[latex3-commits] [git/LaTeX3-latex3-latex2e] gh625: Update code to remove l3backend chunk from shipout/firstpage (ec7a1ef6)

PhelypeOleinik phelype.oleinik at latex-project.org
Sat Jul 24 00:42:56 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : gh625
Link       : https://github.com/latex3/latex2e/commit/ec7a1ef6544eaf31158c0d81ac25a52c0ee5a74f

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

commit ec7a1ef6544eaf31158c0d81ac25a52c0ee5a74f
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Fri Jul 23 19:42:56 2021 -0300

    Update code to remove l3backend chunk from shipout/firstpage


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

ec7a1ef6544eaf31158c0d81ac25a52c0ee5a74f
 support/test209.tex | 18 +++++++++++++++++-
 support/test2e.tex  | 18 +++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/support/test209.tex b/support/test209.tex
index db32bf1a..69ca4e09 100644
--- a/support/test209.tex
+++ b/support/test209.tex
@@ -166,7 +166,23 @@
 
 % Suppress dvips headers
 \def\AtBeginDvi#1{}
-\RemoveFromHook{shipout/firstpage}[l3backend]
+% Gymnastics needed to remove l3backend from shipout/firstpage:
+% If shipout/firstpage is nonempty, an extra box and kern are
+% added to the shipout box, and since \RemoveFromHook no longer
+% removes code added in the future, we need to delay the removal
+% to "shipout/before".  We also need to redirect error messages
+% because in some tests, the "l3backend" chunk is not added.
+% The "voids" rule is no good here because "shipout/firstpage"
+% being nonempty is enough to add the extra box and kern to the
+% output.
+\ExplSyntaxOn
+\AddToHook{shipout/before}
+  {
+    \msg_redirect_name:nnn { hooks } { cannot-remove } { none }
+    \RemoveFromHook{shipout/firstpage}[l3backend]
+    \msg_redirect_name:nnn { hooks } { cannot-remove } { error }
+  }
+\ExplSyntaxOff
 % Load expl3 backend if necessary
 \ifx\@nodocument\relax
   \expandafter\@gobbletwo
diff --git a/support/test2e.tex b/support/test2e.tex
index 24d430ca..9f0913ea 100644
--- a/support/test2e.tex
+++ b/support/test2e.tex
@@ -295,7 +295,23 @@ end
 
 % Suppress dvips headers
 \def\AtBeginDvi#1{}
-\RemoveFromHook{shipout/firstpage}[l3backend]
+% Gymnastics needed to remove l3backend from shipout/firstpage:
+% If shipout/firstpage is nonempty, an extra box and kern are
+% added to the shipout box, and since \RemoveFromHook no longer
+% removes code added in the future, we need to delay the removal
+% to "shipout/before".  We also need to redirect error messages
+% because in some tests, the "l3backend" chunk is not added.
+% The "voids" rule is no good here because "shipout/firstpage"
+% being nonempty is enough to add the extra box and kern to the
+% output.
+\ExplSyntaxOn
+\AddToHook{shipout/before}
+  {
+    \msg_redirect_name:nnn { hooks } { cannot-remove } { none }
+    \RemoveFromHook{shipout/firstpage}[l3backend]
+    \msg_redirect_name:nnn { hooks } { cannot-remove } { error }
+  }
+\ExplSyntaxOff
 % Load expl3 backend if necessary
 \ifx\@nodocument\relax
   \expandafter\@gobbletwo





More information about the latex3-commits mailing list.