% Copyright 2012-2024, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % SPLinT is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with SPLinT. If not, see . % limbo.sty version 3.0 \input epsf.tex \input amssym.def \catcode`\@=11 % a name space protection measure (weak) % fonts \font\tenboldi=cmbxti10 \font\nineboldi=cmbxti9 \font\eightboldi=cmbxti8 \font\sevenboldi=cmbxti7 \font\sixboldi=cmbxti6 \font\fiveboldi=cmbxti5 \font\twelvebi=cmmib10 at 12pt \font\tenbi=cmmib10 \font\tencyr=lhr10 \font\ninebi=cmmib9 \font\sevenbi=cmmib7 \font\sixbi=cmmib6 \font\twelvebsy=cmbsy10 at 12pt \font\ninebsy=cmbsy9 \font\sevenbsy=cmbsy7 \font\twelvei=cmmi10 at 12pt \font\ninei=cmmi9 \font\twelvesy=cmsy10 at 12pt \font\ninesy=cmsy9 \font\twelvetitle=cmssbx12 \font\tentitle=cmssbx10 \font\tentitlei=cmssbxo10 \font\ninetitle=cmssbx9 \font\eighttitle=cmssbx8 \font\seventitle=cmssbx7 \font\titlefrak=eufb10 at 12pt %\font\eightss=cmssq8 %\font\eightssi=cmssqi8 \font\tenss=cmss10 \font\niness=cmss9 \font\eightss=cmss8 \font\sevenss=cmss7 \font\sixss=cmss6 \font\fivess=cmss5 \font\tenssn=cmssdc10 \font\ninessn=cmssdc9 \font\eightssn=cmssdc8 \font\sevenssn=cmssdc7 \font\sixssn=cmssdc6 \font\fivessn=cmssdc5 \font\tenssb=cmssbx10 \font\ninessb=cmssbx9 \font\eightssb=cmssbx8 \font\sevenssb=cmssbx7 \font\sixssb=cmssbx6 \font\fivessb=cmssbx5 \font\twelvetitleit=cmssbxo10 at 12pt \font\ninetitleit=cmssbxo10 at 9pt \font\seventitleit=cmssbxo10 at 7pt \font\authorfont=cmssqi8 \font\affiliationfont=cmssq8 \font\timefont=cmss7 \font\keywordsfn=cmssbx8 \font\tentex=cmtex10 \font\ninetex=cmtex9 \font\eighttex=cmtex8 \font\inchhigh=cminch \font\titlefont=cmssdc10 at 40pt \font\ninerm=cmr9 \font\eightrm=cmr8 \font\sevenrm=cmr7 \font\sixrm=cmr6 \font\ninecyr=lhr9 \font\eightcyr=lhr8 \font\sevencyr=lhr7 \font\ninei=cmmi9 \font\eighti=cmmi8 \font\sixi=cmmi6 \skewchar\ninei='177 \skewchar\eighti='177 \skewchar\sixi='177 \font\ninesy=cmsy9 \font\eightsy=cmsy8 \font\sixsy=cmsy6 \skewchar\ninesy='60 \skewchar\eightsy='60 \skewchar\sixsy='60 \font\twelvebf=cmbx12 \font\ninebf=cmbx9 \font\eightbf=cmbx8 \font\sixbf=cmbx6 \font\ninett=cmtt9 \font\eighttt=cmtt8 \font\seventt=cmtt7 \font\sixtt=cmtt6 \font\tentti=cmitt10 % typewriter italic \font\ninetti=cmitt9 \font\eighttti=cmitt8 \font\seventti=cmitt7 \font\sixtti=cmitt6 \hyphenchar\tentt=-1 % inhibit hyphenation in typewriter type \hyphenchar\ninett=-1 \hyphenchar\eighttt=-1 \font\ninesl=cmsl9 \font\eightsl=cmsl8 \font\sevensl=cmsl7 \font\sixsl=cmsl6 \font\nineit=cmti9 \font\eightit=cmti8 \font\sevenit=cmti7 \font\sixit=cmti6 \font\fiveit=cmti5 \font\twelvemsam=msam10 at 12pt \font\tenmsam=msam10 \font\ninemsam=msam9 \font\eightmsam=msam8 \font\sevenmsam=msam7 \font\sixmsam=msam6 \font\fivemsam=msam5 \font\twelvemsbm=msbm10 at 12pt \font\tenmsbm=msbm10 \font\ninemsbm=msbm9 \font\eightmsbm=msbm8 \font\sevenmsbm=msbm7 \font\sixmsbm=msbm6 \font\fivemsbm=msbm5 \font\tenfrak=eufm10 \font\ninefrak=eufm9 \font\eightfrak=eufm8 \font\sevenfrak=eufm7 \font\sixfrak=eufm6 \font\nineidss=idssbx9 \font\eightidss=idssbx8 \font\sevenidss=idssbx7 \font\sixidss=idssbx6 \font\hv=phvr \font\dings=pzdr \font\dingssmall=pzdr at 8pt \chardef\pen='062 \chardef\leaf='247 \chardef\fancystar='122 \newfam\ssfam \newfam\ssbnfam \newfam\itbfam \newfam\msbmfam \newfam\msamfam % take `<=' and `>=' from Euler ... % but this will be changed back in the title due to % the absence of the bold version \mathchardef\leq="3\hexnumber@\msamfam36 \let\le=\leq \mathchardef\geq="3\hexnumber@\msamfam3E \let\ge=\geq \mathchardef\emptyset="0\hexnumber@\msbfam3F % left and right `french quotes' (guillemots); the characters reside in lhr fonts \chardef\lqq='375 \chardef\rqq='376 \def\cdotfill{\cleaders\hbox {$\m@th \mkern .5mu\cdot\mkern .5mu$}\hfill} \def\dinkus{$\ast\ast\ast$} \def\asterism{\setbox0\hbox{$\ast$}\copy0 \kern-.3\wd0 \raise\ht0 \copy0 \kern-.3\wd0 \copy0 } \newskip\ttglue \def\tenpoint{\def\rm{\fam0\tenrm}% \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex \def\it{\fam\itfam\tenit}% \textfont\itfam=\tenit\scriptfont\itfam=\sevenit \scriptscriptfont\itfam=\fiveit \def\itbold{\fam\itbfam\tenboldi}% \textfont\itbfam=\tenboldi\scriptfont\itfam=\sevenboldi \scriptscriptfont\itbfam=\fiveboldi \def\sl{\fam\slfam\tensl}% \textfont\slfam=\tensl \def\bf{\fam\bffam\tenbf}% \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf \scriptscriptfont\bffam=\fivebf \def\tt{\fam\ttfam\tentt \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\tti{\fam\ttfam\tentti % switch to typewriter italic \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\ttex{\tentex \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\ttl{\let\it\tentitlei\let\sl\tentitlei\tentitle}% \def\ssf{\fam\ssfam\tenss}% \textfont\ssfam=\tenss\scriptfont\ssfam=\sevenss \def\ssfb{\fam\ssfam\tenssb}% \def\ssfbn{\fam\ssbnfam\tenssb}% \textfont\ssbnfam=\tenssn\scriptfont\ssfam=\sevenssn \textfont\ttfam=\tentt\scriptfont\ttfam=\seventt \fam\ttfam\tentt \ttglue=.5em plus.25em minus.15em \def\Bbb{\fam\msbmfam\tenmsbm}% \textfont\msbmfam=\tenmsbm\scriptfont\msbmfam=\sevenmsbm \scriptscriptfont\msbmfam=\fivemsbm \textfont\msamfam=\tenmsam\scriptfont\msamfam=\sevenmsam \scriptscriptfont\msamfam=\fivemsam \def\frak##1{{\tenfrak ##1}}% \normalbaselineskip=12pt \let\sc=\eightrm \let\sci=\eightit \let\mc=\ninerm \let\cyr=\tencyr \let\big=\tenbig \let\idss=\eightidss \setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width0pt}% \let\sscmd\sevenpoint \normalbaselines\rm} \def\ninepoint{\def\rm{\fam0\ninerm}% \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm \textfont1=\ninei \scriptfont1=\sixi \scriptscriptfont1=\fivei \textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex \def\it{\fam\itfam\nineit}% \textfont\itfam=\nineit\scriptfont\itfam=\sixit \def\itbold{\fam\itbfam\nineboldi}% \textfont\itbfam=\nineboldi\scriptfont\itfam=\sixboldi \def\sl{\fam\slfam\ninesl}% \textfont\slfam=\ninesl \def\bf{\fam\bffam\ninebf}% \textfont\bffam=\ninebf \scriptfont\bffam=\sixbf \scriptscriptfont\bffam=\fivebf \def\tt{\fam\ttfam\ninett \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\tti{\fam\ttfam\ninetti % switch to typewriter italic \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\ttex{\ninetex \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\ttl{\let\it\ninetitleit\let\sl\ninetitleit\ninetitle}% \def\ssf{\fam\ssfam\niness}% \textfont\ssfam=\niness\scriptfont\ssfam=\sixss \def\ssfb{\fam\ssfam\ninessb}% %no room for another font family \def\ssfbn{\fam\ssbnfam\ninessn}% \textfont\ssbnfam=\ninessn\scriptfont\ssbnfam=\sixssn \textfont\ttfam=\ninett\scriptfont\ttfam=\sixtt \fam\ttfam\ninett \ttglue=.5em plus.25em minus.15em \def\Bbb{\fam\msbmfam\ninemsbm}% \textfont\msbmfam=\ninemsbm\scriptfont\msbmfam=\sixmsbm \scriptscriptfont\msbmfam=\fivemsbm \textfont\msamfam=\ninemsam\scriptfont\msamfam=\sixmsam \scriptscriptfont\msamfam=\fivemsam \def\frak##1{{\ninefrak ##1}}% \normalbaselineskip=11pt \let\sc=\sevenrm \let\sci\sevenit \let\mc=\eightrm \let\cyr=\ninecyr \let\big=\ninebig \let\idss=\sevenidss \setbox\strutbox=\hbox{\vrule height8pt depth3pt width0pt}% \let\sscmd\sixpoint \normalbaselines\rm} \def\eightpoint{\def\rm{\fam0\eightrm}% \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm \textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex \def\it{\fam\itfam\eightit}% \def\itbold{\fam\itbfam\eightboldi}% \textfont\itfam=\eightit \def\sl{\fam\slfam\eightsl}% \textfont\slfam=\eightsl \def\bf{\fam\bffam\eightbf}% \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf \scriptscriptfont\bffam=\fivebf \def\tt{\fam\ttfam\eighttt \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\tti{\fam\ttfam\eighttti % switch to typewriter italic \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\ttex{\eighttex \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \textfont\ttfam=\eighttt \fam\ttfam\eighttt \ttglue=.5em plus.25em minus.15em \def\ssf{\fam\ssfam\eightss}% \textfont\ssfam=\eightss\scriptfont\ssfam=\sixss \def\ssfb{\fam\ssfam\eightssb}% \def\ssfbn{\fam\ssbnfam\eightssb}% \textfont\ssbnfam=\eightssn\scriptfont\ssbnfam=\sixssn \def\Bbb{\fam\msbmfam\eightmsbm}% \textfont\msbmfam=\eightmsbm\scriptfont\msbmfam=\sixmsbm \scriptscriptfont\msbmfam=\fivemsbm \textfont\msamfam=\eightmsam\scriptfont\msamfam=\sixmsam \scriptscriptfont\msamfam=\fivemsam \def\frak##1{{\eightfrak ##1}}% \normalbaselineskip=9pt \let\sc=\sixrm \let\sci=\sixit \let\mc=\sevenrm \let\cyr=\eightcyr \let\big=\eightbig \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height7pt depth2pt width0pt}% \let\sscmd\sixpoint \normalbaselines\rm} \def\sevenpoint{\def\rm{\fam0\sevenrm}% \textfont0=\sevenrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm \textfont1=\seveni \scriptfont1=\sixi \scriptscriptfont1=\fivei \textfont2=\sevensy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex \def\it{\fam\itfam\sevenit}% \def\itbold{\fam\itbfam\sevenboldi}% \textfont\itfam=\sevenit \def\sl{\fam\slfam\sevensl}% \textfont\slfam=\sevensl \def\bf{\fam\bffam\sevenbf}% \textfont\bffam=\sevenbf \scriptfont\bffam=\sixbf\scriptscriptfont\bffam=\fivebf \def\tt{\fam\ttfam\seventt \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\tti{\fam\ttfam\seventti % switch to typewriter italic \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \textfont\ttfam=\seventt \fam\ttfam\seventt \ttglue=.5em plus.25em minus.15em \def\ssf{\fam\ssfam\sevenss}% \textfont\ssfam=\sevenss\scriptfont\ssfam=\sixss \def\ssfb{\fam\ssfam\sevenssb}% \def\ssfbn{\fam\ssbnfam\sevenssb}% \textfont\ssbnfam=\sevenssn\scriptfont\ssbnfam=\sixssn \def\Bbb{\fam\msbmfam\sevenmsbm}% \textfont\msbmfam=\sevenmsbm\scriptfont\msbmfam=\sixmsbm \scriptscriptfont\msbmfam=\fivemsbm \textfont\msamfam=\sevenmsam\scriptfont\msamfam=\sixmsam \scriptscriptfont\msamfam=\fivemsam \def\frak##1{{\sevenfrak ##1}}% \normalbaselineskip=8pt \let\sc=\sixrm \let\sci=\sixit \let\mc=\sixrm \let\big=\sevenbig \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height6pt depth2pt width0pt}% \normalbaselines\rm} \def\sixpoint{\def\rm{\fam0\sixrm}% \textfont0=\sixrm \scriptfont0=\fiverm \scriptscriptfont0=\fiverm \textfont1=\sixi \scriptfont1=\fivei \scriptscriptfont1=\fivei \textfont2=\sixsy \scriptfont2=\fivesy \scriptscriptfont2=\fivesy \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex \def\it{\fam\itfam\sixit}% \def\itbold{\fam\itbfam\sixboldi}% \textfont\itfam=\sixit \def\sl{\fam\slfam\sixsl}% \textfont\slfam=\sixsl \def\bf{\fam\bffam\sixbf}% \textfont\bffam=\sixbf \scriptfont\bffam=\fivebf\scriptscriptfont\bffam=\fivebf \def\tt{\fam\ttfam\sixtt \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \def\tti{\fam\ttfam\sixtti % switch to typewriter italic \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string }% \textfont\ttfam=\sixtt \fam\ttfam\sixtt \ttglue=.5em plus.25em minus.15em \def\ssf{\fam\ssfam\sixss}% \textfont\ssfam=\sixss\scriptfont\ssfam=\fivess \def\ssfb{\fam\ssfam\sixssb}% \def\ssfbn{\fam\ssbnfam\sixssb}% \textfont\ssbnfam=\sixssn\scriptfont\ssbnfam=\fivessn \def\Bbb{\fam\msbmfam\sixmsbm}% \textfont\msbmfam=\sixmsbm\scriptfont\msbmfam=\fivemsbm \scriptscriptfont\msbmfam=\fivemsbm \textfont\msamfam=\sixmsam\scriptfont\msamfam=\fivemsam \scriptscriptfont\msamfam=\fivemsam \def\frak##1{{\sixfrak ##1}}% \normalbaselineskip=8pt \let\sc=\sixrm \let\sci=\sixit \let\mc=\sixrm \let\big=\sixbig \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height5.5pt depth1.5pt width0pt}% \normalbaselines\rm} \def\em{\let\tt\tti\let\sc\sci\it} % fonts for the chapter titles \font\cmhuge=cmssbx10 at .7in \font\tthuge=cmtt10 at .7 in \font\cmmiddle=cmss10 at .3in \font\ttmiddle=cmtt10 at .3in \def\hugetitle{% \let\ssf\cmhuge \let\tt\tthuge \ssf } \def\midtitle{% \let\ssf\cmmiddle \let\tt\ttmiddle \ssf } % temporary registers \input trt1.sty % we can prevent acrobat from defaulting to % the "shrink to printable area" setting, which causes an 8.5"\times11" page to shrink % by about 6\% to fit onto the printable region of the physical printer; % this macro was contributed by Jeff Norden. \ifx\pdfcatalog\UNDEFINED\else \pdfcatalog{/ViewerPreferences<>}% \fi % a slightly involved way of determining whether we are making a pdf file is % due to the fact that pdftex can output dvi files as well. \newif\ifmakepdf \ifx\pdfoutput\undefined \makepdffalse \else \ifnum\pdfoutput>\z@ \makepdftrue \else \makepdffalse \fi \fi % cleaning up whitespace \newif\ifspaceleft \def\removewhitespace{% a macro that removes glue, kerns, and % penalties before the current point \loop\spaceleftfalse\unwhitespaceonce\ifspaceleft\repeat } \def\unwhitespaceonce{% \ifhmode \ifdim\lastskip=\z@\else\unskip\spacelefttrue\fi \ifdim\lastkern=\z@\else\unkern\spacelefttrue\fi \ifnum\lastpenalty=\z@\else\unpenalty\spacelefttrue\fi \fi} % color management % remember the cmyk color in an impossible control sequence \def\colordef#1#2{\expandafter\def\csname cmykc@l@r #1\endcsname{#2}} % color switch: we maintain our own color stack for pdf output; % newer versions of pdf\TeX\ have `proper' color stack primitives % which provide a more reliable implementation (across page breaks % and inside insertions, for example) \def\colorset#1{\begingroup \ifmakepdf \expandafter\let\expandafter\currentc@l@r\csname cmykc@l@r #1\endcsname \edef\next{\noexpand\pdfliteral{\csname cmykc@l@r #1\endcsname\space k}}\next \else \special{ps:gsave}% \edef\next{\special{ps:\csname cmykc@l@r #1\endcsname\space setcmykcolor}}\next \fi } \def\currentc@l@r{1 1 1 1} % start out black \def\quickcolordef#1#2{\colordef{#1}{#2}% \expandafter\def\csname color#1\endcsname##1{\colorset{#1}##1\restorecolor}} \def\grayset#1{\begingroup \ifmakepdf \def\currentc@l@r##1k{#1 g}% so we can use \restoreco... \pdfliteral{#1 g}% \else \special{ps:gsave}\special{ps:#1 setgray}% \fi } \def\restorecolor{\endgroup \ifmakepdf \expandafter\pdfliteral\expandafter{\currentc@l@r\space k}% \else \special{ps:grestore}% \fi } % macros to provide pdf references to outside documents as well as inside the code \def\locallink#1{% \ifmakepdf\colorset{link}\pdfstartlink attr {/Border [0 0 0]} goto name {#1}\fi} \def\exlinkpage#1#2#3{\colorset{link}% \ifmakepdf\pdfstartlink attr {/Border [0 0 0]} goto file {#1} page #2 {#3}\fi} \def\endlink{\ifmakepdf\pdfendlink\restorecolor\fi} \def\namedspot#1{\ifmakepdf % raise the reference to make sure that the viewer window shows the % whole line in which the reference occurs \raise\ht\strutbox\vbox to 0pt{\vss\hbox to 0pt{\pdfdest name {#1} xyz}}% \fi} \def\pdfpagelink#1{% reference the page number \pdfstartlink attr {/Border [0 0 0]} goto page #1 {/XYZ null null null}\BlueGreen#1\Black\pdfendlink } \quickcolordef{peach}{0 0.06 0.14 0} \quickcolordef{corn}{0 0.06 0.63 0.02} \quickcolordef{sandybrown}{0 0.33 0.61 0.04} \quickcolordef{darkwood}{0 0.29 0.5 0.48} \quickcolordef{link}{0 0 1 0.30} \def\colorblack#1{\grayset{0}#1\restorecolor} \def\colorwhite#1{\grayset{1}#1\restorecolor} \def\colorgray#1{\grayset{.5}#1\restorecolor} % verbatim listing macros borrowed (with changes) from The TeXbook \newcount\democodelc \chardef\other=12 \def\ttverbatim{\begingroup \catcode`\\=\other \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other \catcode`\_=\other \catcode`\|=\other \obeyspaces \obeylines \tt \ttglue=.5em plus.25em minus.15em } {\catcode`\^=\active \catcode`\*=7 \obeylines \gdef^{\leavevmode\ttverbatim \spaceskip\ttglue \def**M{\endgroup\cr}\let^=\endgroup}} \def\beginlines{\begingroup\parindent0pt \obeylines \everypar{\strut}\catcode`\^=\active} \def\endlines{\endgroup} \def\paddednumber#1{\ifnum #1 < 10 0\number#1\relax\else \number#1\fi} % demo code display % **H will produce a `|', **K can be used as an escape character, **L and **N % can be used in place of left and right braces to provide some control **C is % a comment character when needed {\catcode`\ =\active\gdef {\phantom{\char"20\relax}}\catcode`\^^H=\active\gdef^^H{\yl}}% \newif\ifnumberlines \def\begindemo{% \medskip \bgroup \def\linenoup{% \global\advance\democodelc by1 \ifnumberlines{\sevenrm\paddednumber\democodelc}\fi} \def\nooutput{\omit\hfil{\sevenrm\strut[more code $\ldots$]}\hfil\cr\noalign{\kern3pt}} \catcode`\^=\active\democodelc=0 \catcode`\*=7 \chardef\*=`\*% \catcode`\^^H=\active % ^^H \catcode`\^^K=0 \catcode`\^^L=1 \catcode`\^^N=2 \catcode`\^^C=14 \tabskip=0pt plus 1 fill \halign \demoastyle\bgroup\linenoup\hskip\demomargin ##\hfil\hskip\demomargin% \ifnumberlines{\sevenrm\paddednumber\democodelc}\fi\cr% } \def\enddemo{\egroup\egroup\medskip\noindent} % referencing lines from the demo code \def\dlbl#1{\expandafter\xdef\csname lncnt_#1\endcsname{\the\democodelc}}% \def\dref#1{\csname lncnt_#1\endcsname}% \newskip\demomargin \demomargin=3em \def\demoastyle{to\hsize} % macros to provide some primitive alignment \def\texalignment{\setbox0\lastbox\setbox0\lastbox\unkern\begingroup\settabs 3 \columns \let\C\tabC\let\8\tabalign\def\5{\relax\ifmmode\oopsamp\else\clearamp\fi}\def\6{\strut\cr}} \def\oopsamp{$&$} \def\clearamp{&} \def\texalignmentshort{\setbox0\lastbox\setbox0\lastbox\unkern\begingroup\settabs 2 \columns \let\C\tabC\let\8\tabalign\def\5{\ifmmode\oopsamp\else\clearamp\fi}\def\6{\strut\cr}} \def\endtexalignment{\vskip-\baselineskip\strut\endgroup} \def\eatcr#1\6{\ignorespaces} \newtoks\postlimbotoks \def\postlimbostuff{% } \def\picture#1{\ifmakepdf\pdfximage{#1.pdf}\pdfrefximage\pdflastximage \else \epsfbox{#1.eps}\fi } \let\yl| % to use in \TeX\ mode instead of `|' \def\vl{|} % same as above but expandable \def\greaterthan{>} % CTANGLE always leaves a space after `>' in the output which interferes with some macros % redefinitions of various CWEB macros; % macros that provide a way to customize printing of reserved words \let\oldamp\& \let\oldoneletterid\| \let\oldslashslash\\ \def\replaceunderscore#1{% \ifx#1\_% \yybreak{x\replaceunderscore}% \else \ifx#1\#% \yybreak@{H\replaceunderscore}% \else \ifx#1\end \yybreak@@{}% \else \yybreak@@{\string#1\replaceunderscore}% \fi \fi \yycontinue } \def\reservedid#1{\expandafter\r@servedid\expandafter{\csname RVD\replaceunderscore#1\end\endcsname}{#1}} \def\r@servedid#1#2{\ifx#1\relax\yybreak{\oldamp{#2}}\else\yybreak{#1}\yycontinue} \def\reservedname#1{\expandafter\r@servedname\expandafter{\csname RVD\replaceunderscore#1\end\endcsname}{#1}} \def\r@servedname#1#2{\ifx#1\relax\yybreak{\oldslashslash{#2}}\else\yybreak{#1}\yycontinue} \def\reservedoneletterid#1{% \expandafter\ifx\csname RVD\string#1\endcsname\relax \yybreak{\oldoneletterid{#1}}% \else \yybreak{\csname RVD\string#1\endcsname}% \yycontinue} \def\defreserved#1{% \expandafter\def\csname RVD\replaceunderscore#1\end\endcsname } \let\&\reservedid \let\|\reservedoneletterid % better `hash' \let\oldhash\# \def\#{\lower.5pt\hbox{\tt\oldhash}} \let\oldmathS\$ % cweb macros adopted to making typesetting languages other than C possible: Makefile and linker scripts. \tempca=\catcode`\^^I% remember the old catcode \catcode`\^^I=\active \def\vb{\begingroup\catcode`\^^I=\active\vvb} % give the tab a chance to change its catcode before the rest is scanned \def\vvb#1{{% \hbox{\vbox{\ttex%\tt \let\\=\BS % backslash in a string \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string \let\~=\TL % tilde in a string %\let\ =\space % space in a string \def\ {\phantom{0}}% \let\_=\UL % underline in a string \let\&=\AM % ampersand in a string \let\^=\CF % circumflex in a string \let\$=\oldmathS % dollar sign \let\#=\oldhash % hash symbol: the new definition above would break alignment \let\n\empty % the `end of line' inserted by the preprocessing script \def^^I{$\llcorner$&$\lrcorner$}% a tab is a tab \tabalign{}#1\cr}}}\endgroup} % verbatim string \catcode`\^^I=\tempca \def\hex{\hbox{\tt\aftergroup}\aftergroup\hexsubscript} \def\hexsubscript{\hbox{$_{\scriptscriptstyle1\kern-.7pt6}$}} \let\K=\Leftarrow \setbox\MGbox=\hbox{\hbox{\ninei\char'053}} \def\R{\hbox{$^{\rm not}$}} \let\CM\lnot \def\MRL#1{\KK#1}\def\KK#1#2{\buildrel\;{\let\OR\lor\scriptscriptstyle#1}\over#2} \def\C#1{\5\5\quad\hbox{$\triangleright\,$}{\rm #1}\hbox{$\,\triangleleft$}} \let\Z=\leq \let\G=\geq \let\E== \def\tabC#1{\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} \def\.#1{\leavevmode\hbox{\tt % typewriter type for strings \let\\=\BS % backslash in a string \let\{=\LB % left brace in a string \let\}=\RB % right brace in a string \let\~=\TL % tilde in a string \let\ =\SP % space in a string %\let\_=\UL % underline in a string \let\&=\AM % ampersand in a string \let\^=\CF % circumflex in a string \let\uscore\_\chardef\_=`\_% #1\kern.05em}} % macros to change the appearance of section headers \outer\def\N#1#2#3.{% beginning of starred section \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi \message{*\secno} % progress report \def\stripprefix##1>{}\def\gtitletoks{#3}% \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}% \edef\next{\write\cont{%\noexpand\noexpand\noexpand\eatone{\noexpand\meaning\noexpand\ZZ}% \noexpand\noexpand\noexpand % AS: this is a (sort of a) bug in cwebmac.tex % as long as the index is output (i.e. ...\eject) % before all the sections this is unnecessary % uncomment the line after the brace to see what \ZZ % expands to in case of weird errors \ZZ{\gtitletoks}{#1}{\secno}% write to contents file {\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss} \ifpdftex\expandafter\xdef\csname curr#1\endcsname{\secno}% \ifnum#1>0\countB=#1 \advance\countB by-1 \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi\fi \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest [ @thispage /FitH @ypos ] >>}\fi \ifon\startsection{\ttl#3.\ }\ignorespaces} % changed the font; AS \let\oldN\N \outer\def\textN#1#2#3.{% beginning of starred section in `text' mode \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon \ifnum#1<2 \vfil\eject % force page break for chapters \else \vskip0pt plus 3.5\baselineskip\penalty-100\vskip0pt plus -3.5\baselineskip\vskip\intersecskip % no page break \fi \fi \message{*\secno} % progress report \def\stripprefix##1>{}\def\gtitletoks{#3}% \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}% \edef\next{\write\cont{%\noexpand\noexpand\noexpand\eatone{\noexpand\meaning\noexpand\ZZ}% \noexpand\noexpand\noexpand % AS this is a (sort of) bug in cwebmac.tex % as long as the index is output (i.e. ...\eject) % before all the sections this is unnecessary % uncomment the line after the brace to see what \ZZ % expands to in case of weird errors \ZZ{\gtitletoks}{#1}{\secno}% write to contents file {\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss} \ifpdftex\expandafter\xdef\csname curr#1\endcsname{\secno}% \ifnum#1>0\countB=#1 \advance\countB by-1 \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi\fi % drop support for pdf specials: AS \ifon\startsection{\ttl#3}\smallskip\noindent\ignorespaces} \outer\def\chapterN#1#2#3.{% beginning of starred section in `book' mode \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\stsecchappreseparator{#1}\fi % before the title \message{*\secno}% progress report \def\stripprefix##1>{}\def\gtitletoks{#3}% \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}% \edef\next{% \write\cont{%\noexpand\noexpand\noexpand\eatone{\noexpand\meaning\noexpand\ZZ}% \noexpand\noexpand\noexpand % AS this is a (sort of) bug in cwebmac.tex % as long as the index is output (i.e. ...\eject) % before all the sections this is unnecessary % uncomment the line after the brace to see what \ZZ % expands to in case of weird errors \ZZ{\gtitletoks}{#1}{\secno}{\noexpand\the\pageno}{\the\toksE}% \ZZ{title}{depth}{sec}{page}{ss} }}\next % write to contents file \ifpdftex \expandafter\xdef\csname curr#1\endcsname{\secno}% \ifnum#1=\z@ \countB=#1 \advance\countB by\@ne \expandafter\xdef\csname curr\the\countB\endcsname{\secno}% \advance\countB by\@ne \expandafter\xdef\csname curr\the\countB\endcsname{\secno}% \advance\countB by\@ne \expandafter\xdef\csname curr\the\countB\endcsname{\secno}% \fi % allow subsection depth to jump up to 3 levels after a chapter: AS \ifnum#1>0\countB=#1 \advance\countB by-1 %\message{#3::chunk\the\countB.\expnumber{curr\the\countB}::\expnumber{chunk\the\countB.\expnumber{curr\the\countB}}}% \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}% \fi \fi % drop support for pdf specials: AS \ifon\stsecchap{#1}{#3}\ignorespaces } \def\writebookmarkline#1#2#3#4#5{{% the scheme for bookmarks is rather fragile % the proper implementation must involve a stack: AS \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let \edef\depth{\expnumber{chunk#2.#3}}% \ifnum\depth=\z@ % allow subsection depth to jump up to 3 levels: AS \countB=#2 \advance\countB\@ne \edef\depth{\expnumber{chunk\the\countB.#3}}% \ifnum\depth=\z@ \advance\countB\@ne \edef\depth{\expnumber{chunk\the\countB.#3}}% \fi \fi %\message{bookmark for #5::depth:\depth::#2.#3}% \pdfoutline goto num #3 count -\depth {#5}}} \def\stsecchappreseparator#1{% separator between the end of the previous section and the current one \ifnum#1<\tw@ \vfil\eject % force page break for chapters and major subsections \ifodd\pageno \else \null\vfill\eject \fi \else \vskip0pt plus 3.5\baselineskip \penalty-100 \vskip0pt plus -3.5\baselineskip \vskip\intersecskip % no forced page break \fi } \def\stsecchap#1#2{\rightskip=0pt % get out of C mode (cf. \B) \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 % \ifnum#1>0 \noindent{\let\*=\lapstar\llap{\tentitle\secstar\quad}}{\ttl #2}\smallskip\noindent% push it to the margins \else \null % sloppy but this works for the narrow case of this example \global\chapterheadtrue \vskip1.5in \vbox{\tabskip=0pt plus 1 fil \halign to\hsize{% \hfil##\tabskip=0pt\cr \cmhuge\secstar\cr \noalign{\vskip 1pc}% \cmmiddle#2\cr }% }% \bigskip \noindent \fi % \ifpdftex\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\ifmakepdf\pdfdest num \secstar fith\fi}}% this space is a bug in the original cwebmac.tex; AS \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\special{% pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi} \outer\def\textM#1{\MN{#1}\ifon\vskip0pt plus 3\baselineskip\penalty-100\vskip0pt plus -3\baselineskip % no page break \vskip\intersecskip\startsection\ignorespaces} \def\MN#1{\par % common code for \M, \N {\xdef\secstar{#1}\let\*=\empty\xdef\secno{#1}}% remove \* from section name \ifx\secno\secstar \onmaybe \else\ontrue \fi \mark{{\secno}{\the\gdepth}{\the\gtitle}}% remove the annoying `paragraph' sign; AS } % a new start section macro: fix the extra space bug and push the section number to the margins \def\stseclap{\rightskip=0pt % get out of C mode (cf. \B) \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 \noindent{\let\*=\lapstar\llap{\tentitle\secstar\quad}}% push it to the margins \ifpdftex\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\ifmakepdf\pdfdest num \secstar fith\fi}}% this space is a bug in the original cwebmac.tex; AS \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\special{% pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi} \let\startsection\stseclap \newif\ifchapterhead % make page and section number hang in the margins; \quad is chosen to % be consistent with section appearance; the page numbers are printed % in old-style numerals; \def\lheader{% \ifchapterhead \hfil \else \termindexfalse\headertrue\llap{\mainfont\oldstyle\the\pageno\tentitle\quad}% \eightpoint\rm\grouptitle\hfill\title \rlap{\tentitle\quad\secrangedisplay}% \fi } % top line on left-hand pages \def\rheader{% \ifchapterhead \hfil \else \termindexfalse\headertrue\llap{\secrangedisplay\tentitle\quad}% \eightpoint\rm\title\hfill\grouptitle \rlap{\tentitle\quad\mainfont\oldstyle\the\pageno}% \fi } % top line on right-hand pages \def\secrangedisplay{{\tenpoint$^{\hbox{\sevenrm\topsecno}}_{\hbox{\sevenrm\botsecno}}$}} \def\botsecno{\expandafter\takeone\botmark} % the first section on the % next page \newif\ifsepsectionchapter % do we put the section list in its own chapter? \def\finmod{% \parfillskip 0pt plus 1fil \def\grouptitle{NAMES OF THE SECTIONS} \let\topsecno=\nullsec \message{Section names:} \setpage \def\note##1##2.{\quad{\eightrm##1~\ifacro{\pdfnote##2.}\else{##2}\fi.}} \def\Q{\note{Cited in section}} % crossref for mention of a section \def\Qs{\note{Cited in sections}} % crossref for mentions of a section \def\U{\note{Used in section}} % crossref for use of a section \def\Us{\note{Used in sections}} % crossref for uses of a section \def\I{\par\hangindent 2em}\let\*=* \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X % \ifpdftex %\makebookmarks % move this to just before the contents so \inxmod has a % chance to close the \cont channel; AS \ifsepsectionchapter\else\pdfdest name {NOS} fith \fi %\pdfoutline goto name {NOS} count -\secno {\outsecname}% %\def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% %{\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% %\pdfoutline goto num \the\toksA \expandafter{\the\toksE}% % remove bookmarks for individual sections to avoid unpleasant % pdf navigation artefacts; AS %} % pdf specials are not supported: AS \fi \fi % \bigskip \vskip0pt plus 5pt \penalty-10 \tenpoint \centerline{\sc A LIST OF ALL SECTIONS} \penalty300 \medskip \emergencystretch=12pt \sectionlistsetup \readsections } \let\sectionlistsetup\relax \def\YYcontentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil \ \ifacro \pdfstartlink attr {/Border [0 0 0]} goto page #4 {/FitH} \BlueGreen #3\Black\pdfendlink \else#3\fi\hbox to3em{\hss#4}}} \def\YYwritebookmarkline#1#2#3#4#5{{% \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let \pdfoutline goto page #4 {#4} count 0 {#5}}} \def\makebookmarks{\let\ZZ=\writebookmarkline \let\YY\YYwritebookmarkline \readcontents\relax} \def\topofcontents{% \null\vskip-3\baselineskip\centerline{C{\sc ONTENTS} (\sc\uppercase\expandafter{\title})}\medskip \ifacro \ifpdftex \makebookmarks \ifsepsectionchapter\else\pdfoutline goto name {NOS} count 0 {\outsecname}\fi% no section listing; AS \pdfdest name {TOC} fith % bookmark for the table of contents \fi \fi \let\YY\YYcontentsline } \def\botofcontents{\vfill \ifpdftex\pdfoutline goto name {TOC} count 0 {Table of Contents}\fi \centerline{\covernote}} % this material will end the table of contents page \newwrite\exampletable \newif\ifsaveparseoutput \newif\ifchecktable % \Cee\ section macros % stage one macros for `\B' sections: collecting tokens % \B is always paired with \par (see CWEAVE section 213); unfortunately, this is % where certainty ends; the output of \CWEAVE\ is woefully unstructured, to say the % least; the ugly hack below appears to be the only way to typeset the \Cee\ sections % in their own style (using the 9pt face as is the case below). \let\oldB\B \long\def\Bvbpp#1\par{% the \vb{\yyendgame}\vb... is inserted by brack.pl \Bvbp@#1\cleanBtail\X\X$\E$\par } \def\cleanBtail\X\X$\E${} \long\def\Bvbp@#1\X#2\X$#3\E#4$#5\par{% \yystringempty{#5}% {% this is a \Cee\ section (@c or @p); it is tempting to assume that the suffix % is \X\X$\E$\par and forego the invocation of \Bvb@@, however, this is not always % the case as the first \X may come from a different section in the middle. \oldB#1\X#2\X$#3\E#4$\par }{% the logic here is not perfect but if this is still a \Cee\ section, % inserting @t@> between @> and whatever follows that produces $...\E...$ % will correct the misidentification (the result of which may be, at best, % part of the section being typeset in a wrong face, or, worse \begingroup % starting a group in a wrong place (such as in the middle of the math mode)) \oldB#1\X#2\X${#3}\E{#4}$\begingroup % the braces around #3 and #4 are necessary % to ensure proper spacing around \E in case % #3 and #4 are empty \ninepoint \Binputtoks{#5}\Btoksmathfalse #5\par\endgroup }% } \newtoks\Binputtoks \newif\ifBtoksmath % does the section start in math mode? \let\yyendgame\empty \let\postparse\empty % the `upper half' \preparse... macros will use the contents of \Binputtoks \newif\ifyyskipparse \let\B\Bvbpp % parser stack setup \def\fillpstack#1#2{% \expandafter\def\csname currentparser[#1]\endcsname{#2}% } \def\poppstack#1{% \expandafter\ifx\csname currentparser[#1]\endcsname\relax \yybreak{% unknown language, skip the section \preparsetrivial } \else \yybreak{% \expandafter\expandafter\expandafter \p@ppstack\csname currentparser[#1]\endcsname\end{#1}% }% \yycontinue } \def\p@ppstack#1#2\end#3{% \yystringempty{#2}{% \fillpstack{#3}\relax#1% }{% \fillpstack{#3}{#2}#1% }% } % section macros \def\lsectionbegin#1{% \ifmmode \yybreak{% {}$% exit the group inside the math mode \Btoksmathtrue \poppstack{#1}\vb{}$% }% finish the math mode and reinsert it as stash \else \yybreak{% \poppstack{#1}% }% \yycontinue } \def\skiptolsection#1\lsectionbegin#2{% \ifBtoksmath \yybreak{% \lsectionbegin{#2}\vb{}${}% }% \else \yybreak{% \lsectionbegin{#2}% }% \yycontinue } \def\removefinalvb#1\endparse{} \def\preparsetrivial#1\postparse{} % in case the section contains some dangerous % terms like \insertraw{...} that must be skipped % URL typesetting \def\urls#1#2{% make it possible to omit the `https://' nonsense \hskip0pt plus .3\hsize\penalty1000 \hskip0pt plus -.3\hsize {% \def~{\string~}% \ifmakepdf \pdfURL{{\tt #2}}{#1#2}% \else {\tt #2}% \fi }% \hskip0pt plus .2\hsize\penalty1000 \hskip0pt plus -.2\hsize\relax % this is somewhat of an infidelity in \TeX's syntax } \def\urll#1#2{% make it possible to omit the `https://' nonsense \hskip0pt plus .3\hsize\penalty1000 \hskip0pt plus -.3\hsize {% \def~{\string~}% \ifmakepdf \pdfURL{#2}{#1}% \else {\tt #2}% \fi }% \hskip0pt plus .2\hsize\penalty1000 \hskip0pt plus -.2\hsize\relax % this is somewhat of an infidelity in \TeX's syntax } \def\url#1{\urls{}{#1}} % commonly used names \def\CWEB{\.{CWEB}} \def\CTANGLE{\.{CTANGLE}} \def\CWEAVE{\.{CWEAVE}} \def\WEB{\.{WEB}} \def\Pascal{P{\sc ASCAL}} \def\noweb{\.{noweb}} \def\splint{\.{SPLinT}} \def\POSIX{{\sc POSIX}} \def\AST{{\sc AST}} \def\EAST{{\sc EAST}} \def\WEST{{\sc WEST}} \def\ISO{{\mc ISO}} \def\bison{\ifheader B{\sc ISON}\else\.{bison}\fi} \def\flex{\ifheader F{\sc LEX}\else\.{flex}\fi} \def\lex{\.{lex}} \def\yacc{\.{yacc}} \def\gcc{\.{gcc}} \def\ld{\ifheader LD\else\.{ld}\fi} \def\GNU{{\sc GNU}} \def\CEEPP/{{\mc C{\tt ++}\spacefactor1000}} \def\Ceepp{\CEEPP/} \def\mft{\.{mft}} \def\MF{{\tt META}\-{\tt FONT}\spacefactor1000 } \def\MP{{\tt META}\-{\tt POST}\spacefactor1000 } % from tugboat.cmn \newbox\TestBox \def\La{\tempca=\the\fam \leavevmode L% \setbox\TestBox=\hbox{$\fam\tempca\scriptstyle A$}% \kern-.5\wd\TestBox\raise.42ex\box\TestBox} \def\LaTeX{\La\kern-.15em\TeX} \def\sqbullet{\kern.3ex\vrule height .9ex width .8ex depth -.1ex }% square bullet (from manmac.tex) \def\sqebullet{% empty square bullet \kern.3ex\vbox{\hsize=.8ex \hrule height .4pt \kern-.4pt \hbox to\hsize{\vrule height .9ex \hfill\vrule height .9ex} \kern-.4pt \hrule height .4pt \kern.1ex }% } % a `union' to control command sequences in the .aux files; \def\auxunionctl{}% here we add sequences that control namespace switching % although it is handled as a `union', we plan to execute this % sequence rather than use it as a storage list \newwrite\auxstream \def\initauxstream{% this command should be executed only after % all the command sequances have been loaded (i.e. after % noweb.sty, dcols.sty, etc. have been loaded) \immediate\openin\trystream=\jobname.aux \ifeof\trystream \else \restorecslist{aux:global:activate}\auxunionctl \auxunionctl % activate/deactivate individual subsets \immediate\closein\trystream \input \jobname.aux \fi \immediate\openout\auxstream=\jobname.aux \restorecslist{aux:global:prestart}\auxunionctl \auxunionctl } \def\everyendofjob{% \restorecslist{aux:global:precutoff}\auxunionctl \auxunionctl % write delayed data to the stream \immediate\closeout\auxstream \restorecslist{aux:global:preend}\auxunionctl \auxunionctl % do end of run tasks for every command set that writes to aux stream \message{Closed auxilary streams}% } % \end amendment, based on stackexchange question/answer by Bruno LeFloch % https://tex.stackexchange.com/questions/39279/test-whether-end-will-really-end-the-run/40894 % with some simplifications (we do not really need to take care of every possible situation % since the \end command appears at a predictable spot) \def\newend{% \ifdim\pagegoal=\maxdimen \yybreak{\checkdeadcycles}% \else \yybreak{\end}% do nothing, the regular \output will take care of the endgame \yycontinue } \def\checkdeadcycles{% \ifnum\deadcycles=\z@ \yybreak{\testpageforstuff}% \else \yybreak{\end}% do nothing, the regular \output will take care of the endgame \yycontinue } % insert the same material \end would insert (see The \TeX book, p.~264) \def\forceoutputagain{% \prevdepth=-1000pt \hbox{}\vfill\penalty-'10000000000 } \def\testpageforstuff{% temporarily replace the output routine % to check if the page contains stuff other than boxes \begingroup\output{\aftergroup\endgroup\testpageoutput}% \forceoutputagain % call the new output routine } \def\testpageoutput{% \deadcycles=\z@ \cleantemppage \yyifpageempty % is there any stuff other than boxes in the vertical list? % this macro is only expanded if \pagegoal=\maxdimen and \deadcycles=0 {\everyendofjob}% vertical list is empty {}% whatsit nodes present, let \end take care of them \aftergroup\end \unvbox255 \ifnum\outputpenalty=\@M % 10000 the break was not at a penalty item \else \penalty\outputpenalty \fi } \def\cleantemppage{% remove material inserted by \forceoutputagain \setbox255\vbox{% \unvbox255 \unskip % remove \vfill \setbox0\lastbox % remove \hbox{} \unskip % remove \topskip }% } \def\yyifpageempty{% \setbox\z@\vbox{% \vbox{}\unvcopy255\setbox0\lastbox \expandafter }% \ifvoid\z@ %\vbox was not the last item, force output again \yybreak{\yysecondoftwo}% \else \yybreak{\yyfirstoftwo}% \yycontinue } \def\con{\par\vfill\eject % finish the section names % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers \rightskip 0pt \hyphenpenalty 50 \tolerance 200 \setpage \output={\normaloutput\page\lheader\rheader} \titletrue % prepare to output the table of contents \pageno=\contentspagenumber \def\grouptitle{TABLE OF CONTENTS} \message{Table of contents:} \topofcontents \startpdf \line{\hfil Section\hbox to3em{\hss Page}} \let\ZZ=\contentsline \readcontents\relax % read the contents info \botofcontents \newend } % print the contents page(s) and terminate % sugar \def\FOREVER{{\bf forever}} % microtypography extensions: activate optical alignment \ifacro \ifpdftex \input other/texmf/macros/protcode.tex \pdfprotrudechars=2 \setprotcode\tenrm \setprotcode\ninerm \setprotcode\eightrm \setprotcode\sevenrm \setprotcode\sixrm \setprotcode\tenit \setprotcode\nineit \setprotcode\eightit \setprotcode\sevenit \setprotcode\sixit % do not stretch characters %\pdfdjustspacing=2 %\pdffontexpand\sevenrm 30 20 10 autoexpand \fi \fi % TODO: use \pdfsavepos, \pdflastxpos, and \pdflastypos to % save the position of index terms on the page % unstable macros % two column typesetting for short sections % CAUTION: while the macros below seem to work, their use requires a great deal of care % o they assume that the sections are narrow so only use them if you are reasonably sure that % the width of the sections to be typeset as double column text are stable and not % going to change much % o sections to be so typeset should not be part of `concatenated' @c sections; otherwise % the noweb style section pointers in the margins will clash with the text in the adjacent % column (this is not a concern if the traditional \CWEB\ referencing style is used \def\dcolbM{\expandafter\let\csname M\endcsname\thisM \vskip 0pt plus 3\baselineskip\penalty-100 \vskip 0pt plus -3\baselineskip \vskip\ht\strutbox \vskip-\topskip % negate the \topskip at the beginning of the column box \vskip-\smallskipamount \vskip\intersecskip \begindoublecols \csname M\endcsname } \def\dcolbN{\expandafter\let\csname M\endcsname\thisN \vskip\ht\strutbox \vskip-\topskip % negate the \topskip at the beginning of the column box \vskip-\smallskipamount \vskip\intersecskip \begindoublecols \csname N\endcsname } \def\dcoleM{% \vfil\enddoublecols \crudelet{M}{thisM}% \crudelet{N}{thisN}% \csname M\endcsname } \def\dcoleN{% \vfil\enddoublecols \crudelet{M}{thisM}% \crudelet{N}{thisN}% \csname N\endcsname } \def\beginfoldedsections{% begin double column output starting with the next % \M or \N section \ifbootstrapmode \else \crudelet{thisM}{M}% \crudelet{thisN}{N}% \crudelet{M}{dcolbM}% \crudelet{N}{dcolbN}% \fi } \def\endfoldedsections{% finish double column output starting with the next % \M or \N section \ifbootstrapmode \else \crudelet{M}{dcoleM}% \crudelet{N}{dcoleN}% \fi } \def\crudelet#1#2{% ignore \outer (as a useful side effect these assignments can be skipped % as a part of an \if... statement without producing `incomplete \iftrue' % or like errors \edef\next{\global\let\expandafter\nx\csname#1\endcsname\expandafter\nx\csname#2\endcsname}\next } \def\beginfoldedsectionshere{% similar to \beginfoldedsections but can be used immediately % before the @c portion of the section that will be typeset in two % columns; this way the \TeX\ portion of the section can still be % typeset in a single column % save the current section macro to be restored by \endfoldedsections \ifbootstrapmode \else \crudelet{thisN}{N}% both types of section macros are saved \crudelet{thisM}{M}% just in case the section changes to an \M section \vskip\ht\strutbox \vskip-\topskip % negate the \topskip at the beginning of the column box \vskip-\smallskipamount % undo the skip from \begindoublecols \yskip \begindoublecols \parindent=1em \fi } % support reproducible compilation \ifpdftex \pdfinfoomitdate=1 \pdftrailerid{}% \fi \tenpoint