diff --git a/acmart.cls b/acmart.cls index b97409f..9890d92 100644 --- a/acmart.cls +++ b/acmart.cls @@ -5,17 +5,17 @@ %% The original source files were: %% %% acmart.dtx (with options: `class') -%% +%% %% IMPORTANT NOTICE: -%% +%% %% For the copyright see the source file. -%% +%% %% Any modified versions of this file must be renamed %% with new filenames distinct from acmart.cls. -%% +%% %% For distribution of the original source see the terms %% for copying and modification in the file acmart.dtx. -%% +%% %% This generated file may be distributed as long as the %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be @@ -35,13 +35,17 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} - \NeedsTeXFormat{LaTeX2e} \ProvidesClass{acmart} -[2016/12/03 v1.25 Typesetting articles for Association of +[2017/07/09 v1.43 Typesetting articles for Association of Computing Machinery] \def\@classname{acmart} +\InputIfFileExists{acmart-preload-hook.tex}{% + \ClassWarning{\@classname}{% + I am loading acmart-preload-hook.tex. You are fully responsible + for any problems from now on.}}{} \RequirePackage{xkeyval} +\RequirePackage{xstring} \define@choicekey*+{acmart.cls}{format}[\ACM@format\ACM@format@nr]{% manuscript, acmsmall, acmlarge, acmtog, sigconf, siggraph, sigplan, sigchi, sigchi-a}[manuscript]{}{% @@ -83,16 +87,14 @@ Computing Machinery] \fi}{\PackageError{\@classname}{Option authorversion can be either true or false}} \ExecuteOptionsX{authorversion=false} -\newif\if@ACM@natbib@override -\@ACM@natbib@overridefalse \define@boolkey+{acmart.cls}[@ACM@]{natbib}[true]{% - \@ACM@natbib@overridetrue \if@ACM@natbib \PackageInfo{\@classname}{Explicitly selecting natbib mode}% \else \PackageInfo{\@classname}{Explicitly deselecting natbib mode}% \fi}{\PackageError{\@classname}{Option natbib can be either true or false}} +\ExecuteOptionsX{natbib=true} \define@boolkey+{acmart.cls}[@ACM@]{anonymous}[true]{% \if@ACM@anonymous \PackageInfo{\@classname}{Using anonymous mode}% @@ -101,6 +103,24 @@ Computing Machinery] \fi}{\PackageError{\@classname}{Option anonymous can be either true or false}} \ExecuteOptionsX{anonymous=false} +\define@boolkey+{acmart.cls}[@ACM@]{timestamp}[true]{% + \if@ACM@timestamp + \PackageInfo{\@classname}{Using timestamp mode}% + \else + \PackageInfo{\@classname}{Not using timestamp mode}% + \fi}{\PackageError{\@classname}{Option timestamp can be either true or + false}} +\ExecuteOptionsX{timestamp=false} +\define@boolkey+{acmart.cls}[@ACM@]{authordraft}[true]{% + \if@ACM@authordraft + \PackageInfo{\@classname}{Using authordraft mode}% + \@ACM@timestamptrue + \@ACM@reviewtrue + \else + \PackageInfo{\@classname}{Not using authordraft mode}% + \fi}{\PackageError{\@classname}{Option authordraft can be either true or + false}} +\ExecuteOptionsX{authordraft=false} \def\ACM@fontsize{} \DeclareOptionX{9pt}{\edef\ACM@fontsize{\CurrentOption}} \DeclareOptionX{10pt}{\edef\ACM@fontsize{\CurrentOption}} @@ -113,6 +133,11 @@ Computing Machinery] \newif\if@ACM@manuscript \newif\if@ACM@journal \newif\if@ACM@sigchiamode +\ifnum\ACM@format@nr=5\relax % siggraph + \ClassWarning{\@classname}{The format `siggraph' is now obsolete. + I am switching to sigconf.} + \setkeys{acmart.cls}{format=sigconf} +\fi \ifnum\ACM@format@nr=0\relax \@ACM@manuscripttrue \else @@ -140,9 +165,6 @@ Computing Machinery] \@ACM@journalfalse \@ACM@sigchiamodetrue \fi -\if@ACM@natbib@override\else - \@ACM@natbibtrue -\fi \ifx\ACM@fontsize\@empty \ifcase\ACM@format@nr \relax % manuscript @@ -158,7 +180,7 @@ Computing Machinery] \or % siggraph \def\ACM@fontsize{9pt}% \or % sigplan - \def\ACM@fontsize{9pt}% + \def\ACM@fontsize{10pt}% \or % sigchi \def\ACM@fontsize{10pt}% \or % sigchi-a @@ -174,6 +196,7 @@ Computing Machinery] \RequirePackage{setspace} \onehalfspacing \fi +\RequirePackage{textcase} \if@ACM@natbib \RequirePackage{natbib} \renewcommand{\bibsection}{% @@ -257,7 +280,7 @@ Computing Machinery] \newcommand{\bibstyle@acmauthoryear}{% \setcitestyle{% authoryear,% - open={(},close={)},citesep={;},% + open={[},close={]},citesep={;},% aysep={},yysep={,},% notesep={, }}} \newcommand{\bibstyle@acmnumeric}{% @@ -265,7 +288,9 @@ Computing Machinery] numbers,sort&compress,% open={[},close={]},citesep={,},% notesep={, }}} +\if@ACM@natbib \citestyle{acmnumeric} +\fi \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -283,6 +308,7 @@ Computing Machinery] {\@ssect{#3}{#4}{#5}{#6}}% {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} \def\@sect#1#2#3#4#5#6[#7]#8{% + \edef\@toclevel{\ifnum#2=\@m 0\else\number#2\fi}% \ifnum #2>\c@secnumdepth \let\@svsec\@empty \else @@ -297,6 +323,9 @@ Computing Machinery] \interlinepenalty \@M #8\@@par}% \endgroup \csname #1mark\endcsname{#7}% + \ifnum #2>\c@secnumdepth \else + \@tochangmeasure{\csname the#1\endcsname}% + \fi \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% @@ -307,6 +336,9 @@ Computing Machinery] #6{\hskip #3\relax \@svsec #8}% \csname #1mark\endcsname{#7}% + \ifnum #2>\c@secnumdepth \else + \@tochangmeasure{\csname the#1\endcsname\space}% + \fi \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% @@ -351,9 +383,31 @@ Computing Machinery] \def\@svsechd{#4{\hskip #1\relax #5}}% \fi \@xsect{#3}} +\def\@starttoc#1#2{\begingroup\makeatletter + \setTrue{#1}% + \par\removelastskip\vskip\z@skip + \@startsection{section}\@M\z@{\linespacing\@plus\linespacing}% + {.5\linespacing}{\centering\contentsnamefont}{#2}% + \@input{\jobname.#1}% + \if@filesw + \@xp\newwrite\csname tf@#1\endcsname + \immediate\@xp\openout\csname tf@#1\endcsname \jobname.#1\relax + \fi + \global\@nobreakfalse \endgroup + \addvspace{32\p@\@plus14\p@}% +} +\def\l@section{\@tocline{1}{0pt}{1pc}{2pc}{}} +\def\l@subsection{\@tocline{2}{0pt}{1pc}{3pc}{}} +\def\l@subsubsection{\@tocline{2}{0pt}{1pc}{5pc}{}} \let\@footnotemark@nolink\@footnotemark \let\@footnotetext@nolink\@footnotetext -\RequirePackage[bookmarksnumbered]{hyperref} +\RequirePackage[bookmarksnumbered,unicode]{hyperref} +\pdfstringdefDisableCommands{% + \def\unskip{}% + \def\textbullet{- }% + \def\textrightarrow{ -> }% + \def\footnotemark{}% +} \urlstyle{rm} \ifcase\ACM@format@nr \relax % manuscript @@ -377,6 +431,7 @@ Computing Machinery] \else \hypersetup{hidelinks} \fi +\RequirePackage{cleveref} \if@ACM@natbib \let\citeN\cite \let\cite\citep @@ -385,14 +440,17 @@ Computing Machinery] \let\citeyearNP\citeyear \let\citeyear\citeyearpar \let\citeNP\citealt - \def\shortcite#1{\citeyear{#1}} \DeclareRobustCommand\citeA {\begingroup\NAT@swafalse \let\NAT@ctype\@ne\NAT@partrue\NAT@fullfalse\NAT@open\NAT@citetp}% \providecommand\newblock{}% \else - \providecommand\citename[1]{#1} + \AtBeginDocument{% + \let\shortcite\cite% + \providecommand\citename[1]{#1}} \fi +\newcommand\shortcite[2][]{% + \ifNAT@numbers\cite[#1]{#2}\else\citeyear[#1]{#2}\fi} \def\bibliographystyle#1{% \ifx\@begindocumenthook\@undefined\else \expandafter\AtBeginDocument @@ -409,54 +467,70 @@ Computing Machinery] \definecolor[named]{ACMGreen}{cmyk}{0.20,0,1,0.19} \definecolor[named]{ACMPurple}{cmyk}{0.55,1,0,0.15} \definecolor[named]{ACMDarkBlue}{cmyk}{1,0.58,0,0.21} +\if@ACM@authordraft + \RequirePackage{draftwatermark} + \SetWatermarkFontSize{0.5in} + \SetWatermarkColor[gray]{.9} + \SetWatermarkText{\parbox{12em}{\centering + Unpublished working draft\\ + Not for distribution}} +\fi \RequirePackage{geometry} \ifcase\ACM@format@nr \relax % manuscript - \geometry{letterpaper,head=1pc}% + \geometry{letterpaper,head=13pt, + marginparwidth=6pc,heightrounded}% \or % acmsmall \geometry{twoside=true, - includeheadfoot, head=1pc, foot=2pc, + includeheadfoot, head=13pt, foot=2pc, paperwidth=6.75in, paperheight=10in, - top=58pt, bottom=44pt, inner=46pt, outer=46pt + top=58pt, bottom=44pt, inner=46pt, outer=46pt, + marginparwidth=2pc,heightrounded }% \or % acmlarge - \geometry{twoside=true, head=1pc, foot=2pc, + \geometry{twoside=true, head=13pt, foot=2pc, paperwidth=8.5in, paperheight=11in, includeheadfoot, - top=78pt, bottom=114pt, inner=81pt, outer=81pt + top=78pt, bottom=114pt, inner=81pt, outer=81pt, + marginparwidth=4pc,heightrounded }% \or % acmtog - \geometry{twoside=true, head=1pc, foot=2pc, + \geometry{twoside=true, head=13pt, foot=2pc, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=24pt, - top=52pt, bottom=75pt, inner=52pt, outer=52pt + top=52pt, bottom=75pt, inner=52pt, outer=52pt, + marginparwidth=2pc,heightrounded }% \or % sigconf - \geometry{twoside=true, head=1pc, + \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, - top=57pt, bottom=73pt, inner=54pt, outer=54pt + top=57pt, bottom=73pt, inner=54pt, outer=54pt, + marginparwidth=2pc,heightrounded }% \or % siggraph - \geometry{twoside=true, head=1pc, + \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, - top=57pt, bottom=73pt, inner=54pt, outer=54pt + top=57pt, bottom=73pt, inner=54pt, outer=54pt, + marginparwidth=2pc,heightrounded }% \or % sigplan - \geometry{twoside=true, head=1pc, + \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot=false, columnsep=2pc, - top=1in, bottom=1in, inner=0.75in, outer=0.75in + top=1in, bottom=1in, inner=0.75in, outer=0.75in, + marginparwidth=2pc,heightrounded }% \or % sigchi - \geometry{twoside=true, head=1pc, + \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, - top=66pt, bottom=73pt, inner=54pt, outer=54pt + top=66pt, bottom=73pt, inner=54pt, outer=54pt, + marginparwidth=2pc,heightrounded }% \or % sigchi-a - \geometry{twoside=false, head=1pc, + \geometry{twoside=false, head=13pt, paperwidth=11in, paperheight=8.5in, includeheadfoot, marginparsep=72pt, marginparwidth=170pt, columnsep=20pt, @@ -479,6 +553,7 @@ Computing Machinery] \or % sigchi \or % sigchi-a \fi +\setlength\normalparindent{\parindent} \def\copyrightpermissionfootnoterule{\kern-3\p@ \hrule \@width \columnwidth \kern 2.6\p@} \RequirePackage{manyfoot} @@ -524,6 +599,21 @@ Computing Machinery] \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% \color@endgroup}} \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}} +\def\@textbottom{\vskip \z@ \@plus 1pt} +\let\@texttop\relax +\RequirePackage{iftex} +\ifPDFTeX +\input{glyphtounicode} +\pdfglyphtounicode{f_f}{FB00} +\pdfglyphtounicode{f_f_i}{FB03} +\pdfglyphtounicode{f_f_l}{FB04} +\pdfglyphtounicode{f_i}{FB01} +\pdfglyphtounicode{t_t}{00740074} +\pdfglyphtounicode{f_t}{00660074} +\pdfglyphtounicode{T_h}{00540068} +\pdfgentounicode=1 +\fi +\RequirePackage{cmap} \newif\if@ACM@newfonts \@ACM@newfontstrue \IfFileExists{libertine.sty}{}{\ClassWarning{\@classname}{You do not @@ -535,11 +625,10 @@ Computing Machinery] have newtxmath package installed. Please upgrade your TeX}\@ACM@newfontsfalse} \if@ACM@newfonts -\RequirePackage[tt=false]{libertine} +\RequirePackage[tt=false, type1=true]{libertine} \RequirePackage[varqu]{zi4} \RequirePackage[libertine]{newtxmath} -\else -\RequirePackage{textcomp} +\RequirePackage[T1]{fontenc} \fi \if@ACM@sigchiamode \renewcommand{\familydefault}{\sfdefault} @@ -620,10 +709,50 @@ Computing Machinery] \or % sigchi \or % sigchi-a \fi -\renewcommand{\descriptionlabel}[1]{\hspace\labelsep \upshape\bfseries #1} +\newdimen\@ACM@labelwidth +\AtBeginDocument{% + \setlength\labelsep{4pt} + \setlength{\@ACM@labelwidth}{6.5pt} + + %% First-level list: when beginning after the first line of an + %% indented paragraph or ending before an indented paragraph, labels + %% should not hang to the left of the preceding/following text. + \setlength\leftmargini{\z@} + \addtolength\leftmargini{\parindent} + \addtolength\leftmargini{2\labelsep} + \addtolength\leftmargini{\@ACM@labelwidth} + + %% Second-level and higher lists. + \setlength\leftmarginii{\z@} + \addtolength\leftmarginii{0.5\labelsep} + \addtolength\leftmarginii{\@ACM@labelwidth} + \setlength\leftmarginiii{\leftmarginii} + \setlength\leftmarginiv{\leftmarginiii} + \setlength\leftmarginv{\leftmarginiv} + \setlength\leftmarginvi{\leftmarginv} + \@listi} +\newskip\listisep +\listisep\smallskipamount +\def\@listI{\leftmargin\leftmargini + \labelwidth\leftmargini \advance\labelwidth-\labelsep + \listparindent\z@ + \topsep\listisep} +\let\@listi\@listI +\def\@listii{\leftmargin\leftmarginii + \labelwidth\leftmarginii \advance\labelwidth-\labelsep + \topsep\z@skip} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii \advance\labelwidth-\labelsep} +\def\@listiv{\leftmargin\leftmarginiv + \labelwidth\leftmarginiv \advance\labelwidth-\labelsep} +\def\@listv{\leftmargin\leftmarginv + \labelwidth\leftmarginv \advance\labelwidth-\labelsep} +\def\@listvi{\leftmargin\leftmarginvi + \labelwidth\leftmarginvi \advance\labelwidth-\labelsep} +\renewcommand{\descriptionlabel}[1]{\upshape\bfseries #1} \renewenvironment{description}{\list{}{% - \itemindent-12\p@ - \labelwidth\z@ \let\makelabel\descriptionlabel}% + \labelwidth\@ACM@labelwidth + \let\makelabel\descriptionlabel}% }{ \endlist } @@ -638,7 +767,9 @@ Computing Machinery] JERIC,% JETC,% JOCCH,% + PACMHCI,% PACMPL,% + POMACS,% TAAS,% TACCESS,% TACO,% @@ -689,9 +820,9 @@ Computing Machinery] \def\@journalNameShort{ACM Comput. Surv.}% \def\@permissionCodeOne{0360-0300}% \or % IMWUT - \def\@journalName{PACM on Interactive, Mobile, Wearable and - Ubiquitous Technologies}% - \def\@journalNameShort{PACM Interact. Mob. Wearable Ubiquitous Technol.}% + \def\@journalName{Proceedings of the ACM on Interactive, Mobile, + Wearable and Ubiquitous Technologies}% + \def\@journalNameShort{Proc. ACM Interact. Mob. Wearable Ubiquitous Technol.}% \def\@permissionCodeOne{2474-9567}% \or % JACM \def\@journalName{Journal of the ACM}% @@ -716,10 +847,18 @@ Computing Machinery] \or % JOCCH \def\@journalName{ACM Journal on Computing and Cultural Heritage}% \def\@journalName{ACM J. Comput. Cult. Herit.}% +\or % PACMHCI + \def\@journalName{Proceedings of the ACM on Human-Computer Interaction}% + \def\@journalName{Proc. ACM Hum.-Comput. Interact.}% + \def\@permissionCodeOne{2573-0142}% \or % PACMPL - \def\@journalName{PACM on Programming Languages}% - \def\@journalName{PACM Progr. Lang.}% + \def\@journalName{Proceedings of the ACM on Programming Languages}% + \def\@journalName{Proc. ACM Program. Lang.}% \def\@permissionCodeOne{2475-1421}% +\or % POMACS + \def\@journalName{Proceedings of the ACM on Measurement and Analysis of Computing Systems}% + \def\@journalName{Proc. ACM Meas. Anal. Comput. Syst.}% + \def\@permissionCodeOne{2476-1249}% \or % TAAS \def\@journalName{ACM Transactions on Autonomous and Adaptive Systems}% \def\@journalNameShort{ACM Trans. Autonom. Adapt. Syst.}% @@ -940,11 +1079,25 @@ Computing Machinery] \if@ACM@anonymous\else \g@addto@macro\addresses{\affiliation{#1}{#2}}% \fi} +\define@boolkey+{@ACM@affiliation@}[@ACM@affiliation@]{obeypunctuation}% +[true]{}{\ClassError{\@classname}{obeypunctuation must be true or false}} +\def\additionalaffiliation#1{\authornote{\@additionalaffiliation{#1}}} +\def\@additionalaffiliation#1{\bgroup + \def\position##1{\ignorespaces}% + \def\institution##1{##1\ignorespaces}% + \def\department{\@ifnextchar[{\@department}{\@department[]}}% + \def\@department[##1]##2{\unskip, ##2\ignorespaces}% + \let\streetaddress\position + \let\city\position + \let\state\position + \let\postcode\position + \let\country\position + Also with #1\unskip.\egroup} \renewcommand{\email}[2][]{% \if@ACM@anonymous\else \g@addto@macro\addresses{\email{#1}{#2}}% \fi} -\let\orcid\@gobble +\def\orcid#1{\unskip\ignorespaces} \def\@titlenotes{} \def\titlenote#1{% \g@addto@macro\@title{\footnotemark}% @@ -967,10 +1120,16 @@ Computing Machinery] \def\@authornotes{} \def\authornote#1{% \if@ACM@anonymous\else - \g@addto@macro\addresses{\@authornotemark} + \g@addto@macro\addresses{\@authornotemark}% \g@addto@macro\@authornotes{% \stepcounter{footnote}\footnotetext{#1}}% \fi} +\newcommand\authornotemark[1][\relax]{% + \ifx#1\relax\relax\relax + \g@addto@macro\addresses{\@authornotemark}% + \else + \g@addto@macro\addresses{\@@authornotemark{#1}}% + \fi} \def\acmVolume#1{\def\@acmVolume{#1}} \acmVolume{1} \def\acmNumber#1{\def\@acmNumber{#1}} @@ -980,15 +1139,17 @@ Computing Machinery] \def\acmArticleSeq#1{\def\@acmArticleSeq{#1}} \acmArticleSeq{\@acmArticle} \def\acmYear#1{\def\@acmYear{#1}} -\acmYear{2016} +\acmYear{\the\year} \def\acmMonth#1{\def\@acmMonth{#1}} -\acmMonth{1} +\acmMonth{\the\month} \def\@acmPubDate{\ifcase\@acmMonth\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi~\@acmYear} \def\acmPrice#1{\def\@acmPrice{#1}} \acmPrice{15.00} +\def\acmSubmissionID#1{\def\@acmSubmissionID{#1}} +\acmSubmissionID{} \def\acmISBN#1{\def\@acmISBN{#1}} \acmISBN{978-x-xxxx-xxxx-x/YY/MM} \def\acmDOI#1{\def\@acmDOI{#1}} @@ -1012,20 +1173,20 @@ Computing Machinery] \def\@acmBadgeL@image{} \def\startPage#1{\def\@startPage{#1}} \startPage{} -\def\terms#1{\def\@terms{#1}} -\terms{} +\def\terms#1{\ClassWarning{\@classname}{The command \string\terms{} is + obsolete. I am going to ignore it}} \def\keywords#1{\def\@keywords{#1}} \keywords{} \renewenvironment{abstract}{\Collect@Body\@saveabstract}{} \long\def\@saveabstract#1{\long\gdef\@abstract{#1}} \@saveabstract{} \long\def\@lempty{} -\define@boolkey+{@ACM@topmatter@}[@ACM@]{printcss}[true]{% - \if@ACM@printcss - \ClassInfo{\@classname}{Printing CSS}% +\define@boolkey+{@ACM@topmatter@}[@ACM@]{printccs}[true]{% + \if@ACM@printccs + \ClassInfo{\@classname}{Printing CCS}% \else - \ClassInfo{\@classname}{Suppressing CSS}% - \fi}{\ClassError{\@classname}{printcss must be true or false}} + \ClassInfo{\@classname}{Suppressing CCS}% + \fi}{\ClassError{\@classname}{printccs must be true or false}} \define@boolkey+{@ACM@topmatter@}[@ACM@]{printacmref}[true]{% \if@ACM@printacmref \ClassInfo{\@classname}{Printing bibformat}% @@ -1038,8 +1199,12 @@ Computing Machinery] \else \ClassInfo{\@classname}{Suppressing folios}% \fi}{\ClassError{\@classname}{printfolios must be true or false}} +\define@cmdkey{@ACM@topmatter@}[@ACM@]{authorsperrow}[0]{% + \IfInteger{#1}{\ClassInfo{\@classname}{Setting authorsperrow to + #1}}{\ClassWarning{\@classname}{Parameter authorsperrow must be + numerical. Ignoring the input #1}\gdef\@ACM@authorsperrow{0}}} \def\settopmatter#1{\setkeys{@ACM@topmatter@}{#1}} -\settopmatter{printcss=true, printacmref=true} +\settopmatter{printccs=true, printacmref=true} \if@ACM@manuscript \settopmatter{printfolios=true} \else @@ -1049,6 +1214,7 @@ Computing Machinery] \settopmatter{printfolios=false} \fi \fi +\settopmatter{authorsperrow=0} \def\@received{} \newcommand\received[2][]{\def\@tempa{#1}% \ifx\@tempa\@empty @@ -1072,15 +1238,28 @@ Computing Machinery] \excludecomment{CCSXML} \let\@concepts\@empty \newcommand\ccsdesc[2][100]{% - \ccsdesc@parse#1~#2~} + \ccsdesc@parse#1~#2~~\ccsdesc@parse@end} +\RequirePackage{textcomp} \def\ccsdesc@parse#1~#2~#3~{% - \expandafter\ifx\csname CCS@#2\endcsname\relax - \expandafter\gdef\csname CCS@#2\endcsname{\textbullet\textbf{#2} $\to$ }% - \g@addto@macro{\@concepts}{\csname CCS@#2\endcsname}\fi - \expandafter\g@addto@macro\expandafter{\csname CCS@#2\endcsname}{% - \ifnum#1>499\textbf{#3; }\else - \ifnum#1>299\textit{#3; }\else - #3; \fi\fi}} + \expandafter\ifx\csname CCS@General@#2\endcsname\relax + \expandafter\gdef\csname CCS@General@#2\endcsname{\textbullet\ + \textbf{#2}}% + \expandafter\gdef\csname CCS@Punctuation@#2\endcsname{; }% + \expandafter\gdef\csname CCS@Specific@#2\endcsname{}% + \g@addto@macro{\@concepts}{\csname CCS@General@#2\endcsname + \csname CCS@Punctuation@#2\endcsname + \csname CCS@Specific@#2\endcsname}% + \fi + \ifx#3\relax\relax\else + \expandafter\gdef\csname CCS@Punctuation@#2\endcsname{ + \textrightarrow\ }% + \expandafter\g@addto@macro\expandafter{\csname CCS@Specific@#2\endcsname}{% + \ifnum#1>499\textbf{#3}; \else + \ifnum#1>299\textit{#3}; \else + #3; \fi\fi}% + \fi +\ccsdesc@parse@finish} +\def\ccsdesc@parse@finish#1\ccsdesc@parse@end{} \newif\if@printcopyright \@printcopyrighttrue \newif\if@printpermission @@ -1088,9 +1267,11 @@ Computing Machinery] \newif\if@acmowned \@acmownedtrue \define@choicekey*{ACM@}{acmcopyrightmode}[% - \acm@copyrightinput\acm@copyrightmode]{none,acmcopyright,acmlicensed,% - rightsretained,usgov,usgovmixed,cagov,cagovmixed,% - licensedusgovmixed,licensedcagovmixed,othergov,licensedothergov}{% + \acm@copyrightinput\acm@copyrightmode]{none,% + acmcopyright,acmlicensed,rightsretained,% + usgov,usgovmixed,cagov,cagovmixed,% + licensedusgovmixed,% + licensedcagov,licensedcagovmixed,othergov,licensedothergov}{% \@printpermissiontrue \@printcopyrighttrue \@acmownedtrue @@ -1104,11 +1285,13 @@ Computing Machinery] \fi \ifnum\acm@copyrightmode=3\relax % rightsretained \@acmownedfalse + \acmPrice{}% \fi \ifnum\acm@copyrightmode=4\relax % usgov \@printpermissiontrue \@printcopyrightfalse \@acmownedfalse + \acmPrice{}% \fi \ifnum\acm@copyrightmode=6\relax % cagov \@acmownedfalse @@ -1116,13 +1299,16 @@ Computing Machinery] \ifnum\acm@copyrightmode=8\relax % licensedusgovmixed \@acmownedfalse \fi - \ifnum\acm@copyrightmode=9\relax % licensedcagovmixed + \ifnum\acm@copyrightmode=9\relax % licensedcagov + \@acmownedfalse + \fi + \ifnum\acm@copyrightmode=10\relax % licensedcagovmixed \@acmownedfalse \fi - \ifnum\acm@copyrightmode=10\relax % othergov + \ifnum\acm@copyrightmode=11\relax % othergov \@acmownedtrue \fi - \ifnum\acm@copyrightmode=11\relax % licensedothergov + \ifnum\acm@copyrightmode=12\relax % licensedothergov \@acmownedfalse \fi} \def\setcopyright#1{\setkeys{ACM@}{acmcopyrightmode=#1}} @@ -1130,32 +1316,35 @@ Computing Machinery] \def\@copyrightowner{% \ifcase\acm@copyrightmode\relax % none \or % acmcopyright - ACM\@. + Association for Computing Machinery. \or % acmlicensed Copyright held by the owner/author(s). Publication rights licensed to - ACM\@. + Association for Computing Machinery. \or % rightsretained Copyright held by the owner/author(s). \or % usgov \or % usgovmixed - ACM\@. + Association for Computing Machinery. \or % cagov Crown in Right of Canada. \or %cagovmixed - ACM\@. + Association for Computing Machinery. \or %licensedusgovmixed Copyright held by the owner/author(s). Publication rights licensed to - ACM\@. + Association for Computing Machinery. + \or % licensedcagov + Crown in Right of Canada. Publication rights licensed to + Association for Computing Machinery. \or %licensedcagovmixed Copyright held by the owner/author(s). Publication rights licensed to - ACM\@. + Association for Computing Machinery. \or % othergov - ACM\@. + Association for Computing Machinery. \or % licensedothergov Copyright held by the owner/author(s). Publication rights licensed to - ACM\@. + Association for Computing Machinery. \fi} -\def\@formatdoi#1{\url{http://dx.doi.org/#1}} +\def\@formatdoi#1{\url{https://doi.org/#1}} \def\@copyrightpermission{% \ifcase\acm@copyrightmode\relax % none \or % acmcopyright @@ -1196,16 +1385,10 @@ Computing Machinery] source. \or % usgovmixed ACM acknowledges that this contribution was authored or co-authored - by an employee, or contractor of the national government. As such, - the Government retains a nonexclusive, royalty-free right to + by an employee, contractor, or affiliate of the United States government. As such, + the United States government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for - Government purposes only. Permission to make digital or hard copies - for personal or classroom use is granted. Copies must bear this - notice and the full citation on the first page. Copyrights for - components of this work owned by others than ACM must be - honored. To copy otherwise, distribute, republish, or post, - requires prior specific permission and\hspace*{.5pt}/or a - fee. Request permissions from permissions@acm.org. + government purposes only. \or % cagov This article was authored by employees of the Government of Canada. As such, the Canadian government retains all interest in the @@ -1216,7 +1399,7 @@ Computing Machinery] Permission to make digital or hard copies for personal or classroom use is granted. Copies must bear this notice and the full citation on the first page. Copyrights for components of this work owned by - others than the Canadain Government must be honored. To copy + others than the Canadian Government must be honored. To copy otherwise, distribute, republish, or post, requires prior specific permission and\hspace*{.5pt}/or a fee. Request permissions from permissions@acm.org. @@ -1239,6 +1422,20 @@ Computing Machinery] Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only. + \or % licensedcagov + This article was authored by employees of the Government of Canada. + As such, the Canadian government retains all interest in the + copyright to this work and grants to ACM a nonexclusive, + royalty-free right to publish or reproduce this article, or to allow + others to do so, provided that clear attribution is given both to + the authors and the Canadian government agency employing them. + Permission to make digital or hard copies for personal or classroom + use is granted. Copies must bear this notice and the full citation + on the first page. Copyrights for components of this work owned by + others than the Canadian Government must be honored. To copy + otherwise, distribute, republish, or post, requires prior specific + permission and\hspace*{.5pt}/or a fee. Request permissions from + permissions@acm.org. \or % licensedcagovmixed Publication rights licensed to ACM\@. ACM acknowledges that this contribution was authored or co-authored by an employee, contractor @@ -1282,8 +1479,9 @@ Computing Machinery] \let\@footnotemark\@footnotemark@nolink \let\@footnotetext\@footnotetext@nolink \renewcommand\thefootnote{\@fnsymbol\c@footnote}% - \@topnum\z@ % this prevents figures from falling at the top of page - % 1 + \global\@topnum\z@ % this prevents floats from falling + % at the top of page 1 + \global\@botnum\z@ % we do not want them to be on bottom either \hsize=\textwidth \def\@makefnmark{\hbox{\@textsuperscript{\@thefnmark}}}% \@mktitle\if@ACM@sigchiamode\else\@mkauthors\fi\@mkteasers @@ -1300,62 +1498,65 @@ Computing Machinery] \footnotetextcopyrightpermission{% \def\par{\let\par\@par}\parindent\z@\@setthanks}% \fi - \footnotetextcopyrightpermission{\parindent\z@\parskip0.1\baselineskip - \if@ACM@authorversion\else - \if@printpermission\@copyrightpermission\par\fi - \fi - \if@ACM@manuscript\else - \if@ACM@journal\else % Print the conference short name - {\itshape \acmConference@shortname, \acmConference@venue}\par + \footnotetextcopyrightpermission{% + \if@ACM@authordraft + \raisebox{-2ex}[\z@][\z@]{\makebox[0pt][l]{\large\bfseries + Unpublished + working draft. Not for distribution}}% + \color[gray]{0.9}% \fi - \fi - \if@printcopyright - \copyright\ \@copyrightyear\ \@copyrightowner\ - \else - \@copyrightyear.\ - \fi - \if@ACM@manuscript - Manuscript submitted to ACM\\ - \else - \if@ACM@authorversion - This is the author's version of the work. It is posted here for - your personal use. Not for redistribution. The definitive Version - of Record was published in - \if@ACM@journal - \emph{\@journalName}% - \else - \emph{Proceedings of \acmConference@name, \acmConference@date}% - \fi - \ifx\@acmDOI\@empty - . + \parindent\z@\parskip0.1\baselineskip + \if@ACM@authorversion\else + \if@printpermission\@copyrightpermission\par\fi + \fi + \if@ACM@manuscript\else + \if@ACM@journal\else % Print the conference information + {\itshape \acmConference@shortname, \acmConference@date, \acmConference@venue}\par + \fi + \fi + \if@printcopyright + \copyright\ \@copyrightyear\ \@copyrightowner\\ + \else + \@copyrightyear.\ + \fi + \if@ACM@manuscript + Manuscript submitted to ACM\\ + \else + \if@ACM@authorversion + This is the author's version of the work. It is posted here for + your personal use. Not for redistribution. The definitive Version + of Record was published in + \if@ACM@journal + \emph{\@journalName}% + \else + \emph{Proceedings of \acmConference@name, \acmConference@date}% + \fi + \ifx\@acmDOI\@empty + . + \else + , \@formatdoi{\@acmDOI}. + \fi\\ \else - , \@formatdoi{\@acmDOI}. - \fi\\ - \else - \if@ACM@journal - \@permissionCodeOne/\@acmYear/\@acmMonth-ART\@acmArticle\ - \$\@acmPrice\\ - DOI: \nolinkurl{\@acmDOI}% - \else % Conference - \@acmISBN - \ifx\@acmPrice\@empty.\else\dots\$\@acmPrice\fi\\ - DOI: \nolinkurl{\@acmDOI}% + \if@ACM@journal + \@permissionCodeOne/\@acmYear/\@acmMonth-ART\@acmArticle + \ifx\@acmPrice\@empty\else\ \$\@acmPrice\fi\\ + \@formatdoi{\@acmDOI}% + \else % Conference + ACM~ISBN~\@acmISBN + \ifx\@acmPrice\@empty.\else\dots\$\@acmPrice\fi\\ + \@formatdoi{\@acmDOI}% + \fi \fi - \fi - \fi}% + \fi} \endgroup \setcounter{footnote}{0}% \@mkabstract - \if@ACM@printcss + \if@ACM@printccs \ifx\@concepts\@empty\else\bgroup {\@specialsection{CCS Concepts}% \@concepts\par}\egroup \fi \fi - \if\@terms\@empty\else\bgroup - {\@specialsection{General Terms}% - \@terms\par}\egroup - \fi \ifx\@keywords\@empty\else\bgroup {\if@ACM@journal \@specialsection{Additional Key Words and Phrases}% @@ -1372,7 +1573,9 @@ Computing Machinery] \@mkbibcitation \fi \hypersetup{pdfauthor={\authors}, - pdftitle={\@title}, pdfkeywords={\@concepts}}% + pdftitle={\@title}, + pdfsubject={\@concepts}, + pdfkeywords={\@keywords}}% \@printendtopmatter \@afterindentfalse \@afterheading @@ -1485,7 +1688,7 @@ Computing Machinery] \or % sigchi-a \Huge\bfseries \fi} -\def\@subtitlefont{% +\def\@subtitlefont{\normalsize \ifcase\ACM@format@nr \relax % manuscript \mdseries @@ -1573,27 +1776,27 @@ Computing Machinery] \newbox\@ACM@commabox \def\@ACM@addtoaddress#1{% \ifvmode\else + \if@ACM@affiliation@obeypunctuation\else \setbox\@ACM@commabox=\hbox{, }% \unskip\cleaders\copy\@ACM@commabox\hskip\wd\@ACM@commabox - \fi + \fi\fi #1} +\def\streetaddress#1{\unskip\ignorespaces} +\def\postcode#1{\unskip\ignorespaces} \if@ACM@journal - \let\position\@gobble - \def\institution#1{#1\ignorespaces}% - \let\department\@gobble - \let\streetaddress\@gobble - \let\city\@gobble - \let\state\@gobble - \let\postcode\@gobble - \let\country\@gobble + \def\position#1{\unskip\ignorespaces} + \def\institution#1{#1\ignorespaces} + \def\city#1{\unskip\ignorespaces} + \def\state#1{\unskip\ignorespaces} + \newcommand\department[2][0]{} + \def\country#1{\if@ACM@affiliation@obeypunctuation\else, \fi#1\ignorespaces} \else - \def\position#1{#1\par}% - \def\institution#1{#1\par}% - \def\department#1{#1\par}% - \def\streetaddress#1{#1\par}% + \def\position#1{\if@ACM@affiliation@obeypunctuation#1\else#1\par\fi}% + \def\institution#1{\if@ACM@affiliation@obeypunctuation#1\else#1\par\fi}% + \newcommand\department[2][0]{\if@ACM@affiliation@obeypunctuation + #2\else#2\par\fi}% \let\city\@ACM@addtoaddress \let\state\@ACM@addtoaddress - \def\postcode#1{\unskip\space#1}% \let\country\@ACM@addtoaddress \fi \def\@mkauthors{\begingroup @@ -1661,21 +1864,26 @@ Computing Machinery] \global\let\and\@typeset@author@line \def\@author##1{% \ifx\@currentauthors\@empty - \gdef\@currentauthors{\@authorfont\MakeUppercase{##1}}% + \gdef\@currentauthors{\@authorfont\MakeTextUppercase{##1}}% \else - \g@addto@macro{\@currentauthors}{\and\MakeUppercase{##1}}% + \g@addto@macro{\@currentauthors}{\and\MakeTextUppercase{##1}}% \fi \gdef\and{}}% \def\email##1##2{}% \def\affiliation##1##2{% \def\@tempa{##2}\ifx\@tempa\@empty\else \ifx\@currentaffiliations\@empty - \gdef\@currentaffiliations{\@affiliationfont##2}% + \gdef\@currentaffiliations{% + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}% + \@affiliationfont##2}% \else - \g@addto@macro{\@currentaffiliations}{\and##2}% + \g@addto@macro{\@currentaffiliations}{\and + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}##2}% \fi \fi - \global\let\and\@typeset@author@line} + \global\let\and\@typeset@author@line}% \global\setbox\mktitle@bx=\vbox{\noindent\box\mktitle@bx\par\medskip \noindent\addresses\@typeset@author@line \par\medskip}% @@ -1694,17 +1902,21 @@ Computing Machinery] \def\@mkauthors@iii{% \author@bx@wd=\textwidth\relax \advance\author@bx@wd by -\author@bx@sep\relax - \ifcase\num@authorgroups - \relax % 0? - \or % 1=one author per row - \or % 2=two authors per row - \divide\author@bx@wd by \num@authorgroups\relax - \or % 3=three authors per row - \divide\author@bx@wd by \num@authorgroups\relax - \or % 4=two authors per row (!) - \divide\author@bx@wd by 2\relax - \else % three authors per row - \divide\author@bx@wd by 3\relax + \ifnum\@ACM@authorsperrow>0\relax + \divide\author@bx@wd by \@ACM@authorsperrow\relax + \else + \ifcase\num@authorgroups + \relax % 0? + \or % 1=one author per row + \or % 2=two authors per row + \divide\author@bx@wd by \num@authorgroups\relax + \or % 3=three authors per row + \divide\author@bx@wd by \num@authorgroups\relax + \or % 4=two authors per row (!) + \divide\author@bx@wd by 2\relax + \else % three authors per row + \divide\author@bx@wd by 3\relax + \fi \fi \advance\author@bx@wd by -\author@bx@sep\relax \gdef\@currentauthors{}% @@ -1721,9 +1933,13 @@ Computing Machinery] \g@addto@macro\@currentaffiliation{\par\nolinkurl{##2}}% \fi}% \def\affiliation##1##2{\ifx\@currentaffiliation\@empty - \gdef\@currentaffiliation{##2}% + \gdef\@currentaffiliation{% + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}##2}% \else - \g@addto@macro\@currentaffiliation{\par##2}% + \g@addto@macro\@currentaffiliation{\par + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}##2}% \fi \global\let\and\@typeset@author@bx }% @@ -1735,11 +1951,15 @@ Computing Machinery] \def\@mkauthors@iv{% \author@bx@wd=\columnwidth\relax \advance\author@bx@wd by -\author@bx@sep\relax - \ifcase\num@authorgroups - \relax % 0? - \or % 1=one author per row - \else % 2=two authors per row - \divide\author@bx@wd by 2\relax + \ifnum\@ACM@authorsperrow>0\relax + \divide\author@bx@wd by \@ACM@authorsperrow\relax + \else + \ifcase\num@authorgroups + \relax % 0? + \or % 1=one author per row + \else % 2=two authors per row + \divide\author@bx@wd by 2\relax + \fi \fi \advance\author@bx@wd by -\author@bx@sep\relax \gdef\@currentauthors{}% @@ -1756,16 +1976,21 @@ Computing Machinery] \g@addto@macro\@currentaffiliation{\par\nolinkurl{##2}}% \fi}% \def\affiliation##1##2{\ifx\@currentaffiliation\@empty - \gdef\@currentaffiliation{##2}% + \gdef\@currentaffiliation{% + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}##2}% \else - \g@addto@macro\@currentaffiliation{\par##2}% + \g@addto@macro\@currentaffiliation{\par + \setkeys{@ACM@affiliation@}{obeypunctuation=false}% + \setkeys{@ACM@affiliation@}{##1}##2}% \fi \global\let\and\@typeset@author@bx}% \bgroup\hsize=\columnwidth \par\raggedright\leftskip=\z@ \lineskip=1pc\noindent \addresses\let\and\@typeset@author@bx\and\par\bigskip\egroup} -\def\@authornotemark{\g@addto@macro\@currentauthors{\footnotemark}} +\def\@authornotemark{\g@addto@macro\@currentauthors{\footnotemark\relax}} +\def\@@authornotemark#1{\g@addto@macro\@currentauthors{\footnotemark[#1]}} \def\@mkteasers{% \ifx\@teaserfigures\@empty\else \def\@teaser##1{\par\bigskip\bgroup @@ -1776,17 +2001,21 @@ Computing Machinery] \def\@setaddresses{} \def\@mkabstract{\bgroup \ifx\@abstract\@lempty\else - {\if@ACM@journal + {\phantomsection\addcontentsline{toc}{section}{Abstract}% + \if@ACM@journal \small\noindent \else \section*{Abstract}% \fi - \phantomsection\addcontentsline{toc}{section}{Abstract}% \ignorespaces\@abstract\par}% \fi\egroup} \def\@mkbibcitation{\bgroup \def\footnotemark{}% - \par\medskip\small\noindent{\bfseries ACM Reference format:}\par\nobreak + \def\\{\unskip{} \ignorespaces}% + \def\footnote{\ClassError{\@classname}{Please do note use footnotes + inside \string\title{} or \string\author{} command! Use + \string\titlenote{} or \string\authornote{} instead!}}% + \par\medskip\small\noindent{\bfseries ACM Reference Format:}\par\nobreak \noindent\authors. \@acmYear. \@title. \if@ACM@journal \textit{\@journalNameShort} @@ -1799,7 +2028,7 @@ Computing Machinery] \ (\acmConference@shortname)\fi ,} \ref{TotPages}~pages. \fi\par - \noindent DOI: \nolinkurl{\@acmDOI} + \noindent\@formatdoi{\@acmDOI} \par\egroup} \def\@printendtopmatter{\par\medskip \ifcase\ACM@format@nr @@ -1826,20 +2055,48 @@ Computing Machinery] \RequirePackage{fancyhdr} \if@ACM@review \newsavebox{\ACM@linecount@bx} - \savebox{\ACM@linecount@bx}[4em][t]{\parbox[t]{4em}{% - \newlength\ACM@linecount@bxht\setlength{\ACM@linecount@bxht}{-\baselineskip} - \@tempcnta\@ne\relax - \loop{\color{ACMRed}\scriptsize\the\@tempcnta}\\ - \advance\@tempcnta by \@ne - \addtolength{\ACM@linecount@bxht}{\baselineskip} - \ifdim\ACM@linecount@bxht<\textheight\repeat}} + \newlength\ACM@linecount@bxht + \newcount\ACM@linecount + \ACM@linecount\@ne\relax + \def\ACM@mk@linecount{% + \savebox{\ACM@linecount@bx}[4em][t]{\parbox[t]{4em}{% + \setlength{\ACM@linecount@bxht}{-\baselineskip}% + \loop{\color{red}\scriptsize\the\ACM@linecount}\\ + \global\advance\ACM@linecount by \@ne + \addtolength{\ACM@linecount@bxht}{\baselineskip}% + \ifdim\ACM@linecount@bxht<\textheight\repeat}}} \fi -\def\ACM@linecount{% +\def\ACM@linecountL{% \if@ACM@review + \ACM@mk@linecount \begin{picture}(0,0)% \put(-26,-22){\usebox{\ACM@linecount@bx}}% \end{picture}% \fi} +\def\ACM@linecountR{% + \if@ACM@review + \ACM@mk@linecount + \begin{picture}(0,0)% + \put(20,-22){\usebox{\ACM@linecount@bx}}% + \end{picture}% + \fi} +\if@ACM@timestamp + % Subtracting 30 from \time gives us the effect of rounding-down despite + % \numexpr rounding to nearest + \newcounter{ACM@time@hours} + \setcounter{ACM@time@hours}{\numexpr (\time - 30) / 60 \relax} + \newcounter{ACM@time@minutes} + \setcounter{ACM@time@minutes}{\numexpr \time - \theACM@time@hours * 60 \relax} + \newcommand\ACM@timestamp{% + \footnotesize% + \the\year-\two@digits{\the\month}-\two@digits{\the\day}{ }% + \two@digits{\theACM@time@hours}:\two@digits{\theACM@time@minutes}{ }% + page~\thepage\ (pp. \@startPage-\pageref*{TotPages})% + \ifx\@acmSubmissionID\@empty\relax\else + ~Submission~ID: \@acmSubmissionID + \fi + } +\fi \def\@shortauthors{\if@ACM@anonymous Anon.\else\shortauthors\fi} \def\@headfootfont{% \ifcase\ACM@format@nr @@ -1868,46 +2125,50 @@ Computing Machinery] \renewcommand{\footrulewidth}{\z@}% \ifcase\ACM@format@nr \relax % manuscript - \fancyhead[LE]{\ACM@linecount\if@ACM@printfolios\thepage\fi}% + \fancyhead[LE]{\ACM@linecountL\if@ACM@printfolios\thepage\fi}% \fancyhead[RO]{\if@ACM@printfolios\thepage\fi}% \fancyhead[RE]{\@shortauthors}% - \fancyhead[LO]{\ACM@linecount\shorttitle}% + \fancyhead[LO]{\ACM@linecountL\shorttitle}% \fancyfoot[RO,LE]{\footnotesize Manuscript submitted to ACM}% \or % acmsmall - \fancyhead[LE]{\ACM@linecount\@headfootfont\@acmArticle\if@ACM@printfolios:\thepage\fi}% + \fancyhead[LE]{\ACM@linecountL\@headfootfont\@acmArticle\if@ACM@printfolios:\thepage\fi}% \fancyhead[RO]{\@headfootfont\@acmArticle\if@ACM@printfolios:\thepage\fi}% \fancyhead[RE]{\@headfootfont\@shortauthors}% - \fancyhead[LO]{\ACM@linecount\@headfootfont\shorttitle}% + \fancyhead[LO]{\ACM@linecountL\@headfootfont\shorttitle}% \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \or % acmlarge - \fancyhead[LE]{\ACM@linecount\@headfootfont - \@acmArticle:\if@ACM@printfolios\thepage\quad\textbullet\quad\fi\@shortauthors}% - \fancyhead[LO]{\ACM@linecount}% + \fancyhead[LE]{\ACM@linecountL\@headfootfont + \@acmArticle\if@ACM@printfolios:\thepage\fi\quad\textbullet\quad\@shortauthors}% + \fancyhead[LO]{\ACM@linecountL}% \fancyhead[RO]{\@headfootfont \shorttitle\quad\textbullet\quad\@acmArticle\if@ACM@printfolios:\thepage\fi}% \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \or % acmtog - \fancyhead[LE]{\ACM@linecount\@headfootfont - \@acmArticle:\if@ACM@printfolios\thepage\quad\textbullet\quad\fi\@shortauthors}% - \fancyhead[LO]{\ACM@linecount}% + \fancyhead[LE]{\ACM@linecountL\@headfootfont + \@acmArticle\if@ACM@printfolios:\thepage\fi\quad\textbullet\quad\@shortauthors}% + \fancyhead[LO]{\ACM@linecountL}% + \fancyhead[RE]{\ACM@linecountR}% \fancyhead[RO]{\@headfootfont - \shorttitle\quad\textbullet\quad\@acmArticle\if@ACM@printfolios:\thepage\fi}% + \shorttitle\quad\textbullet\quad\@acmArticle\if@ACM@printfolios:\thepage\fi\ACM@linecountR}% \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \else % Proceedings \fancyfoot[C]{\if@ACM@printfolios\footnotesize\thepage\fi}% - \fancyhead[LO]{\ACM@linecount\@headfootfont\shorttitle}% - \fancyhead[RE]{\@headfootfont\@shortauthors}% - \fancyhead[LE]{\ACM@linecount\@headfootfont\acmConference@shortname, + \fancyhead[LO]{\ACM@linecountL\@headfootfont\shorttitle}% + \fancyhead[RE]{\@headfootfont\@shortauthors\ACM@linecountR}% + \fancyhead[LE]{\ACM@linecountL\@headfootfont\acmConference@shortname, \acmConference@date, \acmConference@venue}% \fancyhead[RO]{\@headfootfont\acmConference@shortname, - \acmConference@date, \acmConference@venue}% + \acmConference@date, \acmConference@venue\ACM@linecountR}% \fi \if@ACM@sigchiamode \fancyheadoffset[L]{\dimexpr(\marginparsep+\marginparwidth)}% \fi + \if@ACM@timestamp + \fancyfoot[LO,RE]{\ACM@timestamp} + \fi } \pagestyle{standardpagestyle} \newdimen\@folio@wd @@ -1955,15 +2216,15 @@ Computing Machinery] \renewcommand{\footrulewidth}{\z@}% \ifcase\ACM@format@nr \relax % manuscript - \fancyhead[L]{\ACM@linecount}% + \fancyhead[L]{\ACM@linecountL}% \fancyfoot[RO,LE]{\if@ACM@printfolios\small\thepage\fi}% \fancyfoot[RE,LO]{\footnotesize Manuscript submitted to ACM}% \or % acmsmall \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% - \fancyhead[LE]{\ACM@linecount\@folioblob}% - \fancyhead[LO]{\ACM@linecount}% + \fancyhead[LE]{\ACM@linecountL\@folioblob}% + \fancyhead[LO]{\ACM@linecountL}% \fancyhead[RO]{\@folioblob}% \fancyheadoffset[RO,LE]{0.6\@folio@wd}% \or % acmlarge @@ -1971,18 +2232,28 @@ Computing Machinery] \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \fancyhead[RO]{\@folioblob}% - \fancyhead[LE]{\ACM@linecount\@folioblob}% - \fancyhead[LO]{\ACM@linecount}% + \fancyhead[LE]{\ACM@linecountL\@folioblob}% + \fancyhead[LO]{\ACM@linecountL}% \fancyheadoffset[RO,LE]{1.4\@folio@wd}% \or % acmtog \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% - \fancyhead[L]{\ACM@linecount}% + \fancyhead[L]{\ACM@linecountL}% + \fancyhead[R]{\ACM@linecountR}% \else % Conference proceedings - \fancyhead[L]{\ACM@linecount}% + \fancyhead[L]{\ACM@linecountL}% + \fancyhead[R]{\ACM@linecountR}% \fancyfoot[C]{\if@ACM@printfolios\footnotesize\thepage\fi}% \fi + \if@ACM@timestamp + \ifnum\ACM@format@nr=0\relax % Manuscript + \fancyfoot[LO,RE]{\ACM@timestamp\quad + \footnotesize Manuscript submitted to ACM} + \else + \fancyfoot[LO,RE]{\ACM@timestamp} + \fi + \fi } \renewcommand\section{\@startsection{section}{1}{\z@}% {-.75\baselineskip \@plus -2\p@ \@minus -.2\p@}% @@ -2008,7 +2279,7 @@ Computing Machinery] \rightskip\@rightskip \leftskip\z@skip \parindent\z@} -\def\@secfont{\sffamily\bfseries\section@raggedright\MakeUppercase} +\def\@secfont{\sffamily\bfseries\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\bfseries\section@raggedright} \def\@subsubsecfont{\sffamily\itshape} \def\@parfont{\itshape} @@ -2017,16 +2288,16 @@ Computing Machinery] \relax % manuscript \or % acmsmall \or % acmlarge - \def\@secfont{\sffamily\large\section@raggedright\MakeUppercase} + \def\@secfont{\sffamily\large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\large\section@raggedright} \or % acmtog - \def\@secfont{\sffamily\large\section@raggedright\MakeUppercase} + \def\@secfont{\sffamily\large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\large\section@raggedright} \or % sigconf - \def\@secfont{\bfseries\Large\section@raggedright\MakeUppercase} + \def\@secfont{\bfseries\Large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\bfseries\Large\section@raggedright} \or % siggraph - \def\@secfont{\bfseries\sffamily\Large\section@raggedright\MakeUppercase} + \def\@secfont{\bfseries\sffamily\Large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\bfseries\sffamily\Large\section@raggedright} \or % sigplan \def\@secfont{\bfseries\Large\section@raggedright} @@ -2048,15 +2319,16 @@ Computing Machinery] \def\@subparfont{\itshape} \or % sigchi \setcounter{secnumdepth}{1} - \def\@secfont{\bfseries\sffamily\section@raggedright\MakeUppercase} + \def\@secfont{\bfseries\sffamily\section@raggedright\MakeTextUppercase} \def\@subsecfont{\bfseries\sffamily\section@raggedright} \or % sigchi-a \setcounter{secnumdepth}{0} - \def\@secfont{\bfseries\sffamily\section@raggedright\MakeUppercase} + \def\@secfont{\bfseries\sffamily\section@raggedright\MakeTextUppercase} \def\@subsecfont{\bfseries\sffamily\section@raggedright} \fi \def\@adddotafter#1{#1\@addpunct{.}} \def\@addspaceafter#1{#1\@addpunct{\enspace}} +\providecommand*\@dotsep{4.5} \def\@acmplainbodyfont{\itshape} \def\@acmplainindent{\parindent} \def\@acmplainheadfont{\scshape} @@ -2181,7 +2453,7 @@ Computing Machinery] \ifx\@tempa\@tempb arXiv:\href{http://arxiv.org/abs/#2}{#2}\else arXiv:#2% \fi} -\normalsize\normalfont +\normalsize\normalfont\frenchspacing \endinput %% -%% End of file `acmart.cls'. +%% End of file `acmart.cls'. \ No newline at end of file diff --git a/alga.tex b/alga.tex index 357bf08..35f3191 100644 --- a/alga.tex +++ b/alga.tex @@ -1,5 +1,4 @@ -\documentclass[sigplan,authorversion]{acmart} - +\documentclass[sigplan,screen,9pt]{acmart} \usepackage{booktabs} \usepackage{subcaption} @@ -15,29 +14,31 @@ \makeatletter +%%% The following is specific to Haskell'17 and the paper +%%% 'Algebraic Graphs with Class (Functional Pearl)' +%%% by Andrey Mokhov. +%%% \setcopyright{acmlicensed} +\acmPrice{15.00} \acmDOI{10.1145/3122955.3122956} -\acmISBN{978-1-4503-5182-9/17/09} -\acmConference[Haskell'17]{10th ACM SIGPLAN International Haskell Symposium}{September 7-8, 2017}{Oxford, UK} \acmYear{2017} \copyrightyear{2017} -\acmPrice{15.00} +\acmISBN{978-1-4503-5182-9/17/09} +\acmConference[Haskell'17]{10th ACM SIGPLAN International Haskell Symposium}{September 7-8, 2017}{Oxford, UK} \bibliographystyle{ACM-Reference-Format} \citestyle{acmauthoryear} \begin{document} -\settopmatter{printacmref=false} -\title{Algebraic Graphs with Class\vspace{-1.5mm}} -\subtitle{Functional Pearl} +\title{Algebraic Graphs with Class (Functional Pearl)} \author{Andrey Mokhov} \affiliation{ - \institution{Newcastle University, United Kingdom\vspace{-1mm}} + \institution{Newcastle University, United Kingdom} } \begin{abstract} -% \vspace{-1mm} +\vspace{-0.5mm} The paper presents a minimalistic and elegant approach to working with graphs in Haskell. It is built on a rigorous mathematical foundation --- an algebra of graphs --- that allows us to apply @@ -51,7 +52,7 @@ and transitive graphs, as well as hypergraphs, by appropriately choosing the set of underlying axioms. The flexibility of the approach is demonstrated by developing a library for constructing -and transforming polymorphic graphs. +and transforming polymorphic graphs.\vspace{-1mm} \end{abstract} %% 2012 ACM Computing Classification System (CSS) concepts @@ -59,15 +60,15 @@ \begin{CCSXML} -10002950.10003624.10003633 -Mathematics of computing~Graph theory +10002950 +Mathematics of computing 500 + \end{CCSXML} -\ccsdesc[500]{Mathematics of computing~Graph theory} -%\keywords{\vspace{-2mm}Haskell, algebra, graph theory} -\keywords{Haskell, algebra, graph theory} +\ccsdesc[500]{Mathematics of computing} +\keywords{\vspace{-2mm}Haskell, algebra, graph theory} \maketitle diff --git a/algebra.tex b/algebra.tex index 72e9865..4659181 100644 --- a/algebra.tex +++ b/algebra.tex @@ -10,10 +10,11 @@ \caption{Decomposition: $1 \rightarrow 2 \rightarrow 3 = 1 \rightarrow 2 + 1 \rightarrow 3 + 2 \rightarrow 3$} \end{subfigure} +\vspace{-1mm} \caption{Two axioms of the algebra of graphs.\label{fig-axioms}} \end{figure*} -\section{Algebraic structure}\label{sec-algebra} +\section{Algebraic Structure}\label{sec-algebra} The functions \hs{edge}, \hs{vertices} and \hs{clique} defined in the previous section \S\ref{sec-core} satisfy a few properties that we can intuitively write down @@ -38,7 +39,7 @@ \section{Algebraic structure}\label{sec-algebra} generally useful for formal verification, as well as automated testing of graph library APIs. -\subsection{Axiomatic characterisation}\label{sub-laws} +\subsection{Axiomatic Characterisation}\label{sub-laws} The definitions of \hs{vertices} and \hs{clique} in \S\ref{sub-class} use $\varepsilon$ as the identity for both overlay $+$ and connect $\rightarrow$ @@ -161,7 +162,7 @@ \subsection{Axiomatic characterisation}\label{sub-laws} \caption{Equational reasoning with algebraic graphs.\label{fig-proof}} \end{figure*} -\subsection{Partial order on graphs}\label{sub-partial-order} +\subsection{Partial Order on Graphs}\label{sub-partial-order} It is fairly standard to define $x \preceq y$ as $x + y = y$ for an idempotent operation~$+$, since it gives a partial order on the elements @@ -206,7 +207,7 @@ \subsection{Partial order on graphs}\label{sub-partial-order} \end{itemize} -\subsection{Equational reasoning}\label{sub-reasoning} +\subsection{Equational Reasoning}\label{sub-reasoning} In this subsection we show how to use equational reasoning and the laws of the algebra to prove properties of functions on graphs. diff --git a/core.tex b/core.tex index f326a3e..18c33b8 100644 --- a/core.tex +++ b/core.tex @@ -1,36 +1,6 @@ %!TEX root = alga.tex -\begin{figure*} -\begin{subfigure}[b]{0.2\linewidth} -\centerline{\includegraphics[scale=0.27]{fig/ex-a.pdf}} -\vspace{-2.4mm} -\caption{$1 + 2$} -\centerline{\includegraphics[scale=0.27]{fig/ex-b.pdf}} -\vspace{-2.4mm} -\caption{$1 \rightarrow 2$} -\end{subfigure} -\hspace{11mm} -\begin{subfigure}[b]{0.17\linewidth} -\centerline{\includegraphics[scale=0.27]{fig/ex-c.pdf}} -\vspace{-1mm} -\caption{$1 \rightarrow (2 + 3)$} -\end{subfigure} -\hspace{12mm} -\begin{subfigure}[b]{0.15\linewidth} -\centerline{\includegraphics[scale=0.27]{fig/ex-d.pdf}} -\vspace{2.4mm} -\caption{$1 \rightarrow 1$} -\end{subfigure} -\hspace{12mm} -\begin{subfigure}[b]{0.2\linewidth} -\centerline{\includegraphics[scale=0.27]{fig/ex-e-new.pdf}} -\vspace{-1mm} -\caption{$1 \rightarrow 2 + 2 \rightarrow 3$} -\end{subfigure} -\caption{Examples of graph construction. The overlay and connect operations are denoted -by $+$ and $\rightarrow$, respectively.\label{fig-construction}} -\end{figure*} - -\section{The core}\label{sec-core} +\vspace{-0.5mm} +\section{The Core}\label{sec-core} In this section we define the \emph{core} of algebraic graphs comprising four graph construction primitives. We describe the semantics of the primitives using the common representation of graphs by sets of vertices and edges, and @@ -48,7 +18,7 @@ \section{The core}\label{sec-core} solution is to define an abstract interface that encapsulates the data structure and provides a set of safe construction primitives. This is exactly the approach we take. -\subsection{Constructing graphs}\label{sub-constructing} +\subsection{Constructing Graphs}\label{sub-constructing} The simplest possible graph is the \emph{empty} graph. We denote it by $\varepsilon$, therefore $\varepsilon = (\varnothing, \varnothing)$ and @@ -84,11 +54,10 @@ \subsection{Constructing graphs}\label{sub-constructing} \begin{itemize} \item $1 + 2$ is the graph with two isolated vertices 1 and 2. \item $1 \rightarrow 2$ is the graph with an edge between vertices 1 and 2. - \item $1 \rightarrow (2 + 3)$ is the graph with three vertices $\{1, 2, 3\}$ - and two edges $(1, 2)$ and $(1, 3)$. + \item $1 \rightarrow (2 + 3)$ comprises vertices $\{1, 2, 3\}$ + and edges $\{(1, 2), (1, 3)\}$. \item $1 \rightarrow 1$ is the graph with vertex 1 and the \emph{self-loop}. - \item $1 \rightarrow 2 + 2 \rightarrow 3$ is the graph with three vertices $\{1, 2, 3\}$ - and two edges $(1, 2)$ and $(2, 3)$. + \item $1 \rightarrow 2 + 2 \rightarrow 3$ is the \emph{path graph} on vertices $\{1, 2, 3\}$. \end{itemize} As shown in~\S\ref{sec-intro}, the core can be represented by a simple @@ -97,7 +66,7 @@ \subsection{Constructing graphs}\label{sub-constructing} has the usual inhabitants, such as the pair $(V,E)$, data types from \textsf{containers} and \textsf{fgl}, as well as other, stranger forms of life. -\subsection{Type class}\label{sub-class} +\subsection{Type Class}\label{sub-class} We abstract the graph construction primitives defined in \S\ref{sub-constructing} as the type class \hs{Graph}\footnote{The name collision (\hs{data Graph} diff --git a/discussion.tex b/discussion.tex index 070e76a..d3cebf9 100644 --- a/discussion.tex +++ b/discussion.tex @@ -1,6 +1,5 @@ %!TEX root = alga.tex -\vspace{-1mm} -\section{Discussion and future research opportunities}\label{sec-discussion} +\section{\hspace{-1mm}Discussion~and~Future~Research~Opportunities}\label{sec-discussion} The paper presented a new algebraic foundation for working with graphs. It is particularly well-suited for functional programming languages diff --git a/graphs.tex b/graphs.tex index 8eb5541..be91f8c 100644 --- a/graphs.tex +++ b/graphs.tex @@ -1,5 +1,5 @@ %!TEX root = alga.tex -\section{Graphs \`{a} la carte}\label{sec-a-la-carte} +\section{Graphs \`{a} la Carte}\label{sec-a-la-carte} In this section we define several useful \hs{Graph} instances, and show that the algebra presented in the previous section~\S\ref{sec-algebra} is @@ -28,14 +28,14 @@ \section{Graphs \`{a} la carte}\label{sec-a-la-carte} connect x y = R (domain x `union` domain y) (relation x `union` relation y `union` fromAscList [ (a, b) | a <- elems (domain x), b <- elems (domain y) ]) \end{minted} -\vspace{-2mm} +\vspace{-2.5mm} \caption{Implementing the \hs{Graph} type class by a binary relation and the core graph construction primitives defined in~\S\ref{sub-constructing}.\label{fig-relation}} -\vspace{-2mm} +\vspace{-2.5mm} \end{figure*} -\subsection{Binary relation}\label{sub-relation} +\subsection{Binary Relation}\label{sub-relation} We start by a direct encoding of the graph construction primitives defined in~\S\ref{sub-constructing} into the abstract data type \hs{Relation} isomorphic @@ -103,7 +103,7 @@ \subsection{Binary relation}\label{sub-relation} The last example highlights the fact that the \hs{Relation@\,\,\blk{a}@} instance allows vertices of any type \hs{@\blk{a}@} that satisfies the~\hs{Ord@\,\,\blk{a}@} constraint. -\subsection{Deep embedding}\label{sub-embedding} +\subsection{Deep Embedding}\label{sub-embedding} We can embed the core graph construction primitives into a simple data type (excuse and ignore the name clash with the type class): @@ -273,7 +273,7 @@ \subsection{Deep embedding}\label{sub-embedding} % which motivates us to study polymorphic graph transformations that can be reused by % all law-abiding citizens of the \hs{Graph} world -- see \S\ref{sec-transformations}. -\subsection{Undirected graphs}\label{sub-undirected} +\subsection{Undirected Graphs}\label{sub-undirected} As hinted at in \S\ref{sub-laws}, to switch from directed to undirected graphs it is sufficient to add the axiom of commutativity for the connect operation. For @@ -354,7 +354,7 @@ \subsection{Undirected graphs}\label{sub-undirected} \label{fig-3-decomposition}} \end{figure*} -\subsection{Reflexive graphs}\label{sub-reflexive} +\subsection{Reflexive Graphs}\label{sub-reflexive} A graph is \emph{reflexive} if every vertex of the graph is connected to itself, i.e. has a self-loop. An example of a reflexive graph is the graph corresponding @@ -382,7 +382,7 @@ \subsection{Reflexive graphs}\label{sub-reflexive} \hs{class Graph@\,\,\blk{g}@ => ReflexiveGraph@\,\,\blk{g}@} to increase the type safety of functions that rely on the self-loop axiom. -\subsection{Transitive graphs}\label{sub-transitive} +\subsection{Transitive Graphs}\label{sub-transitive} In many applications graphs satisfy the \emph{transitivity} property: if a vertex $x$ is connected to $y$, and $y$ is connected to $z$, then the edge between $x$ and $z$ can be @@ -418,7 +418,7 @@ \subsection{Transitive graphs}\label{sub-transitive} A subclass \hs{class Graph@\,\,\blk{g}@ => TransitiveGraph@\,\,\blk{g}@} can be defined to distinguish algebraic graphs with the closure axiom from others. -\subsection{Preorders and equivalence relations}\label{sub-preorder} +\subsection{Preorders and Equivalence Relations}\label{sub-preorder} By combining reflexive and transitive graphs, one can obtain \emph{preorders}. For example, $(1 + 2 + 3) \rightarrow (2 + 3 + 4)$ diff --git a/intro.tex b/intro.tex index 220ce4c..828eeb3 100644 --- a/intro.tex +++ b/intro.tex @@ -1,7 +1,7 @@ %!TEX root = alga.tex -%\vspace{-2mm} +\vspace{-2mm} \section{Introduction}\label{sec-intro} -%\vspace{-0.5mm} +\vspace{-0.5mm} Graphs are ubiquitous in computing, yet working with graphs often requires painfully low-level fiddling with sets of vertices and edges. Building high-level @@ -47,12 +47,14 @@ \section{Introduction}\label{sec-intro} Algebraic graphs have a safe and minimalistic core of four graph construction primitives, as captured by the following data type: +\vspace{-0.59mm} \begin{minted}{haskell} data Graph a = Empty | Vertex a | Overlay (Graph a) (Graph a) | Connect (Graph a) (Graph a) \end{minted} +\vspace{-0.59mm} \noindent Here \hs{Empty} and \hs{Vertex} construct the \emph{empty} and \emph{single-vertex} graphs, @@ -84,22 +86,56 @@ \section{Introduction}\label{sec-intro} i.e. malformed graphs cannot be constructed. \item Under the basic set of axioms, algebraic graphs correspond to directed - graphs with no edge labels. As we show in~\S\ref{sec-a-la-carte}, by extending - the algebra with additional axioms, it is possible to also represent undirected, - reflexive and transitive graphs, their combinations, as well as hypergraphs. + graphs. As we show in~\S\ref{sec-a-la-carte}, by extending + the algebra with additional axioms, we can represent undirected, + reflexive, transitive graphs, their combinations, and hypergraphs. Importantly, the core remains unchanged, which allows us to define highly reusable polymorphic functions on graphs. \item We develop a library\footnote{The library is on Hackage: \url{http://hackage.haskell.org/package/algebraic-graphs}.} - for constructing and transforming algebraic graphs and demonstrate its - flexibility in \S\ref{sec-transformations}. + for constructing and transforming algebraic graphs + and demonstrate its flexibility in \S\ref{sec-transformations}. + % Although the development of efficient algorithms for algebraic % graphs is outside the scope of this paper, we show that the library can cope % with graphs comprising billions of edges in the matter of % seconds, which is sufficiently fast for many applications. \end{itemize} -\vspace{-0.25mm} +\vspace{-2mm} + +\begin{figure*} +\begin{subfigure}[b]{0.2\linewidth} +\centerline{\includegraphics[scale=0.27]{fig/ex-a.pdf}} +\vspace{-2.4mm} +\caption{$1 + 2$} +\centerline{\includegraphics[scale=0.27]{fig/ex-b.pdf}} +\vspace{-2.4mm} +\caption{$1 \rightarrow 2$} +\end{subfigure} +\hspace{11mm} +\begin{subfigure}[b]{0.17\linewidth} +\centerline{\includegraphics[scale=0.27]{fig/ex-c.pdf}} +\vspace{-1mm} +\caption{$1 \rightarrow (2 + 3)$} +\end{subfigure} +\hspace{12mm} +\begin{subfigure}[b]{0.15\linewidth} +\centerline{\includegraphics[scale=0.27]{fig/ex-d.pdf}} +\vspace{2.4mm} +\caption{$1 \rightarrow 1$} +\end{subfigure} +\hspace{12mm} +\begin{subfigure}[b]{0.2\linewidth} +\centerline{\includegraphics[scale=0.27]{fig/ex-e-new.pdf}} +\vspace{-1mm} +\caption{$1 \rightarrow 2 + 2 \rightarrow 3$} +\end{subfigure} +\vspace{-1.5mm} +\caption{Examples of graph construction. The overlay and connect operations are denoted +by $+$ and $\rightarrow$, respectively.\label{fig-construction}} +\vspace{-3mm} +\end{figure*} Graphs and functional programming have a long history. We review related work in \S\ref{sec-related}. Limitations of the presented approach and future diff --git a/library.tex b/library.tex index 6d96283..d655ed1 100644 --- a/library.tex +++ b/library.tex @@ -49,7 +49,7 @@ \caption{API of the graph construction and transformation library.\label{fig-api}} \end{figure*} -\section{Graph transformation library}\label{sec-transformations} +\section{Graph Transformation Library}\label{sec-transformations} As shown in the previous section~\S\ref{sec-a-la-carte}, the world of \hs{Graph} instances has many inhabitants sharing a part of their `algebraic DNA'. They all @@ -58,7 +58,7 @@ \section{Graph transformation library}\label{sec-transformations} Fig.~\ref{fig-api}. The part shown in Fig.~\ref{fig-api}(a) has been defined in~\S\ref{sec-algebra}. -\subsection{Standard families of graphs}\label{sub-families} +\subsection{Standard Families of Graphs}\label{sub-families} This subsection defines a few simple functions for constructing graphs from standard graph families. See Fig.~\ref{fig-api}(b) for the list of all functions @@ -150,7 +150,7 @@ \subsection{Standard families of graphs}\label{sub-families} is the directed clique on the same set of vertices, therefore they are considered equal by the \hs{Transitive} graph instance. -\subsection{Graph transpose} +\subsection{Graph Transpose} In the rest of this section we present a toolbox for transforming polymorphic graph expressions. The functions in the presented toolbox are listed in Fig.~\ref{fig-api}(c). @@ -200,7 +200,7 @@ \subsection{Graph transpose} polymorphic argument and let the type inference interpret it as a value of type \hs{Transpose}. -\subsection{Graph functor}\label{sub-functor} +\subsection{Graph Functor}\label{sub-functor} We now implement a function \hs{gmap} that given a function \hs{a}~\hs{->}~\hs{b} and a polymorphic graph whose vertices are of type \hs{a} will produce a @@ -333,7 +333,7 @@ \subsection{Graph functor}\label{sub-functor} fully parametric. As a consequence, \hs{toList (1 + 1)} produces the list \hs{[1,1]}. -\subsection{Graph monad}\label{sub-monad} +\subsection{Graph Monad}\label{sub-monad} What do the operations of removing a vertex and splitting a vertex have in common? They both can be implemented by replacing each vertex of a graph with a (possibly empty) @@ -414,7 +414,7 @@ \subsection{Graph monad}\label{sub-monad} \noindent Here vertex 1 is split into a pair of vertices $\{0, 1\}$ that have the same connectivity. -\subsection{Beyond homomorphisms}\label{sub-beyond} +\subsection{Beyond Homomorphisms}\label{sub-beyond} Most of the \hs{newtype} wrappers defined in this section are \emph{homomorphisms}, that is, they preserve the structure of the original graph expression. The two @@ -487,10 +487,12 @@ \subsection{Beyond homomorphisms}\label{sub-beyond} \begin{figure*} \centerline{\includegraphics[scale=0.3]{fig/De-Bruijn-construction.pdf}} +\vspace{-1mm} \caption{Constructing De Bruijn graphs using the graph monad.\label{fig-de-bruijn}} +\vspace{-1mm} \end{figure*} -\subsection{De Bruijn graphs} +\subsection{De Bruijn Graphs} To demonstrate that one can easily construct sophisticated graphs using the presented library, let us try it on \emph{De Bruijn graphs}, an interesting diff --git a/related-work.tex b/related-work.tex index e3b9d11..1544aec 100644 --- a/related-work.tex +++ b/related-work.tex @@ -1,5 +1,5 @@ %!TEX root = alga.tex -\section{Related work}\label{sec-related} +\section{Related Work}\label{sec-related} Historically, first approaches to graph representation in functional programming used edge lists, adjacency lists, as well as mutually recursive data structures