diff options
Diffstat (limited to 'Master/texmf-dist/source/latex-dev/base/ltshipout.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex-dev/base/ltshipout.dtx | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx b/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx index 09495dde9a5..83fab820a9e 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx @@ -32,8 +32,8 @@ %%% From File: ltshipout.dtx % % \begin{macrocode} -\providecommand\ltshipoutversion{v1.0l} -\providecommand\ltshipoutdate{2022/01/06} +\providecommand\ltshipoutversion{v1.0m} +\providecommand\ltshipoutdate{2022/05/08} % \end{macrocode} % %<*driver> @@ -1014,8 +1014,14 @@ \_@@_add_foreground_box:n { \UseHook{shipout/lastpage} \@kernel@after@shipout@lastpage } + \bool_gset_true:N \g_@@_lastpage_handled_bool +% \end{macrocode} +% We record that we have handled the \hook{shipout/lastpage} hook +% but only if we really did. +% \changes{v1.0m}{2022/05/08}{Handle case where shipout/lastpage is +% run too early (gh/813)} +% \begin{macrocode} } - \bool_gset_true:N \g_@@_lastpage_handled_bool } \@@_finalize_box: % \end{macrocode} @@ -1723,15 +1729,35 @@ \gdef\string\@abspage@last {\int_use:N \g_shipout_readonly_int}} \fi % \end{macrocode} -% But we may have guessed wrongly earlier and we still have to run the +% But we may have guessed wrongly earlier and have run it too early +% or we still have to run the % \hook{shipout/lastpage} even though there is no page to place % it into. If that is the case we make a trivial extra page and put % it there. This temporary page will then vanish again on the next % run but helps to keep pdf viewers happy. +% In either case we should put out an appropriate ``rerun'' warning. +% \changes{v1.0m}{2022/05/08}{Handle case where shipout/lastpage is +% run too early (gh/813)} % \begin{macrocode} - \bool_if:NF \g_@@_lastpage_handled_bool + \bool_if:NTF \g_@@_lastpage_handled_bool + { +% \end{macrocode} +% If the hook was already executed, we have to test if that total +% shipouts match the shipouts from last run (because that +% corresponds to the page it was executed). If not we output a warning. +% \begin{macrocode} + \int_compare:nNnF \@abspage@last = \g_shipout_readonly_int + { + \@latex@warning@no@line{Hook~ 'shipout/lastpage'~ executed~ + on~ wrong~ page~ (\@abspage@last\space not~ + \int_use:N\g_shipout_readonly_int).\MessageBreak + Rerun~ to~ correct~ this}% + } + } { % \end{macrocode} +% If the hook was not run, we need to add an extra page and place +% it there. % However, making this extra page in case the hook is actually % empty would be forcing a rerun without any reason, so we check % that condition and also check if |