[latex3-commits] [git/LaTeX3-latex3-latex2e] gh431: fix for #431 (4bf51ee8)
Frank Mittelbach
frank.mittelbach at latex-project.org
Mon Nov 23 11:56:29 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : gh431
Link : https://github.com/latex3/latex2e/commit/4bf51ee896e735d3f0e2699d3c67785e38bc6e12
>---------------------------------------------------------------
commit 4bf51ee896e735d3f0e2699d3c67785e38bc6e12
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Mon Nov 23 11:56:29 2020 +0100
fix for #431
>---------------------------------------------------------------
4bf51ee896e735d3f0e2699d3c67785e38bc6e12
base/changes.txt | 6 ++++++
base/ltshipout.dtx | 18 ++++++++++++++----
base/testfiles-lthooks2/github-0431.lvt | 32 ++++++++++++++++++++++++++++++++
base/testfiles-lthooks2/github-0431.tlg | 31 +++++++++++++++++++++++++++++++
base/update-lthooks-tests.sh | 3 ++-
5 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 6e6a82ec..0bbeb879 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -1,3 +1,4 @@
+
================================================================================
This file lists changes to the LaTeX2e files in reverse chronological order of
publication (therefore the dates might be out of sequence if there are hotfixes).
@@ -6,6 +7,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2020-11-23 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
+
+ * ltshipout.dtx:
+ Check for both kernel and user hooks and execute if either is non-empty (gh/431)}
+
2020-10-26 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
* ltmiscen.dtx (subsection{Environments}):
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index 08d2da5f..88f991d9 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -31,8 +31,8 @@
%%% From File: ltshipout.dtx
%
% \begin{macrocode}
-\providecommand\ltshipoutversion{v1.0c}
-\providecommand\ltshipoutdate{2020/11/03}
+\providecommand\ltshipoutversion{v1.0d}
+\providecommand\ltshipoutdate{2020/11/23}
% \end{macrocode}
%
%<*driver>
@@ -751,7 +751,13 @@
\hook_if_empty:nF {shipout/foreground}
{ \@@_add_foreground_picture:n
{ \hook_use:n {shipout/foreground} } }
- \hook_if_empty:nF {shipout/background}
+% \end{macrocode}
+% If there is no user hook, there might still code in the kernel hook.
+% \changes{v1.0d}{2020/11/23}{Check for both kernel and user hook (gh/431)}
+% \begin{macrocode}
+ \bool_lazy_and:nnF
+ { \hook_if_empty_p:n {shipout/background} }
+ { \tl_if_empty_p:N \@kernel at before@shipout at background }
{ \@@_add_background_picture:n
{ \@kernel at before@shipout at background
\hook_use:n {shipout/background} } }
@@ -764,11 +770,15 @@
\@@_execute_firstpage_hook:
% \end{macrocode}
% The we check if we have to add the \hook{shipout/lastpage} hook
+% or the corresponding kernel hook
% because we have reached the last page. This test will be false for
% all but one (and hopefully the correct) page.
+% \changes{v1.0d}{2020/11/23}{Check for both kernel and user hook (gh/431)}
% \begin{macrocode}
\int_compare:nNnT \@abspage at last = \g_shipout_readonly_int
- { \hook_if_empty:nF {shipout/lastpage}
+ { \bool_lazy_and:nnF
+ { \hook_if_empty_p:n {shipout/lastpage} }
+ { \tl_if_empty_p:N \@kernel at after@shipout at lastpage }
{ \@@_debug:n { \typeout{Executing~ lastpage~ hook~
on~ page~ \int_use:N \g_shipout_readonly_int } }
\_@@_add_foreground_box:n { \UseHook{shipout/lastpage}
diff --git a/base/testfiles-lthooks2/github-0431.lvt b/base/testfiles-lthooks2/github-0431.lvt
new file mode 100644
index 00000000..677ae27b
--- /dev/null
+++ b/base/testfiles-lthooks2/github-0431.lvt
@@ -0,0 +1,32 @@
+
+\documentclass{article}
+
+\input{regression-test}
+
+\makeatletter
+% dummy definitions:
+\g at addto@macro \@kernel at after@shipout at lastpage {\typeout{After last shipout}}
+\g at addto@macro \@kernel at before@shipout at background {\typeout{Before background shipout}}
+\makeatother
+
+% bug in ltshipout: kernel hook is only executed if user
+% hook is not empty :-(
+
+\DebugShipoutsOn
+
+\begin{document}
+
+\START
+
+\ShowHook{shipout/background}
+\ShowHook{shipout/lastpage}
+
+test
+
+\newpage
+
+test2
+
+\end{document}
+
+
diff --git a/base/testfiles-lthooks2/github-0431.tlg b/base/testfiles-lthooks2/github-0431.tlg
new file mode 100644
index 00000000..3e4c68e4
--- /dev/null
+++ b/base/testfiles-lthooks2/github-0431.tlg
@@ -0,0 +1,31 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-> The hook 'shipout/background':
+> Code chunks:
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Hook code pool empty.
+<recently read> }
+l. ...\ShowHook{shipout/background}
+-> The hook 'shipout/lastpage':
+> Code chunks:
+> ---
+> Extra code for next invocation:
+> ---
+> Rules:
+> ---
+> Hook code pool empty.
+<recently read> }
+l. ...\ShowHook{shipout/lastpage}
+Absolute page = 1 (target: 2)
+Before background shipout
+[1
+]
+Absolute page = 2 (target: 2)
+Before background shipout
+Executing lastpage hook on page 2
+After last shipout
+[2] (github-0431.aux)
diff --git a/base/update-lthooks-tests.sh b/base/update-lthooks-tests.sh
index 001ba76d..03d7a159 100644
--- a/base/update-lthooks-tests.sh
+++ b/base/update-lthooks-tests.sh
@@ -7,7 +7,8 @@ l3build save -cconfig-lthooks2 \
shipout2-004 \
shipout2-006 \
shipout2-007 \
- github-0360
+ github-0360 \
+ github-0431
More information about the latex3-commits
mailing list.