summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/jlreq
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-19 23:27:52 +0000
committerKarl Berry <karl@freefriends.org>2018-05-19 23:27:52 +0000
commitd5975620549112823d69c164a8e1d06cb83398c2 (patch)
tree58bb37ab24bdb0b7fbfd0eeeeb0db5e6e5925429 /Master/texmf-dist/tex/latex/jlreq
parent4fa4ff22732b71ed4356295cbbe0672e29dcea43 (diff)
jlreq (19may18)
git-svn-id: svn://tug.org/texlive/trunk@47771 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.sty454
-rw-r--r--Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty355
-rw-r--r--Master/texmf-dist/tex/latex/jlreq/jlreq.cls707
3 files changed, 1013 insertions, 503 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty
new file mode 100644
index 00000000000..880622c4963
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty
@@ -0,0 +1,454 @@
+% エンジン非依存のマクロ集
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{jlreq-helpers}[2018/04/12 jlreq-helpers]
+\RequirePackage{xkeyval,etoolbox}
+
+%. helper1
+\newcount\jlreq@tempcnta
+\newcount\jlreq@tempcntb
+\newcount\jlreq@tempcntc
+\newdimen\jlreq@tempdima
+\newdimen\jlreq@tempdimb
+\newdimen\jlreq@tempdimc
+\newskip\jlreq@tempskipa
+\newskip\jlreq@tempskipb
+\newskip\jlreq@tempskipc
+\newif\ifjlreq@tempa
+\newif\ifjlreq@tempb
+\newif\ifjlreq@tempc
+\newbox\jlreq@tempboxa
+\newbox\jlreq@tempboxb
+\newbox\jlreq@tempboxc
+% 計算結果を返すための変数
+\newdimen\jlreq@resultdimen
+\newskip\jlreq@resultskip
+\newbox\jlreq@resultbox
+\newif\ifjlreq@result
+\newcount\jlreq@resultcnt
+
+\def\jlreq@uniqtoken{\jlreq@uniqtoken}
+\def\jlreq@endmark{\jlreq@endmark}
+\long\def\jlreq@deleteuntileendmark#1\jlreq@endmark{}
+
+\def\jlreq@expandafter@ii{\expandafter\expandafter\expandafter}
+\edef\jlreq@expandafter@iii{\expandonce{\jlreq@expandafter@ii}\noexpand\expandafter\expandonce{\jlreq@expandafter@ii}}
+\edef\jlreq@expandtwice#1{\expandonce{\jlreq@expandafter@ii}\noexpand\unexpanded\expandonce{\jlreq@expandafter@ii}{#1}}
+\edef\jlreq@expand@three#1{\expandonce{\jlreq@expandafter@iii}\noexpand\unexpanded\expandonce{\jlreq@expandafter@iii}{#1}}
+
+% \jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@の形で使う
+% 二回展開すると,#1の先頭(ただし空白は無視される)を取り出す.#1が空の場合は\jlreq@uniqtoken,先頭が{の場合は\bgroupとなる
+\def\jlreq@endmark@{\jlreq@endmark@} % \jlreq@getfirsttokenだけのためのendmark
+\long\def\jlreq@getfirsttoken#1#{\jlreq@getfirsttoken@#1\bgroup\jlreq@endmark@}
+\long\def\jlreq@getfirsttoken@#1#2\jlreq@endmark@#3\jlreq@endmark@{#1}
+% 与えられたトークン列が空か(展開はしないでチェック)
+\long\def\jlreq@ifempty#1{\expandafter\ifx\expandafter\relax\detokenize{#1}\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
+% #1の先頭トークンが#2か(ただし#1が空ならば#2=\jlreq@uniqtoken,#1={ならば#2=\bgroupでTRUEとなる)
+\long\edef\jlreq@iffirsttoken#1#2{%
+ % スペースチェック
+ \unexpanded{\expandafter\expandafter\expandafter\jlreq@deleteuntileendmark\expandafter\ifx\expandafter}\expandonce{\space}\noexpand\detokenize{#1}\unexpanded{\@undefined\jlreq@endmark\expandafter\@firstoftwo\else\jlreq@endmark\expandafter\@secondoftwo\fi}{%
+ \noexpand\ifx\expandonce{\space}#2\unexpanded{\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}%
+ }{%
+ \noexpand\jlreq@iffirsttoken@ignorespaces{#1}{#2}%
+ }%
+}
+% こちらは先頭のスペースを読み飛ばす
+\long\def\jlreq@iffirsttoken@ignorespaces#1#2{%
+ \expandafter\expandafter\expandafter\ifx\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+}
+
+% #1が\jlreq@endmarkか
+\long\def\jlreq@ifendmark#1{\jlreq@iffirsttoken{#1}{\jlreq@endmark}}
+
+% #1の先頭が引数なしのマクロか
+\long\def\jlreq@ifmacro@noargument#1{%
+ \jlreq@ifempty{#1}{\@secondoftwo}{%
+ \jlreq@iffirsttoken{#1}{ }{\@secondoftwo}{%
+ \expandafter\expandafter\expandafter\jlreq@ifmacro@noargument@\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@
+}}}
+\long\def\jlreq@ifmacro@noargument@#1{\expandafter\jlreq@ifmacro@noargument@@\expandafter{\meaning #1}}
+\edef\jlreq@do{%
+ \unexpanded{\def\jlreq@ifmacro@noargument@@}##1{\noexpand\jlreq@ifmacro@noargument@@@##1\expandonce{\detokenize{macro:->}}\noexpand\jlreq@endmark}
+ \unexpanded{\def\jlreq@ifmacro@noargument@@@}##1\expandonce{\detokenize{macro:->}}##2\noexpand\jlreq@endmark{\noexpand\jlreq@ifempty{##1}}
+}
+\jlreq@do
+
+% #1(skipレジスタ)が0か(展開不可).
+\newcommand*\jlreq@ifgluezero[1]{%
+ \begingroup
+ \edef\@tempa{\the#1}%
+ \edef\@tempb{\detokenize{0.0pt}}%
+ \edef\jlreq@do{\ifx\@tempa\@tempb\noexpand\@firstoftwo\else\noexpand\@secondoftwo\fi}%
+ \expandafter\endgroup
+ \jlreq@do
+}
+
+% #1が#2で終わるか(展開不可)
+\newcommand*{\jlreq@ifendswith}[2]{%
+ \jlreq@ifempty{#2}{\@firstoftwo}{%
+ \begingroup
+ \def\jlreq@tempa##1#2\jlreq@uniqtoken##2\jlreq@endmark{%
+ \edef\jlreq@do{\jlreq@ifempty{##2}{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}}%
+ }%
+ \jlreq@tempa#1\jlreq@uniqtoken#2\jlreq@uniqtoken\jlreq@endmark
+ \expandafter\endgroup
+ \jlreq@do
+ }%
+}
+% #1が#2で始まるか(展開不可)
+\newcommand*{\jlreq@ifstartswith}[2]{%
+ \jlreq@ifempty{#2}{\@firstoftwo}{%
+ \jlreq@ifempty{#1}{\@secondoftwo}{%
+ \begingroup
+ \def\jlreq@tempa##1#2##2\jlreq@endmark{%
+ \edef\jlreq@do{\jlreq@ifempty{##1}{\noexpand\@firstoftwo}{\noexpand\@secondoftwo}}%
+ }%
+ \jlreq@tempa#1#2\jlreq@endmark
+ \expandafter\endgroup
+ \jlreq@do
+ }%
+ }%
+}
+% #1が#2を含むか(展開不可){}内に#2があってもFALSE判定.
+\newcommand*{\jlreq@ifcontains}[2]{%
+ \jlreq@ifempty{#2}{\@firstoftwo}{%
+ \begingroup
+ \def\jlreq@tempa##1#2##2\jlreq@endmark{%
+ \edef\jlreq@do{\jlreq@ifempty{##2}{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}}%
+ }%
+ \jlreq@tempa#1#2\jlreq@endmark
+ \expandafter\endgroup
+ \jlreq@do
+ }%
+}
+
+% @removeelementの括弧があっても動くかもしれない版
+% #2から#1を消して#3に入れる
+\newcommand*{\jlreq@helper@removeelement}[3]{%
+ \begingroup
+ \edef\jlreq@tempa{\unexpanded{#1}}% 消したいやつ
+ \def\jlreq@tempb{}% 消していない分を放り込んでいく
+ \jlreq@tempatrue% 最初の\jlreq@tempbへの追加か.
+ \jlreq@helper@removeelement@#2,\jlreq@endmark,%
+ \edef\jlreq@do{\unexpanded{\def#3}{\expandonce{\jlreq@tempb}}}%
+ \expandafter\endgroup
+ \jlreq@do
+}
+\def\jlreq@helper@removeelement@#1,{%
+ \jlreq@ifendmark{#1}{}{%
+ \edef\@tempa{\unexpanded{#1}}%
+ \ifx\jlreq@tempa\@tempa\expandafter\@gobble\else\expandafter\@firstofone\fi{%
+ \eappto\jlreq@tempb{\ifjlreq@tempa\else,\fi\unexpanded{#1}}%
+ \jlreq@tempafalse
+ }%
+ \jlreq@helper@removeelement@
+ }%
+}
+
+% 空白を無視しない\@ifnextchar
+\newcommand{\jlreq@ifnextchar}[3]{%
+ \let\reserved@d=#1%
+ \edef\reserved@a{\unexpanded{#2}}%
+ \edef\reserved@b{\unexpanded{#3}}%
+ \futurelet\jlreq@nextchar\jlreq@ifnextchar@
+}
+\def\jlreq@ifnextchar@{%
+ \ifx\jlreq@nextchar\reserved@d\let\reserved@b\reserved@a\fi
+ \reserved@b
+}
+% 空白を無視しない\@ifsart
+\newcommand*{\jlreq@ifstar}[2]{\jlreq@ifnextchar *{\edef\reserved@a*{\unexpanded{#1}}\reserved@a}{#2}}
+% カンマで区切って,その前と後ろを\jlreq@resulta,\jlreq@resultbに入れる
+% もしカンマがない場合は\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
+}
+\def\jlreq@helper@removelastcomma#1,\jlreq@endmark{#1}
+
+% vbox #1の最後を\jlreq@resultboxに入れる
+% #1の最後の行は消える
+\newcommand*{\jlreq@getlastbox}[1]{%
+ \setbox#1=\vbox{\unvbox#1\relax
+ \unskip\unskip\unpenalty\global\setbox\jlreq@resultbox=\lastbox}%
+ \ifhbox\jlreq@resultbox
+ \global\setbox\jlreq@resultbox=\hbox{%
+ \unhbox\jlreq@resultbox\unskip\unskip\unpenalty}%
+ \else
+ \global\setbox\jlreq@resultbox=\copy\voidb@x
+ \fi
+}
+
+% 簡易なkeyvalのパース.
+% \jlreq@parsekeyval*[family=jlreq@key]{ % *ありは\setkeys*を使う
+% {key}{\def\val{#1}}
+% *{key}{\def\val{#1}} % デフォルト値を空文字列にする
+% {key}[choice1,choice2]{\def\valchoice{#1}}
+%}{parse対象}
+\newcommand*{\jlreq@parsekeyval}{%
+ \@ifstar{\jlreq@helper@parsekeyval@{*}}{\jlreq@helper@parsekeyval@{}}%
+}
+\def\jlreq@helper@parsekeyval@#1{%
+ \@ifnextchar[{\jlreq@helper@parsekeyval@@{#1}}{\jlreq@helper@parsekeyval@@{#1}[jlreq@key]}%
+}
+\long\def\jlreq@helper@parsekeyval@@#1[#2]#3#4{%
+ \begingroup
+ \def\jlreq@do{}%
+ \jlreq@helper@parsekeyval@@@{#2}#3{\jlreq@endmark}%
+ \setkeys#1{#2}{#4}%
+ \expandafter\endgroup
+ \jlreq@do
+}
+\def\jlreq@helper@parsekeyval@@@#1#2#{%
+ \jlreq@iffirsttoken@ignorespaces{#2}{*}{%
+ \jlreq@helper@parsekeyval@@@definekeywithdefault{#1}%
+ }{%
+ \jlreq@helper@parsekeyval@@@@{#1}%
+ }%
+}
+\long\def\jlreq@helper@parsekeyval@@@@#1#2{%
+ \jlreq@ifendmark{#2}{}{%
+ \@ifnextchar[{\jlreq@helper@parsekeyval@@@choicekey{#1}{#2}}{\jlreq@helper@parsekeyval@@@definekey{#1}{#2}}%
+ }%
+}
+\long\def\jlreq@helper@parsekeyval@@@choicekey#1#2[#3]#4{%
+ \define@choicekey{#1}{#2}{#3}{\eappto\jlreq@do{\unexpanded{#4}}}%
+ \jlreq@helper@parsekeyval@@@{#1}%
+}
+\long\def\jlreq@helper@parsekeyval@@@definekeywithdefault#1#2#3{%
+ \define@key{#1}{#2}[]{\eappto\jlreq@do{\unexpanded{#3}}}%
+ \jlreq@helper@parsekeyval@@@{#1}%
+}
+\long\def\jlreq@helper@parsekeyval@@@definekey#1#2#3{%
+ \define@key{#1}{#2}{\eappto\jlreq@do{\unexpanded{#3}}}%
+ \jlreq@helper@parsekeyval@@@{#1}%
+}
+
+% キー指定しないkeyval(独自実装)
+% \jlreq@parsekeyval@nokey{<action>}{<parse対象>}
+% action内では#1=key, #2=val
+\newcommand{\jlreq@parsekeyval@nokey}[2]{%
+ \begingroup
+ \def\jlreq@do{}%
+ \def\jlreq@parsekeyval@nokey@execute##1##2{#1}%
+ \expandafter\jlreq@parsekeyval@nokey@#2,\jlreq@endmark,%
+ \expandafter\endgroup
+ \jlreq@do
+}
+\long\def\jlreq@parsekeyval@nokey@#1,{%
+ \jlreq@ifendmark{#1}{}{\jlreq@parsekeyval@nokey@@#1=\jlreq@endmark}%
+}
+\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@@@#1#2{%
+ \eappto\jlreq@do{\expandonce{\jlreq@parsekeyval@nokey@execute{#2}{#1}}}%
+ \jlreq@parsekeyval@nokey@
+}
+\long\def\jlreq@parsekeyval@nokey@@@@#1=\jlreq@endmark{#1}
+
+% \jlreq@switch{str}{
+% {str}{abcd}
+% {str1}{xyz}
+%}[default: input = #1] -> abcd
+%または
+%
+% \jlreq@switch{str}{
+% {str}{abcd}
+% {str1}{xyz}
+% {default} % ここは#1を受け付けない(パラメータトークンを受け付けたい場合のため).
+%} -> abcd
+% 文字列比較→\edefして比較する
+% 第一引数は\jlreq@tempaに入れておく.
+\long\def\jlreq@helper@switch@executeoption#1[#2]{%
+ \begingroup
+ \def\jlreq@do##1{#2}%
+ \expandafter\endgroup
+ \jlreq@do{#1}%
+}
+\long\def\jlreq@helper@removeoption[#1]{}
+\newcommand{\jlreq@switch}[2]{%
+ \begingroup
+ \let\jlreq@do\@undefined
+ \edef\jlreq@tempa{#1}% ループ中ずっと保存する
+ \jlreq@helper@switch@#2\jlreq@endmark
+ \ifx\jlreq@do\@undefined
+ \def\jlreq@do{\@ifnextchar[{\jlreq@helper@switch@executeoption{#1}}{}}%
+ \else
+ \appto\jlreq@do{\@ifnextchar[{\jlreq@helper@removeoption}{}}%
+ \fi
+ \expandafter\endgroup
+ \jlreq@do
+}
+\long\def\jlreq@helper@switch@#1{%
+ \jlreq@ifendmark{#1}{}{\jlreq@helper@switch@@{#1}}%
+}
+
+\long\def\jlreq@helper@switch@@#1#2{%
+ \jlreq@ifendmark{#2}{%
+ \edef\jlreq@do{\unexpanded{#1}}%
+ }{%
+ \edef\jlreq@tempb{#1}%
+ \ifx\jlreq@tempa\jlreq@tempb\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{%
+ \edef\jlreq@do{\unexpanded{#2}}%
+ \jlreq@deleteuntileendmark
+ }{%
+ \jlreq@helper@switch@
+ }%
+ }%
+}
+
+
+\RequirePackage[savepos]{zref}
+\newcount\jlreq@zref@reference@count
+\jlreq@zref@reference@count=0
+% 現在のページを得る
+\zref@newprop*{jlreq@page}[0]{\number\c@page}
+\zref@addprop{main}{jlreq@page}
+\newcount\jlreq@currentpage
+% \jlreq@setcurrentpageをすると,\jlreq@currentpageにこの場所のページ数が入る
+\newcommand*{\jlreq@setcurrentpage}{%
+ \global\advance\jlreq@zref@reference@count by 1
+ \zref@labelbyprops{jlreq@currentpage.\the\jlreq@zref@reference@count}{jlreq@page}%
+ \global\jlreq@currentpage=\zref@extractdefault{jlreq@currentpage.\the\jlreq@zref@reference@count}{jlreq@page}{\c@page}\relax
+}
+
+% 先頭にあるマクロを展開しまくった結果の先頭を#2に入れる.
+\newcommand{\jlreq@getfirsttoken@expandmacros}[2]{%
+ \jlreq@iffirsttoken{#1}{ }{\def#2{ }}{%
+ \jlreq@ifempty{#1}{\def#2{}}{%
+ \jlreq@ifmacro@noargument{#1}{%
+ \expandafter\jlreq@getfirsttoken@expandmacros\expandafter{#1}{#2}%
+ }{%
+ \expandafter\expandafter\expandafter\jlreq@getfirsttoken@expandmacros@\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@{#2}%
+ }%
+ }%
+ }%
+}
+\def\jlreq@getfirsttoken@expandmacros@#1#2{\def#2{#1}}
+
+\def\jlreq@helper@checktokenlist#1#2{%
+ \jlreq@ifendmark{#2}{\@firstoftwo}%
+ {%
+ \ifnum0#1{#2}>0 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+ {\jlreq@helper@checktokenlist{#1}}%
+ {\expandafter\@secondoftwo\jlreq@deleteuntileendmark}%
+ }%
+}
+\def\jlreq@helper@chknumlist#1{\ifx#101\fi\ifx#111\fi\ifx#121\fi\ifx#131\fi\ifx#141\fi\ifx#151\fi\ifx#161\fi\ifx#171\fi\ifx#181\fi\ifx#191\fi}
+\def\jlreq@helper@chkfloatlist#1{\jlreq@helper@chknumlist{#1}\ifx#1.1\fi}
+% #1が[0-9\.]*に当てはまるか.
+\newcommand*{\jlreq@iffloat}[1]{\jlreq@helper@checktokenlist{\jlreq@helper@chkfloatlist}#1\jlreq@endmark}
+\newcommand*{\jlreq@ifnumber}[1]{\jlreq@helper@checktokenlist{\jlreq@helper@chknumlist}#1\jlreq@endmark}
+
+% \jlreq@ifprimitive#1#2#3: #1がprimitiveならば#2を,そうでなければ#3を実行する
+% (\if(pdf)primitiveを避けるようにしている.)
+\newcommand*{\jlreq@ifprimitive}[1]{%
+ \begingroup
+ \edef\@tempa{\string#1}%
+ \edef\@tempb{\meaning#1}%
+ \expandafter\endgroup
+ \ifx\@tempa\@tempb\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+}
+
+\newcommand*{\jlreq@helper@guessengine}{%
+ \jlreq@ifprimitive\directlua{%
+ \let\jlreq@result=l%
+ }{%
+ \jlreq@ifprimitive\ucs{%
+ \let\jlreq@result=u%
+ }{%
+ \let\jlreq@result=p%
+ }%
+ }%
+}
+
+% #1を\@undefinedに,既に\@undefinedならば#2{#1}を呼ぶ
+\newcommand*{\jlreq@helper@undefcs}[2]{%
+ \ifundef{#1}{#2{#1}}{\undef{#1}}%
+}
+% \if版
+\newcommand*{\jlreq@helper@undefif}[2]{%
+ \ifundef{#1}{#2{#1}}{%
+ \edef\@tempa{\expandafter\@gobble\string#1}%
+ \edef\@tempa{\expandafter\@gobbletwo\@tempa}%
+ \undef{#1}%
+ \expandafter\undef\expandafter{\csname\@tempa true\endcsname}%
+ \expandafter\undef\expandafter{\csname\@tempa false\endcsname}%
+ }%
+}
+
+% 紙サイズ一覧
+\@namedef{jlreq@helper@papersizelist@a0}{{841mm}{1189mm}}
+\@namedef{jlreq@helper@papersizelist@a1}{{594mm}{841mm}}
+\@namedef{jlreq@helper@papersizelist@a2}{{420mm}{594mm}}
+\@namedef{jlreq@helper@papersizelist@a3}{{297mm}{420mm}}
+\@namedef{jlreq@helper@papersizelist@a4}{{210mm}{297mm}}
+\@namedef{jlreq@helper@papersizelist@a5}{{148mm}{210mm}}
+\@namedef{jlreq@helper@papersizelist@a6}{{105mm}{148mm}}
+\@namedef{jlreq@helper@papersizelist@a7}{{74mm}{105mm}}
+\@namedef{jlreq@helper@papersizelist@a8}{{52mm}{74mm}}
+\@namedef{jlreq@helper@papersizelist@a9}{{37mm}{52mm}}
+\@namedef{jlreq@helper@papersizelist@a10}{{26mm}{37mm}}
+
+\@namedef{jlreq@helper@papersizelist@b0}{{1030mm}{1456mm}}
+\@namedef{jlreq@helper@papersizelist@b1}{{728mm}{1030mm}}
+\@namedef{jlreq@helper@papersizelist@b2}{{515mm}{728mm}}
+\@namedef{jlreq@helper@papersizelist@b3}{{364mm}{515mm}}
+\@namedef{jlreq@helper@papersizelist@b4}{{257mm}{364mm}}
+\@namedef{jlreq@helper@papersizelist@b5}{{182mm}{257mm}}
+\@namedef{jlreq@helper@papersizelist@b6}{{128mm}{182mm}}
+\@namedef{jlreq@helper@papersizelist@b7}{{91mm}{128mm}}
+\@namedef{jlreq@helper@papersizelist@b8}{{64mm}{91mm}}
+\@namedef{jlreq@helper@papersizelist@b9}{{45mm}{64mm}}
+\@namedef{jlreq@helper@papersizelist@b10}{{32mm}{45mm}}
+
+\@namedef{jlreq@helper@papersizelist@c2}{{458mm}{648mm}}
+\@namedef{jlreq@helper@papersizelist@c3}{{324mm}{458mm}}
+\@namedef{jlreq@helper@papersizelist@c4}{{229mm}{354mm}}
+\@namedef{jlreq@helper@papersizelist@c5}{{162mm}{229mm}}
+\@namedef{jlreq@helper@papersizelist@c6}{{114mm}{162mm}}
+\@namedef{jlreq@helper@papersizelist@c7}{{81mm}{114mm}}
+\@namedef{jlreq@helper@papersizelist@c8}{{57mm}{81mm}}
+
+\@namedef{jlreq@helper@papersizelist@a4var}{{210mm}{283mm}}
+\@namedef{jlreq@helper@papersizelist@b5var}{{182mm}{230mm}}
+
+\@namedef{jlreq@helper@papersizelist@letter}{{8.5in}{11in}}
+\@namedef{jlreq@helper@papersizelist@legal}{{8.5in}{14in}}
+\@namedef{jlreq@helper@papersizelist@executive}{{7.25in}{10.5in}}
+\@namedef{jlreq@helper@papersizelist@hagaki}{{100mm}{148mm}}
+
+% #1÷#2を\jlreq@resultdimenに入れる.(#1,#2は寸法を与える.)
+\newcommand*{\jlreq@helper@divide}[2]{%
+ \begingroup
+ \@tempdima=\dimexpr#1\relax\@tempdimb=\dimexpr#2\relax
+ % 分母を正にする
+ \ifdim\@tempdimb<0pt \@tempdima=-\@tempdima\@tempdimb=-\@tempdimb\fi
+ % \jlreq@tempdima*\@tempdimb <= \@tempdima < (\jlreq@tempdima + 1)*\@tempdimb
+ % となる整数\jlreq@tempdimaを捜し,\jlreq@tempdimb=\jlreq@tempdima + 1とする
+ \jlreq@tempdima=0pt
+ \ifdim\@tempdima<0pt
+ \loop\ifdim\strip@pt\jlreq@tempdima\@tempdimb>\@tempdima\advance\jlreq@tempdima by -1pt\repeat
+ \else
+ \loop\ifdim\strip@pt\jlreq@tempdima\@tempdimb<\@tempdima\advance\jlreq@tempdima by 1pt\repeat
+ \ifdim\strip@pt\jlreq@tempdima\@tempdimb=\@tempdima\else\advance\jlreq@tempdima by -1pt\fi
+ \fi
+ \jlreq@tempdimb=\dimexpr\jlreq@tempdima + 1pt\relax
+ % \jlreq@tempdimaと\jlreq@tempdimbで挟んでいく二分法
+ \jlreq@tempcnta=0 % 無限ループを避けるためのカウンタ
+ \loop\ifnum\numexpr\ifdim\dimexpr\jlreq@tempdimb - \jlreq@tempdima\relax>1sp 1\else0\fi*\ifnum\jlreq@tempcnta<100 1\else 0\fi\relax=1
+ \jlreq@tempdimc=\dimexpr(\jlreq@tempdima+\jlreq@tempdimb)/2\relax
+ \ifdim\strip@pt\jlreq@tempdimc\@tempdimb>\@tempdima\jlreq@tempdimb=\jlreq@tempdimc
+ \else\jlreq@tempdima=\jlreq@tempdimc\fi
+ \advance\jlreq@tempcnta by 1
+ \repeat
+ \edef\jlreq@do{\noexpand\jlreq@resultdimen=\the\jlreq@tempdima\noexpand\relax}%
+ \expandafter\endgroup
+ \jlreq@do
+}
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty b/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty
new file mode 100644
index 00000000000..48f9bd51439
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/jlreq/jlreq-trimmarks.sty
@@ -0,0 +1,355 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{jlreq-trimmarks}[2018/05/19 jlreq-trimmarks]
+\RequirePackage{xkeyval,etoolbox}
+\RequirePackage{jlreq-helpers}
+
+\newcommand*{\jlreq@trimmarks@undeferr}[1]{\PackageError{jlreq-trimmarks}{Trying to delete \string#1 even though it is not defined, may be a bug}{\@ehc}}
+\newcommand*{\jlreq@trimmarks@afterpkg@addtodeletecs}[1]{%
+ \appto\jlreq@trimmarks@afterpkg@deletecslist{\jlreq@helper@undefcs{#1}{\jlreq@trimmarks@undeferr}}%
+}
+\newcommand*{\jlreq@trimmarks@afterpkg@addtodeleteif}[1]{%
+ \appto\jlreq@trimmarks@afterpkg@deletecslist{\jlreq@helper@undefif{#1}{\jlreq@trimmarks@undeferr}}%
+}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@afterpkg@addtodeletecs}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@afterpkg@addtodeleteif}
+\AtEndOfPackage{%
+ \jlreq@trimmarks@afterpkg@deletecslist
+ \jlreq@helper@undefcs{\jlreq@trimmarks@afterpkg@deletecslist}{\jlreq@trimmarks@undeferr}%
+ \undef{\jlreq@trimmarks@undeferr}%
+}
+
+\newcommand*{\jlreq@trimmarks@DeclareOption}[2]{%
+ \DeclareOptionX{#1}{%
+ \jlreq@ifempty{##1}{}{\PackageError{jlreq-trimmarks}{The option #1 should have no value}{\@ehc}}%
+ #2%
+ }
+}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@DeclareOption}
+
+\@ifclassloaded{jlreq}{\let\ifjlreq@trimmarks@jlreqloaded=\@firstoftwo}{\let\ifjlreq@trimmarks@jlreqloaded=\@secondoftwo}
+
+% dvipdfmx=f,dvips=s,dviout = o, lualatex = l
+\jlreq@trimmarks@DeclareOption{dvipdfmx}{\let\jlreq@trimmarks@driver=f}
+\jlreq@trimmarks@DeclareOption{dvips}{\let\jlreq@trimmarks@driver=s}
+\jlreq@trimmarks@DeclareOption{dviout}{\let\jlreq@trimmarks@driver=o}
+\let\jlreq@trimmarks@engine=\jlreq@engine
+\jlreq@trimmarks@DeclareOption{lualatex}{\let\jlreq@trimmarks@engine=l}
+\jlreq@trimmarks@DeclareOption{uplatex}{\let\jlreq@trimmarks@engine=u}
+\jlreq@trimmarks@DeclareOption{platex}{\let\jlreq@trimmarks@engine=p}
+
+\def\jlreq@trimmarks@switchpapersize{}
+\def\jlreq@trimmarks@addpapersize#1{%
+ \@ifnextchar[{\jlreq@trimmarks@addpapersize@{#1}}{\jlreq@trimmarks@addpapersize@@{#1}}
+}
+\def\jlreq@trimmarks@addpapersize@#1[#2]{%
+ \edef\@tempa{\unexpanded{\jlreq@trimmarks@addpapersize@@{#1}}\csexpandonce{jlreq@helper@papersizelist@#2}}%
+ \@tempa
+}
+\newcommand*{\jlreq@trimmarks@addpapersize@@}[3]{%
+ \@for\@tempa:=#1\do{%
+ \eappto\jlreq@trimmarks@switchpapersize{{\expandonce{\@tempa}}{\unexpanded{\def\jlreq@trimmarks@paperwidth{#2}\def\jlreq@trimmarks@paperheight{#3}}}}%
+ }%
+}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@switchpapersize}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@addpapersize}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@addpapersize@}
+\jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@addpapersize@@}
+
+\jlreq@trimmarks@addpapersize{a0,A0}[a0]
+\jlreq@trimmarks@addpapersize{a1,A1}[a1]
+\jlreq@trimmarks@addpapersize{a2,A2}[a2]
+\jlreq@trimmarks@addpapersize{a3,A3}[a3]
+\jlreq@trimmarks@addpapersize{a4,A4}[a4]
+\jlreq@trimmarks@addpapersize{a5,A5}[a5]
+\jlreq@trimmarks@addpapersize{a6,A6}[a6]
+\jlreq@trimmarks@addpapersize{a7,A7}[a7]
+\jlreq@trimmarks@addpapersize{a8,A8}[a8]
+\jlreq@trimmarks@addpapersize{a9,A9}[a9]
+\jlreq@trimmarks@addpapersize{a10,A10}[a10]
+
+\jlreq@trimmarks@addpapersize{b0,B0}[b0]
+\jlreq@trimmarks@addpapersize{b1,B1}[b1]
+\jlreq@trimmarks@addpapersize{b2,B2}[b2]
+\jlreq@trimmarks@addpapersize{b3,B3}[b3]
+\jlreq@trimmarks@addpapersize{b4,B4}[b4]
+\jlreq@trimmarks@addpapersize{b5,B5}[b5]
+\jlreq@trimmarks@addpapersize{b6,B6}[b6]
+\jlreq@trimmarks@addpapersize{b7,B7}[b7]
+\jlreq@trimmarks@addpapersize{b8,B8}[b8]
+\jlreq@trimmarks@addpapersize{b9,B9}[b9]
+\jlreq@trimmarks@addpapersize{b10,B10}[b10]
+
+\jlreq@trimmarks@addpapersize{c2,C2}[c2]
+\jlreq@trimmarks@addpapersize{c3,C3}[c3]
+\jlreq@trimmarks@addpapersize{c4,C4}[c4]
+\jlreq@trimmarks@addpapersize{c5,C5}[c5]
+\jlreq@trimmarks@addpapersize{c6,C6}[c6]
+\jlreq@trimmarks@addpapersize{c7,C7}[c7]
+\jlreq@trimmarks@addpapersize{c8,C8}[c8]
+
+\jlreq@trimmarks@addpapersize{a4var}[a4var]
+\jlreq@trimmarks@addpapersize{b5var}[b5var]
+
+\jlreq@trimmarks@addpapersize{letter}[letter]
+\jlreq@trimmarks@addpapersize{legal}[legal]
+\jlreq@trimmarks@addpapersize{executive}[executive]
+\jlreq@trimmarks@addpapersize{hagaki}[hagaki]
+
+\DeclareOptionX{trimmarks_paper}{
+ \edef\jlreq@do{%
+ \unexpanded{\jlreq@switch{#1}}{\expandonce{\jlreq@trimmarks@switchpapersize}}%
+ [\unexpanded{%
+ \jlreq@helper@dividebycomma{#1}%
+ \ifjlreq@result
+ \edef\jlreq@trimmarks@paperwidth{\jlreq@resulta}
+ \edef\jlreq@trimmarks@paperheight{\jlreq@resultb}
+ \else
+ \PackageError{jlreq}{The paper #1 is unknown}{\@ehc}%
+ \fi
+ }]%
+ }%
+ \jlreq@do
+}
+
+\newif\ifjlreq@trimmarks@digital \jlreq@trimmarks@digitaltrue
+\newif\ifjlreq@trimmarks@show \jlreq@trimmarks@showtrue
+\newif\ifjlreq@trimmarks@show@artbox \jlreq@trimmarks@show@artboxfalse
+\tombowdatetrue
+\DeclareOptionX{show}{%
+ \jlreq@ifempty{#1}{
+ \jlreq@trimmarks@showtrue\tombowdatetrue\jlreq@trimmarks@digitaltrue
+ }{
+ \jlreq@trimmarks@showfalse\tombowdatefalse\jlreq@trimmarks@digitalfalse
+ \@for\jlreq@trimmarks@tempa:=#1\do{%
+ \jlreq@switch{\jlreq@trimmarks@tempa}{
+ {trimmarks}{\jlreq@trimmarks@showtrue}
+ {banner}{\tombowdatetrue}
+ {digital}{\jlreq@trimmarks@digitaltrue}
+ {digital*}{\jlreq@trimmarks@digitaltrue\jlreq@trimmarks@show@artboxtrue}
+ {no}{\tombowdatefalse\jlreq@trimmarks@showfalse\jlreq@trimmarks@digitafalse}
+ }[\PackageError{jlreq-trimmarks}{Unknown value `##1' in the option `show'}{\@ehc}]
+ }
+ }
+}
+
+\let\jlreq@temporary@original@@removeelement=\@removeelement
+\let\@removeelement=\jlreq@helper@removeelement
+\ProcessOptionsX*\relax
+\let\@removeelement=\jlreq@temporary@original@@removeelement
+\let\jlreq@temporary@original@@removeelement=\@undefined
+
+\ifx o\jlreq@trimmarks@driver
+ \ifjlreq@trimmarks@digital
+ \ClassError{jlreq}{`show=digital' can't be used with the driver `dviout'}{\@ehc}
+ \fi
+\fi
+
+\newcommand{\jlreqtrimmarkssetup}[1]{%
+ \jlreq@parsekeyval{%
+ {banner}{\@bannertoken{##1}\maketombowbox}
+ {bleed_margin}{\def\jlreq@trimmarks@bleed{##1}\maketombowbox}
+ {trimmarks_width}{\setlength{\@tombowwidth}{##1}\maketombowbox}
+ {color}{
+ \jlreq@ifempty{##1}{
+ \def\jlreq@trimmarks@color{\normalcolor}
+ }{
+ \@ifundefined{color}{
+ \PackageError{jlreq-trimmarks}{`\string\color' is not defined, please load the package `color' or its variant before this package}{\@ehc}
+ }
+ \jlreq@switch{##1}{
+ {c}{\def\jlreq@trimmarks@color{\color[cmyk]{1,0,0,0}}}
+ {m}{\def\jlreq@trimmarks@color{\color[cmyk]{0,1,0,0}}}
+ {y}{\def\jlreq@trimmarks@color{\color[cmyk]{0,0,1,0}}}
+ {k}{\def\jlreq@trimmarks@color{\color[cmyk]{0,0,0,1}}}
+ {cm}{\def\jlreq@trimmarks@color{\color[cmyk]{1,1,0,0}}}
+ {cy}{\def\jlreq@trimmarks@color{\color[cmyk]{1,0,1,0}}}
+ {ck}{\def\jlreq@trimmarks@color{\color[cmyk]{1,0,0,1}}}
+ {my}{\def\jlreq@trimmarks@color{\color[cmyk]{0,1,1,0}}}
+ {mk}{\def\jlreq@trimmarks@color{\color[cmyk]{0,1,0,1}}}
+ {yk}{\def\jlreq@trimmarks@color{\color[cmyk]{0,0,1,1}}}
+ {cmy}{\def\jlreq@trimmarks@color{\color[cmyk]{1,1,1,0}}}
+ {cmk}{\def\jlreq@trimmarks@color{\color[cmyk]{1,1,0,1}}}
+ {cyk}{\def\jlreq@trimmarks@color{\color[cmyk]{1,0,1,1}}}
+ {myk}{\def\jlreq@trimmarks@color{\color[cmyk]{0,1,1,1}}}
+ {cmyk}{\def\jlreq@trimmarks@color{\color[cmyk]{1,1,1,1}}}
+ {
+ \jlreq@iffirsttoken{##1}{[}{
+ \def\@tempa[####1]####2\jlreq@endmark{\def\jlreq@trimmarks@color{\color[####1]{####2}}}
+ }{
+ \def\@tempa####1\jlreq@endmark{\def\jlreq@trimmarks@color{\color{####1}}}
+ }
+ \@tempa##1\jlreq@endmark
+ }
+ }
+ }
+ \maketombowbox
+ }
+ }{#1}
+}
+\@onlypreamble\jlreqtrimmarkssetup
+\jlreqtrimmarkssetup{
+ banner={%
+ \jobname\space(\number\year-\two@digits\month-\two@digits\day
+ \space\two@digits\hour:\two@digits\minute)%
+ },
+ bleed_margin=3mm,
+ color={}
+}
+
+\ifx\jlreq@trimmarks@engine\@undefined
+ \jlreq@helper@guessengine
+ \let\jlreq@trimmarks@engine=\jlreq@result
+\fi
+
+\ifx\jlreq@trimmarks@driver\@undefined
+ \ifx l\jlreq@trimmarks@engine
+ \let\jlreq@trimmarks@driver=l
+ \else
+ % default: dvipdfmx
+ \let\jlreq@trimmarks@driver=f
+ \fi
+\fi
+
+\ifx\jlreq@trimmarks@paperwidth\@undefined
+ \edef\jlreq@trimmarks@paperwidth{\the\dimexpr\paperwidth + 2in\relax}
+ \edef\jlreq@trimmarks@paperheight{\the\dimexpr\paperheight + 2in\relax}
+\fi
+
+\ifx l\jlreq@engine
+ \setlength{\pagewidth}{\dimexpr\jlreq@trimmarks@paperwidth\relax}
+ \setlength{\pageheight}{\dimexpr\jlreq@trimmarks@paperheight\relax}
+\else
+ \setlength{\pdfpagewidth}{\dimexpr\jlreq@trimmarks@paperwidth\relax}
+ \setlength{\pdfpageheight}{\dimexpr\jlreq@trimmarks@paperheight\relax}
+\fi
+
+\hoffset=\dimexpr(\jlreq@trimmarks@paperwidth - \paperwidth)/2 - 1in\relax
+\voffset=\dimexpr(\jlreq@trimmarks@paperheight - \paperheight)/2 - 1in\relax
+
+\ifx l\jlreq@trimmarks@driver\else
+ \edef\@tempa{\noexpand\AtBeginDvi{\noexpand\special{papersize=\the\dimexpr\jlreq@trimmarks@paperwidth\relax,\the\dimexpr\jlreq@trimmarks@paperheight\relax}}}
+ \@tempa
+\fi
+\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
+\@ifundefined{stockheight}{\newdimen\stockheight}{}
+\setlength{\stockwidth}{\dimexpr\jlreq@trimmarks@paperwidth\relax}
+\setlength{\stockheight}{\dimexpr\jlreq@trimmarks@paperheight\relax}
+
+\def\maketombowbox{%
+ \setbox\@TL\hbox to\z@{\yoko\hss
+ \vrule width\dimexpr 10mm + \jlreq@trimmarks@bleed\relax height\@tombowwidth depth\z@
+ \vrule height10mm width\@tombowwidth depth\z@
+ \iftombowdate
+ \raise4pt\hbox to\z@{\hskip5mm\@bannerfont\the\@bannertoken\hss}%
+ \fi}%
+ \setbox\@Tl\hbox to\z@{\yoko\hss
+ \vrule width10mm height\@tombowwidth depth\z@
+ \vrule height\dimexpr 10mm + \jlreq@trimmarks@bleed\relax width\@tombowwidth depth\z@}%
+ \setbox\@TC\hbox{\yoko
+ \vrule width10mm height\@tombowwidth depth\z@
+ \vrule height10mm width\@tombowwidth depth\z@
+ \vrule width10mm height\@tombowwidth depth\z@}%
+ \setbox\@TR\hbox to\z@{\yoko
+ \vrule height10mm width\@tombowwidth depth\z@
+ \vrule width\dimexpr 10mm + \jlreq@trimmarks@bleed\relax height\@tombowwidth depth\z@\hss}%
+ \setbox\@Tr\hbox to\z@{\yoko
+ \vrule height\dimexpr 10mm + \jlreq@trimmarks@bleed\relax width\@tombowwidth depth\z@
+ \vrule width10mm height\@tombowwidth depth\z@\hss}%
+ \setbox\@BL\hbox to\z@{\yoko\hss
+ \vrule width\dimexpr 10mm + \jlreq@trimmarks@bleed\relax depth\@tombowwidth height\z@
+ \vrule depth10mm width\@tombowwidth height\z@}%
+ \setbox\@Bl\hbox to\z@{\yoko\hss
+ \vrule width10mm depth\@tombowwidth height\z@
+ \vrule depth\dimexpr 10mm + \jlreq@trimmarks@bleed\relax width\@tombowwidth height\z@}%
+ \setbox\@BC\hbox{\yoko
+ \vrule width10mm depth\@tombowwidth height\z@
+ \vrule depth10mm width\@tombowwidth height\z@
+ \vrule width10mm depth\@tombowwidth height\z@}%
+ \setbox\@BR\hbox to\z@{\yoko
+ \vrule depth10mm width\@tombowwidth height\z@
+ \vrule width\dimexpr 10mm + \jlreq@trimmarks@bleed\relax depth\@tombowwidth height\z@\hss}%
+ \setbox\@Br\hbox to\z@{\yoko
+ \vrule depth\dimexpr 10mm + \jlreq@trimmarks@bleed\relax width\@tombowwidth height\z@
+ \vrule width10mm depth\@tombowwidth height\z@\hss}%
+ \setbox\@CL\hbox to\z@{\yoko\hss
+ \vrule width10mm height.5\@tombowwidth depth.5\@tombowwidth
+ \vrule height10mm depth10mm width\@tombowwidth}%
+ \setbox\@CR\hbox to\z@{\yoko
+ \vrule height10mm depth10mm width\@tombowwidth
+ \vrule height.5\@tombowwidth depth.5\@tombowwidth width10mm\hss}%
+}
+\def\@outputtombow{%
+ % 6mm: from plcore
+ \@@paperwidth=\dimexpr\@@paperwidth - 6mm + 2\dimexpr\jlreq@trimmarks@bleed\relax\relax
+ \@@paperheight=\dimexpr\@@paperheight - 6mm + 2\dimexpr\jlreq@trimmarks@bleed\relax\relax
+ \ifjlreq@trimmarks@show
+ \vbox to\z@{\kern-\dimexpr 10mm + \jlreq@trimmarks@bleed\relax
+ \boxmaxdepth\maxdimen
+ \moveleft\jlreq@trimmarks@bleed\vbox to\@@paperheight{%
+ \color@begingroup\jlreq@trimmarks@color
+ \hbox to\@@paperwidth{\hskip\jlreq@trimmarks@bleed\relax
+ \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip\jlreq@trimmarks@bleed}%
+ \kern-10mm
+ \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}%
+ \vfill
+ \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}%
+ \vfill
+ \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}%
+ \kern-10mm
+ \hbox to\@@paperwidth{\hskip\jlreq@trimmarks@bleed\relax
+ \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip\jlreq@trimmarks@bleed}%
+ \color@endgroup}\vss
+ }%
+ \fi
+}
+
+\ifjlreq@trimmarks@digital
+ \def\jlreq@trimmarks@pttobp#1{\strip@pt\dimexpr0.9963\dimexpr#1\relax\relax}
+ \edef\jlreq@trimmarks@trimboxsize{%
+ [%
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperwidth - \paperwidth)/2}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperheight - \paperheight)/2}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperwidth + \paperwidth)/2}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperheight + \paperheight)/2}%
+ ]
+ }
+ \edef\jlreq@trimmarks@bleedboxsize{%
+ [%
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperwidth - \paperwidth)/2 - \jlreq@trimmarks@bleed}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperheight - \paperheight)/2 - \jlreq@trimmarks@bleed}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperwidth + \paperwidth)/2 + \jlreq@trimmarks@bleed}
+ \jlreq@trimmarks@pttobp{(\jlreq@trimmarks@paperheight + \paperheight)/2 + \jlreq@trimmarks@bleed}%
+ ]
+ }
+ \edef\jlreq@trimmarks@pdfattribute{%
+ /TrimBox \jlreq@trimmarks@trimboxsize
+ \ifjlreq@trimmarks@show@artbox /ArtBox \jlreq@trimmarks@trimboxsize\fi
+ /BleedBox \jlreq@trimmarks@bleedboxsize
+ }
+ \jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@pttobp}
+ \jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@trimboxsize}
+ \jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@bleedboxsize}
+ \jlreq@trimmarks@afterpkg@addtodeletecs{\jlreq@trimmarks@pdfattribute}
+
+ \ifx l\jlreq@trimmarks@driver
+ \edef\@tempa{\noexpand\pdfvariable pageattr{\jlreq@trimmarks@pdfattribute}}
+ \@tempa
+ \fi
+ \ifx f\jlreq@trimmarks@driver
+ \edef\@outputtombow{\noexpand\special{pdf: put @thispage <<\jlreq@trimmarks@pdfattribute>>}\expandonce{\@outputtombow}}
+ \fi
+ \ifx s\jlreq@trimmarks@driver
+ \edef\@tempa{\noexpand\special{ps:SDict begin
+ [ /TrimBox \jlreq@trimmarks@trimboxsize /PAGE pdfmark
+ \ifjlreq@trimmarks@show@artbox [ /ArtBox \jlreq@trimmarks@trimboxsize /PAGE pdfmark \fi
+ [ /BleedBox \jlreq@trimmarks@bleedboxsize /PAGE pdfmark
+ end}}%
+ \@tempa
+ \fi
+\fi
+
+% always true
+\tombowtrue
+\maketombowbox
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
index d84993e69ce..241fa9d4d01 100644
--- a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
+++ b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
@@ -5,328 +5,24 @@
%%
% (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/)
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jlreq}[2018/04/11 jlreq]
+\ProvidesClass{jlreq}[2018/05/19 jlreq]
\RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen}
+\RequirePackage{jlreq-helpers}
-%. helper1
-\newcount\jlreq@tempcnta
-\newcount\jlreq@tempcntb
-\newcount\jlreq@tempcntc
-\newdimen\jlreq@tempdima
-\newdimen\jlreq@tempdimb
-\newdimen\jlreq@tempdimc
-\newskip\jlreq@tempskipa
-\newskip\jlreq@tempskipb
-\newskip\jlreq@tempskipc
-\newif\ifjlreq@tempa
-\newif\ifjlreq@tempb
-\newif\ifjlreq@tempc
-\newbox\jlreq@tempboxa
-\newbox\jlreq@tempboxb
-\newbox\jlreq@tempboxc
-% 計算結果を返すための変数
-\newdimen\jlreq@resultdimen
-\newskip\jlreq@resultskip
-\newbox\jlreq@resultbox
-\newif\ifjlreq@result
-\newcount\jlreq@resultcnt
-
-\newcommand*{\jlreq@undefcs}[1]{%
- \ifundef{#1}{\ClassError{jlreq}{Trying to delete \string#1 even though it is not defined, may be a bug}{\@ehc}}{\undef{#1}}%
-}
-
+\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]{%
- \appto\jlreq@aftercls@deletecslist{\jlreq@undefcs{#1}}%
+ \appto\jlreq@aftercls@deletecslist{\jlreq@helper@undefcs{#1}{\jlreq@undeferr}}%
}
-\jlreq@aftercls@addtodeletecs{\jlreq@aftercls@addtodeletecs}
\newcommand*{\jlreq@aftercls@addtodeleteif}[1]{%
- \edef\@tempa{\expandafter\@gobble\string#1}%
- \edef\@tempa{\expandafter\@gobbletwo\@tempa}%
- \eappto\jlreq@aftercls@deletecslist{%
- \unexpanded{\jlreq@undefcs{#1}}%
- \noexpand\jlreq@undefcs{\expandonce{\csname\@tempa true\endcsname}}%
- \noexpand\jlreq@undefcs{\expandonce{\csname\@tempa false\endcsname}}%
- }%
+ \appto\jlreq@aftercls@deletecslist{\jlreq@helper@undefif{#1}{\jlreq@undeferr}}%
}
+\jlreq@aftercls@addtodeletecs{\jlreq@aftercls@addtodeletecs}
\jlreq@aftercls@addtodeletecs{\jlreq@aftercls@addtodeleteif}
\AtEndOfClass{%
\jlreq@aftercls@deletecslist
- \jlreq@undefcs{\jlreq@aftercls@deletecslist}%
- \undef{\jlreq@undefcs}%
-}
-
-\def\jlreq@uniqtoken{\jlreq@uniqtoken}
-\def\jlreq@endmark{\jlreq@endmark}
-\long\def\jlreq@deleteuntileendmark#1\jlreq@endmark{}
-
-\def\jlreq@expandafter@ii{\expandafter\expandafter\expandafter}
-\edef\jlreq@expandafter@iii{\expandonce{\jlreq@expandafter@ii}\noexpand\expandafter\expandonce{\jlreq@expandafter@ii}}
-\edef\jlreq@expandtwice#1{\expandonce{\jlreq@expandafter@ii}\noexpand\unexpanded\expandonce{\jlreq@expandafter@ii}{#1}}
-\edef\jlreq@expand@three#1{\expandonce{\jlreq@expandafter@iii}\noexpand\unexpanded\expandonce{\jlreq@expandafter@iii}{#1}}
-
-% \jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@の形で使う
-% 二回展開すると,#1の先頭(ただし空白は無視される)を取り出す.#1が空の場合は\jlreq@uniqtoken,先頭が{の場合は\bgroupとなる
-\def\jlreq@endmark@{\jlreq@endmark@} % \jlreq@getfirsttokenだけのためのendmark
-\long\def\jlreq@getfirsttoken#1#{\jlreq@getfirsttoken@#1\bgroup\jlreq@endmark@}
-\long\def\jlreq@getfirsttoken@#1#2\jlreq@endmark@#3\jlreq@endmark@{#1}
-% 与えられたトークン列が空か(展開はしないでチェック)
-\long\def\jlreq@ifempty#1{\expandafter\ifx\expandafter\relax\detokenize{#1}\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
-% #1の先頭トークンが#2か(ただし#1が空ならば#2=\jlreq@uniqtoken,#1={ならば#2=\bgroupでTRUEとなる)
-\long\edef\jlreq@iffirsttoken#1#2{%
- % スペースチェック
- \unexpanded{\expandafter\expandafter\expandafter\jlreq@deleteuntileendmark\expandafter\ifx\expandafter}\expandonce{\space}\noexpand\detokenize{#1}\unexpanded{\@undefined\jlreq@endmark\expandafter\@firstoftwo\else\jlreq@endmark\expandafter\@secondoftwo\fi}{%
- \noexpand\ifx\expandonce{\space}#2\unexpanded{\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}%
- }{%
- \noexpand\jlreq@iffirsttoken@ignorespaces{#1}{#2}%
- }%
-}
-% こちらは先頭のスペースを読み飛ばす
-\long\def\jlreq@iffirsttoken@ignorespaces#1#2{%
- \expandafter\expandafter\expandafter\ifx\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
-}
-
-% #1が\jlreq@endmarkか
-\long\def\jlreq@ifendmark#1{\jlreq@iffirsttoken{#1}{\jlreq@endmark}}
-
-% #1の先頭が引数なしのマクロか
-\long\def\jlreq@ifmacro@noargument#1{%
- \jlreq@ifempty{#1}{\@secondoftwo}{%
- \jlreq@iffirsttoken{#1}{ }{\@secondoftwo}{%
- \expandafter\expandafter\expandafter\jlreq@ifmacro@noargument@\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@
-}}}
-\long\def\jlreq@ifmacro@noargument@#1{\expandafter\jlreq@ifmacro@noargument@@\expandafter{\meaning #1}}
-\edef\jlreq@do{%
- \unexpanded{\def\jlreq@ifmacro@noargument@@}##1{\noexpand\jlreq@ifmacro@noargument@@@##1\expandonce{\detokenize{macro:->}}\noexpand\jlreq@endmark}
- \unexpanded{\def\jlreq@ifmacro@noargument@@@}##1\expandonce{\detokenize{macro:->}}##2\noexpand\jlreq@endmark{\noexpand\jlreq@ifempty{##1}}
-}
-\jlreq@do
-
-% #1(skipレジスタ)が0か(展開不可).
-\def\jlreq@ifgluezero#1{%
- \begingroup
- \edef\@tempa{\the#1}%
- \edef\@tempb{\detokenize{0.0pt}}%
- \edef\jlreq@do{\ifx\@tempa\@tempb\noexpand\@firstoftwo\else\noexpand\@secondoftwo\fi}%
- \expandafter\endgroup
- \jlreq@do
-}
-
-% #1が#2で終わるか(展開不可)
-\def\jlreq@ifendswith#1#2{%
- \jlreq@ifempty{#2}{\@firstoftwo}{%
- \begingroup
- \def\jlreq@tempa##1#2\jlreq@uniqtoken##2\jlreq@endmark{%
- \edef\jlreq@do{\jlreq@ifempty{##2}{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}}%
- }%
- \jlreq@tempa#1\jlreq@uniqtoken#2\jlreq@uniqtoken\jlreq@endmark
- \expandafter\endgroup
- \jlreq@do
- }%
-}
-% #1が#2で始まるか(展開不可)
-\def\jlreq@ifstartswith#1#2{%
- \jlreq@ifempty{#2}{\@firstoftwo}{%
- \jlreq@ifempty{#1}{\@secondoftwo}{%
- \begingroup
- \def\jlreq@tempa##1#2##2\jlreq@endmark{%
- \edef\jlreq@do{\jlreq@ifempty{##1}{\noexpand\@firstoftwo}{\noexpand\@secondoftwo}}%
- }%
- \jlreq@tempa#1#2\jlreq@endmark
- \expandafter\endgroup
- \jlreq@do
- }%
- }%
-}
-% #1が#2を含むか(展開不可){}内に#2があってもFALSE判定.
-\def\jlreq@ifcontains#1#2{%
- \jlreq@ifempty{#2}{\@firstoftwo}{%
- \begingroup
- \def\jlreq@tempa##1#2##2\jlreq@endmark{%
- \edef\jlreq@do{\jlreq@ifempty{##2}{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}}%
- }%
- \jlreq@tempa#1#2\jlreq@endmark
- \expandafter\endgroup
- \jlreq@do
- }%
-}
-
-% @removeelementの括弧があっても動くかもしれない版
-% #2から#1を消して#3に入れる
-\def\jlreq@helper@removeelement#1#2#3{%
- \begingroup
- \edef\jlreq@tempa{\unexpanded{#1}}% 消したいやつ
- \def\jlreq@tempb{}% 消していない分を放り込んでいく
- \jlreq@tempatrue% 最初の\jlreq@tempbへの追加か.
- \jlreq@helper@removeelement@#2,\jlreq@endmark,%
- \edef\jlreq@do{\unexpanded{\def#3}{\expandonce{\jlreq@tempb}}}%
- \expandafter\endgroup
- \jlreq@do
-}
-\def\jlreq@helper@removeelement@#1,{%
- \jlreq@ifendmark{#1}{}{%
- \edef\@tempa{\unexpanded{#1}}%
- \ifx\jlreq@tempa\@tempa\expandafter\@gobble\else\expandafter\@firstofone\fi{%
- \eappto\jlreq@tempb{\ifjlreq@tempa\else,\fi\unexpanded{#1}}%
- \jlreq@tempafalse
- }%
- \jlreq@helper@removeelement@
- }%
-}
-
-% 空白を無視しない\@ifnextchar
-\long\def\jlreq@ifnextchar#1#2#3{%
- \let\reserved@d=#1%
- \edef\reserved@a{\unexpanded{#2}}%
- \edef\reserved@b{\unexpanded{#3}}%
- \futurelet\jlreq@nextchar\jlreq@ifnextchar@
-}
-\def\jlreq@ifnextchar@{%
- \ifx\jlreq@nextchar\reserved@d\let\reserved@b\reserved@a\fi
- \reserved@b
-}
-% 空白を無視しない\@ifsart
-\def\jlreq@ifstar#1#2{\jlreq@ifnextchar *{\edef\reserved@a*{\unexpanded{#1}}\reserved@a}{#2}}
-% カンマで区切って,その前と後ろを\jlreq@resulta,\jlreq@resultbに入れる
-% もしカンマがない場合は\ifjlreq@resultがfalseになる.
-\def\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
-}
-\def\jlreq@helper@removelastcomma#1,\jlreq@endmark{#1}
-
-% vbox #1の最後を\jlreq@resultboxに入れる
-% #1の最後の行は消える
-\newcommand*{\jlreq@getlastbox}[1]{%
- \setbox#1=\vbox{\unvbox#1\relax
- \unskip\unskip\unpenalty\global\setbox\jlreq@resultbox=\lastbox}%
- \ifhbox\jlreq@resultbox
- \global\setbox\jlreq@resultbox=\hbox{%
- \unhbox\jlreq@resultbox\unskip\unskip\unpenalty}%
- \else
- \global\setbox\jlreq@resultbox=\copy\voidb@x
- \fi
-}
-
-% 簡易なkeyvalのパース.
-% \jlreq@parsekeyval*[family=jlreq@key]{ % *ありは\setkeys*を使う
-% {key}{\def\val{#1}}
-% *{key}{\def\val{#1}} % デフォルト値を空文字列にする
-% {key}[choice1,choice2]{\def\valchoice{#1}}
-%}{parse対象}
-\def\jlreq@parsekeyval{%
- \@ifstar{\jlreq@helper@parsekeyval@{*}}{\jlreq@helper@parsekeyval@{}}%
-}
-\def\jlreq@helper@parsekeyval@#1{%
- \@ifnextchar[{\jlreq@helper@parsekeyval@@{#1}}{\jlreq@helper@parsekeyval@@{#1}[jlreq@key]}%
-}
-\long\def\jlreq@helper@parsekeyval@@#1[#2]#3#4{%
- \begingroup
- \def\jlreq@do{}%
- \jlreq@helper@parsekeyval@@@{#2}#3{\jlreq@endmark}%
- \setkeys#1{#2}{#4}%
- \expandafter\endgroup
- \jlreq@do
-}
-\def\jlreq@helper@parsekeyval@@@#1#2#{%
- \jlreq@iffirsttoken@ignorespaces{#2}{*}{%
- \jlreq@helper@parsekeyval@@@definekeywithdefault{#1}%
- }{%
- \jlreq@helper@parsekeyval@@@@{#1}%
- }%
-}
-\long\def\jlreq@helper@parsekeyval@@@@#1#2{%
- \jlreq@ifendmark{#2}{}{%
- \@ifnextchar[{\jlreq@helper@parsekeyval@@@choicekey{#1}{#2}}{\jlreq@helper@parsekeyval@@@definekey{#1}{#2}}%
- }%
-}
-\long\def\jlreq@helper@parsekeyval@@@choicekey#1#2[#3]#4{%
- \define@choicekey{#1}{#2}{#3}{\eappto\jlreq@do{\unexpanded{#4}}}%
- \jlreq@helper@parsekeyval@@@{#1}%
-}
-\long\def\jlreq@helper@parsekeyval@@@definekeywithdefault#1#2#3{%
- \define@key{#1}{#2}[]{\eappto\jlreq@do{\unexpanded{#3}}}%
- \jlreq@helper@parsekeyval@@@{#1}%
-}
-\long\def\jlreq@helper@parsekeyval@@@definekey#1#2#3{%
- \define@key{#1}{#2}{\eappto\jlreq@do{\unexpanded{#3}}}%
- \jlreq@helper@parsekeyval@@@{#1}%
-}
-
-% キー指定しないkeyval(独自実装)
-% \jlreq@parsekeyval@nokey{<action>}{<parse対象>}
-% action内では#1=key, #2=val
-\long\def\jlreq@parsekeyval@nokey#1#2{%
- \begingroup
- \def\jlreq@do{}%
- \def\jlreq@parsekeyval@nokey@execute##1##2{#1}%
- \expandafter\jlreq@parsekeyval@nokey@#2,\jlreq@endmark,%
- \expandafter\endgroup
- \jlreq@do
-}
-\long\def\jlreq@parsekeyval@nokey@#1,{%
- \jlreq@ifendmark{#1}{}{\jlreq@parsekeyval@nokey@@#1=\jlreq@endmark}%
-}
-\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@@@#1#2{%
- \eappto\jlreq@do{\expandonce{\jlreq@parsekeyval@nokey@execute{#2}{#1}}}%
- \jlreq@parsekeyval@nokey@
-}
-\long\def\jlreq@parsekeyval@nokey@@@@#1=\jlreq@endmark{#1}
-
-% \jlreq@switch{str}{
-% {str}{abcd}
-% {str1}{xyz}
-%}[default: input = #1] -> abcd
-%または
-%
-% \jlreq@switch{str}{
-% {str}{abcd}
-% {str1}{xyz}
-% {default} % ここは#1を受け付けない(パラメータトークンを受け付けたい場合のため).
-%} -> abcd
-% 文字列比較→\edefして比較する
-% 第一引数は\jlreq@tempaに入れておく.
-\long\def\jlreq@helper@switch@executeoption#1[#2]{%
- \begingroup
- \def\jlreq@do##1{#2}%
- \expandafter\endgroup
- \jlreq@do{#1}%
-}
-\long\def\jlreq@helper@removeoption[#1]{}
-\long\def\jlreq@switch#1#2{%
- \begingroup
- \let\jlreq@do\@undefined
- \edef\jlreq@tempa{#1}% ループ中ずっと保存する
- \jlreq@helper@switch@#2\jlreq@endmark
- \ifx\jlreq@do\@undefined
- \def\jlreq@do{\@ifnextchar[{\jlreq@helper@switch@executeoption{#1}}{}}%
- \else
- \appto\jlreq@do{\@ifnextchar[{\jlreq@helper@removeoption}{}}%
- \fi
- \expandafter\endgroup
- \jlreq@do
-}
-\long\def\jlreq@helper@switch@#1{%
- \jlreq@ifendmark{#1}{}{\jlreq@helper@switch@@{#1}}%
-}
-
-\long\def\jlreq@helper@switch@@#1#2{%
- \jlreq@ifendmark{#2}{%
- \edef\jlreq@do{\unexpanded{#1}}%
- }{%
- \edef\jlreq@tempb{#1}%
- \ifx\jlreq@tempa\jlreq@tempb\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{%
- \edef\jlreq@do{\unexpanded{#2}}%
- \jlreq@deleteuntileendmark
- }{%
- \jlreq@helper@switch@
- }%
- }%
+ \jlreq@helper@undefcs{\jlreq@aftercls@deletecslist}{\jlreq@undeferr}%
+ \undef{\jlreq@undeferr}%
}
% preambleにいるかのスイッチ
@@ -334,20 +30,6 @@
\jlreq@preambletrue
\AtBeginDocument{\jlreq@preamblefalse}
-\RequirePackage[savepos]{zref}
-\newcount\jlreq@zref@reference@count
-\jlreq@zref@reference@count=0
-% 現在のページを得る
-\zref@newprop*{jlreq@page}[0]{\number\c@page}
-\zref@addprop{main}{jlreq@page}
-\newcount\jlreq@currentpage
-% \jlreq@setcurrentpageをすると,\jlreq@currentpageにこの場所のページ数が入る
-\newcommand*{\jlreq@setcurrentpage}{%
- \global\advance\jlreq@zref@reference@count by 1
- \zref@labelbyprops{jlreq@currentpage.\the\jlreq@zref@reference@count}{jlreq@page}%
- \global\jlreq@currentpage=\zref@extractdefault{jlreq@currentpage.\the\jlreq@zref@reference@count}{jlreq@page}{\c@page}\relax
-}
-
\def\jlreq@saveoriginalcs#1{%
\ifx#1\relax
\ClassError{jlreq}{Trying to save \string#1 but it's not defined, may be a bug}{\@ehc}%
@@ -363,34 +45,6 @@
{#1}%
}
-% 先頭にあるマクロを展開しまくった結果の先頭を#2に入れる.
-\long\def\jlreq@getfirsttoken@expandmacros#1#2{%
- \jlreq@iffirsttoken{#1}{ }{\def#2{ }}{%
- \jlreq@ifempty{#1}{\def#2{}}{%
- \jlreq@ifmacro@noargument{#1}{%
- \expandafter\jlreq@getfirsttoken@expandmacros\expandafter{#1}{#2}%
- }{%
- \expandafter\expandafter\expandafter\jlreq@getfirsttoken@expandmacros@\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@{#2}%
- }%
- }%
- }%
-}
-\def\jlreq@getfirsttoken@expandmacros@#1#2{\def#2{#1}}
-
-\def\jlreq@helper@checktokenlist#1#2{%
- \jlreq@ifendmark{#2}{\@firstoftwo}%
- {%
- \ifnum0#1{#2}>0 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
- {\jlreq@helper@checktokenlist{#1}}%
- {\expandafter\@secondoftwo\jlreq@deleteuntileendmark}%
- }%
-}
-\def\jlreq@helper@chknumlist#1{\ifx#101\fi\ifx#111\fi\ifx#121\fi\ifx#131\fi\ifx#141\fi\ifx#151\fi\ifx#161\fi\ifx#171\fi\ifx#181\fi\ifx#191\fi}
-\def\jlreq@helper@chkfloatlist#1{\jlreq@helper@chknumlist{#1}\ifx#1.1\fi}
-% #1が[0-9\.]*に当てはまるか.
-\def\jlreq@iffloat#1{\jlreq@helper@checktokenlist{\jlreq@helper@chkfloatlist}#1\jlreq@endmark}
-\def\jlreq@ifnumber#1{\jlreq@helper@checktokenlist{\jlreq@helper@chknumlist}#1\jlreq@endmark}
-
%. オプションの定義
% オプション処理の際にしか使わない変数(後でそれを元に別の変数を調整する)
% ものは\jlreq@option@<key>に格納する.
@@ -419,7 +73,15 @@
\def\jlreq@switchpapersize{}
\jlreq@aftercls@addtodeletecs{\jlreq@switchpapersize}
% \jlreq@addpapersize{paper=に指定するもの}{単独オプション名}{横}{縦}
-\newcommand*{\jlreq@addpapersize}[4]{%
+
+\def\jlreq@addpapersize#1#2{%
+ \@ifnextchar[{\jlreq@addpapersize@{#1}{#2}}{\jlreq@addpapersize@@{#1}{#2}}
+}
+\def\jlreq@addpapersize@#1#2[#3]{%
+ \edef\@tempa{\unexpanded{\jlreq@addpapersize@@{#1}{#2}}\csexpandonce{jlreq@helper@papersizelist@#3}}%
+ \@tempa
+}
+\newcommand*{\jlreq@addpapersize@@}[4]{%
\@for\@tempa:=#1\do{%
\eappto\jlreq@switchpapersize{{\expandonce{\@tempa}}{\unexpanded{\setlength{\paperwidth}{#3}\setlength{\paperheight}{#4}}}}%
}%
@@ -428,6 +90,8 @@
}%
}
\jlreq@aftercls@addtodeletecs{\jlreq@addpapersize}
+\jlreq@aftercls@addtodeletecs{\jlreq@addpapersize@}
+\jlreq@aftercls@addtodeletecs{\jlreq@addpapersize@@}
\DeclareOptionX{paper}{
\edef\jlreq@do{%
\unexpanded{\jlreq@switch{#1}}{\expandonce{\jlreq@switchpapersize}}%
@@ -444,45 +108,45 @@
\jlreq@do
}
% 紙サイズ一覧.b*はJIS B.
-\jlreq@addpapersize{a0,A0}{}{841mm}{1189mm}
-\jlreq@addpapersize{a1,A1}{}{594mm}{841mm}
-\jlreq@addpapersize{a2,A2}{}{420mm}{594mm}
-\jlreq@addpapersize{a3,A3}{a3paper}{297mm}{420mm}
-\jlreq@addpapersize{a4,A4}{a4paper}{210mm}{297mm}
-\jlreq@addpapersize{a5,A5}{a5paper}{148mm}{210mm}
-\jlreq@addpapersize{a6,A6}{a6paper}{105mm}{148mm}
-\jlreq@addpapersize{a7,A7}{}{74mm}{105mm}
-\jlreq@addpapersize{a8,A8}{}{52mm}{74mm}
-\jlreq@addpapersize{a9,A9}{}{37mm}{52mm}
-\jlreq@addpapersize{a10,A10}{}{26mm}{37mm}
-
-\jlreq@addpapersize{b0,B0}{}{1030mm}{1456mm}
-\jlreq@addpapersize{b1,B1}{}{728mm}{1030mm}
-\jlreq@addpapersize{b2,B2}{}{515mm}{728mm}
-\jlreq@addpapersize{b3,B3}{}{364mm}{515mm}
-\jlreq@addpapersize{b4,B4}{b4paper}{257mm}{364mm}
-\jlreq@addpapersize{b5,B5}{b5paper}{182mm}{257mm}
-\jlreq@addpapersize{b6,B6}{b6paper}{128mm}{182mm}
-\jlreq@addpapersize{b7,B7}{}{91mm}{128mm}
-\jlreq@addpapersize{b8,B8}{}{64mm}{91mm}
-\jlreq@addpapersize{b9,B9}{}{45mm}{64mm}
-\jlreq@addpapersize{b10,B10}{}{32mm}{45mm}
-
-\jlreq@addpapersize{c2,C2}{}{458mm}{648mm}
-\jlreq@addpapersize{c3,C3}{}{324mm}{458mm}
-\jlreq@addpapersize{c4C,C4}{}{229mm}{354mm}
-\jlreq@addpapersize{c5,C5}{}{162mm}{229mm}
-\jlreq@addpapersize{c6,C6}{}{114mm}{162mm}
-\jlreq@addpapersize{c7,C7}{}{81mm}{114mm}
-\jlreq@addpapersize{c8,C8}{}{57mm}{81mm}
-
-\jlreq@addpapersize{a4var}{}{210mm}{283mm}
-\jlreq@addpapersize{b5var}{}{182mm}{230mm}
-
-\jlreq@addpapersize{letter}{letterpaper}{8.5in}{11in}
-\jlreq@addpapersize{legal}{legalpaper}{8.5in}{14in}
-\jlreq@addpapersize{executive}{executivepaper}{7.25in}{10.5in}
-\jlreq@addpapersize{hagaki}{}{100mm}{148mm}
+\jlreq@addpapersize{a0,A0}{}[a0]
+\jlreq@addpapersize{a1,A1}{}[a1]
+\jlreq@addpapersize{a2,A2}{}[a2]
+\jlreq@addpapersize{a3,A3}{a3paper}[a3]
+\jlreq@addpapersize{a4,A4}{a4paper}[a4]
+\jlreq@addpapersize{a5,A5}{a5paper}[a5]
+\jlreq@addpapersize{a6,A6}{a6paper}[a6]
+\jlreq@addpapersize{a7,A7}{}[a7]
+\jlreq@addpapersize{a8,A8}{}[a8]
+\jlreq@addpapersize{a9,A9}{}[a9]
+\jlreq@addpapersize{a10,A10}{}[a10]
+
+\jlreq@addpapersize{b0,B0}{}[b0]
+\jlreq@addpapersize{b1,B1}{}[b1]
+\jlreq@addpapersize{b2,B2}{}[b2]
+\jlreq@addpapersize{b3,B3}{}[b3]
+\jlreq@addpapersize{b4,B4}{b4paper}[b4]
+\jlreq@addpapersize{b5,B5}{b5paper}[b5]
+\jlreq@addpapersize{b6,B6}{b6paper}[b6]
+\jlreq@addpapersize{b7,B7}{}[b7]
+\jlreq@addpapersize{b8,B8}{}[b8]
+\jlreq@addpapersize{b9,B9}{}[b9]
+\jlreq@addpapersize{b10,B10}{}[b10]
+
+\jlreq@addpapersize{c2,C2}{}[c2]
+\jlreq@addpapersize{c3,C3}{}[c3]
+\jlreq@addpapersize{c4,C4}{}[c4]
+\jlreq@addpapersize{c5,C5}{}[c5]
+\jlreq@addpapersize{c6,C6}{}[c6]
+\jlreq@addpapersize{c7,C7}{}[c7]
+\jlreq@addpapersize{c8,C8}{}[c8]
+
+\jlreq@addpapersize{a4var}{}[a4var]
+\jlreq@addpapersize{b5var}{}[b5var]
+
+\jlreq@addpapersize{letter}{letterpaper}[letter]
+\jlreq@addpapersize{legal}{legalpaper}[legal]
+\jlreq@addpapersize{executive}{executivepaper}[executive]
+\jlreq@addpapersize{hagaki}{}[hagaki]
%.. フォントサイズ,行長,1ページあたりの行数で基本版面のサイズを決める(2.4.1.a)
@@ -521,6 +185,10 @@
\newcommand*{\jlreq@option@gutter}{}
\jlreq@aftercls@addtodeletecs{\jlreq@option@gutter}
\DeclareOptionX{gutter}{\renewcommand*{\jlreq@option@gutter}{#1}}
+%.. 小口
+\newcommand*{\jlreq@option@fore@edge}{}
+\jlreq@aftercls@addtodeletecs{\jlreq@option@fore@edge}
+\DeclareOptionX{fore_edge}{\renewcommand*{\jlreq@option@fore@edge}{#1}}
%.. 柱とノンブル
\newcommand*{\jlreq@option@headfoot@verticalpos}{}
@@ -564,14 +232,9 @@
\newif\if@landscape\@landscapefalse
\newif\if@tate \@tatefalse
\jlreq@DeclareOption{landscape}{\@landscapetrue}
-\jlreq@DeclareOption{tombo}{%
- \tombowtrue\tombowdatefalse
- \setlength{\@tombowwidth}{.1\p@}%
- \maketombowbox}
-\jlreq@DeclareOption{mentuke}{%
- \tombowtrue\tombowdatefalse
- \setlength{\@tombowwidth}{\z@}%
- \maketombowbox}
+\jlreq@DeclareOption{tombo}{\ClassWarningNoLine{jlreq}{The option `tombo' is not supported by jlreq class. Please use the jlreq-trimmarks package}}
+\jlreq@DeclareOption{tombow}{\ClassWarningNoLine{jlreq}{The option `tombow' is not supported by jlreq class. Please use the jlreq-trimmarks package}}
+\jlreq@DeclareOption{mentuke}{\ClassWarningNoLine{jlreq}{The option `mentuke' is not supported by jlreq class. Please use the jlreq-trimmarks package}}
\jlreq@DeclareOption{tate}{\@tatetrue}
\newif\ifjlreq@option@twoside\jlreq@option@twosidefalse % onesideかtwosideが指定された
@@ -648,26 +311,10 @@
\jlreq@aftercls@addtodeletecs{\jlreq@jlreqsetup@addtofinally}
\@onlypreamble\jlreqsetup
-% \jlreq@ifprimitive#1#2#3: #1がprimitiveならば#2を,そうでなければ#3を実行する
-% (\if(pdf)primitiveを避けるようにしている.)
-\def\jlreq@ifprimitive#1{%
- \begingroup
- \edef\@tempa{\string#1}%
- \edef\@tempb{\meaning#1}%
- \expandafter\endgroup
- \ifx\@tempa\@tempb\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
-}
% エンジンの設定
\ifx\jlreq@engine\@undefined
- \jlreq@ifprimitive\directlua{
- \let\jlreq@engine=l
- }{
- \jlreq@ifprimitive\ucs{
- \let\jlreq@engine=u
- }{
- \let\jlreq@engine=p
- }
- }
+ \jlreq@helper@guessengine
+ \let\jlreq@engine=\jlreq@result
\fi
@@ -757,6 +404,7 @@
\else
\evensidemargin
\fi
+ \iftombow - 1in\fi
- 1in - \hoffset\relax
}
\else
@@ -778,6 +426,7 @@
- \topmargin - \headheight - \headsep - \voffset
- \zposy{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp
}%
+ \iftombow - 1in\fi
- \@totalleftmargin - 1in
\relax
}
@@ -880,39 +529,12 @@
\jlreq@do
}
-% #1÷#2を\jlreq@resultdimenに入れる.(#1,#2は寸法を与える.)
\ifx l\jlreq@engine
\newcommand*{\jlreq@divide}[2]{%
\jlreq@resultdimen=\directlua{tex.print(tostring(\strip@pt\dimexpr #1\relax/\strip@pt\dimexpr #2\relax) .. "pt ")}%
}
\else
- \newcommand*{\jlreq@divide}[2]{%
- \begingroup
- \@tempdima=\dimexpr#1\relax\@tempdimb=\dimexpr#2\relax
- % 分母を正にする
- \ifdim\@tempdimb<0pt \@tempdima=-\@tempdima\@tempdimb=-\@tempdimb\fi
- % \jlreq@tempdima*\@tempdimb <= \@tempdima < (\jlreq@tempdima + 1)*\@tempdimb
- % となる整数\jlreq@tempdimaを捜し,\jlreq@tempdimb=\jlreq@tempdima + 1とする
- \jlreq@tempdima=0pt
- \ifdim\@tempdima<0pt
- \loop\ifdim\strip@pt\jlreq@tempdima\@tempdimb>\@tempdima\advance\jlreq@tempdima by -1pt\repeat
- \else
- \loop\ifdim\strip@pt\jlreq@tempdima\@tempdimb<\@tempdima\advance\jlreq@tempdima by 1pt\repeat
- \ifdim\strip@pt\jlreq@tempdima\@tempdimb=\@tempdima\else\advance\jlreq@tempdima by -1pt\fi
- \fi
- \jlreq@tempdimb=\dimexpr\jlreq@tempdima + 1pt\relax
- % \jlreq@tempdimaと\jlreq@tempdimbで挟んでいく二分法
- \jlreq@tempcnta=0 % 無限ループを避けるためのカウンタ
- \loop\ifnum\numexpr\ifdim\dimexpr\jlreq@tempdimb - \jlreq@tempdima\relax>1sp 1\else0\fi*\ifnum\jlreq@tempcnta<100 1\else 0\fi\relax=1
- \jlreq@tempdimc=\dimexpr(\jlreq@tempdima+\jlreq@tempdimb)/2\relax
- \ifdim\strip@pt\jlreq@tempdimc\@tempdimb>\@tempdima\jlreq@tempdimb=\jlreq@tempdimc
- \else\jlreq@tempdima=\jlreq@tempdimc\fi
- \advance\jlreq@tempcnta by 1
- \repeat
- \edef\jlreq@do{\noexpand\jlreq@resultdimen=\the\jlreq@tempdima\noexpand\relax}%
- \expandafter\endgroup
- \jlreq@do
- }
+ \let\jlreq@divide=\jlreq@helper@divide
\fi
%. 基本設定
@@ -1251,7 +873,7 @@
% 行頭の括弧は \jlreq@open@bracket@before@space \inhibitglue 「みたいにする.
\ifthenelse{\equal{\jlreq@open@bracket@pos}{zenkakunibu_nibu}}{
- \def\jlreq@open@bracket@before@space{\hskip -.5\zw}
+ \def\jlreq@open@bracket@before@space{\hskip\glueexpr-.5\zw\relax}
}{
\def\jlreq@open@bracket@before@space{}
}
@@ -1610,16 +1232,47 @@
% (TODO: 頭注)
\if@tate\@mparswitchfalse\fi
+\setlength{\topskip}{1\zw} % フォントサイズと一致させる
+\ifx\jlreq@option@headfoot@verticalpos\@empty
+ \if@tate\def\jlreq@option@headfoot@verticalpos{1zw}
+ \else\def\jlreq@option@headfoot@verticalpos{2zw}\fi
+\fi
+\setlength{\headsep}{\jlreq@speciallength{\jlreq@option@headfoot@verticalpos}}
+\ifdim\headsep<1\zw\relax\jlreq@note{基本版面との上下方向の最低の空き量を,基本版面の文字サイズの全角アキとする (26.1.a).}\fi
+\setlength{\headheight}{1\zw}
+
% \textwidthと\textheightのデフォルト値は縦横ともに0.75倍(調整が入る).
%.. \textwidth:文字送り方向の行長
% 二段の場合は最初の段の頭から次の段の後まで
% 一度\textwidthに一行の長さの文字数を入れる(段組の場合でも)
+\newif\ifjlreq@determine@kihonhanmen@warning@first
+\jlreq@determine@kihonhanmen@warning@firsttrue
+\def\jlreq@determine@kihonhanmen@warning{
+ \ifjlreq@determine@kihonhanmen@warning@first
+ \jlreq@note{基本版面は,a. サイズの決定 b. 仕上りサイズに対する基本版面の配置位置の決定 という手順で行う (2.4.1).}
+ \jlreq@determine@kihonhanmen@warning@firstfalse
+ \fi
+}
+\jlreq@aftercls@addtodeletecs{\jlreq@determine@kihonhanmen@warning}
+\jlreq@aftercls@addtodeleteif{\ifjlreq@determine@kihonhanmen@warning@first}
\@tempdima=1\zw
\ifx\jlreq@option@line@length\@empty
\if@tate
- \setlength{\textwidth}{0.75\paperheight}
+ \ifnum 0\ifx\jlreq@option@head@space\@empty 1\fi\ifx\jlreq@option@foot@space\@empty 1\fi>0
+ \setlength{\textwidth}{0.75\paperheight}
+ \divide\textwidth\@tempdima\multiply\textwidth\@tempdima
+ \else
+ \jlreq@determine@kihonhanmen@warning
+ \setlength{\textwidth}{\dimexpr\paperheight - \jlreq@option@head@space - \jlreq@option@foot@space \relax}
+ \fi
\else
- \setlength{\textwidth}{0.75\paperwidth}
+ \ifnum 0\ifx\jlreq@option@gutter\@empty 1\fi\ifx\jlreq@option@fore@edge\@empty 1\fi>0
+ \setlength{\textwidth}{0.75\paperwidth}
+ \divide\textwidth\@tempdima\multiply\textwidth\@tempdima
+ \else
+ \jlreq@determine@kihonhanmen@warning
+ \setlength{\textwidth}{\dimexpr\paperwidth - \jlreq@option@gutter - \jlreq@option@fore@edge\relax}
+ \fi
\fi
\if@twocolumn
\addtolength{\textwidth}{\dimexpr-2\marginparwidth - 2\marginparsep\relax}
@@ -1627,7 +1280,6 @@
\else
\addtolength{\textwidth}{\dimexpr-\marginparwidth - \marginparsep\relax}
\fi
- \divide\textwidth\@tempdima
\else
\setlength{\textwidth}{\jlreq@speciallength{\jlreq@option@line@length}}
\divide\textwidth\@tempdima
@@ -1640,66 +1292,95 @@
\jlreq@note{一行の長さは40文字以下が望ましい (2.4.2.c 注2).}
\fi
\fi
+ \multiply\textwidth\@tempdima
\fi
-\multiply\textwidth\@tempdima
\if@twocolumn
\setlength{\textwidth}{\dimexpr2\textwidth + \columnsep\relax}
\fi
-\setlength{\topskip}{1\zw} % フォントサイズと一致させる
%.. \textheight:行送り方向の長さ
% 一番上(直後に\topskip由来が入る)から最終行のベースラインまでの長さ.
% \topskipが十分ある時は先頭行のベースラインから最終行のベースライン+\topskip
+\def\jlreq@adjusttextheight{
+ \addtolength{\textheight}{-\topskip}
+ \divide\textheight\baselineskip \multiply\textheight\baselineskip
+ \addtolength{\textheight}{\topskip}
+}
+\jlreq@aftercls@addtodeletecs{\jlreq@adjusttextheight}
\ifx\jlreq@option@number@of@lines\@empty
\if@tate
- \setlength{\textheight}{0.75\paperwidth}
+ \ifnum 0\ifx\jlreq@option@gutter\@empty 1\fi\ifx\jlreq@option@fore@edge\@empty 1\fi>0
+ \setlength{\textheight}{0.75\paperwidth}
+ \jlreq@adjusttextheight
+ \else
+ \jlreq@determine@kihonhanmen@warning
+ \setlength{\textheight}{\dimexpr\paperwidth - \jlreq@option@gutter - \jlreq@option@fore@edge + \topskip - 1\zw\relax}
+ \fi
\else
- \setlength{\textheight}{0.75\paperheight}
+ \ifnum 0\ifx\jlreq@option@head@space\@empty 1\fi\ifx\jlreq@option@foot@space\@empty 1\fi>0
+ \setlength{\textheight}{0.75\paperheight}
+ \jlreq@adjusttextheight
+ \else
+ \jlreq@determine@kihonhanmen@warning
+ \setlength{\textheight}{\dimexpr\paperheight + 2\topskip - 1\zh - \Cht - \jlreq@option@head@space - \jlreq@option@foot@space\relax}
+ \fi
\fi
- \addtolength{\textheight}{-\topskip}
- \divide\textheight\baselineskip \multiply\textheight\baselineskip
- \addtolength{\textheight}{\topskip}
\else
\setlength{\textheight}{\dimexpr\numexpr\jlreq@option@number@of@lines\relax\baselineskip - \baselineskip + \topskip\relax}
\fi
-\ifx\jlreq@option@headfoot@verticalpos\@empty
- \if@tate\def\jlreq@option@headfoot@verticalpos{1zw}
- \else\def\jlreq@option@headfoot@verticalpos{2zw}\fi
-\fi
-\setlength{\headsep}{\jlreq@speciallength{\jlreq@option@headfoot@verticalpos}}
-\ifdim\headsep<1\zw\relax\jlreq@note{基本版面との上下方向の最低の空き量を,基本版面の文字サイズの全角アキとする (26.1.a).}\fi
-\setlength{\headheight}{1\zw}
%.. 横
-\ifx\jlreq@option@gutter\@empty
- % 中央配置
+\def\jlreq@setsidemargin@by@gutter#1{
\if@tate
- \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textheight + \topskip\relax}
+ \setlength{\evensidemargin}{#1}
+ \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textheight - \evensidemargin + \topskip - \Cht\relax}
+ \addtolength{\evensidemargin}{\Cdp}
\else
+ \setlength{\oddsidemargin}{#1}
\if@twocolumn
- \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textwidth\relax}
- \else
- \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textwidth - \marginparsep - \marginparwidth\relax}
+ \addtolength{\oddsidemargin}{\dimexpr\marginparsep + \marginparwidth\relax}
\fi
+ \setlength{\evensidemargin}{\dimexpr\paperwidth - \textwidth - \oddsidemargin\relax}
+ \fi
+}
+\def\jlreq@setsidemargin@by@fore@edge#1{
+ \jlreq@setsidemargin@by@gutter{#1}
+ \@tempdima=\evensidemargin
+ \evensidemargin=\oddsidemargin
+ \oddsidemargin=\@tempdima
+ \ifjlreq@determine@kihonhanmen@warning@first
+ \jlreq@note{基本版面の配置はのどの空き量を指定する (2.4.1.b).}
\fi
- \setlength{\oddsidemargin}{.5\oddsidemargin}
- \ifnum0\if@twocolumn1\fi\if@tate1\fi>0
- \setlength{\evensidemargin}{\oddsidemargin}
+}
+
+\ifx\jlreq@option@gutter\@empty
+ \ifx\jlreq@option@fore@edge\@empty
+ % 中央配置
+ \if@tate
+ \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textheight + \topskip\relax}
+ \else
+ \if@twocolumn
+ \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textwidth\relax}
+ \else
+ \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textwidth - \marginparsep - \marginparwidth\relax}
+ \fi
+ \fi
+ \setlength{\oddsidemargin}{.5\oddsidemargin}
+ \ifnum0\if@twocolumn1\fi\if@tate1\fi>0
+ \setlength{\evensidemargin}{\oddsidemargin}
+ \else
+ \setlength{\evensidemargin}{\dimexpr\oddsidemargin + \marginparsep + \marginparwidth\relax}
+ \fi
\else
- \setlength{\evensidemargin}{\dimexpr\oddsidemargin + \marginparsep + \marginparwidth\relax}
+ \jlreq@setsidemargin@by@fore@edge{\jlreq@speciallength{\jlreq@option@fore@edge}}
\fi
\else
- \if@tate
- \setlength{\evensidemargin}{\jlreq@speciallength{\jlreq@option@gutter}}
- \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textheight - \evensidemargin + \topskip - \Cht\relax}
- \addtolength{\evensidemargin}{\Cdp}
- \else
- \setlength{\oddsidemargin}{\jlreq@speciallength{\jlreq@option@gutter}}
- \if@twocolumn
- \addtolength{\oddsidemargin}{\dimexpr\marginparsep + \marginparwidth\relax}
+ \jlreq@setsidemargin@by@gutter{\jlreq@speciallength{\jlreq@option@gutter}}
+ \ifx\jlreq@option@fore@edge\@empty\else
+ \ifjlreq@determine@kihonhanmen@warning@first\else
+ \ClassWarningNoLine{jlreq}{fore_edge is ignored}
\fi
- \setlength{\evensidemargin}{\dimexpr\paperwidth - \textwidth - \oddsidemargin\relax}
\fi
\fi
\addtolength{\oddsidemargin}{-1in}
@@ -1751,10 +1432,14 @@
% 両方指定されていたら,縦書きは地を,横書きは天を使う
\if@tate
\jlreq@settopmarginbyfoot{\jlreq@speciallength{\jlreq@option@foot@space}}
- \ClassWarningNoLine{jlreq}{head_space is ignored}
+ \ifx\jlreq@option@line@length\@empty\else
+ \ClassWarningNoLine{jlreq}{head_space is ignored}
+ \fi
\else
\jlreq@settopmarginbyhead{\jlreq@speciallength{\jlreq@option@head@space}}
- \ClassWarningNoLine{jlreq}{foot_space is ignored}
+ \ifx\jlreq@option@number@of@lines\@empty\else
+ \ClassWarningNoLine{jlreq}{foot_space is ignored}
+ \fi
\fi
\fi
\fi
@@ -1783,17 +1468,21 @@
\fi
}
-% 同行見出し以外では,jlreq@heading@maketoc@<命令名>が\tableofcontents用の出力をするために呼び出される.
+% 扉見出しと別行見出しについては,\<csname> -> \jlreq@headingcs@csname -> 本体と
+% 二段構えで展開されるようにする.一度の展開で\parが出るのを防ぐため.
+% 一度展開を\longなしマクロに渡されると破綻するので.(そういうパッケージが存在する.)
+
+% jlreq@heading@maketoc@<命令名>が\tableofcontents用の出力をするために呼び出される.
% #1=*または空(見出し命令に*がついていたかで分岐),#2=ラベル,#3=running head
% デフォルトでは\<命令名>markと\addcontentslineが必要ならば呼ばれる.
-% 同行見出しでは\@startsection任せ
% 見出しの直前に実行される
\newcommand*{\jlreq@hook@beforeheadings}[1]{}
% 見出し名一覧を格納する
\def\jlreq@heading@allheadings{}
-% 目次を出力する命令\l@<命令名>を作る.{1 = 命令名}{2 = レベル}{3 = ラベルのフォーマット}
+% 目次を出力する命令\l@<命令名>を作る命令を作る.{1 = 命令名}{2 = レベル}{3 = ラベルのフォーマット}
+% 結果は\jlreq@resultに入る.
\def\jlreq@heading@make@l@#1#2#3{%
\@ifundefined{l@#1}{%
% 長さは適当に計測する
@@ -1801,12 +1490,17 @@
% ちょっと大きめで計測しておく
\csname c@#1\endcsname=9
\setbox\jlreq@tempboxa=\hbox{#3}%
- \jlreq@tempdima=\wd\jlreq@tempboxa\relax%
- \jlreq@tempdimb=1\zw
- \divide\jlreq@tempdima by \jlreq@tempdimb
+ \jlreq@tempdima=\wd\jlreq@tempboxa
+ \csname c@#1\endcsname=26
+ \setbox\jlreq@tempboxa=\hbox{#3}%
+ \ifdim\jlreq@tempdima<\wd\jlreq@tempboxa
+ \jlreq@tempdima=\wd\jlreq@tempboxa
+ \fi
+ % \numexprは四捨五入
+ \jlreq@tempdimb=\dimexpr\the\numexpr\jlreq@tempdima/\dimexpr 1\zw\relax + 2\relax\zw\relax
\edef\jlreq@do{%
\unexpanded{\def\jlreq@result}{%
- \noexpand\def\expandonce{\csname l@#1\endcsname}{\unexpanded{\@dottedtocline{#2}{0\zw}}{\the\numexpr\jlreq@tempdima + 1\relax\noexpand\zw}}%
+ \noexpand\def\expandonce{\csname l@#1\endcsname}{\unexpanded{\@dottedtocline{#2}{0\zw}}{\the\jlreq@tempdimb}}%
}%
}%
\expandafter\endgroup
@@ -1885,11 +1579,12 @@
\expandonce{\jlreq@heading@clearpage}%
\unexpanded{\if@restonecol\twocolumn\fi}%
}%
- \noexpand\def\expandonce{\csname #1\endcsname}{%
+ \noexpand\def\expandonce{\csname jlreq@headingcs@#1\endcsname}{%
% 改丁.これでよいのかな.
\unexpanded{\if@twocolumn\onecolumn\@restonecoltrue\else\@restonecolfalse\fi\cleartooddpage}%
\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}}%
}%
\expandafter\endgroup
\jlreq@do
@@ -2407,7 +2102,7 @@
\fi
\edef\jlreq@do{%
\expandonce{\jlreq@do}%
- \noexpand\edef\expandonce{\csname #1\endcsname}{\noexpand\unexpanded{%
+ \noexpand\edef\expandonce{\csname jlreq@headingcs@#1\endcsname}{\noexpand\unexpanded{%
\noexpand\jlreq@hook@beforeheadings{#1}%
\expandonce{\jlreq@pagebreak}%
\unexpanded{\jlreq@BlockHeading@start{#1}{#2}}%
@@ -2420,6 +2115,7 @@
}%
{\expandonce{\jlreq@totalformat}}%
}}%
+ \noexpand\def\expandonce{\csname #1\endcsname}{\expandonce{\csname jlreq@headingcs@#1\endcsname}}%
}%
\expandafter\endgroup
\jlreq@do
@@ -2517,7 +2213,7 @@
\fi
\eappto\jlreq@tempb{%
\noexpand\@ifundefined{jlreq@BlockHeading@spaces@setlist@\jlreq@headings}{}{%
- \noexpand\ClassError{jlrqe}{The spaces for \jlreq@headings\space is multiplly defined (in SetBlockHeadingSpaces)}{\noexpand\@ehc}%
+ \noexpand\ClassError{jlrqe}{The spaces for \jlreq@headings\space is defined more than once (in SetBlockHeadingSpaces)}{\noexpand\@ehc}%
}%
\noexpand\def\expandonce{\csname jlreq@BlockHeading@spaces@setlist@\jlreq@headings\endcsname}{{\expandonce{\jlreq@totalset}}\expandonce{\jlreq@set}}%
}%
@@ -2720,7 +2416,7 @@
\unexpanded{{\setbox\jlreq@tempboxa\lastbox}}%
\noexpand\begingroup
\expandonce{\jlreq@tempa{#5}}%
- \expandonce{\csname jlreq@heading@maketoc@#1\endcsname{#3}{#6}{#4}}%
+ \expandonce{\csname jlreq@heading@maketoc@#1\endcsname}{#3}{#6}{#4}%
\noexpand\endgroup
}%
}%
@@ -3308,11 +3004,11 @@
\ifthenelse{\equal{#1}{one}}{
\long\def\jlreq@makefntext##1{\parindent 1\zw
\addtolength{\leftskip}{\dimexpr\jlreq@footnoteindent + 1\zw\relax}% 全体をインデント+1文字分下げる
- \noindent\hskip -1\zw\jlreq@referencemark@format{\@thefnmark}\hskip 1\zw##1}% 見出し出力と一文字分の空き
+ \noindent\hskip\glueexpr-1\zw\relax\jlreq@referencemark@format{\@thefnmark}\hskip\glueexpr1\zw\relax##1}% 見出し出力と一文字分の空き
}{
\long\def\jlreq@makefntext##1{\parindent 1\zw
\addtolength{\leftskip}{\jlreq@footnoteindent}% 全体をインデント
- \noindent\hskip 1\zw\jlreq@referencemark@format{\@thefnmark}\hskip 1\zw##1}% 見出し出力と一文字分の空き
+ \noindent\hskip\glueexpr1\zw\relax\jlreq@referencemark@format{\@thefnmark}\hskip\glueexpr1\zw\relax##1}% 見出し出力と一文字分の空き
}
}
\jlreqsetup{footnotetext_indent=one}
@@ -3352,7 +3048,7 @@
}{%
\begingroup
\csname c@\jlreq@endnotecounter\endcsname #1\relax
- \expandafter\unrestored@protected@xdef\csname\jlreq@endnotemarkname\endcsname{\csname \jlreq@endnotecounter\endcsname}%
+ \expandafter\unrestored@protected@xdef\csname\jlreq@endnotemarkname\endcsname{\csname the\jlreq@endnotecounter\endcsname}%
\endgroup
}%
\@endnotemark
@@ -3365,7 +3061,7 @@
}{%
\begingroup
\csname c@\jlreq@endnotecounter\endcsname #1\relax
- \expandafter\unrestored@protected@xdef\csname\jlreq@endnotemarkname\endcsname{\csname \jlreq@endnotecounter\endcsname}%
+ \expandafter\unrestored@protected@xdef\csname\jlreq@endnotemarkname\endcsname{\csname the\jlreq@endnotecounter\endcsname}%
\endgroup
}%
\@endnotetext{#2}%
@@ -3416,7 +3112,7 @@
\jlreq@endnote@indent=2\jlreq@mol
% 二行目以降を全角分下げる(4.2.4.d:TODO: 選択できるべき)
\newcommand{\@makeendtext}[1]{\parindent 1\jlreq@mol
- \hskip-1\jlreq@mol\csname\jlreq@endnotemarkname\endcsname\hskip 1\jlreq@mol#1}% 見出し出力と一文字分の空き(4.2.4.c)
+ \hskip\glueexpr-1\jlreq@mol\relax\csname\jlreq@endnotemarkname\endcsname\hskip\glueexpr1\zw\relax#1}% 見出し出力と一文字分の空き(4.2.4.c)
\def\@makeendmark{\@makefnmark}
% \theendnoteの出力を仕込む
@@ -5112,6 +4808,11 @@
\else
\jlreqsetup{year_style=seireki}
\fi
+
+% 時刻
+\hour=\time \divide\hour by 60
+\minute=\numexpr\time - 60*\hour\relax
+
%.. 定理環境
\jlreq@saveoriginalcs{\@begintheorem}
\jlreq@saveoriginalcs{\@opargbegintheorem}