OSDN Git Service

lltjext.sty: bugfix (\@startpbox was accidentaly set to \relax)
[luatex-ja/luatexja.git] / src / lltjext.sty
index a3bd9bc..0624b4f 100644 (file)
@@ -3,9 +3,9 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjext}[2017/04/06 v1.2f-ltj-5 Macros for vertical writing]
+\ProvidesPackage{lltjext}[2017/05/05 v1.2g-ltj-5 Macros for vertical writing]
 \RequirePackage{luatexja}
-
+\newcount\ltj@ext@dir
 {\catcode`\*=11
 \global\let\ltj@lltjext@orig@tabularS=\tabular*
 }%
 %%% array and tabular
 \def\array{\let\@acol\@arrayacol \let\@classz\@arrayclassz
  \let\@classiv\@arrayclassiv
- \let\\\@arraycr\let\@halignto\@empty\X@tabarray}
+ \let\\\@arraycr\let\@halignto\@empty
+ \ltj@ext@dir=\ltjgetparameter{direction}\relax\X@tabarray}
 \def\tabular{\let\@halignto\@empty\X@tabular}
 \@namedef{tabular*}{\@ifnextchar<%>
-   {\@stabular}{\@stabular<Z>}}
+   {\@stabular}{\@stabular<z>}}
 \def\X@tabarray{\@ifnextchar<%>
-   {\p@tabarray}{\p@tabarray<Z>}}
+   {\p@tabarray}{\p@tabarray<z>}}
 \def\X@tabular{\@ifnextchar<%>
-   {\p@tabular}{\p@tabular<Z>}}
+   {\p@tabular}{\p@tabular<z>}}
 \def\@stabular<#1>#2{%
    \setlength\dimen@{#2}%
    \edef\@halignto{to\the\dimen@}\p@tabular<#1>}
 \def\p@tabular<#1>{\leavevmode \hbox \bgroup 
-   \count@=\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[%]
@@ -36,7 +37,7 @@
 \def\p@array<#1>[#2]#3{%
   \let\box@dir\relax
   \if #1z\relax
-    \ifnum\count@=3\relax
+    \ifnum\ltj@ext@dir=3\relax
       \let\box@dir\utod\@tempcnta=\zstrutbox
     \fi
   \else
@@ -51,7 +52,7 @@
     \fi\fi\fi\fi
   \fi
   \ifx\box@dir\relax
-    \ifcase\count@
+    \ifcase\ltj@ext@dir
        \or   \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou
        \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
        \or   \let\box@dir\yoko\@tempcnta=\ystrutbox% yoko
@@ -65,7 +66,8 @@
   \fork@array@option<#1>[#2]%
   \@mkpream{#3}\edef\@preamble{\ialign \noexpand\@halignto
   \bgroup\@arstrut \@preamble \tabskip\z@skip \cr}%
-   \let\tabularnewline\\%
+  \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+  \let\tabularnewline\\%
   \@begin@alignbox\bgroup\box@dir\adjustbaseline
     \let\par\@empty
     \let\@sharp##\let\protect\relax
 }
 
 %%% pbox
-\def\pbox{\leavevmode\@ifnextchar<{\X@makePbox}{\X@makePbox<Z>}}
+\DeclareRobustCommand\pbox{\leavevmode\@ifnextchar<{\X@makePbox}{\X@makePbox<Z>}}
 \def\X@makePbox<#1>{%
   \@ifnextchar[{\@imakePbox<#1>}{\@imakePbox<#1>[-5\p@]}}
 \def\@imakePbox<#1>[#2]{\@ifnextchar[%]
        \else \let\box@dir\utod
     \fi
   \fi
-    \ifdim #2 <\z@ \hbox{\box@dir#4}\else
-    \hbox to#2{\box@dir
+    \setlength{\@tempdima}{#2}%
+    \ifdim\@tempdima<\z@ \hbox{\box@dir#4}\else
+    \hb@xt@\@tempdima{\box@dir
                \if #3l\relax\else\hss\fi
                #4\relax
                \if #3r\relax\else\hss\fi}\fi\egroup}
 
 \def\ltj@lltjext@patch@array{%
   \patchcmd{\@tabular}{\hbox\bgroup}{%
-       \hbox\bgroup\count@=\ltjgetparameter{direction}}{}{}
+       \hbox\bgroup\ltj@ext@dir=\ltjgetparameter{direction}}{}{}
+  \pretocmd{\@array}%
+       {\ltj@ext@dir=\ltjgetparameter{direction}\relax}{}{}
   \def\@startpbox##1{\bgroup
    \box@dir\adjustbaseline%%% これを追加
-   \hsize=##1\@arrayparboxrestore
+   \setlength\hsize{##1}\@arrayparboxrestore
      \everypar{%
         \vrule \@height \ltjgetht\@arstrutbox \@width \z@
         \everypar{}}%
      }
-  \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}}
+  \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<z>}}
   \def\p@array<##1>[##2]##3{%
     \let\box@dir\relax
     \if ##1z\relax
-      \ifnum\count@=3\relax
+      \ifnum\ltj@ext@dir=3\relax
         \let\box@dir\utod\@tempcnta=\zstrutbox
       \fi
     \else
       \fi\fi\fi\fi
     \fi
     \ifx\box@dir\relax
-      \ifcase\count@
+      \ifcase\ltj@ext@dir
          \or   \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou
          \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
          \or   \let\box@dir\yoko\@tempcnta=\ystrutbox% yoko