By default, \LuaTeX-ja uses Japanese fonts to typeset Greek and Cyrillic letters,
To change this behavior,
put \verb!\ltjsetparameter{jacharrange={-2,-3}}! in the preamble.
- For the detailed description, see Subsection~\ref{ssec-setrange}.
+ For the detailed description, see Subsection~\ref{ssec:setrange}.
From version~20150906.0, characters which belongs both ISO~8859-1 and JIS~X~0208,
such as \P~and~\S, are now typeset in alphabetic fonts.
\end{lstlisting}
を入れると
上記種類の文字は欧文フォントを用いて組まれるようになる.
- 詳しい説明は\ref{ssec-setrange}節を参照してほしい.
+ 詳しい説明は\ref{ssec:setrange}節を参照してほしい.
また,\P,~\S といったISO~8859-1の上位領域とJIS~X~0208の共通部分の文字は
バージョン20150906.0から標準で欧文扱いとなった.\LaTeXe\ 2017/01/01以降では
%<*en>
\item Characters are classified into following two types.
Note that the classification can be customized by a user
- (see Subsection~\ref{ssec-setrange}).
+ (see Subsection~\ref{ssec:setrange}).
%</en>
%<*ja>
\item 文字は次の2種類に分けられる.この類別は固定されているものではなく,ユーザが後から変更可能である
- (\ref{ssec-setrange}節を参照).
+ (\ref{ssec:setrange}節を参照).
%</ja>
\begin{itemize}
%<*en>
Generally speaking, LuaJIT\TeX\ processes \LuaTeX-ja
about 30\% faster than \LuaTeX, but not always%
\footnote{%
- LuaJIT has the 1\,GB~(or~2\,GB) memory limitation. So typesetting a large source by LuaJIT\TeX\
- may cause an ``out of memory'' error.
+ LuaJIT has several limitations such as 1\,GB~(or~2\,GB) memory limitation.
+ So typesetting a large source by LuaJIT\TeX may cause an ``out of memory'' error,
+ or failure of loading/saving font cache of \Pkg{luaotfload}.
}.
%</en>
%<*ja>
LuaJIT\TeX を用いると\LuaTeX のだいたい1.3倍の速度で動くようであるが,
IPA mj明朝などの大きいフォントを用いた場合には\LuaTeX よりも遅くなることもある
\footnote{%
- LuaJITは1\,GB(あるいは2\,GB)のメモリ制限があることが知られている.そのため,
+ LuaJITã\81¯1\,GBï¼\88ã\81\82ã\82\8bã\81\84ã\81¯2\,GBï¼\89ã\81®ã\83¡ã\83¢ã\83ªå\88¶é\99\90ã\81ªã\81©ï¼\8cã\81\84ã\81\8fã\81¤ã\81\8bã\81®å\88¶é\99\90äº\8bé \85ã\81\8cã\81\82ã\82\8bã\81\93ã\81¨ã\81\8cç\9f¥ã\82\89ã\82\8cã\81¦ã\81\84ã\82\8bï¼\8eã\81\9dã\81®ã\81\9fã\82\81ï¼\8c
大きいソースファイルをLuaJIT\TeX でタイプセットするとLuaの側で``out of memory''エラーが発生してしまう.
本ドキュメントのように,「各ページごとにLuaで使っているメモリ容量をチェックし,
必要なら\texttt{collectgarbage("collect")}でガベージコレクタを実行」すると
状況が多少改善されるかもしれない.
+ また,LuaJIT\TeX でIPA mj明朝などの「大きい」フォントを利用した場合はフォントキャッシュの保存に失敗し,
+ 毎回フォントを読み込まなければならず結果的に時間がかかることがある.
}.
%</ja>
%<en>\subsection{Using in plain \TeX}
%<ja>\subsection{plain \TeX で使う}
-\label{ssec-plain}
+\label{ssec:plain}
%<en>To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
%<ja>\LuaTeX-jaを plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
\begin{itemize}
%<*en>
\item With \texttt{luatexja.cfg}, one can use other fonts
-as ``default'' Japanese fonts (Subsection~\ref{ssec-cfg}).
+as ``default'' Japanese fonts (Subsection~\ref{ssec:cfg}).
%</en>
%<*ja>
\item \texttt{luatexja.cfg} を用いることによって,標準和文フォントを
-IPAexフォントから別のフォントに置き換えることができる.\ref{ssec-cfg}節を参照.
+IPAexフォントから別のフォントに置き換えることができる.\ref{ssec:cfg}節を参照.
%</ja>
%<*en>
%<en>\subsection{Using in \LaTeX}
%<ja>\subsection{\LaTeX で使う}
-\label{ssec-ltx}
+\label{ssec:ltx}
%<*en>
Using in \LaTeXe\ is basically same. To set up the minimal environment
\renewcommand{\kanjifamilydefault}{\gtdefault}
\end{lstlisting}
+%<*ja>
+\item \pLaTeX と同様に,\texttt{mc},~\texttt{gt}両ファミリには「従属欧文」書体が定義されている.
+ これらは\cs{userelfont}を\cs{selectfont}(や,その他の「実際に」
+ フォントを変更する命令)の前で実行することにより使うことができる.
+
+ \pLaTeX では標準の欧文フォントはOT1エンコーディングのComputer Modern Roman (\texttt{cmr})%
+ であったが,2017年以降の\LuaLaTeX ではTUエンコーディングのlatin Modern Roman (\texttt{lmr})%
+ に変更されている.そのため,前段落で述べた「従属欧文」も,Latin Modern Romanに設定している.
+%</ja>
\end{itemize}
Original \Pkg{jsclasses} use \cs{mag}~primitive to set the main document font size.
However, \LuaTeX\ beta-0.87.0~or~later does not support \cs{mag} in PDF~output,
-so \Pkg{ltjsclasses} use different method%
-\footnote{Similar to \texttt{magstyle=xreal} in the \Pkg{BXjscls} classes (by Takayuki Yato).}
-to set the main document font size.
+so \Pkg{ltjsclasses} uses the \texttt{nomag*} option\footnote{Same effect as
+ the \Pkg{BXjscls} classes (by Takayuki Yato) and \Pkg{jsclasses}.
+ However, these classes uses only \TeX\ code, but \Pkg{ltjsclasses} uses Lua code.}
+ by default to set the main font size. If this causes some unexpected behavior, specify
+\texttt{nomag} option in \cs{documentclass}.
%</en>
%<*ja>
しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
\texttt{ltjsarticle.cls},~\texttt{ltjsbook.cls}, \texttt{ltjsreport.cls},~\texttt{ltjskiyou.cls}.}%
がそれぞれ用意されている.
-元々の\Pkg{ltjsclasses}ではフォントサイズを指定するのに\cs{mag}プリミティブが使われていたが,
+元々の\Pkg{jsclasses}では本文のフォントサイズを設定するのに\cs{mag}プリミティブが使われていたが,
\LuaTeX~beta-0.87.0以降ではPDF出力時の\cs{mag}のサポートが廃止された.
-そのため,\Pkg{ltjsclasses}では別の方法
-\footnote{八登崇之氏による\Pkg{BXjscls}クラスにおける\texttt{magstyle=xreal}指定時と類似している.}で
-フォントサイズを指定することにしている.
+そのため,\Pkg{ltjsclasses}では\texttt{nomag*}オプション
+\footnote{\Pkg{jsclasses}や,八登崇之氏による\Pkg{BXjscls}クラスにおける同名のオプションと
+ 同じ.上記クラスは\TeX コードのみで実装しているが,\Pkg{ltjsclasses}ではLuaコードも用いている.}が標準で
+有効になっており,これを使って本文フォントサイズの設定を行っている.
+しかし,この\texttt{nomag*}オプションでは(20180121.0版より前の版において\Pkg{unicode-math}パッケージ使用時に
+起きたように)予想外の意図しない現象に遭遇する危険がある.そのような場合は
+\cs{documentclass}において\texttt{nomag}オプションを指定してほしい.
%</ja>
%<*ja>
%<ja>\section{フォントの変更}
\subsection{plain \TeX~and~\LaTeXe}
-\label{ssec-chgfnt}
+\label{ssec:chgfnt}
\paragraph{plain \TeX}
%<*en>
To change Japanese fonts in plain \TeX, you must use the command
-\cs{jfont}~and~\cs{tfont}. So please see Subsection~\ref{ssec-jfont}.
+\cs{jfont}~and~\cs{tfont}. So please see Subsection~\ref{ssec:jfont}.
%</en>
%<*ja>
plain \TeX で和文フォントを変更するためには,
\pTeX のように \cs{jfont} 命令や \cs{tfont} 命令を直接用いる.
-\ref{ssec-jfont}節を参照.
+\ref{ssec:jfont}節を参照.
%</ja>
\paragraph{\LaTeXe\ (NFSS2)}
alphabetic fonts to \texttt{T1}.
\cs{fontfamily} also changes the current Japanese font family,
the current alphabetic font family, \emph{or both}.
- For the detail, see Subsection~\ref{ssec-nfsspat}.
+ For the detail, see Subsection~\ref{ssec:nfsspat}.
%</en>
%<*ja>
ここで,\verb+\fontencoding{+<encoding>\verb+}+ は,引数により和文側か欧文
\texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を
\texttt{T1}へと変更する.\cs{fontfamily} も引数により和文側,欧文
側,\emph{あるいは両方}のフォントファミリを変更する.詳細は
- \ref{ssec-nfsspat}節を参照すること.
+ \ref{ssec:nfsspat}節を参照すること.
%</ja>
%<*en>
\end{lstlisting}
%<*ja>
仮名書体を使う場合など,複数の和文フォントを組み合わせて使いたい場合は
-\ref{ssec-altfont}節の \cs{ltjdeclarealtfont} と,その\LaTeX 版の\
-\cs{DeclareAlternateKanjiFont}(\ref{ssec-nfsspat}節)を参照せよ.
+\ref{ssec:altfont}節の \cs{ltjdeclarealtfont} と,その\LaTeX 版の\
+\cs{DeclareAlternateKanjiFont}(\ref{ssec:nfsspat}節)を参照せよ.
%</ja>
\end{itemize}
%<*en>
We also believe that using Japanese characters as identifiers is rare,
hence we don't describe how to change Japanese fonts in math mode in
-this chapter. For the method, please see Subsection~\ref{ssec-math}.
+this chapter. For the method, please see Subsection~\ref{ssec:math}.
%</en>
%<*ja>
また\LuaTeX-jaプロジェクトでは,和文文字が識別子として用いられることはほとんどない
と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
-記述しない.この方法については\ref{ssec-math}節を参照のこと.
+記述しない.この方法については\ref{ssec:math}節を参照のこと.
%</ja>
%<en>\subsection{\Pkg{luatexja-fontspec} package}
%<ja>\subsection{\Pkg{luatexja-fontspec}パッケージ}
-\label{ssec-fontspec}
+\label{ssec:fontspec}
%<*en>
To use the functionality of the \Pkg{fontspec} package to Japanese fonts,
it is needed to load the \Pkg{luatexja-fontspec} package in the preamble, as follows:
\item[scale=<float>]
%<*en>
Override the ratio of the font size of Japanese fonts to that of alphabetic fonts.
-The default value is calculated automatically (for~example, about~0.924865 when
- the \Pkg{ltjsarticle} class is used).
+The default value is determined as follows:
+ \begin{itemize}
+ \item The value of \cs{Cjascale} is used, if this control sequence is already defined.
+ \item It is calculated automatically from the current Japanese font at the loading of the
+ package, if \cs{Cjascale} is not defined.
+ \end{itemize}
+\cs{Cjascale} is defined in \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
%</en>
%<*ja>
-欧文に対する和文の比率は,標準では \Pkg{luatexja-fontspec}読み込み時の和欧文比率から
-自動計算される(例えば,\Pkg{ltjsarticle}クラス使用時には和文は欧文の約0.924865倍となる)が,
-それを手動で上書きするときに使用する.
+欧文に対する和文の比率を手動で上書きするときに使用する.
+標準では
+\begin{itemize}
+ \item \cs{Cjascale}が定義されている場合
+ \footnote{\LuaTeX-ja が用意しているクラスファイル(\Pkg{ltjclasses},~\Pkg{ltjsclasses})を
+ 使う場合はこちらに当てはまる.}は,それを用いる.
+ \item \cs{Cjascale}が未定義の場合は,\Pkg{luatexja-fontspec}読み込み時の和文フォントから自動計算される.
+\end{itemize}
%</ja>
\end{cslist}
これら3オプションについては,
\Pkg{luatexja-preset} パッケージにプリセットを使う時に一緒に指定するか,
-あるいは対応する内容を\ref{ssec-chgfnt}節,\ref{ssec-nfsspat}節 (NFSS2) や
-\ref{ssec-fontspec}節 (\Pkg{fontspec}) の方法で手動で指定する必要がある.
+あるいは対応する内容を\ref{ssec:chgfnt}節,\ref{ssec:nfsspat}節 (NFSS2) や
+\ref{ssec:fontspec}節 (\Pkg{fontspec}) の方法で手動で指定する必要がある.
%</ja>
%<en>\subsection{Changing default Japanese fonts}
%<ja>\subsection{標準和文フォントの変更}
-\label{ssec-cfg}
+\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,
%<en>\subsection{Range of \textbf{JAchar}s}
%<ja>\subsection{\textbf{JAchar}の範囲}
-\label{ssec-setrange}
+\label{ssec:setrange}
%<*en>
\LuaTeX-ja divides the Unicode codespace \texttt{U+0080}--\texttt{U+10FFFF}
\ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
\end{lstlisting}
%<*en>
-One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}).
+One can use also numbers to specify these two parameters (see Subsection~\ref{ssec:param}).
%</en>
%<*ja>
-また,これら2パラメータには数値で値を指定することもできる(\ref{ssec-param}節を参照).
+また,これら2パラメータには数値で値を指定することもできる(\ref{ssec:param}節を参照).
%</ja>
%<*en>
``ア'', not 20.
%</en>
%<*ja>
-\newpage
\subsection{禁則処理関連パラメータとOpenTypeのfont feature}
禁則処理や \Param{kanjiskip}, \Param{xkanjiskip} の挿入に関連したパラメータのうち
\begin{quote}
\end{quote}
は,文字コードごとに設定する量である.
-\Pkg{fontspec}パッケージを使う(\ref{ssec-fontspec}節)場合など,
+\Pkg{fontspec}パッケージを使う(\ref{ssec:fontspec}節)場合など,
各種のOpenType featureを適用することもあると思うが,前段落に述べたパラメータ類は,
\emph{OpenType featureの適用前の文字コードによって適用される.}
例えば,以下の例において10行目の「ア」は,\verb+hwid+ featureの適用により半角カタカナの「ア」
\begin{itemize}
\item
\emph{Distinction between \textbf{JAchar} or \textbf{ALchar}}
-is controlled by the character range, see Subsection~\ref{ssec-setrange}.
+is controlled by the character range, see Subsection~\ref{ssec:setrange}.
\item
\emph{Whether the character can be used in a control word}
is controlled by setting \cs{catcode} to 11~(enabled) or 12~(disabled), as usual.
分割している:
\begin{description}
\item[欧文/和文の区別 (\upTeX)]
-\cs{ltjdefcharrange} と\textsf{jacharrange}パラメータ(\ref{ssec-setrange}節)
+\cs{ltjdefcharrange} と\textsf{jacharrange}パラメータ(\ref{ssec:setrange}節)
\item[制御綴中に使用可か]
\LuaTeX 自身の \cs{catcode} でよい
\item[\Param{jcharwidowpenalty}が挿入可か]
The fifth column (\emph{utod} direction) corresponds the ``\texttt{tate (math) direction}'' of \pTeX.
Directions can be changed by \cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod},
-only when the current list is null. Also, the direction of a math formula is changed to
+only when the current list is null.
+These commands cannot be executed in unrestricted horizontal modes, nor math modes.
+The direction of a math formula is changed to
\emph{utod}, when the direction outside the math formula is \emph{tate} (vertical writing).
%</en>
組方向は,\cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod} をそれぞれ使用することで,
現在作成中のリストやボックスが空の時にのみ変更可能である.
+ただし,現在のモードが非制限水平モードや(文中,別行立て問わず)数式モードであるときには
+組方向を変更することは出来ない.
また,縦組中の数式内のボックスは\pTeX と同じように組方向が \cs{utod} となる.
%</ja>
%<ja>\section{フォントメトリックと和文フォント}
%<en>\subsection{\cs{jfont}}
%<ja>\subsection{\cs{jfont} 命令}
-\label{ssec-jfont}
+\label{ssec:jfont}
%<*en>
To load a font as a Japanese font (for horizontal direction), you must use the
\autoref{fig:kern-jfm}を参照.
\begin{itemize}
\item \emph{\cs{jfont} や,
-NFSS2用の命令(\ref{ssec-chgfnt}節,\ref{ssec-nfsspat}節)における指定では
+NFSS2用の命令(\ref{ssec:chgfnt}節,\ref{ssec:nfsspat}節)における指定では
カーニング情報は標準で使用する}ことになっているようである.
言い換えれば,カーニング情報を使用しない設定にするには,面倒でも
\begin{lstlisting}
This command admits the same syntax used in \cs{font}~and~\cs{jfont}.
A font defined by~\cs{tfont} differs the following points from that by~\cs{jfont}:
\begin{itemize}
- \item Both \texttt{vert}~and~\texttt{vrt2} Opentype features are activated,
- unless they are explicitly activated or deactivated (as the third line in the example below).
+ \item OpenType Feature~\texttt{vrt2}%
+ \footnote{If the font does not define \texttt{vrt2} feature,
+ use \texttt{vert} instead.} is automatically activated,
+ unless \texttt{vert}~and//or~\texttt{vrt2} are explicitly activated
+ or deactivated (as the second line in the example below).
\begin{lstlisting}
-\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv
- % vert and vrt2 are automatically activated
+\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv % vrt2 is automatically activated
\tfont\T=file:KozMinPr6N-Regular.otf:jfm=ujisv;-vert % vert and vrt2 are not activated
+\tfont\U=file:ipaexm.ttf:jfm=ujisv
+ % vert is automatically activated, since this font does not have vrt2
\end{lstlisting}
- \item ...
+ \item Sometimes \texttt{vert} and/or \texttt{vrt2} are not activated
+ while one specified activation of these feature.
+ This is because the font does not define these features in current combination of
+ script~tag and language~system~identifier.
+
+ In this situation, \LuaTeX-ja performs all replacements which is defined in~\texttt{vert}
+ feature for \emph{some} scripts for \emph{some} languages.
+ \item Furthermore, a glyph is automatically rotated 90~degrees,
+ if it is not replaced by \texttt{vert} feature for \emph{any} script
+ for \emph{any} language, and if it is marked as `r''~or~``Tr'' in UAX~\#50.
\item One have to specify the name of vertical JFM in \texttt{jfm=<name>}.
\LuaTeX-ja ships following vertical JFMs:
\begin{description}
\cs{tfont} で定義された縦組用和文フォントは,
以下の点が \cs{jfont} による横組用和文フォントとは異なる:
\begin{itemize}
- \item 自動的に \texttt{vert}, \texttt{vrt2} の両OpenType featureが有効化される.
-但し,以下の例の3行目に示すように,明示的に \texttt{vert}, \texttt{vrt2}(のいずれか)の
-有効・無効を指定した場合は別である.
+ \item 明示的に \texttt{vert}, \texttt{vrt2}(のいずれか)の
+ 有効・無効を指定した場合を除き,自動的に OpenType feature~\texttt{vrt2} の有効化が
+ 指定されたものとみなされる
+ \footnote{もしフォントが\texttt{vrt2}を定義していなかった場合,代わりに
+ \texttt{vert}を用いる.}.
\begin{lstlisting}
-\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv
- % vert and vrt2 are automatically activated
+\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv % vrt2 is automatically activated
\tfont\T=file:KozMinPr6N-Regular.otf:jfm=ujisv;-vert % vert and vrt2 are not activated
+\tfont\U=file:ipaexm.ttf:jfm=ujisv
+ % vert is automatically activated, since this font does not have vrt2
\end{lstlisting}
- \item \ref{ssec-math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない.
+ \item \texttt{vert}, \texttt{vrt2} の少なくとも一つの有効を指定した場合にも関わらず,
+ script tagとlanguage system identifierの値の組み合わせによって
+ 実際には有効にならなかった場合,\LuaTeX-jaは
+ \begin{quote}
+ どれかのscript,~languageで定義されている\texttt{vert}による
+ (単一グリフから単一グリフへの)置換を全部適用する
+ \end{quote}
+ という挙動を取る\footnote{%
+ 例えば,Windows~7に付属しているSimHeiでは,\texttt{vert}はScriptが\texttt{hani},
+ Languageが\texttt{CHN}という状況でのみ定義されている.しかし,\Pkg{luaotfload}では
+ このscript,~languageの組み合わせを指定することはできないので,
+ \Pkg{luaotfload}そのままでは\texttt{vert}を適用させることはできない.
+ }.
+ \item さらに,「いかなるscript,~languageでも\texttt{vert}により置換されない」グリフ
+ のうち,UAX~\#50で``r''もしくは``Tr''と指定されているものは90度自動回転させる.
+ \item \ref{ssec:math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない.
\item \texttt{jfm=<name>}\ の部分には縦組用JFMを指定する.
以下の縦組用JFMが\LuaTeX-jaには同梱されている.%おり,違いを\autoref{tab-difjfm-tate}に示した.
\begin{description}
%<en>\subsection{Prefix \texttt{psft}}
%<ja>\subsection{\texttt{psft}プリフィックス}
-\label{ssec-psft}
+\label{ssec:psft}
%<*en>
Besides ``\texttt{file:}''\ and ``\texttt{name:}''\ prefixes which
are introduced in the \Pkg{luaotfload} package,
%<en>\subsection{Structure of a JFM file}
%<ja>\subsection{JFMファイルの構造}
-\label{ssec-jfm-str}
+\label{ssec:jfm-str}
%<en>A JFM file is a Lua script which has only one function call:
%<ja>JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである:
\begin{lstlisting}
\begin{cslist}[style=standard]
\item[priority=<priority>]
\Pkg{luatexja-adjust}による優先順位付き
- 行長調整(\ref{ssec-adj}節)において,このグルーの優先度を指定する.許される値は以下の通り:
+ 行長調整(\ref{ssec:adj}節)において,このグルーの優先度を指定する.許される値は以下の通り:
\begin{description}
\item[バージョン1] $-4$から$+3$の間の整数
\item[バージョン2以降] $-4$から$+3$の間の整数の2つ組\texttt{\{<stretch>, <shrink>\}}か,
a pair of these integers \texttt{\{<stretch>, <shrink>\}} (version 2~or~later).
This is
used only in line adjustment with priority by \Pkg{luatexja-adjust}
-(see Subsection~\ref{ssec-adj}). Higher value means the glue is easy to stretch,
+(see Subsection~\ref{ssec:adj}). Higher value means the glue is easy to stretch,
and is also easy to shrink.
\item[kanjiskip\_natural=<num>\textrm{, }%
kanjiskip\_stretch=<num>\textrm{, }kanjiskip\_shrink=<num>]\leavevmode
優先順位付き行長調整が有効であり,かつ現在の文字クラスの文字が
行末に来た時に,この文字と行末の間には指定された値のいずれかの大きさのカーンが
- 挿入される(\autoref{ssec-adj}参照).
+ 挿入される(\autoref{ssec:adj}参照).
バージョン1における
\begin{lstlisting}[escapechar=\$]
%<en>\subsection{Math font family}
%<ja>\subsection{数式フォントファミリ}
-\label{ssec-math}
+\label{ssec:math}
%<*en>
\TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
%<en>\section{Parameters}
%<ja>\section{パラメータ}
\subsection{\cs{ltjsetparameter}}
-\label{ssec-param}
+\label{ssec:param}
%<*en>
As described before, \cs{ltjsetparameter} and \cs{ltjgetparameter} are
Changing current Japanese font does not alter this parameter, as \pTeX.
If the natural width of this parameter is \cs{maxdimen}, \LuaTeX-ja uses
-the value which is specified in the JFM for current Japanese font (See Subsection~\ref{ssec-jfm-str}).
+the value which is specified in the JFM for current Japanese font (See Subsection~\ref{ssec:jfm-str}).
%</en>
\item[\DParam{xkanjiskip}\,=<skip>$^\ast$] [\cs{xkanjiskip}]\
Changing current font does not alter this parameter, as \pTeX.
As \Param{kanjiskip}, if the natural width of this parameter is \cs{maxdimen}, \LuaTeX-ja uses
-the value which is specified in the JFM for current Japanese font (See Subsection~\ref{ssec-jfm-str}).
+the value which is specified in the JFM for current Japanese font (See Subsection~\ref{ssec:jfm-str}).
%</en>
%</en>
%<*ja>
デフォルト値は \texttt{paverage} である.
-各々の値による差異の詳細は\ref{ssec-cluster-wa}節の「『右空白』の算出」を参照してほしい.
+各々の値による差異の詳細は\ref{ssec:cluster-wa}節の「『右空白』の算出」を参照してほしい.
%</ja>
\item[\DParam{jacharrange}\,=<ranges>]
\subsection{\cs{ltjgetparameter}}
-\label{ssec-getpar}
+\label{ssec:getpar}
%<*en>
\cs{ltjgetparameter} is a control sequence for acquiring parameters. It
always takes a parameter name as first argument.
\end{itemize}
+
+%<*en>
+\subsection{Alternative Commands to \cs{ltjsetparameter}}
+The basic method to set parameters of \LuaTeX-ja is to use
+\cs{ltjsetparameter}~or~\cs{ltjglobalsetparameter}.
+However, these commands are slow, because they parse a key-value list,
+so several alternative commands are used in \LuaTeX-ja.
+\emph{This subsection is not for general \LuaTeX-ja users.}
+
+\paragraph{Setting \Param{kanjiskip}~or~\Param{xkanjiskip}}
+In \Pkg{ltjsclasses}, every size-changing command such as \cs{Large}
+changes \cs{kanjiskip}~and~\cs{xkanjiskip}.
+But a simple implementation, as the code below, is slow since
+two key-value lists are parsed by \cs{ltjsetparameter}:
+\begin{lstlisting}
+ \ltjsetparameter{kanjiskip=0\zw plus .1\zw minus .01\zw}
+ \@tempskipa=\ltjgetparameter{xkanjiskip}
+ \ifdim\@tempskipa>\z@
+ \if@slide
+ \ltjsetparameter{xkanjiskip=0.1em}
+ \else
+ \ltjsetparameter{xkanjiskip=0.25em plus 0.15em minus 0.06em}
+ \fi
+ \fi
+\end{lstlisting}
+
+Hence, \LuaTeX-ja defines more primitive commands, namely \cs{ltj@setpar@global},
+\cs{ltjsetkanjiskip}, and~\cs{ltjsetxkanjiskip}. Here
+\begin{quote}
+ \lstinline+\ltj@setpar@global\ltjsetkanjiskip 10pt+
+\end{quote}
+and \lstinline+\ltjsetparameter{kanjiskip=10pt}+ has the same effect.
+The actual code of \Pkg{ltjsclasses} is shown below:
+\begin{lstlisting}
+ \ltj@setpar@global
+ \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw}
+ \@tempskipa=\ltjgetparameter{xkanjiskip}
+ \ifdim\@tempskipa>\z@
+ \if@slide
+ \ltjsetxkanjiskip.1em
+ \else
+ \ltjsetxkanjiskip.25em plus .15em minus .06em
+ \fi
+ \fi
+\end{lstlisting}
+
+Note that using \cs{ltjsetkanjiskip}~or~\cs{ltjsetxkanjiskip} alone,
+that is, without executing \cs{ltj@setpar@global} in advance, is \emph{not} supported.
+%</en>
+
%<*ja>
\subsection{\cs{ltjsetparameter} の代替}
原則として各種内部パラメータの設定には \cs{ltjsetparameter} もしくは
\LuaTeX-ja の内部ではより高速に実行できる別の形式を用いている.
\emph{本節は一般利用者むけの内容ではない.}
-\paragraph{\Param{kanjiskip}, \Param{xkanjiskip} の設定}
+\paragraph{\Param{kanjiskip}, \Param{xkanjiskip}の設定}
\pLaTeXe 新ドキュメントクラスでは,
\begin{lstlisting}
\def\@setfontsize#1#2#3{%
\subsection{\cs{ltjdeclarealtfont}}
-\label{ssec-altfont}
+\label{ssec:altfont}
%<*en>
Using \cs{ltjdeclarealtfont}, one can ``compose'' more than one Japanese fonts.
This \cs{ltjdeclarealtfont} uses in the following form:
\subsection{\cs{ltjalchar} と \cs{ltjjachar}}
文字コードが$\text{<chr\_code>}~(\geq 128=\mathtt{0x80})$の文字を
\ \cs{char} プリミティブを使い \cs{char}<chr\_code> として出力させると,
-その文字の属する文字範囲(\ref{ssec-setrange}節参照)によって
+その文字の属する文字範囲(\ref{ssec:setrange}節参照)によって
\textbf{ALchar}か\textbf{JAchar}か,つまり欧文フォントで出力されるか和文フォントで出力され
るかが決まる.
<chr\_code>が127以下の場合は,\cs{ltjjachar} であっても\textbf{ALchar}として出力されること
に注意.
-以下は\ref{ssec-setrange}節に載せた例に,\cs{char} の動作を追加したものである.
+以下は\ref{ssec:setrange}節に載せた例に,\cs{char} の動作を追加したものである.
\begin{LTXexample}[width=0.25\textwidth]
\gtfamily\large % default, ALchar, JAchar
¶, \char`¶, \ltjalchar`¶, \ltjjachar`¶\\ % default: ALchar
%<en>\subsection{Patch for NFSS2}
%<ja>\subsection{NFSS2へのパッチ}
-\label{ssec-nfsspat}
+\label{ssec:nfsspat}
%<*en>
Japanese patch for NFSS2 in \LuaTeX-ja
is based on \texttt{plfonts.dtx} which plays the same role in \pLaTeXe.
We will describe
-commands which are not described in Subsection~\ref{ssec-chgfnt}.
+commands which are not described in Subsection~\ref{ssec:chgfnt}.
%</en>
%<*ja>
\LuaTeX-jaのNFSS2への日本語パッチは
\pLaTeXe で同様の役割を果たす \texttt{plfonts.dtx} をベースに,
和文エンコーディングの管理等をLuaで書きなおしたものである.
-ここでは\ref{ssec-chgfnt}節で述べていなかった命令について
+ここでは\ref{ssec:chgfnt}節で述べていなかった命令について
記述しておく.
%</ja>
\item[\cs{userelfont}]
%<*en>
-Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
- font family with respect to current Japanese font family,
- which was set by
- \cs{DeclareRelationFont} or \cs{SetRelationFont}.
-Like \cs{fontfamily}, \cs{selectfont} is required to take an effect.
+(Only)~at the next call of \cs{selectfont},
+ change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
+ font family with respect to current Japanese font family,
+ which was set by
+ \cs{DeclareRelationFont} or \cs{SetRelationFont}.
%</en>
%<*ja>
-現在の欧文フォントのエンコーディング/ファミリ/…… を,
+次回(のみ)の\cs{selectfont}の実行時に,現在の欧文フォントのエンコーディング/ファミリ/…… を,
\cs{DeclareRelationFont} か \cs{SetRelationFont} で指定された
現在の和文フォントに対応する「従属欧文」フォントに変更する.
-\cs{fontfamily} のように,有効にするためには \cs{selectfont} が必要である.
%</ja>
\item[\cs{adjustbaseline}]
\item[\cs{fontfamily}\{<family>\}]
%<*en>
As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
-to <family>. See Subsection~\ref{ssec-fontfamilycmd} for detail.
+to <family>. See Subsection~\ref{ssec:fontfamilycmd} for detail.
%</en>
%<*ja>
元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
-和文,\emph{もしくは両方})を<family>に変更する.詳細は\ref{ssec-fontfamilycmd}節を参照すること.
+和文,\emph{もしくは両方})を<family>に変更する.詳細は\ref{ssec:fontfamilycmd}節を参照すること.
%</ja>
\item[\cs{DeclareAlternateKanjiFont}\{<base-encoding>\}\{<base-family>\}\{<base-series>\}\{<base-shape>\}\\
\null\hfill\{<alt-encoding>\}\{<alt-family>\}\{<alt-series>\}\{<alt-shape>\}\{<range>\}]
%<*ja>
-\ref{ssec-altfont}節の\
+\ref{ssec:altfont}節の\
\cs{ltjdeclarealtfont} と同様に,前半の4引数の
和文フォント(基底フォント)のうち<range>中の文字を
第5から第8引数の和文フォントを使って組むように指示する.
\end{itemize}%
%</ja>
%<*en>
-As \cs{ltjdeclarealtfont}~(Subsection~\ref{ssec-altfont}),
+As \cs{ltjdeclarealtfont}~(Subsection~\ref{ssec:altfont}),
characters in <range> of the Japanese font (we say the \emph{base font})
which specified by first 4 arguments are typeset
by the Japanese font which specified by fifth to eighth arguments
%<en>\subsection{Detail of \cs{fontfamily} command}
%<ja>\subsection{\cs{fontfamily}コマンドの詳細}
-\label{ssec-fontfamilycmd}
+\label{ssec:fontfamilycmd}
%<*en>
In this subsection, we describe when \cs{fontfamily}<family> changes current
Japanese/alphabetic font family. Basically, current Japanese fotn family is changed to
\cs{input} で読み込み可能である.
%</ja>
\subsection{\Pkg{luatexja-fontspec}}
-\label{ssec-fontspec2}
+\label{ssec:fontspec2}
%<*en>
-As described in Subsection~\ref{ssec-fontspec}, this optional package
+As described in Subsection~\ref{ssec:fontspec}, this optional package
provides the counterparts for several commands defined in the
\Pkg{fontspec} package (requires \Pkg{fontspec}~v2.4).
In addition to OpenType font features in the original \Pkg{fontspec},
the commands of Japanese version:
%</en>
%<*ja>
-\ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}%
+\ref{ssec:fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}%
パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
\Pkg{fontspec}パッケージで指定可能な各種OpenType機能に加えて,和文版のコマンドには
%<*en>
These 3 keys correspond to \texttt{cid}, \texttt{jfm} and
\texttt{jfmvar} keys for \cs{jfont}~and~\cs{tfont} respectively.
-See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details
+See Subsections~\ref{ssec:jfont} and \ref{ssec:psft} for details
of \texttt{cid}, \texttt{jfm} and
\texttt{jfmvar} keys.
%<*ja>
これら3つのキーはそれぞれ \cs{jfont},~\cs{tfont}に対する
\texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
-\texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーの詳細は\ref{ssec-jfont}節
- と\ref{ssec-psft}節を参照.
+\texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーの詳細は\ref{ssec:jfont}節
+ と\ref{ssec:psft}節を参照.
\texttt{CID} キーは下の \texttt{NoEmbed} と合わせて用いられたときのみ有効である.
また,横組用JFMと縦組用JFMは共用できないため,実際に \texttt{JFM} キーを用いる際は
\item[NoEmbed]
%<*en>
By specifying this key, one can use ``name-only'' Japanese font which
-will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
+will not be embedded in the output PDF file. See Subsection~\ref{ssec:psft}.
%</en>
%<*ja>
これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
-できる.\ref{ssec-psft}節を参照.
+できる.\ref{ssec:psft}節を参照.
%</ja>
\begin{figure}[!tb]
\item[AltFont]
%<*en>
-As \cs{ltjdeclarealtfont}~(Subsection~\ref{ssec-altfont}) and
-\cs{DeclareAlternateKanjiFont}~(Subsection~\ref{ssec-nfsspat}),
+As \cs{ltjdeclarealtfont}~(Subsection~\ref{ssec:altfont}) and
+\cs{DeclareAlternateKanjiFont}~(Subsection~\ref{ssec:nfsspat}),
with this key, one can typeset some Japanese characters
by a different font and/or using different features.
The \texttt{AltFont} feature takes a comma-separated list of comma-separated lists,
as the following:
%</en>
%<*ja>
-\ref{ssec-altfont}節の \cs{ltjdeclarealtfont} や,
-\ref{ssec-nfsspat}節の \cs{DeclareAlternateKanjiFont} と同様に,
+\ref{ssec:altfont}節の \cs{ltjdeclarealtfont} や,
+\ref{ssec:nfsspat}節の \cs{DeclareAlternateKanjiFont} と同様に,
このキーを用いると一部の文字を異なったフォントや機能たちを使って組むことができる.
\texttt{AltFont} キーに指定する値は,次のように二重のコンマ区切りリストである:
%</ja>
\subsection{\Pkg{luatexja-otf}}
-\label{ssec-ltjotf}
+\label{ssec:ltjotf}
%<*en>
This optional package supports typesetting glyphs
by specifying a CID number.
%</ja>
\subsection{\Pkg{luatexja-adjust}}
-\label{ssec-adj}
+\label{ssec:adj}
\begin{figure}[t]
\def\sq{%
\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%