OSDN Git Service

de3b14f00b37e8c512dfc80de30321026bd4a149
[luatex-ja/luatexja.git] / doc / manual.dtx
1 %#! lualatex -shell-escape manual.ins
2
3 %<en>\documentclass[a4paper,titlepage]{article}
4 %<ja>\documentclass[a4paper,titlepage]{ltjsarticle}
5 \usepackage[margin=20mm,footskip=5mm]{geometry}
6
7 \usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float}
8 \usepackage{booktabs,listings,showexpl,multicol}
9 \usepackage{luatexja-otf}
10 \usepackage{luatexja-fontspec}
11 \usepackage[unicode]{hyperref}
12 \usepackage[all]{xy}
13 \SelectTips{cm}{}
14
15 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
16 \DeclareRobustCommand\LuaTeX{Lua\TeX}
17 \DeclareRobustCommand\pdfTeX{pdf\TeX}
18 \DeclareRobustCommand\pTeX{p\kern-.05em\TeX}
19 \DeclareRobustCommand\upTeX{up\kern-.05em\TeX}
20 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
21 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
22 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
23
24 \ltjsetparameter{jacharrange={-3}}
25 \theoremstyle{definition}
26 %<en>\newtheorem{defn}{Definition}
27 %<ja>\newtheorem{defn}{定義}
28
29 \newenvironment{cslist}{%
30   \leftskip2em\parindent=0pt\def\makelabel##1{{\tt\char92##1}}
31   \def\{{\char`\{}\def\}{\char`\}}
32   \let\origitem=\item
33   \def\item[##1]{\par\smallskip\par\hskip-\leftskip\makelabel{##1}\par}
34 }{}
35
36 \makeatletter
37 \long\def\@makecaption#1#2{%
38   \vskip\abovecaptionskip
39   \sbox\@tempboxa{{\small #1. #2}}%
40   \ifdim \wd\@tempboxa >\hsize
41     {\small #1. #2}\par
42   \else
43     \global \@minipagefalse
44     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
45   \fi
46   \vskip\belowcaptionskip}
47 % Suppress output from showexpl to stdout.
48 \let\SX@Info\relax
49 \makeatother
50
51 %<*en>
52 \title{The \LuaTeX-ja package}
53 \author{The \LuaTeX-ja project team}
54 %</en>
55 %<*ja>
56 \title{\LuaTeX-jaパッケージ}
57 \author{\LuaTeX-jaプロジェクトチーム}
58 %</ja>
59
60 \lstset{
61   basicstyle=\ttfamily\small, pos=o, breaklines=true,
62   numbers=none, rframe={}, basewidth=0.5em
63 }
64
65 \parskip=\smallskipamount
66 \protected\def\Param#1{\textsf{#1}} % parameter name
67 \protected\def\Pkg#1{\underline{\smash{\texttt{#1}}}} % packages/classes
68
69 \begin{document}
70 \catcode`\<=13
71 \def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
72 \maketitle
73
74 \tableofcontents
75 \bigskip
76
77 %<*en>
78 \textbf{This documentation is far from complete. It may have many
79 grammatical (and contextual) errors.}
80 %</en>
81 %<*ja>
82 \textbf{\large 本ドキュメントはまだまだ未完成です.}
83 %</ja>
84
85 \clearpage
86 %<en>\part{User's manual}
87 %<ja>\part{ユーザーズマニュアル}
88
89 %<en>\section{Introduction}
90 %<ja>\section{はじめに}
91
92 %<*en>
93 The \LuaTeX-ja package is a macro package for typesetting high-quality
94 Japanese documents when using \LuaTeX.
95 %</en>
96 %<*ja>
97 \LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
98 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
99 %</ja>
100
101 %<en>\subsection{Backgrounds}
102 %<ja>\subsection{背景}
103
104 %<*en>
105 Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
106 are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
107 extension of \TeX: so it can produce high-quality Japanese documents
108 without using very complicated macros. But this point is a mixed
109 blessing: \pTeX\ is left behind from other extensions of \TeX,
110 especially \eTeX\ and \pdfTeX, and from changes about
111 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
112 %</en>
113 %<*ja>
114 従来,「\TeX を用いて日本語組版を行う」といったとき,エンジンとしては
115 ASCII \pTeX やそれの拡張物が用いられることが一般的であった.\pTeX は\TeX
116 のエンジン拡張であり,(少々仕様上不便な点はあるものの)商業印刷の分野に
117 も用いられるほどの高品質な日本語組版を可能としている.だが,それは弱点に
118 もなってしまった:\pTeX という(組版的に)満足なものがあったため,海外で
119 行われている数々の\TeX の拡張──例えば\eTeX や\pdfTeX ──や,TrueType,
120 OpenType, Unicodeといった計算機で日本語を扱う際の状況の変化に追従すること
121 を怠ってしまったのだ.
122 %</ja>
123
124 %<*en>
125 Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
126 of \pTeX) and \epTeX\ (merging of \pTeX\ and
127 \eTeX\ extension), have developed to fill those gaps to some
128 extent, but gaps still exist.
129 %</en>
130 %<*ja>
131 ここ数年,若干状況は改善されてきた.現在手に入る大半の\pTeX バイナリでは
132 外部UTF-8入力が利用可能となり,さらにUnicode化を推進し,\pTeX の内部処理
133 までUnicode化した\upTeX も開発されている.また,\pTeX に\eTeX 拡張をマー
134 ジした\epTeX も登場し,\TeX\ Live\ 2011では\pLaTeX が\epTeX の上で動作す
135 るようになった.だが,\pdfTeX 拡張(PDF 直接出力やmicro-typesetting)を
136 \pTeX に対応させようという動きはなく,海外とのgapは未だにあるのが現状であ
137 る.
138 %</ja>
139
140 %<*en>
141 However, the appearance of \LuaTeX\ changed the whole situation. With
142 using Lua `callbacks', users can customize the internal processing of
143 \LuaTeX. So there is no need to modify sources of engines to
144 support Japanese typesetting: to do this, we only have to write Lua
145 scripts for appropriate callbacks.
146 %</en>
147 %<*ja>
148 しかし,\LuaTeX の登場で,状況は大きく変わることになった.Luaコードで
149 `callback'を書くことにより,\LuaTeX の内部処理に割り込みをかけることが可
150 能となった.これは,エンジン拡張という真似をしなくても,Luaコードとそれに
151 関する\TeX マクロを書けば,エンジン拡張とほぼ同程度のことができるようになっ
152 たということを意味する.\LuaTeX-jaは,このアプローチによってLuaコード・
153 \TeX マクロによって日本語組版を\LuaTeX の上で実現させようという目的で開発
154 が始まったパッケージである.
155 %</ja>
156
157 %<en>\subsection{Major Changes from \pTeX}
158 %<ja>\subsection{\pTeX からの主な変更点}
159
160 %<*en>
161 The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
162 target of development was to implement features of \pTeX. However,
163 \emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
164 specifications/behaviors of \pTeX\ were not adopted}.
165 %</en>
166 %<*ja>
167 \LuaTeX-jaは,\pTeX に多大な影響を受けている.初期の開発目標は,\pTeX の機
168 能をLuaコードにより実装することであった.しかし,開発が進むにつれ,\pTeX
169 の完全な移植は不可能であり,また\pTeX における実装がいささか不可解になっ
170 ているような状況も発見された.そのため,\textbf{\LuaTeX-ja は,もはや
171 \pTeX の完全な移植は目標とはしない.\pTeX における不自然な仕様・挙動があ
172 れば,そこは積極的に改める.}
173 %</ja>
174
175 %<*en>
176 The followings are major changes from \pTeX:
177 %</en>
178 %<*ja>
179 以下は \pTeX からの主な変更点である.
180 %</ja>
181
182 \begin{itemize}
183 %<*en>
184 \item A Japanese font is a tuple of a `real' font, a Japanese font
185       metric (\textbf{JFM}, for short), and an optional string called
186       `variation'.
187 %</en>
188 %<*ja>
189 \item 和文フォントは「実際の」フォント,和文フォントメトリック(JFM と呼ぶ),そ
190       して `variation' と呼ばれる文字列の組である.
191 %</ja>
192
193 %<*en>
194 \item In \pTeX, a line break after Japanese character is ignored (and
195       doesn't yield a space), since line breaks (in source files) are
196       permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
197       doesn't have this function completely, because of a specification
198       of \LuaTeX.
199 %</en>
200 %<*ja>
201 \item 日本語の文書中では改行はほとんどどこでも許されるので,\pTeX では和文文字
202       直後の改行は無視される(スペースが入らない)ようになっていた.しかし,
203       \LuaTeX-ja では \LuaTeX の仕様のためにこの機能は完全には実装されていない.
204 %</ja>
205
206 %<*en>
207 \item The insertion process of glues/kerns between two Japanese
208       characters and between a Japanese character and other characters
209       (we refer these glues/kerns as \textbf{JAglue}) is rewritten from
210       scratch.
211 %</en>
212 %<*ja>
213 \item 2つの和文文字の間,和文文字と欧文文字の間に入るグルー/カーン
214       (\textbf{JAglue} と呼ぶ)の挿入処理が0から書き直されている.
215 %</ja>
216
217 \begin{itemize}
218 %<*en>
219 \item As \LuaTeX's internal character handling is `node-based'
220       (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
221       insertion process of \textbf{JAglue} is now `node-based'.
222 %</en>
223 %<*ja>
224 \item \LuaTeX の内部での文字の扱いが「ノードベース」になっているように(例えば,
225       \verb+of{}fice+ で合字は抑制されない),\textbf{JAglue} の挿入処理も
226       「ノードベース」である.
227 %</ja>
228
229 %<*en>
230 \item Furthermore, nodes between two characters which have no effects in
231       line break (\textit{e.g.}, \verb+\special+ node) and kerns from
232       italic correction are ignored in the insertion process.
233 %</en>
234 %<*ja>
235 \item さらに,2つの文字の間にある行末では効果を持たないノード(例えば
236       \verb+\special+ ノード)や,イタリック補正に伴い挿入されるカーンは
237       挿入処理中では無視される.
238 %</ja>
239
240 %<*en>
241 \item \emph{Caution: due to above two points, many methods which did the
242       dividing the process of the insertion of \textbf{JAglue} in \pTeX\ are not
243       effective anymore.} In concrete terms, the following two methods are not effective anymore:
244 %</en>
245 %<*ja>
246 \item \textbf{注意:上の2つの変更により,従来 \textbf{JAglue} の挿入処理を分断するのに
247       使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:}
248 %</ja>
249 \begin{verbatim}
250   ちょ{}っと  ちょ\/っと
251 \end{verbatim}
252 %<*en>
253       If you want to do so, please put an empty hbox between it instead:
254 %</en>
255 %<*ja>
256       もし同じことをやりたければ,空のhboxを間に挟めばよい:
257 %</ja>
258 \begin{verbatim}
259   ちょ\hbox{}っと
260 \end{verbatim}
261
262
263 %<*en>
264 \item In the process, two Japanese fonts which only differ in their `real'
265       fonts are identified.
266 %</en>
267 %<*ja>
268 \item 処理中では,2つの和文フォントは,「実際の」フォントのみが異なる場合に同一視
269       される.
270 %</ja>
271 \end{itemize}
272
273 %<*en>
274 \item At the present, vertical typesetting (\emph{tategaki}), is not
275       supported in \LuaTeX-ja.
276 %</en>
277 %<*ja>
278 \item 現時点では,縦書きは \LuaTeX-ja ではサポートされていない.
279 %</ja>
280
281 \end{itemize}
282
283 %<*en>
284 For detailed information, see Part~\ref{part-imp}.
285 %</en>
286 %<*ja>
287 詳細については第 \ref{part-imp} 部を見よ.
288 %</ja>
289
290 %<en>\subsection{Notations}
291 %<ja>\subsection{用語と記法}
292
293 %<*en>
294 In this document, the following terms and notations are used:
295 %</en>
296 %<*ja>
297 本ドキュメントでは,以下の用語と記法を用いる:
298 %</ja>
299
300 \begin{itemize}
301 %<*en>
302 \item Characters are divided into two types:
303 %</en>
304 %<*ja>
305 \item 文字は2種類に分けられる:
306 %</ja>
307 \begin{itemize}
308 %<*en>
309 \item \textbf{JAchar}: standing for Japanese characters such as
310       Hiragana, Katakana, Kanji and other punctuation marks for
311       Japanese.
312 %</en>
313 %<*ja>
314 \item \textbf{JAchar}: ひらがな,カタカナ,漢字,和文用の約物といった和文文字の
315       ことを指す.
316 %</ja>
317
318 %<*en>
319 \item \textbf{ALchar}: standing for all other characters like alphabets.
320 %</en>
321 %<*ja>
322 \item \textbf{ALchar}: アルファベットを始めとする,その他全ての文字を指す.
323 %</ja>
324 \end{itemize}
325
326 %<*en>
327 We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts' for fonts used in \textbf{JAchar}.
328 %</en>
329 %<*ja>
330 そして,\textbf{ALchar} の出力に用いられるフォントを「欧文フォント」と呼び,
331 \textbf{JAchar} の出力に用いられるフォントを「和文フォント」と呼ぶ.
332 %</ja>
333
334 %<*en>
335 \item A word in a sans-serif font (like \Param{prebreakpenalty})
336       means an internal parameter for Japanese typesetting, and it
337       is used as a key in \verb+\ltjsetparameter+ command.
338 %</en>
339 %<*ja>
340 \item サンセリフ体で書かれた語(例:\Param{prebreakpenalty})は日本語組版用の
341       パラメータを表し,これらは \verb+\ltjsetparameter+ コマンドのキーとして
342       用いられる.
343 %</ja>
344
345 %<*en>
346 \item A word in typewriter font with underline (like \Pkg{fontspec})
347       means a package or a class of \LaTeX.
348 %</en>
349 %<*ja>
350 \item 下線付きのタイプライタ体で書かれた語(例:\Pkg{fontspec})は \LaTeX の
351       パッケージやクラスを表す.
352 %</ja>
353
354 %<*en>
355 \item The word `primitive' is used not only for primitives in \LuaTeX,
356       but also for control sequences that defined in the core module of
357       \LuaTeX-ja.
358 %</en>
359 %<*ja>
360 \item 「プリミティブ」という語を,\LuaTeX のプリミティブだけではなく \LuaTeX-ja
361       のコアモジュールで定義されたコントロールシーケンスに対しても用いる.
362 %</ja>
363
364 %<*en>
365 \item In this document, natural numbers start from~0.
366 %</en>
367 %<*ja>
368 \item 本ドキュメントでは,自然数は0から始まる.
369 %</ja>
370 \end{itemize}
371
372 %<en>\subsection{About the project}
373 %<ja>\subsection{プロジェクトについて}
374
375 %<*en>
376 \paragraph{Project Wiki} Project Wiki is under construction.
377 %</en>
378 %<*ja>
379 \paragraph{プロジェクト Wiki} プロジェクト Wiki は構築中である.
380 %</ja>
381
382 %<*en>
383 \begin{itemize}
384 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
385 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
386 \end{itemize}
387 %</en>
388 %<*ja>
389 \begin{itemize}
390 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
391 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
392 \end{itemize}
393 %</ja>
394
395 %<*en>
396 This project is hosted by SourceForge.JP.
397 %</en>
398 %<*ja>
399 本プロジェクトは SourceForge.JP のサービスを用いて運営されている.
400 %</ja>
401
402 %<en>\paragraph{Members}\
403 %<ja>\paragraph{開発メンバー}\
404 %<*en>
405 \begin{multienumerate}
406 \def\labelenumi{$\bullet$}
407 \mitemxxx{Hironori KITAGAWA}{Kazuki MAEDA}{Takayuki YATO}
408 \mitemxxx{Yusuke KUROKI}{Noriyuki ABE}{Munehiro YAMAMOTO}
409 \mitemxxo{Tomoaki HONDA}{Shuzaburo SAITO}
410 \end{multienumerate}
411 %</en>
412 %<*ja>
413 \begin{multienumerate}
414 \def\labelenumi{$\bullet$}
415 \mitemxxx{北川 弘典}{前田 一貴}{八登 崇之}
416 \mitemxxx{黒木 裕介}{阿部 紀行}{山本 宗宏}
417 \mitemxxo{本田 知亮}{齋藤 修三郎}
418 \end{multienumerate}
419 %</ja>
420
421
422 % \paragraph{Acknowledgments} -- 挿入するならここ
423
424 \clearpage
425 %<en>\section{Getting Started}
426 %<ja>\section{使い方}
427 %<en>\subsection{Installation}
428 %<ja>\subsection{インストール}
429
430 %<*en>
431 To install the \LuaTeX-ja\ package, you will need:
432 %</en>
433 %<*ja>
434 \LuaTeX-ja パッケージのインストールには,次のものが必要である.
435 %</ja>
436 \begin{itemize}
437 %<*en>
438 \item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.\\
439 If you are using \TeX~Live~2011 or current W32\TeX, you don't have to worry.
440 %</en>
441 %<*ja>
442 \item \LuaTeX(バージョン 0.65.0-beta 以降)とその支援パッケージ.
443       \TeX~Live~2011 や W32\TeX の最新版ならば問題ない.
444 %</ja>
445 %<*en>
446 \item The source archive of \LuaTeX-ja, of course\texttt{:)}
447 %</en>
448 %<*ja>
449 \item \LuaTeX-ja のソースアーカイブ(もちろん \texttt{:)}).
450 %</ja>
451 \end{itemize}
452
453 %<*en>
454 The installation methods are as follows:
455 %</en>
456 %<*ja>
457 インストール方法は以下のようになる:
458 %</ja>
459 \begin{enumerate}
460 %<*en>
461 \item Download the source archive.
462
463       At the present, \LuaTeX-ja has no official release, so you have to retrieve
464       the archive from the repository.
465       You can retrieve the Git repository via
466 %</en>
467 %<*ja>
468 \item ソースアーカイブをダウンロードする.
469
470       現時点では,\LuaTeX-ja の公式リリースはないので,レポジトリからアーカイブを
471       取得しなければならない.
472       次のようにすることで,Git レポジトリを取得することができる:
473 %</ja>
474 \begin{verbatim}
475 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
476 \end{verbatim} 
477 %<*en>
478       or download the archive of HEAD in \texttt{master} branch from
479 %</en>
480 %<*ja>
481       もしくは,\texttt{master} ブランチの HEAD アーカイブを以下からダウンロードすることができる:
482 %</ja>
483 \begin{flushleft}
484 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
485 \end{flushleft}
486
487 %<*en>
488 Note that the forefront of development may not be in \texttt{master} branch.
489 %</en>
490 %<*ja>
491 開発中の最新の成果は \texttt{master} ブランチには含まれていないかもしれないことに注意.
492 %</ja>
493
494 %<*en>
495 \item Extract the archive. You will see \texttt{src/} and several other sub-directories.
496 %</en>
497 %<*ja>
498 \item アーカイブを展開する.\texttt{src/} をはじめとしたいくつかのディレクトリができる.
499 %</ja>
500
501 %<*en>
502 \item Copy all the contents of \texttt{src/} into one of your \texttt{TEXMF} tree.
503 %</en>
504 %<*ja>
505 \item \texttt{src/} の中身全てを自分の \texttt{TEXMF} ツリーにコピーする.
506 %</ja>
507
508 %<*en>
509 \item If \texttt{mktexlsr} is needed to update the file name database, make it so.
510 %</en>
511 %<*ja>
512 \item もし \texttt{mktexlsr} を実行する必要があればそうする.
513 %</ja>
514 \end{enumerate}
515
516 %<en>\subsection{Cautions}
517 %<ja>\subsection{注意点}
518
519 \begin{itemize}
520 %<*en>
521 \item The encoding of your source file must be UTF-8. No other
522       encodings, such as EUC-JP or Shift-JIS, are not supported.
523 %</en>
524 %<*ja>
525 \item 原稿のソースファイルの文字コードは UTF-8 でなければならない.
526       EUC-JP や Shift-JIS は使用できない.
527 %</ja>
528
529 %<*en>
530 \item May be conflict with other packages.
531
532       For example, the default setting of \textbf{JAchar} in the present
533       version does not coexist with the \Pkg{unicode-math}
534       package. Putting the following line in preamble makes that
535       mathematical symbols will be typeset correctly, but several
536       Japanese characters will be treated as an \textbf{ALchar} as
537       side-effect:
538 %</en>
539 %<*ja>
540 \item いくつかのパッケージと衝突する.
541
542       例えば,\textbf{JAchar} の範囲の設定がデフォルトのままだと,現行の
543       バージョンでは \Pkg{unicode-math} パッケージと共存できない.
544       以下の行をプリアンブルに追加することで数学記号が正しく出るように
545       なるが,副作用としていくつかの和文文字が \textbf{ALchar} として
546       扱われるようになってしまう:
547 %</ja>
548 \begin{verbatim}
549 \ltjsetparameter{jacharrange={-3, -8}}
550 \end{verbatim}
551 \end{itemize}
552
553 %<en>\subsection{Using in plain \TeX}
554 %<ja>\subsection{plain \TeX で使う}
555 \label{ssec-plain}
556
557 %<*en>
558 To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
559 %</en>
560 %<*ja>
561 \LuaTeX-ja を plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
562 %</ja>
563 \begin{verbatim}
564 \input luatexja.sty
565 \end{verbatim}
566 %<*en>
567 This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents:
568 %</en>
569 %<*ja>
570 これで(\texttt{ptex.tex} のように)日本語組版のための最低限の設定がなされる:
571 %</ja>
572
573 \begin{itemize}
574 %<*en>
575 \item The following 6~Japanese fonts are preloaded:
576 \begin{center}
577 \begin{tabular}{ccccc}
578 \toprule
579 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
580 \emph{mincho}&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
581 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
582 \bottomrule
583 \end{tabular}
584 \end{center}
585 %</en>
586 %<*ja>
587 \item 以下の6つの和文フォントが定義される:
588 \begin{center}
589 \begin{tabular}{ccccc}
590 \toprule
591 \textbf{字体}&\textbf{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
592 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
593 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
594 \bottomrule
595 \end{tabular}
596 \end{center}
597 %</ja>
598 \begin{itemize}
599 %<*en>
600 \item The `Q(級)' is a unit used in Japanese phototypesetting, and
601       $1\,\textrm{Q}=0.25\,\textrm{mm}$. This length is stored in a
602       dimension \verb+\jQ+.
603 %</en>
604 %<*ja>
605 \item `Q(級)' は日本の写植で用いられる単位で,$1\,\textrm{Q}=0.25\,\textrm{mm}$
606       である.この長さは \verb+\jQ+ に保持されている.
607 %</ja>
608
609 %<*en>
610 \item It is widely accepted that the font `Ryumin-Light' and
611       `GothicBBB-Medium' aren't embedded into PDF files, and PDF reader
612       substitute them by some external Japanese fonts (\textit{e.g.},
613       Kozuka Mincho is used for Ryumin-Light in Adobe Reader). We adopt this custom to
614       the default setting.
615 %</en>
616 %<*ja>
617 \item `Ryumin-Light' と `GothicBBB-Medium' は PDF ファイルに埋め込まずに
618       名前参照のみで用いることが広く受け入れられており,この場合 PDF リーダーが
619       適切な外部フォントで代用する(例えば,Adobe Reader では Ryumin-Light は
620       小塚明朝で代替される).そこで,これらをデフォルトのフォントと
621       して採用する.
622 %</ja>
623
624 %<*en>
625 \item A character in an alphabetic font is generally smaller than a
626       Japanese font in the same size. So actual size specification of
627       these Japanese fonts is in fact smaller than that of alphabetic
628       fonts, namely scaled by 0.962216.
629 %</en>
630 %<*ja>
631 \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも
632       一般に小さい.そこで,これらの和文フォントの実際のサイズは指定された値よりも
633       小さくなるように設定されており,具体的には指定の 0.962216 倍にスケールされる.
634 %</ja>
635 \end{itemize}
636
637 %<*en>
638 \item The amount of glue that are inserted between a \textbf{JAchar} and
639       an \textbf{ALchar} (the parameter \Param{xkanjiskip}) is set to
640 %</en>
641 %<*ja>
642 \item \textbf{JAchar} と \textbf{ALchar} の間に入るグルー (\Param{xkanjiskip}) の
643       量は次のように設定されている:
644 %</ja>
645 \[
646  (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}}
647  = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}.
648 \]
649 \end{itemize}
650
651 %<en>\subsection{Using in \LaTeX}
652 %<ja>\subsection{\LaTeX で使う}
653 \label{ssec-ltx}
654
655 \paragraph{\LaTeXe}
656
657 %<*en>
658 Using in \LaTeXe\ is basically same. To set up the minimal environment
659 for Japanese, you only have to load \texttt{luatexja.sty}:
660 %</en>
661 %<*ja>
662 \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を
663 設定するためには,\texttt{luatexja.sty} を読み込むだけでよい:
664 %</ja>
665 \begin{verbatim}
666 \usepackage{luatexja}
667 \end{verbatim}
668 %<*en>
669 It also does minimal settings (counterparts in \pLaTeX\ are \texttt{
670 plfonts.dtx} and \texttt{pldefs.ltx}):
671 %</en>
672 %<*ja>
673 これで \pLaTeX の \texttt{plfonts.dtx} と \texttt{pldefs.ltx} に相当する最低限の設定が
674 なされる:
675 %</ja>
676
677 \begin{itemize}
678 %<*en>
679 \item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
680 When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
681 %</en>
682 %<*ja>
683 \item \texttt{JY3} は和文フォント用のフォントエンコーディングである(横書き用).\\
684 将来的に,\LuaTeX-ja で縦書きがサポートされる際には,\texttt{JT3} を縦書き用として
685 用いる予定である.
686 %</ja>
687
688 %<*en>
689 \item Two font families \texttt{mc} and \texttt{gt} are defined:
690 \begin{center}
691 \begin{tabular}{ccccc}
692 \toprule
693 \textbf{classification}&\textbf{family}&\verb+\mdseries+&\verb+\bfseries+&\textbf{scale}\\\midrule
694 \emph{mincho}&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
695 \emph{gothic}&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
696 \bottomrule
697 \end{tabular}
698 \end{center}
699 Remark that the bold series in both family are same as the medium series of \emph{gothic} family.
700 This is a convention in \pLaTeX. This is a trace that there were only 2~fonts (these are Ryumin-Light
701 and GothicBBB-Medium) in early years of DTP.
702 %</en>
703 %<*ja>
704 \item 2つのフォントファミリ \texttt{mc} と \texttt{gt} が定義されている:
705 \begin{center}
706 \begin{tabular}{ccccc}
707 \toprule
708 \textbf{字体}&\textbf{ファミリ}&\verb+\mdseries+&\verb+\bfseries+&\textbf{スケール}\\\midrule
709 明朝体&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
710 ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
711 \bottomrule
712 \end{tabular}
713 \end{center}
714 どちらのファミリにおいても,その bold シリーズはゴシック体の medium シリーズで
715 あることに注意.これは初期の DTP において和文フォントが2つ(それがちょうど\
716 Ryumin-Light, GothicBBB-Medium だった)しか利用できなかった時の名残であり,\pLaTeX{}
717 での標準設定とも同じである.
718 %</ja>
719
720 %<*en>
721 \item Japanese characters in math mode are typeset by the font family \texttt{mc}.
722 %</en>
723 %<*ja>
724 \item 数式モード中の和文文字は \texttt{mc} ファミリで出力される.
725 %</ja>
726 \end{itemize}
727
728 %<*en>
729 However, above settings are not sufficient for Japanese-based
730 documents. To typeset Japanese-based documents, you are better to use
731 class files other than \texttt{article.cls}, \texttt{book.cls}, and so on.  At
732 the present, we have the counterparts of \Pkg{jclasses} (standard
733 classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
734 Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
735 %</en>
736 %<*ja>
737 しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
738 日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls} といった
739 欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
740 現時点では,\Pkg{jclasses} (\pLaTeX の標準クラス)と \Pkg{jsclasses}
741 (奥村晴彦氏によるクラスファイル)に対応するものとして,\Pkg{ltjclasses},
742 \Pkg{ltjsclasses} がそれぞれ用意されている.
743 %</ja>
744
745 %<*en>
746 \paragraph{\texttt{\char92 CID, \texttt{\char92 UTF}} and macros in OTF package}
747 Under \pLaTeX, \Pkg{otf} package (developed by Shuzaburo Saito) is
748 used for typesetting characters which is in Adobe-Japan1-6 CID but not
749 in JIS~X~0208. Since this package is widely used, \LuaTeX-ja
750 supports some of functions in \Pkg{otf} package.
751 If you want to use these functions, load \Pkg{luatexja-otf} package.
752 %</en>
753 %<*ja>
754 \paragraph{\texttt{\char92 CID, \texttt{\char92 UTF}} と OTF パッケージのマクロ}
755 \pLaTeX では,JIS~X~0208 にない Adobe-Japan1-6 の文字を出力するために,
756 齋藤修三郎氏による \Pkg{otf} パッケージが用いられていた.このパッケージは
757 広く用いられているため,\LuaTeX-ja においても \Pkg{otf} パッケージの機能の
758 一部をサポートしている.これらの機能を用いるためには \Pkg{luatexja-otf} パッケージ
759 を読み込めばよい.
760 %</ja>
761
762 \begin{LTXexample}
763 森\UTF{9DD7}外と内田百\UTF{9592}とが\UTF{9AD9}島屋に行く。
764
765 \CID{7652}飾区の\CID{13706}野家,
766 葛飾区の吉野家
767 \end{LTXexample}
768 %lltjp-listings.sty要修正?:↑「森」の直後で改行.
769
770
771 %<en>\subsection{Changing Fonts}
772 %<ja>\subsection{フォントの変更}
773 \label{ssub-chgfnt}
774
775 %<*en>
776 \paragraph{Remark: Japanese Characters in Math Mode}
777 Since \pTeX\ supports Japanese characters in math mode, there are
778 sources like the following:
779 %</en>
780 %<*ja>
781 \paragraph{意見:数式モード中の和文文字}
782 \pTeX では数式中での和文文字の使用がサポートされていたので,
783 以下のようなソースが存在した:
784 %</ja>
785 \begin{LTXexample}
786 $f_{高温}$~($f_{\text{high temperature}}$).
787 \[ y=(x-1)^2+2\quad{}よって\quad y>0 \]
788 $5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
789 \end{LTXexample}
790 %<*en>
791 We (the project members of \LuaTeX-ja) think that using
792 Japanese characters in math mode are allowed if and only if these are used as identifiers.
793 In this point of view,
794 %</en>
795 %<*ja>
796 \LuaTeX-ja プロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる
797 ときのみ許されると考えている.
798 この観点から,
799 %</ja>
800 \begin{itemize}
801 %<*en>
802 \item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and
803 `よって' is used as a conjunction.
804 %</en>
805 %<*ja>
806 \item 上記数式のうち 1, 2 行目は正しくない.なぜならば `高温' が意味のあるラベルと
807       して,`よって' が接続詞として用いられているからである.
808 %</ja>
809 %<*en>
810 \item However, the line~3 is correct, since `素' is used as an identifier.
811 %</en>
812 %<*ja>
813 \item しかしながら,3行目は `素' が識別子として用いられているので正しい.
814 %</ja>
815 \end{itemize}
816 %<*en>
817 Hence, in our opinion, the above input should be corrected as:
818 %</en>
819 %<*ja>
820 したがって,\LuaTeX-ja プロジェクトの意見としては,上記の入力は次のように直されるべき
821 である:
822 %</ja>
823 \begin{LTXexample}
824 $f_{\text{高温}}$~%
825 ($f_{\text{high temperature}}$).
826 \[ y=(x-1)^2+2\quad
827   \mathrel{\text{よって}}\quad y>0 \]
828 $5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
829 \end{LTXexample}
830 %BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない.
831 %<*en>
832 We also believe that using Japanese characters as identifiers is rare,
833 hence we don't describe how to change Japanese fonts in math mode in
834 this chapter. For the method, please see Part~\ref{part-ref}.
835 %</en>
836 %<*ja>
837 また \LuaTeX-ja プロジェクトでは,和文文字が識別子として用いられることはほとんどない
838 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
839 記述しない.この方法については第 \ref{part-ref} 部を参照のこと.
840 %</ja>
841
842 %<*en>
843 \paragraph{plain \TeX}
844 To change Japanese fonts in plain \TeX, you must use the primitive
845 \verb+\jfont+. So please see Part~\ref{part-ref}.
846 %</en>
847 %<*ja>
848 \paragraph{plain \TeX}
849 plain \TeX で和文フォントを変更するためには,\verb+\jfont+ プリミティブを用いなけれ
850 ばならない.第 \ref{part-ref} 部を参照せよ.
851 %</ja>
852
853 %<*en>
854 \paragraph{NFSS2}
855 For \LaTeXe, \LuaTeX-ja simply adopted the font selection system from that
856 of \pLaTeXe\ (in \texttt{plfonts.dtx}).
857 %</en>
858 %<*ja>
859 \paragraph{NFSS2}
860 \LaTeXe については,\LuaTeX-ja では単にフォント選択システムを \pLaTeXe\ (\texttt{plfonts.dtx})
861 から採用している.
862 %</ja>
863 \begin{itemize}
864 %<*en>
865 \item Two control sequences \verb+\mcdefault+ and \verb+\gtdefault+ are
866       used to specify the default font families for \emph{mincho} and
867       \emph{gothic}, respectively. Default values: \texttt{mc} for
868       \verb+\mcdefault+ and \texttt{gt} for \verb+\gtdefault+.
869 %</en>
870 %<*ja>
871 \item 2つのコントロールシーケンス \verb+\mcdefault+ と \verb+\gtdefault+ がそれぞ
872       れ明朝体とゴシック体のデフォルトのフォントファミリを指定するために用いられる.
873       初期値:\verb+\mcdefault+ は \texttt{mc},\verb+\gtdefault+ は \texttt{gt}.
874 %</ja>
875 %<*en>
876 \item Commands \verb+\fontfamily+, \verb+\fontseries+,
877       \verb+\fontshape+ and \verb+\selectfont+ can be used to change
878       attributes of Japanese fonts.
879 %</en>
880 %<*ja>
881 \item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして
882       \verb+\selectfont+ が和文フォントの属性を変更するために使用できる.
883 %</ja>
884
885 %<*en>
886 \begin{center}
887 \begin{tabular}{cccccc}
888 \toprule
889 &\textbf{encoding}&\textbf{family}&\textbf{series}&\textbf{shape}&\textbf{selection}\\\midrule
890 alphabetic fonts
891 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
892 &\verb+\useroman+\\
893 Japanese fonts
894 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
895 &\verb+\usekanji+\\
896 both&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
897 auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
898 \bottomrule
899 \end{tabular}
900 \end{center}
901 %</en>
902 %<*ja>
903 \begin{center}
904 \begin{tabular}{cccccc}
905 \toprule
906 &\textbf{エンコーディング}&\textbf{ファミリ}&\textbf{シリーズ}&\textbf{シェープ}&\textbf{選択}\\\midrule
907 欧文フォント
908 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
909 &\verb+\useroman+\\
910 和文フォント
911 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
912 &\verb+\usekanji+\\
913 両方&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
914 自動選択&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
915 \bottomrule
916 \end{tabular}
917 \end{center}
918 %</ja>
919
920 %<*en>
921       \verb+\fontencoding{<encoding>}+ changes the encoding of alphabetic fonts
922       or Japanese fonts depending on the argument. For example,
923       \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to
924       \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of
925       alphabetic fonts to \texttt{T1}.
926       \verb+\fontfamily+ also changes the family of Japanese fonts, alphabetic
927       fonts, \emph{or both}. For detail, see Subsection~\ref{ssub-nfsspat}.
928 %</en>
929 %<*ja>
930       ここで,\verb+\fontencoding{<encoding>}+は,引数により和文側か欧文側かの
931       どちらかが切り替わる.例えば,\verb+\fontencoding{JY3}+は和文フォントの
932       エンコーディングを\texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文
933       フォント側を\texttt{T1}へと変更する.
934       \verb+\fontfamily+も引数により和文側,欧文側,\textbf{あるいは両方}のフォ
935       ントファミリが切り替わる.詳細は\ref{ssub-nfsspat}節を参照すること.
936 %</ja>
937
938 %<*en>
939 \item For defining a Japanese font family, use
940       \verb+\DeclareKanjiFamily+ instead of
941       \verb+\DeclareFontFamily+. However, in the present implementation,
942       using \verb+\DeclareFontFamily+ doesn't cause any problem.
943 %</en>
944 %<*ja>
945 \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の代わりに
946       \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の実装では
947       \verb+\DeclareFontFamily+ を用いても問題は生じない.
948 %</ja>
949 \end{itemize}
950
951 %<*en>
952 \paragraph{fontspec}
953 To coexist with the \Pkg{fontspec} package, it is needed to load
954 \Pkg{luatexja-fontspec} package in the preamble. This additional
955 package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
956 package, if needed.
957 %</en>
958 %<*ja>
959 \Pkg{fontspec} パッケージと同様の機能を和文フォントに対しても用いるためには,
960 \Pkg{luatexja-fontspec} パッケージをプリアンブルで読み込む必要がある.このパッケージ
961 は必要ならば自動で \Pkg{luatexja} パッケージと \Pkg{fontspec} パッケージを読み込む.
962 %</ja>
963
964 %<*en>
965 In \Pkg{luatexja-fontspec} package, the following 7~commands are defined as
966 counterparts of original commands in the \Pkg{fontspec} package:
967 %</en>
968 %<*ja>
969 \Pkg{luatexja-fontspec} パッケージでは,以下の7つのコマンドを \Pkg{fontspec}
970 パッケージの元のコマンドに対応するものとして定義している:
971 %</ja>
972 %<*en>
973 \begin{center}
974 \begin{tabular}{ccccc}
975 \toprule
976 Japanese fonts
977 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
978 alphabetic fonts
979 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
980 \midrule
981 Japanese fonts
982 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
983 alphabetic fonts
984 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
985 \bottomrule
986 \end{tabular}
987 \end{center}
988 %</en>
989 %<*ja>
990 \begin{center}
991 \begin{tabular}{ccccc}
992 \toprule
993 和文フォント
994 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
995 欧文フォント
996 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
997 \midrule
998 和文フォント
999 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1000 欧文フォント
1001 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1002 \bottomrule
1003 \end{tabular}
1004 \end{center}
1005 %</ja>
1006
1007 \begin{LTXexample}
1008 \fontspec[Numbers=OldStyle]{TeX Gyre Termes}
1009 \jfontspec{IPAexMincho}
1010 JIS~X~0213:2004→辻
1011
1012 \addjfontfeatures{CJKShape=JIS1990}
1013 JIS~X~0208:1990→辻
1014 \end{LTXexample}
1015
1016 %<*en>
1017 Note that there is no command named \verb+\setmonojfont+, since it is
1018 popular for Japanese fonts that nearly all Japanese glyphs have same
1019 widths.  Also note that the kerning feature is set off by default in
1020 these 7~commands, since this feature and \textbf{JAglue} will clash (see
1021 \ref{para-kern}).
1022 %</en>
1023 %<*ja>
1024 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
1025 \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
1026 ンドでは Kerning feature はデフォルトでは off となっている.これはこの
1027 feature が \textbf{JAglue} と衝突するためである(\ref{para-kern} 節を見よ).
1028 %</ja>
1029
1030 %<en>\section{Changing Parameters}
1031 %<ja>\section{パラメータの変更}
1032
1033 %<*en>
1034 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
1035 most of them are not stored as internal register of \TeX, but as an
1036 original storage system in \LuaTeX-ja. Hence, to assign or acquire those
1037 parameters, you have to use commands \verb+\ltjsetparameter+ and
1038 \verb+\ltjgetparameter+.
1039 %</en>
1040 %<*ja>
1041 \LuaTeX-ja には多くのパラメータが存在する.そして \LuaTeX の振る舞いのために,
1042 その多くは \TeX のレジスタにではなく,\LuaTeX-ja 独自の方法で保持されている.
1043 そのため,これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と
1044 \verb+\ltjgetparameter+ を用いなければならない.
1045 %</ja>
1046
1047 %<en>\subsection{Editing the range of \textbf{JAchar}s}
1048 %<ja>\subsection{\textbf{JAchar} の範囲の設定}
1049
1050 %<*en>
1051 To edit the range of \textbf{JAchar}s, you have to assign a non-zero
1052 natural number which is less than 217 to the character range first. This
1053 can be done by using \verb+\ltjdefcharrange+ primitive. For example, the
1054 next line assigns whole characters in Supplementary Multilingual Plane
1055 and the character `漢' to the range number~100.
1056 %</en>
1057 %<*ja>
1058 \textbf{JAchar} の範囲を設定するためには,まず文字範囲に0より大きく217より小さい
1059 自然数を割り当てる必要がある.これには \verb+\ltjdefcharrange+ プリミティブを用いる.
1060 例えば,次のように書くことで追加多言語面 (SMP) にある全ての文字と `漢' の範囲番号が
1061 100に設定される.
1062 %</ja>
1063 \begin{lstlisting}
1064 \ltjdefcharrange{100}{"10000-"1FFFF,`漢}
1065 \end{lstlisting}
1066 %<*en>
1067 This assignment of numbers to ranges are always global, so you should
1068 not do this in the middle of a document.
1069 %</en>
1070 %<*ja>
1071 この文字範囲への番号の割り当てはいつもグローバルであり,したがって文書の途中で
1072 この操作をするべきではない.
1073 %</ja>
1074
1075 %<*en>
1076 If some character has been belonged to some non-zero numbered range,
1077 this will be overwritten by the new setting. For example, whole SMP
1078 belong to the range~4 in the default setting of \LuaTeX-ja, and if you
1079 specify the above line, then SMP will belong to the range~100 and be
1080 removed from the range~4.
1081 %</en>
1082 %<*ja>
1083 もし指定されたある文字がある非零番号の範囲に属していたならば,これは新しい設定で
1084 上書きされる.例えば,SMP は全て \LuaTeX-ja のデフォルトでは4番の文字範囲に
1085 属しているが,上記の指定を行えば SMP は100番に属すようになり,4番からは除かれる.
1086 %</ja>
1087
1088 %<*en>
1089 After assigning numbers to ranges, the \textsf{jacharrange} parameter can
1090 be used to customize which character range will be treated as ranges of
1091 \textbf{JAchar}s, as the following line (this is just the default
1092 setting of \LuaTeX-ja):
1093 %</en>
1094 %<*ja>
1095 文字範囲に番号を割り当てた後は,\textsf{jacharrange} パラメータが \textbf{JAchar} と
1096 して扱われる文字の範囲を設定するために用いられる.例えば,以下は \LuaTeX-ja の
1097 初期設定である:
1098 %</ja>
1099 \begin{verbatim}
1100 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
1101 \end{verbatim}
1102 %<*en>
1103 The argument to \textsf{jacharrange} parameter is a list of integer.
1104 Negative integer $-n$ in the list means that `the characters that belong to
1105 range~$n$ are treated as \textbf{ALchar}', and positive integer $+n$ means
1106 that `the characters that belong to range~$n$ are treated as \textbf{JAchar}'.
1107 %</en>
1108 %<*ja>
1109 \textsf{jacharrange} パラメータには整数のリストを与える.
1110 リスト中の負の整数 $-n$ は「文字範囲 $n$ に属する文字は \textbf{ALchar} として
1111 扱われる」ことを意味し,正の整数 $+n$ は \textbf{JAchar} として扱うことを意味する.
1112 %</ja>
1113
1114 %<*en>
1115 \paragraph{Default Setting}
1116 \LuaTeX-ja predefines eight character ranges for convenience. They are
1117 determined from the following data:
1118 %</en>
1119 %<*ja>
1120 \paragraph{初期設定}
1121 \LuaTeX-ja では8つの文字範囲を設定している.これらは以下のデータに基づいて決定して
1122 いる.
1123 %</ja>
1124 \begin{itemize}
1125 %<*en>
1126 \item Blocks in Unicode~6.0.
1127 %</en>
1128 %<*ja>
1129 \item Unicode~6.0 のブロック.
1130 %</ja>
1131 %<*en>
1132 \item The \texttt{Adobe-Japan1-UCS2} mapping between a CID Adobe-Japan1-6 and Unicode.
1133 %</en>
1134 %<*ja>
1135 \item \texttt{Adobe-Japan1-UCS2} による Adobe-Japan1-6 の CID と Unicode の間の
1136       マッピング.
1137 %</ja>
1138 %<*en>
1139 \item The \texttt{PXbase} bundle for \upTeX\ by Takayuki Yato.
1140 %</en>
1141 %<*ja>
1142 \item 八登崇之氏による \upTeX 用の \texttt{PXbase} バンドル.
1143 %</ja>
1144 \end{itemize}
1145
1146 %<*en>
1147 Now we describe these eight ranges. The alphabet `J' or `A' after the
1148 number shows whether characters in the range is treated as
1149 \textbf{JAchar}s or not by default. These settings are similar to the
1150 \texttt{prefercjk} settings defined in \texttt{PXbase} bundle.
1151 %</en>
1152 %<*ja>
1153 以下ではこれら8つの文字範囲について記述する.番号のあとのアルファベット `J' と `A'
1154 はデフォルトで \textbf{JAchar} として扱われるかどうかを示す.これらの設定は
1155 \texttt{PXbase} バンドルで定義されている \texttt{prefercjk} と類似のものである.
1156 %</ja>
1157 \begin{description}
1158 %<*en>
1159 \item[Range~8${}^{\text{J}}$] Symbols in the intersection of the upper half of ISO~8859-1
1160          (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range
1161          consists of the following characters:
1162 %</en>
1163 %<*ja>
1164 \item[範囲 8${}^{\text{J}}$] ISO~8859-1 の上位領域(ラテン1補助)と
1165                              JIS~X~0208 の共通部分にある記号.この文字範囲は
1166                              以下の文字で構成される:
1167 %</ja>
1168 \begin{multicols}{2}
1169 \begin{itemize}
1170 \def\ch#1#2{\item \char"#1\ (\texttt{U+00#1}, #2)}%"
1171 %<*en>
1172 \ch{A7}{Section Sign}
1173 \ch{A8}{Diaeresis}
1174 \ch{B0}{Degree sign}
1175 \ch{B1}{Plus-minus sign}
1176 \ch{B4}{Spacing acute}
1177 \ch{B6}{Paragraph sign}
1178 \ch{D7}{Multiplication sign}
1179 \ch{F7}{Division Sign}
1180 %</en>
1181 %<*ja>
1182 \ch{A7}{節記号}
1183 \ch{A8}{トレマ}
1184 \ch{B0}{度}
1185 \ch{B1}{正又は負符号}
1186 \ch{B4}{アキュート・アクセント}
1187 \ch{B6}{段落記号}
1188 \ch{D7}{乗算記号}
1189 \ch{F7}{除算記号}
1190 %</ja>
1191 \end{itemize}
1192 \end{multicols}
1193
1194 %<*en>
1195 \item[Range~1${}^{\text{A}}$] Latin characters that some of them are included in Adobe-Japan1-6.
1196 This range consist of the following Unicode ranges, \emph{except characters in the range~8 above}:
1197 %</en>
1198 %<*ja>
1199 \item[範囲 1${}^{\text{A}}$] ラテン文字.一部はAdobe-Japan1-6 にも含まれている.
1200                              この範囲は以下の Unicode のブロックから構成されている.
1201                              \textbf{ただし,範囲 8 は除く.}
1202 %</ja>
1203 \begin{multicols}{2}
1204 \begin{itemize}
1205 %<*en>
1206 \item \texttt{U+0080}--\texttt{U+00FF}: Latin-1 Supplement
1207 \item \texttt{U+0100}--\texttt{U+017F}: Latin Extended-A
1208 \item \texttt{U+0180}--\texttt{U+024F}: Latin Extended-B
1209 \item \texttt{U+0250}--\texttt{U+02AF}: IPA Extensions
1210 \item \texttt{U+02B0}--\texttt{U+02FF}: Spacing Modifier Letters
1211 \item \texttt{U+0300}--\texttt{U+036F}: Combining Diacritical Marks
1212 \item \texttt{U+1E00}--\texttt{U+1EFF}: Latin Extended Additional
1213 %</en>
1214 %<*ja>
1215 \item \texttt{U+0080}--\texttt{U+00FF}: ラテン1補助
1216 \item \texttt{U+0100}--\texttt{U+017F}: ラテン文字拡張A
1217 \item \texttt{U+0180}--\texttt{U+024F}: ラテン文字拡張B
1218 \item \texttt{U+0250}--\texttt{U+02AF}: IPA拡張(国際音声記号)
1219 \item \texttt{U+02B0}--\texttt{U+02FF}: 前進を伴う修飾文字
1220 \item \texttt{U+0300}--\texttt{U+036F}: ダイアクリティカルマーク(合成可能)
1221 \item \texttt{U+1E00}--\texttt{U+1EFF}: ラテン文字拡張追加
1222 %</ja>
1223 \par\
1224 \end{itemize}
1225 \end{multicols}
1226 %<*en>
1227 \item[Range~2${}^{\text{J}}$] Greek and Cyrillic letters. JIS~X~0208 (hence most of Japanese
1228            fonts) has some of these characters.
1229 %</en>
1230 %<*ja>
1231 \item[範囲 2${}^{\text{J}}$] ギリシャ文字とキリル文字.JIS~X~0208(したがって多くの
1232                              和文フォント)はこれらの文字を持つ.
1233 %</ja>
1234 \begin{multicols}{2}
1235 \begin{itemize}
1236 %<*en>
1237 \item \texttt{U+0370}--\texttt{U+03FF}: Greek and Coptic
1238 \item \texttt{U+0400}--\texttt{U+04FF}: Cyrillic
1239 \item \texttt{U+1F00}--\texttt{U+1FFF}: Greek Extended
1240 %</en>
1241 %<*ja>
1242 \item \texttt{U+0370}--\texttt{U+03FF}: ギリシア文字及びコプト文字
1243 \item \texttt{U+0400}--\texttt{U+04FF}: キリル文字
1244 \item \texttt{U+1F00}--\texttt{U+1FFF}: キリル文字補助
1245 %</ja>
1246 \\\
1247 \end{itemize}
1248 \end{multicols}
1249 %<*en>
1250 \item[Range~3${}^{\text{J}}$] Punctuations and Miscellaneous symbols. The block list is
1251            indicated in Table~\ref{table-rng3}.
1252 %</en>
1253 %<*ja>
1254 \item[範囲 3${}^{\text{J}}$] 句読点と記号類.ブロックのリストは表~\ref{table-rng3}
1255                              に示してある.
1256 %</ja>
1257 \begin{table}[!tb]
1258 %<*en>
1259 \caption{Unicode blocks in predefined character range~3.}
1260 %</en>
1261 %<*ja>
1262 \caption{文字範囲 3 に指定されている Unicode ブロック.}
1263 %</ja>
1264 \label{table-rng3}
1265 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1266 \begin{center}\small
1267 \begin{tabular}{llll}
1268 %<*en>
1269 "2000--"206F&General Punctuation&
1270 "2070--"209F&Superscripts and Subscripts\\
1271 "20A0--"20CF&Currency Symbols&
1272 "20D0--"20FF&Comb.\ Diacritical Marks for Symbols\\
1273 "2100--"214F&Letterlike Symbols&
1274 "2150--"218F&Number Forms\\
1275 "2190--"21FF&Arrows&
1276 "2200--"22FF&Mathematical Operators\\
1277 "2300--"23FF&Miscellaneous Technical&
1278 "2400--"243F&Control Pictures\\
1279 "2500--"257F&Box Drawing&
1280 "2580--"259F&Block Elements\\
1281 "25A0--"25FF&Geometric Shapes&
1282 "2600--"26FF&Miscellaneous Symbols\\
1283 "2700--"27BF&Dingbats&
1284 "2900--"297F&Supplemental Arrows-B\\
1285 "2980--"29FF&Misc.\ Mathematical Symbols-B&
1286 "2B00--"2BFF&Miscellaneous Symbols and Arrows\\
1287 "E000--"F8FF&Private Use Area&
1288 %</en>
1289 %<*ja>
1290 "2000--"206F&一般句読点&
1291 "2070--"209F&上付き・下付き\\
1292 "20A0--"20CF&通貨記号&
1293 "20D0--"20FF&記号用ダイアクリティカルマーク(合成可能)\\
1294 "2100--"214F&文字様記号&
1295 "2150--"218F&数字に準じるもの\\
1296 "2190--"21FF&矢印&
1297 "2200--"22FF&数学記号(演算子)\\
1298 "2300--"23FF&その他の技術用記号&
1299 "2400--"243F&制御機能用記号\\
1300 "2500--"257F&罫線素片&
1301 "2580--"259F&ブロック要素\\
1302 "25A0--"25FF&幾何学模様&
1303 "2600--"26FF&その他の記号\\
1304 "2700--"27BF&装飾記号&
1305 "2900--"297F&補助矢印B\\
1306 "2980--"29FF&その他の数学記号B&
1307 "2B00--"2BFF&その他の記号及び矢印\\
1308 "E000--"F8FF&私用領域(外字領域)&
1309 %</ja>
1310 \end{tabular}
1311 \end{center}
1312 \end{table}
1313 %<*en>
1314 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
1315            of almost all Unicode blocks which are not in other
1316            predefined ranges. Hence, instead of showing the block list,
1317            we put the definition of this range itself:
1318 %</en>
1319 %<*ja>
1320 \item[範囲 4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
1321                              この範囲は他の範囲にないほとんど全ての Unicode ブロック
1322                              で構成されている.したがって,ブロックのリストを示す
1323                              代わりに,範囲の定義そのものを示す:
1324 %</ja>
1325 \begin{lstlisting}
1326 \ltjdefcharrange{4}{%
1327    "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
1328   "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F,
1329   "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF} % non-Japanese
1330 \end{lstlisting}
1331 %<*en>
1332 \item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
1333 %</en>
1334 %<*ja>
1335 \item[範囲 5${}^{\text{A}}$] 代用符号と補助私用領域.
1336 %</ja>
1337 %<*en>
1338 \item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
1339 %</en>
1340 %<*ja>
1341 \item[範囲 6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは
1342                              表~\ref{table-rng6} に示す.
1343 %</ja>
1344 \begin{table}[!tb]
1345 %<*en>
1346 \caption{Unicode blocks in predefined character range~6.}
1347 %</en>
1348 %<*ja>
1349 \caption{文字範囲 6 に指定されている Unicode ブロック.}
1350 %</ja>
1351 \label{table-rng6}
1352 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1353 \begin{center}\small
1354 \begin{tabular}{llll}
1355 %<*en>
1356 "2460--"24FF&Enclosed Alphanumerics&
1357 "2E80--"2EFF&CJK Radicals Supplement\\
1358 "3000--"303F&CJK Symbols and Punctuation&
1359 "3040--"309F&Hiragana\\
1360 "30A0--"30FF&Katakana&
1361 "3190--"319F&Kanbun\\
1362 "31F0--"31FF&Katakana Phonetic Extensions&
1363 "3200--"32FF&Enclosed CJK Letters and Months\\
1364 "3300--"33FF&CJK Compatibility&
1365 "3400--"4DBF&CJK Unified Ideographs Extension A\\
1366 "4E00--"9FFF&CJK Unified Ideographs&
1367 "F900--"FAFF&CJK Compatibility Ideographs\\
1368 "FE10--"FE1F&Vertical Forms&
1369 "FE30--"FE4F&CJK Compatibility Forms\\
1370 "FE50--"FE6F&Small Form Variants&
1371 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)
1372 %</en>
1373 %<*ja>
1374 "2460--"24FF&囲み英数字&
1375 "2E80--"2EFF&CJK部首補助\\
1376 "3000--"303F&CJKの記号及び句読点&
1377 "3040--"309F&平仮名\\
1378 "30A0--"30FF&片仮名&
1379 "3190--"319F&漢文用記号(返り点)\\
1380 "31F0--"31FF&片仮名拡張&
1381 "3200--"32FF&囲みCJK文字・月\\
1382 "3300--"33FF&CJK互換用文字&
1383 "3400--"4DBF&CJK統合漢字拡張A\\
1384 "4E00--"9FFF&CJK統合漢字&
1385 "F900--"FAFF&CJK互換漢字\\
1386 "FE10--"FE1F&縦書き形&
1387 "FE30--"FE4F&CJK互換形\\
1388 "FE50--"FE6F&小字形&
1389 "{20}000--"{2F}FFF&(追加多言語面)
1390 %</ja>
1391 \end{tabular}
1392 \end{center}
1393 \end{table}
1394 %<*en>
1395 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in  Adobe-Japan1-6.
1396 The block list is indicated in Table~\ref{table-rng7}.
1397 %</en>
1398 %<*ja>
1399 \item[範囲 7${}^{\text{J}}$] CJK 言語で用いられる文字のうち,Adobe-Japan1-6 に
1400                             含まれていないもの.
1401                             ブロックのリストは表~\ref{table-rng7} に示す.
1402 %</ja>
1403 \begin{table}[!tb]
1404 %<*en>
1405 \caption{Unicode blocks in predefined character range~7.}
1406 %</en>
1407 %<*ja>
1408 \caption{文字範囲 7 に指定されている Unicode ブロック.}
1409 %</ja>
1410 \label{table-rng7}
1411 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1412 \begin{center}\small
1413 \begin{tabular}{llll}
1414 %<*en>
1415 "1100--"11FF&Hangul Jamo&
1416 "2F00--"2FDF&Kangxi Radicals\\
1417 "2FF0--"2FFF&Ideographic Description Characters&
1418 "3100--"312F&Bopomofo\\
1419 "3130--"318F&Hangul Compatibility Jamo&
1420 "31A0--"31BF&Bopomofo Extended\\
1421 "31C0--"31EF&CJK Strokes&
1422 "A000--"A48F&Yi Syllables\\
1423 "A490--"A4CF&Yi Radicals&
1424 "A830--"A83F&Common Indic Number Forms\\
1425 "AC00--"D7AF&Hangul Syllables&
1426 "D7B0--"D7FF&Hangul Jamo Extended-B
1427 %</en>
1428 %<*ja>
1429 "1100--"11FF&ハングル字母&
1430 "2F00--"2FDF&康熙部首\\
1431 "2FF0--"2FFF&漢字構成記述文字&
1432 "3100--"312F&注音字母 (注音符号)\\
1433 "3130--"318F&ハングル互換字母&
1434 "31A0--"31BF&注音字母拡張\\
1435 "31C0--"31EF&CJKの筆画&
1436 "A000--"A48F&イ文字\\
1437 "A490--"A4CF&イ文字部首&
1438 "A830--"A83F&共通インド数字に準じるもの\\
1439 "AC00--"D7AF&ハングル音節文字&
1440 "D7B0--"D7FF&ハングル字母拡張B
1441 %</ja>
1442 \end{tabular}
1443 \end{center}
1444 \end{table}
1445 \end{description}
1446
1447
1448 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
1449 %<ja>\subsection{\Param{kanjiskip} と \Param{xkanjiskip}}
1450 \label{subs-kskip}
1451
1452 %<*en>
1453 \textbf{JAglue} is divided into the following three categories:
1454 %</en>
1455 %<*ja>
1456 \textbf{JAglue} は以下の3つのカテゴリに分類される:
1457 %</ja>
1458 \begin{itemize}
1459 %<*en>
1460 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
1461       around a Japanese character, this glue will be not inserted at the
1462       place.
1463 %</en>
1464 %<*ja>
1465 \item JFM で指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
1466       発行されていれば,このグルーは挿入されない.
1467 %</ja>
1468 %<*en>
1469 \item The default glue which inserted between two \textbf{JAchar}s (\Param{
1470       kanjiskip}).
1471 %</en>
1472 %<*ja>
1473 \item デフォルトで2つの \textbf{JAchar} の間に挿入されるグルー(\Param{kanjiskip}).
1474 %</ja>
1475 %<*en>
1476 \item The default glue which inserted between a \textbf{JAchar} and an
1477       \textbf{ALchar} (\Param{xkanjiskip}).
1478 %</en>
1479 %<*ja>
1480 \item デフォルトで \textbf{JAchar} と \textbf{ALchar} の間に挿入されるグルー(\Param{xkanjiskip}).
1481 %</ja>
1482 \end{itemize}
1483 %<*en>
1484 The value (a skip) of \Param{kanjiskip} or \Param{xkanjiskip} can be
1485 changed as the following.
1486 %</en>
1487 %<*ja>
1488 \Param{kanjiskip} や \Param{xkanjiskip} の値は以下のようにして変更可能である.
1489 %</ja>
1490 \begin{lstlisting}
1491 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
1492                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
1493 \end{lstlisting}
1494
1495 %<*en>
1496 It may occur that JFM contains the data of `ideal width of \Param{kanjiskip}'
1497 and/or `ideal width of \Param{xkanjiskip}'.
1498 To use these data from JFM, set the value of \Param{kanjiskip} or
1499 \Param{xkanjiskip} to \verb+\maxdimen+.
1500 %</en>
1501 %<*ja>
1502 JFM は「望ましい \Param{kanjiskip} の値」や「望ましい \Param{xkanjiskip} の値」を
1503 持っていることがある.
1504 これらのデータを使うためには,\Param{kanjiskip} や \Param{xkanjiskip} の値を
1505 \verb+\maxdimen+ の値に設定すればよい.
1506 %</ja>
1507
1508 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
1509 %<ja>\subsection{\Param{xkanjiskip} の設定の挿入}
1510
1511 %<*en>
1512 It is not desirable that \Param{xkanjiskip} is inserted into every
1513 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
1514 \Param{xkanjiskip} should not be inserted after opening parenthesis
1515 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
1516 %</en>
1517 %<*ja>
1518 \Param{xkanjiskip} がすべての \textbf{JAchar} と \textbf{ALchar} の境界に
1519 挿入されるのは望ましいことではない.例えば,\Param{xkanjiskip} は開き括弧の
1520 後には挿入されるべきではない(`(あ' と `(\hskip\ltjgetparameter{xkanjiskip}あ' を
1521 比べてみよ).
1522 %</ja>
1523
1524 %<*en>
1525 \LuaTeX-ja can control whether \Param{xkanjiskip} can be inserted
1526 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
1527 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
1528 %</en>
1529 %<*ja>
1530 \LuaTeX-ja では \Param{xkanjiskip} をある文字の前/後に挿入するかどうかを,
1531 \textbf{JAchar} に対しては \Param{jaxspmode} を,\textbf{ALchar} に対しては
1532 \Param{alxspmode} をそれぞれ変えることで制御することができる.
1533 %</ja>
1534 \begin{LTXexample}
1535 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
1536 pあq い!う
1537 \end{LTXexample}
1538
1539 %<*en>
1540 The second argument \texttt{preonly} means `the insertion of
1541 \Param{xkanjiskip} is allowed before this character, but not after'.
1542 the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{
1543 inhibit}. For the compatibility with \pTeX, natural numbers between
1544 0~and~3 are also allowed as the second argument\footnote{But we don't
1545 recommend this: since numbers 1~and~2 have opposite meanings in
1546 \Param{jaxspmode} and \Param{alxspmode}.}.
1547 %</en>
1548 %<*ja>
1549 2つ目のの引数の \texttt{preonly} は「\Param{xkanjiskip} の挿入はこの文字の前でのみ
1550 許され,後では許さない」ことを意味する.他に指定可能な値は \texttt{postonly},
1551 \texttt{allow}, \texttt{inhibit} である.\pTeX との互換性のために,
1552 0から3の自然数を2つ目の引数として指定することも可能である\footnote{しかし,
1553 これは推奨されない:なぜならば 1 と 2 は \Param{jaxspmode} と \Param{alxspmode} で
1554 逆の意味になるから.}.
1555 %</ja>
1556
1557 %<*en>
1558 If you want to enable/disable all insertions of \Param{kanjiskip} and
1559 \Param{xkanjiskip}, set \Param{autospacing} and \Param{autoxspacing}
1560 parameters to \texttt{true}/\texttt{false}, respectively.
1561 %</en>
1562 %<*ja>
1563 もし全ての \Param{kanjiskip} と \Param{xkanjiskip} の挿入を有効化/無効化
1564 したければ,それぞれ \Param{autospacing} と \Param{autoxspacing} を
1565 \texttt{true}/\texttt{false} に設定すればよい.
1566 %</ja>
1567
1568 %<en>\subsection{Shifting Baseline}
1569 %<ja>\subsection{ベースラインの移動}
1570
1571 %<*en>
1572 To make a match between a Japanese font and an alphabetic font, sometimes
1573 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
1574 by setting \verb+\ybaselineshift+ to a non-zero length (the
1575 baseline of alphabetic fonts is shifted below). However, for documents
1576 whose main language is not Japanese, it is good to shift the baseline of
1577 Japanese fonts, but not that of alphabetic fonts.
1578 Because of this, \LuaTeX-ja can independently set the shifting amount
1579 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
1580 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
1581 parameter).
1582 %</en>
1583 %<*ja>
1584 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
1585 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで
1586 なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない
1587 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
1588 このため,\LuaTeX-ja では欧文フォントのベースラインのシフト量
1589 (\Param{yalbaselineshift} パラメータ)と和文フォントのベースラインのシフト量
1590 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
1591 %</ja>
1592
1593 \begin{LTXexample}
1594 \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
1595 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
1596 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
1597 \end{LTXexample}
1598 %<*en>
1599 Here the horizontal line in above is the baseline of a line.
1600 %</en>
1601 %<*ja>
1602 上の例において引かれている水平線がベースラインである.
1603 %</ja>
1604
1605 %<*en>
1606 There is an interesting side-effect: characters in different size can be
1607 vertically aligned center in a line, by setting two parameters appropriately.
1608 The following is an example (beware the value is not well tuned):
1609 %</en>
1610 %<*ja>
1611 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
1612 異なる文字を中心線に揃えることができるのだ.
1613 以下は一つの例である(値はあまり調整されていないことに注意):
1614 %</ja>
1615 \begin{LTXexample}
1616 xyz漢字
1617 {\scriptsize
1618   \ltjsetparameter{yjabaselineshift=-1pt,
1619     yalbaselineshift=-1pt}
1620   XYZひらがな
1621 }abcかな
1622 \end{LTXexample}
1623
1624
1625 %<en>\subsection{Cropmark}
1626 %<ja>\subsection{トンボ}
1627
1628 %<*en>
1629 Cropmark is a mark for indicating 4~corners and horizontal/vertical
1630 center of the paper. In Japanese, we call cropmark as tombo(w).
1631 \pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel.
1632 The following steps are needed to typeset cropmark:
1633 %</en>
1634 %<*ja>
1635 トンボは用紙の四つ角と水平/垂直方向の中心を表す印である.
1636 \pLaTeX と \LuaTeX-ja ではトンボの出力をサポートしている.
1637 トンボを出力するためには以下の手順が必要である:
1638 %</ja>
1639
1640 \begin{enumerate}
1641 %<*en>
1642 \item First, define the banner which will be printed at the upper left
1643       of the paper. This is done by assigning a token list to
1644       \verb+\@bannertoken+.
1645
1646 For example, the following sets banner as `\texttt{filename (YYYY-MM-DD hh:mm)}':
1647 %</en>
1648 %<*ja>
1649 \item まず,用紙の左上に印刷されるバナーを定義する.これは \verb+\@bannertoken+
1650       にトークンリストを与えることでなされる.
1651
1652 例えば,以下はバナーとして `\texttt{filename (YYYY-MM-DD hh:mm)}' を設定する:
1653 %</ja>
1654
1655 \begin{verbatim}
1656 \makeatletter
1657
1658 \hour\time \divide\hour by 60 \@tempcnta\hour \multiply\@tempcnta 60\relax
1659 \minute\time \advance\minute-\@tempcnta
1660 \@bannertoken{%
1661    \jobname\space(\number\year-\two@digits\month-\two@digits\day
1662    \space\two@digits\hour:\two@digits\minute)}%
1663 \end{verbatim}
1664
1665 \item ...
1666 \end{enumerate}
1667
1668
1669 %<en>\part{Reference}
1670 %<ja>\part{リファレンス}
1671 \label{part-ref}
1672 %<en>\section{Font Metric and Japanese Font}
1673 %<ja>\section{フォントメトリックと和文フォント}
1674 %<en>\subsection{\texttt{\char92jfont} primitive}
1675 %<ja>\subsection{\texttt{\char92jfont} プリミティブ}
1676
1677 %<*en>
1678 To load a font as a Japanese font, you must use the
1679 \verb+\jfont+ primitive instead of~\verb+\font+, while
1680 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
1681 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
1682 so TrueType/OpenType fonts with features can be used for Japanese fonts:
1683 %</en>
1684 %<*ja>
1685 フォントを和文フォントとして読み込むためには,\verb+\jfont+ プリミティブを
1686 \verb+\font+ プリミティブの代わりに用いる.
1687 \verb+\jfont+ プリミティブの文法は \verb+\font+ と同じである.
1688 \LuaTeX-ja は \Pkg{luaotfload} パッケージを自動的に読み込むので,
1689 TrueType/OpenType フォントに feature を指定したものを和文フォントとして用いる
1690 ことができる:
1691 %</ja>
1692 \begin{LTXexample}
1693 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
1694   +trad;-kern;jfm=ujis} at 14pt
1695 \tradgt{}当/体/医/区
1696 \end{LTXexample}
1697
1698 %<*en>
1699 Note that the defined control sequence
1700 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
1701 \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+
1702 causes a error.  We denote control sequences which are defined in
1703 \verb+\jfont+ by <jfont\_cs>.
1704 %</en>
1705 %<*ja>
1706 なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+)
1707 は \textit{font\_def} トークンではないので,\verb+\fontname\tradgt+ のような
1708 入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された
1709 コントロールシーケンスを <jfont\_cs> で表す.
1710 %</ja>
1711
1712 %<en>\paragraph{Prefix \texttt{psft}}
1713 %<ja>\paragraph{\texttt{psft} プレフィックス}
1714 %<*en>
1715 Besides \texttt{file:}\ and \texttt{name:}\ prefixes, \texttt{psft:}\
1716 can be used a prefix in \verb+\jfont+ (and~\verb+\font+) primitive.
1717 Using this prefix, you can specify a `name-only' Japanese font which
1718 will be not embedded to PDF. Typical use of this prefix is to specify
1719 the `standard' Japanese fonts, namely, `Ryumin-Light' and
1720 `GothicBBB-Medium'. For kerning or other information, that of Kozuka
1721 Mincho Pr6N Regular (this is a font by Adobe Inc., and included in
1722 Japanese Font Packs for Adore Reader) will be used.
1723 %</en>
1724 %<*ja>
1725 \texttt{file:} と \texttt{name:} のプレフィックスに加えて,
1726 \verb+\jfont+ プリミティブ(と \verb+\font+ プリミティブ)では
1727 \texttt{psft:} プレフィックス用いることができる.
1728 このプレフィックスを用いることで,PDF には埋め込まれない「名前だけの」
1729 和文フォントを指定することができる.典型的な使い方は「標準的な」和文フォント,
1730 つまり `Ryumin-Light' と `GothicBBB-Medium' を指定することである.
1731 この場合,カーニング他の情報は小塚明朝 Pr6N Regular
1732 (Adobe 社によるフォントで,Adobe Reader の日本語フォントパックに含まれている)
1733 が用いられる.
1734 %</ja>
1735
1736 \paragraph{JFM}
1737 %<*en>
1738 As noted in Introduction, a JFM has measurements of characters and
1739 glues/kerns that are automatically inserted for Japanese
1740 typesetting. The structure of JFM will be described in the next
1741 subsection. At the calling of \verb+\jfont+ primitive, you must specify
1742 which JFM will be used for this font by the following keys:
1743 %</en>
1744 %<*ja>
1745 「はじめに」の節で述べたように,JFM は文字と和文組版で自動的に挿入される
1746 グルー/カーンの寸法情報を持っている.JFM の構造は次の小節で述べる.
1747 \verb+\jfont+ プリミティブの呼び出しの際には,どの JFM を用いるのかを以下のキーで
1748 指定する必要がある:
1749 %</ja>
1750
1751 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
1752 \item[jfm=<name>]
1753 %<*en>
1754 Specify the name of JFM. A file named \texttt{jfm-<name>.lua} will be searched
1755 and/or loaded.
1756
1757 The followings are JFMs shipped with \LuaTeX-ja:
1758 %</en>
1759 %<*ja>
1760 JFM の名前を指定する.ファイル名が \texttt{jfm-<name>.lua} のものを探し,
1761 もし存在すればそれを読み込む.
1762
1763 以下の JFM が \LuaTeX-ja には同梱されている:
1764 %</ja>
1765 \begin{description}
1766 %<*en>
1767 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
1768   based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
1769   is used in \upTeX. When you use the \Pkg{luatexja-otf} package, please use this JFM.
1770 %</en>
1771 %<*ja>
1772 \item[\tt jfm-ujis.lua] \LuaTeX-ja の標準 JFM である.この JFM は \upTeX で
1773   用いられる UTF/OTF パッケージ用のメトリックである \verb+upnmlminr-h.tfm+ を
1774   元にしている.\Pkg{luatexja-otf} パッケージを使うときはこの JFM を指定して
1775   下さい.
1776 %</ja>
1777 %<*en>
1778 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font
1779   metric' which is widely used in \pTeX. A major difference of
1780   \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
1781   most characters under \texttt{jfm-ujis.lua} are square-shaped,
1782   while that under \texttt{jfm-jis.lua} are horizontal
1783   rectangles.
1784 %</en>
1785 %<*ja>
1786 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JIS フォントメトリック」
1787   \verb+jis.tfm+ に相当する JFM である.\texttt{jfm-ujis.lua} とこの
1788   \texttt{jfm-jis.lua} の主な違いは,\texttt{jfm-ujis.lua} ではほとんどの文字が
1789   正方形状であるのに対し,\texttt{jfm-jis.lua} では横長の長方形状である.
1790 %</ja>
1791 %<*en>
1792 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
1793   of the default Japanese font metric shipped with \pTeX. There
1794   are notable difference between this JFM and other 2~JFMs, as
1795   shown in Table~\ref{tab-difjfm}.
1796 %</en>
1797 %<*ja>
1798 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文フォントメトリック
1799   である \verb+min10.tfm+ に相当する JFM である.この JFM と他の2つの JFM の間には
1800   表 \ref{tab-difjfm} に示すような特筆すべき違いがある.
1801 %</ja>
1802 \end{description}
1803
1804 \item[jfmvar=<string>] Sometimes there is a need that
1805 \end{list}
1806
1807 \begin{table}[t]
1808 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
1809 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
1810 \label{tab-difjfm}
1811 \ltjsetparameter{jacharrange={+3}}
1812 \begin{center}
1813 \def\r#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1814 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
1815 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
1816 \vrule height 0pt depth \dp0}}
1817 \def\s#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1818 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
1819 \def\t#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 19.24432pt \g
1820 \setbox0=\hbox{漢}%
1821 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
1822 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
1823 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1824 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1825 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
1826 \begin{tabular}{rccc}
1827 \toprule
1828 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
1829 \midrule
1830 %<en>Example~1
1831 %<ja>例1
1832 &\r{ujis}&\r{jis}&\r{min}\\
1833 %<en>Example~2
1834 %<ja>例2
1835 &\s{ujis}&\s{jis}&\s{min}\\
1836 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
1837 \bottomrule
1838 \end{tabular}
1839 \end{center}
1840 \ltjsetparameter{jacharrange={-3}}
1841 \end{table}
1842
1843 %<en>\paragraph{Note: kern feature}
1844 %<ja>\paragraph{注意:kern feature}
1845 \label{para-kern}
1846 %<*en>
1847 Some fonts have information for inter-glyph spacing. However, this
1848 information is not well-compatible with \LuaTeX-ja.  More concretely,
1849 this kerning space from this information are inserted \emph{before} the
1850 insertion process of \textbf{JAglue}, and this causes incorrect spacing
1851 between two characters when both a glue/kern from the data in the font
1852 and it from JFM are present.
1853 %</en>
1854 %<*ja>
1855 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
1856 この情報は \LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
1857 されるカーニングスペースは \textbf{JAglue} の挿入過程の\textbf{前に}挿入され,
1858 JFM に基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
1859 なる.
1860 %</ja>
1861
1862 \begin{itemize}
1863 %<*en>
1864 \item You should specify \texttt{-kern} in
1865   \verb+jfont+ primitive, when you want to use other font features,
1866   such as \texttt{script=...}\,.
1867 %</en>
1868 %<*ja>
1869 \item  \texttt{script=...} といった feature を使いたい場合には,\verb+\jfont+
1870   プリミティブに \texttt{-kern} を指定するべきである.
1871 %</ja>
1872 %<*en>
1873 \item If you want to use Japanese fonts in proportional width, and use
1874       information from this font, use \texttt{jfm-prop.lua} for its JFM, and ...
1875 %</en>
1876 %<*ja>
1877 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
1878   ならば,\texttt{jfm-prop.lua} を JFM として指定し,……
1879 %</ja>
1880
1881 TODO: kanjiskip?
1882 \end{itemize}
1883
1884
1885 %<en>\subsection{Structure of JFM file}
1886 %<ja>\subsection{JFM ファイルの構造}
1887 A JFM file is a Lua script which has only one function call:
1888 \begin{verbatim}
1889 luatexja.jfont.define_jfm { ... }
1890 \end{verbatim}
1891 Real data are stored in the table which indicated above by
1892 \verb+{ ... }+.  So, the rest of this subsection are devoted to describe the
1893 structure of this table.  Note that all lengths in a JFM file are
1894 floating-point numbers in design-size unit.
1895
1896 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
1897 \item[dir=<direction>] (required)
1898
1899 The direction of JFM. At the present, only \texttt{'yoko'} is supported.
1900
1901 \item[zw=<length>] (required)
1902
1903 The amount of the length of the `full-width'.
1904
1905 \item[zh=<length>] (required)
1906
1907 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}] (optional)
1908
1909 This field specifies the `ideal' amount of \Param{kanjiskip}. As noted
1910              in Subsection~\ref{subs-kskip}, if the parameter
1911              \Param{kanjiskip} is \verb+\maxdimen+, the value specified
1912              in this field is actually used (if this field is not specified in
1913              JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
1914              fields are in design-size unit too.
1915
1916
1917 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}] (optional)
1918
1919 Like the \Param{kanjiskip} field, this field specifies the `ideal'
1920              amount of \Param{xkanjiskip}.
1921
1922 \end{list}
1923
1924 Besides from above fields, a JFM file have several sub-tables those
1925 indices are natural numbers.  The table indexed by~$i\in\omega$ stores
1926 information of `character class'~$i$. At least, the character class~0 is
1927 always present, so each JFM file must have a sub-table whose index is
1928 \texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
1929 the following fields:
1930
1931 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
1932 \item[chars=\{<character>, ...\}] (required except character class~0)
1933
1934 This field is a list of characters which are in this character
1935              type~$i$. This field is not required if $i=0$, since all
1936              \textbf{JAchar} which are not in any character class other
1937              than 0 (hence, the character class~0 contains most of
1938              \textbf{JAchar}s). In the list, a character can be
1939              specified by its code number, or by the character itself
1940              (as a string of length~1). Moreover, there are `imaginary
1941              characters' which specified in the list. We will describe these later.
1942
1943 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]\ (required)
1944
1945 Specify width of characters in character class~$i$, height, depth and
1946 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
1947 as values of these fields.
1948 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
1949
1950 \item[left=<length>, down=<length>, align=<align>]\
1951
1952 These fields are for adjusting the position of the `real' glyph. Legal
1953              values of \texttt{align} field are \texttt{'left'},
1954              \texttt{'middle'} and \texttt{'right'}. If one of these
1955              3~fields are omitted, \texttt{left} and \texttt{down} are
1956              treated as~0, and \texttt{align} field is treated as
1957              \texttt{'left'}.
1958 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
1959
1960 In most cases, \texttt{left} and \texttt{down} fields are~0, while
1961 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
1962 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
1963 when the current character class is the class for opening delimiters'.
1964 \begin{figure}[!tb]
1965 \begin{minipage}{0.4\textwidth}%
1966 \begin{center}\unitlength=10pt\small
1967 \begin{picture}(15,12)(-1,-4)
1968 \color{black!10!white}% real glyph :step1
1969 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
1970
1971 \color{red!20!white}% real glyph :step1
1972 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
1973
1974 \color{red}% real glyph
1975 \thicklines
1976 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
1977 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
1978 \put(-1,5.5){\line(1,0){6}}
1979 \put(-1,-4){\line(1,0){6}}
1980
1981 \color{green!20!white}% real glyph :step1
1982 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
1983
1984 \color{black}% real glyph :step1
1985 \thicklines
1986 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
1987 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
1988 \put(0,8){\line(1,0){12}}
1989 \put(0,-3){\line(1,0){12}}
1990 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
1991 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
1992 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
1993
1994 \color{green!50!black}% real glyph :step1
1995 \thicklines
1996 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
1997 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
1998 \put(3,7){\line(1,0){6}}
1999 \put(3,-2.5){\line(1,0){6}}
2000 \newsavebox{\eqdist}
2001 \savebox{\eqdist}(0,0)[b]{%
2002   \thinlines
2003   \put(-0.08,0.2){\line(0,-1){0.4}}%
2004   \put(0.08,0.2){\line(0,-1){0.4}}}
2005 \put(1.5,0){\usebox{\eqdist}}
2006 \put(10.5,0){\usebox{\eqdist}}
2007
2008 \color{blue}% shifted
2009 \thicklines
2010 \put(3,-1.5){\vector(-1,0){4}}
2011 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
2012 \put(3,0){\vector(0,-1){1.5}}
2013 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
2014 \end{picture}
2015 \end{center}
2016 \end{minipage}%
2017 \begin{minipage}{0.6\textwidth}%
2018 Consider a node containing Japanese character whose value of the \texttt{align}
2019 field is \texttt{'middle'}.
2020 \begin{itemize}
2021 \item The black rectangle is a frame of the node.
2022 Its width, height and depth are specified by JFM.
2023 \item Since the \texttt{align} field is \texttt{'middle'},
2024 the `real' glyph is centered horizontally (the green rectangle).
2025 \item Furthermore, the glyph is shifted according to values of fields
2026       \texttt{left} and \texttt{down}. The ultimate position of the real
2027       glyph is indicated by the red rectangle.
2028 \end{itemize}
2029 \end{minipage}
2030 \caption{The position of the `real' glyph.}
2031 \label{fig-pos}
2032 \end{figure}
2033
2034
2035 \item[kern={\{[$j$]=<kern>, ...\}}]
2036
2037 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
2038 \end{list}
2039
2040 %<*en>
2041 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
2042 \item['lineend'] An ending of a line.
2043 \item['diffmet'] Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
2044 \item['boxbdd'] The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
2045 \item['parbdd'] The beginning of an (indented) paragraph.
2046 \item['jcharbdd'] A boundary between \textbf{JAchar} and anything else
2047              (such as \textbf{ALchar}, kern, glue, ...).
2048 \item[$-1$] The left/right boundary of an inline math formula.
2049 \end{list}
2050 %</en>
2051
2052 %<*ja>
2053 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
2054 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
2055 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
2056 い組版調整ができるようになっている.以下でその一覧を述べる:
2057 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
2058 \item['lineend'] 行の終端を表す.
2059 \item['diffmet']
2060
2061 \item['boxbdd'] hboxの先頭と末尾,及びインデントされていない
2062              (\verb+\noindent+で開始された)段落の先頭を表す.
2063 \item['parbdd'] 通常の(\verb+\noindent+で開始されていない)段落の先頭.
2064 \item['jcharbdd'] 和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
2065 \item[$-1$] 行中数式と地の文との境界.
2066 \end{list}
2067
2068 \paragraph{\pTeX 用和文フォントメトリックの移植}
2069 以下に,\pTeX 用和文フォントメトリックを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
2070 \begin{itemize}
2071 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
2072 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
2073       トメトリック等を移植する場合は,
2074 \begin{itemize}
2075 \item JFM中の全ての数値を$1/0.962216$倍しておく.
2076 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
2077       \LaTeX でのフォント宣言なら,例えば次のように:
2078 \begin{verbatim}
2079 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
2080 \end{verbatim}
2081 \end{itemize}
2082 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
2083       (JFM中に単に書かなければよい).
2084 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
2085       文字クラスに関してはglue/kernの設定はしない.
2086
2087 これは,\pTeX では,
2088       hboxの先頭・末尾とインデントされていない(\verb+\noindent+で開始さ
2089       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
2090 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
2091
2092 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
2093       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
2094       は,段落の最初に手動で\verb+\inhibitglue+を追加するか,あるいは
2095       \verb+\everypar+のhackを行い,それを自動化させるしかなかった.
2096
2097 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
2098 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
2099 \texttt{'parbdd'}を入れれば全角下がりとなる.
2100
2101 \ltjsetparameter{jacharrange={+3}}
2102 \begin{LTXexample}
2103 \jfont\g=psft:Ryumin-Light:jfm=test \g
2104 \parindent1\zw\noindent{}◆◆◆◆◆
2105 \par{}「◆◆←二分下がり
2106 \par{}【◆◆←全角下がり
2107 \par{}〔◆◆←全角二分下がり
2108 \end{LTXexample}
2109 \end{itemize}
2110 \ltjsetparameter{jacharrange={-3}}
2111 %</ja>
2112
2113 %<en>\subsection{Math Font Family}
2114 %<ja>\subsection{数式フォントファミリ}
2115 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
2116 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX can handles 256~families, but
2117 an external package is needed to support this in plain \TeX\ and
2118 \LaTeX.}, and each family has three fonts:
2119 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
2120
2121 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
2122 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
2123 font families. There is no relation between the value of
2124 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
2125 you can set both \verb+\fam+ and \verb+\jfam+ to~the same value.
2126
2127 \begin{table}[!tb]
2128 \caption{Primitives for Japanese math fonts.}
2129 \label{tab-math}
2130 \begin{center}\def\{{\char`\{}\def\}{\char`\}}
2131 \begin{tabular}{lll}
2132 \toprule
2133 &Japanese fonts&alphabetic fonts\\
2134 \midrule
2135 font family&\verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
2136 text size&\tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
2137 script size&\tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
2138 scriptscript size&\tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
2139 \bottomrule
2140 \end{tabular}
2141 \end{center}
2142 \end{table}
2143
2144 %<en>\subsection{Callbacks}
2145 %<ja>\subsection{コールバック}
2146 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
2147 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks
2148 \begin{list}{}%
2149 {\def\makelabel#1{\bfseries#1}}
2150 \item[\texttt{luatexja.load\_jfm} callback]
2151 With this callback you can overwrite JFMs.
2152 This callback is called when a new JFM is loaded.
2153
2154 \begin{verbatim}
2155 function (<table> jfm_info, <string> jfm_name)
2156   return <table> new_jfm_info
2157 end
2158 \end{verbatim}
2159
2160 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
2161 this argument has \texttt{chars} field which contains character codes
2162              whose character class is not~0.
2163
2164 An example of this callback is the \texttt{ltjarticle} class, with
2165              forcefully assigning character class~0 to \texttt{'parbdd'}
2166              in the JFM \texttt{jfm-min.lua}. This callback doesn't
2167              replace any code of \LuaTeX-ja.
2168
2169 \item[\texttt{luatexja.define\_font} callback]
2170 This callback and the next callback form a pair, and you can assign letters which don't have
2171              fixed code points in Unicode to non-zero character classes.
2172 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
2173 \begin{verbatim}
2174 function (<table> jfont_info, <number> font_number)
2175   return <table> new_jfont_info
2176 end
2177 \end{verbatim}
2178
2179 You may assume that \verb+jfont_info+ has the following fields:
2180 \begin{description}
2181 \item[\tt jfm] The index number of JFM.
2182 \item[\tt size] Font size in a scaled point (${}=2^{-16}\,\textrm{pt}$).
2183 \item[\tt var] The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
2184 \end{description}
2185
2186 The returned table \verb+new_jfont_info+ also should include these three fields.
2187 The \verb+font_number+ is a font number.
2188
2189 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
2190              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
2191              CID characters in a JFM. This callback doesn't replace any
2192              code of \LuaTeX-ja.
2193
2194
2195 \item[\texttt{luatexja.find\_char\_class} callback]
2196 This callback is called just when \LuaTeX-ja inready to determine which
2197              character class a character \verb+chr_code+ belongs.
2198 A function used in this callback should be in the following form:
2199 \begin{lstlisting}[numbers=left]
2200 function (<number> char_class, <table> jfont_info, <number> chr_code)
2201   if char_class~=0 then return char_class
2202   else
2203     ....
2204     return (<number> new_char_class or 0)
2205   end
2206 end
2207 \end{lstlisting}
2208
2209 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
2210              routine or previous function calls in this callback, hence
2211              this argument may not be 0. Moreover, the returned
2212              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
2213              is not~0, otherwise you will overwrite the \LuaTeX-ja's
2214              default routine.
2215
2216 This callback doesn't replace any code of \LuaTeX-ja.
2217
2218 \item[\texttt{luatexja.set\_width} callback]
2219 This callback is called when \LuaTeX-ja is trying to encapsule a
2220              \textbf{JAchar} \textit{glyph\_node}, to adjust its
2221              dimension and position.
2222 \begin{lstlisting}[numbers=left]
2223 function (<table> shift_info, <table> jfont_info, <number> char_class)
2224   return <table> new_shift_info
2225 end
2226 \end{lstlisting}
2227
2228 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
2229 \texttt{down} and \texttt{left} fields, which are the amount of shifting
2230              down/left the character in a scaled-point.
2231
2232 %<*ja>
2233 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
2234              JFM内で規定された文字クラス0の文字における$(\hbox{高
2235              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
2236              下位置が自動調整される.例えば,
2237 \begin{itemize}
2238 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
2239 (和文OpenTypeフォントの標準値)
2240 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
2241 \end{itemize}
2242 となっていたとする.すると,実際の文字の出力位置は,
2243 \[
2244  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{825}y= 0.03\dot1\dot5y
2245 \]
2246 だけ上にずらされることになる,
2247 %</ja>
2248 \end{list}
2249
2250
2251
2252 %<en>\section{Parameters}
2253 %<ja>\section{パラメータ}
2254 %<en>\subsection{\texttt{\char92 ltjsetparameter} primitive}
2255 %<ja>\subsection{\texttt{\char92 ltjsetparameter} プリミティブ}
2256 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
2257 primitives for accessing most parameters of \LuaTeX-ja. One of the main
2258 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
2259 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
2260 is the position of \verb+hpack_filter+ callback in the source
2261 of \LuaTeX, see Section~\ref{sec-para}.
2262
2263 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives
2264 for assigning parameters. These take one argument which is a
2265 \texttt{<key>=<value>} list. Allowed keys are described in the next
2266 subsection.
2267 The difference between
2268 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
2269 scope of assignment;
2270 \verb+\ltjsetparameter+ does a local assignment and
2271 \verb+\ltjglobalsetparameter+ does a global one.
2272 They also obey the value of \verb+\globaldefs+,
2273 like other assignment.
2274
2275 \verb+\ltjgetparameter+ is the primitive for acquiring parameters. It
2276 always takes a parameter name as first argument, and also takes the
2277 additional argument---a character code, for example---in some cases.
2278 \begin{LTXexample}
2279 \ltjgetparameter{differentjfm},
2280 \ltjgetparameter{autospacing},
2281 \ltjgetparameter{prebreakpenalty}{`)}.
2282 \end{LTXexample}
2283 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
2284 always a string}. This is outputted by \texttt{tex.write()}, so any
2285 character other than space~`\texttt{\char32}'~(U+0020) has the category code
2286 12~(other), while the space has 10~(space).
2287
2288 %<en>\subsection{List of Parameters}
2289 %<ja>\subsection{パラメータ一覧}
2290 The following is the list of parameters which can be specified by the
2291 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
2292 in \pTeX, and symbols beside each parameter has the following meaning:
2293 \begin{itemize}
2294 \item No mark: values at the end of the paragraph or the hbox are
2295       adopted in the whole paragraph/hbox.
2296 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
2297 \item `\dagger': assignments are always global.
2298 \end{itemize}
2299
2300 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
2301 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
2302
2303 Penalty value for suppressing orphans. This penalty is inserted just
2304              after the last \textbf{JAchar} which is not regarded as a
2305              (Japanese) punctuation mark.
2306
2307 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
2308
2309 An additional attributes having each character whose character code is <chr\_code>.
2310 At the present version, the lowermost bit of <natural number> indicates
2311              whether the character is considered as a punctuation mark
2312              (see the description of \Param{jcharwidowpenalty} above).
2313
2314
2315 \item[\Param{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
2316 %<*ja>
2317 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
2318              この文字の前に挿入/追加されるペナルティの量を指定する.
2319
2320 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,標準で読み込まれる
2321              \texttt{luatexja-kinsoku.tex}において
2322 \begin{verbatim}
2323 \ltjsetparameter{prebreakpenalty={`〙,10000}}
2324 \end{verbatim}
2325 と,最大値の10000が指定されている.他にも,小書きのカナなど,絶対禁止とい
2326              うわけではないができれば行頭にはきて欲しくない場合に,0と
2327              10000の間の値を指定するのも有用であろう.
2328 \begin{verbatim}
2329 \ltjsetparameter{prebreakpenalty={`ゕ,150}}
2330 \end{verbatim}
2331 %</ja>
2332
2333 \item[\Param{postbreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
2334 %<*ja>
2335 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
2336              この文字の後に挿入/追加されるペナルティの量を指定する.
2337
2338 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
2339 \begin{itemize}
2340 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
2341       た(後から指定した方で上書きされる).
2342 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
2343 \end{itemize}
2344 という制限があったが,\LuaTeX-ja ではこれらの制限は解消されている.
2345 %</ja>
2346
2347 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\textfont+ in \TeX]
2348 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\scriptfont+ in \TeX]
2349 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\scriptscriptfont+ in \TeX]
2350 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
2351 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
2352
2353 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
2354
2355 Setting whether inserting  \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
2356 The followings are allowed for <mode>:
2357 \begin{description}
2358 \item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
2359 \item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
2360 \item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
2361 \item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character.
2362 This is the default value.
2363 \end{description}
2364 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
2365
2366
2367 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
2368
2369 Setting whether inserting \Param{xkanjiskip} is allowed before/after a
2370              \textbf{ALchar} whose character code is <chr\_code>.
2371 The followings are allowed for <mode>:
2372 \begin{description}
2373 \item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited
2374            before the character, nor after the character.
2375 \item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed
2376            before the character, but not after.
2377 \item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed
2378            after the character, but not before.
2379 \item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed both
2380            before the character and after the character.
2381 This is the default value.
2382 \end{description}
2383 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
2384
2385 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
2386 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
2387 \item[\Param{kanjiskip}\,=<skip>] [\verb+\kanjiskip+]
2388 \item[\Param{xkanjiskip}\,=<skip>] [\verb+\xkanjiskip+]
2389
2390 \item[\Param{differentjfm}\,=<mode>$^\dagger$]
2391
2392 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
2393 The allowed arguments are the followings:
2394 \begin{description}
2395 \item[\texttt{average}]
2396 \item[\texttt{both}]
2397 \item[\texttt{large}]
2398 \item[\texttt{small}]
2399 \end{description}
2400
2401 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
2402 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
2403 \end{list}
2404
2405
2406 %<en>\section{Other Primitives}
2407 %<ja>\section{その他のプリミティブ}
2408 %<en>\subsection{Primitives for Compatibility}
2409 %<ja>\subsection{互換プリミティブ}
2410 The following primitives are implemented for compatibility with \pTeX:
2411 \begin{list}{}{\def\makelabel{\ttfamily\char92 }}
2412 \item[kuten]
2413 \item[jis]
2414 \item[euc]
2415 \item[sjis]
2416 \item[ucs]
2417 \item[kansuji]
2418 \end{list}
2419 %<en>\subsection{\texttt{\char92 inhibitglue} primitive}
2420 %<ja>\subsection{\texttt{\char92 inhibitglue} プリミティブ}
2421 The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
2422 The following is an example, using a special JFM that there will be a glue between
2423 the beginning of a box and `あ', and also between `あ' and `ウ'.
2424
2425 \begin{LTXexample}
2426 \jfont\g=psft:Ryumin-Light:jfm=test \g
2427 あウあ\inhibitglue{}ウ\inhibitglue\par
2428 あ\par\inhibitglue{}あ
2429 \par\inhibitglue\hrule{}あoff\inhibitglue ice
2430 \end{LTXexample}
2431
2432 With the help of this example, we remark the specification of \verb+\inhibitglue+:
2433 \begin{itemize}
2434 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
2435       effective at the beginning of the next paragraph. This is realized
2436       by hacking \verb+\everypar+.
2437 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
2438       mode is only effective on the spot; does not get over boundary of
2439       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
2440       kernings, as shown in line~4 of above example.
2441 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
2442 \end{itemize}
2443
2444 %<en>\section{Control Sequences for \LaTeXe}
2445 %<ja>\section{\LaTeXe 用のコントロールシーケンス}
2446 %<en>\subsection{Patch for NFSS2}
2447 %<ja>\subsection{NFSS2 へのパッチ}
2448 \label{ssub-nfsspat}
2449 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
2450 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
2451 For an convenience, we will describe
2452 commands which are not described in Subsection~\ref{ssub-chgfnt}.
2453
2454 \begin{cslist}%
2455 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
2456 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
2457              and Japanese font families is only made by its
2458              encoding. For example, encodings OT1 and T1 are for
2459              alphabetic font families, and a Japanese font family cannot
2460              have these encodings. This command defines a new encoding
2461              scheme for Japanese font family (in horizontal direction).
2462
2463 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
2464 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
2465 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
2466
2467 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
2468
2469 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
2470 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
2471 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>と,和文数式用フォ
2472              ントファミリ変更の命令<ja-cmd>の2つを同時に行う命令として
2473              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
2474              <al-cmd>に同じものを指定する,すなわち,<al-cmd>に和文側も変
2475              更させるようにするのが一般的と思われる.
2476
2477 本コマンドの使用については,\pLaTeX 配布中の\texttt{plfonts.dtx}に詳しく
2478              注意点が述べられているので,そちらを参照されたい.
2479
2480 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
2481   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
2482 %<*en>
2483 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
2484 with respect to a Japanese font family given by the former 4~arguments.
2485 %</en>
2486 %<*ja>
2487 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
2488 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
2489 %</ja>
2490 \item[SetRelationFont]
2491 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
2492 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
2493 \item[userelfont]
2494 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
2495              font family with respect to current Japanese font family,
2496              which was set by
2497              \verb+\DeclareRelationFont+ or \verb+SetRelationFont+.
2498 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
2499
2500 \item[adjustbaseline]
2501 ...
2502
2503 \item[fontfamily\{<family>\}]
2504 {\let\item\origitem
2505 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
2506 to <family>. Which family will be changed is determined as follows:
2507 \begin{itemize}
2508 \item Let current encoding scheme for Japanese fonts be
2509       <ja-enc>. Current Japanese font family will be changed to
2510       <family>, if one of the following two conditions is met:
2511 \begin{itemize}
2512 \item The family <fam> under the encoding <ja-enc> is already defined by
2513       \verb+\DeclareKanijFamily+.
2514 \item A font definition named \texttt{<enc><ja-enc>.fd} (the file name is
2515       all lowercase) exists.
2516 \end{itemize}
2517 \item Let current encoding scheme for Japanese fonts be
2518       <al-enc>. For alphabetic font family, the criterion as above is used.
2519 \item There is a case which none of the above applies, that is, the font
2520       family named <family> doesn't seem to be defined neither under the
2521       encoding <ja-enc>, nor under <al-enc>.
2522
2523 In this case, the default family for font substitution is used for
2524       alphabetic and Japanese fonts. Note that current encoding will not
2525       be set to <family>, unlike the original implementation in \LaTeX.
2526 \end{itemize}
2527 }
2528 \end{cslist}
2529
2530 As closing this subsection, we shall introduce an example of
2531 \verb+SetRelationFont+ and \verb+\userelfont+:
2532 \begin{LTXexample}
2533 \gtfamily{}あいうabc
2534 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
2535 \userelfont\selectfont{}あいうabc
2536 \end{LTXexample}
2537
2538
2539 %<en>\subsection{Cropmark/`tombow'}
2540 %<ja>\subsection{トンボ}
2541
2542 %<en>\section{Extensions}
2543 %<ja>\section{拡張}
2544 \subsection{\texttt{luatexja-fontspec.sty}}
2545
2546 \subsection{\texttt{luatexja-otf.sty}}
2547 This optional package supports typesetting characters in
2548 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
2549 commands:
2550 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
2551 \item[\char92CID\{<number>\}]
2552 Typeset a character whose CID number is <number>.
2553 \item[\char92UTF\{<hex\_number>\}]
2554 Typeset a character whose character code is <hex\_number> (in hexadecimal).
2555 This command is similar to \verb+\char"+<hex\_number>,\ %"
2556 but please remind remarks below.
2557 \end{list}
2558
2559 \paragraph{Remarks}
2560 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
2561 ordinary characters in the following points:
2562 \begin{itemize}
2563 \item Always treated as \textbf{JAchar}s.
2564 \item Processing codes for supporting OpenType features (\textit{e.g.},
2565       glyph replacement and kerning) by the \Pkg{luaotfload} package
2566       is not performed to these characters.
2567 \end{itemize}
2568
2569
2570 \paragraph{Additionally Syntax of JFM}
2571 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
2572 chars} table in JFM now allows a string in the form
2573 \verb+'AJ1-xxx'+, which stands for the character
2574 whose CID number in Adobe-Japan1 is \verb+xxx+.
2575
2576 %<en>\part{Implementations}
2577 %<ja>\part{実装}
2578 \label{part-imp}
2579 %<en>\section{Storing Parameters}
2580 %<ja>\section{パラメータの保持}
2581 \label{sec-para}
2582 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
2583 %<ja>\subsection{用いられる寸法レジスタ,属性レジスタ,whatsit ノード}
2584 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
2585 \begin{list}{}{%
2586 \def\makelabel{\ttfamily}
2587 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
2588 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
2589 }
2590
2591 \dim{jQ}
2592 As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to
2593                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
2594                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
2595 \dim{jH}
2596 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
2597                         used in Japanese phototypesetting. This
2598                         \verb+\jH+ is a synonym of \verb+\jQ+.
2599 \dim{ltj@zw} A temporal register for the `full-width' of current Japanese font.
2600 \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.
2601 \attr{jfam} Current number of Japanese font family for math formulas.
2602 \attr{ltj@curjfnt} The font index of current Japanese font.
2603 \attr{ltj@charclass} The character class of Japanese \textit{glyph\_node}.
2604 \attr{ltj@yablshift} The amount of shifting the baseline of alphabetic
2605                         fonts in scaled point ($2^{-16}\,\textrm{pt}$).
2606 \attr{ltj@ykblshift} The amount of shifting the baseline of Japanese
2607                         fonts in scaled point ($2^{-16}\,\textrm{pt}$).
2608 \attr{ltj@autospc} Whether the auto insertion of \Param{kanjiskip} is allowed at the node.
2609 \attr{ltj@autoxspc} Whether the auto insertion of \Param{xkanjiskip} is allowed at the node.
2610 \attr{ltj@icflag} An attribute for distinguishing `kinds' of a node. One of the following value is
2611                         assigned to this attribute:
2612 \begin{description}
2613 \item[\textit{italic} (1)] Glues from an italic correction
2614            (\verb+\/+). This distinction of origins of glues
2615            (from explicit \verb+\kern+, or from \verb+\/+)
2616            is needed in the insertion process of \Param{xkanjiskip}.
2617 \item[\textit{packed} (2)]
2618 \item[\textit{kinsoku} (3)] Penalties inserted for the word-wrapping  process of Japanese characters (\emph{kinsoku}).
2619 \item[\textit{from\_jfm} (4)] Glues/kerns from JFM.
2620 \item[\textit{line\_end} (5)] Kerns for ...
2621 \item[\textit{kanji\_skip} (6)] Glues for \Param{kanjiskip}.
2622 \item[\textit{xkanji\_skip} (7)] Glues for \Param{xkanjiskip}.
2623 \item[\textit{processed} (8)] Nodes which is already processed by ...
2624 \item[\textit{ic\_processed} (9)] Glues from an italic correction, but also already processed.
2625 \item[\textit{boxbdd} (15)] Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
2626 \end{description}
2627 \attr{ltj@kcat$i$} Where $i$~is a natural number which is less than~7.
2628 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
2629 \end{list}
2630
2631 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
2632 typesetting. All those nodes store a natural number (hence the node's
2633 \texttt{type} is 100).
2634 \begin{description}
2635 \item[30111] Nodes for indicating that \verb+\inhibitglue+ is
2636            specified. The \texttt{value} field of these nodes doesn't matter.
2637 \item[30112] Nodes for \LuaTeX-ja's stack system (see the next
2638            subsection). The \texttt{value} field of these nodes is
2639            current group.
2640 \item[30113] Nodes for Japanese Characters which the callback process of
2641            luaotfload won't be applied, and the character code is
2642            stored in the \texttt{value} field. Each node having this
2643            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
2644            the callback process of luaotfload.
2645 \end{description}
2646 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
2647
2648 %<en>\subsection{Stack System of \LuaTeX-ja}
2649 %<ja>\subsection{\LuaTeX-ja のスタックシステム}
2650 \label{ssec-stack}
2651 \paragraph{Background}
2652 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
2653 are stored in it.  To clarify the reason, imagine the parameter
2654 \Param{kanjiskip} is stored by a skip, and consider the following
2655 source:
2656 \begin{LTXexample}
2657 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
2658 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
2659 \box0.ぴよぴよ\par
2660 \end{LTXexample}
2661
2662 As described in Part~\ref{part-ref}, the only effective value of
2663 \Param{kanjiskip} in an hbox is the latest value, so the value of
2664 \Param{kanjiskip} which applied in the entire hbox should be 5\,pt.
2665 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
2666 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
2667 file in the source of \LuaTeX), there are the following codes:
2668 \begin{lstlisting}
2669 void package(int c)
2670 {
2671     scaled h;                   /* height of box */
2672     halfword p;                 /* first node in a box */
2673     scaled d;                   /* max depth */
2674     int grp;
2675     grp = cur_group;
2676     d = box_max_depth;
2677     unsave();
2678     save_ptr -= 4;
2679     if (cur_list.mode_field == -hmode) {
2680         cur_box = filtered_hpack(cur_list.head_field,
2681                                  cur_list.tail_field, saved_value(1),
2682                                  saved_level(1), grp, saved_level(2));
2683         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
2684 \end{lstlisting}
2685 Notice that \verb+unsave+ is executed \emph{before}
2686 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
2687 executed): so `5\,pt' in the above source is orphaned at
2688 \texttt+unsave+, and hence it can't be accessed from \verb+hpack_filter+
2689 callback.
2690
2691 \paragraph{The method}
2692 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
2693 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
2694
2695 These are two \TeX\ count registers for maintaining information:
2696 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
2697 the \TeX's group level when the last assignment was done.  Parameters
2698 are stored in one big table named \texttt{charprop\_stack\_table}, where
2699 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
2700 a new stack level is created by \verb+\ltjsetparameter+, all data of the
2701 previous level is copied.
2702
2703 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
2704 another thing: When a new stack level is about to be created, a whatsit
2705 node whose type, subtype and value are 44~(\textit{user\_defined}),
2706 30112, and current group level respectively is appended to the current
2707 list (we refer this node by \textit{stack\_flag}). This enables us to
2708 know whether assignment is done just inside a hbox. Suppose that the
2709 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
2710 group, then:
2711 \begin{itemize}
2712 \item If there is no \textit{stack\_flag} node in the list of hbox, then
2713       no assignment was occurred inside the hbox. Hence values of
2714       parameters at the end of the hbox are stored in the stack
2715       level~$s$.
2716 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
2717       an assignment was occurred just inside the hbox group. Hence
2718       values of parameters at the end of the hbox are stored in the
2719       stack level~$s+1$.
2720 \item If there are \textit{stack\_flag} nodes but all of their values
2721       are more than~$t+1$, then an assignment was occurred in the box,
2722       but it is done is `more internal' group. Hence values of
2723       parameters at the end of the hbox are stored in the stack
2724       level~$s$.
2725 \end{itemize}
2726
2727 Note that to work this trick correctly, assignments to
2728 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
2729 regardless the value of \verb+\globaldefs+.
2730 This problem is resolved by using
2731 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
2732
2733
2734 %<en>\section{Linebreak after Japanese Character}
2735 %<ja>\section{和文文字直後の改行}
2736 \label{sec-lbreak}
2737 %<en>\subsection{Reference: Behavior in \pTeX}
2738 %<ja>\subsection{参考: \pTeX の挙動}
2739 %<*en>
2740 In~\pTeX, a line break after a Japanese character doesn't emit a space,
2741 since words are not separated by spaces in Japanese writings. However,
2742 this feature isn't fully implemented in \LuaTeX-ja due to the
2743 specification of callbacks in~\LuaTeX. To clarify the difference between
2744 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
2745 this subsection.
2746
2747 \pTeX's input processor can be described in terms of a finite state
2748 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
2749 internal states are as follows:
2750 \begin{itemize}
2751 \item State~$N$: new line
2752 \item State~$S$: skipping spaces
2753 \item State~$M$: middle of line
2754 \item State~$K$: after a Japanese character
2755 \end{itemize}
2756 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
2757 processor.  State~$K$ is similar to state~$M$, and is entered after
2758 Japanese characters.  The diagram of state transitions are indicated in
2759 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
2760 after `beginning/ending of a group' characters.
2761 %</en>
2762
2763 %<*ja>
2764 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
2765 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
2766 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
2767
2768 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
2769 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
2770 以下に述べるような4状態を持っている.
2771
2772 \begin{itemize}
2773 \item State~$N$: 行の開始.
2774 \item State~$S$: 空白読み飛ばし.
2775 \item State~$M$: 行中.
2776 \item State~$K$: 行中(和文文字の後).
2777 \end{itemize}
2778 また,状態遷移は,図~\ref{fig-ptexipro} のようになっており,図中の数字は
2779 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
2780 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
2781 じものになる.
2782
2783 この図から分かることは,
2784 \begin{quote}
2785 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
2786 \end{quote}
2787 ということである.
2788 %</ja>
2789
2790 \begin{figure}[!tb]
2791 \begin{gather*}
2792  \def\sp{\texttt{\char32}}
2793  \xymatrix{&&
2794    {\text{scan a cs}}\ar@(r,ul)[dr]&\\
2795 \ar[r]&
2796    *++[o][F-]{N}\ar[ur]^0\ar[dd]_{d,\ g}\ar[u]^{5\ (\texttt{\char92par})}
2797      \ar@{->}@(d,l)[ddrr]_(0.45){j}&&
2798    *++[o][F-]{S}\ar@(l,dr)[ul]^0\ar@(l,ur)[ddll]_{d,\ g}\ar[u]_{5}
2799      \ar@{->}@(r,r)[dd]^{j}\\&\\&
2800    *++[o][F-]{M}\ar[uuur]^0\ar@(r,dl)[uurr]_(0.55){10\ (\sp)}
2801      \ar[d]_{5\ ({\sp})}\ar@{->}@(dr,dl)[rr]_{j}&&
2802    *++[o][F-]{K}\ar@{->}@(ul,d)[uuul]^0\ar@{->}[ll]^{d}
2803      \ar@{->}@(ur,dr)[uu]^{10\ (\sp)}\ar@{->}[d]_5\\
2804    &&&
2805  }\\
2806  d:=\{3,4,6,7,8,11,12,13\},\quad g:=\{1,2\},\quad j:=(\text{Japanese characters})
2807 \end{gather*}
2808 \begin{itemize}
2809 \item Numbers represent category codes.
2810 \item Category codes 9~(ignored), 14~(comment)~and~15~(invalid) are omitted in above diagram.
2811 \end{itemize}
2812 \caption{State transitions of \pTeX's input processor.}
2813 \label{fig-ptexipro}
2814 \end{figure}
2815
2816
2817 %<en>\subsection{Behavior in \LuaTeX-ja}
2818 %<ja>\subsection{\LuaTeX-ja の挙動}
2819 %<*en>
2820 States in the input processor of \LuaTeX\ is the same as that of \TeX,
2821 and they can't be customized by any callbacks. Hence, we can only use
2822 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
2823 suppress a space by a line break which is after Japanese characters.
2824
2825 However, \verb+token_filter+ callback cannot be used either, since a
2826 character in category code 5~(end-of-line) is converted into an space
2827 token \emph{in the input processor}.  So we can use only the
2828 \verb+process_input_buffer+ callback.  This means that suppressing a
2829 space must be done \emph{just before} an input line is read.
2830
2831 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
2832 \begin{quote}
2833 A character U+FFFFF (its category code is set to 14~(comment) by
2834 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
2835 process it}, if and only if the following two conditions are satisfied:
2836 \begin{enumerate}
2837 \item The category code of the character $\langle${return}$\rangle$
2838       (whose character code is 13) is 5~(end-of-line).
2839 \item The input line matches the following `regular expression':
2840 \[
2841   (\text{any char})^*(\textbf{JAchar})
2842   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
2843 \]
2844 \end{enumerate}
2845 \end{quote}
2846
2847 \paragraph{Remark}
2848 The following example shows the major difference from the behavior of \pTeX:
2849 \begin{LTXexample}
2850 \ltjsetparameter{autoxspacing=false}
2851 \ltjsetparameter{jacharrange={-6}}xあ
2852 y\ltjsetparameter{jacharrange={+6}}zあ
2853 u
2854 \end{LTXexample}
2855 \begin{itemize}
2856 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
2857 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
2858 \item There is no space between `あ' (in the line~3) and `u', since the
2859       line~3 ends with an \textbf{ALchar}
2860 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
2861 \end{itemize}
2862 %</en>
2863
2864 %<*ja>
2865 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,callbackによりユーザが
2866 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
2867 きそうなcallbackとしては,\verb+process_input_buffer+や
2868 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
2869 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
2870 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
2871 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
2872 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
2873
2874 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
2875 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
2876 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
2877
2878 \begin{quote}
2879 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
2880 以下の2条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
2881 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
2882 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
2883 \begin{enumerate}
2884 \item 改行文字(文字コード13番)のカテゴリーコードが5~(end-of-line)である.
2885 \item 入力行は次の「正規表現」にマッチしている:
2886 \[
2887   (\text{any char})^*(\textbf{JAchar})
2888   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
2889 \]
2890 \end{enumerate}
2891 \end{quote}
2892
2893 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
2894 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
2895 しかしながら,完全に同じ挙動が実現できたわけではない.
2896 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
2897 \begin{LTXexample}
2898 \ltjsetparameter{autoxspacing=false}
2899 \ltjsetparameter{jacharrange={-6}}xあ
2900 y\ltjsetparameter{jacharrange={+6}}zあ
2901 u
2902 \end{LTXexample}
2903 もし\pTeX とまったく同じ挙動を示すならば,出力は
2904 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
2905 上のように異なる挙動となっている.
2906 \begin{itemize}
2907 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
2908       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
2909 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
2910       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
2911 \end{itemize}
2912 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
2913 その行はそこで改行するようにした方がいいだろう.
2914 %</ja>
2915
2916
2917 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
2918 %<ja>\section{JFM グルーの挿入,\Param{kanjiskip} と \Param{xkanjiskip}}
2919 %<en>\subsection{Overview}
2920 %<ja>\subsection{概要}
2921 %<*en>
2922 NOT COMPLETED
2923 %</en>
2924
2925 %<*ja>
2926 \LuaTeX-ja における和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.
2927 \pTeX では次のような仕様であった:
2928 \begin{itemize}
2929 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
2930 追加する過程で行われる.
2931 \item \Param{xkanjiskip}の挿入は,hboxへのパッケージングや行分割前に行われる.
2932 \item \Param{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に
2933 「和文文字を表す2つの<char\_node>の間には\Param{kanjiskip}がある」ものとみなされる.
2934 \end{itemize}
2935 しかし,\LuaTeX-jaでは,hboxへのパッケージングや行分割前に全ての
2936 \textbf{JAglue},即ちJFMグルー・\Param{xkanjiskip}・\Param{kanjiskip}の
2937 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
2938 カーニング処理がノードベースになったことに対応する変更である.
2939
2940 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,下の図\ref{fig-clu}のよう
2941 に「塊」を単位にして行われる.大雑把にいうと,「塊」は文字とそれに付随す
2942 るノード達(アクセント位置補正用のkernや,イタリック補正)をまとめたもの
2943 であり,2つの塊の間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
2944 には関係しないものがある.そのため,……
2945 %</ja>
2946
2947 % \begin{figure}[!tb]
2948 % \unitlength=10mm
2949 % \end{figure}
2950
2951 %<en>\subsection{Definition of a `cluster'}
2952 %<ja>\subsection{「クラスタ」の定義}
2953
2954 \begin{defn}
2955 A \emph{cluster} is a list of nodes in one of the following forms, with the \textit{id} of it:
2956 \begin{enumerate}
2957 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
2958       nodes come from a hbox which is already packaged, by unpackaging
2959       (\verb+\unhbox+).
2960       The \textit{id} is \textit{id\_pbox}.
2961 \item A inline math formula, including two \textit{math\_node}s at the boundary of it:
2962 HOGE
2963       The \textit{id} is \textit{id\_math}.
2964 \item A \textit{glyph\_node} with nodes which relate with it:
2965 HOGE
2966 The \textit{id} is \textit{id\_jglyph} or
2967 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
2968 represents a Japanese character or not.
2969 \item An box-like node, that is, an hbox, an vbox and an rule (\verb+\vrule+).
2970 The \textit{id} is \textit{id\_hlist} if the node is an
2971       hbox which is not shifted vertically, or \textit{id\_box\_like}
2972       otherwise.
2973 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
2974 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
2975       and \textit{id\_disc}, respectively.
2976 %Just a node which will \dots, \textit{i.e.}, a node which is \emph{not} one of the following:
2977 %\textit{ins\_node}, \textit{mark\_node}, \textit{adjust\_node}, \textit{whatsit\_node}
2978 %and \textit{penalty\_node}.
2979 \end{enumerate}
2980 We denote a cluster by \textit{Np}, \textit{Nq} and \textit{Nr}.
2981 \end{defn}
2982
2983 Internally, a cluster is represented by a table $\textit{Np}$ with the following fields.
2984
2985 \begin{description}
2986 \def\makelabel#1{\textbf{\textit{#1}}}
2987 \item[first, last] The first/last node of the cluster.
2988 \item[id] The \textit{id} in above definition.
2989 \item[nuc]
2990
2991 % jachar
2992 \item[auto\_kspc, auto\_xspc]
2993 \item[xspc\_before, xspc\_after]
2994
2995 % alchar, jachar
2996 \item[pre, post]
2997 \item[char]
2998 \item[class]
2999 \item[lend]
3000 \item[met, var]
3001 \end{description}
3002 \end{document}