OSDN Git Service

lltjext.sty: save \tabular*
[luatex-ja/luatexja.git] / src / lltjext.sty
index 8ce37b7..79030f7 100644 (file)
@@ -3,10 +3,12 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjext}
-   [2014/09/06 v1.2-ltj-3 Macros for vertical writing]
+\ProvidesPackage{lltjext}[2015/09/18 v1.2-ltj-4 Macros for vertical writing]
 \RequirePackage{luatexja}
 
+{\catcode`\*=11
+\global\let\ltj@lltjext@orig@tabularS=\tabular*
+}%
 \let\ltj@lltjext@orig@tabular=\tabular
 \let\ltj@lltjext@orig@array=\array
 
@@ -22,7 +24,8 @@
 \def\X@tabular{\@ifnextchar<%>
    {\p@tabular}{\p@tabular<Z>}}
 \def\@stabular<#1>#2{\def\@halignto{to#2}\p@tabular<#1>}
-\def\p@tabular<#1>{\leavevmode \hbox \bgroup $\let\@acol\@tabacol
+\def\p@tabular<#1>{\leavevmode \hbox \bgroup 
+   \count@=\ltjgetparameter{direction}$\let\@acol\@tabacol
    \let\@classz\@tabclassz
    \let\@classiv\@tabclassiv \let\\\@tabularcr\p@tabarray<#1>}
 \def\p@tabarray<#1>{\m@th\@ifnextchar[%]
@@ -46,7 +49,7 @@
     \fi\fi\fi\fi
   \fi
   \ifx\box@dir\relax
-    \ifcase\ltjgetparameter{direction}
+    \ifcase\count@
        \or   \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou
        \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
        \or   \let\box@dir\yoko\@tempcnta=\strutbox% yoko
 %%% kanji
 \def\Kanji#1{\expandafter\@Kanji\csname c@#1\endcsname}
 \def\@Kanji#1{\expandafter\kansuji\number #1}
-\def\kanji{\iftdir\expandafter\kansuji\fi}
+\def\kanji{\ifnum\ltjgetparameter{direction}=3 \expandafter\kansuji\fi}
 
 %%% bou
 %%%
       \let\@sharp####\let\protect\relax
       \let\\\@arraycr\let\tabularnewline\\\let\par\@empty
      \lineskip\z@skip\baselineskip\z@skip\@preamble}
-  \def\endarray{\crcr\egroup\egroup\@end@alignbox}
+  \def\endarray{\crcr\egroup\egroup\@end@alignbox\@arrayright}
 }
 
 \@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}
 }
 
 
-\endinput
\ No newline at end of file
+\endinput