[latex3-commits] [latex3/latex2e] ltmarks-multicol: handle top of mcol-1 (9e189dd2e)

github at latex-project.org github at latex-project.org
Sat Nov 9 21:45:39 CET 2024


Repository : https://github.com/latex3/latex2e
On branch  : ltmarks-multicol
Link       : https://github.com/latex3/latex2e/commit/9e189dd2eb554df5fc54b94274f33ed2802612a7

>---------------------------------------------------------------

commit 9e189dd2eb554df5fc54b94274f33ed2802612a7
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Nov 9 21:45:39 2024 +0100

    handle top of mcol-1


>---------------------------------------------------------------

9e189dd2eb554df5fc54b94274f33ed2802612a7
 base/ltmarks.dtx                                | 81 ++++++++++++++-----------
 required/tools/multicol.dtx                     | 22 +++++--
 required/tools/testfiles/sx411758.luatex.tlg    |  1 +
 required/tools/testfiles/sx411758.tlg           |  1 +
 required/tools/testfiles/tlb-multicol-007.tlg   |  1 +
 required/tools/testfiles/tlb-multicol-marks.tlg |  6 +-
 6 files changed, 71 insertions(+), 41 deletions(-)

diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx
index d69b9895c..81d369b06 100644
--- a/base/ltmarks.dtx
+++ b/base/ltmarks.dtx
@@ -635,9 +635,9 @@
 %
 %
 %
-% \begin{function}{\@@_update_structure_alias:nn}
+% \begin{function}{\@@_update_alias_structure:nn}
 %   \begin{syntax}
-%     \cs{@@_update_structure_alias:nn} \Arg{alias} \Arg{source}
+%     \cs{@@_update_alias_structure:nn} \Arg{alias} \Arg{source}
 %   \end{syntax}
 %   Helper function that copies all mark values in the \meta{source}
 %   region to \meta{alias}, i.e., make the structures identical. Used
@@ -660,6 +660,18 @@
 %   when we have just processed the first column in a two-column document.
 % \end{function}
 %
+% \begin{function}{\@@_update_structure_to_empty:n}
+%   \begin{syntax}
+%     \cs{@@_update_structure_to_empty:n} \Arg{region}
+%   \end{syntax}
+%   Helper function that sets all mark values in the \meta{region} to
+%   empty. This is currently used for \texttt{mcol} when a multicol
+%   envirnment starts because it wouldn't make sense if the top mark
+%   in the first column would return the last mark from a previous
+%   multicol (which may have been much earlier with intermediate
+%   material).
+% \end{function}
+%
 %
 % \begin{function}{\@@_get_marks_for_reinsertion:nNN}
 %   \begin{syntax}
@@ -1130,7 +1142,7 @@
 %    \texttt{previous-...}; this leaves the current structure
 %    untouched so we can update it class by class (which is necessary).
 %    \begin{macrocode}
