X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Flltjext.sty;h=9e1421b130c111950c8f9b463eaa047587ad23b8;hb=b0e23554957e57c3bbafa1ac664319e4f4af249b;hp=4cf19785ac7b83615646c59acddd60d627506233;hpb=8026750951bcca08fcfeaf623e913fcd6ecf2b94;p=luatex-ja%2Fluatexja.git diff --git a/src/lltjext.sty b/src/lltjext.sty index 4cf1978..9e1421b 100644 --- a/src/lltjext.sty +++ b/src/lltjext.sty @@ -3,12 +3,9 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjext}[2017/08/27 v1.2g-ltj-8 Macros for vertical writing] +\ProvidesPackage{lltjext}[2019/09/25 v1.2k-ltj-11 Macros for vertical writing] \RequirePackage{luatexja} \newcount\ltj@ext@dir -{\catcode`\*=11 -\global\let\ltj@lltjext@orig@tabularS=\tabular* -}% \let\ltj@lltjext@orig@tabular=\tabular \let\ltj@lltjext@orig@array=\array @@ -19,16 +16,20 @@ \ltj@ext@dir=\ltjgetparameter{direction}\relax\X@tabarray} \def\tabular{\let\@halignto\@empty\X@tabular} \@namedef{tabular*}{\@ifnextchar<%> - {\@stabular}{\@stabular}} + {\p@stabular}{\p@stabular}} +{\catcode`\*=11 +\global\let\ltj@lltjext@orig@tabularS=\tabular* +}% \def\X@tabarray{\@ifnextchar<%> {\p@tabarray}{\p@tabarray}} \def\X@tabular{\@ifnextchar<%> {\p@tabular}{\p@tabular}} -\def\@stabular<#1>#2{% +\def\p@stabular<#1>#2{% \setlength\dimen@{#2}% \edef\@halignto{to\the\dimen@}\p@tabular<#1>} \def\p@tabular<#1>{\leavevmode \hbox \bgroup - \ltj@ext@dir=\ltjgetparameter{direction}$\let\@acol\@tabacol + \ltj@ext@dir=\ltjgetparameter{direction} + $\let\@acol\@tabacol \let\@classz\@tabclassz \let\@classiv\@tabclassiv \let\\\@tabularcr\p@tabarray<#1>} \def\p@tabarray<#1>{\m@th\@ifnextchar[%] @@ -59,19 +60,22 @@ \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod \fi \fi + \fork@array@option<#1>[#2]\@begin@alignbox + \bgroup\box@dir\adjustbaseline \setbox\@arstrutbox\hbox{% \box@dir \vrule\@height\arraystretch\ltjgetht\@tempcnta \@depth\arraystretch\ltjgetdp\@tempcnta \@width\z@}% - \fork@array@option<#1>[#2]% \@mkpream{#3}\edef\@preamble{\ialign \noexpand\@halignto \bgroup\@arstrut \@preamble \tabskip\z@skip \cr}% \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox \let\tabularnewline\\% - \@begin@alignbox\bgroup\box@dir\adjustbaseline \let\par\@empty - \let\@sharp##\let\protect\relax - \lineskip\z@skip\baselineskip\z@skip\@preamble} + \let\@sharp##% + \set@typeset@protect + \lineskip\z@skip\baselineskip\z@skip + \ifhmode \@preamerr\z@ \@@par\fi + \@preamble} \def\endarray{\crcr\egroup\egroup\@end@alignbox} \def\endtabular{\endarray$\egroup} \expandafter \let \csname endtabular*\endcsname = \endtabular @@ -192,18 +196,18 @@ }\hrule width\floatwidth height\floatruletick depth\z@}} \def\DeclareLayoutCaption#1<#2>(#3)[#4#5]{% \expandafter - \ifx\csname #1@layoutcaption\endcsname\relax \else + \ifx\csname #1@layoutc@ption\endcsname\relax \else \@latex@info{Redeclaring capiton layout setting of '#1'}% \fi \expandafter - \gdef\csname #1@layoutcaption\endcsname{% + \gdef\csname #1@layoutc@ption\endcsname{% \if Z\caption@dir\def\caption@dir{#2}\fi \ifdim\captionwidth=\z@ \captionwidth=#3\relax\fi \if Z\caption@posa\def\caption@posa{#4}\fi \if Z\caption@posb\def\caption@posb{#5}\fi}} \@onlypreamble\DeclareLayoutCaption -\DeclareLayoutCaption{figure}(.8\linewidth)[cd] -\DeclareLayoutCaption{table}(.8\linewidth)[cu] +\DeclareLayoutCaption{figure}(.8\linewidth)[cd] +\DeclareLayoutCaption{table}(.8\linewidth)[cu] \def\layoutcaption{\def\caption@dir{Z}\captionwidth\z@ \def\caption@posa{Z}\def\caption@posb{Z}% \@ifnextchar<\X@layoutcaption{% @@ -216,12 +220,21 @@ \@ifnextchar[{\@iilayoutcaption}{\relax}} \def\@iilayoutcaption[#1#2]{% \def\caption@posa{#1}\def\caption@posb{#2}} -\def\pcaption{\refstepcounter\@captype \@dblarg{\@pcaption\@captype}} +\def\pcaption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\pcaption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@pcaption\@captype}}% +} \long\def\@pcaption#1[#2]#3{% \addcontentsline{\csname ext@#1\endcsname}{#1}{% \protect\numberline{\csname the#1\endcsname}{\ignorespaces#2}}% \ifvoid\@floatbox - \latex@error{Use with `\protect\layoutfloat'.}\@eha + \@latex@error{Use \noexpand\pcaption with `\protect\layoutfloat'}\@eha \fi \make@pcaptionbox{#3}% \@pboxswfalse @@ -229,22 +242,23 @@ \if l\caption@posb\box\@captionbox\kern\captionfloatsep\fi \if t\caption@posa\vtop \else\if b\caption@posa\vbox - \else\ifmmode\vcenter \else\@pboxswtrue $\vcenter \fi\fi\fi + \else\@pboxswtrue $\vcenter \fi\fi {\if u\caption@posb\box\@captionbox\kern\captionfloatsep\fi \unvbox\@floatbox \if d\caption@posb\kern\captionfloatsep\box\@captionbox\fi}% + \if@pboxsw \m@th$\fi \if r\caption@posb\kern\captionfloatsep\box\@captionbox\fi - \if@pboxsw \m@th$\fi \if r\float@pos\else\hss\fi}}% + \if r\float@pos\else\hss\fi}}% \par\vskip.25\baselineskip \box\@tempboxa} \def\make@pcaptionbox#1{% \expandafter - \ifx\csname\@captype @layoutcaption\endcsname\relax + \ifx\csname\@captype @layoutc@ption\endcsname\relax \@latex@warning{Default caption layout of `\@captype' unknown.}% \def\caption@dir{Z}\captionwidth\z@ \def\caption@posa{Z}\def\caption@posb{Z}% \else - \csname \@captype @layoutcaption\endcsname + \csname \@captype @layoutc@ption\endcsname \fi \@tempswafalse % \@tempswa: 基本組の組方向とキャプションの組方向が直交するか? @@ -262,7 +276,8 @@ \setbox0\hbox{\hbox{\captiondir \captionfontsetup\parindent\z@\inhibitglue \csname fnum@\@captype\endcsname  #1}}%" - \if@tempswa\@tempdima\ltjgetht0\relax\else\@tempdima\ltjgetwd0\relax\fi + \if@tempswa\@tempdima\ltjgetht0 \advance\@tempdima\ltjgetdp0 + \else\@tempdima\ltjgetwd0 \fi \ifdim\@tempdima>\captionwidth \@tempdima\captionwidth \fi \@pboxswfalse \setbox0\hbox{% @@ -616,9 +631,9 @@ %%% bou %%% \def\boutenchar{\char\euc"A1A2}%" -\def\bou#1{\ifvmode\leavevmode\fi\@bou#1\end} +\DeclareRobustCommand\bou[1]{\ifvmode\leavevmode\fi\@bou#1\end} \def\@bou#1{% - \ifx#1\end \let\next=\relax + \ifx#1\end \let\ltj@@next=\relax \else \ifnum\ltjgetparameter{direction}=3\relax \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen @@ -629,11 +644,11 @@ \vss\moveleft-0.2\zw\hbox{\boutenchar}\nointerlineskip \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax \fi - \let\next=\@bou - \fi\next} + \let\ltj@@next=\@bou + \fi\ltj@@next} %%% kasen -\def\kasen#1{% +\DeclareRobustCommand\kasen[1]{% \ifnum\ltjgetparameter{direction}=3\relax \setbox\z@\hbox{#1}\leavevmode\raise.7\zw \hbox to\z@{\vrule\@width\wd\z@ \@depth\z@ \@height.4\p@\hss}% @@ -654,13 +669,29 @@ \hbox\bgroup\ltj@ext@dir=\ltjgetparameter{direction}}{}{} \pretocmd{\array}% {\ltj@ext@dir=\ltjgetparameter{direction}\relax}{}{} + \expandafter\let\csname tabular*\endcsname=\ltj@lltjext@orig@tabularS + \patchcmd{\p@stabular}{\p@tabular}{\@tabular}{}{} + \@ifpackagelater{array}{2018/09/13} + {\expandafter\@firstoftwo} + {\expandafter\@secondoftwo} + {% = for 2018/09/13 v2.4i or newer \def\@startpbox##1{\bgroup - \box@dir\adjustbaseline%%% これを追加 - \setlength\hsize{##1}\@arrayparboxrestore - \everypar{% - \vrule \@height \ltjgetht\@arstrutbox \@width \z@ - \everypar{}}% - } + \color@begingroup + \box@dir\adjustbaseline%%% これを追加 + \setlength\hsize{##1}\@arrayparboxrestore + \everypar{% + \vrule \@height \ltjgetht\@arstrutbox \@width \z@ + \everypar{}}% + }% + }{ % = for 2018/04/30 v2.4h or older + \def\@startpbox##1{\bgroup + \box@dir\adjustbaseline%%% これを追加 + \setlength\hsize{##1}\@arrayparboxrestore + \everypar{% + \vrule \@height \ltjgetht\@arstrutbox \@width \z@ + \everypar{}}% + }% + }% \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray}} \def\p@array<##1>[##2]##3{% \let\box@dir\relax @@ -709,12 +740,10 @@ } \@ifpackageloaded{array}{% - \expandafter\let\csname tabular*\endcsname=\ltj@lltjext@orig@tabularS \let\tabular=\ltj@lltjext@orig@tabular \let\array=\ltj@lltjext@orig@array \ltj@lltjext@patch@array }{% - \let\ltj@lltjext@orig@tabularS\relax \let\ltj@lltjext@orig@tabular\relax \let\ltj@lltjext@orig@array\relax \RequirePackage{filehook,etoolbox}