OSDN Git Service

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