OSDN Git Service

Add English description to Subsection 4.2 Prefix psft.
[luatex-ja/luatexja.git] / doc / luatexja.dtx
1 %#! lualatex -shell-escape manual.ins
2
3 %<*en>
4 \documentclass[a4paper,titlepage]{article}
5 \usepackage[margin=25mm,footskip=5mm]{geometry}
6 %</en>
7 %<*ja>
8 \documentclass[a4paper,titlepage]{ltjsarticle}
9 \usepackage[margin=25mm, footskip=5mm]{geometry}
10 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
11 %</ja>
12
13 \usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float,makecell}
14 \usepackage{mathptmx}
15 \usepackage{booktabs,listings,showexpl,multicol}
16 \usepackage{luatexja-otf}
17 \usepackage{luatexja-fontspec}
18 \usepackage[unicode=true]{hyperref}
19 \usepackage[all]{xy}
20 %<ja> \SelectTips{cm}{}
21 %<*en>
22 \usepackage{mathptmx}
23 \setmainfont[Ligatures=TeX]{TeX Gyre Termes}
24 \setsansfont[Ligatures=TeX]{TeX Gyre Heros}
25 \frenchspacing
26 %</en>
27 \def\labelenumii{(\arabic{enumii})}
28
29 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
30 \DeclareRobustCommand\LuaTeX{Lua\TeX}
31 \DeclareRobustCommand\pdfTeX{pdf\TeX}
32 \DeclareRobustCommand\pTeX{p\kern-.05em\TeX}
33 \DeclareRobustCommand\upTeX{up\kern-.05em\TeX}
34 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
35 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
36 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
37
38 \theoremstyle{definition}
39 %<en>\newtheorem{defn}{Definition}
40 %<ja>\newtheorem{defn}{定義}
41
42 \newenvironment{cslist}{%
43   \leftskip2em\parindent=0pt\def\makelabel##1{{\tt\char92##1}}
44   \def\{{\char`\{}\def\}{\char`\}}
45   \let\origitem=\item
46   \def\item[##1]{\par\smallskip\par\hskip-\leftskip\makelabel{##1}\par}
47 }{}
48
49 \makeatletter
50 \long\def\@makecaption#1#2{%
51   \vskip\abovecaptionskip
52   \sbox\@tempboxa{{\small #1. #2}}%
53   \ifdim \wd\@tempboxa >\hsize
54     {\small #1. #2}\par
55   \else
56     \global \@minipagefalse
57     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
58   \fi
59   \vskip\belowcaptionskip}
60 % Suppress output from showexpl to stdout.
61 \let\SX@Info\relax
62 \makeatother
63
64 \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr
65   #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}}
66
67 %<*en>
68 \title{The \LuaTeX-ja package}
69 \author{The \LuaTeX-ja project team}
70 %</en>
71 %<*ja>
72 \title{\LuaTeX-jaパッケージ}
73 \author{\LuaTeX-jaプロジェクトチーム}
74 %</ja>
75
76 \lstset{
77   basicstyle=\ttfamily\small, pos=o, breaklines=true,
78   numbers=none, rframe={}, basewidth=0.5em
79 }
80
81 \parskip=\smallskipamount
82 \protected\def\Param#1{\textsf{#1}} % parameter name
83 \protected\def\Pkg#1{\underline{\smash{\texttt{#1}}}} % packages/classes
84
85 \begin{document}
86 \catcode`\<=13
87 \def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
88 \maketitle
89
90 \tableofcontents
91 \bigskip
92
93 %<*en>
94 \textbf{This documentation is far from complete. It may have many
95 grammatical (and contextual) errors.} Also, several parts
96 (especially, Section~\ref{sec-jfmglue}) are written in Japanese only.
97 %</en>
98 %<*ja>
99 \textbf{\large 本ドキュメントはまだまだ未完成です.}
100 %</ja>
101
102 \clearpage
103 %<en>\part{User's manual}
104 %<ja>\part{ユーザーズマニュアル}
105
106 %<en>\section{Introduction}
107 %<ja>\section{はじめに}
108
109 %<*en>
110 The \LuaTeX-ja package is a macro package for typesetting high-quality
111 Japanese documents when using \LuaTeX.
112 %</en>
113 %<*ja>
114 \LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
115 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
116 %</ja>
117
118 %<en>\subsection{Backgrounds}
119 %<ja>\subsection{背景}
120
121 %<*en>
122 Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
123 are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
124 extension of \TeX: so it can produce high-quality Japanese documents
125 without using very complicated macros. But this point is a mixed
126 blessing: \pTeX\ is left behind from other extensions of \TeX,
127 especially \eTeX\ and \pdfTeX, and from changes about
128 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
129 %</en>
130 %<*ja>
131 従来,「\TeX を用いて日本語組版を行う」といったとき,エンジンとしては
132 ASCII \pTeX やそれの拡張物が用いられることが一般的であった.\pTeX は\TeX
133 のエンジン拡張であり,(少々仕様上不便な点はあるものの)商業印刷の分野に
134 も用いられるほどの高品質な日本語組版を可能としている.だが,それは弱点に
135 もなってしまった:\pTeX という(組版的に)満足なものがあったため,海外で
136 行われている数々の\TeX の拡張──例えば\eTeX や\pdfTeX ──や,TrueType,
137 OpenType, Unicodeといった計算機で日本語を扱う際の状況の変化に追従すること
138 を怠ってしまったのだ.
139 %</ja>
140
141 %<*en>
142 Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
143 of \pTeX) and \epTeX\ (merging of \pTeX\ and
144 \eTeX\ extension), have developed to fill those gaps to some
145 extent, but gaps still exist.
146 %</en>
147 %<*ja>
148 ここ数年,若干状況は改善されてきた.現在手に入る大半の\pTeX バイナリでは
149 外部UTF-8入力が利用可能となり,さらにUnicode化を推進し,\pTeX の内部処理
150 までUnicode化した\upTeX も開発されている.また,\pTeX に\eTeX 拡張をマー
151 ジした\epTeX も登場し,\TeX\ Live\ 2011では\pLaTeX が\epTeX の上で動作す
152 るようになった.だが,\pdfTeX 拡張(PDF直接出力やmicro-typesetting)を
153 \pTeX に対応させようという動きはなく,海外とのgapは未だにあるのが現状であ
154 る.
155 %</ja>
156
157 %<*en>
158 However, the appearance of \LuaTeX\ changed the whole situation. With
159 using Lua `callbacks', users can customize the internal processing of
160 \LuaTeX. So there is no need to modify sources of engines to
161 support Japanese typesetting: to do this, we only have to write Lua
162 scripts for appropriate callbacks.
163 %</en>
164 %<*ja>
165 しかし,\LuaTeX の登場で,状況は大きく変わることになった.Luaコードで
166 `callback'を書くことにより,\LuaTeX の内部処理に割り込みをかけることが可
167 能となった.これは,エンジン拡張という真似をしなくても,Luaコードとそれに
168 関する\TeX マクロを書けば,エンジン拡張とほぼ同程度のことができるようになっ
169 たということを意味する.\LuaTeX-jaは,このアプローチによってLuaコード・
170 \TeX マクロによって日本語組版を\LuaTeX の上で実現させようという目的で開発
171 が始まったパッケージである.
172 %</ja>
173
174 %<en>\subsection{Major Changes from \pTeX}
175 %<ja>\subsection{\pTeX からの主な変更点}
176
177 %<*en>
178 The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
179 target of development was to implement features of \pTeX. However,
180 \emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
181 specifications/behaviors of \pTeX\ were not adopted}.
182 %</en>
183 %<*ja>
184 \LuaTeX-jaは,\pTeX に多大な影響を受けている.初期の開発目標は,\pTeX の機
185 能をLuaコードにより実装することであった.しかし,開発が進むにつれ,\pTeX
186 の完全な移植は不可能であり,また\pTeX における実装がいささか不可解になっ
187 ているような状況も発見された.そのため,\textbf{\LuaTeX-jaは,もはや
188 \pTeX の完全な移植は目標とはしない.\pTeX における不自然な仕様・挙動があ
189 れば,そこは積極的に改める.}
190 %</ja>
191
192 %<*en>
193 The followings are major changes from \pTeX:
194 %</en>
195 %<*ja>
196 以下は \pTeX からの主な変更点である.
197 %</ja>
198
199 \begin{itemize}
200 %<*en>
201 \item A Japanese font is a tuple of a `real' font, a Japanese font
202       metric (\textbf{JFM}, for short), and an optional string called
203       `variation'.
204 %</en>
205 %<*ja>
206 \item 和文フォントは(小塚明朝,IPA明朝などの)実際のフォント,和文フォントメトリック(JFMと呼ぶ),そ
207       して`variation'と呼ばれる文字列の組である.
208 %</ja>
209
210 %<*en>
211 \item In \pTeX, a line break after Japanese character is ignored (and
212       doesn't yield a space), since line breaks (in source files) are
213       permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
214       doesn't have this function completely, because of a specification
215       of \LuaTeX.
216 %</en>
217 %<*ja>
218 \item 日本語の文書中では改行はほとんどどこでも許されるので,\pTeX では和文文字
219       直後の改行は無視される(スペースが入らない)ようになっていた.しかし,
220       \LuaTeX-ja では \LuaTeX の仕様のためにこの機能は完全には実装されていない.
221 %</ja>
222
223 %<*en>
224 \item The insertion process of glues/kerns between two Japanese
225       characters and between a Japanese character and other characters
226       (we refer these glues/kerns as \textbf{JAglue}) is rewritten from
227       scratch.
228 %</en>
229 %<*ja>
230 \item 2つの和文文字の間,和文文字と欧文文字の間に入るグルー/カーン
231       (\textbf{JAglue}と呼ぶ)の挿入処理が0から書き直されている.
232 %</ja>
233
234 \begin{itemize}
235 %<*en>
236 \item As \LuaTeX's internal character handling is `node-based'
237       (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
238       insertion process of \textbf{JAglue} is now `node-based'.
239 %</en>
240 %<*ja>
241 \item \LuaTeX の内部での文字の扱いが「ノードベース」になっているように(例えば,
242       \verb+of{}fice+ で合字は抑制されない),\textbf{JAglue}の挿入処理も
243       「ノードベース」である.
244 %</ja>
245
246 %<*en>
247 \item Furthermore, nodes between two characters which have no effects in
248       line break (\textit{e.g.}, \verb+\special+ node) and kerns from
249       italic correction are ignored in the insertion process.
250 %</en>
251 %<*ja>
252 \item さらに,2つの文字の間にある行末では効果を持たないノード(例えば \verb+\special+ ノード)や,
253   イタリック補正に伴い挿入されるカーンは挿入処理中では無視される.
254 %</ja>
255
256 %<*en>
257 \item \emph{Caution: due to above two points, many methods which did for the
258       dividing the process of the insertion of \textbf{JAglue} in \pTeX\ are not
259       effective anymore.} In concrete terms, the following two methods are not effective anymore:
260 %</en>
261 %<*ja>
262 \item \textbf{注意:上の2つの変更により,従来\textbf{JAglue}の挿入処理を分断するのに
263       使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:}
264 %</ja>
265 \begin{verbatim}
266   ちょ{}っと  ちょ\/っと
267 \end{verbatim}
268 %<*en>
269       If you want to do so, please put an empty hbox between it instead:
270 %</en>
271 %<*ja>
272       もし同じことをやりたければ,空の水平ボックスを間に挟めばよい:
273 %</ja>
274 \begin{verbatim}
275   ちょ\hbox{}っと
276 \end{verbatim}
277
278
279 %<*en>
280 \item In the process, two Japanese fonts which only differ in their `real'
281       fonts are identified.
282 %</en>
283 %<*ja>
284 \item 処理中では,2つの和文フォントは,「実際の」フォントのみが異なる場合に同一視
285       される.
286 %</ja>
287 \end{itemize}
288
289 %<*en>
290 \item At the present, vertical typesetting (\emph{tategaki}), is not
291       supported in \LuaTeX-ja.
292 %</en>
293 %<*ja>
294 \item 現時点では,縦書きは\LuaTeX-jaではサポートされていない.
295 %</ja>
296
297 \end{itemize}
298
299 %<*en>
300 For detailed information, see Part~\ref{part-imp}.
301 %</en>
302 %<*ja>
303 詳細については第\ref{part-imp}部を参照.
304 %</ja>
305
306 %<en>\subsection{Notations}
307 %<ja>\subsection{用語と記法}
308
309 %<*en>
310 In this document, the following terms and notations are used:
311 %</en>
312 %<*ja>
313 本ドキュメントでは,以下の用語と記法を用いる:
314 %</ja>
315
316 \begin{itemize}
317 %<*en>
318 \item Characters are divided into two types:
319 %</en>
320 %<*ja>
321 \item 文字は2種類に分けられる:
322 %</ja>
323 \begin{itemize}
324 %<*en>
325 \item \textbf{JAchar}: standing for Japanese characters such as
326       Hiragana, Katakana, Kanji and other punctuation marks for
327       Japanese.
328 %</en>
329 %<*ja>
330 \item \textbf{JAchar}: ひらがな,カタカナ,漢字,和文用の約物といった和文文字の
331       ことを指す.
332 %</ja>
333
334 %<*en>
335 \item \textbf{ALchar}: standing for all other characters like alphabets.
336 %</en>
337 %<*ja>
338 \item \textbf{ALchar}: アルファベットを始めとする,その他全ての文字を指す.
339 %</ja>
340 \end{itemize}
341
342 %<*en>
343 We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts' for fonts used in \textbf{JAchar}.
344 %</en>
345 %<*ja>
346 そして,\textbf{ALchar}の出力に用いられるフォントを「欧文フォント」と呼び,
347 \textbf{JAchar}の出力に用いられるフォントを「和文フォント」と呼ぶ.
348 %</ja>
349
350 %<*en>
351 \item A word in a sans-serif font (like \Param{prebreakpenalty})
352       means an internal parameter for Japanese typesetting, and it
353       is used as a key in \verb+\ltjsetparameter+ command.
354 %</en>
355 %<*ja>
356 \item サンセリフ体で書かれた語(例:\Param{prebreakpenalty})は日本語組版用の
357       パラメータを表し,これらは \verb+\ltjsetparameter+ コマンドのキーとして
358       用いられる.
359 %</ja>
360
361 %<*en>
362 \item A word in typewriter font with underline (like \Pkg{fontspec})
363       means a package or a class of \LaTeX.
364 %</en>
365 %<*ja>
366 \item 下線付きのタイプライタ体で書かれた語(例:\Pkg{fontspec})は\LaTeX の
367       パッケージやクラスを表す.
368 %</ja>
369
370 %<*en>
371 \item The word `primitive' is used not only for primitives in \LuaTeX,
372       but also for control sequences that defined in the core module of
373       \LuaTeX-ja.
374 %</en>
375 %<*ja>
376 \item 「プリミティブ」という語を,\LuaTeX のプリミティブだけではなく \LuaTeX-ja
377       のコアモジュールで定義されたコントロールシーケンスに対しても用いる.
378 %</ja>
379
380 %<*en>
381 \item In this document, natural numbers start from~0.
382 %</en>
383 %<*ja>
384 \item 本ドキュメントでは,自然数は0から始まる.
385 %</ja>
386 \end{itemize}
387
388 %<en>\subsection{About the project}
389 %<ja>\subsection{プロジェクトについて}
390
391 %<*en>
392 \paragraph{Project Wiki} Project Wiki is under construction.
393 %</en>
394 %<*ja>
395 \paragraph{プロジェクトWiki} プロジェクトWikiは構築中である.
396 %</ja>
397
398 %<*en>
399 \begin{itemize}
400 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
401 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
402 \end{itemize}
403 %</en>
404 %<*ja>
405 \begin{itemize}
406 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
407 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
408 \end{itemize}
409 %</ja>
410
411 %<*en>
412 This project is hosted by SourceForge.JP.
413 %</en>
414 %<*ja>
415 本プロジェクトはSourceForge.JPのサービスを用いて運営されている.
416 %</ja>
417
418 %<en>\paragraph{Members}\
419 %<ja>\paragraph{開発メンバー}\
420 %<*en>
421 \begin{multienumerate}
422 \def\labelenumi{$\bullet$}
423 \mitemxxx{Hironori KITAGAWA}{Kazuki MAEDA}{Takayuki YATO}
424 \mitemxxx{Yusuke KUROKI}{Noriyuki ABE}{Munehiro YAMAMOTO}
425 \mitemxxx{Tomoaki HONDA}{Shuzaburo SAITO}{MA Qiyuan}
426 \end{multienumerate}
427 %</en>
428 %<*ja>
429 \begin{multienumerate}
430 \def\labelenumi{$\bullet$}
431 \mitemxxx{北川 弘典}{前田 一貴}{八登 崇之}
432 \mitemxxx{黒木 裕介}{阿部 紀行}{山本 宗宏}
433 \mitemxxx{本田 知亮}{齋藤 修三郎}{馬 起園}
434 \end{multienumerate}
435 %</ja>
436
437
438 % \paragraph{Acknowledgments} -- 挿入するならここ
439
440 \clearpage
441 %<en>\section{Getting Started}
442 %<ja>\section{使い方}
443 %<en>\subsection{Installation}
444 %<ja>\subsection{インストール}
445
446 %<*en>
447 To install the \LuaTeX-ja\ package, you will need:
448 %</en>
449 %<*ja>
450 \LuaTeX-jaパッケージのインストールには,次のものが必要である.
451 %</ja>
452 \begin{itemize}
453 %<*en>
454 \item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.\\
455 If you are using \TeX~Live~2011 or current W32\TeX, you don't have to worry.
456 %</en>
457 %<*ja>
458 \item \LuaTeX(バージョン 0.65.0-beta 以降)とその支援パッケージ.
459       \TeX~Live~2011やW32\TeX の最新版ならば問題ない.
460 %</ja>
461 %<*en>
462 \item The source archive of \LuaTeX-ja, of course\texttt{:)}
463 %</en>
464 %<*ja>
465 \item \LuaTeX-jaのソースアーカイブ(もちろん\texttt{:)}).
466 %</ja>
467 %<*en>
468 \item The \Pkg{xunicode} package, which version is \emph{just v0.981 (2011/09/09)}.\\
469 If you have the \Pkg{fontspec} package, this \Pkg{xunicode} package must be exist.
470 But be careful about the version; other versions may not work correctly with \LuaTeX-ja.
471 %</en>
472 %<*ja>
473 \item \Pkg{xunicode}パッケージ(\textbf{2011/09/09,~v0.981}).\\
474 \Pkg{fontspec}パッケージが導入されていればこのパッケージも導入されているはずであるが,
475 このv0.981以外のバージョンでは\LuaTeX-ja上で正しく動作しない危険性がある.
476 %</ja>
477 \end{itemize}
478
479 %<*en>
480 The installation methods are as follows:
481 %</en>
482 %<*ja>
483 インストール方法は以下のようになる:
484 %</ja>
485 \begin{enumerate}
486 %<*en>
487 \item Download the source archive, by one of the following method.
488       At the present, \LuaTeX-ja has no \emph{stable} release.
489
490 \begin{itemize}
491 \item Copy the Git repository:
492 \begin{verbatim}
493 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
494 \end{verbatim}
495 \item Download the \texttt{tar.gz} archive of HEAD in the \texttt{master} branch from
496 \begin{flushleft}
497 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
498 \end{flushleft}
499 \item Now \LuaTeX-ja is available from the following archive and distributions:
500   \begin{itemize}
501   \item CTAN (in the \texttt{macros/luatex/generic/luatexja} directory)
502   \item \TeX\ Live (in \texttt{texmf-dist/tex/luatex/luatexja})
503   \item W32\TeX\ (in \texttt{luatexja.tar.xz})
504   \end{itemize}
505   These are based on the \texttt{master} branch.
506 \end{itemize}
507
508 Note that the \texttt{master} branch, and hence the archive in CTAN, are not updated frequently;
509 the forefront of development is not the \texttt{master} branch.
510 %</en>
511 %<*ja>
512 \item ソースアーカイブを以下のいずれかの方法で取得する.現在公開されているのはあくまでも
513       開発版であって,安定版でないことに注意.
514
515 \begin{itemize}
516 \item Gitリポジトリの内容をコピーする:
517 \begin{verbatim}
518 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
519 \end{verbatim}
520 \item \texttt{master}ブランチのスナップショット(\texttt{tar.gz}形式)をダウンロードする.
521 \begin{flushleft}
522 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
523 \end{flushleft}
524 \item 今や,\LuaTeX-jaは以下のアーカイブ,およびディストリビューションにも収録されている:
525   \begin{itemize}
526   \item CTAN (\texttt{macros/luatex/generic/luatexja})
527   \item \TeX\ Live (\texttt{texmf-dist/tex/luatex/luatexja})
528   \item W32\TeX\ (\texttt{luatexja.tar.xz})
529   \end{itemize}
530   これらは\texttt{master}ブランチの内容を元にしている.
531 \end{itemize}
532
533 \texttt{master}ブランチ(従って,CTAN内のアーカイブも)はたまにしか更新されないことに注意.
534 主な開発は\texttt{master}の外で行われ,比較的まとまってきたらそれを\texttt{master}に
535 反映させることにしている.
536 %</ja>
537
538 %<*en>
539 \item Extract the archive. You will see \texttt{src/} and several other sub-directories.
540 But only the contents in \texttt{src/} are needed to work \LuaTeX-ja.
541 %</en>
542 %<*ja>
543 \item 「Gitリポジトリをコピー」以外の方法でアーカイブを取得したならば,それを展開する.
544       \texttt{src/}をはじめとしたいくつかのディレクトリができるが,
545       動作には\texttt{src/}以下の内容だけで十分.
546 %</ja>
547
548 %<*en>
549 \item Copy all the contents of \texttt{src/} into one of your \texttt{TEXMF} tree.
550       \texttt{TEXMF/tex/luatex/luatexja/} is an example location.
551       If you cloned entire Git repository, making a symbolic link of \texttt{src/}
552       instead copying is also good.
553 %</en>
554 %<*ja>
555 \item \texttt{src/}の中身を自分の\texttt{TEXMF}ツリーにコピーする.
556       場所の例としては,例えば\texttt{TEXMF/tex/luatex/luatexja/}がある.
557       シンボリックリンクが利用できる環境で,かつリポジトリを直接取得したのであれば,
558       (更新を容易にするために)コピーではなくリンクを貼ることを勧める.
559 %</ja>
560
561 %<*en>
562 \item If \texttt{mktexlsr} is needed to update the file name database, make it so.
563 %</en>
564 %<*ja>
565 \item 必要があれば,\texttt{mktexlsr}を実行する.
566 %</ja>
567 \end{enumerate}
568
569
570 %<en>\subsection{Cautions}
571 %<ja>\subsection{注意点}
572
573 \begin{itemize}
574 %<*en>
575 \item The encoding of your source file must be UTF-8. No other
576       encodings, such as EUC-JP or Shift-JIS, are not supported.
577 %</en>
578 %<*ja>
579 \item 原稿のソースファイルの文字コードはUTF-8固定である.
580       従来日本語の文字コードとして用いられてきたEUC-JPやShift-JISは使用できない.
581 %</ja>
582 \end{itemize}
583
584 %<en>\subsection{Using in plain \TeX}
585 %<ja>\subsection{plain \TeX で使う}
586 \label{ssec-plain}
587
588 %<*en>
589 To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
590 %</en>
591 %<*ja>
592 \LuaTeX-jaを plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
593 %</ja>
594 \begin{verbatim}
595 \input luatexja.sty
596 \end{verbatim}
597 %<*en>
598 This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents:
599 %</en>
600 %<*ja>
601 これで(\texttt{ptex.tex}のように)日本語組版のための最低限の設定がなされる:
602 %</ja>
603
604 \begin{itemize}
605 %<*en>
606 \item The following 6~Japanese fonts are preloaded:
607 \begin{center}
608 \begin{tabular}{ccccc}
609 \toprule
610 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
611 \emph{mincho}&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
612 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
613 \bottomrule
614 \end{tabular}
615 \end{center}
616 %</en>
617 %<*ja>
618 \item 以下の6つの和文フォントが定義される:
619 \begin{center}
620 \begin{tabular}{ccccc}
621 \toprule
622 \textbf{字体}&\textbf{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
623 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
624 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
625 \bottomrule
626 \end{tabular}
627 \end{center}
628 %</ja>
629 \begin{itemize}
630 %<*en>
631 \item The `Q(級)' is a unit used in Japanese phototypesetting, and
632       $1\,\textrm{Q}=0.25\,\textrm{mm}$. This length is stored in a
633       dimension \verb+\jQ+.
634 %</en>
635 %<*ja>
636 \item `Q(級)'は日本の写植で用いられる単位で,$1\,\textrm{Q}=0.25\,\textrm{mm}$
637       である.この長さは \verb+\jQ+ に保持されている.
638 %</ja>
639
640 %<*en>
641 \item It is widely accepted that the font `Ryumin-Light' and
642       `GothicBBB-Medium' aren't embedded into PDF files, and PDF reader
643       substitute them by some external Japanese fonts (\textit{e.g.},
644       Kozuka Mincho is used for Ryumin-Light in Adobe Reader). We adopt this custom to
645       the default setting.
646 %</en>
647 %<*ja>
648 \item `Ryumin-Light'と`GothicBBB-Medium'はPDFファイルに埋め込まずに
649       名前参照のみで用いることが広く受け入れられており,この場合PDFリーダーが
650       適切な外部フォントで代用する(例えば,Adobe ReaderではRyumin-Lightは
651       小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと
652       して採用する.
653 %</ja>
654
655 %<*en>
656 \item A character in an alphabetic font is generally smaller than a
657       Japanese font in the same size. So actual size specification of
658       these Japanese fonts is in fact smaller than that of alphabetic
659       fonts, namely scaled by 0.962216.
660 %</en>
661 %<*ja>
662 \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも
663       一般に小さくデザインされている.そこで,標準ではこれらの和文フォントの実際のサイズは指定された値よりも
664       小さくなるように設定されており,具体的には指定の0.962216倍にスケールされる.
665       この0.962216という数値も,\pTeX におけるスケーリングを踏襲した値である.
666 %</ja>
667 \end{itemize}
668
669 %<*en>
670 \item The amount of glue that are inserted between a \textbf{JAchar} and
671       an \textbf{ALchar} (the parameter \Param{xkanjiskip}) is set to
672 %</en>
673 %<*ja>
674 \item \textbf{JAchar}と\textbf{ALchar}の間に入るグルー(\Param{xkanjiskip})の
675       量は次のように設定されている:
676 %</ja>
677 \[
678  (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}}
679  = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}.
680 \]
681 \end{itemize}
682
683 %<en>\subsection{Using in \LaTeX}
684 %<ja>\subsection{\LaTeX で使う}
685 \label{ssec-ltx}
686
687 \paragraph{\LaTeXe}
688
689 %<*en>
690 Using in \LaTeXe\ is basically same. To set up the minimal environment
691 for Japanese, you only have to load \texttt{luatexja.sty}:
692 %</en>
693 %<*ja>
694 \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を
695 設定するためには,\texttt{luatexja.sty}を読み込むだけでよい:
696 %</ja>
697 \begin{verbatim}
698 \usepackage{luatexja}
699 \end{verbatim}
700 %<*en>
701 It also does minimal settings (counterparts in \pLaTeX\ are \texttt{
702 plfonts.dtx} and \texttt{pldefs.ltx}):
703 %</en>
704 %<*ja>
705 これで\pLaTeX の\texttt{plfonts.dtx}と\texttt{pldefs.ltx}に相当する最低限の設定が
706 なされる:
707 %</ja>
708
709 \begin{itemize}
710 %<*en>
711 \item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
712 When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
713 %</en>
714 %<*ja>
715 \item \texttt{JY3}は和文フォント用のフォントエンコーディングである(横書き用).\\
716 将来的に,\LuaTeX-jaで縦書きがサポートされる際には,\texttt{JT3}を縦書き用として
717 用いる予定である.
718 %</ja>
719
720 %<*en>
721 \item Two font families \texttt{mc} and \texttt{gt} are defined:
722 \begin{center}
723 \begin{tabular}{ccccc}
724 \toprule
725 \textbf{classification}&\textbf{family}&\verb+\mdseries+&\verb+\bfseries+&\textbf{scale}\\\midrule
726 \emph{mincho}&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
727 \emph{gothic}&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
728 \bottomrule
729 \end{tabular}
730 \end{center}
731 Remark that the bold series in both family are same as the medium series of \emph{gothic} family.
732 This is a convention in \pLaTeX. This is a trace that there were only 2~fonts (these are Ryumin-Light
733 and GothicBBB-Medium) in early years of DTP.
734 %</en>
735 %<*ja>
736 \item 2つのフォントファミリ\texttt{mc}と\texttt{gt}が定義されている:
737 \begin{center}
738 \begin{tabular}{ccccc}
739 \toprule
740 \textbf{字体}&\textbf{ファミリ}&\verb+\mdseries+&\verb+\bfseries+&\textbf{スケール}\\\midrule
741 明朝体&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
742 ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
743 \bottomrule
744 \end{tabular}
745 \end{center}
746 どちらのファミリにおいても,そのboldシリーズはゴシック体のmediumシリーズで
747 あることに注意.これは初期のDTPにおいて和文フォントが2つ(それがちょうど\
748 Ryumin-Light, GothicBBB-Mediumだった)しか利用できなかった時の名残であり,\pLaTeX{}
749 での標準設定とも同じである.
750 %</ja>
751
752 %<*en>
753 \item Japanese characters in math mode are typeset by the font family \texttt{mc}.
754 %</en>
755 %<*ja>
756 \item 数式モード中の和文文字は\texttt{mc}ファミリで出力される.
757 %</ja>
758 \end{itemize}
759
760 %<*en>
761 However, above settings are not sufficient for Japanese-based
762 documents. To typeset Japanese-based documents, you are better to use
763 class files other than \texttt{article.cls}, \texttt{book.cls}, and so on.  At
764 the present, we have the counterparts of \Pkg{jclasses} (standard
765 classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
766 Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
767 %</en>
768 %<*ja>
769 しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
770 日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls}といった
771 欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
772 現時点では,\Pkg{jclasses}(\pLaTeX の標準クラス)と\Pkg{jsclasses}
773 (奥村晴彦氏によるクラスファイル)に対応するものとして,\Pkg{ltjclasses},
774 \Pkg{ltjsclasses}がそれぞれ用意されている.
775 %</ja>
776
777 %<*en>
778 \paragraph{\texttt{\char92 CID}, \texttt{\char92 UTF} and macros in OTF package}
779 Under \pLaTeX, \Pkg{otf} package (developed by Shuzaburo Saito) is
780 used for typesetting characters which is in Adobe-Japan1-6 CID but not
781 in JIS~X~0208. Since this package is widely used, \LuaTeX-ja
782 supports some of functions in \Pkg{otf} package.
783 If you want to use these functions, load \Pkg{luatexja-otf} package.
784 %</en>
785 %<*ja>
786 \paragraph{\texttt{\char92 CID}, \texttt{\char92 UTF}とOTFパッケージのマクロ}
787 \pLaTeX では,JIS~X~0208にないAdobe-Japan1-6の文字を出力するために,
788 齋藤修三郎氏による\Pkg{otf}パッケージが用いられていた.このパッケージは
789 広く用いられているため,\LuaTeX-jaにおいても\Pkg{otf}パッケージの機能の
790 一部をサポートしている.これらの機能を用いるためには\Pkg{luatexja-otf}パッケージ
791 を読み込めばよい.
792 %</ja>
793
794 \begin{LTXexample}
795 森\UTF{9DD7}外と内田百\UTF{9592}とが\UTF{9AD9}島屋に行く。
796
797 \CID{7652}飾区の\CID{13706}野家,
798 葛飾区の吉野家
799 \end{LTXexample}
800
801 %<en>\subsection{Changing Fonts}
802 %<ja>\subsection{フォントの変更}
803 \label{ssub-chgfnt}
804
805 %<*en>
806 \paragraph{Remark: Japanese Characters in Math Mode}
807 Since \pTeX\ supports Japanese characters in math mode, there are
808 sources like the following:
809 %</en>
810 %<*ja>
811 \paragraph{意見:数式モード中の和文文字}
812 \pTeX では,特に何もしないでも数式中に和文文字を記述することができた.そのため,
813 以下のようなソースが見られた:
814 %</ja>
815 \begin{LTXexample}
816 $f_{高温}$~($f_{\text{high temperature}}$).
817 \[ y=(x-1)^2+2\quad よって\quad y>0 \]
818 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
819 \end{LTXexample}
820 %<*en>
821 We (the project members of \LuaTeX-ja) think that using
822 Japanese characters in math mode are allowed if and only if these are used as identifiers.
823 In this point of view,
824 %</en>
825 %<*ja>
826 \LuaTeX-jaプロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる
827 ときのみ許されると考えている.
828 この観点から,
829 %</ja>
830 \begin{itemize}
831 %<*en>
832 \item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and
833 `よって' is used as a conjunction.
834 %</en>
835 %<*ja>
836 \item 上記数式のうち1, 2行目は正しくない.なぜならば`高温'が意味のあるラベルと
837       して,`よって'が接続詞として用いられているからである.
838 %</ja>
839 %<*en>
840 \item However, the line~3 is correct, since `素' is used as an identifier.
841 %</en>
842 %<*ja>
843 \item しかしながら,3行目は`素'が識別子として用いられているので正しい.
844 %</ja>
845 \end{itemize}
846 %<*en>
847 Hence, in our opinion, the above input should be corrected as:
848 %</en>
849 %<*ja>
850 したがって,\LuaTeX-jaプロジェクトの意見としては,上記の入力は次のように直されるべき
851 である:
852 %</ja>
853 \begin{LTXexample}
854 $f_{\text{高温}}$~%
855 ($f_{\text{high temperature}}$).
856 \[ y=(x-1)^2+2\quad
857   \mathrel{\text{よって}}\quad y>0 \]
858 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
859 \end{LTXexample}
860 %BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない.
861 %<*en>
862 We also believe that using Japanese characters as identifiers is rare,
863 hence we don't describe how to change Japanese fonts in math mode in
864 this chapter. For the method, please see Subsection~\ref{ssec-math}.
865 %</en>
866 %<*ja>
867 また\LuaTeX-jaプロジェクトでは,和文文字が識別子として用いられることはほとんどない
868 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
869 記述しない.この方法については\ref{ssec-math}節を参照のこと.
870 %</ja>
871
872 %<*en>
873 \paragraph{plain \TeX}
874 To change Japanese fonts in plain \TeX, you must use the primitive
875 \verb+\jfont+. So please see Subsection~\ref{ssec-jfont}.
876 %</en>
877 %<*ja>
878 \paragraph{plain \TeX}
879 plain \TeX で和文フォントを変更するためには,\verb+\jfont+ プリミティブを用いなけれ
880 ばならない.\ref{ssec-jfont}節を参照.
881 %</ja>
882
883 %<*en>
884 \paragraph{NFSS2}
885 For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (in \texttt{plfonts.dtx}).
886 %</en>
887 %<*ja>
888 \paragraph{NFSS2}
889 \LaTeXe については,\LuaTeX-jaではフォント選択システムを\pLaTeXe\ (\texttt{plfonts.dtx})
890 の大部分をそのまま採用している.
891 %</ja>
892 \begin{itemize}
893 %<*en>
894 \item Two control sequences \verb+\mcdefault+ and \verb+\gtdefault+ are
895       used to specify the default font families for \emph{mincho} and
896       \emph{gothic}, respectively. Default values: \texttt{mc} for
897       \verb+\mcdefault+ and \texttt{gt} for \verb+\gtdefault+.
898 %</en>
899 %<*ja>
900 \item 2つのコントロールシーケンス \verb+\mcdefault+ と \verb+\gtdefault+ がそれぞ
901       れ明朝体とゴシック体のデフォルトのフォントファミリを指定するために用いられる.
902       初期値:\verb+\mcdefault+ は\texttt{mc},\verb+\gtdefault+ は\texttt{gt}.
903 %</ja>
904 %<*en>
905 \item Commands \verb+\fontfamily+, \verb+\fontseries+,
906       \verb+\fontshape+ and \verb+\selectfont+ can be used to change
907       attributes of Japanese fonts.
908 %</en>
909 %<*ja>
910 \item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして
911       \verb+\selectfont+ が和文フォントの属性を変更するために使用できる.
912 %</ja>
913
914 %<*en>
915 \begin{center}
916 \begin{tabular}{cccccc}
917 \toprule
918 &\textbf{encoding}&\textbf{family}&\textbf{series}&\textbf{shape}&\textbf{selection}\\\midrule
919 alphabetic fonts
920 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
921 &\verb+\useroman+\\
922 Japanese fonts
923 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
924 &\verb+\usekanji+\\
925 both&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
926 auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
927 \bottomrule
928 \end{tabular}
929 \end{center}
930 %</en>
931 %<*ja>
932 \begin{center}
933 \begin{tabular}{cccccc}
934 \toprule
935 &\textbf{エンコーディング}&\textbf{ファミリ}&\textbf{シリーズ}&\textbf{シェープ}&\textbf{選択}\\\midrule
936 欧文フォント
937 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
938 &\verb+\useroman+\\
939 和文フォント
940 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
941 &\verb+\usekanji+\\
942 両方&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
943 自動選択&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
944 \bottomrule
945 \end{tabular}
946 \end{center}
947 %</ja>
948
949 %<*en>
950       \verb+\fontencoding{<encoding>}+ changes the encoding of alphabetic fonts
951       or Japanese fonts depending on the argument. For example,
952       \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to
953       \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of
954       alphabetic fonts to \texttt{T1}.
955       \verb+\fontfamily+ also changes the family of Japanese fonts, alphabetic
956       fonts, \emph{or both}. For detail, see Subsection~\ref{ssub-nfsspat}.
957 %</en>
958 %<*ja>
959       ここで,\verb+\fontencoding{<encoding>}+ は,引数により和文側か欧文
960       側かのどちらかのエンコーディングを変更する.例えば,
961       \verb+\fontencoding{JY3}+ は和文フォントのエンコーディングを
962       \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を
963       \texttt{T1}へと変更する.\verb+\fontfamily+ も引数により和文側,欧文
964       側,\textbf{あるいは両方}のフォントファミリを変更する.詳細は
965       \ref{ssub-nfsspat}節を参照すること.
966 %</ja>
967
968 %<*en>
969 \item For defining a Japanese font family, use
970       \verb+\DeclareKanjiFamily+ instead of
971       \verb+\DeclareFontFamily+. However, in the present implementation,
972       using \verb+\DeclareFontFamily+ doesn't cause any problem.
973 %</en>
974 %<*ja>
975 \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の
976       代わりに \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の
977       実装では \verb+\DeclareFontFamily+ を用いても問題は生じない.
978 %</ja>
979 \end{itemize}
980
981 \subsection{fontspec}
982 \label{ssec-fontspec}
983 %<*en>
984 To coexist with the \Pkg{fontspec} package, it is needed to load
985 \Pkg{luatexja-fontspec} package in the preamble. This additional
986 package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
987 package, if needed.
988 %</en>
989 %<*ja>
990 \Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いるためには,
991 \Pkg{luatexja-fontspec}パッケージをプリアンブルで読み込む必要がある.このパッケージ
992 は必要ならば自動で\Pkg{luatexja}パッケージと\Pkg{fontspec}パッケージを読み込む.
993 %</ja>
994
995 %<*en>
996 In \Pkg{luatexja-fontspec} package, the following 7~commands are defined as
997 counterparts of original commands in the \Pkg{fontspec} package:
998 %</en>
999 %<*ja>
1000 \Pkg{luatexja-fontspec}パッケージでは,以下の7つのコマンドを\Pkg{fontspec}
1001 パッケージの元のコマンドに対応するものとして定義している:
1002 %</ja>
1003 %<*en>
1004 \begin{center}
1005 \begin{tabular}{ccccc}
1006 \toprule
1007 Japanese fonts
1008 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1009 alphabetic fonts
1010 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1011 \midrule
1012 Japanese fonts
1013 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1014 alphabetic fonts
1015 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1016 \bottomrule
1017 \end{tabular}
1018 \end{center}
1019 %</en>
1020 %<*ja>
1021 \begin{center}
1022 \begin{tabular}{ccccc}
1023 \toprule
1024 和文フォント
1025 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1026 欧文フォント
1027 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1028 \midrule
1029 和文フォント
1030 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1031 欧文フォント
1032 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1033 \bottomrule
1034 \end{tabular}
1035 \end{center}
1036 %</ja>
1037
1038 \begin{LTXexample}
1039 \fontspec[Numbers=OldStyle]{TeX Gyre Termes}
1040 \jfontspec{IPAexMincho}
1041 JIS~X~0213:2004→辻
1042
1043 \addjfontfeatures{CJKShape=JIS1990}
1044 JIS~X~0208:1990→辻
1045 \end{LTXexample}
1046
1047 %<*en>
1048 Note that there is no command named \verb+\setmonojfont+, since it is
1049 popular for Japanese fonts that nearly all Japanese glyphs have same
1050 widths.  Also note that the kerning feature is set off by default in
1051 these 7~commands, since this feature and \textbf{JAglue} will clash (see
1052 \ref{para-kern}).
1053 %</en>
1054 %<*ja>
1055 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
1056 \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
1057 ンドではKerning featureはデフォルトではoffとなっている.これはこの
1058 featureが\textbf{JAglue}と衝突するためである(\ref{para-kern}節を参照).
1059 %</ja>
1060
1061 %<en>\section{Changing Parameters}
1062 %<ja>\section{パラメータの変更}
1063
1064 %<*en>
1065 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
1066 most of them are not stored as internal register of \TeX, but as an
1067 original storage system in \LuaTeX-ja. Hence, to assign or acquire those
1068 parameters, you have to use commands \verb+\ltjsetparameter+ and
1069 \verb+\ltjgetparameter+.
1070 %</en>
1071 %<*ja>
1072 \LuaTeX-jaには多くのパラメータが存在する.そして\LuaTeX の仕様のために,
1073 その多くは\TeX のレジスタにではなく,\LuaTeX-ja独自の方法で保持されている.
1074 そのため,これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ を
1075 用いる必要がある.
1076 %</ja>
1077
1078 %<en>\subsection{Editing the range of \textbf{JAchar}s}
1079 %<ja>\subsection{\textbf{JAchar}の範囲の設定}
1080
1081 %<*en>
1082 To edit the range of \textbf{JAchar}s, you have to assign a non-zero
1083 natural number which is less than 217 to the character range first. This
1084 can be done by using \verb+\ltjdefcharrange+ primitive. For example, the
1085 next line assigns whole characters in Supplementary Ideographic Plane
1086 and the character `漢' to the range number~100.
1087 %</en>
1088 %<*ja>
1089 \textbf{JAchar}の範囲を設定するためには,まず各文字に0より大きく217より小さいindexを
1090 割り当てる必要がある.これには \verb+\ltjdefcharrange+ プリミティブを用いる.
1091 例えば,次のように書くことで追加漢字面(SIP)にある全ての文字と`漢'が
1092 「100番の文字範囲」に属するように設定される.
1093 %</ja>
1094 \begin{lstlisting}
1095 \ltjdefcharrange{100}{"10000-"1FFFF,`漢}
1096 \end{lstlisting}
1097 %<*en>
1098 This assignment of numbers to ranges are always global, so you should
1099 not do this in the middle of a document.
1100 %</en>
1101 %<*ja>
1102 この文字範囲の割り当ては常にグローバルであり,したがって文書の途中で
1103 この操作をするべきではない.
1104 %</ja>
1105
1106 %<*en>
1107 If some character has been belonged to some non-zero numbered range,
1108 this will be overwritten by the new setting. For example, whole SIP
1109 belong to the range~4 in the default setting of \LuaTeX-ja, and if you
1110 specify the above line, then SIP will belong to the range~100 and be
1111 removed from the range~4.
1112 %</en>
1113 %<*ja>
1114 もし指定されたある文字がある非零番号の範囲に属していたならば,これは新しい設定で
1115 上書きされる.例えば,SIPは全て\LuaTeX-jaのデフォルトでは4番の文字範囲に
1116 属しているが,上記の指定を行えばSIPは100番に属すようになり,4番からは除かれる.
1117 %</ja>
1118
1119 %<*en>
1120 After assigning numbers to ranges, the \textsf{jacharrange} parameter can
1121 be used to customize which character range will be treated as ranges of
1122 \textbf{JAchar}s, as the following line (this is just the default
1123 setting of \LuaTeX-ja):
1124 %</en>
1125 %<*ja>
1126 文字範囲に番号を割り当てた後は,\textsf{jacharrange}パラメータが\textbf{JAchar}と
1127 して扱われる文字の範囲を設定するために用いられる.例えば,以下は\LuaTeX-jaの
1128 初期設定である:
1129 %</ja>
1130 \begin{verbatim}
1131 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
1132 \end{verbatim}
1133 %<*en>
1134 The argument to \textsf{jacharrange} parameter is a list of integer.
1135 Negative integer $-n$ in the list means that `the characters that belong to
1136 range~$n$ are treated as \textbf{ALchar}', and positive integer $+n$ means
1137 that `the characters that belong to range~$n$ are treated as \textbf{JAchar}'.
1138 %</en>
1139 %<*ja>
1140 \textsf{jacharrange}パラメータには整数のリストを与える.
1141 リスト中の負の整数$-n$は「文字範囲$n$に属する文字は\textbf{ALchar}として
1142 扱われる」ことを意味し,正の整数$+n$は\textbf{JAchar}として扱うことを意味する.
1143 %</ja>
1144
1145 %<*en>
1146 \paragraph{Default Setting}
1147 \LuaTeX-ja predefines eight character ranges for convenience. They are
1148 determined from the following data:
1149 %</en>
1150 %<*ja>
1151 \paragraph{初期設定}
1152 \LuaTeX-jaでは8つの文字範囲を設定している.これらは以下のデータに基づいて決定して
1153 いる.
1154 %</ja>
1155 \begin{itemize}
1156 %<*en>
1157 \item Blocks in Unicode~6.0.
1158 %</en>
1159 %<*ja>
1160 \item Unicode~6.0のブロック.
1161 %</ja>
1162 %<*en>
1163 \item The \texttt{Adobe-Japan1-UCS2} mapping between a CID Adobe-Japan1-6 and Unicode.
1164 %</en>
1165 %<*ja>
1166 \item \texttt{Adobe-Japan1-UCS2}によるAdobe-Japan1-6のCIDとUnicodeの間の
1167       マッピング.
1168 %</ja>
1169 %<*en>
1170 \item The \texttt{PXbase} bundle for \upTeX\ by Takayuki Yato.
1171 %</en>
1172 %<*ja>
1173 \item 八登崇之氏による\upTeX 用の\texttt{PXbase}バンドル.
1174 %</ja>
1175 \end{itemize}
1176
1177 %<*en>
1178 Now we describe these eight ranges. The alphabet `J' or `A' after the
1179 number shows whether characters in the range is treated as
1180 \textbf{JAchar}s or not by default. These settings are similar to the
1181 \texttt{prefercjk} settings defined in \texttt{PXbase} bundle.
1182 %</en>
1183 %<*ja>
1184 以下ではこれら8つの文字範囲について記述する.番号のあとのアルファベット`J'と`A'
1185 はデフォルトで\textbf{JAchar}か\textbf{ALchar}かを表している.これらの設定は
1186 \texttt{PXbase}バンドルで定義されている\texttt{prefercjk}と類似のものである.
1187 %</ja>
1188 \begin{description}
1189 %<*en>
1190 \item[Range~8${}^{\text{J}}$] Symbols in the intersection of the upper half of ISO~8859-1
1191          (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range
1192          consists of the following characters:
1193 %</en>
1194 %<*ja>
1195 \item[範囲8${}^{\text{J}}$] ISO~8859-1の上位領域(ラテン1補助)と
1196                              JIS~X~0208の共通部分にある記号.この文字範囲は
1197                              以下の文字で構成される:
1198 %</ja>
1199 \begin{multicols}{2}
1200 \begin{itemize}
1201 \def\ch#1#2{\item \char"#1\ (\texttt{U+00#1}, #2)}%"
1202 %<*en>
1203 \ch{A7}{Section Sign}
1204 \ch{A8}{Diaeresis}
1205 \ch{B0}{Degree sign}
1206 \ch{B1}{Plus-minus sign}
1207 \ch{B4}{Spacing acute}
1208 \ch{B6}{Paragraph sign}
1209 \ch{D7}{Multiplication sign}
1210 \ch{F7}{Division Sign}
1211 %</en>
1212 %<*ja>
1213 \ch{A7}{節記号}
1214 \ch{A8}{トレマ}
1215 \ch{B0}{度}
1216 \ch{B1}{正又は負符号}
1217 \ch{B4}{アキュート・アクセント}
1218 \ch{B6}{段落記号}
1219 \ch{D7}{乗算記号}
1220 \ch{F7}{除算記号}
1221 %</ja>
1222 \end{itemize}
1223 \end{multicols}
1224
1225 %<*en>
1226 \item[Range~1${}^{\text{A}}$] Latin characters that some of them are included in Adobe-Japan1-6.
1227 This range consist of the following Unicode ranges, \emph{except characters in the range~8 above}:
1228 %</en>
1229 %<*ja>
1230 \item[範囲1${}^{\text{A}}$] ラテン文字.一部はAdobe-Japan1-6にも含まれている.
1231                              この範囲は以下のUnicodeのブロックから構成されている.
1232                              \textbf{ただし,範囲8は除く.}
1233 %</ja>
1234 \begin{multicols}{2}
1235 \begin{itemize}
1236 %<*en>
1237 \item \texttt{U+0080}--\texttt{U+00FF}: Latin-1 Supplement
1238 \item \texttt{U+0100}--\texttt{U+017F}: Latin Extended-A
1239 \item \texttt{U+0180}--\texttt{U+024F}: Latin Extended-B
1240 \item \texttt{U+0250}--\texttt{U+02AF}: IPA Extensions
1241 \item \texttt{U+02B0}--\texttt{U+02FF}: Spacing Modifier Letters
1242 \item \texttt{U+0300}--\texttt{U+036F}: Combining Diacritical Marks
1243 \item \texttt{U+1E00}--\texttt{U+1EFF}: Latin Extended Additional
1244 %</en>
1245 %<*ja>
1246 \item \texttt{U+0080}--\texttt{U+00FF}: ラテン1補助
1247 \item \texttt{U+0100}--\texttt{U+017F}: ラテン文字拡張A
1248 \item \texttt{U+0180}--\texttt{U+024F}: ラテン文字拡張B
1249 \item \texttt{U+0250}--\texttt{U+02AF}: IPA拡張(国際音声記号)
1250 \item \texttt{U+02B0}--\texttt{U+02FF}: 前進を伴う修飾文字
1251 \item \texttt{U+0300}--\texttt{U+036F}: ダイアクリティカルマーク(合成可能)
1252 \item \texttt{U+1E00}--\texttt{U+1EFF}: ラテン文字拡張追加
1253 %</ja>
1254 \par\
1255 \end{itemize}
1256 \end{multicols}
1257 %<*en>
1258 \item[Range~2${}^{\text{J}}$] Greek and Cyrillic letters. JIS~X~0208 (hence most of Japanese
1259            fonts) has some of these characters.
1260 %</en>
1261 %<*ja>
1262 \item[範囲2${}^{\text{J}}$] ギリシャ文字とキリル文字.JIS~X~0208(したがって多くの
1263                              和文フォント)はこれらの文字を持つ.
1264 %</ja>
1265 \begin{multicols}{2}
1266 \begin{itemize}
1267 %<*en>
1268 \item \texttt{U+0370}--\texttt{U+03FF}: Greek and Coptic
1269 \item \texttt{U+0400}--\texttt{U+04FF}: Cyrillic
1270 \item \texttt{U+1F00}--\texttt{U+1FFF}: Greek Extended
1271 %</en>
1272 %<*ja>
1273 \item \texttt{U+0370}--\texttt{U+03FF}: ギリシア文字及びコプト文字
1274 \item \texttt{U+0400}--\texttt{U+04FF}: キリル文字
1275 \item \texttt{U+1F00}--\texttt{U+1FFF}: キリル文字補助
1276 %</ja>
1277 \\\
1278 \end{itemize}
1279 \end{multicols}
1280 %<*en>
1281 \item[Range~3${}^{\text{J}}$] Punctuations and Miscellaneous symbols. The block list is
1282            indicated in Table~\ref{table-rng3}.
1283 %</en>
1284 %<*ja>
1285 \item[範囲3${}^{\text{J}}$] 句読点と記号類.ブロックのリストは表\ref{table-rng3}%
1286                              に示してある.
1287 %</ja>
1288 \begin{table}[!tb]
1289 %<*en>
1290 \caption{Unicode blocks in predefined character range~3.}
1291 %</en>
1292 %<*ja>
1293 \caption{文字範囲3に指定されているUnicodeブロック.}
1294 %</ja>
1295 \label{table-rng3}
1296 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1297 \begin{center}\small
1298 \begin{tabular}{llll}
1299 %<*en>
1300 "2000--"206F&General Punctuation&
1301 "2070--"209F&Superscripts and Subscripts\\
1302 "20A0--"20CF&Currency Symbols&
1303 "20D0--"20FF&Comb.\ Diacritical Marks for Symbols\\
1304 "2100--"214F&Letterlike Symbols&
1305 "2150--"218F&Number Forms\\
1306 "2190--"21FF&Arrows&
1307 "2200--"22FF&Mathematical Operators\\
1308 "2300--"23FF&Miscellaneous Technical&
1309 "2400--"243F&Control Pictures\\
1310 "2500--"257F&Box Drawing&
1311 "2580--"259F&Block Elements\\
1312 "25A0--"25FF&Geometric Shapes&
1313 "2600--"26FF&Miscellaneous Symbols\\
1314 "2700--"27BF&Dingbats&
1315 "2900--"297F&Supplemental Arrows-B\\
1316 "2980--"29FF&Misc.\ Mathematical Symbols-B&
1317 "2B00--"2BFF&Miscellaneous Symbols and Arrows\\
1318 "E000--"F8FF&Private Use Area&
1319 %</en>
1320 %<*ja>
1321 "2000--"206F&一般句読点&
1322 "2070--"209F&上付き・下付き\\
1323 "20A0--"20CF&通貨記号&
1324 "20D0--"20FF&記号用ダイアクリティカルマーク(合成可能)\\
1325 "2100--"214F&文字様記号&
1326 "2150--"218F&数字に準じるもの\\
1327 "2190--"21FF&矢印&
1328 "2200--"22FF&数学記号(演算子)\\
1329 "2300--"23FF&その他の技術用記号&
1330 "2400--"243F&制御機能用記号\\
1331 "2500--"257F&罫線素片&
1332 "2580--"259F&ブロック要素\\
1333 "25A0--"25FF&幾何学模様&
1334 "2600--"26FF&その他の記号\\
1335 "2700--"27BF&装飾記号&
1336 "2900--"297F&補助矢印B\\
1337 "2980--"29FF&その他の数学記号B&
1338 "2B00--"2BFF&その他の記号及び矢印\\
1339 "E000--"F8FF&私用領域(外字領域)&
1340 %</ja>
1341 \end{tabular}
1342 \end{center}
1343 \end{table}
1344 %<*en>
1345 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
1346            of almost all Unicode blocks which are not in other
1347            predefined ranges. Hence, instead of showing the block list,
1348            we put the definition of this range itself:
1349 %</en>
1350 %<*ja>
1351 \item[範囲4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
1352                              この範囲は他の範囲にないほとんど全てのUnicodeブロック
1353                              で構成されている.したがって,ブロックのリストを示す
1354                              代わりに,範囲の定義そのものを示す:
1355 %</ja>
1356 \begin{lstlisting}
1357 \ltjdefcharrange{4}{%
1358    "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
1359   "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F,
1360   "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF} % non-Japanese
1361 \end{lstlisting}
1362 %<*en>
1363 \item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
1364 %</en>
1365 %<*ja>
1366 \item[範囲5${}^{\text{A}}$] 代用符号と補助私用領域.
1367 %</ja>
1368 %<*en>
1369 \item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
1370 %</en>
1371 %<*ja>
1372 \item[範囲6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは
1373                              表\ref{table-rng6}に示す.
1374 %</ja>
1375 \begin{table}[!tb]
1376 %<*en>
1377 \caption{Unicode blocks in predefined character range~6.}
1378 %</en>
1379 %<*ja>
1380 \caption{文字範囲6に指定されているUnicodeブロック.}
1381 %</ja>
1382 \label{table-rng6}
1383 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1384 \begin{center}\small
1385 \begin{tabular}{llll}
1386 %<*en>
1387 "2460--"24FF&Enclosed Alphanumerics&
1388 "2E80--"2EFF&CJK Radicals Supplement\\
1389 "3000--"303F&CJK Symbols and Punctuation&
1390 "3040--"309F&Hiragana\\
1391 "30A0--"30FF&Katakana&
1392 "3190--"319F&Kanbun\\
1393 "31F0--"31FF&Katakana Phonetic Extensions&
1394 "3200--"32FF&Enclosed CJK Letters and Months\\
1395 "3300--"33FF&CJK Compatibility&
1396 "3400--"4DBF&CJK Unified Ideographs Extension A\\
1397 "4E00--"9FFF&CJK Unified Ideographs&
1398 "F900--"FAFF&CJK Compatibility Ideographs\\
1399 "FE10--"FE1F&Vertical Forms&
1400 "FE30--"FE4F&CJK Compatibility Forms\\
1401 "FE50--"FE6F&Small Form Variants&
1402 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)
1403 %</en>
1404 %<*ja>
1405 "2460--"24FF&囲み英数字&
1406 "2E80--"2EFF&CJK部首補助\\
1407 "3000--"303F&CJKの記号及び句読点&
1408 "3040--"309F&平仮名\\
1409 "30A0--"30FF&片仮名&
1410 "3190--"319F&漢文用記号(返り点)\\
1411 "31F0--"31FF&片仮名拡張&
1412 "3200--"32FF&囲みCJK文字・月\\
1413 "3300--"33FF&CJK互換用文字&
1414 "3400--"4DBF&CJK統合漢字拡張A\\
1415 "4E00--"9FFF&CJK統合漢字&
1416 "F900--"FAFF&CJK互換漢字\\
1417 "FE10--"FE1F&縦書き形&
1418 "FE30--"FE4F&CJK互換形\\
1419 "FE50--"FE6F&小字形&
1420 "{20}000--"{2F}FFF&(追加漢字面)
1421 %</ja>
1422 \end{tabular}
1423 \end{center}
1424 \end{table}
1425 %<*en>
1426 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in  Adobe-Japan1-6.
1427 The block list is indicated in Table~\ref{table-rng7}.
1428 %</en>
1429 %<*ja>
1430 \item[範囲7${}^{\text{J}}$] CJK言語で用いられる文字のうち,Adobe-Japan1-6に
1431                             含まれていないもの.
1432                             ブロックのリストは表\ref{table-rng7}に示す.
1433 %</ja>
1434 \begin{table}[!tb]
1435 %<*en>
1436 \caption{Unicode blocks in predefined character range~7.}
1437 %</en>
1438 %<*ja>
1439 \caption{文字範囲7に指定されているUnicodeブロック.}
1440 %</ja>
1441 \label{table-rng7}
1442 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1443 \begin{center}\small
1444 \begin{tabular}{llll}
1445 %<*en>
1446 "1100--"11FF&Hangul Jamo&
1447 "2F00--"2FDF&Kangxi Radicals\\
1448 "2FF0--"2FFF&Ideographic Description Characters&
1449 "3100--"312F&Bopomofo\\
1450 "3130--"318F&Hangul Compatibility Jamo&
1451 "31A0--"31BF&Bopomofo Extended\\
1452 "31C0--"31EF&CJK Strokes&
1453 "A000--"A48F&Yi Syllables\\
1454 "A490--"A4CF&Yi Radicals&
1455 "A830--"A83F&Common Indic Number Forms\\
1456 "AC00--"D7AF&Hangul Syllables&
1457 "D7B0--"D7FF&Hangul Jamo Extended-B
1458 %</en>
1459 %<*ja>
1460 "1100--"11FF&ハングル字母&
1461 "2F00--"2FDF&康熙部首\\
1462 "2FF0--"2FFF&漢字構成記述文字&
1463 "3100--"312F&注音字母 (注音符号)\\
1464 "3130--"318F&ハングル互換字母&
1465 "31A0--"31BF&注音字母拡張\\
1466 "31C0--"31EF&CJKの筆画&
1467 "A000--"A48F&イ文字\\
1468 "A490--"A4CF&イ文字部首&
1469 "A830--"A83F&共通インド数字に準じるもの\\
1470 "AC00--"D7AF&ハングル音節文字&
1471 "D7B0--"D7FF&ハングル字母拡張B
1472 %</ja>
1473 \end{tabular}
1474 \end{center}
1475 \end{table}
1476 \end{description}
1477
1478
1479 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
1480 %<ja>\subsection{\Param{kanjiskip}と\Param{xkanjiskip}}
1481 \label{subs-kskip}
1482
1483 %<*en>
1484 \textbf{JAglue} is divided into the following three categories:
1485 %</en>
1486 %<*ja>
1487 \textbf{JAglue}は以下の3つのカテゴリに分類される:
1488 %</ja>
1489 \begin{itemize}
1490 %<*en>
1491 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
1492       around a Japanese character, this glue will not be inserted at the
1493       place.
1494 %</en>
1495 %<*ja>
1496 \item JFMで指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
1497       発行されていれば,このグルーは挿入されない.
1498 %</ja>
1499 %<*en>
1500 \item The default glue which inserted between two \textbf{JAchar}s (\Param{%
1501       kanjiskip}).
1502 %</en>
1503 %<*ja>
1504 \item デフォルトで2つの\textbf{JAchar}の間に挿入されるグルー(\Param{kanjiskip}).
1505 %</ja>
1506 %<*en>
1507 \item The default glue which inserted between a \textbf{JAchar} and an
1508       \textbf{ALchar} (\Param{xkanjiskip}).
1509 %</en>
1510 %<*ja>
1511 \item デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルー(\Param{xkanjiskip}).
1512 %</ja>
1513 \end{itemize}
1514 %<*en>
1515 The value (a skip) of \Param{kanjiskip} or \Param{xkanjiskip} can be
1516 changed as the following.
1517 %</en>
1518 %<*ja>
1519 \Param{kanjiskip}や\Param{xkanjiskip}の値は以下のようにして変更可能である.
1520 %</ja>
1521 \begin{lstlisting}
1522 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
1523                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
1524 \end{lstlisting}
1525
1526 %<*en>
1527 It may occur that JFM contains the data of `ideal width of \Param{kanjiskip}'
1528 and/or `ideal width of \Param{xkanjiskip}'.
1529 To use these data from JFM, set the value of \Param{kanjiskip} or
1530 \Param{xkanjiskip} to \verb+\maxdimen+.
1531 %</en>
1532 %<*ja>
1533 JFMは「望ましい\Param{kanjiskip}の値」や「望ましい\Param{xkanjiskip}の値」を
1534 持っていることがある.
1535 これらのデータを使うためには,\Param{kanjiskip}や\Param{xkanjiskip}の
1536 値を \verb+\maxdimen+ の値に設定すればよい.
1537 %</ja>
1538
1539 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
1540 %<ja>\subsection{\Param{xkanjiskip} の設定の挿入}
1541
1542 %<*en>
1543 It is not desirable that \Param{xkanjiskip} is inserted into every
1544 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
1545 \Param{xkanjiskip} should not be inserted after opening parenthesis
1546 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
1547 \LuaTeX-ja can control whether \Param{xkanjiskip} can be inserted
1548 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
1549 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
1550 %</en>
1551 %<*ja>
1552 \Param{xkanjiskip}がすべての\textbf{JAchar}と\textbf{ALchar}の境界に
1553 挿入されるのは望ましいことではない.例えば,\Param{xkanjiskip}は開き括弧の
1554 後には挿入されるべきではない(`(あ'と`(\hskip\ltjgetparameter{xkanjiskip}あ'を
1555 比べてみよ).
1556 \LuaTeX-jaでは\Param{xkanjiskip}をある文字の前/後に挿入するかどうかを,
1557 \textbf{JAchar}に対しては\Param{jaxspmode}を,\textbf{ALchar}に対しては
1558 \Param{alxspmode}をそれぞれ変えることで制御することができる.
1559 %</ja>
1560 \begin{LTXexample}
1561 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
1562 pあq い!う
1563 \end{LTXexample}
1564
1565 %<*en>
1566 The second argument \texttt{preonly} means `the insertion of
1567 \Param{xkanjiskip} is allowed before this character, but not after'.
1568 the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{
1569 inhibit}.
1570 %</en>
1571 %<*ja>
1572 2つ目の引数の \texttt{preonly}は「\Param{xkanjiskip}の挿入はこの文字の
1573 前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は
1574 \texttt{postonly}, \texttt{allow}, \texttt{inhibit}である.
1575 %</ja>
1576
1577 %<*en>
1578 \Param{jaxspmode} and \Param{alxspmode} use a same table to store the parameters
1579 on the current version. Therefore, line 1 in the code above can be rewritten
1580 as follows:
1581 %</en>
1582 %<*ja>
1583 なお,現行の
1584 仕様では,\Param{jaxspmode}, \Param{alxspmode}はテーブルを共有しており,
1585 上のコードの1行目を次のように変えても同じことになる:
1586 %</ja>
1587 \begin{verbatim}
1588 \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
1589 \end{verbatim}
1590 %<*en>
1591 One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}).
1592 %</en>
1593 %<*ja>
1594 また,これら2パラメータには数値で値を指定することもできる(\ref{ssec-param}節を参照).
1595 %</ja>
1596
1597 %<*en>
1598 If you want to enable/disable all insertions of \Param{kanjiskip} and
1599 \Param{xkanjiskip}, set \Param{autospacing} and \Param{autoxspacing}
1600 parameters to \texttt{true}/\texttt{false}, respectively.
1601 %</en>
1602 %<*ja>
1603 もし全ての\Param{kanjiskip}と\Param{xkanjiskip}の挿入を有効化/無効化
1604 したければ,それぞれ\Param{autospacing}と\Param{autoxspacing}を
1605 \texttt{true}/\texttt{false}に設定すればよい.
1606 %</ja>
1607
1608 %<en>\subsection{Shifting Baseline}
1609 %<ja>\subsection{ベースラインの移動}
1610
1611 %<*en>
1612 To make a match between a Japanese font and an alphabetic font, sometimes
1613 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
1614 by setting \verb+\ybaselineshift+ to a non-zero length (the
1615 baseline of alphabetic fonts is shifted below). However, for documents
1616 whose main language is not Japanese, it is good to shift the baseline of
1617 Japanese fonts, but not that of alphabetic fonts.
1618 Because of this, \LuaTeX-ja can independently set the shifting amount
1619 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
1620 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
1621 parameter).
1622 %</en>
1623 %<*ja>
1624 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
1625 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで
1626 なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない
1627 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
1628 このため,\LuaTeX-jaでは欧文フォントのベースラインのシフト量
1629 (\Param{yalbaselineshift}パラメータ)と和文フォントのベースラインのシフト量
1630 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
1631 %</ja>
1632
1633 \begin{LTXexample}
1634 \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
1635 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
1636 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
1637 \end{LTXexample}
1638 %<*en>
1639 Here the horizontal line in above is the baseline of a line.
1640 %</en>
1641 %<*ja>
1642 上の例において引かれている水平線がベースラインである.
1643 %</ja>
1644
1645 %<*en>
1646 There is an interesting side-effect: characters in different size can be
1647 vertically aligned center in a line, by setting two parameters appropriately.
1648 The following is an example (beware the value is not well tuned):
1649 %</en>
1650 %<*ja>
1651 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
1652 異なる文字を中心線に揃えることができるのだ.
1653 以下は一つの例である(値はあまり調整されていないことに注意):
1654 %</ja>
1655 \begin{LTXexample}
1656 xyz漢字
1657 {\scriptsize
1658   \ltjsetparameter{yjabaselineshift=-1pt,
1659     yalbaselineshift=-1pt}
1660   XYZひらがな
1661 }abcかな
1662 \end{LTXexample}
1663
1664
1665 %<en>\subsection{Cropmark}
1666 %<ja>\subsection{トンボ}
1667
1668 %<*en>
1669 Cropmark is a mark for indicating 4~corners and horizontal/vertical
1670 center of the paper. In Japanese, we call cropmark as tombo(w).
1671 \pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel.
1672 The following steps are needed to typeset cropmark:
1673 %</en>
1674 %<*ja>
1675 トンボは用紙の四つ角と水平/垂直方向の中心を表す印である.
1676 \pLaTeX と \LuaTeX-jaではトンボの出力をサポートしている.
1677 トンボを出力するためには以下の手順が必要である:
1678 %</ja>
1679
1680 \begin{enumerate}
1681 %<*en>
1682 \item First, define the banner which will be printed at the upper left
1683       of the paper. This is done by assigning a token list to
1684       \verb+\@bannertoken+.
1685
1686 For example, the following sets banner as `\texttt{filename (YYYY-MM-DD hh:mm)}':
1687 %</en>
1688 %<*ja>
1689 \item まず,用紙の左上に印刷されるバナーを定義する.これは \verb+\@bannertoken+
1690       にトークンリストを与えることでなされる.
1691
1692 例えば,以下はバナーとして`\texttt{filename (YYYY-MM-DD hh:mm)}'を設定する:
1693 %</ja>
1694
1695 \begin{verbatim}
1696 \makeatletter
1697
1698 \hour\time \divide\hour by 60 \@tempcnta\hour \multiply\@tempcnta 60\relax
1699 \minute\time \advance\minute-\@tempcnta
1700 \@bannertoken{%
1701    \jobname\space(\number\year-\two@digits\month-\two@digits\day
1702    \space\two@digits\hour:\two@digits\minute)}%
1703 \end{verbatim}
1704
1705 \item ...
1706 \end{enumerate}
1707
1708
1709 %<en>\part{Reference}
1710 %<ja>\part{リファレンス}
1711 \label{part-ref}
1712 %<en>\section{Font Metric and Japanese Font}
1713 %<ja>\section{フォントメトリックと和文フォント}
1714 %<en>\subsection{\texttt{\char92jfont} primitive}
1715 %<ja>\subsection{\texttt{\char92jfont}プリミティブ}
1716 \label{ssec-jfont}
1717
1718 %<*en>
1719 To load a font as a Japanese font, you must use the
1720 \verb+\jfont+ primitive instead of~\verb+\font+, while
1721 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
1722 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
1723 so TrueType/OpenType fonts with features can be used for Japanese fonts:
1724 %</en>
1725 %<*ja>
1726 フォントを和文フォントとして読み込むためには,\verb+\jfont+ プリミティブを
1727 \verb+\font+ プリミティブの代わりに用いる.
1728 \verb+\jfont+ プリミティブの文法は \verb+\font+ と同じである.
1729 \LuaTeX-jaは\Pkg{luaotfload}パッケージを自動的に読み込むので,
1730 TrueType/OpenTypeフォントにfeatureを指定したものを和文フォントとして用いる
1731 ことができる:
1732 %</ja>
1733 \begin{LTXexample}
1734 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
1735   +trad;-kern;jfm=ujis} at 14pt
1736 \tradgt{}当/体/医/区
1737 \end{LTXexample}
1738
1739 %<*en>
1740 Note that the defined control sequence
1741 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
1742 \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+
1743 causes a error.  We denote control sequences which are defined in
1744 \verb+\jfont+ by <jfont\_cs>.
1745 %</en>
1746 %<*ja>
1747 なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+)
1748 は\textit{font\_def}トークンではないので,\verb+\fontname\tradgt+ のような
1749 入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された
1750 コントロールシーケンスを<jfont\_cs>で表す.
1751 %</ja>
1752
1753 \paragraph{JFM}
1754 %<*en>
1755 As noted in Introduction, a JFM has measurements of characters and
1756 glues/kerns that are automatically inserted for Japanese
1757 typesetting. The structure of JFM will be described in the next
1758 subsection. At the calling of \verb+\jfont+ primitive, you must specify
1759 which JFM will be used for this font by the following keys:
1760 %</en>
1761 %<*ja>
1762 「はじめに」の節で述べたように,JFMは文字と和文組版で自動的に挿入される
1763 グルー/カーンの寸法情報を持っている.JFMの構造は次の小節で述べる.
1764 \verb+\jfont+ プリミティブの呼び出しの際には,どのJFMを用いるのかを以下のキーで
1765 指定する必要がある:
1766 %</ja>
1767
1768 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1769 \item[jfm=<name>]
1770 %<*en>
1771 Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
1772 a file named \texttt{jfm-<name>.lua}.
1773
1774 The following JFMs are shipped with \LuaTeX-ja:
1775 %</en>
1776 %<*ja>
1777 JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
1778 \texttt{jfm-<name>.lua}を読み込む.
1779
1780 以下のJFMが\LuaTeX-jaには同梱されている:
1781 %</ja>
1782 \begin{description}
1783 %<*en>
1784 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
1785   based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
1786   is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM.
1787 %</en>
1788 %<*ja>
1789 \item[\tt jfm-ujis.lua] \LuaTeX-jaの標準JFMである.このJFMは\upTeX で
1790   用いられるUTF/OTFパッケージ用のメトリックである \verb+upnmlminr-h.tfm+ を
1791   元にしている.\Pkg{luatexja-otf}パッケージを使うときはこのJFMを指定するべきである.
1792 %</ja>
1793 %<*en>
1794 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font
1795   metric' which is widely used in \pTeX. A major difference of
1796   \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
1797   most characters under \texttt{jfm-ujis.lua} are square-shaped,
1798   while that under \texttt{jfm-jis.lua} are horizontal
1799   rectangles.
1800 %</en>
1801 %<*ja>
1802 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JISフォントメトリック」
1803   \verb+jis.tfm+ に相当するJFMである.\texttt{jfm-ujis.lua}とこの
1804   \texttt{jfm-jis.lua}の主な違いは,\texttt{jfm-ujis.lua}ではほとんどの文字が
1805   正方形状であるのに対し,\texttt{jfm-jis.lua}では横長の長方形状である.
1806 %</ja>
1807 %<*en>
1808 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
1809   of the default Japanese font metric shipped with \pTeX. There
1810   are notable difference between this JFM and other 2~JFMs, as
1811   shown in Table~\ref{tab-difjfm}.
1812 %</en>
1813 %<*ja>
1814 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文フォントメトリック
1815   である \verb+min10.tfm+ に相当するJFMである.このJFMと他の2つのJFMの間には
1816   表\ref{tab-difjfm}に示すような特筆すべき違いがある.
1817 %</ja>
1818 \end{description}
1819
1820 \item[jfmvar=<string>] Sometimes there is a need that ...
1821 \end{list}
1822
1823 \begin{table}[t]
1824 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
1825 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
1826 \label{tab-difjfm}
1827 \ltjsetparameter{jacharrange={+3}}
1828 \begin{center}
1829 \def\r#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1830 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
1831 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
1832 \vrule height 0pt depth \dp0}}
1833 \def\s#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1834 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
1835 \def\t#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 19.24432pt \g
1836 \setbox0=\hbox{漢}%
1837 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
1838 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
1839 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1840 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1841 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
1842 \begin{tabular}{rccc}
1843 \toprule
1844 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
1845 \midrule
1846 %<en>Example~1\footnotemark
1847 %<ja>例1\footnotemark
1848 &\r{ujis}&\r{jis}&\r{min}\\
1849 %<en>Example~2
1850 %<ja>例2
1851 &\s{ujis}&\s{jis}&\s{min}\\
1852 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
1853 \bottomrule
1854 \end{tabular}
1855 \end{center}
1856 \ltjsetparameter{jacharrange={-3}}
1857 \end{table}
1858 \footnotetext{from: 乙部厳己, min10フォントについて.
1859 \texttt{http://argent.shinshu-u.ac.jp/\~{\ }otobe/tex/files/min10.pdf}.}
1860
1861 %<en>\paragraph{Note: kern feature}
1862 %<ja>\paragraph{注意:kern feature}
1863 \label{para-kern}
1864 %<*en>
1865 Some fonts have information for inter-glyph spacing. However, this
1866 information is not well-compatible with \LuaTeX-ja.  More concretely,
1867 this kerning space from this information are inserted \emph{before} the
1868 insertion process of \textbf{JAglue}, and this causes incorrect spacing
1869 between two characters when both a glue/kern from the data in the font
1870 and it from JFM are present.
1871 %</en>
1872 %<*ja>
1873 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
1874 この情報は\LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
1875 されるカーニングスペースは\textbf{JAglue}の挿入過程の\textbf{前に}挿入され,
1876 JFMに基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
1877 なる.
1878 %</ja>
1879
1880 \begin{itemize}
1881 %<*en>
1882 \item You should specify \texttt{-kern} in
1883   \verb+jfont+ primitive, when you want to use other font features,
1884   such as \texttt{script=...}\,.
1885 %</en>
1886 %<*ja>
1887 \item  \texttt{script=...}といったfeatureを使いたい場合には,\verb+\jfont+
1888   プリミティブに\texttt{-kern}を指定するべきである.
1889 %</ja>
1890 %<*en>
1891 \item If you want to use Japanese fonts in proportional width, and use
1892       information from this font, use \texttt{jfm-prop.lua} for its JFM, and ...
1893 %</en>
1894 %<*ja>
1895 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
1896   ならば,\texttt{jfm-prop.lua}をJFMとして指定し,……
1897 %</ja>
1898
1899 TODO: kanjiskip?
1900 \end{itemize}
1901
1902
1903 %<en>\subsection{Prefix \texttt{psft}}
1904 %<ja>\subsection{\texttt{psft}プリフィックス}
1905 \label{ssec-psft}
1906 %<*en>
1907 Besides \texttt{file:}\ and \texttt{name:}\ prefixes, one can use \texttt{psft:}\
1908 prefix in \verb+\jfont+ (and~\verb+\font+) primitive,
1909 to specify a `name-only' Japanese font which
1910 will not be embedded to PDF. Typical use of this prefix is to specify
1911 the `standard' Japanese fonts, namely, `Ryumin-Light' and
1912 `GothicBBB-Medium'.
1913 %</en>
1914 %<*ja>
1915 \texttt{file:}と\texttt{name:}のプリフィックスに加えて,
1916 \verb+\jfont+ プリミティブ(と \verb+\font+ プリミティブ)では
1917 \texttt{psft:}プリフィックスを用いることができる.
1918 このプリフィックスを用いることで,PDFには埋め込まれない「名前だけの」
1919 和文フォントを指定することができる.「標準的な」和文フォント,
1920 つまり`Ryumin-Light'と`GothicBBB-Medium'の指定でこのプリフィックスが使われる.
1921 %</ja>
1922
1923 %<en>\paragraph{\texttt{cid} key}
1924 %<ja>\paragraph{\texttt{cid}キー}
1925 \label{para-cid}
1926
1927 %<*en>
1928 The default font defined by using \texttt{psft:} prefix is for Japanese typesetting;
1929 it is Adobe-Japan1-6 CID-keyed font.
1930 One can specify \texttt{cid} key to use other CID-keyed non-embedded fonts
1931 for Chinese or Korean typesetting.
1932 \begin{lstlisting}[numbers=left]
1933 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % Japanese
1934 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % default value is Adobe-Japan1-6
1935 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % Traditional Chinese
1936 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % Simplified Chinese
1937 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % Korean
1938 \end{lstlisting}
1939 Note that the code above specifies \texttt{jfm-jis.lua}, which is for Japanese fonts,
1940 as JFM for Chinese and Korean fonts.
1941 %</en>
1942 %<*ja>
1943 標準で\texttt{psft:}プリフィックスで定義されるフォントは日本語用のもので
1944 あり,Adobe-Japan1-6のCIDに対応したものとなる.しかし,\LuaTeX-jaは中国語
1945 の組版にも威力を発揮することが分かり,日本語フォントでない非埋込フォント
1946 の対応も必要となった.そのために追加されたのが\texttt{cid}キーである.
1947
1948 \texttt{cid}キーに値を指定すると,そのCIDを持った非埋込フォントを定義することができる:
1949 \begin{lstlisting}[numbers=left]
1950 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % 日本語
1951 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % 無指定時は Adobe-Japan1-6
1952 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % 中国語繁体字
1953 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % 中国語簡体字
1954 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % 韓国語
1955 \end{lstlisting}
1956 上のコードでは中国語・韓国語用フォントに対してもJFMに
1957 日本語用の\texttt{jfm-jis.lua}を指定しているので注意されたい.
1958 %</ja>
1959
1960 %<*en>
1961 At present, \LuaTeX-ja supports only 4 values written in the sample code above.
1962 Specifying other values, e.g.,
1963 %</en>
1964 %<*ja>
1965 今のところ,\LuaTeX-jaは上のサンプルコード中に書いた4つの値しかサポートしていない.
1966 %</ja>
1967 \begin{lstlisting}
1968 \jfont\test={psft:Ryumin-Light:cid=Adobe-Japan2;jfm=jis}
1969 \end{lstlisting}
1970 %<*en>
1971 occurs the following error:
1972 %</en>
1973 %<*ja>
1974 のようにそれら以外の値を指定すると,
1975 %</ja>
1976 \begin{lstlisting}[numbers=left]
1977 ! Package luatexja Error: bad cid key `Adobe-Japan2'.
1978
1979 See the luatexja package documentation for explanation.
1980 Type  H <return>  for immediate help.
1981 <to be read again>
1982                    \par
1983 l.78
1984
1985 ? h
1986 I couldn't find any non-embedded font information for the CID
1987 `Adobe-Japan2'. For now, I'll use `Adobe-Japan1-6'.
1988 Please contact the LuaTeX-ja project team.
1989 ?
1990 \end{lstlisting}
1991 %<*ja>
1992 というエラーが出る.
1993 %</ja>
1994
1995 %<en>\subsection{Structure of JFM file}
1996 %<ja>\subsection{JFMファイルの構造}
1997
1998 %<*en>
1999 A JFM file is a Lua script which has only one function call:
2000 %</en>
2001 %<*ja>
2002 JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである:
2003 %</ja>
2004 \begin{verbatim}
2005 luatexja.jfont.define_jfm { ... }
2006 \end{verbatim}
2007 %<*en>
2008 Real data are stored in the table which indicated above by
2009 \verb+{ ... }+.  So, the rest of this subsection are devoted to describe the
2010 structure of this table.  Note that all lengths in a JFM file are
2011 floating-point numbers in design-size unit.
2012 %</en>
2013 %<*ja>
2014 実際のデータは上で \verb+{ ... }+ で示されたテーブルの中に格納されている.
2015 以下ではこのテーブルの構造について記す.
2016 なお,JFMファイル中の長さは全てdesign-sizeを単位とする浮動小数点数であることに
2017 注意する.
2018 %</ja>
2019
2020 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2021
2022 \item[dir=<direction>]
2023 %<en>(required)
2024 %<ja>(必須)
2025
2026 %<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
2027 %<ja>JFMの書字方向.現時点では\texttt{'yoko'}のみがサポートされる.
2028
2029 \item[zw=<length>]
2030 %<en>(required)
2031 %<ja>(必須)
2032
2033 %<en>The amount of the length of the `full-width'.
2034 %<ja>「全角幅」の長さ.
2035
2036 \item[zh=<length>]
2037 %<en>(required)
2038 %<ja>(必須)
2039
2040 %<en>The amount of the length of the `full-height' (height + depth).
2041 %<ja>「全角高さ」(height + depth)の長さ.
2042
2043 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}]
2044 %<en>(optional)
2045 %<ja>(任意)
2046
2047 %<*en>
2048 This field specifies the `ideal' amount of \Param{kanjiskip}. As noted
2049              in Subsection~\ref{subs-kskip}, if the parameter
2050              \Param{kanjiskip} is \verb+\maxdimen+, the value specified
2051              in this field is actually used (if this field is not specified in
2052              JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
2053              fields are in design-size unit too.
2054 %</en>
2055 %<*ja>
2056 「理想的な」\Param{kanjiskip}の量を指定する.\ref{subs-kskip}節で述べたように,
2057 もし\Param{kanjiskip}が \verb+\maxdimen+ の値ならば,このフィールドで指定された
2058 値が実際には用いられる(もしこのフィールドがJFMで指定されていなければ,
2059 0\,ptであるものとして扱われる).<stretch>と<shrink>のフィールドもdesign-size
2060 が単位であることに注意せよ.
2061 %</ja>
2062
2063 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}]
2064 %<en>(optional)
2065 %<ja>(任意)
2066
2067 %<*en>
2068 Like the \Param{kanjiskip} field, this field specifies the `ideal'
2069              amount of \Param{xkanjiskip}.
2070 %</en>
2071 %<*ja>
2072 \Param{kanjiskip}フィールドと同様に,\Param{xkanjiskip}の「理想的な」量を
2073 指定する.
2074 %</ja>
2075 \end{list}
2076
2077 %<*en>
2078 Besides from above fields, a JFM file have several sub-tables those
2079 indices are natural numbers.  The table indexed by~$i\in\omega$ stores
2080 information of `character class'~$i$. At least, the character class~0 is
2081 always present, so each JFM file must have a sub-table whose index is
2082 \texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
2083 the following fields:
2084 %</en>
2085 %<*ja>
2086 上記のフィールドに加えて,JFMファイルはそのインデックスが自然数であるいくつかの
2087 サブテーブルを持つ.インデックスが$i\in\omega$であるテーブルは「文字クラス」$i$の
2088 情報を格納する.少なくとも,文字クラス0は常に存在するので,JFMファイルはインデックス
2089 が\texttt{[0]}のサブテーブルを持たなければならない.それぞれのサブテーブル
2090 (そのインデックスを$i$で表わす)は以下のフィールドを持つ:
2091 %</ja>
2092
2093 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2094 \item[chars=\{<character>, ...\}]
2095 %<en>(required except character class~0)
2096 %<ja>(文字クラス0を除いて必須)
2097
2098 %<*en>
2099 This field is a list of characters which are in this character
2100              type~$i$. This field is not required if $i=0$, since all
2101              \textbf{JAchar} which are not in any character class other
2102              than 0 are in the character class 0
2103              (hence, the character class~0 contains most of
2104              \textbf{JAchar}s). In the list, a character can be
2105              specified by its code number, or by the character itself
2106              (as a string of length~1). Moreover, there are `imaginary
2107              characters' which specified in the list. We will describe these later.
2108 %</en>
2109 %<*ja>
2110 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
2111 場合には必須ではない.なぜならば,文字クラス0には,0以外の文字クラスに属するものを
2112 除いた全ての\textbf{JAchar}が属するからである(よって,文字クラス0はほとんどの
2113 \textbf{JAchar}を含む).このリストでは,文字はその文字コードを用いて,もしくは
2114 文字それ自体(長さ1の文字列)によって指定される.さらに,このリストで指定される
2115 「仮想的な文字」も存在する.これらについては後に記す.
2116 %</ja>
2117
2118 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
2119 %<en>(required)
2120 %<ja>(必須)
2121
2122 %<*en>
2123 Specify width of characters in character class~$i$, height, depth and
2124 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
2125 as values of these fields.
2126 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
2127 %</en>
2128 %<*ja>
2129 文字クラス$i$に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
2130 文字クラス$i$に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
2131 値であるものとして扱われる.
2132 しかし,例外が一つある:もし\texttt{'prop'}が\texttt{width}フィールドに
2133 指定された場合,文字の幅はその「実際の」グリフの幅となる.
2134 %</ja>
2135
2136 \item[left=<length>, down=<length>, align=<align>]\
2137
2138 %<*en>
2139 These fields are for adjusting the position of the `real' glyph. Legal
2140              values of \texttt{align} field are \texttt{'left'},
2141              \texttt{'middle'} and \texttt{'right'}. If one of these
2142              3~fields are omitted, \texttt{left} and \texttt{down} are
2143              treated as~0, and \texttt{align} field is treated as
2144              \texttt{'left'}.
2145 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
2146 %</en>
2147 %<*ja>
2148 これらのフィールドは「実際の」グリフの位置を調整するためにある.
2149 \texttt{align}フィールドに指定できる値は\texttt{'left'}, \texttt{'middle'},
2150 \texttt{'right'}のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
2151 場合,\texttt{left}と\texttt{down}は0,\texttt{align}フィールドは
2152 \texttt{'left'}であるものとして扱われる.
2153 これら3つのフィールドの意味については図\ref{fig-pos}で説明する.
2154 %</ja>
2155
2156 %<*en>
2157 In most cases, \texttt{left} and \texttt{down} fields are~0, while
2158 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
2159 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
2160 when the current character class is the class for opening delimiters'.
2161 %</en>
2162 %<*ja>
2163 多くの場合,\texttt{left}と\texttt{down}は0である一方,
2164 \texttt{align}フィールドが\texttt{'middle'}や\texttt{'right'}であることは
2165 珍しいことではない.
2166 例えば,\texttt{align}フィールドを\texttt{'right'}に指定することは,
2167 文字クラスが開き括弧類であるときに実際必要である.
2168 %</ja>
2169 \begin{figure}[!tb]
2170 \begin{minipage}{0.4\textwidth}%
2171 \begin{center}\unitlength=10pt\small
2172 \begin{picture}(15,12)(-1,-4)
2173 \color{black!10!white}% real glyph :step1
2174 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
2175
2176 \color{red!20!white}% real glyph :step1
2177 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2178
2179 \color{red}% real glyph
2180 \thicklines
2181 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2182 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
2183 \put(-1,5.5){\line(1,0){6}}
2184 \put(-1,-4){\line(1,0){6}}
2185
2186 \color{green!20!white}% real glyph :step1
2187 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2188
2189 \color{black}% real glyph :step1
2190 \thicklines
2191 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
2192 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
2193 \put(0,8){\line(1,0){12}}
2194 \put(0,-3){\line(1,0){12}}
2195 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
2196 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
2197 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
2198
2199 \color{green!50!black}% real glyph :step1
2200 \thicklines
2201 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2202 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
2203 \put(3,7){\line(1,0){6}}
2204 \put(3,-2.5){\line(1,0){6}}
2205 \newsavebox{\eqdist}
2206 \savebox{\eqdist}(0,0)[b]{%
2207   \thinlines
2208   \put(-0.08,0.2){\line(0,-1){0.4}}%
2209   \put(0.08,0.2){\line(0,-1){0.4}}}
2210 \put(1.5,0){\usebox{\eqdist}}
2211 \put(10.5,0){\usebox{\eqdist}}
2212
2213 \color{blue}% shifted
2214 \thicklines
2215 \put(3,-1.5){\vector(-1,0){4}}
2216 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
2217 \put(3,0){\vector(0,-1){1.5}}
2218 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
2219 \end{picture}
2220 \end{center}
2221 \end{minipage}%
2222 \begin{minipage}{0.6\textwidth}%
2223 %<*en>
2224 Consider a node containing Japanese character whose value of the \texttt{align}
2225 field is \texttt{'middle'}.
2226 %</en>
2227 %<*ja>
2228 \texttt{align}フィールドの値が\texttt{'middle'}である和文文字を含むノードを
2229 考えよう.
2230 %</ja>
2231 \begin{itemize}
2232 \item
2233 %<*en>
2234 The black rectangle is a frame of the node.
2235 Its width, height and depth are specified by JFM.
2236 %</en>
2237 %<*ja>
2238 黒色の長方形はノードの枠である.
2239 その幅,高さ,深さはJFMによって指定される.
2240 %</ja>
2241 \item
2242 %<*en>
2243 Since the \texttt{align} field is \texttt{'middle'},
2244 the `real' glyph is centered horizontally (the green rectangle).
2245 %</en>
2246 %<*ja>
2247 \texttt{align}フィールドは\texttt{middle}なので,「実際の」グリフは
2248 水平方向の中心に配置される(緑色の長方形).
2249 %</ja>
2250 \item
2251 %<*en>
2252 Furthermore, the glyph is shifted according to values of fields
2253       \texttt{left} and \texttt{down}. The ultimate position of the real
2254       glyph is indicated by the red rectangle.
2255 %</en>
2256 %<*ja>
2257 さらに,グリフは\texttt{left}と\texttt{down}の値に従ってシフトされる.
2258 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
2259 %</ja>
2260 \end{itemize}
2261 \end{minipage}
2262 \caption{
2263 %<en>The position of the `real' glyph.
2264 %<ja>「実際の」グリフの位置.
2265 }
2266 \label{fig-pos}
2267 \end{figure}
2268
2269
2270 \item[kern={\{[$j$]=<kern>, ...\}}]
2271
2272 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
2273 \end{list}
2274
2275 %<*en>
2276 As described before, you can specify several `imaginary characters' in
2277 \texttt{chars} field. The most of these characters are regarded as the
2278 characters of class 0 in \pTeX.
2279 As a result, \LuaTeX-ja can control typesetting finer than \pTeX.
2280 The following is the list of `imaginary characters':
2281 %</en>
2282 %<*ja>
2283 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
2284 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
2285 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
2286 い組版調整ができるようになっている.以下でその一覧を述べる:
2287 %</ja>
2288 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2289 \item['lineend']
2290 %<en>An ending of a line.
2291 %<ja>行の終端を表す.
2292
2293 \item['diffmet']
2294 %<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
2295 %<ja>JFMやサイズが異なる2つの\textbf{JAchar}の間の境界として用いられる.
2296
2297 \item['boxbdd']
2298 %<en>The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
2299 %<ja>水平ボックスの先頭と末尾,及びインデントされていない(\verb+\noindent+ で開始された)段落の先頭を表す.
2300
2301 \item['parbdd']
2302 %<en>The beginning of an (indented) paragraph.
2303 %<ja>通常の(\verb+\noindent+ で開始されていない)段落の先頭.
2304
2305 \item['jcharbdd']
2306 %<en>A boundary between \textbf{JAchar} and anything else (such as \textbf{ALchar}, kern, glue, ...).
2307 %<ja>和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
2308
2309 \item[$-1$]
2310 %<en>The left/right boundary of an inline math formula.
2311 %<ja>行中数式と地の文との境界.
2312 \end{list}
2313
2314 %<en>\paragraph{Porting JFM from \pTeX}
2315 %<ja>\paragraph{\pTeX 用和文フォントメトリックの移植}
2316
2317 % ToDo: English version.
2318
2319 %<*en>
2320 ...
2321 %</en>
2322
2323 %<*ja>
2324 以下に,\pTeX 用和文フォントメトリックを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
2325 \begin{itemize}
2326 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
2327 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
2328       トメトリック等を移植する場合は,
2329 \begin{itemize}
2330 \item JFM中の全ての数値を$1/0.962216$倍しておく.
2331 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
2332       \LaTeX でのフォント宣言なら,例えば次のように:
2333 \begin{verbatim}
2334 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
2335 \end{verbatim}
2336 \end{itemize}
2337 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
2338       (JFM中に単に書かなければよい).
2339 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
2340       文字クラスに関してはグルー/カーンの設定はしない.
2341
2342 これは,\pTeX では,
2343       水平ボックスの先頭・末尾とインデントされていない(\verb+\noindent+ で開始さ
2344       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
2345 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
2346
2347 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
2348       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
2349       は,段落の最初に手動で \verb+\inhibitglue+ を追加するか,あるいは
2350       \ \verb+\everypar+ のハックを行い,それを自動化させるしかなかった.
2351
2352 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
2353 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
2354 \texttt{'parbdd'}を入れれば全角下がりとなる.
2355
2356 \begin{LTXexample}
2357 \jfont\g=psft:Ryumin-Light:jfm=test \g
2358 \parindent1\zw\noindent{}◆◆◆◆◆
2359 \par 「◆◆←二分下がり
2360 \par 【◆◆←全角下がり
2361 \par 〔◆◆←全角二分下がり
2362 \end{LTXexample}
2363 \end{itemize}
2364
2365 但し,\verb+\everypar+ を利用している場合にはこの仕組みは正しく動かない.
2366 そのような例としては箇条書き中の \verb+\item+ で始まる段落があり,\Pkg{ltjsclasses}では
2367 人工的に「\texttt{'parbdd'}の意味を持つ」whatsitノードを作ることによって対処している%
2368 \footnote{\texttt{no\_runtime/ltjsclasses.dtx} を参照されたい.
2369 JFM側で一部の対処ができることにより,\Pkg{jsclasses}のようにif文の判定はしていない.}
2370 %</ja>
2371
2372 %<en>\subsection{Math Font Family}
2373 %<ja>\subsection{数式フォントファミリ}
2374 \label{ssec-math}
2375
2376 %<*en>
2377 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
2378 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX\ can handles 256~families, but
2379 an external package is needed to support this in plain \TeX\ and
2380 \LaTeX.}, and each family has three fonts:
2381 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
2382 %</en>
2383 %<*ja>
2384 \TeX\ は数式フォントを16のファミリ\footnote{Omega, Aleph, \LuaTeX,そして
2385   $\varepsilon$-\kern-.125em(u)\pTeX\ では256の数式ファミリを扱うことができるが,
2386   これをサポートするためにplain \TeX と\LaTeX では外部パッケージを読み込む必要が
2387   ある.}で管理し,それぞれのファミリは3つのフォントを持っている:\verb+\textfont+, \verb+\scriptfont+ そして \verb+\scriptscriptfont+ である.
2388 %</ja>
2389
2390 %<*en>
2391 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
2392 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
2393 font families. There is no relation between the value of
2394 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
2395 you can set both \verb+\fam+ and \verb+\jfam+ to the same value.
2396 %</en>
2397 %<*ja>
2398 \LuaTeX-jaの数式中での和文フォントの扱いも同様である.
2399 表\ref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する
2400 ものを示している.\verb+\fam+ と \verb+\jfam+ の値の間には関係はなく,
2401 適切な設定の下では \verb+\fam+ と \verb+\jfam+ の両方に同じ値を設定することができる.
2402 %</ja>
2403
2404 \begin{table}[!tb]
2405 %<en>\caption{Primitives for Japanese math fonts.}
2406 %<ja>\caption{和文数式フォントに対するプリミティブ.}
2407 \label{tab-math}
2408 \begin{center}\def\{{\char`\{}\def\}{\char`\}}
2409 \begin{tabular}{lll}
2410 \toprule
2411 %<en>&Japanese fonts&alphabetic fonts\\
2412 %<ja>&和文フォント&欧文フォント\\
2413 \midrule
2414 font family&\verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
2415 text size&\tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
2416 script size&\tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
2417 scriptscript size&\tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
2418 \bottomrule
2419 \end{tabular}
2420 \end{center}
2421 \end{table}
2422
2423 %<en>\subsection{Callbacks}
2424 %<ja>\subsection{コールバック}
2425
2426 %<*en>
2427 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
2428 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks.
2429 %</en>
2430 %<*ja>
2431 \LuaTeX 自体のものに加えて,\LuaTeX-jaもコールバックを持っている.
2432 これらのコールバックには,他のコールバックと同様に \verb+luatexbase.add_to_callback+
2433 関数などを用いることでアクセスすることができる.
2434 %</ja>
2435 \begin{list}{}%
2436 {\def\makelabel#1{\bfseries#1}}
2437 %<en>\item[\texttt{luatexja.load\_jfm} callback]
2438 %<ja>\item[\texttt{luatexja.load\_jfm}コールバック]
2439 %<*en>
2440 With this callback you can overwrite JFMs.
2441 This callback is called when a new JFM is loaded.
2442 %</en>
2443 %<*ja>
2444 このコールバックを用いることでJFMを上書きすることができる.
2445 このコールバックは新しいJFMが読み込まれるときに呼び出される.
2446 %</ja>
2447
2448 \begin{lstlisting}[numbers=left]
2449 function (<table> jfm_info, <string> jfm_name)
2450   return <table> new_jfm_info
2451 end
2452 \end{lstlisting}
2453
2454 %<*en>
2455 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
2456 this argument has \texttt{chars} field which contains character codes
2457              whose character class is not~0.
2458 %</en>
2459 %<*ja>
2460 引数 \verb+jfm_info+ はJFMファイルのテーブルと似たものが格納されるが,
2461 クラス0を除いた文字のコードを含んだ\texttt{chars}フィールドを持つ点が異なる.
2462 %</ja>
2463
2464 %<*en>
2465 An example of this callback is the \texttt{ltjarticle} class, with
2466              forcefully assigning character class~0 to \texttt{'parbdd'}
2467              in the JFM \texttt{jfm-min.lua}. This callback doesn't
2468              replace any code of \LuaTeX-ja.
2469 %</en>
2470 %<*ja>
2471 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
2472 \texttt{jfm-min.lua}中の\texttt{'parbdd'}を強制的にクラス0に割り当てている.
2473 このコールバックは\LuaTeX-jaのコードを書き換えない.
2474 %</ja>
2475
2476 %<en>\item[\texttt{luatexja.define\_font} callback]
2477 %<ja>\item[\texttt{luatexja.define\_font}コールバック]
2478 %<*en>
2479 This callback and the next callback form a pair, and you can assign letters which don't have
2480              fixed code points in Unicode to non-zero character classes.
2481 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
2482 %</en>
2483 %<*ja>
2484 このコールバックと次のコールバックは組をなしており,Unicode中に固定された文字コード
2485 番号を持たない文字を非零の文字クラスに割り当てることができる.
2486 このコールバックは新しい和文フォントが読み込まれたときに呼び出される.
2487 %</ja>
2488
2489 \begin{lstlisting}[numbers=left]
2490 function (<table> jfont_info, <number> font_number)
2491   return <table> new_jfont_info
2492 end
2493 \end{lstlisting}
2494
2495 %<*en>
2496 You may assume that \verb+jfont_info+ has the following fields:
2497 %</en>
2498 %<*ja>
2499 \verb+jfont_info+ は以下のフィールドを持つ:
2500 %</ja>
2501 \begin{description}
2502 \item[\tt jfm]
2503 %<en>The index number of JFM.
2504 %<ja>JFMのインデックス番号.
2505
2506 \item[\tt size]
2507 %<en>Font size in a scaled point (${}=2^{-16}\,\textrm{pt}$).
2508 %<ja>スケールド・ポイント(${}=2^{-16}\,\textrm{pt}$)を単位としたフォントのサイズ.
2509
2510 \item[\tt var]
2511 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
2512 %<ja>\verb+\jfont+ の呼び出しの際に\texttt{jfmvar=...}で指定された値.
2513 \end{description}
2514
2515 %<*en>
2516 The returned table \verb+new_jfont_info+ also should include these three fields.
2517 The \verb+font_number+ is a font number.
2518 %</en>
2519 %<*ja>
2520 戻り値の \verb+new_jfont_info+ テーブルもこれら3つのフィールドを含まなければならない.
2521 \verb+font_number+ はフォント番号である.
2522 %</ja>
2523
2524 %<*en>
2525 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
2526              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
2527              CID characters in a JFM. This callback doesn't replace any
2528              code of \LuaTeX-ja.
2529 %</en>
2530 %<*ja>
2531 これと次のコールバックの良い使用例は\Pkg{luatexja-otf}パッケージであり,
2532 JFM中でAdobe-Japan1 CIDの文字を \verb+"AJ1-xxx"+ の形で指定するために
2533 用いられている.
2534 このコールバックは\LuaTeX-jaのコードを書き換えない.
2535 %</ja>
2536
2537 %<en>\item[\texttt{luatexja.find\_char\_class} callback]
2538 %<ja>\item[\texttt{luatexja.find\_char\_class}コールバック]
2539 %<*en>
2540 This callback is called just when \LuaTeX-ja is trying to determine which
2541              character class a character \verb+chr_code+ belongs.
2542 A function used in this callback should be in the following form:
2543 %</en>
2544 %<*ja>
2545 このコールバックは\LuaTeX-jaが \verb+chr_code+ の文字がどの文字クラスに
2546 属するかを決定しようとする際に呼び出される.
2547 このコールバックで呼び出される関数は次の形をしていなければならない:
2548 %</ja>
2549 \begin{lstlisting}[numbers=left]
2550 function (<number> char_class, <table> jfont_info, <number> chr_code)
2551   if char_class~=0 then return char_class
2552   else
2553     ....
2554     return (<number> new_char_class or 0)
2555   end
2556 end
2557 \end{lstlisting}
2558
2559 %<*en>
2560 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
2561              routine or previous function calls in this callback, hence
2562              this argument may not be 0. Moreover, the returned
2563              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
2564              is not~0, otherwise you will overwrite the \LuaTeX-ja's
2565              default routine.
2566 %</en>
2567 %<*ja>
2568 引数 \verb+char_class+ は\LuaTeX-jaのデフォルトルーチンか,このコールバックの
2569 直前の関数呼び出しの結果を含んでおり,したがってこの値は0ではないかもしれない.
2570 さらに,戻り値の \verb+new_char_class+ は \verb+char_class+ が非零のときには
2571 \verb+char_class+ の値と同じであるべきで,そうでないときは\LuaTeX-jaの
2572 デフォルトルーチンを書き換えることになる.
2573 %</ja>
2574
2575 %<*en>
2576 This callback doesn't replace any code of \LuaTeX-ja.
2577 %</en>
2578 %<*ja>
2579 このコールバックは\LuaTeX-jaのコードを書き換えない.
2580 %</ja>
2581
2582 %<en>\item[\texttt{luatexja.set\_width} callback]
2583 %<ja>\item[\texttt{luatexja.set\_width}コールバック]
2584 %<*en>
2585 This callback is called when \LuaTeX-ja is trying to encapsule a
2586              \textbf{JAchar} \textit{glyph\_node}, to adjust its
2587              dimension and position.
2588 %</en>
2589 %<*ja>
2590 このコールバックは\LuaTeX-jaが\textbf{JAchar}の寸法と位置を調節するために
2591 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
2592 %</ja>
2593 \begin{lstlisting}[numbers=left]
2594 function (<table> shift_info, <table> jfont_info, <number> char_class)
2595   return <table> new_shift_info
2596 end
2597 \end{lstlisting}
2598
2599 %<*en>
2600 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
2601 \texttt{down} and \texttt{left} fields, which are the amount of shifting
2602              down/left the character in a scaled-point.
2603 %</en>
2604 %<*ja>
2605 引数 \verb+shift_info+ と戻り値の \verb+new_shift_info+ は
2606 \texttt{down}と\texttt{left}のフィールドを持ち,これらの値は
2607 文字の下/左へのシフト量(スケールド・ポイント単位)である.
2608 %</ja>
2609
2610 %<*en>
2611 A good example is \Pkg{test/valign.lua}.
2612 After loading this file, the vertical position of glyphs is automatically
2613 adjusted; the ratio $(\hbox{height}:\hbox{depth})$ of glyphs is adjusted
2614 to be that of letters in the character class~0. For example, suppose that
2615 \begin{itemize}
2616 \item The setting of the JFM: $(\hbox{height})=88x$, $(\hbox{depth})=12x$
2617   (the standard values of Japanese OpenType fonts);
2618 \item The value of the real font: $(\hbox{height})=28y$, $(\hbox{depth})=5y$
2619   (the standard values of Japanese TrueType fonts).
2620 \end{itemize}
2621 Then, the position of glyphs is shifted up by
2622 \[
2623  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
2624 \]
2625 %</en>
2626 %<*ja>
2627 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
2628              JFM内で規定された文字クラス0の文字における$(\hbox{高
2629              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
2630              下位置が自動調整される.例えば,
2631 \begin{itemize}
2632 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
2633 (和文OpenTypeフォントの標準値)
2634 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
2635 \end{itemize}
2636 となっていたとする.すると,実際の文字の出力位置は,
2637 \[
2638  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
2639 \]
2640 だけ上にずらされることになる.
2641 %</ja>
2642 \end{list}
2643
2644
2645
2646 %<en>\section{Parameters}
2647 %<ja>\section{パラメータ}
2648 %<en>\subsection{\texttt{\char92 ltjsetparameter} primitive}
2649 %<ja>\subsection{\texttt{\char92 ltjsetparameter}プリミティブ}
2650
2651 %<*en>
2652 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
2653 primitives for accessing most parameters of \LuaTeX-ja. One of the main
2654 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
2655 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
2656 is the position of \verb+hpack_filter+ callback in the source
2657 of \LuaTeX, see Section~\ref{sec-para}.
2658 %</en>
2659 %<*ja>
2660 先に述べたように,\verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ は
2661 \LuaTeX-jaのほとんどのパラメータにアクセスするためのプリミティブである.
2662 \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を
2663 採用しない理由の一つは,\LuaTeX のソースにおける \verb+\hpack_filter+
2664 コールバックの位置にある.\ref{sec-para}節を参照.
2665 %</ja>
2666
2667 %<*en>
2668 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives
2669 for assigning parameters. These take one argument which is a
2670 \texttt{<key>=<value>} list. Allowed keys are described in the next
2671 subsection.
2672 The difference between
2673 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
2674 scope of assignment;
2675 \verb+\ltjsetparameter+ does a local assignment and
2676 \verb+\ltjglobalsetparameter+ does a global one.
2677 They also obey the value of \verb+\globaldefs+,
2678 like other assignment.
2679 %</en>
2680 %<*ja>
2681 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ はパラメータを
2682 指定するためのプリミティブである.これらは\texttt{<key>=<value>}のリストを
2683 引数としてとる.許されるキーは次の節に記述する.
2684 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ の違いはスコープの
2685 違いのみである.
2686 \verb+\ltjsetparameter+ はローカルな指定,\verb+\ltjglobalsetparameter+ は
2687 グローバルな指定を行う.
2688 これらは他のパラメータ指定と同様に \verb+\globaldefs+ の値に従う.
2689 %</ja>
2690
2691 %<*en>
2692 \verb+\ltjgetparameter+ is the primitive for acquiring parameters. It
2693 always takes a parameter name as first argument, and also takes the
2694 additional argument---a character code, for example---in some cases.
2695 %</en>
2696 %<*ja>
2697 \verb+\ltjgetparameter+ はパラメータの値を取得するためのプリミティブであり,
2698 常にパラメータの名前を第一引数にとる.
2699 そして,いくつかの場合には加えてさらに引数(例えば文字コード)をとる.
2700 %</ja>
2701 \begin{LTXexample}
2702 \ltjgetparameter{differentjfm},
2703 \ltjgetparameter{autospacing},
2704 \ltjgetparameter{prebreakpenalty}{`)}.
2705 \end{LTXexample}
2706 %<*en>
2707 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
2708 always a string}. This is outputted by \texttt{tex.write()}, so any
2709 character other than space~`\texttt{\char32}'~(U+0020) has the category code
2710 12~(other), while the space has 10~(space).
2711 %</en>
2712 %<*ja>
2713 \textbf{{\normalfont\tt\char92ltjgetparameter}の戻り値は常に文字列である.}
2714 これは\texttt{tex.write()}によって出力しているためで,スペース`\texttt{\char32}'~(U+0020)を除いた文字のカテゴリーコードは全て12~(other)となる.
2715 一方,スペースのカテゴリーコードは10~(space)である.
2716 %</ja>
2717
2718 %<en>\subsection{List of Parameters}
2719 %<ja>\subsection{パラメータ一覧}
2720 \label{ssec-param}
2721
2722 %<*en>
2723 The following is the list of parameters which can be specified by the
2724 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
2725 in \pTeX, and symbols beside each parameter has the following meaning:
2726 %</en>
2727 %<*ja>
2728 以下は \verb+\ltjsetparameter+ に指定することができるパラメータの一覧である.
2729 [\verb+\cs+]は\pTeX における対応物を示す.
2730 また,それぞれのパラメータの右上にある記号には次の意味がある:
2731 %</ja>
2732 \begin{itemize}
2733 %<*en>
2734 \item No mark: values at the end of the paragraph or the hbox are
2735       adopted in the whole paragraph/hbox.
2736 %</en>
2737 %<*ja>
2738 \item 記号なし:段落や水平ボックスの終端での値がその段落/水平ボックス全体で用いられる.
2739 %</ja>
2740 %<*en>
2741 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
2742 %</en>
2743 %<*ja>
2744 \item `\ast':ローカルなパラメータであり,段落/水平ボックス内のどこででも値を変えることができる.
2745 %</ja>
2746 %<*en>
2747 \item `\dagger': assignments are always global.
2748 %</en>
2749 %<*ja>
2750 \item `\dagger':指定は常にグローバルになる.
2751 %</ja>
2752 \end{itemize}
2753
2754 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2755 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
2756 %<*en>
2757 Penalty value for suppressing orphans. This penalty is inserted just
2758              after the last \textbf{JAchar} which is not regarded as a
2759              (Japanese) punctuation mark.
2760 %</en>
2761 %<*ja>
2762 パラグラフの最後の字が孤立して改行されるのを防ぐためのペナルティの値.
2763 このペナルティは(日本語の)句読点として扱われない最後の\textbf{JAchar}の直後に
2764 挿入される.
2765 %</ja>
2766
2767 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
2768 %<*en>
2769 An additional attributes which each character whose character code is <chr\_code> has.
2770 At the present version, the lowermost bit of <natural number> indicates
2771              whether the character is considered as a punctuation mark
2772              (see the description of \Param{jcharwidowpenalty} above).
2773 %</en>
2774 %<*ja>
2775 文字コードが<chr\_code>の文字が持つ付加的な属性値(attribute).
2776 現在のバージョンでは,<natural number>の最下位ビットが,その文字が句読点と
2777 みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照).
2778 %</ja>
2779
2780 \item[\Param{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
2781 %<*ja>
2782 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
2783              この文字の前に挿入/追加されるペナルティの量を指定する.
2784
2785 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,標準で読み込まれる
2786              \texttt{luatexja-kinsoku.tex}において
2787 \begin{verbatim}
2788 \ltjsetparameter{prebreakpenalty={`〙,10000}}
2789 \end{verbatim}
2790 と,最大値の10000が指定されている.他にも,小書きのカナなど,絶対禁止とい
2791              うわけではないができれば行頭にはきて欲しくない場合に,0と
2792              10000の間の値を指定するのも有用であろう.
2793 \begin{verbatim}
2794 \ltjsetparameter{prebreakpenalty={`ゕ,150}}
2795 \end{verbatim}
2796 %</ja>
2797
2798 \item[\Param{postbreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
2799 %<*ja>
2800 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
2801              この文字の後に挿入/追加されるペナルティの量を指定する.
2802
2803 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
2804 \begin{itemize}
2805 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
2806       た(後から指定した方で上書きされる).
2807 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
2808 \end{itemize}
2809 という制限があったが,\LuaTeX-jaではこれらの制限は解消されている.
2810 %</ja>
2811
2812 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}]
2813 %<en>[\verb+\textfont+ in \TeX]
2814 %<ja>[\TeX の \verb+\textfont+]
2815 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}]
2816 %<en>[\verb+\scriptfont+ in \TeX]
2817 %<ja>[\TeX の \verb+\scriptfont+]
2818 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}]
2819 %<en>[\verb+\scriptscriptfont+ in \TeX]
2820 %<ja>[\TeX の \verb+\scriptscriptfont+]
2821 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
2822 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
2823
2824 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
2825
2826 %<*en>
2827 Setting whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
2828 The followings are allowed for <mode>:
2829 %</en>
2830 %<*ja>
2831 文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{xkanjiskip}の
2832 挿入を許すかどうかの設定.
2833 以下の<mode>が許される:
2834 %</ja>
2835 \begin{description}
2836 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
2837 %<ja>\item[0, \texttt{inhibit}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも禁止される.
2838 %<en>\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
2839 %<ja>\item[1, \texttt{preonly}] \Param{xkanjiskip}の挿入は文字の前では許されるが,後ろでは許されない.
2840 %<en>\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
2841 %<ja>\item[2, \texttt{postonly}] \Param{xkanjiskip}の挿入は文字の後ろでは許されるが,前では許されない.
2842 %<en>\item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed both before the character and after the character. This is the default value.
2843 %<ja>\item[3, \texttt{allow}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
2844 \end{description}
2845 %<*en>
2846 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
2847 %</en>
2848 %<*ja>
2849 このパラメータは\pTeX の \verb+\inhibitxspcode+ プリミティブと似ているが,
2850 互換性はない.
2851 %</ja>
2852
2853 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
2854
2855 %<*en>
2856 Setting whether inserting \Param{xkanjiskip} is allowed before/after a
2857              \textbf{ALchar} whose character code is <chr\_code>.
2858              The followings are allowed for <mode>:
2859 %</en>
2860 %<*ja>
2861 文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{xkanjiskip}の
2862 挿入を許すかどうかの設定.
2863 以下の<mode>が許される:
2864 %</ja>
2865 \begin{description}
2866 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
2867 %<ja>\item[0, \texttt{inhibit}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも禁止される.
2868 %<en>\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
2869 %<ja>\item[1, \texttt{preonly}] \Param{xkanjiskip}の挿入は文字の前では許されるが,後ろでは許されない.
2870 %<en>\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
2871 %<ja>\item[2, \texttt{postonly}] \Param{xkanjiskip}の挿入は文字の後ろでは許されるが,前では許されない.
2872 %<en>\item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character. This is the default value.
2873 %<ja>\item[3, \texttt{allow}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
2874 \end{description}
2875 %<*en>
2876 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
2877 %</en>
2878 %<*ja>
2879 \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため,
2880 これら2つのパラメータは互いの異名となっていることに注意する.
2881 %</ja>
2882
2883 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
2884 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
2885 \item[\Param{kanjiskip}\,=<skip>] [\verb+\kanjiskip+]
2886 \item[\Param{xkanjiskip}\,=<skip>] [\verb+\xkanjiskip+]
2887
2888 \item[\Param{differentjfm}\,=<mode>$^\dagger$]
2889
2890 %<*en>
2891 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
2892 The allowed arguments are the followings:
2893 %</en>
2894 %<*ja>
2895 JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグルー/カーンをどのように
2896 入れるかを指定うる.
2897 許される値は以下の通り:
2898 %</ja>
2899 \begin{description}
2900 \item[\texttt{average}]
2901 \item[\texttt{both}]
2902 \item[\texttt{large}]
2903 \item[\texttt{small}]
2904 \end{description}
2905
2906 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
2907 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
2908 \end{list}
2909
2910
2911 %<en>\section{Other Primitives}
2912 %<ja>\section{その他のプリミティブ}
2913 %<en>\subsection{Primitives for Compatibility}
2914 %<ja>\subsection{互換プリミティブ}
2915
2916 %<*en>
2917 The following primitives are implemented for compatibility with \pTeX:
2918 %</en>
2919 %<*ja>
2920 以下のプリミティブは\pTeX との互換性のために実装されている:
2921 %</ja>
2922 \begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw}
2923 \item[kuten]
2924 \item[jis]
2925 \item[euc]
2926 \item[sjis]
2927 \item[ucs]
2928 \item[kansuji]
2929 \end{list}
2930
2931 %<en>\subsection{\texttt{\char92 inhibitglue} primitive}
2932 %<ja>\subsection{\texttt{\char92 inhibitglue}プリミティブ}
2933
2934 %<*en>
2935 The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
2936 The following is an example, using a special JFM that there will be a glue between
2937 the beginning of a box and `あ', and also between `あ' and `ウ'.
2938 %</en>
2939 %<*ja>
2940 \verb+\inhibitglue+ プリミティブは\textbf{JAglue}の挿入を抑制する.
2941 以下は,ボックスの始めと`あ'の間,`あ'と`ウ'の間にグルーが入る特別なJFMを用いた例で
2942 ある.
2943 %</ja>
2944
2945 \begin{LTXexample}
2946 \jfont\g=psft:Ryumin-Light:jfm=test \g
2947 \fbox{\hbox{あウあ\inhibitglue ウ}}
2948 \inhibitglue\par\noindent あ1
2949 \par\inhibitglue\noindent あ2
2950 \par\noindent\inhibitglue あ3
2951 \par\hrule\noindent あoff\inhibitglue ice
2952 \end{LTXexample}
2953
2954 %<*en>
2955 With the help of this example, we remark the specification of \verb+\inhibitglue+:
2956 %</en>
2957 %<*ja>
2958 この例を援用して,\verb+\inhibitglue+ の仕様について述べる.
2959 %</ja>
2960 \begin{itemize}
2961 %<*en>
2962 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
2963       simply ignored.
2964 %</en>
2965 %<*ja>
2966 \item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
2967 4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
2968 \verb+\noindent+ の時点で水平モードになるからである.
2969 %</ja>
2970
2971 %<*en>
2972 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
2973       mode is only effective on the spot; does not get over boundary of
2974       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
2975       kernings, as shown in the last line of above example.
2976 %</en>
2977 %<*ja>
2978 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
2979   有効であり,段落の境界を乗り越えない.
2980   さらに,\verb+\inhibitglue+ は上の例の最終行のようにリガチャとカーニングを
2981   打ち消す.
2982 %</ja>
2983
2984 %<*en>
2985 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
2986 %</en>
2987 %<*ja>
2988 \item \verb+\inhibitglue+ を数式モード中で呼び出した場合はただ無視される.
2989 %</ja>
2990 \end{itemize}
2991
2992 %<en>\section{Control Sequences for \LaTeXe}
2993 %<ja>\section{\LaTeXe 用のコントロールシーケンス}
2994
2995 %<en>\subsection{Patch for NFSS2}
2996 %<ja>\subsection{NFSS2へのパッチ}
2997 \label{ssub-nfsspat}
2998
2999 %<*en>
3000 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
3001 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
3002 For an convenience, we will describe
3003 commands which are not described in Subsection~\ref{ssub-chgfnt}.
3004 %</en>
3005 %<*ja>
3006 \ref{ssec-ltx}節で述べたように,\LuaTeX-jaはNFSS2への日本語パッチである
3007 \pLaTeXe の\texttt{plfonts.dtx}を単純に取り入れている.
3008 便宜のため,ここでは\ref{ssub-chgfnt}節で述べていなかったコマンドについて
3009 記述しておく.
3010 %</ja>
3011
3012 \begin{cslist}%
3013 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
3014
3015 %<*en>
3016 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
3017              and Japanese font families are only made by their
3018              encodings. For example, encodings OT1 and T1 are for
3019              alphabetic font families, and a Japanese font family cannot
3020              have these encodings. This command defines a new encoding
3021              scheme for Japanese font family (in horizontal direction).
3022 %</en>
3023 %<*ja>
3024 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
3025 そのエンコーディングからのみ作られる.
3026 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
3027 和文フォントファミリはこれらのエンコーディングを持つことはできない.
3028 このコマンドは和文フォントファミリ(横書き用)のための新しいエンコーディングを
3029 定義する.
3030 %</ja>
3031
3032 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
3033 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
3034 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
3035
3036 %<*en>
3037 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
3038 %</en>
3039 %<*ja>
3040 上記3つのコマンドはちょうど \verb+DeclareFontEncodingDefaults+ などに対応するものである.
3041 %</ja>
3042
3043 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
3044
3045 % ToDo: en
3046 %<*ja>
3047 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
3048 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\verb+\mathrm+ 等)と,和文数式用フォ
3049              ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+ 等)の2つを同時に行う命令として
3050              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
3051              <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
3052              更させるようにするのが一般的と思われる.
3053
3054 {\let\item=\origitem
3055 本命令は
3056 \begin{center}\tt
3057 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
3058 (<al-cmd>を1段展開したもの)\{<ja-cmd>を1段展開したもの)\{<arg>\}\}
3059 \end{center}
3060 と定義を行うので,使用には注意が必要である:
3061 \begin{itemize}
3062 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に
3063 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
3064 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと\texttt{@}をつけた命令を指定した時の動作は保証できない.
3065 \end{itemize}}
3066 %</ja>
3067
3068 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
3069   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
3070 %<*en>
3071 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
3072 with respect to a Japanese font family given by the former 4~arguments.
3073 %</en>
3074 %<*ja>
3075 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
3076 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
3077 %</ja>
3078 \item[SetRelationFont]
3079 %<*en>
3080 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
3081 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
3082 %</en>
3083 %<*ja>
3084 このコマンドは \verb+\DeclareRelationFont+ とローカルな指定であることを除いて
3085 ほとんど同じである(\verb+\DeclareRelationFont+ はグローバル).
3086 %</ja>
3087
3088 \item[userelfont]
3089 %<*en>
3090 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
3091              font family with respect to current Japanese font family,
3092              which was set by
3093              \verb+\DeclareRelationFont+ or \verb+\SetRelationFont+.
3094 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
3095 %</en>
3096 %<*ja>
3097 現在の欧文フォントエンコーディング/ファミリ/…… を,
3098 \verb+\DeclareRelationFont+ か \verb+\SetRelationFont+ で指定された
3099 現在の和文フォントファミリに対応する「従属欧文」フォントファミリに変更する.
3100 \verb+\fontfamily+ のように,有効にするためには \verb+\selectfont+ が必要である.
3101 %</ja>
3102
3103 \item[adjustbaseline]
3104 ...
3105
3106 \item[fontfamily\{<family>\}]
3107 {\let\item\origitem
3108 %<*en>
3109 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
3110 to <family>. Which family will be changed is determined as follows:
3111 %</en>
3112 %<*ja>
3113 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
3114 和文,\textbf{もしくは両方})を<family>に変更する.
3115 どのファミリが変更されるかは以下のようにして決定される:
3116 %</ja>
3117 \begin{itemize}
3118 %<*en>
3119 \item Let current encoding scheme for Japanese fonts be
3120       <ja-enc>. Current Japanese font family will be changed to
3121       <family>, if one of the following two conditions is met:
3122 %</en>
3123 %<*ja>
3124 \item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
3125   現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
3126   <family>に変更される:
3127 %</ja>
3128 \begin{itemize}
3129 %<*en>
3130 \item The family <fam> under the encoding <ja-enc> has been already defined by
3131       \verb+\DeclareKanijFamily+.
3132 %</en>
3133 %<*ja>
3134 \item エンコーディング<ja-enc>におけるファミリ<fam>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
3135 %</ja>
3136 %<*en>
3137 \item A font definition named \texttt{<enc><ja-enc>.fd} (the file name is
3138       all lowercase) exists.
3139 %</en>
3140 %<*ja>
3141 \item フォント定義ファイル\texttt{<enc><ja-enc>.fd}(ファイル名は全て小文字)が存在する.
3142 %</ja>
3143 \end{itemize}
3144 %<*en>
3145 \item Let current encoding scheme for alphabetic fonts be
3146       <al-enc>. For alphabetic font family, the criterion as above is used.
3147 %</en>
3148 %<*ja>
3149 \item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
3150   欧文フォントファミリに対しても,上記の基準が用いられる.
3151 %</ja>
3152 %<*en>
3153 \item There is a case which none of the above applies, that is, the font
3154       family named <family> doesn't seem to be defined neither under the
3155       encoding <ja-enc>, nor under <al-enc>.
3156 In this case, the default family for font substitution is used for
3157       alphabetic and Japanese fonts. Note that current encoding will not
3158       be set to <family>, unlike the original implementation in \LaTeX.
3159 %</en>
3160 %<*ja>
3161 \item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
3162   どちらでも定義されないような場合がある.
3163   この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
3164   和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
3165   現在のエンコーディングは<family>には設定されないことに注意する.
3166 %</ja>
3167 \end{itemize}
3168 }
3169 \end{cslist}
3170
3171 %<*en>
3172 As closing this subsection, we shall introduce an example of
3173 \verb+\SetRelationFont+ and \verb+\userelfont+:
3174 %</en>
3175 %<*ja>
3176 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
3177 紹介しておこう.
3178 %</ja>
3179 \begin{LTXexample}
3180 \gtfamily{}あいうabc
3181 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
3182 \userelfont\selectfont{}あいうabc
3183 \end{LTXexample}
3184
3185
3186 %<en>\subsection{Cropmark/`tombow'}
3187 %<ja>\subsection{トンボ}
3188 % ToDo
3189
3190 %<en>\section{Extensions}
3191 %<ja>\section{拡張}
3192 \subsection{\texttt{luatexja-fontspec.sty}}
3193
3194 %<*en>
3195 As described in Subsection~\ref{ssec-fontspec}, this optional package
3196 provides the counterparts for several commands defined in the
3197 \Pkg{fontspec} package.
3198 In addition to `font features' in the original \Pkg{fontspec},
3199 the following `font features' specifications are allowed for
3200 the commands of Japanese version:
3201 %</en>
3202 %<*ja>
3203 \ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}
3204 パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
3205 オリジナルの\Pkg{fontspec}での`font feature'に加えて,和文版のコマンドには
3206 以下の`font feature'を指定することができる:
3207 %</ja>
3208
3209
3210 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3211 \item[CID=<name>]
3212 \item[JFM=<name>]
3213 \item[JFM-var=<name>] \
3214
3215 %<*en>
3216 These 3 font features correspond to \texttt{cid}, \texttt{jfm} and
3217 \texttt{jfmvar} keys for \verb+\jfont+ primitive, respectively.
3218 \texttt{CID} is effective only when with \texttt{NoEmbed}
3219 described below.
3220 See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details.
3221 %</en>
3222 %<*ja>
3223 これら3つのキーはそれぞれ \verb+\jfont+ プリミティブに対する
3224 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
3225 \texttt{CID} は下の \texttt{NoEmbed} と合わせて用いられたときのみ有効である.
3226 詳細は\ref{ssec-jfont}節と\ref{ssec-psft}節を参照.
3227 %</ja>
3228
3229 \item[NoEmbed]
3230 %<*en>
3231 By specifying this font feature, one can use `name-only' Japanese font which
3232 will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
3233 %</en>
3234 %<*ja>
3235 これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
3236 できる.\ref{ssec-psft}節を参照.
3237 %</ja>
3238 \end{list}
3239
3240 \subsection{\texttt{luatexja-otf.sty}}
3241
3242 %<*en>
3243 This optional package supports typesetting characters in
3244 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
3245 commands:
3246 %</en>
3247 %<*ja>
3248 この追加パッケージはAdobe-Japan1の文字の出力をサポートする.
3249 \texttt{luatexja-otf.sty}は以下の2つの低レベルコマンドを提供する:
3250 %</ja>
3251 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3252 \item[\char92CID\{<number>\}]
3253 %<*en>
3254 Typeset a character whose CID number is <number>.
3255 %</en>
3256 %<*ja>
3257 CID番号が<number>の文字を出力する.
3258 %</ja>
3259
3260 \item[\char92UTF\{<hex\_number>\}]
3261 %<*en>
3262 Typeset a character whose character code is <hex\_number> (in hexadecimal).
3263 This command is similar to \verb+\char"+<hex\_number>,\ %"
3264 but please remind remarks below.
3265 %</en>
3266 %<*ja>
3267 文字コードが(16進で)<hex\_number>の文字を出力する.
3268 このコマンドは \verb+\char"+<hex\_number>と似ているが,下の記述に注意すること.%"
3269 %</ja>
3270 \end{list}
3271
3272 %<en>\paragraph{Remarks}
3273 %<ja>\paragraph{注意}
3274 %<*en>
3275 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
3276 ordinary characters in the following points:
3277 %</en>
3278 %<*ja>
3279 \verb+\CID+ と \verb+\UTF+ コマンドによって出力される文字は
3280 以下の点で通常の文字と異なる:
3281 %</ja>
3282 \begin{itemize}
3283 %<*en>
3284 \item Always treated as \textbf{JAchar}s.
3285 %</en>
3286 %<*ja>
3287 \item 常に\textbf{JAchar}として扱われる.
3288 %</ja>
3289 %<*en>
3290 \item Processing codes for supporting OpenType features (\textit{e.g.},
3291       glyph replacement and kerning) by the \Pkg{luaotfload} package
3292       is not performed to these characters.
3293 %</en>
3294 %<*ja>
3295 \item OpenType feature(例えばグリフ置換やカーニング)をサポートするための
3296   \Pkg{luaotfload}パッケージのコードはこれらの文字には働かない.
3297 %</ja>
3298 \end{itemize}
3299
3300
3301 %<en>\paragraph{Additional Syntax of JFM}
3302 %<ja>\paragraph{JFMへの記法の追加}
3303
3304 %<*en>
3305 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
3306 chars} table in JFM now allows a string in the form
3307 \verb+'AJ1-xxx'+, which stands for the character
3308 whose CID number in Adobe-Japan1 is \verb+xxx+.
3309 %</en>
3310 %<*ja>
3311 \texttt{luatexja-otf.sty}はJFMの記法を拡張する.
3312 JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形の文字列が
3313 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
3314 %</ja>
3315
3316 %<en>\part{Implementations}
3317 %<ja>\part{実装}
3318 \label{part-imp}
3319 %<en>\section{Storing Parameters}
3320 %<ja>\section{パラメータの保持}
3321 \label{sec-para}
3322 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
3323 %<ja>\subsection{\LuaTeX-jaで用いられる寸法レジスタ,属性レジスタ,whatsitノード}
3324
3325 %<*en>
3326 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
3327 %</en>
3328 %<*ja>
3329 以下は\LuaTeX-jaで用いられる寸法レジスタ(dimension),属性レジスタ(attribute)の
3330 リストである.
3331 %</ja>
3332 \begin{list}{}{%
3333 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
3334 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
3335 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
3336 }
3337
3338 \dim{jQ}
3339 %<*en>
3340 As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to
3341                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
3342                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
3343 %</en>
3344 %<*ja>
3345 \ref{ssec-plain}節で述べたように,\verb+\jQ+ は$1\,\textrm{Q}=0.25\,\textrm{mm}$
3346 と等しい.ここで,`Q'(もしくは「級」)は日本の写植で用いられる単位である.したがって,
3347 この寸法レジスタの値を変更してはならない.
3348 %</ja>
3349
3350 \dim{jH}
3351 %<*en>
3352 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
3353                         used in Japanese phototypesetting. This
3354                         \verb+\jH+ is a synonym of \verb+\jQ+.
3355 %</en>
3356 %<*ja>
3357 同じく写植で用いられていた単位として「歯」があり,これは$0.25\,\textrm{mm}$と
3358 等しい.\verb+\jH+ は \verb+\jQ+ の別名である.
3359 %</ja>
3360
3361 \dim{ltj@zw}
3362 %<*en>
3363 A temporal register for the `full-width' of current Japanese font.
3364 %</en>
3365 %<*ja>
3366 現在の和文フォントの「全角幅」を保持する一時レジスタ.
3367 %</ja>
3368
3369 \dim{ltj@zh}
3370 %<*en>
3371 A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
3372 %</en>
3373 %<*ja>
3374 現在の和文フォントの「全角高さ」(通常,高さと深さの和)を保持する一時レジスタ.
3375 %</ja>
3376
3377 \attr{jfam}
3378 %<*en>
3379 Current number of Japanese font family for math formulas.
3380 %</en>
3381 %<*ja>
3382 数式用の和文フォントファミリの現在の番号.
3383 %</ja>
3384
3385 \attr{ltj@curjfnt}
3386 %<*en>
3387 The font index of current Japanese font.
3388 %</en>
3389 %<*ja>
3390 現在の和文フォントのフォント番号.
3391 %</ja>
3392
3393 \attr{ltj@charclass}
3394 %<*en>
3395 The character class of Japanese \textit{glyph\_node}.
3396 %</en>
3397 %<*ja>
3398 和文文字の\textit{glyph\_node}の文字クラス.
3399 %</ja>
3400
3401 \attr{ltj@yablshift}
3402 %<*en>
3403 The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$).
3404 %</en>
3405 %<*ja>
3406 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量.
3407 %</ja>
3408
3409 \attr{ltj@ykblshift}
3410 %<*en>
3411 The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\,\textrm{pt}$).
3412 %</en>
3413 %<*ja>
3414 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
3415 %</ja>
3416
3417 \attr{ltj@autospc}
3418 %<*en>
3419 Whether the auto insertion of \Param{kanjiskip} is allowed at the node.
3420 %</en>
3421 %<*ja>
3422 そのノードで\Param{kanjiskip}の自動挿入が許されるかどうか.
3423 %</ja>
3424
3425 \attr{ltj@autoxspc}
3426 %<*en>
3427 Whether the auto insertion of \Param{xkanjiskip} is allowed at the node.
3428 %</en>
3429 %<*ja>
3430 そのノードで\Param{xkanjiskip}の自動挿入が許されるかどうか.
3431 %</ja>
3432
3433 \attr{ltj@icflag}
3434 %<*en>
3435 An attribute for distinguishing `kinds' of a node. One of the following value is
3436 assigned to this attribute:
3437 %</en>
3438 %<*ja>
3439 ノードの「種類」を区別するための属性.以下のうちのひとつが値として割り当てられる:
3440 %</ja>
3441 \begin{description}
3442 \item[\textit{italic} (1)]
3443 %<*en>
3444 Glues from an italic correction
3445            (\verb+\/+). This distinction of origins of glues
3446            (from explicit \verb+\kern+, or from \verb+\/+)
3447            is needed in the insertion process of \Param{xkanjiskip}.
3448 %</en>
3449 %<*ja>
3450 イタリック補正(\verb+\/+)によるグルー.このグルーの由来の区別(\verb+\kern+ か
3451 \verb+\/+ か)は\Param{xkanjiskip}の挿入過程において必要になる.
3452 %</ja>
3453
3454 \item[\textit{packed} (2)]
3455
3456 \item[\textit{kinsoku} (3)]
3457 %<*en>
3458 Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}).
3459 %</en>
3460 %<*ja>
3461 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
3462 %</ja>
3463
3464 \item[\textit{from\_jfm} (4)]
3465 %<*en>
3466 Glues/kerns from JFM.
3467 %</en>
3468 %<*ja>
3469 JFM由来のグルー/カーン.
3470 %</ja>
3471
3472 \item[\textit{line\_end} (5)]
3473 %<*en>
3474 Kerns for ...
3475 %</en>
3476 %<*ja>
3477 カーン ...
3478 %</ja>
3479
3480 \item[\textit{kanji\_skip} (6)]
3481 %<*en>
3482 Glues for \Param{kanjiskip}.
3483 %</en>
3484 %<*ja>
3485 \Param{kanjiskip}のグルー.
3486 %</ja>
3487
3488 \item[\textit{xkanji\_skip} (7)]
3489 %<*en>
3490 Glues for \Param{xkanjiskip}.
3491 %</en>
3492 %<*ja>
3493 \Param{xkanjiskip}のグルー.
3494 %</ja>
3495
3496 \item[\textit{processed} (8)]
3497 %<*en>
3498 Nodes which is already processed by ...
3499 %</en>
3500 %<*ja>
3501 ... によって既に処理されたノード.
3502 %</ja>
3503
3504 \item[\textit{ic\_processed} (9)]
3505 %<*en>
3506 Glues from an italic correction, but also already processed.
3507 %</en>
3508 %<*ja>
3509 イタリック補正に由来するグルーであるが,まだ処理されていないもの.
3510 %</ja>
3511
3512 \item[\textit{boxbdd} (15)]
3513 %<*en>
3514 Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
3515 %</en>
3516 %<*ja>
3517 ある水平ボックスか段落の最初か最後に挿入されたグルー/カーン.
3518 %</ja>
3519 \end{description}
3520
3521 \attr{ltj@kcat$i$}
3522 %<*en>
3523 Where $i$~is a natural number which is less than~7.
3524 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
3525 %</en>
3526 %<*ja>
3527 $i$は7より小さい自然数.
3528 これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
3529 扱われるかを示すビットベクトルを格納する.
3530 %</ja>
3531 \end{list}
3532
3533 %<*en>
3534 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
3535 inrernal processing. All those nodes store a natural number (hence the node's
3536 \texttt{type} is 100). The following \verb+user_id+s are used:
3537 %</en>
3538 %<*ja>
3539 さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
3540 これらの全てのノードは自然数を格納している(したがってノードの\texttt{type}は
3541 100である).次の \verb+user_id+ が使用される:
3542 %</ja>
3543 \begin{description}
3544 \item[30111]
3545 %<*en>
3546 Nodes for indicating that \verb+\inhibitglue+ is
3547            specified. The \texttt{value} field of these nodes doesn't matter.
3548 %</en>
3549 %<*ja>
3550 \verb+\inhibitglue+ が指定されたことを示すノード.これらのノードの
3551 \texttt{value}フィールドは意味を持たない.
3552 %</ja>
3553
3554 \item[30112]
3555 %<*en>
3556 Nodes for \LuaTeX-ja's stack system (see the next
3557            subsection). The \texttt{value} field of these nodes is
3558            current group.
3559 %</en>
3560 %<*ja>
3561 \LuaTeX-jaのスタックシステム(次の節を参照)のためのノード.
3562 これらのノードの\texttt{value}フィールドは現在のグループを表す.
3563 %</ja>
3564
3565 \item[30113]
3566 %<*en>
3567 Nodes for Japanese Characters which the callback process of
3568            \Pkg{luaotfload} won't be applied, and the character code is
3569            stored in the \texttt{value} field. Each node having this
3570            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
3571            the callback process of luaotfload.
3572            This \verb+user_id+ is only used by the \Pkg{luatexja-otf} package.
3573 %</en>
3574 %<*ja>
3575 \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
3576 \texttt{value}フィールドにその文字のコードが格納されている.
3577 この \verb+user_id+ を持つノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
3578 \textbf{後で}`glyph\_node'に変換される.この \verb+user_id+ は %
3579 \Pkg{luatexja-otf} パッケージでのみ使用される.
3580 %</ja>
3581
3582 \item[30114]
3583 Nodes for indicating beginning of a paragraph.
3584 A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
3585 for its label before the actual contents. So \dots
3586 \end{description}
3587 %<*en>
3588 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
3589 %</en>
3590 %<*ja>
3591 これらのwhatsitノードは\textbf{JAglue}の挿入処理の間に取り除かれる.
3592 %</ja>
3593
3594 %<en>\subsection{Stack System of \LuaTeX-ja}
3595 %<ja>\subsection{\LuaTeX-jaのスタックシステム}
3596 \label{ssec-stack}
3597
3598 %<en>\paragraph{Background}
3599 %<ja>\paragraph{背景}
3600 %<*en>
3601 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
3602 are stored in it. To clarify the reason, imagine the parameter
3603 \Param{kanjiskip} is stored by a skip, and consider the following
3604 source:
3605 %</en>
3606 %<*ja>
3607 \LuaTeX-jaは独自のスタックシステムを持ち,\LuaTeX-jaのほとんどのパラメータは
3608 これを用いて保持されている.その理由を明らかにするために,
3609 \Param{kanjiskip}パラメータがスキップレジスタで保持されているとし,
3610 以下のコードを考えてみよう:
3611 %</ja>
3612 \begin{LTXexample}
3613 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
3614 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
3615 \box0.ぴよぴよ\par
3616 \end{LTXexample}
3617
3618 %<*en>
3619 As described in Subsection~\ref{ssec-param}, the only effective value of
3620 \Param{kanjiskip} in an hbox is the latest value, so the value of
3621 \Param{kanjiskip} which applied in the entire hbox should be 5\,pt.
3622 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
3623 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
3624 file in the source of \LuaTeX), there are the following codes:
3625 %</en>
3626 %<*ja>
3627 \ref{ssec-param}節で述べたように,ある水平ボックスの中で効力を持つ
3628 \Param{kanjiskip}の値は最後に現れた値のみであり,したがってボックス全体に適用される
3629 \Param{kanjiskip}は5\,ptであるべきである.しかし,\LuaTeX の実装のために,
3630 この`5\,pt'はどのコールバックからも知ることはできない.
3631 \texttt{tex/packaging.w}(これは\LuaTeX のソースファイルである)の中に,
3632 以下のコードがある:
3633 %</ja>
3634 \begin{lstlisting}
3635 void package(int c)
3636 {
3637     scaled h;                   /* height of box */
3638     halfword p;                 /* first node in a box */
3639     scaled d;                   /* max depth */
3640     int grp;
3641     grp = cur_group;
3642     d = box_max_depth;
3643     unsave();
3644     save_ptr -= 4;
3645     if (cur_list.mode_field == -hmode) {
3646         cur_box = filtered_hpack(cur_list.head_field,
3647                                  cur_list.tail_field, saved_value(1),
3648                                  saved_level(1), grp, saved_level(2));
3649         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
3650 \end{lstlisting}
3651 %<*en>
3652 Notice that \verb+unsave+ is executed \emph{before}
3653 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
3654 executed): so `5\,pt' in the above source is orphaned at
3655 \verb+unsave+, and hence it can't be accessed from \verb+hpack_filter+
3656 callback.
3657 %</en>
3658 %<*ja>
3659 \verb+unsave+ が \verb+filtered_hpack+(これは \verb+hpack_filter+ コールバックが
3660 実行されるところである)の\textbf{前に}実行されていることに注意する.
3661 したがって,上記ソース中で`5\,pt'は \verb+unsave+ のところで捨てられ,
3662 \verb+hpack_filter+ からはアクセスすることができない.
3663 %</ja>
3664
3665 %<en>\paragraph{The method}
3666 %<ja>\paragraph{解決法}
3667
3668 %<*en>
3669 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
3670 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
3671 %</en>
3672 %<*ja>
3673 スタックシステムのコードはDev-luatexメーリングリストのある投稿\footnote{\texttt{[Dev-luatex] tex.currentgrouplevel}: Jonathan Sauerによる2008/8/19の投稿.}を
3674 ベースにしている.
3675 %</ja>
3676
3677 %<*en>
3678 These are two \TeX\ count registers for maintaining information:
3679 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
3680 the \TeX's group level when the last assignment was done.  Parameters
3681 are stored in one big table named \texttt{charprop\_stack\_table}, where
3682 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
3683 a new stack level is created by \verb+\ltjsetparameter+, all data of the
3684 previous level is copied.
3685 %</en>
3686 %<*ja>
3687 情報を保持するために,2つの\TeX の整数レジスタを用いている:
3688 \verb+\ltj@@stack+ でスタックレベル,\verb+\ltj@@group@level+ で最後の代入が
3689 なされた時点での\TeX のグループレベルを保持している.
3690 パラメータは\texttt{charprop\_stack\_table}という名前のひとつの大きなテーブルに
3691 格納される.ここで,\texttt{charprop\_stack\_table[$i$]}はスタックレベル$i$の
3692 データを格納している.もし新しいスタックレベルが \verb+\ltjsetparameter+ によって
3693 生成されたら,前のレベルの全てのデータがコピーされる.
3694 %</ja>
3695
3696 %<*en>
3697 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
3698 another thing: When a new stack level is about to be created, a whatsit
3699 node whose type, subtype and value are 44~(\textit{user\_defined}),
3700 30112, and current group level respectively is appended to the current
3701 list (we refer this node by \textit{stack\_flag}). This enables us to
3702 know whether assignment is done just inside a hbox. Suppose that the
3703 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
3704 group, then:
3705 %</en>
3706 %<*ja>
3707 上の「背景」で述べた問題を解決するために,\LuaTeX-jaではもう一つの手法を導入する:
3708 新しいスタックレベルが生成されようとするとき,type, subtype, valueがそれぞれ
3709 44~(\textit{user\_defined}), 30112,そして現在のグループレベルであるwhatsitノード
3710 を現在のリストに付け加える(このノードを\textit{stack\_flag}とする).
3711 これにより,ある水平ボックスの中で代入がなされたかどうかを知ることが可能
3712 となる.スタックレベルを$s$,その水平ボックスグループの直後の\TeX のグループレベルを
3713 $t$とすると:
3714 %</ja>
3715 \begin{itemize}
3716 %<*en>
3717 \item If there is no \textit{stack\_flag} node in the list of the hbox, then
3718       no assignment was occurred inside the hbox. Hence values of
3719       parameters at the end of the hbox are stored in the stack
3720       level~$s$.
3721 %</en>
3722 %<*ja>
3723 \item もしその水平ボックスのリストの中に\textit{stack\_flag}ノードがなければ,
3724   水平ボックスの中では代入は起こらなかったということになる.
3725   したがって,その水平ボックスの終わりにおけるパラメータの値はスタックレベル$s$に
3726   格納されている.
3727 %</ja>
3728
3729 %<*en>
3730 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
3731       an assignment was occurred just inside the hbox group. Hence
3732       values of parameters at the end of the hbox are stored in the
3733       stack level~$s+1$.
3734 %</en>
3735 %<*ja>
3736 \item もし値が$t+1$の\textit{stack\_flag}ノードがあれば,その
3737   水平ボックスグループの中で代入が起こったことになる.
3738   したがって,水平ボックスの終わりにおけるパラメータの値はスタックレベル$s+1$に
3739   格納されている.
3740 %</ja>
3741
3742 %<*en>
3743 \item If there are \textit{stack\_flag} nodes but all of their values
3744       are more than~$t+1$, then an assignment was occurred in the box,
3745       but it is done is `more internal' group. Hence values of
3746       parameters at the end of the hbox are stored in the stack
3747       level~$s$.
3748 %</en>
3749 %<*ja>
3750 \item もし\textit{stack\_flag}ノードがあるがそれらの値が全て$t+1$より大きい
3751   場合,そのボックスの中で代入が起こったが,それは「より内部の」グループで
3752   起こったということになる.したがって,水平ボックスの終わりでのパラメータの
3753   値はスタックレベル$s$に格納されている.
3754 %</ja>
3755 \end{itemize}
3756
3757 %<*en>
3758 Note that to work this trick correctly, assignments to
3759 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
3760 regardless the value of \verb+\globaldefs+.
3761 This problem is resolved by using
3762 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
3763 %</en>
3764 %<*ja>
3765 このトリックを正しく働かせるためには,\verb+\ltj@@stack+ と \verb+\ltj@@group@level+ への
3766 代入は \verb+\globaldefs+ の値によらず常にローカルでなければならないことに注意する.
3767 この問題は \hbox{\verb+\directlua{tex.globaldefs=0}+}(この代入は常にローカル)を
3768 用いることで解決している.
3769 %</ja>
3770
3771 %<en>\section{Linebreak after Japanese Character}
3772 %<ja>\section{和文文字直後の改行}
3773 \label{sec-lbreak}
3774 %<en>\subsection{Reference: Behavior in \pTeX}
3775 %<ja>\subsection{参考:\pTeX の動作}
3776 %<*en>
3777 In~\pTeX, a line break after a Japanese character doesn't emit a space,
3778 since words are not separated by spaces in Japanese writings. However,
3779 this feature isn't fully implemented in \LuaTeX-ja due to the
3780 specification of callbacks in~\LuaTeX. To clarify the difference between
3781 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
3782 this subsection.
3783
3784 \pTeX's input processor can be described in terms of a finite state
3785 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
3786 internal states are as follows:
3787 \begin{itemize}
3788 \item State~$N$: new line
3789 \item State~$S$: skipping spaces
3790 \item State~$M$: middle of line
3791 \item State~$K$: after a Japanese character
3792 \end{itemize}
3793 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
3794 processor.  State~$K$ is similar to state~$M$, and is entered after
3795 Japanese characters.  The diagram of state transitions are indicated in
3796 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
3797 after `beginning/ending of a group' characters.
3798 %</en>
3799
3800 %<*ja>
3801 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
3802 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
3803 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
3804
3805 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
3806 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
3807 以下に述べるような4状態を持っている.
3808
3809 \begin{itemize}
3810 \item State~$N$: 行の開始.
3811 \item State~$S$: 空白読み飛ばし.
3812 \item State~$M$: 行中.
3813 \item State~$K$: 行中(和文文字の後).
3814 \end{itemize}
3815 また,状態遷移は,図\ref{fig-ptexipro}のようになっており,図中の数字は
3816 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
3817 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
3818 じものになる.
3819
3820 この図から分かることは,
3821 \begin{quote}
3822 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
3823 \end{quote}
3824 ということである.
3825 %</ja>
3826
3827 \begin{figure}[!tb]
3828 \begin{gather*}
3829  \def\sp{\texttt{\char32}}
3830  \xymatrix{&&
3831    {\text{scan a cs}}\ar@(r,ul)[dr]&\\
3832 \ar[r]&
3833    *++[o][F-]{N}\ar[ur]^0\ar[dd]_{d,\ g}\ar[u]^{5\ (\texttt{\char92par})}
3834      \ar@{->}@(d,l)[ddrr]_(0.45){j}&&
3835    *++[o][F-]{S}\ar@(l,dr)[ul]^0\ar@(l,ur)[ddll]_{d,\ g}\ar[u]_{5}
3836      \ar@{->}@(r,r)[dd]^{j}\\&\\&
3837    *++[o][F-]{M}\ar[uuur]^0\ar@(r,dl)[uurr]_(0.55){10\ (\sp)}
3838      \ar[d]_{5\ ({\sp})}\ar@{->}@(dr,dl)[rr]_{j}&&
3839    *++[o][F-]{K}\ar@{->}@(ul,d)[uuul]^0\ar@{->}[ll]^{d}
3840      \ar@{->}@(ur,dr)[uu]^{10\ (\sp)}\ar@{->}[d]_5\\
3841    &&&
3842  }\\
3843  d:=\{3,4,6,7,8,11,12,13\},\quad g:=\{1,2\},\quad j:=(\text{Japanese characters})
3844 \end{gather*}
3845 \begin{itemize}
3846 %<*en>
3847 \item Numbers represent category codes.
3848 %</en>
3849 %<*ja>
3850 \item 数字はカテゴリーコードを表わしている.
3851 %</ja>
3852 %<*en>
3853 \item Category codes 9~(ignored), 14~(comment)~and~15~(invalid) are omitted in the above diagram.
3854 %</en>
3855 %<*ja>
3856 \item カテゴリーコード9(無視する文字),14(コメント文字),15(無効文字)は上の図では省かれている.
3857 %</ja>
3858 \end{itemize}
3859 %<en>\caption{State transitions of \pTeX's input processor.}
3860 %<ja>\caption{\pTeX の入力処理部の状態遷移.}
3861 \label{fig-ptexipro}
3862 \end{figure}
3863
3864
3865 %<en>\subsection{Behavior in \LuaTeX-ja}
3866 %<ja>\subsection{\LuaTeX-jaの動作}
3867 %<*en>
3868 States in the input processor of \LuaTeX\ is the same as that of \TeX,
3869 and they can't be customized by any callbacks. Hence, we can only use
3870 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
3871 suppress a space by a line break which is after Japanese characters.
3872
3873 However, \verb+token_filter+ callback cannot be used either, since a
3874 character in category code 5~(end-of-line) is converted into an space
3875 token \emph{in the input processor}.  So we can use only the
3876 \verb+process_input_buffer+ callback.  This means that suppressing a
3877 space must be done \emph{just before} an input line is read.
3878
3879 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
3880 \begin{quote}
3881 A character U+FFFFF (its category code is set to 14~(comment) by
3882 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
3883 process it}, if and only if the following two conditions are satisfied:
3884 \begin{enumerate}
3885 \item The category code of the character $\langle${return}$\rangle$
3886       (whose character code is 13) is 5~(end-of-line).
3887 \item The input line matches the following `regular expression':
3888 \[
3889   (\text{any char})^*(\textbf{JAchar})
3890   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
3891 \]
3892 \end{enumerate}
3893 \end{quote}
3894
3895 \paragraph{Remark}
3896 The following example shows the major difference from the behavior of \pTeX:
3897 \begin{LTXexample}
3898 \ltjsetparameter{autoxspacing=false}
3899 \ltjsetparameter{jacharrange={-6}}xあ
3900 y\ltjsetparameter{jacharrange={+6}}zあ
3901 u
3902 \end{LTXexample}
3903 \begin{itemize}
3904 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
3905 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
3906 \item There is no space between `あ' (in the line~3) and `u', since the
3907       line~3 ends with an \textbf{ALchar}
3908 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
3909 \end{itemize}
3910 %</en>
3911
3912 %<*ja>
3913 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,コールバックによりユーザが
3914 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
3915 きそうなコールバックとしては,\verb+process_input_buffer+や
3916 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
3917 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
3918 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
3919 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
3920 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
3921
3922 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
3923 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
3924 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
3925
3926 \begin{quote}
3927 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
3928 以下の2条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
3929 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
3930 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
3931 \begin{enumerate}
3932 \item 改行文字(文字コード13番)のカテゴリーコードが5~(end-of-line)である.
3933 \item 入力行は次の「正規表現」にマッチしている:
3934 \[
3935   (\text{any char})^*(\textbf{JAchar})
3936   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
3937 \]
3938 \end{enumerate}
3939 \end{quote}
3940
3941 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
3942 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
3943 しかしながら,完全に同じ挙動が実現できたわけではない.
3944 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
3945 \begin{LTXexample}
3946 \ltjsetparameter{autoxspacing=false}
3947 \ltjsetparameter{jacharrange={-6}}xあ
3948 y\ltjsetparameter{jacharrange={+6}}zあ
3949 u
3950 \end{LTXexample}
3951 もし\pTeX とまったく同じ挙動を示すならば,出力は
3952 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
3953 上のように異なる挙動となっている.
3954 \begin{itemize}
3955 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
3956       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
3957 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
3958       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
3959 \end{itemize}
3960 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
3961 その行はそこで改行するようにした方がいいだろう.
3962 %</ja>
3963
3964
3965 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
3966 %<ja>\section{JFMグルーの挿入,\Param{kanjiskip}と\Param{xkanjiskip}}
3967 \label{sec-jfmglue}
3968 %<en>\subsection{Overview}
3969 %<ja>\subsection{概要}
3970
3971 \LuaTeX-jaにおける和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.
3972 \pTeX では次のような仕様であった:
3973 \begin{itemize}
3974 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
3975 追加する過程で行われる.
3976 \item \Param{xkanjiskip}の挿入は,水平ボックスへのパッケージングや行分割前に行われる.
3977 \item \Param{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に
3978 「和文文字を表す2つの<char\_node>の間には\Param{kanjiskip}がある」ものとみなされる.
3979 \end{itemize}
3980 しかし,\LuaTeX-jaでは,水平ボックスへのパッケージングや行分割前に全ての
3981 \textbf{JAglue},即ちJFMグルー・\Param{xkanjiskip}・\Param{kanjiskip}の
3982 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
3983 カーニング処理がノードベースになったことに対応する変更である.
3984
3985 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
3986 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
3987 るノード達(アクセント位置補正用のカーンや,イタリック補正)をまとめたもの
3988 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
3989 には関係しないものがある.
3990
3991
3992 %<en>\subsection{definition of a `cluster'}
3993 %<ja>\subsection{「クラスタ」の定義}
3994
3995 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
3996 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
3997 \begin{defn}
3998 %<*en>
3999 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
4000 with the \textit{id} of it:
4001 %</en>
4002 %<*ja>
4003 \textbf{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである:
4004 %</ja>
4005 \begin{enumerate}
4006 %<*en>
4007 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
4008       nodes come from a hbox which is already packaged, by unpackaging
4009       (\verb+\unhbox+).
4010       The \textit{id} is \textit{id\_pbox}.
4011 %</en>
4012 %<*ja>
4013 \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト.
4014   これらのノードはある既にパッケージングされた水平ボックスから \verb+\unhbox+ で
4015   アンパックされたものである.
4016   その\textit{id}は\textit{id\_pbox}である.
4017 %</ja>
4018
4019 %<*en>
4020 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
4021       The \textit{id} is \textit{id\_math}.
4022 %</en>
4023 %<*ja>
4024 \item インライン数式でその境界に2つの\textit{math\_node}を含むもの.
4025   その\textit{id}は\textit{id\_math}である.
4026 %</ja>
4027
4028 %<*en>
4029 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
4030 %</en>
4031 %<*ja>
4032 \item \textit{glpyh\_node}~$p$とそれに関係するノード:
4033 %</ja>
4034 \begin{enumerate}
4035 %<*en>
4036 \item A kern for the italic correction of~$p$.
4037 %</en>
4038 %<*ja>
4039 \item $p$のイタリック補正のためのカーン.
4040 %</ja>
4041
4042 %<*en>
4043 \item An accent attached to $p$ by \verb+\accent+.
4044 %</en>
4045 %<*ja>
4046 \item \verb+\accent+ による$p$に付随したアクセント.
4047 %</ja>
4048 \end{enumerate}
4049 \[
4050 \overbrace{%
4051  \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
4052 \left\{\begin{array}{c}
4053 \Node{glyph}{accent}\\\noalign{\medskip}
4054 \Node{hbox}{accent (shifted vert.)}
4055 \end{array}\right\}\longrightarrow
4056 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
4057 \longrightarrow
4058 \Node{glyph}{$p$}\longrightarrow
4059 \overbrace{%
4060 \Node{kern}{italic corr.}}^{\text{(b)}}
4061 \]
4062
4063 %<*en>
4064 The \textit{id} is \textit{id\_jglyph} or
4065 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
4066 represents a Japanese character or not.
4067 %</en>
4068 %<*ja>
4069 \textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって
4070 \textit{id\_jglyph},もしくは\textit{id\_glyph}となる.
4071 %</ja>
4072
4073 %<*en>
4074 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
4075 The \textit{id} is \textit{id\_hlist} if the node is an
4076       hbox which is not shifted vertically, or \textit{id\_box\_like}
4077       otherwise.
4078 %</en>
4079 %<*ja>
4080 \item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\verb+\vrule+),
4081   そして\textit{unset\_node}.
4082   その\textit{id}は垂直に移動していない水平ボックスならば\textit{id\_hlist},
4083   そうでなければ\textit{id\_box\_like}となる.
4084 %</ja>
4085
4086 %<*en>
4087 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
4088 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
4089       and \textit{id\_disc}, respectively.
4090 %</en>
4091 %<*ja>
4092 \item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行.
4093   その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして
4094   \textit{id\_disc}である.
4095 %</ja>
4096 \end{enumerate}
4097 %<*en>
4098 Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster.
4099 %</en>
4100 %<*ja>
4101 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す.
4102 %</ja>
4103 \end{defn}
4104
4105 \paragraph{\textit{id}の意味}
4106 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
4107 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
4108 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
4109 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
4110 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
4111 説明用に準備した概念であって,実際のLuaコード中にそのように書かれているわけではないことに注意.
4112
4113 \begin{description}
4114 \item[\textit{id\_jglyph}] 和文文字.\\
4115 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
4116 \textit{glyph\_node}そのものである.
4117 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
4118 多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた
4119 \textit{glyph\_node}である可能性もある.
4120 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
4121 一方,後者の場合,
4122 \begin{itemize}
4123 \item $\mathit{Np}.\mathit{head}$は,
4124 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
4125 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
4126 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
4127 \end{itemize}
4128 \item[\textit{id\_math}] インライン数式.\\
4129 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
4130 「文字コード$-1$の欧文文字」とおく.
4131 \item[\textit{id\_hlist}] 縦方向にシフトされていない水平ボックス.\\
4132 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
4133 先頭・末尾のノードである.
4134 \begin{itemize}
4135 \item 状況によっては,\TeX ソースで言うと
4136 \begin{verbatim}
4137 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
4138 \end{verbatim}
4139 のように,$p$の内容が別の水平ボックスで開始・終了している可能性も十分あり得る.そのような場合,
4140 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない}水平ボックスの
4141 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
4142 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた水平ボックス,\verb+\lower1pt\hbox{xyz}+に対応するノードである.
4143 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用のカーンが
4144 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
4145 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
4146 と同様に再帰的に構成要素をたどっていく.
4147 \end{itemize}
4148 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
4149 まとめて1つのクラスタとして取り扱うだけである.
4150 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
4151 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
4152 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
4153 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
4154 全く考慮に入れない.
4155 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
4156 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
4157 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
4158 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
4159 \end{description}
4160
4161 \paragraph{クラスタの別の分類}
4162 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
4163 挿入処理では2つの隣り合ったクラスタの間に
4164 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
4165 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
4166 \begin{description}
4167 \item[和文A] リスト中に直接出現している和文文字.
4168 \textit{id}が\textit{id\_jglyph}であるか,\\
4169 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
4170
4171 \item[和文B] リスト中の水平ボックスの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
4172 JFMグルーの挿入が行われない(\Param{xkanjiskip},~\Param{kanjiskip}は入り得る)ことである.\\
4173 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
4174
4175 \item[欧文] リスト中に直接/水平ボックスの中身として出現している欧文文字.次の3つの場合が該当:
4176 \begin{itemize}
4177 \item \textit{id}が\textit{id\_glyph}である.
4178 \item \textit{id}が\textit{id\_math}である.
4179 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
4180 \end{itemize}
4181 \item[箱] box,またはそれに類似するもの.次の2つが該当:
4182 \begin{itemize}
4183 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
4184 \item \textit{id}が\textit{id\_box\_like}である.
4185 \end{itemize}
4186
4187 \end{description}
4188
4189 \subsection{段落/水平ボックスの先頭や末尾}
4190 \paragraph{先頭部の処理}
4191 まず,段落/水平ボックスの一番最初にあるクラスタ\textit{Np}を探索する.
4192 水平ボックスの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
4193 \begin{center}
4194 \verb+\parindent+由来の水平ボックス ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない
4195 ようなwhatsit.
4196 \end{center}
4197 これは,\verb+\parindent+由来の水平ボックスがクラスタを構成しないようにするためである.
4198
4199 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
4200 \begin{enumerate}
4201 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
4202 \item 問題のリストが字下げありの段落(\verb+\parindent+由来の水平ボックスあり)の場合は,
4203 この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
4204 \item そうでないとき(\verb+noindent+で開始された段落や水平ボックス)は,
4205 $g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
4206 \end{enumerate}
4207 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
4208 そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する:
4209 \begin{itemize}
4210 \item 問題にしているリストが段落であり,かつ
4211 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
4212 \end{itemize}
4213
4214 \paragraph{末尾の処理}
4215 末尾の処理は,問題のリストが段落のものか水平ボックスのものかによって異なる.
4216 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るグルー/カーンを,
4217 \textit{Nq}の直後に挿入するのみである.
4218
4219 一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と,
4220 \verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は
4221 この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
4222 \begin{enumerate}
4223 \item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する.
4224 \item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
4225 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
4226
4227 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような
4228 最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}
4229 を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
4230 \end{enumerate}
4231
4232 \subsection{概観と典型例:2つの「和文A」の場合}
4233 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
4234 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
4235 \[
4236  \Node{cluster}{\textit{Nq}}\longrightarrow
4237 \overbrace{
4238 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
4239 \longrightarrow \Node{cluster}{\textit{Np}}
4240 \]
4241 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
4242 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
4243 \[
4244  \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow
4245 \overbrace{
4246 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
4247 \longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}}
4248 \]
4249
4250 以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
4251 この場合が全ての場合の基本となる.
4252
4253 \paragraph{「右空白」の算出}
4254 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
4255 \begin{description}
4256 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
4257       デフォルト値\Param{kanjiskip}を採用することとなるので,次へ.
4258 \begin{enumerate}
4259 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),
4260       代わりに\Param{kanjiskip}が挿入されることとなる.次へ.
4261 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
4262       共通に使っているJFM内で挿入される空白(グルーかカーン)が決まっているか調べる.
4263 \item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである.
4264 この場合,まず
4265 \[
4266 \vcenter{\halign{\hfil$#:={}$&(\inhibitglue#\inhibitglue)\cr
4267 gb&\textit{Nq}と「文字コードが{\tt'diffmet'}の文字」との間に入るグルー/カーン\cr
4268 ga&「文字コードが{\tt'diffmet'}の文字」と\textit{Np}との間に入るグルー/カーン\cr
4269 }}
4270 \]
4271 として,左側由来・右側由来の空白(グルー/カーン)を(それぞれのJFMから)求める.
4272 $\mathit{ga}$と$\mathit{gb}$のどちらか片方が未定義であるならば,定義されている側の値をそのまま採用する.
4273 もし$\mathit{ga}$と$\mathit{gb}$が両方決まっているならば,両者の値を平均\footnote{\Param{differentjfm}パラメタの
4274 値によって,「大きい方」「小さい方」「合計」に変えることができる.}した値を採用する.
4275 \end{enumerate}
4276
4277 例えば,
4278 \begin{verbatim}
4279 \jfont\foo=psft:Ryumin-Light:jfm=ujis
4280 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
4281 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
4282 \end{verbatim}
4283 という3フォントを考え,
4284 \[
4285  \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p}
4286 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q}
4287 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r}
4288 \]
4289 という3ノードを考える(それぞれ単独でクラスタをなす).
4290 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で,
4291 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる.
4292 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
4293 \Param{kanjiskip}の値を以下で定め,それを「右空白」として採用する.
4294 この段階においては,\verb+\inhibitglue+は効力を持たないため,
4295 結果として,2つの和文文字間には常に何らかのグルー/カーンが挿入されることとなる.
4296 \begin{enumerate}
4297 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
4298 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
4299 \item ユーザ側から見た\Param{kanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
4300 なければ,\Param{kanjiskip}パラメタの値を持つglueを採用する.
4301 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{kanjiskip}の値を用いる.
4302 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
4303 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
4304 \end{enumerate}
4305 \end{description}
4306 \paragraph{「左空白」の算出とそれに伴う補正}
4307 次に,「左空白」にあたる量を算出する:
4308 \begin{description}
4309 \item[line-end~{[E]}]
4310 \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
4311 \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
4312 \begin{enumerate}
4313 \item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
4314 \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
4315 \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
4316 \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
4317 \end{enumerate}
4318 \end{description}
4319 \paragraph{禁則用ペナルティの挿入}
4320 まず,
4321 \[
4322  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値})
4323 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値})
4324 \]
4325 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
4326 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
4327 算出では単純な整数の加減算を行う.
4328
4329 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
4330 \begin{description}
4331 \item[P-normal~{[PN]}]
4332 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
4333 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
4334 また,$10000 + (-10000) = 0$としている.
4335
4336 少々困るのは,(a)部分にペナルティが存在していない場合である.
4337 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
4338 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
4339 ということになるが,実際には僅かにこれより複雑である.
4340 \begin{itemize}
4341 \item 「右空白」がカーンであるとき,
4342 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
4343 この場合は$a\neq 0$であってもペナルティの挿入はしない.
4344 \item 「左空白」がカーンとしてきっちり定義されている時(このとき,「右空白」はカーンでない),
4345 この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
4346 \textit{penalty\_node}を作って挿入する.
4347 \item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
4348 \end{itemize}
4349 \end{description}
4350
4351 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
4352   \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$}
4353 \begin{table}[t]
4354 %<en>\caption{Summary of JFM glues.}
4355 %<ja>\caption{JFM グルーの概要.}
4356 \label{tab-jfmglue}
4357 \begin{center}
4358 \small
4359 \begin{tabular}{>{\sf}c|cccccc}
4360 \toprule
4361 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
4362 和文A&
4363 \gkf{E}{M→K}{PN}&
4364 \gkf{---}{\OA →K}{PN}&
4365 \gkf{---}{\OA →X}{PN}&
4366 \gkf{---}{\OA}{PA}&
4367 \gkf{---}{\OA}{PN}&
4368 \gkf{---}{\OA}{PS}\\
4369 和文B&
4370 \gkf{E}{\OB→K}{PA}&
4371 \gkf{---}{K}{PS}&
4372 \gkf{---}{X}{PS}\\
4373 欧文&
4374 \gkf{E}{\OB →X}{PA}&
4375 \gkf{---}{X}{PS}\cr
4376 箱&\gkf{E}{\OB}{PA}\\
4377 glue&\gkf{E}{\OB}{PN}\\
4378 kern&\gkf{E}{\OB}{PS}\\
4379 \bottomrule
4380 \end{tabular}
4381 \end{center}
4382 \begin{quote}
4383 %<*en>
4384 Here {\small\gkf{E}{M→K}{PN}} means that
4385 %</en>
4386 %<*ja>
4387 ここで {\small\gkf{E}{M→K}{PN}} は次の意味である:
4388 %</ja>
4389 \begin{enumerate}
4390 %<*en>
4391 \item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'.
4392 If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'.
4393 %</en>
4394 %<*ja>
4395 \item 「右空白」を決めるために,\LuaTeX-ja はまず「JFM由来{[M]}」の方法を試みる.
4396   これが失敗したら,\LuaTeX-ja は「\Param{kanjiskip}~{[K]}」の方法を試みる.
4397 %</ja>
4398
4399 %<*en>
4400 \item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'.
4401 %</en>
4402 %<*ja>
4403 \item \textit{Nq} と \textit{Np} の間の「左空白」は「\textsf{line-end~[E]}」の
4404   方法で決定される.
4405 %</ja>
4406
4407 %<*en>
4408 \item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}.
4409 %</en>
4410 %<*ja>
4411 \item \LuaTeX-jaは2つのクラスタの間の禁則処理用のペナルティを調節するために「\textsf{P-normal~[PN]}」の方法を採用する.
4412 %</ja>
4413 \end{enumerate}
4414 \end{quote}
4415 \end{table}
4416
4417 \subsection{その他の場合}
4418 本節の内容は表\ref{tab-jfmglue}にまとめてある.
4419
4420 \paragraph{和文Aと欧文の間}
4421 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
4422 \begin{itemize}
4423 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
4424 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
4425 \item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ.
4426 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
4427 \end{itemize}
4428 \begin{description}
4429 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
4430 未定義でなければそれを「右空白」として採用する.
4431 \textsf{JFM-origin~[M]}の変種と考えて良い.
4432 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
4433 \begin{enumerate}
4434 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
4435 \item そうでなければ,
4436 \textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るグルー/カーンとして定まる.
4437 \end{enumerate}
4438 \item[\Param{xkanjiskip}~{[X]}]
4439 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
4440 \Param{xkanjiskip}の値を以下で定め,それを「右空白」として採用する.
4441 この段階で\verb+\inhibitglue+は効力を持たないのも同じである.
4442 \begin{enumerate}
4443 \item 以下のいずれかの場合は,\Param{xkanjiskip}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
4444 \begin{itemize}
4445 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
4446 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{xkanjiskip}の挿入」が禁止されている
4447 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
4448 \item \textit{Np}の中身の文字コードについて,「直前への\Param{xkanjiskip}の挿入」が禁止されている
4449 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
4450 \end{itemize}
4451 \item ユーザ側から見た\Param{xkanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
4452 なければ,\Param{xkanjiskip}パラメタの値を持つglueを採用する.
4453 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
4454 で使われているJFMに指定されている\Param{xkanjiskip}の値を用いる.
4455 \end{enumerate}
4456 \end{description}
4457
4458 \paragraph{欧文と和文Aの間}
4459 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
4460 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
4461 \begin{itemize}
4462 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
4463 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
4464 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
4465 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
4466 \end{itemize}
4467 \begin{description}
4468 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
4469 未定義でなければそれを「右空白」として採用する.
4470 \textsf{JFM-origin~[M]}の変種と考えて良い.
4471 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
4472 \begin{enumerate}
4473 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
4474 \item そうでなければ,
4475 「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るグルー/カーンとして定まる.
4476 \end{enumerate}
4477 \end{description}
4478
4479 \paragraph{和文Aと箱・グルー・カーンの間}
4480 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・グルー・カーンのいずれかであった場合,
4481 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
4482 ペナルティの挿入処理は若干異なったものとなっている.
4483
4484 \begin{itemize}
4485 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
4486 それが失敗した場合は,「右空白」は挿入されない.
4487 \item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
4488 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
4489 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
4490 「$\mathit{Np}.\mathit{head}$に対する\Param{prebreakpenalty}の値」は0とみなされる.言い換えれば,
4491 \[
4492  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値}).
4493 \]
4494 \begin{description}
4495 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
4496 (明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため,
4497 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
4498 \item[グルー] \textit{Np}がグルーの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
4499 \item[カーン] \textit{Np}がカーンであった場合は,両クラスタの間での行分割は
4500 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
4501 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
4502 \end{description}
4503 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
4504 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
4505 \end{itemize}
4506
4507 \begin{description}
4508 \item[P-allow~{[PA]}]
4509 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
4510 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
4511
4512 (a)部分にペナルティが存在していない場合,
4513 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
4514 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
4515 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
4516 \begin{itemize}
4517 \item 「右空白」がグルーでない(カーンか未定義)であるとき.
4518 \item 「左空白」がカーンとしてきっちり定義されている時.
4519 \end{itemize}
4520
4521 \item[P-suppress~{[PS]}]
4522 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
4523 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
4524
4525 (a)部分にペナルティが存在していない場合,
4526 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
4527 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
4528 そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する.
4529 \end{description}
4530
4531 なお,「右空白」はカーン,「左空白」は未定義の
4532 \[
4533  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
4534 \]
4535 のような状況を考える.
4536 このとき,$a$,即ち「あ」の\Param{postbreakpenalty}がいかなる値であっても,
4537 この2クラスタ間は最終的に
4538 \begin{equation}
4539  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
4540 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
4541 \label{eq-gref}
4542 \end{equation}
4543 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
4544 \Param{postbreakpenalty}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
4545 \eqref{eq-gref}と
4546 \[
4547  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
4548 \Node{penalty}{$a$}\longrightarrow
4549 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
4550 \]
4551 との間に差異は生じない%
4552 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
4553 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
4554
4555 \paragraph{箱・グルー・カーンと和文Aの間}
4556 \textit{Np}が\textsf{箱}・グルー・カーンのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
4557 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意.
4558 \begin{itemize}
4559 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
4560 それが失敗した場合は,「右空白」は挿入されない.
4561 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
4562 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
4563 $\mathit{Nq}.\mathit{tail}$は無意味なので,
4564 \[
4565  a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値}).
4566 \]
4567 \begin{description}
4568 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
4569 \item[グルー] \textit{Nq}がグルーの場合は,\textsf{P-normal~[PN]}を用いる.
4570 \item[カーン] \textit{Nq}がカーンの場合は,\textsf{P-suppress~[PS]}を用いる.
4571 \end{description}
4572 \end{itemize}
4573
4574 \paragraph{和文Aと和文Bの違い}
4575 先に述べたように,\textsf{和文B}は水平ボックスの中身の先頭(or 末尾)として出現している
4576 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
4577 \begin{itemize}
4578 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
4579 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
4580 「左空白」の算出も行われない.例えば,
4581 \begin{itemize}
4582 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
4583 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
4584 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
4585 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
4586 \end{itemize}
4587 \item \textsf{和文B}と箱・グルー・カーンが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
4588 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
4589 \textsf{P-suppress~[PS]}が用いられる.
4590 \item \textsf{和文B}の文字に対する\Param{prebreakpenalty},~\Param{postbreakpenalty}の値は使われず,0として計算される.
4591 \end{itemize}
4592
4593
4594 次が具体例である:
4595 \begin{LTXexample}
4596 あ.\inhibitglue A\\
4597 \hbox{あ.}A\\
4598 あ.A
4599 \end{LTXexample}
4600 \begin{itemize}
4601 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
4602 \Param{xkanjiskip}(四分アキ)が入ることに注意.
4603 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(水平ボックスの中身の末尾として登場しているから)ので,
4604 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{xkanjiskip}が入ることとなる.
4605 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
4606 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
4607 \end{itemize}
4608
4609 \section{psft}
4610
4611 \begin{thebibliography}{99}
4612   \addcontentsline{toc}{section}{\refname}
4613 \bibitem{texbytopic}
4614 Victor Eijkhout,  \emph{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
4615 \end{thebibliography}
4616 \end{document}