summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/jlreq/jlreq.cls')
-rw-r--r--Master/texmf-dist/tex/latex/jlreq/jlreq.cls131
1 files changed, 78 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
index d513a760f98..d3712ede72a 100644
--- a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
+++ b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls
@@ -5,7 +5,7 @@
%%
% (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/)
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{jlreq}[2018/08/15 jlreq]
+\ProvidesClass{jlreq}[2018/09/01 jlreq]
\RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen}
\RequirePackage{jlreq-helpers}
@@ -406,18 +406,28 @@
% 現在行の残りを得る.
\ifx l\jlreq@engine
- % 以下のコードはおかしい.
+ % 以下のコードはLuaTeX-jaのバグ?に依存している
+ % https://ja.osdn.net/projects/luatex-ja/ticket/36489
\newcommand*{\jlreq@calc@current@linewidth@onecolumn}{%
- \dimexpr\zposx{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp - \@totalleftmargin -
- \ifodd\jlreq@currentpage
- \oddsidemargin
- \else
- \evensidemargin
- \fi
- \iftombow - 1in\fi
- - 1in - \hoffset\relax
+ \dimexpr
+ \zposx{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp - \@totalleftmargin -
+ \ifodd\jlreq@currentpage
+ \oddsidemargin
+ \else
+ \evensidemargin
+ \fi
+ \iftombow -1in \fi
+ - \pdfvariable horigin - \hoffset
+ \relax
}
\else
+ % トンボ出力時にはjlreq-trimmarksであることを仮定する.
+ % 新しいpLaTeXに対しては,jlreq-trimmarksは内部の1inを1trueinに書き換える
+ \@ifundefined{@tombowreset@@paper}{
+ \def\jlreq@tombow@adjust{\iftombow -1in \fi}
+ }{
+ \def\jlreq@tombow@adjust{\iftombow -1truein \fi}
+ }
\newcommand*{\jlreq@calc@current@linewidth@onecolumn}{%
\dimexpr
\jlreq@ifydir{%
@@ -436,7 +446,7 @@
- \topmargin - \headheight - \headsep - \voffset
- \zposy{jlreq@rest@width.pos.\the\jlreq@zref@reference@count} sp
}%
- \iftombow - 1in\fi
+ \jlreq@tombow@adjust
- \@totalleftmargin - 1in
\relax
}
@@ -1158,25 +1168,18 @@
%. ページレイアウト
% landscapeの場合縦横をひっくり返す
\if@landscape
- \jlreq@swap{\paperwidth}{\paperheight}
+ \jlreq@helper@swap@register{\paperwidth}{\paperheight}
\fi
% \pdfpagewidthとか設定
\ifx l\jlreq@engine
- \let\jlreq@pagewidth=\pagewidth
- \let\jlreq@pageheight=\pageheight
+ \setlength{\pagewidth}{\paperwidth}
+ \setlength{\pageheight}{\paperheight}
\else
- \let\jlreq@pagewidth=\pdfpagewidth
- \let\jlreq@pageheight=\pdfpageheight
-\fi
-\setlength{\jlreq@pagewidth}{\paperwidth}
-\setlength{\jlreq@pageheight}{\paperheight}
-\iftombow
- \addtolength{\jlreq@pagewidth}{2in}
- \addtolength{\jlreq@pageheight}{2in}
+ \setlength{\pdfpagewidth}{\paperwidth}
+ \setlength{\pdfpageheight}{\paperheight}
\fi
-
\ifx l\jlreq@engine
\def\jlreq@expand@speciallength#1{%
% zhやzwを\zhや\zwにする.
@@ -1203,6 +1206,11 @@
\jlreq@tempdimb=1\zw
\divide\jlreq@tempdima\jlreq@tempdimb
\multiply\jlreq@tempdima\jlreq@tempdimb
+ \ifdim\jlreq@tempdima>0pt
+ \ifnum 0\ifdim\jlreq@tempdima>25\zw 1\fi\ifdim\jlreq@tempdima<15\zw 1\fi>0
+ \jlreq@note{並列注の字詰め方向の長さ(行長)は,15字から20字くらいである.ケースによっては25字程度にする場合もある (4.2.7).}
+ \fi
+ \fi
\edef\jlreq@do{
\noexpand\setlength{\noexpand\marginparwidth}{\the\jlreq@tempdima}
\noexpand\setlength{\noexpand\marginparpush}{\the\dimexpr 0.5\zw\relax} % 同上:4.2.7.g
@@ -1215,11 +1223,6 @@
\setlength{\marginparsep}{0pt}
\fi
-\ifdim\marginparwidth>0pt
- \ifnum 0\ifdim\marginparwidth>25\zw 1\fi\ifdim\marginparwidth<15\zw 1\fi>0
- \jlreq@note{並列注の字詰め方向の長さ(行長)は,15字から20字くらいである.ケースによっては25字程度にする場合もある (4.2.7).}
- \fi
-\fi
% 縦書きの時は脚注に固定
% (TODO: 頭注)
\if@tate\@mparswitchfalse\fi
@@ -1345,13 +1348,13 @@
}
\def\jlreq@setsidemargin@by@fore@edge#1{
\jlreq@setsidemargin@by@gutter{#1}
- \@tempdima=\evensidemargin
- \evensidemargin=\oddsidemargin
- \oddsidemargin=\@tempdima
+ \jlreq@helper@swap@register{\oddsidemargin}{\evensidemargin}
\ifjlreq@determine@kihonhanmen@warning@first
\jlreq@note{基本版面の配置はのどの空き量を指定する (2.4.1.b).}
\fi
}
+\jlreq@aftercls@addtodeletecs{\jlreq@setsidemargin@by@gutter}
+\jlreq@aftercls@addtodeletecs{\jlreq@setsidemargin@by@fore@edge}
\ifx\jlreq@option@gutter\@empty
\ifx\jlreq@option@fore@edge\@empty
@@ -1377,36 +1380,41 @@
\else
\jlreq@setsidemargin@by@gutter{\jlreq@speciallength{\jlreq@option@gutter}}
\ifx\jlreq@option@fore@edge\@empty\else
- \ifjlreq@determine@kihonhanmen@warning@first\else
+ \ifjlreq@determine@kihonhanmen@warning@first
\ClassWarningNoLine{jlreq}{fore_edge is ignored}
\fi
\fi
\fi
-\addtolength{\oddsidemargin}{-1in}
-\addtolength{\evensidemargin}{-1in}
+\ifx l\jlreq@engine
+ \addtolength{\oddsidemargin}{-1in}
+ \addtolength{\evensidemargin}{-1in}
+\else
+ \addtolength{\oddsidemargin}{-1truein}
+ \addtolength{\evensidemargin}{-1truein}
+\fi
%.. 縦
% \topmarginに全体の頭からテキストの頭までの長さを入れる
% 天の値からtopmarginを設定する
\def\jlreq@settopmarginbyhead#1{
\if@tate
- \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in\relax}
+ \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight\relax}
\if@twocolumn
\addtolength{\topmargin}{\dimexpr\marginparwidth + \marginparsep\relax}
\fi
\jlreq@note{縦組の場合は地の空き量を指定する (2.4.1.b).}
\else
- \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in - \topskip + \Cht\relax}
+ \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - \topskip + \Cht\relax}
\fi
}
\jlreq@aftercls@addtodeletecs{\jlreq@settopmarginbyhead}
% 地の値から
\def\jlreq@settopmarginbyfoot#1{
\if@tate
- \setlength{\topmargin}{\dimexpr\paperheight - \textwidth - \headsep - \headheight - 1in - #1 - \marginparsep - \marginparwidth\relax}
+ \setlength{\topmargin}{\dimexpr\paperheight - \textwidth - \headsep - \headheight - #1 - \marginparsep - \marginparwidth\relax}
\else
\jlreq@note{横組の場合は天の空き量を指定する (2.4.1.b).}
- \setlength{\topmargin}{\dimexpr\paperheight - \textheight + \topskip - 1\zh - \headsep - \headheight - 1in - #1\relax}
+ \setlength{\topmargin}{\dimexpr\paperheight - \textheight + \topskip - 1\zh - \headsep - \headheight - #1\relax}
\fi
}
\jlreq@aftercls@addtodeletecs{\jlreq@settopmarginbyfoot}
@@ -1442,7 +1450,11 @@
\fi
\fi
\fi
-
+\ifx l\jlreq@engine
+ \addtolength{\topmargin}{-1in}
+\else
+ \addtolength{\topmargin}{-1truein}
+\fi
%.. 下
\setlength{\footskip}{\dimexpr\headsep + \if@tate\marginparwidth + \marginparsep\else\topskip - \Cht\fi + \headheight\relax}
% \maxdepth + \topskip = フォントサイズ×1.5(だってさ)
@@ -1612,6 +1624,7 @@
% ラベルフォーマットでは#1=カウンタ名,見出し文字列フォーマットでは#1=見出し文字列,副題フォーマットでは#1=副題
% ラベルのみのフォーマットは目次に使われる.
\newcommand{\jlreq@BlockHeading@start}[5]{%
+ \if@noskipsec\leavevmode\fi
\edef\jlreq@BlockHeading@start@format{\unexpanded{#4}}% この二つは\parを含むかもしれないので引数渡しはしない(後の\@ifstarで詰まる)
\edef\jlreq@BlockHeading@start@totalformat{\unexpanded{#5}}%
\jlreq@BlockHeading@start@{#1}{#2}{#3}%
@@ -2224,7 +2237,7 @@
}
\def\jlreq@SetBlockHeadingSpaces@iii#1{%
\@for\@tempa:=#1\do{%
- \expandafter\jlreq@remove@spaceandbracket\expandafter{\@tempa}{\@tempa}%
+ \expandafter\jlreq@helper@trim\expandafter{\@tempa}{\@tempa}%
\expandafter\jlreq@iffirsttoken@ignorespaces\expandafter{\@tempa}{_}{%
\ifx\jlreq@lastdimen\@empty\else\eappto\jlreq@set{{\expandonce{\jlreq@lastdimen}}}\fi%
\def\jlreq@lastdimen{}%
@@ -2513,12 +2526,13 @@
%.. 窓見出し
\def\jlreq@CutinHeading@start#1#2#3#4#5#6#7{%
+ \if@noskipsec\leavevmode\fi
\par
- \ifnum\hangafter=1
+ \ifnum\hangafter=1 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{%
\jlreq@CutinHeading@start@{#2}{#3}{#4}{#5}{#6}{#7}%
- \else
+ }{%
\ClassError{jlreq}{Can not use \expandafter\string\csname#1\endcsname\space here}{\@ehc}%
- \fi
+ }%
}
% 1 = 書式指定,2 = インデント, 3 = 見出しと本文の間, 4 = これを越えたら二行以上,5 = これを越えたら三行以上,6 = テキスト
\def\jlreq@CutinHeading@start@#1#2#3#4#5#6{%
@@ -2825,12 +2839,12 @@
\ifx l\jlreq@engine
\def\jlreq@hook@prenote{%
\jlreq@lastnodechar=\lastnodechar\relax
- \ifnum\lastnodechar>-1\inhibitglue\fi
+ \ifnum\jlreq@lastnodechar>-1 \inhibitglue\fi
}
\else
% (u)platexの時は代入すると\inhibitglueが効かなくなる
\def\jlreq@hook@prenote{%
- \ifnum\lastnodechar>-1\inhibitglue\fi
+ \ifnum\lastnodechar>-1 \inhibitglue\fi
\jlreq@lastnodechar=\lastnodechar\relax
}
\fi
@@ -3160,7 +3174,7 @@
% \jlreq@tempcにセクション名たちを入れていく
\def\jlreq@tempc{}
\@for\jlreq@tempa:=#1\do{
- \expandafter\jlreq@remove@spaceandbracket\expandafter{\jlreq@tempa}{\jlreq@tempa}%
+ \expandafter\jlreq@helper@trim\expandafter{\jlreq@tempa}{\jlreq@tempa}%
\jlreq@switch{\jlreq@tempa}{
{headings}{\jlreq@tempatrue}
{paragraph}{
@@ -4694,7 +4708,7 @@
\def\jlreq@do{}%
\def\jlreq@keyvallist{}%
\@for\@tempa:=#1\do{%
- \expandafter\jlreq@remove@spaceandbracket\expandafter{\@tempa}{\@tempa}%
+ \expandafter\jlreq@helper@trim\expandafter{\@tempa}{\@tempa}%
\expandafter\jlreq@ifcontains\expandafter{\@tempa}{=}{%
\expandafter\appto\expandafter\jlreq@keyvallist\expandafter{\@tempa,}%
}{%
@@ -5108,13 +5122,24 @@
%. その他諸々
%.. 縦中横
-\DeclareRobustCommand*{\tatechuyoko}[1]{%
- \jlreq@ifydir{\ClassError{jlreq}{\string\tatechuyoko\space is not allowed in yoko mode}{\@ehc}}{}%
- \jlreq@lastnodechar=\lastnodechar
- \ifvmode\leavevmode\fi
+\edef\@tempa{%
+ \unexpanded{%
+ \jlreq@ifydir{\ClassError{jlreq}{\string\tatechuyoko\space is not allowed in yoko mode}{\@ehc}}{}%
+ \ifvmode\leavevmode\fi
+ }%
+ \ifx l\jlreq@engine\unexpanded{%
+ \jlreq@lastnodechar=\lastnodechar\relax
+ \ifnum\jlreq@lastnodechar>-1 \inhibitglue\fi
+ }\else\unexpanded{%
+ \ifnum\lastnodechar>-1 \inhibitglue\fi
+ \jlreq@lastnodechar=\lastnodechar\relax
+ }\fi
+}
+
+\expandafter\protected\expandafter\def\expandafter\tatechuyoko\expandafter#\expandafter1\expandafter{%
+ \@tempa
% 前のJFM glue
- \ifnum\jlreq@lastnodechar=-1\else
- \inhibitglue
+ \ifnum\jlreq@lastnodechar>-1
\jlreq@calc@jfmglue{\char\jlreq@lastnodechar}{阿}%
\jlreq@ifgluezero\jlreq@resultskip{}{\hskip\jlreq@resultskip}%
\fi