From d310a5884150cb8753e7fbea759cc579c2a305b4 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 30 Apr 2018 22:40:21 +0000
Subject: bxjscls (30apr18)

git-svn-id: svn://tug.org/texlive/trunk@47517 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls | 224 ++++++++++++----------
 1 file changed, 122 insertions(+), 102 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls')

diff --git a/Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls b/Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls
index 4f1e4290376..fc865c7eb3d 100644
--- a/Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls
+++ b/Master/texmf-dist/tex/latex/bxjscls/bxjsslide.cls
@@ -22,7 +22,7 @@
 %% in the same archive or directory.)
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{bxjsslide}
-  [2018/03/29 v1.8a BXJS document classes]
+  [2018/04/19 v1.9  BXJS document classes]
 %% このファイルは日本語文字を含みます.
 \def\bxjs@clsname{bxjsslide}
 \newif\ifjsc@needsp@tch
@@ -68,6 +68,9 @@
    {It's a fatal error. I'll quit right now.}
   \expandafter\@firstofone
 \fi{\endinput\@@end}
+\ifx l\jsEngine
+  \directlua{ bxjs = {} }
+\fi
 \ifjsWitheTeX \let\bxjs@protected\protected
 \else \let\bxjs@protected\@empty
 \fi
@@ -107,12 +110,12 @@
     \fi
   \endgroup
   #1=\bxjs@g@tmpa\relax}
-\if j\jsEngine \def\bxjs@parse@qh@all{zw,zh}
-\else \def\bxjs@parse@qh@all{trueQ,trueH,Q,H,zw,zh}
+\if j\jsEngine \def\bxjs@parse@qh@units{zw,zh}
+\else \def\bxjs@parse@qh@units{trueQ,trueH,Q,H,zw,zh}
 \fi
 \def\bxjs@parse@qh#1{%
   \let\bxjs@tmpb\relax
