+%<*en>
+\section{Directions}
+\LuaTeX\ supports four $\Omega$-style directions: \texttt{TLT},~\texttt{TRT}, \texttt{RTT}
+and \texttt{LTL}.
+However, neither directions are not well-suited for typesetting Japanese vertically, hence we
+implemented vertical writing by rotating \texttt{TLT}-box by 90~degrees.
+%</en>
+%<*ja>
+\section{縦組}
+\label{sec-direction}
+\LuaTeX 本体でも,$\Omega$・$\aleph$由来の機能として,複数の組方向をサポートしている.
+しかし,\LuaTeX がサポートするのは \texttt{TLT},~\texttt{TRT}, \texttt{RTT},~\texttt{LTL}\
+のみであり,日本語の縦組に使うのは望ましくない\footnote{%
+和文文字だけならば \texttt{RTT} を使えばなんとかなると思うが,
+欧文文字が入ってきた場合はうまくいかず,\texttt{RTR} という組方向が必要になる.
+}.そのため,\LuaTeX-jaでは横組(\texttt{TLT})で組んだボックスを回転させる方式で
+縦組を実装した.
+%</ja>
+
+%<ja>\subsection{サポートする組方向}
+\begin{table}[t]
+%<ja>\caption{\LuaTeX-ja のサポートする組方向}
+%<en>\caption{Directions supported by \LuaTeX-ja}
+%<en>\medskip
+\label{tab-dir}
+\centering\small
+\def\obox#1{%
+ \setbox0=\hbox{\yoko\hbox{#1%
+ \large\ltjsetparameter{talbaselineshift=0pt}%
+ \vrule height 25pt width 0.4pt depth 15pt\kern-.2pt%
+ \raise25pt\hbox to 0pt{\hss\composite{*r^@{>>}}\hss}%
+ \raise-15pt\hbox to 0pt{\hss\composite{*l^@{>|}}\hss}\kern.2pt%
+ \vrule height.2pt depth.2pt width 60pt\hbox to 0pt{\hss\composite{*d^@{>}}\hss}\kern-60pt
+ \hbox to 60pt{\,銀は、Ag\hss}}}%
+ \raise\dimexpr 0.5\ltjgetdp0-0.5\ltjgetht0\box0%
+}
+%<*ja>
+\begin{tabular}{>{\bfseries}lcccc}
+\toprule
+&横組&縦組 &\cs{dtou}「dtou方向」&「utod方向」\\
+\midrule
+命令&\cs{yoko}&\cs{tate}&\cs{dtou}&\cs{utod}\\
+字送り方向&水平右向き(→)&垂直下向き(↓)&垂直上向き(↑)&垂直下向き(↓)\\
+行送り方向&垂直下向き(↓)&水平左向き(←)&水平右向き(→)&水平左向き(←)\\
+使用する和文フォント&横組用(\cs{jfont})&縦組用(\cs{tfont})&
+\multicolumn{2}{c}{%
+ 横組用(\cs{jfont})の$90^\circ$回転}\\[\smallskipamount]
+組版例\null $^*$ &\obox{\yoko}&\obox{\tate}&\obox{\dtou}&\obox{\utod}\\
+\noalign{\medskip}
+\bottomrule
+\end{tabular}
+
+\medskip\raggedright
+\def\R#1{%
+ \raise0.38\zw\hbox{%
+ \vrule height.2pt depth.2pt width2\zw%
+ \hbox to 0pt{\hss\composite{*d^@{#1}}\hss}%
+ }%
+}
+$^*$\ 幅(width),高さ(height),深さ(depth)の増加方向を,
+それぞれ「\R{>}」,「\R{>>}」,「\R{>|}」で表している.
+\raggedright
+%</ja>
+
+%<*en>
+\begin{tabular}{>{\bfseries}lcccc}
+\toprule
+&horizontal (\emph{yoko}~direction)&vertical (\emph{tate}~direction)&%
+ \emph{dtou} direction&\emph{utod} direction\\
+\midrule
+Commands&\cs{yoko}&\cs{tate}&\cs{dtou}&\cs{utod}\\
+Beginning of the page&Top&Right&Left&Right\\
+Beginning of the line&Left&Top&Bottom&Top\\
+Used Japanese font&horizontal (\cs{jfont})&vertical (\cs{tfont})&
+\multicolumn{2}{c}{%
+ horizontal ($90^\circ$ rotated)}\\[\smallskipamount]
+Example&\obox{\yoko}&\obox{\tate}&\obox{\dtou}&\obox{\utod}\\
+\noalign{\medskip}
+(Notation used in $\Omega$)&TLT&RTR, RTT&LBL&RTR\\
+\bottomrule
+\end{tabular}
+
+\medskip\raggedright
+\def\R#1{%
+ \raise0.38\zw\hbox{%
+ \vrule height.2pt depth.2pt width2\zw%
+ \hbox to 0pt{\hss\composite{*d^@{#1}}\hss}%
+ }%
+}
+\raggedright
+%</en>
+\end{table}
+
+%<*en>
+\LuaTeX-ja supports four directions, as shown in Table~\ref{tab-dir}.
+The second column (\emph{yoko} direction) is just horizontal writing,
+and the third column (\emph{tate} direction) is vertical writing.
+The fourth column (\emph{dtou} direction) is actually a hidden feature of \pTeX.
+We implemented this for debugging purpose.
+The fifth column (\emph{utod} direction) corresponds the ``\texttt{tate (math) direction}'' of \pTeX.
+
+Directions can be changed by \cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod},
+only when the current list is null. Also, the direction of a math formula is changed to
+\emph{utod}, when the direction outside the math formula is \emph{tate} (vertical writing).
+%</en>
+
+%<*ja>
+\LuaTeX-jaがサポートする組方向は表\ref{tab-dir}に示す4つである.
+4列目の \cs{dtou} は聞き慣れない命令だと思うが,
+実は\pTeX に同名の命令が(ドキュメントには書かれていないが)存在する.
+Down-TO-Upの意味なのだろう.\cs{dtou} を使用する機会はないだろうが,
+\LuaTeX-jaではデバッグ用に実装している.
+5列目の \cs{utod} は,\pTeX で言う「縦数式ディレクション」に相当するものである.
+
+組方向は,\cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod} をそれぞれ使用することで,
+現在作成中のリストやボックスが空の時にのみ変更可能である.
+また,縦組中の数式内のボックスは\pTeX と同じように組方向が \cs{utod} となる.
+%</ja>
+
+%<*en>
+\subsection{Boxes in different direction}
+
+As in \pTeX, one can use boxes of different direction in one document.
+The below is an example.
+\begin{LTXexample}
+ここは横組% yoko
+\hbox{\tate % tate
+ \hbox{縦組}% tate
+ の中に
+ \hbox{\yoko 横組の内容}% yoko
+ を挿入する
+}
+また横組に戻る% yoko
+\end{LTXexample}
+
+Table~\ref{tab-diffdir} shows how a box is arranged when
+the direction inside the box and that outside the box differ.
+%</en>
+%<*ja>
+\subsection{異方向のボックス}
+
+縦組の中に「42」などの2桁以上の算用数字を横組で組むなど,
+異なる組方向を混在させることがしばしば行われる.
+組方向の混在も\pTeX と同じようにできる:
+\begin{LTXexample}
+ここは横組% yoko
+\hbox{\tate % tate
+ \hbox{縦組}% tate
+ の中に
+ \hbox{\yoko 横組の内容}% yoko
+ を挿入する
+}
+また横組に戻る% yoko
+\end{LTXexample}
+
+異なる組方向のボックスを配置した場合にどう組まれるかの仕様も,\pTeX を
+踏襲している.表\ref{tab-diffdir}に示す.
+%</ja>
+
+\begin{table}[t]
+%<ja>\caption{異方向のボックスの配置}
+%<en>\caption{Boxes in different direction}
+%<en>\medskip
+\label{tab-diffdir}
+ \centering\small\unitlength3mm
+ \def\TATEeg{%
+ \hbox{\smash{\begin{picture}(0,0)(-2,0)
+ \thicklines
+ \polyline(-2,0)(-2,-7)(5,-7)(5,0)
+ \put(0,0){\circle*{0.3}}
+ \put(2.5,-4){\makebox(0,0){\hbox{\tate\bfseries \emph{tate}/\emph{utod}}}}
+ \put(0,0){\vector(1,0){5}} \put(2.5,-0.2){\makebox(0,0)[t]{$h_{\mathrm{T}}$}}
+ \put(0,0){\vector(-1,0){2}}\put(-1,-0.2){\makebox(0,0)[t]{$d_{\mathrm{T}}$}}
+ \put(0,0){\vector(0,-1){7}}\put(0.2,-3.5){\makebox(0,0)[l]{$w_{\mathrm{T}}$}}
+ \end{picture}}}
+ }
+ \def\DTOUeg{%
+ \hbox{\smash{\begin{picture}(0,0)(-5,0)
+ \thicklines
+ \polyline(-5,0)(-5,7)(2,7)(2,0)
+ \put(0,0){\circle*{0.3}}
+ \put(-2.5,4){\makebox(0,0){\hbox{\dtou\bfseries \emph{dtou}}}}
+ \put(0,0){\vector(-1,0){5}} \put(-2.5,0.3){\makebox(0,0)[b]{$h_{\mathrm{D}}$}}
+ \put(0,0){\vector(1,0){2}}\put(1,0.3){\makebox(0,0)[b]{$d_{\mathrm{D}}$}}
+ \put(0,0){\vector(0,1){7}}\put(-0.2,3.5){\makebox(0,0)[r]{$w_{\mathrm{D}}$}}
+ \end{picture}}}
+ }
+ \def\YOKOeg{%
+ \hbox{\smash{\begin{picture}(0,0)
+ \thicklines
+ \polyline(0,5)(7,5)(7,-2)(0,-2)
+ \put(4,2.5){\makebox(0,0){\hbox{\yoko\bfseries \emph{yoko}}}}
+ \put(0,0){\circle*{0.3}}
+ \put(0,0){\vector(0,1){5}} \put(0.3,2.5){\makebox(0,0)[l]{$h_{\mathrm{Y}}$}}
+ \put(0,0){\vector(0,-1){2}}\put(0.3,-1){\makebox(0,0)[l]{$d_{\mathrm{Y}}$}}
+ \put(0,0){\vector(1,0){7}}\put(3.5,0.2){\makebox(0,0)[b]{$w_{\mathrm{Y}}$}}
+ \end{picture}}}
+ }
+\begin{tabular}{ccc}
+\toprule
+%<ja>\emph{横組中に配置}&\emph{縦組中に配置}&%
+%<ja>\emph{組方向 \cs{dtou} 中に配置}\\
+%<en>\textbf{typeset in \emph{yoko} direction}
+%<en>&\textbf{typeset in \emph{tate} or \emph{utod} direction}
+%<en>&\textbf{typeset in \emph{dtou} direction}\\
+\midrule
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(0,0){\line(1,0){3.8}}
+ \put(4,7){\TATEeg}
+ \put(11.2,0){\line(1,0){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(3,3.5){\vector(0,1){3.5}\vector(0,-1){3.5}}
+ \put(2.8,3.5){\makebox(0,0)[r]{$H_{\mathrm{Y}}$}}
+ \put(3,-2){\vector(0,1){2}}
+ \put(2.8,-1){\makebox(0,0)[r]{$D_{\mathrm{Y}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(6,8){\vector(-1,0){2}}
+ \put(9,8){\vector(1,0){2}}
+ \put(7.5,8){\makebox(0,0){$W_{\mathrm{Y}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{Y}} &= h_{\mathrm{T}}+d_{\mathrm{T}},\\
+ H_{\mathrm{Y}} &= w_{\mathrm{T}},\\
+ D_{\mathrm{Y}} &=0\,\mathrm{pt}
+ \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(7.5,-0.2){\line(0,-1){2.8}}
+ \put(4,2){\YOKOeg}
+ \put(7.5, 7.2){\line(0,1){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(2,0){\line(1,0){1.8}}
+ \put(3,5){\vector(0,1){2}}
+ \put(3,2){\vector(0,-1){2}}
+ \put(3,3.5){\makebox(0,0){$W_{\mathrm{T}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(8,8){\vector(-1,0){0.5}\vector(1,0){3}}
+ \put(7,8){\vector(-1,0){3}\vector(1,0){0.5}}
+ \put(9.25,8.2){\makebox(0,0)[b]{$H_{\mathrm{T}}$}}
+ \put(5.75,8.2){\makebox(0,0)[b]{$D_{\mathrm{T}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{T}} &= h_{\mathrm{Y}}+d_{\mathrm{Y}},\\
+ H_{\mathrm{T}} &= w_{\mathrm{Y}}/2,\\
+ D_{\mathrm{T}} &= w_{\mathrm{Y}}/2
+ \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(11,-0.2){\line(0,-1){2.8}}
+ \put(4,2){\YOKOeg}
+ \put(11, 7.2){\line(0,1){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(2,0){\line(1,0){1.8}}
+ \put(3,5){\vector(0,1){2}}
+ \put(3,2){\vector(0,-1){2}}
+ \put(3,3.5){\makebox(0,0){$W_{\mathrm{D}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(7.5,8){\vector(-1,0){3.5}\vector(1,0){3.5}}
+ \put(13,8){\vector(-1,0){2}}
+ \put(7.5,8.2){\makebox(0,0)[b]{$H_{\mathrm{D}}$}}
+ \put(12,8.2){\makebox(0,0)[b]{$D_{\mathrm{D}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{D}} &= h_{\mathrm{Y}}+d_{\mathrm{Y}},\\
+ H_{\mathrm{D}} &= w_{\mathrm{Y}},\\
+ D_{\mathrm{D}} &= 0\,\mathrm{pt}
+ \end{align*}%
+ }%
+\\\midrule
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(0,0){\line(1,0){3.8}}
+ \put(4,0){\DTOUeg}
+ \put(11.2,0){\line(1,0){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(3,3.5){\vector(0,1){3.5}\vector(0,-1){3.5}}
+ \put(2.8,3.5){\makebox(0,0)[r]{$H_{\mathrm{Y}}$}}
+ \put(3,-2){\vector(0,1){2}}
+ \put(2.8,-1){\makebox(0,0)[r]{$D_{\mathrm{Y}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(6,8){\vector(-1,0){2}}
+ \put(9,8){\vector(1,0){2}}
+ \put(7.5,8){\makebox(0,0){$W_{\mathrm{Y}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{Y}} &= h_{\mathrm{D}}+d_{\mathrm{D}},\\
+ H_{\mathrm{Y}} &= w_{\mathrm{D}},\\
+ D_{\mathrm{Y}} &= 0\,pt
+ \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(9,-0.2){\line(0,-1){2.8}}
+ \put(4,0){\DTOUeg}
+ \put(9, 7.2){\line(0,1){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(2,0){\line(1,0){1.8}}
+ \put(3,5){\vector(0,1){2}}
+ \put(3,2){\vector(0,-1){2}}
+ \put(3,3.5){\makebox(0,0){$W_{\mathrm{T}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(6.5,8){\vector(-1,0){2.5}\vector(1,0){2.5}}
+ \put(10,8){\vector(-1,0){1}\vector(1,0){1}}
+ \put(10,8.2){\makebox(0,0)[b]{$H_{\mathrm{T}}$}}
+ \put(6.5,8.2){\makebox(0,0)[b]{$D_{\mathrm{T}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{T}} &= h_{\mathrm{D}}+d_{\mathrm{D}},\\
+ H_{\mathrm{T}} &= d_{\mathrm{D}},\\
+ D_{\mathrm{T}} &= h_{\mathrm{D}}
+ \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+ \put(6,-0.2){\line(0,-1){2.8}}
+ \put(4,7){\TATEeg}
+ \put(6, 7.2){\line(0,1){3.8}}
+%
+ \put(2,7){\line(1,0){1.8}}
+ \put(2,0){\line(1,0){1.8}}
+ \put(3,5){\vector(0,1){2}}
+ \put(3,2){\vector(0,-1){2}}
+ \put(3,3.5){\makebox(0,0){$W_{\mathrm{D}}$}}
+%
+ \put(4,7.2){\line(0,1){1.8}}
+ \put(11,7.2){\line(0,1){1.8}}
+ \put(5,8){\vector(-1,0){1}\vector(1,0){1}}
+ \put(8.5,8){\vector(-1,0){2.5}\vector(1,0){2.5}}
+ \put(5,8.2){\makebox(0,0)[b]{$H_{\mathrm{D}}$}}
+ \put(8.5,8.2){\makebox(0,0)[b]{$D_{\mathrm{D}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+ \begin{align*}
+ W_{\mathrm{D}} &= w_{\mathrm{T}},\\
+ H_{\mathrm{D}} &= d_{\mathrm{T}},\\
+ D_{\mathrm{D}} &= h_{\mathrm{T}}
+ \end{align*}%
+ }\\
+\bottomrule
+\end{tabular}
+\end{table}
+
+
+
+%<*en>
+\paragraph{\cs{wd} and direction}
+In \pTeX, \cs{wd},~\cs{ht},~\cs{dp} means the dimensions of a box register
+\emph{with respact to the current direction}.
+This means that the value of \cs{wd0} etc.\ might differ when the current direction is
+different, even if \cs{box0} stores the same box.
+However, this no longer applies in \LuaTeX-ja.
+
+\begin{LTXexample}
+% yoko direction
+\setbox0=\hbox to 20pt{foo}
+\the\wd0,~\hbox{\tate\vrule\the\wd0}
+\wd0=100pt
+\the\wd0,~\hbox{\tate \the\wd0}
+\end{LTXexample}
+
+To access box dimensions \emph{with respect to current direction},
+one have to use the following commands instead of \cs{wd} wtc.
+\begin{cslist}
+
+ \item[\cs{ltjgetwd}<num>\textrm{, }\cs{ltjgetht}<num>\textrm{, }%
+ \cs{ltjgetdp}<num>]
+These commands return \emph{an internal dimension} of \cs{box<num>} with respect to
+the current direction. One can use these in \cs{dimexpr} primitive, as the followings.
+\begin{lstlisting}
+\dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701
+\end{lstlisting}
+The following is an example.
+\begin{LTXexample}[width=0.3\textwidth]
+\parindent0pt
+\setbox32767=\hbox{\yoko よこぐみ}
+\fboxsep=0mm\fbox{\copy32767}
+\vbox{\hsize=20mm
+\yoko YOKO \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\tate TATE \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\dtou DTOU \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\end{LTXexample}
+
+ \item[\cs{ltjsetwd}<num>=<dimen>\textrm{, }\cs{ltjsetht}<num>=<dimen>\textrm{, }%
+ \cs{ltjsetdp}<num>=<dimen>]
+These commands set the dimension of \cs{box<num>}. Unlike \cs{ltjgetwd}, one does not need
+ to group the argument <num>; four calls of \cs{ltjsetwd} below have the same meaning.
+\begin{lstlisting}
+\ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt
+\end{lstlisting}
+
+\end{cslist}
+%</en>
+%<*ja>
+\paragraph{\cs{wd} 達と組方向}
+ボックスレジスタ \cs{box}<num> にセットされているボックスの幅・高さ・深さの取得や
+変更にはそれぞれ \cs{wd},~\cs{ht},~\cs{dp} プリミティブを用いるのであった.
+\pTeX ではこれらのプリミティブは,「現在の組方向におけるボックスの寸法」を指すもので,
+同じボックスに対しても現在の組方向によって返る値は異なるもであった.
+
+\LuaTeX-jaにおいては状況が異なり,\cs{wd},~\cs{ht},~\cs{dp} が返す値は
+現在の組方向には依存しない.下の例のように,横組のボックスが格納されていれば
+\cs{wd}等は常に「横組におけるボックスの寸法」を意味する.
+
+\begin{LTXexample}
+% yoko direction
+\setbox0=\hbox to 20pt{foo}
+\the\wd0,~\hbox{\tate\vrule\the\wd0}
+\wd0=100pt
+\the\wd0,~\hbox{\tate \the\wd0}
+\end{LTXexample}
+
+\pTeX のように現在の組方向に応じたボックスの寸法の取得・設定を行うには,
+代わりに次の命令を使用する.
+
+\begin{cslist}
+
+ \item[\cs{ltjgetwd}<num>\textrm{, }\cs{ltjgetht}<num>\textrm{, }%
+ \cs{ltjgetdp}<num>]
+現在の組方向に応じたボックスの寸法の取得を行う.結果は内部長さであるため,
+\begin{lstlisting}
+\dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701
+\end{lstlisting}
+のように \cs{wd}<num> の代わりとして扱うことができる.
+使用例は以下の通りである.
+\begin{LTXexample}[width=0.3\textwidth]
+\parindent0pt
+\setbox32767=\hbox{\yoko よこぐみ}
+\fboxsep=0mm\fbox{\copy32767}
+\vbox{\hsize=20mm
+\yoko YOKO \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\tate TATE \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\dtou DTOU \the\ltjgetwd32767, \\
+ \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\end{LTXexample}
+
+ \item[\cs{ltjsetwd}<num>=<dimen>\textrm{, }\cs{ltjsetht}<num>=<dimen>\textrm{, }%
+ \cs{ltjsetdp}<num>=<dimen>]
+現在の組方向に応じたボックスの寸法の設定を行う.\cs{afterassignment} を2回利用して
+実装しているので,次の4通りは全て同じ意味である.
+\begin{lstlisting}
+\ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt
+\end{lstlisting}
+
+設定値は「横組」「縦組及び \cs{utod} 方向」「\cs{dtou} 方向」
+の3種ごとに独立して記録される.参考として,Gitリポジトリ内の
+ \verb+test/test55-boxdim_diffdir.{tex,pdf}+ を挙げておく.
+
+\end{cslist}
+%</ja>
+
+%<*en>
+\subsection{Getting current direction}
+The \Param{direction} parameter returns the current direction, and
+the \Param{boxdir} parameter (with the argumant <num>)
+returns the direction of a box register \cs{box}<num>.
+The returned value of these parameters are a \emph{string}:
+\begin{center}
+\small
+\begin{tabular}{>{\bfseries}lccccc}
+\toprule
+Direction&\emph{yoko}&\emph{tate}&\emph{dtou}&\emph{utod}&(empty)\\
+\midrule
+Returned value&\texttt{4}&\texttt{3}&\texttt{1}&\texttt{11}&\texttt{0}\\
+\bottomrule
+\end{tabular}
+\end{center}
+\begin{LTXexample}[width=0.3\textwidth]
+\leavevmode\def\DIR{\ltjgetparameter{direction}}
+\hbox{\yoko \DIR}, \hbox{\tate\DIR},
+\hbox{\dtou\DIR}, \hbox{\utod\DIR},
+\hbox{\tate$\hbox{tate math: \DIR}$}
+
+\setbox2=\hbox{\tate}\ltjgetparameter{boxdir}{2}
+\end{LTXexample}
+%</en>
+%<*ja>
+\subsection{組方向の取得}
+「現在の組方向」や「<num>番のボックスの組方向」は,
+\pTeX では \cs{ifydir} や \cs{ifybox}<num> といった条件判断文を使って
+判断することができた.
+しかし,\LuaTeX-jaはあくまでも\TeX マクロとLuaコードで
+記述されており,それでは新たな条件判断命令を作るのは難しい.
+
+\LuaTeX-jaでは,\Param{direction}パラメータで現在の組方向を,
+\Param{boxdir}パラメータ(と追加の引数<num>)によって
+\cs{box}<num>の組方向をそれぞれ取得できるようにした.
+戻り値は文字列である:
+\begin{center}
+\small
+\begin{tabular}{>{\bfseries}lccccc}
+\toprule
+組方向&\emph{横組}&\emph{tate縦組}&\emph{dtou方向}&\emph{utod方向}&(未割り当て)\\
+\midrule
+戻り値&\texttt{4}&\texttt{3}&\texttt{1}&\texttt{11}&\texttt{0}\\
+\bottomrule
+\end{tabular}
+\end{center}
+
+\begin{LTXexample}[width=0.3\textwidth]
+\leavevmode\def\DIR{\ltjgetparameter{ direction}}
+\hbox{\yoko\DIR}, \hbox{\tate\DIR},
+\hbox{\dtou\DIR}, \hbox{\utod\DIR},
+\hbox{\tate$\hbox{tate math: \DIR}$}
+
+\setbox2=\hbox{\tate}\ltjgetparameter{boxdir}{2}
+\end{LTXexample}
+
+これらを用いれば,例えば
+\pTeX の \cs{ifydir},~\cs{ifybox200} と同等の条件判断を
+\begin{lstlisting}
+\ifnum\ltjgetparameter{direction}=4
+\ifnum\ltjgetparameter{boxdir}{200}=4
+\end{lstlisting}
+のように行うことができる.
+\cs{iftdir} は少々面倒であるが
+\begin{lstlisting}
+\ifnum\numexpr
+ \ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8=3
+\end{lstlisting}
+とすればよい.
+%</ja>
+
+%<*en>
+\subsection{Overridden box primitives}
+To cope with multiple directions, the following primitives are
+overridden by \LuaTeX-ja, using~\verb+\protected\def+.
+\begin{cslist}[style=standard]
+ \item[\cs{unhbox}<num>\textrm{, }\cs{unvbox}<num>\textrm{, }\cs{unhcopy}<num>\textrm{, }\cs{unvcopy}<num>]
+ \item[\cs{vadjust}\{<material>\}]
+ \item[\cs{insert}<number>\{<material>\}]
+ \item[\cs{lastbox}]
+ \item[\cs{raise}<dimen><box>\textrm{, }\cs{lower}<dimen><box>\textrm{\ etc., }\cs{vcenter}]
+ \item[\cs{vcenter}]
+\end{cslist}
+%</en>
+%<*ja>
+\subsection{プリミティブの再定義}
+異なる組方向に対応するために,以下に挙げるプリミティブは
+\LuaTeX-jaによる前処理もしくは後処理が行われるように
+\ \verb+\protected\def+ により再定義してある.
+
+\begin{cslist}
+ \item[\cs{unhbox}<num>\textrm{, }\cs{unvbox}<num>\textrm{, }\cs{unhcopy}<num>\textrm{, }\cs{unvcopy}<num>]
+ ボックスの組方向が現在のリストと異なる場合は事前にエラーメッセージを出力する.
+ \pTeX と異なり,エラーを無視して無理矢理 \cs{unhbox}, \cs{unvbox} を
+ 続行させることもできるが,その場合の組版結果は保証しない.
+ \item[\cs{vadjust}\{<material>\}] 一旦プリミティブ本来の挙動を行う.その後,<material>の組方向が
+ 周囲の垂直リストの組方向と一致しない場合にエラーを出力し,
+ 該当の \cs{vadjust} を無効にする.
+ \item[\cs{insert}<number>\{<material>\}]
+ 一旦プリミティブ本来の挙動を行い,その後<material>内の各ボックス・罫線の直前に組方向を示
+ すdirection whatsitを挿入する.
+ \item[\cs{lastbox}] ボックスの「中身」を現在の組方向に合わせるためのノード
+ (\textit{dir\_box}という)を必要ならば除去し,
+ 正しく「中身」のボックスが返されるように前処理をする.
+ \item[\cs{raise}<dimen><box>\textrm{, }\cs{lower}<dimen><box>\textrm{\ etc., }\cs{vcenter}]
+ 一方,こちらでは必要に応じて\textit{dir\_box}を作成する前処理を追加している.
+\end{cslist}
+%</ja>
+