diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/tools/multicol.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/tools/multicol.dtx | 81 |
1 files changed, 68 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/tools/multicol.dtx b/Master/texmf-dist/source/latex/tools/multicol.dtx index b347d3e80b5..1962ec24e59 100644 --- a/Master/texmf-dist/source/latex/tools/multicol.dtx +++ b/Master/texmf-dist/source/latex/tools/multicol.dtx @@ -98,7 +98,7 @@ %<driver> \ProvidesFile{multicol.drv} % \fi % \ProvidesFile{multicol.dtx} - [2018/04/20 v1.8s multicolumn formatting (FMi)] + [2018/11/09 v1.8u multicolumn formatting (FMi)] % % %% @@ -3899,8 +3899,24 @@ not make sense.\MessageBreak Going to balance anyway}% \else - \let\balance@columns@out - \multi@column@out +% \end{macrocode} +% If we aren't balancing we change the |\balance@columns@out| to +% work like the normal output routine that cuts normal +% pages. However, there is a catch: In case the last page we cut +% (after seeing the end of the environment) is actually larger than +% a page (for example, if it contains more |\columnbreak| commands +% than columns) we end up with some leftover material that is +% returned to the main galley, but now the environment end penalty +% is missing. So we add another one here too. Of course that +% shouldn't be done if there is really only a single final page, +% but fortunately in that case we have just finished a page and any +% penalty on the recent contributions will be discarded, thus the +% extra one is harmless---puh. +% \changes{v1.8t}{2018/06/26}{Re-add end penalty for +% \texttt{multicols*} environment to guard against leftovers (git/53)} +% \begin{macrocode} + \def\balance@columns@out + {\multi@column@out \penalty-\@Mvi }% \fi \begin{multicols} } @@ -4217,8 +4233,16 @@ % \begin{macro}{\docolaction} % +% The \verb=\docolaction= scans for a star and optional argument +% and 3 mandatory ones, but we do this in chunks (not having xparse +% available). +% +% \changes{v1.8u}{2018/11/09}{Support star with \cs{docolaction}} +% \begin{macrocode} +\newcommand\docolaction{% +% \end{macrocode} +% First check is the support is enabled. % \begin{macrocode} -\newcommand\docolaction[4][1]{% \ifx\mc@col@status@write\relax \PackageError{multicol}% {Option 'colaction' not selected}% @@ -4226,6 +4250,9 @@ requires the use of the 'colaction' option on the package}% \fi +% \end{macrocode} +% Then prepare \verb=\mc@col@type=. +% \begin{macrocode} \global\advance\mc@col@check@num\@ne \edef\mc@col@type{\expandafter\ifx \csname mc@col-\the\mc@col@check@num @@ -4233,7 +4260,36 @@ 0\else \csname mc@col-\the\mc@col@check@num \endcsname - \fi}% + \fi}% +% \end{macrocode} +% Finally check for a star, record this information and then call +% \verb=\@docolaction= to do the rest. +% \begin{macrocode} + \@ifstar + {\@docolactionstartrue \@docolaction}% + {\@docolactionstarfalse\@docolaction}% +} +% \end{macrocode} +% +% \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 +% preparations. +% \begin{macrocode} + \edef\@docolactioncheck{\write\@auxout + {\string\mc@set@col@status + {mc@col-\the\mc@col@check@num}% + {\mc@col@type}}}% +% \end{macrocode} +% Where we do the actual \verb=\write= depends on the whether or +% not we gave seen a \texttt{*}. If yes, we do it first and then +% execute the code argument, otherwise we execute that code first +% and check at the point after that. +% \begin{macrocode} + \if@docolactionstar \@docolactioncheck \fi % \end{macrocode} % We prefix with 0 so that an unknown label (that returns % \verb=\relax=) will result in case 0 @@ -4256,21 +4312,20 @@ \or #4% % 3 last col \else - \ERROR + \ERRORwrongdefaultgiven \fi % \end{macrocode} -% But how does the column number get associated with our label? We -% do do this by writing another line into the aux file at this point: % \begin{macrocode} - \edef\next{\write\@auxout - {\string\mc@set@col@status - {mc@col-\the\mc@col@check@num}% - {\mc@col@type}}}% - \next + \if@docolactionstar \else \@docolactioncheck \fi } % \end{macrocode} % \end{macro} % +% Here is the if used above: +% \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: |