diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/jlreq/jlreq.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq.cls | 145 |
1 files changed, 99 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls index 8615e3bf303..d6ce3e2eb0d 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls +++ b/Master/texmf-dist/tex/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}[2022/07/13 jlreq] +\ProvidesClass{jlreq}[2022/11/28 jlreq] \RequirePackage{l3keys2e} \RequirePackage{etoolbox} -\RequirePackage{jlreq-helpers}[2021/08/12] +\RequirePackage{jlreq-helpers}[2022/11/28] \ExplSyntaxOn \int_new:N \l__jlreq_tmpa_int @@ -1669,19 +1669,19 @@ %. 見出し関係 (4.1) % \clear***page -\NewDocumentCommand{\cleartooddpage}{ O{} }{ +\newcommand{\jlreq@cleartooddpage}[1][]{ \clearpage \ifodd\c@page\else - \jlreq@ifempty{#1}{}{\thispagestyle{#1}}% + \tl_if_empty:nF {#1} { \thispagestyle{#1} }% \hbox{}% \newpage \if@twocolumn\hbox{}\newpage\fi \fi } -\NewDocumentCommand{\cleartoevenpage}{ O{} }{ +\newcommand{\jlreq@cleartoevenpage}[1][]{ \clearpage \ifodd\c@page - \jlreq@ifempty{#1}{}{\thispagestyle{#1}}% + \tl_if_empty:nF {#1} { \thispagestyle{#1} }% \hbox{}% \newpage \if@twocolumn\hbox{}\newpage\fi @@ -1826,7 +1826,7 @@ }% \noexpand\def\exp_not:c {jlreq@headingcs@#1}{% % 改丁.これでよいのかな. - \unexpanded{\if@twocolumn\onecolumn\@restonecoltrue\else\@restonecolfalse\fi\cleartooddpage[empty]}% + \unexpanded{\if@twocolumn\onecolumn\@restonecoltrue\else\@restonecolfalse\fi\jlreq@cleartooddpage[empty]}% \ifx\jlreq@pagestyle\@empty\else\noexpand\thispagestyle{\exp_not:o {\jlreq@pagestyle}}\fi \noexpand\secdef{\exp_not:c {jlreq@TobiraHeading@start@#1}}{\exp_not:c {jlreq@TobiraHeading@start@s@#1}}}% \noexpand\def\exp_not:c {#1}{% @@ -1886,20 +1886,27 @@ % {1 = 命令}{2 = レベル}{3 = スペース関連}{4 = 全フォーマット}{5 = *}{6 = running head}{7 = 見出し}{8 = 副題} \long\def\jlreq@BlockHeading@start@@@@#1#2#3#4#5#6#7#8{% + \global\advance\jlreq@BlockHeading@spaces@current@count by 1 + \tl_gput_right:Nn \jlreq@BlockHeading@spaces@current@sequence {_#1}% \edef\jlreq@tempa##1##2##3##4##5##6##7{% \unexpanded{\jlreq@BlockHeading@start@makeoutput{#1}{#2}}{{##1}{##2}{##3}}{\exp_not:o {\jlreq@BlockHeading@start@eachformat}}{\exp_not:o {\jlreq@BlockHeading@start@format}}\unexpanded{{#5}{#6}{#7}{#8}}% \unexpanded{\def\jlreq@tempb}{{##4}{##5}{##6}}% 縦方向空き \noexpand\jlreq@ifempty{##7}{\noexpand\jlreq@tempatrue}{\noexpand\jlreq@tempafalse}% 偶数ページのみで改ページするならば\jlreq@tempatrue }% \jlreq@tempa#3% - \global\advance\jlreq@BlockHeading@spaces@current@count by 1 - \tl_gput_right:Nn \jlreq@BlockHeading@spaces@current@sequence {_#1}% + \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@afteroutsidebox@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% + \exp_not:o { \jlreq@resultc } + }% % 連続する見出しの間の処理をするために,即時では出力せず,いったんマクロに格納する. + % \jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@<n> % \jlreq@BlockHeading@spaces@current@before@<n> % \jlreq@BlockHeading@start@gyodori\jlreq@BlockHeading@spaces@current@space@<n>{jlreq@BlockHeading@spaces@current@output@<n>} % ↑\jlreq@BlockHeading@spaces@current@format@<n>で整形される. % \jlreq@BlockHeading@spaces@current@after@<n> + % \jlreq@BlockHeading@spaces@current@afteroutsidebox@<n> + % \jlreq@BlockHeading@spaces@current@afteroutsideiflast@<n> % として後に呼び出される.(spaceは書き換えられる可能性がある.) + % outsideとついているものは全体が行取りされた場合はその外に出される. \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@output@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \exp_not:o {\jlreq@resultb}% }% @@ -1907,28 +1914,31 @@ \exp_not:o {\jlreq@tempb}% }% \long\def\@tempa##1##2##3{##1}% - \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@before@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% + \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \exp_not:o {\@tempa#4}% - \exp_not:o {\jlreq@resulta}% \ifjlreq@tempa\unexpanded{% \jlreq@setcurrentpage \edef\jlreq@BlockHeading@currentpage{\the\jlreq@currentpage}% }\fi }% + \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@before@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% + \exp_not:o {\jlreq@resulta}% + }% \long\def\@tempa##1##2##3{##2}% \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@format@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \exp_not:o {\@tempa#4}% }% \long\def\@tempa##1##2##3{##3}% - \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@after@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% - \exp_not:o {\jlreq@resultc}% + \expandafter\gdef\csname jlreq@BlockHeading@spaces@current@after@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% + }% + \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@afteroutsideiflast@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \ifjlreq@tempa\unexpanded{% \ifx\jlreq@BlockHeading@currentpage\@empty\nobreak\else \ifodd\jlreq@BlockHeading@currentpage\nobreak\else\allowbreak\fi \fi }\else\noexpand\nobreak\fi \exp_not:o {\@tempa#4}% - }% + } \ifx\jlreq@BlockHeading@spaces@headingslist\@empty \expandafter\jlreq@BlockHeading@spaces@outputwospace \expandafter\ignorespaces @@ -2362,8 +2372,8 @@ pagebreak / clearpage .code:n = {\def\jlreq@pagebreak{\clearpage}\jlreq@column@spanning@possibletrue}, pagebreak / cleardoublepage .code:n = {\def\jlreq@pagebreak{\cleardoublepage}\jlreq@column@spanning@possibletrue}, pagebreak / clearcolumn .code:n = {\if@twocolumn\def\jlreq@pagebreak{\newpage}\else\def\jlreq@pagebreak{}\fi\jlreq@column@spanning@possiblefalse}, - pagebreak / begin_with_even_page .code:n = {\def\jlreq@pagebreak{\cleartoevenpage[empty]}\jlreq@column@spanning@possibletrue}, - pagebreak / begin_with_odd_page .code:n = {\def\jlreq@pagebreak{\cleartooddpage[empty]}\jlreq@column@spanning@possibletrue}, + pagebreak / begin_with_even_page .code:n = {\def\jlreq@pagebreak{\jlreq@cleartoevenpage[empty]}\jlreq@column@spanning@possibletrue}, + pagebreak / begin_with_odd_page .code:n = {\def\jlreq@pagebreak{\jlreq@cleartooddpage[empty]}\jlreq@column@spanning@possibletrue}, pagebreak / nariyuki .code:n = {\def\jlreq@pagebreak{}\jlreq@column@spanning@possiblefalse}, pagestyle .tl_set:N = \l__jlreq_pagestyle_tl, % 後々数字を受け付けるようになったりするかもしれないので…… @@ -2558,7 +2568,7 @@ % それ以外:空き量 % 最初や最後に空き量指定がある場合は,全体への指定に組み込むことにする. % -% 現在状況保存に以下のマクロを使う +% 現在状況保存に以下のマクロを使う,nは1から始まる. % \jlreq@BlockHeading@spaces@current@sequence % : 現在どのような見出しが続いているかリスト. % \jlreq@BlockHeading@spaces@current@space@<n> @@ -2569,8 +2579,14 @@ % : 現在処理中のn番目の見出しのフォーマット.行取りマクロを包み込むようにする. % \jlreq@BlockHeading@spaces@current@before@<n> % : n番目の見出しの前に出すもの +% \jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@<n> +% : n番目の見出しの前に出すもの.現在処理中の最初の見出しの時はボックスの前に出す. % \jlreq@BlockHeading@spaces@current@after@<n> % : n番目の見出しの後ろに出すもの +% \jlreq@BlockHeading@spaces@current@afteroutsideiflast@<n> +% : n番目の見出しの前に出すもの.現在処理中の最後の見出しの時はボックスのあとに出す. +% \jlreq@BlockHeading@spaces@current@afteroutsidebox@<n> +% : n番目の見出しの後ろに出すが,ボックスの外に出すもの(\markなどが想定) % \jlreq@BlockHeading@spaces@current@count % : 現在いくつの連続する見出しを処理しているかのカウンター \newcount\jlreq@BlockHeading@spaces@current@count @@ -2739,7 +2755,10 @@ \def\jlreq@BlockHeading@spaces@outputwospace@{% \ifnum\jlreq@tempcnta<\jlreq@BlockHeading@spaces@current@count \advance\jlreq@tempcnta by 1 - \tl_put_right:Nx \jlreq@do {\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@before@\the\jlreq@tempcnta}}% + \tl_put_right:Nx \jlreq@do { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@\the\jlreq@tempcnta} + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@before@\the\jlreq@tempcnta} + }% \edef\jlreq@tempa{% \unexpanded{\long\def\jlreq@tempa##1}{\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@format@\the\jlreq@tempcnta}}% }% @@ -2751,7 +2770,12 @@ {\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@output@\the\jlreq@tempcnta}}% }}% }% - \tl_put_right:Nx \jlreq@do {\jlreq@tempb\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@after@\the\jlreq@tempcnta}}% + \tl_put_right:Nx \jlreq@do { + \jlreq@tempb + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsidebox@\the\jlreq@tempcnta}% + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@after@\the\jlreq@tempcnta}% + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsideiflast@\the\jlreq@tempcnta}% + }% \expandafter\jlreq@BlockHeading@spaces@outputwospace@ \fi } @@ -2759,45 +2783,61 @@ \def\jlreq@BlockHeading@spaces@output@#1#2\jlreq@endmark{% \def\jlreq@result{}% \jlreq@tempcnta=0 - \jlreq@BlockHeading@spaces@output@@#2\jlreq@endmark \jlreq@tempatrue % 周りの行取り処理が必要か \tl_if_empty:nT {#1} {\jlreq@tempafalse}% \tl_if_eq:nnT {#1} {{}{}{}} { \jlreq@tempafalse } - \edef\jlreq@do{% - \ifjlreq@tempa - \unexpanded{\jlreq@BlockHeading@start@gyodori#1}{% - \exp_not:o {\jlreq@result}% - }% - \else - \exp_not:o {\jlreq@result}% - \fi - }% + \legacy_if:nTF { jlreq@tempa } { + \jlreq@BlockHeading@spaces@output@@{*}#2\jlreq@endmark + \tl_set:Nx \l__jlreq_do_tl { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@1} + \exp_not:n { \jlreq@BlockHeading@start@gyodori#1 } { + \exp_not:o { \jlreq@result } + } + } + \int_step_inline:nnn { 1 } { \jlreq@BlockHeading@spaces@current@count } { + \tl_put_right:Nx \l__jlreq_do_tl { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsidebox@##1} + } + } + \tl_put_right:Nx \l__jlreq_do_tl { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsideiflast@\the\jlreq@BlockHeading@spaces@current@count} + } + }{ + \jlreq@BlockHeading@spaces@output@@{}#2\jlreq@endmark + \tl_set:Nx \l__jlreq_do_tl { \exp_not:o { \jlreq@result } } + } \jlreq@BlockHeading@spaces@clear - \jlreq@do +% \message{[[output~headings]]} +% \message{\exp_not:o \l__jlreq_do_tl} + \l__jlreq_do_tl } % jlreq@resultに出力すべきものを入れていく -\def\jlreq@BlockHeading@spaces@output@@#1{% - \jlreq@ifendmark{#1}{}{% - \str_if_eq:eeTF {\str_head:n {#1}} {_} { +% #1: 全体の行取り処理をする場合は* +\def\jlreq@BlockHeading@spaces@output@@#1#2{% + \jlreq@ifendmark{#2}{}{% + \str_if_eq:eeTF {\str_head:n {#2}} {_} { \advance\jlreq@tempcnta by 1 - \expandafter\jlreq@BlockHeading@spaces@output@@@\expandafter{\@gobble #1}% + \tl_set:Nx \l__jlreq_tmpa_tl { + \exp_not:N \jlreq@BlockHeading@spaces@output@@@ {#1} { \exp_not:o { \@gobble #2 } } + } + \l__jlreq_tmpa_tl }{% - \tl_put_right:Nn \jlreq@result {\vskip\glueexpr #1\relax}% + \tl_put_right:Nn \jlreq@result {\vskip\glueexpr #2\relax}% }% - \jlreq@BlockHeading@spaces@output@@ + \jlreq@BlockHeading@spaces@output@@{#1} }% } -\def\jlreq@BlockHeading@spaces@output@@@#1{% +\def\jlreq@BlockHeading@spaces@output@@@#1#2{% \edef\jlreq@do{% - \noexpand\jlreq@BlockHeading@spaces@output@@@@ - \jlreq@iffirsttoken@ignorespaces{#1}{*}{{*}\exp_not:o {\@gobble #1}}{\unexpanded{{}#1}}% + \noexpand\jlreq@BlockHeading@spaces@output@@@@{#1} + \jlreq@iffirsttoken@ignorespaces{#2}{*}{{*}\exp_not:o {\@gobble #2}}{\unexpanded{{}#2}}% \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@space@\the\jlreq@tempcnta}% {\exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@output@\the\jlreq@tempcnta}}% }% \jlreq@do } -% #1: デフォルト値を使うならば*,#2#3#4が設定された値,#5#6#7がデフォルト値,#8は偶数ページの,#9が出力 -\def\jlreq@BlockHeading@spaces@output@@@@#1#2#3#4#5#6#7#8{% +% #2: デフォルト値を使うならば*,#3#4#5が設定された値,#6#7#8がデフォルト値,#9は偶数ページの +\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}}% }% @@ -2805,17 +2845,26 @@ \edef\jlreq@tempb{% \noexpand\exp_not:o {\noexpand\jlreq@tempa{% \noexpand\jlreq@BlockHeading@start@gyodori - \jlreq@ifempty{#1}{\unexpanded{{#2}{#3}{#4}}}{% - {\jlreq@ifempty{#2}{\unexpanded{#5}}{\unexpanded{#2}}}% + \jlreq@ifempty{#2}{\unexpanded{{#3}{#4}{#5}}}{% {\jlreq@ifempty{#3}{\unexpanded{#6}}{\unexpanded{#3}}}% {\jlreq@ifempty{#4}{\unexpanded{#7}}{\unexpanded{#4}}}% - }\unexpanded{{#8}}% + {\jlreq@ifempty{#5}{\unexpanded{#8}}{\unexpanded{#5}}}% + }\unexpanded{{#9}}% }}% }% \tl_put_right:Nx \jlreq@result {% + \bool_if:nT { \tl_if_empty_p:n {#1} || \int_compare_p:n { \jlreq@tempcnta > 0 } } { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@\the\jlreq@tempcnta}% + } \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@before@\the\jlreq@tempcnta}% \jlreq@tempb + \tl_if_empty:nT { #1 } { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsidebox@\the\jlreq@tempcnta}% + } \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@after@\the\jlreq@tempcnta}% + \bool_if:nT { \tl_if_empty_p:n {#1} || \int_compare_p:n { \jlreq@tempcnta < \jlreq@BlockHeading@spaces@current@count } } { + \exp_args:Nc \exp_not:o {jlreq@BlockHeading@spaces@current@afteroutsideiflast@\the\jlreq@tempcnta}% + } }% } @@ -2828,7 +2877,10 @@ \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@space@\the\jlreq@tempcnta\endcsname=\@undefined \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@output@\the\jlreq@tempcnta\endcsname=\@undefined \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@before@\the\jlreq@tempcnta\endcsname=\@undefined + \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@beforeoutsideiffirst@\the\jlreq@tempcnta\endcsname=\@undefined \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@after@\the\jlreq@tempcnta\endcsname=\@undefined + \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@afteroutsideiflast@\the\jlreq@tempcnta\endcsname=\@undefined + \expandafter\global\expandafter\let\csname jlreq@BlockHeading@spaces@current@afteroutsidebox@\the\jlreq@tempcnta\endcsname=\@undefined }% \gdef\jlreq@BlockHeading@spaces@current@sequence{}% \global\jlreq@BlockHeading@spaces@current@count=0 @@ -5069,7 +5121,8 @@ \vskip\abovecaptionskip \edef\jlreq@do{\unexpanded{\def\jlreq@tempa##1}{\jlreq@jlreqsetup@withenv@nameuse{jlreq@@makecaption@label@format@setting}{\jlreq@tempb}}}% \jlreq@do - \setbox\jlreq@tempboxa=\hbox{\jlreq@jlreqsetup@withenv@nameuse{jlreq@@makecaption@label@font@setting}{\jlreq@tempb}#1}% + % 最後の\relaxはhttps://github.com/abenori/jlreq/issues/112のため. + \setbox\jlreq@tempboxa=\hbox{\jlreq@jlreqsetup@withenv@nameuse{jlreq@@makecaption@label@font@setting}{\jlreq@tempb}#1\relax}% \ifdim\wd\jlreq@tempboxa=0pt \edef\jlreq@tempa{{\jlreq@jlreqsetup@withenv@nameuse{jlreq@@makecaption@font@setting}{\jlreq@tempb}\unexpanded{#2}}}% \else @@ -6537,7 +6590,7 @@ \ifx p\jlreq@engine platex\fi \ifx u\jlreq@engine uplatex\fi ,setupname=jlreqsetup - ]{jlreq-complements}[2022-07-13] + ]{jlreq-complements}[2022/11/28] } \l__jlreq_tmpa_tl \jlreqsetup{ |