2 % lltjext.sty: derived from plext.sty in pLaTeX.
4 \NeedsTeXFormat{LaTeX2e}
5 \ProvidesPackage{lltjext}
6 [2014/08/11 v1.2-ltj-2 Macros for vertical writing]
7 \RequirePackage{luatexja}
9 \let\ltj@lltjext@orig@tabular=\tabular
10 \let\ltj@lltjext@orig@array=\array
13 \def\array{\let\@acol\@arrayacol \let\@classz\@arrayclassz
14 \let\@classiv\@arrayclassiv
15 \let\\\@arraycr\let\@halignto\@empty\X@tabarray}
16 \def\tabular{\let\@halignto\@empty\X@tabular}
17 \@namedef{tabular*}{\@ifnextchar<%>
18 {\@stabular}{\@stabular<Z>}}
19 \def\X@tabarray{\@ifnextchar<%>
20 {\p@tabarray}{\p@tabarray<Z>}}
21 \def\X@tabular{\@ifnextchar<%>
22 {\p@tabular}{\p@tabular<Z>}}
23 \def\@stabular<#1>#2{\def\@halignto{to#2}\p@tabular<#1>}
24 \def\p@tabular<#1>{\leavevmode \hbox \bgroup $\let\@acol\@tabacol
25 \let\@classz\@tabclassz
26 \let\@classiv\@tabclassiv \let\\\@tabularcr\p@tabarray<#1>}
27 \def\p@tabarray<#1>{\m@th\@ifnextchar[%]
28 {\p@array<#1>}{\p@array<#1>[c]}}
30 \def\p@array<#1>[#2]#3{%
33 \ifnum\ltjgetparameter{direction}=3\relax
34 \let\box@dir\utod\@tempcnta=\zstrutbox
38 \let\box@dir\yoko\@tempcnta=\strutbox
40 \let\box@dir\tate\@tempcnta=\tstrutbox
42 \let\box@dir\dtou\@tempcnta=\dstrutbox
44 \let\box@dir\utod\@tempcnta=\zstrutbox
48 \ifcase\ltjgetparameter{direction}
49 \or \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou
50 \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
51 \or \let\box@dir\yoko\@tempcnta=\strutbox% yoko
52 \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod
55 \setbox\@arstrutbox\hbox{%
57 \vrule\@height\arraystretch\ltjgetht\@tempcnta
58 \@depth\arraystretch\ltjgetdp\@tempcnta \@width\z@}%
59 \fork@array@option<#1>[#2]%
60 \@mkpream{#3}\edef\@preamble{\ialign \noexpand\@halignto
61 \bgroup\@arstrut \@preamble \tabskip\z@skip \cr}%
62 \let\tabularnewline\\%
63 \@begin@alignbox\bgroup\box@dir\adjustbaseline
65 \let\@sharp##\let\protect\relax
66 \lineskip\z@skip\baselineskip\z@skip\@preamble}
67 \def\endarray{\crcr\egroup\egroup\@end@alignbox}
68 \def\endtabular{\endarray$\egroup}
69 \expandafter \let \csname endtabular*\endcsname = \endtabular
70 \def\fork@array@option<#1>[#2]{%
71 \ifnum\ltjgetparameter{direction}=4 % yoko
74 \let\@begin@alignbox\vtop
75 \let\@end@alignbox\relax
77 \let\@begin@alignbox\vbox
78 \let\@end@alignbox\relax
80 \let\@begin@alignbox\vcenter
81 \let\@end@alignbox\relax
85 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
86 \def\@end@alignbox{\egroup}%
88 \let\@begin@alignbox\vbox
89 \let\@end@alignbox\relax
91 \let\@begin@alignbox\vcenter
92 \let\@end@alignbox\relax
95 \else\ifnum\ltjgetparameter{direction}=1 % dtou
98 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
99 \def\@end@alignbox{\egroup}%
101 \let\@begin@alignbox\vbox
102 \let\@end@alignbox\relax
104 \let\@begin@alignbox\vcenter
105 \let\@end@alignbox\relax
107 \else\ifx\box@dir\dtou
109 \let\@begin@alignbox\vtop
110 \let\@end@alignbox\relax
112 \let\@begin@alignbox\vbox
113 \let\@end@alignbox\relax
115 \let\@begin@alignbox\vcenter
116 \let\@end@alignbox\relax
118 \else % 180 度回転→vtop, vbox を入れ替える
120 \let\@begin@alignbox\vbox %%% !!!
121 \let\@end@alignbox\relax
123 \let\@begin@alignbox\vtop %%% !!!
124 \let\@end@alignbox\relax
126 \let\@begin@alignbox\vcenter
127 \let\@end@alignbox\relax
133 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
134 \def\@end@alignbox{\egroup}%
136 \def\@begin@alignbox{\vbox\bgroup\vbox}%
137 \def\@end@alignbox{\kern\z@\egroup}%
139 \let\@begin@alignbox\vcenter
140 \let\@end@alignbox\relax
142 \else\ifx\box@dir\dtou % 180 度回転→vtop, vbox を入れ替える
144 \let\@begin@alignbox\vbox %%% !!!
145 \let\@end@alignbox\relax
147 \let\@begin@alignbox\vtop %%% !!!
148 \let\@end@alignbox\relax
150 \let\@begin@alignbox\vcenter
151 \let\@end@alignbox\relax
155 \let\@begin@alignbox\vtop
156 \let\@end@alignbox\relax
158 \let\@begin@alignbox\vbox
159 \let\@end@alignbox\relax
161 \let\@begin@alignbox\vcenter
162 \let\@end@alignbox\relax
171 \newdimen\floatheight
172 \newdimen\floatruletick \floatruletick=0.4pt
173 \newdimen\captionfloatsep \captionfloatsep=10pt
175 \let\captiondir\relax
176 \newdimen\captionwidth \captionwidth\z@
180 \def\captionfontsetup{\normalfont\normalsize}
181 \def\layoutfloat{\@ifnextchar(%)
182 {\X@layoutfloat}{\X@layoutfloat(-5\p@,-5\p@)}}
183 \def\X@layoutfloat(#1,#2){\@ifnextchar[%]
184 {\@layoutfloat(#1,#2)}{\@layoutfloat(#1,#2)[c]}}
185 \long\def\@layoutfloat(#1,#2)[#3]#4{%
187 \floatwidth=#1 \floatheight=#2 \edef\float@pos{#3}%
188 \ifdim\floatwidth<\z@
189 \floatwidth\ltjgetwd\z@\floatruletick\z@
191 \ifdim\floatheight<\z@
192 \floatheight\ltjgetht\z@\advance\floatheight\ltjgetdp\z@\relax
195 \setbox\@floatbox\vbox to\floatheight{\offinterlineskip
196 \hrule width\floatwidth height\floatruletick depth\z@
197 \vss\hbox to\floatwidth{%
198 \vrule width\floatruletick height\floatheight depth\z@
199 \hss\vbox to\floatheight{\hsize\floatwidth\vss#4\vss}\hss
200 \vrule width\floatruletick height\floatheight depth\z@
201 }\hrule width\floatwidth height\floatruletick depth\z@}}
202 \def\DeclareLayoutCaption#1<#2>(#3)[#4#5]{%
204 \ifx\csname #1@layoutcaption\endcsname\relax \else
205 \@latex@info{Redeclaring capiton layout setting of '#1'}%
208 \gdef\csname #1@layoutcaption\endcsname{%
209 \if Z\caption@dir\def\caption@dir{#2}\fi
210 \ifdim\captionwidth=\z@ \captionwidth=#3\relax\fi
211 \if Z\caption@posa\def\caption@posa{#4}\fi
212 \if Z\caption@posb\def\caption@posb{#5}\fi}}
213 \@onlypreamble\DeclareLayoutCaption
214 \DeclareLayoutCaption{figure}<y>(.8\linewidth)[cd]
215 \DeclareLayoutCaption{table}<y>(.8\linewidth)[cu]
216 \def\layoutcaption{\def\caption@dir{Z}\captionwidth\z@
217 \def\caption@posa{Z}\def\caption@posb{Z}%
218 \@ifnextchar<\X@layoutcaption{%
219 \@ifnextchar(\@ilayoutcaption{%
220 \@ifnextchar[\@iilayoutcaption\relax}}}
221 \def\X@layoutcaption<#1>{\def\caption@dir{#1}%
222 \@ifnextchar(\@ilayoutcaption{%
223 \@ifnextchar[\@iilayoutcaption\relax}}
224 \def\@ilayoutcaption(#1){\setlength\captionwidth{#1}%
225 \@ifnextchar[{\@iilayoutcaption}{\relax}}
226 \def\@iilayoutcaption[#1#2]{%
227 \def\caption@posa{#1}\def\caption@posb{#2}}
228 \def\pcaption{\refstepcounter\@captype \@dblarg{\@pcaption\@captype}}
229 \long\def\@pcaption#1[#2]#3{%
230 \addcontentsline{\csname ext@#1\endcsname}{#1}{%
231 \protect\numberline{\csname the#1\endcsname}{\ignorespaces#2}}%
233 \latex@error{Use with `\protect\layoutfloat'.}\@eha
235 \make@pcaptionbox{#3}%
237 \setbox\@tempboxa\vbox{\hbox to\hsize{\if l\float@pos\else\hss\fi
238 \if l\caption@posb\box\@captionbox\kern\captionfloatsep\fi
239 \if t\caption@posa\vtop
240 \else\if b\caption@posa\vbox
241 \else\ifmmode\vcenter \else\@pboxswtrue $\vcenter \fi\fi\fi
242 {\if u\caption@posb\box\@captionbox\kern\captionfloatsep\fi
244 \if d\caption@posb\kern\captionfloatsep\box\@captionbox\fi}%
245 \if r\caption@posb\kern\captionfloatsep\box\@captionbox\fi
246 \if@pboxsw \m@th$\fi \if r\float@pos\else\hss\fi}}%
247 \par\vskip.25\baselineskip
249 \def\make@pcaptionbox#1{%
251 \ifx\csname\@captype @layoutcaption\endcsname\relax
252 \@latex@warning{Default caption layout of `\@captype' unknown.}%
253 \def\caption@dir{Z}\captionwidth\z@
254 \def\caption@posa{Z}\def\caption@posb{Z}%
256 \csname \@captype @layoutcaption\endcsname
259 % tempswa\hline 基本組の組方向とキャプションの組方向が直交するか?
260 \if y\caption@dir \let\captiondir\yoko
261 \ifodd\ltjgetparameter{direction}\relax\@tempswatrue\fi
262 \else\if z\caption@dir \let\captiondir\relax
263 \ifnum\ltjgetparameter{direction}=3\relax\let\captiondir\utod\fi
264 \else\if d\caption@dir \let\captiondir\dtou
265 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
266 \else\if u\caption@dir \let\captiondir\utod
267 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
268 \else\if t\caption@dir \let\captiondir\tate
269 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
271 \setbox0\hbox{\hbox{\captiondir
272 \captionfontsetup\parindent\z@\inhibitglue
273 \csname fnum@\@captype\endcsname #1}}%"
274 \if@tempswa\@tempdima\ltjgetht0\relax\else\@tempdima\ltjgetwd0\relax\fi
275 \ifdim\@tempdima>\captionwidth \@tempdima\captionwidth \fi
278 \if u\caption@posb\vbox
279 \else\if d\caption@posb\vbox
280 \else\if t\caption@posa\vtop
281 \else\if b\caption@posa\vbox
282 \else\ifmmode\vcenter\else\@pboxswtrue $\vcenter\fi
284 {\hsize\@tempdima\kern\z@
285 \vbox{\captiondir\hsize\@tempdima
286 \captionfontsetup\parindent\z@\inhibitglue
287 \csname fnum@\@captype\endcsname #1}\kern\z@
288 }\if@pboxsw \m@th$\fi}%
289 \let\to@captionboxwidth\relax
290 \if l\caption@posb \else\if r\caption@posb\else
291 \def\to@captionboxwidth{to\floatwidth}\fi\fi
292 \setbox\@captionbox\hbox\to@captionboxwidth{%
293 \if t\caption@posa\else\hss\fi
295 \if b\caption@posa\else\hss\fi}}
297 %%% minipage and parbox
298 \def\minipage{\@ifnextchar<%>
299 {\X@minipage}{\X@minipage<Z>}}
300 \def\X@minipage<#1>{\@ifnextchar[%]
301 {\@iminipage<#1>}{\@iiiminipage<#1>{c}\@empty[s]}}
302 \def\@iminipage<#1>[#2]{\@ifnextchar[%]
303 {\@iiminipage<#1>{#2}}{\@iiiminipage<#1>{#2}\@empty[s]}}
304 \def\@iiminipage<#1>#2[#3]{\@ifnextchar[%]
305 {\@iiiminipage<#1>{#2}{#3}}{\@iiiminipage<#1>{#2}{#3}[#2]}}
306 \def\@iiiminipage<#1>#2#3[#4]#5{%
308 \setlength\@tempdima{#5}%
309 \def\@mpargs{<#1>{#2}{#3}[#4]{#5}}%
312 \ifnum\ltjgetparameter{direction}=3\relax
316 \if #1y\relax \let\box@dir\yoko
317 \else\if #1t\relax\let\box@dir\tate
318 \else\if #1d\relax\let\box@dir\dtou
319 \else\if #1u\relax\let\box@dir\utod
323 \ifcase\ltjgetparameter{direction}\relax
324 \or \let\box@dir\dtou
325 \or\or\let\box@dir\tate
326 \or \let\box@dir\yoko
327 \else \let\box@dir\utod
330 \setbox\@tempboxa\vbox\bgroup\box@dir
334 \textwidth\hsize \columnwidth\hsize
336 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}%
338 \let\@footnotetext\@mpfootnotetext
339 \let\@listdepth\@mplistdepth \@mplistdepth\z@
341 \global\@minipagetrue %% \global added 24 May 89
342 \everypar{\global\@minipagefalse\everypar{}}}
346 \ifvoid\@mpfootins\else
347 \vskip\skip\@mpfootins
352 \global\@minipagefalse %% added 24 May 89
355 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}\egroup}
356 \def\parbox{\@ifnextchar<%>
357 {\X@parbox}{\X@parbox<Z>}}
358 \def\X@parbox<#1>{\@ifnextchar[%]
359 {\@iparbox<#1>}{\@iiiparbox<#1>{c}\@empty[s]}}
360 \def\@iparbox<#1>[#2]{\@ifnextchar[%]
361 {\@iiparbox<#1>{#2}}{\@iiiparbox<#1>{#2}\@empty[s]}}
362 \def\@iiparbox<#1>#2[#3]{\@ifnextchar[%]%
363 {\@iiiparbox<#1>{#2}{#3}}{\@iiiparbox<#1>{#2}{#3}[#2]}}
364 \long\def\@iiiparbox<#1>#2#3[#4]#5#6{%
366 \setlength\@tempdima{#5}%
367 \fork@parbox@option<#1>[#2]%
368 \@begin@tempboxa\vbox{\box@dir
369 \hsize\@tempdima\@parboxrestore\adjustbaseline#6\endgraf}%
370 \ifx\@empty#3\relax\else
371 \setlength\@tempdimb{#3}%
372 \def\@parboxto{to\@tempdimb}%
374 \@begin@parbox\@parboxto{\box@dir\adjustbaseline
375 \let\hss\vss\let\unhbox\unvbox
376 \csname bm@#4\endcsname}\@end@parbox
377 \@end@tempboxa\egroup}
378 \def\fork@parbox@option<#1>[#2]{%
381 \ifnum\ltjgetparameter{direction}=3\relax
385 \if #1y\relax \let\box@dir\yoko
386 \else\if #1t\relax\let\box@dir\tate
387 \else\if #1d\relax\let\box@dir\dtou
388 \else\if #1u\relax\let\box@dir\utod
392 \ifcase\ltjgetparameter{direction}\relax
393 \or \let\box@dir\dtou
394 \or\or\let\box@dir\tate
395 \or \let\box@dir\yoko
396 \else \let\box@dir\utod
399 %%% now almost same as \fork@array@option
400 \ifnum\ltjgetparameter{direction}=4 % yoko
403 \let\@begin@parbox\vtop
404 \let\@end@parbox\relax
406 \let\@begin@parbox\vbox
407 \let\@end@parbox\relax
409 \def\@begin@parbox{$\vcenter}%
410 \def\@end@parbox{\m@th$}%
414 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}%
415 \def\@end@parbox{\egroup}%
417 \let\@begin@parbox\vbox
418 \let\@end@parbox\relax
420 \def\@begin@parbox{$\vcenter}%
421 \def\@end@parbox{\m@th$}%
424 \else\ifnum\ltjgetparameter{direction}=1 % dtou
427 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}
428 \def\@end@parbox{\egroup}
430 \let\@begin@parbox\vbox
431 \let\@end@parbox\relax
433 \def\@begin@parbox{$\vcenter}%
434 \def\@end@parbox{\m@th$}%
436 \else\ifx\box@dir\dtou
438 \let\@begin@parbox\vtop
439 \let\@end@parbox\relax
441 \let\@begin@parbox\vbox
442 \let\@end@parbox\relax
444 \def\@begin@parbox{$\vcenter}%
445 \def\@end@parbox{\m@th$}%
447 \else % 180 度回転→vtop, vbox を入れ替える
449 \let\@begin@parbox\vbox %%% !!!
450 \let\@end@parbox\relax
452 \let\@begin@parbox\vtop %%% !!!
453 \let\@end@parbox\relax
455 \def\@begin@parbox{$\vcenter}%
456 \def\@end@parbox{\m@th$}%
462 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}%
463 \def\@end@parbox{\egroup}%
465 \def\@begin@parbox{\vbox\bgroup\vbox}%
466 \def\@end@parbox{\kern\z@\egroup}%
468 \def\@begin@parbox{$\vcenter}%
469 \def\@end@parbox{\m@th$}%
471 \else\ifx\box@dir\dtou % 180 度回転→vtop, vbox を入れ替える
473 \let\@begin@parbox\vbox %%% !!!
474 \let\@end@parbox\relax
476 \let\@begin@parbox\vtop %%% !!!
477 \let\@end@parbox\relax
479 \def\@begin@parbox{$\vcenter}%
480 \def\@end@parbox{\m@th$}%
484 \let\@begin@parbox\vtop
485 \let\@end@parbox\relax
487 \let\@begin@parbox\vbox
488 \let\@end@parbox\relax
490 \def\@begin@parbox{$\vcenter}%
491 \def\@end@parbox{\m@th$}%
498 \def\pbox{\leavevmode\@ifnextchar<{\X@makePbox}{\X@makePbox<Z>}}
499 \def\X@makePbox<#1>{%
500 \@ifnextchar[{\@imakePbox<#1>}{\@imakePbox<#1>[-5\p@]}}
501 \def\@imakePbox<#1>[#2]{\@ifnextchar[%]
502 {\@iimakePbox<#1>{#2}}{\@iimakePbox<#1>{#2}[c]}}
503 \def\@iimakePbox<#1>#2[#3]#4{%
504 \bgroup\let\box@dir\relax
506 \ifnum\ltjgetparameter{direction}=3 \relax
510 \if #1y\relax \let\box@dir\yoko
511 \else\if #1t\relax\let\box@dir\tate
512 \else\if #1d\relax\let\box@dir\dtou
513 \else\if #1u\relax\let\box@dir\utod
517 \ifcase\ltjgetparameter{direction}
518 \or \let\box@dir\dtou
519 \or\or\let\box@dir\tate
520 \or \let\box@dir\yoko
521 \else \let\box@dir\utod
524 \ifdim #2 <\z@ \hbox{\box@dir#4}\else
526 \if #3l\relax\else\hss\fi
528 \if #3r\relax\else\hss\fi}\fi\egroup}
531 \def\picture{\@ifnextchar<%>
532 {\X@picture}{\X@picture<Z>}}
533 \def\X@picture<#1>(#2,#3){\@ifnextchar(%)
534 {\@@picture<#1>(#2,#3)}{\@@picture<#1>(#2,#3)(0,0)}}
536 \def\ltj@@pic@reset@blshift{%
537 \ltj@yablshift\z@\ltj@ykblshift\z@
538 \ltj@tablshift\z@\ltj@tkblshift\z@
540 \def\@@picture<#1>(#2,#3)(#4,#5){%
541 \edef\ltj@@pic@save@blshift{%
542 \noexpand\ltj@yablshift\the\ltj@yablshift\noexpand\relax
543 \noexpand\ltj@ykblshift\the\ltj@ykblshift\noexpand\relax
544 \noexpand\ltj@tablshift\the\ltj@tablshift\noexpand\relax
545 \noexpand\ltj@tkblshift\the\ltj@tkblshift\noexpand\relax
547 \bgroup\let\box@dir\relax
549 \ifnum\ltjgetparameter{direction}=3 \relax
553 \if #1y\relax \let\box@dir\yoko
554 \else\if #1t\relax\let\box@dir\tate
555 \else\if #1d\relax\let\box@dir\dtou
556 \else\if #1u\relax\let\box@dir\utod
560 \ifcase\ltjgetparameter{direction}
561 \or \let\box@dir\dtou
562 \or\or\let\box@dir\tate
563 \or \let\box@dir\yoko
564 \else \let\box@dir\utod
567 \@picwd=#2\unitlength \@picht=#3\unitlength
568 \setbox\@picbox\hbox to\@picwd\bgroup\box@dir
569 \hskip-#4\unitlength\lower#5\unitlength\hbox\bgroup
570 \ltj@@pic@reset@blshift
574 \setbox0=\hbox{\box@dir%
575 \ltjsetht\@picbox\@picht \ltjsetdp\@picbox\z@
578 \ifnum\ltjgetparameter{direction}=3 \@tempswatrue\fi
579 \ifnum\ltjgetparameter{direction}=11 \@tempswatrue\fi
581 \ifx\box@dir\yoko % この場合だけ垂直位置補正が必要
582 \ltjsetht\@picbox\dimexpr\ltjgetht\@picbox+\ltjgetdp\@picbox\relax
587 \egroup\ltj@@pic@save@blshift}
589 \def\put{\ltj@@pic@reset@blshift\org@put}
591 \def\line{\ltj@@pic@reset@blshift\org@line}
592 \let\org@vector\vector
593 \def\vector{\ltj@@pic@reset@blshift\org@vector}
594 \let\org@dashbox\dashbox
595 \def\dashbox{\ltj@@pic@reset@blshift\org@dashbox}
597 \def\oval{\ltj@@pic@reset@blshift\org@oval}
598 \let\org@circle\circle
599 \def\circle{\ltj@@pic@reset@blshift\org@circle}
602 \newif\ifnot@advanceline
604 \rensujiskip=0.25\chs plus.25\zw minus.25\zw
605 \DeclareRobustCommand\rensuji{%
606 \@ifstar{\not@advancelinetrue\@rensuji}{\@rensuji}}
607 \def\@rensuji{\@ifnextchar[{\@@rensuji}{\@@rensuji[c]}}
608 \def\@@rensuji[#1]#2{\ifnum\ltjgetparameter{direction}=4\relax%
611 \ifvmode\leavevmode\fi
612 \ifnot@advanceline\not@advancelinefalse\else
613 \setbox\z@\hbox{\yoko#2}%
614 \@tempdima\ltjgetht\z@ \advance\@tempdima\ltjgetdp\z@
615 \ifnum\ltjgetparameter{direction}=1\relax
616 \if #1c\relax\vrule \@width \z@ \@height.5\@tempdima \@depth.5\@tempdima
617 \else\if #1l\relax\vrule\@width \z@\@height\z@ \@depth\@tempdima
618 \else\vrule\@width \z@ \@height\@tempdima \@depth\z@
621 \if #1c\relax\vrule \@width \z@ \@height.5\@tempdima \@depth.5\@tempdima
622 \else\if #1r\relax\vrule\@width \z@\@height\z@ \@depth\@tempdima
623 \else\vrule\@width \z@ \@height\@tempdima \@depth\z@
627 \ifnum\ltjgetparameter{direction}=1\relax
628 \if #1c\relax\hbox to\zw{\yoko\hss#2\hss}%
629 \else\if #1r\relax\vbox{\hbox to\zw{\yoko\hss#2}\kern\z@}%
630 \else\vtop{\kern\z@\hbox to\zw{\yoko#2\hss}}%
633 \if #1c\relax\hbox to\zw{\yoko\hss#2\hss}%
634 \else\if #1r\relax\vtop{\kern\z@\hbox to\zw{\yoko\hss#2}}%
635 \else\vbox{\hbox to\zw{\yoko #2\hss}\kern\z@}%
641 \let\prensuji\rensuji
644 \def\Kanji#1{\expandafter\@Kanji\csname c@#1\endcsname}
645 \def\@Kanji#1{\expandafter\kansuji\number #1}
646 \def\kanji{\iftdir\expandafter\kansuji\fi}
650 \def\boutenchar{\char\euc"A1A2}%"
651 \def\bou#1{\ifvmode\leavevmode\fi\@bou#1\end}
653 \ifx#1\end \let\next=\relax
655 \ifnum\ltjgetparameter{direction}=3\relax
656 \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
657 \vss\moveleft0.2\zw\hbox{\yoko\boutenchar}\nointerlineskip
658 \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
660 \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
661 \vss\moveleft-0.2\zw\hbox{\boutenchar}\nointerlineskip
662 \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
669 \ifnum\ltjgetparameter{direction}=3\relax
670 \setbox\z@\hbox{#1}\leavevmode\raise.7\zw
671 \hbox to\z@{\vrule\@width\wd\z@ \@depth\z@ \@height.4\p@\hss}%
673 \else\underline{#1}\fi}
676 \def\@eqnnum{{\reset@font\rmfamily \normalcolor
677 \ifnum\ltjgetparameter{direction}=3 \raise.25\zh\hbox{\yoko(\theequation)}%
678 \else (\theequation)\fi}}
679 \def\@thecounter#1{\noexpand\rensuji{\noexpand\arabic{#1}}}
680 \def\@thmcounter#1{\noexpand\rensuji{\noexpand\arabic{#1}}}
682 %% Compatibility with array package
684 \def\ltj@lltjext@patch@array{%
685 \def\@startpbox##1{\bgroup
686 \box@dir\adjustbaseline%%% これを追加
687 \hsize=##1\@arrayparboxrestore
689 \vrule \@height \ltjgetht\@arstrutbox \@width \z@
692 \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}}
693 \def\p@array<##1>[##2]##3{%
696 \ifnum\ltjgetparameter{direction}=3\relax
697 \let\box@dir\utod\@tempcnta=\zstrutbox
701 \let\box@dir\yoko\@tempcnta=\strutbox
703 \let\box@dir\tate\@tempcnta=\tstrutbox
705 \let\box@dir\dtou\@tempcnta=\dstrutbox
707 \let\box@dir\utod\@tempcnta=\zstrutbox
711 \ifcase\ltjgetparameter{direction}
712 \or \let\box@dir\dtou\@tempcnta=\tabskip \z@\tabskip \z@\dstrutbox% dtou
713 \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
714 \or \let\box@dir\yoko\@tempcnta=\strutbox% yoko
715 \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod
718 \setbox \@arstrutbox \hbox{\box@dir\vrule
719 \@height \arraystretch
720 \dimexpr \ltjgetht\@tempcnta+\extrarowheight\relax
721 \@depth \arraystretch \ltjgetdp \@tempcnta
723 \fork@array@option<##1>[##2]%
726 \xdef\@preamble{\ialign \noexpand \@halignto
727 \bgroup \tabskip \z@skip \@arstrut \@preamble
731 \@begin@alignbox\bgroup\box@dir\adjustbaseline
733 \let\@sharp####\let\protect\relax
734 \let\\\@arraycr\let\tabularnewline\\\let\par\@empty
735 \lineskip\z@skip\baselineskip\z@skip\@preamble}
736 \def\endarray{\crcr\egroup\egroup\@end@alignbox}
739 \@ifpackageloaded{array}{%
740 \let\tabular=\ltj@lltjext@orig@tabular
741 \let\array=\ltj@lltjext@orig@array
742 \ltj@lltjext@patch@array
744 \let\ltj@lltjext@orig@tabular\relax
745 \let\ltj@lltjext@orig@array\relax
746 \RequirePackage{filehook}
747 \AtEndOfPackageFile{array}{\ltj@lltjext@patch@array}