-  \@for\bxjs@tmpa:=\bxjs@parse@qh@all\do{%
+  \@for\bxjs@tmpa:=\bxjs@parse@qh@units\do{%
     \ifx\bxjs@tmpb\relax
       \edef\bxjs@next{{\bxjs@tmpa}{#1}}%
       \expandafter\bxjs@parse@qh@a\csname bxjs@unit@\bxjs@tmpa\expandafter
@@ -133,18 +136,28 @@
     \fi
   \fi}
   \def\bxjs@unit@Q{0.25mm}\let\bxjs@unit@H\bxjs@unit@Q
+\@onlypreamble\bxjs@begin@document@hook
+\let\bxjs@begin@document@hook\@empty
+\AtBeginDocument{\bxjs@begin@document@hook}
+\@onlypreamble\bxjs@post@option@hook
+\let\bxjs@post@option@hook\@empty
+\@onlypreamble\bxjs@pre@jadriver@hook
+\let\bxjs@pre@jadriver@hook\@empty
 \def\jsAtEndOfClass{%
   \expandafter\g@addto@macro\csname\bxjs@clsname.cls-h@@k\endcsname}
-\@onlypreamble\bxjs@restore@jltrcc
-\let\bxjs@restore@jltrcc\@empty
+\@onlypreamble\bxjs@tmpdo
+\@onlypreamble\bxjs@tmpdo@a
+\@onlypreamble\bxjs@tmpdo@b
+\@onlypreamble\bxjs@tmpdo@c
+\@onlypreamble\bxjs@tmpdo@d
 \if l\jsEngine
-\def\bxjs@change@jltrcc#1{%
-  \xdef\bxjs@restore@jltrcc{%
-    \bxjs@restore@jltrcc
+\def\bxjs@tmpdo#1{%
+  \xdef\bxjs@pre@jadriver@hook{%
+    \bxjs@pre@jadriver@hook
     \catcode`#1=\the\catcode`#1\relax}%
   \catcode`#1=11\relax}
-\@tfor\bxjs@x:=西暦\do
-  {\expandafter\bxjs@change@jltrcc\bxjs@x}
+\@tfor\bxjs@tmpa:=和西暦\do
+  {\expandafter\bxjs@tmpdo\bxjs@tmpa}
 \fi
 \bxjs@robust@def\jsInhibitGlue{%
   \ifx\inhibitglue\@undefined\else \inhibitglue \fi}
@@ -161,6 +174,7 @@
 \newif\if@restonecol
 \newif\if@titlepage
 \newif\if@enablejfam \@enablejfamfalse
+\@onlypreamble\bxjs@setpaper
 \def\bxjs@setpaper#1{\def\bxjs@param@paper{#1}}
 \DeclareOption{a3paper}{\bxjs@setpaper{a3paper}}
 \DeclareOption{a4paper}{\bxjs@setpaper{a4paper}}
@@ -301,7 +315,7 @@
   \expandafter\let\expandafter\ifjsDraft\csname if#1\endcsname}
 \DeclareOption{draft}{\bxjs@draft{true}\setlength\overfullrule{5pt}}
 \DeclareOption{final}{\bxjs@draft{false}\setlength\overfullrule{0pt}}
-\AtBeginDocument{%
+\g@addto@macro\bxjs@begin@document@hook{%
   \expandafter\ifx\csname ifdraft\endcsname\relax
     \expandafter\let\csname ifdraft\expandafter\endcsname
      \csname ifjsDraft\endcsname
@@ -341,9 +355,8 @@
       \else \@tempdimb=\@tempcntb\@ne \fi}%
     \xdef\bxjs@gtmpa{\the\@tempdimb}%
   \endgroup #1=\bxjs@gtmpa\relax}
-\let\bxjs@composite@proc\relax
 \DeclareOption{pandoc}{%
-  \def\bxjs@composite@proc{%
+  \g@addto@macro\bxjs@post@option@hook{%
     \bxjs@oldfontcommandstrue
     \setkeys{bxjs}{ja=pandoc}%
     \let\bxjs@engine@given=*}%
@@ -408,26 +421,6 @@
   \let\bxjs@driver@given\bxjs@driver@@xetex}
 \DeclareOption{dvipdfmx-if-dvi}{%
   \setkeys{bxjs}{dvi=dvipdfmx}}
-\newif\ifbxjs@usezw \bxjs@usezwtrue
-\DeclareOption{nozw}{%
-  \bxjs@usezwfalse}
-\DeclareOption{zw}{%
-  \bxjs@usezwtrue}
-\newif\ifbxjs@disguise@js \bxjs@disguise@jstrue
-\DeclareOption{nojs}{%
-  \bxjs@disguise@jsfalse}
-\DeclareOption{js}{%
-  \bxjs@disguise@jstrue}
-\newif\ifbxjs@precisetext
-\DeclareOption{noprecisetext}{%
-  \bxjs@precisetextfalse}
-\DeclareOption{precisetext}{%
-  \bxjs@precisetexttrue}
-\newif\ifbxjs@simplejasetup \bxjs@simplejasetuptrue
-\DeclareOption{nosimplejasetup}{%
-  \bxjs@simplejasetupfalse}
-\DeclareOption{simplejasetup}{%
-  \bxjs@simplejasetuptrue}
 \newif\ifbxjs@bigcode \bxjs@bigcodefalse
 \edef\bxjs@tmpa{\expandafter\noexpand\csname\endcsname}
 \def\bxjs@tmpb#1 #2#3\@nil{%
@@ -442,16 +435,27 @@
   \bxjs@oldfontcommandsfalse}
 \DeclareOption{oldfontcommands}{%
   \bxjs@oldfontcommandstrue}
-\def\bxjs@setkey{%
-  \expandafter\bxjs@setkey@a\expandafter{\CurrentOption}}
-\def\bxjs@setkey@a{\bxjs@safe@setkeys{bxjs}}
-\DeclareOption*{\bxjs@setkey}
+\DeclareOption*{%
+  \def\bxjs@next{\bxjs@safe@setkeys{bxjs}}%
+  \expandafter\bxjs@next\expandafter{\CurrentOption}}
 \def\bxjs@safe@setkeys#1#2{%
-  \let\bxjs@KV@errx\KV@errx
-  \let\KV@errx\bxjs@safe@setkeys@a
+  \let\bxjs@save@KV@errx\KV@errx \let\KV@errx\@gobble
   \setkeys{#1}{#2}%
-  \let\KV@errx\bxjs@KV@errx}
-\def\bxjs@safe@setkeys@a#1{}
+  \let\KV@errx\bxjs@save@KV@errx}
+\@onlypreamble\bxjs@declare@enum@option
+\def\bxjs@declare@enum@option#1#2{%
+  \define@key{bxjs}{#1}{%
+    \expandafter\ifx\csname bxjs@#2@@##1\endcsname\relax
+      \bxjs@error@keyval{#1}{##1}%
+    \else \bxjs@csletcs{bxjs@#2}{bxjs@#2@@##1}%
+    \fi}}
+\@onlypreamble\bxjs@declare@bool@option
+\def\bxjs@declare@bool@option#1#2{%
+  \define@key{bxjs}{#1}[true]{%
+    \expandafter\ifx\csname bxjs@#2##1\endcsname\relax
+      \bxjs@error@keyval{#1}{##1}%
+    \else \@nameuse{bxjs@#2##1}%
+    \fi}}
 \def\bxjs@set@keyval#1#2#3{%
   \expandafter\let\expandafter\bxjs@next\csname bxjs@kv@#1@#2\endcsname
   \ifx\bxjs@next\relax
@@ -479,9 +483,9 @@
 \define@key{bxjs}{mag}{\edef\bxjs@param@mag{#1}}
 \define@key{bxjs}{paper}{\edef\bxjs@param@paper{#1}}
 \let\bxjs@jadriver\relax
-\define@key{bxjs}{jadriver}{\edef\bxjs@jadriver{#1}}
+\define@key{bxjs}{jadriver}{\edef\bxjs@jadriver@opt{#1}}
 \define@key{bxjs}{ja}[\relax]{%
-  \ifx\relax#1\else\edef\bxjs@jadriver{#1}\fi}
+  \ifx\relax#1\else\edef\bxjs@jadriver@opt{#1}\fi}
 \let\jsJaFont\@empty
 \define@key{bxjs}{jafont}{\edef\jsJaFont{#1}}
 \let\jsJaParam\@empty
@@ -550,7 +554,7 @@
 \define@key{bxjs}{layout}{%
   \bxjs@set@keyval{layout}{#1}{}}
 \define@key{bxjs}{textwidth-limit}{%
-  \edef\bxjs@textwidth@limit{#1}}
+  \edef\bxjs@textwidth@limit@opt{#1}}
 \define@key{bxjs}{textwidth}{\edef\bxjs@textwidth@opt{#1}}
 \define@key{bxjs}{line_length}{\setkeys{bxjs}{textwidth=#1}}
 \define@key{bxjs}{number-of-lines}{\edef\bxjs@number@of@lines@opt{#1}}
@@ -594,15 +598,31 @@
 \def\bxjs@kv@labelsection@compat{\let\bxjs@label@section\bxjs@label@section@compat}
 \def\bxjs@kv@labelsection@modern{\let\bxjs@label@section\bxjs@label@section@modern}
 \define@key{bxjs}{label-section}{\bxjs@set@keyval{labelsection}{#1}{}}
-\let\bxjs@ltx@removeelement\@removeelement
+\newif\ifbxjs@usezw \bxjs@usezwtrue
+\bxjs@declare@bool@option{use-zw}{usezw}
+\DeclareOption{nozw}{\setkeys{bxjs}{use-zw=false}}
+\DeclareOption{zw}{\setkeys{bxjs}{use-zw=true}}
+\newif\ifbxjs@disguise@js \bxjs@disguise@jstrue
+\bxjs@declare@bool@option{disguise-js}{disguise@js}
+\DeclareOption{nojs}{\setkeys{bxjs}{disguise-js=false}}
+\DeclareOption{js}{\setkeys{bxjs}{disguise-js=true}}
+\newif\ifbxjs@precisetext
+\bxjs@declare@bool@option{precise-text}{precisetext}
+\DeclareOption{noprecisetext}{\setkeys{bxjs}{precise-text=false}}
+\DeclareOption{precisetext}{\setkeys{bxjs}{precise-text=true}}
+\newif\ifbxjs@simplejasetup \bxjs@simplejasetuptrue
+\bxjs@declare@bool@option{simple-ja-setup}{simplejasetup}
+\DeclareOption{nosimplejasetup}{\setkeys{bxjs}{simple-ja-setup=false}}
+\DeclareOption{simplejasetup}{\setkeys{bxjs}{simple-ja-setup=true}}
+\let\bxjs@org@removeelement\@removeelement
 \def\@removeelement#1#2#3{%
   \def\reserved@a{#2}%
   \ifx\reserved@a\@empty \let#3\@empty
-  \else \bxjs@ltx@removeelement{#1}{#2}{#3}%
+  \else \bxjs@org@removeelement{#1}{#2}{#3}%
   \fi}
 \ExecuteOptions{36pt,a4paper,landscape,oneside,onecolumn,titlepage,final}
 \ProcessOptions\relax
-\bxjs@composite@proc
+\bxjs@post@option@hook
 \if@slide
   \def\maybeblue{\@ifundefined{ver@color.sty}{}{\color{blue}}}
 \fi
@@ -611,32 +631,28 @@
   \setlength\paperheight{\paperwidth}
   \setlength\paperwidth {\@tempdima}
 \fi
-\@onlypreamble\bxjs@purge@brace@elts
-\def\bxjs@purge@brace@elts{%
+\def\bxjs@tmpdo{%
   \def\bxjs@tmpa{\@gobble}%
-  \expandafter\bxjs@purge@be@a\@classoptionslist,\@nil,%
+  \expandafter\bxjs@tmpdo@a\@classoptionslist,\@nil,%
   \let\@classoptionslist\bxjs@tmpa}
-\@onlypreamble\bxjs@purge@be@a
-\def\bxjs@purge@be@a#1,{%
+\def\bxjs@tmpdo@a#1,{%
   \ifx\@nil#1\relax\else
-    \bxjs@purge@be@b#1{}\@nil
+    \bxjs@tmpdo@b#1{}\@nil
     \if@tempswa \edef\bxjs@tmpa{\bxjs@tmpa,#1}\fi
-    \expandafter\bxjs@purge@be@a
+    \expandafter\bxjs@tmpdo@a
   \fi}
-\@onlypreamble\bxjs@purge@be@b
-\def\bxjs@purge@be@b#1#{\bxjs@purge@be@c}
-\@onlypreamble\bxjs@purge@be@c
-\def\bxjs@purge@be@c#1\@nil{%
+\def\bxjs@tmpdo@b#1#{\bxjs@tmpdo@c}
+\def\bxjs@tmpdo@c#1\@nil{%
   \ifx\@nil#1\@nil \@tempswatrue \else \@tempswafalse \fi}
-\bxjs@purge@brace@elts
+\bxjs@tmpdo
 \@expandtwoargs\@removeelement
   {papersize}\@classoptionslist\@classoptionslist
 \@expandtwoargs\@removeelement
   {10pt}\@classoptionslist\@classoptionslist
 \@expandtwoargs\@removeelement
   {noscale}\@classoptionslist\@classoptionslist
-\ifx\bxjs@jadriver\relax\else
-  \let\bxjs@jadriver@given\bxjs@jadriver
+\ifx\bxjs@jadriver@opt\@undefined\else
+  \let\bxjs@jadriver\bxjs@jadriver@opt
 \fi
 \let\bxjs@tmpb\jsEngine
 \ifx j\bxjs@tmpb\ifjsWithpTeXng
@@ -696,17 +712,17 @@
 \else \@tempswatrue
 \fi\fi\fi
 \if@tempswa
-  \ifx\bxjs@driver@opt\@undefined \ifx\bxjs@jadriver@given\@undefined\else
+  \ifx\bxjs@driver@opt\@undefined \ifx\bxjs@jadriver@opt\@undefined\else
     \ClassWarningNoLine\bxjs@clsname
     {No driver option is given}
   \fi\fi
   \ifbxjs@dvi@opt
-    \edef\bxjs@nxt{%
+    \edef\bxjs@next{%
       \let\noexpand\bxjs@driver@given
        \csname bxjs@dvidriver@@\bxjs@driver@opt\endcsname
       \noexpand\g@addto@macro\noexpand\@classoptionslist
        {,\bxjs@driver@opt}%
-    }\bxjs@nxt
+    }\bxjs@next
   \fi
 \fi
 \ifjsWithpTeXng
@@ -727,7 +743,7 @@
     \let\bxjs@jadriver\bxjs@@minimal
   \fi
 \fi
-\ifx\bxjs@jadriver@given\@undefined\else
+\ifx\bxjs@jadriver@opt\@undefined\else
   \ifx\bxjs@engine@given\@undefined
     \ClassError\bxjs@clsname
      {An engine option must be explicitly given}%
@@ -820,6 +836,7 @@
   \catcode`\?=11 \let\p@?\jsc@mpt
 \fi
 \chardef\bxjs@qmcc=\catcode`\?\relax
+\g@addto@macro\bxjs@pre@jadriver@hook{\catcode`\?=12\relax}
 \newdimen\jsZw
 \jsZw=10\jsc@mpt \jsZw=\jsScale\jsZw
 \ifbxjs@usezw
@@ -919,10 +936,10 @@
   \skip2=\abovedisplayshortskip
   \skip4=\belowdisplayskip
   \skip6=\belowdisplayshortskip
-  \let\bxjs@ltx@nomath\@nomath
+  \let\bxjs@save@nomath\@nomath
   \let\@nomath\@gobble
   \@currsize\selectfont
-  \let\@nomath\bxjs@ltx@nomath
+  \let\@nomath\bxjs@save@nomath
   \abovedisplayskip=\skip0
   \abovedisplayshortskip=\skip2
   \belowdisplayskip=\skip4
@@ -1013,21 +1030,23 @@
 \@lowpenalty   51
 \@medpenalty  151
 \@highpenalty 301
+\@onlypreamble\bxjs@bd@pre@geometry@hook
+\let\bxjs@bd@pre@geometry@hook\@empty
 \ifjsc@mag
 \mag=\bxjs@param@mag
 \fi
 \setlength{\topskip}{10\p@?}
 \def\bxjs@unit@trueQ{0.25truemm}\let\bxjs@unit@trueH\bxjs@unit@trueQ
 \def\bxjs@unit@zw{\jsZw}\let\bxjs@unit@zh\bxjs@unit@zw
-\def\bxjs@read@a{\futurelet\bxjs@tmpa\bxjs@read@b}
-\def\bxjs@read@b{%
-  \ifx\bxjs@tmpa\bgroup \expandafter\bxjs@read@c
-  \else \expandafter\bxjs@read@d \fi}
-\def\bxjs@read@c#1#2#3\@nil{\edef\bxjs@param@paper{papersize={#1,#2}}}
-\def\bxjs@read@d#1\@nil{\bxjs@read@e#1,,\@nil}
-\def\bxjs@read@e#1,#2,#3\@nil{%
+\def\bxjs@tmpdo{\futurelet\bxjs@tmpa\bxjs@tmpdo@a}
+\def\bxjs@tmpdo@a{%
+  \ifx\bxjs@tmpa\bgroup \expandafter\bxjs@tmpdo@b
+  \else \expandafter\bxjs@tmpdo@c \fi}
+\def\bxjs@tmpdo@b#1#2#3\@nil{\edef\bxjs@param@paper{papersize={#1,#2}}}
+\def\bxjs@tmpdo@c#1\@nil{\bxjs@tmpdo@d#1,,\@nil}
+\def\bxjs@tmpdo@d#1,#2,#3\@nil{%
   \ifx\@nil#3\@nil\else \edef\bxjs@param@paper{papersize={#1,#2}}\fi}
-\expandafter\bxjs@read@a\bxjs@param@paper\@empty\@empty\@nil
+\expandafter\bxjs@tmpdo\bxjs@param@paper\@empty\@empty\@nil
 \edef\bxjs@layout@paper{%
   \ifjsc@mag truedimen,\fi
   \if@landscape landscape,\fi
@@ -1048,10 +1067,13 @@
   \edef\bxjs@layout{\bxjs@layout lines=\the\@tempcnta,}
 \fi
 \newdimen\fullwidth
+\def\bxjs@preproc@layout{%
+  \edef\bxjs@save@ht@strutbox{\the\ht\strutbox}\ht\strutbox=10\jsc@mpt}
 \def\bxjs@postproc@layout{%
   \ifx\bxjs@geometry@driver\relax\else
     \let\Gm@driver\bxjs@geometry@driver
   \fi
+  \ht\strutbox=\bxjs@save@ht@strutbox\relax
   \ifbxjs@whole@zw@lines
     \@tempdimb=\textwidth
     \if@twocolumn \@tempdima=2\Cwd \else \@tempdima=1\Cwd \fi
@@ -1086,10 +1108,6 @@
 \edef\jsGeometryOptions{%
   \bxjs@layout@paper,\bxjs@layout}
 \ifx\bxjs@geometry\bxjs@geometry@class
-\def\bxjs@geometry@guard@on{%
-  \edef\bxjs@gg@tmp{\the\ht\strutbox}\ht\strutbox=10\jsc@mpt}
-\def\bxjs@geometry@guard@off{%
-  \ht\strutbox=\bxjs@gg@tmp\relax}
 \ifbxjs@papersize
   \ifx\bxjs@driver@given\bxjs@driver@@dvipdfmx
     \PassOptionsToPackage{dvipdfm}{geometry}
@@ -1100,19 +1118,16 @@
 \else
   \PassOptionsToPackage{driver=none}{geometry}
 \fi
-\AtBeginDocument{\bxjs@pre@geometry@hook}
+\AtBeginDocument{\bxjs@bd@pre@geometry@hook}
 \AtBeginDocument{\ImposeOldLuaTeXBehavior}
-\bxjs@geometry@guard@on
+\bxjs@preproc@layout
 \edef\bxjs@next{%
   \noexpand\RequirePackage[\bxjs@layout@paper,\bxjs@layout]{geometry}%
 }\bxjs@next
-\bxjs@geometry@guard@off
 \AtBeginDocument{\RevokeOldLuaTeXBehavior}
 \let\bxjs@geometry@driver\Gm@driver
 \bxjs@postproc@layout
-\@onlypreamble\bxjs@pre@geometry@hook
-\def\bxjs@pre@geometry@hook{%
-  \@ifpackageloaded{geometry}{%
+\g@addto@macro\bxjs@bd@pre@geometry@hook{%
     \@ifpackagelater{geometry}{2010/02/12}{}{%else
       \PackageWarningNoLine\bxjs@clsname
        {The 'geometry' package installed\MessageBreak
@@ -1121,14 +1136,12 @@
         \def\bxjs@Gm@driver{pdftex}
         \ifx\pdfhorigin\@undefined \newdimen\pdfhorigin \fi
         \ifx\pdfvorigin\@undefined \newdimen\pdfvorigin \fi
-      \fi\fi
-    }%
+      \fi\fi}%
     \ifjsWithpTeXng
       \ifx\Gm@driver\@empty
         \def\Gm@driver{pdftex}%
       \fi
-    \fi
-  }{}}
+    \fi}
 \def\setpagelayout{%
   \bxjs@ifplus{\bxjs@setpagelayout@a\tw@}{%else
     \@ifstar{\bxjs@setpagelayout@a\@ne}{\bxjs@setpagelayout@a\z@}}}
@@ -1140,20 +1153,17 @@
   \or% semireset(+)
     \def\bxjs@next{reset,\bxjs@layout@paper,\bxjs@layout@base,#2}%
   \fi
-  \bxjs@geometry@guard@on
+  \bxjs@preproc@layout
   \edef\bxjs@next{%
     \noexpand\geometry{\bxjs@next}%
   }\bxjs@next
-  \bxjs@geometry@guard@off
   \bxjs@postproc@layout}
 \else\ifx\bxjs@geometry\bxjs@geometry@user
-\AtBeginDocument{\bxjs@check@page@layout}
-\@onlypreamble\bxjs@check@page@layout
-\def\bxjs@check@page@layout{%
+\g@addto@macro\bxjs@begin@document@hook{%
   \ifdim\textwidth=.5\maxdimen
     \ClassError\bxjs@clsname
      {Page layout is not properly set}%
-     {\@ehd}
+     {\@ehd}%
   \fi}
 \def\jsUseMinimalPageLayout{%
   \setlength{\textwidth}{6.5in}%
@@ -2107,7 +2117,7 @@
 \let\jsInhibitGlueAtParTop\@empty
 \def\everyparhook{\jsInhibitGlueAtParTop}
 \ifnum\bxjs@everyparhook=\bxjs@everyparhook@compat
-\AtBeginDocument{\everypar{\everyparhook}}
+\g@addto@macro\bxjs@begin@document@hook{\everypar{\everyparhook}}
 \fi
 \ifx j\jsEngine
 \def\@inhibitglue{%
@@ -2260,6 +2270,7 @@
 \newcommand{\tablename}{\if@english Table~\else 表\fi}
 \newcommand{\appendixname}{\if@english \else 付録\fi}
 \newcommand{\abstractname}{\if@english Abstract\else 概要\fi}
+\@onlypreamble\bxjs@decl@Seireki@cmds
 \@tempswafalse
 \if p\jsEngine \@tempswatrue \fi
 \if n\jsEngine \@tempswatrue \fi
@@ -2306,6 +2317,18 @@
   \def\bxjs@gengo{平成}\advance\bxjs@jayear-1988\relax
   \let\heisei\bxjs@jayear
 \else
+  \IfFileExists{bxwareki.sty}{\IfFileExists{bxwareki2019.def}{%
+    \RequirePackage{bxwareki}[]%
+    \let\bxjs@gengo\WarekiGengo
+  }{}}{}%
+  \if l\jsEngine \ifx\bxjs@gengo\@empty
+    \toks@{}
+    \directlua{pcall(function()
+      tex.toks[0] = bxjs.get_new_gengo()
+    end)}
+    \edef\bxjs@gengo{\the\toks@}
+  \fi\fi
+  \ifx\bxjs@gengo\@empty\else \advance\bxjs@jayear-2018\relax \fi
 \fi\fi\fi
 \edef\jayear{%
   \ifx\bxjs@gengo\@empty \the\bxjs@jayear\bxjs@iai
@@ -2332,7 +2355,7 @@
     }%
   \fi}
 \let\today\bxjs@today
-\AtBeginDocument{%
+\g@addto@macro\bxjs@begin@document@hook{%
   \ifx\bbl@jpn@Seirekitrue\@undefined\else
     \bxjs@decl@Seireki@cmds
     \g@addto@macro\datejapanese{%
@@ -2351,11 +2374,8 @@
 \fi
   \renewcommand\familydefault{\sfdefault}
   \raggedright
-\catcode`\?=12
-\ifx\bxjs@jadriver\relax\else
+\bxjs@pre@jadriver@hook
 \input{bxjsja-\bxjs@jadriver.def}
-\fi
-\bxjs@restore@jltrcc
 \endinput
 %%
 %% End of file `bxjsslide.cls'.
-- 
cgit v1.2.3

