From 34310603e5253ef5742542e3f0123b341a70ee20 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 28 Sep 2020 03:04:08 +0000 Subject: CTAN sync 202009280304 --- language/japanese/jlreq/jlreq.cls | 219 ++++++++++++++++++++++---------------- 1 file changed, 130 insertions(+), 89 deletions(-) (limited to 'language/japanese/jlreq/jlreq.cls') diff --git a/language/japanese/jlreq/jlreq.cls b/language/japanese/jlreq/jlreq.cls index 913785b02d..ba89816ec6 100644 --- a/language/japanese/jlreq/jlreq.cls +++ b/language/japanese/jlreq/jlreq.cls @@ -5,8 +5,8 @@ %% % (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/) \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{jlreq}[2020/05/01 jlreq] -\RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen} +\ProvidesClass{jlreq}[2020/09/27 jlreq] +\RequirePackage{xkeyval,everyhook,etoolbox,ifthen,filehook} \RequirePackage{jlreq-helpers} \newcommand*{\jlreq@undeferr}[1]{\ClassError{jlreq}{Trying to delete \string#1 even though it is not defined, may be a bug}{\@ehc}} @@ -44,6 +44,10 @@ {\csname jlreq@original@\expandafter\@gobble\string#1\endcsname}% {#1}% } +\def\jlreq@restoreoriginalcs#1{% + \jlreq@if{\ifcsname jlreq@original@\expandafter\@gobble\string#1\endcsname\fi}% + {\expandafter\let\expandafter#1\csname jlreq@original@\expandafter\@gobble\string#1\endcsname}{}% +} %. オプションの定義 % オプション処理の際にしか使わない変数(後でそれを元に別の変数を調整する) @@ -1177,18 +1181,7 @@ \newcommand{\huge}{\@setfontsize\huge{2\jlreq@fontsize}{\dimexpr 28\jlreq@baselineskip/17\relax}} \newcommand{\Huge}{\@setfontsize\Huge{\dimexpr 25\jlreq@fontsize/10\relax}{\dimexpr 33\jlreq@baselineskip/17\relax}} -%. plextから一部拝借 -% オプションも*もない\rensuji(コピペ) -\DeclareRobustCommand{\jlreq@rensuji}[1]{% - \ifvmode\leavevmode\fi - \jlreq@ifydir{\hbox{#1}}{% - \hskip 0pt plus 0.25\jlreq@zw minus 0pt % \rensujiskipは固定値 - \setbox\jlreq@tempboxa=\hbox{\yoko#1}% - \@tempdima=\dimexpr\ht\jlreq@tempboxa+\dp\jlreq@tempboxa\relax - \vrule\@width\z@ \@height.5\@tempdima \@depth.5\@tempdima - \hbox to 1\jlreq@zw{\yoko\hss#1\hss}% - \hskip 0pt plus 0.25\jlreq@zw minus 0pt -}} +%. plextから拝借 \def\jlreq@Kanji#1{\expandafter\kansuji\csname c@#1\endcsname} % このあたりはtarticleと同じ @@ -2256,7 +2249,7 @@ \def\jlreq@do{}% 初期化.これに最終処理を入れていく. % 入力チェック \ifthenelse{\equal{\jlreq@column@spanning}{true}}{% - \jlreq@if{\ifjlreq@column@spanning@possible\else\fi}{ + \jlreq@if{\unless\ifjlreq@column@spanning@possible\fi}{ \ClassWarningNoLine{jlreq}{column_spanning can be used only with `pagebreak=nariyuki' or `pagebreak=clearcolumn' (in BlockHeading #1)}% \def\jlreq@column@spanning{false}% }{}% @@ -3139,14 +3132,42 @@ % \footnoteと\footnotemarkの前後に\jlreq@hook@prenote/\jlreq@hook@postnoteを入れる \jlreq@saveoriginalcs{\footnote} \jlreq@saveoriginalcs{\footnotemark} +\long\def\jlreq@footnotetext@for@footnote[#1]#2{% + \def\jlreq@result{\footnotetext[#1]{#2}}% +} \def\footnote{% + \jlreq@footnote{\footnote}{\footnotemark}{\jlreq@footnotetext@for@footnote}% +} +\def\jlreq@footnote#1#2#3{% \jlreq@hook@prenote - \@ifnextchar[{\jlreq@footnote@impl@woption}{\jlreq@footnote@impl@wooption}% + \@ifnextchar[{\jlreq@footnote@impl@woption{#1}{#2}{#3}}{\jlreq@footnote@impl@wooption{#1}{#2}{#3}}% } \def\footnotemark{% \jlreq@hook@prenote \@ifnextchar[{\jlreq@footnotemark@impl@woption}{\jlreq@footnotemark@impl@wooption}% } +\long\def\jlreq@footnotemark@impl@woption[#1]{% + \jlreq@useoriginalcs{\footnotemark}[#1]% + \jlreq@hook@postnote +} +\long\def\jlreq@footnotemark@impl@wooption{% + \jlreq@useoriginalcs{\footnotemark}% + \jlreq@hook@postnote +} +\def\jlreq@restore@original@footnotes{% + \let\jlreq@temporary@saved@footnote=\footnote + \let\jlreq@temporary@saved@footnotemark=\footnotemark + \let\jlreq@temporary@saved@footnotetext=\footnotetext + \jlreq@restoreoriginalcs{\footnote}% + \jlreq@restoreoriginalcs{\footnotemark}% + \jlreq@restoreoriginalcs{\footnotetext}% +} +\def\jlreq@restore@jlreq@footnotes{% + \let\footnote=\jlreq@temporary@saved@footnote + \let\footnotemark=\jlreq@temporary@saved@footnotemark + \let\footnotetext=\jlreq@temporary@saved@footnotetext +} + \ifthenelse{\boolean{@tate} \AND \(\boolean{@twoside} \OR \boolean{@twocolumn}\)}{ % 縦組の傍注は,その見開き内に付いている合印に対応する注を,奇数ページの左端にそろえて配置する.多段組では最下段の左端にそろえて配置する.(4.2.6.a) % 必要ならば\footnoteを\footnotemarkと\footnotetextにわけ,\footnotetextをアウトプット時まで遅延することで実現する. @@ -3156,7 +3177,7 @@ \jlreq@footnote@delayfootnoteslist } \preto\@opcol{\jlreq@hook@@opcol} - % \jlreq@footnote@delayfootnote@delay#1#2#3:#1ページ目に\footnotetext[#2]{#3}を出す + % \jlreq@footnote@delayfootnote@delay#1#2:#1ページ目に#2を出す % \jlreq@footnote@delayfootnote@page:何ページ目に\footnotetextを入れるかを\jlreq@resultcntに入れる.その場での場合は-1. \if@twocolumn \if@twoside @@ -3173,89 +3194,100 @@ \ifnum\jlreq@resultcnt=\value{page}\if@firstcolumn\else\jlreq@resultcnt=-1 \fi\fi } \fi - \long\def\jlreq@footnote@delayfootnote@delay#1#2#3{% + \long\def\jlreq@footnote@delayfootnote@delay#1#2{% % 二段組みの場合は上段を組んだ直後に\footnotetextを挿入(そのページの下段に入る) - \ifnum 0\if@firstcolumn\else 1\fi\ifnum#1>\value{page}1\fi>0 - \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}{#3}}}% - \else - \footnotetext[#2]{#3}% - \fi + \jlreq@if{\ifnum 0\if@firstcolumn\else 1\fi\ifnum#1>\value{page}1\fi>0 \fi}{% + \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}}}% + }{#2}% } \else \def\jlreq@footnote@delayfootnote@page{% \jlreq@setcurrentpage - \ifodd\jlreq@currentpage + \jlreq@if{\ifodd\jlreq@currentpage\relax\fi}{% \jlreq@resultcnt=-1 - \else + }{% \jlreq@resultcnt=\numexpr\jlreq@currentpage+1\relax - \fi + }% } - \long\def\jlreq@footnote@delayfootnote@delay#1#2#3{% + \long\def\jlreq@footnote@delayfootnote@delay#1#2{% % 一段組の場合はその前のページを組んだ直後に\footnotetextを挿入. - \ifnum\numexpr#1 - 1\relax>\value{page}% - \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}{#3}}}% - \else - \footnotetext[#2]{#3}% - \fi + \jlreq@if{\ifnum\numexpr#1 - 1\relax>\value{page} \fi}{% + \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}}}% + }{#2}% } \fi - \def\jlreq@footnote@delayfootnote@immediate#1#2#3{% - \ifnum #1<\jlreq@currentpage - \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}{#3}}}% - \else - \footnotetext[#2]{#3}% - \fi + \def\jlreq@footnote@delayfootnote@immediate#1#2{% + \jlreq@if{\ifnum #1<\jlreq@currentpage\relax\fi}{% + \xappto\jlreq@footnote@delayfootnoteslist{\unexpanded{\jlreq@footnote@delayfootnote{#1}{#2}}}% + }{#2}% } \let\jlreq@footnote@delayfootnote=\jlreq@footnote@delayfootnote@delay \def\jlreq@footnote@flushdelayfootnoteslist{% - \ifx\jlreq@footnote@delayfootnoteslist\@empty\else + \jlreq@if{\ifx\jlreq@footnote@delayfootnoteslist\@empty\fi}{}{% \let\jlreq@footnote@delayfootnote=\jlreq@footnote@delayfootnote@immediate \jlreq@setcurrentpage \expandafter\gdef\expandafter\jlreq@footnote@delayfootnoteslist\expandafter{\expandafter}% \jlreq@footnote@delayfootnoteslist \let\jlreq@footnote@delayfootnote=\jlreq@footnote@delayfootnote@delay - \fi + }% } \AtEndDocument{\jlreq@footnote@flushdelayfootnoteslist} \preto\newpage{\jlreq@footnote@flushdelayfootnoteslist} - \long\def\jlreq@footnote@impl@woption[#1]#2{% + \long\def\jlreq@footnote@impl@woption#1#2#3[#4]#5{% \jlreq@footnote@delayfootnote@page - \ifnum\jlreq@resultcnt=-1 - \jlreq@useoriginalcs{\footnote}[#1]{#2}% - \else - \jlreq@useoriginalcs{\footnotemark}[#1]% - \xappto\jlreq@footnote@delayfootnoteslist{\noexpand\jlreq@footnote@delayfootnote{\the\jlreq@resultcnt}{\unexpanded{#1}}{\unexpanded{#2}}}% - \fi + \begingroup + \edef\jlreq@do{\unexpanded{% + \jlreq@restore@original@footnotes + \def\jlreq@result{}#2[#4]\jlreq@result + \def\jlreq@result{}#3[#4]{#5}% + \jlreq@restore@jlreq@footnotes}% + \jlreq@if{\ifnum\jlreq@resultcnt=-1 \fi}{\noexpand\jlreq@result}{\unexpanded{% + \xappto\jlreq@footnote@delayfootnoteslist{% + \noexpand\jlreq@footnote@delayfootnote{\the\jlreq@resultcnt}{% + \noexpand\jlreq@restore@original@footnotes + \expandonce{\jlreq@result}% + \noexpand\jlreq@restore@jlreq@footnotes + }% + }% + }}% + }% + \expandafter\endgroup\jlreq@do \jlreq@hook@postnote } - \long\def\jlreq@footnote@impl@wooption#1{% + \long\def\jlreq@footnote@impl@wooption#1#2#3#4{% \jlreq@footnote@delayfootnote@page - \ifnum\jlreq@resultcnt=-1 - \jlreq@useoriginalcs{\footnote}{#1}% - \else - \jlreq@useoriginalcs{\footnotemark}% - \xappto\jlreq@footnote@delayfootnoteslist{\noexpand\jlreq@footnote@delayfootnote{\the\jlreq@resultcnt}{\the\value{footnote}}{\unexpanded{#1}}}% - \fi + \begingroup + \stepcounter{footnote}% + \edef\jlreq@do{% + \unexpanded{\def\jlreq@result{}#2}[\the\value{footnote}]\noexpand\jlreq@result + \unexpanded{\def\jlreq@result{}#3}[\the\value{footnote}]\unexpanded{{#4}}% + \jlreq@if{\ifnum\jlreq@resultcnt=-1 \fi}{\noexpand\jlreq@result}{\unexpanded{% + \xappto\jlreq@footnote@delayfootnoteslist{% + \noexpand\jlreq@footnote@delayfootnote{\the\jlreq@resultcnt}{% + \noexpand\jlreq@restore@original@footnotes + \expandonce{\jlreq@result}% + \noexpand\jlreq@restore@jlreq@footnotes + }% + }% + }}% + }% + \expandafter\endgroup\jlreq@do \jlreq@hook@postnote } }{ - \long\def\jlreq@footnote@impl@woption[#1]#2{% - \jlreq@useoriginalcs{\footnote}[#1]{#2}% + \long\def\jlreq@footnote@impl@woption#1#2#3[#4]#5{% + \jlreq@restore@original@footnotes + #1[#4]{#5}% + \jlreq@restore@jlreq@footnotes \jlreq@hook@postnote } - \long\def\jlreq@footnote@impl@wooption#1{% - \jlreq@useoriginalcs{\footnote}{#1}% + \long\def\jlreq@footnote@impl@wooption#1#2#3#4{% + \jlreq@restore@original@footnotes + #1{#4}% + \jlreq@restore@jlreq@footnotes \jlreq@hook@postnote } } -\long\def\jlreq@footnotemark@impl@woption[#1]{% - \jlreq@useoriginalcs{\footnotemark}[#1]% - \jlreq@hook@postnote -} -\long\def\jlreq@footnotemark@impl@wooption{% - \jlreq@useoriginalcs{\footnotemark}% - \jlreq@hook@postnote -} % 合印 \renewcommand*{\@makefnmark}{% @@ -3263,7 +3295,7 @@ } % 4.2.2注3 \if@tate - \renewcommand*{\thefootnote}{\jlreq@open@bracket@before@space\inhibitglue(\jlreq@rensuji{\@arabic\c@footnote})\inhibitglue} + \renewcommand*{\thefootnote}{\jlreq@open@bracket@before@space\inhibitglue(\tatechuyoko*{\@arabic\c@footnote})\inhibitglue} \else \renewcommand*{\thefootnote}{\arabic{footnote}\hbox{})\inhibitglue} \fi @@ -4041,7 +4073,7 @@ }% } \def\jlreq@pagestyle@make@runninghead@#1#2#3#4#5{% - \jlreq@if{\ifnum\numexpr\jlreq@ifendmark{#5\fi}{1}{0}*\ifjlreq@tempa 1\else 0\fi\relax=1 \fi}{% + \jlreq@if{\ifnum\numexpr\jlreq@ifendmark{#5}{1}{0}*\ifjlreq@tempa 1\else 0\fi\relax=1 \fi}{% % 項目が一つしか無い \jlreq@ifempty{#2}{\csappto}{\cspreto}{#1}{#4}% }{% @@ -5123,7 +5155,7 @@ \protected@write\@auxout{% \let\label\@gobble\let\index\@gobble\let\glossary\@gobble \if@tate - \@temptokena{\jlreq@rensuji{\thepage}}% + \@temptokena{\tatechuyoko{\thepage}}% \else \@temptokena{\thepage}% \fi @@ -5526,11 +5558,17 @@ %. その他諸々 %.. 縦中横 -\edef\@tempa{% - \unexpanded{% - \jlreq@ifydir{\ClassError{jlreq}{\string\tatechuyoko\space is not allowed in yoko mode}{\@ehc}}{}% - \ifvmode\leavevmode\fi +\protected\def\tatechuyoko{\@ifstar + {\jlreq@tatechuyoko@i}% + {% + \jlreq@iftdir{}{\ClassError{jlreq}{\string\tatechuyoko\space is not allowed in yoko mode}{\@ehc}}% + \jlreq@tatechuyoko@ii }% +} +\def\jlreq@tatechuyoko@i#1{\jlreq@iftdir{\jlreq@tatechuyoko@ii{#1}}{#1}} + +\edef\@tempa{% + \unexpanded{\ifvmode\leavevmode\fi}% \ifx l\jlreq@engine\unexpanded{% \jlreq@lastnodechar=\lastnodechar\relax \ifnum\jlreq@lastnodechar>-1 \inhibitglue\fi @@ -5540,19 +5578,22 @@ }\fi } -\expandafter\protected\expandafter\def\expandafter\tatechuyoko\expandafter#\expandafter1\expandafter{% +\expandafter\def\expandafter\jlreq@tatechuyoko@ii\expandafter#\expandafter1\expandafter{% \@tempa % 前のJFM glue \ifnum\jlreq@lastnodechar>-1 \jlreq@calc@jfmglue{\char\jlreq@lastnodechar}{阿}% \jlreq@ifgluezero\jlreq@resultskip{}{\hskip\jlreq@resultskip}% \fi - \hbox{\yoko - \setbox\jlreq@tempboxa=\hbox{阿}% - \vrule width 0pt height \ht\jlreq@tempboxa depth \dp\jlreq@tempboxa #1}% - \futurelet\jlreq@nextchar\jlreq@tatechuyoko@ + \hbox{\yoko + \begingroup + \setbox\jlreq@tempboxa=\hbox{阿}% + \vrule width 0pt height \ht\jlreq@tempboxa depth \dp\jlreq@tempboxa + \endgroup + #1}% + \futurelet\jlreq@nextchar\jlreq@tatechuyoko@iii } -\def\jlreq@tatechuyoko@{% +\def\jlreq@tatechuyoko@iii{% \begingroup \def\jlreq@do{}% \jlreq@getfirsttoken@expandmacros{\jlreq@nextchar}{\jlreq@tempa}% @@ -5676,11 +5717,11 @@ \if@tate \renewcommand{\thepart}{\jlreq@Kanji{part}} \ifthenelse{\equal{\jlreq@article@type}{article}}{}{\renewcommand{\thechapter}{\jlreq@Kanji{chapter}}} - \renewcommand{\thesection}{\jlreq@rensuji{\@arabic\c@section}} - \renewcommand{\thesubsection}{\jlreq@rensuji{\@alph\c@subsection}} - \renewcommand{\thesubsubsection}{\jlreq@rensuji{\@arabic\c@subsubsection}} - \renewcommand{\theparagraph}{(\jlreq@rensuji{\@arabic\c@paragraph})} - \renewcommand{\thesubparagraph}{(\jlreq@rensuji{\@arabic\c@subparagraph})} + \renewcommand{\thesection}{\tatechuyoko*{\@arabic\c@section}} + \renewcommand{\thesubsection}{\tatechuyoko*{\@alph\c@subsection}} + \renewcommand{\thesubsubsection}{\tatechuyoko*{\@arabic\c@subsubsection}} + \renewcommand{\theparagraph}{(\tatechuyoko*{\@arabic\c@paragraph})} + \renewcommand{\thesubparagraph}{(\tatechuyoko*{\@arabic\c@subparagraph})} \ifthenelse{\equal{\jlreq@article@type}{article}}{ \NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE}},indent=4\jlreq@zw,lines=4,after_label_space=1\jlreq@zw,second_heading_text_indent={-1\jlreq@zw,1\jlreq@zw},subtitle_font={\jlreq@keepbaselineskip{\large}}} @@ -5805,9 +5846,9 @@ %.. 箇条書き \if@tate \renewcommand{\theenumi}{\jlreq@Kanji{enumi}} - \renewcommand{\theenumii}{\jlreq@rensuji{\@arabic\c@enumii}} - \renewcommand{\theenumiii}{\jlreq@rensuji{\@arabic\c@enumiii}} - \renewcommand{\theenumiv}{\jlreq@rensuji{\@arabic\c@enumiv}} + \renewcommand{\theenumii}{\tatechuyoko*{\@arabic\c@enumii}} + \renewcommand{\theenumiii}{\tatechuyoko*{\@arabic\c@enumiii}} + \renewcommand{\theenumiv}{\tatechuyoko*{\@arabic\c@enumiv}} \newcommand{\labelenumi}{\theenumi} \newcommand{\labelenumii}{\theenumii} \newcommand{\labelenumiii}{\theenumiii} @@ -5911,7 +5952,7 @@ \if@tate \jlreqsetup{ appendix_counter = { - section = {value = 0, the = {\jlreq@rensuji{\Alph{section}}}}, + section = {value = 0, the = {\tatechuyoko*{\Alph{section}}}}, subsection = {value = 0}, } } @@ -5928,7 +5969,7 @@ \if@tate \jlreqsetup{ appendix_counter = { - chapter = {value = 0, the = {\jlreq@rensuji{\Alph{chapter}}}}, + chapter = {value = 0, the = {\tatechuyoko*{\Alph{chapter}}}}, } } \else -- cgit v1.2.3