From 7adf2ca20d8a1efd3b91d3ec16220cabbd26c062 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Fri, 10 Nov 2023 15:16:44 +0100 Subject: [PATCH 01/20] enhance mark extraction to account for forced breaks within the material (WIP) --- base/ltmarks.dtx | 178 +++++++++++++++++++------- base/testfiles-ltmarks/xmarks-009.lvt | 38 ++++++ base/testfiles-ltmarks/xmarks-009.tlg | 52 ++++++++ base/update-ltmarks-test.sh | 1 + 4 files changed, 220 insertions(+), 49 deletions(-) create mode 100644 base/testfiles-ltmarks/xmarks-009.lvt create mode 100644 base/testfiles-ltmarks/xmarks-009.tlg diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 677534dd2..726fe5d40 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -15,8 +15,8 @@ %%% From File: ltmarks.dtx % % \begin{macrocode} -\def\ltmarksversion{v1.0d} -\def\ltmarksdate{2022/06/01} +\def\ltmarksversion{v1.0e} +\def\ltmarksdate{2023/11/10} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -784,11 +784,12 @@ % \subsection{Updating mark structures} % % -% \begin{macro}{\l_@@_box,\g_@@_tmp_tl,\g_@@_new_top_tl} -% For some operations we need a temporary private box and two +% \begin{macro}{\l_@@_box,\l_@@_ii_box,\g_@@_tmp_tl,\g_@@_new_top_tl} +% For some operations we need two temporary private boxes and two % private global token lists. % \begin{macrocode} \box_new:N \l_@@_box +\box_new:N \l_@@_ii_box \tl_new:N \g_@@_tmp_tl \tl_new:N \g_@@_new_top_tl % \end{macrocode} @@ -816,8 +817,13 @@ % Getting the first and last marks out of the material in \verb=#2= % is done by putting the material in a box and then doing a % split operation to the maximum size possible (which hopefully -% means all of the content).\footnote{We could verify this, maybe we -% should.} Because this is an action only for the sake of getting +% means all of the content).\footnote{With normal column material cut +% from the main galley we should always get all material in one go, but +% in certain situations, for example, +% in a \pkg{multicols} environment that contains +% some \cs{columnbreak}s a single split operation will not be +% enough. Thus, this this is something we need to handle.} +% Because this is an action only for the sake of getting % at the mark values we don't want any underfull % box warnings so we turn those (locally) off. % \begin{macrocode} @@ -842,11 +848,40 @@ % boxes end up as the last item on the page we should not unpack % them. % -% We therefore do an \tn{unskip} to get rid of that glue if present and -% also check if we have then a \tn{vbox} as the last item and if so -% unpack that too, but only under certain conditions, see -% below. All this is temporary, just for getting the -% marks out, so it doesn't affect the final page production. +% All these issues need to be handled which is done in +% \cs{@@_prepare_and_extract:nn}. +% +% \begin{macrocode} + \@@_prepare_and_extract:nn {#1}{#2} +% \end{macrocode} +% Once all mark classes have been processed the data structures are +% updated and we can close the group which undoes our local +% changes and retains only the global ones. +% \begin{macrocode} + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{@@_prepare_and_extract:nn} +% This macro expects a region name as its first argument and +% vertical material (not boxed) as its second. It attempts to +% extract mark information from \verb/#2/ and if it succeeds stores +% it away in the mark structure for the region. If it finds a +% forced break in the material it removes it and then restarts the +% attempt. If it finds infinite negative glue it generates an error +% message otherwise it finally succeeds. +% \begin{macrocode} +\cs_new_protected:Npn \@@_prepare_and_extract:nn #1#2 { +% \end{macrocode} +% +% To handle the \cs{enlargethispage} case we do an \tn{unskip} to +% get rid of that glue if present and also check if we have then a +% \tn{vbox} as the last item and if so unpack that too, but only +% under certain conditions, see below. All this is temporary, just +% for getting the marks out, so it doesn't affect the final page +% production. % % In fact, we go one step further and set the box to a large % negative height possible and afterwards take a look at the @@ -866,11 +901,10 @@ \box_set_to_last:N \l_@@_box % \end{macrocode} % After having removed the last box from the current list (if there -% was one) -% we check if the list is now empty. If not, the the last box is -% definitely not the one from \tn{enlargethispage} and so we can -% and should leave it alone. Otherwise we check if this last box is -% a \tn{vbox}. +% was one) we check if the list is now empty. If not, the the last +% box is definitely not the one from \tn{enlargethispage} and so we +% can and should leave it alone. Otherwise we check if this last +% box is a \tn{vbox}. % \changes{v1.0d}{2022/06/01}{Extend the logic for detecting the marks % in the box (gh/836)} % \begin{macrocode} @@ -879,8 +913,9 @@ \box_if_vertical:NT \l_@@_box { % \end{macrocode} -% If it is we do a further test and reset the \cs{l_@@_box} -% to check if it contains infinitely shrinkable glue. +% If it is, we do a further test and retypeset the \cs{l_@@_box} +% to check if it contains infinitely shrinkable glue using the same +% trick as before. % \begin{macrocode} \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } { @@ -889,10 +924,11 @@ % is not empty } % \end{macrocode} -% If not, then we unpack it, if yes we still ignore it for the process of -% mark extraction. We do not generate an error though, because in all -% likelihood this is an ordinary box like a marginal that does -% contain something like \tn{vss}. +% If we don't detect infinite negative glue we unpack the box. If +% yes we ignore it for the process of mark extraction. However, we +% do not generate an error message, because in all likelihood this +% is an ordinary box like a marginal that does contain something +% like \tn{vss}. % \begin{macrocode} \int_compare:nNnT \tex_badness:D > 0 { \vbox_unpack:N \l_@@_box } @@ -912,16 +948,65 @@ \tex_kern:D \c_zero_dim } \int_compare:nNnTF \tex_badness:D > 0 + { % \end{macrocode} % If the box had no infinite shrinkage (or rather if our test % didn't show any) we vsplit it. Note that it % doesn't matter that we set it to this strange size first. If there % was infinite shrinkage after all, we end up with a low-level -% \TeX{} error, but if there is, it is a coding error and needs +% \TeX{} error, but if that is the case, it is a coding error +% somewhere and needs % correcting. +% \begin{macrocode} + \vbox_set_split_to_ht:NNn \l_@@_ii_box \l_@@_box \c_max_dim +% \end{macrocode} +% After splitting we check if there is anything left in +% \cs{l_@@_box}. If not then the above split has set some split marks +% that we can then use to finish the extraction: +% \begin{macrocode} + \box_if_empty:NTF \l_@@_box + { \@@_do_extraction:n {#1} } +% \end{macrocode} +% If we have a remainder after the split then this means that there was some forced +% break in the material. We get rid of that be combining the +% content of the two boxes and restart. +% \begin{macrocode} + { +%<*trace> + \@@_debug:n { \iow_term:x + { Marks:~ mark~ extraction~needs~ recursion~ + \msg_line_context: } } +% + \@@_prepare_and_extract:nn {#1} + { \vbox_unpack:N \l_@@_ii_box + \vbox_unpack:N \l_@@_box } + } + } +% \end{macrocode} +% If the badness was zero (we actually tested for${}>0$ but it +% can't get negative) then we had infinite shrinkage, so we report +% that and set all marks to the value the last mark had before. % \begin{macrocode} { - \vbox_set_split_to_ht:NNn \l_@@_box \l_@@_box \c_max_dim + \msg_error:nnn { mark } { infinite-shrinkage } {#1} + \seq_map_inline:Nn \g_@@_classes_seq + { + \tl_gset_eq:cc { g_@@_#1_top_ ##1_tl } + { g_@@_#1_last_ ##1_tl } + \tl_gset_eq:cc { g_@@_#1_first_##1_tl } + { g_@@_#1_last_ ##1_tl } + } + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_do_extraction:n #1 { % \end{macrocode} % After this action we can get first and last marks of the various % classes through \cs{tex_splitfirstmarks:D} and @@ -987,33 +1072,10 @@ } } } - } -% \end{macrocode} -% If the badness was zero (we actually tested for${}>0$ but it -% can't get negative) then we had infinite shrinkage, so we report -% that and set all marks to the value the last mark had before. -% \begin{macrocode} - { - \msg_error:nnn { mark } { infinite-shrinkage } {#1} - \seq_map_inline:Nn \g_@@_classes_seq - { - \tl_gset_eq:cc { g_@@_#1_top_ ##1_tl } - { g_@@_#1_last_ ##1_tl } - \tl_gset_eq:cc { g_@@_#1_first_##1_tl } - { g_@@_#1_last_ ##1_tl } - } - } -% \end{macrocode} -% Once all mark classes have been processed the data structures are -% updated and we can close the group which undoes our local -% changes and retains only the global ones. -% \begin{macrocode} - \group_end: - } +} % \end{macrocode} % \end{macro} % -% % \begin{macro}{\@@_update_structure_alias:nn} % This function copies the structure for one region to another % (name), e.g., from \texttt{page} to \texttt{previous-page} above, @@ -1358,7 +1420,7 @@ % % % \begin{macro}{\@@_status:n} -% Show all mark class values across all regions. +% Show a snapshot of all mark class values across all regions. % \begin{macrocode} \cs_new_protected:Npn \@@_status:n #1 { @@ -1370,6 +1432,24 @@ % \end{macro} % % +% \begin{macro}{\ShowMarksAt} +% Debugging helper that displays a snapshot of all known mark +% structures. The argument is a text string that this is +% displayed to help identifying when the snapshot was made. +% +% This may may not stay like this which is why it isn't yet +% documented as an official command. +% \begin{macrocode} +\cs_new_protected:Npn \ShowMarksAt #1 { +%<*trace> + \@@_debug:n + { + \@@_status:n{#1} + } +% +} +% \end{macrocode} +% \end{macro} % % % \subsection{Designer-level interfaces} diff --git a/base/testfiles-ltmarks/xmarks-009.lvt b/base/testfiles-ltmarks/xmarks-009.lvt new file mode 100644 index 000000000..da7afbf1d --- /dev/null +++ b/base/testfiles-ltmarks/xmarks-009.lvt @@ -0,0 +1,38 @@ + +\documentclass{article} +\usepackage{fancyhdr} +\pagestyle{fancy} + +\input{regression-test} + +\DebugMarksOn + +\begin{document} +\START + +\ShowMarksAt{before mark extraction} + +\ExplSyntaxOn + +\__mark_update_structure:nn{page} + {text\markright{A} \par + \break + text\markright{B} \par + \break +% \vskip 0pt minus 1fil\relax + text\markright{C} \par + } + +\ExplSyntaxOff + +\ShowMarksAt{after mark extraction} + + + +\newpage + +\OMIT +\end{document} + + + diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg new file mode 100644 index 000000000..1f2414b03 --- /dev/null +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -0,0 +1,52 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +Marks: 2e-left before mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right before mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right-nonempty before mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: set 2e-right <- 'A' on line ... +Marks: set 2e-right-nonempty <- 'A' on line ... +Marks: set 2e-right <- 'B' on line ... +Marks: set 2e-right-nonempty <- 'B' on line ... +Marks: set 2e-right <- 'C' on line ... +Marks: set 2e-right-nonempty <- 'C' on line ... +Marks: mark extraction needs recursion on line ... +Marks: mark extraction needs recursion on line ... +Marks: 2e-left after mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right after mark extraction: + page (current):||A|C| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right-nonempty after mark extraction: + page (current):||A|C| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| diff --git a/base/update-ltmarks-test.sh b/base/update-ltmarks-test.sh index e16e4b571..384ed455e 100644 --- a/base/update-ltmarks-test.sh +++ b/base/update-ltmarks-test.sh @@ -8,6 +8,7 @@ l3build save -cconfig-ltmarks \ xmarks-006 \ xmarks-007 \ xmarks-008 \ + xmarks-009 \ github-0836 From 010bb157d2c359ce0afcc7bd18d77bc9300a916d Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Mon, 13 Nov 2023 19:09:37 +0100 Subject: [PATCH 02/20] Generalize mark extraction code; Use it to also provide \__mark_get_marks_for_reinsertion:nNN for use in multicols (and elsewhere) eventually --- base/ltmarks.dtx | 329 +++++++++++++++++++++----- base/testfiles-ltmarks/xmarks-009.lvt | 56 ++++- base/testfiles-ltmarks/xmarks-009.tlg | 97 ++++++++ 3 files changed, 422 insertions(+), 60 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 726fe5d40..32c0ab32c 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -16,7 +16,7 @@ % % \begin{macrocode} \def\ltmarksversion{v1.0e} -\def\ltmarksdate{2023/11/10} +\def\ltmarksdate{2023/11/13} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -610,9 +610,9 @@ % marks. It too is called as part of \cs{@opcol}. % \end{function} % -% \begin{function}{\@@_update_structure:nn} +% \begin{function}{\@@_update_structure_from_material:nn} % \begin{syntax} -% \cs{@@_update_structure:nn} \Arg{region} \Arg{material with marks} +% \cs{@@_update_structure_from_material:nn} \Arg{region} \Arg{material with marks} % \end{syntax} % Helper function that inspects the marks % inside the second argument and assigns new mark values based on @@ -627,7 +627,7 @@ % \texttt{page} and \texttt{column} because only they have % \texttt{previous-...} counterparts. % -% Another important part to keep in mind is that marks are only +% Another important aspect to keep in mind is that marks are only % recognized if they appear on top-level, e.g., if we want to % process material stored in boxes we need to put it unboxed (using % \cs{unvcopy} etc.)\ into the second argument. @@ -642,7 +642,7 @@ % Helper function that copies all mark values in the \meta{source} % region to \meta{alias}, i.e., make the structures identical. Used % to update the \texttt{previous-...} structures inside -% \cs{@@_update_structure:nn} and \texttt{first-column} and +% \cs{@@_update_structure_from_material:nn} and \texttt{first-column} and % \texttt{last-column} structures inside % \cs{@@_update_singlecol_structures:} or % \cs{@@_update_dblcol_structures:}. @@ -650,7 +650,6 @@ % % % -% % \begin{function}{\@@_update_structure_to_err:n} % \begin{syntax} % \cs{@@_update_structure_to_err:n} \Arg{region} @@ -662,6 +661,30 @@ % \end{function} % % +% \begin{function}{@@_get_marks_for_reinsertion:nNN} +% \begin{syntax} +% \cs{@@_get_marks_for_reinsertion:nNN} \Arg{source} +% \Arg{token-list-var for collecting first marks} +% \Arg{token-list-var for collecting last marks} +% \end{syntax} +% Helper function for extracting marks that would otherwise get +% lost, for example when they are hidden inside a box. This helper +% does not update mark structures and can therefore be used outside +% the output routine as well. +% +% It collect all marks inside the \meta{source} and adds suitable +% \cs{mark_insert:nn} in the two token lists. These token lists can +% then be executed at the right place to reinsert the marks, e.g., +% directly after the box. This is, for example, used by +% \pkg{multicol} when a short balanced \env{multicols} is returned +% to the galley for typesetting. +% +% It is quite likely that one only needs a single token list for +% returning the \cs{mark_insert:nn} statements. If that is the case +% this command may change to take only two arguments. +% \end{function} +% +% % % ^^A \end{documentation} % @@ -796,25 +819,26 @@ % \end{macro} % % -% \begin{macro}{\@@_update_structure:nn} % -% This function updates the mark structures. The first argument is -% the region to update and second argument receives the material -% that holds the marks. Out of this material we extract the first -% and last marks for all classes (if there are any) to do the -% assignments. -% -% \begin{macrocode} -\cs_new_protected:Npn \@@_update_structure:nn #1#2 - { -% \end{macrocode} -% First thing we do is copying the current structure to -% \texttt{previous-...}; this leaves the current structure -% untouched so we can update it class by class (which is necessary). +% \begin{macro}{\@@_extract_and_handle_marks:nnn} +% % \begin{macrocode} - \@@_update_structure_alias:nn { previous-#1 } {#1} +\cs_new_protected:Npn \@@_extract_and_handle_marks:nnn #1#2#3 { % \end{macrocode} -% Getting the first and last marks out of the material in \verb=#2= +% This macro expects a region name as its third argument and +% vertical material (not boxed) as its fourth. It attempts to +% extract mark information from \verb/#4/ and if it succeeds It +% executes \verb/#1{#3}/ to do something with the marks, e.g., to +% update the mark structure for the region. +% +% If it finds infinite negative glue it generates an error message +% and then calls \verb/#2{#3}/ to handle anything special in that +% case. +% +% If it finds a forced break in the material it removes it and then +% restarts the attempt without it. +% +% Getting the first and last marks out of the material in \verb=#4= % is done by putting the material in a box and then doing a % split operation to the maximum size possible (which hopefully % means all of the content).\footnote{With normal column material cut @@ -852,7 +876,7 @@ % \cs{@@_prepare_and_extract:nn}. % % \begin{macrocode} - \@@_prepare_and_extract:nn {#1}{#2} + \@@_prepare_and_extract:nnn {#1} {#2} {#3} % \end{macrocode} % Once all mark classes have been processed the data structures are % updated and we can close the group which undoes our local @@ -864,16 +888,10 @@ % \end{macro} % % -% \begin{macro}{@@_prepare_and_extract:nn} -% This macro expects a region name as its first argument and -% vertical material (not boxed) as its second. It attempts to -% extract mark information from \verb/#2/ and if it succeeds stores -% it away in the mark structure for the region. If it finds a -% forced break in the material it removes it and then restarts the -% attempt. If it finds infinite negative glue it generates an error -% message otherwise it finally succeeds. +% \begin{macro}{@@_prepare_and_extract:nnn} +% % \begin{macrocode} -\cs_new_protected:Npn \@@_prepare_and_extract:nn #1#2 { +\cs_new_protected:Npn \@@_prepare_and_extract:nnn #1#2#3 { % \end{macrocode} % % To handle the \cs{enlargethispage} case we do an \tn{unskip} to @@ -896,7 +914,7 @@ % \begin{macrocode} \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } { - #2 + #3 \tex_unskip:D \box_set_to_last:N \l_@@_box % \end{macrocode} @@ -965,7 +983,7 @@ % that we can then use to finish the extraction: % \begin{macrocode} \box_if_empty:NTF \l_@@_box - { \@@_do_extraction:n {#1} } + { #1 } % \end{macrocode} % If we have a remainder after the split then this means that there was some forced % break in the material. We get rid of that be combining the @@ -977,43 +995,71 @@ { Marks:~ mark~ extraction~needs~ recursion~ \msg_line_context: } } % - \@@_prepare_and_extract:nn {#1} + \@@_prepare_and_extract:nnn {#1} {#2} { \vbox_unpack:N \l_@@_ii_box \vbox_unpack:N \l_@@_box } } } % \end{macrocode} % If the badness was zero (we actually tested for${}>0$ but it -% can't get negative) then we had infinite shrinkage, so we report -% that and set all marks to the value the last mark had before. +% can't get negative) then we had infinite shrinkage, so we execute +% the code that handles that case: % \begin{macrocode} - { - \msg_error:nnn { mark } { infinite-shrinkage } {#1} - \seq_map_inline:Nn \g_@@_classes_seq - { - \tl_gset_eq:cc { g_@@_#1_top_ ##1_tl } - { g_@@_#1_last_ ##1_tl } - \tl_gset_eq:cc { g_@@_#1_first_##1_tl } - { g_@@_#1_last_ ##1_tl } - } - } + { #2 } } % \end{macrocode} % \end{macro} % % % -% \begin{macro}{} +% \begin{macro}{\@@_update_structure_from_material:nn} +% +% This function updates the mark structures of a region. The first +% argument is the region to update and second argument receives the +% material that holds the marks. Out of this material we extract +% the first and last marks for all classes (if there are any) to do +% the assignments. +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_update_structure_from_material:nn #1#2 { + \@@_extract_and_handle_marks:nnn +% \end{macrocode} % +% If marks can be extracted we update the structure from the split +% marks (code in \cs{@@_update_structure_from_splitmarks:n}). +% Otherwise, we generate an error message and update it using the +% last mark from the previous region (code in +% \cs{@@_update_structure_when_infinite_glue:n}). +% \begin{macrocode} + { \@@_update_structure_from_splitmarks:n {#1} } + { \@@_update_structure_when_infinite_glue:n {#1} } + { #2 } +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@@_update_structure_from_splitmarks:n} +% This macro is called when it is possible to \cs{vsplit} the +% material to extract the marks (or at least if we think it is +% possible, see notes). +% \begin{macrocode} +\cs_new_protected:Npn \@@_update_structure_from_splitmarks:n #1 { +% \end{macrocode} +% +% First thing we do is copying the current structure to +% \texttt{previous-...}; this leaves the current structure +% untouched so we can update it class by class (which is necessary). % \begin{macrocode} -\cs_new_protected:Npn \@@_do_extraction:n #1 { + \@@_update_structure_alias: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 % \cs{tex_splitbotmarks:D}. So now we loop over all classes stored in % \cs{g_@@_classes_seq}. % \begin{macrocode} - \seq_map_inline:Nn \g_@@_classes_seq + \seq_map_inline:Nn \g_@@_classes_seq { % \end{macrocode} % First action: get the last mark from the previous region, i.e., @@ -1035,7 +1081,7 @@ \tl_gset:No \g_@@_tmp_tl { \tex_splitbotmarks:D \use:c { c_@@_class_##1_mark } } % \end{macrocode} -% If this mark doesn't exist then obviously first mark does +% If this mark doesn't exist then obviously the first mark does % neither, so both become the last mark from the previous region. We % have to be a little careful here: something like % \verb=\mark_insert:nn{foo}{}= adds an \enquote{empty} mark that should @@ -1075,6 +1121,160 @@ } % \end{macrocode} % \end{macro} + + + + +% \begin{macro}{\@@_update_structure_when_infinite_glue:n} +% If a region contains infinite negative glue we report this as an +% error and then set all marks to the last mark from the previous +% region (as we can't extract any new marks). +% \begin{macrocode} +\cs_new_protected:Npn \@@_update_structure_when_infinite_glue:n #1 { + \msg_error:nnn { mark } { infinite-shrinkage-region } {#1} + \seq_map_inline:Nn \g_@@_classes_seq + { + \tl_gset_eq:cc { g_@@_#1_top_ ##1_tl } + { g_@@_#1_last_ ##1_tl } + \tl_gset_eq:cc { g_@@_#1_first_##1_tl } + { g_@@_#1_last_ ##1_tl } + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@@_get_marks_for_reinsertion:nNN} +% +% This function extracts the marks from the material in the first +% argument but it does not update any the mark structure. Instead, +% it collects the marks in the token lists given as the second and +% third argument, in a way that they can be reinserted by just +% executing the token lists.\footnote{It is probably enough to +% collect everything in a single token list as long as we put the +% first marks first and the last marks last). But for extra +% flexibility, I currently use 2 tls. This might change when it is +% really clear that this is never needed.} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_marks_for_reinsertion:nNN #1#2#3 { +% \end{macrocode} +% First we clear the tmp token lists as we haven't seen any marks yet. +% \begin{macrocode} + \tl_clear:N \g_@@_first_marks_tl + \tl_clear:N \g_@@_last_marks_tl +% \end{macrocode} +% The we try to extract all marks, thereby filling the token lists +% with suitable \cs{mark_insert:nn} calls. +% \begin{macrocode} + \@@_extract_and_handle_marks:nnn +% \end{macrocode} +% If we can extract them (i.e., if we don't detect negative infinite +% glue) then this is done with \cs{@@_get_from_splitmarks:} otherwise +% we issue warning that mark extraction was not possible. +% \begin{macrocode} + { \@@_get_from_splitmarks: } + { \msg_warning:nn { mark } { infinite-shrinkage-box } } + { #1 } +% \end{macrocode} +% finally we copy the updated (or not updated) tmp token lists to +% the two that have been supplied when the function was called. +% By convention they are local variables and +% \cs{@@_extract_and_handle_marks:nnn} runs in a group, which is +% why we have to use global variables for collecting. +% \begin{macrocode} + \tl_set_eq:NN #2 \g_@@_first_marks_tl + \tl_set_eq:NN #3 \g_@@_last_marks_tl +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_get_from_splitmarks:} +% This function is called after we have done a \cs{vsplit} to +% update the split marks. It loops through all mark classes to find +% out if there are marks for this class and if so updates the +% global tls used for collecting. +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_from_splitmarks: { + \seq_map_inline:Nn \g_@@_classes_seq + { +% \end{macrocode} +% First we to get the last last mark for the current class from the +% material supplied. +% \begin{macrocode} + \tl_gset:No \g_@@_tmp_tl + { \tex_splitbotmarks:D \use:c { c_@@_class_##1_mark } } +% \end{macrocode} +% +% If this mark doesn't exist then obviously first mark doesn't +% either, so we do nothing (other than issuing some debugging +% info). We have to be a little careful here: something like +% \verb=\mark_insert:nn{foo}{}= adds an \enquote{empty} mark that +% should not be confused with no mark at all. But no mark in our +% material will result in \cs{g_@@_tmp_tl} being fully empty. This +% is why we have to make sure that \enquote{empty} from +% \cs{mark_insert:nn} only appears to be empty but fails the next +% test (see below how this is done). +% \begin{macrocode} + \tl_if_empty:NTF \g_@@_tmp_tl + { +%<*trace> + \@@_debug:n { \iow_term:x { Marks:~no~ marks~ + for~ class~ '##1'~\msg_line_context: } } +% + } +% \end{macrocode} +% +% If it wasn't empty, i.e., if it had a real value then we use this +% value for our new last mark instead. This means we put an +% appropriate \cs{mark_insert:nn} statement into +% \cs{g_@@_last_marks_tl}. +% \begin{macrocode} + { +%<*trace> + \@@_debug:n { \iow_term:x { Marks:~ extract~ last~ + mark~ for~ class~ '##1'~ =~ \g_@@_tmp_tl } } +% + \tl_gput_right:Ne \g_@@_last_marks_tl + { \mark_insert:nn {##1} { \g_@@_tmp_tl } } +% \end{macrocode} +% Because we had a last mark we also have a first mark (which might +% be the same, but might be not), so we pick that up and add it to +% the \cs{g_@@_first_marks_tl} token list. This explains why we +% first checked for the last mark because that makes the processing +% faster in case there is none. +% \begin{macrocode} +%<*trace> + \@@_debug:n { \iow_term:x { Marks:~ extract~ first~ + mark~ for~ class~ '##1'~ =~ + \tex_splitfirstmarks:D + \use:c { c_@@_class_##1_mark } + } } +% + \tl_gput_right:Ne \g_@@_first_marks_tl + { \mark_insert:nn {##1} + { + \tex_splitfirstmarks:D + \use:c { c_@@_class_##1_mark } + } + } + } + } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\g_@@_first_marks_tl,\g_@@_last_marks_tl} +% The two global variables used in the code above. +% \begin{macrocode} +\tl_new:N \g_@@_first_marks_tl +\tl_new:N \g_@@_last_marks_tl +% \end{macrocode} +% \end{macro} +% % % \begin{macro}{\@@_update_structure_alias:nn} % This function copies the structure for one region to another @@ -1220,7 +1420,7 @@ % To retrieve the first, last or top region mark, we grab the % appropriate value stored in the corresponding token list variable % and pass its contents back. These functions should be used only -% in output routines after \cs{@@_update_structure:nn} has acted, +% in output routines after \cs{@@_update_structure_from_material:nn} has acted, % otherwise their value will be wrong. % % If used with an unknown class or region they generate an error @@ -1310,17 +1510,28 @@ % \end{macrocode} % % \begin{macrocode} -\msg_new:nnnn { mark } { infinite-shrinkage } - { Infinite~shrinkage~found~in~'#1'. } +\msg_new:nnnn { mark } { infinite-shrinkage-region } + { Infinite~shrinkage~found~in~'#1'~region. } { \c__msg_coding_error_text_tl The~mark~region~'#1'~contains~some~infinite~negative~glue~ - allowing~it~to~shrink~to~an~arbitrary~size.~ + allowing~it~to~shrink~to~an~arbitrarily~small~size.~ This~makes~it~impossible~to~split~the~region~apart~to~ get~at~its~marks.~They~are~lost. } % \end{macrocode} % +% If box content checked for marks contains some infinite negative glue +% allowing it to shrink to an arbitrarily small size we can't extract any marks. +% They are lost, but this should not generate an error because in +% certain places, e.g., in some \env{minipage}s such glue might be legitimate. +% \begin{macrocode} +\msg_new:nnn { mark } { infinite-shrinkage-box } + { Infinite~shrinkage~found~in~box~material~--~marks~not~extracted~ + \msg_line_context: + } +% \end{macrocode} +% % % % \subsection{Debugging the mark structures} @@ -1525,11 +1736,11 @@ % \begin{macrocode} \box_if_vertical:NTF \@outputbox { - \@@_update_structure:nn {page} + \@@_update_structure_from_material:nn {page} { \vbox_unpack:N \@outputbox } } { - \@@_update_structure:nn {page} + \@@_update_structure_from_material:nn {page} { \hbox_unpack:N \@outputbox } } % \end{macrocode} @@ -1569,11 +1780,11 @@ % \begin{macrocode} \box_if_vertical:NTF \@outputbox { - \@@_update_structure:nn {column} + \@@_update_structure_from_material:nn {column} { \vbox_unpack:N \@outputbox } } { - \@@_update_structure:nn {column} + \@@_update_structure_from_material:nn {column} { \hbox_unpack:N \@outputbox } } % \end{macrocode} diff --git a/base/testfiles-ltmarks/xmarks-009.lvt b/base/testfiles-ltmarks/xmarks-009.lvt index da7afbf1d..5e19b8c7e 100644 --- a/base/testfiles-ltmarks/xmarks-009.lvt +++ b/base/testfiles-ltmarks/xmarks-009.lvt @@ -7,6 +7,9 @@ \DebugMarksOn +\NewMarkClass{unused} + + \begin{document} \START @@ -14,7 +17,7 @@ \ExplSyntaxOn -\__mark_update_structure:nn{page} +\__mark_update_structure_from_material:nn{page} {text\markright{A} \par \break text\markright{B} \par @@ -27,6 +30,57 @@ \ShowMarksAt{after mark extraction} +\ExplSyntaxOn + +\__mark_update_structure_from_material:nn{page} + {text\markright{D} \par + \break + text\markright{E} \par + \vskip 0pt minus 1fil\relax + text\markright{F} \par + } + +\ExplSyntaxOff + +\ShowMarksAt{after material with infinite glue} + + +\ExplSyntaxOn + +\tl_new:N \l_first_marks_tl +\tl_new:N \l_last_marks_tl + +\__mark_get_marks_for_reinsertion:nNN + { + text\markboth{A1}{A2} \par + \break + text\markboth{B1}{B2} \par + \break + text\markright{A3} \par + } + \l_first_marks_tl + \l_last_marks_tl + + +\tl_show:N \l_first_marks_tl +\tl_show:N \l_last_marks_tl + +\__mark_get_marks_for_reinsertion:nNN + { + text\markboth{A1}{A2} \par + \break + text\markboth{B1}{B2} \par + \vskip 0pt minus 1fil\relax + text\markright{A3} \par + } + \l_first_marks_tl + \l_last_marks_tl + + +\tl_show:N \l_first_marks_tl +\tl_show:N \l_last_marks_tl + +\ExplSyntaxOff \newpage diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index 1f2414b03..2a032472c 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -21,6 +21,13 @@ Marks: 2e-right-nonempty before mark extraction: column (current):|||| column (first):|||| column (second):|||| +Marks: unused before mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| Marks: set 2e-right <- 'A' on line ... Marks: set 2e-right-nonempty <- 'A' on line ... Marks: set 2e-right <- 'B' on line ... @@ -50,3 +57,93 @@ Marks: 2e-right-nonempty after mark extraction: column (current):|||| column (first):|||| column (second):|||| +Marks: unused after mark extraction: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: set 2e-right <- 'D' on line ... +Marks: set 2e-right-nonempty <- 'D' on line ... +Marks: set 2e-right <- 'E' on line ... +Marks: set 2e-right-nonempty <- 'E' on line ... +Marks: set 2e-right <- 'F' on line ... +Marks: set 2e-right-nonempty <- 'F' on line ... +! LaTeX mark Error: Infinite shrinkage found in 'page' region. +For immediate help type H . + ... +l. ... } +This is a coding error. +The mark region 'page' contains some infinite negative glue allowing it to +shrink to an arbitrarily small size. This makes it impossible to split the +region apart to get at its marks. They are lost. +Marks: 2e-left after material with infinite glue: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right after material with infinite glue: + page (current):|C|C|C| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right-nonempty after material with infinite glue: + page (current):|C|C|C| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: unused after material with infinite glue: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: set 2e-left <- 'A1' on line ... +Marks: set 2e-right <- 'A2' on line ... +Marks: set 2e-right-nonempty <- 'A2' on line ... +Marks: set 2e-left <- 'B1' on line ... +Marks: set 2e-right <- 'B2' on line ... +Marks: set 2e-right-nonempty <- 'B2' on line ... +Marks: set 2e-right <- 'A3' on line ... +Marks: set 2e-right-nonempty <- 'A3' on line ... +Marks: mark extraction needs recursion on line ... +Marks: mark extraction needs recursion on line ... +Marks: extract last mark for class '2e-left' = B1 +Marks: extract first mark for class '2e-left' = A1 +Marks: extract last mark for class '2e-right' = A3 +Marks: extract first mark for class '2e-right' = A2 +Marks: extract last mark for class '2e-right-nonempty' = A3 +Marks: extract first mark for class '2e-right-nonempty' = A2 +Marks: no marks for class 'unused' on line ... +> \l_first_marks_tl=\mark_insert:nn {2e-left}{A1}\mark_insert:nn +{2e-right}{A2}\mark_insert:nn {2e-right-nonempty}{A2}. + } +l. ...\tl_show:N \l_first_marks_tl +> \l_last_marks_tl=\mark_insert:nn {2e-left}{B1}\mark_insert:nn +{2e-right}{A3}\mark_insert:nn {2e-right-nonempty}{A3}. + } +l. ...\tl_show:N \l_last_marks_tl +Marks: set 2e-left <- 'A1' on line ... +Marks: set 2e-right <- 'A2' on line ... +Marks: set 2e-right-nonempty <- 'A2' on line ... +Marks: set 2e-left <- 'B1' on line ... +Marks: set 2e-right <- 'B2' on line ... +Marks: set 2e-right-nonempty <- 'B2' on line ... +Marks: set 2e-right <- 'A3' on line ... +Marks: set 2e-right-nonempty <- 'A3' on line ... +LaTeX mark Warning: Infinite shrinkage found in box material -- marks not +(mark) extracted on line ... +> \l_first_marks_tl=. + } +l. ...\tl_show:N \l_first_marks_tl +> \l_last_marks_tl=. + } +l. ...\tl_show:N \l_last_marks_tl From b6728feaadf93dd8911e3d27068cfcfd8460ed77 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 15:13:52 +0100 Subject: [PATCH 03/20] added change entries typos and corrections --- base/changes.txt | 14 +++++ base/ltmarks.dtx | 140 ++++++++++++++++++++++++++--------------------- 2 files changed, 92 insertions(+), 62 deletions(-) diff --git a/base/changes.txt b/base/changes.txt index 51e856dd1..5ef008703 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,20 @@ to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2023-11-14 Frank Mittelbach + + * ltmarks.dtx: + Some internal commands renamed and extended. + + Generalized the support for extracting marks to cover cases like multicols. + + Renamed \__mark_update_structure:nn to \__mark_update_structure_from_material:nn + + Added \__mark_get_marks_for_reinsertion:nNN + + Added \ShowMarksAt for debugging (might not stay this way) + + 2023-11-09 Yukai Chou * clsguide-historic.tex, usrguide.tex: Replace quotation with quote envs for zero para indent diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 32c0ab32c..2f9f49d1e 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -16,7 +16,7 @@ % % \begin{macrocode} \def\ltmarksversion{v1.0e} -\def\ltmarksdate{2023/11/13} +\def\ltmarksdate{2023/11/14} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -627,8 +627,8 @@ % \texttt{page} and \texttt{column} because only they have % \texttt{previous-...} counterparts. % -% Another important aspect to keep in mind is that marks are only -% recognized if they appear on top-level, e.g., if we want to +% Another important aspect to keep in mind is that marks are recognized +% only if they appear on the top level, e.g., if we want to % process material stored in boxes we need to put it unboxed (using % \cs{unvcopy} etc.)\ into the second argument. % \end{function} @@ -672,7 +672,7 @@ % does not update mark structures and can therefore be used outside % the output routine as well. % -% It collect all marks inside the \meta{source} and adds suitable +% It collect all the marks from inside the \meta{source} and adds suitable % \cs{mark_insert:nn} in the two token lists. These token lists can % then be executed at the right place to reinsert the marks, e.g., % directly after the box. This is, for example, used by @@ -821,35 +821,42 @@ % % % \begin{macro}{\@@_extract_and_handle_marks:nnn} +% \changes{v1.0e}{2023/11/14}{Macro added} % +% This is the main macro to extract and handle marks inside some +% vertical material. It is used by +% \cs{@@_update_structure_from_material:nn} (for updating the mark +% structure for a region based on the marks found) and by +% \cs{@@_get_marks_for_reinsertion:nNN} (for extracting marks from +% some material and prepare for reinserting them later (e.g., out +% of a box that is placed as a box into the main galley). % \begin{macrocode} \cs_new_protected:Npn \@@_extract_and_handle_marks:nnn #1#2#3 { % \end{macrocode} % This macro expects a region name as its third argument and % vertical material (not boxed) as its fourth. It attempts to -% extract mark information from \verb/#4/ and if it succeeds It -% executes \verb/#1{#3}/ to do something with the marks, e.g., to +% extract mark information from \verb/#3/ and, if it succeeds, it then +% executes \verb/#1/ to do something with the marks, e.g., to % update the mark structure for the region. % % If it finds infinite negative glue it generates an error message -% and then calls \verb/#2{#3}/ to handle anything special in that +% and then calls \verb/#2/ to handle anything special in that % case. % % If it finds a forced break in the material it removes it and then % restarts the attempt without it. % % Getting the first and last marks out of the material in \verb=#4= -% is done by putting the material in a box and then doing a -% split operation to the maximum size possible (which hopefully -% means all of the content).\footnote{With normal column material cut -% from the main galley we should always get all material in one go, but -% in certain situations, for example, -% in a \pkg{multicols} environment that contains -% some \cs{columnbreak}s a single split operation will not be -% enough. Thus, this this is something we need to handle.} -% Because this is an action only for the sake of getting -% at the mark values we don't want any underfull -% box warnings so we turn those (locally) off. +% is done by putting the material in a box and then doing a split +% operation to the maximum size possible (which hopefully gets us +% all of the content).\footnote{With normal column material cut +% from the main galley we should always get all material in one go, +% but in certain situations, for example, in a \pkg{multicols} +% environment that contains some \cs{columnbreak}s a single split +% operation will not be enough. Thus, this is something we need to +% handle.} Because this action is used only to get the mark +% values, we don't want any underfull box warnings so we (locally) +% turn those off. % \begin{macrocode} \group_begin: \dim_set_eq:NN \tex_splitmaxdepth:D \c_max_dim @@ -872,14 +879,14 @@ % boxes end up as the last item on the page we should not unpack % them. % -% All these issues need to be handled which is done in +% All these issues need to be handled, which is done in % \cs{@@_prepare_and_extract:nn}. % % \begin{macrocode} \@@_prepare_and_extract:nnn {#1} {#2} {#3} % \end{macrocode} -% Once all mark classes have been processed the data structures are -% updated and we can close the group which undoes our local +% Once all mark classes have been processed, the data structures are +% updated and we can close the group, which undoes our local % changes and retains only the global ones. % \begin{macrocode} \group_end: @@ -895,14 +902,14 @@ % \end{macrocode} % % To handle the \cs{enlargethispage} case we do an \tn{unskip} to -% get rid of that glue if present and also check if we have then a +% get rid of any glue that is present at the end and also check if we have then a % \tn{vbox} as the last item and if so unpack that too, but only % under certain conditions, see below. All this is temporary, just % for getting the marks out, so it doesn't affect the final page % production. % % In fact, we go one step further and set the box to a large -% negative height possible and afterwards take a look at the +% negative height and afterwards take a look at the % reported badness: if it is zero we know that there has still been % infinite shrinkage in the box so that we can't do a % \tn{vsplit}. If that is the case we generate an error message and @@ -919,9 +926,9 @@ \box_set_to_last:N \l_@@_box % \end{macrocode} % After having removed the last box from the current list (if there -% was one) we check if the list is now empty. If not, the the last +% was one) we check whether the list is now empty. If not, then the last % box is definitely not the one from \tn{enlargethispage} and so we -% can and should leave it alone. Otherwise we check if this last +% can, and should, leave it alone. Otherwise we check if this last % box is a \tn{vbox}. % \changes{v1.0d}{2022/06/01}{Extend the logic for detecting the marks % in the box (gh/836)} @@ -931,9 +938,9 @@ \box_if_vertical:NT \l_@@_box { % \end{macrocode} -% If it is, we do a further test and retypeset the \cs{l_@@_box} -% to check if it contains infinitely shrinkable glue using the same -% trick as before. +% If it is, we do a further test and retypeset the \cs{l_@@_box} to +% check whether it contains infinitely shrinkable glue, using the +% same trick as before. % \begin{macrocode} \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } { @@ -942,10 +949,10 @@ % is not empty } % \end{macrocode} -% If we don't detect infinite negative glue we unpack the box. If -% yes we ignore it for the process of mark extraction. However, we -% do not generate an error message, because in all likelihood this -% is an ordinary box like a marginal that does contain something +% If we don't detect infinite negative glue then we unpack the box. If +% we do, we ignore it for the process of mark extraction. However, we +% do not generate an error message because in all likelihood this +% is an ordinary box, like a marginal, that does contain something % like \tn{vss}. % \begin{macrocode} \int_compare:nNnT \tex_badness:D > 0 @@ -972,9 +979,8 @@ % didn't show any) we vsplit it. Note that it % doesn't matter that we set it to this strange size first. If there % was infinite shrinkage after all, we end up with a low-level -% \TeX{} error, but if that is the case, it is a coding error -% somewhere and needs -% correcting. +% \TeX{} error, but if that is the case then there is a coding error +% somewhere and needs to be corrected. % \begin{macrocode} \vbox_set_split_to_ht:NNn \l_@@_ii_box \l_@@_box \c_max_dim % \end{macrocode} @@ -985,9 +991,9 @@ \box_if_empty:NTF \l_@@_box { #1 } % \end{macrocode} -% If we have a remainder after the split then this means that there was some forced -% break in the material. We get rid of that be combining the -% content of the two boxes and restart. +% If we have a remainder after the split then this means that there +% was some forced break in the material. We get rid of that by +% combining the content of the two boxes and restart. % \begin{macrocode} { %<*trace> @@ -1014,6 +1020,8 @@ % % \begin{macro}{\@@_update_structure_from_material:nn} % +% \changes{v1.0e}{2023/11/14}{Macro renamed} +% % This function updates the mark structures of a region. The first % argument is the region to update and second argument receives the % material that holds the marks. Out of this material we extract @@ -1048,7 +1056,7 @@ \cs_new_protected:Npn \@@_update_structure_from_splitmarks:n #1 { % \end{macrocode} % -% First thing we do is copying the current structure to +% The first thing we do is to copy the current structure to % \texttt{previous-...}; this leaves the current structure % untouched so we can update it class by class (which is necessary). % \begin{macrocode} @@ -1081,8 +1089,8 @@ \tl_gset:No \g_@@_tmp_tl { \tex_splitbotmarks:D \use:c { c_@@_class_##1_mark } } % \end{macrocode} -% If this mark doesn't exist then obviously the first mark does -% neither, so both become the last mark from the previous region. We +% If this mark doesn't exist then obviously neither does the first mark, +% so both become the last mark from the previous region. We % have to be a little careful here: something like % \verb=\mark_insert:nn{foo}{}= adds an \enquote{empty} mark that should % not be confused with no mark at all. But no mark in our material @@ -1148,9 +1156,9 @@ % \begin{macro}{\@@_get_marks_for_reinsertion:nNN} % % This function extracts the marks from the material in the first -% argument but it does not update any the mark structure. Instead, +% argument but it does not update any the mark structures. Instead, % it collects the marks in the token lists given as the second and -% third argument, in a way that they can be reinserted by just +% third argument, in such a way that they can be reinserted by just % executing the token lists.\footnote{It is probably enough to % collect everything in a single token list as long as we put the % first marks first and the last marks last). But for extra @@ -1160,7 +1168,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_get_marks_for_reinsertion:nNN #1#2#3 { % \end{macrocode} -% First we clear the tmp token lists as we haven't seen any marks yet. +% First we clear the temporary token lists as we haven't seen any marks yet. % \begin{macrocode} \tl_clear:N \g_@@_first_marks_tl \tl_clear:N \g_@@_last_marks_tl @@ -1172,13 +1180,13 @@ % \end{macrocode} % If we can extract them (i.e., if we don't detect negative infinite % glue) then this is done with \cs{@@_get_from_splitmarks:} otherwise -% we issue warning that mark extraction was not possible. +% we issue a warning that mark extraction was not possible. % \begin{macrocode} { \@@_get_from_splitmarks: } { \msg_warning:nn { mark } { infinite-shrinkage-box } } { #1 } % \end{macrocode} -% finally we copy the updated (or not updated) tmp token lists to +% Finally we copy the updated (or not updated) temporary token lists to % the two that have been supplied when the function was called. % By convention they are local variables and % \cs{@@_extract_and_handle_marks:nnn} runs in a group, which is @@ -1201,7 +1209,7 @@ \seq_map_inline:Nn \g_@@_classes_seq { % \end{macrocode} -% First we to get the last last mark for the current class from the +% First we to get the last mark for the current class from the % material supplied. % \begin{macrocode} \tl_gset:No \g_@@_tmp_tl @@ -1210,12 +1218,17 @@ % % If this mark doesn't exist then obviously first mark doesn't % either, so we do nothing (other than issuing some debugging -% info). We have to be a little careful here: something like +% info). + +% We have to be a little careful here: something like % \verb=\mark_insert:nn{foo}{}= adds an \enquote{empty} mark that -% should not be confused with no mark at all. But no mark in our -% material will result in \cs{g_@@_tmp_tl} being fully empty. This -% is why we have to make sure that \enquote{empty} from -% \cs{mark_insert:nn} only appears to be empty but fails the next +% we should not confuse with the case where there is no mark at +% all. +% +% When there is no mark at all we get a truly empty +% \cs{g_@@_tmp_tl} as a result. This is why we have to make sure +% that an \enquote{empty} mark generated with \cs{mark_insert:nn} +% only appears to be empty when it is typeset, but fails the next % test (see below how this is done). % \begin{macrocode} \tl_if_empty:NTF \g_@@_tmp_tl @@ -1241,7 +1254,7 @@ { \mark_insert:nn {##1} { \g_@@_tmp_tl } } % \end{macrocode} % Because we had a last mark we also have a first mark (which might -% be the same, but might be not), so we pick that up and add it to +% be the same, but might not be), so we pick that up and add it to % the \cs{g_@@_first_marks_tl} token list. This explains why we % first checked for the last mark because that makes the processing % faster in case there is none. @@ -1268,7 +1281,7 @@ % % % \begin{macro}{\g_@@_first_marks_tl,\g_@@_last_marks_tl} -% The two global variables used in the code above. +% These are two global temporary variables used in the code above. % \begin{macrocode} \tl_new:N \g_@@_first_marks_tl \tl_new:N \g_@@_last_marks_tl @@ -1420,7 +1433,7 @@ % To retrieve the first, last or top region mark, we grab the % appropriate value stored in the corresponding token list variable % and pass its contents back. These functions should be used only -% in output routines after \cs{@@_update_structure_from_material:nn} has acted, +% in output routines and only after \cs{@@_update_structure_from_material:nn} has acted, % otherwise their value will be wrong. % % If used with an unknown class or region they generate an error @@ -1521,10 +1534,12 @@ } % \end{macrocode} % -% If box content checked for marks contains some infinite negative glue -% allowing it to shrink to an arbitrarily small size we can't extract any marks. -% They are lost, but this should not generate an error because in -% certain places, e.g., in some \env{minipage}s such glue might be legitimate. +% If some arbitrary box content to be checked for marks contains +% some infinite negative glue, allowing it to shrink to an +% arbitrarily small size, then we can't extract any marks. They +% are lost, but this should not generate an error because in +% certain places, e.g., in some \env{minipage}s, such glue might be +% legitimate. % \begin{macrocode} \msg_new:nnn { mark } { infinite-shrinkage-box } { Infinite~shrinkage~found~in~box~material~--~marks~not~extracted~ @@ -1644,12 +1659,13 @@ % % % \begin{macro}{\ShowMarksAt} +% \changes{v1.0e}{2023/11/14}{Macro added} % Debugging helper that displays a snapshot of all known mark -% structures. The argument is a text string that this is +% structures. The argument is a text string that is % displayed to help identifying when the snapshot was made. % -% This may may not stay like this which is why it isn't yet -% documented as an official command. +% This may not stay like this (or at all), which is why it isn't +% yet documented as an official command. % \begin{macrocode} \cs_new_protected:Npn \ShowMarksAt #1 { %<*trace> From 3e1a3a0099141b4a23588e5ff5daf2b4125ddcb5 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 15:59:55 +0100 Subject: [PATCH 04/20] first attempt using \interactionmode (WIP) code can be simplified if we go this way. --- base/ltmarks.dtx | 23 +++++++++++-- base/testfiles-ltmarks/xmarks-006.tlg | 3 +- base/testfiles-ltmarks/xmarks-009.lvt | 14 ++++++++ base/testfiles-ltmarks/xmarks-009.tlg | 48 +++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 4 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 2f9f49d1e..c5cbded78 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -979,10 +979,21 @@ % didn't show any) we vsplit it. Note that it % doesn't matter that we set it to this strange size first. If there % was infinite shrinkage after all, we end up with a low-level -% \TeX{} error, but if that is the case then there is a coding error -% somewhere and needs to be corrected. -% \begin{macrocode} +% \TeX{} error. Unfortunately this is something one cannot always +% prevent. For example if there is infinite negative glue that is +% canceled by infinite positive glue then we can't detect this case. +% however the splitting operation will balk, because it goes throw +% the vertical material item by item and complains the moment it +% finds any negative infinite glue, even though it is a harmless +% one if the material whole is considered as a whole. +% We therefore, change the interaction mode, so that such errors +% appear in the log, but do not stop the processing. +% \begin{macrocode} + \tl_set:Ne \l_@@_interaction_tl + { \interactionmode \the\interactionmode\relax } + \interactionmode 0 \vbox_set_split_to_ht:NNn \l_@@_ii_box \l_@@_box \c_max_dim + \l_@@_interaction_tl % \end{macrocode} % After splitting we check if there is anything left in % \cs{l_@@_box}. If not then the above split has set some split marks @@ -1017,6 +1028,12 @@ % \end{macro} % % +% \begin{macro}{\l_@@_interaction_tl} +% +% \begin{macrocode} +\tl_new:N \l_@@_interaction_tl +% \end{macrocode} +% \end{macro} % % \begin{macro}{\@@_update_structure_from_material:nn} % diff --git a/base/testfiles-ltmarks/xmarks-006.tlg b/base/testfiles-ltmarks/xmarks-006.tlg index c5d9bf45e..285f83b32 100644 --- a/base/testfiles-ltmarks/xmarks-006.tlg +++ b/base/testfiles-ltmarks/xmarks-006.tlg @@ -1,5 +1,6 @@ This is a generated file for the l3build validation system. Don't change this file in any respect. ==Even======|left=\MakeUppercase []{1\hskip 1em\relax A test}|right=| -[5] [6] +[5] +[6] ==Even======|left=\MakeUppercase []{4\hskip 1em\relax C}|right=| diff --git a/base/testfiles-ltmarks/xmarks-009.lvt b/base/testfiles-ltmarks/xmarks-009.lvt index 5e19b8c7e..717e7ffd0 100644 --- a/base/testfiles-ltmarks/xmarks-009.lvt +++ b/base/testfiles-ltmarks/xmarks-009.lvt @@ -44,6 +44,20 @@ \ShowMarksAt{after material with infinite glue} +\ExplSyntaxOn + +\__mark_update_structure_from_material:nn{page} + {text\markright{G} \par + \vskip 0pt minus 1fil\relax + text\markright{H} \par + \vskip 0pt minus -1fil\relax + text\markright{I} \par + } + +\ExplSyntaxOff + +\ShowMarksAt{after material with canceling infinite glue} + \ExplSyntaxOn diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index 2a032472c..f9d5bab12 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -106,6 +106,54 @@ Marks: unused after material with infinite glue: column (current):|||| column (first):|||| column (second):|||| +Marks: set 2e-right <- 'G' on line ... +Marks: set 2e-right-nonempty <- 'G' on line ... +Marks: set 2e-right <- 'H' on line ... +Marks: set 2e-right-nonempty <- 'H' on line ... +Marks: set 2e-right <- 'I' on line ... +Marks: set 2e-right-nonempty <- 'I' on line ... +! Infinite glue shrinkage found in box being split. +\__box_dim_eval:n ...box_dim_eval:w #1\scan_stop: +l. ... } +The box you are \vsplitting contains some infinitely +shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. +Such glue doesn't belong there; but you can safely proceed, +since the offensive shrinkability has been made finite. +! Infinite glue shrinkage found in box being split. +\__box_dim_eval:n ...box_dim_eval:w #1\scan_stop: +l. ... } +The box you are \vsplitting contains some infinitely +shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. +Such glue doesn't belong there; but you can safely proceed, +since the offensive shrinkability has been made finite. +Marks: 2e-left after material with canceling infinite glue: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right after material with canceling infinite glue: + page (current):|C|G|I| + page (previous):|C|C|C| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: 2e-right-nonempty after material with canceling infinite glue: + page (current):|C|G|I| + page (previous):|C|C|C| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| +Marks: unused after material with canceling infinite glue: + page (current):|||| + page (previous):|||| + column (previous):|||| + column (current):|||| + column (first):|||| + column (second):|||| Marks: set 2e-left <- 'A1' on line ... Marks: set 2e-right <- 'A2' on line ... Marks: set 2e-right-nonempty <- 'A2' on line ... From 2a5626b4b8303a76afa1948418fbd85b6e0ac566 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Tue, 14 Nov 2023 19:23:02 +0000 Subject: [PATCH 05/20] improve infinite glue shrinkage log message --- base/ltmarks.dtx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index c5cbded78..d523df58c 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -898,6 +898,16 @@ % \begin{macro}{@@_prepare_and_extract:nnn} % % \begin{macrocode} +\cs_set_eq:cN{Ignore~infinite~glue~shrinkage~error}\c_max_dim +% \end{macrocode} +% \begin{macrocode} +\cs_new_protected:Npx \@@_vbox_set_split_to_maxdimen:NN #1#2 + { \tex_setbox:D #1 \tex_vsplit:D #2 to \exp_not:N\use:n{ + \use:c{Ignore~infinite~glue~shrinkage~error} + } + } +% \end{macrocode} +% \begin{macrocode} \cs_new_protected:Npn \@@_prepare_and_extract:nnn #1#2#3 { % \end{macrocode} % @@ -982,17 +992,17 @@ % \TeX{} error. Unfortunately this is something one cannot always % prevent. For example if there is infinite negative glue that is % canceled by infinite positive glue then we can't detect this case. -% however the splitting operation will balk, because it goes throw +% however the splitting operation will balk, because it goes through % the vertical material item by item and complains the moment it % finds any negative infinite glue, even though it is a harmless -% one if the material whole is considered as a whole. +% one if the material is considered as a whole. % We therefore, change the interaction mode, so that such errors % appear in the log, but do not stop the processing. % \begin{macrocode} \tl_set:Ne \l_@@_interaction_tl { \interactionmode \the\interactionmode\relax } - \interactionmode 0 - \vbox_set_split_to_ht:NNn \l_@@_ii_box \l_@@_box \c_max_dim + \interactionmode 0\scan_stop: + \@@_vbox_set_split_to_maxdimen:NN \l_@@_ii_box \l_@@_box \l_@@_interaction_tl % \end{macrocode} % After splitting we check if there is anything left in From 071e846bad7a2771ce86157e70b1877b6a5c7055 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 22:50:55 +0100 Subject: [PATCH 06/20] some documentation of David's idea --- base/ltmarks.dtx | 97 ++++++++++++++++++++++----- base/testfiles-ltmarks/xmarks-009.tlg | 4 +- 2 files changed, 83 insertions(+), 18 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index d523df58c..0a6829455 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -898,16 +898,6 @@ % \begin{macro}{@@_prepare_and_extract:nnn} % % \begin{macrocode} -\cs_set_eq:cN{Ignore~infinite~glue~shrinkage~error}\c_max_dim -% \end{macrocode} -% \begin{macrocode} -\cs_new_protected:Npx \@@_vbox_set_split_to_maxdimen:NN #1#2 - { \tex_setbox:D #1 \tex_vsplit:D #2 to \exp_not:N\use:n{ - \use:c{Ignore~infinite~glue~shrinkage~error} - } - } -% \end{macrocode} -% \begin{macrocode} \cs_new_protected:Npn \@@_prepare_and_extract:nnn #1#2#3 { % \end{macrocode} % @@ -999,11 +989,7 @@ % We therefore, change the interaction mode, so that such errors % appear in the log, but do not stop the processing. % \begin{macrocode} - \tl_set:Ne \l_@@_interaction_tl - { \interactionmode \the\interactionmode\relax } - \interactionmode 0\scan_stop: \@@_vbox_set_split_to_maxdimen:NN \l_@@_ii_box \l_@@_box - \l_@@_interaction_tl % \end{macrocode} % After splitting we check if there is anything left in % \cs{l_@@_box}. If not then the above split has set some split marks @@ -1038,10 +1024,89 @@ % \end{macro} % % -% \begin{macro}{\l_@@_interaction_tl} +% \begin{macro}{\@@_vbox_set_split_to_maxdimen:NN} +% +% Split a box to get at its marks without pausing even if \TeX{} is +% producing an error message because of infinite negative glue in +% the box. If there is such an error we ensure that it only shows +% up in the log but not on the terminal. +% +% The nice low-level hack by DPC records in the \texttt{.log} that a glue +% shrinkage error is harmless. +% +% We disguise \Cs{c_max_dim} in an odd looking csname, which then +% shows up as part of the display of an error message if that error +% happens. This csname forms part of the error diplay so what +% you get is something like +%\begin{verbatim} +% ! Infinite glue shrinkage found in box being split. +% Glue shrinkage error above ignored ! +% l. ... } +%\end{verbatim} +% which hopefully makes it clear that the error is harmless and ignored. +% \begin{macrocode} +\cs_set_eq:cN {Glue~shrinkage~error~above~ignored~!}\c_max_dim +% \end{macrocode} +% +% The whole definition of \cs{@@_vbox_set_split_to_maxdimen:NN} +% below is fully expanded, so we have to use a lot of +% \cs{exp_not:N}s to prevent expansion where necessary. +% \begin{macrocode} +\cs_new_protected:Npx \@@_vbox_set_split_to_maxdimen:NN #1#2 { +% \end{macrocode} +% We start by saving the current interaction and escape char setting. +% \begin{macrocode} + \tl_set:Nn \exp_not:N \l_@@_saved_parameters_tl + { + \tex_interactionmode:D + \int_use:N \tex_interactionmode:D \scan_stop: + \tex_escapechar:D + \int_use:N \tex_escapechar:D \scan_stop: + } +% \end{macrocode} +% Then we change them so that no escape char is printed in the +% error message (accounts for the missing backslash in front of +% \verb/Glue shrinkage .../) and we set the interaction to +% \cs{nonstopmode} so that the the error (if any) just goes into +% the \texttt{.log} file and \TeX{} doesn't stop at that point. +% \begin{macrocode} + \tex_escapechar:D -1 \scan_stop: + \nonstopmode +% \end{macrocode} +% Then we do the splitting of the box to \cs{c_max_dim} to get at +% the marks. This may generate the error we are worried about, +% i.e., if the box contains infinite negative glue. However, \TeX{} +% makes this glue finite and continues, which means we get our split +% marks which is really all we care about. +% \begin{macrocode} + \tex_setbox:D #1 \tex_vsplit:D #2 to +% \end{macrocode} +% The \cs{use:n} may seem pointless, and it is to some extent, but +% we need it to get our disguised \cs{c_max_dim} displayed +% properly as part of the error message if there is one. Without +% it, the display would show only part of what we want it to show +% (try it). +% \begin{macrocode} + \exp_not:N \use:n { +% \use:c{~Ignore~infinite~glue~shrinkage~error} +% \use:c{Glue~shrinkage~error~is~harmless~!} + \use:c{Glue~shrinkage~error~above~ignored~!} + } +% \end{macrocode} +% Finally, we change the escape char and the interaction mode back +% to what it was before: +% \begin{macrocode} + \exp_not:N \l_@@_saved_parameters_tl +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\l_@@_saved_parameters_tl} % % \begin{macrocode} -\tl_new:N \l_@@_interaction_tl +\tl_new:N \l_@@_saved_parameters_tl % \end{macrocode} % \end{macro} % diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index f9d5bab12..9c6ee11e0 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -113,14 +113,14 @@ Marks: set 2e-right-nonempty <- 'H' on line ... Marks: set 2e-right <- 'I' on line ... Marks: set 2e-right-nonempty <- 'I' on line ... ! Infinite glue shrinkage found in box being split. -\__box_dim_eval:n ...box_dim_eval:w #1\scan_stop: + Glue shrinkage error above ignored ! l. ... } The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. Such glue doesn't belong there; but you can safely proceed, since the offensive shrinkability has been made finite. ! Infinite glue shrinkage found in box being split. -\__box_dim_eval:n ...box_dim_eval:w #1\scan_stop: + Glue shrinkage error above ignored ! l. ... } The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. From 759de638375e4314d2dc4079c92558d38c0521da Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 22:59:37 +0100 Subject: [PATCH 07/20] hmm --- base/ltmarks.dtx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 0a6829455..f976e32a3 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -1034,7 +1034,7 @@ % The nice low-level hack by DPC records in the \texttt{.log} that a glue % shrinkage error is harmless. % -% We disguise \Cs{c_max_dim} in an odd looking csname, which then +% We disguise \cs{c_max_dim} in an odd looking csname, which then % shows up as part of the display of an error message if that error % happens. This csname forms part of the error diplay so what % you get is something like From 9963c28bf4d7038ca4cbb251eb3a95bef78cb070 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 23:11:04 +0100 Subject: [PATCH 08/20] much simpler this way now (and the marks always correct) documentation not yet updated and old code still mostly inside commented out --- base/ltmarks.dtx | 30 ++++++++------- base/testfiles-ltmarks/xmarks-009.tlg | 53 +++++++++++++++++---------- 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index f976e32a3..dc583510d 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -919,7 +919,7 @@ % infinite shrinkage in all cases, e.g., if there are several glues % that cancel each other, but it is the best we can do. % \begin{macrocode} - \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } + \vbox_set:Nn \l_@@_box { #3 \tex_unskip:D @@ -942,12 +942,12 @@ % check whether it contains infinitely shrinkable glue, using the % same trick as before. % \begin{macrocode} - \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } - { - \vbox_unpack:N \l_@@_box - \tex_kern:D \c_zero_dim % ensure that box - % is not empty - } +% \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } +% { +% \vbox_unpack:N \l_@@_box +% \tex_kern:D \c_zero_dim % ensure that box +% % is not empty +% } % \end{macrocode} % If we don't detect infinite negative glue then we unpack the box. If % we do, we ignore it for the process of mark extraction. However, we @@ -955,8 +955,10 @@ % is an ordinary box, like a marginal, that does contain something % like \tn{vss}. % \begin{macrocode} - \int_compare:nNnT \tex_badness:D > 0 - { \vbox_unpack:N \l_@@_box } +% \int_compare:nNnT \tex_badness:D > 0 +% { + \vbox_unpack:N \l_@@_box +% } } } % \end{macrocode} @@ -970,10 +972,10 @@ % infinite shrinking glue. A simple \tn{kern} is enough to avoid % this (the same was already done above). % \begin{macrocode} - \tex_kern:D \c_zero_dim +% \tex_kern:D \c_zero_dim } - \int_compare:nNnTF \tex_badness:D > 0 - { +% \int_compare:nNnTF \tex_badness:D > 0 +% { % \end{macrocode} % If the box had no infinite shrinkage (or rather if our test % didn't show any) we vsplit it. Note that it @@ -1012,13 +1014,13 @@ { \vbox_unpack:N \l_@@_ii_box \vbox_unpack:N \l_@@_box } } - } +% } % \end{macrocode} % If the badness was zero (we actually tested for${}>0$ but it % can't get negative) then we had infinite shrinkage, so we execute % the code that handles that case: % \begin{macrocode} - { #2 } +% { #2 } } % \end{macrocode} % \end{macro} diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index 9c6ee11e0..71a9556db 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -70,14 +70,14 @@ Marks: set 2e-right <- 'E' on line ... Marks: set 2e-right-nonempty <- 'E' on line ... Marks: set 2e-right <- 'F' on line ... Marks: set 2e-right-nonempty <- 'F' on line ... -! LaTeX mark Error: Infinite shrinkage found in 'page' region. -For immediate help type H . - ... +Marks: mark extraction needs recursion on line ... +! Infinite glue shrinkage found in box being split. + Glue shrinkage error above ignored ! l. ... } -This is a coding error. -The mark region 'page' contains some infinite negative glue allowing it to -shrink to an arbitrarily small size. This makes it impossible to split the -region apart to get at its marks. They are lost. +The box you are \vsplitting contains some infinitely +shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. +Such glue doesn't belong there; but you can safely proceed, +since the offensive shrinkability has been made finite. Marks: 2e-left after material with infinite glue: page (current):|||| page (previous):|||| @@ -86,15 +86,15 @@ Marks: 2e-left after material with infinite glue: column (first):|||| column (second):|||| Marks: 2e-right after material with infinite glue: - page (current):|C|C|C| - page (previous):|||| + page (current):|C|D|F| + page (previous):||A|C| column (previous):|||| column (current):|||| column (first):|||| column (second):|||| Marks: 2e-right-nonempty after material with infinite glue: - page (current):|C|C|C| - page (previous):|||| + page (current):|C|D|F| + page (previous):||A|C| column (previous):|||| column (current):|||| column (first):|||| @@ -134,15 +134,15 @@ Marks: 2e-left after material with canceling infinite glue: column (first):|||| column (second):|||| Marks: 2e-right after material with canceling infinite glue: - page (current):|C|G|I| - page (previous):|C|C|C| + page (current):|F|G|I| + page (previous):|C|D|F| column (previous):|||| column (current):|||| column (first):|||| column (second):|||| Marks: 2e-right-nonempty after material with canceling infinite glue: - page (current):|C|G|I| - page (previous):|C|C|C| + page (current):|F|G|I| + page (previous):|C|D|F| column (previous):|||| column (current):|||| column (first):|||| @@ -187,11 +187,26 @@ Marks: set 2e-right <- 'B2' on line ... Marks: set 2e-right-nonempty <- 'B2' on line ... Marks: set 2e-right <- 'A3' on line ... Marks: set 2e-right-nonempty <- 'A3' on line ... -LaTeX mark Warning: Infinite shrinkage found in box material -- marks not -(mark) extracted on line ... -> \l_first_marks_tl=. +Marks: mark extraction needs recursion on line ... +! Infinite glue shrinkage found in box being split. + Glue shrinkage error above ignored ! +l. ... \l_last_marks_tl +The box you are \vsplitting contains some infinitely +shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. +Such glue doesn't belong there; but you can safely proceed, +since the offensive shrinkability has been made finite. +Marks: extract last mark for class '2e-left' = B1 +Marks: extract first mark for class '2e-left' = A1 +Marks: extract last mark for class '2e-right' = A3 +Marks: extract first mark for class '2e-right' = A2 +Marks: extract last mark for class '2e-right-nonempty' = A3 +Marks: extract first mark for class '2e-right-nonempty' = A2 +Marks: no marks for class 'unused' on line ... +> \l_first_marks_tl=\mark_insert:nn {2e-left}{A1}\mark_insert:nn +{2e-right}{A2}\mark_insert:nn {2e-right-nonempty}{A2}. } l. ...\tl_show:N \l_first_marks_tl -> \l_last_marks_tl=. +> \l_last_marks_tl=\mark_insert:nn {2e-left}{B1}\mark_insert:nn +{2e-right}{A3}\mark_insert:nn {2e-right-nonempty}{A3}. } l. ...\tl_show:N \l_last_marks_tl From 8bab6baf96a80efa05d5fd2839372fa7529c849c Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 23:16:29 +0100 Subject: [PATCH 09/20] the ways of TeX are mysterious --- anybody any idea how this change can be triggered from ltmarks.dtx? --- base/testfiles-legacy/utf8-test-001.tlg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/testfiles-legacy/utf8-test-001.tlg b/base/testfiles-legacy/utf8-test-001.tlg index 0bfde8198..8c0b30cb1 100644 --- a/base/testfiles-legacy/utf8-test-001.tlg +++ b/base/testfiles-legacy/utf8-test-001.tlg @@ -34,7 +34,8 @@ LaTeX Font Info: External font `cmex10' loaded for size \tf@toc=\write... [1 ] -(f^^c3^^bc^^c3^^9fe^^e2^^82^^ac^^e2^^82^^ac^^e2^^82^^ac.tex) [2 +(f^^c3^^bc^^c3^^9fe^^e2^^82^^ac^^e2^^82^^ac^^e2^^82^^ac.tex) +[2 ] (f^^c3^^bc^^c3^^9fe im sand.tex) (f^^c3^^bc^^c3^^9fe.tex) No file ^^e2^^82^^ac^^e2^^82^^ac^^e2^^82^^ac. (f^^c3^^bc^^c3^^9fe im sand.tex) (f^^c3^^bc^^c3^^9fe im sand.tex) (one two three.tex) From c05b4ff779d7ad298d8e40971e2719e4312a8089 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 23:24:44 +0100 Subject: [PATCH 10/20] more of those ... strange --- base/testfiles-doc/tlb-dox002.luatex.tlg | 6 ++++-- base/testfiles-doc/tlb-dox002.tlg | 6 ++++-- base/testfiles-doc/tlb-dox003.luatex.tlg | 3 ++- base/testfiles-doc/tlb-dox003.tlg | 3 ++- base/testfiles-doc/tlb-falk002.luatex.tlg | 3 ++- base/testfiles-doc/tlb-falk002.tlg | 3 ++- base/testfiles-doc/tlb-hypdoc001.luatex.tlg | 4 +++- base/testfiles-doc/tlb-hypdoc001.tlg | 4 +++- base/update-doc.sh | 10 +++++----- 9 files changed, 27 insertions(+), 15 deletions(-) diff --git a/base/testfiles-doc/tlb-dox002.luatex.tlg b/base/testfiles-doc/tlb-dox002.luatex.tlg index 940838f1d..9eadc1410 100644 --- a/base/testfiles-doc/tlb-dox002.luatex.tlg +++ b/base/testfiles-doc/tlb-dox002.luatex.tlg @@ -45,7 +45,8 @@ Indexing '\mylength' as Length Searching for '\relax' Indexing '\relax' (\SpecialIndex) \indexentry{relax=\verb!*+\relax+|hdclindex{13}{code}}{3} -(tlb-dox002.ind [2 +(tlb-dox002.ind +[2 \glossaryentry{v3>myenvironment=\verb!*+myenvironment+:>Third change|hdpindex{}}{2} \glossaryentry{v2.2>@mymacro=\verb!*+\@mymacro+:>new|hdpindex{}}{2} ] @@ -56,7 +57,8 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... [3 -]) (tlb-dox002.gls [4 +]) (tlb-dox002.gls +[4 ]) (tlb-dox002.aux) Package rerunfilecheck Info: File `tlb-dox002.out' has not changed. (rerunfilecheck) Checksum: 349BDA914F2BE01D49890BA22F447C6E;700. diff --git a/base/testfiles-doc/tlb-dox002.tlg b/base/testfiles-doc/tlb-dox002.tlg index 940838f1d..9eadc1410 100644 --- a/base/testfiles-doc/tlb-dox002.tlg +++ b/base/testfiles-doc/tlb-dox002.tlg @@ -45,7 +45,8 @@ Indexing '\mylength' as Length Searching for '\relax' Indexing '\relax' (\SpecialIndex) \indexentry{relax=\verb!*+\relax+|hdclindex{13}{code}}{3} -(tlb-dox002.ind [2 +(tlb-dox002.ind +[2 \glossaryentry{v3>myenvironment=\verb!*+myenvironment+:>Third change|hdpindex{}}{2} \glossaryentry{v2.2>@mymacro=\verb!*+\@mymacro+:>new|hdpindex{}}{2} ] @@ -56,7 +57,8 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... [3 -]) (tlb-dox002.gls [4 +]) (tlb-dox002.gls +[4 ]) (tlb-dox002.aux) Package rerunfilecheck Info: File `tlb-dox002.out' has not changed. (rerunfilecheck) Checksum: 349BDA914F2BE01D49890BA22F447C6E;700. diff --git a/base/testfiles-doc/tlb-dox003.luatex.tlg b/base/testfiles-doc/tlb-dox003.luatex.tlg index 8f04b4d13..394465f04 100644 --- a/base/testfiles-doc/tlb-dox003.luatex.tlg +++ b/base/testfiles-doc/tlb-dox003.luatex.tlg @@ -84,7 +84,8 @@ Underfull \hbox (badness 5036) in paragraph at lines 41--43 .\OT1/cmr/m/n/9 - .\discretionary (penalty 50) .\glue(\rightskip) 15.0 -) (tlb-dox003.gls) [2 +) (tlb-dox003.gls) +[2 \glossaryentry{v3>myenvironment=\verb!*+myenvironment+:>Third change}{2} \glossaryentry{v2.2>@mymacro=\verb!*+\@mymacro+:>new}{2} ] (tlb-dox003.aux) diff --git a/base/testfiles-doc/tlb-dox003.tlg b/base/testfiles-doc/tlb-dox003.tlg index 4af926d8b..cf9168eba 100644 --- a/base/testfiles-doc/tlb-dox003.tlg +++ b/base/testfiles-doc/tlb-dox003.tlg @@ -80,7 +80,8 @@ Underfull \hbox (badness 5036) in paragraph at lines 41--43 .\discretionary .\OT1/cmr/m/n/9 - .\glue(\rightskip) 15.0 -) (tlb-dox003.gls) [2 +) (tlb-dox003.gls) +[2 \glossaryentry{v3>myenvironment=\verb!*+myenvironment+:>Third change}{2} \glossaryentry{v2.2>@mymacro=\verb!*+\@mymacro+:>new}{2} ] (tlb-dox003.aux) diff --git a/base/testfiles-doc/tlb-falk002.luatex.tlg b/base/testfiles-doc/tlb-falk002.luatex.tlg index 2e8e4e6ac..932bb7cad 100644 --- a/base/testfiles-doc/tlb-falk002.luatex.tlg +++ b/base/testfiles-doc/tlb-falk002.luatex.tlg @@ -45,7 +45,8 @@ No file tlb-falk002.gls. * This macro file has no checksum! * The checksum should be 12! ********************************** -) [1 +) +[1 \glossaryentry{v2.00>!!=General:>Etwas Neues}{1} \glossaryentry{v2.01>!!=General:>Und sogar noch neuer}{1} \glossaryentry{v2.00>mymacro=\verb!*+\mymacro+:>neu}{1} diff --git a/base/testfiles-doc/tlb-falk002.tlg b/base/testfiles-doc/tlb-falk002.tlg index 2e8e4e6ac..932bb7cad 100644 --- a/base/testfiles-doc/tlb-falk002.tlg +++ b/base/testfiles-doc/tlb-falk002.tlg @@ -45,7 +45,8 @@ No file tlb-falk002.gls. * This macro file has no checksum! * The checksum should be 12! ********************************** -) [1 +) +[1 \glossaryentry{v2.00>!!=General:>Etwas Neues}{1} \glossaryentry{v2.01>!!=General:>Und sogar noch neuer}{1} \glossaryentry{v2.00>mymacro=\verb!*+\mymacro+:>neu}{1} diff --git a/base/testfiles-doc/tlb-hypdoc001.luatex.tlg b/base/testfiles-doc/tlb-hypdoc001.luatex.tlg index 990a0a770..162602a38 100644 --- a/base/testfiles-doc/tlb-hypdoc001.luatex.tlg +++ b/base/testfiles-doc/tlb-hypdoc001.luatex.tlg @@ -9,6 +9,7 @@ LaTeX Font Info: External font `cmex10' loaded for size \tf@toc=\write... (tlb-hypdoc001.lvt LaTeX Font Info: Trying to load font information for T1+cmtt on input line .... +[1 \indexentry{foo=\verb!*+\foo+|hdclindex{2}{usage}}{1} ] \indexentry{foo=\verb!*+\foo+|hdclindex{3}{main}}{1} @@ -51,7 +52,8 @@ Package hyperref Warning: Token not allowed in a PDF string (Unicode): [2 \indexentry{secnumdepth={\ttfamily secnumdepth} (counter)|hdclindex{17}{usage}}{2} \indexentry{counters:>secnumdepth={\ttfamily secnumdepth}|hdclindex{17}{usage}}{2} -]) [3] (tlb-hypdoc001.aux) +]) +[3] (tlb-hypdoc001.aux) Package rerunfilecheck Info: File `tlb-hypdoc001.out' has not changed. (rerunfilecheck) Checksum: 02BF5FF5A4002CD28A9EB50F297994CB;842. Package rerunfilecheck Info: File `tlb-hypdoc001.hd' has not changed. diff --git a/base/testfiles-doc/tlb-hypdoc001.tlg b/base/testfiles-doc/tlb-hypdoc001.tlg index 990a0a770..162602a38 100644 --- a/base/testfiles-doc/tlb-hypdoc001.tlg +++ b/base/testfiles-doc/tlb-hypdoc001.tlg @@ -9,6 +9,7 @@ LaTeX Font Info: External font `cmex10' loaded for size \tf@toc=\write... (tlb-hypdoc001.lvt LaTeX Font Info: Trying to load font information for T1+cmtt on input line .... +[1 \indexentry{foo=\verb!*+\foo+|hdclindex{2}{usage}}{1} ] \indexentry{foo=\verb!*+\foo+|hdclindex{3}{main}}{1} @@ -51,7 +52,8 @@ Package hyperref Warning: Token not allowed in a PDF string (Unicode): [2 \indexentry{secnumdepth={\ttfamily secnumdepth} (counter)|hdclindex{17}{usage}}{2} \indexentry{counters:>secnumdepth={\ttfamily secnumdepth}|hdclindex{17}{usage}}{2} -]) [3] (tlb-hypdoc001.aux) +]) +[3] (tlb-hypdoc001.aux) Package rerunfilecheck Info: File `tlb-hypdoc001.out' has not changed. (rerunfilecheck) Checksum: 02BF5FF5A4002CD28A9EB50F297994CB;842. Package rerunfilecheck Info: File `tlb-hypdoc001.hd' has not changed. diff --git a/base/update-doc.sh b/base/update-doc.sh index 4af0bc1ba..dbea5c0c5 100644 --- a/base/update-doc.sh +++ b/base/update-doc.sh @@ -1,4 +1,4 @@ -l3build save -cconfig-doc -eetex \ +l3build save -cconfig-doc -epdftex \ github-0023 \ github-0750 \ tlb-dox009 \ @@ -8,15 +8,15 @@ l3build save -cconfig-doc -eetex \ tlb-dox013 \ tlb-dox014 -l3build save -cconfig-doc -eetex,xetex,luatex \ +l3build save -cconfig-doc -epdftex,xetex,luatex \ github-0205 \ tlb-dox004 \ tlb-dox005 -# l3build save -cconfig-doc -eetex,xetex +# l3build save -cconfig-doc -epdftex,xetex -l3build save -cconfig-doc -eetex,luatex \ +l3build save -cconfig-doc -epdftex,luatex \ github-0075 \ tlb-doc009 \ tlb-dox001 \ @@ -34,5 +34,5 @@ l3build save -cconfig-doc -eetex,luatex \ -#l3build save -eetex \ +#l3build save -epdftex \ From 99c537b01b5c779a92659138081a236b584aac3b Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Tue, 14 Nov 2023 23:36:20 +0100 Subject: [PATCH 11/20] and another one --- base/testfiles-doc/github-0344.tlg | 3 ++- base/update-doc.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/base/testfiles-doc/github-0344.tlg b/base/testfiles-doc/github-0344.tlg index a0dca4a67..776060e95 100644 --- a/base/testfiles-doc/github-0344.tlg +++ b/base/testfiles-doc/github-0344.tlg @@ -24,5 +24,6 @@ l. ...% \showbox\@labels ! OK. l. ...% \showbox\@labels ^^A -> void -) [1 +) +[1 ] (github-0344.aux) diff --git a/base/update-doc.sh b/base/update-doc.sh index dbea5c0c5..aa7580144 100644 --- a/base/update-doc.sh +++ b/base/update-doc.sh @@ -1,5 +1,6 @@ l3build save -cconfig-doc -epdftex \ github-0023 \ + github-0344 \ github-0750 \ tlb-dox009 \ tlb-dox010 \ From d599d5ea0eff8c68e6b58e077eb716e62c9cf4ba Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Wed, 15 Nov 2023 12:26:10 +0100 Subject: [PATCH 12/20] some cleanup and many more test files showing extra lines in the log --- base/ltmarks.dtx | 185 +++++------------- base/testfiles/github-0217-io-base.tlg | 9 +- .../testfiles/github-0217-io-space.luatex.tlg | 9 +- base/testfiles/github-0217-io-space.tlg | 9 +- base/testfiles/tl2e8.tlg | 7 +- base/testfiles/tlb-fltrace-005b.luatex.tlg | 3 +- base/testfiles/tlb-fltrace-005b.tlg | 3 +- base/testfiles/tlb0577a.luatex.tlg | 1 + base/testfiles/tlb0577a.tlg | 1 + base/testfiles/tlb0878b.luatex.tlg | 1 + base/testfiles/tlb0878b.tlg | 1 + base/testfiles/tlb1379.luatex.tlg | 1 + base/testfiles/tlb1379.tlg | 1 + base/testfiles/tlb1451.luatex.tlg | 8 +- base/testfiles/tlb1451.tlg | 8 +- base/testfiles/tlb1783a.tlg | 6 +- base/testfiles/tlb1826.luatex.tlg | 1 + base/testfiles/tlb1826.tlg | 1 + base/testfiles/tlb2400.luatex.tlg | 3 +- base/testfiles/tlb2400.tlg | 3 +- base/testfiles/tlcs01a.luatex.tlg | 3 +- base/testfiles/tlcs01a.tlg | 3 +- base/testfiles/tlcs01b.luatex.tlg | 3 +- base/testfiles/tlcs01b.tlg | 3 +- base/testfiles/tlcs01r.luatex.tlg | 3 +- base/testfiles/tlcs01r.tlg | 3 +- base/testfiles/tlcs02.luatex.tlg | 1 + base/testfiles/tlcs02.tlg | 1 + base/testfiles/tlcs04a.luatex.tlg | 4 +- base/testfiles/tlcs04a.tlg | 4 +- base/testfiles/tlcs04b.luatex.tlg | 4 +- base/testfiles/tlcs04b.tlg | 4 +- base/testfiles/tlcs04r.luatex.tlg | 1 + base/testfiles/tlcs04r.tlg | 1 + base/testfiles/tlcs06a.tlg | 3 +- base/testfiles/tlcs06b.tlg | 7 +- base/testfiles/tlcs06r.tlg | 6 +- base/testfiles/tltc001.luatex.tlg | 3 +- base/testfiles/tltc001.tlg | 3 +- base/testfiles/tltx001.luatex.tlg | 3 +- base/testfiles/tltx001.tlg | 3 +- base/testfiles/tltx001.xetex.tlg | 3 +- base/testfiles/tltx004.tlg | 3 +- base/testfiles/tlxs01b.luatex.tlg | 3 +- base/testfiles/tlxs01b.tlg | 3 +- base/testfiles/tlxs01r.luatex.tlg | 3 +- base/testfiles/tlxs01r.tlg | 3 +- base/testfiles/tlxs04b.tlg | 3 +- base/testfiles/tlxs06a.tlg | 3 +- base/testfiles/tlxs06b.tlg | 7 +- base/testfiles/tlxs06r.tlg | 6 +- .../testfiles/firstaid-pgfmorepages.tlg | 3 +- .../graphics/testfiles/braces-compat-01.tlg | 3 +- 53 files changed, 175 insertions(+), 195 deletions(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index dc583510d..970a881d0 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -16,7 +16,7 @@ % % \begin{macrocode} \def\ltmarksversion{v1.0e} -\def\ltmarksdate{2023/11/14} +\def\ltmarksdate{2023/11/15} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -820,7 +820,7 @@ % % % -% \begin{macro}{\@@_extract_and_handle_marks:nnn} +% \begin{macro}{\@@_extract_and_handle_marks:nn} % \changes{v1.0e}{2023/11/14}{Macro added} % % This is the main macro to extract and handle marks inside some @@ -831,7 +831,7 @@ % some material and prepare for reinserting them later (e.g., out % of a box that is placed as a box into the main galley). % \begin{macrocode} -\cs_new_protected:Npn \@@_extract_and_handle_marks:nnn #1#2#3 { +\cs_new_protected:Npn \@@_extract_and_handle_marks:nn #1#2 { % \end{macrocode} % This macro expects a region name as its third argument and % vertical material (not boxed) as its fourth. It attempts to @@ -883,7 +883,7 @@ % \cs{@@_prepare_and_extract:nn}. % % \begin{macrocode} - \@@_prepare_and_extract:nnn {#1} {#2} {#3} + \@@_prepare_and_extract:nn {#1} {#2} % \end{macrocode} % Once all mark classes have been processed, the data structures are % updated and we can close the group, which undoes our local @@ -895,38 +895,28 @@ % \end{macro} % % -% \begin{macro}{@@_prepare_and_extract:nnn} +% \begin{macro}{@@_prepare_and_extract:nn} % % \begin{macrocode} -\cs_new_protected:Npn \@@_prepare_and_extract:nnn #1#2#3 { +\cs_new_protected:Npn \@@_prepare_and_extract:nn #1#2 { % \end{macrocode} % % To handle the \cs{enlargethispage} case we do an \tn{unskip} to -% get rid of any glue that is present at the end and also check if we have then a -% \tn{vbox} as the last item and if so unpack that too, but only -% under certain conditions, see below. All this is temporary, just -% for getting the marks out, so it doesn't affect the final page -% production. -% -% In fact, we go one step further and set the box to a large -% negative height and afterwards take a look at the -% reported badness: if it is zero we know that there has still been -% infinite shrinkage in the box so that we can't do a -% \tn{vsplit}. If that is the case we generate an error message and -% bypass extracting the marks. We use only half of \cs{c_max_dim} -% because otherwise \TeX{} will report an overfull vbox despite our -% setting of \cs{tex_vfuzz:D}. This test will not find existing -% infinite shrinkage in all cases, e.g., if there are several glues -% that cancel each other, but it is the best we can do. +% get rid of any glue that is present at the end of the material +% and also check if we have then a \tn{vbox} as the last item and +% if so unpack that too, but only under certain conditions, see +% below. All this is temporary done in a group, just for getting +% the marks out, so it doesn't affect the final page production. +% % \begin{macrocode} \vbox_set:Nn \l_@@_box { - #3 + #2 \tex_unskip:D \box_set_to_last:N \l_@@_box % \end{macrocode} % After having removed the last box from the current list (if there -% was one) we check whether the list is now empty. If not, then the last +% was one) we check whether the vertical list is now empty. If not, then the last % box is definitely not the one from \tn{enlargethispage} and so we % can, and should, leave it alone. Otherwise we check if this last % box is a \tn{vbox}. @@ -938,58 +928,25 @@ \box_if_vertical:NT \l_@@_box { % \end{macrocode} -% If it is, we do a further test and retypeset the \cs{l_@@_box} to -% check whether it contains infinitely shrinkable glue, using the -% same trick as before. -% \begin{macrocode} -% \vbox_set_to_ht:Nnn \l_@@_box { -.5\c_max_dim } -% { -% \vbox_unpack:N \l_@@_box -% \tex_kern:D \c_zero_dim % ensure that box -% % is not empty -% } -% \end{macrocode} -% If we don't detect infinite negative glue then we unpack the box. If -% we do, we ignore it for the process of mark extraction. However, we -% do not generate an error message because in all likelihood this -% is an ordinary box, like a marginal, that does contain something -% like \tn{vss}. -% \begin{macrocode} -% \int_compare:nNnT \tex_badness:D > 0 -% { +% If it is, we unpack the box. +% \begin{macrocode} \vbox_unpack:N \l_@@_box -% } } } % \end{macrocode} % If it wasn't a vbox, it was either an hbox or there was no box. % Given that we are only interested in the marks we don't need put -% it back in that case. However, we have to make sure that the -% outer box under construction -% is not totally empty (which it might have been from the start, or -% now), because \TeX{} does not report a badness for empty boxes -% and that means our test would incorrectly conclude that we have -% infinite shrinking glue. A simple \tn{kern} is enough to avoid -% this (the same was already done above). -% \begin{macrocode} -% \tex_kern:D \c_zero_dim +% it back in that case. } -% \int_compare:nNnTF \tex_badness:D > 0 -% { -% \end{macrocode} -% If the box had no infinite shrinkage (or rather if our test -% didn't show any) we vsplit it. Note that it -% doesn't matter that we set it to this strange size first. If there -% was infinite shrinkage after all, we end up with a low-level -% \TeX{} error. Unfortunately this is something one cannot always -% prevent. For example if there is infinite negative glue that is -% canceled by infinite positive glue then we can't detect this case. -% however the splitting operation will balk, because it goes through -% the vertical material item by item and complains the moment it -% finds any negative infinite glue, even though it is a harmless -% one if the material is considered as a whole. -% We therefore, change the interaction mode, so that such errors -% appear in the log, but do not stop the processing. +% \end{macrocode} +% We are now ready to \cs{vsplit} the box to get at the marks. If +% the box contains some infinite negative glue the \TeX{} will +% produce an error complaining about it, but it will correctly find +% the the split marks. Given that we can't prevent that error, we +% hide it from the user and ensure that \TeX{} doesn't stop. The +% error message still shows in the log, but even that is mitigated +% as best as possible---see the definition of +% \cs{@@_vbox_set_split_to_maxdimen:NN} for the tricks employed. % \begin{macrocode} \@@_vbox_set_split_to_maxdimen:NN \l_@@_ii_box \l_@@_box % \end{macrocode} @@ -1010,17 +967,10 @@ { Marks:~ mark~ extraction~needs~ recursion~ \msg_line_context: } } % - \@@_prepare_and_extract:nnn {#1} {#2} + \@@_prepare_and_extract:nn {#1} { \vbox_unpack:N \l_@@_ii_box \vbox_unpack:N \l_@@_box } } -% } -% \end{macrocode} -% If the badness was zero (we actually tested for${}>0$ but it -% can't get negative) then we had infinite shrinkage, so we execute -% the code that handles that case: -% \begin{macrocode} -% { #2 } } % \end{macrocode} % \end{macro} @@ -1045,7 +995,8 @@ % Glue shrinkage error above ignored ! % l. ... } %\end{verbatim} -% which hopefully makes it clear that the error is harmless and ignored. +% which hopefully makes it clear that the error is harmless and +% and should be ignored by the reader of the \texttt{.log}. % \begin{macrocode} \cs_set_eq:cN {Glue~shrinkage~error~above~ignored~!}\c_max_dim % \end{macrocode} @@ -1056,14 +1007,14 @@ % \begin{macrocode} \cs_new_protected:Npx \@@_vbox_set_split_to_maxdimen:NN #1#2 { % \end{macrocode} -% We start by saving the current interaction and escape char setting. +% We start by saving the current interaction and escape char settings. % \begin{macrocode} - \tl_set:Nn \exp_not:N \l_@@_saved_parameters_tl + \tl_set:Ne \exp_not:N \l_@@_saved_parameters_tl { \tex_interactionmode:D - \int_use:N \tex_interactionmode:D \scan_stop: + \exp_not:N \int_use:N \tex_interactionmode:D \scan_stop: \tex_escapechar:D - \int_use:N \tex_escapechar:D \scan_stop: + \exp_not:N \int_use:N \tex_escapechar:D \scan_stop: } % \end{macrocode} % Then we change them so that no escape char is printed in the @@ -1073,7 +1024,7 @@ % the \texttt{.log} file and \TeX{} doesn't stop at that point. % \begin{macrocode} \tex_escapechar:D -1 \scan_stop: - \nonstopmode + \tex_interactionmode:D 0 \scan_stop: % \end{macrocode} % Then we do the splitting of the box to \cs{c_max_dim} to get at % the marks. This may generate the error we are worried about, @@ -1106,7 +1057,8 @@ % % % \begin{macro}{\l_@@_saved_parameters_tl} -% +% The temporary variable used for resetting escape char and +% interaction mode. % \begin{macrocode} \tl_new:N \l_@@_saved_parameters_tl % \end{macrocode} @@ -1124,17 +1076,13 @@ % % \begin{macrocode} \cs_new_protected:Npn \@@_update_structure_from_material:nn #1#2 { - \@@_extract_and_handle_marks:nnn + \@@_extract_and_handle_marks:nn % \end{macrocode} % -% If marks can be extracted we update the structure from the split -% marks (code in \cs{@@_update_structure_from_splitmarks:n}). -% Otherwise, we generate an error message and update it using the -% last mark from the previous region (code in -% \cs{@@_update_structure_when_infinite_glue:n}). -% \begin{macrocode} - { \@@_update_structure_from_splitmarks:n {#1} } - { \@@_update_structure_when_infinite_glue:n {#1} } +% Once the marks can be extracted we update the structure from the +% split marks (code in \cs{@@_update_structure_from_splitmarks:n}). +% \begin{macrocode} + { \@@_update_structure_from_splitmarks:n {#1} } { #2 } } % \end{macrocode} @@ -1223,27 +1171,6 @@ } % \end{macrocode} % \end{macro} - - - - -% \begin{macro}{\@@_update_structure_when_infinite_glue:n} -% If a region contains infinite negative glue we report this as an -% error and then set all marks to the last mark from the previous -% region (as we can't extract any new marks). -% \begin{macrocode} -\cs_new_protected:Npn \@@_update_structure_when_infinite_glue:n #1 { - \msg_error:nnn { mark } { infinite-shrinkage-region } {#1} - \seq_map_inline:Nn \g_@@_classes_seq - { - \tl_gset_eq:cc { g_@@_#1_top_ ##1_tl } - { g_@@_#1_last_ ##1_tl } - \tl_gset_eq:cc { g_@@_#1_first_##1_tl } - { g_@@_#1_last_ ##1_tl } - } -} -% \end{macrocode} -% \end{macro} % % % @@ -1270,20 +1197,19 @@ % The we try to extract all marks, thereby filling the token lists % with suitable \cs{mark_insert:nn} calls. % \begin{macrocode} - \@@_extract_and_handle_marks:nnn + \@@_extract_and_handle_marks:nn % \end{macrocode} % If we can extract them (i.e., if we don't detect negative infinite % glue) then this is done with \cs{@@_get_from_splitmarks:} otherwise % we issue a warning that mark extraction was not possible. % \begin{macrocode} - { \@@_get_from_splitmarks: } - { \msg_warning:nn { mark } { infinite-shrinkage-box } } + \@@_get_from_splitmarks: { #1 } % \end{macrocode} % Finally we copy the updated (or not updated) temporary token lists to % the two that have been supplied when the function was called. % By convention they are local variables and -% \cs{@@_extract_and_handle_marks:nnn} runs in a group, which is +% \cs{@@_extract_and_handle_marks:nn} runs in a group, which is % why we have to use global variables for collecting. % \begin{macrocode} \tl_set_eq:NN #2 \g_@@_first_marks_tl @@ -1616,30 +1542,7 @@ } % \end{macrocode} % -% \begin{macrocode} -\msg_new:nnnn { mark } { infinite-shrinkage-region } - { Infinite~shrinkage~found~in~'#1'~region. } - { - \c__msg_coding_error_text_tl - The~mark~region~'#1'~contains~some~infinite~negative~glue~ - allowing~it~to~shrink~to~an~arbitrarily~small~size.~ - This~makes~it~impossible~to~split~the~region~apart~to~ - get~at~its~marks.~They~are~lost. - } -% \end{macrocode} % -% If some arbitrary box content to be checked for marks contains -% some infinite negative glue, allowing it to shrink to an -% arbitrarily small size, then we can't extract any marks. They -% are lost, but this should not generate an error because in -% certain places, e.g., in some \env{minipage}s, such glue might be -% legitimate. -% \begin{macrocode} -\msg_new:nnn { mark } { infinite-shrinkage-box } - { Infinite~shrinkage~found~in~box~material~--~marks~not~extracted~ - \msg_line_context: - } -% \end{macrocode} % % % diff --git a/base/testfiles/github-0217-io-base.tlg b/base/testfiles/github-0217-io-base.tlg index 0b0338042..ce8a6fa62 100644 --- a/base/testfiles/github-0217-io-base.tlg +++ b/base/testfiles/github-0217-io-base.tlg @@ -6,15 +6,18 @@ Main Class: report (part-one.tex First Included file Chapter 1. -) [1 +) +[1 ] (part3.tex Third Included file Chapter 2. -) [2 +) +[2 ] (part4.tex Fourth Included file Chapter 3. -) [3 +) +[3 ] (github-0217-io-base.aux (part-one.aux) (part-two.aux) (part3.aux) (part4.aux)) diff --git a/base/testfiles/github-0217-io-space.luatex.tlg b/base/testfiles/github-0217-io-space.luatex.tlg index 4ace28b03..af282bc67 100644 --- a/base/testfiles/github-0217-io-space.luatex.tlg +++ b/base/testfiles/github-0217-io-space.luatex.tlg @@ -6,15 +6,18 @@ Main Class: report ("./part one.tex" First Included file Chapter 1. -) [1 +) +[1 ] (part3.tex Third Included file Chapter 3. -) [3 +) +[3 ] (part4.tex Fourth Included file Chapter 4. -) [4 +) +[4 ] diff --git a/base/testfiles/github-0217-io-space.tlg b/base/testfiles/github-0217-io-space.tlg index 648e2411c..f2ffc77e6 100644 --- a/base/testfiles/github-0217-io-space.tlg +++ b/base/testfiles/github-0217-io-space.tlg @@ -6,15 +6,18 @@ Main Class: report (part one.tex First Included file Chapter 1. -) [1 +) +[1 ] (part3.tex Third Included file Chapter 3. -) [3 +) +[3 ] (part4.tex Fourth Included file Chapter 4. -) [4 +) +[4 ] diff --git a/base/testfiles/tl2e8.tlg b/base/testfiles/tl2e8.tlg index aed93a1b9..175a32e54 100644 --- a/base/testfiles/tl2e8.tlg +++ b/base/testfiles/tl2e8.tlg @@ -14,7 +14,10 @@ Type H for immediate help. l. ...\begin{figure}[X] Option `X' ignored and `p' used. [2 -] [3 +] +[3 Figure aaa on page 3 Figure bbb on page 3 -] [4] [5] (tl2e8.aux) +] +[4] +[5] (tl2e8.aux) diff --git a/base/testfiles/tlb-fltrace-005b.luatex.tlg b/base/testfiles/tlb-fltrace-005b.luatex.tlg index 03c37f8b9..4174e6950 100644 --- a/base/testfiles/tlb-fltrace-005b.luatex.tlg +++ b/base/testfiles/tlb-fltrace-005b.luatex.tlg @@ -289,5 +289,6 @@ LaTeX2e: \wd\bx@65534 = 0.0pt l. ...\ShowFloat{65534} % undefined in pdftex [1 -] [2 +] +[2 ] (tlb-fltrace-005b.aux) diff --git a/base/testfiles/tlb-fltrace-005b.tlg b/base/testfiles/tlb-fltrace-005b.tlg index be42f097e..cd5d89ad9 100644 --- a/base/testfiles/tlb-fltrace-005b.tlg +++ b/base/testfiles/tlb-fltrace-005b.tlg @@ -250,5 +250,6 @@ l. ...\ShowFloat{32757} LaTeX2e: ***Float 65534 details: LaTeX2e: Not a float! [1 -] [2 +] +[2 ] (tlb-fltrace-005b.aux) diff --git a/base/testfiles/tlb0577a.luatex.tlg b/base/testfiles/tlb0577a.luatex.tlg index b3252533a..6191279a2 100644 --- a/base/testfiles/tlb0577a.luatex.tlg +++ b/base/testfiles/tlb0577a.luatex.tlg @@ -10,4 +10,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb0577a.aux) diff --git a/base/testfiles/tlb0577a.tlg b/base/testfiles/tlb0577a.tlg index b3252533a..6191279a2 100644 --- a/base/testfiles/tlb0577a.tlg +++ b/base/testfiles/tlb0577a.tlg @@ -10,4 +10,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb0577a.aux) diff --git a/base/testfiles/tlb0878b.luatex.tlg b/base/testfiles/tlb0878b.luatex.tlg index c855f2ea6..52328f8d7 100644 --- a/base/testfiles/tlb0878b.luatex.tlg +++ b/base/testfiles/tlb0878b.luatex.tlg @@ -5,4 +5,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb0878b.aux) diff --git a/base/testfiles/tlb0878b.tlg b/base/testfiles/tlb0878b.tlg index c855f2ea6..52328f8d7 100644 --- a/base/testfiles/tlb0878b.tlg +++ b/base/testfiles/tlb0878b.tlg @@ -5,4 +5,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb0878b.aux) diff --git a/base/testfiles/tlb1379.luatex.tlg b/base/testfiles/tlb1379.luatex.tlg index c392e2eb7..c29aa43bc 100644 --- a/base/testfiles/tlb1379.luatex.tlg +++ b/base/testfiles/tlb1379.luatex.tlg @@ -8,4 +8,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb1379.aux) diff --git a/base/testfiles/tlb1379.tlg b/base/testfiles/tlb1379.tlg index c392e2eb7..c29aa43bc 100644 --- a/base/testfiles/tlb1379.tlg +++ b/base/testfiles/tlb1379.tlg @@ -8,4 +8,5 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[1 ] (tlb1379.aux) diff --git a/base/testfiles/tlb1451.luatex.tlg b/base/testfiles/tlb1451.luatex.tlg index 79c23f29e..1e98337fe 100644 --- a/base/testfiles/tlb1451.luatex.tlg +++ b/base/testfiles/tlb1451.luatex.tlg @@ -298,7 +298,9 @@ Underfull \vbox (badness 2073) has occurred while \output is active ..\OT1/cmr/m/n/10 r ..\glue(\rightskip) 0.0 .\glue -1.94444 -[3] [4] [5] +[3] +[4] +[5] Underfull \vbox (badness 10000) has occurred while \output is active \vbox(58.0+0.0)x345.0, direction TLT .\glue(\topskip) 2.5 @@ -420,4 +422,6 @@ Underfull \vbox (badness 10000) has occurred while \output is active ....\OT1/cmr/m/n/10 ) ..\glue(\tabskip) 0.0 .\glue -2.5 -[6] [7] [8] (tlb1451.aux) +[6] +[7] +[8] (tlb1451.aux) diff --git a/base/testfiles/tlb1451.tlg b/base/testfiles/tlb1451.tlg index 137246fd8..154bd1b2d 100644 --- a/base/testfiles/tlb1451.tlg +++ b/base/testfiles/tlb1451.tlg @@ -257,7 +257,9 @@ Underfull \vbox (badness 2073) has occurred while \output is active ..\OT1/cmr/m/n/10 r ..\glue(\rightskip) 0.0 .\glue -1.94444 -[3] [4] [5] +[3] +[4] +[5] Underfull \vbox (badness 10000) has occurred while \output is active \vbox(58.0+0.0)x345.0 .\glue(\topskip) 2.5 @@ -379,4 +381,6 @@ Underfull \vbox (badness 10000) has occurred while \output is active ....\OT1/cmr/m/n/10 ) ..\glue(\tabskip) 0.0 .\glue -2.5 -[6] [7] [8] (tlb1451.aux) +[6] +[7] +[8] (tlb1451.aux) diff --git a/base/testfiles/tlb1783a.tlg b/base/testfiles/tlb1783a.tlg index 7183567ca..966cca4d9 100644 --- a/base/testfiles/tlb1783a.tlg +++ b/base/testfiles/tlb1783a.tlg @@ -1,10 +1,12 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2 +] +[2 ] (tlb1783a.toc) \tf@toc=\write... -[3] [4 +[3] +[4 ] Chapter 1. [5] (tlb1783a.aux) diff --git a/base/testfiles/tlb1826.luatex.tlg b/base/testfiles/tlb1826.luatex.tlg index f488f0fcb..a60114dfd 100644 --- a/base/testfiles/tlb1826.luatex.tlg +++ b/base/testfiles/tlb1826.luatex.tlg @@ -4,4 +4,5 @@ Author: Marcin Woli\'nski Format: LaTeX2e<1995/06/01> Main Class: article LaTeX Font Info: Trying to load font information for foo+cmtt on input line .... +[1 ] (tlb1826.aux) diff --git a/base/testfiles/tlb1826.tlg b/base/testfiles/tlb1826.tlg index f488f0fcb..a60114dfd 100644 --- a/base/testfiles/tlb1826.tlg +++ b/base/testfiles/tlb1826.tlg @@ -4,4 +4,5 @@ Author: Marcin Woli\'nski Format: LaTeX2e<1995/06/01> Main Class: article LaTeX Font Info: Trying to load font information for foo+cmtt on input line .... +[1 ] (tlb1826.aux) diff --git a/base/testfiles/tlb2400.luatex.tlg b/base/testfiles/tlb2400.luatex.tlg index fd3d5f78d..a3bdac13a 100644 --- a/base/testfiles/tlb2400.luatex.tlg +++ b/base/testfiles/tlb2400.luatex.tlg @@ -14,6 +14,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... [1 -] [2 +] +[2 ] (tlb2400.aux) LaTeX Warning: There were undefined references. diff --git a/base/testfiles/tlb2400.tlg b/base/testfiles/tlb2400.tlg index fd3d5f78d..a3bdac13a 100644 --- a/base/testfiles/tlb2400.tlg +++ b/base/testfiles/tlb2400.tlg @@ -14,6 +14,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... [1 -] [2 +] +[2 ] (tlb2400.aux) LaTeX Warning: There were undefined references. diff --git a/base/testfiles/tlcs01a.luatex.tlg b/base/testfiles/tlcs01a.luatex.tlg index 2557b77e1..b70b24b64 100644 --- a/base/testfiles/tlcs01a.luatex.tlg +++ b/base/testfiles/tlcs01a.luatex.tlg @@ -47,7 +47,8 @@ Table name changed to XTable Figure name changed to XFigure References name changed to XReferences [1 -] [2] +] +[2] Index name changed to XIndex [3 ] diff --git a/base/testfiles/tlcs01a.tlg b/base/testfiles/tlcs01a.tlg index 2557b77e1..b70b24b64 100644 --- a/base/testfiles/tlcs01a.tlg +++ b/base/testfiles/tlcs01a.tlg @@ -47,7 +47,8 @@ Table name changed to XTable Figure name changed to XFigure References name changed to XReferences [1 -] [2] +] +[2] Index name changed to XIndex [3 ] diff --git a/base/testfiles/tlcs01b.luatex.tlg b/base/testfiles/tlcs01b.luatex.tlg index 96a7959a7..7d6eb1af7 100644 --- a/base/testfiles/tlcs01b.luatex.tlg +++ b/base/testfiles/tlcs01b.luatex.tlg @@ -53,7 +53,8 @@ CONTENTS NAME CHANGED TO XCONTENTS [6 ] Part name changed to XPart -[7] [8] +[7] +[8] \global \advance \c@chaptername 1\relax XChapter\typeout {Chapter name changed to XChapter} 1. Chapter name changed to XChapter Table name changed to XTable diff --git a/base/testfiles/tlcs01b.tlg b/base/testfiles/tlcs01b.tlg index 4c26d8f8b..ff0ea0d92 100644 --- a/base/testfiles/tlcs01b.tlg +++ b/base/testfiles/tlcs01b.tlg @@ -53,7 +53,8 @@ CONTENTS NAME CHANGED TO XCONTENTS [6 ] Part name changed to XPart -[7] [8] +[7] +[8] \global \advance \c@chaptername 1\relax XChapter\typeout {Chapter name changed to XChapter} 1. Chapter name changed to XChapter Table name changed to XTable diff --git a/base/testfiles/tlcs01r.luatex.tlg b/base/testfiles/tlcs01r.luatex.tlg index 0435ee8f9..74acdb99e 100644 --- a/base/testfiles/tlcs01r.luatex.tlg +++ b/base/testfiles/tlcs01r.luatex.tlg @@ -57,7 +57,8 @@ Chapter name changed to XChapter Table name changed to XTable Figure name changed to XFigure [1 -] [2] +] +[2] \global \advance \c@appendixname 1\relax XAppendix\typeout {Appendix name changed to XAppendix} A. Appendix name changed to XAppendix [3 diff --git a/base/testfiles/tlcs01r.tlg b/base/testfiles/tlcs01r.tlg index 0435ee8f9..74acdb99e 100644 --- a/base/testfiles/tlcs01r.tlg +++ b/base/testfiles/tlcs01r.tlg @@ -57,7 +57,8 @@ Chapter name changed to XChapter Table name changed to XTable Figure name changed to XFigure [1 -] [2] +] +[2] \global \advance \c@appendixname 1\relax XAppendix\typeout {Appendix name changed to XAppendix} A. Appendix name changed to XAppendix [3 diff --git a/base/testfiles/tlcs02.luatex.tlg b/base/testfiles/tlcs02.luatex.tlg index 4a66b2469..31c506dba 100644 --- a/base/testfiles/tlcs02.luatex.tlg +++ b/base/testfiles/tlcs02.luatex.tlg @@ -12,6 +12,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Underfull \hbox (badness 3503) in paragraph at lines 71--84 \OT1/cmr/m/n/10 Lu-cio Domi-tio Ap-pio Clau-dio con-sulibus diff --git a/base/testfiles/tlcs02.tlg b/base/testfiles/tlcs02.tlg index 2eb83b514..d432040a0 100644 --- a/base/testfiles/tlcs02.tlg +++ b/base/testfiles/tlcs02.tlg @@ -12,6 +12,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Underfull \hbox (badness 3503) in paragraph at lines 71--84 \OT1/cmr/m/n/10 Lucio Domi-tio Ap-pio Clau-dio con-sulibus diff --git a/base/testfiles/tlcs04a.luatex.tlg b/base/testfiles/tlcs04a.luatex.tlg index 6dcd1c7e3..d8c3cfdf9 100644 --- a/base/testfiles/tlcs04a.luatex.tlg +++ b/base/testfiles/tlcs04a.luatex.tlg @@ -16,5 +16,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... -] [1 +[0 +] +[1 ] (tlcs04a.aux) diff --git a/base/testfiles/tlcs04a.tlg b/base/testfiles/tlcs04a.tlg index 6dcd1c7e3..d8c3cfdf9 100644 --- a/base/testfiles/tlcs04a.tlg +++ b/base/testfiles/tlcs04a.tlg @@ -16,5 +16,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... -] [1 +[0 +] +[1 ] (tlcs04a.aux) diff --git a/base/testfiles/tlcs04b.luatex.tlg b/base/testfiles/tlcs04b.luatex.tlg index 645b5e399..8609bcaa2 100644 --- a/base/testfiles/tlcs04b.luatex.tlg +++ b/base/testfiles/tlcs04b.luatex.tlg @@ -16,8 +16,10 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Chapter 1. [1 -] [2 +] +[2 ] (tlcs04b.aux) diff --git a/base/testfiles/tlcs04b.tlg b/base/testfiles/tlcs04b.tlg index 645b5e399..8609bcaa2 100644 --- a/base/testfiles/tlcs04b.tlg +++ b/base/testfiles/tlcs04b.tlg @@ -16,8 +16,10 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Chapter 1. [1 -] [2 +] +[2 ] (tlcs04b.aux) diff --git a/base/testfiles/tlcs04r.luatex.tlg b/base/testfiles/tlcs04r.luatex.tlg index 75b6e625a..2947375d0 100644 --- a/base/testfiles/tlcs04r.luatex.tlg +++ b/base/testfiles/tlcs04r.luatex.tlg @@ -16,6 +16,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Chapter 1. [1 diff --git a/base/testfiles/tlcs04r.tlg b/base/testfiles/tlcs04r.tlg index 75b6e625a..2947375d0 100644 --- a/base/testfiles/tlcs04r.tlg +++ b/base/testfiles/tlcs04r.tlg @@ -16,6 +16,7 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... LaTeX Font Info: Trying to load font information for U+lasy on input line .... +[0 ] Chapter 1. [1 diff --git a/base/testfiles/tlcs06a.tlg b/base/testfiles/tlcs06a.tlg index 6f395eaeb..e22195508 100644 --- a/base/testfiles/tlcs06a.tlg +++ b/base/testfiles/tlcs06a.tlg @@ -5,4 +5,5 @@ Format: LaTeX Version 2.09 <18 March 1992> Main Style: article <14 Jan 92> Style Options: [1 -] [2] (tlcs06a.aux) +] +[2] (tlcs06a.aux) diff --git a/base/testfiles/tlcs06b.tlg b/base/testfiles/tlcs06b.tlg index c5b22fea9..22627352b 100644 --- a/base/testfiles/tlcs06b.tlg +++ b/base/testfiles/tlcs06b.tlg @@ -6,5 +6,8 @@ Main Style: book <14 Jan 92> Style Options: Chapter 1. [1 -] [2 -] [3] [4] (tlcs06b.aux) +] +[2 +] +[3] +[4] (tlcs06b.aux) diff --git a/base/testfiles/tlcs06r.tlg b/base/testfiles/tlcs06r.tlg index 59c40b6e6..157c213f2 100644 --- a/base/testfiles/tlcs06r.tlg +++ b/base/testfiles/tlcs06r.tlg @@ -6,5 +6,7 @@ Main Style: report <14 Jan 92> Style Options: Chapter 1. [1 -] [2 -] [3] (tlcs06r.aux) +] +[2 +] +[3] (tlcs06r.aux) diff --git a/base/testfiles/tltc001.luatex.tlg b/base/testfiles/tltc001.luatex.tlg index ca009df61..6003a8375 100644 --- a/base/testfiles/tltc001.luatex.tlg +++ b/base/testfiles/tltc001.luatex.tlg @@ -750,7 +750,8 @@ If that doesn't work, type X to quit. LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Citation `notfound' on page 5 undefined on input line .... -[5] [6] +[5] +[6] Completed box being shipped out [7] \vbox(357.0+0.0)x408.0, direction TLT .\glue 27.0 diff --git a/base/testfiles/tltc001.tlg b/base/testfiles/tltc001.tlg index 8739908f3..d99a5e931 100644 --- a/base/testfiles/tltc001.tlg +++ b/base/testfiles/tltc001.tlg @@ -616,7 +616,8 @@ If that doesn't work, type X to quit. LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Citation `notfound' on page 5 undefined on input line .... -[5] [6] +[5] +[6] Completed box being shipped out [7] \vbox(357.0+0.0)x408.0 .\glue 27.0 diff --git a/base/testfiles/tltx001.luatex.tlg b/base/testfiles/tltx001.luatex.tlg index f561295ac..fa79ed14f 100644 --- a/base/testfiles/tltx001.luatex.tlg +++ b/base/testfiles/tltx001.luatex.tlg @@ -705,7 +705,8 @@ If that doesn't work, type X to quit. LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Citation `notfound' on page 5 undefined on input line .... -[5] [6] +[5] +[6] Completed box being shipped out [7] \vbox(358.0+0.0)x407.0, direction TLT .\glue 16.0 diff --git a/base/testfiles/tltx001.tlg b/base/testfiles/tltx001.tlg index 4490d6611..16ac541ee 100644 --- a/base/testfiles/tltx001.tlg +++ b/base/testfiles/tltx001.tlg @@ -571,7 +571,8 @@ If that doesn't work, type X to quit. LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Citation `notfound' on page 5 undefined on input line .... -[5] [6] +[5] +[6] Completed box being shipped out [7] \vbox(358.0+0.0)x407.0 .\glue 16.0 diff --git a/base/testfiles/tltx001.xetex.tlg b/base/testfiles/tltx001.xetex.tlg index 20c4cba28..646e9962b 100644 --- a/base/testfiles/tltx001.xetex.tlg +++ b/base/testfiles/tltx001.xetex.tlg @@ -571,7 +571,8 @@ If that doesn't work, type X to quit. LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Reference `notfound' on page 5 undefined on input line .... LaTeX Warning: Citation `notfound' on page 5 undefined on input line .... -[5] [6] +[5] +[6] Completed box being shipped out [7] \vbox(358.0+0.0)x407.0 .\glue 16.0 diff --git a/base/testfiles/tltx004.tlg b/base/testfiles/tltx004.tlg index 9dc451a86..c0c05c858 100644 --- a/base/testfiles/tltx004.tlg +++ b/base/testfiles/tltx004.tlg @@ -80,7 +80,8 @@ Defined \whiledo \isodd {\A } yes: no !! (wrong value) \isodd {\pageref {foo}} - yes: yes [1 + yes: yes +[1 ] \isodd {\pageref {bar}} no : no diff --git a/base/testfiles/tlxs01b.luatex.tlg b/base/testfiles/tlxs01b.luatex.tlg index aa596bc8c..83197ce4e 100644 --- a/base/testfiles/tlxs01b.luatex.tlg +++ b/base/testfiles/tlxs01b.luatex.tlg @@ -41,7 +41,8 @@ CONTENTS NAME CHANGED TO XCONTENTS [6 ] Part name changed to XPart -[7] [8] +[7] +[8] \global \advance \c@chaptername 1\relax XChapter\typeout {Chapter name changed to XChapter} 1. Chapter name changed to XChapter Table name changed to XTable diff --git a/base/testfiles/tlxs01b.tlg b/base/testfiles/tlxs01b.tlg index aa596bc8c..83197ce4e 100644 --- a/base/testfiles/tlxs01b.tlg +++ b/base/testfiles/tlxs01b.tlg @@ -41,7 +41,8 @@ CONTENTS NAME CHANGED TO XCONTENTS [6 ] Part name changed to XPart -[7] [8] +[7] +[8] \global \advance \c@chaptername 1\relax XChapter\typeout {Chapter name changed to XChapter} 1. Chapter name changed to XChapter Table name changed to XTable diff --git a/base/testfiles/tlxs01r.luatex.tlg b/base/testfiles/tlxs01r.luatex.tlg index d6037530e..d7a8168db 100644 --- a/base/testfiles/tlxs01r.luatex.tlg +++ b/base/testfiles/tlxs01r.luatex.tlg @@ -44,7 +44,8 @@ Chapter name changed to XChapter Table name changed to XTable Figure name changed to XFigure [1 -] [2] +] +[2] \global \advance \c@appendixname 1\relax XAppendix\typeout {Appendix name changed to XAppendix} A. Appendix name changed to XAppendix [3 diff --git a/base/testfiles/tlxs01r.tlg b/base/testfiles/tlxs01r.tlg index d6037530e..d7a8168db 100644 --- a/base/testfiles/tlxs01r.tlg +++ b/base/testfiles/tlxs01r.tlg @@ -44,7 +44,8 @@ Chapter name changed to XChapter Table name changed to XTable Figure name changed to XFigure [1 -] [2] +] +[2] \global \advance \c@appendixname 1\relax XAppendix\typeout {Appendix name changed to XAppendix} A. Appendix name changed to XAppendix [3 diff --git a/base/testfiles/tlxs04b.tlg b/base/testfiles/tlxs04b.tlg index dc19411df..c1d585c55 100644 --- a/base/testfiles/tlxs04b.tlg +++ b/base/testfiles/tlxs04b.tlg @@ -15,7 +15,8 @@ LaTeX Font Info: External font `cmex10' loaded for size LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line .... [1 -] [2 +] +[2 ] Chapter 1. [3] (tlxs04b.aux) diff --git a/base/testfiles/tlxs06a.tlg b/base/testfiles/tlxs06a.tlg index 0788f251e..e38a9ba04 100644 --- a/base/testfiles/tlxs06a.tlg +++ b/base/testfiles/tlxs06a.tlg @@ -4,4 +4,5 @@ Author: Chris Martin Format: LaTeX2e<1993/12/24> Main Class: article [1 -] [2] (tlxs06a.aux) +] +[2] (tlxs06a.aux) diff --git a/base/testfiles/tlxs06b.tlg b/base/testfiles/tlxs06b.tlg index 9715b4b6a..98739c03b 100644 --- a/base/testfiles/tlxs06b.tlg +++ b/base/testfiles/tlxs06b.tlg @@ -5,5 +5,8 @@ Format: LaTeX2e<1993/12/24> Main Class: book Chapter 1. [1 -] [2 -] [3] [4] (tlxs06b.aux) +] +[2 +] +[3] +[4] (tlxs06b.aux) diff --git a/base/testfiles/tlxs06r.tlg b/base/testfiles/tlxs06r.tlg index ada6a8b3b..441f8c89c 100644 --- a/base/testfiles/tlxs06r.tlg +++ b/base/testfiles/tlxs06r.tlg @@ -5,5 +5,7 @@ Format: LaTeX2e<1993/12/24> Main Class: report Chapter 1. [1 -] [2 -] [3] (tlxs06r.aux) +] +[2 +] +[3] (tlxs06r.aux) diff --git a/required/firstaid/testfiles/firstaid-pgfmorepages.tlg b/required/firstaid/testfiles/firstaid-pgfmorepages.tlg index 77e1becf7..5e4e81eb8 100644 --- a/required/firstaid/testfiles/firstaid-pgfmorepages.tlg +++ b/required/firstaid/testfiles/firstaid-pgfmorepages.tlg @@ -33,5 +33,6 @@ Package: epstopdf-base ....-..-.. v... Base part for package epstopdf Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line .... (../epstopdf-sys.cfg File: epstopdf-sys.cfg ....-..-.. v... Configuration of (r)epstopdf for TeX Live -)) [1 +)) +[1 ] (firstaid-pgfmorepages.aux) diff --git a/required/graphics/testfiles/braces-compat-01.tlg b/required/graphics/testfiles/braces-compat-01.tlg index 063ac93af..d7482499e 100644 --- a/required/graphics/testfiles/braces-compat-01.tlg +++ b/required/graphics/testfiles/braces-compat-01.tlg @@ -5,7 +5,8 @@ File: foo.bar.eps Graphic file (type eps) File: foo.bar.eps Graphic file (type eps) File: foo.bar.eps Graphic file (type eps) - [1 + +[1 ] (braces-compat-01.aux) *File List* article.cls ....-..-.. v... Standard LaTeX document class From 4fb1442fa5f880f8b5660bf7e571267a8866a9cf Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Wed, 15 Nov 2023 13:05:35 +0100 Subject: [PATCH 13/20] too much removed from the doc --- base/ltmarks.dtx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 970a881d0..21182b2e1 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -937,11 +937,12 @@ % If it wasn't a vbox, it was either an hbox or there was no box. % Given that we are only interested in the marks we don't need put % it back in that case. +% \begin{macrocode} } % \end{macrocode} % We are now ready to \cs{vsplit} the box to get at the marks. If % the box contains some infinite negative glue the \TeX{} will -% produce an error complaining about it, but it will correctly find +% produce an error complaining about it but it will correctly find % the the split marks. Given that we can't prevent that error, we % hide it from the user and ensure that \TeX{} doesn't stop. The % error message still shows in the log, but even that is mitigated From bff9dd70c38956c21f8fd44322e8c120854647a2 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Wed, 15 Nov 2023 14:40:29 +0100 Subject: [PATCH 14/20] and a few more tests ... --- .../testfiles-block/blocks-trivlist-00.luatex.tlg | 3 ++- .../testfiles-block/blocks-trivlist-00.tlg | 3 ++- .../graphic-011-picture.luatex.tlg | 4 +++- .../testfiles-graphic/graphic-011-picture.tlg | 4 +++- required/latex-lab/testfiles-math/mtag-tlc3.tlg | 13 ++++++++++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/required/latex-lab/testfiles-block/blocks-trivlist-00.luatex.tlg b/required/latex-lab/testfiles-block/blocks-trivlist-00.luatex.tlg index 515bdaead..db7a9186d 100644 --- a/required/latex-lab/testfiles-block/blocks-trivlist-00.luatex.tlg +++ b/required/latex-lab/testfiles-block/blocks-trivlist-00.luatex.tlg @@ -85,4 +85,5 @@ Don't change this file in any respect. ==> blockenv common ending on input line ... ==> __kernel_displayblock_end: [1 -] [2] (blocks-trivlist-00.aux) +] +[2] (blocks-trivlist-00.aux) diff --git a/required/latex-lab/testfiles-block/blocks-trivlist-00.tlg b/required/latex-lab/testfiles-block/blocks-trivlist-00.tlg index 515bdaead..db7a9186d 100644 --- a/required/latex-lab/testfiles-block/blocks-trivlist-00.tlg +++ b/required/latex-lab/testfiles-block/blocks-trivlist-00.tlg @@ -85,4 +85,5 @@ Don't change this file in any respect. ==> blockenv common ending on input line ... ==> __kernel_displayblock_end: [1 -] [2] (blocks-trivlist-00.aux) +] +[2] (blocks-trivlist-00.aux) diff --git a/required/latex-lab/testfiles-graphic/graphic-011-picture.luatex.tlg b/required/latex-lab/testfiles-graphic/graphic-011-picture.luatex.tlg index c925994d4..4e4cb5ce7 100644 --- a/required/latex-lab/testfiles-graphic/graphic-011-picture.luatex.tlg +++ b/required/latex-lab/testfiles-graphic/graphic-011-picture.luatex.tlg @@ -4,4 +4,6 @@ tag/graphic debug: BBox of graphics 1 is 149.11082 567.17311 348.36363 666.79951 [1 ] tag/graphic debug: BBox of graphics 2 is 148.71233 537.68369 347.96513 677.16066 -[2] [3] [4] (graphic-011-picture.aux) +[2] +[3] +[4] (graphic-011-picture.aux) diff --git a/required/latex-lab/testfiles-graphic/graphic-011-picture.tlg b/required/latex-lab/testfiles-graphic/graphic-011-picture.tlg index c925994d4..4e4cb5ce7 100644 --- a/required/latex-lab/testfiles-graphic/graphic-011-picture.tlg +++ b/required/latex-lab/testfiles-graphic/graphic-011-picture.tlg @@ -4,4 +4,6 @@ tag/graphic debug: BBox of graphics 1 is 149.11082 567.17311 348.36363 666.79951 [1 ] tag/graphic debug: BBox of graphics 2 is 148.71233 537.68369 347.96513 677.16066 -[2] [3] [4] (graphic-011-picture.aux) +[2] +[3] +[4] (graphic-011-picture.aux) diff --git a/required/latex-lab/testfiles-math/mtag-tlc3.tlg b/required/latex-lab/testfiles-math/mtag-tlc3.tlg index 56e445712..1de6005d9 100644 --- a/required/latex-lab/testfiles-math/mtag-tlc3.tlg +++ b/required/latex-lab/testfiles-math/mtag-tlc3.tlg @@ -533,4 +533,15 @@ Overfull \hbox (9.05542pt too wide) detected at line 434 .\marks4{b+,296,326,Formula,,,} .\mathoff .\glue 0.0 plus 1.0fil -) [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] +) +[7] +[8] +[9] +[10] +[11] +[12] +[13] +[14] +[15] +[16] +[17] From ef861350ed1738ce9648323b162580e6c58df5e5 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Wed, 15 Nov 2023 15:32:14 +0100 Subject: [PATCH 15/20] even more test files --- .../tools/testfiles-TU/github-0352.luatex.tlg | 4 +++- required/tools/testfiles-TU/github-0352.tlg | 4 +++- .../tools/testfiles-search/sx603948.etex.tlg | 13 +++++++++++++ .../testfiles-search/tlb-varioref-006.etex.tlg | 16 ++++++++++++++++ .../testfiles-search/tlb-varioref-007.etex.tlg | 16 ++++++++++++++++ required/tools/testfiles/github-0190.tlg | 3 ++- required/tools/testfiles/github-0682.tlg | 6 ++++-- required/tools/testfiles/tl2e1.tlg | 3 ++- required/tools/testfiles/tlb0549.tlg | 3 ++- required/tools/testfiles/tlb2914.tlg | 3 ++- required/tools/testfiles/tlb3512.tlg | 3 ++- required/tools/testfiles/tlb4488.tlg | 3 ++- required/tools/testfiles/tnfss1.luatex.tlg | 6 ++++-- required/tools/testfiles/tnfss1.tlg | 6 ++++-- 14 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 required/tools/testfiles-search/sx603948.etex.tlg create mode 100644 required/tools/testfiles-search/tlb-varioref-006.etex.tlg create mode 100644 required/tools/testfiles-search/tlb-varioref-007.etex.tlg diff --git a/required/tools/testfiles-TU/github-0352.luatex.tlg b/required/tools/testfiles-TU/github-0352.luatex.tlg index f677394f1..452277c3d 100644 --- a/required/tools/testfiles-TU/github-0352.luatex.tlg +++ b/required/tools/testfiles-TU/github-0352.luatex.tlg @@ -1,7 +1,9 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2] [3] +] +[2] +[3] Completed box being shipped out [4] \vbox(633.0+0.0)x407.0, direction TLT .\glue 16.0 diff --git a/required/tools/testfiles-TU/github-0352.tlg b/required/tools/testfiles-TU/github-0352.tlg index 50682c12b..0880aa321 100644 --- a/required/tools/testfiles-TU/github-0352.tlg +++ b/required/tools/testfiles-TU/github-0352.tlg @@ -1,7 +1,9 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2] [3] +] +[2] +[3] Missing character: There is no ( (U+FF08) in font [lmroman10-regular]:mapping=tex-text;! Missing character: There is no ペ (U+30DA) in font [lmroman10-regular]:mapping=tex-text;! Missing character: There is no ー (U+30FC) in font [lmroman10-regular]:mapping=tex-text;! diff --git a/required/tools/testfiles-search/sx603948.etex.tlg b/required/tools/testfiles-search/sx603948.etex.tlg new file mode 100644 index 000000000..3bb4f0879 --- /dev/null +++ b/required/tools/testfiles-search/sx603948.etex.tlg @@ -0,0 +1,13 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. +No error: +(sx603948-x.tex +LaTeX Warning: Reference `aRef' on page 1 undefined on input line .... +) +[1 +] +LaTeX Warning: Reference `blub' on page 2 undefined on input line .... +LaTeX Warning: Reference `blub' on page 2 undefined on input line .... +[2 +] (sx603948.aux (sx603948-x.aux)) +LaTeX Warning: There were undefined references. diff --git a/required/tools/testfiles-search/tlb-varioref-006.etex.tlg b/required/tools/testfiles-search/tlb-varioref-006.etex.tlg new file mode 100644 index 000000000..28e960b65 --- /dev/null +++ b/required/tools/testfiles-search/tlb-varioref-006.etex.tlg @@ -0,0 +1,16 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. +A away from C +B near C +C near C +D near C +E away from C +LaTeX Warning: Reference `undef' on page 1 undefined on input line .... +undef away from C +[1 +] +[2] +[3] +[4] +[5] (tlb-varioref-006.aux) +LaTeX Warning: There were undefined references. diff --git a/required/tools/testfiles-search/tlb-varioref-007.etex.tlg b/required/tools/testfiles-search/tlb-varioref-007.etex.tlg new file mode 100644 index 000000000..42d175ba2 --- /dev/null +++ b/required/tools/testfiles-search/tlb-varioref-007.etex.tlg @@ -0,0 +1,16 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. +[1 +] +[2] +A away from current (\pageref {A} <> 3 approx) +B near current point (\pageref {B} <> 3 approx) +C near current point (\pageref {C} <> 3 approx) +D near current point (\pageref {D} <> 3 approx) +E away from current (\pageref {E} <> 3 approx) +LaTeX Warning: Reference `undef' on page 3 undefined on input line .... +undef away from current (\pageref {undef} <> 3 approx) +[3] +[4] +[5] (tlb-varioref-007.aux) +LaTeX Warning: There were undefined references. diff --git a/required/tools/testfiles/github-0190.tlg b/required/tools/testfiles/github-0190.tlg index 5ace59779..7db254e20 100644 --- a/required/tools/testfiles/github-0190.tlg +++ b/required/tools/testfiles/github-0190.tlg @@ -4,4 +4,5 @@ Box Height=34.0pt [1 ] Box Height=34.0pt -[2] [3] [4] [5] (github-0190.aux) +[2] [3] [4] +[5] (github-0190.aux) diff --git a/required/tools/testfiles/github-0682.tlg b/required/tools/testfiles/github-0682.tlg index 1846822bc..5421ca7c6 100644 --- a/required/tools/testfiles/github-0682.tlg +++ b/required/tools/testfiles/github-0682.tlg @@ -2,7 +2,8 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. 1: 454.0pt [1 -] [2] +] +[2] 2: 0.0pt [3] 3: 70.0pt @@ -10,7 +11,8 @@ Don't change this file in any respect. 4: 82.0pt [6] [7] 5: 82.0pt -[8] [9] +[8] +[9] 1: 0.0pt [10] 2: 82.0pt diff --git a/required/tools/testfiles/tl2e1.tlg b/required/tools/testfiles/tl2e1.tlg index a41f1d1ec..ff835e3f9 100644 --- a/required/tools/testfiles/tl2e1.tlg +++ b/required/tools/testfiles/tl2e1.tlg @@ -561,4 +561,5 @@ Underfull \hbox (badness 1406) in paragraph at lines 893--895 .\OT1/cmss/m/n/10 l .\OT1/cmss/m/n/10 d .\glue(\rightskip) 0.0 -[8] [9] (tl2e1.aux) +[8] +[9] (tl2e1.aux) diff --git a/required/tools/testfiles/tlb0549.tlg b/required/tools/testfiles/tlb0549.tlg index fde945230..6ccca1959 100644 --- a/required/tools/testfiles/tlb0549.tlg +++ b/required/tools/testfiles/tlb0549.tlg @@ -4,4 +4,5 @@ Author: Patrick Daly Format: LaTeX2e<1994/06/01> Main Class: article [1 -] [2] (tlb0549.aux) +] +[2] (tlb0549.aux) diff --git a/required/tools/testfiles/tlb2914.tlg b/required/tools/testfiles/tlb2914.tlg index c0b82b277..91b2d5ee2 100644 --- a/required/tools/testfiles/tlb2914.tlg +++ b/required/tools/testfiles/tlb2914.tlg @@ -1,4 +1,5 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2] (tlb2914.aux) +] +[2] (tlb2914.aux) diff --git a/required/tools/testfiles/tlb3512.tlg b/required/tools/testfiles/tlb3512.tlg index 4b5339d2a..c76ed1af2 100644 --- a/required/tools/testfiles/tlb3512.tlg +++ b/required/tools/testfiles/tlb3512.tlg @@ -1,4 +1,5 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2] (tlb3512.aux) +] +[2] (tlb3512.aux) diff --git a/required/tools/testfiles/tlb4488.tlg b/required/tools/testfiles/tlb4488.tlg index b6f6eba72..584a20e25 100644 --- a/required/tools/testfiles/tlb4488.tlg +++ b/required/tools/testfiles/tlb4488.tlg @@ -6,4 +6,5 @@ LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line .... There shouldn't be under/overfull boxes in the result [1 -] [2] (tlb4488.aux) +] +[2] (tlb4488.aux) diff --git a/required/tools/testfiles/tnfss1.luatex.tlg b/required/tools/testfiles/tnfss1.luatex.tlg index 883416448..e7ba2babb 100644 --- a/required/tools/testfiles/tnfss1.luatex.tlg +++ b/required/tools/testfiles/tnfss1.luatex.tlg @@ -201,7 +201,8 @@ LaTeX Font Info: External font `lasy5 at5.0pt' loaded as LaTeX Font Info: External font `tcrm1000 at10.0pt' loaded as (Font) TS1/cmr/m/n/10 on input line .... [1 -] [2] [3] +] +[2] [3] LaTeX Font Info: External font `cmbxti10 at12.0pt' loaded as (Font) OT1/cmr/bx/it/12 on input line .... Overfull \hbox (1.99799pt too wide) in paragraph at lines 435--435 @@ -627,4 +628,5 @@ Underfull \hbox (badness 1406) in paragraph at lines 887--889 .\OT1/cmss/m/n/10 l .\OT1/cmss/m/n/10 d .\glue(\rightskip) 0.0 -[8] [9] (tnfss1.aux) +[8] +[9] (tnfss1.aux) diff --git a/required/tools/testfiles/tnfss1.tlg b/required/tools/testfiles/tnfss1.tlg index ae88c42c5..183b27634 100644 --- a/required/tools/testfiles/tnfss1.tlg +++ b/required/tools/testfiles/tnfss1.tlg @@ -201,7 +201,8 @@ LaTeX Font Info: External font `lasy5 at5.0pt' loaded as LaTeX Font Info: External font `tcrm1000 at10.0pt' loaded as (Font) TS1/cmr/m/n/10 on input line .... [1 -] [2] [3] +] +[2] [3] LaTeX Font Info: External font `cmbxti10 at12.0pt' loaded as (Font) OT1/cmr/bx/it/12 on input line .... Overfull \hbox (1.99799pt too wide) in paragraph at lines 435--435 @@ -666,4 +667,5 @@ Underfull \hbox (badness 1406) in paragraph at lines 887--889 .\OT1/cmss/m/n/10 l .\OT1/cmss/m/n/10 d .\glue(\rightskip) 0.0 -[8] [9] (tnfss1.aux) +[8] +[9] (tnfss1.aux) From cf3cbff1f863ea8b7b4966062f6f92504827be7b Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Wed, 15 Nov 2023 17:02:21 +0100 Subject: [PATCH 16/20] added ltnews entry --- base/doc/ltnews39.tex | 70 ++++++++++++++++++++++++--- base/ltmarks.dtx | 8 +-- base/testfiles-ltmarks/xmarks-009.tlg | 8 +-- 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/base/doc/ltnews39.tex b/base/doc/ltnews39.tex index 3002928c1..8bb3ecb38 100644 --- a/base/doc/ltnews39.tex +++ b/base/doc/ltnews39.tex @@ -145,6 +145,60 @@ \section{Introduction} +\section{Enhancements to the new mark mechanism} + +In June 2022 we introduced a new mark mechanism in +\LaTeX{}~\cite[p.~76]{39:ltnews} that allows keeping track of multiple +independent marks. It also properly supports top marks, something that wasn't +reliably possible with \LaTeX{} before. + +There was, however, one limitation: to retrieve the marks from the +page data it was necessary to \cs{vsplit} that data artificially so +that \TeX{} would produce split marks that the mechanism could then +use. Unfortunately, \TeX{} gets very upset if it finds infinite +negative glue (e.g., from \cs{vss}) within this data. This is not +totally surprising because such glue would allow to split off any +amount of material as such glue would hide the size of it. \TeX{} +therefore responds with an error message if it find such glue while +doing a \cs{vsplit} operation (and it does so even if a later glue +item cancels the infinite glue). + +To account for this, the code in 2022 attempted to detect this +situation beforehand and if so did not do any splitting but, of +course, it would then also not extract any mark information. + +In this release the approach has been changed and we always do a +\cs{vsplit} operation and thus always get the right mark data +extracted. While it is not possible to avoid upsetting \TeX{} in case +we have infinite negative glue present, it is possible to hide this +(more or less) from the user.\footnote{A note to \pkg{l3build} users +that make use of its testing capabilities: the new mechanism +temporarily changes \cs{interactionmode} and, for implementation +reasons in \TeX{}, that results in extra newlines in the \texttt{.log} +file, so instead of seeing \texttt{[1] [2]} you will see each on +separate lines. This means that test files might show difference of +that nature, once the code is active, and must therefore be +regenerated as necessary.} With the new code \TeX{} will neither stop +nor show anything on the terminal. What we can't do, though, is to +avoid that an error is written to the log file, but to make it clear +that this error is harmless and should be ignored we have arranged the +code so that the error message, if it is issued, takes the following +format: +\begin{verbatim} +! Infinite glue shrinkage found in box being split. + Infinite shrink error above ignored ! +l. ... } +\end{verbatim} +Not perfect (especially the somewhat unmotivated \texttt{}), +but you can only do so much if error messages and their texts are +hard-wired in the engine. + +So why all this? There are two reasons: we do not loose marks in edge +cases any longer and perhaps more importantly we are now also reliably +able to extract marks from arbitrarily boxed data, something that +wasn't possible at all before. This is, for example, necessary to +support extended marks in \env{multicols} environments or extract them +from floats, marginpars, etc. \section{New or improved commands} @@ -209,19 +263,19 @@ \subsection{\pkg{verbatim}: \cs{verb} showed visible spaces} \githubissue{1160} -\subsection{\pkg{multicol}: \cs{columnbreak} interfers with mark mechanism} +\subsection{\pkg{multicol}: \cs{columnbreak} interferes with mark mechanism} The \pkg{multicol} package has to keep track of marks (from \cs{markright} or \cs{markboth}) as part of its output routine code and can't rely on \LaTeX{} handling that automatically. It does so by -artifically splitting page data with \cs{vsplit} to extract the mark +artificially splitting page data with \cs{vsplit} to extract the mark data. With the introduction of \cs{columnbreak} that code failed sometimes, because it was not seeing any mark that followed such a forced column break. This has now been corrected, but there is further work to do, because -as of now \pkg{multicol} does not handle marks using the new mark -mechanism at all. +as of now \pkg{multicol} does not yet handle marks using the new mark +mechanism\Dash see the discussion at the beginning of the newsletter. % \githubissue{1130} @@ -253,10 +307,10 @@ \subsection{Correct definition of \cs{k}} %\newblock ISBN 0-201-52983-1. %\newblock Reprinted with corrections in 1996. % -% -%\bibitem{39:ltnews} \LaTeX{} Project Team. -% \emph{\LaTeXe{} news 1--39}.\\ -% \url{https://latex-project.org/news/latex2e-news/ltnews.pdf} + +\bibitem{39:ltnews} \LaTeX{} Project Team. + \emph{\LaTeXe{} news 1--39}.\\ + \url{https://latex-project.org/news/latex2e-news/ltnews.pdf} % %\bibitem{39:blueprint} Frank Mittelbach and Chris Rowley. % \emph{\LaTeX{} Tagged PDF \Dash A blueprint for a large project}.\\ diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 21182b2e1..d41104dee 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -993,13 +993,13 @@ % you get is something like %\begin{verbatim} % ! Infinite glue shrinkage found in box being split. -% Glue shrinkage error above ignored ! +% Infinite shrink error above ignored ! % l. ... } %\end{verbatim} % which hopefully makes it clear that the error is harmless and % and should be ignored by the reader of the \texttt{.log}. % \begin{macrocode} -\cs_set_eq:cN {Glue~shrinkage~error~above~ignored~!}\c_max_dim +\cs_set_eq:cN {Infinite~shrink~error~above~ignored~!}\c_max_dim % \end{macrocode} % % The whole definition of \cs{@@_vbox_set_split_to_maxdimen:NN} @@ -1020,7 +1020,7 @@ % \end{macrocode} % Then we change them so that no escape char is printed in the % error message (accounts for the missing backslash in front of -% \verb/Glue shrinkage .../) and we set the interaction to +% \verb/Infinite shrink .../) and we set the interaction to % \cs{nonstopmode} so that the the error (if any) just goes into % the \texttt{.log} file and \TeX{} doesn't stop at that point. % \begin{macrocode} @@ -1044,7 +1044,7 @@ \exp_not:N \use:n { % \use:c{~Ignore~infinite~glue~shrinkage~error} % \use:c{Glue~shrinkage~error~is~harmless~!} - \use:c{Glue~shrinkage~error~above~ignored~!} + \use:c{Infinite~shrink~error~above~ignored~!} } % \end{macrocode} % Finally, we change the escape char and the interaction mode back diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index 71a9556db..f9733a899 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -72,7 +72,7 @@ Marks: set 2e-right <- 'F' on line ... Marks: set 2e-right-nonempty <- 'F' on line ... Marks: mark extraction needs recursion on line ... ! Infinite glue shrinkage found in box being split. - Glue shrinkage error above ignored ! + Infinite shrink error above ignored ! l. ... } The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. @@ -113,14 +113,14 @@ Marks: set 2e-right-nonempty <- 'H' on line ... Marks: set 2e-right <- 'I' on line ... Marks: set 2e-right-nonempty <- 'I' on line ... ! Infinite glue shrinkage found in box being split. - Glue shrinkage error above ignored ! + Infinite shrink error above ignored ! l. ... } The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. Such glue doesn't belong there; but you can safely proceed, since the offensive shrinkability has been made finite. ! Infinite glue shrinkage found in box being split. - Glue shrinkage error above ignored ! + Infinite shrink error above ignored ! l. ... } The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. @@ -189,7 +189,7 @@ Marks: set 2e-right <- 'A3' on line ... Marks: set 2e-right-nonempty <- 'A3' on line ... Marks: mark extraction needs recursion on line ... ! Infinite glue shrinkage found in box being split. - Glue shrinkage error above ignored ! + Infinite shrink error above ignored ! l. ... \l_last_marks_tl The box you are \vsplitting contains some infinitely shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. From 7d8f90f907b7c011eb7cc854003433b70efc1ac2 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Wed, 15 Nov 2023 16:56:07 +0000 Subject: [PATCH 17/20] minor wording adjustments --- base/doc/ltnews39.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/doc/ltnews39.tex b/base/doc/ltnews39.tex index 8bb3ecb38..c64d44216 100644 --- a/base/doc/ltnews39.tex +++ b/base/doc/ltnews39.tex @@ -157,7 +157,7 @@ \section{Enhancements to the new mark mechanism} that \TeX{} would produce split marks that the mechanism could then use. Unfortunately, \TeX{} gets very upset if it finds infinite negative glue (e.g., from \cs{vss}) within this data. This is not -totally surprising because such glue would allow to split off any +totally surprising because such glue would allow splitting off any amount of material as such glue would hide the size of it. \TeX{} therefore responds with an error message if it find such glue while doing a \cs{vsplit} operation (and it does so even if a later glue @@ -193,7 +193,7 @@ \section{Enhancements to the new mark mechanism} but you can only do so much if error messages and their texts are hard-wired in the engine. -So why all this? There are two reasons: we do not loose marks in edge +So why all this? There are two reasons: we do not lose marks in edge cases any longer and perhaps more importantly we are now also reliably able to extract marks from arbitrarily boxed data, something that wasn't possible at all before. This is, for example, necessary to From 0d35a5f5cb11b9c8305537cf9db779f271be299d Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Thu, 16 Nov 2023 00:02:27 +0100 Subject: [PATCH 18/20] a bit more docu cleanup --- base/doc/ltnews39.tex | 6 + base/ltmarks.dtx | 211 ++++++++++++++------------ base/testfiles-ltmarks/xmarks-009.lvt | 43 ++++++ base/testfiles-ltmarks/xmarks-009.tlg | 43 ++++++ 4 files changed, 208 insertions(+), 95 deletions(-) diff --git a/base/doc/ltnews39.tex b/base/doc/ltnews39.tex index c64d44216..a49691e35 100644 --- a/base/doc/ltnews39.tex +++ b/base/doc/ltnews39.tex @@ -144,6 +144,8 @@ \section{Introduction} +\emph{to write} + \section{Enhancements to the new mark mechanism} @@ -200,6 +202,10 @@ \section{Enhancements to the new mark mechanism} support extended marks in \env{multicols} environments or extract them from floats, marginpars, etc. +Details about the implementation can be found in \texttt{texdoc + ltmarks-code} or in the shorter \texttt{texdoc ltmarks-doc} (which +only describes the general concepts and the command interfaces). + \section{New or improved commands} diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index d41104dee..25172af74 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -16,7 +16,7 @@ % % \begin{macrocode} \def\ltmarksversion{v1.0e} -\def\ltmarksdate{2023/11/15} +\def\ltmarksdate{2023/11/16} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -299,6 +299,8 @@ % \emph{true}; if a declared and an undeclared mark class is used % it is always \emph{false}.} % +% \subsection{Use cases for conditionals} +% % However, the basic version is enough for the following typical use cases: % \begin{description} % \item[Test for at most one mark of class \texttt{myclass} on current @@ -661,25 +663,32 @@ % \end{function} % % -% \begin{function}{@@_get_marks_for_reinsertion:nNN} +% \begin{function}{\@@_get_marks_for_reinsertion:nNN} % \begin{syntax} % \cs{@@_get_marks_for_reinsertion:nNN} \Arg{source} -% \Arg{token-list-var for collecting first marks} -% \Arg{token-list-var for collecting last marks} +% \qquad \meta{token-list-var for collecting first marks} +% \qquad \meta{token-list-var for collecting last marks} % \end{syntax} % Helper function for extracting marks that would otherwise get % lost, for example when they are hidden inside a box. This helper % does not update mark structures and can therefore be used outside % the output routine as well. % -% It collect all the marks from inside the \meta{source} and adds suitable -% \cs{mark_insert:nn} in the two token lists. These token lists can -% then be executed at the right place to reinsert the marks, e.g., -% directly after the box. This is, for example, used by -% \pkg{multicol} when a short balanced \env{multicols} is returned -% to the galley for typesetting. -% -% It is quite likely that one only needs a single token list for +% It collect all the top-level marks from inside the \meta{source} +% and adds suitable \cs{mark_insert:nn} in the two token +% lists. These token lists can then be executed at the right place +% to reinsert the marks, e.g., directly after the box. This is, for +% example, used by \pkg{multicol} when a short balanced +% \env{multicols} is returned to the galley for typesetting. +% +% If the \meta{source} consists of a single vertical box (plus +% possibly followed by some glue but nothing else) then the box is +% unpacked and the top-level marks are collected from its +% content. However, if it is not a vertical box or there are are +% other data then nothing is unpacked and you have to do the +% unpacking yourself to get at the marks inside. +% +% It is quite likely that one only needs a single token list for % returning the \cs{mark_insert:nn} statements. If that is the case % this command may change to take only two arguments. % \end{function} @@ -726,12 +735,13 @@ % % % \begin{macro}{\mark_new_class:n,\@@_new_class:nn} +% % A mark class is created by initializing a number of data -% structures. First, we get a register number to refer to the mark class. -% The new mark class is then added to the \cs{g_@@_classes_seq} -% sequence to be able to easily loop over all classes. Finally a -% number of top-level global token lists are declared that hold -% various versions of the mark for access. +% structures. First, we get a register number to refer to the mark +% class. The new mark class is then added to the +% \cs{g_@@_classes_seq} sequence to be able to easily loop over all +% classes. Finally a number of top-level global token lists are +% declared that hold various versions of the mark for access. % \begin{macrocode} \cs_new_protected:Npn \mark_new_class:n #1 { @@ -833,20 +843,22 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_extract_and_handle_marks:nn #1#2 { % \end{macrocode} -% This macro expects a region name as its third argument and -% vertical material (not boxed) as its fourth. It attempts to -% extract mark information from \verb/#3/ and, if it succeeds, it then -% executes \verb/#1/ to do something with the marks, e.g., to -% update the mark structure for the region. +% This macro expects code to handle extracted marks in its first argument and +% vertical material (not boxed or just consisting of a single +% vertical box) as its second. It +% extracts top-level mark information from \verb/#2/, stores them +% as split marks and then calls +% \verb/#1/ to make use of this information. % -% If it finds infinite negative glue it generates an error message -% and then calls \verb/#2/ to handle anything special in that -% case. -% % If it finds a forced break in the material it removes it and then % restarts the attempt without it. % -% Getting the first and last marks out of the material in \verb=#4= +% We start with a group to keep most changes local. +% \begin{macrocode} + \group_begin: +% \end{macrocode} +% +% Getting the first and last marks out of the material in \verb=#2= % is done by putting the material in a box and then doing a split % operation to the maximum size possible (which hopefully gets us % all of the content).\footnote{With normal column material cut @@ -857,21 +869,22 @@ % handle.} Because this action is used only to get the mark % values, we don't want any underfull box warnings so we (locally) % turn those off. +% % \begin{macrocode} - \group_begin: \dim_set_eq:NN \tex_splitmaxdepth:D \c_max_dim \int_set_eq:NN \tex_vbadness:D \c_max_int \dim_set_eq:NN \tex_vfuzz:D \c_max_dim % \end{macrocode} -% There is a further complication: if the region contains infinite +% +% There is a further complication: if the material contains infinite % shrinking glue then a \tn{vsplit} operation will balk with a -% low-level error. Now pages or columns, which are our main concern here, can't -% have such infinite shrinkage if they are cut straight from the -% galley, however the use of \tn{enlargethispage} actually does add -% some at the very bottom (and also wraps the whole page into a box -% by itself, so if we leave it this way then a) we get this error -% and b) we don't see any marks because they are hidden one level -% down). +% low-level error. Now pages or columns, which are our main concern +% here, can't have such infinite shrinkage if they are cut straight +% from the galley, however the use of \tn{enlargethispage} actually +% does add some at the very bottom (and also wraps the whole page +% into a box by itself, so if we leave it this way then a) we get +% this error and b) we don't see any marks because they are hidden +% one level down). % % Another possible issue are packages or user code that place stray % \tn{vbox}es directly into the main galley (an example is @@ -895,50 +908,51 @@ % \end{macro} % % -% \begin{macro}{@@_prepare_and_extract:nn} +% \begin{macro}{\@@_prepare_and_extract:nn} % +% This macro does the dirty work. It is not directly integrated in +% \cs{@@_extract_and_handle_marks:nn} because we may have to call +% it recursively if we find forced breaks. % \begin{macrocode} \cs_new_protected:Npn \@@_prepare_and_extract:nn #1#2 { % \end{macrocode} % % To handle the \cs{enlargethispage} case we do an \tn{unskip} to -% get rid of any glue that is present at the end of the material +% get rid of any glue that is present at the very end of the material % and also check if we have then a \tn{vbox} as the last item and % if so unpack that too, but only under certain conditions, see % below. All this is temporary done in a group, just for getting % the marks out, so it doesn't affect the final page production. % % \begin{macrocode} - \vbox_set:Nn \l_@@_box - { - #2 - \tex_unskip:D - \box_set_to_last:N \l_@@_box + \vbox_set:Nn \l_@@_box + { + #2 + \tex_unskip:D + \box_set_to_last:N \l_@@_box % \end{macrocode} % After having removed the last box from the current list (if there -% was one) we check whether the vertical list is now empty. If not, then the last -% box is definitely not the one from \tn{enlargethispage} and so we -% can, and should, leave it alone. Otherwise we check if this last -% box is a \tn{vbox}. +% was one) we check whether the vertical list is now empty. If not, +% then the last box is definitely not the one from +% \tn{enlargethispage} and so we can, and should, leave it +% alone. Otherwise we check if this last box is a \tn{vbox}. % \changes{v1.0d}{2022/06/01}{Extend the logic for detecting the marks % in the box (gh/836)} % \begin{macrocode} - \int_compare:nNnT \tex_lastnodetype:D < 0 - { - \box_if_vertical:NT \l_@@_box - { + \int_compare:nNnT \tex_lastnodetype:D < 0 + { + \box_if_vertical:NT \l_@@_box % \end{macrocode} % If it is, we unpack the box. % \begin{macrocode} - \vbox_unpack:N \l_@@_box - } - } + { \vbox_unpack:N \l_@@_box } + } % \end{macrocode} % If it wasn't a vbox, it was either an hbox or there was no box. % Given that we are only interested in the marks we don't need put % it back in that case. % \begin{macrocode} - } + } % \end{macrocode} % We are now ready to \cs{vsplit} the box to get at the marks. If % the box contains some infinite negative glue the \TeX{} will @@ -949,29 +963,29 @@ % as best as possible---see the definition of % \cs{@@_vbox_set_split_to_maxdimen:NN} for the tricks employed. % \begin{macrocode} - \@@_vbox_set_split_to_maxdimen:NN \l_@@_ii_box \l_@@_box + \@@_vbox_set_split_to_maxdimen:NN \l_@@_ii_box \l_@@_box % \end{macrocode} % After splitting we check if there is anything left in % \cs{l_@@_box}. If not then the above split has set some split marks % that we can then use to finish the extraction: % \begin{macrocode} - \box_if_empty:NTF \l_@@_box - { #1 } + \box_if_empty:NTF \l_@@_box + { #1 } % \end{macrocode} % If we have a remainder after the split then this means that there % was some forced break in the material. We get rid of that by % combining the content of the two boxes and restart. % \begin{macrocode} - { + { %<*trace> - \@@_debug:n { \iow_term:x - { Marks:~ mark~ extraction~needs~ recursion~ - \msg_line_context: } } + \@@_debug:n { \iow_term:x + { Marks:~ mark~ extraction~needs~ recursion~ + \msg_line_context: } } % - \@@_prepare_and_extract:nn {#1} - { \vbox_unpack:N \l_@@_ii_box - \vbox_unpack:N \l_@@_box } - } + \@@_prepare_and_extract:nn {#1} + { \vbox_unpack:N \l_@@_ii_box + \vbox_unpack:N \l_@@_box } + } } % \end{macrocode} % \end{macro} @@ -1004,7 +1018,7 @@ % % The whole definition of \cs{@@_vbox_set_split_to_maxdimen:NN} % below is fully expanded, so we have to use a lot of -% \cs{exp_not:N}s to prevent expansion where necessary. +% \cs{exp_not:N} commands to prevent expansion where necessary. % \begin{macrocode} \cs_new_protected:Npx \@@_vbox_set_split_to_maxdimen:NN #1#2 { % \end{macrocode} @@ -1042,8 +1056,6 @@ % (try it). % \begin{macrocode} \exp_not:N \use:n { -% \use:c{~Ignore~infinite~glue~shrinkage~error} -% \use:c{Glue~shrinkage~error~is~harmless~!} \use:c{Infinite~shrink~error~above~ignored~!} } % \end{macrocode} @@ -1092,14 +1104,13 @@ % % % \begin{macro}{\@@_update_structure_from_splitmarks:n} -% This macro is called when it is possible to \cs{vsplit} the -% material to extract the marks (or at least if we think it is -% possible, see notes). +% This macro is called after we have done a \cs{tex_vsplit:D} +% operation and the mark data is in the split marks. % \begin{macrocode} \cs_new_protected:Npn \@@_update_structure_from_splitmarks:n #1 { % \end{macrocode} % -% The first thing we do is to copy the current structure to +% The first thing we do is to copy the current region structure to % \texttt{previous-...}; this leaves the current structure % untouched so we can update it class by class (which is necessary). % \begin{macrocode} @@ -1139,7 +1150,7 @@ % not be confused with no mark at all. But no mark in our material % will result in \cs{g_@@_tmp_tl} being fully empty. This is why we % have to make sure that \enquote{empty} from \cs{mark_insert:nn} only -% appears to be empty but fails the next test (see below how this +% appears to be empty when typeset but fails the next test (see below how this % is done). % \begin{macrocode} \tl_if_empty:NTF \g_@@_tmp_tl @@ -1184,7 +1195,7 @@ % executing the token lists.\footnote{It is probably enough to % collect everything in a single token list as long as we put the % first marks first and the last marks last). But for extra -% flexibility, I currently use 2 tls. This might change when it is +% flexibility, I currently use 2 token lists. This might change when it is % really clear that this is never needed.} % % \begin{macrocode} @@ -1195,23 +1206,24 @@ \tl_clear:N \g_@@_first_marks_tl \tl_clear:N \g_@@_last_marks_tl % \end{macrocode} -% The we try to extract all marks, thereby filling the token lists +% Then we extract all top-level marks, thereby filling the token lists % with suitable \cs{mark_insert:nn} calls. % \begin{macrocode} \@@_extract_and_handle_marks:nn % \end{macrocode} -% If we can extract them (i.e., if we don't detect negative infinite -% glue) then this is done with \cs{@@_get_from_splitmarks:} otherwise -% we issue a warning that mark extraction was not possible. +% The first argument holds the code for fill the token lists and +% the second is the material we extract from. % \begin{macrocode} \@@_get_from_splitmarks: { #1 } % \end{macrocode} -% Finally we copy the updated (or not updated) temporary token lists to -% the two that have been supplied when the function was called. -% By convention they are local variables and -% \cs{@@_extract_and_handle_marks:nn} runs in a group, which is -% why we have to use global variables for collecting. +% +% Finally, we copy the updated (or not updated) temporary token +% lists to the two that have been supplied when the function was +% called. By convention \enquote{get} operations return their +% values in local variables and \cs{@@_extract_and_handle_marks:nn} +% runs in a group, which is why we have to use global temporary +% variables for collecting. % \begin{macrocode} \tl_set_eq:NN #2 \g_@@_first_marks_tl \tl_set_eq:NN #3 \g_@@_last_marks_tl @@ -1503,7 +1515,7 @@ % % \subsection{Messages} % -% Mark errors are LaTeX kernel errors: +% Mark errors are \LaTeX{} kernel errors: % \changes{v1.0d}{2022/06/01}{Marks are kernel errors} % \begin{macrocode} \prop_gput:Nnn \g_msg_module_type_prop { mark } { LaTeX } @@ -1667,10 +1679,7 @@ % \begin{macrocode} \cs_new_protected:Npn \ShowMarksAt #1 { %<*trace> - \@@_debug:n - { - \@@_status:n{#1} - } + \@@_debug:n { \@@_status:n {#1} } % } % \end{macrocode} @@ -1730,9 +1739,9 @@ % % % -% \section{\LaTeXe{} integration} +% \section{\LaTeXe{} integration} % -% \subsection{Core \LaTeXe{} integration} +% \subsection{Core \LaTeXe{} integration} % % \begin{macro}{\@@_update_singlecol_structures:} % This command updates the mark structures if we are producing a @@ -1888,17 +1897,26 @@ %<@@=> % \end{macrocode} % -% \begin{macro}[int]{\@expl@@@mark@update@singlecol@structures@@, -% \@expl@@@mark@update@dblcol@structures@@} +% \begin{macro}[int]{\@expl@@@mark@update@singlecol@structures@@} % \begin{macrocode} \cs_new_eq:NN \@expl@@@mark@update@singlecol@structures@@ \__mark_update_singlecol_structures: +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}[int]{\@expl@@@mark@update@dblcol@structures@@} +% \begin{macrocode} \cs_new_eq:NN \@expl@@@mark@update@dblcol@structures@@ \__mark_update_dblcol_structures: % \end{macrocode} % \end{macro} % -% \subsection{Other \LaTeXe{} output routines} +% +% +% +% \subsection{Other \LaTeXe{} output routines} % % This section will cover \pkg{multicol} and other packages altering % or providing their own output routine. Not done yet. @@ -1906,6 +1924,9 @@ % % % +% \subsection{Rollback information} +% +% % \begin{macrocode} %\IncludeInRelease{0000/00/00}{ltmarks}% % {Undo~Marks~handling} @@ -1914,7 +1935,7 @@ % We keep the interface commands around even if we roll back in % case they are used in packages that don't roll back. Not likely % to do a lot of good, but then there is not much we can do, but -% this at least then doesn't give errors. +% this at least they won't give unknown csname errors. % \begin{macrocode} %\DeclareRobustCommand \NewMarkClass[1]{} %\DeclareRobustCommand \InsertMark[2]{} diff --git a/base/testfiles-ltmarks/xmarks-009.lvt b/base/testfiles-ltmarks/xmarks-009.lvt index 717e7ffd0..c41524bec 100644 --- a/base/testfiles-ltmarks/xmarks-009.lvt +++ b/base/testfiles-ltmarks/xmarks-009.lvt @@ -91,6 +91,49 @@ \l_last_marks_tl +\tl_show:N \l_first_marks_tl +\tl_show:N \l_last_marks_tl + + +\typeout{------------~ vbox~ test~ ----------------} +% test what happens if you pass a vbox as source without unboxing it: + +\box_new:N \l_test_box + +\vbox_set:Nn \l_test_box + { + text\markboth{A1}{A2} \par + \break + text\markboth{B1}{B2} \par + \break + text\markright{A3} \par + } + +\__mark_get_marks_for_reinsertion:nNN + { \box_use_drop:N \l_test_box } + \l_first_marks_tl + \l_last_marks_tl + + +\tl_show:N \l_first_marks_tl +\tl_show:N \l_last_marks_tl + + +\typeout{------------~ hbox~ test~ ----------------} +% test what happens if you pass a hbox as source without unboxing it: + +\hbox_set:Nn \l_test_box + { + text\markboth{A1}{A2} + text\markright{A3} + } + +\__mark_get_marks_for_reinsertion:nNN + { \box_use_drop:N \l_test_box } + \l_first_marks_tl + \l_last_marks_tl + + \tl_show:N \l_first_marks_tl \tl_show:N \l_last_marks_tl diff --git a/base/testfiles-ltmarks/xmarks-009.tlg b/base/testfiles-ltmarks/xmarks-009.tlg index f9733a899..fe8acfe98 100644 --- a/base/testfiles-ltmarks/xmarks-009.tlg +++ b/base/testfiles-ltmarks/xmarks-009.tlg @@ -210,3 +210,46 @@ l. ...\tl_show:N \l_first_marks_tl {2e-right}{A3}\mark_insert:nn {2e-right-nonempty}{A3}. } l. ...\tl_show:N \l_last_marks_tl +------------ vbox test ---------------- +\l_test_box=\box... +Marks: set 2e-left <- 'A1' on line ... +Marks: set 2e-right <- 'A2' on line ... +Marks: set 2e-right-nonempty <- 'A2' on line ... +Marks: set 2e-left <- 'B1' on line ... +Marks: set 2e-right <- 'B2' on line ... +Marks: set 2e-right-nonempty <- 'B2' on line ... +Marks: set 2e-right <- 'A3' on line ... +Marks: set 2e-right-nonempty <- 'A3' on line ... +Marks: mark extraction needs recursion on line ... +Marks: mark extraction needs recursion on line ... +Marks: extract last mark for class '2e-left' = B1 +Marks: extract first mark for class '2e-left' = A1 +Marks: extract last mark for class '2e-right' = A3 +Marks: extract first mark for class '2e-right' = A2 +Marks: extract last mark for class '2e-right-nonempty' = A3 +Marks: extract first mark for class '2e-right-nonempty' = A2 +Marks: no marks for class 'unused' on line ... +> \l_first_marks_tl=\mark_insert:nn {2e-left}{A1}\mark_insert:nn +{2e-right}{A2}\mark_insert:nn {2e-right-nonempty}{A2}. + } +l. ...\tl_show:N \l_first_marks_tl +> \l_last_marks_tl=\mark_insert:nn {2e-left}{B1}\mark_insert:nn +{2e-right}{A3}\mark_insert:nn {2e-right-nonempty}{A3}. + } +l. ...\tl_show:N \l_last_marks_tl +------------ hbox test ---------------- +Marks: set 2e-left <- 'A1' on line ... +Marks: set 2e-right <- 'A2' on line ... +Marks: set 2e-right-nonempty <- 'A2' on line ... +Marks: set 2e-right <- 'A3' on line ... +Marks: set 2e-right-nonempty <- 'A3' on line ... +Marks: no marks for class '2e-left' on line ... +Marks: no marks for class '2e-right' on line ... +Marks: no marks for class '2e-right-nonempty' on line ... +Marks: no marks for class 'unused' on line ... +> \l_first_marks_tl=. + } +l. ...\tl_show:N \l_first_marks_tl +> \l_last_marks_tl=. + } +l. ...\tl_show:N \l_last_marks_tl From 6829c524ea5742df92068ce24c1fcf7cb54b0c43 Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Mon, 29 Jan 2024 00:56:25 +0100 Subject: [PATCH 19/20] tlg updates --- required/tools/testfiles-search/sx603948.tlg | 3 ++- required/tools/testfiles-search/tlb-varioref-006.tlg | 6 +++++- required/tools/testfiles-search/tlb-varioref-007.tlg | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/required/tools/testfiles-search/sx603948.tlg b/required/tools/testfiles-search/sx603948.tlg index bd02008e5..3bb4f0879 100644 --- a/required/tools/testfiles-search/sx603948.tlg +++ b/required/tools/testfiles-search/sx603948.tlg @@ -3,7 +3,8 @@ Don't change this file in any respect. No error: (sx603948-x.tex LaTeX Warning: Reference `aRef' on page 1 undefined on input line .... -) [1 +) +[1 ] LaTeX Warning: Reference `blub' on page 2 undefined on input line .... LaTeX Warning: Reference `blub' on page 2 undefined on input line .... diff --git a/required/tools/testfiles-search/tlb-varioref-006.tlg b/required/tools/testfiles-search/tlb-varioref-006.tlg index 7ea4a5767..28e960b65 100644 --- a/required/tools/testfiles-search/tlb-varioref-006.tlg +++ b/required/tools/testfiles-search/tlb-varioref-006.tlg @@ -8,5 +8,9 @@ E away from C LaTeX Warning: Reference `undef' on page 1 undefined on input line .... undef away from C [1 -] [2] [3] [4] [5] (tlb-varioref-006.aux) +] +[2] +[3] +[4] +[5] (tlb-varioref-006.aux) LaTeX Warning: There were undefined references. diff --git a/required/tools/testfiles-search/tlb-varioref-007.tlg b/required/tools/testfiles-search/tlb-varioref-007.tlg index db4097525..42d175ba2 100644 --- a/required/tools/testfiles-search/tlb-varioref-007.tlg +++ b/required/tools/testfiles-search/tlb-varioref-007.tlg @@ -1,7 +1,8 @@ This is a generated file for the LaTeX2e validation system. Don't change this file in any respect. [1 -] [2] +] +[2] A away from current (\pageref {A} <> 3 approx) B near current point (\pageref {B} <> 3 approx) C near current point (\pageref {C} <> 3 approx) @@ -9,5 +10,7 @@ D near current point (\pageref {D} <> 3 approx) E away from current (\pageref {E} <> 3 approx) LaTeX Warning: Reference `undef' on page 3 undefined on input line .... undef away from current (\pageref {undef} <> 3 approx) -[3] [4] [5] (tlb-varioref-007.aux) +[3] +[4] +[5] (tlb-varioref-007.aux) LaTeX Warning: There were undefined references. From 1e5923137a7dcaa9e4b3e3787e1555c33bfb521a Mon Sep 17 00:00:00 2001 From: Frank Mittelbach Date: Mon, 29 Jan 2024 01:14:27 +0100 Subject: [PATCH 20/20] correct date --- base/changes.txt | 20 ++++++++++---------- base/ltmarks.dtx | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/base/changes.txt b/base/changes.txt index 016fa7cfc..595ce18ad 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,16 @@ to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2024-01-29 Frank Mittelbach + + * ltmarks.dtx: + Generalized the support for extracting marks to cover cases like multicols. + + Some internal commands renamed and extended. + Renamed \__mark_update_structure:nn to \__mark_update_structure_from_material:nn + Added \__mark_get_marks_for_reinsertion:nNN + Added \ShowMarksAt for debugging (might not stay this way) + 2024-01-27 Frank Mittelbach * lttextcomp.dtx (section{Font family sub-encodings setup}): @@ -58,16 +68,6 @@ not part of the distribution. * usrguide.tex Re-introduce \listfiles (extended) description -2023-11-14 Frank Mittelbach - - * ltmarks.dtx: - Generalized the support for extracting marks to cover cases like multicols. - - Some internal commands renamed and extended. - Renamed \__mark_update_structure:nn to \__mark_update_structure_from_material:nn - Added \__mark_get_marks_for_reinsertion:nNN - Added \ShowMarksAt for debugging (might not stay this way) - 2023-11-09 Yukai Chou * clsguide-historic.tex, usrguide.tex: Replace quotation with quote envs for zero para indent diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx index 25172af74..564da5eaf 100644 --- a/base/ltmarks.dtx +++ b/base/ltmarks.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % %% File: ltmarks.dtx -%% Copyright (C) 2022-2023 +%% Copyright (C) 2022-2024 %% Frank Mittelbach, The LaTeX Project % % It may be distributed and/or modified under the conditions of the @@ -16,7 +16,7 @@ % % \begin{macrocode} \def\ltmarksversion{v1.0e} -\def\ltmarksdate{2023/11/16} +\def\ltmarksdate{2024/01/29} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -831,7 +831,7 @@ % % % \begin{macro}{\@@_extract_and_handle_marks:nn} -% \changes{v1.0e}{2023/11/14}{Macro added} +% \changes{v1.0e}{2024/01/29}{Macro added} % % This is the main macro to extract and handle marks inside some % vertical material. It is used by @@ -1079,7 +1079,7 @@ % % \begin{macro}{\@@_update_structure_from_material:nn} % -% \changes{v1.0e}{2023/11/14}{Macro renamed} +% \changes{v1.0e}{2024/01/29}{Macro renamed} % % This function updates the mark structures of a region. The first % argument is the region to update and second argument receives the @@ -1669,7 +1669,7 @@ % % % \begin{macro}{\ShowMarksAt} -% \changes{v1.0e}{2023/11/14}{Macro added} +% \changes{v1.0e}{2024/01/29}{Macro added} % Debugging helper that displays a snapshot of all known mark % structures. The argument is a text string that is % displayed to help identifying when the snapshot was made.