From d2a6bb90e56a2836bb59477b8f27248aab9149f5 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Thu, 1 Oct 2020 03:04:13 +0000
Subject: CTAN sync 202010010304

---
 macros/luatex/generic/luatexja/src/ltj-latex.sty | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

(limited to 'macros/luatex/generic/luatexja/src/ltj-latex.sty')

diff --git a/macros/luatex/generic/luatexja/src/ltj-latex.sty b/macros/luatex/generic/luatexja/src/ltj-latex.sty
index 55fd5d4ebd..834f16e70a 100644
--- a/macros/luatex/generic/luatexja/src/ltj-latex.sty
+++ b/macros/luatex/generic/luatexja/src/ltj-latex.sty
@@ -12,7 +12,7 @@
 \def\luatexjalatexLoaded{\endinput}
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2020-08-08 LaTeX support of LuaTeX-ja]
+\ProvidesPackage{ltj-latex}[2020-10-01 LaTeX support of LuaTeX-ja]
 
 % cleanup at end of the document
 %\let\ltj@@orig@end=\@@end
@@ -21,17 +21,23 @@
 
 \endlinechar=13
 
+%%% LaTeX version detection
+\ifcsname tex_shipout:D\endcsname
+  \expandafter\let\csname tex_shipout:D\endcsname\ltj@shipout
+\fi
+\newif\ifltj@ltfilehook@avail
+\@ifl@t@r\fmtversion{2020-10-01}{%
+  \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltfilehook@availtrue\fi
+  \else\ltj@ltfilehook@availtrue\fi
+}{}
+
 %%% patch for LaTeX
 \usepackage{lltjfont}
 \usepackage{lltjdefs}
 \usepackage{lltjcore}
+\RequirePackage{lltjp-atbegshi}
 
 %%% patching commands
-\newif\ifltj@ltfilehook@avail
-\@ifl@t@r\fmtversion{2020-10-01}{%
-  \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltfilehook@availtrue\fi
-  \else\ltj@ltfilehook@availtrue\fi
-}{}
 \ifltj@ltfilehook@avail
   \def\@@ltj@ExecuteAfterPackage#1{\AddToHook{package/after/#1}}
   \def\@@ltj@ExecuteBeforePackage#1{\AddToHook{package/before/#1}}
@@ -80,15 +86,17 @@
 \ltj@pkgpatch{tascmac}
 \ltj@pkgpatch{ascmac}[lltjp-tascmac]
 \ltj@pkgpatch@im{stfloats}
-\ltj@pkgpatch{preview}  %% at \begin{document}
+\ifltj@ltfilehook@avail\else
+  \ltj@pkgpatch{preview}  %% at \begin{document}
   % (preview package has delayed option)
+\fi
 \ltj@pkgpatch{array}    %% at \begin{document}
 \ltj@pkgpatch{collcell} %% at \begin{document}
 \ltj@pkgpatch@im{unicode-math}
 \ltj@pkgpatch@im{siunitx}
 \ltj@pkgpatch@im{microtype}
 
-\ifltj@ltshipout@avail\else\ltj@pkgpatch@im{everyshi}\fi
+\ifltj@ltfilehook@avail\else\ltj@pkgpatch@im{everyshi}\fi
 
 \RequirePackage{lltjp-geometry}
 
-- 
cgit v1.2.3

