diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/tools/multicol.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/tools/multicol.dtx | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/tools/multicol.dtx b/Master/texmf-dist/source/latex/tools/multicol.dtx index 28523c3fef5..f1d8b777d38 100644 --- a/Master/texmf-dist/source/latex/tools/multicol.dtx +++ b/Master/texmf-dist/source/latex/tools/multicol.dtx @@ -8,7 +8,7 @@ % conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in -% http://www.latex-project.org/lppl.txt +% https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later. % @@ -20,7 +20,7 @@ % \iffalse This is a METACOMMENT % %% Package `multicol' to use with LaTeX2e -%% Copyright 1989-2016 Frank Mittelbach +%% Copyright 1989-2018 Frank Mittelbach %% %% In addition to the terms of LPPL any distributed version %% (unchanged or modified) of multicol has to keep the statement @@ -86,12 +86,19 @@ %<*dtx> \ProvidesFile{multicol.dtx} %</dtx> -%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%<package>\NeedsTeXFormat{LaTeX2e}[2018-04-01] +%<package> +%<package>\providecommand\DeclareRelease[3]{} +%<package>\providecommand\DeclareCurrentRelease[2]{} +%<package> +%<package>\DeclareRelease{}{2017-04-11}{multicol-2017-04-11.sty} +%<package>\DeclareCurrentRelease{}{2018-04-01} +%<package> %<package>\ProvidesPackage{multicol} %<driver> \ProvidesFile{multicol.drv} % \fi % \ProvidesFile{multicol.dtx} - [2017/04/11 v1.8q multicolumn formatting (FMi)] + [2018/04/01 v1.8r multicolumn formatting (FMi)] % % %% @@ -1667,6 +1674,24 @@ % \end{macrocode} % \end{macro} % +% +% \begin{macro}{\@Mvi} +% In versions prior to 1.8r the balancing at the end of the +% environment was done by changing the output routine from +% |\multi@column@out| to |\balance@column@out|. As it turned out +% that this has a couple of issues when the last columns should not +% be balanced after aled (for example because they contained several +% |\columnbreak| commands we now stay with one output routine for +% the environment and only signal that we reached the end of the +% environment by marking it with a special penalty that we can check +% for later. +% \changes{v1.8r}{2018/01/28}{Macro added} +% \begin{macrocode} +\mathchardef\@Mvi=10006 % 10005 is \columnbreak +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\endmulticols} % When the end of the \mc{} environment is sensed we have to % balance the gathered material. Depending on whether or not we are @@ -1763,13 +1788,13 @@ % the very last item on the main vertical list is a valid break % point so that \TeX{} breaks the page in case it is overfull. % \begin{macrocode} - \penalty\z@ + \penalty\z@ % \end{macrocode} -% Now it's safe to change the output routine in order to balance -% the columns. +% Now it's safe to call the output routine in order to balance +% the columns. We do this by calling it with a special penalty. +% \changes{v1.8r}{2018/01/28}{Use special penalty to signal end of environment} % \begin{macrocode} - \output{\balance@columns@out}% - \eject + \penalty-\@Mvi % \end{macrocode} % If the \mc{} environment body was completely empty or if a % multi-page \mc{} just ends at a page boundary we have the unusual @@ -2563,6 +2588,26 @@ \reinsert@footnotes \else % \end{macrocode} +% Another special case is reaching the end of the \mc{} +% environment which is signalled by |-\@Mvi|. +% \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}% +% \end{macrocode} +% If we are at this point then have 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| +% if we are inside \texttt{multicols*} in which case we would get a loop +% if the |\outputpenalty| is not changed---this could be cleaned up +% 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 + \balance@columns@out + \else +% \end{macrocode} % If we encounter a float or a marginpar in the current % implementation we simply warn the user that this is not allowed. % Then we reinsert the page and its footnotes. @@ -2580,9 +2625,10 @@ % this is possible with |\xdef|.) % \changes{v1.2a}{1990/02/05}{Float boxes freed.} % \begin{macrocode} - \xdef\@freelist{\@freelist\@currlist}% - \gdef\@currlist{}% - \fi + \xdef\@freelist{\@freelist\@currlist}% + \gdef\@currlist{}% + \fi + \fi \fi % \end{macrocode} % If the penalty is $-10001$ it will come from a |\clearpage| and @@ -2712,7 +2758,14 @@ \setbox\@cclv\vbox {\vskip\topskip \vskip-\splittopskip - \unvbox\mult@box}% + \unvbox\mult@box +% \end{macrocode} +% We also have to re-add the end of environment penalty since after +% this page we may want balance the remaining material. +% \changes{v1.8r}{2018/01/28}{Re-add the final penalty} +% \begin{macrocode} + \penalty-\@Mvi + }% % \end{macrocode} % We then call the standard multicol output routine which will % produce a normal page for us (remember we are still within the |