OSDN Git Service

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