OSDN Git Service

updated Chinese manual.
[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$的“字符类”$i$来索引。
2760 一般,最少需要的是字符类0,故每一个JFM文件必须有次级表索引为\texttt{[0]}。
2761 %</zh>
2762
2763 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2764 \item[chars=\{<character>, ...\}]
2765 %<en>(required except character class~0)
2766 %<ja>(文字クラス0を除いて必須)
2767 %<zh>(字符类0外必须)
2768
2769 %<*en>
2770 This field is a list of characters which are in this character
2771              type~$i$. This field is not required if $i=0$, since all
2772              \textbf{JAchar} which are not in any character class other
2773              than 0 are in the character class 0
2774              (hence, the character class~0 contains most of
2775              \textbf{JAchar}s). In the list, a character can be
2776              specified by its code number, or by the character itself
2777              (as a string of length~1). Moreover, there are `imaginary
2778              characters' which specified in the list. We will describe these later.
2779 %</en>
2780 %<*ja>
2781 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
2782 場合には必須ではない.なぜならば,文字クラス0には,0以外の文字クラスに属するものを
2783 除いた全ての\textbf{JAchar}が属するからである(よって,文字クラス0はほとんどの
2784 \textbf{JAchar}を含む).このリストでは,文字はその文字コードを用いて,もしくは
2785 文字それ自体(長さ1の文字列)によって指定される.さらに,このリストで指定される
2786 「仮想的な文字」も存在する.これらについては後に記す.
2787 %</ja>
2788 %<*zh>
2789 这部分为字符集$i$的字符列表。当$i=0$时不需要设定此部分,因为不在字符集0种的\textbf{JAchar}
2790 字符都包含在字符集0中(也就是字符集0包含大多数的\textbf{JAchar})。在这个字符列表中,每一个
2791 字符据可以使用其编码,或者字符本身(长度为1的字符串)。另外还有部分“假想字符”可在此列表中
2792 使用。我们会在下面描述。
2793 %</zh>
2794
2795 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
2796 %<en>(required)
2797 %<ja>(必須)
2798 %<zh>(必须)
2799
2800 %<*en>
2801 Specify width of characters in character class~$i$, height, depth and
2802 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
2803 as values of these fields.
2804 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
2805 %</en>
2806 %<*ja>
2807 文字クラス$i$に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
2808 文字クラス$i$に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
2809 値であるものとして扱われる.
2810 しかし,例外が一つある:もし\texttt{'prop'}が\texttt{width}フィールドに
2811 指定された場合,文字の幅はその「実際の」グリフの幅となる.
2812 %</ja>
2813 %<*zh>
2814 设定字符类$i$的宽度,高度和深度以及意大利体校正。在字符集$i$中,所有字符的宽度,高度
2815 和深度的值为上述设定之值。不过还有例外,如果\texttt{'prop'}设定了\texttt{width}部分,那么
2816 字符的宽度则为其“真实”字形宽度。
2817 %</zh>
2818
2819 \item[left=<length>, down=<length>, align=<align>]\
2820
2821 %<*en>
2822 These fields are for adjusting the position of the `real' glyph. Legal
2823              values of \texttt{align} field are \texttt{'left'},
2824              \texttt{'middle'} and \texttt{'right'}. If one of these
2825              3~fields are omitted, \texttt{left} and \texttt{down} are
2826              treated as~0, and \texttt{align} field is treated as
2827              \texttt{'left'}.
2828 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
2829 %</en>
2830 %<*ja>
2831 これらのフィールドは「実際の」グリフの位置を調整するためにある.
2832 \texttt{align}フィールドに指定できる値は\texttt{'left'}, \texttt{'middle'},
2833 \texttt{'right'}のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
2834 場合,\texttt{left}と\texttt{down}は0,\texttt{align}フィールドは
2835 \texttt{'left'}であるものとして扱われる.
2836 これら3つのフィールドの意味については図 \ref{fig-pos} で説明する.
2837 %</ja>
2838 %<*zh>
2839 此部分为“真实”字形对齐位置。\texttt{align}的合法值为\texttt{'left'},
2840 \texttt{'middle'}和\texttt{'right'}。如此三项被省略,则\texttt{left}和
2841 \texttt{down}被视作0,\texttt{align}被视作\texttt{'left'}。
2842 此部分三个域的作用,请参见图\ref{fig-pos}。
2843 %</zh>
2844
2845 %<*en>
2846 In most cases, \texttt{left} and \texttt{down} fields are~0, while
2847 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
2848 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
2849 when the current character class is the class for opening delimiters'.
2850 %</en>
2851 %<*ja>
2852 多くの場合,\texttt{left}と\texttt{down}は0である一方,
2853 \texttt{align}フィールドが\texttt{'middle'}や\texttt{'right'}であることは
2854 珍しいことではない.
2855 例えば,\texttt{align}フィールドを\texttt{'right'}に指定することは,
2856 文字クラスが開き括弧類であるときに実際必要である.
2857 %</ja>
2858 %<*zh>
2859 在大多数情况下,\texttt{left}和\texttt{down}域为0,但是在\texttt{align}域为
2860 \texttt{'middle'}或者\texttt{'right'}时则是不正常的。例如,必须设定\texttt{align}
2861 为\texttt{'right'}时,则当前字符类必须为开定界符。
2862 %</zh>
2863 \begin{figure}[!tb]
2864 \begin{minipage}{0.4\textwidth}%
2865 \begin{center}\unitlength=10pt\small
2866 \begin{picture}(15,12)(-1,-4)
2867 \color{black!10!white}% real glyph :step1
2868 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
2869
2870 \color{red!20!white}% real glyph :step1
2871 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2872
2873 \color{red}% real glyph
2874 \thicklines
2875 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2876 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
2877 \put(-1,5.5){\line(1,0){6}}
2878 \put(-1,-4){\line(1,0){6}}
2879
2880 \color{green!20!white}% real glyph :step1
2881 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2882
2883 \color{black}% real glyph :step1
2884 \thicklines
2885 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
2886 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
2887 \put(0,8){\line(1,0){12}}
2888 \put(0,-3){\line(1,0){12}}
2889 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
2890 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
2891 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
2892
2893 \color{green!50!black}% real glyph :step1
2894 \thicklines
2895 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2896 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
2897 \put(3,7){\line(1,0){6}}
2898 \put(3,-2.5){\line(1,0){6}}
2899 \newsavebox{\eqdist}
2900 \savebox{\eqdist}(0,0)[b]{%
2901   \thinlines
2902   \put(-0.08,0.2){\line(0,-1){0.4}}%
2903   \put(0.08,0.2){\line(0,-1){0.4}}}
2904 \put(1.5,0){\usebox{\eqdist}}
2905 \put(10.5,0){\usebox{\eqdist}}
2906
2907 \color{blue}% shifted
2908 \thicklines
2909 \put(3,-1.5){\vector(-1,0){4}}
2910 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
2911 \put(3,0){\vector(0,-1){1.5}}
2912 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
2913 \end{picture}
2914 \end{center}
2915 \end{minipage}%
2916 \begin{minipage}{0.6\textwidth}%
2917 %<*en>
2918 Consider a node containing Japanese character whose value of the \texttt{align}
2919 field is \texttt{'middle'}.
2920 %</en>
2921 %<*ja>
2922 \texttt{align}フィールドの値が\texttt{'middle'}である和文文字を含むノードを
2923 考えよう.
2924 %</ja>
2925 %<*zh>
2926 假定一个node包含日语字符,且其值为\texttt{align}的\texttt{'middle'}。
2927 %</zh>
2928 \begin{itemize}
2929 \item
2930 %<*en>
2931 The black rectangle is a frame of the node.
2932 Its width, height and depth are specified by JFM.
2933 %</en>
2934 %<*ja>
2935 黒色の長方形はノードの枠である.
2936 その幅,高さ,深さはJFMによって指定される.
2937 %</ja>
2938 %<*zh>
2939 黑色长方形为node框。其宽度,高度,深度均为JFM所设定。
2940 %</zh>
2941 \item
2942 %<*en>
2943 Since the \texttt{align} field is \texttt{'middle'},
2944 the `real' glyph is centered horizontally (the green rectangle).
2945 %</en>
2946 %<*ja>
2947 \texttt{align}フィールドは\texttt{middle}なので,「実際の」グリフは
2948 水平方向の中心に配置される(緑色の長方形).
2949 %</ja>
2950 %<*zh>
2951 因\texttt{align}被设定为\texttt{middle},故“真实”字形为水平居中(绿长方形中)。
2952 %</zh>
2953 \item
2954 %<*en>
2955 Furthermore, the glyph is shifted according to values of fields
2956       \texttt{left} and \texttt{down}. The ultimate position of the real
2957       glyph is indicated by the red rectangle.
2958 %</en>
2959 %<*ja>
2960 さらに,グリフは\texttt{left}と\texttt{down}の値に従ってシフトされる.
2961 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
2962 %</ja>
2963 %<*zh>
2964 此外,字形移位由\texttt{left}和\texttt{down}决定。最终字形位置为红长方形所示。
2965 %</zh>
2966 \end{itemize}
2967 \end{minipage}
2968 \caption{
2969 %<en>The position of the `real' glyph.
2970 %<ja>「実際の」グリフの位置.
2971 %<zh>“真实”字形位置
2972 }
2973 \label{fig-pos}
2974 \end{figure}
2975
2976
2977 \item[kern={\{[$j$]=<kern>, ...\}}]
2978
2979 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
2980 \end{list}
2981
2982 %<*en>
2983 As described before, you can specify several `imaginary characters' in
2984 \texttt{chars} field. The most of these characters are regarded as the
2985 characters of class 0 in \pTeX.
2986 As a result, \LuaTeX-ja can control typesetting finer than \pTeX.
2987 The following is the list of `imaginary characters':
2988 %</en>
2989 %<*ja>
2990 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
2991 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
2992 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
2993 い組版調整ができるようになっている.以下でその一覧を述べる:
2994 %</ja>
2995 %<*zh>
2996 如上所述,你可以在\texttt{chars}中设定多个“假想字符”。这些字符中的多数字符在
2997 \pTeX中式被视作字符集0中字符。故此,\LuaTeX-ja可以比\pTeX做得更好。
2998 下列为“假想字符”列表:
2999 %</zh>
3000 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3001 \item['lineend']
3002 %<en>An ending of a line.
3003 %<ja>行の終端を表す.
3004 %<zh>行尾结束字符。
3005
3006 \item['diffmet']
3007 %<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
3008 %<ja>JFMやサイズが異なる2つの\textbf{JAchar}の間の境界として用いられる.
3009 %<zh>用于两个不同大小或不同JFM的两个\textbf{JAchar}间边界。
3010
3011 \item['boxbdd']
3012 %<en>The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
3013 %<ja>水平ボックスの先頭と末尾,及びインデントされていない(\verb+\noindent+ で開始された)段落の先頭を表す.
3014 %<zh>水平合字结束或结尾,以及未缩进段落开头。
3015
3016 \item['parbdd']
3017 %<en>The beginning of an (indented) paragraph.
3018 %<ja>通常の(\verb+\noindent+ で開始されていない)段落の先頭.
3019 %<zh>缩进段落开头。
3020
3021 \item['jcharbdd']
3022 %<en>A boundary between \textbf{JAchar} and anything else (such as \textbf{ALchar}, kern, glue, ...).
3023 %<ja>和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
3024 %<zh>日文字符和其他(如\textbf{ALchar},胶,出格等)边界。
3025
3026 \item[$-1$]
3027 %<en>The left/right boundary of an inline math formula.
3028 %<ja>行中数式と地の文との境界.
3029 %<zh>行中数学式的左/右边界。
3030 \end{list}
3031
3032 %<en>\paragraph{Porting JFM from \pTeX}
3033 %<ja>\paragraph{\pTeX 用和文フォントメトリックの移植}
3034 %<zh>\paragraph{\pTeX下使用的JFM移植}
3035
3036 % ToDo: English version.
3037
3038 %<*en>
3039 ...
3040 %</en>
3041
3042 %<*ja>
3043 以下に,\pTeX 用和文フォントメトリックを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
3044 \begin{itemize}
3045 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
3046 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
3047       トメトリック等を移植する場合は,
3048 \begin{itemize}
3049 \item JFM中の全ての数値を$1/0.962216$倍しておく.
3050 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
3051       \LaTeX でのフォント宣言なら,例えば次のように:
3052 \begin{verbatim}
3053 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
3054 \end{verbatim}
3055 \end{itemize}
3056 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
3057       (JFM中に単に書かなければよい).
3058 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
3059       文字クラスに関してはグルー/カーンの設定はしない.
3060
3061 これは,\pTeX では,
3062       水平ボックスの先頭・末尾とインデントされていない(\verb+\noindent+ で開始さ
3063       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
3064 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
3065
3066 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
3067       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
3068       は,段落の最初に手動で \verb+\inhibitglue+ を追加するか,あるいは
3069       \verb+\everypar+ のハックを行い,それを自動化させるしかなかった.
3070
3071 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
3072 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
3073 \texttt{'parbdd'}を入れれば全角下がりとなる.
3074
3075 \ltjsetparameter{jacharrange={+3}}
3076 \begin{LTXexample}
3077 \jfont\g=psft:Ryumin-Light:jfm=test \g
3078 \parindent1\zw\noindent{}◆◆◆◆◆
3079 \par 「◆◆←二分下がり
3080 \par 【◆◆←全角下がり
3081 \par 〔◆◆←全角二分下がり
3082 \end{LTXexample}
3083 \end{itemize}
3084 \ltjsetparameter{jacharrange={-3}}
3085 %</ja>
3086 %<*zh>
3087 下面,给出用于\pTeX使用的JFM移植到\LuaTeX-ja过程中需要注意的几点。
3088 %</zh>
3089
3090
3091 %<en>\subsection{Math Font Family}
3092 %<ja>\subsection{数式フォントファミリ}
3093 %<zh>\subsection{数学字体族}
3094 \label{ssec-math}
3095
3096 %<*en>
3097 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
3098 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX\ can handles 256~families, but
3099 an external package is needed to support this in plain \TeX\ and
3100 \LaTeX.}, and each family has three fonts:
3101 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
3102 %</en>
3103 %<*ja>
3104 \TeX\ は数式フォントを16のファミリ\footnote{Omega, Aleph, \LuaTeX,そして
3105   $\varepsilon$-\kern-.125em(u)\pTeX\ では256の数式ファミリを扱うことができるが,
3106   これをサポートするためにplain \TeX と\LaTeX では外部パッケージを読み込む必要が
3107   ある.}で管理し,それぞれのファミリは3つのフォントを持っている:\verb+\textfont+, \verb+\scriptfont+ そして \verb+\scriptscriptfont+ である.
3108 %</ja>
3109
3110 %<*en>
3111 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
3112 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
3113 font families. There is no relation between the value of
3114 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
3115 you can set both \verb+\fam+ and \verb+\jfam+ to the same value.
3116 %</en>
3117 %<*ja>
3118 \LuaTeX-jaの数式中での和文フォントの扱いも同様である.
3119 表 \ref{tab-math} は数式フォントファミリに対する \TeX のプリミティブと対応する
3120 ものを示している.\verb+\fam+ と \verb+\jfam+ の値の間には関係はなく,
3121 適切な設定の下では \verb+\fam+ と \verb+\jfam+ の両方に同じ値を設定することができる.
3122 %</ja>
3123
3124 \begin{table}[!tb]
3125 %<en>\caption{Primitives for Japanese math fonts.}
3126 %<ja>\caption{和文数式フォントに対するプリミティブ.}
3127 %<zh>\caption{日语数学字体基本语句}
3128 \label{tab-math}
3129 \begin{center}\def\{{\char`\{}\def\}{\char`\}}
3130 \begin{tabular}{lll}
3131 \toprule
3132 %<en>&Japanese fonts&alphabetic fonts\\
3133 %<ja>&和文フォント&欧文フォント\\
3134 %<zh>&日文字体&西文字体\\
3135 \midrule
3136 font family&\verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
3137 text size&\tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
3138 script size&\tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
3139 scriptscript size&\tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
3140 \bottomrule
3141 \end{tabular}
3142 \end{center}
3143 \end{table}
3144
3145 %<en>\subsection{Callbacks}
3146 %<ja>\subsection{コールバック}
3147 %<zh>\subsection{回调}
3148
3149 %<*en>
3150 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
3151 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks.
3152 %</en>
3153 %<*ja>
3154 \LuaTeX 自体のものに加えて,\LuaTeX-jaもコールバックを持っている.
3155 これらのコールバックには,他のコールバックと同様に \verb+luatexbase.add_to_callback+
3156 関数などを用いることでアクセスすることができる.
3157 %</ja>
3158 \begin{list}{}%
3159 {\def\makelabel#1{\bfseries#1}}
3160 %<en>\item[\texttt{luatexja.load\_jfm} callback]
3161 %<ja>\item[\texttt{luatexja.load\_jfm}コールバック]
3162 %<zh>\item[\texttt{luatexja.load\_jfm}回调]
3163 %<*en>
3164 With this callback you can overwrite JFMs.
3165 This callback is called when a new JFM is loaded.
3166 %</en>
3167 %<*ja>
3168 このコールバックを用いることでJFMを上書きすることができる.
3169 このコールバックは新しいJFMが読み込まれるときに呼び出される.
3170 %</ja>
3171
3172 \begin{lstlisting}[numbers=left]
3173 function (<table> jfm_info, <string> jfm_name)
3174   return <table> new_jfm_info
3175 end
3176 \end{lstlisting}
3177
3178 %<*en>
3179 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
3180 this argument has \texttt{chars} field which contains character codes
3181              whose character class is not~0.
3182 %</en>
3183 %<*ja>
3184 引数 \verb+jfm_info+ はJFMファイルのテーブルと似たものが格納されるが,
3185 クラス0を除いた文字のコードを含んだ\texttt{chars}フィールドを持つ点が異なる.
3186 %</ja>
3187
3188 %<*en>
3189 An example of this callback is the \texttt{ltjarticle} class, with
3190              forcefully assigning character class~0 to \texttt{'parbdd'}
3191              in the JFM \texttt{jfm-min.lua}. This callback doesn't
3192              replace any code of \LuaTeX-ja.
3193 %</en>
3194 %<*ja>
3195 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
3196 \texttt{jfm-min.lua}中の\texttt{'parbdd'}を強制的にクラス0に割り当てている.
3197 このコールバックは\LuaTeX-jaのコードを書き換えない.
3198 %</ja>
3199
3200 %<en>\item[\texttt{luatexja.define\_font} callback]
3201 %<ja>\item[\texttt{luatexja.define\_font}コールバック]
3202 %<zh>\item[\texttt{luatexja.define\_font}回调]
3203 %<*en>
3204 This callback and the next callback form a pair, and you can assign letters which don't have
3205              fixed code points in Unicode to non-zero character classes.
3206 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
3207 %</en>
3208 %<*ja>
3209 このコールバックと次のコールバックは組をなしており,Unicode中に固定された文字コード
3210 番号を持たない文字を非零の文字クラスに割り当てることができる.
3211 このコールバックは新しい和文フォントが読み込まれたときに呼び出される.
3212 %</ja>
3213
3214 \begin{lstlisting}[numbers=left]
3215 function (<table> jfont_info, <number> font_number)
3216   return <table> new_jfont_info
3217 end
3218 \end{lstlisting}
3219
3220 %<*en>
3221 You may assume that \verb+jfont_info+ has the following fields:
3222 %</en>
3223 %<*ja>
3224 \verb+jfont_info+ は以下のフィールドを持つ:
3225 %</ja>
3226 \begin{description}
3227 \item[\tt jfm]
3228 %<en>The index number of JFM.
3229 %<ja>JFMのインデックス番号.
3230 %<zh>JFM索引编号。
3231
3232 \item[\tt size]
3233 %<en>Font size in a scaled point (${}=2^{-16}\,\textrm{pt}$).
3234 %<ja>スケールド・ポイント(${}=2^{-16}\,\textrm{pt}$)を単位としたフォントのサイズ.
3235 %<zh>以参照点(${}=2^{-16}\,\textrm{pt}$)为点位的字体大小。
3236
3237 \item[\tt var]
3238 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
3239 %<ja>\verb+\jfont+ の呼び出しの際に\texttt{jfmvar=...}で指定された値.
3240 %<zh>\verb!\jfont!调用的\texttt{jfmvar=...}值。
3241 \end{description}
3242
3243 %<*en>
3244 The returned table \verb+new_jfont_info+ also should include these three fields.
3245 The \verb+font_number+ is a font number.
3246 %</en>
3247 %<*ja>
3248 戻り値の \verb+new_jfont_info+ テーブルもこれら3つのフィールドを含まなければならない.
3249 \verb+font_number+ はフォント番号である.
3250 %</ja>
3251
3252 %<*en>
3253 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
3254              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
3255              CID characters in a JFM. This callback doesn't replace any
3256              code of \LuaTeX-ja.
3257 %</en>
3258 %<*ja>
3259 これと次のコールバックの良い使用例は\Pkg{luatexja-otf}パッケージであり,
3260 JFM中でAdobe-Japan1 CIDの文字を \verb+"AJ1-xxx"+ の形で指定するために
3261 用いられている.
3262 このコールバックは\LuaTeX-jaのコードを書き換えない.
3263 %</ja>
3264
3265 %<en>\item[\texttt{luatexja.find\_char\_class} callback]
3266 %<ja>\item[\texttt{luatexja.find\_char\_class}コールバック]
3267 %<zh>\item[\texttt{luatexja.find\_char\_class}回调]
3268 %<*en>
3269 This callback is called just when \LuaTeX-ja is trying to determine which
3270              character class a character \verb+chr_code+ belongs.
3271 A function used in this callback should be in the following form:
3272 %</en>
3273 %<*ja>
3274 このコールバックは\LuaTeX-jaが \verb+chr_code+ の文字がどの文字クラスに
3275 属するかを決定しようとする際に呼び出される.
3276 このコールバックで呼び出される関数は次の形をしていなければならない:
3277 %</ja>
3278 \begin{lstlisting}[numbers=left]
3279 function (<number> char_class, <table> jfont_info, <number> chr_code)
3280   if char_class~=0 then return char_class
3281   else
3282     ....
3283     return (<number> new_char_class or 0)
3284   end
3285 end
3286 \end{lstlisting}
3287
3288 %<*en>
3289 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
3290              routine or previous function calls in this callback, hence
3291              this argument may not be 0. Moreover, the returned
3292              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
3293              is not~0, otherwise you will overwrite the \LuaTeX-ja's
3294              default routine.
3295 %</en>
3296 %<*ja>
3297 引数 \verb+char_class+ は\LuaTeX-jaのデフォルトルーチンか,このコールバックの
3298 直前の関数呼び出しの結果を含んでおり,したがってこの値は0ではないかもしれない.
3299 さらに,戻り値の \verb+new_char_class+ は \verb+char_class+ が非零のときには
3300 \verb+char_class+ の値と同じであるべきで,そうでないときは\LuaTeX-jaの
3301 デフォルトルーチンを書き換えることになる.
3302 %</ja>
3303
3304 %<*en>
3305 This callback doesn't replace any code of \LuaTeX-ja.
3306 %</en>
3307 %<*ja>
3308 このコールバックは\LuaTeX-jaのコードを書き換えない.
3309 %</ja>
3310 %<*zh>
3311 此回调不会替换\LuaTeX-ja中任何代码。
3312 %</zh>
3313
3314 %<en>\item[\texttt{luatexja.set\_width} callback]
3315 %<ja>\item[\texttt{luatexja.set\_width}コールバック]
3316 %<zh>\item[\texttt{luatexja.set\_width}回调]
3317 %<*en>
3318 This callback is called when \LuaTeX-ja is trying to encapsule a
3319              \textbf{JAchar} \textit{glyph\_node}, to adjust its
3320              dimension and position.
3321 %</en>
3322 %<*ja>
3323 このコールバックは\LuaTeX-jaが\textbf{JAchar}の寸法と位置を調節するために
3324 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
3325 %</ja>
3326 \begin{lstlisting}[numbers=left]
3327 function (<table> shift_info, <table> jfont_info, <number> char_class)
3328   return <table> new_shift_info
3329 end
3330 \end{lstlisting}
3331
3332 %<*en>
3333 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
3334 \texttt{down} and \texttt{left} fields, which are the amount of shifting
3335              down/left the character in a scaled-point.
3336 %</en>
3337 %<*ja>
3338 引数 \verb+shift_info+ と戻り値の \verb+new_shift_info+ は
3339 \texttt{down}と\texttt{left}のフィールドを持ち,これらの値は
3340 文字の下/左へのシフト量(スケールド・ポイント単位)である.
3341 %</ja>
3342
3343 %<*en>
3344 A good example is \Pkg{test/valign.lua}.
3345 After loading this file, the vertical position of glyphs is automatically
3346 adjusted; the ratio $(\hbox{height}:\hbox{depth})$ of glyphs is adjusted
3347 to be that of letters in the character class~0. For example, suppose that
3348 \begin{itemize}
3349 \item The setting of the JFM: $(\hbox{height})=88x$, $(\hbox{depth})=12x$
3350   (the standard values of Japanese OpenType fonts);
3351 \item The value of the real font: $(\hbox{height})=28y$, $(\hbox{depth})=5y$
3352   (the standard values of Japanese TrueType fonts).
3353 \end{itemize}
3354 Then, the position of glyphs is shifted up by
3355 \[
3356  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3357 \]
3358 %</en>
3359 %<*ja>
3360 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
3361              JFM内で規定された文字クラス0の文字における$(\hbox{高
3362              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
3363              下位置が自動調整される.例えば,
3364 \begin{itemize}
3365 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
3366 (和文OpenTypeフォントの標準値)
3367 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
3368 \end{itemize}
3369 となっていたとする.すると,実際の文字の出力位置は,
3370 \[
3371  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3372 \]
3373 だけ上にずらされることになる.
3374 %</ja>
3375 \end{list}
3376
3377
3378
3379 %<en>\section{Parameters}
3380 %<ja>\section{パラメータ}
3381 %<zh>\section{参数}
3382 %<en>\subsection{\texttt{\char92 ltjsetparameter} primitive}
3383 %<ja>\subsection{\texttt{\char92 ltjsetparameter}プリミティブ}
3384 %<zh>\subsection{\texttt{\char92 ltjsetparameter}基本参数}
3385
3386 %<*en>
3387 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
3388 primitives for accessing most parameters of \LuaTeX-ja. One of the main
3389 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
3390 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
3391 is the position of \verb+hpack_filter+ callback in the source
3392 of \LuaTeX, see Section~\ref{sec-para}.
3393 %</en>
3394 %<*ja>
3395 先に述べたように,\verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ は
3396 \LuaTeX-jaのほとんどのパラメータにアクセスするためのプリミティブである.
3397 \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を
3398 採用しない理由の一つは,\LuaTeX のソースにおける \verb+\hpack_filter+
3399 コールバックの位置にある.\ref{sec-para} 節を参照.
3400 %</ja>
3401
3402 %<*en>
3403 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives
3404 for assigning parameters. These take one argument which is a
3405 \texttt{<key>=<value>} list. Allowed keys are described in the next
3406 subsection.
3407 The difference between
3408 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
3409 scope of assignment;
3410 \verb+\ltjsetparameter+ does a local assignment and
3411 \verb+\ltjglobalsetparameter+ does a global one.
3412 They also obey the value of \verb+\globaldefs+,
3413 like other assignment.
3414 %</en>
3415 %<*ja>
3416 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ はパラメータを
3417 指定するためのプリミティブである.これらは\texttt{<key>=<value>}のリストを
3418 引数としてとる.許されるキーは次の節に記述する.
3419 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ の違いはスコープの
3420 違いのみである.
3421 \verb+\ltjsetparameter+ はローカルな指定,\verb+\ltjglobalsetparameter+ は
3422 グローバルな指定を行う.
3423 これらは他のパラメータ指定と同様に \verb+\globaldefs+ の値に従う.
3424 %</ja>
3425
3426 %<*en>
3427 \verb+\ltjgetparameter+ is the primitive for acquiring parameters. It
3428 always takes a parameter name as first argument, and also takes the
3429 additional argument---a character code, for example---in some cases.
3430 %</en>
3431 %<*ja>
3432 \verb+\ltjgetparameter+ はパラメータの値を取得するためのプリミティブであり,
3433 常にパラメータの名前を第一引数にとる.
3434 そして,いくつかの場合には加えてさらに引数(例えば文字コード)をとる.
3435 %</ja>
3436 \begin{LTXexample}
3437 \ltjgetparameter{differentjfm},
3438 \ltjgetparameter{autospacing},
3439 \ltjgetparameter{prebreakpenalty}{`)}.
3440 \end{LTXexample}
3441 %<*en>
3442 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
3443 always a string}. This is outputted by \texttt{tex.write()}, so any
3444 character other than space~`\texttt{\char32}'~(U+0020) has the category code
3445 12~(other), while the space has 10~(space).
3446 %</en>
3447 %<*ja>
3448 \textbf{{\normalfont\tt\char92ltjgetparameter}の戻り値は常に文字列である.}
3449 これは\texttt{tex.write()}によって出力しているためで,スペース`\texttt{\char32}'~(U+0020)を除いた文字のカテゴリーコードは全て12~(other)となる.
3450 一方,スペースのカテゴリーコードは10~(space)である.
3451 %</ja>
3452
3453 %<en>\subsection{List of Parameters}
3454 %<ja>\subsection{パラメータ一覧}
3455 %<zh>\subsection{参数一览}
3456 \label{ssec-param}
3457
3458 %<*en>
3459 The following is the list of parameters which can be specified by the
3460 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
3461 in \pTeX, and symbols beside each parameter has the following meaning:
3462 %</en>
3463 %<*ja>
3464 以下は \verb+\ltjsetparameter+ に指定することができるパラメータの一覧である.
3465 [\verb+\cs+]は\pTeX における対応物を示す.
3466 また,それぞれのパラメータの右上にある記号には次の意味がある:
3467 %</ja>
3468 \begin{itemize}
3469 %<*en>
3470 \item No mark: values at the end of the paragraph or the hbox are
3471       adopted in the whole paragraph/hbox.
3472 %</en>
3473 %<*ja>
3474 \item 記号なし:段落や水平ボックスの終端での値がその段落/水平ボックス全体で用いられる.
3475 %</ja>
3476 %<*en>
3477 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
3478 %</en>
3479 %<*ja>
3480 \item `\ast':ローカルなパラメータであり,段落/水平ボックス内のどこででも値を変えることができる.
3481 %</ja>
3482 %<*en>
3483 \item `\dagger': assignments are always global.
3484 %</en>
3485 %<*ja>
3486 \item `\dagger':指定は常にグローバルになる.
3487 %</ja>
3488 \end{itemize}
3489
3490 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3491 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
3492 %<*en>
3493 Penalty value for suppressing orphans. This penalty is inserted just
3494              after the last \textbf{JAchar} which is not regarded as a
3495              (Japanese) punctuation mark.
3496 %</en>
3497 %<*ja>
3498 パラグラフの最後の字が孤立して改行されるのを防ぐためのペナルティの値.
3499 このペナルティは(日本語の)句読点として扱われない最後の\textbf{JAchar}の直後に
3500 挿入される.
3501 %</ja>
3502
3503 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
3504 %<*en>
3505 An additional attributes which each character whose character code is <chr\_code> has.
3506 At the present version, the lowermost bit of <natural number> indicates
3507              whether the character is considered as a punctuation mark
3508              (see the description of \Param{jcharwidowpenalty} above).
3509 %</en>
3510 %<*ja>
3511 文字コードが<chr\_code>の文字が持つ付加的な属性値(attribute).
3512 現在のバージョンでは,<natural number>の最下位ビットが,その文字が句読点と
3513 みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照).
3514 %</ja>
3515
3516 \item[\Param{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
3517 %<*ja>
3518 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
3519              この文字の前に挿入/追加されるペナルティの量を指定する.
3520
3521 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,標準で読み込まれる
3522              \texttt{luatexja-kinsoku.tex}において
3523 \begin{verbatim}
3524 \ltjsetparameter{prebreakpenalty={`〙,10000}}
3525 \end{verbatim}
3526 と,最大値の10000が指定されている.他にも,小書きのカナなど,絶対禁止とい
3527              うわけではないができれば行頭にはきて欲しくない場合に,0と
3528              10000の間の値を指定するのも有用であろう.
3529 \begin{verbatim}
3530 \ltjsetparameter{prebreakpenalty={`ゕ,150}}
3531 \end{verbatim}
3532 %</ja>
3533
3534 \item[\Param{postbreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
3535 %<*ja>
3536 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
3537              この文字の後に挿入/追加されるペナルティの量を指定する.
3538
3539 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
3540 \begin{itemize}
3541 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
3542       た(後から指定した方で上書きされる).
3543 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
3544 \end{itemize}
3545 という制限があったが,\LuaTeX-jaではこれらの制限は解消されている.
3546 %</ja>
3547
3548 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}]
3549 %<en>[\verb+\textfont+ in \TeX]
3550 %<ja>[\TeX の \verb+\textfont+]
3551 %<zh>[\TeX中的\verb+\textfont+]
3552 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}]
3553 %<en>[\verb+\scriptfont+ in \TeX]
3554 %<ja>[\TeX の \verb+\scriptfont+]
3555 %<zh>[\TeX中的\verb+\scriptfont+]
3556 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}]
3557 %<en>[\verb+\scriptscriptfont+ in \TeX]
3558 %<ja>[\TeX の \verb+\scriptscriptfont+]
3559 %<zh>[\TeX中的\verb+\scriptscriptfont+]
3560 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
3561 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
3562
3563 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
3564
3565 %<*en>
3566 Setting whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
3567 The followings are allowed for <mode>:
3568 %</en>
3569 %<*ja>
3570 文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{xkanjiskip}の
3571 挿入を許すかどうかの設定.
3572 以下の<mode>が許される:
3573 %</ja>
3574 \begin{description}
3575 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
3576 %<ja>\item[0, \texttt{inhibit}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも禁止される.
3577 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{xkanjiskip}均被禁止。
3578 %<en>\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
3579 %<ja>\item[1, \texttt{preonly}] \Param{xkanjiskip}の挿入は文字の前では許されるが,後ろでは許されない.
3580 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{xkanjiskip},但其后不允许插入。
3581 %<en>\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
3582 %<ja>\item[2, \texttt{postonly}] \Param{xkanjiskip}の挿入は文字の後ろでは許されるが,前では許されない.
3583 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{xkanjiskip},但之前不允许插入。
3584 %<en>\item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed both before the character and after the character. This is the default value.
3585 %<ja>\item[3, \texttt{allow}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
3586 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{xkanjiskip}。此为默认值。
3587 \end{description}
3588 %<*en>
3589 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
3590 %</en>
3591 %<*ja>
3592 このパラメータは\pTeX の \verb+\inhibitxspcode+ プリミティブと似ているが,
3593 互換性はない.
3594 %</ja>
3595 %<*zh>
3596 此参数类似\pTeX基本语句\verb!\inhibitxspcode!,但是和\verb!\inhibitxspcode不兼容。!
3597 %</zh>
3598 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
3599
3600 %<*en>
3601 Setting whether inserting \Param{xkanjiskip} is allowed before/after a
3602              \textbf{ALchar} whose character code is <chr\_code>.
3603              The followings are allowed for <mode>:
3604 %</en>
3605 %<*ja>
3606 文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{xkanjiskip}の
3607 挿入を許すかどうかの設定.
3608 以下の<mode>が許される:
3609 %</ja>
3610 \begin{description}
3611 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
3612 %<ja>\item[0, \texttt{inhibit}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも禁止される.
3613 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{xkanjiskip}均被禁止。
3614 %<en>\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
3615 %<ja>\item[1, \texttt{preonly}] \Param{xkanjiskip}の挿入は文字の前では許されるが,後ろでは許されない.
3616 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{xkanjiskip},但其后不允许插入。
3617 %<en>\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
3618 %<ja>\item[2, \texttt{postonly}] \Param{xkanjiskip}の挿入は文字の後ろでは許されるが,前では許されない.
3619 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{xkanjiskip},但之前不允许插入。
3620 %<en>\item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character. This is the default value.
3621 %<ja>\item[3, \texttt{allow}] \Param{xkanjiskip}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
3622 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{xkanjiskip}。此为默认值。
3623 \end{description}
3624 %<*en>
3625 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
3626 %</en>
3627 %<*ja>
3628 \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため,
3629 これら2つのパラメータは互いの異名となっていることに注意する.
3630 %</ja>
3631 %<*zh>
3632 注意参数\Param{jaxspmode}和\Param{alxspmode}公用一个表,故这两个参数互为同义语。
3633 %</zh>
3634
3635 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
3636 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
3637 \item[\Param{kanjiskip}\,=<skip>] [\verb+\kanjiskip+]
3638 \item[\Param{xkanjiskip}\,=<skip>] [\verb+\xkanjiskip+]
3639
3640 \item[\Param{differentjfm}\,=<mode>$^\dagger$]
3641
3642 %<*en>
3643 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
3644 The allowed arguments are the followings:
3645 %</en>
3646 %<*ja>
3647 JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグルー/カーンをどのように
3648 入れるかを指定うる.
3649 許される値は以下の通り:
3650 %</ja>
3651 %<*zh>
3652 对于处理不同大小或者JFM的两种\textbf{JAchar}之间的胶/出格。
3653 有下列参数:
3654 %</zh>
3655 \begin{description}
3656 \item[\texttt{average}]
3657 \item[\texttt{both}]
3658 \item[\texttt{large}]
3659 \item[\texttt{small}]
3660 \end{description}
3661
3662 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
3663 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
3664 \end{list}
3665
3666
3667 %<en>\section{Other Primitives}
3668 %<ja>\section{その他のプリミティブ}
3669 %<zh>\section{其他基本语句}
3670 %<en>\subsection{Primitives for Compatibility}
3671 %<ja>\subsection{互換プリミティブ}
3672 %<zh>\subsection{基本语句兼容性}
3673
3674 %<*en>
3675 The following primitives are implemented for compatibility with \pTeX:
3676 %</en>
3677 %<*ja>
3678 以下のプリミティブは\pTeX との互換性のために実装されている:
3679 %</ja>
3680 %<*zh>
3681 下列基本语句的实现与\pTeX兼容:
3682 %</zh>
3683 \begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw}
3684 \item[kuten]
3685 \item[jis]
3686 \item[euc]
3687 \item[sjis]
3688 \item[ucs]
3689 \item[kansuji]
3690 \end{list}
3691
3692 %<en>\subsection{\texttt{\char92 inhibitglue} primitive}
3693 %<ja>\subsection{\texttt{\char92 inhibitglue}プリミティブ}
3694 %<zh>\subsection{\texttt{\char92 inhibitglue}基本语句}
3695 %<*en>
3696 The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
3697 The following is an example, using a special JFM that there will be a glue between
3698 the beginning of a box and `あ', and also between `あ' and `ウ'.
3699 %</en>
3700 %<*ja>
3701 \verb+\inhibitglue+ プリミティブは\textbf{JAglue}の挿入を抑制する.
3702 以下は,ボックスの始めと`あ'の間,`あ'と`ウ'の間にグルーが入る特別なJFMを用いた例で
3703 ある.
3704 %</ja>
3705 %<*zh>
3706 基本语句\verb!\inhibitglue!会压缩\textbf{JAchar}的插入。
3707 下面的例子使用了特殊的JFM。在一个盒子和“あ”之间,以及“あ”和“ウ”之间存在胶。
3708 %</zh>
3709
3710 \begin{LTXexample}
3711 \jfont\g=psft:Ryumin-Light:jfm=test \g
3712 \fbox{\hbox{あウあ\inhibitglue ウ}}
3713 \inhibitglue\par\noindent あ1
3714 \par\inhibitglue\noindent あ2
3715 \par\noindent\inhibitglue あ3
3716 \par\hrule\noindent あoff\inhibitglue ice
3717 \end{LTXexample}
3718
3719 %<*en>
3720 With the help of this example, we remark the specification of \verb+\inhibitglue+:
3721 %</en>
3722 %<*ja>
3723 この例を援用して,\verb+\inhibitglue+ の仕様について述べる.
3724 %</ja>
3725 %<*zh>
3726 如上例子,我们注意到\verb!\inhibtglue!的用法。
3727 %</zh>
3728 \begin{itemize}
3729 %<*en>
3730 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
3731       simply ignored.
3732 %</en>
3733 %<*ja>
3734 \item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
3735 4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
3736 \verb+\noindent+ の時点で水平モードになるからである.
3737 %</ja>
3738
3739 %<*en>
3740 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
3741       mode is only effective on the spot; does not get over boundary of
3742       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
3743       kernings, as shown in the last line of above example.
3744 %</en>
3745 %<*ja>
3746 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
3747   有効であり,段落の境界を乗り越えない.
3748   さらに,\verb+\inhibitglue+ は上の例の最終行のようにリガチャとカーニングを
3749   打ち消す.
3750 %</ja>
3751
3752 %<*en>
3753 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
3754 %</en>
3755 %<*ja>
3756 \item \verb+\inhibitglue+ を数式モード中で呼び出した場合はただ無視される.
3757 %</ja>
3758 \end{itemize}
3759
3760 %<en>\section{Control Sequences for \LaTeXe}
3761 %<ja>\section{\LaTeXe 用のコントロールシーケンス}
3762 %<zh>\section{\LaTeXe 下使用的控制序列}
3763
3764 %<en>\subsection{Patch for NFSS2}
3765 %<ja>\subsection{NFSS2へのパッチ}
3766 %<zh>\subsection{NFSS2补丁}
3767 \label{ssub-nfsspat}
3768
3769 %<*en>
3770 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
3771 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
3772 For an convenience, we will describe
3773 commands which are not described in Subsection~\ref{ssub-chgfnt}.
3774 %</en>
3775 %<*ja>
3776 \ref{ssec-ltx} 節で述べたように,\LuaTeX-jaはNFSS2への日本語パッチである
3777 \pLaTeXe の\texttt{plfonts.dtx}を単純に取り入れている.
3778 便宜のため,ここでは \ref{ssub-chgfnt} 節で述べていなかったコマンドについて
3779 記述しておく.
3780 %</ja>
3781
3782 \begin{cslist}%
3783 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
3784
3785 %<*en>
3786 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
3787              and Japanese font families are only made by their
3788              encodings. For example, encodings OT1 and T1 are for
3789              alphabetic font families, and a Japanese font family cannot
3790              have these encodings. This command defines a new encoding
3791              scheme for Japanese font family (in horizontal direction).
3792 %</en>
3793 %<*ja>
3794 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
3795 そのエンコーディングからのみ作られる.
3796 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
3797 和文フォントファミリはこれらのエンコーディングを持つことはできない.
3798 このコマンドは和文フォントファミリ(横書き用)のための新しいエンコーディングを
3799 定義する.
3800 %</ja>
3801
3802 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
3803 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
3804 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
3805
3806 %<*en>
3807 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
3808 %</en>
3809 %<*ja>
3810 上記3つのコマンドはちょうど \verb+DeclareFontEncodingDefaults+ などに対応するものである.
3811 %</ja>
3812
3813 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
3814
3815 % ToDo: en
3816 %<*ja>
3817 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
3818 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\verb+\mathrm+ 等)と,和文数式用フォ
3819              ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+ 等)の2つを同時に行う命令として
3820              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
3821              <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
3822              更させるようにするのが一般的と思われる.
3823
3824 {\let\item=\origitem
3825 本命令は
3826 \begin{center}\tt
3827 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
3828 (<al-cmd>を1段展開したもの)\{<ja-cmd>を1段展開したもの)\{<arg>\}\}
3829 \end{center}
3830 と定義を行うので,使用には注意が必要である:
3831 \begin{itemize}
3832 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に
3833 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
3834 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと\texttt{@}をつけた命令を指定した時の動作は保証できない.
3835 \end{itemize}}
3836 %</ja>
3837
3838 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
3839   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
3840 %<*en>
3841 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
3842 with respect to a Japanese font family given by the former 4~arguments.
3843 %</en>
3844 %<*ja>
3845 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
3846 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
3847 %</ja>
3848 \item[SetRelationFont]
3849 %<*en>
3850 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
3851 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
3852 %</en>
3853 %<*ja>
3854 このコマンドは \verb+\DeclareRelationFont+ とローカルな指定であることを除いて
3855 ほとんど同じである(\verb+\DeclareRelationFont+ はグローバル).
3856 %</ja>
3857
3858 \item[userelfont]
3859 %<*en>
3860 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
3861              font family with respect to current Japanese font family,
3862              which was set by
3863              \verb+\DeclareRelationFont+ or \verb+\SetRelationFont+.
3864 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
3865 %</en>
3866 %<*ja>
3867 現在の欧文フォントエンコーディング/ファミリ/…… を,
3868 \verb+\DeclareRelationFont+ か \verb+\SetRelationFont+ で指定された
3869 現在の和文フォントファミリに対応する「従属欧文」フォントファミリに変更する.
3870 \verb+\fontfamily+ のように,有効にするためには \verb+\selectfont+ が必要である.
3871 %</ja>
3872
3873 \item[adjustbaseline]
3874 ...
3875
3876 \item[fontfamily\{<family>\}]
3877 {\let\item\origitem
3878 %<*en>
3879 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
3880 to <family>. Which family will be changed is determined as follows:
3881 %</en>
3882 %<*ja>
3883 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
3884 和文,\textbf{もしくは両方})を<family>に変更する.
3885 どのファミリが変更されるかは以下のようにして決定される:
3886 %</ja>
3887 \begin{itemize}
3888 %<*en>
3889 \item Let current encoding scheme for Japanese fonts be
3890       <ja-enc>. Current Japanese font family will be changed to
3891       <family>, if one of the following two conditions is met:
3892 %</en>
3893 %<*ja>
3894 \item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
3895   現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
3896   <family>に変更される:
3897 %</ja>
3898 \begin{itemize}
3899 %<*en>
3900 \item The family <fam> under the encoding <ja-enc> has been already defined by
3901       \verb+\DeclareKanijFamily+.
3902 %</en>
3903 %<*ja>
3904 \item エンコーディング<ja-enc>におけるファミリ<fam>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
3905 %</ja>
3906 %<*en>
3907 \item A font definition named \texttt{<enc><ja-enc>.fd} (the file name is
3908       all lowercase) exists.
3909 %</en>
3910 %<*ja>
3911 \item フォント定義ファイル\texttt{<enc><ja-enc>.fd}(ファイル名は全て小文字)が存在する.
3912 %</ja>
3913 \end{itemize}
3914 %<*en>
3915 \item Let current encoding scheme for alphabetic fonts be
3916       <al-enc>. For alphabetic font family, the criterion as above is used.
3917 %</en>
3918 %<*ja>
3919 \item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
3920   欧文フォントファミリに対しても,上記の基準が用いられる.
3921 %</ja>
3922 %<*en>
3923 \item There is a case which none of the above applies, that is, the font
3924       family named <family> doesn't seem to be defined neither under the
3925       encoding <ja-enc>, nor under <al-enc>.
3926 In this case, the default family for font substitution is used for
3927       alphabetic and Japanese fonts. Note that current encoding will not
3928       be set to <family>, unlike the original implementation in \LaTeX.
3929 %</en>
3930 %<*ja>
3931 \item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
3932   どちらでも定義されないような場合がある.
3933   この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
3934   和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
3935   現在のエンコーディングは<family>には設定されないことに注意する.
3936 %</ja>
3937 \end{itemize}
3938 }
3939 \end{cslist}
3940
3941 %<*en>
3942 As closing this subsection, we shall introduce an example of
3943 \verb+\SetRelationFont+ and \verb+\userelfont+:
3944 %</en>
3945 %<*ja>
3946 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
3947 紹介しておこう.
3948 %</ja>
3949 \begin{LTXexample}
3950 \gtfamily{}あいうabc
3951 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
3952 \userelfont\selectfont{}あいうabc
3953 \end{LTXexample}
3954
3955
3956 %<en>\subsection{Cropmark/`tombow'}
3957 %<ja>\subsection{トンボ}
3958 % ToDo
3959
3960 %<en>\section{Extensions}
3961 %<ja>\section{拡張}
3962 \subsection{\texttt{luatexja-fontspec.sty}}
3963
3964 %<*en>
3965 As described in Subsection~\ref{ssec-fontspec}, this optional package
3966 provides the counterparts for several commands defined in the
3967 \Pkg{fontspec} package.
3968 In addition to `font features' in the original \Pkg{fontspec},
3969 the following `font features' specifications are allowed for
3970 the commands of Japanese version:
3971 %</en>
3972 %<*ja>
3973 \ref{ssec-fontspec} 節で述べたように,この追加パッケージは\Pkg{fontspec}
3974 パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
3975 オリジナルの\Pkg{fontspec}での`font feature'に加えて,和文版のコマンドには
3976 以下の`font feature'を指定することができる:
3977 %</ja>
3978
3979
3980 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3981 \item[JFM=<name>]
3982 \item[JFM-var=<name>]
3983
3984 %<*en>
3985 These 2 font features correspond to \texttt{jfm} and \texttt{jfmvar} keys for
3986 \verb+\jfont+ primitive, respectively. See Subsection~\ref{ssec-jfont}.
3987 %</en>
3988 %<*ja>
3989 これら2つのキーはそれぞれ \verb+\jfont+ プリミティブに対する
3990 \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
3991 \ref{ssec-jfont} 節を参照.
3992 %</ja>
3993
3994 \item[NoEmbed]
3995 %<*en>
3996 By specifying this font feature, you can use `name-only' Japanese font which
3997 will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
3998 %</en>
3999 %<*ja>
4000 これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
4001 できる.\ref{ssec-psft} 節を参照.
4002 %</ja>
4003
4004 \item[CID=<name>]
4005 %<*en>
4006 This feature is effective only when with NoEmbed feature.
4007 You can use the non-embedded CID-keyed font whose glyphs are addressed according
4008 to the specified character collection defined by Adobe Inc.
4009 The default value is Adobe-Japan1. See also Subsection~\ref{ssec-psft}.
4010 %</en>
4011 %<*ja>
4012 NoEmbed キーと合わせて用いる.
4013 非埋め込みの CID-keyed フォントがどの文字コレクションに基づくものかを指定する.
4014 デフォルトは Adobe-Japan1 である.\ref{ssec-psft} 節も参照.
4015 %</ja>
4016 \end{list}
4017
4018 \subsection{\texttt{luatexja-otf.sty}}
4019
4020 %<*en>
4021 This optional package supports typesetting characters in
4022 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
4023 commands:
4024 %</en>
4025 %<*ja>
4026 この追加パッケージはAdobe-Japan1の文字の出力をサポートする.
4027 \texttt{luatexja-otf.sty}は以下の2つの低レベルコマンドを提供する:
4028 %</ja>
4029 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4030 \item[\char92CID\{<number>\}]
4031 %<*en>
4032 Typeset a character whose CID number is <number>.
4033 %</en>
4034 %<*ja>
4035 CID番号が<number>の文字を出力する.
4036 %</ja>
4037
4038 \item[\char92UTF\{<hex\_number>\}]
4039 %<*en>
4040 Typeset a character whose character code is <hex\_number> (in hexadecimal).
4041 This command is similar to \verb+\char"+<hex\_number>,\ %"
4042 but please remind remarks below.
4043 %</en>
4044 %<*ja>
4045 文字コードが(16進で)<hex\_number>の文字を出力する.
4046 このコマンドは \verb+\char"+<hex\_number>と似ているが,下の記述に注意すること.%"
4047 %</ja>
4048 \end{list}
4049
4050 %<en>\paragraph{Remarks}
4051 %<ja>\paragraph{注意}
4052 %<*en>
4053 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
4054 ordinary characters in the following points:
4055 %</en>
4056 %<*ja>
4057 \verb+\CID+ と \verb+\UTF+ コマンドによって出力される文字は
4058 以下の点で通常の文字と異なる:
4059 %</ja>
4060 \begin{itemize}
4061 %<*en>
4062 \item Always treated as \textbf{JAchar}s.
4063 %</en>
4064 %<*ja>
4065 \item 常に\textbf{JAchar}として扱われる.
4066 %</ja>
4067 %<*en>
4068 \item Processing codes for supporting OpenType features (\textit{e.g.},
4069       glyph replacement and kerning) by the \Pkg{luaotfload} package
4070       is not performed to these characters.
4071 %</en>
4072 %<*ja>
4073 \item OpenType feature(例えばグリフ置換やカーニング)をサポートするための
4074   \Pkg{luaotfload}パッケージのコードはこれらの文字には働かない.
4075 %</ja>
4076 \end{itemize}
4077
4078
4079 %<en>\paragraph{Additional Syntax of JFM}
4080 %<ja>\paragraph{JFMへの記法の追加}
4081
4082 %<*en>
4083 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
4084 chars} table in JFM now allows a string in the form
4085 \verb+'AJ1-xxx'+, which stands for the character
4086 whose CID number in Adobe-Japan1 is \verb+xxx+.
4087 %</en>
4088 %<*ja>
4089 \texttt{luatexja-otf.sty}はJFMの記法を拡張する.
4090 JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形の文字列が
4091 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
4092 %</ja>
4093
4094 %<en>\part{Implementations}
4095 %<ja>\part{実装}
4096 \label{part-imp}
4097 %<en>\section{Storing Parameters}
4098 %<ja>\section{パラメータの保持}
4099 \label{sec-para}
4100 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
4101 %<ja>\subsection{\LuaTeX-jaで用いられる寸法レジスタ,属性レジスタ,whatsitノード}
4102
4103 %<*en>
4104 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
4105 %</en>
4106 %<*ja>
4107 以下は\LuaTeX-jaで用いられる寸法レジスタ(dimension),属性レジスタ(attribute)の
4108 リストである.
4109 %</ja>
4110 \begin{list}{}{%
4111 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
4112 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
4113 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
4114 }
4115
4116 \dim{jQ}
4117 %<*en>
4118 As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to
4119                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
4120                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
4121 %</en>
4122 %<*ja>
4123 \ref{ssec-plain} 節で述べたように,\verb+\jQ+ は$1\,\textrm{Q}=0.25\,\textrm{mm}$
4124 と等しい.ここで,`Q'(もしくは「級」)は日本の写植で用いられる単位である.したがって,
4125 この寸法レジスタの値を変更してはならない.
4126 %</ja>
4127
4128 \dim{jH}
4129 %<*en>
4130 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
4131                         used in Japanese phototypesetting. This
4132                         \verb+\jH+ is a synonym of \verb+\jQ+.
4133 %</en>
4134 %<*ja>
4135 同じく写植で用いられていた単位として「歯」があり,これは$0.25\,\textrm{mm}$と
4136 等しい.\verb+\jH+ は \verb+\jQ+ の別名である.
4137 %</ja>
4138
4139 \dim{ltj@zw}
4140 %<*en>
4141 A temporal register for the `full-width' of current Japanese font.
4142 %</en>
4143 %<*ja>
4144 現在の和文フォントの「全角幅」を保持する一時レジスタ.
4145 %</ja>
4146
4147 \dim{ltj@zh}
4148 %<*en>
4149 A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
4150 %</en>
4151 %<*ja>
4152 現在の和文フォントの「全角高さ」(通常,高さと深さの和)を保持する一時レジスタ.
4153 %</ja>
4154
4155 \attr{jfam}
4156 %<*en>
4157 Current number of Japanese font family for math formulas.
4158 %</en>
4159 %<*ja>
4160 数式用の和文フォントファミリの現在の番号.
4161 %</ja>
4162
4163 \attr{ltj@curjfnt}
4164 %<*en>
4165 The font index of current Japanese font.
4166 %</en>
4167 %<*ja>
4168 現在の和文フォントのフォント番号.
4169 %</ja>
4170
4171 \attr{ltj@charclass}
4172 %<*en>
4173 The character class of Japanese \textit{glyph\_node}.
4174 %</en>
4175 %<*ja>
4176 和文文字の\textit{glyph\_node}の文字クラス.
4177 %</ja>
4178
4179 \attr{ltj@yablshift}
4180 %<*en>
4181 The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4182 %</en>
4183 %<*ja>
4184 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量.
4185 %</ja>
4186
4187 \attr{ltj@ykblshift}
4188 %<*en>
4189 The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4190 %</en>
4191 %<*ja>
4192 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
4193 %</ja>
4194
4195 \attr{ltj@autospc}
4196 %<*en>
4197 Whether the auto insertion of \Param{kanjiskip} is allowed at the node.
4198 %</en>
4199 %<*ja>
4200 そのノードで\Param{kanjiskip}の自動挿入が許されるかどうか.
4201 %</ja>
4202
4203 \attr{ltj@autoxspc}
4204 %<*en>
4205 Whether the auto insertion of \Param{xkanjiskip} is allowed at the node.
4206 %</en>
4207 %<*ja>
4208 そのノードで\Param{xkanjiskip}の自動挿入が許されるかどうか.
4209 %</ja>
4210
4211 \attr{ltj@icflag}
4212 %<*en>
4213 An attribute for distinguishing `kinds' of a node. One of the following value is
4214 assigned to this attribute:
4215 %</en>
4216 %<*ja>
4217 ノードの「種類」を区別するための属性.以下のうちのひとつが値として割り当てられる:
4218 %</ja>
4219 \begin{description}
4220 \item[\textit{italic} (1)]
4221 %<*en>
4222 Glues from an italic correction
4223            (\verb+\/+). This distinction of origins of glues
4224            (from explicit \verb+\kern+, or from \verb+\/+)
4225            is needed in the insertion process of \Param{xkanjiskip}.
4226 %</en>
4227 %<*ja>
4228 イタリック補正(\verb+\/+)によるグルー.このグルーの由来の区別(\verb+\kern+ か
4229 \verb+\/+ か)は\Param{xkanjiskip}の挿入過程において必要になる.
4230 %</ja>
4231
4232 \item[\textit{packed} (2)]
4233
4234 \item[\textit{kinsoku} (3)]
4235 %<*en>
4236 Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}).
4237 %</en>
4238 %<*ja>
4239 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
4240 %</ja>
4241
4242 \item[\textit{from\_jfm} (4)]
4243 %<*en>
4244 Glues/kerns from JFM.
4245 %</en>
4246 %<*ja>
4247 JFM由来のグルー/カーン.
4248 %</ja>
4249
4250 \item[\textit{line\_end} (5)]
4251 %<*en>
4252 Kerns for ...
4253 %</en>
4254 %<*ja>
4255 カーン ...
4256 %</ja>
4257
4258 \item[\textit{kanji\_skip} (6)]
4259 %<*en>
4260 Glues for \Param{kanjiskip}.
4261 %</en>
4262 %<*ja>
4263 \Param{kanjiskip}のグルー.
4264 %</ja>
4265
4266 \item[\textit{xkanji\_skip} (7)]
4267 %<*en>
4268 Glues for \Param{xkanjiskip}.
4269 %</en>
4270 %<*ja>
4271 \Param{xkanjiskip}のグルー.
4272 %</ja>
4273
4274 \item[\textit{processed} (8)]
4275 %<*en>
4276 Nodes which is already processed by ...
4277 %</en>
4278 %<*ja>
4279 ... によって既に処理されたノード.
4280 %</ja>
4281
4282 \item[\textit{ic\_processed} (9)]
4283 %<*en>
4284 Glues from an italic correction, but also already processed.
4285 %</en>
4286 %<*ja>
4287 イタリック補正に由来するグルーであるが,まだ処理されていないもの.
4288 %</ja>
4289
4290 \item[\textit{boxbdd} (15)]
4291 %<*en>
4292 Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
4293 %</en>
4294 %<*ja>
4295 ある水平ボックスか段落の最初か最後に挿入されたグルー/カーン.
4296 %</ja>
4297 \end{description}
4298
4299 \attr{ltj@kcat$i$}
4300 %<*en>
4301 Where $i$~is a natural number which is less than~7.
4302 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
4303 %</en>
4304 %<*ja>
4305 $i$は7より小さい自然数.
4306 これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
4307 扱われるかを示すビットベクトルを格納する.
4308 %</ja>
4309 \end{list}
4310
4311 %<*en>
4312 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
4313 inrernal processing. All those nodes store a natural number (hence the node's
4314 \texttt{type} is 100). The following \verb+user_id+s are used:
4315 %</en>
4316 %<*ja>
4317 さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
4318 これらの全てのノードは自然数を格納している(したがってノードの\texttt{type}は
4319 100である).次の \verb+user_id+ が使用される:
4320 %</ja>
4321 \begin{description}
4322 \item[30111]
4323 %<*en>
4324 Nodes for indicating that \verb+\inhibitglue+ is
4325            specified. The \texttt{value} field of these nodes doesn't matter.
4326 %</en>
4327 %<*ja>
4328 \verb+\inhibitglue+ が指定されたことを示すノード.これらのノードの
4329 \texttt{value}フィールドは意味を持たない.
4330 %</ja>
4331
4332 \item[30112]
4333 %<*en>
4334 Nodes for \LuaTeX-ja's stack system (see the next
4335            subsection). The \texttt{value} field of these nodes is
4336            current group.
4337 %</en>
4338 %<*ja>
4339 \LuaTeX-jaのスタックシステム(次の節を参照)のためのノード.
4340 これらのノードの\texttt{value}フィールドは現在のグループを表す.
4341 %</ja>
4342
4343 \item[30113]
4344 %<*en>
4345 Nodes for Japanese Characters which the callback process of
4346            \Pkg{luaotfload} won't be applied, and the character code is
4347            stored in the \texttt{value} field. Each node having this
4348            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
4349            the callback process of luaotfload.
4350            This \verb+user_id+ is only used by the \Pkg{luatexja-otf} package.
4351 %</en>
4352 %<*ja>
4353 \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
4354 \texttt{value}フィールドにその文字のコードが格納されている.
4355 この \verb+user_id+ を持つノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
4356 \textbf{後で}`glyph\_node'に変換される.この \verb+user_id+ は %
4357 \Pkg{luatexja-otf} パッケージでのみ使用される.
4358 %</ja>
4359
4360 \item[30114]
4361 Nodes for indicating beginning of a paragraph. 
4362 A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
4363 for its label before the actual contents. So \dots
4364 \end{description}
4365 %<*en>
4366 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
4367 %</en>
4368 %<*ja>
4369 これらのwhatsitノードは\textbf{JAglue}の挿入処理の間に取り除かれる.
4370 %</ja>
4371
4372 %<en>\subsection{Stack System of \LuaTeX-ja}
4373 %<ja>\subsection{\LuaTeX-jaのスタックシステム}
4374 \label{ssec-stack}
4375
4376 %<en>\paragraph{Background}
4377 %<ja>\paragraph{背景}
4378 %<*en>
4379 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
4380 are stored in it. To clarify the reason, imagine the parameter
4381 \Param{kanjiskip} is stored by a skip, and consider the following
4382 source:
4383 %</en>
4384 %<*ja>
4385 \LuaTeX-jaは独自のスタックシステムを持ち,\LuaTeX-jaのほとんどのパラメータは
4386 これを用いて保持されている.その理由を明らかにするために,
4387 \Param{kanjiskip}パラメータがスキップレジスタで保持されているとし,
4388 以下のコードを考えてみよう:
4389 %</ja>
4390 \begin{LTXexample}
4391 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
4392 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
4393 \box0.ぴよぴよ\par
4394 \end{LTXexample}
4395
4396 %<*en>
4397 As described in Subsection~\ref{ssec-param}, the only effective value of
4398 \Param{kanjiskip} in an hbox is the latest value, so the value of
4399 \Param{kanjiskip} which applied in the entire hbox should be 5\,pt.
4400 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
4401 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
4402 file in the source of \LuaTeX), there are the following codes:
4403 %</en>
4404 %<*ja>
4405 \ref{ssec-param} 節で述べたように,ある水平ボックスの中で効力を持つ
4406 \Param{kanjiskip}の値は最後に現れた値のみであり,したがってボックス全体に適用される
4407 \Param{kanjiskip}は5\,ptであるべきである.しかし,\LuaTeX の実装のために,
4408 この`5\,pt'はどのコールバックからも知ることはできない.
4409 \texttt{tex/packaging.w}(これは\LuaTeX のソースファイルである)の中に,
4410 以下のコードがある:
4411 %</ja>
4412 \begin{lstlisting}
4413 void package(int c)
4414 {
4415     scaled h;                   /* height of box */
4416     halfword p;                 /* first node in a box */
4417     scaled d;                   /* max depth */
4418     int grp;
4419     grp = cur_group;
4420     d = box_max_depth;
4421     unsave();
4422     save_ptr -= 4;
4423     if (cur_list.mode_field == -hmode) {
4424         cur_box = filtered_hpack(cur_list.head_field,
4425                                  cur_list.tail_field, saved_value(1),
4426                                  saved_level(1), grp, saved_level(2));
4427         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
4428 \end{lstlisting}
4429 %<*en>
4430 Notice that \verb+unsave+ is executed \emph{before}
4431 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
4432 executed): so `5\,pt' in the above source is orphaned at
4433 \verb+unsave+, and hence it can't be accessed from \verb+hpack_filter+
4434 callback.
4435 %</en>
4436 %<*ja>
4437 \verb+unsave+ が \verb+filtered_hpack+(これは \verb+hpack_filter+ コールバックが
4438 実行されるところである)の\textbf{前に}実行されていることに注意する.
4439 したがって,上記ソース中で`5\,pt'は \verb+unsave+ のところで捨てられ,
4440 \verb+hpack_filter+ からはアクセスすることができない.
4441 %</ja>
4442
4443 %<en>\paragraph{The method}
4444 %<ja>\paragraph{解決法}
4445 %<zh>\paragraph{解决方法}
4446
4447 %<*en>
4448 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
4449 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
4450 %</en>
4451 %<*ja>
4452 スタックシステムのコードはDev-luatexメーリングリストのある投稿\footnote{\texttt{[Dev-luatex] tex.currentgrouplevel}: Jonathan Sauerによる2008/8/19の投稿.}を
4453 ベースにしている.
4454 %</ja>
4455
4456 %<*en>
4457 These are two \TeX\ count registers for maintaining information:
4458 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
4459 the \TeX's group level when the last assignment was done.  Parameters
4460 are stored in one big table named \texttt{charprop\_stack\_table}, where
4461 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
4462 a new stack level is created by \verb+\ltjsetparameter+, all data of the
4463 previous level is copied.
4464 %</en>
4465 %<*ja>
4466 情報を保持するために,2つの\TeX の整数レジスタを用いている:
4467 \verb+\ltj@@stack+ でスタックレベル,\verb+\ltj@@group@level+ で最後の代入が
4468 なされた時点での\TeX のグループレベルを保持している.
4469 パラメータは\texttt{charprop\_stack\_table}という名前のひとつの大きなテーブルに
4470 格納される.ここで,\texttt{charprop\_stack\_table[$i$]}はスタックレベル$i$の
4471 データを格納している.もし新しいスタックレベルが \verb+\ltjsetparameter+ によって
4472 生成されたら,前のレベルの全てのデータがコピーされる.
4473 %</ja>
4474
4475 %<*en>
4476 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
4477 another thing: When a new stack level is about to be created, a whatsit
4478 node whose type, subtype and value are 44~(\textit{user\_defined}),
4479 30112, and current group level respectively is appended to the current
4480 list (we refer this node by \textit{stack\_flag}). This enables us to
4481 know whether assignment is done just inside a hbox. Suppose that the
4482 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
4483 group, then:
4484 %</en>
4485 %<*ja>
4486 上の「背景」で述べた問題を解決するために,\LuaTeX-jaではもう一つの手法を導入する:
4487 新しいスタックレベルが生成されようとするとき,type, subtype, valueがそれぞれ
4488 44~(\textit{user\_defined}), 30112,そして現在のグループレベルであるwhatsitノード
4489 を現在のリストに付け加える(このノードを\textit{stack\_flag}とする).
4490 これにより,ある水平ボックスの中で代入がなされたかどうかを知ることが可能
4491 となる.スタックレベルを$s$,その水平ボックスグループの直後の\TeX のグループレベルを
4492 $t$とすると:
4493 %</ja>
4494 \begin{itemize}
4495 %<*en>
4496 \item If there is no \textit{stack\_flag} node in the list of the hbox, then
4497       no assignment was occurred inside the hbox. Hence values of
4498       parameters at the end of the hbox are stored in the stack
4499       level~$s$.
4500 %</en>
4501 %<*ja>
4502 \item もしその水平ボックスのリストの中に\textit{stack\_flag}ノードがなければ,
4503   水平ボックスの中では代入は起こらなかったということになる.
4504   したがって,その水平ボックスの終わりにおけるパラメータの値はスタックレベル$s$に
4505   格納されている.
4506 %</ja>
4507
4508 %<*en>
4509 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
4510       an assignment was occurred just inside the hbox group. Hence
4511       values of parameters at the end of the hbox are stored in the
4512       stack level~$s+1$.
4513 %</en>
4514 %<*ja>
4515 \item もし値が$t+1$の\textit{stack\_flag}ノードがあれば,その
4516   水平ボックスグループの中で代入が起こったことになる.
4517   したがって,水平ボックスの終わりにおけるパラメータの値はスタックレベル$s+1$に
4518   格納されている.
4519 %</ja>
4520
4521 %<*en>
4522 \item If there are \textit{stack\_flag} nodes but all of their values
4523       are more than~$t+1$, then an assignment was occurred in the box,
4524       but it is done is `more internal' group. Hence values of
4525       parameters at the end of the hbox are stored in the stack
4526       level~$s$.
4527 %</en>
4528 %<*ja>
4529 \item もし\textit{stack\_flag}ノードがあるがそれらの値が全て$t+1$より大きい
4530   場合,そのボックスの中で代入が起こったが,それは「より内部の」グループで
4531   起こったということになる.したがって,水平ボックスの終わりでのパラメータの
4532   値はスタックレベル$s$に格納されている.
4533 %</ja>
4534 \end{itemize}
4535
4536 %<*en>
4537 Note that to work this trick correctly, assignments to
4538 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
4539 regardless the value of \verb+\globaldefs+.
4540 This problem is resolved by using
4541 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
4542 %</en>
4543 %<*ja>
4544 このトリックを正しく働かせるためには,\verb+\ltj@@stack+ と \verb+\ltj@@group@level+ への
4545 代入は \verb+\globaldefs+ の値によらず常にローカルでなければならないことに注意する.
4546 この問題は \hbox{\verb+\directlua{tex.globaldefs=0}+}(この代入は常にローカル)を
4547 用いることで解決している.
4548 %</ja>
4549
4550 %<en>\section{Linebreak after Japanese Character}
4551 %<ja>\section{和文文字直後の改行}
4552 %<ja>\section{日文字符后断行}
4553 \label{sec-lbreak}
4554 %<en>\subsection{Reference: Behavior in \pTeX}
4555 %<ja>\subsection{参考:\pTeX の動作}
4556 %<zh>\subsection{参考:\pTeX 行为}
4557 %<*en>
4558 In~\pTeX, a line break after a Japanese character doesn't emit a space,
4559 since words are not separated by spaces in Japanese writings. However,
4560 this feature isn't fully implemented in \LuaTeX-ja due to the
4561 specification of callbacks in~\LuaTeX. To clarify the difference between
4562 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
4563 this subsection.
4564
4565 \pTeX's input processor can be described in terms of a finite state
4566 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
4567 internal states are as follows:
4568 \begin{itemize}
4569 \item State~$N$: new line
4570 \item State~$S$: skipping spaces
4571 \item State~$M$: middle of line
4572 \item State~$K$: after a Japanese character
4573 \end{itemize}
4574 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
4575 processor.  State~$K$ is similar to state~$M$, and is entered after
4576 Japanese characters.  The diagram of state transitions are indicated in
4577 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
4578 after `beginning/ending of a group' characters.
4579 %</en>
4580
4581 %<*ja>
4582 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
4583 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
4584 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
4585
4586 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
4587 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
4588 以下に述べるような4状態を持っている.
4589
4590 \begin{itemize}
4591 \item State~$N$: 行の開始.
4592 \item State~$S$: 空白読み飛ばし.
4593 \item State~$M$: 行中.
4594 \item State~$K$: 行中(和文文字の後).
4595 \end{itemize}
4596 また,状態遷移は,図 \ref{fig-ptexipro} のようになっており,図中の数字は
4597 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
4598 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
4599 じものになる.
4600
4601 この図から分かることは,
4602 \begin{quote}
4603 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
4604 \end{quote}
4605 ということである.
4606 %</ja>
4607
4608 \begin{figure}[!tb]
4609 \begin{gather*}
4610  \def\sp{\texttt{\char32}}
4611  \xymatrix{&&
4612    {\text{scan a cs}}\ar@(r,ul)[dr]&\\
4613 \ar[r]&
4614    *++[o][F-]{N}\ar[ur]^0\ar[dd]_{d,\ g}\ar[u]^{5\ (\texttt{\char92par})}
4615      \ar@{->}@(d,l)[ddrr]_(0.45){j}&&
4616    *++[o][F-]{S}\ar@(l,dr)[ul]^0\ar@(l,ur)[ddll]_{d,\ g}\ar[u]_{5}
4617      \ar@{->}@(r,r)[dd]^{j}\\&\\&
4618    *++[o][F-]{M}\ar[uuur]^0\ar@(r,dl)[uurr]_(0.55){10\ (\sp)}
4619      \ar[d]_{5\ ({\sp})}\ar@{->}@(dr,dl)[rr]_{j}&&
4620    *++[o][F-]{K}\ar@{->}@(ul,d)[uuul]^0\ar@{->}[ll]^{d}
4621      \ar@{->}@(ur,dr)[uu]^{10\ (\sp)}\ar@{->}[d]_5\\
4622    &&&
4623  }\\
4624  d:=\{3,4,6,7,8,11,12,13\},\quad g:=\{1,2\},\quad j:=(\text{Japanese characters})
4625 \end{gather*}
4626 \begin{itemize}
4627 %<*en>
4628 \item Numbers represent category codes.
4629 %</en>
4630 %<*ja>
4631 \item 数字はカテゴリーコードを表わしている.
4632 %</ja>
4633 %<*en>
4634 \item Category codes 9~(ignored), 14~(comment)~and~15~(invalid) are omitted in the above diagram.
4635 %</en>
4636 %<*ja>
4637 \item カテゴリーコード9(無視する文字),14(コメント文字),15(無効文字)は上の図では省かれている.
4638 %</ja>
4639 \end{itemize}
4640 %<en>\caption{State transitions of \pTeX's input processor.}
4641 %<ja>\caption{\pTeX の入力処理部の状態遷移.}
4642 \label{fig-ptexipro}
4643 \end{figure}
4644
4645
4646 %<en>\subsection{Behavior in \LuaTeX-ja}
4647 %<ja>\subsection{\LuaTeX-jaの動作}
4648 %<zh>\subsection{\LuaTeX-ja行为}
4649 %<*en>
4650 States in the input processor of \LuaTeX\ is the same as that of \TeX,
4651 and they can't be customized by any callbacks. Hence, we can only use
4652 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
4653 suppress a space by a line break which is after Japanese characters.
4654
4655 However, \verb+token_filter+ callback cannot be used either, since a
4656 character in category code 5~(end-of-line) is converted into an space
4657 token \emph{in the input processor}.  So we can use only the
4658 \verb+process_input_buffer+ callback.  This means that suppressing a
4659 space must be done \emph{just before} an input line is read.
4660
4661 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
4662 \begin{quote}
4663 A character U+FFFFF (its category code is set to 14~(comment) by
4664 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
4665 process it}, if and only if the following two conditions are satisfied:
4666 \begin{enumerate}
4667 \item The category code of the character $\langle${return}$\rangle$
4668       (whose character code is 13) is 5~(end-of-line).
4669 \item The input line matches the following `regular expression':
4670 \[
4671   (\text{any char})^*(\textbf{JAchar})
4672   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
4673 \]
4674 \end{enumerate}
4675 \end{quote}
4676
4677 \paragraph{Remark}
4678 The following example shows the major difference from the behavior of \pTeX:
4679 \begin{LTXexample}
4680 \ltjsetparameter{autoxspacing=false}
4681 \ltjsetparameter{jacharrange={-6}}xあ
4682 y\ltjsetparameter{jacharrange={+6}}zあ
4683 u
4684 \end{LTXexample}
4685 \begin{itemize}
4686 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
4687 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
4688 \item There is no space between `あ' (in the line~3) and `u', since the
4689       line~3 ends with an \textbf{ALchar}
4690 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
4691 \end{itemize}
4692 %</en>
4693
4694 %<*ja>
4695 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,コールバックによりユーザが
4696 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
4697 きそうなコールバックとしては,\verb+process_input_buffer+や
4698 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
4699 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
4700 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
4701 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
4702 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
4703
4704 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
4705 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
4706 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
4707
4708 \begin{quote}
4709 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
4710 以下の2条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
4711 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
4712 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
4713 \begin{enumerate}
4714 \item 改行文字(文字コード13番)のカテゴリーコードが5~(end-of-line)である.
4715 \item 入力行は次の「正規表現」にマッチしている:
4716 \[
4717   (\text{any char})^*(\textbf{JAchar})
4718   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
4719 \]
4720 \end{enumerate}
4721 \end{quote}
4722
4723 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
4724 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
4725 しかしながら,完全に同じ挙動が実現できたわけではない.
4726 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
4727 \begin{LTXexample}
4728 \ltjsetparameter{autoxspacing=false}
4729 \ltjsetparameter{jacharrange={-6}}xあ
4730 y\ltjsetparameter{jacharrange={+6}}zあ
4731 u
4732 \end{LTXexample}
4733 もし\pTeX とまったく同じ挙動を示すならば,出力は
4734 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
4735 上のように異なる挙動となっている.
4736 \begin{itemize}
4737 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
4738       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
4739 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
4740       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
4741 \end{itemize}
4742 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
4743 その行はそこで改行するようにした方がいいだろう.
4744 %</ja>
4745
4746
4747 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
4748 %<ja>\section{JFMグルーの挿入,\Param{kanjiskip}と\Param{xkanjiskip}}
4749 %<ja>\section{JFM的胶插入,\Param{kanjiskip}和\Param{xkanjiskip}}
4750 \label{sec-jfmglue}
4751 %<en>\subsection{Overview}
4752 %<ja>\subsection{概要}
4753 %<zh>\subsection{概要}
4754
4755 \LuaTeX-jaにおける和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.
4756 \pTeX では次のような仕様であった:
4757 \begin{itemize}
4758 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
4759 追加する過程で行われる.
4760 \item \Param{xkanjiskip}の挿入は,水平ボックスへのパッケージングや行分割前に行われる.
4761 \item \Param{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に
4762 「和文文字を表す2つの<char\_node>の間には\Param{kanjiskip}がある」ものとみなされる.
4763 \end{itemize}
4764 しかし,\LuaTeX-jaでは,水平ボックスへのパッケージングや行分割前に全ての
4765 \textbf{JAglue},即ちJFMグルー・\Param{xkanjiskip}・\Param{kanjiskip}の
4766 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
4767 カーニング処理がノードベースになったことに対応する変更である.
4768
4769 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
4770 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
4771 るノード達(アクセント位置補正用のカーンや,イタリック補正)をまとめたもの
4772 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
4773 には関係しないものがある.
4774
4775
4776 %<en>\subsection{definition of a `cluster'}
4777 %<ja>\subsection{「クラスタ」の定義}
4778 %<zh>\subsection{“cluster”定义}
4779
4780 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
4781 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
4782 \begin{defn}
4783 %<*en>
4784 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
4785 with the \textit{id} of it:
4786 %</en>
4787 %<*ja>
4788 \textbf{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである:
4789 %</ja>
4790 \begin{enumerate}
4791 %<*en>
4792 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
4793       nodes come from a hbox which is already packaged, by unpackaging
4794       (\verb+\unhbox+).
4795       The \textit{id} is \textit{id\_pbox}.
4796 %</en>
4797 %<*ja>
4798 \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト.
4799   これらのノードはある既にパッケージングされた水平ボックスから \verb+\unhbox+ で
4800   アンパックされたものである.
4801   その\textit{id}は\textit{id\_pbox}である.
4802 %</ja>
4803
4804 %<*en>
4805 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
4806       The \textit{id} is \textit{id\_math}.
4807 %</en>
4808 %<*ja>
4809 \item インライン数式でその境界に2つの\textit{math\_node}を含むもの.
4810   その\textit{id}は\textit{id\_math}である.
4811 %</ja>
4812
4813 %<*en>
4814 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
4815 %</en>
4816 %<*ja>
4817 \item \textit{glpyh\_node}~$p$とそれに関係するノード:
4818 %</ja>
4819 \begin{enumerate}
4820 %<*en>
4821 \item A kern for the italic correction of~$p$.
4822 %</en>
4823 %<*ja>
4824 \item $p$のイタリック補正のためのカーン.
4825 %</ja>
4826
4827 %<*en>
4828 \item An accent attached to $p$ by \verb+\accent+.
4829 %</en>
4830 %<*ja>
4831 \item \verb+\accent+ による$p$に付随したアクセント.
4832 %</ja>
4833 \end{enumerate}
4834 \[
4835 \overbrace{%
4836  \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
4837 \left\{\begin{array}{c}
4838 \Node{glyph}{accent}\\\noalign{\medskip}
4839 \Node{hbox}{accent (shifted vert.)}
4840 \end{array}\right\}\longrightarrow
4841 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
4842 \longrightarrow
4843 \Node{glyph}{$p$}\longrightarrow
4844 \overbrace{%
4845 \Node{kern}{italic corr.}}^{\text{(b)}}
4846 \]
4847
4848 %<*en>
4849 The \textit{id} is \textit{id\_jglyph} or
4850 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
4851 represents a Japanese character or not.
4852 %</en>
4853 %<*ja>
4854 \textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって
4855 \textit{id\_jglyph},もしくは\textit{id\_glyph}となる.
4856 %</ja>
4857
4858 %<*en>
4859 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
4860 The \textit{id} is \textit{id\_hlist} if the node is an
4861       hbox which is not shifted vertically, or \textit{id\_box\_like}
4862       otherwise.
4863 %</en>
4864 %<*ja>
4865 \item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\verb+\vrule+),
4866   そして\textit{unset\_node}.
4867   その\textit{id}は垂直に移動していない水平ボックスならば\textit{id\_hlist},
4868   そうでなければ\textit{id\_box\_like}となる.
4869 %</ja>
4870
4871 %<*en>
4872 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
4873 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
4874       and \textit{id\_disc}, respectively.
4875 %</en>
4876 %<*ja>
4877 \item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行.
4878   その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして
4879   \textit{id\_disc}である.
4880 %</ja>
4881 \end{enumerate}
4882 %<*en>
4883 Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster.
4884 %</en>
4885 %<*ja>
4886 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す.
4887 %</ja>
4888 \end{defn}
4889
4890 \paragraph{\textit{id}の意味}
4891 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
4892 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
4893 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
4894 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
4895 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
4896 説明用に準備した概念であって,実際のLuaコード中にそのように書かれているわけではないことに注意.
4897
4898 \begin{description}
4899 \item[\textit{id\_jglyph}] 和文文字.\\
4900 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
4901 \textit{glyph\_node}そのものである.
4902 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
4903 多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた
4904 \textit{glyph\_node}である可能性もある.
4905 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
4906 一方,後者の場合,
4907 \begin{itemize}
4908 \item $\mathit{Np}.\mathit{head}$は,
4909 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
4910 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
4911 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
4912 \end{itemize}
4913 \item[\textit{id\_math}] インライン数式.\\
4914 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
4915 「文字コード$-1$の欧文文字」とおく.
4916 \item[\textit{id\_hlist}] 縦方向にシフトされていない水平ボックス.\\
4917 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
4918 先頭・末尾のノードである.
4919 \begin{itemize}
4920 \item 状況によっては,\TeX ソースで言うと
4921 \begin{verbatim}
4922 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
4923 \end{verbatim}
4924 のように,$p$の内容が別の水平ボックスで開始・終了している可能性も十分あり得る.そのような場合,
4925 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない}水平ボックスの
4926 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
4927 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた水平ボックス,\verb+\lower1pt\hbox{xyz}+に対応するノードである.
4928 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用のカーンが
4929 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
4930 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
4931 と同様に再帰的に構成要素をたどっていく.
4932 \end{itemize}
4933 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
4934 まとめて1つのクラスタとして取り扱うだけである.
4935 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
4936 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
4937 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
4938 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
4939 全く考慮に入れない.
4940 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
4941 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
4942 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
4943 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
4944 \end{description}
4945
4946 \paragraph{クラスタの別の分類}
4947 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
4948 挿入処理では2つの隣り合ったクラスタの間に
4949 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
4950 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
4951 \begin{description}
4952 \item[和文A] リスト中に直接出現している和文文字.
4953 \textit{id}が\textit{id\_jglyph}であるか,\\
4954 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
4955
4956 \item[和文B] リスト中の水平ボックスの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
4957 JFMグルーの挿入が行われない(\Param{xkanjiskip},~\Param{kanjiskip}は入り得る)ことである.\\
4958 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
4959
4960 \item[欧文] リスト中に直接/水平ボックスの中身として出現している欧文文字.次の3つの場合が該当:
4961 \begin{itemize}
4962 \item \textit{id}が\textit{id\_glyph}である.
4963 \item \textit{id}が\textit{id\_math}である.
4964 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
4965 \end{itemize}
4966 \item[箱] box,またはそれに類似するもの.次の2つが該当:
4967 \begin{itemize}
4968 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
4969 \item \textit{id}が\textit{id\_box\_like}である.
4970 \end{itemize}
4971
4972 \end{description}
4973
4974 \subsection{段落/水平ボックスの先頭や末尾}
4975 \paragraph{先頭部の処理}
4976 まず,段落/水平ボックスの一番最初にあるクラスタ\textit{Np}を探索する.
4977 水平ボックスの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
4978 \begin{center}
4979 \verb+\parindent+由来の水平ボックス ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない
4980 ようなwhatsit.
4981 \end{center}
4982 これは,\verb+\parindent+由来の水平ボックスがクラスタを構成しないようにするためである.
4983
4984 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
4985 \begin{enumerate}
4986 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
4987 \item 問題のリストが字下げありの段落(\verb+\parindent+由来の水平ボックスあり)の場合は,
4988 この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
4989 \item そうでないとき(\verb+noindent+で開始された段落や水平ボックス)は,
4990 $g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
4991 \end{enumerate}
4992 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
4993 そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する:
4994 \begin{itemize}
4995 \item 問題にしているリストが段落であり,かつ
4996 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
4997 \end{itemize}
4998
4999 \paragraph{末尾の処理}
5000 末尾の処理は,問題のリストが段落のものか水平ボックスのものかによって異なる.
5001 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るグルー/カーンを,
5002 \textit{Nq}の直後に挿入するのみである.
5003
5004 一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と,
5005 \verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は
5006 この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
5007 \begin{enumerate}
5008 \item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する.
5009 \item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
5010 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
5011
5012 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような
5013 最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}
5014 を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
5015 \end{enumerate}
5016
5017 \subsection{概観と典型例:2つの「和文A」の場合}
5018 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
5019 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
5020 \[
5021  \Node{cluster}{\textit{Nq}}\longrightarrow
5022 \overbrace{
5023 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5024 \longrightarrow \Node{cluster}{\textit{Np}}
5025 \]
5026 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
5027 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
5028 \[
5029  \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow
5030 \overbrace{
5031 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5032 \longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}}
5033 \]
5034
5035 以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
5036 この場合が全ての場合の基本となる.
5037
5038 \paragraph{「右空白」の算出}
5039 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
5040 \begin{description}
5041 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
5042       デフォルト値\Param{kanjiskip}を採用することとなるので,次へ.
5043 \begin{enumerate}
5044 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),
5045       代わりに\Param{kanjiskip}が挿入されることとなる.次へ.
5046 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
5047       共通に使っているJFM内で挿入される空白(グルーかカーン)が決まっているか調べる.
5048 \item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである.
5049 この場合,まず
5050 \[
5051 \vcenter{\halign{\hfil$#:={}$&(\inhibitglue#\inhibitglue)\cr
5052 gb&\textit{Nq}と「文字コードが{\tt'diffmet'}の文字」との間に入るグルー/カーン\cr
5053 ga&「文字コードが{\tt'diffmet'}の文字」と\textit{Np}との間に入るグルー/カーン\cr
5054 }}
5055 \]
5056 として,左側由来・右側由来の空白(グルー/カーン)を(それぞれのJFMから)求める.
5057 $\mathit{ga}$と$\mathit{gb}$のどちらか片方が未定義であるならば,定義されている側の値をそのまま採用する.
5058 もし$\mathit{ga}$と$\mathit{gb}$が両方決まっているならば,両者の値を平均\footnote{\Param{differentjfm}パラメタの
5059 値によって,「大きい方」「小さい方」「合計」に変えることができる.}した値を採用する.
5060 \end{enumerate}
5061
5062 例えば,
5063 \begin{verbatim}
5064 \jfont\foo=psft:Ryumin-Light:jfm=ujis
5065 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
5066 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
5067 \end{verbatim}
5068 という3フォントを考え,
5069 \[
5070  \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p}
5071 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q}
5072 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r}
5073 \]
5074 という3ノードを考える(それぞれ単独でクラスタをなす).
5075 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で,
5076 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる.
5077 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
5078 \Param{kanjiskip}の値を以下で定め,それを「右空白」として採用する.
5079 この段階においては,\verb+\inhibitglue+は効力を持たないため,
5080 結果として,2つの和文文字間には常に何らかのグルー/カーンが挿入されることとなる.
5081 \begin{enumerate}
5082 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
5083 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
5084 \item ユーザ側から見た\Param{kanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5085 なければ,\Param{kanjiskip}パラメタの値を持つglueを採用する.
5086 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{kanjiskip}の値を用いる.
5087 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
5088 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
5089 \end{enumerate}
5090 \end{description}
5091 \paragraph{「左空白」の算出とそれに伴う補正}
5092 次に,「左空白」にあたる量を算出する:
5093 \begin{description}
5094 \item[line-end~{[E]}]
5095 \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
5096 \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
5097 \begin{enumerate}
5098 \item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
5099 \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
5100 \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
5101 \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
5102 \end{enumerate}
5103 \end{description}
5104 \paragraph{禁則用ペナルティの挿入}
5105 まず,
5106 \[
5107  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値})
5108 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値})
5109 \]
5110 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
5111 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
5112 算出では単純な整数の加減算を行う.
5113
5114 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
5115 \begin{description}
5116 \item[P-normal~{[PN]}]
5117 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
5118 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
5119 また,$10000 + (-10000) = 0$としている.
5120
5121 少々困るのは,(a)部分にペナルティが存在していない場合である.
5122 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
5123 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
5124 ということになるが,実際には僅かにこれより複雑である.
5125 \begin{itemize}
5126 \item 「右空白」がカーンであるとき,
5127 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
5128 この場合は$a\neq 0$であってもペナルティの挿入はしない.
5129 \item 「左空白」がカーンとしてきっちり定義されている時(このとき,「右空白」はカーンでない),
5130 この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
5131 \textit{penalty\_node}を作って挿入する.
5132 \item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
5133 \end{itemize}
5134 \end{description}
5135
5136 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
5137   \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$}
5138 \begin{table}[t]
5139 %<en>\caption{Summary of JFM glues.}
5140 %<ja>\caption{JFM グルーの概要.}
5141 %<zh>\caption{JFM胶总结。}
5142 \label{tab-jfmglue}
5143 \begin{center}
5144 \small
5145 \begin{tabular}{>{\sf}c|cccccc}
5146 \toprule
5147 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
5148 和文A&
5149 \gkf{E}{M→K}{PN}&
5150 \gkf{---}{\OA →K}{PN}&
5151 \gkf{---}{\OA →X}{PN}&
5152 \gkf{---}{\OA}{PA}&
5153 \gkf{---}{\OA}{PN}&
5154 \gkf{---}{\OA}{PS}\\
5155 和文B&
5156 \gkf{E}{\OB→K}{PA}&
5157 \gkf{---}{K}{PS}&
5158 \gkf{---}{X}{PS}\\
5159 欧文&
5160 \gkf{E}{\OB →X}{PA}&
5161 \gkf{---}{X}{PS}\cr
5162 箱&\gkf{E}{\OB}{PA}\\
5163 glue&\gkf{E}{\OB}{PN}\\
5164 kern&\gkf{E}{\OB}{PS}\\
5165 \bottomrule
5166 \end{tabular}
5167 \end{center}
5168 \begin{quote}
5169 %<*en>
5170 Here {\small\gkf{E}{M→K}{PN}} means that
5171 %</en>
5172 %<*ja>
5173 ここで {\small\gkf{E}{M→K}{PN}} は次の意味である:
5174 %</ja>
5175 \begin{enumerate}
5176 %<*en>
5177 \item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'.
5178 If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'.
5179 %</en>
5180 %<*ja>
5181 \item 「右空白」を決めるために,\LuaTeX-ja はまず「JFM由来{[M]}」の方法を試みる.
5182   これが失敗したら,\LuaTeX-ja は「\Param{kanjiskip}~{[K]}」の方法を試みる.
5183 %</ja>
5184
5185 %<*en>
5186 \item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'.
5187 %</en>
5188 %<*ja>
5189 \item \textit{Nq} と \textit{Np} の間の「左空白」は「\textsf{line-end~[E]}」の
5190   方法で決定される.
5191 %</ja>
5192
5193 %<*en>
5194 \item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}.
5195 %</en>
5196 %<*ja>
5197 \item \LuaTeX-jaは2つのクラスタの間の禁則処理用のペナルティを調節するために「\textsf{P-normal~[PN]}」の方法を採用する.
5198 %</ja>
5199 \end{enumerate}
5200 \end{quote}
5201 \end{table}
5202
5203 \subsection{その他の場合}
5204 本節の内容は表 \ref{tab-jfmglue} にまとめてある.
5205
5206 \paragraph{和文Aと欧文の間}
5207 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
5208 \begin{itemize}
5209 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5210 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
5211 \item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ.
5212 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
5213 \end{itemize}
5214 \begin{description}
5215 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
5216 未定義でなければそれを「右空白」として採用する.
5217 \textsf{JFM-origin~[M]}の変種と考えて良い.
5218 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
5219 \begin{enumerate}
5220 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
5221 \item そうでなければ,
5222 \textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るグルー/カーンとして定まる.
5223 \end{enumerate}
5224 \item[\Param{xkanjiskip}~{[X]}]
5225 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
5226 \Param{xkanjiskip}の値を以下で定め,それを「右空白」として採用する.
5227 この段階で\verb+\inhibitglue+は効力を持たないのも同じである.
5228 \begin{enumerate}
5229 \item 以下のいずれかの場合は,\Param{xkanjiskip}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
5230 \begin{itemize}
5231 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
5232 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{xkanjiskip}の挿入」が禁止されている
5233 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
5234 \item \textit{Np}の中身の文字コードについて,「直前への\Param{xkanjiskip}の挿入」が禁止されている
5235 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
5236 \end{itemize}
5237 \item ユーザ側から見た\Param{xkanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5238 なければ,\Param{xkanjiskip}パラメタの値を持つglueを採用する.
5239 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
5240 で使われているJFMに指定されている\Param{xkanjiskip}の値を用いる.
5241 \end{enumerate}
5242 \end{description}
5243
5244 \paragraph{欧文と和文Aの間}
5245 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
5246 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
5247 \begin{itemize}
5248 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
5249 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
5250 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
5251 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
5252 \end{itemize}
5253 \begin{description}
5254 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
5255 未定義でなければそれを「右空白」として採用する.
5256 \textsf{JFM-origin~[M]}の変種と考えて良い.
5257 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
5258 \begin{enumerate}
5259 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
5260 \item そうでなければ,
5261 「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るグルー/カーンとして定まる.
5262 \end{enumerate}
5263 \end{description}
5264
5265 \paragraph{和文Aと箱・グルー・カーンの間}
5266 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・グルー・カーンのいずれかであった場合,
5267 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
5268 ペナルティの挿入処理は若干異なったものとなっている.
5269
5270 \begin{itemize}
5271 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5272 それが失敗した場合は,「右空白」は挿入されない.
5273 \item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
5274 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
5275 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
5276 「$\mathit{Np}.\mathit{head}$に対する\Param{prebreakpenalty}の値」は0とみなされる.言い換えれば,
5277 \[
5278  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値}).
5279 \]
5280 \begin{description}
5281 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
5282 (明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため,
5283 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
5284 \item[グルー] \textit{Np}がグルーの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
5285 \item[カーン] \textit{Np}がカーンであった場合は,両クラスタの間での行分割は
5286 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
5287 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
5288 \end{description}
5289 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
5290 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
5291 \end{itemize}
5292
5293 \begin{description}
5294 \item[P-allow~{[PA]}]
5295 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
5296 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
5297
5298 (a)部分にペナルティが存在していない場合,
5299 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
5300 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
5301 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
5302 \begin{itemize}
5303 \item 「右空白」がグルーでない(カーンか未定義)であるとき.
5304 \item 「左空白」がカーンとしてきっちり定義されている時.
5305 \end{itemize}
5306
5307 \item[P-suppress~{[PS]}]
5308 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
5309 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
5310
5311 (a)部分にペナルティが存在していない場合,
5312 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
5313 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
5314 そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する.
5315 \end{description}
5316
5317 なお,「右空白」はカーン,「左空白」は未定義の
5318 \[
5319  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5320 \]
5321 のような状況を考える.
5322 このとき,$a$,即ち「あ」の\Param{postbreakpenalty}がいかなる値であっても,
5323 この2クラスタ間は最終的に
5324 \begin{equation}
5325  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
5326 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5327 \label{eq-gref}
5328 \end{equation}
5329 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
5330 \Param{postbreakpenalty}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
5331 \eqref{eq-gref}と
5332 \[
5333  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
5334 \Node{penalty}{$a$}\longrightarrow
5335 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5336 \]
5337 との間に差異は生じない%
5338 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
5339 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
5340
5341 \paragraph{箱・グルー・カーンと和文Aの間}
5342 \textit{Np}が\textsf{箱}・グルー・カーンのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
5343 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意.
5344 \begin{itemize}
5345 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
5346 それが失敗した場合は,「右空白」は挿入されない.
5347 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
5348 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
5349 $\mathit{Nq}.\mathit{tail}$は無意味なので,
5350 \[
5351  a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値}).
5352 \]
5353 \begin{description}
5354 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
5355 \item[グルー] \textit{Nq}がグルーの場合は,\textsf{P-normal~[PN]}を用いる.
5356 \item[カーン] \textit{Nq}がカーンの場合は,\textsf{P-suppress~[PS]}を用いる.
5357 \end{description}
5358 \end{itemize}
5359
5360 \paragraph{和文Aと和文Bの違い}
5361 先に述べたように,\textsf{和文B}は水平ボックスの中身の先頭(or 末尾)として出現している
5362 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
5363 \begin{itemize}
5364 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
5365 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
5366 「左空白」の算出も行われない.例えば,
5367 \begin{itemize}
5368 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
5369 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
5370 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
5371 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
5372 \end{itemize}
5373 \item \textsf{和文B}と箱・グルー・カーンが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
5374 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
5375 \textsf{P-suppress~[PS]}が用いられる.
5376 \item \textsf{和文B}の文字に対する\Param{prebreakpenalty},~\Param{postbreakpenalty}の値は使われず,0として計算される.
5377 \end{itemize}
5378
5379
5380 次が具体例である:
5381 \begin{LTXexample}
5382 あ.\inhibitglue A\\
5383 \hbox{あ.}A\\
5384 あ.A
5385 \end{LTXexample}
5386 \begin{itemize}
5387 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
5388 \Param{xkanjiskip}(四分アキ)が入ることに注意.
5389 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(水平ボックスの中身の末尾として登場しているから)ので,
5390 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{xkanjiskip}が入ることとなる.
5391 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
5392 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
5393 \end{itemize}
5394
5395 \section{psft}
5396
5397 \begin{thebibliography}{99}
5398   \addcontentsline{toc}{section}{\refname}
5399 \bibitem{texbytopic}
5400 Victor Eijkhout,  \emph{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
5401 \end{thebibliography}
5402 \end{document}