From 8c6ca435b3bc584eb3efe8e52417fb989e677789 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sun, 14 Feb 2021 03:00:50 +0000
Subject: CTAN sync 202102140300

---
 language/japanese/platex-tools/pxatbegshi.sty | 39 ++++++++++++++++++---------
 1 file changed, 26 insertions(+), 13 deletions(-)

(limited to 'language/japanese/platex-tools/pxatbegshi.sty')

diff --git a/language/japanese/platex-tools/pxatbegshi.sty b/language/japanese/platex-tools/pxatbegshi.sty
index 3c8a830415..856b95eb44 100644
--- a/language/japanese/platex-tools/pxatbegshi.sty
+++ b/language/japanese/platex-tools/pxatbegshi.sty
@@ -30,29 +30,42 @@
 %% package declaration
 \NeedsTeXFormat{pLaTeX2e}
 \ProvidesPackage{pxatbegshi}
-    [2020/09/25 v0.7 Patch to atbegshi for (u)pLaTeX]
-
-%% preparations
-\def\pxabgs@pkgname{pxatbegshi}
-\def\pxabgs@warn{\PackageWarningNoLine\pxabgs@pkgname}
-
-%% load it
-\RequirePackage{atbegshi}
+    [2021/02/13 v0.7b Patch to atbegshi for (u)pLaTeX]
 
 %% Since LaTeX2e 2020-10-01, atbegshi.sty is merely
 %% an emulation by atbegshi-ltx.sty from ltshipout.dtx.
-%% The new code does NOT define \AtBegShi@Output,
-%% so we can detect it!
 
-\ifx\AtBegShi@Output\@undefined
-  %% pLaTeX2e 2020-10-01 natively supports the situation
-  \PackageInfo{pxatbegshi}{This package is no longer needed}
+\chardef\pxabgs@status=\z@
+\ifx\IfHookExistsTF\@undefined\else  % >= LaTeX2e 2020-10-01
+  \IfHookExistsTF{shipout/before}{%  % >= LaTeX2e 2020-10-01
+    \chardef\pxabgs@status=\@ne
+  }{}
+\fi
+\ifnum\pxabgs@status=\@ne
+  % if LaTeX2e and pLaTeX2e are inconsistent, raise an error!
+  \@ifl@t@r\pfmtversion{2020/10/01}{%
+    \PackageInfo{pxatbegshi}{This package is no longer needed}%
+  }{%
+    \PackageError{pxatbegshi}{Inconsistent LaTeX2e/pLaTeX2e combination}\@ehc
+  }%
+  \RequirePackage{atbegshi}% input anyway
   \expandafter\endinput
 \fi
 
 %% The rest of this package is meant for
 %% LaTeX2e 2020-02-02 PL5 or older.
 
+\RequirePackage{atbegshi}
+
+\ifx\AtBegShi@Output\@undefined
+  \PackageError{pxatbegshi}{This should not happen}\@ehc
+  \expandafter\endinput
+\fi
+
+%% preparations
+\def\pxabgs@pkgname{pxatbegshi}
+\def\pxabgs@warn{\PackageWarningNoLine\pxabgs@pkgname}
+
 %% internal macros are locally effective
 \begingroup
 
-- 
cgit v1.2.3

