diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-20 22:57:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-20 22:57:49 +0000 |
commit | dbb860373fff5ef417296c89ed35a45a71bbaa4d (patch) | |
tree | a5256263e2d6c83582d6d2755d707c7f43af22c7 /Master/texmf-dist/tex/latex/jlreq/jlreq.cls | |
parent | e7b67086abd330ff0b6a29c64adc4fb7854b398b (diff) |
jlreq (20mar17)
git-svn-id: svn://tug.org/texlive/trunk@43557 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/jlreq/jlreq.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/jlreq/jlreq.cls | 409 |
1 files changed, 286 insertions, 123 deletions
diff --git a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls index a47d9d89f88..83238525119 100644 --- a/Master/texmf-dist/tex/latex/jlreq/jlreq.cls +++ b/Master/texmf-dist/tex/latex/jlreq/jlreq.cls @@ -5,10 +5,13 @@ %% % (based on JLReq 20120403 https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ja/) \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{jlreq}[2017/03/14 jlreq] +\ProvidesClass{jlreq}[2017/03/20 jlreq] \RequirePackage{xkeyval,everyhook,filehook,etoolbox,ifthen} %. helper1 +\newcount\jlreq@tempcnta +\newcount\jlreq@tempcntb +\newcount\jlreq@tempcntc \newdimen\jlreq@tempdima \newdimen\jlreq@tempdimb \newdimen\jlreq@tempdimc @@ -23,6 +26,7 @@ \newbox\jlreq@tempboxc % 計算結果を返すための変数 \newdimen\jlreq@resultdimen +\newskip\jlreq@resultskip \newbox\jlreq@resultbox \newif\ifjlreq@result @@ -290,6 +294,29 @@ \global\jlreq@currentpage=\zref@extractdefault{jlreq@rest@width.page.\the\jlreq@zref@reference@count}{jlreq@page}{\c@page}% } +\def\jlreq@saveoriginalcs#1{ + \@ifundefined{jlreq@original@#1}{}{% + \ClassError{jlreq}{Trying to save \expandafter\string\csname #1\endcsname\space twice, maybe a bug}{\@ehc}% + }% + \expandafter\expandafter\expandafter\let\expandafter\expandafter\csname jlreq@original@#1\endcsname\csname #1\endcsname +} + +% #1の先頭が文字か +\def\jlreq@isletter#1{% + \expandafter\expandafter\expandafter\jlreq@helper@isletter\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark +} +\def\jlreq@helper@isletter#1{% + \ifnum + 0\ifcat 阿\noexpand #11\fi + \ifcat あ\noexpand #11\fi + \ifcat (\noexpand #11\fi + \ifcat A\noexpand #11\fi + \ifcat 1\noexpand #11\fi + >0 + \expandafter\@firstoftwo\else\expandafter\@secondoftwo + \fi +} + %. オプションの定義 % オプション処理の際にしか使わない変数(後でそれを元に別の変数を調整する) % ものは\jlreq@option@<key>に格納する. @@ -383,6 +410,8 @@ \jlreq@addpapersize[c7]{}{114mm}{81mm} \jlreq@addpapersize[c8]{}{81mm}{57mm} +\let\jlreq@addpapersize=\@undefined + %.. フォントサイズ,行長,1ページあたりの行数で基本版面のサイズを決める(2.4.1.a) \newcommand*{\jlreq@option@fontsize}{} \DeclareOptionX{fontsize}{\renewcommand*{\jlreq@option@fontsize}{#1}} @@ -496,6 +525,8 @@ \newcommand*{\jlreq@warning}[1]{} \jlreq@DeclareOption{jlreq_warnings}{\renewcommand*{\jlreq@warning}[1]{\ClassWarningNoLine{jlreq}{(JLReq warning) ##1}}} +\let\jlreq@DeclareOption=\@undefined + \ExecuteOptionsX{article_type=article,paper=a4,fontsize=10pt,open_bracket_pos=zenkaku_tentsuki,reference_mark=inline,footnotetext_indent=one,endnote_position=headings,onecolumn,final} % \@removeelementを一旦置き換えてから\ProcessOptionsXを実行する \let\jlreq@original@@removeelement=\@removeelement @@ -558,37 +589,26 @@ \fi % \jlreq@gol(Gyo Okuri Length), \jlreq@mol (Moji Okuri Length)を定義 -\if@tate - \ifx l\jlreq@engine - \def\jlreq@gol{\zw}\def\jlreq@mol{\zh} - \else - \def\jlreq@gol{zw}\def\jlreq@mol{zh} - \fi +\ifx l\jlreq@engine + \def\jlreq@gol{\zh}\def\jlreq@mol{\zw} \else - \ifx l\jlreq@engine - \def\jlreq@gol{\zh}\def\jlreq@mol{\zw} - \else - \def\jlreq@gol{zh}\def\jlreq@mol{zw} - \fi + \def\jlreq@gol{zh}\def\jlreq@mol{zw} \fi %. helper2(エンジン依存系) % 組方向を判定 % \jlreq@if(y|t)(dir|box)を定義する. -\def\jlreq@do{% - \def\jlreq@ifydir{\ifydir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftdir{\iftdir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@ifybox##1{\ifybox##1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} - \def\jlreq@iftbox##1{\iftbox##1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} -} -\ifx l\jlreq@engine +\ifx l\jlreq@engine\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{ \def\jlreq@ifydir{\ifnum\ltjgetparameter{direction}=4\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \def\jlreq@iftdir{\ifnum\numexpr\ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8=3\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \def\jlreq@ifybox#1{\ifnum\ltjgetparameter{boxdir}{#1}=4\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \def\jlreq@iftbox#1{\ifnum\numexpr\ltjgetparameter{boxdir}{#1}-(\ltjgetparameter{boxdir}{#1}/8)*8=3\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} -\else - \jlreq@do -\fi +}{ + \def\jlreq@ifydir{\ifydir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + \def\jlreq@iftdir{\iftdir\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + \def\jlreq@ifybox#1{\ifybox#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + \def\jlreq@iftbox#1{\iftbox#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} +} % 現在行の残りを得る. \ifx l\jlreq@engine @@ -639,16 +659,50 @@ \edef\jlreq@savepos@iflabelundefined{\noexpand\zref@ifrefundefined{jlreq@rest@width.pos.\the\jlreq@zref@reference@count}}% } +\ifx\jlreq@engine l + \def\lastnodechar{\directlua{luatexja.pltx_composite_last_node_char()}} +\fi + +% #1と#2の間に入るjmglueを\jlreq@resultskip((x)kanjiskipも)に入れる +\newcommand*{\jlreq@calc@jfmglue}[2]{% + \begingroup + \setbox\jlreq@tempboxa=\hbox{\inhibitglue #1\inhibitglue\hbox{}\inhibitglue#2\inhibitglue}% + \setbox\jlreq@tempboxb=\hbox{\inhibitglue #1#2\inhibitglue}% + \edef\jlreq@do{\noexpand\jlreq@resultskip=\the\dimexpr\wd\jlreq@tempboxb - \wd\jlreq@tempboxa\relax\noexpand\relax}% + \expandafter\endgroup + \jlreq@do +} +\newcount\jlreq@lastnodechar +% jlreq@lastnodecharに入っている値と次のトークン(\futureletで得る)の間に入るJFMグルー等を挿入する +\def\jlreq@fixjfm{% + \ifnum\jlreq@lastnodechar>-1 + \def\jlreq@do{% + \jlreq@isletter{\jlreq@nextchar}{% + \jlreq@calc@jfmglue{\char\jlreq@lastnodechar}{\jlreq@nextchar}% +% \message{fixjfm Insert: \the\jlreq@resultskip}% + \hskip\jlreq@resultskip + \inhibitglue + }{}% + }% + \def\@tempa{% + \futurelet\jlreq@nextchar\jlreq@do + }% + \else\def\@tempa{}\fi + \@tempa +} + %. 基本設定 % 和文文字,欧文文字の設定(とりあえずLuaTeX-jaのデフォルトのまま) +\def\jlreq@kanjiskip{0pt plus 0.25zw minus 0pt} +\def\jlreq@xkanjiskip{0.25zw plus 0.25zw minus 0.125zw} \ifx l\jlreq@engine \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, -8}} % kanjiskip, xkanjiskipはjfmのものを使う \ltjsetparameter{kanjiskip=\maxdimen} \ltjsetparameter{xkanjiskip=\maxdimen} \else - \kanjiskip=0pt plus 0.25zw minus 0pt - \xkanjiskip=0.25zw plus 0.25zw minus 0.125zw + \kanjiskip=\jlreq@kanjiskip + \xkanjiskip=\jlreq@xkanjiskip \fi % 禁則処理,表1,2に従う @@ -1117,7 +1171,26 @@ \jlreq@warning{行間は二分以上全角以下が望ましい (2.4.2.d 注3)} }{} -\emergencystretch 3\jlreq@mol +\emergencystretch 3\jlreq@gol + +% 文字サイズを基準としているような寸法に対しては, +% \@setfontsizeが実行されるたびに追随して値を変える +% その処理は\jlreq@setfontsizehookに入れる +\jlreq@saveoriginalcs{@setfontsize} +\renewcommand*{\@setfontsize}[3]{% + \jlreq@original@@setfontsize{#1}{#2}{#3}% + \jlreq@setfontsizehook +} +\def\jlreq@setfontsizehook{} +\appto\jlreq@setfontsizehook{\ifdim\parindent>0pt\setlength{\parindent}{1\jlreq@mol}\fi} +\ifx\jlreq@engine l\else + \appto\jlreq@setfontsizehook{% + \kanjiskip=\jlreq@kanjiskip + \ifdim\xkanjiskip>0pt + \xkanjiskip=\jlreq@xkanjiskip + \fi + } +\fi \renewcommand{\normalsize}{% \@setfontsize\normalsize{\jlreq@fontsize}{\jlreq@baselineskip}% @@ -1129,7 +1202,7 @@ \if@tate\tate\fi % ここで発行しておく \mcfamily\selectfont\normalsize -\setbox0\hbox{ } % 全角スペース +\setbox0\hbox{阿} \setlength\Cht{\ht0} \setlength\Cdp{\dp0} \setlength\Cwd{\wd0} @@ -1137,17 +1210,6 @@ \setlength\Chs{\wd0} % 4.1.3.a -% 文字サイズを基準としているような寸法に対しては, -% \@setfontsizeが実行されるたびに追随して値を変える -% その処理は\jlreq@setfontsizehookに入れる -\let\jlreq@original@@setfontsize=\@setfontsize -\renewcommand*{\@setfontsize}[3]{% - \jlreq@original@@setfontsize{#1}{#2}{#3}% - \jlreq@setfontsizehook -} -\def\jlreq@setfontsizehook{} -\appto\jlreq@setfontsizehook{\ifdim\parindent>0pt\setlength{\parindent}{1\jlreq@mol}\fi} - % 2.5.2 \baselineskipは一定の方がよい? \newcommand{\footnotesize}{% \@setfontsize\footnotesize{.8\jlreq@fontsize}{\dimexpr 115\jlreq@baselineskip/170\relax}% 脚注文字サイズの二分より少し小さい値を行間に: 4.2.5.e @@ -1185,7 +1247,7 @@ \RequirePackage{plext} \fi \renewcommand*{\@Kanji}[1]{\expandafter\kansuji\number #1\relax} % \relax追加 - \rensujiskip=0\zh plus 0.25\zh minus 0\zh + \rensujiskip=0\jlreq@mol plus 0.25\jlreq@mol minus 0\jlreq@mol \fi % このあたりはtarticleと同じ @@ -1254,8 +1316,9 @@ \setlength{\columnsep}{\jlreq@speciallength{\jlreq@option@column@gap}} \setlength{\columnseprule}{0pt} -% デフォルト値は縦横ともにが0.5倍. -%.. \textwidth:縦書きは縦,横書きは横 +% \textwidthと\textheightのデフォルト値は縦横ともに0.75倍(調整が入る). +%.. \textwidth:文字送り方向の行長 +% 二段の場合は最初の段の頭から次の段の後まで % 一度\textwidthに一行の長さの文字数を入れる(段組の場合でも) \@tempdima=1\jlreq@fontsize \ifx\jlreq@option@line@length\@empty @@ -1286,7 +1349,11 @@ \setlength{\textwidth}{\dimexpr2\textwidth + \columnsep\relax} \fi -%.. \textheight:縦書きは横,横書きは縦 +\setlength{\topskip}{1\zw} % フォントサイズと一致させる + +%.. \textheight:行送り方向の長さ +% 一番上(直後に\topskip由来が入る)から最終行のベースラインまでの長さ. +% \topskipが十分ある時は先頭行のベースラインから最終行のベースライン+\topskip \ifx\jlreq@option@number@of@lines\@empty \if@tate \setlength{\textheight}{0.75\paperwidth} @@ -1297,79 +1364,91 @@ \divide\textheight\baselineskip \multiply\textheight\baselineskip \addtolength{\textheight}{\topskip} \else - \setlength{\textheight}{\dimexpr\jlreq@speciallength{\jlreq@option@number@of@lines\baselineskip} - \baselineskip + \topskip\relax} + \setlength{\textheight}{\dimexpr\jlreq@option@number@of@lines\baselineskip - \baselineskip + \topskip\relax} \fi -\setlength{\topskip}{1\zw} % フォントサイズと一致させる \ifx\jlreq@option@headfoot@verticalpos\@empty - \if@tate\def\jlreq@option@headfoot@verticalpos{1zh} + \if@tate\def\jlreq@option@headfoot@verticalpos{1zw} \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 -\setlength{\headheight}{1\zh} +\setlength{\headheight}{1\zw} %.. 横 \ifx\jlreq@option@gutter\@empty % 中央配置 - \setlength{\oddsidemargin}{\paperwidth} \if@tate - \addtolength{\oddsidemargin}{-\textheight} + \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textheight + \topskip\relax} \else - \addtolength{\oddsidemargin}{-\textwidth} + \setlength{\oddsidemargin}{\dimexpr\paperwidth - \textwidth\relax} \fi \setlength{\oddsidemargin}{.5\oddsidemargin} \addtolength{\oddsidemargin}{-1in} \setlength{\evensidemargin}{\oddsidemargin} \else - \setlength{\oddsidemargin}{\jlreq@speciallength{\jlreq@option@gutter}} - \setlength{\evensidemargin}{\dimexpr\paperwidth - \textheight - \oddsidemargin\relax} \if@tate - \setlength{\jlreq@tempdima}{\oddsidemargin} - \setlength{\oddsidemargin}{\evensidemargin} - \setlength{\evensidemargin}{\jlreq@tempdima} + \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}} + \setlength{\evensidemargin}{\dimexpr\paperwidth - \textwidth - \oddsidemargin\relax} \fi \addtolength{\oddsidemargin}{-1in} \addtolength{\evensidemargin}{-1in} \fi + %.. 縦 -\ifx\jlreq@option@head@space\@empty - \setlength{\topmargin}{\paperheight} +% \topmarginに全体の頭からテキストの頭までの長さを入れる +% 天の値からtopmarginを設定する +\def\jlreq@settopmarginbyhead#1{ \if@tate - \addtolength{\topmargin}{-\textwidth} + \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in\relax} + \jlreq@warning{縦組の場合は地の空き量を指定する (2.4.1.b)} \else - \addtolength{\topmargin}{-\textheight} + \setlength{\topmargin}{\dimexpr #1 - \headsep - \headheight - 1in - \topskip + \Cht\relax} \fi +} +% 地の値から +\def\jlreq@settopmarginbyfoot#1{ + \if@tate + \setlength{\topmargin}{\dimexpr\paperheight - \textwidth - \headsep - \headheight - 1in - #1\relax} + \else + \jlreq@warning{横組の場合は天の空き量を指定する (2.4.1.b)} + \setlength{\topmargin}{\dimexpr\paperheight - \textheight + \topskip - 1\zh - \headsep - \headheight - 1in - #1\relax} + \fi +} +\ifx\jlreq@option@head@space\@empty \ifx\jlreq@option@foot@space\@empty - % 中央配置 - \setlength{\topmargin}{0.5\topmargin} + \if@tate + \jlreq@settopmarginbyfoot{\dimexpr(\paperheight - \textwidth)/2\relax} + \else + \jlreq@settopmarginbyhead{\dimexpr(\paperheight - (\textheight - \topskip + 1\zh))/2\relax} + \fi \else - \addtolength{\topmargin}{-\jlreq@speciallength{\jlreq@option@foot@space}} + \jlreq@settopmarginbyfoot{\jlreq@speciallength{\jlreq@option@foot@space}} \fi \else \ifx\jlreq@option@foot@space\@empty - \setlength{\topmargin}{\jlreq@speciallength{\jlreq@option@head@space}} + \jlreq@settopmarginbyhead{\jlreq@speciallength{\jlreq@option@head@space}} \else % 両方指定されていたら,縦書きは地を,横書きは天を使う \if@tate - \setlength{\topmargin}{\paperheight} - \addtolength{\topmargin}{-\textwidth} - \addtolength{\topmargin}{-\jlreq@speciallength{\jlreq@option@foot@space}} + \jlreq@settopmarginbyfoot{\jlreq@speciallength{\jlreq@option@foot@space}} + \ClassWarningNoLine{jlreq}{head_space is ignored} \else - \setlength{\topmargin}{\jlreq@speciallength{\jlreq@option@head@space}} + \jlreq@settopmarginbyhead{\jlreq@speciallength{\jlreq@option@head@space}} + \ClassWarningNoLine{jlreq}{foot_space is ignored} \fi \fi \fi +\let\jlreq@settopmarginbyhead=\@undefined +\let\jlreq@settopmarginbyfoot=\@undefined - -\addtolength{\topmargin}{-\headsep} -\addtolength{\topmargin}{-\headheight} -\addtolength{\topmargin}{-1in} %.. 下 -% 本文から一文字分離すつもり -\setlength{\footskip}{2\zh} -% \maxdepth + \topskip = フォントサイズ×1.5 -\setlength{\maxdepth}{1.5\jlreq@fontsize} -\addtolength{\maxdepth}{-\topskip} +\setlength{\footskip}{\dimexpr\headsep + 1\zw\relax} +% \maxdepth + \topskip = フォントサイズ×1.5(だってさ) +\setlength{\maxdepth}{\dimexpr1.5\jlreq@fontsize - \topskip\relax} %. 見出し関係 (4.1) % 見出しの直前に実行される @@ -1952,7 +2031,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@warning{窓見出しと本文との空き量は,基本版面の文字サイズの全角以上,2倍未満とする (4.1.10.c)}%& }{}% \edef\jlreq@do{% \noexpand\def\expandonce{\csname #1\endcsname}{% @@ -2000,8 +2079,7 @@ \newcommand*{\jlreq@keepbaselineskip}[1]{% \begingroup - \jlreq@tempdima=\baselineskip - \edef\jlreq@do{\unexpanded{#1}\noexpand\baselineskip=\the\jlreq@tempdima}% + \edef\jlreq@do{\unexpanded{#1}\noexpand\baselineskip=\the\baselineskip}% \expandafter\endgroup \jlreq@do } @@ -2074,39 +2152,39 @@ (\rensuji{\@arabic\c@subparagraph})} \ifthenelse{\equal{\jlreq@article@type}{article}}{ - \NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE\headfont}},indent=4\zh,lines=4,after_label_space=1\zh,second_heading_text_indent={-1\zh,1\zh},subtitle_font={\jlreq@keepbaselineskip{\large}}} + \NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE\headfont}},indent=4\jlreq@mol,lines=4,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\large}}} \if@twoside\ModifyHeading{part}{allowbreak_if_evenpage=true}\fi } {% book, report \NewTobiraHeading{part}{-1}{label_format={第\thepart 部\hspace*{1\jlreq@mol}},format={\null\vfill {\Huge\headfont \hspace*{2\jlreq@mol}#1#2}\vspace*{2\jlreq@gol}}} - \NewBlockHeading{chapter}{0}{indent=2\zh,lines=6,label_format={第\thechapter 章},font={\huge\headfont},after_label_space=1\zh,second_heading_text_indent={-1\zh,1\zh},subtitle_font={\jlreq@keepbaselineskip{\Large}}} + \NewBlockHeading{chapter}{0}{indent=2\jlreq@mol,lines=6,label_format={第\thechapter 章},font={\huge\headfont},after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\Large}}} \if@twoside\ModifyHeading{chapter}{allowbreak_if_evenpage=true}\fi \renewcommand{\thechapter}{\Kanji{chapter}} } - \NewBlockHeading{section}{1}{font={\jlreq@keepbaselineskip{\Large\headfont}},indent=6\zh,lines=3,after_label_space=1\zh,second_heading_text_indent={-1\zh,1\zh},subtitle_font={\jlreq@keepbaselineskip{\normalsize}}} + \NewBlockHeading{section}{1}{font={\jlreq@keepbaselineskip{\Large\headfont}},indent=6\jlreq@mol,lines=3,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\normalsize}}} \if@twoside\ModifyHeading{section}{allowbreak_if_evenpage=true}\fi - \NewBlockHeading{subsection}{2}{font={\jlreq@keepbaselineskip{\large\headfont}},indent=8\zh,lines=2,after_label_space=1\zh,second_heading_text_indent={-1\zh,1\zh},subtitle_font={\jlreq@keepbaselineskip{\small}}} + \NewBlockHeading{subsection}{2}{font={\jlreq@keepbaselineskip{\large\headfont}},indent=8\jlreq@mol,lines=2,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\small}}} \if@twoside\ModifyHeading{subsection}{allowbreak_if_evenpage=true}\fi - \NewBlockHeading{subsubsection}{3}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=10\zh,lines=1,before_lines=1,subtitle_break=false,after_label_space=1\zh,second_heading_text_indent={-1\zh,1\zh},,subtitle_font={\jlreq@keepbaselineskip{\scriptsize}}} + \NewBlockHeading{subsubsection}{3}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=10\jlreq@mol,lines=1,before_lines=1,subtitle_break=false,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},,subtitle_font={\jlreq@keepbaselineskip{\scriptsize}}} \if@twoside\ModifyHeading{subsubsection}{allowbreak_if_evenpage=true}\fi \NewRuninHeading{paragraph}{4}{font={\jlreq@keepbaselineskip{\normalsize\headfont}}} - \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=1\zh} -\else + \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=1\jlreq@mol} +\else% yoko \renewcommand{\thepart}{\Roman{part}} \renewcommand{\thesubsection}{\thesection .\arabic{subsection}} \renewcommand{\thesubsubsection}{\thesubsection .\arabic{subsubsection}} \renewcommand{\theparagraph}{\thesubsubsection .\arabic{paragraph}} \renewcommand{\thesubparagraph}{\theparagraph .\arabic{subparagraph}} \ifthenelse{\equal{\jlreq@article@type}{article}}{ - \NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE\headfont}},label_format={第\thepart 部},lines=4,after_label_space=1\zw,second_heading_text_indent={-1\zw,1\zw},subtitle_font={\jlreq@keepbaselineskip{\large}}} + \NewBlockHeading{part}{0}{font={\jlreq@keepbaselineskip{\LARGE\headfont}},label_format={第\thepart 部},lines=4,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\large}}} \renewcommand{\thesection}{\arabic{section}} } {% book, report \NewTobiraHeading{part}{-1}{label_format={第\thepart 部\hspace*{1\jlreq@gol}},format={\null\vfil {\Huge\headfont #1#2}\vfil}} \NewBlockHeading{chapter}{0}{% - format={{\jlreq@keepbaselineskip{\huge\headfont} #1#2}#3}, - label_format={第\thechapter 章\quad}, - lines=5,after_label_space=1\zw,second_heading_text_indent={-1\zw,1\zw}, + font={\jlreq@keepbaselineskip{\huge\headfont}}, + label_format={第\thechapter 章}, + lines=5,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol}, subtitle_font={\jlreq@keepbaselineskip{\Large}}} \renewcommand{\thechapter}{\arabic{chapter}} \renewcommand{\thesection}{\thechapter.\arabic{section}} @@ -2116,11 +2194,11 @@ \ModifyHeading{chapter}{pagebreak=clearpage} } } - \NewBlockHeading{section}{1}{font={\jlreq@keepbaselineskip{\Large\headfont}},lines=3,after_label_space=1\zw,second_heading_text_indent={-1\zw,1\zw},subtitle_font={\jlreq@keepbaselineskip{\normalsize}}} - \NewBlockHeading{subsection}{2}{font={\jlreq@keepbaselineskip{\large\headfont}},lines=2,after_label_space=1\zw,second_heading_text_indent={-1\zw,1\zw},subtitle_font={\jlreq@keepbaselineskip{\small}}} - \NewBlockHeading{subsubsection}{3}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},lines=1,before_lines=1,subtitle_break=false,after_label_space=1\zw,second_heading_text_indent={-1\zw,1\zw},subtitle_font={\jlreq@keepbaselineskip{\scriptsize}}} - \NewRuninHeading{paragraph}{4}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=1\zw} - \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=2\zw} + \NewBlockHeading{section}{1}{font={\jlreq@keepbaselineskip{\Large\headfont}},lines=3,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\normalsize}}} + \NewBlockHeading{subsection}{2}{font={\jlreq@keepbaselineskip{\large\headfont}},lines=2,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\small}}} + \NewBlockHeading{subsubsection}{3}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},lines=1,before_lines=1,subtitle_break=false,after_label_space=1\jlreq@mol,second_heading_text_indent={-1\jlreq@mol,1\jlreq@mol},subtitle_font={\jlreq@keepbaselineskip{\scriptsize}}} + \NewRuninHeading{paragraph}{4}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=1\jlreq@mol} + \NewRuninHeading{subparagraph}{5}{font={\jlreq@keepbaselineskip{\normalsize\headfont}},indent=2\jlreq@mol} \fi \ifthenelse{\equal{\jlreq@article@type}{article}}{}{% book, report @@ -2163,6 +2241,39 @@ %. 注 % 合印: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}% + } +} + \newcommand*\jlreq@referencemark@format[1]{#1} \ifthenelse{\equal{\jlreq@referencemark}{inline}}{ \newcommand*{\jlreq@notemark}[1]{% @@ -2173,6 +2284,9 @@ \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}}% @@ -2185,7 +2299,25 @@ \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\jlreq@engine l + % luatexの時は\inhibitglueすると\lastnodechar=-1になる + \newcommand*{\jlreq@modify@noteandmark@fixjfm}[2]{% + \jlreq@modify@noteandmark{#1}{#2}{% + \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}{% + \ifnum\lastnodechar>-1\inhibitglue\fi + \jlreq@lastnodechar=\lastnodechar + }{\jlreq@fixjfm} + } + \fi } +\jlreq@modify@noteandmark@fixjfm{\footnote}{\footnotemark} % \@footnotemarkをシンプルなものにする \def\jlreq@setdefaultnotemark#1#2{% \def#1{% @@ -2195,7 +2327,7 @@ \ifhmode\spacefactor\@x@sf\fi \relax} } -\let\jlreq@original@@footnotemark=\@footnotemark +\def\@tempa{@footnotemark} \jlreq@setdefaultnotemark\@footnotemark\@makefnmark %.. 脚注 (縦書きの時は傍注,4.2.5) {% @@ -2221,7 +2353,7 @@ \footnotesize \jlreq@footnoteindent=1\jlreq@mol \@tempdima=\dimexpr\textwidth - \jlreq@footnoteindent\relax - \@tempdimb=1\zw + \@tempdimb=1\jlreq@mol \divide\@tempdima\@tempdimb \multiply\@tempdima\@tempdimb \global\jlreq@footnoteindent=\dimexpr\textwidth - \@tempdima\relax } @@ -2258,7 +2390,7 @@ \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\endnote{\@ifnextchar[{\jlreq@endnote}{\jlreq@endnote[]}} \def\endnotemark{\@ifnextchar[{\jlreq@endnotemark}{\jlreq@endnotemark[]}} \def\endnotetext{\@ifnextchar[{\jlreq@endnotetext}{\jlreq@endnotetext[]}} \long\def\jlreq@endnote[#1]#2{\jlreq@endnotemark[#1]\@endnotetext{#2}} @@ -2328,7 +2460,7 @@ \par \fi } - +\jlreq@modify@noteandmark@fixjfm{\endnote}{\endnotemark} \jlreq@endnote@indent=2\jlreq@mol % 二行目以降を全角分下げる \newcommand{\@makeendtext}[1]{\parindent 1\jlreq@mol @@ -2402,8 +2534,10 @@ \fi \else \setlength{\jlreq@tempdima}{\dimexpr \paperwidth - \textwidth - 1in - \oddsidemargin - \marginparsep\relax} - \ifdim\jlreq@tempdima>\dimexpr\oddsidemargin + 1in\relax - \setlength{\jlreq@tempdima}{\dimexpr\oddsidemargin + 1in\relax} + \if@twocolumn + \ifdim\jlreq@tempdima>\dimexpr\oddsidemargin + 1in - \marginparsep\relax + \setlength{\jlreq@tempdima}{\dimexpr\oddsidemargin + 1in - \marginparsep\relax} + \fi \fi \fi \ifx\jlreq@option@sidenote@width\@empty @@ -2418,7 +2552,7 @@ \ClassWarningNoLine{jlreq}{sidenote_width is greater than the width of the margin} \fi \fi - \@tempdima=1\zw% 1\jlreq@mol + \@tempdima=1\jlreq@mol \global\divide\marginparwidth\@tempdima \global\multiply\marginparwidth\@tempdima \global\setlength{\marginparpush}{.5\@tempdima} % 同上:g @@ -2455,7 +2589,7 @@ \begingroup \csname c@\jlreq@sidenotecounter\endcsname #1\relax \expandafter\unrestored@protected@xdef\csname\jlreq@sidenotemarkname\endcsname{\csname the\jlreq@sidenotecounter\endcsname}% - \endgroup + \endgroup }% \@sidenotemark } @@ -2475,9 +2609,10 @@ \long\def\@makesidetext#1{\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} \else % thefootnote = \inhibitglue (...だと\inhibitglueが効かない - \long\def\@makesidetext#1{ \kern-1\zw\csname\jlreq@sidenotemarkname\endcsname\hspace{0.5\jlreq@mol}#1} + \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}} @@ -2488,13 +2623,31 @@ \def\sidenotemark{\jlreq@sidenotemark} \def\sidenotetext{\jlreq@sidenotetext} \long\def\jlreq@sidenote#1#2{\jlreq@sidenotemark{#1}\jlreq@sidenotetext{#1}{#2}} - \def\jlreq@sidenotemark#1{% - {\reset@font\jlreq@sidenote@keywordfont #1}% - \ifx\jlreq@sidenote@defaultmark\@empty\else - \expandafter\edef\csname\jlreq@sidenotemarkname\endcsname{\jlreq@sidenote@defaultmark}% - \@sidenotemark + \ifthenelse{\equal{\jlreq@referencemark}{inline}}{% + \def\@tempa{\inhibitglue} + }{ + \ifx\jlreq@engine l + \def\@tempa{% + \jlreq@lastnodechar=\lastnodechar + \ifnum\lastnodechar>-1\inhibitglue\fi + } + \else + \def\@tempa{% + \ifnum\lastnodechar>-1\inhibitglue\fi + \jlreq@lastnodechar=\lastnodechar + } \fi } + \edef\jlreq@sidenotemark#1{% + {\noexpand\reset@font\jlreq@sidenote@keywordfont #1}% + \expandonce{\@tempa}% + \unexpanded{% + \ifx\jlreq@sidenote@defaultmark\@empty\else + \expandafter\edef\csname\jlreq@sidenotemarkname\endcsname{\jlreq@sidenote@defaultmark}% + \@sidenotemark + \fi + }% + } \def\@sidenotemark{\@makesidemark} % カスタマイズできるべき? \long\def\jlreq@sidenotetext#1#2{% @@ -2503,6 +2656,19 @@ } \long\def\@makesidetext#1{{\headfont\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}% + } + } + \jlreq@do } %.. 割注(3.4) @@ -2832,10 +2998,10 @@ \) \)}{% \if@twoside - \jlreq@warning{柱やノンブルは,左ページでは,基本版面の左端の延長線にノンブル又は柱の先頭をそろえて配置するか,基本版面の左端の延長線から基本版面の文字サイズの全角アキだけ右に寄せた位置に配置する(ページスタイル #1 内,2.6.1.b)}% + \jlreq@warning{柱やノンブルは,左ページでは,基本版面の左端の延長線にノンブル又は柱の先頭をそろえて配置するか,基本版面の左端の延長線から基本版面の文字サイズの全角アキだけ右に寄せた位置に配置する (ページスタイル #1 内,2.6.1.b)}% \fi }{}% - \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@warning{ノンブルと柱との空き量は文字サイズの2倍又は1.5倍とする (ページスタイル #1 内,2.6.1.c)}}{}% % 見出しを出す場合:evenに章などの高いレベルの見出しを出す(2.6.3.a) \def\jlreq@markdefinition{}% \def\jlreq@even@running@head@level{}% @@ -2886,7 +3052,7 @@ \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@warning{偶数ページには奇数ページよりアウトラインレベルの高い見出しを入れる (ページスタイル #1内,2.6.3.a)}% \fi \fi\fi % ##1 ##2 ##3と並んだヘッダを作る,戻り値は\jlreq@result @@ -3068,9 +3234,6 @@ % \begin{figure}***\caption{???}\end{figure}を % \begin{figure}\layoutfloat{***}\pcaption{???}\end{figure}にする. % -%\def\jlreq@saveoriginalcs#1{ -% \expandafter\expandafter\expandafter\let\expandafter\expandafter\csname jlreq@original@#1\endcsname\csname #1\endcsname -%} %\long\def\jlreq@replace@layoutfloat#1\caption{\layoutfloat{#1}\jlreq@caption} %\long\def\jlreq@caption#1{\ifx#1\jlreq@endmark\else\pcaption{#1}\expandafter\jlreq@replace@layoutfloat\fi} %\def\jlreq@modify@float#1{% @@ -3352,7 +3515,7 @@ \setlength{\parsep}{0pt}% \setlength{\listparindent}{\parindent}% % itemizeは直後ベタ,enumerateは直後全角空き. - \ifthenelse{\equal{\@currenvir}{itemize}}{ + \ifthenelse{\equal{\@currenvir}{itemize}}{% \setlength{\labelsep}{0\jlreq@mol}% }{% \setlength{\labelsep}{1\jlreq@mol}% @@ -3408,7 +3571,7 @@ \fi \newcommand{\labelitemiv}{\hbox to 1\jlreq@mol{\hss ・\hss}} -% 引用系.1.5em→1\zh,字下げを二文字にした.3.5.2の例. +% 引用系.3.5.2の例. \newenvironment{verse} {\let\\\@centercr \list{}{\itemsep\z@ \itemindent -2\jlreq@mol% @@ -3461,8 +3624,8 @@ %. 表関係 4.4 % 表内の行間を0にする(4.4.3.f) -\let\jlreq@original@tabular=\tabular -\let\jlreq@original@endtabular=\endtabular +\jlreq@saveoriginalcs{tabular} +\jlreq@saveoriginalcs{endtabular} \preto\tabular{\begingroup\appto\@arrayparboxrestore{\baselineskip=0pt\lineskip=0pt}} \appto\endtabular{\endgroup} % 4.4.3.e @@ -3545,7 +3708,7 @@ % 第三引数は,上からの幅に加え更にトップの見出しからの差による補正(プラス)が入る. % 補正には\jlreq@top@contentsを使う. % 「トップ」というか,一番最初に現れた見出しを入れる. -% リーダーは.から・に変更しました.更に直後から出るように. +% リーダーは.から・に変更しました. \def\@dottedtocline#1#2#3#4#5{% \jlreq@set@top@contents{#1}% \ifnum #1>\c@tocdepth \else @@ -3562,7 +3725,7 @@ \advance\leftskip \@lnumwidth \hbox{}\hskip -\leftskip \advance\leftskip\@tempdima {#4}\nobreak - \leaders\hbox{$\hbox{・}\mkern \@dotsep mu \m@th \mkern \@dotsep mu$}% + \leaders\hbox{$\m@th\mkern \@dotsep mu$\null\inhibitglue ・\inhibitglue\null$\m@th\mkern \@dotsep mu$}% \hfill\nobreak \hb@xt@\@pnumwidth{\hss\normalfont\normalcolor #5}% \par}% @@ -3740,11 +3903,11 @@ %. 定理環境 \def\jlreq@theorem@abovebelowspace{1\baselineskip}%とりあえず前後に一行分のアキ -\let\jlreq@original@@begintheorem=\@begintheorem +\jlreq@saveoriginalcs{@begintheorem} \def\@begintheorem#1#2{\topsep=\jlreq@theorem@abovebelowspace \trivlist\labelsep=1\jlreq@mol \item[\hskip \labelsep{\headfont #1\ #2}]} -\let\jlreq@original@@opargbegintheorem=\@opargbegintheorem +\jlreq@saveoriginalcs{@opargbegintheorem} \def\@opargbegintheorem#1#2#3{\topsep=\jlreq@theorem@abovebelowspace \trivlist\labelsep=1\jlreq@mol \item[\hskip \labelsep{\headfont #1\ #2(#3)}]} @@ -3752,8 +3915,8 @@ \AtEndOfPackageFile*{amsthm}{ \newtheoremstyle{jlreq}{\jlreq@theorem@abovebelowspace}{\jlreq@theorem@abovebelowspace}{\normalfont}{}{\headfont}{}{1\jlreq@mol}{\thmname{#1}\thmnumber{\ #2}\thmnote{ (#3)}} \theoremstyle{jlreq} - \let\jlreq@original@proof=\proof - \let\jlreq@original@endproof=\endproof + \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\headfont #1\inhibitglue}\nopunct]} \renewcommand{\proofname}{証明} |