OSDN Git Service

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