2 % lltjext.sty: derived from plext.sty in pLaTeX.
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjext}[2016/12/16 v1.2c-ltj-5 Macros for vertical writing]
7 \RequirePackage{luatexja}
10 \global\let\ltj@lltjext@orig@tabularS=\tabular*
12 \let\ltj@lltjext@orig@tabular=\tabular
13 \let\ltj@lltjext@orig@array=\array
16 \def\array{\let\@acol\@arrayacol \let\@classz\@arrayclassz
17 \let\@classiv\@arrayclassiv
18 \let\\\@arraycr\let\@halignto\@empty\X@tabarray}
19 \def\tabular{\let\@halignto\@empty\X@tabular}
20 \@namedef{tabular*}{\@ifnextchar<%>
21 {\@stabular}{\@stabular<Z>}}
22 \def\X@tabarray{\@ifnextchar<%>
23 {\p@tabarray}{\p@tabarray<Z>}}
24 \def\X@tabular{\@ifnextchar<%>
25 {\p@tabular}{\p@tabular<Z>}}
26 \def\@stabular<#1>#2{%
27 \setlength\dimen@{#2}%
28 \edef\@halignto{to\the\dimen@}\p@tabular<#1>}
29 \def\p@tabular<#1>{\leavevmode \hbox \bgroup
30 \count@=\ltjgetparameter{direction}$\let\@acol\@tabacol
31 \let\@classz\@tabclassz
32 \let\@classiv\@tabclassiv \let\\\@tabularcr\p@tabarray<#1>}
33 \def\p@tabarray<#1>{\m@th\@ifnextchar[%]
34 {\p@array<#1>}{\p@array<#1>[c]}}
36 \def\p@array<#1>[#2]#3{%
39 \ifnum\ltjgetparameter{direction}=3\relax
40 \let\box@dir\utod\@tempcnta=\zstrutbox
44 \let\box@dir\yoko\@tempcnta=\strutbox
46 \let\box@dir\tate\@tempcnta=\tstrutbox
48 \let\box@dir\dtou\@tempcnta=\dstrutbox
50 \let\box@dir\utod\@tempcnta=\zstrutbox
55 \or \let\box@dir\dtou\@tempcnta=\dstrutbox% dtou
56 \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
57 \or \let\box@dir\yoko\@tempcnta=\strutbox% yoko
58 \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod
61 \setbox\@arstrutbox\hbox{%
63 \vrule\@height\arraystretch\ltjgetht\@tempcnta
64 \@depth\arraystretch\ltjgetdp\@tempcnta \@width\z@}%
65 \fork@array@option<#1>[#2]%
66 \@mkpream{#3}\edef\@preamble{\ialign \noexpand\@halignto
67 \bgroup\@arstrut \@preamble \tabskip\z@skip \cr}%
68 \let\tabularnewline\\%
69 \@begin@alignbox\bgroup\box@dir\adjustbaseline
71 \let\@sharp##\let\protect\relax
72 \lineskip\z@skip\baselineskip\z@skip\@preamble}
73 \def\endarray{\crcr\egroup\egroup\@end@alignbox}
74 \def\endtabular{\endarray$\egroup}
75 \expandafter \let \csname endtabular*\endcsname = \endtabular
76 \def\fork@array@option<#1>[#2]{%
77 \ifnum\ltjgetparameter{direction}=4 % yoko
80 \let\@begin@alignbox\vtop
81 \let\@end@alignbox\relax
83 \let\@begin@alignbox\vbox
84 \let\@end@alignbox\relax
86 \let\@begin@alignbox\vcenter
87 \let\@end@alignbox\relax
91 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
92 \def\@end@alignbox{\egroup}%
94 \let\@begin@alignbox\vbox
95 \let\@end@alignbox\relax
97 \let\@begin@alignbox\vcenter
98 \let\@end@alignbox\relax
101 \else\ifnum\ltjgetparameter{direction}=1 % dtou
104 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
105 \def\@end@alignbox{\egroup}%
107 \let\@begin@alignbox\vbox
108 \let\@end@alignbox\relax
110 \let\@begin@alignbox\vcenter
111 \let\@end@alignbox\relax
113 \else\ifx\box@dir\dtou
115 \let\@begin@alignbox\vtop
116 \let\@end@alignbox\relax
118 \let\@begin@alignbox\vbox
119 \let\@end@alignbox\relax
121 \let\@begin@alignbox\vcenter
122 \let\@end@alignbox\relax
124 \else % 180 度回転→vtop, vbox を入れ替える
126 \let\@begin@alignbox\vbox %%% !!!
127 \let\@end@alignbox\relax
129 \let\@begin@alignbox\vtop %%% !!!
130 \let\@end@alignbox\relax
132 \let\@begin@alignbox\vcenter
133 \let\@end@alignbox\relax
139 \def\@begin@alignbox{\vtop\bgroup\kern\z@\vbox}%
140 \def\@end@alignbox{\egroup}%
142 \def\@begin@alignbox{\vbox\bgroup\vbox}%
143 \def\@end@alignbox{\kern\z@\egroup}%
145 \let\@begin@alignbox\vcenter
146 \let\@end@alignbox\relax
148 \else\ifx\box@dir\dtou % 180 度回転→vtop, vbox を入れ替える
150 \let\@begin@alignbox\vbox %%% !!!
151 \let\@end@alignbox\relax
153 \let\@begin@alignbox\vtop %%% !!!
154 \let\@end@alignbox\relax
156 \let\@begin@alignbox\vcenter
157 \let\@end@alignbox\relax
161 \let\@begin@alignbox\vtop
162 \let\@end@alignbox\relax
164 \let\@begin@alignbox\vbox
165 \let\@end@alignbox\relax
167 \let\@begin@alignbox\vcenter
168 \let\@end@alignbox\relax
177 \newdimen\floatheight
178 \newdimen\floatruletick \floatruletick=0.4pt
179 \newdimen\captionfloatsep \captionfloatsep=10pt
181 \let\captiondir\relax
182 \newdimen\captionwidth \captionwidth\z@
186 \def\captionfontsetup{\normalfont\normalsize}
187 \def\layoutfloat{\@ifnextchar(%)
188 {\X@layoutfloat}{\X@layoutfloat(-5\p@,-5\p@)}}
189 \def\X@layoutfloat(#1,#2){\@ifnextchar[%]
190 {\@layoutfloat(#1,#2)}{\@layoutfloat(#1,#2)[c]}}
191 \long\def\@layoutfloat(#1,#2)[#3]#4{%
193 \floatwidth=#1 \floatheight=#2 \edef\float@pos{#3}%
194 \ifdim\floatwidth<\z@
195 \floatwidth\ltjgetwd\z@\floatruletick\z@
197 \ifdim\floatheight<\z@
198 \floatheight\ltjgetht\z@\advance\floatheight\ltjgetdp\z@\relax
201 \setbox\@floatbox\vbox to\floatheight{\offinterlineskip
202 \hrule width\floatwidth height\floatruletick depth\z@
203 \vss\hbox to\floatwidth{%
204 \vrule width\floatruletick height\floatheight depth\z@
205 \hss\vbox to\floatheight{\hsize\floatwidth\vss#4\vss}\hss
206 \vrule width\floatruletick height\floatheight depth\z@
207 }\hrule width\floatwidth height\floatruletick depth\z@}}
208 \def\DeclareLayoutCaption#1<#2>(#3)[#4#5]{%
210 \ifx\csname #1@layoutcaption\endcsname\relax \else
211 \@latex@info{Redeclaring capiton layout setting of '#1'}%
214 \gdef\csname #1@layoutcaption\endcsname{%
215 \if Z\caption@dir\def\caption@dir{#2}\fi
216 \ifdim\captionwidth=\z@ \captionwidth=#3\relax\fi
217 \if Z\caption@posa\def\caption@posa{#4}\fi
218 \if Z\caption@posb\def\caption@posb{#5}\fi}}
219 \@onlypreamble\DeclareLayoutCaption
220 \DeclareLayoutCaption{figure}<y>(.8\linewidth)[cd]
221 \DeclareLayoutCaption{table}<y>(.8\linewidth)[cu]
222 \def\layoutcaption{\def\caption@dir{Z}\captionwidth\z@
223 \def\caption@posa{Z}\def\caption@posb{Z}%
224 \@ifnextchar<\X@layoutcaption{%
225 \@ifnextchar(\@ilayoutcaption{%
226 \@ifnextchar[\@iilayoutcaption\relax}}}
227 \def\X@layoutcaption<#1>{\def\caption@dir{#1}%
228 \@ifnextchar(\@ilayoutcaption{%
229 \@ifnextchar[\@iilayoutcaption\relax}}
230 \def\@ilayoutcaption(#1){\setlength\captionwidth{#1}%
231 \@ifnextchar[{\@iilayoutcaption}{\relax}}
232 \def\@iilayoutcaption[#1#2]{%
233 \def\caption@posa{#1}\def\caption@posb{#2}}
234 \def\pcaption{\refstepcounter\@captype \@dblarg{\@pcaption\@captype}}
235 \long\def\@pcaption#1[#2]#3{%
236 \addcontentsline{\csname ext@#1\endcsname}{#1}{%
237 \protect\numberline{\csname the#1\endcsname}{\ignorespaces#2}}%
239 \latex@error{Use with `\protect\layoutfloat'.}\@eha
241 \make@pcaptionbox{#3}%
243 \setbox\@tempboxa\vbox{\hbox to\hsize{\if l\float@pos\else\hss\fi
244 \if l\caption@posb\box\@captionbox\kern\captionfloatsep\fi
245 \if t\caption@posa\vtop
246 \else\if b\caption@posa\vbox
247 \else\ifmmode\vcenter \else\@pboxswtrue $\vcenter \fi\fi\fi
248 {\if u\caption@posb\box\@captionbox\kern\captionfloatsep\fi
250 \if d\caption@posb\kern\captionfloatsep\box\@captionbox\fi}%
251 \if r\caption@posb\kern\captionfloatsep\box\@captionbox\fi
252 \if@pboxsw \m@th$\fi \if r\float@pos\else\hss\fi}}%
253 \par\vskip.25\baselineskip
255 \def\make@pcaptionbox#1{%
257 \ifx\csname\@captype @layoutcaption\endcsname\relax
258 \@latex@warning{Default caption layout of `\@captype' unknown.}%
259 \def\caption@dir{Z}\captionwidth\z@
260 \def\caption@posa{Z}\def\caption@posb{Z}%
262 \csname \@captype @layoutcaption\endcsname
265 % tempswa\hline 基本組の組方向とキャプションの組方向が直交するか?
266 \if y\caption@dir \let\captiondir\yoko
267 \ifodd\ltjgetparameter{direction}\relax\@tempswatrue\fi
268 \else\if z\caption@dir \let\captiondir\relax
269 \ifnum\ltjgetparameter{direction}=3\relax\let\captiondir\utod\fi
270 \else\if d\caption@dir \let\captiondir\dtou
271 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
272 \else\if u\caption@dir \let\captiondir\utod
273 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
274 \else\if t\caption@dir \let\captiondir\tate
275 \ifodd\ltjgetparameter{direction}\else\@tempswatrue\fi
277 \setbox0\hbox{\hbox{\captiondir
278 \captionfontsetup\parindent\z@\inhibitglue
279 \csname fnum@\@captype\endcsname #1}}%"
280 \if@tempswa\@tempdima\ltjgetht0\relax\else\@tempdima\ltjgetwd0\relax\fi
281 \ifdim\@tempdima>\captionwidth \@tempdima\captionwidth \fi
284 \if u\caption@posb\vbox
285 \else\if d\caption@posb\vbox
286 \else\if t\caption@posa\vtop
287 \else\if b\caption@posa\vbox
288 \else\ifmmode\vcenter\else\@pboxswtrue $\vcenter\fi
290 {\hsize\@tempdima\kern\z@
291 \vbox{\captiondir\hsize\@tempdima
292 \captionfontsetup\parindent\z@\inhibitglue
293 \csname fnum@\@captype\endcsname #1}\kern\z@
294 }\if@pboxsw \m@th$\fi}%
295 \let\to@captionboxwidth\relax
296 \if l\caption@posb \else\if r\caption@posb\else
297 \def\to@captionboxwidth{to\floatwidth}\fi\fi
298 \setbox\@captionbox\hbox\to@captionboxwidth{%
299 \if t\caption@posa\else\hss\fi
301 \if b\caption@posa\else\hss\fi}}
303 %%% minipage and parbox
304 \def\minipage{\@ifnextchar<%>
305 {\X@minipage}{\X@minipage<Z>}}
306 \def\X@minipage<#1>{\@ifnextchar[%]
307 {\@iminipage<#1>}{\@iiiminipage<#1>{c}\relax[s]}}
308 \def\@iminipage<#1>[#2]{\@ifnextchar[%]
309 {\@iiminipage<#1>{#2}}{\@iiiminipage<#1>{#2}\relax[s]}}
310 \def\@iiminipage<#1>#2[#3]{\@ifnextchar[%]
311 {\@iiiminipage<#1>{#2}{#3}}{\@iiiminipage<#1>{#2}{#3}[#2]}}
312 \def\@iiiminipage<#1>#2#3[#4]#5{%
314 \setlength\@tempdima{#5}%
315 \def\@mpargs{<#1>{#2}{#3}[#4]{#5}}%
318 \ifnum\ltjgetparameter{direction}=3\relax
322 \if #1y\relax \let\box@dir\yoko
323 \else\if #1t\relax\let\box@dir\tate
324 \else\if #1d\relax\let\box@dir\dtou
325 \else\if #1u\relax\let\box@dir\utod
329 \ifcase\ltjgetparameter{direction}\relax
330 \or \let\box@dir\dtou
331 \or\or\let\box@dir\tate
332 \or \let\box@dir\yoko
333 \else \let\box@dir\utod
336 \setbox\@tempboxa\vbox\bgroup\box@dir
340 \textwidth\hsize \columnwidth\hsize
342 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}%
344 \let\@footnotetext\@mpfootnotetext
345 \let\@listdepth\@mplistdepth \@mplistdepth\z@
351 \ifvoid\@mpfootins\else
352 \vskip\skip\@mpfootins
357 \@minipagefalse %% added 24 May 89
360 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}\egroup}
361 \def\parbox{\@ifnextchar<%>
362 {\X@parbox}{\X@parbox<Z>}}
363 \def\X@parbox<#1>{\@ifnextchar[%]
364 {\@iparbox<#1>}{\@iiiparbox<#1>{c}\relax[s]}}
365 \def\@iparbox<#1>[#2]{\@ifnextchar[%]
366 {\@iiparbox<#1>{#2}}{\@iiiparbox<#1>{#2}\relax[s]}}
367 \def\@iiparbox<#1>#2[#3]{\@ifnextchar[%]%
368 {\@iiiparbox<#1>{#2}{#3}}{\@iiiparbox<#1>{#2}{#3}[#2]}}
369 \long\def\@iiiparbox<#1>#2#3[#4]#5#6{%
371 \setlength\@tempdima{#5}%
372 \fork@parbox@option<#1>[#2]%
373 \@begin@tempboxa\vbox{\box@dir
374 \hsize\@tempdima\@parboxrestore\adjustbaseline#6\@@par}%
375 \ifx\relax#3\relax\else
376 \setlength\@tempdimb{#3}%
377 \edef\@parboxto{to\the\@tempdimb}%
379 \@begin@parbox\@parboxto{\box@dir\adjustbaseline
380 \let\hss\vss\let\unhbox\unvbox
381 \csname bm@#4\endcsname}\@end@parbox
382 \@end@tempboxa\egroup}
383 \def\fork@parbox@option<#1>[#2]{%
386 \ifnum\ltjgetparameter{direction}=3\relax
390 \if #1y\relax \let\box@dir\yoko
391 \else\if #1t\relax\let\box@dir\tate
392 \else\if #1d\relax\let\box@dir\dtou
393 \else\if #1u\relax\let\box@dir\utod
397 \ifcase\ltjgetparameter{direction}\relax
398 \or \let\box@dir\dtou
399 \or\or\let\box@dir\tate
400 \or \let\box@dir\yoko
401 \else \let\box@dir\utod
404 %%% now almost same as \fork@array@option
405 \ifnum\ltjgetparameter{direction}=4 % yoko
408 \let\@begin@parbox\vtop
409 \let\@end@parbox\relax
411 \let\@begin@parbox\vbox
412 \let\@end@parbox\relax
414 \def\@begin@parbox{$\vcenter}%
415 \def\@end@parbox{\m@th$}%
419 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}%
420 \def\@end@parbox{\egroup}%
422 \let\@begin@parbox\vbox
423 \let\@end@parbox\relax
425 \def\@begin@parbox{$\vcenter}%
426 \def\@end@parbox{\m@th$}%
429 \else\ifnum\ltjgetparameter{direction}=1 % dtou
432 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}
433 \def\@end@parbox{\egroup}
435 \let\@begin@parbox\vbox
436 \let\@end@parbox\relax
438 \def\@begin@parbox{$\vcenter}%
439 \def\@end@parbox{\m@th$}%
441 \else\ifx\box@dir\dtou
443 \let\@begin@parbox\vtop
444 \let\@end@parbox\relax
446 \let\@begin@parbox\vbox
447 \let\@end@parbox\relax
449 \def\@begin@parbox{$\vcenter}%
450 \def\@end@parbox{\m@th$}%
452 \else % 180 度回転→vtop, vbox を入れ替える
454 \let\@begin@parbox\vbox %%% !!!
455 \let\@end@parbox\relax
457 \let\@begin@parbox\vtop %%% !!!
458 \let\@end@parbox\relax
460 \def\@begin@parbox{$\vcenter}%
461 \def\@end@parbox{\m@th$}%
467 \def\@begin@parbox{\vtop\bgroup\kern\z@\vbox}%
468 \def\@end@parbox{\egroup}%
470 \def\@begin@parbox{\vbox\bgroup\vbox}%
471 \def\@end@parbox{\kern\z@\egroup}%
473 \def\@begin@parbox{$\vcenter}%
474 \def\@end@parbox{\m@th$}%
476 \else\ifx\box@dir\dtou % 180 度回転→vtop, vbox を入れ替える
478 \let\@begin@parbox\vbox %%% !!!
479 \let\@end@parbox\relax
481 \let\@begin@parbox\vtop %%% !!!
482 \let\@end@parbox\relax
484 \def\@begin@parbox{$\vcenter}%
485 \def\@end@parbox{\m@th$}%
489 \let\@begin@parbox\vtop
490 \let\@end@parbox\relax
492 \let\@begin@parbox\vbox
493 \let\@end@parbox\relax
495 \def\@begin@parbox{$\vcenter}%
496 \def\@end@parbox{\m@th$}%
503 \def\pbox{\leavevmode\@ifnextchar<{\X@makePbox}{\X@makePbox<Z>}}
504 \def\X@makePbox<#1>{%
505 \@ifnextchar[{\@imakePbox<#1>}{\@imakePbox<#1>[-5\p@]}}
506 \def\@imakePbox<#1>[#2]{\@ifnextchar[%]
507 {\@iimakePbox<#1>{#2}}{\@iimakePbox<#1>{#2}[c]}}
508 \def\@iimakePbox<#1>#2[#3]#4{%
509 \bgroup\let\box@dir\relax
511 \ifnum\ltjgetparameter{direction}=3 \relax
515 \if #1y\relax \let\box@dir\yoko
516 \else\if #1t\relax\let\box@dir\tate
517 \else\if #1d\relax\let\box@dir\dtou
518 \else\if #1u\relax\let\box@dir\utod
522 \ifcase\ltjgetparameter{direction}
523 \or \let\box@dir\dtou
524 \or\or\let\box@dir\tate
525 \or \let\box@dir\yoko
526 \else \let\box@dir\utod
529 \ifdim #2 <\z@ \hbox{\box@dir#4}\else
531 \if #3l\relax\else\hss\fi
533 \if #3r\relax\else\hss\fi}\fi\egroup}
536 \def\picture{\@ifnextchar<%>
537 {\X@picture}{\X@picture<Z>}}
538 \def\X@picture<#1>(#2,#3){\@ifnextchar(%)
539 {\@@picture<#1>(#2,#3)}{\@@picture<#1>(#2,#3)(0,0)}}
541 \def\ltj@@pic@reset@blshift{%
542 \ltj@yablshift\z@\ltj@ykblshift\z@
543 \ltj@tablshift\z@\ltj@tkblshift\z@
545 \def\@@picture<#1>(#2,#3)(#4,#5){%
546 \edef\ltj@@pic@save@blshift{%
547 \noexpand\ltj@yablshift\the\ltj@yablshift\noexpand\relax
548 \noexpand\ltj@ykblshift\the\ltj@ykblshift\noexpand\relax
549 \noexpand\ltj@tablshift\the\ltj@tablshift\noexpand\relax
550 \noexpand\ltj@tkblshift\the\ltj@tkblshift\noexpand\relax
552 \bgroup\let\box@dir\relax
554 \ifnum\ltjgetparameter{direction}=3 \relax
558 \if #1y\relax \let\box@dir\yoko
559 \else\if #1t\relax\let\box@dir\tate
560 \else\if #1d\relax\let\box@dir\dtou
561 \else\if #1u\relax\let\box@dir\utod
565 \ifcase\ltjgetparameter{direction}
566 \or \let\box@dir\dtou
567 \or\or\let\box@dir\tate
568 \or \let\box@dir\yoko
569 \else \let\box@dir\utod
572 \@picwd=#2\unitlength \@picht=#3\unitlength
573 \setbox\@picbox\hbox to\@picwd\bgroup\box@dir
574 \hskip-#4\unitlength\lower#5\unitlength\hbox\bgroup
575 \ltj@@pic@reset@blshift
579 \setbox0=\hbox{\box@dir%
580 \ltjsetht\@picbox\@picht \ltjsetdp\@picbox\z@
583 \ifnum\ltjgetparameter{direction}=3 \@tempswatrue\fi
584 \ifnum\ltjgetparameter{direction}=11 \@tempswatrue\fi
586 \ifx\box@dir\yoko % この場合だけ垂直位置補正が必要
587 \ltjsetht\@picbox\dimexpr\ltjgetht\@picbox+\ltjgetdp\@picbox\relax
592 \egroup\ltj@@pic@save@blshift}
594 \def\put{\ltj@@pic@reset@blshift\org@put}
596 \def\line{\ltj@@pic@reset@blshift\org@line}
597 \let\org@vector\vector
598 \def\vector{\ltj@@pic@reset@blshift\org@vector}
599 \let\org@dashbox\dashbox
600 \def\dashbox{\ltj@@pic@reset@blshift\org@dashbox}
602 \def\oval{\ltj@@pic@reset@blshift\org@oval}
603 \let\org@circle\circle
604 \def\circle{\ltj@@pic@reset@blshift\org@circle}
607 \newif\ifnot@advanceline
609 \rensujiskip=0.25\chs plus.25\zw minus.25\zw
610 \DeclareRobustCommand\rensuji{%
611 \@ifstar{\not@advancelinetrue\@rensuji}{\@rensuji}}
612 \def\@rensuji{\@ifnextchar[{\@@rensuji}{\@@rensuji[c]}}
613 \def\@@rensuji[#1]#2{%
614 \ifvmode\leavevmode\fi
615 \ifnum\ltjgetparameter{direction}=4\relax\hbox{#2}\else
617 \setbox\tw@\hbox{漢}% 「あ」では仮名書体使用時がまずそう
618 \@tempdimb\ltjgetht\tw@ \advance\@tempdimb\ltjgetdp\tw@
619 \ifnot@advanceline\not@advancelinefalse\else
620 \setbox\z@\hbox{\yoko#2}%
621 \@tempdima\ltjgetht\z@ \advance\@tempdima\ltjgetdp\z@
622 \ifnum\ltjgetparameter{direction}=1\relax
623 % 周囲が dtou の場合には,高さ \ltjgetht\tw@, 深さ \ltjgetdp\tw@ のボックスを基準としている.
624 \if #1c\relax\vrule \@width \z@ \@height\dimexpr.5\@tempdima+.5\ltjgetht\tw@-.5\ltjgetdp\tw@
625 \@depth\dimexpr.5\@tempdima-.5\ltjgetht\tw@+.5\ltjgetdp\tw@
626 \else\if #1l\relax\vrule\@width \z@\@height\ltjgetht\tw@ \@depth\dimexpr\@tempdima-\ltjgetht\tw@
627 \else\vrule\@width \z@ \@height\dimexpr\@tempdima-\ltjgetdp\tw@ \@depth\ltjgetdp\tw@
630 % 周囲が tate, utod の場合も同じ
631 \if #1c\relax\vrule \@width \z@ \@height\dimexpr.5\@tempdima+.5\ltjgetht\tw@-.5\ltjgetdp\tw@
632 \@depth\dimexpr.5\@tempdima-.5\ltjgetht\tw@+.5\ltjgetdp\tw@
633 \else\if #1r\relax\vrule\@width \z@\@height\ltjgetht\tw@ \@depth\dimexpr\@tempdima-\ltjgetht\tw@
634 \else\vrule\@width \z@ \@height\dimexpr\@tempdima-\ltjgetdp\tw@ \@depth\ltjgetdp\tw@
638 \ifnum\ltjgetparameter{direction}=1\relax
639 \if #1c\relax\hbox to\@tempdimb{\yoko\hss#2\hss\kern-\ltjgetdp\tw@}%
640 \else\if #1r\relax\vbox{\hbox to\@tempdimb{\yoko\hss#2\kern-\ltjgetdp\tw@}}%
641 \else\lower\ltjgetdp\tw@\vtop{\hbox to\@tempdimb{\yoko#2\hss}}%
644 \if #1c\relax\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@
645 \hbox to\@tempdimb{\yoko \hss#2\hss}%
646 \else\if #1r\relax\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@
647 \vbox{\hbox to\@tempdimb{\yoko\hss#2}}%
648 \else\raise\dimexpr.5\@tempdimb-\ltjgetdp\tw@
649 \vtop{\hbox to\@tempdimb{\yoko #2\hss}}%
655 \let\prensuji\rensuji
658 \def\Kanji#1{\expandafter\@Kanji\csname c@#1\endcsname}
659 \def\@Kanji#1{\kansuji #1}
660 \def\kanji{\ifnum\ltjgetparameter{direction}=3 \expandafter\kansuji\fi}
664 \def\boutenchar{\char\euc"A1A2}%"
665 \def\bou#1{\ifvmode\leavevmode\fi\@bou#1\end}
667 \ifx#1\end \let\next=\relax
669 \ifnum\ltjgetparameter{direction}=3\relax
670 \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
671 \vss\moveleft0.2\zw\hbox{\yoko\boutenchar}\nointerlineskip
672 \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
674 \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
675 \vss\moveleft-0.2\zw\hbox{\boutenchar}\nointerlineskip
676 \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
683 \ifnum\ltjgetparameter{direction}=3\relax
684 \setbox\z@\hbox{#1}\leavevmode\raise.7\zw
685 \hbox to\z@{\vrule\@width\wd\z@ \@depth\z@ \@height.4\p@\hss}%
687 \else\underline{#1}\fi}
690 \def\@eqnnum{{\reset@font\rmfamily \normalcolor
691 \ifnum\ltjgetparameter{direction}=3 \raise.25\zh\hbox{\yoko(\theequation)}%
692 \else (\theequation)\fi}}
693 \def\@thecounter#1{\noexpand\rensuji{\noexpand\arabic{#1}}}
694 \def\@thmcounter#1{\noexpand\rensuji{\noexpand\arabic{#1}}}
696 %% Compatibility with array package
698 \def\ltj@lltjext@patch@array{%
699 \def\@startpbox##1{\bgroup
700 \box@dir\adjustbaseline%%% これを追加
701 \hsize=##1\@arrayparboxrestore
703 \vrule \@height \ltjgetht\@arstrutbox \@width \z@
706 \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}}
707 \def\p@array<##1>[##2]##3{%
710 \ifnum\ltjgetparameter{direction}=3\relax
711 \let\box@dir\utod\@tempcnta=\zstrutbox
715 \let\box@dir\yoko\@tempcnta=\strutbox
717 \let\box@dir\tate\@tempcnta=\tstrutbox
719 \let\box@dir\dtou\@tempcnta=\dstrutbox
721 \let\box@dir\utod\@tempcnta=\zstrutbox
725 \ifcase\ltjgetparameter{direction}
726 \or \let\box@dir\dtou\@tempcnta=\tabskip \z@\tabskip \z@\dstrutbox% dtou
727 \or\or\let\box@dir\tate\@tempcnta=\tstrutbox% tate
728 \or \let\box@dir\yoko\@tempcnta=\strutbox% yoko
729 \else \let\box@dir\utod\@tempcnta=\zstrutbox% utod
732 \setbox \@arstrutbox \hbox{\box@dir\vrule
733 \@height \arraystretch
734 \dimexpr \ltjgetht\@tempcnta+\extrarowheight\relax
735 \@depth \arraystretch \ltjgetdp \@tempcnta
737 \fork@array@option<##1>[##2]%
740 \xdef\@preamble{\ialign \noexpand \@halignto
741 \bgroup \tabskip \z@skip \@arstrut \@preamble
745 \@begin@alignbox\bgroup\box@dir\adjustbaseline
747 \let\@sharp####\let\protect\relax
748 \let\\\@arraycr\let\tabularnewline\\\let\par\@empty
749 \lineskip\z@skip\baselineskip\z@skip\@preamble}
750 \def\endarray{\crcr\egroup\egroup\@end@alignbox\@arrayright}
753 \@ifpackageloaded{array}{%
754 \expandafter\let\csname tabular*\endcsname=\ltj@lltjext@orig@tabularS
755 \let\tabular=\ltj@lltjext@orig@tabular
756 \let\array=\ltj@lltjext@orig@array
757 \ltj@lltjext@patch@array
759 \let\ltj@lltjext@orig@tabularS\relax
760 \let\ltj@lltjext@orig@tabular\relax
761 \let\ltj@lltjext@orig@array\relax
762 \RequirePackage{filehook}
763 \AtEndOfPackageFile{array}{\ltj@lltjext@patch@array}
766 %%%%%%%%%%%%%%%% LuaTeX-ja original
768 \define@key[ltj]{japaram}{autouprightnum}{% %COUNT
769 \ltj@@set@stack{AURN}{0}{10000}\z@#1 }