diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-29 22:22:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-29 22:22:55 +0000 |
commit | a64b4791da7a1ea0fb4652e5a729eac97378f936 (patch) | |
tree | 9259c032947abef7879470656be9a1371d564f01 /Master/texmf-dist/tex/latex | |
parent | 3f99609b0e6bb17494a6f8bd9d49033f50762c74 (diff) |
jlreq (29apr17)
git-svn-id: svn://tug.org/texlive/trunk@44117 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq.cls | 1031 |
1 files changed, 576 insertions, 455 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls index 7d25d0efd4c..4c14104d8b6 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}[2017/04/04 jlreq] +\ProvidesClass{jlreq}[2017/04/29 jlreq] \RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen} %. helper1 @@ -128,35 +128,6 @@ } \def\jlreq@helper@removelastcomma#1,\jlreq@endmark{#1} -% #1が#2のトークン内と\ifxで一致すれば#3を,そうでなければ#4を実行する. -% #2は\edefで展開する.{}があるとバグるかも. -\def\jlreq@ifintokenlist#1#2{% - \begingroup - \jlreq@tempafalse - \edef\@tempa{#2}% - \expandafter\jlreq@helper@ifintokenlist@\expandafter{\@tempa}{#1}% - \ifjlreq@tempa - \def\jlreq@do{\@firstoftwo}% - \else - \def\jlreq@do{\@secondoftwo}% - \fi - \expandafter\endgroup - \jlreq@do -} -\def\jlreq@helper@ifintokenlist@#1#2{% - \jlreq@helper@ifintokenlist@@{#2}#1\jlreq@endmark -} -\def\jlreq@helper@ifintokenlist@@#1#2{% - \jlreq@ifendmark{#2}{% - \def\jlreq@next{}% - }{% - \ifx#1#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi - {\jlreq@tempatrue\def\jlreq@next{\jlreq@deleteuntileendmark}}% - {\def\jlreq@next{\jlreq@helper@ifintokenlist@@{#1}}}% - }% - \jlreq@next -} - % vbox #1の最後を\jlreq@resultboxに入れる % #1の最後の行は消える \newcommand*{\jlreq@getlastbox}[1]{% @@ -385,14 +356,14 @@ %.. 基本版面.まずは紙サイズ. \def\jlreq@switchpapersize{} \jlreq@aftercls@addtodeletecs{\jlreq@switchpapersize} -\newcommand*\jlreq@addpapersize[4][]{% - \jlreq@ifempty{#2}{}{ - \jlreq@DeclareOption{#2}{\setlength\paperheight{#3}\setlength\paperwidth{#4}} - \appto\jlreq@switchpapersize{{#2}{\setlength\paperheight{#3}\setlength\paperwidth{#4}}} - } - \jlreq@ifempty{#1}{}{ - \appto\jlreq@switchpapersize{{#1}{\setlength\paperheight{#3}\setlength\paperwidth{#4}}} - } +% \jlreq@addpapersize{paper=に指定するもの}{単独オプション名}{横}{縦} +\newcommand*{\jlreq@addpapersize}[4]{% + \@for\@tempa:=#1\do{% + \eappto\jlreq@switchpapersize{{\expandonce{\@tempa}}{\unexpanded{\setlength{\paperwidth}{#3}\setlength{\paperheight}{#4}}}}% + }% + \@for\@tempa:=#2\do{% + \expandafter\jlreq@DeclareOption\expandafter{\@tempa}{\setlength{\paperwidth}{#3}\setlength{\paperheight}{#4}}% + }% } \jlreq@aftercls@addtodeletecs{\jlreq@addpapersize} \DeclareOptionX{paper}{ @@ -401,8 +372,8 @@ [\unexpanded{% \jlreq@helper@dividebycomma{#1}% \ifjlreq@tempa - \setlength{\paperheight}{\dimexpr\jlreq@tempc\relax}% - \setlength{\paperwidth}{\dimexpr\jlreq@tempd\relax}% + \setlength{\paperwidth}{\dimexpr\jlreq@tempc\relax}% + \setlength{\paperheight}{\dimexpr\jlreq@tempd\relax}% \else \ClassError{jlreq}{The paper #1 is unknown}{\@ehc}% \fi @@ -411,48 +382,44 @@ \jlreq@do } % 紙サイズ一覧.b*はJIS B. -% [paper=で指定できるようにするもの]{オプション名}{縦}{横} -\jlreq@addpapersize[a3]{a3paper}{420mm}{297mm} -\jlreq@addpapersize[a4]{a4paper}{297mm}{210mm} -\jlreq@addpapersize[a5]{a5paper}{210mm}{148mm} -\jlreq@addpapersize[a6]{a6paper}{148mm}{105mm} -\jlreq@addpapersize[b4]{b4paper}{364mm}{257mm} -\jlreq@addpapersize[b5]{b5paper}{257mm}{182mm} -\jlreq@addpapersize[b6]{b6paper}{182mm}{128mm} -\jlreq@addpapersize{a4j}{297mm}{210mm} -\jlreq@addpapersize{a5j}{210mm}{148mm} -\jlreq@addpapersize{b4j}{364mm}{257mm} -\jlreq@addpapersize{b5j}{257mm}{182mm} -\jlreq@addpapersize{a4var}{283mm}{210mm} -\jlreq@addpapersize{b5var}{230mm}{182mm} -\jlreq@addpapersize[letter]{letterpaper}{11in}{8.5in} -\jlreq@addpapersize[legal]{legalpaper}{14in}{8.5in} -\jlreq@addpapersize[executive]{executivepaper}{10.5in}{7.25in} -% 追加 -\jlreq@addpapersize[a0]{}{1189mm}{841mm} -\jlreq@addpapersize[a1]{}{841mm}{594mm} -\jlreq@addpapersize[a2]{}{594mm}{420mm} -\jlreq@addpapersize[a7]{}{105mm}{74mm} -\jlreq@addpapersize[a8]{}{74mm}{52mm} -\jlreq@addpapersize[a9]{}{52mm}{37mm} -\jlreq@addpapersize[a10]{}{37mm}{26mm} - -\jlreq@addpapersize[b0]{}{1456mm}{1030mm} -\jlreq@addpapersize[b1]{}{1030mm}{728mm} -\jlreq@addpapersize[b2]{}{728mm}{515mm} -\jlreq@addpapersize[b3]{}{515mm}{364mm} -\jlreq@addpapersize[b7]{}{128mm}{91mm} -\jlreq@addpapersize[b8]{}{91mm}{64mm} -\jlreq@addpapersize[b9]{}{64mm}{45mm} -\jlreq@addpapersize[b10]{}{45mm}{32mm} - -\jlreq@addpapersize[c2]{}{648mm}{458mm} -\jlreq@addpapersize[c3]{}{458mm}{324mm} -\jlreq@addpapersize[c4]{}{354mm}{229mm} -\jlreq@addpapersize[c5]{}{229mm}{162mm} -\jlreq@addpapersize[c6]{}{162mm}{114mm} -\jlreq@addpapersize[c7]{}{114mm}{81mm} -\jlreq@addpapersize[c8]{}{81mm}{57mm} +\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} %.. フォントサイズ,行長,1ページあたりの行数で基本版面のサイズを決める(2.4.1.a) @@ -462,7 +429,12 @@ \jlreq@DeclareOption{10pt}{\renewcommand*{\jlreq@option@fontsize}{10pt}} \jlreq@DeclareOption{11pt}{\renewcommand*{\jlreq@option@fontsize}{11pt}} \jlreq@DeclareOption{12pt}{\renewcommand*{\jlreq@option@fontsize}{12pt}} - +\newcommand*{\jlreq@option@jafontsize}{} +\jlreq@aftercls@addtodeletecs{\jlreq@option@jafontsize} +\DeclareOptionX{jafontsize}{\renewcommand*{\jlreq@option@jafontsize}{#1}} +\newcommand*{\jlreq@option@jafontscale}{1} +\DeclareOptionX{jafontscale}{\renewcommand*{\jlreq@option@jafontscale}{#1}} +\jlreq@aftercls@addtodeletecs{\jlreq@option@jafontscale} %.. 行の長さ \newcommand*{\jlreq@option@line@length}{} \jlreq@aftercls@addtodeletecs{\jlreq@option@line@length} @@ -500,7 +472,7 @@ \DeclareOptionX{column_gap}{\renewcommand*{\jlreq@option@column@gap{#1}}} %.. 行送り,指定無しの場合は文字サイズの1.7倍とする.(1.5から2倍が好ましい:2.4.2.d 注3) -\newcommand*{\jlreq@option@baselineskip}{} +\newcommand*{\jlreq@option@baselineskip}{17zw/10} \jlreq@aftercls@addtodeletecs{\jlreq@option@baselineskip} \DeclareOptionX{baselineskip}{\def\jlreq@option@baselineskip{#1}} \DeclareOptionX{linegap}{\def\jlreq@option@baselineskip{1zw + #1}} @@ -515,33 +487,11 @@ \jlreq@DeclareOption{hanging_punctuation}{\jlreq@burasagetrue} %.. 注 -% 合印の場所(4.2.3)行間に入れるか否か -\newcommand*{\jlreq@referencemark}{inline} -\define@choicekey{jlreq.cls}{reference_mark}{inline,interlinear}{\renewcommand*{\jlreq@referencemark}{#1}} -% 脚注の字下げ,一行目を下げるならばone,二行目以降ならばtwo.ちょっと酷いので後で考える. -\newcommand*{\jlreq@footnotetext@indent}{one} -\define@choicekey{jlreq.cls}{footnotetext_indent}{one,two}{\renewcommand*{\jlreq@footnotetext@indent}{#1}} -% 後注をどこに配置するか.headings(全ての見出し),paragraph(段落後),_で始まるやつ(その名前の見出し).カンマ区切り -\newcommand*{\jlreq@endnote@position}{headings} -\DeclareOptionX{endnote_position}{\renewcommand*{\jlreq@endnote@position}{#1}} % 傍注のタイプ -\newcommand*{\jlreq@sidenote@type}{number} -\define@choicekey{jlreq.cls}{sidenote_type}{number,symbol}{\renewcommand*{\jlreq@sidenote@type}{#1}} \newcommand*{\jlreq@option@sidenote@width}{} \jlreq@aftercls@addtodeletecs{\jlreq@option@sidenote@width} \DeclareOptionX{sidenote_width}{\renewcommand*{\jlreq@option@sidenote@width}{#1}} -%.. 引用 -\def\jlreq@quote@indent{2zw} -\DeclareOptionX{quote_indent}{\def\jlreq@quote@indent{#1}} -\def\jlreq@quote@end@indent{0zw} -\DeclareOptionX{quote_end_indent}{\def\jlreq@quote@end@indent{#1}} -\def\jlreq@quote@fontsize{normalsize} -\define@choicekey{jlreq.cls}{quote_fontsize}{normalsize,small,footnotesize,scriptsize,tiny}{\def\jlreq@quote@fontsize{#1}} -\def\jlreq@quote@beforeafter@space{0pt} -\DeclareOptionX{quote_beforeafter_space}{\def\jlreq@quote@beforeafter@space{#1}} - - %.. もろもろ \newif\if@restonecol \@restonecolfalse \newif\if@titlepage \@titlepagefalse @@ -577,10 +527,10 @@ \jlreq@DeclareOption{leqno}{\input{leqno.clo}} \jlreq@DeclareOption{fleqn}{\input{fleqn.clo}} -\newcommand*{\jlreq@warning}[1]{} -\jlreq@DeclareOption{jlreq_warnings}{\renewcommand*{\jlreq@warning}[1]{\ClassWarningNoLine{jlreq}{(JLReq warning) ##1}}} +\newcommand*{\jlreq@note}[1]{} +\jlreq@DeclareOption{jlreq_notes}{\renewcommand*{\jlreq@note}[1]{\message{^^JJLReq note: ##1^^J}}} -\ExecuteOptionsX{article_type=article,paper=a4,fontsize=10pt,open_bracket_pos=zenkaku_tentsuki,reference_mark=inline,footnotetext_indent=one,endnote_position=headings,onecolumn,final} +\ExecuteOptionsX{article_type=article,paper=a4,open_bracket_pos=zenkaku_tentsuki,onecolumn,final} % \@removeelementを一旦置き換えてから\ProcessOptionsXを実行する \let\jlreq@original@@removeelement=\@removeelement \let\@removeelement=\jlreq@helper@removeelement @@ -605,21 +555,36 @@ \fi \def\jlreq@jlreqsetup@keyvallist{} +\def\jlreq@jlreqsetup@finally{} \newcommand{\jlreqsetup}[1]{% \begingroup \edef\jlreq@do{\unexpanded{\jlreq@parsekeyval[jlreqsetup]}{\expandonce{\jlreq@jlreqsetup@keyvallist}}}% \expandafter\endgroup \jlreq@do{#1}% + \jlreq@jlreqsetup@finally +} +% \jlreqsetupの項目に加えるマクロ.\jlreq@jlreqsetup@add{key}{action}とするとkeyに対して定義できる. +% action内ではvalが#1として取得できる.(従ってaction内でマクロを定義する際には##1を使う必要がある.) +\newcommand{\jlreq@jlreqsetup@add}[1]{% + \@ifnextchar[{\jlreq@jlreqsetup@add@{#1}}{\jlreq@jlreqsetup@add@@{#1}}% +} +\long\def\jlreq@jlreqsetup@add@#1[#2]#3{% + \eappto\jlreq@jlreqsetup@keyvallist{\unexpanded{{#1}[#2]{#3}}}% } -\newcommand{\jlreq@jlreqsetup@add}[2]{% +\long\def\jlreq@jlreqsetup@add@@#1#2{% \eappto\jlreq@jlreqsetup@keyvallist{\unexpanded{{#1}{#2}}}% } +% \jlreqsetupの最後に必ず実行される処理を入れる. +\newcommand\jlreq@jlreqsetup@addtofinally[1]{\eappto\jlreq@jlreqsetup@finally{\unexpanded{#1}}} \jlreq@aftercls@addtodeletecs{\jlreq@jlreqsetup@add} +\jlreq@aftercls@addtodeletecs{\jlreq@jlreqsetup@add@} +\jlreq@aftercls@addtodeletecs{\jlreq@jlreqsetup@add@@} +\jlreq@aftercls@addtodeletecs{\jlreq@jlreqsetup@addtofinally} \@onlypreamble\jlreqsetup % エンジンの設定 \ifx\jlreq@engine\@undefined - \ifx\luatexversion\@undefined + \ifx\directlua\@undefined \ifx\ucs\@undefined \let\jlreq@engine=p \else @@ -669,10 +634,16 @@ \def\jlreq@iftbox#1{\iftbox#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} } +\ifx l\jlreq@engine + \newcommand*{\jlreq@getpostbreakpenalty}[1]{\ltjgetparameter{postbreakpenalty}{#1}} +\else + \newcommand*{\jlreq@getpostbreakpenalty}[1]{\postbreakpenalty#1} +\fi + % 現在行の残りを得る. \ifx l\jlreq@engine % 以下のコードはおかしい. - \newcommand*{\jlreq@calc@current@linewidth}{% + \newcommand*{\jlreq@calc@current@linewidth@onecolumn}{% \dimexpr\zposx{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp - \@totalleftmargin - \ifodd\jlreq@currentpage \oddsidemargin @@ -682,7 +653,7 @@ - 1in - \hoffset\relax } \else - \newcommand*{\jlreq@calc@current@linewidth}{% + \newcommand*{\jlreq@calc@current@linewidth@onecolumn}{% \dimexpr \jlreq@ifydir{% \zposx{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp - \hoffset @@ -704,10 +675,19 @@ \relax } \fi +\newcommand*{\jlreq@calc@current@linewidth}{% + \dimexpr\jlreq@calc@current@linewidth@onecolumn + \if@twocolumn + \ifdim\jlreq@calc@current@linewidth@onecolumn<\dimexpr\linewidth+\columnsep\relax\else + - \linewidth - \columnsep + \fi + \fi + \relax +} \newdimen\jlreq@current@linewidth \newdimen\jlreq@rest@linewidth -% この命令以降,次にこの命令を実行する前まで\jlreq@rest@linewidth/\jlreq@rest@linewidthで +% この命令以降,次にこの命令を実行する前まで\jlreq@current@linewidth/\jlreq@rest@linewidthで % この場所における残り長さが取得できる. \newcommand*{\jlreq@savepos@for@rest@linewidth}{% \jlreq@setcurrentpage @@ -731,11 +711,13 @@ \expandafter\endgroup \jlreq@do } + \newcount\jlreq@lastnodechar % jlreq@lastnodecharに入っている値と次のトークン(\futureletで得る)の間に入るJFMグルー等を挿入する -\def\jlreq@fixjfm{% +\newcommand*{\jlreq@fixjfm}{% \ifnum\jlreq@lastnodechar>-1 \def\jlreq@do{% + \ifnum\jlreq@getpostbreakpenalty{\jlreq@lastnodechar}=0\else\penalty\jlreq@getpostbreakpenalty{\jlreq@lastnodechar}\fi \jlreq@isletter{\jlreq@nextchar}{% \jlreq@calc@jfmglue{\char\jlreq@lastnodechar}{\jlreq@nextchar}% % \message{fixjfm Insert: \the\jlreq@resultskip}% @@ -750,6 +732,41 @@ \@tempa } +% #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=#1\relax\@tempdimb=#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 + } +\fi + %. 基本設定 \def\jlreq@kanjiskip{0pt plus 0.25zw minus 0pt} \def\jlreq@xkanjiskip{0.25zw plus 0.25zw minus 0.125zw} @@ -1042,20 +1059,39 @@ \jlreq@setprebreakpenalty{‥}{10000} % ¥100とか70%とか…… +% フォントサイズを設定 \newdimen\jlreq@fontsize +\newdimen\jlreq@jafontsize \ifx l\jlreq@engine - \setlength{\jlreq@fontsize}{% + \def\jlreq@expand@optionfontsize#1{% \dimexpr\directlua{ local act = string.char(92) - local s = [[\jlreq@option@fontsize]] + local s = [[#1]] s = s:gsub("Q",act .. "dimexpr 0.25mm" .. act .. "relax") tex.print(s) }\relax }% \else - \setlength{\jlreq@fontsize}{\dimexpr\jlreq@option@fontsize\relax} + \def\jlreq@expand@optionfontsize#1{\dimexpr#1\relax} +\fi +\jlreq@aftercls@addtodeletecs{\jlreq@expand@optionfontsize} +\ifx\jlreq@option@fontsize\@empty + \ifx\jlreq@option@jafontsize\@empty + \jlreq@fontsize=10pt + \jlreq@jafontsize=\jlreq@option@jafontscale\jlreq@fontsize + \else + \setlength{\jlreq@jafontsize}{\jlreq@expand@optionfontsize{\jlreq@option@jafontsize}} + \jlreq@divide{\jlreq@jafontsize}{\jlreq@option@jafontscale pt} + \jlreq@fontsize=\jlreq@resultdimen + \fi +\else + \setlength{\jlreq@fontsize}{\jlreq@expand@optionfontsize{\jlreq@option@fontsize}} + \ifx\jlreq@option@jafontsize\@empty + \jlreq@jafontsize=\jlreq@option@jafontscale\jlreq@fontsize + \else + \setlength{\jlreq@jafontsize}{\jlreq@expand@optionfontsize{\jlreq@option@jafontsize}} + \fi \fi - %. フォント \RequirePackage{lmodern} @@ -1096,31 +1132,57 @@ \DeclareRobustCommand*{\mit}{\@fontswitch\relax\mathnormal} %.. 和文 +% 行頭括弧に対して\inhibitglueを入れたりする命令を作る +\def\jlreq@openbreackets@list{(〔[{〈《「『【‘“} +\ifx p\jlreq@engine\else\edef\jlreq@openbreackets@list{\jlreq@openbreackets@list ⦅〘〖«〝}\fi +\jlreq@aftercls@addtodeletecs{\jlreq@openbreackets@list} +% \jlreq@openbreackets@listの各括弧に対して,\ifx\jlreq@nextchar 「1\fiみたいなのが並んだのを作る +\def\jlreq@tempa{} +\def\jlreq@do#1{\jlreq@ifendmark{#1}{}{\appto\jlreq@tempa{\ifx\jlreq@nextchar#11\fi}\jlreq@do}} +\expandafter\jlreq@do\jlreq@openbreackets@list\jlreq@endmark +% JFM glueの伸び縮みで行頭括弧が揃わないのを防ぐために常に\inhibitglueを入れる. +\ifthenelse{\equal{\jlreq@open@bracket@pos}{nibu_tentsuki}}{ + \edef\jlreq@openbracket@hook{\noexpand\ifnum0\expandonce{\jlreq@tempa}>0 \unexpanded{\hskip -.5\jlreq@mol\inhibitglue}\noexpand\fi} +}{% zenkakunibu_nibu,zenkaku_tentsuki + \edef\jlreq@openbracket@hook{\noexpand\ifnum0\expandonce{\jlreq@tempa}>0 \unexpanded{\inhibitglue}\noexpand\fi} +} % JFMに関連する設定 \ifx l\jlreq@engine % この値は後でjfm-jlreq内で読む \directlua{jlreq.open_bracket_pos = [[\jlreq@open@bracket@pos]]} - \ifjlreq@burasage\directlua{jlreq.burasage = true} - \else\directlua{jlreq.burasage = false}\fi + \ifjlreq@burasage\directlua{jlreq.burasage = true}\else\directlua{jlreq.burasage = false}\fi + % 行頭括弧はJFMで対応できるが,\item後だけはどうしようもない. + \jlreq@saveoriginalcs{list} + \jlreq@saveoriginalcs{endlist} + \def\list{\jlreq@pushhook@postpar{\futurelet\jlreq@nextchar\jlreq@openbracket@hook}\jlreq@original@list} + \def\endlist{\jlreq@pophook@postpar\jlreq@original@endlist} \else % 非LuaTeXの場合はJFMの入れ替えと\everyparでの処理で対処. - \def\jlreq@jfmname@prefix{} - \def\jlreq@openbreackets@list{(〔[{〈《「『【} - \ifx u\jlreq@engine\edef\jlreq@openbreackets@list{\jlreq@openbreackets@list {⦅〘〖«〝‘“}}\fi % \jlreq@jfmnameにJFMの名前を入れる + \def\jlreq@jfmname@prefix{} + \jlreq@aftercls@addtodeletecs{\jlreq@jfmname@prefix} \ifjlreq@burasage\edef\jlreq@jfmname@prefix{b\jlreq@jfmname@prefix}\fi \ifthenelse{\equal{\jlreq@open@bracket@pos}{zenkakunibu_nibu}}{\edef\jlreq@jfmname@prefix{\jlreq@jfmname@prefix z}}{} \ifx u\jlreq@engine\edef\jlreq@jfmname@prefix{u\jlreq@jfmname@prefix}\fi \edef\jlreq@jfmname{\jlreq@jfmname@prefix jlreq} \edef\jlreq@jfmnameg{\jlreq@jfmname@prefix jlreqg} - % JFM glueの伸び縮みで行頭括弧が揃わないのを防ぐために常に\inhibitglueを入れる. - \ifthenelse{\equal{\jlreq@open@bracket@pos}{nibu_tentsuki}}{ - \def\jlreq@openbracket@hook{\jlreq@ifintokenlist{\jlreq@nextchar}{\jlreq@openbreackets@list}{\hskip -.5\jlreq@mol\inhibitglue}{}} - }{% zenkakunibu_nibu,zenkaku_tentsuki - \def\jlreq@openbracket@hook{\jlreq@ifintokenlist{\jlreq@nextchar}{\jlreq@openbreackets@list}{\inhibitglue}{}} - } \AtBeginDocument{\PushPostHook{par}{\futurelet\jlreq@nextchar\jlreq@openbracket@hook}} \fi +\newcount\jlreq@count@listnest +\jlreq@count@listnest=0 +\def\jlreq@pushhook@postpar#1{% + \advance\jlreq@count@listnest by 1 + \def\@tempa{\SavePostHook{par}}% + \expandafter\@tempa\csname jlreq@save@posthook@par \the\jlreq@count@listnest\endcsname + \PushPostHook{par}{#1}% +} +\def\jlreq@pophook@postpar{% + \def\@tempa{\RestorePostHook{par}}% + \expandafter\@tempa\csname jlreq@save@posthook@par \the\jlreq@count@listnest\endcsname + \expandafter\let\csname jlreq@save@posthook@par \the\jlreq@count@listnest\endcsname=\@undefined + \advance\jlreq@count@listnest by -1 +} + % 開き括弧の幅が全角の場合は,ベタ組にするために補正が必要 \ifthenelse{\equal{\jlreq@open@bracket@pos}{zenkakunibu_nibu}}{ \def\jlreq@open@bracket@before@space{\hskip -.5\jlreq@mol} @@ -1143,22 +1205,25 @@ \def\jlreq@yokokanjiencoding{JY2} \def\jlreq@tatekanjiencoding{JT2} \fi +\jlreq@divide{\jlreq@jafontsize}{\jlreq@fontsize} +\edef\jlreq@jafontscale{\strip@pt\jlreq@resultdimen} +\jlreq@aftercls@addtodeletecs{\jlreq@jafontscale} \ifx l\jlreq@engine \def\jlreq@yokokanjiencoding{JY3} \def\jlreq@tatekanjiencoding{JT3} \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax \expandafter\let\csname JT3/mc/m/n/10\endcsname\relax - \DeclareFontShape{JY3}{mc}{m}{n}{<->\ltj@stdmcfont:jfm=jlreq;script=latn;-kern}{} - \DeclareFontShape{JY3}{gt}{m}{n}{<->\ltj@stdgtfont:jfm=jlreq;script=latn;-kern}{} - \DeclareFontShape{JT3}{mc}{m}{n}{<->\ltj@stdmcfont:jfm=jlreqv;script=latn;-kern}{} - \DeclareFontShape{JT3}{gt}{m}{n}{<->\ltj@stdgtfont:jfm=jlreqv;script=latn;-kern}{} + \DeclareFontShape{JY3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont:jfm=jlreq;script=latn;-kern}{} + \DeclareFontShape{JY3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont:jfm=jlreq;script=latn;-kern}{} + \DeclareFontShape{JT3}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdmcfont:jfm=jlreqv;script=latn;-kern}{} + \DeclareFontShape{JT3}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\ltj@stdgtfont:jfm=jlreqv;script=latn;-kern}{} \else \expandafter\let\csname \jlreq@yokokanjiencoding/mc/m/n/10\endcsname\relax \expandafter\let\csname \jlreq@tatekanjiencoding/mc/m/n/10\endcsname\relax - \DeclareFontShape{\jlreq@yokokanjiencoding}{mc}{m}{n}{<-> \jlreq@jfmname}{} - \DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{m}{n}{<-> \jlreq@jfmnameg}{} - \DeclareFontShape{\jlreq@tatekanjiencoding}{mc}{m}{n}{<-> \jlreq@jfmname-v}{} - \DeclareFontShape{\jlreq@tatekanjiencoding}{gt}{m}{n}{<-> \jlreq@jfmnameg-v}{} + \DeclareFontShape{\jlreq@yokokanjiencoding}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmname}{} + \DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmnameg}{} + \DeclareFontShape{\jlreq@tatekanjiencoding}{mc}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmname-v}{} + \DeclareFontShape{\jlreq@tatekanjiencoding}{gt}{m}{n}{<->s*[\jlreq@jafontscale]\jlreq@jfmnameg-v}{} \fi \DeclareFontShape{\jlreq@yokokanjiencoding}{mc}{bx}{n}{<->ssub*gt/m/n}{} \DeclareFontShape{\jlreq@yokokanjiencoding}{gt}{bx}{n}{<->ssub*gt/m/n}{} @@ -1207,38 +1272,34 @@ % いったん文字サイズを変更((u)platexの際にzh/zwをきちんとするため) \@setfontsize\normalsize{\jlreq@fontsize}{\jlreq@fontsize}% \newdimen\jlreq@baselineskip -\ifx\jlreq@option@baselineskip\@empty - \setlength{\jlreq@baselineskip}{\dimexpr 17\jlreq@fontsize/10\relax}% +\ifx l\jlreq@engine + \setlength{\jlreq@baselineskip}{% + \dimexpr\directlua{ + local act = string.char(92) + local s = [[\jlreq@option@baselineskip]] + s = s:gsub("Q",act .. "dimexpr 0.25mm" .. act .. "relax"):gsub("zh",act .. "zh"):gsub("zw",act .. "zw") + tex.print(s) + }\relax + }% \else - \ifx l\jlreq@engine - \setlength{\jlreq@baselineskip}{% - \dimexpr\directlua{ - local act = string.char(92) - local s = [[\jlreq@option@baselineskip]] - s = s:gsub("Q",act .. "dimexpr 0.25mm" .. act .. "relax"):gsub("zh",act .. "zh"):gsub("zw",act .. "zw") - tex.print(s) - }\relax - }% - \else - \setlength{\jlreq@baselineskip}{\jlreq@option@baselineskip} - \fi + \setlength{\jlreq@baselineskip}{\dimexpr\jlreq@option@baselineskip\relax} \fi \ifdim\jlreq@fontsize>\jlreq@baselineskip \ClassError{jlreq}{The baselineskip is less than fontsize}{\@ehc}% \fi -\ifthenelse{\lengthtest{\jlreq@baselineskip<1.5\jlreq@fontsize} \OR \lengthtest{\jlreq@baselineskip>2\jlreq@fontsize}}{ - \jlreq@warning{行間は二分以上全角以下が望ましい (2.4.2.d 注3)} +\ifthenelse{\lengthtest{\jlreq@baselineskip<1.5\zw} \OR \lengthtest{\jlreq@baselineskip>2\zw}}{ + \jlreq@note{行間は二分以上全角以下が望ましい (2.4.2.d 注3).} }{} \emergencystretch 3\jlreq@gol %.. 文字サイズ変更 % 文字サイズを基準としているような寸法に対しては, -% \@setfontsizeが実行されるたびに追随して値を変える +% \set@fontsizeが実行されるたびに追随して値を変える % その処理は\jlreq@setfontsizehookに入れる -\jlreq@saveoriginalcs{@setfontsize} -\renewcommand*{\@setfontsize}[3]{% - \jlreq@original@@setfontsize{#1}{#2}{#3}% +\jlreq@saveoriginalcs{set@fontsize} +\renewcommand*{\set@fontsize}[3]{% + \jlreq@original@set@fontsize{#1}{#2}{#3}% \jlreq@setfontsizehook } \def\jlreq@setfontsizehook{} @@ -1251,6 +1312,20 @@ \fi } \fi +\jlreq@divide{\jlreq@fontsize}{\jlreq@jafontsize} +\edef\jlreq@jafontinvscale{\strip@pt\jlreq@resultdimen} +\newcommand*{\jafontsize}[2]{% + \begingroup + \jlreq@iffloat{#1}{% + \jlreq@tempdima=\jlreq@jafontinvscale\dimexpr #1pt\relax + \edef\jlreq@do{\noexpand\fontsize{\strip@pt\jlreq@tempdima}{\unexpanded{#2}}}% + }{% + \jlreq@tempdima=\jlreq@jafontinvscale\dimexpr#1\relax + \edef\jlreq@do{\noexpand\fontsize{\expandonce{\the\jlreq@tempdima}}{\unexpanded{#2}}}% + }% + \expandafter\endgroup + \jlreq@do +} \renewcommand{\normalsize}{% \@setfontsize\normalsize{\jlreq@fontsize}{\jlreq@baselineskip}% @@ -1271,26 +1346,19 @@ % 4.1.3.a % 2.5.2 \baselineskipは一定の方がよい? +% \@listiは再定義しないようにした.(\normalsizeと共用でJLReq通りだと思う.) \newcommand{\footnotesize}{% \@setfontsize\footnotesize{.8\jlreq@fontsize}{\dimexpr 115\jlreq@baselineskip/170\relax}% 脚注文字サイズの二分より少し小さい値を行間に: 4.2.5.e - \abovedisplayskip .6\jlreq@gol \@plus.2\jlreq@gol \@minus.4\jlreq@gol - \abovedisplayshortskip \z@ \@plus.1\jlreq@gol - \belowdisplayshortskip .3\jlreq@gol \@plus.1\jlreq@gol \@minus.2\jlreq@gol - \def\@listi{\leftmargin\leftmargini - \topsep .3\jlreq@gol \@plus.1\jlreq@gol \@minus.1\jlreq@gol - \parsep .2\jlreq@gol \@plus.1\jlreq@gol \@minus.1\jlreq@gol - \itemsep \parsep}% + \abovedisplayskip .6\jlreq@fontsize \@plus.2\jlreq@fontsize \@minus.4\jlreq@fontsize + \abovedisplayshortskip \z@ \@plus.1\jlreq@fontsize + \belowdisplayshortskip .3\jlreq@fontsize \@plus.1\jlreq@fontsize \@minus.2\jlreq@fontsize \belowdisplayskip \abovedisplayskip} % tsize10.cloの引数を,そのまま\jlreq@fontsize/\jlreq@baselineskipでスケーリングしているだけ. \newcommand{\small}{% \@setfontsize\small{.9\jlreq@fontsize}{\dimexpr 11\jlreq@baselineskip/17\relax}% - \abovedisplayskip .85\jlreq@gol \@plus.3\jlreq@gol \@minus.4\jlreq@gol - \abovedisplayshortskip \z@ \@plus.2\jlreq@gol - \belowdisplayshortskip .4\jlreq@gol \@plus.2\jlreq@gol \@minus.2\jlreq@gol - \def\@listi{\leftmargin\leftmargini - \topsep .4\jlreq@gol \@plus.2\jlreq@gol \@minus.2\jlreq@gol - \parsep .2\jlreq@gol \@plus.1\jlreq@gol \@minus.1\jlreq@gol - \itemsep \parsep}% + \abovedisplayskip .85\jlreq@fontsize \@plus.3\jlreq@fontsize \@minus.4\jlreq@fontsize + \abovedisplayshortskip \z@ \@plus.2\jlreq@fontsize + \belowdisplayshortskip .4\jlreq@fontsize \@plus.2\jlreq@fontsize \@minus.2\jlreq@fontsize \belowdisplayskip \abovedisplayskip} \newcommand{\scriptsize}{\@setfontsize\scriptsize{\dimexpr 7\jlreq@fontsize/10\relax}{\dimexpr 8\jlreq@baselineskip/17\relax}} \newcommand{\tiny}{\@setfontsize\tiny{\dimexpr 5\jlreq@fontsize/10\relax}{\dimexpr 6\jlreq@baselineskip/17\relax}} @@ -1380,7 +1448,7 @@ %.. \textwidth:文字送り方向の行長 % 二段の場合は最初の段の頭から次の段の後まで % 一度\textwidthに一行の長さの文字数を入れる(段組の場合でも) -\@tempdima=1\jlreq@fontsize +\@tempdima=1\zw \ifx\jlreq@option@line@length\@empty \if@tate \setlength{\textwidth}{0.75\paperheight} @@ -1396,11 +1464,11 @@ \divide\textwidth\@tempdima \if@tate \ifnum\number\textwidth>52 - \jlreq@warning{一行の長さは52文字以下が望ましい (2.4.2.c 注2)} + \jlreq@note{一行の長さは52文字以下が望ましい (2.4.2.c 注2).} \fi \else \ifnum\number\textwidth>40 - \jlreq@warning{一行の長さは40文字以下が望ましい (2.4.2.c 注2)} + \jlreq@note{一行の長さは40文字以下が望ましい (2.4.2.c 注2).} \fi \fi \fi @@ -1432,7 +1500,7 @@ \else\def\jlreq@option@headfoot@verticalpos{2zh}\fi \fi \setlength{\headsep}{\jlreq@speciallength{\jlreq@option@headfoot@verticalpos}} -\ifdim\headsep<1\zw\jlreq@warning{基本版面との上下方向の最低の空き量を,基本版面の文字サイズの全角アキとする (26.1.a)}\fi +\ifdim\headsep<1\zw\relax\jlreq@note{基本版面との上下方向の最低の空き量を,基本版面の文字サイズの全角アキとする (26.1.a).}\fi \setlength{\headheight}{1\zw} %.. 横 \ifx\jlreq@option@gutter\@empty @@ -1464,7 +1532,7 @@ \def\jlreq@settopmarginbyhead#1{ \if@tate \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in\relax} - \jlreq@warning{縦組の場合は地の空き量を指定する (2.4.1.b)} + \jlreq@note{縦組の場合は地の空き量を指定する (2.4.1.b).} \else \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in - \topskip + \Cht\relax} \fi @@ -1475,7 +1543,7 @@ \if@tate \setlength{\topmargin}{\dimexpr\paperheight - \textwidth - \headsep - \headheight - 1in - #1\relax} \else - \jlreq@warning{横組の場合は天の空き量を指定する (2.4.1.b)} + \jlreq@note{横組の場合は天の空き量を指定する (2.4.1.b).} \setlength{\topmargin}{\dimexpr\paperheight - \textheight + \topskip - 1\zh - \headsep - \headheight - 1in - #1\relax} \fi } @@ -1508,7 +1576,7 @@ %.. 下 \setlength{\footskip}{\dimexpr\headsep + 1\zw\relax} % \maxdepth + \topskip = フォントサイズ×1.5(だってさ) -\setlength{\maxdepth}{\dimexpr1.5\jlreq@fontsize - \topskip\relax} +\setlength{\maxdepth}{\dimexpr1.5\zw - \topskip\relax} %. 見出し関係 (4.1) % 見出しの直前に実行される @@ -1538,7 +1606,7 @@ \edef\jlreq@label@format{\expandonce{\csname the#1\endcsname}}% \def\jlreq@heading@clearpage{\cleardoublepage}% \def\jlreq@pagestyle{empty}% - \jlreq@parsekeyval[DeclareTobiraHeading]{ + \jlreq@parsekeyval[DeclareTobiraHeading:#1]{ {label_format}{\def\jlreq@label@format{##1}} {format}{\def\jlreq@format####1####2{##1}} {pagestyle}{\def\jlreq@pagestyle{##1}} @@ -1815,7 +1883,7 @@ \@tempa##1,\jlreq@endmark \jlreq@do }% - \jlreq@parsekeyval[BlockHeading]{ + \jlreq@parsekeyval[BlockHeading:#1]{ {lines}{\def\jlreq@lines{##1}} {before_space}{\def\jlreq@before@space{##1}} {after_space}{\def\jlreq@after@space{##1}} @@ -1977,7 +2045,7 @@ \def\jlreq@mark{}% \def\jlreq@label@font{}% \def\jlreq@after@space{1\jlreq@mol}% - \jlreq@parsekeyval[RuninHeading]{% + \jlreq@parsekeyval[RuninHeading:#1]{% {font}{\def\jlreq@font{##1}} {indent}{\def\jlreq@indent{##1}} {mark}{\def\jlreq@mark{##1}} @@ -2079,11 +2147,11 @@ \expandafter\def\csname jlreq@heading@type@#1\endcsname{\RenewCutinHeading}% \begingroup \def\jlreq@fontcommand{\sffamily\bfseries}% - \def\jlreq@onelinemax{6\jlreq@fontsize}% - \def\jlreq@twolinemax{20\jlreq@fontsize}% + \def\jlreq@onelinemax{6\zw}% + \def\jlreq@twolinemax{20\zw}% \def\jlreq@indent{0\jlreq@mol}% \def\jlreq@after@space{1\jlreq@mol}% - \jlreq@parsekeyval[CutinHeading]{ + \jlreq@parsekeyval[CutinHeading:#1]{ {font}{\def\jlreq@fontcommand{##1}} {onelinemax}{\def\jlreq@onelinemax{##1}} {twolinemax}{\def\jlreq@twolinemax{##1}} @@ -2091,7 +2159,7 @@ {after_space}{\def\jlreq@after@space{##1}} }{#3}% \ifthenelse{\lengthtest{\jlreq@after@space < 0.99\jlreq@mol} \OR \lengthtest{\jlreq@after@space > 2.01\jlreq@mol}}{% - \jlreq@warning{窓見出しと本文との空き量は,基本版面の文字サイズの全角以上,2倍未満とする (4.1.10.c)}%& + \jlreq@note{窓見出しと本文との空き量は,基本版面の文字サイズの全角以上,2倍未満とする (4.1.10.c).}%& }{}% \edef\jlreq@do{% \noexpand\def\expandonce{\csname #1\endcsname}{% @@ -2298,83 +2366,80 @@ % 合印:4.2.3 % 文字サイズは6ポイントくらい(4.2.3.a)とりあえす\scriptsize -% \footnoteとか\footnotemarkの前に#2後に#3を入れる -\newcommand*{\jlreq@modify@noteandmark}[4]{% - \edef\@tempa{\expandafter\@gobble\string#1}% - \jlreq@saveoriginalcs{\@tempa}% - \edef#1{% - \unexpanded{#3}% - \noexpand\@ifnextchar[{\expandonce{\csname jlreq@fixjfm@\@tempa @\endcsname}}{\expandonce{\csname jlreq@fixjfm@\@tempa @@\endcsname}}% - } - \long\expandafter\edef\csname jlreq@fixjfm@\@tempa @\endcsname[##1]##2{% - \expandonce{\csname jlreq@original@\@tempa\endcsname}[##1]{##2}% - \unexpanded{#4}% - } - \long\expandafter\edef\csname jlreq@fixjfm@\@tempa @@\endcsname##1{% - \expandonce{\csname jlreq@original@\@tempa\endcsname}{##1}% - \unexpanded{#4}% - } - \edef\@tempa{\expandafter\@gobble\string#2}% - \jlreq@saveoriginalcs{\@tempa}% - \edef#2{% - \unexpanded{#3}% - \noexpand\@ifnextchar[{\expandonce{\csname jlreq@fixjfm@\@tempa @\endcsname}}{\expandonce{\csname jlreq@fixjfm@\@tempa @@\endcsname}}% - } - \expandafter\edef\csname jlreq@fixjfm@\@tempa @\endcsname[##1]{% - \expandonce{\csname jlreq@original@\@tempa\endcsname}[##1]% - \unexpanded{#4}% - } - \expandafter\edef\csname jlreq@fixjfm@\@tempa @@\endcsname{% - \expandonce{\csname jlreq@original@\@tempa\endcsname}% - \unexpanded{#4}% - } +% \footnoteと\footnotemarkの前後に\jlreq@hook@prenote/\jlreq@hook@postnoteを入れる +\jlreq@saveoriginalcs{footnote}% +\def\footnote{% + \jlreq@hook@prenote + \@ifnextchar[{\jlreq@fixjfm@footnote@}{\jlreq@fixjfm@footnote@@}% +} +\long\def\jlreq@fixjfm@footnote@[#1]#2{% + \jlreq@original@footnote[#1]{#2}% + \jlreq@hook@postnote +} +\long\def\jlreq@fixjfm@footnote@@#1{% + \jlreq@original@footnote{#1}% + \jlreq@hook@postnote +} +\jlreq@saveoriginalcs{footnotemark}% +\def\footnotemark{% + \jlreq@hook@prenote + \@ifnextchar[{\jlreq@fixjfm@footnotemark@}{\jlreq@fixjfm@footnotemark@@}% +} +\def\jlreq@fixjfm@footnotemark@[#1]{% + \jlreq@original@footnotemark[#1]% + \jlreq@hook@postnote +} +\def\jlreq@fixjfm@footnotemark@@{% + \jlreq@original@footnotemark + \jlreq@hook@postnote } \newcommand*\jlreq@referencemark@format[1]{#1} -\ifthenelse{\equal{\jlreq@referencemark}{inline}}{ - \newcommand*{\jlreq@notemark}[1]{% - \jlreq@ifydir{% - \hbox{}\hbox{\@textsuperscript{\normalfont\jlreq@referencemark@format{#1}}}\hbox{}% - }{% - \setbox\@tempboxa=\hbox{\scriptsize\jlreq@referencemark@format{#1}}% - \raise\dimexpr.5\jlreq@gol - (\ht\@tempboxa + \dp\@tempboxa)/2\relax\box\@tempboxa - }% - } - \newcommand*{\jlreq@modify@noteandmark@fixjfm}[2]{% - \jlreq@modify@noteandmark{#1}{#2}{\inhibitglue}{\inhibitglue} - } -}{ - \newcommand*{\jlreq@notemark}[1]{{% - \setbox\@tempboxa=\hbox{\scriptsize\jlreq@referencemark@format{#1}}% - % 行頭に来たときに頭を天にそろえる処理. - \jlreq@savepos@for@rest@linewidth - \ifdim\jlreq@current@linewidth<\wd\@tempboxa - \@tempdima=\jlreq@current@linewidth - \else +\newif\ifjlreqadjustreferencemark +\jlreqadjustreferencemarktrue +\jlreq@jlreqsetup@add{reference_mark}[inline,interlinear]{ + \def\jlreq@referencemark{#1} + \ifthenelse{\equal{\jlreq@referencemark}{inline}}{ + \def\jlreq@notemark##1{% + \jlreq@ifydir{% + \hbox{}\hbox{\@textsuperscript{\normalfont\jlreq@referencemark@format{##1}}}\hbox{}% + }{% + \setbox\@tempboxa=\hbox{\scriptsize\jlreq@referencemark@format{##1}}% + \raise\dimexpr.5\jlreq@gol - \ht\@tempboxa\relax\box\@tempboxa + }% + } + \def\jlreq@hook@prenote{\inhibitglue} + \def\jlreq@hook@postnote{\inhibitglue} + }{% reference_mark=interlinear + \def\jlreq@notemark##1{{% + \setbox\@tempboxa=\hbox{\scriptsize\jlreq@referencemark@format{##1}}% \@tempdima=\wd\@tempboxa - \fi - \setbox\jlreq@tempboxa=\hbox to\z@{\hskip-\@tempdima\raise\dimexpr.5\zw + (\ht\@tempboxa + \dp\@tempboxa)/2\relax\box\@tempboxa\hss}% - \dp\jlreq@tempboxa=0pt\ht\jlreq@tempboxa=0pt\box\jlreq@tempboxa}}% - \ifx l\jlreq@engine - % luatexの時は\inhibitglueすると\lastnodechar=-1になる - \newcommand*{\jlreq@modify@noteandmark@fixjfm}[2]{% - \jlreq@modify@noteandmark{#1}{#2}{% + % 行頭に来たときに頭を天にそろえる処理. + \ifjlreqadjustreferencemark + \jlreq@savepos@for@rest@linewidth + \ifdim\jlreq@current@linewidth<\wd\@tempboxa + \@tempdima=\jlreq@current@linewidth + \fi + \fi + \setbox\jlreq@tempboxa=\hbox to\z@{\hskip-\@tempdima\raise\dimexpr.5\zw + (\ht\@tempboxa + \dp\@tempboxa)/2\relax\box\@tempboxa\hss}% + \dp\jlreq@tempboxa=0pt\ht\jlreq@tempboxa=0pt\box\jlreq@tempboxa}% + }% + \ifx l\jlreq@engine + \def\jlreq@hook@prenote{% \jlreq@lastnodechar=\lastnodechar \ifnum\lastnodechar>-1\inhibitglue\fi - }{\jlreq@fixjfm} - } - \else - % (u)platexの時は代入すると\inhibitglueが効かなくなる - \newcommand*{\jlreq@modify@noteandmark@fixjfm}[2]{% - \jlreq@modify@noteandmark{#1}{#2}{% + } + \else + % (u)platexの時は代入すると\inhibitglueが効かなくなる + \def\jlreq@hook@prenote{% \ifnum\lastnodechar>-1\inhibitglue\fi \jlreq@lastnodechar=\lastnodechar - }{\jlreq@fixjfm} - } - \fi + } + \fi + \def\jlreq@hook@postnote{\jlreq@fixjfm} + } } -\jlreq@aftercls@addtodeletecs{\jlreq@modify@noteandmark@fixjfm} -\jlreq@modify@noteandmark@fixjfm{\footnote}{\footnotemark} +\jlreqsetup{reference_mark=inline} % \@footnotemarkをシンプルなものにする \def\jlreq@setdefaultnotemark#1#2{% \def#1{% @@ -2384,7 +2449,6 @@ \ifhmode\spacefactor\@x@sf\fi \relax} } -\def\@tempa{@footnotemark} \jlreq@setdefaultnotemark\@footnotemark\@makefnmark %.. 脚注 (縦書きの時は傍注,4.2.5) {% @@ -2415,15 +2479,19 @@ \global\jlreq@footnoteindent=\dimexpr\textwidth - \@tempdima\relax } % 4.2.5.d -\ifthenelse{\equal{\jlreq@footnotetext@indent}{one}}{ - \newcommand\@makefntext[1]{\parindent 1\jlreq@mol - \addtolength{\leftskip}{\dimexpr\jlreq@footnoteindent + 1\jlreq@mol\relax}% 全体をインデント+1文字分下げる - \noindent\hskip -1\jlreq@mol\jlreq@referencemark@format{\@thefnmark}\hskip 1\jlreq@mol#1}% 見出し出力と一文字分の空き -}{ - \newcommand\@makefntext[1]{\parindent 1\jlreq@mol - \addtolength{\leftskip}{\jlreq@footnoteindent}% 全体をインデント - \noindent\hskip 1\jlreq@mol\jlreq@referencemark@format{\@thefnmark}\hskip 1\jlreq@mol#1}% 見出し出力と一文字分の空き +\newcommand{\@makefntext}[1]{\jlreq@makefntext{#1}} +\jlreq@jlreqsetup@add{footnotetext_indent}{ + \ifthenelse{\equal{#1}{one}}{ + \long\def\jlreq@makefntext##1{\parindent 1\jlreq@mol + \addtolength{\leftskip}{\dimexpr\jlreq@footnoteindent + 1\jlreq@mol\relax}% 全体をインデント+1文字分下げる + \noindent\hskip -1\jlreq@mol\jlreq@referencemark@format{\@thefnmark}\hskip 1\jlreq@mol##1}% 見出し出力と一文字分の空き + }{ + \long\def\jlreq@makefntext##1{\parindent 1\jlreq@mol + \addtolength{\leftskip}{\jlreq@footnoteindent}% 全体をインデント + \noindent\hskip 1\jlreq@mol\jlreq@referencemark@format{\@thefnmark}\hskip 1\jlreq@mol##1}% 見出し出力と一文字分の空き + } } +\jlreqsetup{footnotetext_indent=one} % 合印 \renewcommand*{\@makefnmark}{% \jlreq@ifydir{\jlreq@notemark{\@thefnmark}}{\hbox{\jlreq@notemark{\@thefnmark}}}% @@ -2432,7 +2500,7 @@ \if@tate \renewcommand*{\thefootnote}{\jlreq@open@bracket@before@space\inhibitglue(\rensuji{\@arabic\c@footnote})\inhibitglue} \else - \renewcommand*{\thefootnote}{\arabic{footnote})\inhibitglue} + \renewcommand*{\thefootnote}{\arabic{footnote}\hbox{})\inhibitglue} \fi %.. 後注(4.2.4) @@ -2447,10 +2515,10 @@ \def\jlreq@endnote@texts{} \long\def\jlreq@endnote@addtext#1#2{% \expandafter\gdef\expandafter\jlreq@endnote@texts\expandafter{\jlreq@endnote@texts{{#1}{#2}}}} -\def\endnote{\@ifnextchar[{\jlreq@endnote}{\jlreq@endnote[]}} -\def\endnotemark{\@ifnextchar[{\jlreq@endnotemark}{\jlreq@endnotemark[]}} +\def\endnote{\jlreq@hook@prenote\@ifnextchar[{\jlreq@endnote}{\jlreq@endnote[]}} +\def\endnotemark{\jlreq@hook@prenote\@ifnextchar[{\jlreq@endnotemark}{\jlreq@endnotemark[]}} \def\endnotetext{\@ifnextchar[{\jlreq@endnotetext}{\jlreq@endnotetext[]}} -\long\def\jlreq@endnote[#1]#2{\jlreq@endnotemark[#1]\@endnotetext{#2}} +\long\def\jlreq@endnote[#1]#2{\jlreq@endnotemark[#1]\@endnotetext{#2}\jlreq@hook@postnote} \def\jlreq@endnotemark[#1]{% \jlreq@ifempty{#1}{% \stepcounter{\jlreq@endnotecounter}% @@ -2462,6 +2530,7 @@ \endgroup }% \@endnotemark + \jlreq@hook@postnote } \jlreq@setdefaultnotemark\@endnotemark\@makeendmark \long\def\jlreq@endnotetext[#1]#2{% @@ -2517,7 +2586,6 @@ \par \fi } -\jlreq@modify@noteandmark@fixjfm{\endnote}{\endnotemark} \jlreq@endnote@indent=2\jlreq@mol % 二行目以降を全角分下げる \newcommand{\@makeendtext}[1]{\parindent 1\jlreq@mol @@ -2525,56 +2593,67 @@ \def\@makeendmark{\@makefnmark} % \theendnoteの出力を仕込む -\jlreq@tempafalse -% \jlreq@tempcにセクション名たちを入れていく -\def\jlreq@tempc{} -\@for\jlreq@tempa:=\jlreq@endnote@position\do{ - \jlreq@switch{\jlreq@tempa}{ - {headings}{\jlreq@tempatrue} - {paragraph}{ - \jlreq@tempatrue% _paragraphの時は_headingsも有効にする - \PushPostHook{par}{% - \ifx\jlreq@endnote@texts\@empty\else - \vskip\dimexpr-\baselineskip\relax - \vskip\dimexpr0pt\relax - \theendnotes +\PushPostHook{par}{\jlreq@endnote@parhook} +\edef\jlreq@do{ + \unexpanded{\def\jlreq@hook@beforeheadings#1}{\expandonce{\jlreq@hook@beforeheadings{#1}}\unexpanded{\jlreq@endnote@hook@beforeheadings{#1}}} +} +\jlreq@do + +\jlreq@jlreqsetup@add{endnote_position}{ + \def\jlreq@endnote@parhook{} + \def\jlreq@endnote@hook@beforeheadings##1{} + \jlreq@tempafalse % headingsが指定された + % \jlreq@tempcにセクション名たちを入れていく + \def\jlreq@tempc{} + \@for\jlreq@tempa:=#1\do{ + \jlreq@switch{\jlreq@tempa}{ + {headings}{\jlreq@tempatrue} + {paragraph}{ + \jlreq@tempatrue% _paragraphの時は_headingsも有効にする + \def\jlreq@endnote@parhook{% + \ifx\jlreq@endnote@texts\@empty\else + \vskip\dimexpr-\baselineskip\relax + \vskip\dimexpr0pt\relax + \theendnotes + \fi + } + } + { + \def\@tempa##1##2\jlreq@endmark{##1} + \edef\@tempa{\expandafter\@tempa\jlreq@tempa\jlreq@endmark} + \expandafter\ifx\@tempa _ + \def\@tempa##1##2\jlreq@endmark{\def\jlreq@result{##2}} + \expandafter\@tempa\jlreq@tempa\jlreq@endmark + \edef\jlreq@tempc{\jlreq@tempc,\jlreq@result} + \else + \ClassError{jlreq}{Invalid value \jlreq@tempa\space in endnote_position}{\@ehc} \fi } } - { - \def\@tempa#1#2\jlreq@endmark{#1} - \edef\@tempa{\expandafter\@tempa\jlreq@tempa\jlreq@endmark} - \expandafter\ifx\@tempa _ - \def\@tempa#1#2\jlreq@endmark{\def\jlreq@result{#2}} - \expandafter\@tempa\jlreq@tempa\jlreq@endmark - \edef\jlreq@tempc{\jlreq@tempc,\jlreq@result} - \else - \ClassError{jlreq}{Invalid value \jlreq@tempa\space in endnote_position}{\@ehc} - \fi - } } -} -\ifjlreq@tempa - \edef\jlreq@do{% - \unexpanded{\def\jlreq@hook@beforeheadings#1}{\expandonce{\jlreq@hook@beforeheadings{#1}}% - \noexpand\theendnotes + \ifjlreq@tempa + \edef\jlreq@do{% + \unexpanded{\def\jlreq@endnote@hook@beforeheadings##1}{\expandonce{\jlreq@endnote@hook@beforeheadings{##1}}% + \noexpand\theendnotes + } } - } - \jlreq@do -\else - \@for\@tempa:=\jlreq@tempc\do{ - \ifx\@tempa\@empty\else - \edef\jlreq@do{% - \unexpanded{\def\jlreq@hook@beforeheadings#1}{\expandonce{\jlreq@hook@beforeheadings{#1}}% - \unexpanded{\def\@tempa}{\@tempa}\unexpanded{\def\@tempb{#1}}% - \unexpanded{\ifx\@tempa\@tempb\theendnotes\fi}% + \jlreq@do + \else + \@for\@tempa:=\jlreq@tempc\do{ + \ifx\@tempa\@empty\else + \edef\jlreq@do{% + \unexpanded{\def\jlreq@endnote@hook@beforeheadings##1}{\expandonce{\jlreq@endnote@hook@beforeheadings{##1}}% + \unexpanded{\def\@tempa}{\@tempa}\unexpanded{\def\@tempb{##1}}% + \unexpanded{\ifx\@tempa\@tempb\theendnotes\fi}% + } } - } - \jlreq@do - \fi - } -\fi + \jlreq@do + \fi + } + \fi +} +\jlreqsetup{endnote_position=headings} \AtEndDocument{\theendnotes} %.. 傍注(4.2.7) @@ -2598,7 +2677,7 @@ \fi \fi \ifx\jlreq@option@sidenote@width\@empty - \setlength{\marginparwidth}{\dimexpr\jlreq@tempdima - 2\jlreq@fontsize - \marginparsep\relax} + \setlength{\marginparwidth}{\dimexpr\jlreq@tempdima - 2\zw - \marginparsep\relax} % 4.7.2.b: 並列中の行長は15文から20字程度 \ifdim\marginparwidth>20\jlreq@mol \global\marginparwidth=20\jlreq@mol @@ -2615,6 +2694,10 @@ \global\setlength{\marginparpush}{.5\@tempdima} % 同上:g } +\ifdim\marginparwidth>25\zw\relax + \jlreq@note{並列注の字詰め方向の長さ(行長)は,15字から20字くらいである.ケースによっては25字程度にする場合もある (4.2.7).} +\fi + \def\jlreq@sidenotemarkname{@thefnmark}% 合印用番号を一時的に入れるマクロ名 % (1) \footnoteとかと同じ形式 sidenote_type=number @@ -2632,104 +2715,88 @@ }% } \jlreq@setdefaultnotemark\@sidenotemark\@makesidemark -\ifthenelse{\equal{\jlreq@sidenote@type}{number}}{ - \def\jlreq@sidenotecounter{footnote}% 傍注用のカウンタ名 - \def\sidenote{\@ifnextchar[{\jlreq@sidenote}{\jlreq@sidenote[]}} - \def\sidenotemark{\@ifnextchar[{\jlreq@sidenotemark}{\jlreq@sidenotemark[]}} - \def\sidenotetext{\@ifnextchar[{\jlreq@sidenotetext}{\jlreq@sidenotetext[]}} - \long\def\jlreq@sidenote[#1]#2{\jlreq@sidenotemark[#1]\@sidenotetext{#2}} - \def\jlreq@sidenotemark[#1]{% - \jlreq@ifempty{#1}{% - \stepcounter{\jlreq@sidenotecounter}% - \expandafter\protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% - }{% - \begingroup - \csname c@\jlreq@sidenotecounter\endcsname #1\relax - \expandafter\unrestored@protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% - \endgroup - }% - \@sidenotemark - } - \long\def\jlreq@sidenotetext[#1]#2{% - \jlreq@ifempty{#1}{% - \expandafter\protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% - }{% - \begingroup - \csname c@\jlreq@sidenotecounter\endcsname#1\relax - \expandafter\unrestored@protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% - \endgroup - }% - \@sidenotetext{#2}% - } - \def\@sidenotemark{\@makesidemark} - \ifx l\jlreq@engine - \long\def\@makesidetext#1{\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} - \else - % thefootnote = \inhibitglue (...だと\inhibitglueが効かない - \long\def\@makesidetext#1{ \kern-1\jlreq@mol\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} - \fi - \def\@makesidemark{\@makefnmark} - \jlreq@modify@noteandmark@fixjfm{\sidenote}{\sidenotemark} -}{% sidenote_type = symbol - \jlreq@jlreqsetup@add{sidenote_symbol}{\def\jlreq@sidenote@defaultmark{#1}} - \jlreq@jlreqsetup@add{sidenote_keyword_font}{\def\jlreq@sidenote@keywordfont{#1}} - \jlreqsetup{ - sidenote_symbol=*,sidenote_keyword_font={}, - } - \def\sidenote{\jlreq@sidenote} - \def\sidenotemark{\jlreq@sidenotemark} - \def\sidenotetext{\jlreq@sidenotetext} - \long\def\jlreq@sidenote#1#2{\jlreq@sidenotemark{#1}\jlreq@sidenotetext{#1}{#2}} - \ifthenelse{\equal{\jlreq@referencemark}{inline}}{% - \def\@tempa{\inhibitglue} - }{ +\def\jlreq@sidenotecounter{footnote}% 傍注用のカウンタ名 +\jlreq@jlreqsetup@add{sidenote_type}[number,symbol]{\def\jlreq@sidenote@type{#1}} +\jlreqsetup{sidenote_type=number} +\jlreq@jlreqsetup@addtofinally{ + \ifthenelse{\equal{\jlreq@sidenote@type}{number}}{ + \def\sidenote{\jlreq@hook@prenote\@ifnextchar[{\jlreq@sidenote}{\jlreq@sidenote[]}} + \def\sidenotemark{\jlreq@hook@prenote\@ifnextchar[{\jlreq@sidenotemark}{\jlreq@sidenotemark[]}} + \def\sidenotetext{\@ifnextchar[{\jlreq@sidenotetext}{\jlreq@sidenotetext[]}} + \long\def\jlreq@sidenote[#1]#2{\jlreq@sidenotemark[#1]\@sidenotetext{#2}\jlreq@hook@postnote} + \def\jlreq@sidenotemark[#1]{% + \jlreq@ifempty{#1}{% + \stepcounter{\jlreq@sidenotecounter}% + \expandafter\protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% + }{% + \begingroup + \csname c@\jlreq@sidenotecounter\endcsname #1\relax + \expandafter\unrestored@protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% + \endgroup + }% + \@sidenotemark + \jlreq@hook@postnote + } + \long\def\jlreq@sidenotetext[#1]#2{% + \jlreq@ifempty{#1}{% + \expandafter\protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% + }{% + \begingroup + \csname c@\jlreq@sidenotecounter\endcsname#1\relax + \expandafter\unrestored@protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% + \endgroup + }% + \@sidenotetext{#2}% + } + % \hspace{0.5\jlreq@mol}の部分は二分空きにする例もある(4.2.7.g) \ifx l\jlreq@engine - \def\@tempa{% - \jlreq@lastnodechar=\lastnodechar - \ifnum\lastnodechar>-1\inhibitglue\fi - } + \long\def\@makesidetext#1{\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} \else - \def\@tempa{% - \ifnum\lastnodechar>-1\inhibitglue\fi - \jlreq@lastnodechar=\lastnodechar - } + % thefootnote = \inhibitglue (...だと\inhibitglueが効かないので空白を挟む + \long\def\@makesidetext#1{ \kern-1\zw\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} \fi - } - \edef\jlreq@sidenotemark#1{% - {\noexpand\reset@font\jlreq@sidenote@keywordfont #1}% - \expandonce{\@tempa}% - \unexpanded{% + \def\@makesidemark{\@makefnmark} + }{% sidenote_type = symbol + \def\sidenote{\jlreq@sidenote} + \def\sidenotemark{\jlreq@sidenotemark} + \def\sidenotetext{\jlreq@sidenotetext} + \long\def\jlreq@sidenote#1#2{\jlreq@sidenotemark{#1}\jlreq@sidenotetext{#1}{#2}} + \edef\jlreq@sidenotemark#1{% + {\unexpanded{\reset@font\jlreq@sidenote@keywordfont}#1}% + \noexpand\jlreq@hook@prenote \ifx\jlreq@sidenote@defaultmark\@empty\else - \expandafter\edef\csname\jlreq@sidenotemarkname\endcsname{\jlreq@sidenote@defaultmark}% - \@sidenotemark + \expandafter\edef\expandonce{\csname\jlreq@sidenotemarkname\endcsname}{\expandonce{\jlreq@sidenote@defaultmark}}% + \noexpand\@sidenotemark \fi - }% - } - \def\@sidenotemark{\@makesidemark} - % カスタマイズできるべき? - \long\def\jlreq@sidenotetext#1#2{% - \expandafter\def\csname\jlreq@sidenotemarkname\endcsname{\inhibitglue\null{\reset@font\sffamily\bfseries\inhibitglue #1}}% - \@sidenotetext{#2}% - } - \long\def\@makesidetext#1{{\sffamily\bfseries\csname\jlreq@sidenotemarkname\endcsname}\hspace*{1\jlreq@mol}#1} - \def\@makesidemark{\@makefnmark} - \ifthenelse{\equal{\jlreq@referencemark}{interlinear}}{\def\@tempa{\jlreq@fixjfm}}{\def\@tempa{\inhibitglue}} - \edef\jlreq@do{ - % \jlreq@lastnodecharの仕込みはすんでいる - \unexpanded{\long\def\sidenote#1#2}{% - \expandonce{\sidenote{#1}{#2}}% - \expandonce{\@tempa}% } - \unexpanded{\long\def\sidenotemark#1}{% - \expandonce{\sidenotemark{#1}}% - \expandonce{\@tempa}% + % カスタマイズできるべき? + \long\def\jlreq@sidenotetext#1#2{% + \expandafter\def\csname\jlreq@sidenotemarkname\endcsname{\inhibitglue\null{\reset@font\sffamily\bfseries\inhibitglue #1}}% + \@sidenotetext{#2}% + } + \long\def\@makesidetext#1{{\sffamily\bfseries\csname\jlreq@sidenotemarkname\endcsname}\hspace*{1\jlreq@mol}#1} + \def\@makesidemark{\@makefnmark} + + \edef\jlreq@do{ + % \jlreq@lastnodecharの仕込みはすんでいる + \unexpanded{\long\def\sidenote#1#2}{% + \expandonce{\sidenote{#1}{#2}}% + \noexpand\jlreq@hook@postnote + } + \unexpanded{\long\def\sidenotemark#1}{% + \expandonce{\sidenotemark{#1}}% + \noexpand\jlreq@hook@postnote + } } + \jlreq@do } - \jlreq@do } +\jlreq@jlreqsetup@add{sidenote_symbol}{\def\jlreq@sidenote@defaultmark{#1}} +\jlreq@jlreqsetup@add{sidenote_keyword_font}{\def\jlreq@sidenote@keywordfont{#1}} +\jlreqsetup{sidenote_symbol=*,sidenote_keyword_font={}} %.. 割注(3.4) -\def\inlinenotesize{.6\jlreq@fontsize} % 割注の文字サイズ +\def\inlinenotesize{.6\jlreq@jafontsize} % 割注の文字サイズ \let\jlreq@inlinenote@autolinebreak=\\% 計測時は\linebreakより\\の方が安定する.悩ましい……. \newcommand{\jlreq@inlinenote@kakkofontsize}{% @@ -2814,7 +2881,7 @@ \edef\jlreq@parshapearg{\jlreq@parshapearg 0pt \the\jlreq@tempdimb 0pt \the\jlreq@tempdimb}% }% \ifvoid\jlreq@resultbox - \ClassWarning{jlreq}{\string\inlinenote\space failed, maybe a bug}% + \ClassWarning{jlreq}{\string\warichu\space failed, maybe a bug}% \else \@tempcnta=0 \splittopskip=0pt\relax @@ -2831,6 +2898,7 @@ \ifnum\@tempcnta=0\jlreq@tempdima=\jlreq@tempdimb \else\jlreq@tempdima=\linewidth\fi \else + % 最終行は自然長に任せる \jlreq@tempdima=-1pt\relax \fi {% @@ -2838,25 +2906,18 @@ \vbadness=10000 \setbox\jlreq@tempboxa=\vsplit\@tempboxa to \dimexpr\jlreq@inlinenote@baselineskip*2\relax \vbadness=\@tempa\relax - % \jlreq@inlinenote@autolinebreak=\\の場合には,割注の長さを計測した物に長さに強制する \jlreq@getlastbox{\jlreq@tempboxa}% \setbox\jlreq@tempboxb=\box\jlreq@resultbox \jlreq@getlastbox{\jlreq@tempboxa}% \setbox\jlreq@tempboxa=\box\jlreq@resultbox - \ifx\jlreq@inlinenote@autolinebreak\\\relax - \ifdim\jlreq@tempdima>0pt\relax - \setbox\jlreq@tempboxa=\vbox{\jlreq@inlinenote@fontsize% - \hbox to \jlreq@tempdima{\unhbox\jlreq@tempboxa}% - \hbox to \jlreq@tempdima{\unhbox\jlreq@tempboxb}}% - \else - \setbox\jlreq@tempboxa=\vbox{\jlreq@inlinenote@fontsize% - \hbox{\unhbox\jlreq@tempboxa}% - \hbox{\unhbox\jlreq@tempboxb}}% - \fi - \else - \setbox\jlreq@tempboxa=\vbox{\jlreq@inlinenote@fontsize% + \ifdim\jlreq@tempdima>0pt\relax + \setbox\jlreq@tempboxa=\vbox{\jlreq@inlinenote@fontsize \hbox to \jlreq@tempdima{\unhbox\jlreq@tempboxa}% \hbox to \jlreq@tempdima{\unhbox\jlreq@tempboxb}}% + \else + \setbox\jlreq@tempboxa=\vbox{\jlreq@inlinenote@fontsize + \hbox{\unhbox\jlreq@tempboxa}% + \hbox{\unhbox\jlreq@tempboxb}}% \fi \jlreq@box@putcenter\jlreq@tempboxa }% @@ -2914,19 +2975,25 @@ }% } -% \jlreq@inlinenote@determinelength{テキスト(1)}{書式指定(2)}{\parshape指定(3)}{調整に使う行数(4)}{成功行数(5)}{最小長さ(6)}{最大長さ(7)} -% \jlreq@resultboxに整形結果を返す.見つからなかったらvoid +% \jlreq@inlinenote@determinelength{テキスト(1)}{フォントとか指定(2)}{\parshape指定(3)}{調整に使う行数(4)}{成功行数(5)}{最小長さ(6)}{最大長さ(7)} +% 次を満たす長さXの最小値を求める(ただし#6 <= X <= #7) +% #1を +% * #5 - #4行目までは#3の指定に従う +% * それ以降はX +% として整形した際に,#5行以内に収まる. +% \jlreq@resultboxに整形結果を返す(垂直ボックス).見つからなかったらvoid \newcommand{\jlreq@inlinenote@determinelength}[7]{% -% \message{#1 の試行開始,行数 = #5, \the#6 から \the#7まで}% +% \message{#1 の試行開始,行数 = #5, \the\dimexpr#6\relax から \the\dimexpr#7\relaxまで}% \@tempcnta=1\relax \def\@tempa{}% + % 調整に使う行の\parshape指定を\@tempaに入れる.長さは\jlreq@tempdima. \@whilenum\@tempcnta<#4\do{% \expandafter\def\expandafter\@tempa\expandafter{\@tempa 0pt \the\jlreq@tempdima}% \advance\@tempcnta by 1\relax }% \@tempcnta=0 \jlreq@tempdima=#6\relax - % 最後の行を少しずつ伸ばしていく + % \jlreq@tempdimaを少しずつ伸ばしていく \@whilenum\@tempcnta<1000\do{% \ifnum\@tempcnta>999\relax% ループが長すぎる \global\setbox\jlreq@resultbox=\voidb@x% @@ -2943,6 +3010,7 @@ \setbox\jlreq@tempboxa=\box\jlreq@resultbox \ifnum\@tempcntb<#5\relax% 行数が達していないならOK % \message{行数 = \the\@tempcntb により確定} + % #5行になるまで空の水平ボックスを加えていく. \global\setbox\jlreq@resultbox=\vbox{#2% \unvbox\@tempboxa\hbox{\unhbox\jlreq@tempboxa\unskip\unskip\unpenalty}% \@whilenum\@tempcntb<#5\do{\hbox{}\advance\@tempcntb by 1}}% @@ -2953,7 +3021,7 @@ \setbox\jlreq@tempboxb=\box\jlreq@resultbox % \message{最終行の長さ \the\wd\jlreq@tempboxa, その前の長さ \the\wd\jlreq@tempboxb}% \ifdim\wd\jlreq@tempboxa>\wd\jlreq@tempboxb - \advance\jlreq@tempdima by 0.3pt\relax + \advance\jlreq@tempdima by 0.3pt\relax% 0.3ptに意味はない \else % 後ろが短いのでOK \global\setbox\jlreq@resultbox=\vbox{#2\unvbox\@tempboxa\box\jlreq@tempboxb\box\jlreq@tempboxa}% @@ -2977,7 +3045,7 @@ % 柱:両柱と片柱(2.6.3) \@tempdima=\jlreq@speciallength{\jlreq@headfoot@sidemargin} \ifthenelse{\lengthtest{\@tempdima=0pt} \OR \(\lengthtest{0.99\zw < \@tempdima} \AND \lengthtest{\@tempdima < 1.01\zw}\)}{}{ - \jlreq@warning{ノンブルまたは柱は,基本版面の左右にそろえるか,全角アキだけ寄せた位置に配置する (2.6.1.b)} + \jlreq@note{ノンブルまたは柱は,基本版面の左右にそろえるか,全角アキだけ寄せた位置に配置する (2.6.1.b).} } % bottom-leftみたいなのを解釈する.入力の順番はどっちでも良いが,出力は<top/bottom><left/right>の順番 @@ -3040,10 +3108,10 @@ % 柱とノンブルの間 \def\jlreq@gap{1.5\zw}% \newif\ifjlreq@clearmark\jlreq@clearmarktrue - \newif\ifjlreq@tate\jlreq@tatefalse - \jlreq@parsekeyval[PageStyle]{ - *{tate}{\jlreq@tatetrue} - *{yoko}{\jlreq@tatefalse} + \newif\ifjlreq@pstate\jlreq@pstatefalse + \jlreq@parsekeyval[PageStyle:#1]{ + *{tate}{\jlreq@pstatetrue} + *{yoko}{\jlreq@pstatefalse} {nombre_position}{\def\jlreq@nombre@position{##1}} {running_head_position}{\def\jlreq@running@head@position{##1}} {nombre}{\def\jlreq@nombre{##1}} @@ -3110,15 +3178,15 @@ \expandafter\@tempb\jlreq@odd@running@head\jlreq@endmark\jlreq@endmark \ifx\jlreq@odd@running@head@level\@empty\else\ifx\jlreq@even@running@head@level\@empty\else \ifnum\jlreq@odd@running@head@level<\jlreq@even@running@head@level - \jlreq@warning{偶数ページには奇数ページよりアウトラインレベルの高い見出しを入れる (ページスタイル #1内,2.6.3.a)}% + \jlreq@note{偶数ページには奇数ページよりアウトラインレベルの高い見出しを入れる (ページスタイル #1内,2.6.3.a).}% \fi \fi\fi % \jlreq@[even/odd][head/foot]に入れていく.tateか否かで場合分け. - \ifjlreq@tate\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% + \ifjlreq@pstate\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{% \ifx\jlreq@nombre@position\@empty\def\jlreq@nombre@position{0pt}\fi \ifx\jlreq@running@head@position\@empty\def\jlreq@running@head@position{0pt}\fi \if@tate\else - \jlreq@warning{ノンブルおよび柱を縦組にして配置するのは縦組の場合のみである (ページスタイル #1 内,2.6.1)}% + \jlreq@note{ノンブルおよび柱を縦組にして配置するのは縦組の場合のみである (ページスタイル #1 内,2.6.1).}% \fi % 柱とノンブルを入れる箱を作る(\jlreq@resultを展開すると\setboxするマクロがでる) \def\jlreq@make@tatebox##1{% @@ -3201,11 +3269,11 @@ \) \)}{% \if@twoside - \jlreq@warning{柱やノンブルは,左ページでは,基本版面の左端の延長線にノンブル又は柱の先頭をそろえて配置するか,基本版面の左端の延長線から基本版面の文字サイズの全角アキだけ右に寄せた位置に配置する (ページスタイル #1 内,2.6.1.b)}% + \jlreq@note{柱やノンブルは,左ページでは,基本版面の左端の延長線にノンブル又は柱の先頭をそろえて配置するか,基本版面の左端の延長線から基本版面の文字サイズの全角アキだけ右に寄せた位置に配置する (ページスタイル #1 内,2.6.1.b).}% \fi }{}% {\jlreq@font - \ifthenelse{\lengthtest{\jlreq@gap < 1.49\zw} \OR \( \lengthtest{\jlreq@gap > 1.51\zw} \AND \lengthtest{\jlreq@gap < 1.99\zw} \) \OR \lengthtest{\jlreq@gap > 2.01\zw}}{\jlreq@warning{ノンブルと柱との空き量は文字サイズの2倍又は1.5倍とする (ページスタイル #1 内,2.6.1.c)}}{}% + \ifthenelse{\lengthtest{\jlreq@gap < 1.49\zw} \OR \( \lengthtest{\jlreq@gap > 1.51\zw} \AND \lengthtest{\jlreq@gap < 1.99\zw} \) \OR \lengthtest{\jlreq@gap > 2.01\zw}}{\jlreq@note{ノンブルと柱との空き量は文字サイズの2倍又は1.5倍とする (ページスタイル #1 内,2.6.1.c).}}{}% }% % ##2を##1 = left/center/rightの場所,##4を##3の場所に置く.被った場合は##2を外側にする. % 戻り値は\jlreq@result @@ -3511,6 +3579,7 @@ \jlreq@iftdir{\yoko}{}% \rlap{\@textsuperscript{\normalfont\@thefnmark}}% }}% + \renewcommand{\jlreq@referencemark@format}[1]{\@makefnmark}% うーん \if@twocolumn \ifnum\col@number=\@ne \@maketitle @@ -3589,13 +3658,18 @@ \else \newenvironment{abstract}{% \ifnum0\if@twocolumn\else1\fi\ifjlreq@preamble1\fi>0 + \ifjlreq@preamble + \ifx l\jlreq@engine\else + \jlreq@pushhook@postpar{\futurelet\jlreq@nextchar\jlreq@openbracket@hook}% + \fi + \fi % とりあえず全部ボックスに入れる. \global\setbox\jlreq@abstractbox=\vtop\bgroup \ifjlreq@preamble % preamble後っぽく振る舞う \@noskipsecfalse % \@nodocumentが入っているので一時的に無効化 - \everypar{} + \everypar{}% \fi \if@twocolumn \parindent=0pt @@ -3639,7 +3713,11 @@ \fi \egroup \fi - \ifjlreq@preamble\else + \ifjlreq@preamble + \ifx l\jlreq@engine\else + \jlreq@pophook@postpar + \fi + \else \unvbox\jlreq@abstractbox \fi } @@ -3669,12 +3747,16 @@ \setlength\leftmarginv{1\jlreq@mol} \setlength\leftmarginvi{1\jlreq@mol} +%.. 箇条書き +\jlreq@jlreqsetup@add{itemization_beforeafter_space}{\def\jlreq@itemization@beforeafter@space{#1}} +\jlreq@jlreqsetup@add{itemization_itemsep}{\def\jlreq@itemization@itemsep{#1}} +\jlreqsetup{itemization_beforeafter_space=0pt,itemization_itemsep=0pt} % enumerate, itemize用初期化 \def\jlreq@init@list{% \setlength{\labelwidth}{2\jlreq@mol}% - \setlength{\topsep}{0pt}% + \setlength{\topsep}{\dimexpr\jlreq@itemization@beforeafter@space\relax}% \setlength{\partopsep}{0pt}% - \setlength{\itemsep}{0pt}% + \setlength{\itemsep}{\dimexpr\jlreq@itemization@itemsep\relax}% \setlength{\parsep}{0pt}% \setlength{\listparindent}{\parindent}% % itemizeは直後ベタ,enumerateは直後全角空き. @@ -3735,28 +3817,34 @@ \newcommand{\labelitemiv}{\hbox to 1\jlreq@mol{\hss ・\hss}} % 引用系.3.5.2の例. +\jlreq@jlreqsetup@add{quote_indent}{\def\jlreq@quote@indent{#1}} +\jlreq@jlreqsetup@add{quote_end_indent}{\def\jlreq@quote@end@indent{#1}} +\jlreq@jlreqsetup@add{quote_fontsize}[normalsize,small,footnotesize,scriptsize,tiny,]{\jlreq@ifempty{#1}{\def\jlreq@quote@fontsize{}}{\edef\jlreq@quote@fontsize{\expandonce{\csname #1\endcsname}}}} +\jlreq@jlreqsetup@add{quote_beforeafter_space}{\def\jlreq@quote@beforeafter@space{#1}} +\jlreqsetup{quote_indent=2\zw,quote_end_indent=0pt,quote_fontsize=,quote_beforeafter_space=0pt} + \newenvironment{verse} {\let\\\@centercr - \list{}{\itemsep\z@ \itemindent -2\jlreq@mol% + \list{}{\itemsep\z@ \itemindent -2\jlreq@mol \listparindent\itemindent \labelwidth\z@ \labelsep\z@ - \leftmargin=\jlreq@speciallength{\jlreq@quote@indent}% + \leftmargin=\dimexpr\jlreq@quote@indent\relax \addtolength{\leftmargin}{2\jlreq@mol}% - \rightmargin=\jlreq@speciallength{\jlreq@quote@end@indent}% - \csname\jlreq@quote@fontsize\endcsname + \rightmargin=\dimexpr\jlreq@quote@end@indent\relax + \jlreq@quote@fontsize \@tempdima=1\zw \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax \@tempdimc=\@tempdimb \divide\@tempdimb by \@tempdima\multiply\@tempdimb by \@tempdima - \topsep=\jlreq@speciallength{\jlreq@quote@beforeafter@space}% + \topsep=\dimexpr\jlreq@quote@beforeafter@space\relax \leftmargin=\dimexpr\leftmargin + \@tempdimc - \@tempdimb\relax}% \item\relax}{\endlist} \newenvironment{quotation} {\list{}{% - \leftmargin=\jlreq@speciallength{\jlreq@quote@indent}% - \rightmargin=\jlreq@speciallength{\jlreq@quote@end@indent}% - \csname\jlreq@quote@fontsize\endcsname + \leftmargin=\dimexpr\jlreq@quote@indent\relax + \rightmargin=\dimexpr\jlreq@quote@end@indent\relax + \jlreq@quote@fontsize \@tempdima=1\zw \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax \@tempdimc=\@tempdimb @@ -3766,14 +3854,14 @@ \itemindent\listparindent \labelwidth\z@ \labelsep\z@ - \topsep=\jlreq@speciallength{\jlreq@quote@beforeafter@space}% + \topsep=\dimexpr\jlreq@quote@beforeafter@space\relax \parsep\z@ \@plus.1\jlreq@gol}% \item\relax}{\endlist} \newenvironment{quote} {\list{}{% - \leftmargin=\jlreq@speciallength{\jlreq@quote@indent}% - \rightmargin=\jlreq@speciallength{\jlreq@quote@end@indent}% - \csname\jlreq@quote@fontsize\endcsname + \leftmargin=\dimexpr\jlreq@quote@indent\relax + \rightmargin=\dimexpr\jlreq@quote@end@indent\relax + \jlreq@quote@fontsize \@tempdima=1\zw \@tempdimb=\dimexpr\linewidth - \@totalleftmargin - \leftmargin - \rightmargin\relax \@tempdimc=\@tempdimb @@ -4034,6 +4122,27 @@ } } +%. その他諸々 +%.. 縦中横 +\DeclareRobustCommand*{\tatechuyoko}[1]{% + \jlreq@ifydir{\ClassError{jlreq}{\string\tatechuyoko\space is not allowed in yoko mode}{\@ehc}}{}% + \jlreq@lastnodechar=\lastnodechar + \ifvmode\leavevmode\fi + \ifnum\jlreq@lastnodechar=-1\else + \inhibitglue + \jlreq@calc@jfmglue{\char\jlreq@lastnodechar}{阿}% + \ifdim\jlreq@resultskip=0pt\else\hskip\jlreq@resultskip\fi + \fi + \hbox{\yoko \vrule width 0pt height 0.88\zw depth 0.12\zw #1}% + \def\jlreq@do{% + \jlreq@isletter{\jlreq@nextchar}{% + \jlreq@calc@jfmglue{\jlreq@nextchar}{阿}% + \ifdim\jlreq@resultskip=0pt\else\hskip\jlreq@resultskip\fi + \inhibitglue + }{}% + }% + \futurelet\jlreq@nextchar\jlreq@do +} % 日にち \newif\if西暦 \西暦true @@ -4064,26 +4173,38 @@ \fi }}} -%. 定理環境 -\def\jlreq@theorem@abovebelowspace{1\baselineskip}%とりあえず前後に一行分のアキ +%.. 定理環境 \jlreq@saveoriginalcs{@begintheorem} -\def\@begintheorem#1#2{\topsep=\jlreq@theorem@abovebelowspace +\jlreq@saveoriginalcs{@opargbegintheorem} +\def\@begintheorem#1#2{\topsep=\dimexpr\jlreq@theorem@beforeafter@space\relax \trivlist\labelsep=1\jlreq@mol + \itemindent=\dimexpr\jlreq@theorem@indent\relax \item[\hskip \labelsep{\sffamily\bfseries #1\ #2}]} -\jlreq@saveoriginalcs{@opargbegintheorem} -\def\@opargbegintheorem#1#2#3{\topsep=\jlreq@theorem@abovebelowspace +\def\@opargbegintheorem#1#2#3{\topsep=\dimexpr\jlreq@theorem@beforeafter@space\relax \trivlist\labelsep=1\jlreq@mol + \itemindent=\dimexpr\jlreq@theorem@indent\relax \item[\hskip \labelsep{\sffamily\bfseries #1\ #2(#3)}]} - -\AtEndOfPackageFile*{amsthm}{ - \newtheoremstyle{jlreq}{\jlreq@theorem@abovebelowspace}{\jlreq@theorem@abovebelowspace}{\normalfont}{}{\sffamily\bfseries}{}{1\jlreq@mol}{\thmname{#1}\thmnumber{\ #2}\thmnote{ (#3)}} - \theoremstyle{jlreq} - \jlreq@saveoriginalcs{proof} - \jlreq@saveoriginalcs{endproof} +\AtEndOfPackageFile*{amsthm}{% + \jlreq@saveoriginalcs{proof}% + \jlreq@saveoriginalcs{endproof}% \def\proof{\@ifnextchar[{\jlreq@proof}{\jlreq@proof[\proofname]}} \def\jlreq@proof[#1]{\labelsep=1\jlreq@mol\jlreq@original@proof[{\normalfont\sffamily\bfseries #1\inhibitglue}\nopunct]} \renewcommand{\proofname}{証明} + \jlreq@setupamsthm + \theoremstyle{jlreq} +} +\def\jlreq@setupamsthm{ + \newtheoremstyle{jlreq}{\dimexpr\jlreq@theorem@beforeafter@space\relax}{\dimexpr\jlreq@theorem@beforeafter@space\relax}{\normalfont}{\dimexpr\jlreq@theorem@indent\relax}{\sffamily\bfseries}{}{1\jlreq@mol}{\thmname{##1}\thmnumber{\ ##2}\thmnote{ (##3)}} +} +\jlreq@jlreqsetup@add{theorem_beforeafter_space}{ + \def\jlreq@theorem@beforeafter@space{#1} + \@ifpackageloaded{amsthm}{\jlreq@setupamsthm}{} +} +\jlreq@jlreqsetup@add{theorem_indent}{ + \def\jlreq@theorem@indent{#1} + \@ifpackageloaded{amsthm}{\jlreq@setupamsthm}{} } +\jlreqsetup{theorem_beforeafter_space=1\baselineskip,theorem_indent=0pt} % デフォルト設定 |