From e08b2c1f89e1eb5123b62d01b4932f5dad1a4305 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 30 Dec 2020 03:01:29 +0000
Subject: CTAN sync 202012300301

---
 language/japanese/jlreq/jlreq.cls | 239 ++++++++++++++++++++++++++------------
 1 file changed, 167 insertions(+), 72 deletions(-)

(limited to 'language/japanese/jlreq/jlreq.cls')

diff --git a/language/japanese/jlreq/jlreq.cls b/language/japanese/jlreq/jlreq.cls
index ba89816ec6..71f7426605 100644
--- a/language/japanese/jlreq/jlreq.cls
+++ b/language/japanese/jlreq/jlreq.cls
@@ -3,12 +3,20 @@
 %% The package is distributed under the BSD 2-Clause License
 %%
 %%
-% (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/)
+% (based on JLReq 20200811 https://www.w3.org/TR/2020/NOTE-jlreq-20200811/)
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jlreq}[2020/09/27 jlreq]
-\RequirePackage{xkeyval,everyhook,etoolbox,ifthen,filehook}
+\ProvidesClass{jlreq}[2020/12/29 jlreq]
+\RequirePackage{xkeyval,everyhook,etoolbox,ifthen}
 \RequirePackage{jlreq-helpers}
 
+
+\ExplSyntaxOn
+\tl_new:N \l_jlreq_tmpa_tl
+\cs_new:Nn \l_jlreq_do: {}
+\str_new:N \l_jlreq_tmpa_str
+\str_new:N \l_jlreq_tmpb_str
+\ExplSyntaxOff
+
 \newcommand*{\jlreq@undeferr}[1]{\ClassError{jlreq}{Trying to delete \string#1 even though it is not defined, may be a bug}{\@ehc}}
 % クラスファイル内でしか使わないマクロをクラスファイル終了時に未定義にする
 \newcommand*{\jlreq@aftercls@addtodeletecs}[1]{%
@@ -31,17 +39,20 @@
 \AtBeginDocument{\jlreq@preamblefalse}
 
 \def\jlreq@saveoriginalcs#1{%
-  \ifx#1\relax
-    \ClassError{jlreq}{Trying to save \string#1 but it's not defined, may be a bug}{\@ehc}%
-  \fi
-  \expandafter\ifx\csname jlreq@original@\expandafter\@gobble\string#1\endcsname\relax\else
-    \ClassError{jlreq}{Trying to save \string#1 twice, may be a bug}{\@ehc}%
-  \fi
-  \expandafter\let\csname jlreq@original@\expandafter\@gobble\string#1\endcsname=#1
+  \@ifundefined{#1}{
+    \ClassError{jlreq}{Trying to save #1 but it's not defined, may be a bug}{\@ehc}%
+  }{}
+  \@ifundefined{jlreq@original@#1}{}{
+    \ClassError{jlreq}{Trying to save #1 twice, may be a bug}{\@ehc}%
+  }
+  \begingroup
+    \edef\jlreq@do{\noexpand\let\expandonce{\csname jlreq@original@#1\endcsname}=\expandonce{\csname #1\endcsname}}
+  \expandafter\endgroup
+  \jlreq@do
 }
 \def\jlreq@useoriginalcs#1{%
-  \jlreq@if{\ifcsname jlreq@original@\expandafter\@gobble\string#1\endcsname\fi}%
-    {\csname jlreq@original@\expandafter\@gobble\string#1\endcsname}%
+  \jlreq@if{\ifcsname jlreq@original@#1\endcsname\fi}%
+    {\csname jlreq@original@#1\endcsname}%
     {#1}%
 }
 \def\jlreq@restoreoriginalcs#1{%
@@ -633,11 +644,13 @@
   \providecommand*{\jlreqkanjiskip}{0pt plus 0.25\jlreq@zw minus 0pt}
 \fi
 \providecommand*{\jlreqxkanjiskip}{0.25\jlreq@zw plus 0.25\jlreq@zw minus 0.125\jlreq@zw}
-\AtBeginDocument{
-  \jlreq@if{\ifx l\jlreq@engine\fi}{
-    \ltjsetparameter{kanjiskip=\jlreqkanjiskip}
-    \ltjsetparameter{xkanjiskip=\jlreqxkanjiskip}
-  }{
+\jlreq@if{\ifx l\jlreq@engine\fi}{
+  \AtBeginDocument{%
+    \ltjsetparameter{kanjiskip=\jlreqkanjiskip}%
+    \ltjsetparameter{xkanjiskip=\jlreqxkanjiskip}%
+  }
+}{
+  \AtBeginDocument{%
     \kanjiskip=\jlreqkanjiskip
     \xkanjiskip=\jlreqxkanjiskip
   }
@@ -652,7 +665,7 @@
     \dimexpr\directlua{
       local act = string.char(92)
       local s = [[#1]]
-      s = s:gsub("Q",act .. "dimexpr 0.25mm" .. act .. "relax")
+      s = s:gsub("[QH]",act .. "dimexpr 0.25mm" .. act .. "relax")
       tex.print(s)
     }\relax
   }%
@@ -702,6 +715,29 @@
 \edef\jlreq@jafontscale{\strip@pt\jlreq@resultdimen}
 \jlreq@aftercls@addtodeletecs{\jlreq@jafontscale}
 \ifx l\jlreq@engine
+  \jlreq@saveoriginalcs{DeclareFontShape}
+  \ExplSyntaxOn
+  \def\DeclareFontShape#1#2#3#4#5#6{
+    \group_begin:
+      \bool_if:nT{\str_if_eq_p:nn{#1}{JY3} || \str_if_eq_p:nn{#1}{JT3}}{
+        \tl_set:Nx \l_jlreq_tmpa_tl {#5}
+        \tl_if_in:NnTF \l_jlreq_tmpa_tl {jfm=jlreq}{
+          \tl_if_in:NnTF \l_jlreq_tmpa_tl {jfm=jlreqv}{
+            \tl_replace_all:Nnn \l_jlreq_tmpa_tl {jfm=jlreqv}{jfm=jlreqv-jidori}
+          }{
+            \tl_replace_all:Nnn \l_jlreq_tmpa_tl {jfm=jlreq}{jfm=jlreq-jidori}
+          }
+          \cs_set:Nx \l_jlreq_do: {\exp_not:n{\jlreq@useoriginalcs{DeclareFontShape}{#1}{#2}{#3}{#4-jidori}}{\tl_use:N \l_jlreq_tmpa_tl}{#6}}
+        }{
+          \tl_if_in:NnT \l_jlreq_tmpa_tl {<->ssub}{
+            \cs_set:Nn \l_jlreq_do: {\jlreq@useoriginalcs{DeclareFontShape}{#1}{#2}{#3}{#4-jidori}{#5}{#6}}
+          }
+        }
+      }
+    \exp_after:wN \group_end: \l_jlreq_do:
+    \jlreq@useoriginalcs{DeclareFontShape}{#1}{#2}{#3}{#4}{#5}{#6}
+  }
+  \ExplSyntaxOff
   \DeclareFontShape{JY3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont:jfm=jlreq;script=latn;-kern}{}
   \DeclareFontShape{JY3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont:jfm=jlreq;script=latn;-kern}{}
   \DeclareFontShape{JT3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont:jfm=jlreqv;script=latn;-kern}{}
@@ -711,6 +747,11 @@
   \DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmnameg}{}
   \DeclareFontShape{\jlreq@tatekanjiencoding}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmname-v}{}
   \DeclareFontShape{\jlreq@tatekanjiencoding}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmnameg-v}{}
+  \edef\jlreq@tempa{\ifx u\jlreq@engine u\fi}
+  \DeclareFontShape{\jlreq@yokokanjiencoding}{mc}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\jlreq@tempa jlreq-jidori}{}
+  \DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\jlreq@tempa jlreqg-jidori}{}
+  \DeclareFontShape{\jlreq@tatekanjiencoding}{mc}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\jlreq@tempa jlreq-v-jidori}{}
+  \DeclareFontShape{\jlreq@tatekanjiencoding}{gt}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\jlreq@tempa jlreqg-v-jidori}{}
 \fi
 \@for\jlreq@encoding:=\jlreq@yokokanjiencoding,\jlreq@tatekanjiencoding\do{
   \@for\jlreq@shape:=n,it,sl,sc\do{
@@ -761,10 +802,10 @@
 \edef\jlreq@charlist@katakana{アイウエオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモヤユヨラリルレロワヰヱヲンヴ\ifx p\jlreq@engine\else ヷヸヹヺ\fi}% カ゚キ゚ク゚ケ゚コ゚セ゚ツ゚ト゚
 
 %.. 行頭括弧調整
-\ifx l\jlreq@endgine
+\ifx l\jlreq@engine
   % \item後の行頭括弧のために仕込み．
-  \jlreq@saveoriginalcs{\list}
-  \jlreq@saveoriginalcs{\endlist}
+  \jlreq@saveoriginalcs{list}
+  \jlreq@saveoriginalcs{endlist}
   \PushPostHook{par}{\jlreq@parhook@atbeginlist}
   \pretocmd{\list}{\def\jlreq@parhook@atbeginlist{\ltjfakeparbegin}}{}{}
   \apptocmd{\endlist}{\def\jlreq@parhook@atbeginlist{}}{}{}
@@ -992,10 +1033,9 @@
 \DeclareRobustCommand*{\mit}{\@fontswitch\relax\mathnormal}
 
 % 和文ファミリと欧文ファミリの連動
-\@ifundefined{@rmfamilyhook}{}{\g@addto@macro\@rmfamilyhook{\prepare@family@series@update@kanji{mc}\mcdefault}}
-\@ifundefined{@sffamilyhook}{}{\g@addto@macro\@sffamilyhook{\prepare@family@series@update@kanji{gt}\gtdefault}}
-\@ifundefined{@ttfamilyhook}{}{\g@addto@macro\@ttfamilyhook{\prepare@family@series@update@kanji{gt}\gtdefault}}
-
+\AddToHook{rmfamily}{\prepare@family@series@update@kanji{mc}\mcdefault}
+\AddToHook{sffamily}{\prepare@family@series@update@kanji{gt}\gtdefault}
+\AddToHook{ttfamily}{\prepare@family@series@update@kanji{gt}\gtdefault}
 
 % 数式フォント設定
 \ifjlreq@option@enablejfam
@@ -1077,7 +1117,7 @@
     \dimexpr\directlua{
       local act = string.char(92)
       local s = [[\jlreq@option@baselineskip]]
-      s = s:gsub("Q",act .. "dimexpr 0.25mm" .. act .. "relax"):gsub("zh",act .. "zh"):gsub("zw",act .. "zw")
+      s = s:gsub("[QH]",act .. "dimexpr 0.25mm" .. act .. "relax"):gsub("zh",act .. "zh"):gsub("zw",act .. "zw")
       tex.print(s)
     }\relax
   }%
@@ -1094,7 +1134,7 @@
 \emergencystretch 3\jlreq@gol
 \setlength{\parindent}{1\zw}
 \def\jlreq@setfontsizehook{}
-\jlreq@saveoriginalcs{\set@fontsize}
+\jlreq@saveoriginalcs{set@fontsize}
 \apptocmd{\set@fontsize}{\expandafter\def\expandafter\size@update\expandafter{\size@update\jlreq@setfontsizehook}}{}{}
 \appto\jlreq@setfontsizehook{\ifdim\parindent>0pt \setlength{\parindent}{1\jlreq@zw}\fi}
 \ifx l\jlreq@engine
@@ -1553,10 +1593,9 @@
 % デフォルトでは\<命令名>markと\addcontentslineが必要ならば呼ばれる．
 
 % 見出しの直前に実行される
-\newcommand*{\jlreq@hook@beforeheadings}[1]{}
+\NewHook{./heading/before}
 % 見出し名一覧を格納する
 \def\jlreq@heading@allheadings{}
-
 % 目次を出力する命令\l@<命令名>を作る命令を作る．{1 = 命令名}{2 = レベル}{3 = ラベルのフォーマット}
 % 結果は\jlreq@resultに入る．
 \def\jlreq@heading@make@l@#1#2#3{%
@@ -1609,6 +1648,7 @@
 %.. 中/半扉見出し
 % addcontentslineに渡すやつ：番号出すのと出さないの
 \newcommand{\DeclareTobiraHeading}[3]{%
+  \IfHookExistsTF{jlreq/heading/before/#1}{}{\NewHook{./heading/before/#1}}%
   \def\jlreq@do{\@removeelement{#1}}%
   \expandafter\jlreq@do\expandafter{\jlreq@heading@allheadings}{\jlreq@heading@allheadings}%
   \appto{\jlreq@heading@allheadings}{,#1}%
@@ -1690,7 +1730,11 @@
         \unexpanded{\if@twocolumn\onecolumn\@restonecoltrue\else\@restonecolfalse\fi\cleartooddpage[empty]}%
         \ifx\jlreq@pagestyle\@empty\else\noexpand\thispagestyle{\expandonce{\jlreq@pagestyle}}\fi
         \noexpand\secdef{\expandonce{\csname jlreq@TobiraHeading@start@#1\endcsname}}{\expandonce{\csname jlreq@TobiraHeading@start@s@#1\endcsname}}}%
-      \noexpand\def\expandonce{\csname #1\endcsname}{\expandonce{\csname jlreq@headingcs@#1\endcsname}}%
+      \noexpand\def\expandonce{\csname #1\endcsname}{%
+        \noexpand\UseHook{jlreq/heading/before}%
+        \noexpand\UseHook{jlreq/heading/before/#1}%
+        \expandonce{\csname jlreq@headingcs@#1\endcsname}%
+      }%
     }%
   \expandafter\endgroup
   \jlreq@do
@@ -2118,6 +2162,7 @@
 % \DeclareBlockHeading{命令名}{レベル}{設定}
 \def\jlreq@BlockHeading@allheadings{}% 別行見出し一覧
 \newcommand{\DeclareBlockHeading}[3]{%
+  \IfHookExistsTF{jlreq/heading/before/#1}{}{\NewHook{jlreq/heading/before/#1}}%
   \def\jlreq@do{\@removeelement{#1}}%
   \expandafter\jlreq@do\expandafter{\jlreq@heading@allheadings}{\jlreq@heading@allheadings}%
   \appto\jlreq@heading@allheadings{,#1}%
@@ -2360,7 +2405,8 @@
     \edef\jlreq@do{%
       \expandonce{\jlreq@do}%
       \noexpand\edef\expandonce{\csname jlreq@headingcs@#1\endcsname}{\noexpand\unexpanded{%
-        \noexpand\jlreq@hook@beforeheadings{#1}%
+        \noexpand\UseHook{jlreq/heading/before}%
+        \noexpand\UseHook{jlreq/heading/before/#1}%
         \expandonce{\jlreq@pagebreak}%
         \unexpanded{\jlreq@BlockHeading@start{#1}{#2}}%
         {{\expandonce{\jlreq@align}}{\expandonce{\jlreq@indent}}{\expandonce{\jlreq@end@indent}}\expandonce{\jlreq@spaceset}{\expandonce{\jlreq@allowbreak@evenpage}}}%
@@ -2729,6 +2775,7 @@
 
 % \DeclareRuninHeading{命令名}{レベル}{設定}
 \newcommand*{\DeclareRuninHeading}[3]{%
+  \IfHookExistsTF{jlreq/heading/before/#1}{}{\NewHook{jlreq/heading/before/#1}}%
   \def\jlreq@do{\@removeelement{#1}}%
   \expandafter\jlreq@do\expandafter{\jlreq@heading@allheadings}{\jlreq@heading@allheadings}%
   \appto\jlreq@heading@allheadings{,#1}%
@@ -2787,7 +2834,8 @@
       % パラメータトークンを含むので，\edefして\unexpandedで包む
       \noexpand\edef\expandonce{\csname #1\endcsname}{%
         \noexpand\unexpanded{%
-          \unexpanded{\jlreq@hook@beforeheadings{#1}}%
+          \noexpand\UseHook{jlreq/heading/before}%
+          \noexpand\UseHook{jlreq/heading/before/#1}%
           \unexpanded{\jlreq@RuninHeading@start{#1}{#2}}{\ifjlreq@number\else -\fi}{\expandonce{\jlreq@label@format}}{\expandonce{\jlreq@format@wlabel}}{\expandonce{\jlreq@format@wolabel}}%
         }%
       }%
@@ -2876,6 +2924,7 @@
 }
 
 \newcommand*{\DeclareCutinHeading}[3]{%
+  \IfHookExistsTF{jlreq/heading/before/#1}{}{\NewHook{jlreq/heading/before/#1}}%
   \expandafter\def\csname jlreq@heading@level@#1\endcsname{#2}%
   \expandafter\def\csname jlreq@heading@setting@#1\endcsname{#3}%
   \expandafter\def\csname jlreq@heading@type@#1\endcsname{\RenewCutinHeading}%
@@ -2897,6 +2946,8 @@
     }{}%
     \edef\jlreq@do{%
       \noexpand\def\expandonce{\csname #1\endcsname}{%
+        \noexpand\UseHook{jlreq/heading/before}%
+        \noexpand\UseHook{jlreq/heading/before/#1}%
         \noexpand\jlreq@CutinHeading@start{#1}{\expandonce{\jlreq@fontcommand}}{\expandonce{\jlreq@indent}}{\expandonce{\jlreq@after@space}}{\expandonce{\jlreq@onelinemax}}{\expandonce{\jlreq@twolinemax}}%
       }%
     }%
@@ -3130,8 +3181,8 @@
 \fi
 
 % \footnoteと\footnotemarkの前後に\jlreq@hook@prenote/\jlreq@hook@postnoteを入れる
-\jlreq@saveoriginalcs{\footnote}
-\jlreq@saveoriginalcs{\footnotemark}
+\jlreq@saveoriginalcs{footnote}
+\jlreq@saveoriginalcs{footnotemark}
 \long\def\jlreq@footnotetext@for@footnote[#1]#2{%
   \def\jlreq@result{\footnotetext[#1]{#2}}%
 }
@@ -3147,11 +3198,11 @@
   \@ifnextchar[{\jlreq@footnotemark@impl@woption}{\jlreq@footnotemark@impl@wooption}%
 }
 \long\def\jlreq@footnotemark@impl@woption[#1]{%
-  \jlreq@useoriginalcs{\footnotemark}[#1]%
+  \jlreq@useoriginalcs{footnotemark}[#1]%
   \jlreq@hook@postnote
 }
 \long\def\jlreq@footnotemark@impl@wooption{%
-  \jlreq@useoriginalcs{\footnotemark}%
+  \jlreq@useoriginalcs{footnotemark}%
   \jlreq@hook@postnote
 }
 \def\jlreq@restore@original@footnotes{%
@@ -3403,10 +3454,9 @@
 \let\@makeendmark=\@makefnmark
 
 % \theendnoteの出力を仕込む
-\apptocmd{\jlreq@hook@beforeheadings}{\jlreq@endnote@hook@beforeheadings{#1}}{}{}
-
 \jlreq@jlreqsetup@add{endnote_position}{
-  \def\jlreq@endnote@hook@beforeheadings##1{}
+  \AddToHook{jlreq/heading/before}[jlreq/endnote]{}
+  \RemoveFromHook{jlreq/heading/before}[jlreq/endnote]
   \jlreq@tempafalse % headingsが指定された
   \jlreq@tempbfalse % paragraphが指定された
   % \jlreq@tempcにセクション名たちを入れていく
@@ -3436,17 +3486,13 @@
   \fi
 
   \ifjlreq@tempa
-    \apptocmd{\jlreq@endnote@hook@beforeheadings}{\theendnotes}{}{}
+    \AddToHook{jlreq/heading/before}[jlreq/endnote]{\theendnotes}
   \else
     \@for\@tempa:=\jlreq@tempc\do{
       \ifx\@tempa\@empty\else
-        \edef\jlreq@do{%
-          \unexpanded{\def\jlreq@endnote@hook@beforeheadings##1}{\expandonce{\jlreq@endnote@hook@beforeheadings{##1}}%
-            \unexpanded{\def\@tempa}{\@tempa}\unexpanded{\def\@tempb{##1}}%
-            \unexpanded{\ifx\@tempa\@tempb\theendnotes\fi}%
-          }
-        }
-        \jlreq@do
+        \AddToHook{jlreq/heading/before/\@tempa}[jlreq/endnote]{}
+        \RemoveFromHook{jlreq/heading/before/\@tempa}[jlreq/endnote]
+        \AddToHook{jlreq/heading/before/\@tempa}[jlreq/endnote]{\theendnotes}
       \fi
     }
   \fi
@@ -4962,11 +5008,8 @@
 %. 箇条書き． cf. JISX4051 8.4
 % 用語定義型
 \newenvironment{description}{\list{}{%
-  \setlength{\leftmargin}{0pt}% 下げない
-  \setlength{\labelwidth}{0pt}%
-  \setlength{\labelsep}{1\jlreq@zw}
-%  \addtolength{\leftmargin}{\leftskip}% たぶんこの二行いらない……
-%  \addtolength{\leftmargin}{\labelsep}%
+  \setlength{\labelsep}{1\jlreq@zw}%
+  \setlength{\labelwidth}{\dimexpr\leftmargin - \labelsep\relax}%
   \let\makelabel=\descriptionlabel
 % 同行じゃない場合はこんな感じ？
 %  \let\jlreq@original@@item=\@item
@@ -5069,27 +5112,33 @@
 
 \newenvironment{verse}
   {\let\\\@centercr
-  \list{}{\itemsep\z@ \itemindent -2\jlreq@mol
+  \list{}{\itemsep\z@ \itemindent -2\jlreq@zw
     \listparindent\itemindent
     \labelwidth\z@
     \labelsep\z@
     \leftmargin=\dimexpr\jlreq@quote@indent\relax
-    \addtolength{\leftmargin}{2\jlreq@mol}%
+    \addtolength{\leftmargin}{2\jlreq@zw}%
     \rightmargin=\dimexpr\jlreq@quote@end@indent\relax
-    \jlreq@quote@fontsize
-    \@tempdima=1\jlreq@zw
+    \begingroup
+      \jlreq@quote@fontsize
+      \edef\jlreq@do{\noexpand\@tempdima=\the\dimexpr1\jlreq@zw\relax\relax}%
+    \expandafter\endgroup
+    \jlreq@do
     \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax
     \@tempdimc=\@tempdimb
     \divide\@tempdimb by \@tempdima\multiply\@tempdimb by \@tempdima
     \topsep=\dimexpr\jlreq@quote@beforeafter@space\relax
     \leftmargin=\dimexpr\leftmargin + \@tempdimc - \@tempdimb\relax}%
-    \item\relax}{\endlist}
+    \item\relax\jlreq@quote@fontsize}{\endlist}
 \newenvironment{quotation}
   {\list{}{%
     \leftmargin=\dimexpr\jlreq@quote@indent\relax
     \rightmargin=\dimexpr\jlreq@quote@end@indent\relax
-    \jlreq@quote@fontsize
-    \@tempdima=1\jlreq@zw
+    \begingroup
+      \jlreq@quote@fontsize
+      \edef\jlreq@do{\noexpand\@tempdima=\the\dimexpr1\jlreq@zw\relax\relax}%
+    \expandafter\endgroup
+    \jlreq@do
     \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax
     \@tempdimc=\@tempdimb
     \divide\@tempdimb by \@tempdima\multiply\@tempdimb by \@tempdima
@@ -5100,13 +5149,16 @@
     \labelsep\z@
     \topsep=\dimexpr\jlreq@quote@beforeafter@space\relax
     \parsep\z@ \@plus.1\jlreq@gol}%
-    \item\relax}{\endlist}
+    \item\relax\jlreq@quote@fontsize}{\endlist}
 \newenvironment{quote}
   {\list{}{%
     \leftmargin=\dimexpr\jlreq@quote@indent\relax
     \rightmargin=\dimexpr\jlreq@quote@end@indent\relax
-    \jlreq@quote@fontsize
-    \@tempdima=1\jlreq@zw
+    \begingroup
+      \jlreq@quote@fontsize
+      \edef\jlreq@do{\noexpand\@tempdima=\the\dimexpr 1\jlreq@zw\relax\relax}%
+    \expandafter\endgroup
+    \jlreq@do
     \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax
     \@tempdimc=\@tempdimb
     \divide\@tempdimb by \@tempdima\multiply\@tempdimb by \@tempdima
@@ -5115,12 +5167,12 @@
     \itemindent\z@
     \topsep=\jlreq@speciallength{\jlreq@quote@beforeafter@space}%
     \listparindent\z@}%
-    \item\relax}{\endlist}
+    \item\relax\jlreq@quote@fontsize}{\endlist}
 
 %. 表関係 4.4
 % 表内の行間を0にする（4.4.3.f）
-\jlreq@saveoriginalcs{\tabular}
-\jlreq@saveoriginalcs{\endtabular}
+\jlreq@saveoriginalcs{tabular}
+\jlreq@saveoriginalcs{endtabular}
 \preto\tabular{\begingroup\appto\@arrayparboxrestore{\baselineskip=0pt\lineskip=0pt}}
 \appto\endtabular{\endgroup}
 % 4.4.3.e
@@ -5608,6 +5660,49 @@
   \jlreq@do
 }
 
+\ExplSyntaxOn
+\jlreq@saveoriginalcs{kanjishape}
+\ifx l\jlreq@engine
+  \cs_set:Nn \l_jlreq_tmpa:n {
+    \NewDocumentCommand{\jidori}{m m}{
+      \mode_if_vertical:TF{\leavevmode}{}
+      \group_begin:
+        \ltj@setpar@global
+        \ltjsetkanjiskip 0pt~plus~1fil~minus~0pt
+        \ltjsetxkanjiskip 0pt~plus~1fil~minus~0pt
+        \renewcommand*{\jlreqkanjiskip}{0pt~plus~1fil~minus~0pt}
+        \renewcommand*{\jlreqxkanjiskip}{0pt~plus~1fil~minus~0pt}
+        \hbox_to_wd:nn {##1}{
+          \def#1{　}
+          \kanjishape{n-jidori}\selectfont
+          \def\kanjishape####1{\jlreq@useoriginalcs{kanjishape}{####1-jidori}}
+          ##2
+          \hskip\glueexpr 0pt~minus~1fil\relax
+        }
+      \group_end:
+    }
+  }
+  \catcode`　=\active
+  \l_jlreq_tmpa:n{　}
+  \catcode`　=12
+\else
+  \NewDocumentCommand{\jidori}{m m}{
+    \mode_if_vertical:TF{\leavevmode}{}
+    \group_begin:
+      \setlength{\kanjiskip}{0pt~plus~15zw~minus~0pt}
+      \setlength{\xkanjiskip}{0pt~plus~15zw~minus~0pt}
+      \renewcommand*{\jlreqkanjiskip}{0pt~plus~15zw~minus~0pt}
+      \renewcommand*{\jlreqxkanjiskip}{0pt~plus~15zw~minus~0pt}
+      \hbox_to_wd:nn {#1}{
+        \kanjishape{n-jidori}\selectfont
+        \inhibitglue #2
+        \hskip\glueexpr 0pt~minus~1fil\relax
+      }
+    \group_end:
+  }
+\fi
+\ExplSyntaxOff
+
 % 日にち
 \newif\if西暦
 \def\西暦{\西暦true}
@@ -5660,8 +5755,8 @@
 \minute=\numexpr\time - 60*\hour\relax
 
 %.. 定理環境
-\jlreq@saveoriginalcs{\@begintheorem}
-\jlreq@saveoriginalcs{\@opargbegintheorem}
+\jlreq@saveoriginalcs{@begintheorem}
+\jlreq@saveoriginalcs{@opargbegintheorem}
 \def\@begintheorem#1#2{\topsep=\dimexpr\jlreq@theorem@beforeafter@space\relax
   \trivlist\labelsep=1\jlreq@zw
   \itemindent=\dimexpr\jlreq@theorem@indent\relax
@@ -5672,9 +5767,9 @@
   \itemindent=\dimexpr\jlreq@theorem@indent\relax
   \jlreq@theorem@font
   \item[\hskip \labelsep{\reset@font\jlreq@theorem@label@font #1\ #2（#3）}]}
-\AtEndOfPackageFile*{amsthm}{%
-  \jlreq@saveoriginalcs{\proof}%
-  \jlreq@saveoriginalcs{\endproof}%
+\AddToHook{package/after/amsthm}{
+  \jlreq@saveoriginalcs{proof}%
+  \jlreq@saveoriginalcs{endproof}%
   \edef\jlreq@do{
     \unexpanded{\def\jlreq@proof[#1]}{%
       \unexpanded{\labelsep=1\jlreq@zw}%
@@ -5739,8 +5834,8 @@
   \if@twoside\ModifyHeading{subsection}{allowbreak_if_evenpage=true}\fi
   \NewBlockHeading{subsubsection}{3}{font={\jlreq@keepbaselineskip{\normalsize}},indent=10\jlreq@zw,lines=1,before_lines=1,subtitle_break=false,after_label_space=1\jlreq@zw,second_heading_text_indent={-1\jlreq@zw,1\jlreq@zw},,subtitle_font={\jlreq@keepbaselineskip{\scriptsize}}}
   \if@twoside\ModifyHeading{subsubsection}{allowbreak_if_evenpage=true}\fi
-  \NewRuninHeading{paragraph}{4}{font={\jlreq@keepbaselineskip{\normalsize}}}
-  \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize}},indent=1\jlreq@zw}
+  \NewRuninHeading{paragraph}{4}{font={\jlreq@keepbaselineskip{\normalsize}\sffamily\gtfamily\bfseries}}
+  \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize}\sffamily\gtfamily\bfseries},indent=1\jlreq@zw}
 \else% yoko
   \renewcommand{\thepart}{\Roman{part}}
   \renewcommand{\thesubsection}{\thesection .\arabic{subsection}}
-- 
cgit v1.2.3