-  \@@_update_structure_alias:nn { previous-#1 } {#1}
+  \@@_update_alias_structure:nn { previous-#1 } {#1}
 %    \end{macrocode}
 %    After this action we can get first and last marks of the various
 %    classes through \cs{tex_splitfirstmarks:D} and
@@ -1344,12 +1356,12 @@
 %  \end{macro}
 %
 %
-%  \begin{macro}{\@@_update_structure_alias:nn}
+%  \begin{macro}{\@@_update_alias_structure:nn}
 %    This function copies the structure for one region to  another
 %    (name), e.g., from \texttt{page} to \texttt{previous-page} above,
 %    or later from \texttt{column} to \texttt{first-column}, etc.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_update_structure_alias:nn #1#2 {
+\cs_new_protected:Npn \@@_update_alias_structure:nn #1#2 {
 %    \end{macrocode}
 %    This requires a simple loop through all mark classes copying the
 %    token list from one name to the next.
@@ -1368,6 +1380,28 @@
 %  \end{macro}
 %
 %
+%  \begin{macro}{\@@_update_structure_to_empty:n}
+%    This function set the structure of one region back to an initial
+%   state, i.e., all classes return an empty value if queried.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_update_structure_to_empty:n #1 {
+%    \end{macrocode}
+%    This requires a simple loop through all mark classes.
+%    \begin{macrocode}
+  \seq_map_inline:Nn \g_@@_classes_seq
+    {
+      \tl_gset_eq:cN { g_@@_ #1 _top_   ##1 _tl }
+                     \c_@@_empty_tl
+      \tl_gset_eq:cN { g_@@_ #1 _first_ ##1 _tl }
+                     \c_@@_empty_tl
+      \tl_gset_eq:cN { g_@@_ #1 _last_  ##1 _tl }
+                     \c_@@_empty_tl
+    }
+}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
 %
 %  \begin{macro}{\@@_update_structure_to_err:n,\@@_error:n}
 %    A slight variation is to install a fixed error message as the
@@ -1867,10 +1901,10 @@
 %    \end{macrocode}
 %    The we provide the necessary updates for the aliases.
 %    \begin{macrocode}
-  \@@_update_structure_alias:nn {previous-column}{previous-page}
-  \@@_update_structure_alias:nn {column}{page}
-  \@@_update_structure_alias:nn {first-column}{page}
-  \@@_update_structure_alias:nn {last-column}{page}
+  \@@_update_alias_structure:nn {previous-column}{previous-page}
+  \@@_update_alias_structure:nn {column}{page}
+  \@@_update_alias_structure:nn {first-column}{page}
+  \@@_update_alias_structure:nn {last-column}{page}
 %<*trace>
 % move this into status itself?
      \@@_debug:n
@@ -1920,7 +1954,7 @@
 %    \texttt{first-column} and there is no \texttt{last-column} yet,
 %    so we make those an error.
 %    \begin{macrocode}
-      \@@_update_structure_alias:nn {first-column}{column}
+      \@@_update_alias_structure:nn {first-column}{column}
       \@@_update_structure_to_err:n {last-column}
     }
     {
@@ -1931,11 +1965,11 @@
 %    (because is was set to \texttt{column} last time which is now the
 %    \texttt{previous-column}), thus there is no need to make an update.
 %    \begin{macrocode}
-%     \@@_update_structure_alias:nn {first-column}{previous-column}
+%     \@@_update_alias_structure:nn {first-column}{previous-column}
 %    \end{macrocode}
 %    However, we now have a proper \texttt{last-column} so we assign that.
 %    \begin{macrocode}
-      \@@_update_structure_alias:nn {last-column}{column}
+      \@@_update_alias_structure:nn {last-column}{column}
 %    \end{macrocode}
 %    What now remains doing is to update the \texttt{page} and
 %    \texttt{previous-page} regions. For this we have to copy the
@@ -2030,29 +2064,6 @@
 %  \end{macro}
 %
 %
-% \subsection{Multi-column integration}
-%
-%
-%  \begin{macro}{}
-%    
-%    \begin{macrocode}
-\def\mc at update@page at structure{%
- %<*trace>
-  \@@_debug:n
-     {
-       \typeout{--->>>~ multicol~ update~ page~ structure}
-     }
- %</trace>
-  \@@_update_structure_from_material:nn
-      {page}
-      { \unvcopy\partial at page
-        \process at cols\mult at firstbox {\unvcopy\count@}
-        \unvcopy\mult at rightbox
-      }
-}
-%    \end{macrocode}
-%  \end{macro}
-%
 %
 % \subsection{Other \LaTeXe{} output routines}
 %
diff --git a/required/tools/multicol.dtx b/required/tools/multicol.dtx
index c2f7076a5..713e5a868 100644
--- a/required/tools/multicol.dtx
+++ b/required/tools/multicol.dtx
@@ -1391,6 +1391,10 @@
   \advance\doublecol at number\mult at rightbox
 %    \end{macrocode}
 %    
+%    \begin{macrocode}
+  \mc at prepar@mark at collection
+%    \end{macrocode}
+%
 %    \begin{macrocode}
   \if at boxedmulticols
   \else
@@ -4331,7 +4335,7 @@
         \@@_update_structure_from_material:nn
              {mcol}
              {\unvcopy\count@} 
-        \@@_update_structure_alias:nn
+        \@@_update_alias_structure:nn
              {mcol - \int_use:N\g_@@_curr_col_int}
              {mcol}
         \int_gincr:N \g_@@_curr_col_int
@@ -4339,11 +4343,11 @@
   \@@_update_structure_from_material:nn
      {mcol}
      {\unvcopy\mult at rightbox}
-  \@@_update_structure_alias:nn
+  \@@_update_alias_structure:nn
      { mcol - \int_use:N\g_@@_curr_col_int }
      {mcol}
-  \@@_update_structure_alias:nn{first-column}{mcol-1}
-  \@@_update_structure_alias:nn{last-column} {mcol}
+  \@@_update_alias_structure:nn{first-column}{mcol-1}
+  \@@_update_alias_structure:nn{last-column} {mcol}
 }
 %    \end{macrocode}
 %  \end{macro}
@@ -4425,6 +4429,16 @@
 %  \end{macro}
 %
 %
+
+%  \begin{macro}{\mc at prepar@mark at collection}
+%    
+%    \begin{macrocode}
+\def \mc at prepar@mark at collection {
+  \@@_debug:n { \typeout{--->>>~ multicol~ empty~ mcol} }
+  \@@_update_structure_to_empty:n {mcol}
+}  
+%    \end{macrocode}
+%  \end{macro}
 %
 %
 %
diff --git a/required/tools/testfiles/sx411758.luatex.tlg b/required/tools/testfiles/sx411758.luatex.tlg
index d5fabacb1..66cae363a 100644
--- a/required/tools/testfiles/sx411758.luatex.tlg
+++ b/required/tools/testfiles/sx411758.luatex.tlg
@@ -4,6 +4,7 @@ Package multicol: Starting environment with 2 columns on input line ....
 Package multicol: Current page:
 (multicol)        height=16383.99998pt: used 0.0pt -> free=16383.99998pt
 (multicol)        needed 50.0pt (for \premulticols ) on input line ....
+--->>> multicol empty mcol
 Package multicol: Forced column break seen on input line ....
 Package multicol: Forced column break seen on input line ....
 Package multicol: Forced column break seen on input line ....
diff --git a/required/tools/testfiles/sx411758.tlg b/required/tools/testfiles/sx411758.tlg
index ec6cbb645..afcb2d461 100644
--- a/required/tools/testfiles/sx411758.tlg
+++ b/required/tools/testfiles/sx411758.tlg
@@ -4,6 +4,7 @@ Package multicol: Starting environment with 2 columns on input line ....
 Package multicol: Current page:
 (multicol)        height=16383.99998pt: used 0.0pt -> free=16383.99998pt
 (multicol)        needed 50.0pt (for \premulticols ) on input line ....
+--->>> multicol empty mcol
 Package multicol: Forced column break seen on input line ....
 Package multicol: Forced column break seen on input line ....
 Package multicol: Forced column break seen on input line ....
diff --git a/required/tools/testfiles/tlb-multicol-007.tlg b/required/tools/testfiles/tlb-multicol-007.tlg
index 4340fc530..4ab83757e 100644
--- a/required/tools/testfiles/tlb-multicol-007.tlg
+++ b/required/tools/testfiles/tlb-multicol-007.tlg
@@ -4,6 +4,7 @@ Package multicol: Starting environment with 2 columns on input line ....
 Package multicol: Current page:
 (multicol)        height=16383.99998pt: used 0.0pt -> free=16383.99998pt
 (multicol)        needed 50.0pt (for \premulticols ) on input line ....
+--->>> multicol empty mcol
 Package multicol: Forced column break seen on input line ....
 Package multicol: End penalty of multicols seen on input line ....
 Package multicol: Re-adding forced break(s) in balancing on input line ....
diff --git a/required/tools/testfiles/tlb-multicol-marks.tlg b/required/tools/testfiles/tlb-multicol-marks.tlg
index 599787722..a7816d17e 100644
--- a/required/tools/testfiles/tlb-multicol-marks.tlg
+++ b/required/tools/testfiles/tlb-multicol-marks.tlg
@@ -2,6 +2,7 @@ This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
 Marks: set DictMark <- '\__mark_id:n {1}a' on line ...
 Marks: set DictMark <- '\__mark_id:n {2}b' on line ...
+--->>> multicol empty mcol
 Marks: set DictMark <- '\__mark_id:n {3}m1' on line ...
 Marks: set DictMark <- '\__mark_id:n {4}n1' on line ...
 Marks: set DictMark <- '\__mark_id:n {5}o1' on line ...
@@ -49,6 +50,7 @@ Marks: extract first mark for class 'DictMark' = \__mark_id:n {7}q1
 Marks: set DictMark <- '\__mark_id:n {11}q1' on line ...
 Marks: set DictMark <- '\__mark_id:n {12}t1' on line ...
 Marks: set DictMark <- '\__mark_id:n {13}z1' on line ...
+--->>> multicol empty mcol
 Marks: set DictMark <- '\__mark_id:n {14}m2' on line ...
 Marks: set DictMark <- '\__mark_id:n {15}n2' on line ...
 Marks: set DictMark <- '\__mark_id:n {16}o2' on line ...
@@ -69,9 +71,9 @@ Marks: 2e-right-nonempty multicol (full page):
 Marks: DictMark multicol (full page):
     page (current) =| \__mark_id:n {6}p1 | \__mark_id:n {11}q1 | \__mark_id:n {15}n2 |
     page (previous)=| \__mark_id:n {0} | \__mark_id:n {1}a | \__mark_id:n {6}p1 |
-    column (first)=| \__mark_id:n {10}t1 | \__mark_id:n {14}m2 | \__mark_id:n {14}m2 |
+    column (first)=| \__mark_id:n {0} | \__mark_id:n {14}m2 | \__mark_id:n {14}m2 |
     column (last) =| \__mark_id:n {14}m2 | \__mark_id:n {15}n2 | \__mark_id:n {15}n2 |
-    column (1) =| \__mark_id:n {10}t1 | \__mark_id:n {14}m2 | \__mark_id:n {14}m2 |
+    column (1) =| \__mark_id:n {0} | \__mark_id:n {14}m2 | \__mark_id:n {14}m2 |
     column (2) =| \__mark_id:n {14}m2 | \__mark_id:n {15}n2 | \__mark_id:n {15}n2 |
     column (3) =| \__mark_id:n {?}\__mark_error:n {mcol-3} | \__mark_id:n {?}\__mark_error:n {mcol-3} | \__mark_id:n {?}\__mark_error:n {mcol-3} |
     column (4) =| \__mark_id:n {?}\__mark_error:n {mcol-4} | \__mark_id:n {?}\__mark_error:n {mcol-4} | \__mark_id:n {?}\__mark_error:n {mcol-4} |





More information about the latex3-commits mailing list.