[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Gh1002 (#1007) (e8149d29)
GitHub
noreply at github.com
Mon Feb 27 21:56:41 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/e8149d296e46d614bf9565b06df49580cc8342eb
>---------------------------------------------------------------
commit e8149d296e46d614bf9565b06df49580cc8342eb
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Mon Feb 27 21:56:41 2023 +0100
Gh1002 (#1007)
* Fix for #1002
* mumble
* test file change
>---------------------------------------------------------------
e8149d296e46d614bf9565b06df49580cc8342eb
base/doc/ltnews37.tex | 13 ++++++++++++
required/tools/changes.txt | 6 ++++++
required/tools/multicol.dtx | 34 ++++++++++++++++++++++++--------
required/tools/testfiles/github-0822.tlg | 1 +
required/tools/testfiles/github-1002.lvt | 2 ++
required/tools/testfiles/github-1002.tlg | 3 ++-
6 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/base/doc/ltnews37.tex b/base/doc/ltnews37.tex
index 9aa9d940..e5e206a6 100644
--- a/base/doc/ltnews37.tex
+++ b/base/doc/ltnews37.tex
@@ -412,6 +412,19 @@ correct.
\section{Changes to packages in the \pkg{tools} category}
+\subsection{Fix handling of nested \env{multicols}}
+
+If \env{multicols} environments have been nested into each other (the
+inner one boxed) it could fail if the boxed environment appeared near a
+page break. The problem was that the output routine was called while
+the \cs{hsize} was still altered to fit the column width of the inner
+\env{multicols} --- thereby messing up the placement of columns of the
+page. This has now been fixed.
+%
+\githubissue{1002}
+
+
+
%\medskip
\begin{thebibliography}{9}
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 7b3e63dc..95a3d685 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -9,6 +9,12 @@ are not part of the distribution.
All changes above are only part of the development branch for the next release.
================================================================================
+2023-02-25 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
+
+ * multicol.dtx:
+ Delay returning boxed multicols so that all parameters get restored first
+ in case the boxed multicols is used into another multicols (gh/1002)
+
#########################
# 2022-11-01 Release
#########################
diff --git a/required/tools/multicol.dtx b/required/tools/multicol.dtx
index aa21d75f..16f28bff 100644
--- a/required/tools/multicol.dtx
+++ b/required/tools/multicol.dtx
@@ -20,7 +20,7 @@
% \iffalse This is a METACOMMENT
%
%% Package `multicol' to use with LaTeX2e
-%% Copyright 1989-2019 Frank Mittelbach
+%% Copyright 1989-2023 Frank Mittelbach
%%
%% In addition to the terms of LPPL any distributed version
%% (unchanged or modified) of multicol has to keep the statement
@@ -99,7 +99,7 @@
%<driver> \ProvidesFile{multicol.drv}
% \fi
% \ProvidesFile{multicol.dtx}
- [2021/11/30 v1.9d multicolumn formatting (FMi)]
+ [2023/02/25 v1.9e multicolumn formatting (FMi)]
%
%
%%
@@ -1760,14 +1760,27 @@
\kept at firstmark
\return at nonemptymark{bot}%
\kept at botmark
- \page at sofar
+% \end{macrocode}
+% When the boxed multicol is returned to the page it can happen
+% that it doesn't fit onto it and \LaTeX{} therefore breaks
+% earlier. The problem in that case is that during the generation
+% \cs{hsize}, etc.\ got changed and this setting is still in effect
+% right now, and if this boxed multicol is within, say,
+% \texttt{multicols*} then its output routine gets very upset. We
+% therefore delay returning the result by saving it in box for now
+% until we have left the group below.
+% \changes{v1.9e}{2023/02/25}{Delay returning boxed multicols (gh/1002)}
+% \begin{macrocode}
+ \global\setbox\mc at boxedresult\vbox{%
+ \page at sofar
% \end{macrocode}
%
% \begin{macrocode}
- \global\let\kept at firstmark
- \l at kept@firstmark
- \global\let\kept at botmark
- \l at kept@botmark
+ \global\let\kept at firstmark
+ \l at kept@firstmark
+ \global\let\kept at botmark
+ \l at kept@botmark
+ }%
%<*marktrace>
\mult at info\tw@
{Restore kept marks to\MessageBreak
@@ -1879,12 +1892,15 @@
% \end{macrocode}
% Now it's time to return any footnotes if we are in unrestricted
% mode. In boxed mode footnotes are kept inside, but in that case
-% we have to write another column status into the \texttt{.aux}
+% we have to first return the saved box to the page and then write
+% another column status into the \texttt{.aux}
% file to support \cs{docolaction} in case we have nested
% environments.
% \changes{v1.8s}{2018/04/20}{Support for \cs{docolaction} (issue/39)}
+% \changes{v1.9e}{2023/02/25}{Delay returning boxed multicols (gh/1002)}
% \begin{macrocode}
\if at boxedmulticols
+ \unvbox\mc at boxedresult
\mc at col@status at write
\else
\reinsert at footnotes
@@ -1949,6 +1965,7 @@
% \SpecialMainIndex{\multicolsep}
% \SpecialMainIndex{\multicolbaselineskip}
% \SpecialMainIndex{\partial at page}
+% \SpecialMainIndex{\mc at boxedresult}
% Let us end this section by allocating all the registers used so
% far.
% \begin{macrocode}
@@ -1970,6 +1987,7 @@
\newskip\multicolbaselineskip
\newbox\partial at page
\newbox\last at line
+\newbox\mc at boxedresult
% \end{macrocode}
% And here are their default values:
% \begin{macrocode}
diff --git a/required/tools/testfiles/github-0822.tlg b/required/tools/testfiles/github-0822.tlg
index 4fd42690..d074b088 100644
--- a/required/tools/testfiles/github-0822.tlg
+++ b/required/tools/testfiles/github-0822.tlg
@@ -53,6 +53,7 @@ Package: multicol ....-..-.. v... multicolumn formatting (FMi)
\multicolbaselineskip=\skip...
\partial at page=\box...
\last at line=\box...
+\mc at boxedresult=\box...
\maxbalancingoverflow=\dimen...
\mult at rightbox=\box...
\mult at grightbox=\box...
diff --git a/required/tools/testfiles/github-1002.lvt b/required/tools/testfiles/github-1002.lvt
index babaf622..78b33b10 100644
--- a/required/tools/testfiles/github-1002.lvt
+++ b/required/tools/testfiles/github-1002.lvt
@@ -49,6 +49,8 @@ There should be an itemize environment here but the bug happens even without it.
a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a\\a\\a\\a\\a\\a\\a\\a
+\TIMO\typeout{A and B should show the same x-position}\OMIT
+
a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a\\a\\a\\a\\a\\a\\a\\a\hfill B\savepos\write20{TIMO^^JB: \the\lastxpos^^JOMIT}
diff --git a/required/tools/testfiles/github-1002.tlg b/required/tools/testfiles/github-1002.tlg
index 1175640f..e46cb31d 100644
--- a/required/tools/testfiles/github-1002.tlg
+++ b/required/tools/testfiles/github-1002.tlg
@@ -1,4 +1,5 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
-A: 25593118
+A: 31409438
+A and B should show the same x-position
B: 31409438
More information about the latex3-commits
mailing list.