diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-16 20:48:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-16 20:48:00 +0000 |
commit | 03e475af0478ac4e6cbe4fbe68e56f7461694064 (patch) | |
tree | f0882fe9fa215951c97b8c5883e86475cce754e7 /Master/texmf-dist/tex/latex | |
parent | d2ffec2a2f1cd6175f94d852756963a3e7526851 (diff) |
jlreq (16aug18)
git-svn-id: svn://tug.org/texlive/trunk@48414 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty | 71 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq.cls | 55 |
2 files changed, 85 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty index 41bb74447fd..9532669172a 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty +++ b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty @@ -1,7 +1,7 @@ % エンジン非依存のマクロ集 \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jlreq-helpers}[2018/08/08 jlreq-helpers] +\ProvidesPackage{jlreq-helpers}[2018/08/15 jlreq-helpers] \RequirePackage{xkeyval,etoolbox} %. helper1 @@ -162,9 +162,15 @@ % もしカンマがない場合は\ifjlreq@resultがfalseになる. \newcommand*{\jlreq@helper@dividebycomma}[1]{\jlreq@helper@dividebycomma@#1,\jlreq@endmark} \def\jlreq@helper@dividebycomma@#1,#2\jlreq@endmark{% - \def\jlreq@resulta{#1}% - \def\jlreq@resultb{#2}% - \ifx\jlreq@resultb\@empty\jlreq@resultfalse\else\jlreq@resulttrue\expandafter\def\expandafter\jlreq@resultb\expandafter{\jlreq@helper@removelastcomma#2\jlreq@endmark}\fi + \jlreq@remove@spaceandbracket{#1}{\jlreq@resulta}% + \jlreq@remove@spaceandbracket{#2}{\jlreq@resultb}% + \ifx\jlreq@resultb\@empty\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \jlreq@resultfalse + }{% + \jlreq@resulttrue + \expandafter\def\expandafter\jlreq@resultb\expandafter{\jlreq@helper@removelastcomma#2\jlreq@endmark}% + \expandafter\jlreq@remove@spaceandbracket\expandafter{\jlreq@resultb}{\jlreq@resultb}% + }% } \def\jlreq@helper@removelastcomma#1,\jlreq@endmark{#1} @@ -243,21 +249,60 @@ \begingroup \def\jlreq@do{}% \def\jlreq@parsekeyval@nokey@execute##1##2{#1}% - \expandafter\jlreq@parsekeyval@nokey@#2,\jlreq@endmark,% + \expandafter\jlreq@parsekeyval@nokey@i#2,\jlreq@endmark,% \expandafter\endgroup \jlreq@do } -\long\def\jlreq@parsekeyval@nokey@#1,{% - \jlreq@ifendmark{#1}{}{\jlreq@ifempty{#1}{\jlreq@parsekeyval@nokey@}{\jlreq@parsekeyval@nokey@@#1=\jlreq@endmark}}% +\long\def\jlreq@parsekeyval@nokey@i#1,{\jlreq@ifendmark{#1}{}{\jlreq@parsekeyval@nokey@ii#1=\jlreq@endmark}} +\long\def\jlreq@parsekeyval@nokey@ii#1=#2\jlreq@endmark{% + \jlreq@ifempty{#2}{\jlreq@parsekeyval@nokey@iii{#2}{#1}}{% + \edef\jlreq@tempa{% + \noexpand\jlreq@parsekeyval@nokey@iii{\jlreq@parsekeyval@nokey@removeequal{#2}}{\unexpanded{#1}}% + }% + \jlreq@tempa + }% } -\long\def\jlreq@parsekeyval@nokey@@#1=#2\jlreq@endmark{% - \jlreq@ifempty{#2}{\jlreq@parsekeyval@nokey@@@{}{#1}}{\expandafter\jlreq@parsekeyval@nokey@@@\expandafter{\jlreq@parsekeyval@nokey@@@@#2\jlreq@endmark}{#1}}% +\long\def\jlreq@parsekeyval@nokey@iii#1#2{% + \jlreq@remove@spaceandbracket{#1}{\jlreq@tempa}% + \jlreq@remove@spaceandbracket{#2}{\jlreq@tempb}% + \ifx\jlreq@tempa\@empty\expandafter\@gobble\else\expandafter\@firstofone\fi + {% + \edef\@tempa{\noexpand\jlreq@parsekeyval@nokey@iv{\expandonce{\jlreq@tempb}}{\expandonce{\jlreq@tempa}}}% + \@tempa + }% + \jlreq@parsekeyval@nokey@i +} +\long\def\jlreq@parsekeyval@nokey@iv#1#2{% + \eappto\jlreq@do{\expandonce{\jlreq@parsekeyval@nokey@execute{#1}{#2}}}% } -\long\def\jlreq@parsekeyval@nokey@@@#1#2{% - \eappto\jlreq@do{\expandonce{\jlreq@parsekeyval@nokey@execute{#2}{#1}}}% - \jlreq@parsekeyval@nokey@ +\long\def\jlreq@parsekeyval@nokey@removeequal#1{\jlreq@parsekeyval@nokey@removeequal@\jlreq@uniqtoken#1\jlreq@endmark} +\long\def\jlreq@parsekeyval@nokey@removeequal@#1=\jlreq@endmark{\expandafter\unexpanded\expandafter{\@gobble#1}} + +% #1の先頭のスペースを削除し,#2に入れる.ただし#1={ X}の時は" X"が入る. +\def\jlreq@do#1{% #1 = " "として後で実行 + \long\def\jlreq@remove@spaceandbracket##1##2{% + \begingroup + \def\jlreq@tempa{}% + \futurelet\jlreq@nextchar\jlreq@remove@spaceandbracket@i##1\jlreq@uniqtoken#1\jlreq@uniqtoken\jlreq@endmark + \edef\jlreq@do{\noexpand\edef\noexpand##2{\noexpand\unexpanded{\expandonce{\jlreq@tempa}}}}% + \expandafter\endgroup + \jlreq@do + } + \def\jlreq@remove@spaceandbracket@i{% + \ifx#1\jlreq@nextchar\expandafter\jlreq@remove@spaceandbracket@ii\else\expandafter\jlreq@remove@spaceandbracket@iii\fi + }% + \def\jlreq@remove@spaceandbracket@ii#1{\futurelet\jlreq@nextchar\jlreq@remove@spaceandbracket@i}% + \long\def\jlreq@remove@spaceandbracket@iii##1#1\jlreq@uniqtoken##2\jlreq@endmark{% + \jlreq@ifempty{##2}{% + \expandafter\jlreq@remove@spaceandbracket@iv\expandafter{\jlreq@removelastuniqtoken##1}% + }{% + \jlreq@remove@spaceandbracket@iv{##1}% + }% + }% } -\long\def\jlreq@parsekeyval@nokey@@@@#1=\jlreq@endmark{#1} +\jlreq@do{ } +\long\def\jlreq@removelastuniqtoken#1\jlreq@uniqtoken{#1} +\long\def\jlreq@remove@spaceandbracket@iv#1{\edef\jlreq@tempa{\unexpanded{#1}}} % \jlreq@switch{str}{ % {str}{abcd} diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls index 9291611a4c3..d513a760f98 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}[2018/08/08 jlreq]
+\ProvidesClass{jlreq}[2018/08/15 jlreq]
\RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen}
\RequirePackage{jlreq-helpers}
@@ -1948,18 +1948,13 @@ \newif\ifjlreq@column@spanning@possible\jlreq@column@spanning@possiblefalse
% a,bみたいなのをaとbにわける.カンマがなければbは空.引数を{a}{b}として##2を呼び出す.
\def\jlreq@parsecomma##1##2{%
- \def\jlreq@tempa####1####2{##2}%
- \def\@tempa####1,####2\jlreq@endmark{%
- \jlreq@ifempty{####2}{%
- \def\@tempa{}%
- }{%
- \def\@tempa########1,\jlreq@endmark{\def\@tempa{########1}}%
- \@tempa####2\jlreq@endmark
- }%
- \edef\@tempa{\unexpanded{\jlreq@tempa{####1}}{\expandonce{\@tempa}}}%
- \edef\jlreq@do{\jlreq@expandtwice{\@tempa}}%
+ \jlreq@helper@dividebycomma{##1}%
+ \ifjlreq@result\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{%
+ \edef\jlreq@do{\noexpand\jlreq@tempa{\expandonce{\jlreq@resulta}}{\expandonce{\jlreq@resultb}}}%
+ }{%
+ \edef\jlreq@do{\noexpand\jlreq@tempa{##1}{}}%
}%
- \@tempa##1,\jlreq@endmark
+ \def\jlreq@tempa####1####2{##2}%
\jlreq@do
}%
\jlreq@parsekeyval[BlockHeading:#1]{
@@ -2173,14 +2168,15 @@ \newcommand{\SetBlockHeadingSpaces}[1]{%
\begingroup
% 現段階の情報をクリアする
- \@for\jlreq@tempa:=\jlreq@BlockHeading@spaces@headingslist\do{%
- \expandafter\let\csname jlreq@BlockHeading@spaces@setlist@\jlreq@tempa\endcsname=\@undefined
- }%
- \def\jlreq@BlockHeading@spaces@headingslist{}%
\def\jlreq@tempa{}% 見出しリスト
\def\jlreq@tempb{}% 設定リスト \def\jlreq@BlockHeading@spaces@***{{**}{**}...}ってのを入れる
\jlreq@SetBlockHeadingSpaces#1\jlreq@endmark
\edef\jlreq@do{%
+ \unexpanded{%
+ \@for\@tempa:=\jlreq@BlockHeading@spaces@headingslist\do{%
+ \expandafter\let\csname jlreq@BlockHeading@spaces@setlist@\@tempa\endcsname=\@undefined
+ }%
+ }%
\unexpanded{\def\jlreq@BlockHeading@spaces@headingslist}{\expandonce{\jlreq@tempa}}%
\expandonce{\jlreq@tempb}%
}%
@@ -2188,12 +2184,12 @@ \jlreq@do
}
\def\jlreq@SetBlockHeadingSpaces{% カンマを無視する処理
- \@ifnextchar,{\expandafter\jlreq@SetBlockHeadingSpaces@\@gobble}{\jlreq@SetBlockHeadingSpaces@}%
+ \@ifnextchar,{\expandafter\jlreq@SetBlockHeadingSpaces@i\@gobble}{\jlreq@SetBlockHeadingSpaces@i}%
}
-\def\jlreq@SetBlockHeadingSpaces@{%
- \@ifnextchar[{\jlreq@SetBlockHeadingSpaces@@}{\jlreq@SetBlockHeadingSpaces@@[]}%
+\def\jlreq@SetBlockHeadingSpaces@i{%
+ \@ifnextchar[{\jlreq@SetBlockHeadingSpaces@ii}{\jlreq@SetBlockHeadingSpaces@ii[]}%
}
-\def\jlreq@SetBlockHeadingSpaces@@[#1]#2{%
+\def\jlreq@SetBlockHeadingSpaces@ii[#1]#2{%
\jlreq@ifendmark{#2}{}{%
\def\jlreq@headings{}% 見出し名リスト
\jlreq@BlockHeading@gyodori@parsekeyval[BlockHeadingSpaces]{#1}{}{}{}%
@@ -2205,7 +2201,7 @@ \jlreq@ifempty{##2}{\jlreq@tempbtrue}{\jlreq@tempbfalse}% 後ろ開きが空ならば\jlreq@tempbtrue
}%
\expandafter\jlreq@do\jlreq@totalset
- \jlreq@SetBlockHeadingSpaces@@@{#2}%
+ \jlreq@SetBlockHeadingSpaces@iii{#2}%
\eappto\jlreq@tempa{,\expandonce{\jlreq@headings}}% \jlreq@tempaに\jlreq@headingsを追加
\ifjlreq@tempb
\ifx\jlreq@lastdimen\@empty\else % 最後が寸法だったので\jlreq@SetBlockHeadingSpaces@totalsetを改変
@@ -2226,12 +2222,13 @@ \jlreq@SetBlockHeadingSpaces
}%
}
-\def\jlreq@SetBlockHeadingSpaces@@@#1{%
+\def\jlreq@SetBlockHeadingSpaces@iii#1{%
\@for\@tempa:=#1\do{%
+ \expandafter\jlreq@remove@spaceandbracket\expandafter{\@tempa}{\@tempa}%
\expandafter\jlreq@iffirsttoken@ignorespaces\expandafter{\@tempa}{_}{%
\ifx\jlreq@lastdimen\@empty\else\eappto\jlreq@set{{\expandonce{\jlreq@lastdimen}}}\fi%
\def\jlreq@lastdimen{}%
- \expandafter\jlreq@SetBlockHeadingSpaces@@@@\@tempa{\jlreq@endmark}%
+ \expandafter\jlreq@SetBlockHeadingSpaces@iv\@tempa{\jlreq@endmark}%
}{%
\ifjlreq@tempa
% 最初が寸法なので,全体の設定(\jlreq@totalset)に組み込む.
@@ -2247,7 +2244,7 @@ \jlreq@tempafalse
}%
}
-\def\jlreq@SetBlockHeadingSpaces@@@@#1#{%
+\def\jlreq@SetBlockHeadingSpaces@iv#1#{%
\expandafter\jlreq@ifcontains\expandafter{\@gobble #1}{_}{%
\ClassWarning{jlreq}{Unusual heading name `\@gobble #1' is found. You forgot a comma? (in SetBlockHeadingSpaces)}%
}{}%
@@ -2257,9 +2254,9 @@ \ClassWarning{jlreq}{The heading name `\@gobble #1' ends with `*'. Do you mean `\@tempa{*}'? (in SetBlockHeadingSpaces)}%
}}{}%
\appto\jlreq@headings{#1}%
- \jlreq@SetBlockHeadingSpaces@@@@@
+ \jlreq@SetBlockHeadingSpaces@v
}
-\def\jlreq@SetBlockHeadingSpaces@@@@@#1{%
+\def\jlreq@SetBlockHeadingSpaces@v#1{%
% 空っぽの場合は{_{r:0pt}{r:0pt}{}}
\jlreq@ifendmark{#1}{\appto\jlreq@set{{_{r:0pt}{r:0pt}{}}}}{%
\jlreq@iffirsttoken{#1}{*}{% *始まりの場合は{_*{}{}{}}
@@ -3163,6 +3160,7 @@ % \jlreq@tempcにセクション名たちを入れていく
\def\jlreq@tempc{}
\@for\jlreq@tempa:=#1\do{
+ \expandafter\jlreq@remove@spaceandbracket\expandafter{\jlreq@tempa}{\jlreq@tempa}%
\jlreq@switch{\jlreq@tempa}{
{headings}{\jlreq@tempatrue}
{paragraph}{
@@ -4015,7 +4013,7 @@ % _iiが存在するか調べて\ifjlreq@headii@existに入れる
\newif\ifjlreq@headii@exist
\jlreq@headii@existfalse
- \@for\jlreq@tempa:=\jlreq@odd@running@head@ii,\jlreq@odd@running@head@ii\do{%
+ \jlreq@for@noexpand\jlreq@tempa:=\jlreq@odd@running@head@ii,\jlreq@odd@running@head@ii\do{%
\expandafter\ifx\jlreq@tempa\@empty\else\jlreq@headii@existtrue\fi
}%
% markの処理
@@ -4026,7 +4024,7 @@ % * 例えば_<見出し命令>が_sectionならば,\jlreq@markdata@sectionに{{<I1>}{<I2>}{<I3>}}を追加する.ここで<I1>,<I2>,<I3>は
% - I1: @iiが無いときにodd or even
% - I2: @iiが無ければ0,あれば1.
- % - I3: マーク出力命令がleftかrightか.(上述のようにoddかevenかで判定される.)
+ % - I3: マーク出力命令がleftかrightに応じて l or r.(上述のようにoddかevenかで判定される.)
% * 他にも_sectionが指定されている柱があれば,\jlreq@markdata@sectionにさらに追加で加えていく.
% * \jlreq@(odd|even)@running@head(@ii)@heading@levelに<見出し命令>のレベルを入れる.レベルが不明な時は\relaxになる.
% また,\jlreq@headingmarklistに<見出し命令>の一覧を入れる.
@@ -4696,6 +4694,7 @@ \def\jlreq@do{}%
\def\jlreq@keyvallist{}%
\@for\@tempa:=#1\do{%
+ \expandafter\jlreq@remove@spaceandbracket\expandafter{\@tempa}{\@tempa}%
\expandafter\jlreq@ifcontains\expandafter{\@tempa}{=}{%
\expandafter\appto\expandafter\jlreq@keyvallist\expandafter{\@tempa,}%
}{%
|