summaryrefslogtreecommitdiff
path: root/macros/jptex/latex/jlreq/jlreq.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/jptex/latex/jlreq/jlreq.cls')
-rw-r--r--macros/jptex/latex/jlreq/jlreq.cls287
1 files changed, 165 insertions, 122 deletions
diff --git a/macros/jptex/latex/jlreq/jlreq.cls b/macros/jptex/latex/jlreq/jlreq.cls
index 1d0d498877..b285102585 100644
--- a/macros/jptex/latex/jlreq/jlreq.cls
+++ b/macros/jptex/latex/jlreq/jlreq.cls
@@ -5,10 +5,10 @@
%%
% (based on JLReq 20200811 https://www.w3.org/TR/2020/NOTE-jlreq-20200811/)
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jlreq}[2023/06/19 jlreq]
+\ProvidesClass{jlreq}[2024/02/13 jlreq]
\RequirePackage{l3keys2e}
\RequirePackage{etoolbox}
-\RequirePackage{jlreq-helpers}[2023/06/19]
+\RequirePackage{jlreq-helpers}[2024/02/13]
\ExplSyntaxOn
\int_new:N \l__jlreq_tmpa_int
@@ -57,9 +57,9 @@
}
% preambleにいるかのスイッチ
-\newif\ifjlreq@preamble
-\jlreq@preambletrue
-\AtBeginDocument{\jlreq@preamblefalse}
+\bool_new:N \g__jlreq_inpreamble_bool
+\bool_gset_true:N \g__jlreq_inpreamble_bool
+\AtBeginDocument{ \bool_gset_false:N \g__jlreq_inpreamble_bool }
\def\jlreq@saveoriginalcs#1{%
\@ifundefined{#1}{
@@ -482,6 +482,7 @@
% http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1508&parent=8435
\if@tate\AtEndPreamble{\par}\fi
\fi
+% \zwや\zhが再定義されても動くようにするために内部では\jlreq@zw,\jlreq@zhを使う.
\let\jlreq@zw=\zw
\let\jlreq@zh=\zh
\if@tate
@@ -529,8 +530,8 @@
% 組方向を判定
% \jlreq@if(y|t)(dir|box)を定義する.
\jlreq@if{\ifx l\jlreq@engine\fi}{
- \def\jlreq@ifydir { \int_compare:nTF { \ltjgetparameter{direction} == 4 } }
- \def\jlreq@iftdir { \int_compare:nTF { (\ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8) == 3 } }
+ \def\jlreq@ifydir { \int_compare:nTF { \ltjgetparameter{direction} == 4 } }
+ \def\jlreq@iftdir { \int_compare:nTF { (\ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8) == 3 } }
\def\jlreq@ifybox#1{ \int_compare:nTF { \ltjgetparameter{boxdir}{#1} == 4 } }
\def\jlreq@iftbox#1{ \int_compare:nTF { (\ltjgetparameter{boxdir}{#1}-(\ltjgetparameter{boxdir}{#1}/8)*8) == 3 } }
}{
@@ -808,37 +809,14 @@
\edef\jlreq@jafontscale{\strip@pt\jlreq@resultdimen}
\__jlreq_aftercls_addtodeletecs:N \jlreq@jafontscale
\ifx l\jlreq@engine
- \jlreq@saveoriginalcs{DeclareFontShape@}
- \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@}
- \exp_not:n { {#1} {#2} {#3} { #4-jidori } }
- { \tl_use:N \l__jlreq_tmpa_tl } { \exp_not:n {#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}
- }
- \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}{}
- \DeclareFontShape{JT3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont :jfm=jlreqv;script=latn;-kern}{}
+ \DeclareFontShape{JY3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont :jfm=jlreq;-kern}{}
+ \DeclareFontShape{JY3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont :jfm=jlreq;-kern}{}
+ \DeclareFontShape{JT3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont :jfm=jlreqv;-kern}{}
+ \DeclareFontShape{JT3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont :jfm=jlreqv;-kern}{}
+ \DeclareFontShape{JY3}{mc}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont :jfm=jlreq-jidori;-kern}{}
+ \DeclareFontShape{JY3}{gt}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont :jfm=jlreq-jidori;-kern}{}
+ \DeclareFontShape{JT3}{mc}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont :jfm=jlreqv-jidori;-kern}{}
+ \DeclareFontShape{JT3}{gt}{m}{n-jidori}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont :jfm=jlreqv-jidori;-kern}{}
\else
\DeclareFontShape{\jlreq@yokokanjiencoding}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmname}{}
\DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmnameg}{}
@@ -856,14 +834,17 @@
\clist_map_inline:nn { m,b,bx,sb,c } {% ####1 = series
\bool_if:nF { \str_if_eq_p:nn {##1} {n} && \str_if_eq_p:nn {####1} {m} } {
\DeclareFontShape{#1}{gt}{####1}{##1}{<->ssub*gt/m/n}{}
+ \DeclareFontShape{#1}{gt}{####1}{##1-jidori}{<->ssub*gt/m/n-jidori}{}
}
}
\clist_map_inline:nn { bx,b,sb } {% ####1 = series
\DeclareFontShape{#1}{mc}{####1}{##1}{<->ssub*gt/m/n}{}
+ \DeclareFontShape{#1}{mc}{####1}{##1-jidori}{<->ssub*gt/m/n-jidori}{}
}
\clist_map_inline:nn { m,c } {% ####1 = series
\bool_if:nF { \str_if_eq_p:nn {##1} {n} && \str_if_eq_p:nn {####1} {m} } {
\DeclareFontShape{#1}{mc}{####1}{##1}{<->ssub*mc/m/n}{}
+ \DeclareFontShape{#1}{mc}{####1}{##1-jidori}{<->ssub*mc/m/n-jidori}{}
}
}
}
@@ -1778,7 +1759,7 @@
\keys_set:nn { DeclareTobiraHeading:#1 } {#3}
\def\jlreq@do{}%
\ifx\jlreq@format\@undefined
- \def\jlreq@format##1##2{##1##2}%
+ \long\def\jlreq@format##1##2{##1##2}%
\fi
\edef\jlreq@formatwlabel{\noexpand\jlreq@format{\exp_not:o {\jlreq@label@format}}}%
\jlreq@heading@make@l@{#1}{#2}{\jlreq@label@format}%
@@ -2082,6 +2063,7 @@
\jlreq@ifempty{#2}{}{\unexpanded{\hsize=\dimexpr\hsize - #2\relax}}%
\jlreq@ifempty{#3}{}{\unexpanded{\hsize=\dimexpr\hsize - #3\relax}}%
\unexpanded{#4}%
+ \noexpand\par
}%
}%
}
@@ -2129,7 +2111,7 @@
% {1 = 前空き}{2 = 後ろ空き}{3 = トータル行数}{4 = 出力}
% 最後には\nobreak(と\vskip)が入っている
\long\def\jlreq@BlockHeading@start@gyodori#1#2#3#4{\par{%
- \setbox\jlreq@tempboxa=\vbox{#4}%
+ \setbox\jlreq@tempboxa=\vbox{#4\par}%
% \jlreq@tempskip(a/b)に前/後ろに入れるべき値を入れる
% #1がa:ならばその値は\jlreq@tempskipaには足さず\jlreq@tempskipcに入れておく
\jlreq@tempskipa=0pt
@@ -2226,8 +2208,8 @@
}%
\expandafter}\jlreq@do
}
-\cs_set:Nn \g__jlreq_gyodori_hook_par: {}
-\PushPostHook{par}{\g__jlreq_gyodori_hook_par:}
+%\cs_set:Nn \g__jlreq_gyodori_hook_par: {}
+%\PushPostHook{par}{\g__jlreq_gyodori_hook_par:}
% 行取り情報をゲットだぜ
@@ -2455,7 +2437,7 @@
\exp_not:o {\jlreq@heading@text@format}%
}%
% 副題:ラベルありかなしかはhangindentの扱いだけなので,他はまとめる
- \def\jlreq@make@subtitle@format##1##2{%
+ \long\def\jlreq@make@subtitle@format##1##2{%
\edef##1{%
\ifjlreq@subtitle@break
\noexpand\par
@@ -2838,7 +2820,7 @@
\jlreq@do
}
% #2: デフォルト値を使うならば*,#3#4#5が設定された値,#6#7#8がデフォルト値,#9は偶数ページの
-\def\jlreq@BlockHeading@spaces@output@@@@#1#2#3#4#5#6#7#8#9{%
+\long\def\jlreq@BlockHeading@spaces@output@@@@#1#2#3#4#5#6#7#8#9{%
\edef\jlreq@tempa{%
\unexpanded{\long\def\jlreq@tempa##1}{\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@format@\the\jlreq@tempcnta}}%
}%
@@ -2910,10 +2892,10 @@
\begingroup
\def\jlreq@do{\@nobreakfalse\global\@noskipsectrue}%
\ifnum0\jlreq@ifempty{#3}{}{1}\ifnum #2>\c@secnumdepth 1\fi>0
- \def\jlreq@tempa##1{#8}%
+ \long\def\jlreq@tempa##1{#8}%
\else
\tl_put_right:Nn \jlreq@do {\refstepcounter{#1}}%
- \def\jlreq@tempa##1{#7}%
+ \long\def\jlreq@tempa##1{#7}%
\fi
\par}%
\unexpanded{\tl_put_right:Nx \jlreq@do}{%
@@ -3366,6 +3348,7 @@
\ifx l\jlreq@engine
\fnfixbottomtrue
+ \IfFileExists{stfloats.sty}{\RequirePackage{stfloats}\fnbelowfloat}{}
\fi
% \footnoteと\footnotemarkの前後に\jlreq@hook@prenote/\jlreq@hook@postnoteを入れる
@@ -3377,7 +3360,7 @@
\def\footnote{%
\jlreq@footnote{\footnote}{\footnotemark}{\jlreq@footnotetext@for@footnote}%
}
-\def\jlreq@footnote#1#2#3{%
+\long\def\jlreq@footnote#1#2#3{%
\jlreq@hook@prenote
\@ifnextchar[{\jlreq@footnote@impl@woption{#1}{#2}{#3}}{\jlreq@footnote@impl@wooption{#1}{#2}{#3}}%
}
@@ -3602,6 +3585,8 @@
\long\def\jlreq@output@endnotes#1#2{%
\expandafter\def\csname\jlreq@endnotemarkname\endcsname{#1}%
\item\@makeendtext{#2}%
+ % グルーピングした方がよいか? https://okumuralab.org/tex/mod/forum/discuss.php?d=3669
+ % \item\leavevmode {\@makeendtext{#2}}%
}
\newcommand*{\theendnotes}{%
@@ -4009,7 +3994,7 @@
% * それ以降はX
% として整形した際に,#5行以内に収まる.
% \jlreq@resultboxに整形結果を返す(垂直ボックス).見つからなかったらvoid.\globalに設定する.
-\def\jlreq@inlinenote@determinelength#1#2#3#4#5#6#7{%
+\long\def\jlreq@inlinenote@determinelength#1#2#3#4#5#6#7{%
\begingroup
% \message{#1 の試行開始,行数 = #5, \the\dimexpr#6\relax から \the\dimexpr#7\relaxまで}%
\@tempcnta=1\relax
@@ -4200,7 +4185,7 @@
}
}
-\cs_generate_variant:Nn \__jlreq_pagestyle_applyformat:NnNN { NocN }
+\cs_generate_variant:Nn \__jlreq_pagestyle_applyformat:NnNN { NocN, NoNN }
% mark系の処理をする.
% #2: 奇数ページ柱(prop,{0,1,2}->柱の中身)
@@ -4347,9 +4332,7 @@
\tl_set:Nx \l__jlreq_tmpb_tl { \exp_args:No \exp_not:n {\use_ii:nn ##1} } % 中身
\tl_put_right:Nx \l__jlreq_result_tl {
\exp_not:N \hbox to~0pt {
- \exp_not:n {\hskip\glueexpr\headsep + \headheight}
- \legacy_if:nF { @tate } { \exp_not:n {+ \topskip - \Cht} }
- \tl_if_empty:oF \l__jlreq_tmpa_tl { + \exp_not:o \l__jlreq_tmpa_tl } \exp_not:N \relax
+ \tl_if_empty:oF \l__jlreq_tmpa_tl { \exp_not:n { \hskip\dimexpr } \exp_not:o \l__jlreq_tmpa_tl \exp_not:N \relax }
\exp_not:o \l__jlreq_tmpb_tl
\exp_not:N \hss
}
@@ -4586,51 +4569,52 @@
%#3: 左
%#4: 真ん中
%#5: 右
+% #6: フォーマット,#7: デフォルトフォーマット
% #1に返す.
-\cs_set:Nn \__jlreq_pagestyle_concat_left_center_right:Nnnnn {
+\cs_set:Nn \__jlreq_pagestyle_concat_left_center_right:NnnnnNN {
\str_if_eq:nnTF {#2} {odd} {
- \__jlreq_pagestyle_concat_left_center_right_aux:Nnnn #1 {#3} {#4} {#5}
+ \__jlreq_pagestyle_concat_left_center_right_aux:NnnnNN #1 {#3} {#4} {#5} #6 #7
}{
% evenでは左右入れ替え
- \__jlreq_pagestyle_concat_left_center_right_aux:Nnnn #1 {#5} {#4} {#3}
+ \__jlreq_pagestyle_concat_left_center_right_aux:NnnnNN #1 {#5} {#4} {#3} #6 #7
}
}
-\cs_generate_variant:Nn \__jlreq_pagestyle_concat_left_center_right:Nnnnn { Nneee }
+\cs_generate_variant:Nn \__jlreq_pagestyle_concat_left_center_right:NnnnnNN { NneeecN }
% #2: 左,#3: 真ん中,#4: 右をくっつける
+% #5: フォーマット,#6: デフォルトフォーマット
% #1に返す
-\cs_set:Nn \__jlreq_pagestyle_concat_left_center_right_aux:Nnnn {
+\cs_set:Nn \__jlreq_pagestyle_concat_left_center_right_aux:NnnnNN {
\group_begin:
- \tl_set:Nn \l__jlreq_tmpa_tl {} % 左
- \tl_set:Nn \l__jlreq_tmpb_tl {} % 右
- \tl_set:Nn \l__jlreq_tmpc_tl {} % 戻り値
+ % \l__jlreq_tmpa_tlにくっつけたモノを入れる
+ \tl_if_empty:nTF {#3} {
+ \bool_if:nF { \tl_if_empty_p:n {#2} && \tl_if_empty_p:n {#4} } {
+ \tl_set:Nn \l__jlreq_tmpa_tl { #2 \hfill #4 }
+ }
+ }{
+ % 真ん中のを完全に真ん中に配置するために左右の幅を0にしておく
+ \tl_set:Nx \l__jlreq_tmpa_tl {
+ \tl_if_empty:nF { #2 } { \exp_not:n { \hbox to~0pt { #2 \hss } } }
+ \exp_not:N \hfill \exp_not:n {#3} \exp_not:N \hfill
+ \tl_if_empty:nF { #4 } { \exp_not:n { \hbox to~0pt { \hss #4 } } }
+ }
+ }
+ % \l__jlreq_tmpa_tlにフォーマットを適用し\l__jlreq_tmpa_tlに代入
+ \__jlreq_pagestyle_applyformat:NoNN \l__jlreq_tmpa_tl \l__jlreq_tmpa_tl #5 #6
+ % 横方向の調整
\tl_if_empty:nF {#2} {
\bool_if:nT { ( !\dim_compare_p:nNn {\jlreq@headfoot@sidemargin}={0pt} ) || \legacy_if_p:n {@tate} }{
- \tl_set:Nx \l__jlreq_tmpa_tl { \exp_not:n {\hskip\dimexpr} \jlreq@expand@speciallength{\jlreq@headfoot@sidemargin} \legacy_if:nT { @tate } { \exp_not:n { -\Cdp } } \exp_not:N \relax }
+ \tl_put_left:Nx \l__jlreq_tmpa_tl { \exp_not:n {\hskip\dimexpr} \jlreq@expand@speciallength{\jlreq@headfoot@sidemargin} \legacy_if:nT { @tate } { \exp_not:n { -\Cdp } } \exp_not:N \relax }
}
- \tl_put_right:Nn \l__jlreq_tmpa_tl {#2}
}
\tl_if_empty:nF {#4} {
- \tl_set:Nn \l__jlreq_tmpb_tl {#4}
% \jlreq@headfoot@sidemargin = 0ptの時に本文の右に一致させるための補正.
\bool_if:nT { ( !\dim_compare_p:nNn {\jlreq@headfoot@sidemargin}={0pt} ) || \legacy_if_p:n {@tate} }{
- \tl_put_right:Nx \l__jlreq_tmpb_tl { \exp_not:n {\hskip\dimexpr} \jlreq@expand@speciallength{\jlreq@headfoot@sidemargin} \legacy_if:nT { @tate } { \exp_not:n { + \topskip - \Cht } } \exp_not:N \relax }
+ \tl_put_right:Nx \l__jlreq_tmpa_tl { \exp_not:n {\hskip\dimexpr} \jlreq@expand@speciallength{\jlreq@headfoot@sidemargin} \legacy_if:nT { @tate } { \exp_not:n { + \topskip - \Cht } } \exp_not:N \relax }
}
}
- \tl_if_empty:nTF {#3} {
- \bool_if:nF { \tl_if_empty_p:n {#2} && \tl_if_empty_p:n {#4} } {
- \tl_set:Nx \l__jlreq_tmpc_tl { \exp_not:o \l__jlreq_tmpa_tl \exp_not:N \hfil \exp_not:o \l__jlreq_tmpb_tl }
- }
- }{
- % 真ん中のを完全に真ん中に配置するために左右の幅を0にしておく
- \tl_if_empty:nF { #2 } { \tl_set:Nx \l__jlreq_tmpa_tl { \exp_not:N \hbox to~0pt { \exp_not:o { \l__jlreq_tmpa_tl } \exp_not:N \hss } } }
- \tl_if_empty:nF { #4 } { \tl_set:Nx \l__jlreq_tmpb_tl { \exp_not:N \hbox to~0pt { \exp_not:N \hss \exp_not:o { \l__jlreq_tmpb_tl } } } }
- \tl_set:Nx \l__jlreq_tmpc_tl {
- \exp_not:o \l__jlreq_tmpa_tl\exp_not:N \hfil \exp_not:n {#3} \exp_not:N \hfil \exp_not:o \l__jlreq_tmpb_tl
- }
- }
- \tl_set:Nx \l__jlreq_do_tl { \exp_not:n {\tl_set:Nn #1 } { \exp_not:o \l__jlreq_tmpc_tl } }
+ \tl_set:Nx \l__jlreq_do_tl { \exp_not:n {\tl_set:Nn #1 } { \exp_not:o \l__jlreq_tmpa_tl } }
\exp_after:wN \group_end:
\l__jlreq_do_tl
}
@@ -4885,16 +4869,24 @@
% ノンブル→\l__jlreq_tmpb_tl
\__jlreq_pagestyle_maketate_nombre:NNNNo \l__jlreq_tmpb_tl \l__jlreq_pagestyle_nombre_prop \l__jlreq_pagestyle_nombre_font_prop \l__jlreq_pagestyle_nombre_position_prop \l__jlreq_pagestyle_nombre_gap_tl
% 柱とノンブルを結合→\l__jlreq_tmpa_tl
- \tl_set:Nx \l__jlreq_tmpa_tl { \exp_not:o \l__jlreq_tmpa_tl \exp_not:N \hfil \exp_not:o \l__jlreq_tmpb_tl }
+ \tl_set:Nx \l__jlreq_tmpa_tl { \exp_not:o \l__jlreq_tmpa_tl \exp_not:N \hfill \exp_not:o \l__jlreq_tmpb_tl }
% formatを適用.
\tl_set:Nn \l__jlreq_tmpb_tl {####1} % デフォルトフォーマット
\__jlreq_pagestyle_applyformat:NocN \l__jlreq_tmpa_tl \l__jlreq_tmpa_tl { l__jlreq_pagestyle_##1_top_format_tl } \l__jlreq_tmpb_tl
% 周りのボックスをつける.結果は\l__jlreq_tmpa_propにいれる.
+ % \topskip > 最初のボックスの高さを仮定する.
\prop_put:Nnx \l__jlreq_tmpa_prop { ##1-top } {
\exp_not:n {\setbox\@tempboxa=\hbox to \dimexpr\headsep + \headheight + \textheight}
- \legacy_if:nF { @tate } { \exp_not:n { - \topskip + 1\jlreq@zh } }
+ \legacy_if:nF { @tate } { \exp_not:n { + \Cdp } }
\exp_not:N \relax
- { \exp_not:n { \tate\adjustbaseline } \exp_not:o \l__jlreq_tmpa_tl }
+ { \exp_not:n { \tate\adjustbaseline \hskip \dimexpr \headsep + \headheight }
+ \legacy_if:nF { @tate } { \exp_not:n { + \topskip - \Cht } }
+ \exp_not:N \relax
+ \hbox to \legacy_if:nF { @tate } { \exp_not:N \dimexpr }
+ \textheight
+ \legacy_if:nF { @tate } { \exp_not:n { - \topskip + 1\jlreq@zh \relax } }
+ { \exp_not:o \l__jlreq_tmpa_tl }
+ }
% Underful対策
\ifx l\jlreq@engine
\unexpanded{\wd\@tempboxa=\headheight}%
@@ -4905,13 +4897,17 @@
}
% 位置調整,左側に柱+ノンブルがある場合
\tl_set:Nx \l__jlreq_tmpa_tl {
- \exp_not:n { \hskip\dimexpr } \legacy_if:nT { @tate } { \exp_not:n { - \Cdp } } \exp_not:n { - \headsep - 1\jlreq@zw\relax }
- \exp_not:n { \box\@tempboxa\hfil }
+ \exp_not:n { \hskip\dimexpr - \headsep - 1\jlreq@zw }
+ \legacy_if:nTF { @tate } { \exp_not:n { - \Cdp } }
+ { \dim_compare:nNnF { \jlreq@sidenote@length + \jlreq@sidenote@sep } {=} { 0pt } { - \the\dimexpr\jlreq@sidenote@length + \jlreq@sidenote@sep\relax } }
+ \exp_not:n { \relax\box\@tempboxa\hfill }
}
% 位置調整,右側に柱+ノンブルがある場合
\tl_set:Nx \l__jlreq_tmpb_tl {
- \exp_not:n { \hskip\dimexpr\textwidth } \legacy_if:nT { @tate } { \exp_not:n { - \topskip + \Cht } } \exp_not:n { + \headsep\relax }
- \exp_not:n { \box\@tempboxa\hss }
+ \exp_not:n { \hskip\dimexpr\textwidth + \headsep }
+ \legacy_if:nTF { @tate } { \exp_not:n { - \topskip + \Cht } }
+ { \dim_compare:nNnF { \jlreq@sidenote@length + \jlreq@sidenote@sep } {=} { 0pt } { + \the\dimexpr\jlreq@sidenote@length + \jlreq@sidenote@sep\relax } }
+ \exp_not:n { \relax\box\@tempboxa\hss }
}
% 位置調整とすでに構築したブロックをくっつける.
\legacy_if:nTF { @tate } {
@@ -4978,14 +4974,13 @@
\prop_put:Nno \l__jlreq_tmpb_prop {########1} \l__jlreq_tmpa_tl
}
% 左,中央,右を結合し\l__jlreq_tmpa_tlへ
- \__jlreq_pagestyle_concat_left_center_right:Nneee \l__jlreq_tmpa_tl {##1} {\prop_item:Nn \l__jlreq_tmpb_prop {left} } {\prop_item:Nn \l__jlreq_tmpb_prop {center} } {\prop_item:Nn \l__jlreq_tmpb_prop {right} }
% デフォルトのフォーマットの設定
\bool_if:nTF { \dim_compare_p:n { \jlreq@sidenote@length > 0pt } && (! \legacy_if_p:n { @tate } ) }{
\tl_set:Nn \l__jlreq_tmpb_tl {\hss\hbox to \jlreqyokoheadlength{########1}\hss}
}{
\tl_set:Nn \l__jlreq_tmpb_tl {########1}
}
- \__jlreq_pagestyle_applyformat:NocN \l__jlreq_tmpa_tl \l__jlreq_tmpa_tl { l__jlreq_pagestyle_##1_####1_format_tl } \l__jlreq_tmpb_tl
+ \__jlreq_pagestyle_concat_left_center_right:NneeecN \l__jlreq_tmpa_tl {##1} {\prop_item:Nn \l__jlreq_tmpb_prop {left} } {\prop_item:Nn \l__jlreq_tmpb_prop {center} } {\prop_item:Nn \l__jlreq_tmpb_prop {right} } { l__jlreq_pagestyle_##1_####1_format_tl } \l__jlreq_tmpb_tl
% 傍注用調整
\dim_compare:nNnT {\jlreq@sidenote@length}>{0pt} {
\legacy_if:nF { @tate } {
@@ -5029,7 +5024,7 @@
}
\if@tate
- \def\jlreqyokoheadlength{\textheight}
+ \def\jlreqyokoheadlength{\textwidth}
\else
\ifdim\jlreq@sidenote@length>0pt
\if@twocolumn
@@ -5041,7 +5036,7 @@
\def\jlreqyokoheadlength{\dimexpr\textwidth\relax}
\fi
\fi
-\edef\jlreqtateheadlength{\unexpanded{\dimexpr\headsep + \headheight + \textheight}\if@tate\else\unexpanded{- \topskip + 1\jlreq@zh}\fi\noexpand\relax}
+\edef\jlreqtateheadlength{\unexpanded{\dimexpr\textheight}\if@tate\else\unexpanded{- \topskip + 1\jlreq@zh}\fi\noexpand\relax}
\NewDocumentCommand{\NewPageStyle} { m +m } {%
\expandafter\@ifdefinable\csname ps@#1\endcsname{\DeclarePageStyle{#1}{#2}}%
@@ -5258,11 +5253,20 @@
%.. figure環境
\newcounter{figure}
-\str_if_eq:VnTF \jlreq@article@type { article } {
- \renewcommand{\thefigure}{\@arabic\c@figure}
-}{%
- \@addtoreset{figure}{chapter}
- \renewcommand{\thefigure}{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@figure}
+\legacy_if:nTF { @tate } {
+ \str_if_eq:VnTF \jlreq@article@type { article } {
+ \renewcommand{\thefigure}{\tatechuyoko*{\@arabic\c@figure}}
+ }{%
+ \@addtoreset{table}{chapter}
+ \renewcommand{\thefigure}{\tatechuyoko*{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@figure}}
+ }
+}{
+ \str_if_eq:VnTF \jlreq@article@type { article } {
+ \renewcommand{\thefigure}{\@arabic\c@figure}
+ }{%
+ \@addtoreset{figure}{chapter}
+ \renewcommand{\thefigure}{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@figure}
+ }
}
\newcommand*{\fps@figure}{h}
\newcommand*{\ftype@figure}{1}
@@ -5273,11 +5277,20 @@
%.. table環境
\newcounter{table}
-\str_if_eq:VnTF \jlreq@article@type { article } {
- \renewcommand{\thetable}{\@arabic\c@table}
-}{%
- \@addtoreset{table}{chapter}
- \renewcommand{\thetable}{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@table}
+\legacy_if:nTF { @tate } {
+ \str_if_eq:VnTF \jlreq@article@type { article } {
+ \renewcommand{\thetable}{\tatechuyoko*{\@arabic\c@table}}
+ }{%
+ \@addtoreset{table}{chapter}
+ \renewcommand{\thetable}{\tatechuyoko*{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@table}}
+ }
+}{
+ \str_if_eq:VnTF \jlreq@article@type { article } {
+ \renewcommand{\thetable}{\@arabic\c@table}
+ }{%
+ \@addtoreset{table}{chapter}
+ \renewcommand{\thetable}{\ifnum\c@chapter>\z@\thechapter.\fi \@arabic\c@table}
+ }
}
\newcommand*{\fps@table}{h}
\newcommand*{\ftype@table}{2}
@@ -5302,6 +5315,9 @@
\fi
}
+\bool_new:N \g__jlreq_beforemaketitle_bool
+\bool_gset_true:N \g__jlreq_beforemaketitle_bool
+
\if@titlepage
\newcommand{\maketitle}{%
% jarticleとかからあまり変更していない
@@ -5379,6 +5395,7 @@
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
+ \bool_gset_false:N \g__jlreq_beforemaketitle_bool
}%
% \vskipを\baselineskipにしてみた.
\def\@maketitle{%
@@ -5410,8 +5427,11 @@
}
%.. abstract
-\def\jlreq@parhook@abstract{}
\str_if_eq:VnF \jlreq@article@type { book } {
+ \def\jlreq@parhook@abstract{}
+ \bool_new:N \g__jlreq_abstract_with_maketitle_bool
+ \keys_define:nn { jlreqsetup } { abstract_with_maketitle .bool_set:N = \g__jlreq_abstract_with_maketitle_bool }
+ \jlreqsetup { abstract_with_maketitle = false }
\newbox\jlreq@abstractbox
\newcommand*{\abstractname}{概要}
\if@titlepage
@@ -5430,21 +5450,25 @@
}
\else
\newenvironment{abstract}{%
- \ifnum0\if@twocolumn\else1\fi\ifjlreq@preamble1\fi>0
- \ifjlreq@preamble
+ \bool_if:nTF {
+ (! \legacy_if_p:n { @twocolumn } ) ||
+ \g__jlreq_inpreamble_bool ||
+ ( \g__jlreq_beforemaketitle_bool && \g__jlreq_abstract_with_maketitle_bool )
+ } {
+ \bool_if:NT \g__jlreq_inpreamble_bool {
\ifx l\jlreq@engine\else
\def\jlreq@parhook@abstract{\futurelet\jlreq@nextchar\jlreq@openbracket@hook}%
\PushPostHook{par}{\jlreq@parhook@abstract}%
\fi
- \fi
+ }
% とりあえず全部ボックスに入れる.
\global\setbox\jlreq@abstractbox=\vtop\bgroup
- \ifjlreq@preamble
+ \bool_if:NT \g__jlreq_inpreamble_bool {
% preamble後っぽく振る舞う
\@noskipsecfalse
% \@nodocumentが入っているので一時的に無効化
\everypar{}%
- \fi
+ }
\if@twocolumn
\parindent=0pt
\hsize=\textwidth
@@ -5474,11 +5498,15 @@
\parsep\z@ \@plus.1\jlreq@zh
}%
\item\relax
- \else
+ }{
\section*{\abstractname}%
- \fi
+ }
}{%
- \ifnum0\if@twocolumn\else1\fi\ifjlreq@preamble1\fi>0
+ \bool_if:nT {
+ (! \legacy_if_p:n { @twocolumn } ) ||
+ \g__jlreq_inpreamble_bool ||
+ ( \g__jlreq_beforemaketitle_bool && \g__jlreq_abstract_with_maketitle_bool )
+ } {
\endlist
\egroup
\vspace{\baselineskip}%
@@ -5486,14 +5514,18 @@
\end{minipage}
\fi
\egroup
- \fi
- \ifjlreq@preamble
+ }
+ \bool_if:NT \g__jlreq_inpreamble_bool {
\ifx l\jlreq@engine\else
\def\jlreq@parhook@abstract{}%
\fi
- \else
+ }
+ \bool_if:nF {
+ \g__jlreq_inpreamble_bool ||
+ ( \g__jlreq_beforemaketitle_bool && \g__jlreq_abstract_with_maketitle_bool )
+ }{
\unvbox\jlreq@abstractbox
- \fi
+ }
}
\fi
}
@@ -5580,7 +5612,7 @@
itemization_beforeafter_space .code:n = {\jlreq@jlreqsetup@itemization{jlreq@itemization@beforeafter@space@envlist}{jlreq@itemization@beforeafter@space@setting}{#1}},
itemization_itemsep .code:n = {\jlreq@jlreqsetup@withenv{jlreq@itemization@itemsep@envlist}{jlreq@itemization@itemsep@setting}{#1}},
itemization_labelsep .code:n = {\jlreq@jlreqsetup@withenv{jlreq@itemization@labelsep@envlist}{jlreq@itemization@labelsep@setting}{#1}},
- itemization_label_length .code:n = {\jlreq@jlreqsetup@itemization{jlreq@itemization@label@length@envlist}{jlreq@itemization@label@length@setting}{#1}}
+ itemization_label_length .code:n = {\jlreq@jlreqsetup@itemization{jlreq@itemization@label@length@envlist}{jlreq@itemization@label@length@setting}{#1}},
}
% enumerate, itemize用初期化,#1 = i,ii,...
\def\jlreq@init@list#1{%
@@ -5725,25 +5757,37 @@
\newcommand{\tableofcontents}{%
\jlreq@top@contents=-100\relax
\if@twocolumn
- \@restonecoltrue\onecolumn
+ \bool_if:NTF \g__jlreq_tableofcontents_twocolumn_bool {
+ \@restonecolfalse
+ }{
+ \@restonecoltrue\onecolumn
+ }
\else
- \@restonecolfalse
+ % スイッチの流用
+ \bool_if:NTF \g__jlreq_tableofcontents_twocolumn_bool {
+ \@restonecoltrue\twocolumn
+ }{
+ \@restonecolfalse
+ }
\fi
\prop_item:Nn \g__jlreq_tableofcontents_prop { heading }
\@mkboth{\contentsname}{\contentsname}%
\@starttoc{toc}%
- \if@restonecol\twocolumn\fi
+ \if@restonecol
+ \bool_if:NTF \g__jlreq_tableofcontents_twocolumn_bool { \onecolumn } { \twocolumn }
+ \fi
}
+\bool_new:N \g__jlreq_tableofcontents_twocolumn_bool
+\bool_gset_false:N \g__jlreq_tableofcontents_twocolumn_bool
\keys_define:nn { jlreqsetup } {
- tableofcontents_heading .code:n = { \prop_gput:Nnn \g__jlreq_tableofcontents_prop { heading } {#1} }
+ tableofcontents_heading .code:n = { \prop_gput:Nnn \g__jlreq_tableofcontents_prop { heading } {#1} },
+ tableofcontents_twocolumn .bool_gset:N = \g__jlreq_tableofcontents_twocolumn_bool
}
\str_if_eq:VnTF \jlreq@article@type { article } {
\keys_set:nn { jlreqsetup } { tableofcontents_heading = { \section*{\contentsname} } }
}{
\keys_set:nn { jlreqsetup } { tableofcontents_heading = { \chapter*{\contentsname} } }
}
-
-
% JIS X 4051自身の目次に近づけようかと……なりきれてないけど.
% 文字の大きさは全て同じ(\normalsize)にする.
@@ -5753,8 +5797,8 @@
% 「トップ」というか,一番最初に現れた見出しを入れる.
% リーダーは.から・に変更しました.
\def\@dottedtocline#1#2#3#4#5{%
- \jlreq@set@top@contents{#1}%
\ifnum #1>\c@tocdepth \else
+ \jlreq@set@top@contents{#1}%
\vskip\toclineskip
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
@@ -5772,7 +5816,8 @@
\hfill\nobreak
\hb@xt@\@pnumwidth{\hss\normalfont\normalcolor #5}%
\par}%
- \fi}
+ \fi
+}
% listoffigures
\newcommand{\listoffigures}{%
@@ -6194,7 +6239,6 @@
\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
}
@@ -6317,7 +6361,6 @@
\renewcommand{\theparagraph}{\thesubsubsection .\arabic{paragraph}}
\renewcommand{\thesubparagraph}{\theparagraph .\arabic{subparagraph}}
\str_if_eq:VnTF \jlreq@article@type { article } {
-\def\X{}
\NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE\sffamily\gtfamily\bfseries}},label_format={第\thepart 部},lines=4,after_label_space=1\jlreq@zw,second_heading_text_indent={-1\jlreq@zw,1\jlreq@zw},subtitle_font={\jlreq@keepbaselineskip{\large}}}
\renewcommand{\thesection}{\arabic{section}}
}{% book, report