OSDN Git Service

lltjext.sty: platex/#77
[luatex-ja/luatexja.git] / src / lltjext.sty
index 4cf1978..b0796ac 100644 (file)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjext}[2017/08/27 v1.2g-ltj-8 Macros for vertical writing]
+\ProvidesPackage{lltjext}[2018/09/21 v1.2j-ltj-9 Macros for vertical writing]
 \RequirePackage{luatexja}
 \newcount\ltj@ext@dir
 {\catcode`\*=11
  \ltj@ext@dir=\ltjgetparameter{direction}\relax\X@tabarray}
 \def\tabular{\let\@halignto\@empty\X@tabular}
 \@namedef{tabular*}{\@ifnextchar<%>
-   {\@stabular}{\@stabular<Z>}}
+   {\p@stabular}{\p@stabular<Z>}}
 \def\X@tabarray{\@ifnextchar<%>
    {\p@tabarray}{\p@tabarray<Z>}}
 \def\X@tabular{\@ifnextchar<%>
    {\p@tabular}{\p@tabular<Z>}}
-\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[%]
    {\p@array<#1>}{\p@array<#1>[c]}}
 
 \def\p@array<#1>[#2]#3{%
+  \fork@array@option<#1>[#2]\@begin@alignbox
   \let\box@dir\relax
   \if #1z\relax
     \ifnum\ltj@ext@dir=3\relax
        \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod
     \fi
   \fi
+  \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
   \@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
 \def\boutenchar{\char\euc"A1A2}%"
 \def\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
         \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{%
       \let\\\@arraycr\let\tabularnewline\\\let\par\@empty
      \lineskip\z@skip\baselineskip\z@skip\@preamble}
   \def\endarray{\crcr\egroup\egroup\@end@alignbox\@arrayright}
+  \@namedef{tabular*}{\@ifnextchar<{\p@stabular}{\p@stabular<Z>}}%>
+  \def\p@stabular<##1>##2{%
+    \setlength\dimen@{##2}%
+    \edef\@halignto{to\the\dimen@}\@tabular<##1>}
 }
 
 \@ifpackageloaded{array}{%