diff options
author | Norbert Preining <norbert@preining.info> | 2024-02-01 03:00:51 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-02-01 03:00:51 +0000 |
commit | a494a509f3f4a13a450c898488155f7aa5353bd3 (patch) | |
tree | ab11a3116dfe36f273b0eefe1a7abb556253a9c8 /support/splint/tex/limbo.sty | |
parent | 79e1bbc1ad6b308aa2074540b2afd43b6a72ce03 (diff) |
CTAN sync 202402010300
Diffstat (limited to 'support/splint/tex/limbo.sty')
-rw-r--r-- | support/splint/tex/limbo.sty | 454 |
1 files changed, 377 insertions, 77 deletions
diff --git a/support/splint/tex/limbo.sty b/support/splint/tex/limbo.sty index c810cd55da..91ec2c973f 100644 --- a/support/splint/tex/limbo.sty +++ b/support/splint/tex/limbo.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2024, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify @@ -164,6 +164,11 @@ \font\sevenfrak=eufm7 \font\sixfrak=eufm6 +\font\nineidss=idssbx9 +\font\eightidss=idssbx8 +\font\sevenidss=idssbx7 +\font\sixidss=idssbx6 + \font\hv=phvr \font\dings=pzdr @@ -230,7 +235,7 @@ \def\ssfb{\fam\ssfam\tenssb}% \def\ssfbn{\fam\ssbnfam\tenssb}% \textfont\ssbnfam=\tenssn\scriptfont\ssfam=\sevenssn - \textfont\ttfam=\tentt + \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 @@ -243,6 +248,7 @@ \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} @@ -280,7 +286,7 @@ %no room for another font family \def\ssfbn{\fam\ssbnfam\ninessn}% \textfont\ssbnfam=\ninessn\scriptfont\ssbnfam=\sixssn - \textfont\ttfam=\ninett + \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 @@ -293,6 +299,7 @@ \let\mc=\eightrm \let\cyr=\ninecyr \let\big=\ninebig + \let\idss=\sevenidss \setbox\strutbox=\hbox{\vrule height8pt depth3pt width0pt}% \let\sscmd\sixpoint \normalbaselines\rm} @@ -340,6 +347,7 @@ \let\mc=\sevenrm \let\cyr=\eightcyr \let\big=\eightbig + \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height7pt depth2pt width0pt}% \let\sscmd\sixpoint \normalbaselines\rm} @@ -381,6 +389,7 @@ \let\sci=\sixit \let\mc=\sixrm \let\big=\sevenbig + \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height6pt depth2pt width0pt}% \normalbaselines\rm} @@ -421,6 +430,7 @@ \let\sci=\sixit \let\mc=\sixrm \let\big=\sixbig + \let\idss=\sixidss \setbox\strutbox=\hbox{\vrule height5.5pt depth1.5pt width0pt}% \normalbaselines\rm} @@ -591,7 +601,8 @@ % demo code display % **H will produce a `|', **K can be used as an escape character, **L and **N -% can be used i place of left and right braces to provide some control +% 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}}% @@ -607,7 +618,7 @@ \catcode`\^=\active\democodelc=0 \catcode`\*=7 \chardef\*=`\*% \catcode`\^^H=\active % ^^H - \catcode`\^^K=0 \catcode`\^^L=1 \catcode`\^^N=2 + \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% @@ -615,6 +626,10 @@ \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 @@ -645,7 +660,8 @@ \epsfbox{#1.eps}\fi } -\let\yl| % to use in \TeX\ mode instead of `|' +\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; @@ -760,7 +776,7 @@ \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 + \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 @@ -800,46 +816,74 @@ \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 + % 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 - \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 - \fi - \message{*\secno} % progress report + \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}% 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 + \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 % @@ -891,7 +935,7 @@ \newif\ifchapterhead -% make page and sectoin number hang in the margins; \quad is chosen to +% 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; @@ -901,7 +945,7 @@ \else \termindexfalse\headertrue\llap{\mainfont\oldstyle\the\pageno\tentitle\quad}% \eightpoint\rm\grouptitle\hfill\title - \rlap{\tentitle\quad\tenpoint$^{\hbox{\sevenrm\topsecno}}_{\hbox{\sevenrm\botsecno}}$}% + \rlap{\tentitle\quad\secrangedisplay}% \fi } % top line on left-hand pages @@ -909,23 +953,19 @@ \ifchapterhead \hfil \else - \termindexfalse\headertrue\llap{\tenpoint$^{\hbox{\sevenrm\topsecno}}_{\hbox{\sevenrm\botsecno}}$\tentitle\quad}% + \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 - -\newwrite\exampletable - -\newif\ifsaveparseoutput -\newif\ifchecktable +\newif\ifsepsectionchapter % do we put the section list in its own chapter? \def\finmod{% - \enddoublecols - \closeout\exampletable \parfillskip 0pt plus 1fil \def\grouptitle{NAMES OF THE SECTIONS} \let\topsecno=\nullsec @@ -942,21 +982,18 @@ \let\Xpdf\X % \ifpdftex - \makebookmarks - \pdfdest name {NOS} fitb - \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}} - \else - \ifpdf - \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi + %\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 % @@ -967,10 +1004,48 @@ \centerline{\sc A LIST OF ALL SECTIONS} \penalty300 \medskip - \emergencystretch=10pt + \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 @@ -982,17 +1057,13 @@ \let\oldB\B -\long\def\Bvbpp#1\par{% - \Bvbp@#1\X\X$\E$\par -} - \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{% new version of the above, experimental +\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 @@ -1086,21 +1157,38 @@ % URL typesetting -\def\url#1{% - \hskip0pt plus .3\hsize\penalty100 +\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 #1}}{#1}% + \pdfURL{{\tt #2}}{#1#2}% \else - {\tt #1}% + {\tt #2}% \fi }% - \hskip0pt plus .2\hsize\penalty100 - \hskip0pt plus -.2\hsize + \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}} @@ -1111,6 +1199,7 @@ \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}} @@ -1146,13 +1235,130 @@ }% } +% 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 extras/texmf/macros/protcode.tex + \input other/texmf/macros/protcode.tex \pdfprotrudechars=2 \setprotcode\tenrm \setprotcode\ninerm @@ -1167,10 +1373,104 @@ % do not stretch characters %\pdfdjustspacing=2 %\pdffontexpand\sevenrm 30 20 10 autoexpand - % TODO: use \pdfsavepos, \pdflastxpos, and \pdflastypos to - % save the position of index terms on the page \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 |