diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-12 03:04:00 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-12 03:04:00 +0000 |
commit | 0ce40abb18ec02ec6fd6bcc5f21612c88daa7578 (patch) | |
tree | 416289fe1448873fd8ca33051f50ad85bffa8aaa /support/splint/tex/dcols.sty | |
parent | fdb18507cd80dc17f5a5256153d34668b4f4e61c (diff) |
CTAN sync 202010120303
Diffstat (limited to 'support/splint/tex/dcols.sty')
-rw-r--r-- | support/splint/tex/dcols.sty | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/support/splint/tex/dcols.sty b/support/splint/tex/dcols.sty index 2560495d45..71176efd14 100644 --- a/support/splint/tex/dcols.sty +++ b/support/splint/tex/dcols.sty @@ -1,4 +1,4 @@ -% Copyright 2004-2014, Alexander Shibakov +% Copyright 2004-2020, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify @@ -74,8 +74,9 @@ \footglue=1em plus.2em minus.1em \adjskip=0pt plus 6pt -\topskip=9pt - +%\topskip=9pt +%\normalbottom % one of these must accompany the use of the macros below + % so that the columns are aligned % \def\setmcparams{% @@ -231,7 +232,7 @@ \dsskip\smallskipamount -\def\begindoublecols{\begingroup\r@ggedbottomfalse\parindent=0pt +\def\begindoublecols{\begingroup\normalbottom\parindent=0pt \count\footins=\@m \multiply\count\footins by\fnotesspan \skip\footins=\fnotesspan\realfootins \remaindergaps=\noofcolumns @@ -718,7 +719,19 @@ % footnote counting macros \let\footthenotes\empty -\footline{\footthenotes}% so the footnotes know where to reset + +\footline{% + \footthenotes % so the footnotes know where to reset + \ifchapterhead + \vbox to 0pt{ + \hbox to\pagewidth{\hfil + \mainfont\vrule width 0pt height 2pc\oldstyle\the\pageno + \hfil} + \vss + }% + \global\chapterheadfalse + \fi +} \def\fnmark#1{{% \ifnum#1<\@M @@ -741,20 +754,25 @@ % auxiliary file (we have to read it in whole because it will be % rewritten as the document is being typeset); this opening has to be % done carefully for the file might not be there yet; check for it first. +% as a side note, one should not use the same stream number (at least the +% one allocated by a \new... command) for both the input and the output +% streams, since one might accidentally close a different stream that +% happened to have the same index but allocated by a \new... command as a +% stream of a different type. -\newread\fnlabels +\newread\tryfnlabels % to check if the file exists \newwrite\fnlabels \newcount\localfn % footnote count \newcount\fniteration \def\setupfootnotes{% this macro should be used at the beginning of the file, after a box (preferably) - \def\footthenotes{\write\fnlabels{\noexpand\addpgendlabel}}% - \openin\fnlabels=\jobname.ftn\relax - \ifeof\fnlabels - \closein\fnlabels\relax + \let\footthenotes\markbottomofpage + \openin\tryfnlabels=\jobname.ftn\relax + \ifeof\tryfnlabels + \closein\tryfnlabels\relax \fniteration\z@ \else - \closein\fnlabels\relax + \closein\tryfnlabels\relax \input \jobname.ftn\relax \fi \edef\savedfnstream{\the\fnstream}% @@ -764,30 +782,38 @@ \write\fnlabels{\noexpand\fniteration\the\fniteration\space}% } -\def\unsetfootnotes{% a clean(er) way to terminate footnote accounting -% \let\footthenotes\footthenoteslast - \def\footthenotes{\closeout\fnlabels\let\footthenotes\empty}% +\def\markbottomofpage{% + \write\fnlabels{\noexpand\addpgendlabel}% } -% the control sequence below is not used, although the idea is clear; -% unfortunately, this does not work, since \closeout\fnlabels is delayed -% so \input \jobname.ftn is likely to import an empty file; -% a more elaborate strategy is possible whereby all the macros inside -% \jobname.ftn are made expandable and the test below (along with \input \jobname.ftn) -% is put inside \write\m@ne{ ... } (so that the expansion of \input \jobname.ftn is -% delayed) using string comparison macros defined elsewhere -% but at the moment it seems excessive - -\def\footthenoteslast{% unused, see above - \closeout\fnlabels +\def\unsetfootnotes{% + \def\footthenotes{% + \write\fnlabels{\noexpand\endinput}% + \closeout\fnlabels + \global\let\footthenotes\checkfootnotestream% + % it is tempting to say \input \jobname.ftn + % at this point to use in the test below but this is not + % going to work: the \closeout will get invoked during the + % \shipout, which happens after the page is set and these + % macros are expanded. + % note that using another `stream' sequence for this purpose + % would not work either, since a footnote at the bottom of the + % page might `fire' but would be put on the next page by + % the epage builder. + }% +} + +\def\checkfootnotestream{% this needs at least one extra page to work correctly ... \fnstream{}% - \input \jobname.ftn + \input\jobname.ftn \edef\next{\the\fnstream}% \ifx\next\savedfnstream - \else + \message{Footnotes are stable ...}% + \else % this test is too strict, a better way would be to check that + % \next is a prefix in \savedfnstream and the remaining characters are all `|' \message{Footnotes may be set incorrectly ...}% \fi - \let\footthenotes\relax + \global\let\footthenotes\empty } \def\setfnmark{{% @@ -807,7 +833,7 @@ \def\splitfnstream{\edef\tempdefone{\the\fnstream}% \ifx\tempdefone\empty - \def\nexttok{?}\message{You need to recount the footnotes ...}% + \def\nexttok{?}\message{You may have to reposition the footnotes ...}% \else \expandafter\splitfnstre@m\tempdefone\end \fi |