OSDN Git Service

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