From fd4151f1cf25830fb5af5279eb2fe8955b588b66 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Sat, 6 Sep 2014 23:16:51 +0900 Subject: [PATCH] More LaTeX codes for vertical writing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit lltjext.sty: fix ``unnatural'' behavior of \rensuji lltjcore.sty: add codes related to \footnote from plcore lltjfont.sty: use `漢' instead of `あ' --- src/lltjext.sty | 38 +++++++++++++++++++++++++------------- src/patches/lltjcore.sty | 44 +++++++++++++++++++++++++++++++++++++++++--- src/patches/lltjfont.sty | 4 ++-- 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/src/lltjext.sty b/src/lltjext.sty index 9c5bf9a..5d74fb3 100644 --- a/src/lltjext.sty +++ b/src/lltjext.sty @@ -1,9 +1,10 @@ % % lltjext.sty: derived from plext.sty in pLaTeX. % + \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{lltjext} - [2014/08/11 v1.2-ltj-2 Macros for vertical writing] + [2014/09/06 v1.2-ltj-3 Macros for vertical writing] \RequirePackage{luatexja} \let\ltj@lltjext@orig@tabular=\tabular @@ -609,30 +610,39 @@ \hbox{#2}\else \hskip\rensujiskip \ifvmode\leavevmode\fi + \setbox\tw@\hbox{漢}% 「あ」では仮名書体使用時がまずそう + \@tempdimb\ltjgetht\tw@ \advance\@tempdimb\ltjgetdp\tw@ \ifnot@advanceline\not@advancelinefalse\else \setbox\z@\hbox{\yoko#2}% \@tempdima\ltjgetht\z@ \advance\@tempdima\ltjgetdp\z@ \ifnum\ltjgetparameter{direction}=1\relax - \if #1c\relax\vrule \@width \z@ \@height.5\@tempdima \@depth.5\@tempdima - \else\if #1l\relax\vrule\@width \z@\@height\z@ \@depth\@tempdima - \else\vrule\@width \z@ \@height\@tempdima \@depth\z@ + % 周囲が dtou の場合には,高さ \ltjgetht\tw@, 深さ \ltjgetdp\tw@ のボックスを基準としている. + \if #1c\relax\vrule \@width 1pt \@height\dimexpr.5\@tempdima+.5\ltjgetht\tw@-.5\ltjgetdp\tw@ + \@depth\dimexpr.5\@tempdima-.5\ltjgetht\tw@+.5\ltjgetdp\tw@ + \else\if #1l\relax\vrule\@width 1pt\@height\ltjgetht\tw@ \@depth\dimexpr\@tempdima-\ltjgetht\tw@ + \else\vrule\@width 1pt \@height\dimexpr\@tempdima-\ltjgetdp\tw@ \@depth\ltjgetdp\tw@ \fi\fi \else - \if #1c\relax\vrule \@width \z@ \@height.5\@tempdima \@depth.5\@tempdima - \else\if #1r\relax\vrule\@width \z@\@height\z@ \@depth\@tempdima - \else\vrule\@width \z@ \@height\@tempdima \@depth\z@ + % 周囲が tate, utod の場合も同じ + \if #1c\relax\vrule \@width 1pt \@height\dimexpr.5\@tempdima+.5\ltjgetht\tw@-.5\ltjgetdp\tw@ + \@depth\dimexpr.5\@tempdima-.5\ltjgetht\tw@+.5\ltjgetdp\tw@ + \else\if #1r\relax\vrule\@width 1pt\@height\ltjgetht\tw@ \@depth\dimexpr\@tempdima-\ltjgetht\tw@ + \else\vrule\@width 1pt \@height\dimexpr\@tempdima-\ltjgetdp\tw@ \@depth\ltjgetdp\tw@ \fi\fi \fi \fi \ifnum\ltjgetparameter{direction}=1\relax - \if #1c\relax\hbox to\zw{\yoko\hss#2\hss}% - \else\if #1r\relax\vbox{\hbox to\zw{\yoko\hss#2}\kern\z@}% - \else\vtop{\kern\z@\hbox to\zw{\yoko#2\hss}}% + \if #1c\relax\hbox to\@tempdimb{\yoko\hss#2\hss\kern-\ltjgetdp\tw@}% + \else\if #1r\relax\vbox{\hbox to\@tempdimb{\yoko\hss#2\kern-\ltjgetdp\tw@}}% + \else\lower\ltjgetdp\tw@\vtop{\hbox to\@tempdimb{\yoko#2\hss}}% \fi\fi \else - \if #1c\relax\hbox to\zw{\yoko\hss#2\hss}% - \else\if #1r\relax\vtop{\kern\z@\hbox to\zw{\yoko\hss#2}}% - \else\vbox{\hbox to\zw{\yoko #2\hss}\kern\z@}% + \if #1c\relax\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@ + \hbox to\@tempdimb{\yoko \hss#2\hss}% + \else\if #1r\relax\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@ + \vbox{\hbox to\@tempdimb{\yoko\hss#2}}% + \else\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@ + \vtop{\hbox to\@tempdimb{\yoko #2\hss}}% \fi\fi \fi \hskip\rensujiskip @@ -746,4 +756,6 @@ \RequirePackage{filehook} \AtEndOfPackageFile{array}{\ltj@lltjext@patch@array} } + + \endinput \ No newline at end of file diff --git a/src/patches/lltjcore.sty b/src/patches/lltjcore.sty index c4acde8..c1b28d5 100644 --- a/src/patches/lltjcore.sty +++ b/src/patches/lltjcore.sty @@ -6,7 +6,18 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{lltjcore}[2013/05/14 Patch to LaTeX2e Kernel for LuaTeX-ja] -\makeatletter +\def\cleardoublepage{\clearpage\if@twoside + \ifodd\c@page + \ifnum\ltjgetparameter{direction}=3 + \hbox{}\thispagestyle{empty}\newpage + \if@twocolumn\hbox{}\newpage\fi + \fi + \else + \ifnum\ltjgetparameter{direction}=4 + \hbox{}\thispagestyle{empty}\newpage + \if@twocolumn\hbox{}\newpage\fi + \fi + \fi\fi} \newif\iftombow \tombowfalse \newif\iftombowdate \tombowdatetrue \newdimen\@tombowwidth @@ -153,7 +164,35 @@ \stepcounter{page}% \let\firstmark\botmark } - +\renewcommand\@makefnmark{\hbox{% + \unless\ifnum\ltjgetparameter{direction}=3 + \@textsuperscript{\normalfont\@thefnmark}% + \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}} +\long\def\@footnotetext#1{% + \ifcase\ltjgetparameter{direction}% + \or \let\@tempa\dtou + \or\or\let\@tempa\tate + \or \let\@tempa\yoko + \else \let\@tempa\utod + \fi + \insert\footins{\@tempa% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}} +\def\@footnotemark{\leavevmode + \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi + \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark + \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi + \ifhmode\spacefactor\@x@sf\fi\relax} \def\@setref#1#2#3{% \ifx#1\relax \protect\G@refundefinedtrue @@ -169,7 +208,6 @@ \verb@eol@error \let\do\@makeother \dospecials \verbatim@font\@noligs \@ifstar\@sverb\@verb} -\def\@makefnmark{\hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}} \fi \gdef\@stopfield{\null\color@endgroup\egroup} \newcount\hour diff --git a/src/patches/lltjfont.sty b/src/patches/lltjfont.sty index 48c8857..3c7ad64 100644 --- a/src/patches/lltjfont.sty +++ b/src/patches/lltjfont.sty @@ -360,14 +360,14 @@ \newdimen\adjust@dimen \def\adjustbaseline{% \setbox\adjust@box\hbox{% - \ltj@ykblshift=0 \ltj@tkblshift=0あ}% + \ltj@ykblshift=0 \ltj@tkblshift=0漢}% \cht\ht\adjust@box \cdp\dp\adjust@box \cwd\wd\adjust@box \cvs\normalbaselineskip \chs\cwd \cHT\cht \advance\cHT\cdp - \setbox0\hbox{\tate\ltj@tkblshift=0 あ}% + \setbox0\hbox{\tate\ltj@tkblshift=0漢}% \setbox\adjust@box\hbox{\tate\ltj@tablshift=0 M}% \adjust@dimen\ht\adjust@box \advance\adjust@dimen\dp\adjust@box -- 2.11.0