OSDN Git Service

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