summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-17 21:39:09 +0000
committerKarl Berry <karl@freefriends.org>2022-06-17 21:39:09 +0000
commitedcccd4cc0ca87ae1e4c6759320181ec21f64906 (patch)
tree899bbb524057b633f0a28fbd5215b468da43767f /Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
parent3e18863c2daf59606e8ccf082c9e98aa6cc2e064 (diff)
latex-dev (17jun22)
git-svn-id: svn://tug.org/texlive/trunk@63631 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex-dev/base/ltmarks.dtx')
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltmarks.dtx69
1 files changed, 58 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx b/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
index e8971c9d6c5..3dc4b493ace 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltmarks.dtx
@@ -14,8 +14,8 @@
%%% From File: ltmarks.dtx
%
% \begin{macrocode}
-\def\ltmarksversion{v1.0c}
-\def\ltmarksdate{2022/05/06}
+\def\ltmarksversion{v1.0d}
+\def\ltmarksdate{2022/06/01}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
@@ -826,18 +826,25 @@
\dim_set_eq:NN \tex_vfuzz:D \c_max_dim
% \end{macrocode}
% There is a further complication: if the region contains infinite
-% shrinking glue then a \cs{vsplit} operation will balk with a
+% 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 \cs{enlargethispage} actually does add
+% 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
+% \pkg{marginnote} that attaches its marginals in this way). If such
+% 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 \cs{vbox} as the last item and if so
-% unpack that too. All this is temporary, just for getting the
+% 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
@@ -856,16 +863,50 @@
#2
\tex_unskip:D
\box_set_to_last:N \l_@@_box
- \box_if_vertical:NT \l_@@_box
- { \vbox_unpack: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}.
+% \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
+ {
+% \end{macrocode}
+% If it is we do a further test and reset the \cs{l_@@_box}
+% to check if it contains infinitely shrinkable glue.
+% \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 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}.
+% \begin{macrocode}
+ \int_compare:nNnT \tex_badness:D > 0
+ { \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 box
+% 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
-% which means out test would incorrectly conclude that we have
-% infinite shrinking glue. A simple \tn{kern} is enough to avoid this.
+% 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
}
@@ -1165,6 +1206,12 @@
%
% \subsection{Messages}
%
+% 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 }
+% \end{macrocode}
+%
% \begin{macrocode}
\msg_new:nnnn { mark } { class-already-defined }
{ Mark~class~'#1'~already~defined }