summaryrefslogtreecommitdiff
path: root/macros/latex/required/tools/multicol.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-03 03:02:01 +0000
committerNorbert Preining <norbert@preining.info>2020-02-03 03:02:01 +0000
commit34897eebd22c3de968b64f09bb4a371d96cb0b89 (patch)
tree19a50e54fca63f1f6482d6cb4c2fdee676fd97b1 /macros/latex/required/tools/multicol.dtx
parente05dc0bb38b16bfb9ba35591285e40af0adaadc4 (diff)
CTAN sync 202002030302
Diffstat (limited to 'macros/latex/required/tools/multicol.dtx')
-rw-r--r--macros/latex/required/tools/multicol.dtx124
1 files changed, 78 insertions, 46 deletions
diff --git a/macros/latex/required/tools/multicol.dtx b/macros/latex/required/tools/multicol.dtx
index d68f471fcd..39bccef2d7 100644
--- a/macros/latex/required/tools/multicol.dtx
+++ b/macros/latex/required/tools/multicol.dtx
@@ -98,7 +98,7 @@
%<driver> \ProvidesFile{multicol.drv}
% \fi
% \ProvidesFile{multicol.dtx}
- [2019/03/01 v1.8w multicolumn formatting (FMi)]
+ [2019/12/09 v1.8y multicolumn formatting (FMi)]
%
%
%%
@@ -134,7 +134,7 @@
% \DoNotIndex{\hbox,\hfil,\hrule,\ht,\hss}
% \DoNotIndex{\ifdim,\ifnum,\ifvoid,\ignorespaces,\insert,\immediate}
% \DoNotIndex{\let,\loop}
-% \DoNotIndex{\maxdepth,\message,\multiply}
+% \DoNotIndex{\@maxdepth,\message,\multiply}
% \DoNotIndex{\newbox,\newcount,\newdimen,\newskip,\number,\newpage}
% \DoNotIndex{\outputpenalty,\p@,\penalty}
% \DoNotIndex{\relax,\repeat,\setbox,\skip,\space,\splitmaxdepth}
@@ -470,7 +470,7 @@
% `\textsf{minrows}' (default 1). If set to a higher value then the
% balancing will have at least that many rows in the first column (and
% also all further columns until it runs outs of material).
-%
+%
% Additionally you can set another counter, the `\textsf{unbalance}'
% counter, to some positive \meta{number}. This will make all but the
% right-most column \meta{number} of lines longer than they would
@@ -978,9 +978,10 @@
% grid. Right now it doesn't do anything other than warning if it
% thinks that the grid got lost.
% \changes{v1.6a}{2003/03/15}{New option grid}
+% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
\let\mc@gridwarn\maxdimen
-\DeclareOption{grid}{\def\mc@gridwarn{\maxdepth}}
+\DeclareOption{grid}{\def\mc@gridwarn{\@maxdepth}}
% \end{macrocode}
%
% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}}
@@ -1033,19 +1034,20 @@
I therefore use two columns instead}%
\col@number\tw@ \fi
% \end{macrocode}
-% We have only enough box registers for ten columns, so we need to
+% We have only enough box registers for twenty columns, so we need to
% check that the user hasn't asked for more.
% \changes{v1.4k}{1992/06/27}{Maximum of 5 columns (temp)}
% \changes{v1.5a}{1992/11/04}{Allow 10 columns again}
+% \changes{v1.8y}{2019/12/09}{Allow for 20 columns (gh/237)}
% \begin{macrocode}
- \ifnum\col@number>10
+ \ifnum\col@number>20
\PackageError{multicol}%
{Too many columns}%
{Current implementation doesn't
- support more than 10 columns.%
+ support more than 20 columns.%
\MessageBreak
- I therefore use 10 columns instead}%
- \col@number10 \fi
+ I therefore use 20 columns instead}%
+ \col@number20 \fi
% \end{macrocode}
% Within the environment we need a special version of the
% kernel |\@footnotetext| command since the original sets the
@@ -1337,7 +1339,7 @@
% resetting the |\parshape| in case we are inside some list
% environment. The correct indentation for the \mc{} environment in
% such a case will be produced by moving the result to the right by
-% |\multicol@leftmargin| later on. If we would use the value of of
+% |\multicol@leftmargin| later on. If we would use the value of
% |\@totalleftmargin| directly then lists inside the \mc{}
% environment could cause a shift of the output.
% \changes{v1.4l}{1992/08/17}{saved \cs{@totalleftmargin}}
@@ -1718,7 +1720,7 @@
% remove any space at the end of the box as we don't want to use
% this in balancing. Because of the |\color@endgroup| this can't be
% done later in |\balance@columns| as the color command will hide
-% it.
+% it.
% \changes{v1.8c}{2013/11/03}{Add \cs{color@endgroup} to prevent color leak}
% \changes{v1.8f}{2014/06/19}{Discard spaces before adding \cs{color@endgroup}}
% \begin{macrocode}
@@ -1760,7 +1762,7 @@
\else
% \end{macrocode}
% If there was a |\columnbreak| on the very last line all material
-% will have been moved to the |\colbreak@box|. Thus the the galley
+% will have been moved to the |\colbreak@box|. Thus the galley
% will be empty and no output routine gets called so that the text
% is lost. To avoid this problem (though unlikely) we check if the
% current galley is empty and the |\colbreak@box| contains text and
@@ -1957,10 +1959,10 @@
% \end{macrocode}
% To allow checking whether some macro is used within the \mc{}
% environment the counter |\col@number| gets a default of |1|
-% outside the the environment.
+% outside the environment.
% \changes{v1.3d}{1991/10/23}{\cs{col@number} set to one}
-% \changes{v1.8o}{2016/02/08}{\cs{col@number} already initialized in the
-% kernel, so not initializing it in the package
+% \changes{v1.8o}{2016/02/08}{\cs{col@number} already initialized in the
+% kernel, so not initializing it in the package
% in case the document is in two-column (pr/4435)}
% \begin{macrocode}
%\col@number = 1
@@ -2143,7 +2145,7 @@
% However, in case one of the columns was unusually deep \TeX{} may
% have tried some corrective actions in which case backing up by
% the saved value will not bring us back to the baseline. A good
-% indication for this is a depth of |\maxdepth| though it is not an
+% indication for this is a depth of |\@maxdepth| though it is not an
% absolute proof. If the option \texttt{grid} is used
% |\mc@gridwarn| will expand to this, otherwise to |\maxdimen| in
% which case this warning will not show up.
@@ -2192,15 +2194,16 @@
% |\vfill| in that case but this is actually wrong for columns that
% are more or less full: by adding a glue at the bottom such a
% column doesn't have any depth any more but without it the material
-% would be allowed a depth of |\maxdepth|. So we allow shrinking by
+% would be allowed a depth of |\@maxdepth|. So we allow shrinking by
% that amount. This only makes a difference if the box would
% otherwise become overfull and shrinking never exceeds the
-% specified value, so we should be fine.
+% specified value, so we should be fine.
% \changes{v1.8h}{2014/09/12}{Macro added (pr/4395)}
% \changes{v1.8j}{2015/03/07}{Use only `0.0001fil' for stretching}
+% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
-\def\vfilmaxdepth{\vskip \z@ \@plus .0001fil
- \@minus \maxdepth}
+\def\vfilmaxdepth{\vskip \z@ \@plus .0001fil
+ \@minus \@maxdepth}
% \end{macrocode}
% \end{macro}
%
@@ -2246,13 +2249,13 @@
% appropriate values to |\splittopskip| and |\splitmaxdepth|.
% \begin{macrocode}
\splittopskip\topskip
- \splitmaxdepth\maxdepth
+ \splitmaxdepth\@maxdepth
% \end{macrocode}
% We also need to restrict |\boxmaxdepth| so that re-boxing is not
-% generating boxes with arbitrary depth.
+% generating boxes with arbitrary depth.
% \changes{v1.8j}{2015/03/07}{Set \cs{boxmaxdepth}}
% \begin{macrocode}
- \boxmaxdepth\maxdepth
+ \boxmaxdepth\@maxdepth
% \end{macrocode}
% Then we calculate the current column height (in |\dimen@|).
% Note that the height of |\partial@page| is already
@@ -2284,7 +2287,7 @@
% reestablished. However, in theory there is a possibility to sneak
% in a whole multicols environment into the running header
% definition. If that happens then it will also be affected by this
-% change---too bad I think.
+% change---too bad I think.
% \changes{v1.8a}{2011/12/20}{Support for \cs{enlargethispage}}
% \changes{v1.8v}{2018/12/27}{Removed dead code, the case where this
% can go wrong is too obscure to worry about it (gh/101)}
@@ -2443,7 +2446,7 @@
%
% Within the OR |\boxmaxdepth| needs to be unrestricted so we set it back
% now as it was changed above.
-% \changes{v1.8p}{2016/04/07}{Reset \cs{boxmaxdepth}}
+% \changes{v1.8p}{2016/04/07}{Reset \cs{boxmaxdepth}}
% \begin{macrocode}
\boxmaxdepth\maxdimen
\setbox\@cclv\vbox{\unvbox\partial@page
@@ -2477,7 +2480,7 @@
% Now we reset |\@colroom| to |\@colht| which is \LaTeX's
% saved value of |\textheight|.
% We also have to reset the recorded position of the last
-% |\marginpar| as well as the recorded size of in-text floats
+% |\marginpar| as well as the recorded size of in-text floats
% as we are now on a new page.
% \changes{v1.8d}{2014/04/23}{Reset \cs{@mparbottom} after page finishes}
% \changes{v1.8n}{2015/08/19}{Reset \cs{@textfloatsheight} after page finishes}
@@ -2585,7 +2588,7 @@
% e.g., after a display environment (if LaTeX would break here by
% its own it would break before the space following the display).
%
-% Thus we rebox box 255 once (using |\maxdepth| and calling
+% Thus we rebox box 255 once (using |\@maxdepth| and calling
% |\remove@discardable@items| inside). The depth of 255 will then
% give us the depth the box would have had if it would have been a
% natural break. We then unbox 255 to get it into the
@@ -2594,8 +2597,9 @@
% balancing later on.
% \changes{v1.8k}{2015/03/21}{Remove discardable items just before a
% forced break}
+% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
- \boxmaxdepth\maxdepth
+ \boxmaxdepth\@maxdepth
\setbox\@cclv\vbox{%
\unvbox\@cclv
\remove@discardable@items}%
@@ -2613,7 +2617,7 @@
\ifnum\outputpenalty = -\@Mvi
\mult@info\@ne{End penalty of multicols seen}%
% \end{macrocode}
-% If we are at this point then have have to run the balancing code
+% If we are at this point then we have to run the balancing code
% (which was previously its own output routine). First we pretend
% that we had a normal forced breakpoint and then call
% |\balance@column@out|. The latter may be let to |\multi@column@out|
@@ -2879,12 +2883,13 @@
% |\splittopskip| and allow for a bit of undershoot and overshoot
% by adding some stretch and shrink.
% \changes{v1.5?}{1994/?/?}{Allow columns to come out a bit long or short}
+% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
\@tempdima\topskip
\splittopskip\@tempdima
\@plus\multicolundershoot
\@minus\multicolovershoot
- \splitmaxdepth\maxdepth
+ \splitmaxdepth\@maxdepth
% \end{macrocode}
% We also have to set |\boxmaxdepth| which normally allows to
% build boxes with arbitrary depth, but as we are building text
@@ -2893,8 +2898,9 @@
% restriction posed by |\splitmaxdepth| gets lost.
% \changes{v1.8h}{2014/09/12}{All column boxes should obey
% \cs{maxdepth} (pr/4395)}
+% \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)}
% \begin{macrocode}
- \boxmaxdepth\maxdepth
+ \boxmaxdepth\@maxdepth
% \end{macrocode}
% The next step is a bit tricky: when \TeX{} assembles material in
% a box, the first line isn't preceded by interline glue, i.e.
@@ -3000,7 +3006,7 @@
\vbadness\@M
% \end{macrocode}
% We also allow for overfull boxes while we trying to split the
-% columns. They can easily happen if we have objects with unusual depth.
+% columns. They can easily happen if we have objects with unusual depth.
% \changes{v1.8h}{2014/09/12}{Do not report overfull}
% \begin{macrocode}
\vfuzz \maxdimen
@@ -3252,7 +3258,7 @@
% If we have unprocessed forced breaks we normally reiterate with a
% larger column size to fit them in eventually. However, if there
% are simply too many of them (e.g., 3 forced breaks but only 2
-% columns to balance) then this will never succeed and and we would
+% columns to balance) then this will never succeed and we would
% continue growing the columns until we hit the largest possible
% column size. So in addition we check how big the column size is
% compared to available room and if we exceed this by
@@ -3309,7 +3315,7 @@
%</badness>
\advance\dimen@\p@
\repeat
-% \end{macrocode}
+% \end{macrocode}
% If we come out of the loop with the switch |forcedbreak@leftover|
% set to true then balancing has failed and we should cut a normal
% page. We indicate this below with |\too@badtrue| when any of the
@@ -3446,7 +3452,25 @@
% of this setup in the documentation, sigh.) This produced a problem
% at the moment we had more than 5 columns because then officially
% allocated boxes were overwritten by the algorithm.
-% The new release now uses private box registers
+% The new release now uses private box registers.
+%
+% There was in fact a bug in the new implementation because at one
+% point \LaTeX{} started to use the extended registers and so
+% jumped from below 255 to above omitting the boxes allocated for
+% inserts and the output page box.
+%
+% So nowadays we really have to check if we get the full sequence
+% of boxes allocated without holes (i.e., $2\times\textit{max
+% cols}+1$) and if not alter the allocation registers to start
+% allocating after 255. This is all done quite low-level by looking
+% directly at the values of the allocation counters.
+% \changes{v1.8y}{2019/12/09}{Allow for 20 columns (gh/237)}
+% \begin{macrocode}
+\ifnum\numexpr \count20-\count14-1<41 % = 2 * 20 + 1
+ \count14=\@cclv
+\fi
+% \end{macrocode}
+%
% \begin{macrocode}
\newbox\mult@rightbox
\newbox\mult@grightbox
@@ -3460,6 +3484,16 @@
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
+\newbox\@tempa\newbox\@tempa
\newbox\@tempa
\let\@tempa\relax
% \end{macrocode}
@@ -3751,7 +3785,7 @@
%
% Special care is needed with handling |\vspace*| as that
% corresponds to |\penalty10000|, |\vskip <skip>|, followed by
-% |\vskip 0pt|. If we see this sequence going backwards in the the
+% |\vskip 0pt|. If we see this sequence going backwards in the
% vertical list we assume that this is a ``desired'' space. We
% therefore stop the recursion and reinsert the spaces.
%
@@ -3798,7 +3832,7 @@
% recurse.
% \begin{macrocode}
\vskip\@tempb\vskip\@tempa\relax
- \else
+ \else
\remove@discardable@items
\fi
\fi
@@ -3818,7 +3852,7 @@
\def\too@badtrue{\global\let\iftoo@bad\iftrue}
\def\too@badfalse{\global\let\iftoo@bad\iffalse}
% \end{macrocode}
-%
+%
% \changes{v1.8k}{2015/03/21}{The new switch}
% \begin{macrocode}
\newif\ifforcedbreak@leftover
@@ -3962,7 +3996,7 @@
% When ending the environment we simply end the inner
% \texttt{multicols} environment, except that we better also stick
% in some stretchable vertical glue so that the last column still
-% containing text is not vertically stretched out.
+% containing text is not vertically stretched out.
%
% We do this as follows: first we ensure that we are back in vertical mode
% and then we cancel out |\lastskip| if it was
@@ -3992,7 +4026,7 @@
\par
\ifdim\lastskip>\z@ \vskip-\lastskip \fi
\ifdim \prevdepth>\z@
- \vskip-\ifdim\prevdepth>\boxmaxdepth
+ \vskip-\ifdim\prevdepth>\boxmaxdepth
\boxmaxdepth
\else \prevdepth \fi
\fi
@@ -4309,9 +4343,9 @@
% \begin{macrocode}
\newcommand\@docolaction[4][1]{%
% \end{macrocode}
-%
-% How does the column number get associated with our label? We
-% do do this by writing another line into the aux file. Here are the
+%
+% How does the column number get associated with our label? We
+% do this by writing another line into the aux file. Here are the
% preparations.
% \begin{macrocode}
\edef\@docolactioncheck{\write\@auxout
@@ -4360,7 +4394,7 @@
% \begin{macrocode}
\newif\if@docolactionstar
% \end{macrocode}
-%
+%
% Because of extra data writing to the aux file the aux file will
% now contain something like the following after the document is
% processed the first time:
@@ -4446,5 +4480,3 @@
% \Finale
%
\endinput
-
-