X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=doc%2Fluatexja.dtx;h=0ed544c88e1f377acb07a8e9e82e406df96dabdc;hb=0526b27bf88ed7f2adedef267f4d9226f6f5a692;hp=abf7977bc7d534579cbecd3d906d800a0150e471;hpb=7383bb0ef0eef7e54a01838d0e5100ac8f13f91b;p=luatex-ja%2Fluatexja.git diff --git a/doc/luatexja.dtx b/doc/luatexja.dtx index abf7977..0ed544c 100644 --- a/doc/luatexja.dtx +++ b/doc/luatexja.dtx @@ -48,7 +48,8 @@ \usepackage{amsmath,array,tikz,pict2e,multienum,float} \usepackage{booktabs,multicol,luatexja-ruby} -\usepackage{xy,lltjext} +\usepackage[all]{xy} +\usepackage{lltjext,alltt} %%%%%%%% listings @@ -178,7 +179,11 @@ %%%%%%%% \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr - #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}} + #1\mathstrut\cr\noalign{\vskip1pt\hrule height.4pt\vskip1pt}\strut#2\cr}}}}}\,} +\def\HNode#1#2#3#4{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr + #1\mathstrut\cr\noalign{\vskip1pt\hrule height.4pt\vskip1pt}% + width:\hfill\ #2\cr height:\hfill\ #3\cr depth:\hfill\ #4\cr + }}}}}\,} \protected\def\Param#1{\hyperlink{fld:#1}{\textsf{#1}}} % parameter name \protected\def\DParam#1{\hypertarget{fld:#1}{\textsf{#1}}} % parameter name (definition) @@ -372,18 +377,18 @@ The followings are major changes from \pTeX: \item \emph{注意:上の2つの変更により,従来\textbf{JAglue}の挿入処理を分断するのに 使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:} % -\begin{verbatim} +\begin{lstlisting} ちょ{}っと ちょ\/っと -\end{verbatim} +\end{lstlisting} %<*en> If you want to do so, please put an empty horizontal box (hbox) between it instead: % %<*ja> もし同じことをやりたければ,空の水平ボックス(hbox)を間に挟めばよい: % -\begin{verbatim} +\begin{lstlisting} ちょ\hbox{}っと -\end{verbatim} +\end{lstlisting} %<*en> @@ -399,13 +404,21 @@ The followings are major changes from \pTeX: %<*ja> \item \LuaTeX-jaでは,\pTeX と同様に漢字・仮名を制御綴内に用いることができ, \cs{西暦} などが正しく動作するようにしている. -但し,制御綴中に使える和文文字が\pTeX・\upTeX と全く同じではないことに注意すること. +但し,制御綴中に使える和文文字が\pTeX・\upTeX と全く同じではない(\ref{sec-catcode}章参照). % %<*ja> \item ****版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている. \LuaTeX のコールバックの制限などにより,特に異なった組方向のボックスを扱う場合には -仕様が異なるので注意すること. +仕様が異なるので注意. +% + +%<*en> +\item Japanese characters in discretionary break (\cs{discretionary}) is not supported. +% +%<*ja> +\item \cs{discretionary} 内に直接和文文字を記述することはサポートされない.和文文字をどう + しても使いたい場合は \cs{hbox} で括ること. % \end{itemize} @@ -535,15 +548,15 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %\subsection{Installation} %\subsection{インストール} -%To install the \LuaTeX-ja\ package, you will need: -%\LuaTeX-jaパッケージのインストールには,次のものが必要である. +%The following packages are needed for the \LuaTeX-ja\ package. +%\LuaTeX-jaパッケージには,次のパッケージ類が必要である. \begin{itemize} \item \LuaTeX\ beta-0.74.0 (or later) \item \Pkg{luaotfload} v2.2 (or later) -\item \Pkg{luatexbase} v0.6 -\item \Pkg{xunicode} v0.981~(2011/09/09) \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files) -\item \Pkg{everysel} +\item \Pkg{everysel} (if you want to use \LuaTeX-ja with \LaTeXe) +%\item \emph{IPAex fonts(\url{http://ipafont.ipa.go.jp/})} +%\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})} \end{itemize} %<*en> @@ -553,19 +566,21 @@ since \LuaTeX\ binary and \Pkg{luaotfload} is updated in \medskip -Now \LuaTeX-ja is available from the following archive and distributions: +Now \LuaTeX-ja is available from +CTAN (in the \texttt{macros/luatex/generic/luatexja} directory), and +the following distributions: \begin{itemize} - \item CTAN (in the \texttt{macros/luatex/generic/luatexja} directory) \item MiK\TeX\ (in \texttt{luatexja.tar.lzma}); see the next subsection \item \TeX\ Live (in \texttt{texmf-dist/tex/luatex/luatexja}) \item W32\TeX\ (in \texttt{luatexja.tar.xz}) \end{itemize} +IPAex fonts are also available in these distributions. If you are using \TeX~Live~2014, you can install \LuaTeX-ja from \TeX~Live manager (\texttt{tlmgr}): -\begin{verbatim} +\begin{lstlisting} $ tlmgr install luatexja -\end{verbatim} +\end{lstlisting} % %<*ja> \emph{本バージョンの\LuaTeX-jaは\TeX~Live~2012以前では動作しない.} @@ -573,19 +588,21 @@ $ tlmgr install luatexja \medskip -現在,\LuaTeX-jaは以下のアーカイブ,およびディストリビューションに収録されている: +現在,\LuaTeX-jaはCTAN (\texttt{macros/luatex/generic/luatexja})に収録されている他, +以下のディストリビューションにも収録されている: \begin{itemize} - \item CTAN (\texttt{macros/luatex/generic/luatexja}) \item MiK\TeX\ (\texttt{luatexja.tar.lzma}) \item \TeX\ Live (\texttt{texmf-dist/tex/luatex/luatexja}) \item W32\TeX\ (\texttt{luatexja.tar.xz}) \end{itemize} +これらのディストリビューションはIPAexフォントも収録している. +W32\TeX においてはIPAexフォントは \texttt{luatexja.tar.xz} 内にある. 例えば\TeX~Live~2014を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を 使ってインストールすることができる. -\begin{verbatim} +\begin{lstlisting} $ tlmgr install luatexja -\end{verbatim} +\end{lstlisting} % %\paragraph{Manual installation} @@ -598,9 +615,9 @@ $ tlmgr install luatexja \begin{itemize} \item Copy the Git repository: -\begin{verbatim} +\begin{lstlisting} $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git -\end{verbatim} +\end{lstlisting} \item Download the \texttt{tar.gz} archive of HEAD in the \texttt{master} branch from \begin{flushleft} \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}. @@ -616,9 +633,9 @@ the forefront of development is not the \texttt{master} branch. \begin{itemize} \item Gitリポジトリの内容をコピーする: -\begin{verbatim} +\begin{lstlisting} $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git -\end{verbatim} +\end{lstlisting} \item \texttt{master}ブランチのスナップショット(\texttt{tar.gz}形式)をダウンロードする. \begin{flushleft} \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}. @@ -650,13 +667,13 @@ But only the contents in \texttt{src/} are needed to work \LuaTeX-ja. 格納した \texttt{ltj-kinsoku.lua} を生成するために, 以下を実行する必要がある: % -\begin{verbatim} +\begin{lstlisting} $ cd src $ lualatex ltjclasses.ins $ lualatex ltjsclasses.ins $ lualatex ltjltxdoc.ins $ luatex ltj-kinsoku_make.tex -\end{verbatim} +\end{lstlisting} %<*en> Note that \texttt{*.\{dtx,ins\}} and \texttt{ltj-kinsoku\_make.tex} are not needed in regular use. % @@ -675,7 +692,11 @@ Note that \texttt{*.\{dtx,ins\}} and \texttt{ltj-kinsoku\_make.tex} are not need % %<*ja> \item \texttt{src}の中身を自分の\texttt{TEXMF}ツリーにコピーする. - 場所の例としては,例えば\texttt{TEXMF/tex/luatex/luatexja/}がある. + 場所の例としては,例えば +\begin{quote} + \texttt{TEXMF/tex/luatex/luatexja/} +\end{quote} + がある. シンボリックリンクが利用できる環境で,かつリポジトリを直接取得したのであれば, (更新を容易にするために)コピーではなくリンクを貼ることを勧める. % @@ -727,10 +748,10 @@ so you will encounter an error like the following: \LuaTeX によって見つけられることが必要である. しかしMiK\TeX ではそのようになっていないので,次のエラーが発生するだろう: % -\begin{verbatim} +\begin{lstlisting} ! LuaTeX error ...iles (x86)/MiKTeX 2.9/tex/luatex/luatexja/ltj-rmlgbm.lua bad argument #1 to 'open' (string expected, got nil) -\end{verbatim} +\end{lstlisting} %<*en> If so, please execute a batch file which is written on @@ -754,9 +775,9 @@ run \LuaTeX-ja in this directory, and finally delete the temporary directory. %To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document: %\LuaTeX-jaを plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい: -\begin{verbatim} +\begin{lstlisting} \input luatexja.sty -\end{verbatim} +\end{lstlisting} %This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents: %これで(\texttt{ptex.tex}のように)日本語組版のための最低限の設定がなされる: @@ -769,12 +790,12 @@ run \LuaTeX-ja in this directory, and finally delete the temporary directory. \textbf{direction}& \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule \smash{\raisebox{-1ex}{\emph{yoko} (horizontal)}}& -\emph{mincho}&Ryumin-Light &\cs{tenmin}&\cs{sevenmin}&\cs{fivemin}\\ -&\emph{gothic}&GothicBBB-Medium&\cs{tengt} &\cs{sevengt} &\cs{fivegt}\\ +\emph{mincho}&IPAex Mincho&\cs{tenmin}&\cs{sevenmin}&\cs{fivemin}\\ +&\emph{gothic}&IPAex Gothic&\cs{tengt} &\cs{sevengt} &\cs{fivegt}\\ \midrule \smash{\raisebox{-1ex}{\emph{tate} (vertical)}}& -\emph{mincho}&Ryumin-Light &\cs{tentmin}&\cs{seventmin}&\cs{fivetmin}\\ -&\emph{gothic}&GothicBBB-Medium&\cs{tentgt} &\cs{seventgt} &\cs{fivetgt}\\ +\emph{mincho}&IPAex Mincho&\cs{tentmin}&\cs{seventmin}&\cs{fivetmin}\\ +&\emph{gothic}&IPAex Gothic&\cs{tentgt} &\cs{seventgt} &\cs{fivetgt}\\ \bottomrule \end{tabular} \end{center} @@ -786,30 +807,24 @@ run \LuaTeX-ja in this directory, and finally delete the temporary directory. \toprule \emph{組方向}&\emph{字体}&\emph{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule \smash{\raisebox{-1ex}{横組}}& -明朝体&Ryumin-Light &\cs{tenmin}&\cs{sevenmin}&\cs{fivemin}\\ -&ゴシック体&GothicBBB-Medium&\cs{tengt} &\cs{sevengt} &\cs{fivegt}\\ +明朝体&IPAex明朝&\cs{tenmin}&\cs{sevenmin}&\cs{fivemin}\\ +&ゴシック体&IPAexゴシック&\cs{tengt} &\cs{sevengt} &\cs{fivegt}\\ \midrule \smash{\raisebox{-1ex}{縦組}}& -明朝体&Ryumin-Light &\cs{tentmin}&\cs{seventmin}&\cs{fivetmin}\\ -&ゴシック体&GothicBBB-Medium&\cs{tentgt} &\cs{seventgt} &\cs{fivetgt}\\ +明朝体&IPAex明朝&\cs{tentmin}&\cs{seventmin}&\cs{fivetmin}\\ +&ゴシック体&IPAexゴシック&\cs{tentgt} &\cs{seventgt} &\cs{fivetgt}\\ \bottomrule \end{tabular} \end{center} % \begin{itemize} %<*en> -\item It is widely accepted that fonts ``Ryumin-Light'' and - ``GothicBBB-Medium'' aren't embedded into PDF files, and a PDF reader - substitute them by some external Japanese fonts (\textit{e.g.}, - Ryumin-Light is substituted with Kozuka Mincho in Adobe Reader). - We adopt this custom to the default setting. +\item With \texttt{luatexja.cfg}, one can use other fonts +as ``default'' Japanese fonts (Subsection~\ref{ssec-cfg}). % %<*ja> -\item ``Ryumin-Light''と``GothicBBB-Medium''はPDFファイルに埋め込まずに - 名前参照のみで用いることが広く受け入れられており,この場合PDFリーダーが - 適切な外部フォントで代用する(例えば,Adobe ReaderではRyumin-Lightは - 小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと - して採用する. +\item \texttt{luatexja.cfg} を用いることによって,標準和文フォントを +IPAexフォントから別のフォントに置き換えることができる.\ref{ssec-cfg}節を参照. % %<*en> @@ -844,8 +859,6 @@ run \LuaTeX-ja in this directory, and finally delete the temporary directory. %\subsection{\LaTeX で使う} \label{ssec-ltx} -\paragraph{\LaTeXe} - %<*en> Using in \LaTeXe\ is basically same. To set up the minimal environment for Japanese, you only have to load \texttt{luatexja.sty}: @@ -854,9 +867,9 @@ for Japanese, you only have to load \texttt{luatexja.sty}: \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を 設定するためには,\texttt{luatexja.sty}を読み込むだけでよい: % -\begin{verbatim} +\begin{lstlisting} \usepackage{luatexja} -\end{verbatim} +\end{lstlisting} %<*en> It also does minimal settings (counterparts in \pLaTeX\ are \texttt{% plfonts.dtx} and \texttt{pldefs.ltx}): @@ -894,15 +907,14 @@ By default, the following fonts are used for \emph{mincho} and \emph{gothic}: \begin{center}\small \begin{tabular}{ccccc} \toprule -\textbf{classification}&\textbf{family name}&\cs{mdseries}&\cs{bfseries}&\textbf{scale}\\\midrule -\emph{mincho} (明朝体)&\tt mc&Ryumin-Light &GothicBBB-Medium&0.962216\\ -\emph{gothic} (\textgt{ゴシック体})&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\ +\textbf{classification}&\textbf{family}&\cs{mdseries}&\cs{bfseries}&\textbf{scale}\\\midrule +\emph{mincho} (明朝体)&\tt mc&IPAex Mincho&IPAex Gothic&0.962216\\ +\emph{gothic} (\textgt{ゴシック体})&\tt gt&IPAex Gothic&IPAex Gothic&0.962216\\ \bottomrule \end{tabular} \end{center} -Note that the bold series in both family are same as the medium series of \emph{gothic} family. -This is a convention in \pLaTeX. This is trace that there were only 2~fonts (these are Ryumin-Light -and GothicBBB-Medium) in early years of DTP. There is no italic nor slanted shape for +Note that the bold series in both family are same as the medium series of \emph{gothic} + family. There is no italic nor slanted shape for these \texttt{mc}~and~\texttt{gt}. % %<*ja> @@ -921,16 +933,14 @@ and GothicBBB-Medium) in early years of DTP. There is no italic nor slanted shap \begin{tabular}{ccccc} \toprule \emph{字体}&\emph{ファミリ}&\cs{mdseries}&\cs{bfseries}&\emph{スケール}\\\midrule -明朝体&\tt mc&Ryumin-Light &GothicBBB-Medium&0.962216\\ -ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\ +明朝体&\tt mc&IPAex明朝&IPAexゴシック&0.962216\\ +ゴシック体&\tt gt&IPAexゴシック&IPAexゴシック&0.962216\\ \bottomrule \end{tabular} \end{center} どちらのファミリにおいても,そのboldシリーズで使われるフォントは -ゴシック体のmediumシリーズで使われるフォントと同じあることに注意. -これは初期のDTPにおいて和文フォントが2つ(それがちょうど\ -Ryumin-Light, GothicBBB-Mediumだった)しか利用できなかった時の名残であり,\pLaTeX{} -での標準設定とも同じである. +ゴシック体のmediumシリーズで使われるフォントと同じであることに注意. +また,どちらのファミリでもイタリック体・スラント体は定義されない. % @@ -966,6 +976,21 @@ Okumura), namely, \Pkg{ltjclasses}\footnote{% がそれぞれ用意されている. % +%<*ja> +\paragraph{脚注とボトムフロートの出力順序} +オリジナルの\LaTeX では脚注がボトムフロートの上に来るようになっており, +\pLaTeX では脚注がボトムフロートの下に来るように変更されている. + +\LuaTeX-jaでは「欧文クラスの中にちょっとだけ日本語を入れる」という利用も考慮し, +脚注とボトムフロートの順序は\LaTeX 通りとした.もし\pLaTeX の出力順序が好みならば, +\Pkg{stfloats}パッケージを利用して +\begin{lstlisting} + \usepackage{stfloats} \fnbelowfloat +\end{lstlisting} +のようにすればよい.\Pkg{footmisc}パッケージを \texttt{bottom}\ オプションを指定して +読み込むという方法もあるが,それだとボトムフロートと脚注の間が開いてしまう. +% + %\section{Changing Fonts} %\section{フォントの変更} @@ -1070,10 +1095,10 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ 実装では \cs{DeclareFontFamily} を用いても問題は生じない. \item 和文フォントのシェイプを定義するには,通常の \cs{DeclareFontShape} を使えば良い: % -\begin{verbatim} +\begin{lstlisting} \DeclareFontShape{JY3}{mc}{bx}{n}{<-> s*KozMinPr6N-Bold:jfm=ujis;-kern}{} % Kozuka Mincho Pr6N Bold -\end{verbatim} +\end{lstlisting} %<*ja> 仮名書体を使う場合など,複数の和文フォントを組み合わせて使いたい場合は \ref{ssec-altfont}節の \cs{ltjdeclarealtfont} と,その\LaTeX 版の\ @@ -1287,14 +1312,14 @@ before \Pkg{luatexja-preset}: 斜体大文字が出なくなる,など.}場合は, 次のように\Pkg{luatexja-preset}の前に\Pkg{fontspec}を手動で読みこめば良い: % -\begin{verbatim} +\begin{lstlisting} \usepackage[no-math]{fontspec} \usepackage[...]{luatexja-preset} -\end{verbatim} +\end{lstlisting} %\paragraph{General options} %\paragraph{一般的なオプション} -\begin{cslist} +\begin{cslist}[before*=] \item[nodeluxe] %<*en> @@ -1306,7 +1331,7 @@ This means that \verb+\mcfamily\bfseries+, \verb+\gtfamily\bfseries+ and %<*ja> \LaTeXe 環境下での標準設定のように,明朝体・ゴシック体を各1ウェイトで使用する. より具体的に言うと,この設定の下では -\ \verb+\mcfamily\bfseries+, \verb+\gtfamily\bfseries+, +\ \verb+\mcfamily\bfseries+, \verb+\gtfamily\bfseries+, \verb+\gtfamily\mdseries+はみな同じフォントとなる. \emph{このオプションは標準で有効になっている.} % @@ -1331,10 +1356,10 @@ bold (\cs{bfseries}). % \item[expert] %<*en> -Use horizontal kana alternates, and define a command \cs{rubyfamily} to use kana +Use horizontal/vertical kana alternates, and define a command \cs{rubyfamily} to use kana characters designed for ruby. % -%横組専用仮名を用いる.また,\cs{rubyfamily} でルビ用仮名が使用可能となる. +%横組・縦組専用仮名を用いる.また,\cs{rubyfamily} でルビ用仮名が使用可能となる. \item[bold] %Substitute bold series of \textit{gothic} for bold series of \textit{mincho}. %「明朝の太字」をゴシック体の太字によって代替する. @@ -1365,7 +1390,6 @@ We didn't taken account of when both \texttt{90jis} and \texttt{jis2004} are sp 同時に指定された場合の動作については全く考慮していない. % -\newpage %\paragraph{Presets for multi weight} %\paragraph{多ウェイト用プリセットの一覧} %<*en> @@ -1469,7 +1493,7 @@ Std/StdNフォントであり,その他はAdobe-Japan1-5対応である. \end{tabular} \end{center} -%\medskip +%\newpage \item[morisawa-pro] Morisawa Pro (Adobe-Japan1-4) fonts. % \\*[-\dimexpr\medskipamount+\baselineskip\relax] @@ -1499,7 +1523,6 @@ Std/StdNフォントであり,その他はAdobe-Japan1-5対応である. \end{tabular} \end{center} -\newpage \item[yu-win] Yu fonts bundled with Windows~8.1. % \\*[-\dimexpr\medskipamount+\baselineskip\relax] \item[yu-osx] Yu fonts bundled with OSX~Mavericks. @@ -1530,7 +1553,7 @@ Std/StdNフォントであり,その他はAdobe-Japan1-5対応である. \end{tabular} \end{center} -\end{cslist} +\end{cslist} %\paragraph{Presets for single weight} %\paragraph{単ウェイト用プリセット一覧} %<*en> @@ -1551,9 +1574,9 @@ even if \texttt{deluxe} option is also specified). \midrule %<*en> \it mincho&Ryumin-Light (non-embedded) -&IPAMincho&IPAexMincho&MS Mincho\\ +&IPA Mincho&IPAex Mincho&MS Mincho\\ \it gothic&GothicBBB-Medium (non-embedded) -&IPAGothic&IPAexGothic&MS Gothic\\ +&IPA Gothic&IPAex Gothic&MS Gothic\\ % %<*ja> \gtfamily 明朝体&Ryumin-Light(非埋込) @@ -1564,7 +1587,6 @@ even if \texttt{deluxe} option is also specified). \bottomrule \end{tabular}\par\medskip} - %\paragraph{Using HG fonts} %\paragraph{HGフォントの利用} %<*en> @@ -1582,14 +1604,14 @@ We can use HG~fonts bundled with Microsoft~Office for realizing multiple weights \midrule %<*en> \bf mincho medium -&IPAMincho&IPAexMincho&MS Mincho\\\midrule +&IPA Mincho&IPAex Mincho&MS Mincho\\\midrule \bf mincho bold& \multicolumn{3}{c}{HG Mincho E}\\\midrule \bf Gothic medium\\ ~~without \texttt{deluxe} -&IPAGothic&IPAexGothic&MS Gothic\\ +&IPA Gothic&IPAex Gothic&MS Gothic\\ ~~with {\tt jis2004} -&IPAGothic&IPAexGothic&MS Gothic\\ +&IPA Gothic&IPAex Gothic&MS Gothic\\ \cmidrule(lr){1-4} ~~otherwise& \multicolumn{3}{c}{HG Gothic M}\\\midrule @@ -1633,6 +1655,7 @@ are internally specified by: \end{description} % %<*ja> +\newpage なお,HG明朝E・HGゴシックE・HG創英角ゴシックUB・HG丸ゴシック体PROの4つについては,内部で \begin{description} \item[標準] フォント名(\texttt{HGMinchoE} など) @@ -1676,10 +1699,10 @@ If you want to use these functions, load \Pkg{luatexja-otf} package. %<*ja> \Pkg{otf}パッケージでは,それぞれ次のようなオプションが存在した: \begin{cslist} -\item[\cs{deluxe}] 明朝体・ゴシック体各2ウェイトと,丸ゴシック体を扱えるようになる. -\item[\cs{expert}] 仮名が横組・縦組専用のものに切り替わり,ルビ用仮名も +\item[deluxe] 明朝体・ゴシック体各2ウェイトと,丸ゴシック体を扱えるようになる. +\item[expert] 仮名が横組・縦組専用のものに切り替わり,ルビ用仮名も \ \cs{rubyfamily}\ によって扱えるようになる. -\item[\cs{bold}] ゴシック体を標準で太いウェイトのものに設定する. +\item[bold] ゴシック体を標準で太いウェイトのものに設定する. \end{cslist} しかしこれらのオプションは\Pkg{luatexja-otf}パッケージには存在しない. \Pkg{otf}パッケージが文書中で使用する和文用TFMを自前の物に置き換えていたのに対し, @@ -1691,6 +1714,59 @@ If you want to use these functions, load \Pkg{luatexja-otf} package. \ref{ssec-fontspec}節 (\Pkg{fontspec}) の方法で手動で指定する必要がある. % +%\subsection{Changing default Japanese fonts} +%\subsection{標準和文フォントの変更} +\label{ssec-cfg} +%<*en> +If \texttt{luatexja.cfg} can be seen from \LuaTeX, \LuaTeX-ja automatically reads it. +The main use of \texttt{luatexja.cfg} is for changing default Japanese fonts, +when IPAex fonts cannot be installed in \TeX~system. +One should not overuse this \texttt{luatexja.cfg}; fonts which will be used in +a document should be specified in its source. + +For example, +\begin{lstlisting} +\def\ltj@stdmcfont{IPAMincho} +\def\ltj@stdgtfont{IPAGothic} +\end{lstlisting} +makes that IPA~Mincho and IPA~Gothic will be used as default Japanese fonts, instead of +IPAex~Mincho and IPAex~Gothic. + +For another example, the following two lines makes that +non-embedded fonts Ryumin-Light~and~GothicBBB-Medium as default Japanese fonts +(as the earlier version of \LuaTeX-ja): +\begin{lstlisting} +\def\ltj@stdmcfont{psft:Ryumin-Light} +\def\ltj@stdgtfont{psft:GothicBBB-Medium} +\end{lstlisting} +% +%<*ja> +\LuaTeX から見える位置に \texttt{luatexja.cfg} があれば,\LuaTeX-jaはそれを読み込む. +このファイルを用いるとplain~\TeX, \LaTeXe における標準和文フォントを +IPAex明朝・IPAexゴシックから変更することができる. +しかし,基本的には\emph{文章中で用いるフォントは(例えば \Pkg{luatexja-preset} などで) +文書ソース内で指定するべき}であり,この \texttt{luatexja.cfg} は, +「IPAexフォントがインストールできない」など,IPAexフォントが使用できない場合にのみ +応急処置的に用いるべきである. + +例えば +\begin{lstlisting} +\def\ltj@stdmcfont{IPAMincho} +\def\ltj@stdgtfont{IPAGothic} +\end{lstlisting} +と記述しておけば,標準和文フォントがIPA明朝・IPAゴシックへと変 +更される. + + +なお,20140906.0以前のバージョンのように, +Ryumin-Light, GothicBBB-Mediumという名前の非埋込フォントを用いる場合は +\begin{lstlisting} +\def\ltj@stdmcfont{psft:Ryumin-Light} +\def\ltj@stdgtfont{psft:GothicBBB-Medium} +\end{lstlisting} +と記述すればよい. +% + %\section{Changing Parameters} %\section{パラメータの変更} @@ -1760,9 +1836,9 @@ it sets \item 2番,3番,6番,7番,8番の文字範囲に属する文字は\textbf{JAchar}. \end{itemize} % -\begin{verbatim} +\begin{lstlisting} \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}} -\end{verbatim} +\end{lstlisting} %<*en> The argument to \textsf{jacharrange} parameter is a list of non-zero integer. Negative integer $-n$ in the list means that ``each character in the range~$n$ is an @@ -1810,7 +1886,7 @@ these eight ranges belongs to the character range~217. % \begin{description} %<*en> -\newpage + \item[Range~8${}^{\text{J}}$] The intersection of the upper half of ISO~8859-1 (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range consists of the following characters: @@ -1986,8 +2062,7 @@ The block list is indicated in Table~\ref{table-rng7}. \end{table} \end{description} - -%\newpage\subsection{\Param{kanjiskip} and \Param{xkanjiskip}} +%\subsection{\Param{kanjiskip} and \Param{xkanjiskip}} %\subsection{\Param{kanjiskip}と\Param{xkanjiskip}} \label{subs-kskip} @@ -2117,9 +2192,9 @@ as follows: 仕様では,\Param{jaxspmode}, \Param{alxspmode}はテーブルを共有しており, 上のコードの1行目を次のように変えても同じことになる: % -\begin{verbatim} +\begin{lstlisting} \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}} -\end{verbatim} +\end{lstlisting} %<*en> One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}). % @@ -2217,6 +2292,30 @@ xyz漢字 }abcかな \end{LTXexample} +%<*en> +Note that setting positive \Param{yalbaselineshift}~or~\Param{talbaselineshift} +parameters does not increase the depth of one-letter ``syllable'' $p$ of \textbf{Alchar}, if +its left-protrusion~(\cs{lpcode}) and right-protrusion~(\cs{rpcode}) are both non-zero. +This is because +\begin{itemize} +\item These two parameters are implemented by setting yoffset field of a +glyph node, and this does not increase the depth of the glyph. +\item To cope with the above situation, \LuaTeX-ja automatically supplies +a rule in every ``syllable''. +\item However, we cannot use this ``supplying a rule'' method if \dots +\end{itemize} + +This problem does not apply for \Param{yjabaselineshift}~nor~\Param{tjabaselineshift}. +% +%<*ja> +なお,以下の場合には1文字の\textbf{ALchar}からなる「音節」の深さは増加しないことに注意. +\begin{itemize} + \item \Param{yalbaselineshift},~\Param{talbaselineshift}パラメータが正になっている. + \item 「音節」を構成する唯一の文字$p$の +左余白への突出量(\cs{lpcode}),右余白への突出量(\cs{rpcode})がどちらも非零である. +\end{itemize} +\Param{yjabaselineshift},~\Param{tjabaselineshift}パラメータについてはこのような問題は起こらない. +% %<*ja> \paragraph{数式における挙動:\pTeX との違い} @@ -2243,10 +2342,10 @@ xyz漢字 \begin{tabular}{lp{30\zw}} \toprule \emph{入力}&\vspace*{\dimexpr-\origbaselineskip-\smallskipamount} -\begin{verbatim} +\begin{lstlisting} 数式abc: $あa\hbox{い}$, $\int_0^x t\,dt=x^2\!/2$, $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ -\end{verbatim}\\ +\end{lstlisting}\\ \noalign{\vskip-\origbaselineskip} \midrule \emph{\pTeX}& @@ -2273,6 +2372,7 @@ $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ \suppressfloats[t] %<*ja> \section{\LuaTeX-jaにおける \cs{catcode}} +\label{sec-catcode} \subsection{予備知識:\pTeX と\upTeX における \cs{kcatcode}} \pTeX,\upTeX においては,和文文字が制御綴内で利用できるかどうか は \cs{kcatcode} の値によって決定されるのであった. @@ -2280,6 +2380,7 @@ $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ % %<*en> \section{\cs{catcode} in \LuaTeX-ja} +\label{sec-catcode} \subsection{Preliminaries: \cs{kcatcode} in \pTeX\ and \upTeX} In \pTeX~and~\upTeX, the value of \cs{kcatcode} determines whether a Japanese character can be used in a control word. @@ -2622,7 +2723,7 @@ Example&\obox{\yoko}&\obox{\tate}&\obox{\dtou}&\obox{\utod}\\ %<*en> \LuaTeX-ja supports four directions, as shown in Table~\ref{tab-dir}. -The second column (\emph{yoko} direction) is just horizontal writing, +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. @@ -2904,17 +3005,17 @@ However, this no longer applies in \LuaTeX-ja. \the\wd0,~\hbox{\tate \the\wd0} \end{LTXexample} -To access box dimensions \emph{with respect to current direction}, +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}\{\}\textrm{, }\cs{ltjgetht}\{\}\textrm{, }% \cs{ltjgetdp}\{\}] -These commands return \emph{an internal dimension} of \cs{box} with respect to +These commands return \emph{an internal dimension} of \cs{box} with respect to the current direction. One can use these in \cs{dimexpr} primitive, as the followings. -\begin{verbatim} +\begin{lstlisting} \dimexpr 2\ltjgetwd{42}-3pt\relax, \the\ltjgetwd{1701} -\end{verbatim} +\end{lstlisting} By implementaion, the argument must be grouped as \verb+\ltjgetwd{42}+, if the argument consists of more than one token. \begin{LTXexample}[width=0.3\textwidth] @@ -2936,9 +3037,9 @@ if the argument consists of more than one token. \cs{ltjsetdp}=] These commands set the dimension of \cs{box}. Unlike \cs{ltjgetwd}, one does not need to group the argument ; four calls of \cs{ltjsetwd} below have the same meaning. -\begin{verbatim} +\begin{lstlisting} \ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt -\end{verbatim} +\end{lstlisting} \end{cslist} % @@ -2969,9 +3070,9 @@ These commands set the dimension of \cs{box}. Unlike \cs{ltjgetwd}, one doe \item[\cs{ltjgetwd}\{\}\textrm{, }\cs{ltjgetht}\{\}\textrm{, }% \cs{ltjgetdp}\{\}] 現在の組方向に応じたボックスの寸法の取得を行う.結果は内部長さであるため, -\begin{verbatim} +\begin{lstlisting} \dimexpr 2\ltjgetwd{42}-3pt\relax, \the\ltjgetwd{1701} -\end{verbatim} +\end{lstlisting} のように \cs{wd} の代わりとして扱うことができる.引数が1桁の場合は, \cs{ltjgetwd3} のように引数をグループで括らなくても良いが,そうでない場合は (通常の命令への引数のように)\verb+\ltjgetwd{42}+ とグループに括る必要がある. @@ -2995,9 +3096,9 @@ These commands set the dimension of \cs{box}. Unlike \cs{ltjgetwd}, one doe \cs{ltjsetdp}=] 現在の組方向に応じたボックスの寸法の設定を行う.\cs{afterassignment} を2回利用して 実装しているので,次の4通りは全て同じ意味である. -\begin{verbatim} +\begin{lstlisting} \ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt -\end{verbatim} +\end{lstlisting} 設定値は「横組」「縦組及び \cs{utod} 方向」「\cs{dtou} 方向」 の3種ごとに独立して記録される.参考として,Gitリポジトリ内の @@ -3034,7 +3135,7 @@ Returned value&\texttt{4}&\texttt{3}&\texttt{1}&\texttt{11}&\texttt{0}\\ %<*ja> \subsection{組方向の取得} 「現在の組方向」や「番のボックスの組方向」は, -\pTeX では\cs{ifydir} や \cs{ifybox} といった条件判断文を使って +\pTeX では \cs{ifydir} や \cs{ifybox} といった条件判断文を使って 判断することができた. しかし,\LuaTeX-jaはあくまでも\TeX マクロとLuaコードで 記述されており,それでは新たな条件判断命令を作るのは難しい. @@ -3064,12 +3165,18 @@ Returned value&\texttt{4}&\texttt{3}&\texttt{1}&\texttt{11}&\texttt{0}\\ \end{LTXexample} これらを用いれば,例えば -\pTeX の \cs{ifydir}, \cs{iftbox200} と同等の条件判断を -\begin{verbatim} +\pTeX の \cs{ifydir},~\cs{ifybox200} と同等の条件判断を +\begin{lstlisting} \ifnum\ltjgetparameter{direction}=4 -\ifnum\ltjgetparameter{boxdir}{200}=3 -\end{verbatim} +\ifnum\ltjgetparameter{boxdir}{200}=4 +\end{lstlisting} のように行うことができる. +\cs{iftdir} は少々面倒であるが +\begin{lstlisting} +\ifnum\numexpr + \ltjgetparameter{direction}-(\ltjgetparameter{direction}/8)*8=3 +\end{lstlisting} +とすればよい. % %<*en> @@ -3080,7 +3187,7 @@ overridden by \LuaTeX-ja, using~\verb+\protected\def+. \item[\cs{unhbox}\textrm{, }\cs{unvbox}\textrm{, }\cs{unhcopy}\textrm{, }\cs{unvcopy}] \item[\cs{vadjust}\{\}] \item[\cs{lastbox}] - \item[\cs{raise}\textrm{, }\cs{lower}\textrm{\ etc., }\cs{vcenter}] + \item[\cs{raise}\textrm{, }\cs{lower}\textrm{\ etc., }\cs{vcenter}] \item[\cs{vcenter}] \end{cslist} % @@ -3099,10 +3206,10 @@ overridden by \LuaTeX-ja, using~\verb+\protected\def+. 周囲の垂直リストの組方向と一致しない場合にエラーを出力し, 該当の \cs{vadjust} を無効にする. \item[\cs{lastbox}] ボックスの「中身」を現在の組方向に合わせるためのノード - (\textit{dir\_node}という)を必要ならば除去し, + (\textit{dir\_box}という)を必要ならば除去し, 正しく「中身」のボックスが返されるように前処理をする. \item[\cs{raise}\textrm{, }\cs{lower}\textrm{\ etc., }\cs{vcenter}] - 一方,こちらでは必要に応じて\textit{dir\_node}を作成する前処理を追加している. + 一方,こちらでは必要に応じて\textit{dir\_box}を作成する前処理を追加している. \end{cslist} % @@ -3350,10 +3457,10 @@ because of the compatibility with previous versions of \LuaTeX-ja. NFSS2用の命令(\ref{ssec-chgfnt}節,\ref{ssec-nfsspat}節)における指定では カーニング情報は標準で使用する}ことになっているようである. 言い換えれば,カーニング情報を使用しない設定にするには,面倒でも -\begin{verbatim} +\begin{lstlisting} \jfont\hoge=KozMinPr6N-Regular:jfm=ujis;-kern at 3.5mm \DeclareFontShape{JY3}{fuga}{m}{n} {<-> s*KozMinPr6N-Regular:jfm=ujis;-kern}{} -\end{verbatim} +\end{lstlisting} のように,\texttt{-kern} という指定を自分で追加しなければいけない. \item 一方,\emph{\Pkg{luatexja-fontspec} の提供する \cs{setmainjfont}\ @@ -3455,9 +3562,9 @@ letter-spacing and the width of italic correction are not correct: \item 出力時に,自動的に「\verb+vert+ feature相当」のグリフ置換が行われる. これは,\Pkg{luaotfload}による各種featureのサポートとは全く別個に行われるもので, いちいち \verb+vert+ featureを指定する必要はない. -\begin{verbatim} +\begin{lstlisting} \tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujis % OK -\end{verbatim} +\end{lstlisting} \item \ref{ssec-math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない. \item \texttt{jfm=}\ の部分には縦組用JFMを指定する. 以下の縦組用JFMが\LuaTeX-jaには同梱されており,違いを表\ref{tab-difjfm-tate}に示した. @@ -3483,9 +3590,9 @@ Besides ``\texttt{file:}''\ and ``\texttt{name:}''\ prefixes which are introduced in the \Pkg{luaotfload} package, \LuaTeX-ja adds ``\texttt{psft:}''\ prefix in \cs{jfont} (and~\cs{font}), to specify a ``name-only'' Japanese font which -will not be embedded to PDF. Typical use of this prefix is to specify -standard, non-embedded Japanese fonts, namely, ``Ryumin-Light'' and -``GothicBBB-Medium''. +will not be embedded to PDF. +Note that these non-embedded fonts under current \LuaTeX\ has Identity-H encoding, +and this violates the standard ISO32000-1:2008~(\cite{pdfstd}). \emph{OpenType font features, such as ``{\tt +jp90}'', have no meaning in name-only fonts using ``{\tt psft:}''\ prefix, @@ -3499,8 +3606,10 @@ with \texttt{psft} prefix, because they are only simple linear transformations. \cs{jfont}(と \cs{font} プリミティブ)では \texttt{psft:}プリフィックスを用いることができる. このプリフィックスを用いることで,PDFには埋め込まれない「名前だけの」 -和文フォントを指定することができる.「標準的な」非埋め込み和文フォント, -つまり「Ryumin-Light」「GothicBBB-Medium」の指定でこのプリフィックスが使われる. +和文フォントを指定することができる. +なお,現行の\LuaTeX で非埋め込みフォントを作成するとPDF内でのエンコーディングが +Identity-Hとなり,PDFの標準規格ISO32000-1:2008~(\cite{pdfstd})に非準拠になってしまう +ので注意してほしい. \emph{\texttt{psft} プリフィックスの下では \texttt{+jp90} などのOpenType font featureの効力はない. @@ -3581,9 +3690,9 @@ Please contact the LuaTeX-ja project team. \label{ssec-jfm-str} %A JFM file is a Lua script which has only one function call: %JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである: -\begin{verbatim} +\begin{lstlisting} luatexja.jfont.define_jfm { ... } -\end{verbatim} +\end{lstlisting} %<*en> Real data are stored in the table which indicated above by \verb+{ ... }+. So, the rest of this subsection are devoted to describe the @@ -3616,14 +3725,22 @@ JFMの書字方向.\texttt{'yoko'}(横組)と \texttt{'tate'}(縦組) %(必須) %The amount of the length of the ``full-width''. -%「全角幅」の長さ.この量が \cs{zw} の長さを決定する. +%<*ja> +「全角幅」の長さ.この量が \cs{zw} の長さとなる.\pTeX では +「全角幅」\texttt{1zw} は「文字クラス0の文字」の幅と決められていたが, +\LuaTeX-jaではここで指定する. +% \item[zh=] %(required) %(必須) %The amount of the ``full-height'' (height + depth). -%「全角高さ」(height + depth)の長さ.通常は全角幅と同じ長さになるだろう. +%<*ja> +「全角高さ」(height + depth)の長さ.通常は全角幅と同じ長さになるだろう. +\pTeX では 「全角高さ」\texttt{1zh} は「文字クラス0の文字」の高さと深さの和と決められていたが, +\LuaTeX-jaではここで指定する. +% \item[kanjiskip=\{, , \}] %(optional) @@ -3705,7 +3822,7 @@ This field is a list of characters which are in this character \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+}」のような,文字それ自体の後にアスタリスクをつけたもの \item いくつかの「仮想的な文字」(後に説明する) \end{itemize} -% +% \item[width=, height=, depth=, italic=] %(required) @@ -3738,7 +3855,7 @@ These fields are for adjusting the position of the ``real'' glyph. Legal 3~fields are omitted, \texttt{left} and \texttt{down} are treated as~0, and \texttt{align} field is treated as \texttt{'left'}. -The effects of these 3~fields are indicated in +The effects of these 3~fields are indicated in Figures \ref{fig-pos}~and~\ref{fig-pos-tate}. % %<*ja> @@ -3820,7 +3937,7 @@ when the current character class is the class for opening delimiters'. \end{minipage}% \begin{minipage}{0.6\textwidth}% %<*en> -Consider a Japanese character node which belongs to +Consider a Japanese character node which belongs to a character class whose the \texttt{align} field is \texttt{'middle'}. % @@ -3931,11 +4048,11 @@ Furthermore, the glyph is shifted according to values of fields \item 実際のグリフの「垂直位置」は,ベースラインが文字の物理的な左右方向の中央を通る 位置となる. -\item +\item また,この場合\texttt{align}フィールドは \texttt{'right'} なので, 「水平位置」は字送り方向に「右寄せ」したものとなる(緑色の長方形). その際,高さ・深さは,実フォントのascender, descenderの値が使われる. -\item +\item その後さらに \texttt{left} と \texttt{down} の値に従ってシフトされる のは横組用和文フォントと変わらない. \end{itemize} @@ -4175,9 +4292,9 @@ See Japanese version of this manual. \item JFM中の全ての数値を$1/0.962216$倍しておく. \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする. \LaTeX でのフォント宣言なら,例えば次のように: -\begin{verbatim} +\begin{lstlisting} \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{} -\end{verbatim} +\end{lstlisting} \end{itemize} \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする (JFM中に単に書かなければよい). @@ -4240,12 +4357,18 @@ Table~\ref{tab-math} shows counterparts to \TeX's primitives for math font families. There is no relation between the value of \cs{fam} and that of \cs{jfam}; with appropriate settings, you can set both \cs{fam} and \cs{jfam} to the same value. +Here in the argument of \Param{jatextfont} etc.\ is +a control sequence which is defined by \cs{jfont}, i.e., +a \emph{horizontal} Japanese font. % %<*ja> \LuaTeX-jaの数式中での和文フォントの扱いも同様である. 表\ref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する ものを示している.\cs{fam} と \cs{jfam} の値の間には関係はなく, 適切な設定の下では \cs{fam} と \cs{jfam} の両方に同じ値を設定することができる. +\Param{jatextfont} 他の第2引数は,\cs{jfont} で定義された +\emph{横組用}和文フォントである.\cs{tfont} で定義された +\emph{縦組用}和文フォントを指定することは想定していない. % \begin{table}[!tb] @@ -4559,8 +4682,8 @@ is the position of \verb+hpack_filter+ callback in the source of \LuaTeX, see Section~\ref{sec-para}. % %<*ja> -先に述べたように,\cs{ltjsetparameter} と \cs{ltjgetparameter} は -\LuaTeX-jaのほとんどのパラメータにアクセスするための命令である. +先に述べたように,\LuaTeX-jaのほとんどの内部パラメータにアクセスするには +\cs{ltjsetparameter} と \cs{ltjgetparameter} を用いる. \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を 採用しない理由の一つは,\LuaTeX のソースにおける \verb+hpack_filter+ コールバックの位置にある.\ref{sec-para}章を参照. @@ -4616,8 +4739,8 @@ adopted in the whole paragraph or the whole hbox. % \end{itemize} -\begin{description}[font=\mdseries] -\item[\DParam{jcharwidowpenalty}\,=$^\ast$] [\cs{jcharwidowpenalty}]\ +\begin{cslist}[style=standard] +\item[\DParam{jcharwidowpenalty}\,=$^\ast$] [\cs{jcharwidowpenalty}]\ %<*en> Penalty value for suppressing orphans. This penalty is inserted just @@ -4651,9 +4774,9 @@ At the present version, the lowermost bit of indicates この文字の前に挿入/追加されるペナルティの量を指定する. 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので, -\begin{verbatim} +\begin{lstlisting} \ltjsetparameter{prebreakpenalty={`〙,10000}} -\end{verbatim} +\end{lstlisting} と,最大値の10000が標準で指定されている.他にも,小書きのカナなど,絶対禁止とい うわけではないができれば行頭にはきて欲しくない場合に,0と 10000の間の値を指定するのも有用であろう. @@ -4662,9 +4785,9 @@ At the present version, the lowermost bit of indicates Set a penalty which is inserted automatically before the character , to prevent a line starts from this character. For example, a line cannot started with one of closing brackets ``〗'', so \LuaTeX-ja sets -\begin{verbatim} +\begin{lstlisting} \ltjsetparameter{prebreakpenalty={`〙,10000}} -\end{verbatim} +\end{lstlisting} by default. % @@ -4765,7 +4888,7 @@ Note that parameters \Param{jaxspmode} and \Param{alxspmode} share a common tabl % %<*ja> \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため, -これら2つのパラメータは互いの異名となっていることに注意する. +これら2つのパラメータは互いの別名となっていることに注意する. % \item[\DParam{autospacing}\,=] [\cs{autospacing}] @@ -4819,13 +4942,13 @@ The default value is \texttt{paverage}. \dots \item[\DParam{jacharrange}\,=] \item[\DParam{kansujichar}\,=\{, \}$^\ast$] [\cs{kansujichar}] -\item[\DParam{direction}\,=\ \hbox{\rm (always local)}]\ +\item[\DParam{direction}\,=\ \hbox{\rm (always local)}]\ %<*en> Assigning to this parameter has the same effect as \cs{yoko}~(if $\hbox{}=4$), \cs{tate}~(if $\hbox{}=3$), \cs{dtou}~(if $\hbox{}=1$) or \cs{utod}~(if $\hbox{}=11$). -If the argument is not one of 4,~3, 1~nor~11, +If the argument is not one of 4,~3, 1~nor~11, the behavior of this assignment is undefined. % %<*ja> @@ -4835,7 +4958,7 @@ the behavior of this assignment is undefined. 動作は未定義である. % -\end{description} +\end{cslist} \subsection{\cs{ltjgetparameter}} \label{ssec-getpar} @@ -5144,9 +5267,9 @@ ignored. For example, if \cs{hoge} uses \texttt{jfm-ujis.lua}, the standard JFM of \LuaTeX-ja, then -\begin{verbatim} +\begin{lstlisting} \ltjdeclarealtfont\hoge\piyo{"3000-"30FF, {-1}-{-1}} -\end{verbatim} +\end{lstlisting} does \begin{quote} If the current Japanese font is \cs{hoge}, \texttt{U+3000}--\texttt{U+30FF} @@ -5178,9 +5301,9 @@ are typeset by \cs{piyo}. 例えば,\cs{hoge} のJFMが\LuaTeX-ja標準の \ \texttt{jfm-ujis.lua} であった場合, -\begin{verbatim} +\begin{lstlisting} \ltjdeclarealtfont\hoge\piyo{"3000-"30FF, {-1}-{-1}} -\end{verbatim} +\end{lstlisting} は「\cs{hoge} を利用しているとき, \texttt{U+3000}--\texttt{U+30FF}と 文字クラス1(開き括弧類)中の文字だけは \cs{piyo} を用いる」 @@ -5530,7 +5653,7 @@ by \cs{input}. %<*en> As described in Subsection~\ref{ssec-fontspec}, this optional package provides the counterparts for several commands defined in the -\Pkg{fontspec} package (recommends v2.4). +\Pkg{fontspec} package (requires \Pkg{fontspec}~v2.4). In addition to OpenType font features in the original \Pkg{fontspec}, the following ``font features'' specifications are allowed for the commands of Japanese version: @@ -5538,8 +5661,7 @@ the commands of Japanese version: %<*ja> \ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec} パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する. -\Pkg{fontspec} パッケージが2.3であっても動作するが, -\emph{以降の説明は \Pkg{fontspec}~v2.4 使用時にのみ当てはまる.} +\emph{以下に述べる和文版の命令の説明は \Pkg{fontspec}~v2.4 使用時にのみ当てはまる.} \Pkg{fontspec}パッケージで指定可能な各種font featureに加えて,和文版のコマンドには 以下の``font feature''を指定することができる: @@ -5558,7 +5680,7 @@ See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details The \texttt{CID} key is effective only when with \texttt{NoEmbed} described below. The same JFM cannot be used in both horizontal Japanese fonts and - vertical Japanese fonts, hence the \texttt{JFM} key + vertical Japanese fonts, hence the \texttt{JFM} key will be actually used in \texttt{YokoFeatures}~and~\texttt{TateFeatures} keys. % %<*ja> @@ -5677,10 +5799,10 @@ A demonstrarion is shown in Figure~\ref{fig:altkanji-fontspec}. \paragraph{Remark on \texttt{AltFont}, \texttt{YokoFeatures}, \texttt{TateFeatures} keys} In \texttt{AltFont},~\texttt{YokoFeatures},~\texttt{TateFeatures} keys, one cannot specify per-shape settings such as \texttt{BoldFeatures}. -For example, +For example, \begin{lstlisting} AltFont = { - { Font=HogeraMin-Light, BoldFont=HogeraMin-Bold, + { Font=HogeraMin-Light, BoldFont=HogeraMin-Bold, Range="3000-"30FF, BoldFeatures={Color=007F00} } } \end{lstlisting} @@ -5695,7 +5817,7 @@ BoldFeatures = { \end{lstlisting} On the other hand, \texttt{YokoFeatures}, \texttt{TateFeatures} and \texttt{TateFont} -keys can be specified in each list in the \texttt{AltFont} key. Also, +keys can be specified in each list in the \texttt{AltFont} key. Also, one can specify \texttt{AltFont} inside \texttt{YokoFeatures},~\texttt{TateFeatures}. % %<*ja> @@ -5706,7 +5828,7 @@ one can specify \texttt{AltFont} inside \texttt{YokoFeatures},~\texttt{TateFeatu 例えば. \begin{lstlisting} AltFont = { - { Font=HogeraMin-Light, BoldFont=HogeraMin-Bold, + { Font=HogeraMin-Light, BoldFont=HogeraMin-Bold, Range="3000-"30FF, BoldFeatures={Color=007F00} } } \end{lstlisting} @@ -5765,9 +5887,9 @@ but please remind remarks below. %<*ja> このパッケージは,\texttt{ajmacros.sty}(\Pkg{otf}パッケージ付属のマクロ集,井上浩一氏作)から -漢字コードをUTF8にしたり,plain \LuaTeX でも利用可能するという +漢字コードをUTF8にしたり,plain \LuaTeX でも利用可能にするという 修正を加えた \texttt{luatexja-ajmacros.sty} も自動的に読み込む. -そのため,マクロ集にある \verb+\aj半角+ などのマクロもそのまま使用可能である. +そのため,\texttt{ajmacros.sty} マクロ集にある \verb+\aj半角+ などのマクロもそのまま使用可能である. % %\paragraph{Remarks} @@ -5843,9 +5965,9 @@ IVSに対応してはいないようである.これらのパッケージで 有効にするには,\Pkg{luatexja-otf}パッケージを読み込んだ上で以下の命令を実行する% \footnote{この命令を2回以上実行しても意味がない.}:} % -\begin{verbatim} +\begin{lstlisting} \directlua{luatexja.otf.enable_ivs()} -\end{verbatim} +\end{lstlisting} % すると,上の命令を実行した箇所以降では,以下のようにIVSによる字形指定が有効となる. % After executing the command above, you can use IVS like the following: \begin{LTXexample} @@ -6088,7 +6210,8 @@ among the line-head form, the line-middle form, and the line-end form. \begin{itemize} \item 組方向オプション \texttt{}(横組),\texttt{}(縦組), \texttt{}\ の他に\ \texttt{}(dtou方向),\texttt{}(utod方向)を追加した. -\texttt{} と \texttt{} の違いは,\texttt{} が周囲の組方向が縦組のときにしか意味を持たない +\texttt{} と \texttt{} の違いは,\texttt{} が(\Pkg{plext} パッケージと同様に) +周囲の組方向が縦組のときにしか意味を持たない のに対し,\texttt{} にはそのような制限がないことである. \item \Pkg{plext} パッケージでは,表組(\texttt{tabular} 環境,\texttt{align} 環境等)や @@ -6104,9 +6227,10 @@ among the line-head form, the line-middle form, and the line-end form. (中身の最後が罫線などの時は,ボックスの下端)に一致するように配置する. \item それ以外のときは,ボックスの中央が「数式の軸」に一致するように配置する. \end{itemize} -特に縦組の場合,「数式の軸」は…… - \item 連数字用命令 \cs{rensuji} における位置合わせオプション…… + \item 連数字用命令 \cs{rensuji} における位置合わせオプション \texttt{[l]}, \texttt{[c]}, + \texttt{[r]} の挙動を若干変更した. + \end{itemize} } % @@ -6122,11 +6246,11 @@ counterpart of the \Pkg{plext} package. \begin{cslist} \item[tabular\textrm{, }array\textrm{, }minipage環境] これらの環境は, -\begin{verbatim} +\begin{lstlisting} \begin{tabular}[pos]{table spec} ... \end{tabular} \begin{array}[pos]{table spec} ... \end{array} \begin{minipage}[pos]{width} ... \end{minipage} -\end{verbatim} +\end{lstlisting} のように,組方向オプション \texttt{\} が拡張されている. 既に述べたように,組方向オプションに指定できる値は以下の5つであり, それ以外を指定した時や無指定時は周囲の組方向と同じ組方向になる. @@ -6147,11 +6271,11 @@ counterpart of the \Pkg{plext} package. 中央揃え(それ以外)される. \item[picture環境] 図表作成に用いる \texttt{picture} 環境も, -\begin{verbatim} +\begin{lstlisting} \begin{picture}(x_size, y_size)(x_offset,y_offset) ... \end{picture} -\end{verbatim} +\end{lstlisting} と組方向が指定できるように拡張されている. $x$成分の増加方向は字送り方向,$y$成分の増加方向は行送り方向の\emph{反対方向}となる. \Pkg{plext} パッケージと同様に @@ -6174,11 +6298,11 @@ $x$成分の増加方向は字送り方向,$y$成分の増加方向は行送 \item[tabular\textrm{, }array\textrm{, }minipage\textrm{ environments}] These environments are extended by \texttt{\}, which specifies the direction, as follows: -\begin{verbatim} +\begin{lstlisting} \begin{tabular}[pos]{table spec} ... \end{tabular} \begin{array}[pos]{table spec} ... \end{array} \begin{minipage}[pos]{width} ... \end{minipage} -\end{verbatim} +\end{lstlisting} This option permits one of the following five values. If none of them is specified, the direction inside the environment is same as that outside the enviromnent. \begin{description} @@ -6419,13 +6543,13 @@ $i$は7より小さい自然数. \attr{ltj@dir} %<*ja> -ボックスにおける組方向を示す.通常のボックスでは +\textit{direction}~whatsit(後述)において組方向を示すために,あるいは\textit{dir\_box}の + 組方向を用いる.\textit{direction}~whatsitにおいては値は \begin{quote} - \textit{dir\_dtou} (1), \textit{dir\_tate} (3), + \textit{dir\_dtou} (1), \textit{dir\_tate} (3), \textit{dir\_yoko} (4), \textit{dir\_utod} (11) \end{quote} -のいずれかであり,これらに次を加えた値をとるボックスが作られることもあ - る(\ref{sec-dir-imp}章参照). +のいずれかであり,\textit{dir\_box}ではこれらに次を加えた値をとる(\ref{sec-dir-imp}章参照). % \begin{description} \item[\textit{dir\_node\_auto} (128)] @@ -6720,9 +6844,9 @@ store some data which obeys the grouping of \TeX. %<*en> The following function can be used to store data into a stack: -\begin{verbatim} +\begin{lstlisting} luatexja.stack.set_stack_table(index, data) -\end{verbatim} +\end{lstlisting} Any values which except \texttt{nil}~and~NaN are usable as \textit{index}. However, a user should use only negative integers or strings as \textit{index}, since natural numbers are used by \LuaTeX-ja itself. @@ -6732,9 +6856,9 @@ is determined by \texttt{luatexja.isglobal} % %<*ja> スタックに値を設定するには,以下のLua関数を呼び出せば良い: -\begin{verbatim} +\begin{lstlisting} luatexja.stack.set_stack_table( index, data) -\end{verbatim} +\end{lstlisting} 直感的には,スタックテーブル中のインデックス\textit{index}の値を\textit{data}にする,という意味である. \textit{index}の値としては \texttt{nil} とNaN以外の任意の値を使えるが, 自然数は\LuaTeX-jaが使用する(将来の拡張用も含む)ので, @@ -6745,18 +6869,18 @@ luatexja.stack.set_stack_table( index, data) %<*en> Stored data can be obtained as the return value of -\begin{verbatim} +\begin{lstlisting} luatexja.stack.get_stack_table(index, default, level) -\end{verbatim} +\end{lstlisting} where \textit{level} is the stack level, which is usually the value of \verb+\ltj@@stack+, and \textit{default} is the default value which will be returned if no values are stored in the stack table whose level is \textit{level}. % %<*ja> スタックの値は, -\begin{verbatim} +\begin{lstlisting} luatexja.stack.get_stack_table( index, default, level) -\end{verbatim} +\end{lstlisting} の戻り値で取得できる.\textit{level}はスタックレベルであり, 通常は \verb+\ltj@@stack+ の値を指定することになるだろう. \textit{default}はレベル\textit{level}のスタックに値が設定されていなかった場合に @@ -6803,9 +6927,9 @@ which is offered by the \Pkg{xkeyval} package. Hence, to add a key in \cs{ltjsetparameter}, one only have to add a key whose prefix is \texttt{ltj} and whose family is \texttt{japaram}, as the following. -\begin{verbatim} +\begin{lstlisting} \define@key[ltj]{japaram}{...}{...} -\end{verbatim} +\end{lstlisting} \cs{ltjsetparameter}~and~\cs{ltjglobalsetparameter} automatically sets \texttt{luatexja.isglobal}. Its meaning is the following. @@ -6828,9 +6952,9 @@ but also by the value of \cs{globaldefs}. このため,\cs{ltjsetparameter} に指定可能なパラメータを追加するには, を \texttt{ltj},を \texttt{japaram} としたキーを -\begin{verbatim} +\begin{lstlisting} \define@key[ltj]{japaram}{...}{...} -\end{verbatim} +\end{lstlisting} のように定義すれば良いだけである. なお,パラメータ指定がグローバルかローカルかどうかを示す \texttt{luatexja.isglobal} が, \begin{align} @@ -6850,7 +6974,7 @@ but also by the value of \cs{globaldefs}. For parameters that do not need additional arguments, one only have to define a function in the table \verb+luatexja.unary_pars+. -For example, with the following function, +For example, with the following function, \verb+\ltjgetparameter{hoge}+ returns a \emph{string} \texttt{42}. \begin{lstlisting}[numbers=left] function luatexja.unary_pars.hoge (t) @@ -6871,11 +6995,11 @@ end Here the first argument $t$ is the stack level, as before. The second argument $c$ is just the second argument of \cs{ltjgetparameter}. -For parameters that need an additional argument, one also have to +For parameters that need an additional argument, one also have to execute the \TeX\ code like -\begin{verbatim} +\begin{lstlisting} \ltj@@decl@array@param{fuga} -\end{verbatim} +\end{lstlisting} to indicate that ``the parameter \texttt{fuga} needs an additional argument''. % %<*ja> @@ -6903,9 +7027,9 @@ end 引数$t$は,先に述べた通りのスタックレベルである.一方,引数$c$は\ \cs{ltjgetparameter} の第2引数を表す数値である. しかしこれだけでは駄目で, -\begin{verbatim} +\begin{lstlisting} \ltj@@decl@array@param{fuga} -\end{verbatim} +\end{lstlisting} を実行し,\TeX インターフェース側に 「\verb+\ltjgetparameter{fuga}+ は追加引数が必要」ということを通知する必要がある. % @@ -7132,7 +7256,7 @@ emits a space. \end{quote} この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.条件1.は, -\texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである. +\texttt{lstlisting}系環境などの日本語対応マクロを書かなくてすませるためのものである. しかしながら,\pTeX と完全に同じ挙動が実現できたわけではない. 次のように,和文文字の範囲を変更したちょうどその行においては挙動が異なる: @@ -7198,54 +7322,54 @@ u \def\OB{$\text{\sf O}_{\text{\sf B}}$} \begin{defn} %<*en> -A \emph{cluster} is a list of consecutive nodes in one of the following forms, +A \emph{cluster} is consecutive nodes in one of the following forms, with the \textit{id} of it: % %<*ja> -\emph{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである: +\emph{クラスタ}は以下の形のうちのどれかひとつをとるノードのリストである: % \begin{enumerate} %<*en> \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$. These nodes come from a hbox which is already packaged, by unpackaging (\cs{unhbox}). - The \textit{id} is \textit{id\_pbox}. + The \textit{id} of the cluster is \textit{id\_pbox}. % %<*ja> \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト. これらのノードはある既にパッケージングされたhboxから \cs{unhbox} で アンパックされたものである. - その\textit{id}は\textit{id\_pbox}である. + この場合,クラスタの\textit{id}は\textit{id\_pbox}である. % %<*en> \item A inline math formula, including two \textit{math\_node}s at the boundary of it. - The \textit{id} is \textit{id\_math}. + The \textit{id} of the cluster is \textit{id\_math}. % %<*ja> \item インライン数式でその境界に2つの\textit{math\_node}を含むもの. - その\textit{id}は\textit{id\_math}である. + この場合,クラスタの\textit{id}は\textit{id\_math}である. % %<*en> -\item A \textit{glyph\_node}~$p$ with nodes which relate with it: +\item A \textit{glyph\_node}~$p$, which represents a \textbf{JAchar}, with nodes which relate with it: % %<*ja> -\item \textit{glpyh\_node}~$p$とそれに関係するノード: +\item \textbf{JAchar}を表す\textit{glyph\_node}~$p$とそれに関係するノード: % \begin{enumerate} %<*en> -\item A kern for the italic correction of~$p$. +\item[(a)] A kern for the italic correction of~$p$. % %<*ja> -\item $p$のイタリック補正のためのカーン. +\item[(a)] $p$のイタリック補正のためのカーン. % %<*en> -\item An accent attached to $p$ by \cs{accent}. +\item[(b)] An accent attached to $p$ by \cs{accent}. % %<*ja> -\item \cs{accent} による$p$に付随したアクセント. +\item[(b)] \cs{accent} による$p$に付随したアクセント. % \end{enumerate} \[ @@ -7263,41 +7387,51 @@ with the \textit{id} of it: \] %<*en> -The \textit{id} is \textit{id\_jglyph} or -\textit{id\_glyph}, according to whether the \textit{glyph\_node} -represents a Japanese character or not. +In this case, the \textit{id} is \textit{id\_jglyph}. +% +%<*ja> +この場合の\textit{id}は\textit{id\_jglyph}である. +% + +%<*en> +\item A list which begins from a \textit{glyph\_node} which represents a \textbf{ALchar}, + and consists of \textbf{ALchar} \textit{glyph\_node}s, + kerns for adjusting accents~(its subtype is 2), kerns for italic corrections and + kerns which are automatically inserted by \LuaTeX~or~luaotfload. + In this case, the \textit{id} is \textit{id\_glyph}. % %<*ja> -\textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって -\textit{id\_jglyph},もしくは\textit{id\_glyph}となる. +\item \textbf{ALchar}を表す\textit{glyph\_node},\cs{accent} によるアクセント位置補正用の + カーン(subtypeが2),そしてイタリック補正・カーニングによって挿入されたカーン達が連続 + したもの.この場合の\textit{id}は\textit{id\_glyph}である. % %<*en> \item An box-like node, that is, an hbox, a vbox, a rule (\cs{vrule}) and an \textit{unset\_node}. -The \textit{id} is \textit{id\_hlist} if the node is an +The \textit{id} of the cluster is \textit{id\_hlist} if the node is an hbox which is not shifted vertically, or \textit{id\_box\_like} otherwise. % %<*ja> -\item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\cs{vrule}), +\item 水平ボックス(hbox),垂直ボックス,罫線 (\cs{vrule}), そして\textit{unset\_node}. - その\textit{id}は垂直に移動していないhboxならば\textit{id\_hlist}, + クラスタの\textit{id}は垂直に移動していないhboxならば\textit{id\_hlist}, そうでなければ\textit{id\_box\_like}となる. % %<*en> \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break. -The \textit{id} is \textit{id\_glue}, \textit{id\_kern} +The \textit{id} of the cluster is \textit{id\_glue}, \textit{id\_kern} and \textit{id\_disc}, respectively. % %<*ja> -\item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行. - その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして +\item グルー,subtypeが 2~(\textit{accent})ではないカーン,そしてdiscretionary break. + その\textit{id} of the clusterはそれぞれ\textit{id\_glue}, \textit{id\_kern},そして \textit{id\_disc}である. % \end{enumerate} %<*en> -Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster. +We use \textit{Np}, \textit{Nq} and \textit{Nr} to denote a cluster. % %<*ja> 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す. @@ -7333,11 +7467,12 @@ $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字 \item[\textit{id\_hlist}] 縦方向にシフトされていないhbox.\\ この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの, 先頭・末尾のノードである. +\medskip \begin{itemize} \item 状況によっては,\TeX ソースで言うと -\begin{verbatim} +\begin{lstlisting} \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}} -\end{verbatim} +\end{lstlisting} のように,$p$の内容が別のhboxで開始・終了している可能性も十分あり得る.そのような場合, $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は, \emph{垂直方向にシフトされていない}hboxの @@ -7521,11 +7656,11 @@ x+y&\text{if\ }\Param{diffrentjfm}=\texttt{both}; \end{enumerate} 例えば, -\begin{verbatim} +\begin{lstlisting} \jfont\foo=psft:Ryumin-Light:jfm=ujis;-kern \jfont\bar=psft:GothicBBB-Medium:jfm=ujis;-kern \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo;-kern -\end{verbatim} +\end{lstlisting} という3フォントを考え, \[ \overbrace{\Node{glyph}{\cs{ foo}, `あ'}}^{p} @@ -8207,12 +8342,12 @@ JFM中にある文字クラス$n$の定義の 全角単位の値として記述されている. 例えば,行末文字が句点「。」であり,そこで用いられているJFM中に -\begin{verbatim} +\begin{lstlisting} [2] = { chars = { '。', ... }, width = 0.5, ..., end_stretch = 0.5, end_shrink = 0.5, }, -\end{verbatim} +\end{lstlisting} という指定があった場合,この行末の句点は \begin{itemize} \item 通常の\TeX の行分割処理で「半角以上の詰め」が行われていた場合, @@ -8539,63 +8674,209 @@ nilでないをキャッシュに保存する. 縦組を実装している. \LuaTeX-jaにおける縦組の実装は -\pTeX における実装(\cite{ptexdoc,ptextug})をベースにしており,…… +\pTeX における実装(\cite{ptexdoc,ptextug})をベースにしている. -\subsection{\textit{direction}~whatsit} +\subsection{direction~whatsit} \textit{direction}~whatsitとは,\textit{direction}という特定の \verb+user_id+ を持つ -whatsitのことである.このwhatsitは,以下の3つの役割がある. -\begin{enumerate} -\def\labelenumi{(\roman{enumi})} - \item 「現在作成中のリストの組方向が \cs{tate} 等により変更された」ことを表す.\\ -「現在の組方向」は \verb+\ltj@dir@count+ というカウンタに格納されているが,それだけでは -\verb+hpack_filter+コールバックなどから正しく処理対象のリストの組方向を正しく取得すること - はできない(\ref{ssec-stack}節参照)ため,このように別途whatsitを用いている. - \item \cs{hbox},~\cs{vbox}によって作成されたボックスの組方向を表す.\\ -原則として,ボックスの組方向はattribute \verb+\ltj@dir+ に格納されることになっている.しか - し,新規に作成されるボックスのattributeをコールバックの内部から制御するには, -\verb+tex.setattribute+ による方法しかなく,これは不安定である. - -なお,この役割のdirection whatsitは,次の(iii)の役割も一緒に持っている. - \item 「異方向における寸法」の記録用.\\ -例えば \cs{box0} に横組のボックスが格納されている時,縦組や \cs{dtou} 方向 -における寸法値は((ii)の役割として作成された)direction~whatsitが -格納しているノードリストに格納される. -\end{enumerate} -このように複数の役割をもたせているので, -\begin{verbatim} -% yoko direction -\setbox0=\hbox{\tate B} -\noindent \unhbox0 A -\end{verbatim} -のような場合に,「(ii)の役割の\textit{direction}~whatsitが(i)の役割として認識され, -このリストは縦組とみなされるのではないか?」と思うかもしれない.しかし, -(i)の役割と(ii)の枠割の\textit{direction}~whatsitは \verb+\ltj@icflag+ の値により -区別されているので,そのような混乱は起こらない. - -\medskip -(ii)の役割のdirection whatsitは,各ボックスの内容を表すリストの先頭に挿入されるが, -例外が以下の2つある: +whatsitのことであり,以下のタイミングで作られる. \begin{itemize} - \item \verb+\hbox{}+, \verb+\vbox{}+ といった, + \item 組方向を \cs{tate} 等で変更したとき. + \item \cs{hbox}, \cs{vbox}, \cs{vtop} による明示的なボックスの開始時.\\ +\verb+\hbox{}+, \verb+\vbox{}+ といった, \begin{itemize} \item \cs{tate} 等によりボックス内部の組方向を変更していない \item ボックスの中身のリストが空である \end{itemize} 場合は,\LuaTeX の \verb+hpack_filter+, \verb+vpack_filter+ といった -callbackに処理が回らないので,この場合にはdirection whatsitは挿入されない. - \item \verb+\vtop{...}+ の場合は,先頭にdirection whatsitを置くと -ボックスの高さが正しく設定されない.そのため,この場合に限っては -direction whatsitはリストの2番目に挿入されることとなる. +callbackに処理が回らない.そこで,\LuaTeX-ja では,\cs{everyhbox}, \cs{everyvbox} を利用す + ることで各ボックスの先頭に確実に追加するようにしている\footnote{% + 問題は \cs{hbox to 25pt\{\}} という状況である.実際のこのボックスの中身は空でない(少な + くともdirection whatsitがある)ため,何も対策をしなければhpack時にUnderfill警告が発 + 生してしまうことになる.\LuaTeX-jaではそうならないように「\cs{hbadness}, + \cs{vbadness} を一時的に10000に変更し,hpack, vpack後に元の値に戻す」処理を行ってい + る. +}. + \item \cs{vsplit}によってvboxを分割した時の「残り」. + \item \LuaTeX-ja読み込み前に作成したボックスの寸法を \cs{ltjsetwd} 等によって変更した時. \end{itemize} +なお,\verb+\vtop{...}+ の場合は,先頭にdirection whatsitを置くと +ボックスの高さが常に0\,ptになるという問題が発生する.そのため,この場合に限っては +vpack時にdirection whatsitをリストの2番目に移動させている. -\subsection{異方向のボックスの整合処理} +direction whatsitはあくまでも組方向処理のための補助的なノードであるので, +\cs{unhbox}, \cs{unhcopy} によってボックスの中身が展開される時には展開直前に削除される. +これは +\begin{lstlisting} + % yoko direction +\setbox0=\hbox{\tate B} +\noindent % 水平モードに入る.この時点でのリストの中身は空 +\unhbox0 A +\end{lstlisting} +といった場合に,段落が縦組で組まれたり,あるいは +\begin{lstlisting} +\setbox0=\hbox{} +\leavevmode \hbox{A}\unhbox0 +\setbox1=\lastbox % \box1 はどうなる? +\end{lstlisting} +で \cs{box1} が \cs{hbox\{A\}} でなく空になってしまうことを防ぐためである. + + +\subsection{\textit{dir\_box}} 縦中横など異方向のボックスを配置する場合に,周囲の組方向と大きさを整合させるため, \LuaTeX-jaでは \verb+\ltj@dir+ が128以降の\textit{hlist\_node}, \textit{vlist\_node}を 用いる.これらは\pTeX における\textit{dir\_node}の役割と同じ果たしており, -この文章中でも\textit{dir\_node}と呼称する. +この文章中では\textit{dir\_box}と呼称する. + +\subsubsection{異方向のボックスの整合} +\textit{dir\_box}の第一の使用目的は,異方向のボックスの大きさを整合させることである. +例えば, +\begin{lstlisting} + % yoko direction +平成\hbox{\tate 26}年 +\end{lstlisting} +は段落中で +\[ + \xymatrix{ + {}\Node{glyph}{`平'}\ar[r]&{}\Node{glyph}{`成'}\ar[r]& + {}\HNode{hlist}{10.00003}{3.02779}{0.0}\ar[r]\ar[d]^{\text{中身}}&{}\Node{glyph}{`年'}\\ + &&{}\Node{whatsit}{\cs{tate}}\ar[r]&{}\Node{glyph}{`2'}\ar[r]&{}\Node{glyph}{`6'} + } +\] +というリストを作る.その後,この段落が終了したときに, +\LuaTeX-jaの\textbf{JAglue}挿入処理が行われ +\[ + \xymatrix{ + {}\Node{glyph}{`平'}\ar[r] + &{}\textcolor{blue}{\Node{glue}{\Param{xkanjiskip}}}\ar[r] + &{}\Node{glyph}{`成'}\ar[r] + &{}\textcolor{blue}{\Node{penalty}{0}} + \ar`r[d] `[l] `[ddll] `[dl] [dl] + \\ + &&{}\textcolor{red}{\HNode{hlist}{3.02779}{10.00003}{0.0}}\ar[r]\ar[d]^{\text{中身}} + &{}\textcolor{blue}{\Node{penalty}{0}}\ar[r] + &{}\Node{glyph}{`年'}\\ + &&{}\HNode{\textit{dir\_box} (\cs{yoko})}{10.00003}{3.02779}{0.0}\ar[d]^{\text{中身}}\\ + &&{}\Node{whatsit}{\cs{tate}}\ar[r]&{}\Node{glyph}{`2'}\ar[r]&{}\Node{glyph}{`6'} + } +\] +のようになる(青字は\textbf{JAglue},赤字が整合処理のための\textit{dir\_box}である). +\TeX の \cs{showbox} 形式で書けば + +\medskip{\narrowbaselines\ttfamily\obeylines\parindent0pt +\catcode`\@=0 @catcode`@\=12 +.\tenmin 平 +@textcolor{blue}{.\glue 0.0 plus 0.4 minus 0.4} +.\tenmin 成 +@textcolor{blue}{.\penalty 0} +@textcolor{red}{.\hbox(10.00003+0.0)x3.02779, direction TLT} +..\hbox(3.02779+0.0)x10.00003, direction TLT +...\whatsit4=[] +...\tenrm 2 +...\tenrm 6 +@textcolor{blue}{.\penalty 0} +.\tenmin 年 +}\medskip + +\noindent である. + +なお,\cs{raise},~\cs{lower}, \cs{moveleft},~\cs{moveright} といったボックス移動命令では. +移動を正しく表現するために段落やボックスの途中でも異方向のボックスは\textit{dir\_box}にカ +プセル化している. +例えば +\begin{lstlisting} + % yoko direction +平成\raise1pt\hbox{\tate 26}年\showlists +\end{lstlisting} +は以下のような結果を得る. + +\medskip{\narrowbaselines\ttfamily\obeylines\parindent0pt +\catcode`\@=0 @catcode`@\=12 +(前略) +\tenrm 平 +\tenrm 成 +@textcolor{red}{\hbox(10.00003+0.0)x3.02779, shifted -1.0, direction TLT} +.\hbox(3.02779+0.0)x10.00003, direction TLT +..\whatsit4=[] +..\tenrm 2 +..\tenrm 6 +\tenrm 年 +}\medskip + +また,メインの垂直リストに異方向のボックスが追加される場合にも同様に即座に +\textit{dir\_box}にカプセル化している.ページ分割のタイミングを正 +しく\TeX が判断するためである. +\cs{lastbox} によるボックスの取得では,\textit{dir\_box}は削除される. + +\subsubsection{異方向のボックス寸法の格納} +第二の使用目的は,現在の組方向がボックス本来の組方向とは異なる状況で, +\cs{ltjsetwd} によってボックス寸法を設定されたことを記録することである. + +例えば +\begin{lstlisting}[numbers=left] +\setbox0=\hbox{\vrule width 10pt height 5pt depth 2pt} +\setbox1=\hbox{\tate\ltjsetwd0=20pt} +\wd0=9pt +\setbox1=\hbox{\dtou\ltjsetwd0=20pt} +\setbox0=\hbox{\dtou a\box0} +\end{lstlisting} +というコードを考える.1行目で \cs{box0} には横組の +幅10\,pt,高さ5\,pt,深さ2\,ptのボックスが代入される. +よって, +\begin{itemize} + \item 縦組下では \cs{box0} は幅7\,pt,高さ・深さ5\,ptのボックスとして扱われる. + \item \cs{dtou} 下では \cs{box0} は幅7\,pt,高さ10\,pt,深さ0\,ptのボックスとして扱われる. +\end{itemize} +このとき,\cs{box0} の\emph{中身}は +\[ + \xymatrix{ + {}\Node{whatsit}{\cs{yoko}}\ar[r]&{}\Node{rule}{} + } +\] +である. +さて,2行目で縦組時の \cs{box0} の幅が20\,ptに設定される.この情報が +direction~whatsit内部のノードリストに,\textit{dir\_box}として格納される: +\[ + \xymatrix{ + {}\Node{whatsit}{\cs{yoko}}\ar[r]\ar[d]_{\text{中身}}&{}\Node{rule}{}\\ + {}\textcolor{red}{\HNode{\textit{dir\_box} (\cs{tate})}{20.0}{5.0}{5.0}} + } +\] + +次に,3行目では横組時の,つまり \cs{box0} 本来の組方向での深さが9\,ptに変更される. +このとき,\cs{box0} は +\begin{itemize} + \item 縦組下では寸法代入が既に行われているので,2行目で作成された\textit{dir\_box}の通り + に幅20\,pt,高さ・深さ5\,ptのボックスとして扱われる. + \item \cs{dtou} 下ではまだ寸法代入が行われていないので, +\cs{box0} の寸法変更に追従し,幅7\,pt,高さ9\,pt,深さ0\,ptのボックスとして扱われる. +\end{itemize} + +4行目では \cs{dtou} 下での\cs{box0} の幅が20\,ptに設定されるので,2行目と同じように +\[ + \xymatrix{ + {}\Node{whatsit}{\cs{yoko}}\ar[r]\ar[d]_{\text{中身}}&{}\Node{rule}{}\\ + {}\textcolor{red}{\HNode{\textit{dir\_box} (\cs{dtou})}{20.0}{9.0}{0.0}}\ar[r]& + {}\HNode{\textit{dir\_box} (\cs{tate})}{20.0}{5.0}{5.0} + } +\] +と\textit{dir\_box}が作成される. + +このように寸法代入によってつくられた\textit{dir\_box}は,前節の整合過程のときに再利用され +る.上記の例でいえば,5行目を実行した後の \cs{box0} の内容は +\[ + \xymatrix{ + {}\Node{whatsit}{\cs{dtou}}\ar[r]& + {}\Node{glyph}{`a'}\ar[r]& + {}\textcolor{red}{\HNode{\textit{dir\_box} (\cs{dtou})}{20.0}{9.0}{0.0}}\ar[d]_{\text{中身}}\\ + &&{}\HNode{hlist}{9.0}{5.0}{2.0}\ar[d]_{\text{中身}}\\ + &&{}\Node{whatsit}{\cs{yoko}}\ar[r]&{}\Node{rule}{} + } +\] +のようになる. % +\newpage \begin{thebibliography}{99} \addcontentsline{toc}{section}{\refname} \bibitem{texbytopic} @@ -8623,6 +8904,11 @@ Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \new \\\null\hfill\texttt{.../texmf-dist/doc/ptex/base/ptexdoc.pdf} \bibitem{ptextug} Hisato Hamano. \newblock \textit{Vertical Typesetting with \TeX}, TUGBoat~\textbf{11}(3), 346--352, 1990. +\bibitem{pdfstd} International Organization for Standardization. \newblock +ISO 32000-1:2008, \textit{Document management -- Portable document format -- Part 1: PDF + 1.7}, 2008. \newblock +\\\null\hfill +\url{http://www.iso.org/iso/iso\_catalogue/catalogue_tc/catalogue\_detail.htm?csnumber=51502} \end{thebibliography} \newpage