X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=doc%2Fmanual.dtx;h=8247a873303dccc95e9adef1a0a07438c2673725;hb=b492cbaeb89e6baa78c93c07e0d30431e3cf075b;hp=1cc62e5d11bbe82063195653d688eda226771dd6;hpb=4df04a5f6375d063a6e25c9a1d43d126a305ca05;p=luatex-ja%2Fluatexja.git diff --git a/doc/manual.dtx b/doc/manual.dtx index 1cc62e5..8247a87 100644 --- a/doc/manual.dtx +++ b/doc/manual.dtx @@ -1,16 +1,23 @@ %#! lualatex -shell-escape manual.ins -%\documentclass[a4paper,titlepage]{article} -%\documentclass[a4paper,titlepage]{ltjsarticle} -\usepackage[margin=20mm,footskip=5mm]{geometry} +%<*en> +\documentclass[a4paper,titlepage]{article} +\usepackage[margin=25mm,footskip=5mm]{geometry} +% +%<*ja> +\documentclass[a4paper,titlepage]{ltjsarticle} +\usepackage[margin=25mm, footskip=5mm]{geometry} +\advance\leftmargini-1\zw\advance\leftmarginii-1\zw +% -\usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float} -\usepackage{booktabs,listings,lltjlisting,showexpl,multicol} +\usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float,makecell} +\usepackage{booktabs,listings,showexpl,multicol} \usepackage{luatexja-otf} \usepackage{luatexja-fontspec} \usepackage[unicode]{hyperref} \usepackage[all]{xy} \SelectTips{cm}{} +\def\labelenumii{(\arabic{enumii})} \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX} \DeclareRobustCommand\LuaTeX{Lua\TeX} @@ -22,6 +29,7 @@ \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX} \ltjsetparameter{jacharrange={-3}} +\ltjdefcharrange{6}{`■,`…,`→,`←,`↓,`↑} \theoremstyle{definition} %\newtheorem{defn}{Definition} %\newtheorem{defn}{定義} @@ -44,8 +52,13 @@ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% \fi \vskip\belowcaptionskip} +% Suppress output from showexpl to stdout. +\let\SX@Info\relax \makeatother +\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}}}}\,}} + %<*en> \title{The \LuaTeX-ja package} \author{The \LuaTeX-ja project team} @@ -184,7 +197,7 @@ The followings are major changes from \pTeX: `variation'. % %<*ja> -\item 和文フォントは「実際の」フォント,和文フォントメトリック(JFM と呼ぶ),そ +\item 和文フォントは(小塚明朝,IPA明朝などの)実際のフォント,和文フォントメトリック(JFM と呼ぶ),そ して `variation' と呼ばれる文字列の組である. % @@ -276,7 +289,7 @@ The followings are major changes from \pTeX: \item 現時点では,縦書きは \LuaTeX-ja ではサポートされていない. % -\end{itemize} +\end{itemize} %<*en> For detailed information, see Part~\ref{part-imp}. @@ -297,7 +310,7 @@ In this document, the following terms and notations are used: \begin{itemize} %<*en> -\item Characters are divided into two types: +\item Characters are divided into two types: % %<*ja> \item 文字は2種類に分けられる: @@ -314,7 +327,7 @@ In this document, the following terms and notations are used: % %<*en> -\item \textbf{ALchar}: standing for all other characters like alphabets. +\item \textbf{ALchar}: standing for all other characters like alphabets. % %<*ja> \item \textbf{ALchar}: アルファベットを始めとする,その他全ての文字を指す. @@ -397,8 +410,8 @@ This project is hosted by SourceForge.JP. 本プロジェクトは SourceForge.JP のサービスを用いて運営されている. % -%\paragraph{Members}\ -%\paragraph{開発メンバー}\ +%\paragraph{Members}\ +%\paragraph{開発メンバー}\ %<*en> \begin{multienumerate} \def\labelenumi{$\bullet$} @@ -465,9 +478,8 @@ The installation methods are as follows: %<*ja> \item ソースアーカイブをダウンロードする. - 現時点では,\LuaTeX-ja の公式リリースはないので,レポジトリからアーカイブを - 取得しなければならない. - 次のようにすることで,Git レポジトリを取得することができる: + 現時点では,\LuaTeX-ja の公式リリースはまだない.そのため,Git レポジトリを + 次のようにすることで取得する必要がある: % \begin{verbatim} $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git @@ -476,7 +488,7 @@ $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git or download the archive of HEAD in \texttt{master} branch from % %<*ja> - もしくは,\texttt{master} ブランチの HEAD アーカイブを以下からダウンロードすることができる: + もしくは,\texttt{master} ブランチの HEAD のアーカイブを以下からダウンロードしてもよい: % \begin{flushleft} \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}. @@ -486,14 +498,17 @@ $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git Note that the forefront of development may not be in \texttt{master} branch. % %<*ja> -開発中の最新の成果は \texttt{master} ブランチには含まれていないかもしれないことに注意. +\texttt{master} ブランチはたまにしか更新されない. +最新の開発中のコードは \texttt{master} ブランチには含まれていない場合がかなり多いので注意. % %<*en> \item Extract the archive. You will see \texttt{src/} and several other sub-directories. % %<*ja> -\item アーカイブを展開する.\texttt{src/} をはじめとしたいくつかのディレクトリができる. +\item 後者の方法でアーカイブ取得したならば,それをを展開する. + \texttt{src/} をはじめとしたいくつかのディレクトリができるが, + 動作には \texttt{src/} 以下の内容だけで十分. % %<*en> @@ -501,13 +516,15 @@ Note that the forefront of development may not be in \texttt{master} branch. % %<*ja> \item \texttt{src/} の中身全てを自分の \texttt{TEXMF} ツリーにコピーする. + シンボリックリンクが利用できる環境で,かつレポジトリを直接取得したのであれば,コピーではなく + リンクを貼るのが適切だろう. % %<*en> \item If \texttt{mktexlsr} is needed to update the file name database, make it so. % %<*ja> -\item もし \texttt{mktexlsr} を実行する必要があればそうする. +\item 必要があれば,\texttt{mktexlsr} を実行する. % \end{enumerate} @@ -520,12 +537,12 @@ Note that the forefront of development may not be in \texttt{master} branch. encodings, such as EUC-JP or Shift-JIS, are not supported. % %<*ja> -\item 原稿のソースファイルの文字コードは UTF-8 でなければならない. - EUC-JP や Shift-JIS は使用できない. +\item 原稿のソースファイルの文字コードは UTF-8 固定である. + 従来日本語の文字コードとして用いられてきた EUC-JP や Shift-JIS は使用できません. % %<*en> -\item May be conflict with other packages. +\item May be conflict with other packages. For example, the default setting of \textbf{JAchar} in the present version does not coexist with the \Pkg{unicode-math} @@ -587,8 +604,8 @@ This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese doc \begin{tabular}{ccccc} \toprule \textbf{字体}&\textbf{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule -\emph{明朝体}&Ryumin-Light &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\ -\emph{ゴシック体}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\ +明朝体&Ryumin-Light &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\ +ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\ \bottomrule \end{tabular} \end{center} @@ -615,7 +632,7 @@ This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese doc \item `Ryumin-Light' と `GothicBBB-Medium' は PDF ファイルに埋め込まずに 名前参照のみで用いることが広く受け入れられており,この場合 PDF リーダーが 適切な外部フォントで代用する(例えば,Adobe Reader では Ryumin-Light は - 小塚明朝で代替される).そこで,これらをデフォルトのフォントと + 小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと して採用する. % @@ -627,8 +644,9 @@ This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese doc % %<*ja> \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも - 一般に小さい.そこで,これらの和文フォントの実際のサイズは指定された値よりも + 一般に小さくデザインされている.そこで,標準ではこれらの和文フォントの実際のサイズは指定された値よりも 小さくなるように設定されており,具体的には指定の 0.962216 倍にスケールされる. + この 0.962216 という数値も,p\TeX におけるスケーリングを踏襲した値である. % \end{itemize} @@ -641,7 +659,7 @@ This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese doc 量は次のように設定されている: % \[ - (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}} + (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}} = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}. \] \end{itemize} @@ -684,7 +702,7 @@ When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} % %<*en> -\item Two font families \texttt{mc} and \texttt{gt} are defined: +\item Two font families \texttt{mc} and \texttt{gt} are defined: \begin{center} \begin{tabular}{ccccc} \toprule @@ -695,7 +713,7 @@ When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} \end{tabular} \end{center} Remark 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 a trace that there were only 2~fonts (these are Ryumin-Light +This is a convention in \pLaTeX. This is a trace that there were only 2~fonts (these are Ryumin-Light and GothicBBB-Medium) in early years of DTP. % %<*ja> @@ -710,7 +728,7 @@ and GothicBBB-Medium) in early years of DTP. \end{tabular} \end{center} どちらのファミリにおいても,その bold シリーズはゴシック体の medium シリーズで -あることに注意.これは初期の DTP において和文フォントが2つ(それがちょうど\ +あることに注意.これは初期の DTP において和文フォントが2つ(それがちょうど\ Ryumin-Light, GothicBBB-Medium だった)しか利用できなかった時の名残であり,\pLaTeX{} での標準設定とも同じである. % @@ -763,7 +781,7 @@ If you want to use these functions, load \Pkg{luatexja-otf} package. \CID{7652}飾区の\CID{13706}野家, 葛飾区の吉野家 \end{LTXexample} -%lltjlisting.sty要修正?:↑「森」の直後で改行. +%lltjp-listings.sty要修正?:↑「森」の直後で改行. %\subsection{Changing Fonts} @@ -777,18 +795,18 @@ sources like the following: % %<*ja> \paragraph{意見:数式モード中の和文文字} -\pTeX では数式中での和文文字の使用がサポートされていたので, -以下のようなソースが存在した: +\pTeX では,特に何もしないでも数式中に和文文字を記述することができた.そのため, +以下のようなソースが見られた: % \begin{LTXexample} $f_{高温}$~($f_{\text{high temperature}}$). -\[ y=(x-1)^2+2\quad{}よって\quad y>0 \] -$5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$. +\[ y=(x-1)^2+2\quad よって\quad y>0 \] +$5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$. \end{LTXexample} %<*en> We (the project members of \LuaTeX-ja) think that using Japanese characters in math mode are allowed if and only if these are used as identifiers. -In this point of view, +In this point of view, % %<*ja> \LuaTeX-ja プロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる @@ -798,7 +816,7 @@ In this point of view, \begin{itemize} %<*en> \item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and -`よって' is used as a conjunction. +`よって' is used as a conjunction. % %<*ja> \item 上記数式のうち 1, 2 行目は正しくない.なぜならば `高温' が意味のあるラベルと @@ -821,9 +839,9 @@ Hence, in our opinion, the above input should be corrected as: \begin{LTXexample} $f_{\text{高温}}$~% ($f_{\text{high temperature}}$). -\[ y=(x-1)^2+2\quad +\[ y=(x-1)^2+2\quad \mathrel{\text{よって}}\quad y>0 \] -$5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$. +$5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$. \end{LTXexample} %BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない. %<*en> @@ -833,7 +851,7 @@ this chapter. For the method, please see Part~\ref{part-ref}. % %<*ja> また \LuaTeX-ja プロジェクトでは,和文文字が識別子として用いられることはほとんどない -と考えており,したがってこの章では数式モード中の和文フォントを変更する方法については +と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については 記述しない.この方法については第 \ref{part-ref} 部を参照のこと. % @@ -850,13 +868,12 @@ plain \TeX で和文フォントを変更するためには,\verb+\jfont+ プ %<*en> \paragraph{NFSS2} -For \LaTeXe, \LuaTeX-ja simply adopted the font selection system from that -of \pLaTeXe\ (in \texttt{plfonts.dtx}). +For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (in \texttt{plfonts.dtx}). % %<*ja> \paragraph{NFSS2} -\LaTeXe については,\LuaTeX-ja では単にフォント選択システムを \pLaTeXe\ (\texttt{plfonts.dtx}) -から採用している. +\LaTeXe については,\LuaTeX-ja ではフォント選択システムを \pLaTeXe\ (\texttt{plfonts.dtx}) +の大部分を採用している. % \begin{itemize} %<*en> @@ -873,10 +890,10 @@ of \pLaTeXe\ (in \texttt{plfonts.dtx}). %<*en> \item Commands \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+ and \verb+\selectfont+ can be used to change - attributes of Japanese fonts. + attributes of Japanese fonts. % %<*ja> -\item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして +\item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして \verb+\selectfont+ が和文フォントの属性を変更するために使用できる. % @@ -917,20 +934,21 @@ auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\ %<*en> \verb+\fontencoding{}+ changes the encoding of alphabetic fonts - or Japanese fonts depending on the argument. For example, - \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to - \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of + or Japanese fonts depending on the argument. For example, + \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to + \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of alphabetic fonts to \texttt{T1}. \verb+\fontfamily+ also changes the family of Japanese fonts, alphabetic fonts, \emph{or both}. For detail, see Subsection~\ref{ssub-nfsspat}. % %<*ja> - ここで,\verb+\fontencoding{}+は,引数により和文側か欧文側かの - どちらかが切り替わる.例えば,\verb+\fontencoding{JY3}+は和文フォントの - エンコーディングを\texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文 - フォント側を\texttt{T1}へと変更する. - \verb+\fontfamily+も引数により和文側,欧文側,\textbf{あるいは両方}のフォ - ントファミリが切り替わる.詳細は\ref{ssub-nfsspat}節を参照すること. + ここで,\verb+\fontencoding{}+は,引数により和文側か欧文 + 側かのどちらかのエンコーディングを変更する.例えば, + \verb+\fontencoding{JY3}+は和文フォントのエンコーディングを + \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を + \texttt{T1}へと変更する.\verb+\fontfamily+も引数により和文側,欧文 + 側,\textbf{あるいは両方}のフォントファミリを変更する.詳細は + \ref{ssub-nfsspat}節を参照すること. % %<*en> @@ -941,13 +959,13 @@ auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\ % %<*ja> \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の代わりに - \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の実装では + \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の実装では \verb+\DeclareFontFamily+ を用いても問題は生じない. % \end{itemize} +\subsection{fontspec} %<*en> -\paragraph{fontspec} To coexist with the \Pkg{fontspec} package, it is needed to load \Pkg{luatexja-fontspec} package in the preamble. This additional package automatically loads \Pkg{luatexja} and \Pkg{fontspec} @@ -964,7 +982,7 @@ In \Pkg{luatexja-fontspec} package, the following 7~commands are defined as counterparts of original commands in the \Pkg{fontspec} package: % %<*ja> -\Pkg{luatexja-fontspec} パッケージでは,以下の7つのコマンドを \Pkg{fontspec} +\Pkg{luatexja-fontspec} パッケージでは,以下の7つのコマンドを \Pkg{fontspec} パッケージの元のコマンドに対応するものとして定義している: % %<*en> @@ -1022,9 +1040,43 @@ these 7~commands, since this feature and \textbf{JAglue} will clash (see 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため, \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ ンドでは Kerning feature はデフォルトでは off となっている.これはこの -feature が \textbf{JAglue} と衝突するためである(\ref{para-kern} 節を見よ). +feature が \textbf{JAglue} と衝突するためである(\ref{para-kern} 節を参照). % +%<*en> +\paragraph{Caution} +\Pkg{xunicode} package will be reloaded during the loading of \Pkg{luatexja-fontspec} package. +However, this reloading won't work for the current version (2011/09/09,~v0.981) of +\Pkg{xunicode} package. Hence we have to patch it, using the following patch, for example: +% +%<*ja> +\paragraph{注意} +\Pkg{luatexja-fontspec}パッケージでは,内部で \Pkg{xunicode} パッケージの再読み込みを +行っているが, \textbf{\TeX\ Live\ 2011 他に含まれている \Pkg{xunicode} パッケージ +(2011/09/09,~v0.981) ではその再読み込みがうまく動作せず},例えば +以下のようなパッチを当てる必要がある: +% +\begin{lstlisting} +--- xunicode.sty.orig 2011-09-12 08:31:47.000000000 +0900 ++++ xunicode.sty 2011-11-16 22:06:17.061413113 +0900 +@@ -1475,7 +1475,11 @@ + + \newtoks\tipasavetokens + \newtoks\tipachecktokens ++ ++\fi + \newif\iftipaonetoken ++\expandafter\ifx\csname ReloadXunicode\endcsname\relax ++ + \def\tipalasttoken{!@! do nothing with this !@!} + \def\tipacatchonechar#1{\begingroup + \def\textipa##1{##1}% prevent recursion +\end{lstlisting} +%<*ja> +なお,上流で v0.984 (2011/10/14) でこの問題は修正されているそうです. +% + + %\section{Changing Parameters} %\section{パラメータの変更} @@ -1039,7 +1091,7 @@ parameters, you have to use commands \verb+\ltjsetparameter+ and \LuaTeX-ja には多くのパラメータが存在する.そして \LuaTeX の振る舞いのために, その多くは \TeX のレジスタにではなく,\LuaTeX-ja 独自の方法で保持されている. そのため,これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と -\verb+\ltjgetparameter+ を用いなければならない. +\verb+\ltjgetparameter+ を用いる必要がある. % %\subsection{Editing the range of \textbf{JAchar}s} @@ -1053,20 +1105,20 @@ next line assigns whole characters in Supplementary Multilingual Plane and the character `漢' to the range number~100. % %<*ja> -\textbf{JAchar} の範囲を設定するためには,まず文字範囲に0より大きく217より小さい -自然数を割り当てる必要がある.これには \verb+\ltjdefcharrange+ プリミティブを用いる. -例えば,次のように書くことで追加多言語面 (SMP) にある全ての文字と `漢' の範囲番号が -100に設定される. +\textbf{JAchar} の範囲を設定するためには,まず各文字に0より大きく217より小さい index を +割り当てる必要がある.これには \verb+\ltjdefcharrange+ プリミティブを用いる. +例えば,次のように書くことで追加多言語面 (SMP) にある全ての文字と `漢' が +「100番の文字範囲」に属する設定される. % \begin{lstlisting} \ltjdefcharrange{100}{"10000-"1FFFF,`漢} \end{lstlisting} %<*en> This assignment of numbers to ranges are always global, so you should -not do this in the middle of a document. +not do this in the middle of a document. % %<*ja> -この文字範囲への番号の割り当てはいつもグローバルであり,したがって文書の途中で +この文字範囲の割り当てはいつもグローバルであり,したがって文書の途中で この操作をするべきではない. % @@ -1098,8 +1150,8 @@ setting of \LuaTeX-ja): \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}} \end{verbatim} %<*en> -The argument to \textsf{jacharrange} parameter is a list of integer. -Negative integer $-n$ in the list means that `the characters that belong to +The argument to \textsf{jacharrange} parameter is a list of integer. +Negative integer $-n$ in the list means that `the characters that belong to range~$n$ are treated as \textbf{ALchar}', and positive integer $+n$ means that `the characters that belong to range~$n$ are treated as \textbf{JAchar}'. % @@ -1144,7 +1196,7 @@ determined from the following data: %<*en> Now we describe these eight ranges. The alphabet `J' or `A' after the number shows whether characters in the range is treated as -\textbf{JAchar}s or not by default. These settings are similar to the +\textbf{JAchar}s or not by default. These settings are similar to the \texttt{prefercjk} settings defined in \texttt{PXbase} bundle. % %<*ja> @@ -1159,7 +1211,7 @@ number shows whether characters in the range is treated as consists of the following characters: % %<*ja> -\item{範囲 8${}^{\text{J}}$} ISO~8869~1 の上半分(ラテン1補助)と +\item[範囲 8${}^{\text{J}}$] ISO~8859-1 の上位領域(ラテン1補助)と JIS~X~0208 の共通部分にある記号.この文字範囲は 以下の文字で構成される: % @@ -1194,7 +1246,7 @@ number shows whether characters in the range is treated as This range consist of the following Unicode ranges, \emph{except characters in the range~8 above}: % %<*ja> -\item{範囲 1${}^{\text{A}}$} ラテン文字.一部はAdobe-Japan1-6 にも含まれている. +\item[範囲 1${}^{\text{A}}$] ラテン文字.一部はAdobe-Japan1-6 にも含まれている. この範囲は以下の Unicode のブロックから構成されている. \textbf{ただし,範囲 8 は除く.} % @@ -1218,7 +1270,7 @@ This range consist of the following Unicode ranges, \emph{except characters in t \item \texttt{U+0300}--\texttt{U+036F}: ダイアクリティカルマーク(合成可能) \item \texttt{U+1E00}--\texttt{U+1EFF}: ラテン文字拡張追加 % -\par\ +\par\ \end{itemize} \end{multicols} %<*en> @@ -1241,7 +1293,7 @@ This range consist of the following Unicode ranges, \emph{except characters in t \item \texttt{U+0400}--\texttt{U+04FF}: キリル文字 \item \texttt{U+1F00}--\texttt{U+1FFF}: キリル文字補助 % -\\\ +\\\ \end{itemize} \end{multicols} %<*en> @@ -1322,8 +1374,8 @@ This range consist of the following Unicode ranges, \emph{except characters in t % \begin{lstlisting} \ltjdefcharrange{4}{% - "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, - "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F, + "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, + "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF} % non-Japanese \end{lstlisting} %<*en> @@ -1446,59 +1498,124 @@ The block list is indicated in Table~\ref{table-rng7}. %\subsection{\Param{kanjiskip} and \Param{xkanjiskip}} %\subsection{\Param{kanjiskip} と \Param{xkanjiskip}} \label{subs-kskip} + +%<*en> \textbf{JAglue} is divided into the following three categories: +% +%<*ja> +\textbf{JAglue} は以下の3つのカテゴリに分類される: +% \begin{itemize} +%<*en> \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued around a Japanese character, this glue will be not inserted at the place. -\item The default glue which inserted between two \textbf{JAchar}s (\textsf{ +% +%<*ja> +\item JFM で指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで + 発行されていれば,このグルーは挿入されない. +% +%<*en> +\item The default glue which inserted between two \textbf{JAchar}s (\Param{ kanjiskip}). +% +%<*ja> +\item デフォルトで2つの \textbf{JAchar} の間に挿入されるグルー(\Param{kanjiskip}). +% +%<*en> \item The default glue which inserted between a \textbf{JAchar} and an \textbf{ALchar} (\Param{xkanjiskip}). +% +%<*ja> +\item デフォルトで \textbf{JAchar} と \textbf{ALchar} の間に挿入されるグルー(\Param{xkanjiskip}). +% \end{itemize} +%<*en> The value (a skip) of \Param{kanjiskip} or \Param{xkanjiskip} can be changed as the following. +% +%<*ja> +\Param{kanjiskip} や \Param{xkanjiskip} の値は以下のようにして変更可能である. +% \begin{lstlisting} -\ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt}, +\ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt}, xkanjiskip={0.25\zw plus 1pt minus 1pt}} \end{lstlisting} - -It may occur that JFM contains the data of `ideal width of \textsf{kanjiskip}' +%<*en> +It may occur that JFM contains the data of `ideal width of \Param{kanjiskip}' and/or `ideal width of \Param{xkanjiskip}'. -To use these data from JFM, set the value of \Param{kanjiskip} or +To use these data from JFM, set the value of \Param{kanjiskip} or \Param{xkanjiskip} to \verb+\maxdimen+. +% +%<*ja> +JFM は「望ましい \Param{kanjiskip} の値」や「望ましい \Param{xkanjiskip} の値」を +持っていることがある. +これらのデータを使うためには,\Param{kanjiskip} や \Param{xkanjiskip} の値を +\verb+\maxdimen+ の値に設定すればよい. +% %\subsection{Insertion Setting of \Param{xkanjiskip}} %\subsection{\Param{xkanjiskip} の設定の挿入} -It is not desirable that \Param{xkanjiskip} is inserted between every + +%<*en> +It is not desirable that \Param{xkanjiskip} is inserted into every boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example, \Param{xkanjiskip} should not be inserted after opening parenthesis (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ'). - \LuaTeX-ja can control whether \Param{xkanjiskip} can be inserted before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and -\Param{alxspmode} parameters \textbf{ALchar}s respectively. +\Param{alxspmode} parameters \textbf{ALchar}s respectively. +% +%<*ja> +\Param{xkanjiskip} がすべての \textbf{JAchar} と \textbf{ALchar} の境界に +挿入されるのは望ましいことではない.例えば,\Param{xkanjiskip} は開き括弧の +後には挿入されるべきではない(`(あ' と `(\hskip\ltjgetparameter{xkanjiskip}あ' を +比べてみよ). +\LuaTeX-ja では \Param{xkanjiskip} をある文字の前/後に挿入するかどうかを, +\textbf{JAchar} に対しては \Param{jaxspmode} を,\textbf{ALchar} に対しては +\Param{alxspmode} をそれぞれ変えることで制御することができる. +% \begin{LTXexample} -\ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}} +\ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}} pあq い!う \end{LTXexample} +%<*en> The second argument \texttt{preonly} means `the insertion of \Param{xkanjiskip} is allowed before this character, but not after'. the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{ -inhibit}. For the compatibility with \pTeX, natural numbers between -0~and~3 are also allowed as the second argument\footnote{But we don't -recommend this: since numbers 1~and~2 have opposite meanings in -\Param{jaxspmode} and \Param{alxspmode}.}. +inhibit}. ... +% +%<*ja> +2つ目の引数の \texttt{preonly} は「\Param{xkanjiskip} の挿入はこの文字の +前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は +\texttt{postonly}, \texttt{allow}, \texttt{inhibit} である. +なお,現行の +仕様では,\Param{jaxspmode}, \Param{alxspmode} はテーブルを共有しており, +上のソースの1行目を次のように変えても同じことになる: +\begin{verbatim} +\ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}} +\end{verbatim} +また,これら2パラメータには数値で値を指定することもできる(第\ref{part-ref}部を参照). +% + +%<*en> If you want to enable/disable all insertions of \Param{kanjiskip} and \Param{xkanjiskip}, set \Param{autospacing} and \Param{autoxspacing} -parameters to \texttt{false}, respectively. - +parameters to \texttt{true}/\texttt{false}, respectively. +% +%<*ja> +もし全ての \Param{kanjiskip} と \Param{xkanjiskip} の挿入を有効化/無効化 +したければ,それぞれ \Param{autospacing} と \Param{autoxspacing} を +\texttt{true}/\texttt{false} に設定すればよい. +% %\subsection{Shifting Baseline} %\subsection{ベースラインの移動} + +%<*en> To make a match between a Japanese font and an alphabetic font, sometimes shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved by setting \verb+\ybaselineshift+ to a non-zero length (the @@ -1508,22 +1625,44 @@ Japanese fonts, but not that of alphabetic fonts. Because of this, \LuaTeX-ja can independently set the shifting amount of the baseline of alphabetic fonts (\Param{yalbaselineshift} parameter) and that of Japanese fonts (\Param{yjabaselineshift} -parameter). +parameter). +% +%<*ja> +和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が +必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで +なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない +文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい. +このため,\LuaTeX-ja では欧文フォントのベースラインのシフト量 +(\Param{yalbaselineshift} パラメータ)と和文フォントのベースラインのシフト量 +(\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている. +% \begin{LTXexample} \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう \end{LTXexample} +%<*en> Here the horizontal line in above is the baseline of a line. +% +%<*ja> +上の例において引かれている水平線がベースラインである. +% +%<*en> There is an interesting side-effect: characters in different size can be vertically aligned center in a line, by setting two parameters appropriately. The following is an example (beware the value is not well tuned): +% +%<*ja> +この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの +異なる文字を中心線に揃えることができるのだ. +以下は一つの例である(値はあまり調整されていないことに注意): +% \begin{LTXexample} -xyz漢字 +xyz漢字 {\scriptsize - \ltjsetparameter{yjabaselineshift=-1pt, + \ltjsetparameter{yjabaselineshift=-1pt, yalbaselineshift=-1pt} XYZひらがな }abcかな @@ -1532,17 +1671,34 @@ xyz漢字 %\subsection{Cropmark} %\subsection{トンボ} + +%<*en> Cropmark is a mark for indicating 4~corners and horizontal/vertical center of the paper. In Japanese, we call cropmark as tombo(w). \pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel. The following steps are needed to typeset cropmark: +% +%<*ja> +トンボは用紙の四つ角と水平/垂直方向の中心を表す印である. +\pLaTeX と \LuaTeX-ja ではトンボの出力をサポートしている. +トンボを出力するためには以下の手順が必要である: +% \begin{enumerate} +%<*en> \item First, define the banner which will be printed at the upper left of the paper. This is done by assigning a token list to \verb+\@bannertoken+. -For example, the following sets banner as `\texttt{filename (2012-01-01 17:01)}': +For example, the following sets banner as `\texttt{filename (YYYY-MM-DD hh:mm)}': +% +%<*ja> +\item まず,用紙の左上に印刷されるバナーを定義する.これは \verb+\@bannertoken+ + にトークンリストを与えることでなされる. + +例えば,以下はバナーとして `\texttt{filename (YYYY-MM-DD hh:mm)}' を設定する: +% + \begin{verbatim} \makeatletter @@ -1561,71 +1717,118 @@ For example, the following sets banner as `\texttt{filename (2012-01-01 17:01)}' %\part{リファレンス} \label{part-ref} %\section{Font Metric and Japanese Font} -%\section{フォントメトリックと日本語フォント} +%\section{フォントメトリックと和文フォント} %\subsection{\texttt{\char92jfont} primitive} %\subsection{\texttt{\char92jfont} プリミティブ} + +%<*en> To load a font as a Japanese font, you must use the \verb+\jfont+ primitive instead of~\verb+\font+, while -\verb+\jfont+ admits the same syntax used in~\verb+\font+. +\verb+\jfont+ admits the same syntax used in~\verb+\font+. \LuaTeX-ja automatically loads \Pkg{luaotfload} package, so TrueType/OpenType fonts with features can be used for Japanese fonts: +% +%<*ja> +フォントを和文フォントとして読み込むためには,\verb+\jfont+ プリミティブを +\verb+\font+ プリミティブの代わりに用いる. +\verb+\jfont+ プリミティブの文法は \verb+\font+ と同じである. +\LuaTeX-ja は \Pkg{luaotfload} パッケージを自動的に読み込むので, +TrueType/OpenType フォントに feature を指定したものを和文フォントとして用いる +ことができる: +% \begin{LTXexample} \jfont\tradgt={file:ipaexg.ttf:script=latn;% +trad;-kern;jfm=ujis} at 14pt \tradgt{}当/体/医/区 \end{LTXexample} +%<*en> Note that the defined control sequence (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+ causes a error. We denote control sequences which are defined in \verb+\jfont+ by . - -\paragraph{Prefix \texttt{psft}} -Besides \texttt{file:}\ and \texttt{name:}\ prefixes, \texttt{psft:}\ -can be used a prefix in \verb+\jfont+ (and~\verb+\font+) primitive. -Using this prefix, you can specify a `name-only' Japanese font which -will be not embedded to PDF. Typical use of this prefix is to specify -the `standard' Japanese fonts, namely, `Ryumin-Light' and -`GothicBBB-Medium'. For kerning or other information, that of Kozuka -Mincho Pr6N Regular (this is a font by Adobe Inc., and included in -Japanese Font Packs for Adore Reader) will be used. - +% +%<*ja> +なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+) +は \textit{font\_def} トークンではないので,\verb+\fontname\tradgt+ のような +入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された +コントロールシーケンスを で表す. +% \paragraph{JFM} +%<*en> As noted in Introduction, a JFM has measurements of characters and glues/kerns that are automatically inserted for Japanese typesetting. The structure of JFM will be described in the next subsection. At the calling of \verb+\jfont+ primitive, you must specify which JFM will be used for this font by the following keys: +% +%<*ja> +「はじめに」の節で述べたように,JFM は文字と和文組版で自動的に挿入される +グルー/カーンの寸法情報を持っている.JFM の構造は次の小節で述べる. +\verb+\jfont+ プリミティブの呼び出しの際には,どの JFM を用いるのかを以下のキーで +指定する必要がある: +% -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item[jfm=] -Specify the name of JFM. A file named \texttt{jfm-.lua} will be searched and/or loaded. +%<*en> +Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load +a file named \texttt{jfm-.lua}. -The followings are JFMs shipped with \LuaTeX-ja: +The following JFMs are shipped with \LuaTeX-ja: +% +%<*ja> +JFM の名前を指定する.もし以前に指定されたJFMが読み込まれていなければ, +\texttt{jfm-.lua} を読み込む. + +以下の JFM が \LuaTeX-ja には同梱されている: +% \begin{description} +%<*en> \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is - based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that - is used in \upTeX. When you use the \Pkg{luatexja-otf} package, please use this JFM. + based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that + is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM. +% +%<*ja> +\item[\tt jfm-ujis.lua] \LuaTeX-ja の標準 JFM である.この JFM は \upTeX で + 用いられる UTF/OTF パッケージ用のメトリックである \verb+upnmlminr-h.tfm+ を + 元にしている.\Pkg{luatexja-otf} パッケージを使うときはこの JFM を指定するべきである. +% +%<*en> \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font - metric' which is widely used in \pTeX. A major difference of - \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that - most characters under \texttt{jfm-ujis.lua} are square-shaped, - while that under \texttt{jfm-jis.lua} are horizontal - rectangles. - + metric' which is widely used in \pTeX. A major difference of + \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that + most characters under \texttt{jfm-ujis.lua} are square-shaped, + while that under \texttt{jfm-jis.lua} are horizontal + rectangles. +% +%<*ja> +\item[\tt jfm-jis.lua] \pTeX で広く用いられている「JIS フォントメトリック」 + \verb+jis.tfm+ に相当する JFM である.\texttt{jfm-ujis.lua} とこの + \texttt{jfm-jis.lua} の主な違いは,\texttt{jfm-ujis.lua} ではほとんどの文字が + 正方形状であるのに対し,\texttt{jfm-jis.lua} では横長の長方形状である. +% +%<*en> \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one - of the default Japanese font metric shipped with \pTeX. There - are notable difference between this JFM and other 2~JFMs, as - shown in Table~\ref{tab-difjfm}. + of the default Japanese font metric shipped with \pTeX. There + are notable difference between this JFM and other 2~JFMs, as + shown in Table~\ref{tab-difjfm}. +% +%<*ja> +\item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文フォントメトリック + である \verb+min10.tfm+ に相当する JFM である.この JFM と他の2つの JFM の間には + 表 \ref{tab-difjfm} に示すような特筆すべき違いがある. +% \end{description} -\item[jfmvar=] Sometimes there is a need that +\item[jfmvar=] Sometimes there is a need that ... \end{list} \begin{table}[t] -\caption{Differences between JFMs shipped with \LuaTeX-ja} +%\caption{Differences between JFMs shipped with \LuaTeX-ja} +%\caption{\LuaTeX-ja に同梱されている JFM の違い} \label{tab-difjfm} \ltjsetparameter{jacharrange={+3}} \begin{center} @@ -1646,34 +1849,93 @@ The followings are JFMs shipped with \LuaTeX-ja: \toprule &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\ \midrule -Example~1&\r{ujis}&\r{jis}&\r{min}\\ -Example~2&\s{ujis}&\s{jis}&\s{min}\\ +%Example~1\footnotemark +%例1\footnotemark +&\r{ujis}&\r{jis}&\r{min}\\ +%Example~2 +%例2 +&\s{ujis}&\s{jis}&\s{min}\\ Bounding Box&\t{ujis}&\t{jis}&\t{min}\\ \bottomrule \end{tabular} \end{center} \ltjsetparameter{jacharrange={-3}} \end{table} +\footnotetext{from: 乙部厳己, min10フォントについて. +\texttt{http://argent.shinshu-u.ac.jp/\~{\ }otobe/tex/files/min10.pdf}.} -\paragraph{Note: kern feature}\label{para-kern} +%\paragraph{Note: kern feature} +%\paragraph{注意:kern feature} +\label{para-kern} +%<*en> Some fonts have information for inter-glyph spacing. However, this information is not well-compatible with \LuaTeX-ja. More concretely, this kerning space from this information are inserted \emph{before} the insertion process of \textbf{JAglue}, and this causes incorrect spacing between two characters when both a glue/kern from the data in the font and it from JFM are present. +% +%<*ja> +いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし, +この情報は \LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入 +されるカーニングスペースは \textbf{JAglue} の挿入過程の\textbf{前に}挿入され, +JFM に基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と +なる. +% \begin{itemize} +%<*en> \item You should specify \texttt{-kern} in -\texttt{\char92jfont} primitive, when you want to use other font features, - such as \texttt{script=...}\,. + \verb+jfont+ primitive, when you want to use other font features, + such as \texttt{script=...}\,. +% +%<*ja> +\item \texttt{script=...} といった feature を使いたい場合には,\verb+\jfont+ + プリミティブに \texttt{-kern} を指定するべきである. +% +%<*en> \item If you want to use Japanese fonts in proportional width, and use information from this font, use \texttt{jfm-prop.lua} for its JFM, and ... +% +%<*ja> +\item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい + ならば,\texttt{jfm-prop.lua} を JFM として指定し,…… +% TODO: kanjiskip? \end{itemize} +%\subsection{Prefix \texttt{psft}} +%\subsection{\texttt{psft} プレフィックス} +%<*en> +Besides \texttt{file:}\ and \texttt{name:}\ prefixes, one can use \texttt{psft:}\ +prefix in \verb+\jfont+ (and~\verb+\font+) primitive, +to specify a `name-only' Japanese font which +will be not embedded to PDF. Typical use of this prefix is to specify +the `standard' Japanese fonts, namely, `Ryumin-Light' and +`GothicBBB-Medium'. For kerning or other information, that of Kozuka +Mincho Pr6N Regular (this is a font by Adobe Inc., and included in +Japanese Font Packs for Adobe Reader) will be used. +% +%<*ja> +\texttt{file:} と \texttt{name:} のプレフィックスに加えて, +\verb+\jfont+ プリミティブ(と \verb+\font+ プリミティブ)では +\texttt{psft:} プレフィックスを用いることができる. +このプレフィックスを用いることで,PDF には埋め込まれない「名前だけの」 +和文フォントを指定することができる.典型的な使い方は「標準的な」和文フォント, +つまり `Ryumin-Light' と `GothicBBB-Medium' を指定することである. +この場合,カーニング他の情報は小塚明朝 Pr6N Regular +(Adobe 社によるフォントで,Adobe Reader の日本語フォントパックに含まれている) +が用いられる. +% + +\paragraph{\texttt{cid} key} +\label{para-cid} + + \texttt{cid} key, ... + + %\subsection{Structure of JFM file} %\subsection{JFM ファイルの構造} A JFM file is a Lua script which has only one function call: @@ -1685,7 +1947,7 @@ Real data are stored in the table which indicated above by structure of this table. Note that all lengths in a JFM file are floating-point numbers in design-size unit. -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item[dir=] (required) The direction of JFM. At the present, only \texttt{'yoko'} is supported. @@ -1720,7 +1982,7 @@ always present, so each JFM file must have a sub-table whose index is \texttt{[0]}. Each sub-table (its numerical index is denoted by $i$) has the following fields: -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item[chars=\{, ...\}] (required except character class~0) This field is a list of characters which are in this character @@ -1736,10 +1998,10 @@ This field is a list of characters which are in this character Specify width of characters in character class~$i$, height, depth and the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are -as values of these fields. -But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph +as values of these fields. +But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph -\item[left=, down=, align=]\ +\item[left=, down=, align=]\ These fields are for adjusting the position of the `real' glyph. Legal values of \texttt{align} field are \texttt{'left'}, @@ -1751,8 +2013,8 @@ The effects of these 3~fields are indicated in Figure~\ref{fig-pos}. In most cases, \texttt{left} and \texttt{down} fields are~0, while it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}. -For example, setting the \texttt{align} field to \texttt{'right'} is practically needed -when the current character class is the class for opening delimiters'. +For example, setting the \texttt{align} field to \texttt{'right'} is practically needed +when the current character class is the class for opening delimiters'. \begin{figure}[!tb] \begin{minipage}{0.4\textwidth}% \begin{center}\unitlength=10pt\small @@ -1803,16 +2065,16 @@ when the current character class is the class for opening delimiters'. \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}} \put(3,0){\vector(0,-1){1.5}} \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}} -\end{picture} +\end{picture} \end{center} \end{minipage}% \begin{minipage}{0.6\textwidth}% -Consider a node containing Japanese character whose value of the \texttt{align} +Consider a node containing Japanese character whose value of the \texttt{align} field is \texttt{'middle'}. \begin{itemize} \item The black rectangle is a frame of the node. Its width, height and depth are specified by JFM. -\item Since the \texttt{align} field is \texttt{'middle'}, +\item Since the \texttt{align} field is \texttt{'middle'}, the `real' glyph is centered horizontally (the green rectangle). \item Furthermore, the glyph is shifted according to values of fields \texttt{left} and \texttt{down}. The ultimate position of the real @@ -1830,8 +2092,8 @@ the `real' glyph is centered horizontally (the green rectangle). \end{list} %<*en> -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} -\item['lineend'] An ending of a line. +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} +\item['lineend'] An ending of a line. \item['diffmet'] Used at a boundary between two \textbf{JAchar}s whose JFM or size is different. \item['boxbdd'] The beginning/ending of a horizontal box, and the beginning of a noindented paragraph. \item['parbdd'] The beginning of an (indented) paragraph. @@ -1845,10 +2107,10 @@ the `real' glyph is centered horizontally (the green rectangle). 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か -い組版調整ができるようになっている.以下のその一覧を述べる: -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +い組版調整ができるようになっている.以下でその一覧を述べる: +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item['lineend'] 行の終端を表す. -\item['diffmet'] +\item['diffmet'] \item['boxbdd'] hboxの先頭と末尾,及びインデントされていない (\verb+\noindent+で開始された)段落の先頭を表す. @@ -1894,9 +2156,9 @@ the `real' glyph is centered horizontally (the green rectangle). \begin{LTXexample} \jfont\g=psft:Ryumin-Light:jfm=test \g \parindent1\zw\noindent{}◆◆◆◆◆ -\par{}「◆◆←二分下がり -\par{}【◆◆←全角下がり -\par{}〔◆◆←全角二分下がり +\par 「◆◆←二分下がり +\par 【◆◆←全角下がり +\par 〔◆◆←全角二分下がり \end{LTXexample} \end{itemize} \ltjsetparameter{jacharrange={-3}} @@ -1913,7 +2175,7 @@ an external package is needed to support this in plain \TeX\ and \LuaTeX-ja's handling of Japanese fonts in math formulas is similar; Table~\ref{tab-math} shows counterparts to \TeX's primitives for math font families. There is no relation between the value of -\verb+\fam+ and that of \verb+\jfam+; with appropriate settings, +\verb+\fam+ and that of \verb+\jfam+; with appropriate settings, you can set both \verb+\fam+ and \verb+\jfam+ to~the same value. \begin{table}[!tb] @@ -1941,6 +2203,7 @@ be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other c {\def\makelabel#1{\bfseries#1}} \item[\texttt{luatexja.load\_jfm} callback] With this callback you can overwrite JFMs. +This callback is called when a new JFM is loaded. \begin{verbatim} function ( jfm_info, jfm_name) @@ -1948,7 +2211,7 @@ function (
jfm_info, jfm_name) end \end{verbatim} -The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except +The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except this argument has \texttt{chars} field which contains character codes whose character class is not~0. @@ -1974,8 +2237,8 @@ You may assume that \verb+jfont_info+ has the following fields: \item[\tt var] The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+. \end{description} -The returned table \verb+new_jfont_info+ also should include these three fields. -The \verb+font_number+ is a font number. +The returned table \verb+new_jfont_info+ also should include these three fields. +The \verb+font_number+ is a font number. A good example of this and the next callbacks is the \Pkg{luatexja-otf} package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1 @@ -2006,8 +2269,36 @@ The argument \verb+char_class+ is the result of \LuaTeX-ja's default This callback doesn't replace any code of \LuaTeX-ja. +\item[\texttt{luatexja.set\_width} callback] +This callback is called when \LuaTeX-ja is trying to encapsule a + \textbf{JAchar} \textit{glyph\_node}, to adjust its + dimension and position. +\begin{lstlisting}[numbers=left] +function (
shift_info,
jfont_info, char_class) + return
new_shift_info +end +\end{lstlisting} +The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have +\texttt{down} and \texttt{left} fields, which are the amount of shifting + down/left the character in a scaled-point. +%<*ja> +良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では, + JFM内で規定された文字クラス0の文字における$(\hbox{高 + さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上 + 下位置が自動調整される.例えば, +\begin{itemize} +\item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$% +(和文OpenTypeフォントの標準値) +\item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値) +\end{itemize} +となっていたとする.すると,実際の文字の出力位置は, +\[ + \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{825}y= 0.03\dot1\dot5y +\] +だけ上にずらされることになる, +% \end{list} @@ -2018,20 +2309,20 @@ This callback doesn't replace any code of \LuaTeX-ja. %\subsection{\texttt{\char92 ltjsetparameter} プリミティブ} As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are primitives for accessing most parameters of \LuaTeX-ja. One of the main -reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\ -(\textit{e.g.},~\verb+\prebreakpenalty`)=10000+) +reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\ +(\textit{e.g.},~\verb+\prebreakpenalty`)=10000+) is the position of \verb+hpack_filter+ callback in the source of \LuaTeX, see Section~\ref{sec-para}. \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives for assigning parameters. These take one argument which is a \texttt{=} list. Allowed keys are described in the next -subsection. +subsection. The difference between \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the scope of assignment; -\verb+\ltjsetparameter+ does a local assignment and -\verb+\ltjglobalsetparameter+ does a global one. +\verb+\ltjsetparameter+ does a local assignment and +\verb+\ltjglobalsetparameter+ does a global one. They also obey the value of \verb+\globaldefs+, like other assignment. @@ -2039,7 +2330,7 @@ like other assignment. always takes a parameter name as first argument, and also takes the additional argument---a character code, for example---in some cases. \begin{LTXexample} -\ltjgetparameter{differentjfm}, +\ltjgetparameter{differentjfm}, \ltjgetparameter{autospacing}, \ltjgetparameter{prebreakpenalty}{`)}. \end{LTXexample} @@ -2060,7 +2351,7 @@ in \pTeX, and symbols beside each parameter has the following meaning: \item `\dagger': assignments are always global. \end{itemize} -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item[\Param{jcharwidowpenalty}\,=] [\verb+\jcharwidowpenalty+] Penalty value for suppressing orphans. This penalty is inserted just @@ -2069,13 +2360,13 @@ Penalty value for suppressing orphans. This penalty is inserted just \item[\Param{kcatcode}\,=\{,\}]\ -An additional attributes having each character whose character code is . +An additional attributes having each character whose character code is . At the present version, the lowermost bit of indicates whether the character is considered as a punctuation mark (see the description of \Param{jcharwidowpenalty} above). -\item[\Param{prebreakpenalty}\,=\{,\}] [\verb+\prebreakpenalty+]\ +\item[\Param{prebreakpenalty}\,=\{,\}] [\verb+\prebreakpenalty+]\ %<*ja> 文字コードの\textbf{JAchar}が行頭にくることを抑止するために, この文字の前に挿入/追加されるペナルティの量を指定する. @@ -2110,20 +2401,22 @@ At the present version, the lowermost bit of indicates \item[\Param{jatextfont}\,=\{,\}] [\verb+\textfont+ in \TeX] \item[\Param{jascriptfont}\,=\{,\}] [\verb+\scriptfont+ in \TeX] \item[\Param{jascriptscriptfont}\,=\{,\}] [\verb+\scriptscriptfont+ in \TeX] -\item[\Param{yjabaselineshift}\,=$^\ast$]\ +\item[\Param{yjabaselineshift}\,=$^\ast$]\ \item[\Param{yalbaselineshift}\,=$^\ast$] [\verb+\ybaselineshift+] -\item[\Param{jaxspmode}\,=\{,\}] [\verb+\inhibitxspcode+] +\item[\Param{jaxspmode}\,=\{,\}] Setting whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is . The followings are allowed for : \begin{description} \item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character. -\item[2, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after. -\item[1, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before. +\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after. +\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before. \item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character. This is the default value. \end{description} +This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+. + \item[\Param{alxspmode}\,=\{,\}] [\verb+\xspcode+] @@ -2141,7 +2434,7 @@ The followings are allowed for : before the character and after the character. This is the default value. \end{description} -Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table. +Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other. \item[\Param{autospacing}\,=$^\ast$] [\verb+\autospacing+] \item[\Param{autoxspacing}\,=$^\ast$] [\verb+\autoxspacing+] @@ -2150,7 +2443,7 @@ Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table. \item[\Param{differentjfm}\,=$^\dagger$] -Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different. +Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different. The allowed arguments are the followings: \begin{description} \item[\texttt{average}] @@ -2169,7 +2462,7 @@ The allowed arguments are the followings: %\subsection{Primitives for Compatibility} %\subsection{互換プリミティブ} The following primitives are implemented for compatibility with \pTeX: -\begin{list}{}{\def\makelabel{\ttfamily\char92 }} +\begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw} \item[kuten] \item[jis] \item[euc] @@ -2180,14 +2473,16 @@ The following primitives are implemented for compatibility with \pTeX: %\subsection{\texttt{\char92 inhibitglue} primitive} %\subsection{\texttt{\char92 inhibitglue} プリミティブ} The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}. -The following is an example, using a special JFM that there will be a glue between +The following is an example, using a special JFM that there will be a glue between the beginning of a box and `あ', and also between `あ' and `ウ'. \begin{LTXexample} \jfont\g=psft:Ryumin-Light:jfm=test \g -あウあ\inhibitglue{}ウ\inhibitglue\par -あ\par\inhibitglue{}あ -\par\inhibitglue\hrule{}あoff\inhibitglue ice +\fbox{\hbox{あウあ\inhibitglue ウ}} +\inhibitglue\par\noindent あ1 +\par\inhibitglue\noindent あ2 +\par\noindent\inhibitglue あ3 +\par\inhibitglue\hrule あoff\inhibitglue ice \end{LTXexample} With the help of this example, we remark the specification of \verb+\inhibitglue+: @@ -2229,27 +2524,37 @@ The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefa \item[reDeclareMathAlphabet\{\}\{\}\{\}] 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する. -具体的には,欧文数式用フォントファミリ変更の命令と,和文数式用フォ - ントファミリ変更の命令の2つを同時に行う命令として +具体的には,欧文数式用フォントファミリ変更の命令 (\verb+\mathrm+等)と,和文数式用フォ + ントファミリ変更の命令(\verb+\mathmc+等)の2つを同時に行う命令として を(再)定義する.実際の使用ではと - に同じものを指定する,すなわち,に和文側も変 + に同じものを指定する,すなわち,で和文側も変 更させるようにするのが一般的と思われる. -本コマンドの使用については,\pLaTeX 配布中の\texttt{plfonts.dtx}に詳しく - 注意点が述べられているので,そちらを参照されたい. +{\let\item=\origitem +本命令は +\begin{center}\tt +\{\}\quad$\longrightarrow$\quad +(を1段展開したもの)\{を1段展開したもの)\{\}\} +\end{center} +と定義を行うので,使用には注意が必要である: +\begin{itemize} +\item ,~は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に +両命令の内容を再定義しても,の内容にそれは反映されない. +\item ,~に\verb+\@mathrm+などと \texttt{@} をつけた命令を指定した時の動作は保証できない. +\end{itemize}} \item[DeclareRelationFont\{\}\{\}\{\}\{\}\\ \hfill\{\}\{\}\{\}\{\}] %<*en> -This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments) -with respect to a Japanese font family given by the former 4~arguments. +This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments) +with respect to a Japanese font family given by the former 4~arguments. % %<*ja> いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して, そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える. % \item[SetRelationFont] -This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local +This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local assignment, where \verb+\DeclareRelationFont+ does a global assignment. \item[userelfont] Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic @@ -2263,7 +2568,7 @@ Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect. \item[fontfamily\{\}] {\let\item\origitem -As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both}) +As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both}) to . Which family will be changed is determined as follows: \begin{itemize} \item Let current encoding scheme for Japanese fonts be @@ -2279,7 +2584,7 @@ to . Which family will be changed is determined as follows: . For alphabetic font family, the criterion as above is used. \item There is a case which none of the above applies, that is, the font family named doesn't seem to be defined neither under the - encoding , nor under . + encoding , nor under . In this case, the default family for font substitution is used for alphabetic and Japanese fonts. Note that current encoding will not @@ -2308,7 +2613,7 @@ As closing this subsection, we shall introduce an example of This optional package supports typesetting characters in Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level commands: -\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}} +\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw} \item[\char92CID\{\}] Typeset a character whose CID number is . \item[\char92UTF\{\}] @@ -2331,8 +2636,8 @@ ordinary characters in the following points: \paragraph{Additionally Syntax of JFM} \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{ chars} table in JFM now allows a string in the form -\verb+'AJ1-xxx'+, which stands for the character -whose CID number in Adobe-Japan1 is \verb+xxx+. +\verb+'AJ1-xxx'+, which stands for the character +whose CID number in Adobe-Japan1 is \verb+xxx+. %\part{Implementations} %\part{実装} @@ -2344,7 +2649,7 @@ whose CID number in Adobe-Japan1 is \verb+xxx+. %\subsection{用いられる寸法レジスタ,属性レジスタ,whatsit ノード} Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja. \begin{list}{}{% -\def\makelabel{\ttfamily} +\def\makelabel{\ttfamily}\advance\leftmargin1\zw \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]} \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]} } @@ -2352,11 +2657,11 @@ Here the following is the list of dimensions and attributes which are used in \L \dim{jQ} As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is - a unit used in Japanese phototypesetting. So one should not change the value of this dimension. + a unit used in Japanese phototypesetting. So one should not change the value of this dimension. \dim{jH} There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and - used in Japanese phototypesetting. The dimension - \verb+\jH+ stores this length, similar to \verb+\jQ+. + used in Japanese phototypesetting. This + \verb+\jH+ is a synonym of \verb+\jQ+. \dim{ltj@zw} A temporal register for the `full-width' of current Japanese font. \dim{ltj@zh} A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font. \attr{jfam} Current number of Japanese font family for math formulas. @@ -2372,10 +2677,10 @@ There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and assigned to this attribute: \begin{description} \item[\textit{italic} (1)] Glues from an italic correction - (\verb+\/+). This distinction of origins of glues + (\verb+\/+). This distinction of origins of glues (from explicit \verb+\kern+, or from \verb+\/+) is needed in the insertion process of \Param{xkanjiskip}. -\item[\textit{packed} (2)] +\item[\textit{packed} (2)] \item[\textit{kinsoku} (3)] Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}). \item[\textit{from\_jfm} (4)] Glues/kerns from JFM. \item[\textit{line\_end} (5)] Kerns for ... @@ -2486,7 +2791,7 @@ group, then: \end{itemize} Note that to work this trick correctly, assignments to -\verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always, +\verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always, regardless the value of \verb+\globaldefs+. This problem is resolved by using \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local). @@ -2503,7 +2808,7 @@ since words are not separated by spaces in Japanese writings. However, this feature isn't fully implemented in \LuaTeX-ja due to the specification of callbacks in~\LuaTeX. To clarify the difference between \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in -this subsection. +this subsection. \pTeX's input processor can be described in terms of a finite state automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The @@ -2523,7 +2828,7 @@ after `beginning/ending of a group' characters. %<*ja> 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は -空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどどこでも改行が可能なため, +空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため, \pTeX では和文文字の直後の改行は単純に無視されるようになっている. このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである. @@ -2536,7 +2841,7 @@ after `beginning/ending of a group' characters. \item State~$M$: 行中. \item State~$K$: 行中(和文文字の後). \end{itemize} -また,状態遷移は,図~\ref{fig-ptexipro} のようになっており,図中の数字は +また,状態遷移は,図\ref{fig-ptexipro} のようになっており,図中の数字は カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり, 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同 じものになる. @@ -2679,11 +2984,8 @@ u %\section{JFM グルーの挿入,\Param{kanjiskip} と \Param{xkanjiskip}} %\subsection{Overview} %\subsection{概要} -%<*en> -NOT COMPLETED -% -%<*ja> + \LuaTeX-ja における和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる. \pTeX では次のような仕様であった: \begin{itemize} @@ -2698,66 +3000,541 @@ NOT COMPLETED 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・ カーニング処理がノードベースになったことに対応する変更である. -\LuaTeX-jaにおける\textbf{JAglue}挿入処理では,下の図\ref{fig-clu}のよう -に「塊」を単位にして行われる.大雑把にいうと,「塊」は文字とそれに付随す +\LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する +「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す るノード達(アクセント位置補正用のkernや,イタリック補正)をまとめたもの -であり,2つの塊の間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版 -には関係しないものがある.そのため,…… -% +であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版 +には関係しないものがある. -% \begin{figure}[!tb] -% \unitlength=10mm -% \end{figure} -%\subsection{Definition of a `cluster'} +%\subsection{definition of a `cluster'} %\subsection{「クラスタ」の定義} +\def\OA{$\text{\sf O}_{\text{\sf A}}$} +\def\OB{$\text{\sf O}_{\text{\sf B}}$} \begin{defn} -A \emph{cluster} is a list of nodes in one of the following forms, with the \textit{id} of it: +A \emph{cluster} is a list of consecutive nodes in one of the following forms, +with the \textit{id} of it: \begin{enumerate} \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$. These nodes come from a hbox which is already packaged, by unpackaging (\verb+\unhbox+). The \textit{id} is \textit{id\_pbox}. -\item A inline math formula, including two \textit{math\_node}s at the boundary of it: -HOGE +\item A inline math formula, including two \textit{math\_node}s at the boundary of it. The \textit{id} is \textit{id\_math}. -\item A \textit{glyph\_node} with nodes which relate with it: -HOGE +\item A \textit{glyph\_node}~$p$ with nodes which relate with it: +\begin{enumerate} +\item A kern for the italic correction of~$p$. +\item An accent attached to $p$ by \verb+\accent+. +\end{enumerate} +\[ +\overbrace{% + \Node{kern}{$\mathit{subtype}=2$}\longrightarrow +\left\{\begin{array}{c} +\Node{glyph}{accent}\\\noalign{\medskip} +\Node{hbox}{accent (shifted vert.)} +\end{array}\right\}\longrightarrow +\Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}} +\longrightarrow +\Node{glyph}{$p$}\longrightarrow +\overbrace{% +\Node{kern}{italic corr.}}^{\text{(b)}} +\] + The \textit{id} is \textit{id\_jglyph} or \textit{id\_glyph}, according to whether the \textit{glyph\_node} represents a Japanese character or not. -\item An box-like node, that is, an hbox, an vbox and an rule (\verb+\vrule+). +\item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}. The \textit{id} is \textit{id\_hlist} if the node is an hbox which is not shifted vertically, or \textit{id\_box\_like} otherwise. \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} and \textit{id\_disc}, respectively. -%Just a node which will \dots, \textit{i.e.}, a node which is \emph{not} one of the following: -%\textit{ins\_node}, \textit{mark\_node}, \textit{adjust\_node}, \textit{whatsit\_node} -%and \textit{penalty\_node}. \end{enumerate} We denote a cluster by \textit{Np}, \textit{Nq} and \textit{Nr}. \end{defn} -Internally, a cluster is represented by a table $\textit{Np}$ with the following fields. +以降は日本語. + +\paragraph{\textit{id}の意味} +$\mathit{Np}.\mathit{id}$の意味を述べるとともに, +「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と, +「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する. +直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語, +と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は +説明用に準備した概念であって,実際の Lua コード中にそのように書かれているわけではないことに注意. \begin{description} -\def\makelabel#1{\textbf{\textit{#1}}} -\item[first, last] The first/last node of the cluster. -\item[id] The \textit{id} in above definition. -\item[nuc] - -% jachar -\item[auto\_kspc, auto\_xspc] -\item[xspc\_before, xspc\_after] - -% alchar, jachar -\item[pre, post] -\item[char] -\item[class] -\item[lend] -\item[met, var] +\item[\textit{id\_jglyph}] 和文文字.\\ +$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している +\textit{glyph\_node}そのものである. +\item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\ +多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた +\textit{glyph\_node}である可能性もある. +前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である. +一方,後者の場合, +\begin{itemize} +\item $\mathit{Np}.\mathit{head}$は, +合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→…… +と再帰的に検索していってたどり着いた\textit{glyph\_node}である. +\item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である. +\end{itemize} +\item[\textit{id\_math}] インライン数式.\\ +便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに +「文字コード$-1$の欧文文字」とおく. +\item[\textit{id\_hlist}] 縦方向にシフトされていない hbox.\\ +この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの, +先頭・末尾のノードである. +\begin{itemize} +\item 状況によっては,\TeX ソースで言うと +\begin{verbatim} +\hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}} +\end{verbatim} +のように,$p$の内容が別の hbox で開始・終了している可能性も十分あり得る.そのような場合, +$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない} hbox の +場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり, +一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた hbox,\verb+\lower1pt\hbox{xyz}+に対応するノードである. +\item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用の kern が +来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う. +\item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}% +と同様に再帰的に構成要素をたどっていく. +\end{itemize} +\item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために +まとめて1つのクラスタとして取り扱うだけである. +\textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する, +\item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\ +\textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが, +第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は +全く考慮に入れない. +\item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\ +この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である. +敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である. +\item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味. \end{description} + +\paragraph{クラスタの別の分類} +さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく. +挿入処理では2つの隣り合ったクラスタの間に +空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである +とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること. +\begin{description} +\item[和文A] リスト中に直接出現している和文文字. +\textit{id}が\textit{id\_jglyph}であるか,\\ +\textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき. + +\item[和文B] リスト中のhboxの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に +JFMグルーの挿入が行われない(\Param{xkanjiskip},~\Param{kanjiskip}は入り得る)ことである.\\ +\textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき. + +\item[欧文] リスト中に直接/hboxの中身として出現している欧文文字.次の3つの場合が該当: +\begin{itemize} +\item \textit{id}が\textit{id\_glyph}である. +\item \textit{id}が\textit{id\_math}である. +\item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}. +\end{itemize} +\item[箱] box,またはそれに類似するもの.次の2つが該当: +\begin{itemize} +\item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない. +\item \textit{id}が\textit{id\_box\_like}である. +\end{itemize} + +\end{description} + +\subsection{段落/hboxの先頭や末尾} +\paragraph{先頭部の処理} +まず,段落/hboxの一番最初にあるクラスタ\textit{Np}を探索する. +hboxの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく: +\begin{center} +\verb+\parindent+由来のhbox ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない +ようなwhatsit. +\end{center} +これは,\verb+\parindent+由来のhboxがクラスタを構成しないようにするためである. + +次に,\textit{Np}の直前に空白$g$を必要なら挿入する: +\begin{enumerate} +\item この処理が働くような\textit{Np}は\textsf{和文A}である. +\item 問題のリストが字下げありの段落(\verb+\parindent+由来のhboxあり)の場合は, +この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るglue/kernである. +\item そうでないとき(\verb+noindent+で開始された段落や,hbox)は, +$g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るglue/kernである. +\end{enumerate} +ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない. +そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する: +\begin{itemize} +\item 問題にしているリストが段落であり,かつ +\item \textit{Np}の前には予めペナルティがなく,$g$はglue. +\end{itemize} + +\paragraph{末尾の処理} +末尾の処理は,問題のリストが段落のものかhboxのものかによって異なる. +後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るglue/kernを, +\textit{Nq}の直後に挿入するのみである. + +一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と, +\verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は +この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる. +\begin{enumerate} +\item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する. +\item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために, +\Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす. + +ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような +最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar} +を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}. +\end{enumerate} + +\subsection{概観と典型例:2つの「和文A」の場合} +先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には, +ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと, +\[ + \Node{cluster}{\textit{Nq}}\longrightarrow +\overbrace{ +\Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)} +\longrightarrow \Node{cluster}{\textit{Np}} +\] +のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る. +そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる: +\[ + \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow +\overbrace{ +\Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)} +\longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}} +\] + +以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,} +この場合が全ての場合の基本となる. + +\paragraph{「右空白」の算出} +まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる. +\begin{description} +\item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合, + デフォルト値\Param{kanjiskip}を採用することとなるので,次へ. +\begin{enumerate} +\item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される), + 代わりに\Param{kanjiskip}が挿入されることとなる.次へ. +\item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば, + 共通に使っているJFM内で挿入される空白 (glue or kern) が決まっているか調べる. +\item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである. +この場合,まず +\[ +\vcenter{\halign{\hfil$#:={}$&(\inhibitglue#\inhibitglue)\cr +gb&\textit{Nq}と「文字コードが{\tt'diffmet'}の文字」との間に入るglue/kern\cr +ga&「文字コードが{\tt'diffmet'}の文字」と\textit{Np}との間に入るglue/kern\cr +}} +\] +として,左側由来・右側由来の空白 (glue/kern) を(それぞれのJFMから)求める. +$\mathit{ga}$と$\mathit{gb}$のどちらか片方が未定義であるならば,定義されている側の値をそのまま採用する. +もし$\mathit{ga}$と$\mathit{gb}$が両方決まっているならば,両者の値を平均\footnote{\Param{differentjfm}パラメタの +値によって,「大きい方」「小さい方」「合計」に変えることができる.}した値を採用する. +\end{enumerate} + +例えば, +\begin{verbatim} +\jfont\foo=psft:Ryumin-Light:jfm=ujis +\jfont\bar=psft:GothicBBB-Medium:jfm=ujis +\jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo +\end{verbatim} +という3フォントを考え, +\[ + \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p} +\longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q} +\longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r} +\] +という3ノードを考える(それぞれ単独でクラスタをなす). +この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で, +$q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる. +\item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合, +\Param{kanjiskip}の値を以下で定め,それを「右空白」として採用する. +この段階においては,\verb+\inhibitglue+は効力を持たないため, +結果として,2つの和文文字間には常に何らかのglue/kernが挿入されることとなる. +\begin{enumerate} +\item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する +\Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする. +\item ユーザ側から見た\Param{kanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で +なければ,\Param{kanjiskip}パラメタの値を持つglueを採用する. +\item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{kanjiskip}の値を用いる. +どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている +JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する. +\end{enumerate} +\end{description} +\paragraph{「左空白」の算出とそれに伴う補正} +次に,「左空白」にあたる量を算出する: +\begin{description} +\item[line-end~{[E]}] +\textit{Nq}と\textit{Np}の間で行分割が起きたときに, +\textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している. +\begin{enumerate} +\item 既に算出した「右空白」がkernである場合は,「左空白」は挿入されない. +\item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は +\textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るkernとして,JFMから決定される. +\item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く. +\end{enumerate} +\end{description} +\paragraph{禁則用ペナルティの挿入} +まず, +\[ + a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値}) ++(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値}) +\] +とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}. +ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の +算出では単純な整数の加減算を行う. + +$a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である. +\begin{description} +\item[P-normal~{[PN]}] +\textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である: +それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい. +また,$10000 + (-10000) = 0$としている. + +少々困るのは,(a)部分にペナルティが存在していない場合である. +直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って +「右空白」の(もし未定義なら\textit{Np}の)直前に挿入…… +ということになるが,実際には僅かにこれより複雑である. +\begin{itemize} +\item 「右空白」がkernであるとき, +それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため, +この場合は$a\neq 0$であってもペナルティの挿入はしない. +\item 「左空白」がkernとしてきっちり定義されている時(このとき,「右空白」はkernでない), +この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても +\textit{penalty\_node}を作って挿入する. +\item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する. +\end{itemize} +\end{description} + +\def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}% + \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$} +\begin{table}[t] +\caption{Summary of JFM glues} +\label{tab-jfmglue} +\begin{center} +\small +\begin{tabular}{>{\sf}c|cccccc} +\toprule +{\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule +和文A& +\gkf{E}{M→K}{PN}& +\gkf{---}{\OA →K}{PN}& +\gkf{---}{\OA →X}{PN}& +\gkf{---}{\OA}{PA}& +\gkf{---}{\OA}{PN}& +\gkf{---}{\OA}{PS}\\ +和文B& +\gkf{E}{\OB→K}{PA}& +\gkf{---}{K}{PS}& +\gkf{---}{X}{PS}\\ +欧文& +\gkf{E}{\OB →X}{PA}& +\gkf{---}{X}{PS}\cr +箱&\gkf{E}{\OB}{PA}\\ +glue&\gkf{E}{\OB}{PN}\\ +kern&\gkf{E}{\OB}{PS}\\ +\bottomrule +\end{tabular} +\end{center} +\begin{quote} +Here {\small\gkf{E}{M→K}{PN}} means that +\begin{enumerate} +\item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'. +If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'. +\item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'. +\item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}. +\end{enumerate} +\end{quote} +\end{table} + +\subsection{その他の場合} +本節の内容は表\ref{tab-jfmglue}にまとめてある. + +\paragraph{和文Aと欧文の間} +\textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる. +\begin{itemize} +\item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる. +それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める. +\item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ. +\item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである. +\end{itemize} +\begin{description} +\item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め, +未定義でなければそれを「右空白」として採用する. +\textsf{JFM-origin~[M]}の変種と考えて良い. +これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである. +\begin{enumerate} +\item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ. +\item そうでなければ, +\textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るglue/kernとして定まる. +\end{enumerate} +\item[\Param{xkanjiskip}~{[X]}] +この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように, +\Param{xkanjiskip}の値を以下で定め,それを「右空白」として採用する. +この段階で\verb+\inhibitglue+は効力を持たないのも同じである. +\begin{enumerate} +\item 以下のいずれかの場合は,\Param{xkanjiskip}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する: +\begin{itemize} +\item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである. +\item \textit{Nq}の中身の文字コードについて,「直後への\Param{xkanjiskip}の挿入」が禁止されている +(つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上). +\item \textit{Np}の中身の文字コードについて,「直前への\Param{xkanjiskip}の挿入」が禁止されている +(つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数). +\end{itemize} +\item ユーザ側から見た\Param{xkanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で +なければ,\Param{xkanjiskip}パラメタの値を持つglueを採用する. +\item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ) +で使われているJFMに指定されている\Param{xkanjiskip}の値を用いる. +\end{enumerate} +\end{description} + +\paragraph{欧文と和文Aの間} +\textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである. +\textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ. +\begin{itemize} +\item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる. +それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める. +\item \textit{Nq}が和文でないので,「左空白」は算出されない. +\item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである. +\end{itemize} +\begin{description} +\item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め, +未定義でなければそれを「右空白」として採用する. +\textsf{JFM-origin~[M]}の変種と考えて良い. +これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである. +\begin{enumerate} +\item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ. +\item そうでなければ, +「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るglue/kernとして定まる. +\end{enumerate} +\end{description} + +\paragraph{和文Aと箱・glue・kernの間} +\textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・glue・kernのいずれかであった場合, +両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので, +ペナルティの挿入処理は若干異なったものとなっている. + +\begin{itemize} +\item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる. +それが失敗した場合は,「右空白」は挿入されない. +\item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ. +\item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる. +なお,$\mathit{Np}.\mathit{head}$は無意味であるから, +「$\mathit{Np}.\mathit{head}$に対する\Param{prebreakpenalty}の値」は0とみなされる.言い換えれば, +\[ + a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値}). +\] +\begin{description} +\item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は +(明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため, +ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる. +\item[glue] \textit{Np}がglueの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる. +\item[kern] \textit{Np}がkernであった場合は,両クラスタの間での行分割は +(明示的に両クラスタの間にペナルティがあった場合を除き)許容されない. +ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う. +\end{description} +これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは, +\textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する. +\end{itemize} + +\begin{description} +\item[P-allow~{[PA]}] +\textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に, +それらの各ノードにおいてペナルティ値を$a$だけ増加させる. + +(a)部分にペナルティが存在していない場合, +\LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする. +そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って +「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する: +\begin{itemize} +\item 「右空白」がglueでない(kernか未定義)であるとき. +\item 「左空白」がkernとしてきっちり定義されている時. +\end{itemize} + +\item[P-suppress~{[PS]}] +\textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に, +それらの各ノードにおいてペナルティ値を$a$だけ増加させる. + +(a)部分にペナルティが存在していない場合, +\textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが, +\LuaTeX-ja はそれをわざわざ行分割可能にはしない. +そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する. +\end{description} + +なお,「右空白」はkern,「左空白」は未定義の +\[ + \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}} +\] +のような状況を考える. +このとき,$a$,即ち「あ」の\Param{postbreakpenalty}がいかなる値であっても, +この2クラスタ間は最終的に +\begin{equation} + \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow +\Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}} +\label{eq-gref} +\end{equation} +となり,$a$分のペナルティは挿入されないことに注意して欲しい. +\Param{postbreakpenalty}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では +\eqref{eq-gref}と +\[ + \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow +\Node{penalty}{$a$}\longrightarrow +\Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}} +\] +との間に差異は生じない% +\footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0) +であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}. + +\paragraph{箱・glue・kernと和文Aの間} +\textit{Np}が\textsf{箱}・glue・kernのいずれかで,\textit{Np}が\textsf{和文A}であった場合は, +すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意. +\begin{itemize} +\item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる. +それが失敗した場合は,「右空白」は挿入されない. +\item \textit{Nq}が和文でないので,「左空白」は算出されない. +\item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる. +$\mathit{Nq}.\mathit{tail}$は無意味なので, +\[ + a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値}). +\] +\begin{description} +\item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる. +\item[glue] \textit{Nq}がglueの場合は,\textsf{P-normal~[PN]}を用いる. +\item[kern] \textit{Nq}がkernの場合は,\textsf{P-suppress~[PS]}を用いる. +\end{description} +\end{itemize} + +\paragraph{和文Aと和文Bの違い} +先に述べたように,\textsf{和文B}はhboxの中身の先頭(or 末尾)として出現している +和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは, +\begin{itemize} +\item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白 +\textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない. +「左空白」の算出も行われない.例えば, +\begin{itemize} +\item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合, +\textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら +\Param{kanjiskip}~\textsf{[K]}の挿入を行う. +\item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る. +\end{itemize} +\item \textsf{和文B}と箱・glue・kernが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない. +\item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は +\textsf{P-suppress~[PS]}が用いられる. +\item \textsf{和文B}の文字に対する\Param{prebreakpenalty},~\Param{postbreakpenalty}の値は使われず,0として計算される. +\end{itemize} + + +次が具体例である: +\begin{LTXexample} +あ.\inhibitglue A\\ +\hbox{あ.}A\\ +あ.A +\end{LTXexample} +\begin{itemize} +\item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には +\Param{xkanjiskip}(四分アキ)が入ることに注意. +\item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(hboxの中身の末尾として登場しているから)ので, +そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{xkanjiskip}が入ることとなる. +\item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって, +ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる. +\end{itemize} + +\section{psft} \end{document}