OSDN Git Service

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