diff options
Diffstat (limited to 'macros/latex-dev/required/tools/multicol.dtx')
-rw-r--r-- | macros/latex-dev/required/tools/multicol.dtx | 128 |
1 files changed, 92 insertions, 36 deletions
diff --git a/macros/latex-dev/required/tools/multicol.dtx b/macros/latex-dev/required/tools/multicol.dtx index 25d4bc68db..2b74d85af9 100644 --- a/macros/latex-dev/required/tools/multicol.dtx +++ b/macros/latex-dev/required/tools/multicol.dtx @@ -98,7 +98,7 @@ %<driver> \ProvidesFile{multicol.drv} % \fi % \ProvidesFile{multicol.dtx} - [2021/07/06 v1.8z multicolumn formatting (FMi)] + [2021/10/08 v1.9a multicolumn formatting (FMi)] % % %% @@ -564,6 +564,13 @@ % forced into the second column (resulting in some white % space between paragraphs in the first column). % +% From version 1.9 onwards \cs{columnbreak} accepts an optional +% argument (just like \cs{pagebreak}) in which you can specify the +% desirability to break the column at that point: supported values are +% \texttt{1} to \texttt{4}. This version also adds \cs{newcolumn} +% which forces a column break but runs the column short (comparible to +% \cs{newpage}). +% % \subsection{Floats inside a \mc{} environment} % % Within the \mc{} environment the usual star float commands are @@ -981,7 +988,8 @@ % \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}} @@ -1071,7 +1079,8 @@ % \changes{v1.6e}{2004/02/14}{Avoid self-referencing definition of % \cs{@footnotetext} (pr/3618)}. % \begin{macrocode} - \ifx\@footnotetext\mult@footnotetext\else + \ifx\@footnotetext\mult@footnotetext + \else \let\orig@footnotetext\@footnotetext \let\@footnotetext\mult@footnotetext \fi @@ -1512,10 +1521,13 @@ \def\clearpage{% \ifx\@deferlist\@empty\else \PackageError{multicol}% - {Deferred floats not cleared}% - {A \string\clearpage\space inside multicols acts like - \string\newpage\space and doesn't clear floats.\MessageBreak - Move it before the multicols environment if you need it.}% + {Deferred floats not cleared}% + {A \string\clearpage\space inside + multicols acts like + \string\newpage\space and doesn't + clear floats.\MessageBreak + Move it before the multicols + environment if you need it.}% \fi \newpage}% % \end{macrocode} @@ -1701,7 +1713,8 @@ % for later. % \changes{v1.8r}{2018/01/28}{Macro added} % \begin{macrocode} -\mathchardef\@Mvi=10006 % 10005 is \columnbreak +\mathchardef\@Mvi=10006 % 10005 is + % \columnbreak % \end{macrocode} % \end{macro} % @@ -1724,7 +1737,8 @@ % \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} - \remove@discardable@items\color@endgroup\egroup + \remove@discardable@items + \color@endgroup\egroup % \end{macrocode} % Now we call |\balance@columns| the routine that balances material % stored in the box |\mult@box|. @@ -1754,7 +1768,7 @@ {Restore kept marks to\MessageBreak first: \meaning\kept@firstmark \MessageBreak bot\space\space: - \meaning\kept@botmark }% + \meaning\kept@botmark }% %</marktrace> % \end{macrocode} % This finishes the code for the ``boxed'' case. @@ -2203,7 +2217,7 @@ % \changes{v1.8x}{2019/10/15}{Use \cs{@maxdepth} not \cs{maxdepth} (gh/190)} % \begin{macrocode} \def\vfilmaxdepth{\vskip \z@ \@plus .0001fil - \@minus \@maxdepth} + \@minus \@maxdepth} % \end{macrocode} % \end{macro} % @@ -2335,7 +2349,8 @@ \setbox\count@ \vbox to\dimen@ {\unvbox\count@ - \ifshr@nking\vfilmaxdepth\fi}% + \ifshr@nking + \vfilmaxdepth\fi}% }% % \end{macrocode} % Then the last column follows. @@ -2615,7 +2630,8 @@ % \changes{v1.8r}{2018/01/28}{Handling end of env through special penalty} % \begin{macrocode} \ifnum\outputpenalty = -\@Mvi - \mult@info\@ne{End penalty of multicols seen}% + \mult@info\@ne{End penalty of + multicols seen}% % \end{macrocode} % If we are at this point then we have to run the balancing code % (which was previously its own output routine). First we pretend @@ -2626,7 +2642,9 @@ % in a better way; basically it is like this, because of the older % code was using different ORs and I simply reused most of it. % \begin{macrocode} - \outputpenalty\@M % pretend we had a natural forced break + \outputpenalty\@M % pretend we had + % a natural + % forced break \balance@columns@out \else % \end{macrocode} @@ -2647,7 +2665,8 @@ % this is possible with |\xdef|.) % \changes{v1.2a}{1990/02/05}{Float boxes freed.} % \begin{macrocode} - \xdef\@freelist{\@freelist\@currlist}% + \xdef\@freelist{\@freelist + \@currlist}% \gdef\@currlist{}% \fi \fi @@ -2822,8 +2841,9 @@ % |\enlargethispage| command. % \changes{v1.8a}{2011/12/20}{Support for \cs{enlargethispage}} % \begin{macrocode} - \ifvbox\@kludgeins\insert\@kludgeins - {\unvbox\@kludgeins}\fi + \ifvbox\@kludgeins + \insert\@kludgeins + {\unvbox\@kludgeins}\fi % \end{macrocode} % Then we |\unvbox| the |\partial@page| (which may be void if we % are not processing the first page of this \mc{} environment. @@ -2833,7 +2853,8 @@ % Then we return the first and bottom mark and the gathered % material to the main vertical list. % \begin{macrocode} - \return@nonemptymark{first}\kept@firstmark + \return@nonemptymark{first}% + \kept@firstmark \return@nonemptymark{bot}\kept@botmark \page@sofar % \end{macrocode} @@ -2960,12 +2981,14 @@ % \changes{v1.8w}{2019/03/01}{Provide minrows counter for balancing} % \begin{macrocode} \@tempdima\dimexpr - \topskip +\c@minrows\baselineskip-\baselineskip\relax + \topskip +\c@minrows\baselineskip + -\baselineskip\relax \ifnum\dimen@<\@tempdima \mult@info\@ne {Start value \the\dimen@ \space -> - \the\@tempdima \space (corrected for minrows)}% + \the\@tempdima \space + (corrected for minrows)}% \dimen@\@tempdima \fi % \end{macrocode} @@ -3466,7 +3489,9 @@ % 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 +\ifnum\numexpr + \count20-\count14-1<41 + % this is = 2 * 20 + 1 \count14=\@cclv \fi % \end{macrocode} @@ -4071,34 +4096,65 @@ % % \begin{macro}{\columnbreak} % \changes{v1.5u}{1999/05/25}{Macro added} +% \changes{v1.9a}{2021/10/08}{Added optional argument for conditional break} % |\columnbreak| is modeled after |\pagebreak| except that we % generate a penalty -10005. % \begin{macrocode} \mathchardef\@Mv=10005 -\def\columnbreak{% +\newcommand\columnbreak[1][4]{% % \end{macrocode} % We have to ensure that it is only used within a \mc{} % environment since if that penalty would be seen by the unmodified % \LaTeX{} output routine strange things would happen. % \begin{macrocode} - \ifnum\col@number<\tw@ - \PackageError{multicol}% - {\noexpand\columnbreak outside multicols}% - {This command can only be used within - a multicols or multicols* environment.}% - \else - \ifvmode - \penalty -\@Mv\relax - \else - \@bsphack - \vadjust{\penalty -\@Mv\relax}% - \@esphack - \fi - \fi} + \ifnum\col@number<\tw@ + \PackageError{multicol}% + {\noexpand\newcolumn outside multicols}% + {This command can only be used within + a multicols or multicols* environment.}% + \else +% \end{macrocode} +% Increasingly lower penalty based on argument value. This is like +% \cs{pagebreak} but we use other penalty values are the \LaTeX{} +% defaults aree rather pointless for pagination. +% \begin{macrocode} + \edef\mc@break@pen + {-\ifcase#1\@m\or 3333\or 6666\or 9999\else\@Mv\fi\relax}% + \ifvmode + \penalty \mc@break@pen + \else + \@bsphack + \vadjust{\penalty \mc@break@pen}% + \@esphack + \fi + \fi} % \end{macrocode} % \end{macro} % % +% +% \begin{macro}{\newcolumn} +% \changes{v1.9a}{2021/10/08}{Macro added} +% This is modeled after \cs{newpage} but for column breaks. +% \begin{macrocode} +\newcommand\newcolumn{% + \ifnum\col@number<\tw@ + \PackageError{multicol}% + {\noexpand\newcolumn outside multicols}% + {This command can only be used within + a multicols or multicols* environment.}% + \else + \ifvmode + \nobreak\vfill\penalty -\@Mv\relax + \else + \@bsphack + \vadjust{\nobreak\vfill\kern\z@\penalty -\@Mv\relax}% + \@esphack + \fi + \fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\colbreak@box} % \changes{v1.5u}{1999/05/25}{Macro added} % Need a box to collect the galley up to the column break. |