diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-07 19:53:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-07 19:53:52 +0000 |
commit | 874a1c81cef02ef6271a1e6f84e269406ed5c5d1 (patch) | |
tree | e7b204fc55f8f8f86567e0d95c728aa072f33716 /Master/texmf-dist/tex/latex/jlreq | |
parent | 110d0c094cd32fdf5d099451643ccae5b31b66dc (diff) |
jlreq (7may19)
git-svn-id: svn://tug.org/texlive/trunk@51036 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/jlreq')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty | 16 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq.cls | 289 |
2 files changed, 101 insertions, 204 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty index 2d4039951bb..5591c6261b9 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty +++ b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty @@ -60,6 +60,12 @@ % #1が\jlreq@endmarkか \long\def\jlreq@ifendmark#1{\jlreq@iffirsttoken{#1}{\jlreq@endmark}} +% 条件.\jlreq@if{ifnum\@count=1 \fi}{<TRUE>}{<FALSE>}みたいに使う +\def\jlreq@if@endmark{\jlreq@if@endmark} +\def\jlreq@if#1{\jlreq@if@#1\jlreq@if@endmark} +\@gobbletwo\if\if +\def\jlreq@if@#1\fi\jlreq@if@endmark{#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + % #1の先頭が引数なしのマクロか \long\def\jlreq@ifmacro@noargument#1{% \jlreq@ifempty{#1}{\@secondoftwo}{% @@ -164,7 +170,7 @@ \def\jlreq@helper@dividebycomma@#1,#2\jlreq@endmark{% \jlreq@helper@trim{#1}{\jlreq@resulta}% \jlreq@helper@trim{#2}{\jlreq@resultb}% - \ifx\jlreq@resultb\@empty\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\ifx\jlreq@resultb\@empty\fi}{% \jlreq@resultfalse }{% \jlreq@resulttrue @@ -366,7 +372,7 @@ \edef\jlreq@do{\unexpanded{#2}}% }{% \edef\jlreq@tempb{\jlreq@ifempty{#1}{#2}{\unexpanded{#2}}}% - \ifx\jlreq@tempa\jlreq@tempb\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\ifx\jlreq@tempa\jlreq@tempb\fi}{% \edef\jlreq@do{\unexpanded{#3}}% \jlreq@deleteuntileendmark }{% @@ -377,11 +383,11 @@ % オレオレラベル…… % \jlreq@reference@ref{ラベル名}{デフォルト値} -\def\jlreq@reference@ref#1{\expandafter\ifx\csname jlreq@reference@#1\endcsname\relax\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi{\csname jlreq@reference@#1\endcsname}} +\def\jlreq@reference@ref#1{\jlreq@if{\expandafter\ifx\csname jlreq@reference@#1\endcsname\fi}{\csname jlreq@reference@#1\endcsname}} % \jlreq@reference@label{ラベル名}{値} \def\jlreq@reference@label#1#2{\protected@write\@auxout{}{\string\@newl@bel{jlreq@reference}{#1}{#2}}}% \def\jlreq@reference@immediate@write#1#2{\immediate\write\@auxout{\string\@newl@bel{jlreq@reference}{#1}{#2}}}% -\def\jlreq@reference@ifexist#1{\expandafter\ifx\csname jlreq@reference@#1\endcsname\relax\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi} +\def\jlreq@reference@ifexist#1{\jlreq@if{\expandafter\ifx\csname jlreq@reference@#1\endcsname\fi}} % 自動生成されるラベル用の番号 \newcount\jlreq@reference@count @@ -412,7 +418,7 @@ \def\jlreq@helper@checktokenlist#1#2{% \jlreq@ifendmark{#2}{\@firstoftwo}% {% - \ifnum0#1{#2}>0 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi + \jlreq@if{\ifnum0#1{#2}>0 \fi}% {\jlreq@helper@checktokenlist{#1}}% {\expandafter\@secondoftwo\jlreq@deleteuntileendmark}% }% diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls index 44f29847a8d..25758ea7ab1 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls +++ b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls @@ -5,7 +5,7 @@ %% % (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/) \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{jlreq}[2019/04/01 jlreq] +\ProvidesClass{jlreq}[2019/05/07 jlreq] \RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen} \RequirePackage{jlreq-helpers} @@ -40,7 +40,7 @@ \expandafter\let\csname jlreq@original@\expandafter\@gobble\string#1\endcsname=#1 } \def\jlreq@useoriginalcs#1{% - \ifcsname jlreq@original@\expandafter\@gobble\string#1\endcsname\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi + \jlreq@if{\ifcsname jlreq@original@\expandafter\@gobble\string#1\endcsname\fi}% {\csname jlreq@original@\expandafter\@gobble\string#1\endcsname}% {#1}% } @@ -376,31 +376,31 @@ } \long\def\jlreq@helper@ifletter#1{% - \ifnum - 0% - \ifcat 阿\noexpand #11\fi - \ifcat あ\noexpand #11\fi - \ifcat (\noexpand #11\fi - \ifcat A\noexpand #11\fi - \ifcat 1\noexpand #11\fi - >0 - \expandafter\@firstoftwo\else\expandafter\@secondoftwo - \fi + \jlreq@if{% + \ifnum + 0% + \ifcat 阿\noexpand #11\fi + \ifcat あ\noexpand #11\fi + \ifcat (\noexpand #11\fi + \ifcat A\noexpand #11\fi + \ifcat 1\noexpand #11\fi + >0 + \fi}% } % 組方向を判定 % \jlreq@if(y|t)(dir|box)を定義する. -\ifx l\jlreq@engine\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{ - \def\jlreq@ifydir{\ifnum\ltjgetparameter{direction}=4 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftdir{\ifnum\numexpr\ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8\relax=3 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@ifybox#1{\ifnum\ltjgetparameter{boxdir}{#1}=4 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftbox#1{\ifnum\numexpr\ltjgetparameter{boxdir}{#1}-(\ltjgetparameter{boxdir}{#1}/8)*8\relax=3 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} +\jlreq@if{\ifx l\jlreq@engine\fi}{ + \def\jlreq@ifydir{\jlreq@if{\ifnum\ltjgetparameter{direction}=4 \fi}} + \def\jlreq@iftdir{\jlreq@if{\ifnum\numexpr\ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8\relax=3 \fi}} + \def\jlreq@ifybox#1{\jlreq@if{\ifnum\ltjgetparameter{boxdir}{#1}=4 \fi}} + \def\jlreq@iftbox#1{\jlreq@if{\ifnum\numexpr\ltjgetparameter{boxdir}{#1}-(\ltjgetparameter{boxdir}{#1}/8)*8\relax=3 \fi}} }{ - \def\jlreq@ifydir{\ifydir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftdir{\iftdir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@ifybox#1{\ifybox#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftbox#1{\iftbox#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + \def\jlreq@ifydir{\jlreq@if{\ifydir\fi}} + \def\jlreq@iftdir{\jlreq@if{\iftdir\fi}} + \def\jlreq@ifybox#1{\jlreq@if{\ifybox#1\fi}} + \def\jlreq@iftbox#1{\jlreq@if{\iftbox#1\fi}} } % 左ページであるか @@ -1332,6 +1332,7 @@ \if@twocolumn \setlength{\textwidth}{\dimexpr2\textwidth + \columnsep\relax} \fi +\addtolength{\textwidth}{0.0001pt} %.. \textheight:行送り方向の長さ @@ -1364,6 +1365,7 @@ \else \setlength{\textheight}{\dimexpr\numexpr\jlreq@option@number@of@lines\relax\baselineskip - \baselineskip + \topskip\relax} \fi +\addtolength{\textheight}{0.0001pt} %.. 横 \def\jlreq@setsidemargin@by@gutter#1{ @@ -1635,7 +1637,7 @@ {\long\gdef\jlreqHeadingText####1{####1}}% }% \ifjlreq@number - \unexpanded{\ifnum#2>\c@secnumdepth\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}{% + \unexpanded{\jlreq@if{\ifnum#2>\c@secnumdepth\relax\fi}}{% \unexpanded{\long\gdef\jlreqHeadingLabel####1{}}% \expandonce{\jlreq@format{}{##1}}% }{% @@ -1724,11 +1726,18 @@ \long\def\jlreq@BlockHeading@start@@@@#1#2#3#4#5#6#7#8{% \edef\jlreq@tempa##1##2##3##4##5##6##7{% \unexpanded{\jlreq@BlockHeading@start@makeoutput{#1}{#2}}{{##1}{##2}{##3}}{\expandonce{\jlreq@BlockHeading@start@eachformat}}{\expandonce{\jlreq@BlockHeading@start@format}}\unexpanded{{#5}{#6}{#7}{#8}}% - \unexpanded{\def\jlreq@tempb}{{##4}{##5}{##6}{##7}}% 縦方向空き + \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 \gappto\jlreq@BlockHeading@spaces@current@sequence{_#1}% + % 連続する見出しの間の処理をするために,即時では出力せず,いったんマクロに格納する. + % \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> + % として後に呼び出される.(spaceは書き換えられる可能性がある.) \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@output@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \expandonce{\jlreq@resultb}% }% @@ -1739,6 +1748,10 @@ \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@before@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \expandonce{\@tempa#4}% \expandonce{\jlreq@resulta}% + \ifjlreq@tempa\unexpanded{% + \jlreq@setcurrentpage + \edef\jlreq@BlockHeading@currentpage{\the\jlreq@currentpage}% + }\fi }% \def\@tempa##1##2##3{##2}% \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@format@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% @@ -1747,6 +1760,12 @@ \def\@tempa##1##2##3{##3}% \expandafter\xdef\csname jlreq@BlockHeading@spaces@current@after@\the\jlreq@BlockHeading@spaces@current@count\endcsname{% \expandonce{\jlreq@resultc}% + \ifjlreq@tempa\unexpanded{% + \ifx\jlreq@BlockHeading@currentpage\@empty\nobreak\else + \ifodd\jlreq@BlockHeading@currentpage\nobreak\else\allowbreak\fi + \fi + }\else\noexpand\nobreak\fi + % 現状ここ↓は常に空 \expandonce{\@tempa#4}% }% \ifx\jlreq@BlockHeading@spaces@headingslist\@empty @@ -1922,10 +1941,10 @@ } % 行取り処理.#3が空の時は行取りの処理はしない.(空白挿入は行う.) -% {1 = 前空き}{2 = 後ろ空き}{3 = トータル行数}{4 = 偶数ページ改ページするなら空}{5 = 出力} -\long\def\jlreq@BlockHeading@start@gyodori#1#2#3#4#5{\par{% - \jlreq@ifempty{#4}{\jlreq@setcurrentpage}{}% - \setbox\jlreq@tempboxa=\vbox{#5}% +% {1 = 前空き}{2 = 後ろ空き}{3 = トータル行数}{4 = 出力} +% 最後には\nobreak(と\vskip)が入っている +\long\def\jlreq@BlockHeading@start@gyodori#1#2#3#4{\par{% + \setbox\jlreq@tempboxa=\vbox{#4}% % \jlreq@tempskip(a/b)に前/後ろに入れるべき値を入れる % #1がa:ならばその値は\jlreq@tempskipaには足さず\jlreq@tempskipcに入れておく \jlreq@tempskipa=0pt @@ -2005,7 +2024,7 @@ \box\jlreq@tempboxa \ifx r\jlreq@ushiroakitype\prevdepth=-1000pt \else\prevdepth=0pt \fi \fi - \jlreq@ifempty{#4}{\ifodd\jlreq@currentpage\nobreak\fi}{\nobreak}% + \nobreak \jlreq@ifgluezero\jlreq@tempskipb{}{\vskip\jlreq@tempskipb}% \edef\jlreq@do{% \ifdim\parskip=0pt \else @@ -2107,7 +2126,7 @@ % a,bみたいなのをaとbにわける.カンマがなければbは空.引数を{a}{b}として##2を呼び出す. \def\jlreq@parsecomma##1##2{% \jlreq@helper@dividebycomma{##1}% - \ifjlreq@result\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\ifjlreq@result\fi}{% \edef\jlreq@do{\noexpand\jlreq@tempa{\expandonce{\jlreq@resulta}}{\expandonce{\jlreq@resultb}}}% }{% \edef\jlreq@do{\noexpand\jlreq@tempa{##1}{}}% @@ -2291,7 +2310,7 @@ % 前開きが常に入ってしまうので,a:の時は除去する \jlreq@iffirsttoken{##1}{a}{\def\jlreq@spaceset{{}{##2}{##3}}}{}% \edef\jlreq@totalformat{% - \unexpanded{\if@twocolumn\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}{% + \unexpanded{\jlreq@if{\if@twocolumn\fi}}{% \noexpand\twocolumn[{% % 普段自動で入る\topskipと\baselineskipを手動で入れる \jlreq@iffirsttoken{##1}{r}{}{\unexpanded{\vskip\topskip\relax}}% @@ -2531,7 +2550,7 @@ \ifthenelse{\equal{#1}{{}{}{}}}{\jlreq@tempafalse}{}% \edef\jlreq@do{% \ifjlreq@tempa - \unexpanded{\jlreq@BlockHeading@start@gyodori#1}{*}{% + \unexpanded{\jlreq@BlockHeading@start@gyodori#1}{% \expandonce{\jlreq@result}% }% \else @@ -2563,7 +2582,7 @@ \jlreq@do } % #1: デフォルト値を使うならば*,#2#3#4が設定された値,#5#6#7がデフォルト値,#8は偶数ページの,#9が出力 -\def\jlreq@BlockHeading@spaces@output@@@@#1#2#3#4#5#6#7#8#9{% +\def\jlreq@BlockHeading@spaces@output@@@@#1#2#3#4#5#6#7#8{% \edef\jlreq@tempa{% \unexpanded{\long\def\jlreq@tempa##1}{\csexpandonce{jlreq@BlockHeading@spaces@current@format@\the\jlreq@tempcnta}}% }% @@ -2575,7 +2594,7 @@ {\jlreq@ifempty{#2}{\unexpanded{#5}}{\unexpanded{#2}}}% {\jlreq@ifempty{#3}{\unexpanded{#6}}{\unexpanded{#3}}}% {\jlreq@ifempty{#4}{\unexpanded{#7}}{\unexpanded{#4}}}% - }\unexpanded{{#8}{#9}}% + }\unexpanded{{#8}}% }}% }% \eappto\jlreq@result{% @@ -2728,7 +2747,7 @@ \def\jlreq@CutinHeading@start#1#2#3#4#5#6#7{% \if@noskipsec\leavevmode\fi \par - \ifnum\hangafter=1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\ifnum\hangafter=1 \fi}{% \jlreq@CutinHeading@start@{#2}{#3}{#4}{#5}{#6}{#7}% }{% \ClassError{jlreq}{Can not use \expandafter\string\csname#1\endcsname\space here}{\@ehc}% @@ -2864,7 +2883,7 @@ \fi } \newcommand*{\jlreq@HeadingType@}[2]{% - \expandafter\expandafter\expandafter\ifx\csname jlreq@heading@type@#1\endcsname#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi + \jlreq@if{\expandafter\expandafter\expandafter\ifx\csname jlreq@heading@type@#1\endcsname#2\fi}% } % 全ての見出しにマクロ#1を適用する. @@ -3726,167 +3745,39 @@ } %.. マークの拡張 -% 三つ以上のマークを保持するために,markを次のようにする -% <マーク1>\jlreq@extramark{{<マーク2>}{<マーク3>}...} -\def\jlreq@extramark#1{} - -% #1番目の\leftmarkや\rightmarkを取得する.\leftmark/\rightmarkの実装に強く依存している. -\def\jlreq@extraleftmark#1{\jlreq@getextramark{#1}{\leftmark}}% -\def\jlreq@extrarightmark#1{\jlreq@getextramark{#1}{\rightmark}}% -\def\jlreq@getextramark#1#2{\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\jlreq@getextramark@#2\jlreq@extramark\jlreq@endmark{#1}} -\def\jlreq@getextramark@#1\jlreq@extramark#2\jlreq@endmark#3{% - \jlreq@ifempty{#2}{}{\jlreq@getextramark@@{#3}#2}% -} -\def\jlreq@getextramark@@#1#2#3\jlreq@extramark{\jlreq@getextramark@@@{#1}#2\jlreq@endmark} -\def\jlreq@getextramark@@@#1#2{% - \jlreq@ifendmark{#2}{}{% - \ifnum#1=1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi - {\jlreq@getextramark@@@@{#2}}{\expandafter\jlreq@getextramark@@@\expandafter{\the\numexpr #1-1\relax}}% - }% -} -\def\jlreq@getextramark@@@@#1#2\jlreq@endmark{#1} - -% トークン列#1に必要ならば\jlre@extramarkを加え,#2に代入 -\def\jlreq@addextramarkcommand#1#2{% - \jlreq@ifcontains{#1}{\jlreq@extramark}{\edef#2{\unexpanded{#1}}}{\edef#2{\unexpanded{#1\jlreq@extramark{}}}}% -} -\def\jlreq@addextramarkcommand@tothemark{% - \begingroup - \expandafter\expandafter\expandafter\jlreq@addextramarkcommand\expandafter\expandafter\expandafter{\expandafter\@firstoftwo\@themark}{\jlreq@tempa}% - \expandafter\expandafter\expandafter\jlreq@addextramarkcommand\expandafter\expandafter\expandafter{\expandafter\@secondoftwo\@themark}{\jlreq@tempb}% - \edef\jlreq@do{\unexpanded{\def\@themark}{{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}}}% - \expandafter\endgroup - \jlreq@do -} - -% #1番目を#2に置き換える -\def\jlreq@setextraleftmark#1#2{% - \let\jlreq@extramark@=\jlreq@extramark - \begingroup - \jlreq@addextramarkcommand@tothemark - \def\jlreq@extramark##1{\noexpand\jlreq@extramark{\jlreq@changeargument{##1}{#1}{#2}}}% - \protected@edef\jlreq@tempa{\expandafter\@firstoftwo\@themark}% - \def\jlreq@extramark{\noexpand\jlreq@extramark}% - \protected@edef\jlreq@tempb{\expandafter\@secondoftwo\@themark}% - \edef\@themark{{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}}% - \edef\jlreq@do{% - \unexpanded{\def\jlreq@extramark{\noexpand\jlreq@extramark}}% - \noexpand\markboth\expandonce{\@themark}% - }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ -} -\def\jlreq@setextrarightmark#1#2{% - \let\jlreq@extramark@=\jlreq@extramark - \begingroup - \jlreq@addextramarkcommand@tothemark - \def\jlreq@extramark{\noexpand\jlreq@extramark}% - \protected@edef\jlreq@tempa{\expandafter\@firstoftwo\@themark}% - \def\jlreq@extramark##1{\noexpand\jlreq@extramark{\jlreq@changeargument{##1}{#1}{#2}}}% - \protected@edef\jlreq@tempb{\expandafter\@secondoftwo\@themark}% - \edef\@themark{{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}}% - \edef\jlreq@do{% - \unexpanded{\def\jlreq@extramark{\noexpand\jlreq@extramark}}% - \noexpand\markright{\expandonce{\jlreq@tempb}}% - }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ -} - -% #1内の#2番目を#3に取り替える.\jlreq@changeargument{{arg1}{arg2}...{argk}}{n}{arg} -% k < nならば{}を加えた後{arg}を最後につける -\def\jlreq@changeargument#1#2#3{% - \jlreq@changeargument@{#2}{#3}#1\jlreq@endmark -} -\def\jlreq@changeargument@#1#2#3{% - \jlreq@ifendmark{#3}{% - \ifnum#1>0 \expandafter\@firstofone\else\expandafter\@gobble\fi - {\jlreq@changeargument@@{#1}{#2}}% - }{% - \ifnum#1=1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi - {{#2}}{{#3}}% - \expandafter\jlreq@changeargument@\expandafter{\the\numexpr #1 - 1\relax}{#2}% - }% -} -\def\jlreq@changeargument@@#1#2{% - \ifnum#1<2 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{{#2}}{% - {}\expandafter\jlreq@changeargument@@\expandafter{\the\numexpr #1 -1 \relax}{#2}% - }% -} - -% \jlreq@cleararguments{k}{{arg1}...{argn}}を{arg1}...{argk}{}...{}にする -\def\jlreq@cleararguments#1#2{\jlreq@cleararguments@{#1}#2\jlreq@endmark} -\def\jlreq@cleararguments@#1#2{\jlreq@ifendmark{#2}{}{% - \ifnum#1<1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi - {{}}{{#2}}% - \expandafter\jlreq@cleararguments@\expandafter{\the\numexpr #1 - 1\relax}% +\def\jlreq@markregistername#1{jlreq@extramark@register@#1} +\def\jlreq@extraleftmark#1{\jlreq@extramark@{#1}{\expandafter\@firstoftwo\botmarks}} +\def\jlreq@extrarightmark#1{\jlreq@extramark@{#1}{\expandafter\@secondoftwo\firstmarks}} +\def\jlreq@extramark@#1#2{\jlreq@if{\ifcsname\jlreq@markregistername{#1}\endcsname\fi}% + {\expandafter\jlreq@extramark@@\expandafter{\csname \jlreq@markregistername{#1}\endcsname}{#2}}% + {}% +} +\def\jlreq@extramark@@#1#2{#2#1\@empty\@empty} + +\def\jlreq@setextraleftmark@#1#2{{#2}{\expandafter\@secondoftwo#1}} +\def\jlreq@setextrarightmark@#1#2{{\expandafter\@firstoftwo#1}{#2}} +\def\jlreq@setextraleftmark#1#2{\jlreq@setextramark{#1}{#2}{\jlreq@setextraleftmark@}} +\def\jlreq@setextrarightmark#1#2{\jlreq@setextramark{#1}{#2}{\jlreq@setextrarightmark@}} +\def\jlreq@setextramark#1#2#3{% + \jlreq@if{\ifcsname\jlreq@markregistername{#1}\endcsname\fi}{}{% + \expandafter\newmarks\csname\jlreq@markregistername{#1}\endcsname + \expandafter\def\csname\jlreq@markregistername{#1}@themark\endcsname{{}{}}% }% -} -% ...\jlreq@extramark{...}を\jlreq@extramark{...}のみにする. -\def\jlreq@getextramarkpart#1{\jlreq@getextramarkpart@#1\jlreq@extramark\jlreq@endmark} -\def\jlreq@getextramarkpart@#1\jlreq@extramark#2\jlreq@endmark{\jlreq@ifempty{#2}{}{\jlreq@getextramarkpart@@#2}} -\def\jlreq@getextramarkpart@@#1\jlreq@extramark{\jlreq@extramark{#1}} - -% #1番目以降を空にする -\def\jlreq@clearleftextramarks#1{% - \let\jlreq@extramark@=\jlreq@extramark \begingroup - \def\jlreq@extramark##1{\noexpand\jlreq@extramark{\jlreq@cleararguments{#1}{##1}}}% - \protected@edef\jlreq@tempa{\expandafter\@firstoftwo\@themark}% - \edef\jlreq@tempb{\expandafter\expandafter\expandafter\expandonce\expandafter\expandafter\expandafter{\expandafter\@secondoftwo\@themark}}% - \edef\jlreq@do{% - \unexpanded{\def\jlreq@extramark{\noexpand\jlreq@extramark}}% - \noexpand\markboth{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}% + \let\label\relax + \let\index\relax + \let\glossary\relax + \def\jlreq@@themark@csname{\jlreq@markregistername{#1}@themark}% + \expandafter\unrestored@protected@xdef\csname\jlreq@@themark@csname\endcsname{% + \expandafter#3\expandafter{\csname\jlreq@@themark@csname\endcsname}{#2}% }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ -} -\def\jlreq@clearrightextramarks#1{% - \let\jlreq@extramark@=\jlreq@extramark - \begingroup - \edef\jlreq@tempa{\expandafter\expandafter\expandafter\expandonce\expandafter\expandafter\expandafter{\expandafter\@firstoftwo\@themark}}% - \def\jlreq@extramark##1{\noexpand\jlreq@extramark{\jlreq@cleararguments{#1}{##1}}}% - \protected@edef\jlreq@tempb{\expandafter\@secondoftwo\@themark}% - \edef\jlreq@do{% - \unexpanded{\def\jlreq@extramark{\noexpand\jlreq@extramark}}% - \noexpand\markboth{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}% - }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ -} - -\def\jlreq@markboth#1#2{% - \let\jlreq@extramark@=\jlreq@extramark - \def\jlreq@extramark{\noexpand\jlreq@extramark}% - \begingroup - \protected@edef\jlreq@tempa{\expandafter\@firstoftwo\@themark}% - \protected@edef\jlreq@tempa{\unexpanded{#1}\expandafter\jlreq@getextramarkpart\expandafter{\jlreq@tempa}}% - \protected@edef\jlreq@tempb{\expandafter\@secondoftwo\@themark}% - \protected@edef\jlreq@tempb{\unexpanded{#2}\expandafter\jlreq@getextramarkpart\expandafter{\jlreq@tempb}}% - \edef\jlreq@do{% - \noexpand\markboth{\expandonce{\jlreq@tempa}}{\expandonce{\jlreq@tempb}}% - }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ -} -\def\jlreq@markright#1{% - \let\jlreq@extramark@=\jlreq@extramark - \def\jlreq@extramark{\noexpand\jlreq@extramark}% - \begingroup - \protected@edef\jlreq@tempb{\expandafter\@secondoftwo\@themark}% - \protected@edef\jlreq@tempb{\unexpanded{#1}\expandafter\jlreq@getextramarkpart\expandafter{\jlreq@tempb}}% - \edef\jlreq@do{% - \noexpand\markright{\expandonce{\jlreq@tempb}}% - }% - \expandafter\endgroup - \jlreq@do - \let\jlreq@extramark=\jlreq@extramark@ + \expandafter\expandafter\expandafter\@temptokena\expandafter\expandafter\expandafter{\csname\jlreq@@themark@csname\endcsname}% + \expandafter\marks\csname\jlreq@markregistername{#1}\endcsname{\the\@temptokena}% + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi } +\let\jlreq@markboth=\markboth +\let\jlreq@markright=\markright %.. \DeclarePageStyle内で使うもの % mark情報の取得を行う. @@ -3971,7 +3862,7 @@ % \jlreq@tempbに\***markの定義を入れる \edef\jlreq@tempb{% \expandonce{\csname the#1\endcsname}% - \noexpand\ifx\expandonce{\csname the#1\endcsname}\unexpanded{\@empty\else\quad\fi}% + \noexpand\ifx\expandonce{\csname the#1\endcsname}\unexpanded{\@empty\else\protect\quad\fi}% \unexpanded{##1}% }% \jlreq@parsekeyval@nokey{% @@ -4050,7 +3941,7 @@ % 間に空白を入れる. % #1: ターゲットなコントロールシークエンスの名前,#2:*ならばreverseする,#3:空き \def\jlreq@pagestyle@make@runninghead#1#2#3{% - \expandafter\ifx\csname #1\endcsname\@empty\expandafter\@gobble\else\expandafter\@firstofone\fi{% + \jlreq@if{\expandafter\ifx\csname #1\endcsname\@empty\fi}{}{% \edef\jlreq@do{% \noexpand\jlreq@tempatrue % 最初の処理かフラグ \unexpanded{\jlreq@pagestyle@make@runninghead@{#1}{#2}{#3}}\csexpandonce{#1}\noexpand\jlreq@endmark @@ -4062,7 +3953,7 @@ }% } \def\jlreq@pagestyle@make@runninghead@#1#2#3#4#5{% - \ifnum\numexpr\jlreq@ifendmark{#5}{1}{0}*\ifjlreq@tempa 1\else 0\fi\relax=1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\ifnum\numexpr\jlreq@ifendmark{#5\fi}{1}{0}*\ifjlreq@tempa 1\else 0\fi\relax=1 \fi}{% % 項目が一つしか無い \jlreq@ifempty{#2}{\csappto}{\cspreto}{#1}{#4}% }{% @@ -4256,7 +4147,7 @@ \jlreq@pagestyle@addfont@tocs{jlreq@nombre@\jlreq@i}{jlreq@nombre@\jlreq@i @font}% }% % \jlreq@oddhead,\jlreq@oddfoot,\jlreq@evenhead,\jlreq@evenfootに必要なものを入れる. - \ifjlreq@pstate\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% tate + \jlreq@if{\ifjlreq@pstate\fi}{% tate % headの方に処理を入れる.footは空. \def\jlreq@oddfoot{}\def\jlreq@evenfoot{}% \jlreq@for@noexpand\jlreq@position:=\jlreq@nombre@i@position,\jlreq@running@head@i@position\do{% @@ -4435,11 +4326,11 @@ \expandafter\edef\csname\jlreq@nombrecsname\endcsname{{\expandonce{\jlreq@nombre@font}\csexpandonce{\jlreq@nombrecsname}}}% \fi \fi - \expandafter\ifx\csname\jlreq@runheadcsname\endcsname\@empty\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\expandafter\ifx\csname\jlreq@runheadcsname\endcsname\@empty\fi}{% % 柱が空:ノンブルのみでよい \expandafter\let\csname\jlreq@csname\expandafter\endcsname\csname\jlreq@nombrecsname\endcsname }{% - \expandafter\ifx\csname\jlreq@nombrecsname\endcsname\@empty\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@if{\expandafter\ifx\csname\jlreq@nombrecsname\endcsname\@empty\fi}{% % % ノンブルが空.柱のみでよい. \jlreq@pagestyle@addfont@tocs{\jlreq@runheadcsname}{jlreq@running@head@font}% \expandafter\let\csname\jlreq@csname\expandafter\endcsname\csname\jlreq@runheadcsname\endcsname @@ -4609,7 +4500,7 @@ % #1@#2が定義されていれば\#1@#2の中身に,そうでなければ\#1の中身に展開される. % 展開は\unexpandedで抑制される. \def\jlreq@jlreqsetup@withenv@nameuse#1#2{% - \expandafter\ifx\csname #1@#2\endcsname\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{\csexpandonce{#1}}{\csexpandonce{#1@#2}}% + \jlreq@if{\expandafter\ifx\csname #1@#2\endcsname\relax\fi}{\csexpandonce{#1}}{\csexpandonce{#1@#2}}% } % 4.3.1 注4 \newlength\abovecaptionskip |