summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/tools/multicol.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/required/tools/multicol.dtx')
-rw-r--r--macros/latex-dev/required/tools/multicol.dtx65
1 files changed, 56 insertions, 9 deletions
diff --git a/macros/latex-dev/required/tools/multicol.dtx b/macros/latex-dev/required/tools/multicol.dtx
index 2676d03aa1..9c680ab563 100644
--- a/macros/latex-dev/required/tools/multicol.dtx
+++ b/macros/latex-dev/required/tools/multicol.dtx
@@ -99,10 +99,10 @@
%<driver> \ProvidesFile{multicol.drv}
% \fi
% \ProvidesFile{multicol.dtx}
- [2023/03/30 v1.9f multicolumn formatting (FMi)]
+ [2024/01/29 v1.9g multicolumn formatting (FMi)]
+%
%
%
-%%
%
% \changes{v1.9c}{2021/11/30}{Added rollback to v1.8}
% \changes{v1.5n}{1997/06/05}{Applied improvement of documentation,
@@ -919,9 +919,22 @@
% And we don't show macro names in the margin.
% \begin{macrocode}
\setcounter{IndexColumns}{4}
-\let\DescribeMacro\SpecialUsageIndex
-\let\DescribeEnv\SpecialEnvIndex
-\renewcommand\PrintMacroName[1]{}
+% \end{macrocode}
+%
+% The following redefinitions have to be moved until after the
+% preamble because version 3 of \pkg{doc} resets them after the
+% premable (this is tmp, because \pkg{hypdoc} is not yet
+% integrated, but as we all know, tmp solutions have a tendency to
+% survive for a long time\ldots).
+% \begin{macrocode}
+\AddToHook{begindocument}{%
+ \let\DescribeMacro\SpecialUsageIndex
+ \let\DescribeEnv\SpecialEnvIndex
+ \renewcommand\PrintMacroName[1]{}%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
\CodelineIndex
%\DisableCrossrefs % Partial index
\RecordChanges % Change log
@@ -1082,7 +1095,7 @@
% better test for this situation. Otherwise, we will get a \TeX{}
% stack overflow as this would generate a self-referencing definition.
% \changes{v1.6e}{2004/02/14}{Avoid self-referencing definition of
-% \cs{@footnotetext} (pr/3618)}.
+% \cs{@footnotetext} (pr/3618)}
% \begin{macrocode}
\ifx\@footnotetext\mult@footnotetext
\else
@@ -2376,7 +2389,7 @@
% If |\raggedcolumns| is in force we add a |vfill| at the bottom by
% unboxing the split box.
% But we need to unbox anyway to ensure that at the end of the box
-% we do not have unwanted space. This can sneak in in certain
+% we do not have unwanted space. This can sneak in, in certain
% situations, for example, if two lists follow each other and we
% break between them. While such space is usually zero it still has
% an effect because it hides depth of the last line in the column
@@ -2925,7 +2938,11 @@
% We start by setting the kept marks by updating them with any
% marks from this box. This has to be done \emph{before} we add a
% penalty of $-10000$ to the top of the box, otherwise only an
-% empty box will be considered.
+% empty box will be considered. But even that is not enough: the box
+% may contain \cs{columnbreak}s in which case doing some artifical
+% splitting to get the marks out still fails to see all marks
+% unless we take some special precaution in \cs{get@keptmarks}
+% (which is now done).
% \changes{v1.5h}{1994/08/26}{Get kept marks first}
% \begin{macrocode}
\get@keptmarks\mult@box
@@ -3751,8 +3768,15 @@
% everything is split off. As a result |\splitfirstmark| and
% |\splitbotmark| will contain the first and last mark in the box
% respectively.
+%
+% Unfortunately, a simple \cs{vsplit} is not enough if the material
+% contains forced breaks in that case we first have to get rid of
+% those which is why we do this work in a separate macro that can
+% call itself recursively.
+% \changes{v1.9g}{2023/11/10}{Get rid of forced breaks for mark
+% extraction (gh/1130)}
% \begin{macrocode}
- \setbox#1\vsplit#1to\maxdimen
+ \mc@get@all@box@marks #1%
% \end{macrocode}
% Therefore we can now set the kept marks which is a global
% operation and afterwards close the group. This will restore the
@@ -3773,6 +3797,29 @@
% \end{macro}
%
%
+% \begin{macro}{\mc@get@all@box@marks}
+% This macro splits a box to \cs{maxdimen} in order to get at the
+% marks inside. If it turns out that we have a remainder after the
+% split (e.g., if there was a \cs{columnbreak} in the material) we
+% stitch the two parts together again (which omits the forced
+% break) and recurse. Eventually, everything is split off and the
+% split marks will then have the appropriate values.
+% \changes{v1.9g}{2023/11/10}{Get rid of forced breaks for mark
+% extraction (gh/1130)}
+% \begin{macrocode}
+\def\mc@get@all@box@marks #1{%
+ \setbox\@tempboxa\vsplit#1to\maxdimen
+ \ifvoid#1\else
+ \setbox#1\vbox{\unvbox\@tempboxa \unvbox#1}%
+ \mc@get@all@box@marks #1%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
% \begin{macro}{\set@keptmarks}
% The macro |\set@keptmarks| is responsible for setting
% |\kept@firstmark| and |\kept@botmark|, by checking the current