OSDN Git Service

Bugfix: \verb under fontspec.
[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 %%%%%%%%
9 \makeatletter
10 %%%%%%%%
11
12 %%%%%%%% record loaded packages
13 \let\ltjpkglist\empty
14 \newif\if@real@append@list
15 \def\@append@newentry#1#2{{%
16   \@real@append@listtrue \def\@tempa{#2}%
17   \let\@pkglist\@append@newentry@pkglist#1%
18   \if@real@append@list
19     \let\@pkglist=\relax\xdef#1{#1\@pkglist{#2}}%
20   \fi}}
21 \def\@append@newentry@pkglist#1{%
22   \def\@tempb{#1}%
23   \ifx\@tempa\@tempb\@real@append@listfalse\fi}
24 \def\@addtofilelist#1{\@append@newentry\ltjpkglist{#1}}
25 \let\@listfiles\empty
26
27 %<*en>
28 \usepackage[margin=25mm,footskip=6mm]{geometry}
29 \usepackage{luatexja-adjust}\ltjdisableadjust
30 \parskip=\smallskipamount
31 %</en>
32 %<*ja>
33 \usepackage[textwidth=45\zw, lines=45, footskip=6mm]{geometry}
34 \usepackage{luatexja-adjust}%\ltjdisableadjust
35 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
36 %</ja>
37 %<*zh>
38 \usepackage[textwidth=45\zw, lines=45, footskip=6mm]{geometry}
39 \usepackage{luatexja-adjust}\ltjdisableadjust
40 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
41 \def\postpartname{编}
42 \DeclareYokoKanjiEncoding{ZH}{}{}
43 \DeclareKanjiEncodingDefaults{}{}
44 \DeclareErrorKanjiFont{ZH}{song}{m}{n}{10}
45 \DeclareKanjiSubstitution{ZH}{song}{m}{n}
46 \newcommand\songdefault{song}
47 \newcommand\heidefault{hei}
48 \newcommand\minchodefault{mincho}
49 \renewcommand\kanjiencodingdefault{ZH}
50 \renewcommand\kanjifamilydefault{\songdefault}
51 \renewcommand\kanjiseriesdefault{\mddefault}
52 \renewcommand\kanjishapedefault{\updefault}
53 \DeclareKanjiFamily{ZH}{song}{}
54 \DeclareFontShape{ZH}{song}{m}{n}{<->name:AdobeSongStd-Light:jfm=jis}{}
55 \DeclareFontShape{ZH}{song}{m}{it}{<->ssub*song/m/n}{}
56 \DeclareFontShape{ZH}{song}{bx}{n}{<->ssub*hei/m/n}{}
57 \DeclareKanjiFamily{ZH}{hei}{}
58 \DeclareFontShape{ZH}{hei}{m}{n}{<->name:SimHei:jfm=jis}{}
59 \DeclareFontShape{ZH}{hei}{bx}{n}{<->ssub*hei/m/n}{}
60 \DeclareKanjiFamily{ZH}{mincho}{}
61 \DeclareFontShape{ZH}{mincho}{m}{n}{<->name:KozMinPr6N-Regular:cid=Adobe-Japan1-6;jfm=jis}{}
62 \fontencoding{ZH}\selectfont
63 \DeclareTextFontCommand{\textsong}{\songfamily}
64 \DeclareTextFontCommand{\texthei}{\heifamily}
65 \DeclareTextFontCommand{\textmincho}{\minchofamily}
66 \DeclareOldFontCommand{\song}{\normalfont\songfamily}{}
67 \DeclareOldFontCommand{\hei}{\normalfont\heifamily}{}
68 \DeclareOldFontCommand{\mincho}{\normalfont\minchofamily}{}
69 \DeclareSymbolFont{songti}{ZH}{song}{m}{n}
70 \jfam\symsongti
71 \SetSymbolFont{songti}{bold}{ZH}{hei}{m}{n}
72 \DeclareSymbolFontAlphabet{\mathsong}{songti}
73 \DeclareMathAlphabet{\mathhei}{ZH}{hei}{m}{n}
74 \DeclareRobustCommand\songfamily{\not@math@alphabet\songfamily\mathsong\kanjifamily\songdefault\selectfont}
75 \DeclareRobustCommand\heifamily{\not@math@alphabet\heifamily\mathhei\kanjifamily\heidefault\selectfont}
76 \DeclareRobustCommand\minchofamily{\not@math@alphabet\minchofamily\mathhei\kanjifamily\minchodefault\selectfont}
77 \DeclareRobustCommand\rmfamily{\not@math@alphabet\rmfamily\mathrm\romanfamily\rmdefault\kanjifamily\songdefault\selectfont}
78 \DeclareRobustCommand\sffamily{\not@math@alphabet\sffamily\mathsf\romanfamily\sfdefault\kanjifamily\heidefault\selectfont}
79 %</zh>
80
81 \usepackage{amsmath,tikz,pict2e,multienum,float}
82 \usepackage{booktabs,multicol}
83
84 %%%%%%%% listings
85 \usepackage{listings,showexpl}
86 \lstset{
87   basicstyle=\ttfamily\small, pos=r, breaklines=true,
88   numbers=none, rframe={}, basewidth=0.5em, numberstyle=\tiny, numbersep=0.5em,
89   explpreset={numberstyle=\tiny, numbers=left, numbersep=1em}
90 }
91 % Suppress output from showexpl to stdout.
92 \let\SX@Info\relax
93
94 %%%%%%%% hyperref
95 \usepackage{hyperref}
96 %<*en>
97 \title{The \LuaTeX-ja package}
98 \author{The \LuaTeX-ja project team}
99 %</en>
100 %<*ja>
101 \title{\LuaTeX-jaパッケージ}
102 \author{\LuaTeX-jaプロジェクトチーム}
103 %</ja>
104 %<*zh>
105 \title{\LuaTeX-ja宏包}
106 \author{\LuaTeX-ja项目团队}
107 %</zh>
108 \hypersetup{%
109         unicode,
110         colorlinks,
111         allbordercolors=1 1 1,
112         allcolors=blue,
113 %<*en>
114         pdfauthor={The LuaTeX-ja project team},
115         pdftitle={The LuaTeX-ja package}
116 %</en>
117 %<*ja>
118         pdfauthor={LuaTeX-jaプロジェクトチーム},
119         pdftitle={LuaTeX-jaパッケージ}
120 %</ja>
121 %<*zh>
122         pdfauthor={LuaTeX-ja项目团队},
123         pdftitle={LuaTeX-ja宏包}
124 %</zh>
125 }
126
127 %%%%%%%% definition env.
128 \usepackage{amsthm}
129 \theoremstyle{definition}
130 %<en>\newtheorem{defn}{Definition}
131 %<ja>\newtheorem{defn}{定義}
132 %<zh>\newtheorem{defn}{定义}
133
134 %%%%%%%% fonts
135 \usepackage{luatexja-otf}
136 \usepackage[jis2004]{luatexja-preset}
137 %<!en>\usepackage{amssymb}
138 %<*en>
139 \usepackage{unicode-math}
140 \setmainfont[Ligatures=TeX]{TeX Gyre Termes}
141 \setsansfont[Ligatures=TeX]{TeX Gyre Heros}
142 \setmathfont{xits-math.otf}
143 \frenchspacing
144 %</en>
145
146 %%%%%%%% logo
147 \usepackage{metalogo}
148 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
149 \DeclareRobustCommand\LuaTeX{Lua\TeX}
150 \DeclareRobustCommand\pdfTeX{pdf\TeX}
151 \DeclareRobustCommand\pTeX{p\kern-.15em\TeX}
152 \DeclareRobustCommand\upTeX{up\kern-.15em\TeX}
153 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
154 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
155 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
156
157 %%%%%%%% other macros
158 \newenvironment{cslist}{%
159   \leftskip2em\parindent=0pt\def\makelabel##1{{\tt\char92##1}}
160   \def\{{\char`\{}\def\}{\char`\}}
161   \let\origitem=\item
162   \def\item[##1]{\par\smallskip\par\hskip-\leftskip\makelabel{##1}\par}
163 }{}
164
165 \def\labelenumii{(\arabic{enumii})}
166 \long\def\@makecaption#1#2{%
167   \vskip\abovecaptionskip
168   \sbox\@tempboxa{{\small #1. #2}}%
169   \ifdim \wd\@tempboxa >\hsize
170     {\small #1. #2}\par
171   \else
172     \global \@minipagefalse
173     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
174   \fi
175   \vskip\belowcaptionskip}
176
177 %%%%%%%%
178 \makeatother
179 %%%%%%%%
180
181 \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr
182   #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}}
183
184 \protected\def\Param#1{\textsf{#1}} % parameter name
185 \protected\def\Pkg#1{\underline{\smash{\texttt{#1}}}} % packages/classes
186
187
188 \begin{document}
189 \catcode`\<=13
190 \def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
191 \maketitle
192
193 \tableofcontents
194 \bigskip
195
196 %<*en>
197 \textbf{This documentation is far from complete. It may have many
198 grammatical (and contextual) errors.} Also, several parts
199 (especially, Section~\ref{sec-jfmglue}) are written in Japanese only.
200 %</en>
201 %<*ja>
202 \textbf{\large 本ドキュメントはまだまだ未完成です.}
203 %</ja>
204 %<*zh>
205 \textbf{\large 本文档尚未完成。}
206 %</zh>
207
208 \clearpage
209 %<en>\part{User's manual}
210 %<ja>\part{ユーザーズマニュアル}
211 %<zh>\part{用户手册}
212
213 %<en>\section{Introduction}
214 %<ja>\section{はじめに}
215 %<zh>\section{引言}
216
217
218 %<*en>
219 The \LuaTeX-ja package is a macro package for typesetting high-quality
220 Japanese documents when using \LuaTeX.
221 %</en>
222 %<*ja>
223 \LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
224 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
225 %</ja>
226 %<*zh>
227 \LuaTeX-ja宏包是应用于下一代标准\TeX 引擎亦即\LuaTeX 引擎上的高质量日语文档排版宏包。
228 %</zh>
229
230 %<en>\subsection{Backgrounds}
231 %<ja>\subsection{背景}
232 %<zh>\section{背景}
233
234
235 %<*en>
236 Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
237 are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
238 extension of \TeX: so it can produce high-quality Japanese documents
239 without using very complicated macros. But this point is a mixed
240 blessing: \pTeX\ is left behind from other extensions of \TeX,
241 especially \eTeX\ and \pdfTeX, and from changes about
242 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
243 %</en>
244 %<*ja>
245 従来,「\TeX を用いて日本語組版を行う」といったとき,エンジンとしては
246 ASCII \pTeX やそれの拡張物が用いられることが一般的であった.\pTeX は\TeX
247 のエンジン拡張であり,(少々仕様上不便な点はあるものの)商業印刷の分野に
248 も用いられるほどの高品質な日本語組版を可能としている.だが,それは弱点に
249 もなってしまった:\pTeX という(組版的に)満足なものがあったため,海外で
250 行われている数々の\TeX の拡張――例えば\eTeX や\pdfTeX ――や,TrueType,
251 OpenType, Unicodeといった計算機で日本語を扱う際の状況の変化に追従すること
252 を怠ってしまったのだ.
253 %</ja>
254 %<*zh>
255 一般情况下,\TeX 下的日语文档输出,是ASCII \pTeX(\TeX 的一个扩展)及其衍生
256 软件来完成的。\pTeX 作为\TeX 的一个扩展引擎,在生成高质量的日语文档时,规避
257 了繁杂的宏编写。但是在和同时期的引擎相比之下,\pTeX 的处境未免有些尴尬:\pTeX
258 已经远远落后于\eTeX 和pdf\TeX,此外也没有跟上计算机上对日文处理的演进(比如,
259 UTF-8编码,TrueType字体,OpenType字体)。
260 %</zh>
261
262 %<*en>
263 Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
264 of \pTeX) and \epTeX\ (merging of \pTeX\ and
265 \eTeX\ extension), have developed to fill those gaps to some
266 extent, but gaps still exist.
267 %</en>
268 %<*ja>
269 ここ数年,若干状況は改善されてきた.現在手に入る大半の\pTeX バイナリでは
270 外部UTF-8入力が利用可能となり,さらにUnicode化を推進し,\pTeX の内部処理
271 までUnicode化した\upTeX も開発されている.また,\pTeX に\eTeX 拡張をマー
272 ジした\epTeX も登場し,\TeX\ Live\ 2011では\pLaTeX が\epTeX の上で動作す
273 るようになった.だが,\pdfTeX 拡張(PDF直接出力やmicro-typesetting)を
274 \pTeX に対応させようという動きはなく,海外とのgapは未だにあるのが現状であ
275 る.
276 %</ja>
277 %<*zh>
278 最近开发的\pTeX 扩展,即\upTeX(Unicode下的\pTeX 实现)和\epTeX(\pTeX 和
279 \eTeX 的融合版本),虽然在部分情况上弥补了上述的差距,但是差距依然存在。
280 %</zh>
281
282 %<*en>
283 However, the appearance of \LuaTeX\ changed the whole situation. With
284 using Lua `callbacks', users can customize the internal processing of
285 \LuaTeX. So there is no need to modify sources of engines to
286 support Japanese typesetting: to do this, we only have to write Lua
287 scripts for appropriate callbacks.
288 %</en>
289 %<*ja>
290 しかし,\LuaTeX の登場で,状況は大きく変わることになった.Luaコードで
291 `callback'を書くことにより,\LuaTeX の内部処理に割り込みをかけることが可
292 能となった.これは,エンジン拡張という真似をしなくても,Luaコードとそれに
293 関する\TeX マクロを書けば,エンジン拡張とほぼ同程度のことができるようになっ
294 たということを意味する.\LuaTeX-jaは,このアプローチによってLuaコード・
295 \TeX マクロによって日本語組版を\LuaTeX の上で実現させようという目的で開発
296 が始まったパッケージである.
297 %</ja>
298 %<*zh>
299 不过,\LuaTeX 的出现改变了整个状况。用户可以通过使用Lua语言的“callback”来
300 调整\LuaTeX 的内部处理机制。所以,没有必要去通过修改引擎的源代码来支持日文
301 排版,相反,我们需要做的仅仅是编写其当处理callback的Lua脚本。
302 %</zh>
303
304 %<en>\subsection{Major Changes from \pTeX}
305 %<ja>\subsection{\pTeX からの主な変更点}
306 %<zh>\subsection{与\pTeX 的差异所在}
307
308 %<*en>
309 The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
310 target of development was to implement features of \pTeX. However,
311 \emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
312 specifications/behaviors of \pTeX\ were not adopted}.
313 %</en>
314 %<*ja>
315 \LuaTeX-jaは,\pTeX に多大な影響を受けている.初期の開発目標は,\pTeX の機
316 能をLuaコードにより実装することであった.しかし,開発が進むにつれ,\pTeX
317 の完全な移植は不可能であり,また\pTeX における実装がいささか不可解になっ
318 ているような状況も発見された.そのため,\textbf{\LuaTeX-jaは,もはや
319 \pTeX の完全な移植は目標とはしない.\pTeX における不自然な仕様・挙動があ
320 れば,そこは積極的に改める.}
321 %</ja>
322 %<*zh>
323 \LuaTeX-ja宏包在设计上,受\pTeX 影响很大。最初开发的主要议题是实现\pTeX 的特性。
324 不过,{\bf\LuaTeX-ja不是简简单单的移植\pTeX,很多不自然的特征和现象都被移出了。}
325 %</zh>
326
327 %<*en>
328 The followings are major changes from \pTeX:
329 %</en>
330 %<*ja>
331 以下は \pTeX からの主な変更点である.
332 %</ja>
333 %<*zh>
334 下面列举出了一些和\pTeX 的差异:
335 %</zh>
336
337 \begin{itemize}
338 %<*en>
339 \item A Japanese font is a tuple of a `real' font, a Japanese font
340       metric (\textbf{JFM}, for short), and an optional string called
341       `variation'.
342 %</en>
343 %<*ja>
344 \item 和文フォントは(小塚明朝,IPA明朝などの)実際のフォント,和文フォン
345       トメトリック(JFMと呼ぶ\footnote{混乱を防ぐため,p\TeX の意味での
346       JFM (\texttt{min10.tfm}) などは本ドキュメントでは\textbf{和文用
347       TFM}とよぶことにする.}),そして`variation'と呼ばれる文字列の組で
348       ある.
349 %</ja>
350 %<*zh>
351 \item 一个日文字体是由三部分构成的元组:实际的字体(如小塚明
352       朝,IPA明朝),日文字体测度(\textbf{JFM})和变体字串。
353 %</zh>
354
355 %<*en>
356 \item In \pTeX, a line break after Japanese character is ignored (and
357       doesn't yield a space), since line breaks (in source files) are
358       permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
359       doesn't have this function completely, because of a specification
360       of \LuaTeX.
361 %</en>
362 %<*ja>
363 \item 日本語の文書中では改行はほとんどどこでも許されるので,\pTeX では和文文字
364       直後の改行は無視される(スペースが入らない)ようになっていた.しかし,
365       \LuaTeX-ja では \LuaTeX の仕様のためにこの機能は完全には実装されていない.
366 %</ja>
367 %<*zh>
368 \item \pTeX 中,日文字符之后的断行并不允许(也不产生空格),其他在源码中的断行
369       是可以随处允许的。不过,因为\LuaTeX 的特殊关系,\LuaTeX-ja并没有这个功能。
370 %</zh>
371
372 %<*en>
373 \item The insertion process of glues/kerns between two Japanese
374       characters and between a Japanese character and other characters
375       (we refer glues/kerns of both kinds as \textbf{JAglue}) is rewritten from
376       scratch.
377 %</en>
378 %<*ja>
379 \item 2つの和文文字の間や,和文文字と欧文文字の間に入るグルー/カーン
380       (両者をあわせて\textbf{JAglue}と呼ぶ)の挿入処理が0から書き直されている.
381 %</ja>
382 %<*zh>
383 \item 插在日文字符和其他字符言之间的胶/出格(我们将此称为\textbf{JAglue})是重新实现的。
384 %</zh>
385
386 \begin{itemize}
387 %<*en>
388 \item As \LuaTeX's internal character handling is `node-based'
389       (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
390       insertion process of \textbf{JAglue} is now `node-based'.
391 %</en>
392 %<*ja>
393 \item \LuaTeX の内部での文字の扱いが「ノードベース」になっているように(例えば,
394       \verb+of{}fice+ で合字は抑制されない),\textbf{JAglue}の挿入処理も
395       「ノードベース」である.
396 %</ja>
397 %<*zh>
398 \item 在\LuaTeX 中,内部的字符处理是“基于node的”(例如:\verb!of{}fice!不会避免合字),
399       \textbf{JAglue}的插入处理,现在也是“基于node的”。
400 %</zh>
401
402 %<*en>
403 \item Furthermore, nodes between two characters which have no effects in
404       line break (\textit{e.g.}, \verb+\special+ node) and kerns from
405       italic correction are ignored in the insertion process.
406 %</en>
407 %<*ja>
408 \item さらに,2つの文字の間にある行末では効果を持たないノード(例えば \verb+\special+ ノード)や,
409   イタリック補正に伴い挿入されるカーンは挿入処理中では無視される.
410 %</ja>
411 %<*zh>
412 \item 此外,两个字符之间的node在断行时不起作用的(例如,\verb!\special!node),还有
413       意大利体校正带来的出格在插入处理中也是被忽略的。
414 %</zh>
415
416 %<*en>
417 \item \emph{Caution: due to above two points, many methods which did for the
418       dividing the process of the insertion of \textbf{JAglue} in \pTeX\ are not
419       effective anymore.} In concrete terms, the following two methods are not effective anymore:
420 %</en>
421 %<*ja>
422 \item \textbf{注意:上の2つの変更により,従来\textbf{JAglue}の挿入処理を分断するのに
423       使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:}
424 %</ja>
425 %<*zh>
426 \item \textbf{警告:鉴于以上两点,在\pTeX 中分割\textbf{JAglue}处理的多种方法不再生效。}
427      明确地说,下列两种方法不再生效:
428 %</zh>
429 \begin{verbatim}
430   ちょ{}っと  ちょ\/っと
431 \end{verbatim}
432 %<*en>
433       If you want to do so, please put an empty hbox between it instead:
434 %</en>
435 %<*ja>
436       もし同じことをやりたければ,空の水平ボックスを間に挟めばよい:
437 %</ja>
438 %<*zh>
439       如果想得到此种结果,请使用空盒子替代:
440 %</zh>
441 \begin{verbatim}
442   ちょ\hbox{}っと
443 \end{verbatim}
444
445
446 %<*en>
447 \item In the process, two Japanese fonts which only differ in their `real'
448       fonts are identified.
449 %</en>
450 %<*ja>
451 \item 処理中では,2つの和文フォントは,「実際の」フォントのみが異なる場合に同一視
452       される.
453 %</ja>
454 %<*zh>
455 \item 处理过程中,两个在“真实”字体上具区别的日文字体可以被识别出来。
456 %</zh>
457 \end{itemize}
458
459 %<*ja>
460 \item \LuaTeX-jaでは,\pTeX と同様に漢字・仮名を制御綴内に用いることができ,
461 \verb+\西暦+ などが正しく動作するようにしている.
462 但し,制御綴中に使える和文文字が\pTeX・\upTeX と全く同じではないことに注意すること.
463 %</ja>
464
465 %<*en>
466 \item At the present, vertical typesetting (\emph{tategaki}), is not
467       supported in \LuaTeX-ja.
468 %</en>
469 %<*ja>
470 \item 現時点では,縦書きは\LuaTeX-jaではサポートされていない.
471 %</ja>
472 %<*zh>
473 \item 当下,\LuaTeX-ja并不支持直行排版。
474 %</zh>
475
476 \end{itemize}
477
478 %<*en>
479 For detailed information, see Part~\ref{part-imp}.
480 %</en>
481 %<*ja>
482 詳細については第\ref{part-imp}部を参照.
483 %</ja>
484 %<*zh>
485 详细的描述,请参见第\ref{part-imp}编。
486 %</zh>
487
488 %<en>\subsection{Notations}
489 %<ja>\subsection{用語と記法}
490 %<zh>\subsection{一些约定}
491
492
493 %<*en>
494 In this document, the following terms and notations are used:
495 %</en>
496 %<*ja>
497 本ドキュメントでは,以下の用語と記法を用いる:
498 %</ja>
499 %<*zh>
500 在本文档中,有下面一些约定:
501 %</zh>
502
503 \begin{itemize}
504 %<*en>
505 \item Characters are divided into two types:
506 %</en>
507 %<*ja>
508 \item 文字は2種類に分けられる:
509 %</ja>
510 %<*zh>
511 \item 字符被分为两种类型:
512 %</zh>
513 \begin{itemize}
514 %<*en>
515 \item \textbf{JAchar}: standing for Japanese characters such as
516       Hiragana, Katakana, Kanji and other punctuation marks for
517       Japanese.
518 %</en>
519 %<*ja>
520 \item \textbf{JAchar}: ひらがな,カタカナ,漢字,和文用の約物といった和文文字の
521       ことを指す.
522 %</ja>
523 %<*zh>
524 \item \textbf{JAchar}:表示日文字符,如平假名,片假名,汉字,日文标点。
525 %</zh>
526
527 %<*en>
528 \item \textbf{ALchar}: standing for all other characters like alphabets.
529 %</en>
530 %<*ja>
531 \item \textbf{ALchar}: アルファベットを始めとする,その他全ての文字を指す.
532 %</ja>
533 %<*zh>
534 \item \textbf{ALchar}:代表其他字母字符。
535 %</zh>
536 \end{itemize}
537
538 %<*en>
539 We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts' for fonts used in \textbf{JAchar}.
540 %</en>
541 %<*ja>
542 そして,\textbf{ALchar}の出力に用いられるフォントを「欧文フォント」と呼び,
543 \textbf{JAchar}の出力に用いられるフォントを「和文フォント」と呼ぶ.
544 %</ja>
545 %<*zh>
546 我们将用于\textbf{ALchar}的字体称为“字母字体”,用于\textbf{JAchar}的字体称为“日文字体”。
547 %</zh>
548
549 %<*en>
550 \item A word in a sans-serif font (like \Param{\hyperlink{fld:prebp}{prebreakpenalty}})
551       means an internal parameter for Japanese typesetting, and it
552       is used as a key in \verb+\ltjsetparameter+ command.
553 %</en>
554 %<*ja>
555 \item サンセリフ体で書かれた語(例:\Param{\hyperlink{fld:prebp}{prebreakpenalty}})は日本語組版用の
556       パラメータを表し,これらは \verb+\ltjsetparameter+ コマンドのキーとして
557       用いられる.
558 %</ja>
559 %<*zh>
560 \item 用无衬线字体表示的词(如:\Param{\hyperlink{fld:prebp}{prebreakpenalty}})表示
561       日文排版中的内部便利iang,并用做\verb!\ltjsetparameter!命令一个键。
562 %</zh>
563
564 %<*en>
565 \item A word in typewriter font with underline (like \Pkg{fontspec})
566       means a package or a class of \LaTeX.
567 %</en>
568 %<*ja>
569 \item 下線付きタイプライタ体の語(例:\Pkg{fontspec})は\LaTeX の
570       パッケージやクラスを表す.
571 %</ja>
572 %<*zh>
573 \item 用下划线表示的词(如:\Pkg{fontspec})表示\LaTeX 的宏包或者文档类。
574 %</zh>
575
576 %<*zh>
577 \item “primitive”,该词在本文档中不仅表示\LuaTeX 的基本控制命令,也包括\LuaTeX-ja的相关的基本控制命令
578 %</zh>
579
580 %<*en>
581 \item In this document, natural numbers start from~0.
582 %</en>
583 %<*ja>
584 \item 本ドキュメントでは,自然数は0から始まる.
585 %</ja>
586 %<*zh>
587 \item 所有的自然数从0开始
588 %</zh>
589 \end{itemize}
590
591 %<en>\subsection{About the project}
592 %<ja>\subsection{プロジェクトについて}
593 %<zh>\subsection{关于本项目}
594
595 %<*en>
596 \paragraph{Project Wiki} Project Wiki is under construction.
597 %</en>
598 %<*ja>
599 \paragraph{プロジェクトWiki} プロジェクトWikiは構築中である.
600 %</ja>
601 %<*zh>
602 \paragraph{项目wiki} 本项目wiki正在编写中。
603 %</zh>
604
605 %<*en>
606 \begin{itemize}
607 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
608 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
609 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28zh%29} (Chinese)
610 \end{itemize}
611 %</en>
612 %<*ja>
613 \begin{itemize}
614 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
615 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
616 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28zh%29}(中国語)
617 \end{itemize}
618 %</ja>
619 %<*zh>
620 \begin{itemize}
621 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日语)
622 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英语)
623 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28zh%29}(汉语)
624 \end{itemize}
625 %</zh>
626 %<*en>
627 This project is hosted by SourceForge.JP.
628 %</en>
629 %<*ja>
630 本プロジェクトはSourceForge.JPのサービスを用いて運営されている.
631 %</ja>
632 %<*zh>
633 本项目由SourceForge.JP托管。
634 %</zh>
635
636 %<en>\paragraph{Members}\
637 %<ja>\paragraph{開発メンバー}\
638 %<zh>\paragraph{开发者}\
639
640 %<*en>
641 \begin{multienumerate}
642 \def\labelenumi{$\bullet$}
643 \mitemxxx{Hironori KITAGAWA}{Kazuki MAEDA}{Takayuki YATO}
644 \mitemxxx{Yusuke KUROKI}{Noriyuki ABE}{Munehiro YAMAMOTO}
645 \mitemxxx{Tomoaki HONDA}{Shuzaburo SAITO}{MA Qiyuan}
646 \end{multienumerate}
647 %</en>
648 %<*ja>
649 \begin{multienumerate}
650 \def\labelenumi{$\bullet$}
651 \mitemxxx{北川 弘典}{前田 一貴}{八登 崇之}
652 \mitemxxx{黒木 裕介}{阿部 紀行}{山本 宗宏}
653 \mitemxxx{本田 知亮}{齋藤 修三郎}{馬 起園}
654 \end{multienumerate}
655 %</ja>
656 %<*zh>
657 \begin{multienumerate}
658 \def\labelenumi{$\bullet$}
659 \mitemxxx{北川 弘典}{前田 一贵}{八登 崇之}
660 \mitemxxx{黒木 裕介}{阿部 纪行}{山本 宗宏}
661 \mitemxxx{本田 知亮}{斋藤 修三郎}{马 起园}
662 \end{multienumerate}
663 %</zh>
664
665 % \paragraph{Acknowledgments} -- 挿入するならここ
666
667 \clearpage
668 %<en>\section{Getting Started}
669 %<ja>\section{使い方}
670 %<zh>\section{使用}
671 %<en>\subsection{Installation}
672 %<ja>\subsection{インストール}
673 %<zh>\subsection{安装}
674
675 %<*en>
676 To install the \LuaTeX-ja\ package, you will need:
677 %</en>
678 %<*ja>
679 \LuaTeX-jaパッケージのインストールには,次のものが必要である.
680 %</ja>
681 %<*zh>
682 安装\LuaTeX-ja之前,需要如下:
683 %</zh>
684 \begin{itemize}
685 %<*en>
686 \item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.
687
688 You might need to add the following lines to 
689 \texttt{lualatex.ini} (just before \verb+\dump+ in the last line), 
690 if you are using recent \LuaTeX\ whose Lua is 5.2.
691 %</en>
692 %<*ja>
693 \item \LuaTeX(バージョン 0.65.0-beta以降)とその支援パッケージ.
694
695 Lua 5.2を用いた\LuaTeX(バージョン0.74.0-beta以降)では,\texttt{lualatex.ini}\ 
696 に次の行を加える必要があるかもしれない(\verb+\dump+ の前に).
697 %</ja>
698 %<*!zh>
699 \begin{lstlisting}
700 {\catcode`\#=12\catcode`\~=12%
701 \global\everyjob\expandafter{\the\everyjob%
702   \directlua{%
703     if not table.maxn then
704       table.maxn = function(t)
705           local r = 0
706           for i,_ in pairs(t) do
707             if type(i)=='number' then
708               if i>r then r=i end
709             end
710           end
711          return r
712       end
713     end
714     if not package.loaders then package.loaders=package.searchers end
715     if not string.explode then
716       string.explode = function (str, separator)
717         if not separator then separator=" +"  end
718         local t, nexti, pos = { }, 1, 1
719         while true do
720           local st, sp = str:find (separator, pos)
721           if not st then break end
722           if pos ~= st then
723             t [ nexti ] = str:sub ( pos , st - 1 )
724             nexti = nexti + 1
725           end
726           pos = sp + 1
727         end
728         t [ nexti ] = str:sub ( pos )
729         return t
730       end
731     end
732   }%
733 }}%
734 \end{lstlisting}
735 %</!zh>
736 %<*zh>
737 \item \LuaTeX(版本号为大于0.65)和相关支持宏包。
738 %如果用户使用的是\TeX Live2011以及最新版本的W32\TeX,可不考虑此项。
739 %</zh>
740 %<*en>
741 \item The source archive of \LuaTeX-ja, of course\texttt{:)}
742 %</en>
743 %<*ja>
744 \item \LuaTeX-jaのソースアーカイブ(もちろん\texttt{:)}).
745 %</ja>
746 %<*zh>
747 \item \LuaTeX-ja的源码(当然喽\texttt{:)})。
748 %</zh>
749 %<*en>
750 \item The \Pkg{xunicode} package, which version is \emph{just v0.981 (2011/09/09)}.\\
751 If you have the \Pkg{fontspec} package, this \Pkg{xunicode} package must be exist.
752 But be careful about the version; other versions may not work correctly with \LuaTeX-ja.
753 %</en>
754 %<*ja>
755 \item \Pkg{xunicode}パッケージ(\textbf{2011/09/09,~v0.981}).\\
756 \Pkg{fontspec}パッケージが導入されていればこのパッケージも導入されているはずであるが,
757 このv0.981以外のバージョンでは\LuaTeX-ja上で正しく動作しない危険性がある.
758 %</ja>
759 %<*zh>
760 \Pkg{xunicode}宏包,当前版本必须为\textit{v0.981(2011/09/09)}。\\
761 如果你使用\Pkg{fontspec}宏包,\Pkg{xunicode}就必须存在。但是请注意该包的
762 版本,其他版本可能不会正常工作。
763 %</zh>
764 \end{itemize}
765
766 %<*en>
767 The installation methods are as follows:
768 %</en>
769 %<*ja>
770 インストール方法は以下のようになる:
771 %</ja>
772 %<*zh>
773 安装方法如下:
774 %</zh>
775 \begin{enumerate}
776 %<*en>
777 \item Download the source archive, by one of the following method.
778       At the present, \LuaTeX-ja has no \emph{stable} release.
779
780 \begin{itemize}
781 \item Copy the Git repository:
782 \begin{verbatim}
783 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
784 \end{verbatim}
785 \item Download the \texttt{tar.gz} archive of HEAD in the \texttt{master} branch from
786 \begin{flushleft}
787 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
788 \end{flushleft}
789 \item Now \LuaTeX-ja is available from the following archive and distributions:
790   \begin{itemize}
791   \item CTAN (in the \texttt{macros/luatex/generic/luatexja} directory)
792   \item MiK\TeX\ (in \texttt{luatexja.tar.lzma})
793   \item \TeX\ Live (in \texttt{texmf-dist/tex/luatex/luatexja})
794   \item W32\TeX\ (in \texttt{luatexja.tar.xz})
795   \end{itemize}
796   These are based on the \texttt{master} branch.
797 \end{itemize}
798
799 Note that the \texttt{master} branch, and hence the archive in CTAN, are not updated frequently;
800 the forefront of development is not the \texttt{master} branch.
801 %</en>
802 %<*ja>
803 \item ソースアーカイブを以下のいずれかの方法で取得する.現在公開されているのはあくまでも
804       開発版であって,安定版でないことに注意.
805
806 \begin{itemize}
807 \item Gitリポジトリの内容をコピーする:
808 \begin{verbatim}
809 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
810 \end{verbatim}
811 \item \texttt{master}ブランチのスナップショット(\texttt{tar.gz}形式)をダウンロードする.
812 \begin{flushleft}
813 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
814 \end{flushleft}
815 \item 今や,\LuaTeX-jaは以下のアーカイブ,およびディストリビューションにも収録されている:
816   \begin{itemize}
817   \item CTAN (\texttt{macros/luatex/generic/luatexja})
818   \item MiK\TeX\ (\texttt{luatexja.tar.lzma})
819   \item \TeX\ Live (\texttt{texmf-dist/tex/luatex/luatexja})
820   \item W32\TeX\ (\texttt{luatexja.tar.xz})
821   \end{itemize}
822   これらは\texttt{master}ブランチの内容を元にしている.
823 \end{itemize}
824
825 \texttt{master}ブランチ(従って,CTAN内のアーカイブも)はたまにしか更新されないことに注意.
826 主な開発は\texttt{master}の外で行われ,比較的まとまってきたらそれを\texttt{master}に
827 反映させることにしている.
828 %</ja>
829 %<*zh>
830 \item 按照如下方法下载源码归档。现在,\LuaTeX-ja没有稳定版本。
831
832 \begin{itemize}
833 \item 复制Git仓库:
834 \begin{verbatim}
835 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
836 \end{verbatim}
837 \item 下载\texttt{master} HEAD版本的\texttt{tar.gz}归档:
838 \begin{flushleft}
839 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
840 \end{flushleft}
841 \item 现在\LuaTeX-ja可以在下列仓库和发行版中获取::
842   \begin{itemize}
843   \item CTAN (\texttt{macros/luatex/generic/luatexja})
844   \item MiK\TeX\ (\texttt{luatexja.tar.lzma})
845   \item \TeX\ Live (\texttt{texmf-dist/tex/luatex/luatexja})
846   \item W32\TeX\ (\texttt{luatexja.tar.xz})
847   \end{itemize}
848   这些版本都基于\texttt{master}分支。
849 \end{itemize}
850
851 注意\texttt{master}分支和CTAN仓库中的版本,升级并不频繁。
852 前段开发并未在\texttt{master}分支。
853 %</zh>
854
855 %<*en>
856 \item Extract the archive. You will see \texttt{src/} and several other sub-directories.
857 But only the contents in \texttt{src/} are needed to work \LuaTeX-ja.
858 %</en>
859 %<*ja>
860 \item 「Gitリポジトリをコピー」以外の方法でアーカイブを取得したならば,それを展開する.
861       \texttt{src/}をはじめとしたいくつかのディレクトリができるが,
862       動作には\texttt{src/}以下の内容だけで十分.
863 %</ja>
864 %<*zh>
865 \item 解压归档。你会看到\texttt{src/}和其他相关文件夹。
866 但是只有\texttt{src/}文件夹下的相关文件是\LuaTeX-ja运行所必须的。
867 %</zh>
868
869 %<*en>
870 \item Copy all the contents of \texttt{src/} into one of your \texttt{TEXMF} tree.
871       \texttt{TEXMF/tex/luatex/luatexja/} is an example location.
872       If you cloned entire Git repository, making a symbolic link of \texttt{src/}
873       instead copying is also good.
874 %</en>
875 %<*ja>
876 \item \texttt{src/}の中身を自分の\texttt{TEXMF}ツリーにコピーする.
877       場所の例としては,例えば\texttt{TEXMF/tex/luatex/luatexja/}がある.
878       シンボリックリンクが利用できる環境で,かつリポジトリを直接取得したのであれば,
879       (更新を容易にするために)コピーではなくリンクを貼ることを勧める.
880 %</ja>
881 %<*zh>
882 \item 复制\texttt{src/}文件夹下内容至\texttt{TEXMF}数下。
883 \texttt{TEXMF/tex/luatex/luatexja/}为例。
884 如果你复制了整个Git仓库,为\texttt{src/}制作软链接来替代复制也是可以的。
885 %</zh>
886
887 %<*en>
888 \item If \texttt{mktexlsr} is needed to update the file name database, make it so.
889 %</en>
890 %<*ja>
891 \item 必要があれば,\texttt{mktexlsr}を実行する.
892 %</ja>
893 %<*zh>
894 \item 如有必要,执行\texttt{mktexlsr}。
895 %</zh>
896 \end{enumerate}
897
898 %<en>\subsection{Cautions}
899 %<ja>\subsection{注意点}
900 %<zh>\subsection{注意}
901
902
903 \begin{itemize}
904 %<*en>
905 \item The encoding of your source file must be UTF-8. No other
906       encodings, such as EUC-JP or Shift-JIS, are not supported.
907 %</en>
908 %<*ja>
909 \item 原稿のソースファイルの文字コードはUTF-8固定である.
910       従来日本語の文字コードとして用いられてきたEUC-JPやShift-JISは使用できない.
911 %</ja>
912 %<*zh>
913 \item 源文档编码必须是UTF-8。其他的编码,如EUC-JP和Shift-JIS都不被支持。
914 %</zh>
915 %<*en>
916 \item \LuaTeX-ja is very slower than \pTeX. Using LuaJIT\TeX slightly improve the situation.
917 %</en>
918 %<*ja>
919 \item \LuaTeX-jaは動作が\pTeX に比べて非常に遅い.コードを変更して徐々に速くしているが,
920 まだ満足できる速度ではない.LuaJIT\TeX を用いると\LuaTeX のだいたい1.3倍の速度で動くようである.
921 %</ja>
922 \end{itemize}
923
924 %<en>\subsection{Using in plain \TeX}
925 %<ja>\subsection{plain \TeX で使う}
926 %<zh>\subsection{plain \TeX 下使用}
927 \label{ssec-plain}
928
929 %<*en>
930 To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
931 %</en>
932 %<*ja>
933 \LuaTeX-jaを plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
934 %</ja>
935 %<*zh>
936 在plain \TeX 下使用\LuaTeX-ja相当简易,在文档开头放置一行:
937 %</zh>
938 \begin{verbatim}
939 \input luatexja.sty
940 \end{verbatim}
941 %<*en>
942 This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents:
943 %</en>
944 %<*ja>
945 これで(\texttt{ptex.tex}のように)日本語組版のための最低限の設定がなされる:
946 %</ja>
947 %<*zh>
948 这里做出了做小的日文文档排版设定(如\texttt{ptex.tex}):
949 %</zh>
950
951 \begin{itemize}
952 %<*en>
953 \item The following 6~Japanese fonts are preloaded:
954 \begin{center}\small
955 \begin{tabular}{ccccc}
956 \toprule
957 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
958 \emph{mincho}&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
959 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
960 \bottomrule
961 \end{tabular}
962 \end{center}
963 %</en>
964 %<*ja>
965 \item 以下の6つの和文フォントが定義される:
966 \begin{center}\small
967 \begin{tabular}{ccccc}
968 \toprule
969 \textbf{字体}&\textbf{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
970 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
971 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
972 \bottomrule
973 \end{tabular}
974 \end{center}
975 %</ja>
976 %<*zh>
977 \item 提前加载了六种日文字体,如下:
978 \begin{center}\small
979 \begin{tabular}{ccccc}
980 \toprule
981 \textbf{字体}&\textbf{字体名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
982 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
983 哥特体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
984 \bottomrule
985 \end{tabular}
986 \end{center}
987 %</zh>
988 \begin{itemize}
989 %<*en>
990 \item It is widely accepted that the font `Ryumin-Light' and
991       `GothicBBB-Medium' aren't embedded into PDF files, and a PDF reader
992       substitute them by some external Japanese fonts (\textit{e.g.},
993       Kozuka Mincho is used for Ryumin-Light in Adobe Reader). We adopt this custom to
994       the default setting.
995 %</en>
996 %<*ja>
997 \item `Ryumin-Light'と`GothicBBB-Medium'はPDFファイルに埋め込まずに
998       名前参照のみで用いることが広く受け入れられており,この場合PDFリーダーが
999       適切な外部フォントで代用する(例えば,Adobe ReaderではRyumin-Lightは
1000       小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと
1001       して採用する.
1002 %</ja>
1003 %<*zh>
1004 \item 广为接受的“Ryumin-Light”和“GothicBBB-Medium”字体不嵌入PDF文件,
1005 而PDF阅读器则会使用外部日文字体替代(例如,在Adobe Reader中使用
1006 Kozuka Mincho字体替代Ryumin-Light)。我们使用默认设定。
1007 %</zh>
1008
1009 %<*en>
1010 \item A character in an alphabetic font is generally smaller than a
1011       Japanese font in the same size. So actual size specification of
1012       these Japanese fonts is in fact smaller than that of alphabetic
1013       fonts, namely scaled by 0.962216.
1014 %</en>
1015 %<*ja>
1016 \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも
1017       一般に小さくデザインされている.そこで,標準ではこれらの和文フォントの実際のサイズは指定された値よりも
1018       小さくなるように設定されており,具体的には指定の0.962216倍にスケールされる.
1019       この0.962216という数値も,\pTeX におけるスケーリングを踏襲した値である.
1020 %</ja>
1021 %<*zh>
1022 \item 一般情况下,相同大小日文字体比西文字体要大一下。所以实际的日文字体尺寸需哟小于西文字
1023 体,即使用一个缩放率:0.962216。
1024 %</zh>
1025 \end{itemize}
1026
1027 %<*en>
1028 \item The amount of glue that are inserted between a \textbf{JAchar} and
1029       an \textbf{ALchar} (the parameter \Param{\hyperlink{fld:xks}{xkanjiskip}}) is set to
1030 %</en>
1031 %<*ja>
1032 \item \textbf{JAchar}と\textbf{ALchar}の間に入るグルー(\Param{\hyperlink{fld:xks}{xkanjiskip}})の
1033       量は次のように設定されている:
1034 %</ja>
1035 %<*zh>
1036 \item 在\textbf{JAchar}和\textbf{ALchar}之间插入的胶(\textsf{xkanjiskip}参数)大小为:
1037 %</zh>
1038 \[
1039  (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}}
1040  = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}.
1041 \]
1042 \end{itemize}
1043
1044 %<en>\subsection{Using in \LaTeX}
1045 %<ja>\subsection{\LaTeX で使う}
1046 %<zh>\subsection{\LaTeX 下使用}
1047 \label{ssec-ltx}
1048
1049 \paragraph{\LaTeXe}
1050
1051 %<*en>
1052 Using in \LaTeXe\ is basically same. To set up the minimal environment
1053 for Japanese, you only have to load \texttt{luatexja.sty}:
1054 %</en>
1055 %<*ja>
1056 \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を
1057 設定するためには,\texttt{luatexja.sty}を読み込むだけでよい:
1058 %</ja>
1059 %<*zh>
1060 在\LaTeXe 下使用基本相同。设定日文的最小环境,你只需加载\texttt{luatexja.sty}:
1061 %</zh>
1062 \begin{verbatim}
1063 \usepackage{luatexja}
1064 \end{verbatim}
1065 %<*en>
1066 It also does minimal settings (counterparts in \pLaTeX\ are \texttt{
1067 plfonts.dtx} and \texttt{pldefs.ltx}):
1068 %</en>
1069 %<*ja>
1070 これで\pLaTeX の\texttt{plfonts.dtx}と\texttt{pldefs.ltx}に相当する最低限の設定が
1071 なされる:
1072 %</ja>
1073 %<*zh>
1074 这些做了最小的设定(作用相当于\pLaTeX 中的\texttt{plfonts.dtx}和\texttt{pldefs.ltx}):
1075 %</zh>
1076
1077 \begin{itemize}
1078 %<*en>
1079 \item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
1080 When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
1081 %</en>
1082 %<*ja>
1083 \item \texttt{JY3}は和文フォント用のフォントエンコーディングである(横書き用).\\
1084 将来的に,\LuaTeX-jaで縦書きがサポートされる際には,\texttt{JT3}を縦書き用として
1085 用いる予定である.
1086 %</ja>
1087 %<*zh>
1088 \item \texttt{JY3}是日文字体编码(在水平方向)。\\
1089 在将来\LuaTeX-ja要支持直行排版的时候,\texttt{JT3}会用于直行字体。
1090 %</zh>
1091
1092 %<*en>
1093 \item Two font families \texttt{mc} and \texttt{gt} are defined:
1094 \begin{center}\small
1095 \begin{tabular}{ccccc}
1096 \toprule
1097 \textbf{classification}&\textbf{family}&\verb+\mdseries+&\verb+\bfseries+&\textbf{scale}\\\midrule
1098 \emph{mincho}&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
1099 \emph{gothic}&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
1100 \bottomrule
1101 \end{tabular}
1102 \end{center}
1103 Remark that the bold series in both family are same as the medium series of \emph{gothic} family.
1104 This is a convention in \pLaTeX. This is a trace that there were only 2~fonts (these are Ryumin-Light
1105 and GothicBBB-Medium) in early years of DTP.
1106 %</en>
1107 %<*ja>
1108 \item 2つのフォントファミリ\texttt{mc}と\texttt{gt}が定義されている:
1109 \begin{center}\small
1110 \begin{tabular}{ccccc}
1111 \toprule
1112 \textbf{字体}&\textbf{ファミリ}&\verb+\mdseries+&\verb+\bfseries+&\textbf{スケール}\\\midrule
1113 明朝体&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
1114 ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
1115 \bottomrule
1116 \end{tabular}
1117 \end{center}
1118 どちらのファミリにおいても,そのboldシリーズはゴシック体のmediumシリーズで
1119 あることに注意.これは初期のDTPにおいて和文フォントが2つ(それがちょうど\
1120 Ryumin-Light, GothicBBB-Mediumだった)しか利用できなかった時の名残であり,\pLaTeX{}
1121 での標準設定とも同じである.
1122 %</ja>
1123 %<*zh>
1124 \item 定义了两个字体族:\texttt{mc}!和\texttt{gt}:\\
1125 \begin{center}\small
1126         \begin{tabular}{ccccc}
1127         \hline
1128         \textbf{字体}&\textbf{字体族}&\verb!\mdseries!&\verb!\bfseries!&缩放率\\
1129         \hline
1130         \textit{mincho}&\verb!mc!&Ryumin-Light&GothicBBB-Medium&0.962216\\
1131         \textit{gothic}&\verb!gt!&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
1132         \hline
1133         \end{tabular}
1134 \end{center}
1135 注意的是两个字体族的粗体系列同为中等系列的\textbf{哥特}族。这\pLaTeX 中的规定。在近些年
1136 中的DTP实务中有仅使用2个字体的趋向(是为Ryumin-Light和GothicBBB-Medium)。
1137 %</zh>
1138
1139 %<*en>
1140 \item Japanese characters in math mode are typeset by the font family \texttt{mc}.
1141 %</en>
1142 %<*ja>
1143 \item 数式モード中の和文文字は\texttt{mc}ファミリで出力される.
1144 %</ja>
1145 %<*zh>
1146 \item 在数学模式下,日文字符使用\verb!mc!字体族来排印。
1147 %</zh>
1148 \end{itemize}
1149
1150 %<*en>
1151 However, above settings are not sufficient for Japanese-based
1152 documents. To typeset Japanese-based documents, you are better to use
1153 class files other than \texttt{article.cls}, \texttt{book.cls}, and so on.  At
1154 the present, we have the counterparts of \Pkg{jclasses} (standard
1155 classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
1156 Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
1157 %</en>
1158 %<*ja>
1159 しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
1160 日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls}といった
1161 欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
1162 現時点では,\Pkg{jclasses}(\pLaTeX の標準クラス)と\Pkg{jsclasses}
1163 (奥村晴彦氏によるクラスファイル)に対応するものとして,\Pkg{ltjclasses},
1164 \Pkg{ltjsclasses}がそれぞれ用意されている.
1165 %</ja>
1166 %<*zh>
1167 不过,上述设定并不能满足排版基于日文的文档。为了排印基于日文的文
1168 档,你最好不要使用\texttt{article.cls},\texttt{book.cls}等文档类文件。
1169 现在,我们有相当于\Pkg{jclasses}(\pLaTeX 标准文档类)和\Pkg{jsclasses}
1170 (奥村晴彦)的文档类,即\Pkg{ltjclasses}和\Pkg{ltjsclasses}。
1171 %</zh>
1172
1173 %<en>\section{Changing Fonts}
1174 %<ja>\section{フォントの変更}
1175 %<zh>\section{字体更改}
1176
1177 \subsection{plain \TeX~and~\LaTeXe}
1178 \label{ssub-chgfnt}
1179
1180 \paragraph{plain \TeX}
1181 %<*en>
1182 To change Japanese fonts in plain \TeX, you must use the control sequence
1183 \verb+\jfont+. So please see Subsection~\ref{ssec-jfont}.
1184 %</en>
1185 %<*ja>
1186 plain \TeX で和文フォントを変更するためには,\pTeX のように \verb+\jfont+ 命令を直接用いる.
1187 \ref{ssec-jfont}節を参照.
1188 %</ja>
1189 %<*zh>
1190 在plain \TeX 下改变日文字体,你必须使用基本语句\verb!\jfont!。请参见\ref{ssec-jfont}。
1191 %</zh>
1192
1193 \paragraph{\LaTeXe\ (NFSS2)}
1194 %<*en>
1195 For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (in \texttt{plfonts.dtx}).
1196 %</en>
1197 %<*ja>
1198 \LaTeXe については,\LuaTeX-jaではフォント選択システムを\pLaTeXe\ (\texttt{plfonts.dtx})
1199 の大部分をそのまま採用している.
1200 %</ja>
1201 %<*zh>
1202 对于\LaTeXe,\LuaTeX-ja采用了\pLaTeXe 中(即\texttt{plfonts.dtx})大部分字体选择系统。
1203 %</zh>
1204 \begin{itemize}
1205 %<*en>
1206 \item Two control sequences \verb+\mcdefault+ and \verb+\gtdefault+ are
1207       used to specify the default font families for \emph{mincho} and
1208       \emph{gothic}, respectively. Default values: \texttt{mc} for
1209       \verb+\mcdefault+ and \texttt{gt} for \verb+\gtdefault+.
1210 %</en>
1211 %<*ja>
1212 \item 2つのコントロールシーケンス \verb+\mcdefault+ と \verb+\gtdefault+ がそれぞ
1213       れ明朝体とゴシック体のデフォルトのフォントファミリを指定するために用いられる.
1214       初期値:\verb+\mcdefault+ は\texttt{mc},\verb+\gtdefault+ は\texttt{gt}.
1215 %</ja>
1216 %<*zh>
1217 \item \verb!\mcdefault!和\verb!\gtdefault!控制语句用来分别控制默认的\textit{mincho}和\textit{gothic}字体族。
1218         默认值:\texttt{mc}用于\verb!\mcdefault!,\texttt{gt}用于\verb!\gtdefault!。
1219 %</zh>
1220 %<*en>
1221 \item Commands \verb+\fontfamily+, \verb+\fontseries+,
1222       \verb+\fontshape+ and \verb+\selectfont+ can be used to change
1223       attributes of Japanese fonts.
1224 %</en>
1225 %<*ja>
1226 \item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして
1227       \verb+\selectfont+ が和文フォントの属性を変更するために使用できる.
1228 %</ja>
1229 %<*zh>
1230 \item 命令\verb!\fontfamily!,\verb!\fontseries!,\verb!\fontshape!个\verb!\selectfont!用来改变日文字体属性。
1231 %</zh>
1232
1233 %<*en>
1234 \begin{center}\small
1235 \begin{tabular}{cccccc}
1236 \toprule
1237 &\textbf{encoding}&\textbf{family}&\textbf{series}&\textbf{shape}&\textbf{selection}\\\midrule
1238 alphabetic fonts
1239 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
1240 &\verb+\useroman+\\
1241 Japanese fonts
1242 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
1243 &\verb+\usekanji+\\
1244 both&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
1245 auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
1246 \bottomrule
1247 \end{tabular}
1248 \end{center}
1249 %</en>
1250 %<*ja>
1251 \begin{center}\small
1252 \begin{tabular}{cccccc}
1253 \toprule
1254 &\textbf{エンコーディング}&\textbf{ファミリ}&\textbf{シリーズ}&\textbf{シェープ}&\textbf{選択}\\\midrule
1255 欧文
1256 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
1257 &\verb+\useroman+\\
1258 和文
1259 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
1260 &\verb+\usekanji+\\
1261 両方&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
1262 自動選択&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
1263 \bottomrule
1264 \end{tabular}
1265 \end{center}
1266 %</ja>
1267 %<*zh>
1268 \begin{center}\small
1269 \begin{tabular}{cccccc}
1270 \toprule
1271 &\textbf{编码}&\textbf{族}&\textbf{系列}&\textbf{形状}&\textbf{选择}\\\midrule
1272 西文字体
1273 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
1274 &\verb+\useroman+\\
1275 日文字体
1276 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
1277 &\verb+\usekanji+\\
1278 两者&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
1279 自动选择&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
1280 \bottomrule
1281 \end{tabular}
1282 \end{center}
1283 %</zh>
1284
1285 %<*en>
1286       \verb+\fontencoding{<encoding>}+ changes the encoding of alphabetic fonts
1287       or Japanese fonts depending on the argument. For example,
1288       \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to
1289       \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of
1290       alphabetic fonts to \texttt{T1}.
1291       \verb+\fontfamily+ also changes the family of Japanese fonts, alphabetic
1292       fonts, \emph{or both}. For detail, see Subsection~\ref{ssub-nfsspat}.
1293 %</en>
1294 %<*ja>
1295       ここで,\verb+\fontencoding{<encoding>}+ は,引数により和文側か欧文
1296       側かのどちらかのエンコーディングを変更する.例えば,
1297       \verb+\fontencoding{JY3}+ は和文フォントのエンコーディングを
1298       \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を
1299       \texttt{T1}へと変更する.\verb+\fontfamily+ も引数により和文側,欧文
1300       側,\textbf{あるいは両方}のフォントファミリを変更する.詳細は
1301       \ref{ssub-nfsspat}節を参照すること.
1302 %</ja>
1303 %<*zh>
1304       \verb!\fontencoding{<encoding>}!依赖于参数以改变西文字体或者日文字体。
1305       例如,\verb!\fontencoding{JY3}!改变当前日文字体至\texttt{JY3},
1306       \verb!\fontencoding{T1}!改变西文字体至\texttt{T1}。
1307       \verb!\fontfamily!也会改变日文字体或西文字体的族,抑或二者。
1308       细节详见\ref{ssub-nfsspat}。
1309 %</zh>
1310
1311 %<*en>
1312 \item For defining a Japanese font family, use
1313       \verb+\DeclareKanjiFamily+ instead of
1314       \verb+\DeclareFontFamily+. However, in the present implementation,
1315       using \verb+\DeclareFontFamily+ doesn't cause any problem.
1316 %</en>
1317 %<*ja>
1318 \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の
1319       代わりに \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の
1320       実装では \verb+\DeclareFontFamily+ を用いても問題は生じない.
1321 %</ja>
1322 %<*zh>
1323 \item 对于定义日文字体族,使用\verb!\DeclareKanjiFamily!代替\verb!\DeclareFontFamily!。
1324       不过,在现在的实现中,使用\verb!\DeclareFontFamily!不会引起任何问题。
1325 %</zh>
1326 \end{itemize}
1327
1328 %<*en>
1329 \paragraph{Remark: Japanese Characters in Math Mode}
1330 Since \pTeX\ supports Japanese characters in math mode, there are
1331 sources like the following:
1332 %</en>
1333 %<*ja>
1334 \paragraph{注意:数式モード中の和文文字}
1335 \pTeX では,特に何もしないでも数式中に和文文字を記述することができた.そのため,
1336 以下のようなソースが見られた:
1337 %</ja>
1338 %<*zh>
1339 \paragraph{注记:数学模式下的日文字符}
1340 \pTeX 支持在数学模式下的日文字符,如以下源码:
1341 %</zh>
1342
1343 \begin{LTXexample}
1344 $f_{高温}$~($f_{\text{high temperature}}$).
1345 \[ y=(x-1)^2+2\quad よって\quad y>0 \]
1346 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
1347 \end{LTXexample}
1348 %<*en>
1349 We (the project members of \LuaTeX-ja) think that using
1350 Japanese characters in math mode are allowed if and only if these are used as identifiers.
1351 In this point of view,
1352 %</en>
1353 %<*ja>
1354 \LuaTeX-jaプロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる
1355 ときのみ許されると考えている.
1356 この観点から,
1357 %</ja>
1358 %<*zh>
1359 我们(\LuaTeX-ja项目成员)认为在数学模式下使用日文字符,只有在这些字符充当标识符时才是正确的。在这点下:
1360 %</zh>
1361 \begin{itemize}
1362 %<*en>
1363 \item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and
1364 `よって' is used as a conjunction.
1365 %</en>
1366 %<*ja>
1367 \item 上記数式のうち1, 2行目は正しくない.なぜならば`高温'が意味のあるラベルと
1368       して,`よって'が接続詞として用いられているからである.
1369 %</ja>
1370 %<*zh>
1371 \item 第1行和第2行是不正确的,因为“高温”的作用为文本标签,“よって”用作为连词。
1372 %</zh>
1373 %<*en>
1374 \item However, the line~3 is correct, since `素' is used as an identifier.
1375 %</en>
1376 %<*ja>
1377 \item しかしながら,3行目は`素'が識別子として用いられているので正しい.
1378 %</ja>
1379 %<*zh>
1380 \item 不过,第3行是正确的,因为“素”是作为标识符的。
1381 %</zh>
1382 \end{itemize}
1383 %<*en>
1384 Hence, in our opinion, the above input should be corrected as:
1385 %</en>
1386 %<*ja>
1387 したがって,\LuaTeX-jaプロジェクトの意見としては,上記の入力は次のように直されるべき
1388 である:
1389 %</ja>
1390 %<*zh>
1391 那么,根据我们的观点,上述输入应当校正为:
1392 %</zh>
1393 \begin{LTXexample}
1394 $f_{\text{高温}}$~%
1395 ($f_{\text{high temperature}}$).
1396 \[ y=(x-1)^2+2\quad
1397   \mathrel{\text{よって}}\quad y>0 \]
1398 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
1399 \end{LTXexample}
1400 %BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない.
1401 %<*en>
1402 We also believe that using Japanese characters as identifiers is rare,
1403 hence we don't describe how to change Japanese fonts in math mode in
1404 this chapter. For the method, please see Subsection~\ref{ssec-math}.
1405 %</en>
1406 %<*ja>
1407 また\LuaTeX-jaプロジェクトでは,和文文字が識別子として用いられることはほとんどない
1408 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
1409 記述しない.この方法については\ref{ssec-math}節を参照のこと.
1410 %</ja>
1411 %<*zh>
1412 我们也认为使用日文字符作为标识符的情况极为少见,所以我们不在此章节描述如何在数学模式下改变日文字体。
1413 关于此方法,请参见\ref{ssec-math}。
1414 %</zh>
1415
1416 \subsection{fontspec}
1417 \label{ssec-fontspec}
1418 %<*en>
1419 To coexist with the \Pkg{fontspec} package, it is needed to load
1420 \Pkg{luatexja-fontspec} package in the preamble. This additional
1421 package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
1422 package, if needed.
1423 %</en>
1424 %<*ja>
1425 \Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いるためには,
1426 \Pkg{luatexja-fontspec}パッケージをプリアンブルで読み込む必要がある.このパッケージ
1427 は必要ならば自動で\Pkg{luatexja}パッケージと\Pkg{fontspec}パッケージを読み込む.
1428 %</ja>
1429 %<*zh>
1430 为与\Pkg{fontspec}宏包共存,需要在导言区中使用\Pkg{luatexja-fontspec}宏包。
1431 这个附加宏包会自动加载\Pkg{luatexja}和\Pkg{fontspec}。
1432 %</zh>
1433
1434 %<*en>
1435 In \Pkg{luatexja-fontspec} package, the following 7~commands are defined as
1436 counterparts of original commands in the \Pkg{fontspec} package:
1437 %</en>
1438 %<*ja>
1439 \Pkg{luatexja-fontspec}パッケージでは,以下の7つのコマンドを\Pkg{fontspec}
1440 パッケージの元のコマンドに対応するものとして定義している:
1441 %</ja>
1442 %<*zh>
1443 在\Pkg{luatexja-fontspec}中,定义了如下七条命令,这些命令和\Pkg{fontspec}的相关命令对比如下:
1444 %</zh>
1445 %<*en>
1446 \begin{center}\small
1447 \begin{tabular}{ccccc}
1448 \toprule
1449 Japanese fonts
1450 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1451 alphabetic fonts
1452 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1453 \midrule
1454 Japanese fonts
1455 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1456 alphabetic fonts
1457 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1458 \bottomrule
1459 \end{tabular}
1460 \end{center}
1461 %</en>
1462 %<*ja>
1463 \begin{center}\small
1464 \begin{tabular}{cccc}
1465 \toprule
1466 和文
1467 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+\\
1468 欧文
1469 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+\\
1470 \midrule
1471 和文
1472 &\verb+\newjfontfamily+&\verb+\newjfontface+&\verb+\defaultjfontfeatures+\\
1473 欧文
1474 &\verb+\newfontfamily+&\verb+\newfontface+&\verb+\defaultfontfeatures+\\
1475 \midrule
1476 和文
1477 &\verb+\addjfontfeatures+\\
1478 欧文
1479 &\verb+\addfontfeatures+\\
1480 \bottomrule
1481 \end{tabular}
1482 \end{center}
1483 %</ja>
1484 %<*zh>
1485 \begin{center}\small
1486 \begin{tabular}{ccccc}
1487 \toprule
1488 日文字体&\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1489 西文字体&\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1490 \midrule
1491 日文字体&\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+&\\
1492 西文字体&\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+&\\
1493 \bottomrule
1494 \end{tabular}
1495 \end{center}
1496 %</zh>
1497
1498 \begin{LTXexample}
1499 \fontspec[Numbers=OldStyle]{LMSans10-Regular}
1500 \jfontspec{IPAexMincho}
1501 JIS~X~0213:2004→辻
1502
1503 \addjfontfeatures{CJKShape=JIS1990}
1504 JIS~X~0208:1990→辻
1505 \end{LTXexample}
1506
1507 %<*en>
1508 Note that there is no command named \verb+\setmonojfont+, since it is
1509 popular for Japanese fonts that nearly all Japanese glyphs have same
1510 widths.  Also note that the kerning feature is set off by default in
1511 these 7~commands, since this feature and \textbf{JAglue} will clash (see
1512 \ref{para-kern}).
1513 %</en>
1514 %<*ja>
1515 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
1516 \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
1517 ンドではKerning featureはデフォルトではoffとなっている.これはこの
1518 featureが\textbf{JAglue}と衝突するためである(\ref{para-kern}節を参照).
1519 %</ja>
1520 %<*zh>
1521 请注意并没有\verb!\setmonofont!命令,因为流行的日文字体几乎全部是等宽的。
1522 另注意,出格特性在这7个命令中默认关闭,因为此特性会与\textbf{JAglue}冲突(参见\ref{para-kern})。
1523 %</zh>
1524
1525 %<en>\subsection{Preset}
1526 %<ja>\subsection{プリセット設定}
1527 \label{ssec-preset}
1528
1529 %<*en>
1530 To use standard Japanese font settings easily, one can load \Pkg{luatexja-preset}
1531 package with several options. This package provides functions in a part of
1532 \Pkg{otf} package and a part of \Pkg{PXchfon} package by Takayuki Yato,
1533 and loads \Pkg{luatexja-fontspec} internally.
1534 %</en>
1535 %<*ja>
1536 よく使われている和文フォント設定を一行で指定できるようにしたのが
1537 \Pkg{luatexja-preset}パッケージである.このパッケージは,
1538 \Pkg{otf}パッケージの一部機能と八登崇之氏による\Pkg{PXchfon}パッケージの一部機能とを
1539 合わせたような格好をしており,内部で\Pkg{luatexja-fontspec}を読み込んでいる.
1540 %</ja>
1541
1542 %<en>\paragraph{General options}
1543 %<ja>\paragraph{一般的なオプション}
1544 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1545 \item[deluxe]
1546 %<*en>
1547 Specifying this option enables us to use \textit{mincho} with two weights (medium~and~bold),
1548 \textit{gothic} with three weights (medium,~bold and~heavy), and \textit{rounded gothic}%
1549 \footnote{Provided by \texttt{\char92mgfamily},
1550 because \textit{rounded gothic} is called \textit{maru gothic} (丸ゴシック) in Japanese.}.
1551 The heavy weight of \textit{gothic} can be used by ``changing the family'' \verb+\gtebfamily+.
1552 This is because \Pkg{fontspec} package can handle only medium (\verb+\mdseries+) and
1553 bold (\verb+\bfseries+).
1554 %</en>
1555 %<*ja>
1556 明朝体2ウェイト・ゴシック体3ウェイトと,
1557 丸ゴシック体 (\verb+\mgfamily+) を使用可能とする.
1558 ゴシック体は細字・太字・極太の3ウェイトがあるが,極太ゴシック体はファミリの切り替え (\verb+\gtebfamily+) %
1559 で実現している.\Pkg{fontspec}では通常 (\verb+\mdseries+) と太字 (\verb+\bfseries+) しか扱えないために
1560 このような中途半端な実装になっている.
1561 %</ja>
1562 \item[expert]
1563 %<*en>
1564 Use horizontal kana alternates, and define a control sequence \verb+\rubyfamily+ to use kana
1565 characters designed for ruby.
1566 %</en>
1567 %<*ja>
1568 横組専用仮名を用いる.また,\verb+\rubyfamily+ でルビ用仮名が使用可能となる.
1569 %</ja>
1570 \item[bold]
1571 %<*en>
1572 Use bold gothic as bold mincho.
1573 %</en>
1574 %<*ja>
1575 明朝の太字をゴシック体の太字とする.
1576 %</ja>
1577 \item[90jis]
1578 %<*en>
1579 Use fonts with 90JIS glyphs if possible.
1580 %</en>
1581 %<*ja>
1582 出来る限り90JISの字形を採用しているフォントを使う.
1583 %</ja>
1584 \item[jis2004]
1585 %<*en>
1586 Use fonts with JIS2004 glyphs if possible.
1587 %</en>
1588 %<*ja>
1589 出来る限りJIS2004の字形を採用しているフォントを使う.
1590 %</ja>
1591 \item[jis]
1592 %<*en>
1593 Use the JFM \texttt{jfm-jis.lua}, instead of \texttt{jfm-ujis.lua}, which is the default JFM of
1594 \LuaTeX-ja.
1595 %</en>
1596 %<*ja>
1597 用いるJFMを(JISフォントメトリック類似の)\texttt{jfm-jis.lua}にする.このオプションがない時は
1598 \LuaTeX-ja標準の\texttt{jfm-ujis.lua}が用いられる.
1599 %</ja>
1600 \end{list}
1601
1602 %<en>\paragraph{Kozuka fonts}
1603 %<ja>\paragraph{小塚フォント}
1604 %<*en>
1605 When using single weight, we adopt Kozuka~Gothic~M as \textit{gothic},
1606 because we think that Kozuka~Gothic~R looks thin.
1607 There is not `Kozuka Maru Gothic', therefore Kozuka~Gothic~H is used
1608 as a substitute for \textit{rounded gothic}.
1609 %</en>
1610 %<*ja>
1611 まず,小塚フォントを用いる設定を述べる.
1612 単ウェイト時のゴシック体は小塚ゴシックRでは細いように感じるので,
1613 小塚ゴシックMに変更している.
1614 さらに,丸ゴシック体はないので便宜上小塚ゴシックHで代用している.
1615 %</ja>
1616 \begin{center}\small
1617 \begin{tabular}{llll}
1618 \toprule
1619 &\tt kozuka4&\tt kozuka6&\tt kozuka6n\\
1620 \midrule
1621 %<*en>
1622 \bf mincho medium&Kozuka Mincho Pro R&Kozuka Mincho ProVI R&Kozuka Mincho Pr6N R\\
1623 \bf mincho bold&Kozuka Mincho Pro B&Kozuka Mincho ProVI B&Kozuka Mincho Pr6N B\\
1624 \midrule
1625 \bf gothic medium\\
1626   without \texttt{deluxe}
1627 &Kozuka Gothic Pro M&Kozuka Gothic ProVI M&Kozuka Gothic Pr6N M\\
1628   multiple weights
1629 &Kozuka Gothic Pro R&Kozuka Gothic ProVI R&Kozuka Gothic Pr6N R\\
1630 \midrule
1631 \bf gothic bold
1632 &Kozuka Gothic Pro B&Kozuka Gothic ProVI B&Kozuka Gothic Pr6N B\\
1633 \bf gothic heavy
1634 &Kozuka Gothic Pro H&Kozuka Gothic ProVI H&Kozuka Gothic Pr6N H\\
1635 (rounded gothic)
1636 &Kozuka Gothic Pro H&Kozuka Gothic ProVI H&Kozuka Gothic Pr6N H\\
1637 %</en>
1638 %<*ja>
1639 \gt 明朝体細字&小塚明朝Pro~R&小塚明朝ProVI~R&小塚明朝Pr6N~R\\
1640 \gt 明朝体太字&小塚明朝Pro~B&小塚明朝ProVI~B&小塚明朝Pr6N~B\\
1641 \midrule
1642 \gt ゴシック体細字\\
1643  単ウェイト時
1644 &小塚ゴシックPro~M&小塚ゴシックProVI~M&小塚ゴシックPr6N~M\\
1645  多ウェイト時
1646 &小塚ゴシックPro~R&小塚ゴシックProVI~R&小塚ゴシックPr6N~R\\
1647 \midrule
1648 \gt ゴシック体太字
1649 &小塚ゴシックPro~B&小塚ゴシックProVI~B&小塚ゴシックPr6N~B\\
1650 \gt ゴシック体極太
1651 &小塚ゴシックPro~H&小塚ゴシックProVI~H&小塚ゴシックPr6N~H\\
1652 \inhibitglue(丸ゴシック体)\inhibitglue
1653 &小塚ゴシックPro~H&小塚ゴシックProVI~H&小塚ゴシックPr6N~H\\
1654 %</ja>
1655 \bottomrule
1656 \end{tabular}
1657 \end{center}
1658
1659 %<en>\paragraph{Hiragino and Morisawa}
1660 %<ja>\paragraph{ヒラギノ・モリサワ}
1661 %<*en>
1662 Settings for Hiragino fonts:
1663 %</en>
1664 %<*ja>
1665 まずヒラギノフォントから:
1666 %</ja>
1667 % これらは持っているわけではないので,フォント名が
1668 % 異なっているかもしれません.確認お願いします.
1669 \begin{center}\small
1670 \begin{tabular}{lll}
1671 \toprule
1672 &\tt hiragino&\tt hiraginon\\
1673 \midrule
1674 %<*en>
1675 \bf mincho medium&
1676 Hiragino Mincho Pro W3&Hiragino Mincho Pr6N W3\\
1677 \bf mincho bold&
1678 Hiragino Mincho Pro W6&Hiragino Mincho Pr6N W6\\
1679 \bf gothic medium&
1680 Hiragino Kaku Gothic Pro W3&Hiragino Kaku Gothic ProN W3\\
1681 \bf gothic bold&
1682 Hiragino Kaku Gothic Pro W6&Hiragino Kaku Gothic ProN W6\\
1683 \bf gothic heavy&
1684 Hiragino Kaku Gothic Std W8&Hiragino Kaku Gothic StdN W8\\
1685 \bf rounded gothic&
1686 Hiragino Maru Gothic Pro W4&Hiragino Maru Gothic ProN W4\\
1687 %</en>
1688 %<*ja>
1689 \gt 明朝体細字&
1690 ヒラギノ明朝体Pro~W3&ヒラギノ明朝体Pr6N~W3\\
1691 \gt 明朝体太字&
1692 ヒラギノ明朝体Pro~W6&ヒラギノ明朝体Pr6N~W6\\
1693 \gt ゴシック体細字&
1694 ヒラギノ角ゴPro~W3&ヒラギノ角ゴProN~W3\\
1695 \gt ゴシック体太字&
1696 ヒラギノ角ゴPro~W6&ヒラギノ角ゴProN~W6\\
1697 \gt ゴシック体極太&
1698 ヒラギノ角ゴStd~W8&ヒラギノ角ゴStdN~W8\\
1699 \gt 丸ゴシック体&
1700 ヒラギノ丸ゴPro~W4&ヒラギノ丸ゴProN~W4\\
1701 %</ja>
1702 \bottomrule
1703 \end{tabular}
1704 \end{center}
1705 %<*en>
1706 Settings for Morisawa fonts:
1707 %</en>
1708 %<*ja>
1709 次はモリサワフォントを用いる設定である:
1710 %</ja>
1711 \begin{center}\small
1712 \begin{tabular}{lll}
1713 \toprule
1714 &\tt morisawa4&\tt morisawa6n\\
1715 \midrule
1716 %<*en>
1717 \bf mincho medium&
1718 Ryumin Pro L-KL&Ryumin Pr6N L-KL\\
1719 \bf mincho bold&
1720 Futo Min A101 Pro Bold&Futo Min A101 Pr6N Bold\\
1721 \bf gothic medium&
1722 Chu Gothic BBB Pro Med&Chu Gothic BBB Pr6N Med\\
1723 \bf gothic bold&
1724 Futo Go B101 Pro Bold&Futo Go B101 Pr6N Bold\\
1725 \bf gothic heavy&
1726 Midashi Go Pro MB31&Midashi Go Pr6N MB31\\
1727 \bf rounded gothic&
1728 Jun Pro 101&Jun Pr6N 101\\
1729 %</en>
1730 %<*ja>
1731 \gt 明朝体細字&
1732 リュウミンPro~L-KL&リュウミンPr6N~L-KL\\
1733 \gt 明朝体太字&
1734 太ミンA101~Pro~Bold&太ミンA101~Pr6N~Bold\\
1735 \gt ゴシック体細字&
1736 中ゴシックBBB~Pro~Med&中ゴシックBBB~Pr6N~Med\\
1737 \gt ゴシック体太字&
1738 太ゴB101~Pro~Bold&太ゴB101~Pr6N~Bold\\
1739 \gt ゴシック体極太&
1740 見出ゴPro~MB31&見出ゴPr6N~MB31\\
1741 \gt 丸ゴシック体&
1742 じゅんPro 101&じゅんPr6N 101\\
1743 %</ja>
1744 \bottomrule
1745 \end{tabular}
1746 \end{center}
1747
1748 %<en>\paragraph{Settings for single weight}
1749 %<ja>\paragraph{単ウェイト用設定}
1750 %<*en>
1751 Next, we describe settings for using only single weight.
1752 In four settings below, we use same fonts for medium and bold (and heavy) weights.
1753 (Hence \verb+\mcfamily\bfseries+ and \verb+\mcfamily\mdseries+ yields same Japanese fonts,
1754 if \texttt{deluxe} option is also specified).
1755 %</en>
1756 %<*ja>
1757 次に,単ウェイト用の設定を述べる.この4設定では「細字」「太字」の区別はない.
1758 また,丸ゴシック体はゴシック体と同じフォントを用いる.
1759 %</ja>
1760 \begin{center}\small
1761 \begin{tabular}{lllll}
1762 \toprule
1763 &\tt noembed&\tt ipa&\tt ipaex&\tt ms\\
1764 \midrule
1765 %<*en>
1766 \bf mincho&Ryumin-Light (non-embedded)
1767 &IPAMincho&IPAexMincho&MS Mincho\\
1768 \bf gothic&GothicBBB-Medium (non-embedded)
1769 &IPAGothic&IPAexGothic&MS Gothic\\
1770 %</en>
1771 %<*ja>
1772 \gt 明朝体&Ryumin-Light(非埋込)
1773 &IPA明朝&IPAex明朝&MS明朝\\
1774 \gt ゴシック体&GothicBBB-Medium(非埋込)
1775 &IPAゴシック&IPAexゴシック&MSゴシック\\
1776 %</ja>
1777 \bottomrule
1778 \end{tabular}
1779 \end{center}
1780
1781 %<en>\paragraph{Using HG fonts}
1782 %<ja>\paragraph{HGフォントの利用}
1783 %<*en>
1784 We can use HG~fonts bundled with Microsoft Office for realizing multiple weights in Japanese fonts.
1785 %</en>
1786 %<*ja>
1787 すぐ前に書いた単ウェイト用設定を,Microsoft Office等に付属するHGフォントを使って
1788 多ウェイト化した設定もある.
1789 %</ja>
1790 \begin{center}\small
1791 \begin{tabular}{llll}
1792 \toprule
1793 &\tt ipa-dx&\tt ipaex-dx&\tt ms-dx\\
1794 \midrule
1795 %<*en>
1796 \bf mincho medium
1797 &IPAMincho&IPAexMincho&MS Mincho\\\midrule
1798 \bf mincho bold&
1799 \multicolumn{3}{c}{HG Mincho E}\\\midrule
1800 \bf Gothic medium\\
1801 ~~without \texttt{deluxe}
1802 &IPAGothic&IPAexGothic&MS Gothic\\
1803 ~~with {\tt jis2004}
1804 &IPAGothic&IPAexGothic&MS Gothic\\
1805 \cmidrule(lr){1-4}
1806 ~~otherwise&
1807 \multicolumn{3}{c}{HG Gothic M}\\\midrule
1808 \bf gothic bold&
1809 \multicolumn{3}{c}{HG Gothic E}\\\midrule
1810 \bf gothic heavy&
1811 \multicolumn{3}{c}{HG Soei Kaku Gothic UB}\\\midrule
1812 \bf rounded gothic&
1813 \multicolumn{3}{c}{HG Maru Gothic PRO}\\
1814 %</en>
1815 %<*ja>
1816 \gt 明朝体細字
1817 &IPA明朝&IPAex明朝&MS明朝\\\midrule
1818 \gt 明朝体太字&
1819 \multicolumn{3}{c}{HG明朝E}\\\midrule
1820 \gt ゴシック体細字\\
1821  単ウェイト時
1822 &IPAゴシック&IPAexゴシック&MSゴシック\\
1823  {\tt jis2004}指定時
1824 &IPAゴシック&IPAexゴシック&MSゴシック\\
1825 \cmidrule(lr){1-4}
1826  それ以外の時&
1827 \multicolumn{3}{c}{HGゴシックM}\\\midrule
1828 \gt ゴシック体太字&
1829 \multicolumn{3}{c}{HGゴシックE}\\\midrule
1830 \gt ゴシック体極太&
1831 \multicolumn{3}{c}{HG創英角ゴシックUB}\\\midrule
1832 \gt 丸ゴシック体&
1833 \multicolumn{3}{c}{HG丸ゴシック体PRO}\\
1834 %</ja>
1835 \bottomrule
1836 \end{tabular}
1837 \end{center}
1838 %<*en>
1839 Note that HG~Mincho~E, HG~Gothic~E, HG Soei Kaku Gothic UB and HG Maru Gothic PRO
1840 are internally specified by:
1841 \begin{description}
1842 \item[default] by font name (\texttt{HGMinchoE}, etc.).
1843 \item[{\tt 90jis}] by filename (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}).
1844 \item[{\tt jis2004}] by filename (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}).
1845 \end{description}
1846 %</en>
1847 %<*ja>
1848 なお,HG明朝E・HGゴシックE・HG創英角ゴシックUB・HG丸ゴシック体PROの4つについては,内部で
1849 \begin{description}
1850 \item[標準] フォント名(\texttt{HGMinchoE} など)
1851 \item[{\tt 90jis}指定時] ファイル名 (%
1852 \texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf})
1853 \item[{\tt jis2004}指定時] ファイル名 (%
1854 \texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf})
1855 \end{description}
1856 として指定を行っているので注意すること.
1857 %</ja>
1858
1859
1860 %<*en>
1861 \subsection{\texttt{\char92 CID}, \texttt{\char92 UTF} and macros in \Pkg{otf} package}
1862 Under \pLaTeX, \Pkg{otf} package (developed by Shuzaburo Saito) is
1863 used for typesetting characters which is in Adobe-Japan1-6 CID but not
1864 in JIS~X~0208. Since this package is widely used, \LuaTeX-ja
1865 supports some of functions in \Pkg{otf} package.
1866 If you want to use these functions, load \Pkg{luatexja-otf} package.
1867 %</en>
1868 %<*ja>
1869 \subsection{\texttt{\char92 CID}, \texttt{\char92 UTF}と\Pkg{otf}パッケージのマクロ}
1870 \pLaTeX では,JIS~X~0208にないAdobe-Japan1-6の文字を出力するために,
1871 齋藤修三郎氏による\Pkg{otf}パッケージが用いられていた.このパッケージは
1872 広く用いられているため,\LuaTeX-jaにおいても\Pkg{otf}パッケージの機能の
1873 一部をサポートしている.これらの機能を用いるためには\Pkg{luatexja-otf}パッケージ
1874 を読み込めばよい.
1875 %</ja>
1876 %<*zh>
1877 \subsection{\Pkg{otf}包中的\texttt{\char92CID},\texttt{\char92UTF}及其他宏}
1878 \pLaTeX 下,\underline{\texttt{otf}}宏包(斋藤修三郎开发)是用来排印存在
1879 于Adobe-Japan1-6但不存在于JIS X 0208中的字符。
1880 该包已经广泛使用,\LuaTeX-ja支持部分\Pkg{otf}包中的部分功能。
1881 如果你想使用这些功能,加载\Pkg{luatexja-otf}宏包。
1882 \bgroup
1883 \fontencoding{JY3}\selectfont
1884 %</zh>
1885
1886 \begin{LTXexample}
1887 \jfontspec{KozMinPr6N-Regular.otf}
1888 森\UTF{9DD7}外と内田百\UTF{9592}とが\UTF{9AD9}島屋に行く。
1889
1890 \CID{7652}飾区の\CID{13706}野家,
1891 \CID{1481}城市,葛西駅,
1892 高崎と\CID{8705}\UTF{FA11}
1893
1894 \aj半角{はんかくカタカナ}
1895 \end{LTXexample}
1896 %<*zh>
1897 \egroup
1898 %</zh>
1899
1900 %<*ja>
1901 \Pkg{otf}パッケージでは,それぞれ次のようなオプションが存在した:
1902 \begin{description}
1903 \item[\texttt{deluxe}] 明朝体・ゴシック体各2ウェイトと,丸ゴシック体を扱えるようになる.
1904 \item[\texttt{expert}] 仮名が横組・縦組専用のものに切り替わり,ルビ用仮名も扱えるようになる.
1905 \item[\texttt{bold}] ゴシック体を標準で太いウェイトのものに設定する.
1906 \end{description}
1907 しかしこれらのオプションは\Pkg{luatexja-otf}パッケージには存在しない.
1908 \Pkg{otf}パッケージが文書中で使用する和文用TFMを自前の物に置き換えていたのに対し,
1909 \Pkg{luatexja-otf}パッケージでは,そのようなことは行わないからである.
1910
1911 これら3オプションについては,
1912 \Pkg{luatexja-preset} パッケージにプリセットを使う時に一緒に指定するか,
1913 あるいは対応する内容を\ref{ssub-chgfnt}節 (NFSS2) や
1914 \ref{ssec-fontspec}節 (\Pkg{fontspec}) の方法で手動で指定する必要がある.
1915 %</ja>
1916
1917 %<en>\section{Changing Parameters}
1918 %<ja>\section{パラメータの変更}
1919 %<zh>\section{变量更改}
1920
1921 %<*en>
1922 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
1923 most of them are not stored as internal register of \TeX, but as an
1924 original storage system in \LuaTeX-ja. Hence, to assign or acquire those
1925 parameters, you have to use commands \verb+\ltjsetparameter+ and
1926 \verb+\ltjgetparameter+.
1927 %</en>
1928 %<*ja>
1929 \LuaTeX-jaには多くのパラメータが存在する.そして\LuaTeX の仕様のために,
1930 その多くは\TeX のレジスタにではなく,\LuaTeX-ja独自の方法で保持されている.
1931 そのため,これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ を
1932 用いる必要がある.
1933 %</ja>
1934 %<*zh>
1935 \LuaTeX-ja包含大量的参数,以控制排版细节。
1936 设定这些参数需要使用命令:\verb!\ltjsetparameter!和\verb!\ltjgetparameter!命令。
1937 %</zh>
1938
1939 %<en>\subsection{Editing the range of \textbf{JAchar}s}
1940 %<ja>\subsection{\textbf{JAchar}の範囲の設定}
1941 %<zh>\subsection{\textbf{JAchar}范围设定}
1942 \label{ssec-setrange}
1943
1944 %<*en>
1945 To edit the range of \textbf{JAchar}s, you have to assign a non-zero
1946 natural number which is less than 217 to the character range first. This
1947 can be done by using \verb+\ltjdefcharrange+. For example, the
1948 next line assigns whole characters in Supplementary Ideographic Plane
1949 and the character `漢' to the range number~100.
1950 %</en>
1951 %<*ja>
1952 \textbf{JAchar}の範囲を設定するためには,まず各文字に0より大きく217より小さいindexを
1953 割り当てる必要がある.これには \verb+\ltjdefcharrange+ を用いる.
1954 例えば,次のように書くことで追加漢字面(SIP)にある全ての文字と`漢'が
1955 「100番の文字範囲」に属するように設定される.
1956 %</ja>
1957 %<*zh>
1958 在设定\textbf{JAchar}之前,需要分配一个小于217的自然数。
1959 这个可以由\verb!\ltjdefcharrange!基本语句来完成。例如,
1960 下面就分配了整个表意文字补充平面和汉字“漢”为100。
1961 %</zh>
1962 \begin{lstlisting}
1963 \ltjdefcharrange{100}{"20000-"2FFFF,`漢}
1964 \end{lstlisting}
1965 %<*en>
1966 This assignment of numbers to ranges are always global, so you should
1967 not do this in the middle of a document.
1968 %</en>
1969 %<*ja>
1970 この文字範囲の割り当ては常にグローバルであり,したがって文書の途中で
1971 この操作をするべきではない.
1972 %</ja>
1973 %<*zh>
1974 范围数的分配是全局的,故你不可在文档中使用。
1975 %</zh>
1976
1977 %<*en>
1978 If some character has been belonged to some non-zero numbered range,
1979 this will be overwritten by the new setting. For example, whole SIP
1980 belong to the range~4 in the default setting of \LuaTeX-ja, and if you
1981 specify the above line, then SIP will belong to the range~100 and be
1982 removed from the range~4.
1983 %</en>
1984 %<*ja>
1985 もし指定されたある文字がある非零番号の範囲に属していたならば,これは新しい設定で
1986 上書きされる.例えば,SIPは全て\LuaTeX-jaのデフォルトでは4番の文字範囲に
1987 属しているが,上記の指定を行えばSIPは100番に属すようになり,4番からは除かれる.
1988 %</ja>
1989 %<*zh>
1990 如果某些字符被改变为新的非零数范围,将会被新设定重写。
1991 例如,整个SIP在\LuaTeX-ja默认设定中属于范围4,如果你使用如上设定,
1992 SIP将会被设定为范围100,且从范围4种移除。
1993 %</zh>
1994
1995 %<*en>
1996 After assigning numbers to ranges, the \textsf{jacharrange} parameter can
1997 be used to customize which character range will be treated as ranges of
1998 \textbf{JAchar}s, as the following line (this is just the default
1999 setting of \LuaTeX-ja):
2000 %</en>
2001 %<*ja>
2002 文字範囲に番号を割り当てた後は,\textsf{jacharrange}パラメータが\textbf{JAchar}と
2003 して扱われる文字の範囲を設定するために用いられる.例えば,以下は\LuaTeX-jaの
2004 初期設定である:
2005 %</ja>
2006 %<*zh>
2007 分配了范围数之后,\textsf{jacharrange}参数将用于设定字符范围为\textbf{JAchar},
2008 如下(为\LuaTeX-ja默认设定):
2009 %</zh>
2010 \begin{verbatim}
2011 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
2012 \end{verbatim}
2013 %<*en>
2014 The argument to \textsf{jacharrange} parameter is a list of integer.
2015 Negative integer $-n$ in the list means that `the characters that belong to
2016 range~$n$ are treated as \textbf{ALchar}', and positive integer $+n$ means
2017 that `the characters that belong to range~$n$ are treated as \textbf{JAchar}'.
2018 %</en>
2019 %<*ja>
2020 \textsf{jacharrange}パラメータには整数のリストを与える.
2021 リスト中の負の整数$-n$は「文字範囲$n$に属する文字は\textbf{ALchar}として
2022 扱われる」ことを意味し,正の整数$+n$は\textbf{JAchar}として扱うことを意味する.
2023 %</ja>
2024 %<*zh>
2025 \textsf{jacharrange}参数的变量未整数数组。
2026 负数$-n$在数组中表示“字符范围$n$中的字符被视作\textbf{ALchar}”,
2027 正数$+n$则表示“字符范围$n$被视作\textbf{JAchar}”。
2028 %</zh>
2029
2030 %<*en>
2031 \paragraph{Default Setting}
2032 \LuaTeX-ja predefines eight character ranges for convenience. They are
2033 determined from the following data:
2034 %</en>
2035 %<*ja>
2036 \paragraph{初期設定}
2037 \LuaTeX-jaでは8つの文字範囲を設定している.これらは以下のデータに基づいて決定して
2038 いる.
2039 %</ja>
2040 %<*zh>
2041 \paragraph{默认设定}
2042 \LuaTeX-ja默认设定了8个字符范围。如下设定:
2043 %</zh>
2044 \begin{itemize}
2045 %<*en>
2046 \item Blocks in Unicode~6.0.
2047 %</en>
2048 %<*ja>
2049 \item Unicode~6.0のブロック.
2050 %</ja>
2051 %<*zh>
2052 \item Unicode~6.0区块
2053 %</zh>
2054 %<*en>
2055 \item The \texttt{Adobe-Japan1-UCS2} mapping between a CID Adobe-Japan1-6 and Unicode.
2056 %</en>
2057 %<*ja>
2058 \item \texttt{Adobe-Japan1-UCS2}によるAdobe-Japan1-6のCIDとUnicodeの間の
2059       マッピング.
2060 %</ja>
2061 %<*zh>
2062 \item 在CID Adobe-Japan1-6和Unicode之间的映射\texttt{Adobe-Japan1-UCS2}。
2063 %</zh>
2064 %<*en>
2065 \item The \Pkg{PXbase} bundle for \upTeX\ by Takayuki Yato.
2066 %</en>
2067 %<*ja>
2068 \item 八登崇之氏による\upTeX 用の\Pkg{PXbase}バンドル.
2069 %</ja>
2070 %<*zh>
2071 \item 八登崇之的\Pkg{PXbase}宏包(\upTeX 下使用)。
2072 %</zh>
2073 \end{itemize}
2074
2075 %<*en>
2076 Now we describe these eight ranges. The alphabet `J' or `A' after the
2077 number shows whether characters in the range is treated as
2078 \textbf{JAchar}s or not by default. These settings are similar to the
2079 \texttt{prefercjk} settings defined in \texttt{PXbase} bundle.
2080 %</en>
2081 %<*ja>
2082 以下ではこれら8つの文字範囲について記述する.番号のあとのアルファベット`J'と`A'
2083 はデフォルトで\textbf{JAchar}か\textbf{ALchar}かを表している.これらの設定は
2084 \texttt{PXbase}バンドルで定義されている\texttt{prefercjk}と類似のものである.
2085 %</ja>
2086 %<*zh>
2087 现在我们描述8个字符范围。在数字后的“J”和“A”表明代表\textbf{JAchar}或者未跟随默认设定。
2088 这些设定类似于\texttt{PXbase}中的\texttt{prefercjk}设定。
2089 %</zh>
2090 \begin{description}
2091 %<*en>
2092 \item[Range~8${}^{\text{J}}$] Symbols in the intersection of the upper half of ISO~8859-1
2093          (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range
2094          consists of the following characters:
2095 %</en>
2096 %<*ja>
2097 \item[範囲8${}^{\text{J}}$] ISO~8859-1の上位領域(ラテン1補助)と
2098                              JIS~X~0208の共通部分にある記号.この文字範囲は
2099                              以下の文字で構成される:
2100 %</ja>
2101 %<*zh>
2102 \item[范围8${}^\text{J}$] ISO 8859-1(Latin-1补充)的上半部和JIS X 0208(日文基本字符集)的重叠部分,包含下列字符:
2103 %</zh>
2104 \begin{multicols}{2}
2105 \begin{itemize}
2106 \def\ch#1#2{\item \char"#1\ (\texttt{U+00#1}, #2)}%"
2107 %<*en>
2108 \ch{A7}{Section Sign}
2109 \ch{A8}{Diaeresis}
2110 \ch{B0}{Degree sign}
2111 \ch{B1}{Plus-minus sign}
2112 \ch{B4}{Spacing acute}
2113 \ch{B6}{Paragraph sign}
2114 \ch{D7}{Multiplication sign}
2115 \ch{F7}{Division Sign}
2116 %</en>
2117 %<*ja>
2118 \ch{A7}{節記号}
2119 \ch{A8}{トレマ}
2120 \ch{B0}{度}
2121 \ch{B1}{正又は負符号}
2122 \ch{B4}{アキュート・アクセント}
2123 \ch{B6}{段落記号}
2124 \ch{D7}{乗算記号}
2125 \ch{F7}{除算記号}
2126 %</ja>
2127 %<*zh>
2128 \ch{A7}{分节符}
2129 \ch{A8}{分音符}
2130 \ch{B0}{温度符号}
2131 \ch{B1}{加减符号}
2132 \ch{B4}{置位尖音}
2133 \ch{B6}{段落符号}
2134 \ch{D7}{乘号}
2135 \ch{F7}{除号}
2136 %</zh>
2137 \end{itemize}
2138 \end{multicols}
2139
2140 %<*en>
2141 \item[Range~1${}^{\text{A}}$] Latin characters that some of them are included in Adobe-Japan1-6.
2142 This range consist of the following Unicode ranges, \emph{except characters in the range~8 above}:
2143 %</en>
2144 %<*ja>
2145 \item[範囲1${}^{\text{A}}$] ラテン文字.一部はAdobe-Japan1-6にも含まれている.
2146                              この範囲は以下のUnicodeのブロックから構成されている.
2147                              \textbf{ただし,範囲8は除く.}
2148 %</ja>
2149 %<*zh>
2150 \item[范围1${}^\text{A}$] 包含于Adobe-Japan1-6中的拉丁字符,此范围包含下列
2151   Unicode区域,但\textbf{不包括上述提到过的范围8}:
2152 %</zh>
2153 \begin{multicols}{2}
2154 \begin{itemize}
2155 %<*en>
2156 \item \texttt{U+0080}--\texttt{U+00FF}: Latin-1 Supplement
2157 \item \texttt{U+0100}--\texttt{U+017F}: Latin Extended-A
2158 \item \texttt{U+0180}--\texttt{U+024F}: Latin Extended-B
2159 \item \texttt{U+0250}--\texttt{U+02AF}: IPA Extensions
2160 \item \texttt{U+02B0}--\texttt{U+02FF}: Spacing Modifier Letters
2161 \item \texttt{U+0300}--\texttt{U+036F}: Combining Diacritical Marks
2162 \item \texttt{U+1E00}--\texttt{U+1EFF}: Latin Extended Additional
2163 %</en>
2164 %<*ja>
2165 \item \texttt{U+0080}--\texttt{U+00FF}: ラテン1補助
2166 \item \texttt{U+0100}--\texttt{U+017F}: ラテン文字拡張A
2167 \item \texttt{U+0180}--\texttt{U+024F}: ラテン文字拡張B
2168 \item \texttt{U+0250}--\texttt{U+02AF}: IPA拡張(国際音声記号)
2169 \item \texttt{U+02B0}--\texttt{U+02FF}: 前進を伴う修飾文字
2170 \item \texttt{U+0300}--\texttt{U+036F}: 合成可能な識別記号
2171 \item \texttt{U+1E00}--\texttt{U+1EFF}: ラテン文字拡張追加
2172 %</ja>
2173 %<*zh>
2174 \item \texttt{U+0080}--\texttt{U+00FF}: 拉丁字母补充-1
2175 \item \texttt{U+0100}--\texttt{U+017F}: 拉丁字母扩充-A
2176 \item \texttt{U+0180}--\texttt{U+024F}: 拉丁字母扩充-B
2177 \item \texttt{U+0250}--\texttt{U+02AF}: 国际音标扩充
2178 \item \texttt{U+02B0}--\texttt{U+02FF}: 进格修饰符元
2179 \item \texttt{U+0300}--\texttt{U+036F}: 组合音标附加符号
2180 \item \texttt{U+1E00}--\texttt{U+1EFF}: 拉丁字母扩充附加
2181 %</zh>
2182 \par\
2183 \end{itemize}
2184 \end{multicols}
2185 %<*en>
2186 \item[Range~2${}^{\text{J}}$] Greek and Cyrillic letters. JIS~X~0208 (hence most of Japanese
2187            fonts) has some of these characters.
2188 %</en>
2189 %<*ja>
2190 \item[範囲2${}^{\text{J}}$] ギリシャ文字とキリル文字.JIS~X~0208(したがってほとんどの
2191                              和文フォント)はこれらの文字を持つ.
2192 %</ja>
2193 %<*zh>
2194 \item[范围2${}^\text{J}$] 希腊文和西里尔字母,使用JIS X 0208的大部分日文字体包含这些字符:
2195 %</zh>
2196 \begin{multicols}{2}
2197 \begin{itemize}
2198 %<*en>
2199 \item \texttt{U+0370}--\texttt{U+03FF}: Greek and Coptic
2200 \item \texttt{U+0400}--\texttt{U+04FF}: Cyrillic
2201 \item \texttt{U+1F00}--\texttt{U+1FFF}: Greek Extended
2202 %</en>
2203 %<*ja>
2204 \item \texttt{U+0370}--\texttt{U+03FF}: ギリシア文字・コプト文字
2205 \item \texttt{U+0400}--\texttt{U+04FF}: キリル文字
2206 \item \texttt{U+1F00}--\texttt{U+1FFF}: キリル文字補助
2207 %</ja>
2208 %<*zh>
2209 \item \texttt{U+0370}--\texttt{U+03FF}: 希腊字母
2210 \item \texttt{U+0400}--\texttt{U+04FF}: 西里尔字母
2211 \item \texttt{U+1F00}--\texttt{U+1FFF}: 希腊文扩充
2212 %</zh>
2213 \\\
2214 \end{itemize}
2215 \end{multicols}
2216 %<*en>
2217 \item[Range~3${}^{\text{J}}$] Punctuations and Miscellaneous symbols. The block list is
2218            indicated in Table~\ref{table-rng3}.
2219 %</en>
2220 %<*ja>
2221 \item[範囲3${}^{\text{J}}$] 句読点と記号類.ブロックのリストは表\ref{table-rng3}%
2222                              に示してある.
2223 %</ja>
2224 %<*zh>
2225 \item[范围3${}^\text{J}$] 标点以及杂项符号,参见表\ref{table-rng3}。
2226 %</zh>
2227 \begin{table}[!tb]
2228 %<*en>
2229 \caption{Unicode blocks in predefined character range~3.}
2230 %</en>
2231 %<*ja>
2232 \caption{文字範囲3に指定されているUnicodeブロック.}
2233 %</ja>
2234 %<*zh>
2235 \caption{字符范围3定义的Unicode范围}
2236 %</zh>
2237 \label{table-rng3}
2238 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
2239 \begin{center}\small
2240 \begin{tabular}{llll}
2241 %<*en>
2242 "2000--"206F&General Punctuation&
2243 "2070--"209F&Superscripts and Subscripts\\
2244 "20A0--"20CF&Currency Symbols&
2245 "20D0--"20FF&Comb.\ Diacritical Marks for Symbols\\
2246 "2100--"214F&Letterlike Symbols&
2247 "2150--"218F&Number Forms\\
2248 "2190--"21FF&Arrows&
2249 "2200--"22FF&Mathematical Operators\\
2250 "2300--"23FF&Miscellaneous Technical&
2251 "2400--"243F&Control Pictures\\
2252 "2500--"257F&Box Drawing&
2253 "2580--"259F&Block Elements\\
2254 "25A0--"25FF&Geometric Shapes&
2255 "2600--"26FF&Miscellaneous Symbols\\
2256 "2700--"27BF&Dingbats&
2257 "2900--"297F&Supplemental Arrows-B\\
2258 "2980--"29FF&Misc.\ Mathematical Symbols-B&
2259 "2B00--"2BFF&Miscellaneous Symbols and Arrows
2260 %</en>
2261 %<*ja>
2262 "2000--"206F&一般句読点&
2263 "2070--"209F&上付き・下付き\\
2264 "20A0--"20CF&通貨記号&
2265 "20D0--"20FF&記号用ダイアクリティカルマーク(合成可能)\\
2266 "2100--"214F&文字様記号&
2267 "2150--"218F&数字に準じるもの\\
2268 "2190--"21FF&矢印&
2269 "2200--"22FF&数学記号(演算子)\\
2270 "2300--"23FF&その他の技術用記号&
2271 "2400--"243F&制御機能用記号\\
2272 "2500--"257F&罫線素片&
2273 "2580--"259F&ブロック要素\\
2274 "25A0--"25FF&幾何学模様&
2275 "2600--"26FF&その他の記号\\
2276 "2700--"27BF&装飾記号&
2277 "2900--"297F&補助矢印B\\
2278 "2980--"29FF&その他の数学記号B&
2279 "2B00--"2BFF&その他の記号及び矢印
2280 %</ja>
2281 %<*zh>
2282 "2000--"206F&一般标点符号&
2283 "2070--"209F&上标及下标\\
2284 "20A0--"20CF&货币符号&
2285 "20D0--"20FF& 符号用组合附加符号\\
2286 "2100--"214F&类字母符号&
2287 "2150--"218F&数字形式\\
2288 "2190--"21FF&箭头符号&
2289 "2200--"22FF&数学运算符号\\
2290 "2300--"23FF&杂项技术符号&
2291 "2400--"243F&控制图像\\
2292 "2500--"257F&制表符&
2293 "2580--"259F&区块元素\\
2294 "25A0--"25FF&几何形状&
2295 "2600--"26FF&杂项符号\\
2296 "2700--"27BF&什锦符号&
2297 "2900--"297F&补充性箭头-B\\
2298 "2980--"29FF&混合数学符号-B&
2299 "2B00--"2BFF&杂项符号和箭头符号
2300 %</zh>
2301 \end{tabular}
2302 \end{center}
2303 \end{table}
2304 %<*en>
2305 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
2306            of almost all Unicode blocks which are not in other
2307            predefined ranges. Hence, instead of showing the block list,
2308            we put the definition of this range itself:
2309 %</en>
2310 %<*ja>
2311 \item[範囲4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
2312                              この範囲は他の範囲にないほとんど全てのUnicodeブロック
2313                              で構成されている.したがって,ブロックのリストを示す
2314                              代わりに,範囲の定義そのものを示す:
2315 %</ja>
2316 %<*zh>
2317 \item[范围4${}^\text{A}$] 通常情况下不包含于日文字体的部分。本范围包含有其他
2318 范围尚未涵盖部分。故,我们直接给出定义:
2319 %</zh>
2320 \begin{lstlisting}
2321 \ltjdefcharrange{4}{%
2322    "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
2323   "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F,
2324   "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF, "E000-"F8FF} % non-Japanese
2325 \end{lstlisting}
2326 %<*en>
2327 \item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
2328 %</en>
2329 %<*ja>
2330 \item[範囲5${}^{\text{A}}$] 代用符号と補助私用領域.
2331 %</ja>
2332 %<*zh>
2333 \item[范围5${}^\text{A}$] 代替以及补充私有使用区域。
2334 %</zh>
2335 %<*en>
2336 \item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
2337 %</en>
2338 %<*ja>
2339 \item[範囲6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは
2340                              表\ref{table-rng6}に示す.
2341 %</ja>
2342 %<*zh>
2343 \item[范围6${}^\text{J}$] 日文字符。
2344 %</zh>
2345 \begin{table}[!tb]
2346 %<*en>
2347 \caption{Unicode blocks in predefined character range~6.}
2348 %</en>
2349 %<*ja>
2350 \caption{文字範囲6に指定されているUnicodeブロック.}
2351 %</ja>
2352 %<*zh>
2353 \caption{字符范围6定义的Unicode范围}
2354 %</zh>
2355 \label{table-rng6}
2356 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
2357 \begin{center}\small
2358 \begin{tabular}{llll}
2359 %<*en>
2360 "2460--"24FF&Enclosed Alphanumerics&
2361 "2E80--"2EFF&CJK Radicals Supplement\\
2362 "3000--"303F&CJK Symbols and Punctuation&
2363 "3040--"309F&Hiragana\\
2364 "30A0--"30FF&Katakana&
2365 "3190--"319F&Kanbun\\
2366 "31F0--"31FF&Katakana Phonetic Extensions&
2367 "3200--"32FF&Enclosed CJK Letters and Months\\
2368 "3300--"33FF&CJK Compatibility&
2369 "3400--"4DBF&CJK Unified Ideographs Extension A\\
2370 "4E00--"9FFF&CJK Unified Ideographs&
2371 "F900--"FAFF&CJK Compatibility Ideographs\\
2372 "FE10--"FE1F&Vertical Forms&
2373 "FE30--"FE4F&CJK Compatibility Forms\\
2374 "FE50--"FE6F&Small Form Variants&
2375 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)
2376 %</en>
2377 %<*ja>
2378 "2460--"24FF&囲み英数字&
2379 "2E80--"2EFF&CJK部首補助\\
2380 "3000--"303F&CJKの記号及び句読点&
2381 "3040--"309F&平仮名\\
2382 "30A0--"30FF&片仮名&
2383 "3190--"319F&漢文用記号(返り点)\\
2384 "31F0--"31FF&片仮名拡張&
2385 "3200--"32FF&囲みCJK文字・月\\
2386 "3300--"33FF&CJK互換用文字&
2387 "3400--"4DBF&CJK統合漢字拡張A\\
2388 "4E00--"9FFF&CJK統合漢字&
2389 "F900--"FAFF&CJK互換漢字\\
2390 "FE10--"FE1F&縦書き形&
2391 "FE30--"FE4F&CJK互換形\\
2392 "FE50--"FE6F&小字形&
2393 "{20}000--"{2F}FFF&(追加漢字面)
2394 %</ja>
2395 %<*zh>
2396 "2460--"24FF&圈状字母数字&
2397 "2E80--"2EFF&CJK部首补充\\
2398 "3000--"303F&CJK标点符号&
2399 "3040--"309F&平假名\\
2400 "30A0--"30FF&片假名&
2401 "3190--"319F&汉文标注号\\
2402 "31F0--"31FF&片假名音标补充&
2403 "3200--"32FF&圈状CJK字母及月份\\
2404 "3300--"33FF&CJK兼容&
2405 "3400--"4DBF&CJK统一表意文字扩充A\\
2406 "4E00--"9FFF&CJK统一表意文字&
2407 "F900--"FAFF&CJK兼容表意文字\\
2408 "FE10--"FE1F&直行标点&
2409 "FE30--"FE4F&CJK兼容形式\\
2410 "FE50--"FE6F&小写变体&
2411 "{20}000--"{2F}FFF&(补充字符)
2412 %</zh>
2413 \end{tabular}
2414 \end{center}
2415 \end{table}
2416 %<*en>
2417 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in  Adobe-Japan1-6.
2418 The block list is indicated in Table~\ref{table-rng7}.
2419 %</en>
2420 %<*ja>
2421 \item[範囲7${}^{\text{J}}$] CJK言語で用いられる文字のうち,Adobe-Japan1-6に
2422                             含まれていないもの.
2423                             ブロックのリストは表\ref{table-rng7}に示す.
2424 %</ja>
2425 %<*zh>
2426 \item[范围7${}^\text{J}$] 不包含于Adobe-Japan1-6的CJK字符,参见表\ref{table-rng7}。
2427 %</zh>
2428 \begin{table}[!tb]
2429 %<*en>
2430 \caption{Unicode blocks in predefined character range~7.}
2431 %</en>
2432 %<*ja>
2433 \caption{文字範囲7に指定されているUnicodeブロック.}
2434 %</ja>
2435 %<*zh>
2436 \caption{字符范围7定义的Unicode范围}
2437 %</zh>
2438 \label{table-rng7}
2439 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
2440 \begin{center}\small
2441 \begin{tabular}{llll}
2442 %<*en>
2443 "1100--"11FF&Hangul Jamo&
2444 "2F00--"2FDF&Kangxi Radicals\\
2445 "2FF0--"2FFF&Ideographic Description Characters&
2446 "3100--"312F&Bopomofo\\
2447 "3130--"318F&Hangul Compatibility Jamo&
2448 "31A0--"31BF&Bopomofo Extended\\
2449 "31C0--"31EF&CJK Strokes&
2450 "A000--"A48F&Yi Syllables\\
2451 "A490--"A4CF&Yi Radicals&
2452 "A830--"A83F&Common Indic Number Forms\\
2453 "AC00--"D7AF&Hangul Syllables&
2454 "D7B0--"D7FF&Hangul Jamo Extended-B
2455 %</en>
2456 %<*ja>
2457 "1100--"11FF&ハングル字母&
2458 "2F00--"2FDF&康熙部首\\
2459 "2FF0--"2FFF&漢字構成記述文字&
2460 "3100--"312F&注音字母 (注音符号)\\
2461 "3130--"318F&ハングル互換字母&
2462 "31A0--"31BF&注音字母拡張\\
2463 "31C0--"31EF&CJKの筆画&
2464 "A000--"A48F&イ文字\\
2465 "A490--"A4CF&イ文字部首&
2466 "A830--"A83F&共通インド数字に準じるもの\\
2467 "AC00--"D7AF&ハングル音節文字&
2468 "D7B0--"D7FF&ハングル字母拡張B
2469 %</ja>
2470 %<*zh>
2471 "1100--"11FF&谚文字母&
2472 "2F00--"2FDF&康熙部首\\
2473 "2FF0--"2FFF&汉字结构描述字符&
2474 "3100--"312F&注音字母\\
2475 "3130--"318F&谚文兼容字母&
2476 "31A0--"31BF&注音字母扩充\\
2477 "31C0--"31EF&CJK笔划&
2478 "A000--"A48F&彝文音节\\
2479 "A490--"A4CF&彝文字母&
2480 "A830--"A83F&一般印度数字\\
2481 "AC00--"D7AF&谚文音节&
2482 "D7B0--"D7FF&谚文字母扩充-B
2483 %</zh>
2484 \end{tabular}
2485 \end{center}
2486 \end{table}
2487 \end{description}
2488
2489
2490 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
2491 %<ja>\subsection{\Param{kanjiskip}と\Param{xkanjiskip}}
2492 %<zh>\subsection{\Param{kanjiskip}和\Param{xkanjiskip}}
2493 \label{subs-kskip}
2494
2495 %<*en>
2496 \textbf{JAglue} is divided into the following three categories:
2497 %</en>
2498 %<*ja>
2499 \textbf{JAglue}は以下の3つのカテゴリに分類される:
2500 %</ja>
2501 %<*zh>
2502 \textbf{JAglue}分为以下三个范畴:
2503 %</zh>
2504 \begin{itemize}
2505 %<*en>
2506 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
2507       around a Japanese character, this glue will not be inserted at the
2508       place.
2509 %</en>
2510 %<*ja>
2511 \item JFMで指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
2512       発行されていれば,このグルーは挿入されない.
2513 %</ja>
2514 %<*zh>
2515 \item JFM设定的胶或出格值。如果在一个日文字符附近使用\verb!\inhibitglue!,则胶便不会插入。
2516 %</zh>
2517 %<*en>
2518 \item The default glue which inserted between two \textbf{JAchar}s (\Param{%
2519       kanjiskip}).
2520 %</en>
2521 %<*ja>
2522 \item デフォルトで2つの\textbf{JAchar}の間に挿入されるグルー(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}).
2523 %</ja>
2524 %<*zh>
2525 \item 两个\textbf{JAchar}之间默认插入的胶(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})。
2526 %</zh>
2527 %<*en>
2528 \item The default glue which inserted between a \textbf{JAchar} and an
2529       \textbf{ALchar} (\Param{\hyperlink{fld:xks}{xkanjiskip}}).
2530 %</en>
2531 %<*ja>
2532 \item デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルー(\Param{\hyperlink{fld:xks}{xkanjiskip}}).
2533 %</ja>
2534 %<*zh>
2535 \item \textbf{JAchar}和\textbf{ALchar}之间默认插入的胶(\Param{\hyperlink{fld:xks}{xkanjiskip}})。
2536 %</zh>
2537 \end{itemize}
2538 %<*en>
2539 The value (a skip) of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or \Param{\hyperlink{fld:xks}{xkanjiskip}} can be
2540 changed as the following.
2541 %</en>
2542 %<*ja>
2543 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や\Param{\hyperlink{fld:xks}{xkanjiskip}}の値は以下のようにして変更可能である.
2544 %</ja>
2545 %<*zh>
2546 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}和\Param{\hyperlink{fld:xks}{xkanjiskip}}的设定如下所示:
2547 %</zh>
2548 \begin{lstlisting}
2549 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
2550                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
2551 \end{lstlisting}
2552
2553 %<*en>
2554 It may occur that JFM contains the data of `ideal width of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}'
2555 and/or `ideal width of \Param{\hyperlink{fld:xks}{xkanjiskip}}'.
2556 To use these data from JFM, set the value of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or
2557 \Param{\hyperlink{fld:xks}{xkanjiskip}} to \verb+\maxdimen+.
2558 %</en>
2559 %<*ja>
2560 JFMは「望ましい\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値」や「望ましい\Param{\hyperlink{fld:xks}{xkanjiskip}}の値」を
2561 持っていることがある.
2562 これらのデータを使うためには,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や\Param{\hyperlink{fld:xks}{xkanjiskip}}の
2563 値を \verb+\maxdimen+ の値に設定すればよい.
2564 %</ja>
2565 %<*zh>
2566 当JFM包含“\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}理想宽度”和/或“\Param{\hyperlink{fld:xks}{xkanjiskip}}理想宽度”数据时,
2567 上述设定产生作用。如果想用JFM中的数据,请设定\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}或\textsf{xkanjiskip}为\verb!\maxdimen!。
2568 %</zh>
2569
2570 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
2571 %<ja>\subsection{\Param{xkanjiskip} の挿入設定}
2572 %<zh>\subsection{\Param{xkanjiskip}插入设定}
2573
2574 %<*en>
2575 It is not desirable that \Param{\hyperlink{fld:xks}{xkanjiskip}} is inserted into every
2576 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
2577 \Param{\hyperlink{fld:xks}{xkanjiskip}} should not be inserted after opening parenthesis
2578 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
2579 \LuaTeX-ja can control whether \Param{\hyperlink{fld:xks}{xkanjiskip}} can be inserted
2580 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
2581 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
2582 %</en>
2583 %<*ja>
2584 \Param{\hyperlink{fld:xks}{xkanjiskip}}がすべての\textbf{JAchar}と\textbf{ALchar}の境界に
2585 挿入されるのは望ましいことではない.例えば,\Param{\hyperlink{fld:xks}{xkanjiskip}}は開き括弧の
2586 後には挿入されるべきではない(`(あ'と`(\hskip\ltjgetparameter{xkanjiskip}あ'を
2587 比べてみよ).
2588 \LuaTeX-jaでは\Param{\hyperlink{fld:xks}{xkanjiskip}}をある文字の前/後に挿入するかどうかを,
2589 \textbf{JAchar}に対しては\Param{jaxspmode}を,\textbf{ALchar}に対しては
2590 \Param{alxspmode}をそれぞれ変えることで制御することができる.
2591 %</ja>
2592 %<*zh>
2593 并不是在所有的\textbf{JAchar}和\textbf{ALchar}周围插入\textsf{xkanjiskip}都是合适的。
2594 比如,在开标点之后插入\Param{\hyperlink{fld:xks}{xkanjiskip}}并不合适[如,比较“(あ”和“(\hskip\ltjgetparameter{xkanjiskip}あ”]。
2595 \LuaTeX-ja可以通过设定\textbf{JAchar}的\Param{jaxspmode}以及\textbf{ALchar}的\Param{alxspmode}来控制
2596 \Param{\hyperlink{fld:xks}{xkanjiskip}}在字符前后的插入。
2597 %</zh>
2598 \begin{LTXexample}
2599 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
2600 pあq い!う
2601 \end{LTXexample}
2602
2603 %<*en>
2604 The second argument \texttt{preonly} means `the insertion of
2605 \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before this character, but not after'.
2606 the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{
2607 inhibit}.
2608 %</en>
2609 %<*ja>
2610 2つ目の引数の \texttt{preonly}は「\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入はこの文字の
2611 前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は
2612 \texttt{postonly}, \texttt{allow}, \texttt{inhibit}である.
2613 %</ja>
2614 %<*zh>
2615 第二个参数\textsf{preonly}表示的含义为“允许在该字符前插入\textsf{xkanjiskip},但不允许在该字符之后插入”。
2616 其他参数还有\textsf{postonly},\textsf{allow}和\textsf{inhibit}。
2617 %</zh>
2618
2619 %<*en>
2620 \Param{jaxspmode} and \Param{alxspmode} use a same table to store the parameters
2621 on the current version. Therefore, line 1 in the code above can be rewritten
2622 as follows:
2623 %</en>
2624 %<*ja>
2625 なお,現行の
2626 仕様では,\Param{jaxspmode}, \Param{alxspmode}はテーブルを共有しており,
2627 上のコードの1行目を次のように変えても同じことになる:
2628 %</ja>
2629 %<*zh>
2630 当前版本的\Param{jaxspmode}和\Param{alxspmode}使用相同的的表保存参数。
2631 因此,上一行可被写作:
2632 %</zh>
2633 \begin{verbatim}
2634 \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
2635 \end{verbatim}
2636 %<*en>
2637 One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}).
2638 %</en>
2639 %<*ja>
2640 また,これら2パラメータには数値で値を指定することもできる(\ref{ssec-param}節を参照).
2641 %</ja>
2642 %<*zh>
2643 你也可以使用数字来定义两个参数(参见\ref{ssec-param})。
2644 %</zh>
2645
2646 %<*en>
2647 If you want to enable/disable all insertions of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} and
2648 \Param{\hyperlink{fld:xks}{xkanjiskip}}, set \Param{autospacing} and \Param{autoxspacing}
2649 parameters to \texttt{true}/\texttt{false}, respectively.
2650 %</en>
2651 %<*ja>
2652 もし全ての\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入を有効化/無効化
2653 したければ,それぞれ\Param{autospacing}と\Param{autoxspacing}を
2654 \texttt{true}/\texttt{false}に設定すればよい.
2655 %</ja>
2656 %<*zh>
2657 如果你想要启用/屏蔽所有的\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}和\Param{\hyperlink{fld:xks}{xkanjiskip}}插入,设定
2658 \Param{autospacing}和\Param{autoxspcing}为\texttt{ture}/\texttt{false}即可。
2659 %</zh>
2660
2661 %<en>\subsection{Shifting Baseline}
2662 %<ja>\subsection{ベースラインの移動}
2663 %<zh>\subsection{基线浮动}
2664 %<*en>
2665 To make a match between a Japanese font and an alphabetic font, sometimes
2666 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
2667 by setting \verb+\ybaselineshift+ to a non-zero length (the
2668 baseline of alphabetic fonts is shifted below). However, for documents
2669 whose main language is not Japanese, it is good to shift the baseline of
2670 Japanese fonts, but not that of alphabetic fonts.
2671 Because of this, \LuaTeX-ja can independently set the shifting amount
2672 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
2673 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
2674 parameter).
2675 %</en>
2676 %<*ja>
2677 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
2678 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで
2679 なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない
2680 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
2681 このため,\LuaTeX-jaでは欧文フォントのベースラインのシフト量
2682 (\Param{yalbaselineshift}パラメータ)と和文フォントのベースラインのシフト量
2683 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
2684 %</ja>
2685 %<*zh>
2686 为了确保日文字体和西文字体能够对其,有时需要浮动其中一者的基线。
2687 在\pTeX 中,此项设定由设定\verb!\yabaselineshift!为非零长度(西文字体基线应向下浮动)。
2688 不过,如果文档的中主要语言不是日文,那么最好上浮日文字体的基线,西文字体不变。
2689 如上所述,\LuaTeX-ja可以独立设定西文字体的基线(\Param{yabaselineshift}参数)和日文字体的基线(\Param{yjabaselineshift}参数)。
2690 %</zh>
2691
2692 \begin{LTXexample}
2693 \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
2694 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
2695 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
2696 \end{LTXexample}
2697 %<*en>
2698 Here the horizontal line in above is the baseline of a line.
2699 %</en>
2700 %<*ja>
2701 上の例において引かれている水平線がベースラインである.
2702 %</ja>
2703 %<*zh>
2704 上述水平线为此行基线。
2705 %</zh>
2706
2707 %<*en>
2708 There is an interesting side-effect: characters in different size can be
2709 vertically aligned center in a line, by setting two parameters appropriately.
2710 The following is an example (beware the value is not well tuned):
2711 %</en>
2712 %<*ja>
2713 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
2714 異なる文字を中心線に揃えることができるのだ.
2715 以下は一つの例である(値はあまり調整されていないことに注意):
2716 %</ja>
2717 %<*zh>
2718 这里还有一个有趣的副作用:不同大小的字符可以通过适当调整这两个参数而在一行中垂直居中。
2719 下面是一个例子(注意,参数值并没有刻意调整):
2720 %</zh>
2721 \begin{LTXexample}
2722 xyz漢字
2723 {\scriptsize
2724   \ltjsetparameter{yjabaselineshift=-1pt,
2725     yalbaselineshift=-1pt}
2726   XYZひらがな
2727 }abcかな
2728 \end{LTXexample}
2729
2730
2731 %<en>\part{Reference}
2732 %<ja>\part{リファレンス}
2733 %<zh>\part{参考指南}
2734 \label{part-ref}
2735 %<en>\section{Font Metric and Japanese Font}
2736 %<ja>\section{フォントメトリックと和文フォント}
2737 %<zh>\section{字体测度和日文字体}
2738 %<en>\subsection{\texttt{\char92jfont}}
2739 %<ja>\subsection{\texttt{\char92jfont} 命令}
2740 %<zh>\subsection{\texttt{\char92jfont}基本语句}
2741 \label{ssec-jfont}
2742
2743 %<*en>
2744 To load a font as a Japanese font, you must use the
2745 \verb+\jfont+ instead of~\verb+\font+, while
2746 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
2747 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
2748 so TrueType/OpenType fonts with features can be used for Japanese fonts:
2749 %</en>
2750 %<*ja>
2751 フォントを和文フォントとして読み込むためには,\verb+\jfont+ を
2752 \verb+\font+ プリミティブの代わりに用いる.
2753 \verb+\jfont+ の文法は \verb+\font+ と同じである.
2754 \LuaTeX-jaは\Pkg{luaotfload}パッケージを自動的に読み込むので,
2755 TrueType/OpenTypeフォントにfeatureを指定したものを和文フォントとして用いる
2756 ことができる:
2757 %</ja>
2758 %<*zh>
2759 为了加载日文字体,需要使用\verb!\jfont!基本语句替代\verb!\font!,前者支持后者所有相同句法。
2760 \LuaTeX-ja自动加载\Pkg{luaotfload}宏包,故TrueType/OpenType字体的特性可以使用于日文字体:
2761 %</zh>
2762 \begin{LTXexample}
2763 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
2764   +trad;-kern;jfm=ujis} at 14pt
2765 \tradgt{}当/体/医/区
2766 \end{LTXexample}
2767
2768 %<*en>
2769 Note that the defined control sequence
2770 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
2771 \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+
2772 causes a error.  We denote control sequences which are defined in
2773 \verb+\jfont+ by <jfont\_cs>.
2774 %</en>
2775 %<*ja>
2776 なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+)
2777 は\textit{font\_def}トークンではないので,\verb+\fontname\tradgt+ のような
2778 入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された
2779 コントロールシーケンスを<jfont\_cs>で表す.
2780 %</ja>
2781 %<*zh>
2782 注意定义的控制序列(上例中的\verb!\tradgt!)使用的\verb!\jfont!并不是一个\textit{font\_def}标记,
2783 故类似\verb!\fontname\tradgt!输入会引起错误。
2784 我们将定义\verb!\jfont!采用<jfont\_cs>。
2785 %</zh>
2786
2787 \paragraph{JFM}
2788 %<*en>
2789 As noted in Introduction, a JFM has measurements of characters and
2790 glues/kerns that are automatically inserted for Japanese
2791 typesetting. The structure of JFM will be described in the next
2792 subsection. At the calling of \verb+\jfont+, you must specify
2793 which JFM will be used for this font by the following keys:
2794 %</en>
2795 %<*ja>
2796 「はじめに」の節で述べたように,JFMは文字と和文組版で自動的に挿入される
2797 グルー/カーンの寸法情報を持っている.JFMの構造は次の小節で述べる.
2798 \verb+\jfont+ 命令の呼び出しの際には,どのJFMを用いるのかを以下のキーで
2799 指定する必要がある:
2800 %</ja>
2801 %<*zh>
2802 在引言中已提及此项,所谓JFM是字符亮度和日文排版中自动插入的胶/出格。
2803 JFM的结构将在下节进行描述。在使用\verb!\jfont!基本语句时,必须设定JFM如下两个键:
2804 %</zh>
2805
2806 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2807 \item[jfm=<name>]
2808 %<*en>
2809 Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
2810 a file named \texttt{jfm-<name>.lua}.
2811
2812 The following JFMs are shipped with \LuaTeX-ja:
2813 %</en>
2814 %<*ja>
2815 JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
2816 \texttt{jfm-<name>.lua}を読み込む.
2817
2818 以下のJFMが\LuaTeX-jaには同梱されている:
2819 %</ja>
2820 %<*zh>
2821 设定JFM名称。设定的JFM如未加载,\LuaTeX-ja会搜寻并加载一个命名为\texttt{jfm-}<\textit{name}>\texttt{.lua}的文件。
2822
2823 \LuaTeX-ja提供如下JFM:
2824 %</zh>
2825 \begin{description}
2826 %<*en>
2827 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
2828   based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
2829   is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM.
2830 %</en>
2831 %<*ja>
2832 \item[\tt jfm-ujis.lua] \LuaTeX-jaの標準JFMである.このJFMは\upTeX で
2833   用いられるUTF/OTFパッケージ用の和文用TFMである \verb+upnmlminr-h.tfm+ を
2834   元にしている.\Pkg{luatexja-otf}パッケージを使うときはこのJFMを指定するべきである.
2835 %</ja>
2836 %<*zh>
2837 \item[\tt jfm-ujis.lua] \LuaTeX-ja标准JFM。次JFM基于\upTeX 使用的UTF/OTF宏包的\verb!upnmlminr-h.tfm!。
2838 如果你使用\Pkg{luatexja-otf}宏包,你将会用到此JFM。
2839 %</zh>
2840 %<*en>
2841 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font
2842   metric' which is widely used in \pTeX. A major difference of
2843   \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
2844   most characters under \texttt{jfm-ujis.lua} are square-shaped,
2845   while that under \texttt{jfm-jis.lua} are horizontal
2846   rectangles.
2847 %</en>
2848 %<*ja>
2849 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JISフォントメトリック」
2850   \verb+jis.tfm+ に相当するJFMである.\texttt{jfm-ujis.lua}とこの
2851   \texttt{jfm-jis.lua}の主な違いは,\texttt{jfm-ujis.lua}ではほとんどの文字が
2852   正方形状であるのに対し,\texttt{jfm-jis.lua}では横長の長方形状である.
2853 %</ja>
2854 %<*zh>
2855 \item[\tt jfm-jis.lua] 相当于\pTeX 使用的\verb!jis.tfm!(“JIS font metric”)。
2856   \texttt{jfm-ujis.lua}和\texttt{jfm-jis.lua}主要区别是:
2857   \texttt{jfm-ujis.lua}下的大部分字符是方形,
2858   \texttt{jfm-jis.lua}下则为长方形。
2859 %</zh>
2860 %<*en>
2861 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
2862   of the default Japanese font metric shipped with \pTeX. There
2863   are notable difference between this JFM and other 2~JFMs, as
2864   shown in Table~\ref{tab-difjfm}.
2865 %</en>
2866 %<*ja>
2867 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文用TFM
2868   である \verb+min10.tfm+ に相当するJFMである.このJFMと他の2つのJFMの間には
2869   表\ref{tab-difjfm}に示すような特筆すべき違いがある.
2870 %</ja>
2871 %<*zh>
2872 \item[\tt jfm-min.lua] 相当于\pTeX 中默认的\verb!min10.tfm!。
2873   这个JFM与其他2个JFM的区别如表\ref{tab-difjfm}所示。
2874 %</zh>
2875 \end{description}
2876
2877 \item[jfmvar=<string>] Sometimes there is a need that \ldots.
2878 \end{list}
2879
2880 \begin{table}[t]
2881 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
2882 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
2883 %<zh>\caption{\LuaTeX-ja下不同JFM表现}
2884 \label{tab-difjfm}
2885 \ltjsetparameter{jacharrange={+3}}
2886 \begin{center}\small
2887 \def\r#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
2888 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
2889 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
2890 \vrule height 0pt depth \dp0}}
2891 \def\s#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
2892 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
2893 \def\t#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 19.24432pt \g
2894 \setbox0=\hbox{漢}%
2895 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
2896 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
2897 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2898 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2899 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
2900 \begin{tabular}{rccc}
2901 \toprule
2902 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
2903 \midrule
2904 %<en>Example~1\cite{min10}
2905 %<ja>例1\cite{min10}
2906 %<zh>例1\cite{min10}
2907 &\r{ujis}&\r{jis}&\r{min}\\
2908 %<en>Example~2
2909 %<ja>例2
2910 %<zh>例2
2911 &\s{ujis}&\s{jis}&\s{min}\\
2912 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
2913 \bottomrule
2914 \end{tabular}
2915 \end{center}
2916 \ltjsetparameter{jacharrange={-3}}
2917 \end{table}
2918
2919 %<en>\paragraph{Note: kern feature}
2920 %<ja>\paragraph{注意:kern feature}
2921 %<zh>\paragraph{注意:kern feature}
2922 \label{para-kern}
2923 %<*en>
2924 Some fonts have information for inter-glyph spacing. However, this
2925 information is not well-compatible with \LuaTeX-ja.  More concretely,
2926 this kerning space from this information are inserted \emph{before} the
2927 insertion process of \textbf{JAglue}, and this causes incorrect spacing
2928 between two characters when both a glue/kern from the data in the font
2929 and it from JFM are present.
2930 %</en>
2931 %<*ja>
2932 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
2933 この情報は\LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
2934 されるカーニングスペースは\textbf{JAglue}の挿入過程の\textbf{前に}挿入され,
2935 JFMに基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
2936 なる.
2937 %</ja>
2938 %<*zh>
2939 一些字体具有内部字形间距信息。但是,这些信息在\LuaTeX-ja下并不良好兼容。
2940 仔细些说,出格间距是在\textbf{JAglue}插入\textbf{之前}而先行插入的,
2941 这就造成了字体数据中和JFM中的胶/出格在两个字符间插入出错。
2942 %</zh>
2943 \begin{itemize}
2944 %<*en>
2945 \item You should specify \texttt{-kern} in
2946   \verb+jfont+ when you want to use other font features,
2947   such as \texttt{script=...}\,.
2948 %</en>
2949 %<*ja>
2950 \item  \texttt{script=...}といったfeatureを使いたい場合には,\verb+\jfont+
2951   に\texttt{-kern}を指定するべきである.
2952 %</ja>
2953 %<*zh>
2954 \item 当你想使用其他字体特性如\texttt{script=...}的时候,可以在\verb!jfont!基本语句中设置\texttt{-kern}
2955 %</zh>
2956 %<*en>
2957 \item If you want to use Japanese fonts in proportional width, and use
2958       information from this font, use \texttt{jfm-prop.lua} for its JFM, and\ldots.
2959 %</en>
2960 %<*ja>
2961 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
2962   ならば,\texttt{jfm-prop.lua}をJFMとして指定し,……
2963 %</ja>
2964 %<*zh>
2965 \item 如果你想使用比例宽度的日文字体,并且使用此字体信息,使用\texttt{jfm-prop.lua}为其JFM,……
2966 %</zh>
2967 TODO: kanjiskip?
2968 \end{itemize}
2969
2970
2971 %<en>\subsection{Prefix \texttt{psft}}
2972 %<ja>\subsection{\texttt{psft}プリフィックス}
2973 %<zh>\subsection{\texttt{psft}前缀}
2974 \label{ssec-psft}
2975 %<*en>
2976 Besides `\texttt{file:}'\ and `\texttt{name:}'\ prefixes, one can use `\texttt{psft:}'\
2977 prefix in \verb+\jfont+ (and~\verb+\font+),
2978 to specify a `name-only' Japanese font which
2979 will not be embedded to PDF. Typical use of this prefix is to specify
2980 the `standard' Japanese fonts, namely, `Ryumin-Light' and
2981 `GothicBBB-Medium'.
2982 \emph{You should not specify any font features, such as `{\tt +jp90}', 
2983 in the definition of `name-only' fonts using this `{\tt psft:}'\ prefix.}
2984 %</en>
2985 %<*ja>
2986 \texttt{file:} と \texttt{name:} のプリフィックスに加えて,
2987 \verb+\jfont+(と \verb+\font+ プリミティブ)では
2988 \texttt{psft:}プリフィックスを用いることができる.
2989 このプリフィックスを用いることで,PDFには埋め込まれない「名前だけの」
2990 和文フォントを指定することができる.「標準的な」和文フォント,
2991 つまり`Ryumin-Light'と`GothicBBB-Medium'の指定でこのプリフィックスが使われる.
2992 \textbf{非埋込フォントをPDFに使用すると,実際にどのようなフォントが表示に用いられるか予測できない.
2993 そのため,本プリフィックス指定時には,\texttt{+jp90} などのfont featureは指定すべきでない.}
2994 %</ja>
2995 %<*zh>
2996 除使用\texttt{file:}和\texttt{name:}外,我们还可以在\verb!\jfont!(以及\verb!\font!)
2997 中使用\texttt{psft:}来设定一个“名义上”的并不嵌入PDF中的日文字体。
2998 此前缀的典型使用是定义“标准”日文字体,即“Ryumin-Light”和“GothicBBB-Medium”。
2999 %</zh>
3000
3001 %<*zh>
3002 \paragraph{\texttt{cid}键} 
3003 默认使用\texttt{psft:}前缀定义的字体是为Adobe-Japan1-6 CID字体。
3004 也可以使用\texttt{cid}键来使用其他的CID字体,如中文和韩文。
3005 %</zh>
3006 %<en>\paragraph{\texttt{cid} key}
3007 %<ja>\paragraph{\texttt{cid}キー}
3008 \label{para-cid}
3009
3010 %<*en>
3011 The default font defined by using \texttt{psft:} prefix is for Japanese typesetting;
3012 it is Adobe-Japan1-6 CID-keyed font.
3013 One can specify \texttt{cid} key to use other CID-keyed non-embedded fonts
3014 for Chinese or Korean typesetting.
3015 \begin{lstlisting}[numbers=left]
3016 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % Japanese
3017 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % default value is Adobe-Japan1-6
3018 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % Traditional Chinese
3019 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % Simplified Chinese
3020 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % Korean
3021 \end{lstlisting}
3022 Note that the code above specifies \texttt{jfm-jis.lua}, which is for Japanese fonts,
3023 as JFM for Chinese and Korean fonts.
3024 %</en>
3025 %<*ja>
3026 標準で\texttt{psft:}プリフィックスで定義されるフォントは日本語用のもので
3027 あり,Adobe-Japan1-6のCIDに対応したものとなる.しかし,\LuaTeX-jaは中国語
3028 の組版にも威力を発揮することが分かり,日本語フォントでない非埋込フォント
3029 の対応も必要となった.そのために追加されたのが\texttt{cid}キーである.
3030
3031 \texttt{cid}キーに値を指定すると,そのCIDを持った非埋込フォントを定義することができる:
3032 \begin{lstlisting}[numbers=left]
3033 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % 日本語
3034 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % 無指定時は Adobe-Japan1-6
3035 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % 中国語繁体字
3036 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % 中国語簡体字
3037 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % 韓国語
3038 \end{lstlisting}
3039 上のコードでは中国語・韓国語用フォントに対してもJFMに
3040 日本語用の\texttt{jfm-jis.lua}を指定しているので注意されたい.
3041 %</ja>
3042
3043 %<*en>
3044 At present, \LuaTeX-ja supports only 4 values written in the sample code above.
3045 Specifying other values, e.g.,
3046 %</en>
3047 %<*ja>
3048 今のところ,\LuaTeX-jaは上のサンプルコード中に書いた4つの値しかサポートしていない.
3049 %</ja>
3050 \begin{lstlisting}
3051 \jfont\test={psft:Ryumin-Light:cid=Adobe-Japan2;jfm=jis}
3052 \end{lstlisting}
3053 %<*en>
3054 occurs the following error:
3055 %</en>
3056 %<*ja>
3057 のようにそれら以外の値を指定すると,
3058 %</ja>
3059 \begin{lstlisting}[numbers=left]
3060 ! Package luatexja Error: bad cid key `Adobe-Japan2'.
3061
3062 See the luatexja package documentation for explanation.
3063 Type  H <return>  for immediate help.
3064 <to be read again>
3065                    \par
3066 l.78
3067
3068 ? h
3069 I couldn't find any non-embedded font information for the CID
3070 `Adobe-Japan2'. For now, I'll use `Adobe-Japan1-6'.
3071 Please contact the LuaTeX-ja project team.
3072 ?
3073 \end{lstlisting}
3074 %<*ja>
3075 というエラーが出る.
3076 %</ja>
3077
3078 %<en>\subsection{Structure of JFM file}
3079 %<ja>\subsection{JFMファイルの構造}
3080 %<zh>\subsection{JFM结构}
3081
3082 %<*en>
3083 A JFM file is a Lua script which has only one function call:
3084 %</en>
3085 %<*ja>
3086 JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである:
3087 %</ja>
3088 %<*zh>
3089 JFM文件为下列函数调用的Lua脚本:
3090 %</zh>
3091 \begin{verbatim}
3092 luatexja.jfont.define_jfm { ... }
3093 \end{verbatim}
3094 %<*en>
3095 Real data are stored in the table which indicated above by
3096 \verb+{ ... }+.  So, the rest of this subsection are devoted to describe the
3097 structure of this table.  Note that all lengths in a JFM file are
3098 floating-point numbers in design-size unit.
3099 %</en>
3100 %<*ja>
3101 実際のデータは上で \verb+{ ... }+ で示されたテーブルの中に格納されている.
3102 以下ではこのテーブルの構造について記す.
3103 なお,JFMファイル中の長さは全てdesign-sizeを単位とする浮動小数点数であることに
3104 注意する.
3105 %</ja>
3106 %<*zh>
3107 实际的数据保存在表中,即如上的\verb!{ ... }!。
3108 以下部分描述表结构。
3109 请注意,在JFM中的所有长度都是按照以design-size为单位的浮点数。
3110 %</zh>
3111
3112 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3113
3114 \item[dir=<direction>]
3115 %<en>(required)
3116 %<ja>(必須)
3117 %<zh>(必须)
3118
3119 %<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
3120 %<ja>JFMの書字方向.現時点では\texttt{'yoko'}のみがサポートされる.
3121 %<zh>JFM的方向,现在只支持\texttt{yoko}(水平)。
3122
3123 \item[zw=<length>]
3124 %<en>(required)
3125 %<ja>(必須)
3126 %<zh>(必须)
3127
3128 %<en>The amount of the length of the `full-width'.
3129 %<ja>「全角幅」の長さ.
3130 %<zh>“全角”长度。
3131
3132 \item[zh=<length>]
3133 %<en>(required)
3134 %<ja>(必須)
3135 %<zh>(必须)
3136
3137 %<en>The amount of the length of the `full-height' (height + depth).
3138 %<ja>「全角高さ」(height + depth)の長さ.
3139 %<zh>“全角高度”(height + depth)长度。
3140
3141 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}]
3142 %<en>(optional)
3143 %<ja>(任意)
3144 %<zh>(可选)
3145
3146 %<*en>
3147 This field specifies the `ideal' amount of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}. As noted
3148              in Subsection~\ref{subs-kskip}, if the parameter
3149              \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is \verb+\maxdimen+, the value specified
3150              in this field is actually used (if this field is not specified in
3151              JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
3152              fields are in design-size unit too.
3153 %</en>
3154 %<*ja>
3155 「理想的な」\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の量を指定する.\ref{subs-kskip}節で述べたように,
3156 もし\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が \verb+\maxdimen+ の値ならば,このフィールドで指定された
3157 値が実際には用いられる(もしこのフィールドがJFMで指定されていなければ,
3158 0\,ptであるものとして扱われる).<stretch>と<shrink>のフィールドもdesign-size
3159 が単位であることに注意せよ.
3160 %</ja>
3161 %<*zh>
3162 这部分为“理想长度”\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}。\ref{subs-kskip}节有详述,如果参数\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}
3163 为\verb!\maxdimen!,则值设定将会被使用(若再JFM中未设定,则被视为0\,pt)。
3164 请注意,<stretch>和<shrink>的长度均为design-size单位。
3165 %</zh>
3166
3167 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}]
3168 %<en>(optional)
3169 %<ja>(任意)
3170 %<zh>(可选)
3171
3172 %<*en>
3173 Like the \texttt{kanjiskip} field, this field specifies the `ideal'
3174              amount of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
3175 %</en>
3176 %<*ja>
3177 \texttt{kanjiskip}フィールドと同様に,\Param{\hyperlink{fld:xks}{xkanjiskip}}の「理想的な」量を
3178 指定する.
3179 %</ja>
3180 %<*zh>
3181 和\texttt{kanjiskip}类似,此部分设定\Param{\hyperlink{fld:xks}{xkanjiskip}}的“理想长度”。
3182 %</zh>
3183 \end{list}
3184
3185 %<*en>
3186 \paragraph{Character classes}
3187 Besides from above fields, a JFM file have several sub-tables those
3188 indices are natural numbers.  The table indexed by~$i\in\omega$ stores
3189 information of `character class'~$i$. At least, the character class~0 is
3190 always present, so each JFM file must have a sub-table whose index is
3191 \texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
3192 the following fields:
3193 %</en>
3194 %<*ja>
3195 \paragraph{文字クラス}
3196 上記のフィールドに加えて,JFMファイルはそのインデックスが自然数であるいくつかの
3197 サブテーブルを持つ.インデックスが$i\in\omega$であるテーブルは「文字クラス」$i$の
3198 情報を格納する.少なくとも,文字クラス0は常に存在するので,JFMファイルはインデックス
3199 が\texttt{[0]}のサブテーブルを持たなければならない.それぞれのサブテーブル
3200 (そのインデックスを$i$で表わす)は以下のフィールドを持つ:
3201 %</ja>
3202 %<*zh>
3203 \paragraph{Character classes}
3204 除了上面涉及到的内容,JFM文件中还有几个以自然数进行声明的次级表。
3205 这些表依靠满足$i\in\omega$的“字符类”$i$来索引。
3206 一般,最少需要的是字符类0,故每一个JFM文件必须有次级表索引为\texttt{[0]}。
3207 %</zh>
3208
3209 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3210 \item[chars=\{<character>, ...\}]
3211 %<en>(required except character class~0)
3212 %<ja>(文字クラス0を除いて必須)
3213 %<zh>(字符类0外必须)
3214
3215 %<*en>
3216 This field is a list of characters which are in this character
3217              type~$i$. This field is optional if $i=0$, since all
3218              \textbf{JAchar} which do not belong  any character classes other
3219              than 0 are in the character class 0
3220              (hence, the character class~0 contains most of
3221              \textbf{JAchar}s). In the list, character(s) can be specified in the following form:
3222 \begin{itemize}
3223 \item a Unicode code point
3224 \item the character itself (as a Lua string, like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+})
3225 \item a string like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+} (the character followed by an asterisk)
3226 \item several ``imaginary'' characters (We will describe these later.)
3227 \end{itemize}
3228 %</en>
3229 %<*ja>
3230 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
3231 場合には任意である(文字クラス0には,0以外の文字クラスに属するものを
3232 除いた全ての\textbf{JAchar}が属するから).このリスト中で文字を指定するには,以下の方法がある:
3233 \begin{itemize}
3234 \item Unicode におけるコード番号
3235 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+}」のような,文字それ自体
3236 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+}」のような,文字それ自体の後にアスタリスクをつけたもの
3237 \item いくつかの「仮想的な文字」(後に説明する)
3238 \end{itemize}
3239 %</ja>
3240 %<*zh>
3241 这部分为字符集$i$的字符列表。当$i=0$时不需要设定此部分,因为不在字符集0种的\textbf{JAchar}
3242 字符都包含在字符集0中(也就是字符集0包含大多数的\textbf{JAchar})。在这个字符列表中,每一个
3243 字符据可以使用其编码,或者字符本身(长度为1的字符串)。另外还有部分“假想字符”可在此列表中
3244 使用。我们会在下面描述。
3245 %</zh>
3246
3247 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
3248 %<en>(required)
3249 %<ja>(必須)
3250 %<zh>(必须)
3251
3252 %<*en>
3253 Specify width of characters in character class~$i$, height, depth and
3254 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
3255 as values of these fields.
3256 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
3257 %</en>
3258 %<*ja>
3259 文字クラス$i$に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
3260 文字クラス$i$に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
3261 値であるものとして扱われる.
3262 しかし,例外が一つある:もし \texttt{'prop'} が \texttt{width} フィールドに
3263 指定された場合,文字の幅はその「実際の」グリフの幅となる.
3264 %</ja>
3265 %<*zh>
3266 设定字符类$i$的宽度,高度和深度以及意大利体校正。在字符集$i$中,所有字符的宽度,高度
3267 和深度的值为上述设定之值。不过还有例外,如果\texttt{'prop'}设定了\texttt{width}部分,那么
3268 字符的宽度则为其“真实”字形宽度。
3269 %</zh>
3270
3271 \item[left=<length>, down=<length>, align=<align>]\
3272
3273 %<*en>
3274 These fields are for adjusting the position of the `real' glyph. Legal
3275              values of \texttt{align} field are \texttt{'left'},
3276              \texttt{'middle'} and \texttt{'right'}. If one of these
3277              3~fields are omitted, \texttt{left} and \texttt{down} are
3278              treated as~0, and \texttt{align} field is treated as
3279              \texttt{'left'}.
3280 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
3281 %</en>
3282 %<*ja>
3283 これらのフィールドは「実際の」グリフの位置を調整するためにある.
3284 \texttt{align}フィールドに指定できる値は\texttt{'left'}, \texttt{'middle'},
3285 \texttt{'right'}のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
3286 場合,\texttt{left}と\texttt{down}は0,\texttt{align}フィールドは
3287 \texttt{'left'}であるものとして扱われる.
3288 これら3つのフィールドの意味については図\ref{fig-pos}で説明する.
3289 %</ja>
3290 %<*zh>
3291 此部分为“真实”字形对齐位置。\texttt{align}的合法值为\texttt{'left'},
3292 \texttt{'middle'}和\texttt{'right'}。如此三项被省略,则\texttt{left}和
3293 \texttt{down}被视作0,\texttt{align}被视作\texttt{'left'}。
3294 此部分三个域的作用,请参见图\ref{fig-pos}。
3295 %</zh>
3296
3297 %<*en>
3298 In most cases, \texttt{left} and \texttt{down} fields are~0, while
3299 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
3300 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
3301 when the current character class is the class for opening delimiters'.
3302 %</en>
3303 %<*ja>
3304 多くの場合,\texttt{left}と\texttt{down}は0である一方,
3305 \texttt{align}フィールドが\texttt{'middle'}や\texttt{'right'}であることは
3306 珍しいことではない.
3307 例えば,\texttt{align}フィールドを\texttt{'right'}に指定することは,
3308 文字クラスが開き括弧類であるときに実際必要である.
3309 %</ja>
3310 %<*zh>
3311 在大多数情况下,\texttt{left}和\texttt{down}域为0,但是在\texttt{align}域为
3312 \texttt{'middle'}或者\texttt{'right'}时则是不正常的。例如,必须设定\texttt{align}
3313 为\texttt{'right'}时,则当前字符类必须为开定界符。
3314 %</zh>
3315 \begin{figure}[!tb]
3316 \begin{minipage}{0.4\textwidth}%
3317 \begin{center}\unitlength=10pt\small
3318 \begin{picture}(15,12)(-1,-4)
3319 \color{black!10!white}% real glyph :step1
3320 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
3321
3322 \color{red!20!white}% real glyph :step1
3323 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
3324
3325 \color{red}% real glyph
3326 \thicklines
3327 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
3328 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
3329 \put(-1,5.5){\line(1,0){6}}
3330 \put(-1,-4){\line(1,0){6}}
3331
3332 \color{green!20!white}% real glyph :step1
3333 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
3334
3335 \color{black}% real glyph :step1
3336 \thicklines
3337 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
3338 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
3339 \put(0,8){\line(1,0){12}}
3340 \put(0,-3){\line(1,0){12}}
3341 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
3342 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
3343 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
3344
3345 \color{green!50!black}% real glyph :step1
3346 \thicklines
3347 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
3348 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
3349 \put(3,7){\line(1,0){6}}
3350 \put(3,-2.5){\line(1,0){6}}
3351 \newsavebox{\eqdist}
3352 \savebox{\eqdist}(0,0)[b]{%
3353   \thinlines
3354   \put(-0.08,0.2){\line(0,-1){0.4}}%
3355   \put(0.08,0.2){\line(0,-1){0.4}}}
3356 \put(1.5,0){\usebox{\eqdist}}
3357 \put(10.5,0){\usebox{\eqdist}}
3358
3359 \color{blue}% shifted
3360 \thicklines
3361 \put(3,-1.5){\vector(-1,0){4}}
3362 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
3363 \put(3,0){\vector(0,-1){1.5}}
3364 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
3365 \end{picture}
3366 \end{center}
3367 \end{minipage}%
3368 \begin{minipage}{0.6\textwidth}%
3369 %<*en>
3370 Consider a node containing Japanese character whose value of the \texttt{align}
3371 field is \texttt{'middle'}.
3372 %</en>
3373 %<*ja>
3374 \texttt{align}フィールドの値が\texttt{'middle'}である和文文字を含むノードを
3375 考えよう.
3376 %</ja>
3377 %<*zh>
3378 假定一个node包含日语字符,且其值为\texttt{align}的\texttt{'middle'}。
3379 %</zh>
3380 \begin{itemize}
3381 \item
3382 %<*en>
3383 The black rectangle is a frame of the node.
3384 Its width, height and depth are specified by JFM.
3385 %</en>
3386 %<*ja>
3387 黒色の長方形はノードの枠である.
3388 その幅,高さ,深さはJFMによって指定される.
3389 %</ja>
3390 %<*zh>
3391 黑色长方形为node框。其宽度,高度,深度均为JFM所设定。
3392 %</zh>
3393 \item
3394 %<*en>
3395 Since the \texttt{align} field is \texttt{'middle'},
3396 the `real' glyph is centered horizontally (the green rectangle).
3397 %</en>
3398 %<*ja>
3399 \texttt{align}フィールドは\texttt{middle}なので,「実際の」グリフは
3400 水平方向の中心に配置される(緑色の長方形).
3401 %</ja>
3402 %<*zh>
3403 因\texttt{align}被设定为\texttt{middle},故“真实”字形为水平居中(绿长方形中)。
3404 %</zh>
3405 \item
3406 %<*en>
3407 Furthermore, the glyph is shifted according to values of fields
3408       \texttt{left} and \texttt{down}. The ultimate position of the real
3409       glyph is indicated by the red rectangle.
3410 %</en>
3411 %<*ja>
3412 さらに,グリフは\texttt{left}と\texttt{down}の値に従ってシフトされる.
3413 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
3414 %</ja>
3415 %<*zh>
3416 此外,字形移位由\texttt{left}和\texttt{down}决定。最终字形位置为红长方形所示。
3417 %</zh>
3418 \end{itemize}
3419 \end{minipage}
3420 \medskip
3421
3422 \caption{%
3423 %<en>The position of the `real' glyph.
3424 %<ja>「実際の」グリフの位置.
3425 %<zh>“真实”字形位置
3426 }
3427 \label{fig-pos}
3428 \end{figure}
3429
3430 \item[kern={\{[$j$]=<kern>, [$j'$]=\{<kern>, [<ratio>]\}, ...\}}]
3431
3432 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>, [<priority>], [<ratio>]\}, ...\}}]
3433 %<*ja>
3434 文字クラス$i$の文字と$j$の文字の間に挿入されるkernやglueの量を指定する.
3435
3436              <priority>は\texttt{luatexja-adjust.sty} による優先順位付き
3437              行長調整(\ref{ssec-adj}節)が有効なときのみ意味を持つ.
3438 このフィールドは省略可能であり,行調整処理におけるこのglueの優先
3439              度を$-2$から$+2$の間の整数で指定する.<priority>の省略時の値
3440              は0であり,範囲外の値が指定されたときの動作は未定義である).
3441
3442 <ratio>も省略可能フィールドであり,$-1$から$+1$の実数値をとる.省略時の値は0である.
3443 \begin{itemize}
3444 \item $-1$はこのグルーが「前の文字」由来であることを示す.
3445 \item $+1$はこのグルーが「後の文字」由来であることを示す.
3446 \item それ以外の値は,「前の文字」由来のグルーと「後の文字」由来の
3447 グルーが混合されていることを示す.
3448 \end{itemize}
3449 なお,このフィールドの値は\Param{\hyperlink{fld:diffjfm}{differentjfm}}の値が\texttt{pleft},~\texttt{pright},~\texttt{paverage}の値のときのみ実際に用いられる.
3450
3451 例えば,\cite{x4051}では,句点と中点の間には,
3452 句点由来の二分空きと中点由来の四分空きが挿入されるが,この場合には
3453 \begin{itemize}
3454 \item <width>には$0.5+0.25=0.75$を指定する.
3455 \item <ratio>には次の値を指定する.
3456 \[
3457  -1\cdot \frac{0.5}{0.5+0.25} + 1 \cdot \frac{0.25}{0.5+0.25} = -\frac13
3458 \]
3459 \end{itemize}
3460
3461 %</ja>
3462
3463 \item[end\_stretch=<kern>]
3464 \item[end\_shrink=<kern>]
3465 %<*ja>
3466 これらのフィールドは省略可能である.
3467 優先順位付き行長調整が有効であり,かつ現在の文字クラスの文字が行
3468              末に来た時に,行長を詰める調整・伸ばす調整のた
3469              めにこの文字と行末の間に挿入可能なカーンの大きさを指定する.
3470 %</ja>
3471
3472 \end{list}
3473
3474 %<*ja>
3475 \paragraph{文字クラスの決定}
3476 文字クラスの決定は少々複雑である.ここでは例を用いて説明しよう.
3477
3478
3479 たとえば,次の内容を一部に含んだ \texttt{jfm-test.lua} を考えよう:
3480 \begin{lstlisting}
3481    [0] = {
3482       chars = { '漢', 'ヒ*' },
3483       align = 'left', left = 0.0, down = 0.0,
3484       width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
3485    },
3486    [2000] = {
3487       chars = { '。', '、*', 'ヒ' },
3488       align = 'left', left = 0.0, down = 0.0,
3489       width = 0.5, height = 0.88, depth = 0.12, italic=0.0,
3490    },
3491 \end{lstlisting}
3492 句点「。」の幅は二分であるので
3493 \begin{LTXexample}
3494 \jfont\a=psft:Ryumin-Light:jfm=test;+vert
3495 \setbox0\hbox{\a 。\inhibitglue 漢}
3496 \the\wd0
3497 \end{LTXexample}
3498 では,全角二分(15.0\,pt)とならなければおかしいが,上の実行結果では20\,ptとなっている.
3499 それは以下の事情によるものである:
3500 \begin{enumerate}
3501 \item \verb+vert+ featureによって句点が縦書き用のグリフと置き換わる(\Pkg{luaotfload} による処理).
3502 \item しかしこのグリフは「文字コード」U+F0000以降とみなされている
3503 (実際にいくらになるかは,フォントによって異なる).
3504 \item よって,文字クラス0とみなされるため,結果として「。」の幅は全角だと認識されてしまう.
3505 \end{enumerate}
3506
3507 一方,「\texttt{'、*'}」のようにアスタリスクつきの指定があると,
3508 状況は異なってくる.
3509 \begin{LTXexample}
3510 \jfont\a=psft:Ryumin-Light:jfm=test;+vert
3511 \a 漢、\inhibitglue 漢
3512 \end{LTXexample}
3513 ここで,読点「、」の文字クラスは,以下のようにして決まる.
3514 \begin{enumerate}
3515 \item とりあえず句点の時と同じように,\Pkg{luaotfload} によって縦書き用読点のグリフに置き換わる.
3516 \item 置換後のグリフの「文字コード」はU+F0000以降であり,
3517 そのままでは文字クラスは0と判定される.
3518 \item ところが,JFMには「\texttt{'、*'}」指定があるので,置換前の横書き用読点のグリフ「、」(文字コードはU+3001)によって文字クラスを判定する.
3519 \item 結果として,上の出力例中の読点の文字クラスは2000となる.
3520 \end{enumerate}
3521
3522 なお,置換後のグリフで判定した文字クラスの値が0でなければ,そちらをそのまま作用する.
3523 \begin{LTXexample}
3524 \jfont\a=psft:Ryumin-Light:jfm=test;+hwid
3525 \a 漢ヒひ
3526 \end{LTXexample}
3527 上の例では,
3528 \texttt{hwid} featureにより,「ヒ」が半角の「ヒ」に置き換わるが,
3529 文字クラスは「ヒ」の属する0\textbf{ではなく},「ヒ」の属する2000となる.
3530 %</ja>
3531
3532 %<ja>\paragraph{仮想的な文字}
3533 %<!ja>\paragraph{Imaginary characters}
3534 %<*en>
3535 As described before, you can specify several `imaginary characters' in
3536 \texttt{chars} field. The most of these characters are regarded as the
3537 characters of class 0 in \pTeX.
3538 As a result, \LuaTeX-ja can control typesetting finer than \pTeX.
3539 The following is the list of `imaginary characters':
3540 %</en>
3541 %<*ja>
3542 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
3543 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
3544 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
3545 い組版調整ができるようになっている.以下でその一覧を述べる:
3546 %</ja>
3547 %<*zh>
3548 如上所述,你可以在\texttt{chars}中设定多个“假想字符”。这些字符中的多数字符在
3549 \pTeX 中式被视作字符集0中字符。故此,\LuaTeX-ja可以比\pTeX 做得更好。
3550 下列为“假想字符”列表:
3551 %</zh>
3552 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3553 %%\item['lineend']
3554 %%%<en>An ending of a line.
3555 %%%<ja>行の終端を表す.
3556 %%%<zh>行尾结束字符。
3557
3558 %%\item['diffmet']
3559 %%<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
3560 %%<ja>JFMやサイズが異なる2つの\textbf{JAchar}の間の境界として用いられる.
3561 %%<zh>用于两个不同大小或不同JFM的两个\textbf{JAchar}间边界。
3562
3563 \item['boxbdd']
3564 %<en>The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
3565 %<ja>水平ボックスの先頭と末尾,及びインデントされていない(\verb+\noindent+ で開始された)段落の先頭を表す.
3566 %<zh>水平合字结束或结尾,以及未缩进段落开头。
3567
3568 \item['parbdd']
3569 %<en>The beginning of an (indented) paragraph.
3570 %<ja>通常の(\verb+\noindent+ で開始されていない)段落の先頭.
3571 %<zh>缩进段落开头。
3572
3573 \item['jcharbdd']
3574 %<en>A boundary between \textbf{JAchar} and anything else (such as \textbf{ALchar}, kern, glue,\,\ldots).
3575 %<ja>和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
3576 %<zh>日文字符和其他(如\textbf{ALchar},胶,出格等)边界。
3577
3578 \item[$-1$]
3579 %<en>The left/right boundary of an inline math formula.
3580 %<ja>行中数式と地の文との境界.
3581 %<zh>行中数学式的左/右边界。
3582 \end{list}
3583
3584 %<en>\paragraph{Porting JFM from \pTeX}
3585 %<ja>\paragraph{\pTeX 用和文用TFMの移植}
3586 %<zh>\paragraph{\pTeX 下使用的TFM移植}
3587
3588 % ToDo: English version.
3589
3590 %<*en>
3591 \ldots
3592 %</en>
3593
3594 %<*ja>
3595 以下に,\pTeX 用に作られた和文用TFMを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
3596 \begin{itemize}
3597 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
3598 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
3599       トメトリック等を移植する場合は,
3600 \begin{itemize}
3601 \item JFM中の全ての数値を$1/0.962216$倍しておく.
3602 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
3603       \LaTeX でのフォント宣言なら,例えば次のように:
3604 \begin{verbatim}
3605 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
3606 \end{verbatim}
3607 \end{itemize}
3608 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
3609       (JFM中に単に書かなければよい).
3610 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
3611       文字クラスに関してはグルー/カーンの設定はしない.
3612
3613 これは,\pTeX では,
3614       水平ボックスの先頭・末尾とインデントされていない(\verb+\noindent+ で開始さ
3615       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
3616 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
3617
3618 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
3619       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
3620       は,段落の最初に手動で \verb+\inhibitglue+ を追加するか,あるいは
3621       \ \verb+\everypar+ のハックを行い,それを自動化させるしかなかった.
3622
3623 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
3624 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
3625 \texttt{'parbdd'}を入れれば全角下がりとなる.
3626
3627 \begin{LTXexample}
3628 \jfont\g=psft:Ryumin-Light:jfm=test \g
3629 \parindent1\zw\noindent{}◆◆◆◆◆
3630 \par 「◆◆←二分下がり
3631 \par 【◆◆←全角下がり
3632 \par 〔◆◆←全角二分下がり
3633 \end{LTXexample}
3634 \end{itemize}
3635
3636 但し,\verb+\everypar+ を利用している場合にはこの仕組みは正しく動かない.
3637 そのような例としては箇条書き中の \verb+\item+ で始まる段落があり,\Pkg{ltjsclasses}では
3638 人工的に「\texttt{'parbdd'}の意味を持つ」whatsitノードを作ることによって対処している%
3639 \footnote{\texttt{no\_runtime/ltjsclasses.dtx} を参照されたい.
3640 JFM側で一部の対処ができることにより,\Pkg{jsclasses}のようにif文の判定はしていない.}
3641 %</ja>
3642 %<*zh>
3643 下面,给出用于\pTeX 使用的JFM移植到\LuaTeX-ja过程中需要注意的几点。
3644 %</zh>
3645
3646
3647 %<en>\subsection{Math Font Family}
3648 %<ja>\subsection{数式フォントファミリ}
3649 %<zh>\subsection{数学字体族}
3650 \label{ssec-math}
3651
3652 %<*en>
3653 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
3654 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX\ can handles 256~families, but
3655 an external package is needed to support this in plain \TeX\ and
3656 \LaTeX.}, and each family has three fonts:
3657 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
3658 %</en>
3659 %<*ja>
3660 \TeX\ は数式フォントを16のファミリ\footnote{Omega, Aleph, \LuaTeX,そして
3661   $\varepsilon$-\kern-.125em(u)\pTeX\ では256の数式ファミリを扱うことができるが,
3662   これをサポートするためにplain \TeX と\LaTeX では外部パッケージを読み込む必要が
3663   ある.}で管理し,それぞれのファミリは3つのフォントを持っている:\verb+\textfont+, \verb+\scriptfont+ そして \verb+\scriptscriptfont+ である.
3664 %</ja>
3665
3666 %<*en>
3667 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
3668 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
3669 font families. There is no relation between the value of
3670 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
3671 you can set both \verb+\fam+ and \verb+\jfam+ to the same value.
3672 %</en>
3673 %<*ja>
3674 \LuaTeX-jaの数式中での和文フォントの扱いも同様である.
3675 表\ref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する
3676 ものを示している.\verb+\fam+ と \verb+\jfam+ の値の間には関係はなく,
3677 適切な設定の下では \verb+\fam+ と \verb+\jfam+ の両方に同じ値を設定することができる.
3678 %</ja>
3679
3680 \begin{table}[!tb]
3681 %<en>\caption{Control sequences for Japanese math fonts}
3682 %<ja>\caption{和文数式フォントに対する命令}
3683 %<zh>\caption{日语数学字体基本语句}
3684 \label{tab-math}
3685 \begin{center}
3686 \def\{{\char`\{}\def\}{\char`\}}\small
3687 \begin{tabular}{ll}
3688 \toprule
3689 %<en>\bf Japanese fonts&\bf alphabetic fonts\\
3690 %<ja>\bf 和文フォント&\bf 欧文フォント\\
3691 %<zh>\bf 日文字体&\bf 西文字体\\
3692 \midrule
3693 \verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
3694 \tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
3695 \tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
3696 \tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
3697 \bottomrule
3698 \end{tabular}
3699 \end{center}
3700 \end{table}
3701
3702 %<en>\subsection{Callbacks}
3703 %<ja>\subsection{コールバック}
3704 %<zh>\subsection{回调}
3705
3706 %<*en>
3707 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
3708 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks.
3709 %</en>
3710 %<*ja>
3711 \LuaTeX 自体のものに加えて,\LuaTeX-jaもコールバックを持っている.
3712 これらのコールバックには,他のコールバックと同様に \verb+luatexbase.add_to_callback+
3713 関数などを用いることでアクセスすることができる.
3714 %</ja>
3715 \begin{list}{}%
3716 {\def\makelabel#1{\bfseries#1}}
3717 %<en>\item[\texttt{luatexja.load\_jfm} callback]
3718 %<ja>\item[\texttt{luatexja.load\_jfm}コールバック]
3719 %<zh>\item[\texttt{luatexja.load\_jfm}回调]
3720 %<*en>
3721 With this callback you can overwrite JFMs.
3722 This callback is called when a new JFM is loaded.
3723 %</en>
3724 %<*ja>
3725 このコールバックを用いることでJFMを上書きすることができる.
3726 このコールバックは新しいJFMが読み込まれるときに呼び出される.
3727 %</ja>
3728
3729 \begin{lstlisting}[numbers=left]
3730 function (<table> jfm_info, <string> jfm_name)
3731   return <table> new_jfm_info
3732 end
3733 \end{lstlisting}
3734
3735 %<*en>
3736 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
3737 this argument has \texttt{chars} field which contains character codes
3738              whose character class is not~0.
3739 %</en>
3740 %<*ja>
3741 引数 \verb+jfm_info+ はJFMファイルのテーブルと似たものが格納されるが,
3742 クラス0を除いた文字のコードを含んだ\texttt{chars}フィールドを持つ点が異なる.
3743 %</ja>
3744
3745 %<*en>
3746 An example of this callback is the \texttt{ltjarticle} class, with
3747              forcefully assigning character class~0 to \texttt{'parbdd'}
3748              in the JFM \texttt{jfm-min.lua}.
3749 %</en>
3750 %<*ja>
3751 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
3752 \texttt{jfm-min.lua}中の\texttt{'parbdd'}を強制的にクラス0に割り当てている.
3753 %</ja>
3754
3755 %<en>\item[\texttt{luatexja.define\_font} callback]
3756 %<ja>\item[\texttt{luatexja.define\_font}コールバック]
3757 %<zh>\item[\texttt{luatexja.define\_font}回调]
3758 %<*en>
3759 This callback and the next callback form a pair, and you can assign letters which don't have
3760              fixed code points in Unicode to non-zero character classes.
3761 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
3762 %</en>
3763 %<*ja>
3764 このコールバックと次のコールバックは組をなしており,Unicode中に固定された文字コード
3765 番号を持たない文字を非零の文字クラスに割り当てることができる.
3766 このコールバックは新しい和文フォントが読み込まれたときに呼び出される.
3767 %</ja>
3768
3769 \begin{lstlisting}[numbers=left]
3770 function (<table> jfont_info, <number> font_number)
3771   return <table> new_jfont_info
3772 end
3773 \end{lstlisting}
3774
3775 %<*en>
3776 You may assume that \verb+jfont_info+ has the following fields:
3777 %</en>
3778 %<*ja>
3779 \verb+jfont_info+ は以下の2フィールドを持つ:
3780 %</ja>
3781 \begin{description}
3782 \item[\tt size\_cache]
3783 %<*ja>
3784 使用されているJFMの情報が格納されているテーブルで,
3785 \textbf{このテーブルを書き換えてはならない}.
3786 中身はほぼJFMファイルに書かれている唯一のテーブルであるが,次のように若干変わっている:
3787 \begin{itemize}
3788 \item 各文字クラス$i$に属する文字達のテーブル
3789 \texttt{[$i$].chars=\{<character>, ...\}}は,トップレベルにまとめられ,
3790 \texttt{chars=\{[<character>]=$i$, ...\}}という形になっている.
3791 \item \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} の各フィールドの値は,
3792 実際に使われるフォントサイズに合わせたsp ($1\,\mathrm{sp}=2^{-6}\,\mathrm{pt}$)単位の長さに変わっている.
3793 \item 各文字クラス$i$の情報を格納したテーブルも,\texttt{char\_type} フィールドの下にまとめられている.
3794 例えば,文字クラス1に属する文字の高さは \texttt{char\_type[1].height} で参照できる.
3795 \item \texttt{dir} フィールドはこのテーブルにはない.
3796 \end{itemize}
3797 %</ja>
3798 %<*en>
3799 A table which contains the information of a JFM, and \emph{this table must not be changed}.
3800 The contents of this table are similar to that which is written is the JFM file, but
3801 the following differ:
3802 \begin{itemize}
3803 \item There is a \texttt{chars} table, \dots
3804 \item The value in \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} fields are
3805 now scaled by real font size, and in scaled-pont unit.
3806 \item ...
3807 \item There is no \texttt{dir} field in this table.
3808 \end{itemize}
3809 %</en>
3810 %<zh> ...
3811
3812 \item[\tt var]
3813 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
3814 %<ja>\verb+\jfont+ の呼び出しの際に\texttt{jfmvar=...}で指定された値.
3815 %<zh>\verb!\jfont!调用的\texttt{jfmvar=...}值。
3816 \end{description}
3817
3818 %<*en>
3819 The returned table \verb+new_jfont_info+ also should include these two fields.
3820 The \verb+font_number+ is a font number.
3821 %</en>
3822 %<*ja>
3823 戻り値の \verb+new_jfont_info+ テーブルもこれら2つのフィールドを含まなければならないが,
3824 それ以外にユーザが勝手にフィールドを付け加えることは自由である.
3825 \verb+font_number+ はフォント番号である.
3826 %</ja>
3827
3828 %<*en>
3829 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
3830              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
3831              CID characters in a JFM. This callback doesn't replace any
3832              code of \LuaTeX-ja.
3833 %</en>
3834 %<*ja>
3835 これと次のコールバックの良い使用例は\Pkg{luatexja-otf}パッケージであり,
3836 JFM中でAdobe-Japan1 CIDの文字を \verb+"AJ1-xxx"+ の形で指定するために
3837 用いられている.
3838 %</ja>
3839
3840 %<en>\item[\texttt{luatexja.find\_char\_class} callback]
3841 %<ja>\item[\texttt{luatexja.find\_char\_class}コールバック]
3842 %<zh>\item[\texttt{luatexja.find\_char\_class}回调]
3843 %<*en>
3844 This callback is called just when \LuaTeX-ja is trying to determine which
3845              character class a character \verb+chr_code+ belongs.
3846 A function used in this callback should be in the following form:
3847 %</en>
3848 %<*ja>
3849 このコールバックは\LuaTeX-jaが \verb+chr_code+ の文字がどの文字クラスに
3850 属するかを決定しようとする際に呼び出される.
3851 このコールバックで呼び出される関数は次の形をしていなければならない:
3852 %</ja>
3853 \begin{lstlisting}[numbers=left]
3854 function (<number> char_class, <table> jfont_info, <number> chr_code)
3855   if char_class~=0 then return char_class
3856   else
3857     ....
3858     return (<number> new_char_class or 0)
3859   end
3860 end
3861 \end{lstlisting}
3862
3863 %<*en>
3864 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
3865              routine or previous function calls in this callback, hence
3866              this argument may not be 0. Moreover, the returned
3867              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
3868              is not~0, otherwise you will overwrite the \LuaTeX-ja's
3869              default routine.
3870 %</en>
3871 %<*ja>
3872 引数 \verb+char_class+ は\LuaTeX-jaのデフォルトルーチンか,このコールバックの
3873 直前の関数呼び出しの結果を含んでおり,したがってこの値は0ではないかもしれない.
3874 さらに,戻り値の \verb+new_char_class+ は \verb+char_class+ が非零のときには
3875 \verb+char_class+ の値と同じであるべきで,そうでないときは\LuaTeX-jaの
3876 デフォルトルーチンを書き換えることになる.
3877 %</ja>
3878
3879 %<en>\item[\texttt{luatexja.set\_width} callback]
3880 %<ja>\item[\texttt{luatexja.set\_width}コールバック]
3881 %<zh>\item[\texttt{luatexja.set\_width}回调]
3882 %<*en>
3883 This callback is called when \LuaTeX-ja is trying to encapsule a
3884              \textbf{JAchar} \textit{glyph\_node}, to adjust its
3885              dimension and position.
3886 %</en>
3887 %<*ja>
3888 このコールバックは\LuaTeX-jaが\textbf{JAchar}の寸法と位置を調節するために
3889 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
3890 %</ja>
3891 \begin{lstlisting}[numbers=left]
3892 function (<table> shift_info, <table> jfont_info, <number> char_class)
3893   return <table> new_shift_info
3894 end
3895 \end{lstlisting}
3896
3897 %<*en>
3898 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
3899 \texttt{down} and \texttt{left} fields, which are the amount of shifting
3900              down/left the character in a scaled-point.
3901 %</en>
3902 %<*ja>
3903 引数 \verb+shift_info+ と戻り値の \verb+new_shift_info+ は
3904 \texttt{down}と\texttt{left}のフィールドを持ち,これらの値は
3905 文字の下/左へのシフト量(スケールド・ポイント単位)である.
3906 %</ja>
3907
3908 %<*en>
3909 A good example is \Pkg{test/valign.lua}.
3910 After loading this file, the vertical position of glyphs is automatically
3911 adjusted; the ratio $(\hbox{height}:\hbox{depth})$ of glyphs is adjusted
3912 to be that of letters in the character class~0. For example, suppose that
3913 \begin{itemize}
3914 \item The setting of the JFM: $(\hbox{height})=88x$, $(\hbox{depth})=12x$
3915   (the standard values of Japanese OpenType fonts);
3916 \item The value of the real font: $(\hbox{height})=28y$, $(\hbox{depth})=5y$
3917   (the standard values of Japanese TrueType fonts).
3918 \end{itemize}
3919 Then, the position of glyphs is shifted up by
3920 \[
3921  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3922 \]
3923 %</en>
3924 %<*ja>
3925 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
3926              JFM内で規定された文字クラス0の文字における$(\hbox{高
3927              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
3928              下位置が自動調整される.例えば,
3929 \begin{itemize}
3930 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
3931 (和文OpenTypeフォントの標準値)
3932 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
3933 \end{itemize}
3934 となっていたとする.すると,実際の文字の出力位置は,
3935 \[
3936  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3937 \]
3938 だけ上にずらされることになる.
3939 %</ja>
3940 \end{list}
3941
3942
3943
3944 %<en>\section{Parameters}
3945 %<ja>\section{パラメータ}
3946 %<zh>\section{参数}
3947 %<en>\subsection{\texttt{\char92 ltjsetparameter}}
3948 %<ja>\subsection{\texttt{\char92 ltjsetparameter}命令}
3949 %<zh>\subsection{\texttt{\char92 ltjsetparameter}基本参数}
3950
3951 %<*en>
3952 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
3953 control sequences for accessing most parameters of \LuaTeX-ja. One of the main
3954 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
3955 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
3956 is the position of \verb+hpack_filter+ callback in the source
3957 of \LuaTeX, see Section~\ref{sec-para}.
3958 %</en>
3959 %<*ja>
3960 先に述べたように,\verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ は
3961 \LuaTeX-jaのほとんどのパラメータにアクセスするための命令である.
3962 \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を
3963 採用しない理由の一つは,\LuaTeX のソースにおける \verb+hpack_filter+
3964 コールバックの位置にある.\ref{sec-para}節を参照.
3965 %</ja>
3966
3967 %<*en>
3968 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are control sequences
3969 for assigning parameters. These take one argument which is a
3970 \texttt{<key>=<value>} list. Allowed keys are described in the next
3971 subsection.
3972 The difference between
3973 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
3974 scope of assignment;
3975 \verb+\ltjsetparameter+ does a local assignment and
3976 \verb+\ltjglobalsetparameter+ does a global one.
3977 They also obey the value of \verb+\globaldefs+,
3978 like other assignment.
3979 %</en>
3980 %<*ja>
3981 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ はパラメータを
3982 指定するための命令である.これらは\texttt{<key>=<value>}のリストを
3983 引数としてとる.許されるキーは次の節に記述する.
3984 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ の違いはスコープの
3985 違いのみである.
3986 \verb+\ltjsetparameter+ はローカルな指定,\verb+\ltjglobalsetparameter+ は
3987 グローバルな指定を行う.
3988 これらは他のパラメータ指定と同様に \verb+\globaldefs+ の値に従う.
3989 %</ja>
3990
3991 %<*en>
3992 \verb+\ltjgetparameter+ is for acquiring parameters. It
3993 always takes a parameter name as first argument, and also takes the
3994 additional argument---a character code, for example---in some cases.
3995 %</en>
3996 %<*ja>
3997 \verb+\ltjgetparameter+ はパラメータの値を取得するための命令であり,
3998 常にパラメータの名前を第一引数にとる.
3999 そして,いくつかの場合には加えてさらに引数(例えば文字コード)をとる.
4000 %</ja>
4001 \begin{LTXexample}
4002 \ltjgetparameter{differentjfm},
4003 \ltjgetparameter{autospacing},
4004 \ltjgetparameter{prebreakpenalty}{`)}.
4005 \end{LTXexample}
4006 %<*en>
4007 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
4008 always a string}. This is outputted by \texttt{tex.write()}, so any
4009 character other than space~`\texttt{\char32}'~(U+0020) has the category code
4010 12~(other), while the space has 10~(space).
4011 %</en>
4012 %<*ja>
4013 \textbf{{\normalfont\tt\char92ltjgetparameter}の戻り値は常に文字列である.}
4014 これは\texttt{tex.write()}によって出力しているためで,スペース`\texttt{\char32}'~(U+0020)を除いた文字のカテゴリーコードは全て12~(other)となる.
4015 一方,スペースのカテゴリーコードは10~(space)である.
4016 %</ja>
4017
4018 %<en>\subsection{List of Parameters}
4019 %<ja>\subsection{パラメータ一覧}
4020 %<zh>\subsection{参数一览}
4021 \label{ssec-param}
4022
4023 %<*en>
4024 The following is the list of parameters which can be specified by the
4025 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
4026 in \pTeX, and symbols beside each parameter has the following meaning:
4027 %</en>
4028 %<*ja>
4029 以下は \verb+\ltjsetparameter+ に指定することができるパラメータの一覧である.
4030 [\verb+\cs+]は\pTeX における対応物を示す.
4031 また,それぞれのパラメータの右上にある記号には次の意味がある:
4032 %</ja>
4033 \begin{itemize}
4034 %<*zh>
4035 \item % avoiding from error ``Something's wrong--perhaps a missing \item.''.
4036 %</zh>
4037 %<*en>
4038 \item No mark: values at the end of the paragraph or the hbox are
4039       adopted in the whole paragraph/hbox.
4040 %</en>
4041 %<*ja>
4042 \item 記号なし:段落や水平ボックスの終端での値がその段落/水平ボックス全体で用いられる.
4043 %</ja>
4044 %<*en>
4045 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
4046 %</en>
4047 %<*ja>
4048 \item `\ast':ローカルなパラメータであり,段落/水平ボックス内のどこででも値を変えることができる.
4049 %</ja>
4050 %<*en>
4051 \item `\dagger': assignments are always global.
4052 %</en>
4053 %<*ja>
4054 \item `\dagger':指定は常にグローバルになる.
4055 %</ja>
4056 \end{itemize}
4057
4058 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4059 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
4060 %<*en>
4061 Penalty value for suppressing orphans. This penalty is inserted just
4062              after the last \textbf{JAchar} which is not regarded as a
4063              (Japanese) punctuation mark.
4064 %</en>
4065 %<*ja>
4066 パラグラフの最後の字が孤立して改行されるのを防ぐためのペナルティの値.
4067 このペナルティは(日本語の)句読点として扱われない最後の\textbf{JAchar}の直後に
4068 挿入される.
4069 %</ja>
4070
4071 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
4072 %<*en>
4073 An additional attributes which each character whose character code is <chr\_code> has.
4074 At the present version, the lowermost bit of <natural number> indicates
4075              whether the character is considered as a punctuation mark
4076              (see the description of \Param{jcharwidowpenalty} above).
4077 %</en>
4078 %<*ja>
4079 文字コードが<chr\_code>の文字が持つ付加的な属性値(attribute).
4080 現在のバージョンでは,<natural number>の最下位ビットが,その文字が句読点と
4081 みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照).
4082 %</ja>
4083
4084 \item[\Param{\hypertarget{fld:prebp}{prebreakpenalty}}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
4085 %<*ja>
4086 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
4087              この文字の前に挿入/追加されるペナルティの量を指定する.
4088
4089 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,
4090 \begin{verbatim}
4091 \ltjsetparameter{prebreakpenalty={`〙,10000}}
4092 \end{verbatim}
4093 と,最大値の10000が標準で指定されている.他にも,小書きのカナなど,絶対禁止とい
4094              うわけではないができれば行頭にはきて欲しくない場合に,0と
4095              10000の間の値を指定するのも有用であろう.
4096 %</ja>
4097
4098 \item[\Param{\hypertarget{fld:postbp}{postbreakpenalty}}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
4099 %<*ja>
4100 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
4101              この文字の後に挿入/追加されるペナルティの量を指定する.
4102
4103 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
4104 \begin{itemize}
4105 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
4106       た(後から指定した方で上書きされる).
4107 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
4108 \end{itemize}
4109 という制限があったが,\LuaTeX-jaではこれらの制限は解消されている.
4110 %</ja>
4111
4112 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}]
4113 %<en>[\verb+\textfont+ in \TeX]
4114 %<ja>[\TeX の \verb+\textfont+]
4115 %<zh>[\TeX 的\verb+\textfont+]
4116 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}]
4117 %<en>[\verb+\scriptfont+ in \TeX]
4118 %<ja>[\TeX の \verb+\scriptfont+]
4119 %<zh>[\TeX 中的\verb+\scriptfont+]
4120 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}]
4121 %<en>[\verb+\scriptscriptfont+ in \TeX]
4122 %<ja>[\TeX の \verb+\scriptscriptfont+]
4123 %<zh>[\TeX 中的\verb+\scriptscriptfont+]
4124 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
4125 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
4126
4127 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
4128
4129 %<*en>
4130 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
4131 The followings are allowed for <mode>:
4132 %</en>
4133 %<*ja>
4134 文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
4135 挿入を許すかどうかの設定.
4136 以下の<mode>が許される:
4137 %</ja>
4138 \begin{description}
4139 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
4140 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
4141 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{\hyperlink{fld:xks}{xkanjiskip}}均被禁止。
4142 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
4143 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
4144 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但其后不允许插入。
4145 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
4146 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
4147 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但之前不允许插入。
4148 %<en>\item[3, \texttt{allow}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed both before the character and after the character. This is the default value.
4149 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
4150 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{\hyperlink{fld:xks}{xkanjiskip}}。此为默认值。
4151 \end{description}
4152 %<*en>
4153 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
4154 %</en>
4155 %<*ja>
4156 このパラメータは\pTeX の \verb+\inhibitxspcode+ プリミティブと似ているが,
4157 互換性はない.
4158 %</ja>
4159 %<*zh>
4160 此参数类似\pTeX 基本语句\verb!\inhibitxspcode!,但是和\verb!\inhibitxspcode!不兼容。
4161 %</zh>
4162 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
4163
4164 %<*en>
4165 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a
4166              \textbf{ALchar} whose character code is <chr\_code>.
4167              The followings are allowed for <mode>:
4168 %</en>
4169 %<*ja>
4170 文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
4171 挿入を許すかどうかの設定.
4172 以下の<mode>が許される:
4173 %</ja>
4174 \begin{description}
4175 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
4176 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
4177 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{\hyperlink{fld:xks}{xkanjiskip}}均被禁止。
4178 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
4179 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
4180 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但其后不允许插入。
4181 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
4182 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
4183 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但之前不允许插入。
4184 %<en>\item[3, \texttt{allow}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character and after the character. This is the default value.
4185 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
4186 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{\hyperlink{fld:xks}{xkanjiskip}}。此为默认值。
4187 \end{description}
4188 %<*en>
4189 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
4190 %</en>
4191 %<*ja>
4192 \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため,
4193 これら2つのパラメータは互いの異名となっていることに注意する.
4194 %</ja>
4195 %<*zh>
4196 注意参数\Param{jaxspmode}和\Param{alxspmode}公用一个表,故这两个参数互为同义语。
4197 %</zh>
4198
4199 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
4200 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
4201 \item[\Param{\hypertarget{fld:kanjiskip}{kanjiskip}}\,=<skip>] [\verb+\kanjiskip+]
4202 %<*ja>
4203 デフォルトで2つの\textbf{JAchar}の間に挿入されるグルーである.
4204 通常では,\pTeX と同じようにフォントサイズに比例して変わることはない.
4205 しかし,自然長が \verb+\maxdimen+ の場合は,例外的に和文フォントのJFM側で指定されている
4206 値を採用(こちらはフォントサイズに比例)することになっている.
4207 %</ja>
4208
4209 \item[\Param{\hypertarget{fld:xks}{xkanjiskip}}\,=<skip>] [\verb+\xkanjiskip+]
4210 %<*ja>
4211 デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルーである.
4212 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と同じように,通常ではフォントサイズに比例して変わることはないが,
4213 自然長が \verb+\maxdimen+ の場合が例外である.
4214 %</ja>
4215
4216
4217 \item[\Param{\hypertarget{fld:diffjfm}{differentjfm}}\,=<mode>$^\dagger$]
4218
4219 %<*en>
4220 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
4221 The allowed arguments are the followings:
4222 %</en>
4223 %<*ja>
4224 JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグルー/カーンをどのように
4225 入れるかを指定する.
4226 許される値は以下の通り:
4227 %</ja>
4228 %<*zh>
4229 对于处理不同大小或者JFM的两种\textbf{JAchar}之间的胶/出格。
4230 有下列参数:
4231 %</zh>
4232 \begin{description}
4233 \item[\texttt{average}]
4234 \item[\texttt{both}]
4235 \item[\texttt{large}]
4236 \item[\texttt{small}]
4237 \item[\texttt{pleft}]
4238 \item[\texttt{pright}]
4239 \item[\texttt{paverage}]
4240 \end{description}
4241
4242 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
4243 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
4244 \end{list}
4245
4246
4247 %<en>\section{Other Control Sequences}
4248 %<ja>\section{その他の命令}
4249 %<zh>\section{其他基本语句}
4250 %<en>\subsection{Control Sequences for Compatibility}
4251 %<ja>\subsection{\pTeX 互換用命令}
4252 %<zh>\subsection{基本语句兼容性}
4253
4254 %<*en>
4255 The following control sequences are implemented for compatibility with \pTeX.
4256 Note that these don't support JIS~X~0213, but only JIS~X~0208.
4257 %</en>
4258 %<*ja>
4259 以下の命令は\pTeX との互換性のために実装されている.そのため,JIS~X~0213には対応せず,
4260 \pTeX と同じようにJIS~X~0208の範囲しかサポートしていない.
4261 %</ja>
4262 %<*zh>
4263 下列基本语句的实现与\pTeX 兼容:
4264 %</zh>
4265 \begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw}
4266 \item[kuten]
4267 \item[jis]
4268 \item[euc]
4269 \item[sjis]
4270 \item[ucs]
4271 \item[kansuji]
4272 \end{list}
4273
4274 %<en>\subsection{\texttt{\char92 inhibitglue}}
4275 %<ja>\subsection{\texttt{\char92 inhibitglue}}
4276 %<zh>\subsection{\texttt{\char92 inhibitglue}基本语句}
4277 %<*en>
4278 \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
4279 The following is an example, using a special JFM that there will be a glue between
4280 the beginning of a box and `あ', and also between `あ' and `ウ'.
4281 %</en>
4282 %<*ja>
4283 \verb+\inhibitglue+ は\textbf{JAglue}の挿入を抑制する.
4284 以下は,ボックスの始めと`あ'の間,`あ'と`ウ'の間にグルーが入る特別なJFMを用いた例で
4285 ある.
4286 %</ja>
4287 %<*zh>
4288 基本语句\verb!\inhibitglue!会压缩\textbf{JAchar}的插入。
4289 下面的例子使用了特殊的JFM。在一个盒子和“あ”之间,以及“あ”和“ウ”之间存在胶。
4290 %</zh>
4291
4292 \begin{LTXexample}
4293 \jfont\g=psft:Ryumin-Light:jfm=test \g
4294 \fbox{\hbox{あウあ\inhibitglue ウ}}
4295 \inhibitglue\par\noindent あ1
4296 \par\inhibitglue\noindent あ2
4297 \par\noindent\inhibitglue あ3
4298 \par\hrule\noindent あoff\inhibitglue ice
4299 \end{LTXexample}
4300
4301 %<*en>
4302 With the help of this example, we remark the specification of \verb+\inhibitglue+:
4303 %</en>
4304 %<*ja>
4305 この例を援用して,\verb+\inhibitglue+ の仕様について述べる.
4306 %</ja>
4307 %<*zh>
4308 如上例子,我们注意到\verb!\inhibtglue!的用法。
4309 %</zh>
4310 \begin{itemize}
4311 %<*zh>
4312 \item
4313 %</zh>
4314 %<*en>
4315 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
4316       simply ignored.
4317 %</en>
4318 %<*ja>
4319 \item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
4320 4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
4321 \verb+\noindent+ の時点で水平モードになるからである.
4322 %</ja>
4323
4324 %<*en>
4325 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
4326       mode is only effective on the spot; does not get over boundary of
4327       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
4328       kernings, as shown in the last line of above example.
4329 %</en>
4330 %<*ja>
4331 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
4332   有効であり,段落の境界を乗り越えない.
4333   さらに,\verb+\inhibitglue+ は上の例の最終行のように(欧文における)リガチャとカーニングを
4334   打ち消す.これは,\verb+\inhibitglue+ が内部的には「現在のリスト中にwhatsitノードを
4335   追加する」ことを行なっているからである.
4336 %</ja>
4337
4338 %<*en>
4339 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
4340 %</en>
4341 %<*ja>
4342 \item \verb+\inhibitglue+ を数式モード中で呼び出した場合はただ無視される.
4343 %</ja>
4344 \end{itemize}
4345
4346 %<en>\section{Control Sequences for \LaTeXe}
4347 %<ja>\section{\LaTeXe 用の命令}
4348 %<zh>\section{\LaTeXe 下使用的控制序列}
4349
4350 %<en>\subsection{Patch for NFSS2}
4351 %<ja>\subsection{NFSS2へのパッチ}
4352 %<zh>\subsection{NFSS2补丁}
4353 \label{ssub-nfsspat}
4354
4355 %<*en>
4356 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
4357 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
4358 For an convenience, we will describe
4359 control sequences which are not described in Subsection~\ref{ssub-chgfnt}.
4360 %</en>
4361 %<*ja>
4362 \ref{ssec-ltx}節で述べたように,\LuaTeX-jaはNFSS2への日本語パッチである
4363 \pLaTeXe の\texttt{plfonts.dtx}を単純に取り入れている.
4364 便宜のため,ここでは\ref{ssub-chgfnt}節で述べていなかった命令について
4365 記述しておく.
4366 %</ja>
4367
4368 \begin{cslist}%
4369 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
4370
4371 %<*en>
4372 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
4373              and Japanese font families are only made by their
4374              encodings. For example, encodings OT1 and T1 are for
4375              alphabetic font families, and a Japanese font family cannot
4376              have these encodings. This command defines a new encoding
4377              scheme for Japanese font family (in horizontal direction).
4378 %</en>
4379 %<*ja>
4380 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
4381 そのエンコーディングからのみ作られる.
4382 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
4383 和文フォントファミリはこれらのエンコーディングを持つことはできない.
4384 このコマンドは和文フォントファミリ(横書き用)のための新しいエンコーディングを
4385 定義する.
4386 %</ja>
4387
4388 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
4389 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
4390 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
4391
4392 %<*en>
4393 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
4394 %</en>
4395 %<*ja>
4396 上記3つのコマンドはちょうど \verb+DeclareFontEncodingDefaults+ などに対応するものである.
4397 %</ja>
4398
4399 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
4400
4401 % ToDo: en
4402 %<*ja>
4403 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
4404 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\verb+\mathrm+ 等)と,和文数式用フォ
4405              ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+ 等)の2つを同時に行う命令として
4406              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
4407              <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
4408              更させるようにするのが一般的と思われる.
4409
4410 {\let\item=\origitem
4411 本命令は
4412 \begin{center}\tt
4413 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
4414 (<al-cmd>を1段展開したもの)\{<ja-cmd>を1段展開したもの)\{<arg>\}\}
4415 \end{center}
4416 と定義を行うので,使用には注意が必要である:
4417 \begin{itemize}
4418 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に
4419 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
4420 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと\texttt{@}をつけた命令を指定した時の動作は保証できない.
4421 \end{itemize}}
4422 %</ja>
4423
4424 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
4425   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
4426 %<*en>
4427 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
4428 with respect to a Japanese font family given by the former 4~arguments.
4429 %</en>
4430 %<*ja>
4431 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
4432 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
4433 %</ja>
4434 \item[SetRelationFont]
4435 %<*en>
4436 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
4437 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
4438 %</en>
4439 %<*ja>
4440 このコマンドは \verb+\DeclareRelationFont+ とローカルな指定であることを除いて
4441 ほとんど同じである(\verb+\DeclareRelationFont+ はグローバル).
4442 %</ja>
4443
4444 \item[userelfont]
4445 %<*en>
4446 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
4447              font family with respect to current Japanese font family,
4448              which was set by
4449              \verb+\DeclareRelationFont+ or \verb+\SetRelationFont+.
4450 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
4451 %</en>
4452 %<*ja>
4453 現在の欧文フォントエンコーディング/ファミリ/…… を,
4454 \verb+\DeclareRelationFont+ か \verb+\SetRelationFont+ で指定された
4455 現在の和文フォントファミリに対応する「従属欧文」フォントファミリに変更する.
4456 \verb+\fontfamily+ のように,有効にするためには \verb+\selectfont+ が必要である.
4457 %</ja>
4458
4459 \item[adjustbaseline]
4460 \ldots
4461
4462 \item[fontfamily\{<family>\}]
4463 {\let\item\origitem
4464 %<*en>
4465 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
4466 to <family>. Which family will be changed is determined as follows:
4467 %</en>
4468 %<*ja>
4469 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
4470 和文,\textbf{もしくは両方})を<family>に変更する.
4471 どのファミリが変更されるかは以下のようにして決定される:
4472 %</ja>
4473 \begin{itemize}
4474 %<*zh>
4475 \item
4476 %</zh>
4477 %<*en>
4478 \item Let current encoding scheme for Japanese fonts be
4479       <ja-enc>. Current Japanese font family will be changed to
4480       <family>, if one of the following two conditions is met:
4481 %</en>
4482 %<*ja>
4483 \item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
4484   現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
4485   <family>に変更される:
4486 %</ja>
4487 \begin{itemize}
4488 %<*en>
4489 \item The family <family> under the encoding <ja-enc> has been already defined by
4490       \verb+\DeclareKanijFamily+.
4491 %</en>
4492 %<*ja>
4493 \item エンコーディング<ja-enc>におけるファミリ<family>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
4494 %</ja>
4495 %<*en>
4496 \item A font definition named \texttt{<ja-enc><family>.fd} (the file name is
4497       all lowercase) exists.
4498 %</en>
4499 %<*zh>
4500 \item
4501 %</zh>
4502 %<*ja>
4503 \item フォント定義ファイル\texttt{<ja-enc><family>.fd}(ファイル名は全て小文字)が存在する.
4504 %</ja>
4505 \end{itemize}
4506 %<*en>
4507 \item Let current encoding scheme for alphabetic fonts be
4508       <al-enc>. For alphabetic font family, the criterion as above is used.
4509 %</en>
4510 %<*ja>
4511 \item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
4512   欧文フォントファミリに対しても,上記の基準が用いられる.
4513 %</ja>
4514 %<*en>
4515 \item There is a case which none of the above applies, that is, the font
4516       family named <family> doesn't seem to be defined neither under the
4517       encoding <ja-enc>, nor under <al-enc>.
4518 In this case, the default family for font substitution is used for
4519       alphabetic and Japanese fonts. Note that current encoding will not
4520       be set to <family>, unlike the original implementation in \LaTeX.
4521 %</en>
4522 %<*ja>
4523 \item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
4524   どちらでも定義されないような場合がある.
4525   この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
4526   和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
4527   現在のエンコーディングは<family>には設定されないことに注意する.
4528 %</ja>
4529 \end{itemize}
4530 }
4531 \end{cslist}
4532
4533 %<*en>
4534 As closing this subsection, we shall introduce an example of
4535 \verb+\SetRelationFont+ and \verb+\userelfont+:
4536 %</en>
4537 %<*ja>
4538 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
4539 紹介しておこう.\verb+\userelfont+ の使用によって,「abc」の部分のフォントが
4540 Avant Garde (OT1/pag/m/n) に変わっていることがわかる.
4541 %</ja>
4542 \begin{LTXexample}
4543 \kanjifamily{gt}\selectfont あいうxyz
4544 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
4545 \userelfont\selectfont あいうabc
4546 \end{LTXexample}
4547
4548 %<en>\section{Extensions}
4549 %<ja>\section{拡張}
4550 \subsection{\texttt{luatexja-fontspec.sty}}
4551
4552 %<*en>
4553 As described in Subsection~\ref{ssec-fontspec}, this optional package
4554 provides the counterparts for several commands defined in the
4555 \Pkg{fontspec} package.
4556 In addition to `font features' in the original \Pkg{fontspec},
4557 the following `font features' specifications are allowed for
4558 the commands of Japanese version:
4559 %</en>
4560 %<*ja>
4561 \ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}
4562 パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
4563 オリジナルの\Pkg{fontspec}での`font feature'に加えて,和文版のコマンドには
4564 以下の`font feature'を指定することができる:
4565 %</ja>
4566
4567
4568 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4569 \item[CID=<name>]
4570 \item[JFM=<name>]
4571 \item[JFM-var=<name>] \
4572
4573 %<*en>
4574 These 3 font features correspond to \texttt{cid}, \texttt{jfm} and
4575 \texttt{jfmvar} keys for \verb+\jfont+ respectively.
4576 \texttt{CID} is effective only when with \texttt{NoEmbed}
4577 described below.
4578 See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details.
4579 %</en>
4580 %<*ja>
4581 これら3つのキーはそれぞれ \verb+\jfont+ に対する
4582 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
4583 \texttt{CID} は下の \texttt{NoEmbed} と合わせて用いられたときのみ有効である.
4584 \verb+\jfont+ プリミティブに対する
4585 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーの詳細は\ref{ssec-jfont}節
4586              と\ref{ssec-psft}節を参照.
4587 %</ja>
4588
4589 \item[NoEmbed]
4590 %<*en>
4591 By specifying this font feature, one can use `name-only' Japanese font which
4592 will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
4593 %</en>
4594 %<*ja>
4595 これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
4596 できる.\ref{ssec-psft}節を参照.
4597 %</ja>
4598 \end{list}
4599
4600 %<*ja>
4601 なお,\texttt{luatexja-fontspec.sty} 読み込み時には和文フォント定義ファイル%
4602 \texttt{<ja-enc><family>.fd}は全く参照されなくなる.
4603 %</ja>
4604
4605
4606
4607 \subsection{\texttt{luatexja-otf.sty}}
4608
4609 %<*en>
4610 This optional package supports typesetting characters in
4611 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
4612 commands:
4613 %</en>
4614 %<*ja>
4615 この追加パッケージはAdobe-Japan1の文字の出力をサポートする.
4616 \texttt{luatexja-otf.sty}は以下の2つの低レベルコマンドを提供する:
4617 %</ja>
4618 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4619 \item[\char92CID\{<number>\}]
4620 %<*en>
4621 Typeset a character whose CID number is <number>.
4622 %</en>
4623 %<*ja>
4624 CID番号が<number>の文字を出力する.
4625 %</ja>
4626
4627 \item[\char92UTF\{<hex\_number>\}]
4628 %<*en>
4629 Typeset a character whose character code is <hex\_number> (in hexadecimal).
4630 This command is similar to \verb+\char"+<hex\_number>,\ %"
4631 but please remind remarks below.
4632 %</en>
4633 %<*ja>
4634 文字コードが(16進で)<hex\_number>の文字を出力する.
4635 このコマンドは \verb+\char"+<hex\_number>と似ているが,下の記述に注意すること.%"
4636 %</ja>
4637 \end{list}
4638
4639 %<en>\paragraph{Remarks}
4640 %<ja>\paragraph{注意}
4641 %<*en>
4642 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
4643 ordinary characters in the following points:
4644 %</en>
4645 %<*ja>
4646 \verb+\CID+ と \verb+\UTF+ コマンドによって出力される文字は
4647 以下の点で通常の文字と異なる:
4648 %</ja>
4649 \begin{itemize}
4650 %<*zh>
4651 \item
4652 %</zh>
4653 %<*en>
4654 \item Always treated as \textbf{JAchar}s.
4655 %</en>
4656 %<*ja>
4657 \item 常に\textbf{JAchar}として扱われる.
4658 %</ja>
4659 %<*en>
4660 \item Processing codes for supporting OpenType features (\textit{e.g.},
4661       glyph replacement and kerning) by the \Pkg{luaotfload} package
4662       is not performed to these characters.
4663 %</en>
4664 %<*ja>
4665 \item OpenType feature(例えばグリフ置換やカーニング)をサポートするための
4666   \Pkg{luaotfload}パッケージのコードはこれらの文字には働かない.
4667 %</ja>
4668 \end{itemize}
4669
4670
4671 %<en>\paragraph{Additional Syntax of JFM}
4672 %<ja>\paragraph{JFMへの記法の追加}
4673
4674 %<*en>
4675 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
4676 chars} table in JFM now allows a string in the form
4677 \verb+'AJ1-xxx'+, which stands for the character
4678 whose CID number in Adobe-Japan1 is \verb+xxx+.
4679 %</en>
4680 %<*ja>
4681 \texttt{luatexja-otf.sty}はJFMの記法を拡張する.
4682 JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形の文字列が
4683 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
4684 %</ja>
4685
4686 \subsection{\texttt{luatexja-adjust.sty}}
4687 \label{ssec-adj}
4688 \begin{figure}[t]
4689 \def\sq{%
4690   \hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
4691    \hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw%
4692   \hskip\dimexpr.5\zw-.2pt\relax}\hss}}
4693 \def\sb{\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
4694   ■\hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw%
4695   \hskip\dimexpr.5\zw-.2pt\relax}\hss}}
4696 \newbox\gridbox
4697 \def\outbox#1{{\Large%
4698   \ltjsetparameter{kanjiskip=0pt plus .2\zw minus .2\zw}%
4699   \setbox\gridbox=\hbox to 20\zw{\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb}%
4700   \hbox{\textcolor{cyan!50!white}{\copy\gridbox}\hskip-20\zw%
4701   \vbox{\hsize=20\zw\noindent\leftskip0pt\rightskip0pt\parfillskip0pt#1}\vrule}%
4702 }}
4703
4704 {\centering
4705 \begin{tabular}{lc}
4706 \toprule
4707 no adjustment&\outbox{以上の原理は,「包除原理」とよく呼ばれるが\hskip-.5\zw\null}\\
4708 without priority&%
4709 \ltjdisableadjust
4710 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}%
4711 \ltjenableadjust\\
4712 with priority&%
4713 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}
4714 %<!ja>\ltjdisableadjust
4715 \\
4716 \bottomrule
4717 \end{tabular}\par}
4718 \smallskip
4719
4720 Note: the value of 
4721 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is 0\,pt${}^{+1/5\,\mathrm{em}}_{-1/5\,\mathrm{em}}$ in this figure,
4722 for making the difference obvious.
4723 %<ja>\caption{行長調整}\label{fig-adj}
4724 %<en>\caption{Line adjustment}\label{fig-adj}
4725 \end{figure}
4726
4727
4728 %<*en>
4729 ...
4730 %</en>
4731 %<*ja>
4732 \pTeX では,行長調整において優先度の概念が存在しなかったため,図
4733 \ref{fig-adj}上段における半角分の半端は,図\ref{fig-adj}中段のように,鍵
4734 括弧周辺の空白と和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})の両方によって負担される.し
4735 かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい
4736 ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文
4737 文字はベタ組で組まれる(図\ref{fig-adj}下段)ことになっている.この追加
4738 パッケージは\cite{jlreq}や\cite{x4051}における規定のような,優先順位付き
4739 の行長調整を提供する.詳細な仕様については\ref{sec-adjspec}を参照.
4740
4741
4742 \texttt{luatexja-adjust.sty}は,以下の命令を提供する.これらはすべてグローバルに効力を発揮する.
4743
4744 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4745 \item[\char92ltjdisableadjust]
4746 優先順位付きの行長調整を無効化する.
4747
4748 \item[\char92ltjenableadjust]
4749 優先順位付きの行長調整を有効化する.
4750
4751 \item[優先度設定……]
4752
4753 \end{list}
4754
4755
4756
4757
4758
4759 %</ja>
4760
4761
4762
4763 %<en>\part{Implementations}
4764 %<ja>\part{実装}
4765 \label{part-imp}
4766 %<en>\section{Storing Parameters}
4767 %<ja>\section{パラメータの保持}
4768 \label{sec-para}
4769 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
4770 %<ja>\subsection{\LuaTeX-jaで用いられる寸法レジスタ,属性レジスタ,whatsitノード}
4771
4772 %<*en>
4773 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
4774 %</en>
4775 %<*ja>
4776 以下は\LuaTeX-jaで用いられる寸法レジスタ(dimension),属性レジスタ(attribute)の
4777 リストである.
4778 %</ja>
4779 \begin{list}{}{%
4780 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
4781 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
4782 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
4783 }
4784
4785 \dim{jQ}
4786 %<*en>
4787 \verb+\jQ+ is equal to
4788                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
4789                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
4790 %</en>
4791 %<*ja>
4792 \verb+\jQ+ は$1\,\textrm{Q}=0.25\,\textrm{mm}$
4793 と等しい.ここで,`Q'(もしくは「級」)は日本の写植で用いられる単位である.したがって,
4794 この寸法レジスタの値を変更してはならない.
4795 %</ja>
4796
4797 \dim{jH}
4798 %<*en>
4799 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
4800                         used in Japanese phototypesetting. This
4801                         \verb+\jH+ is a synonym of \verb+\jQ+.
4802 %</en>
4803 %<*ja>
4804 同じく写植で用いられていた単位として「歯」があり,これも$0.25\,\textrm{mm}$と
4805 等しい.\verb+\jH+ は \verb+\jQ+ の別名である.
4806 %</ja>
4807
4808 \dim{ltj@zw}
4809 %<*en>
4810 A temporal register for the `full-width' of current Japanese font.
4811 %</en>
4812 %<*ja>
4813 現在の和文フォントの「全角幅」を保持する一時レジスタ.
4814 %</ja>
4815
4816 \dim{ltj@zh}
4817 %<*en>
4818 A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
4819 %</en>
4820 %<*ja>
4821 現在の和文フォントの「全角高さ」(通常,高さと深さの和)を保持する一時レジスタ.
4822 %</ja>
4823
4824 \attr{jfam}
4825 %<*en>
4826 Current number of Japanese font family for math formulas.
4827 %</en>
4828 %<*ja>
4829 数式用の和文フォントファミリの現在の番号.
4830 %</ja>
4831
4832 \attr{ltj@curjfnt}
4833 %<*en>
4834 The font index of current Japanese font.
4835 %</en>
4836 %<*ja>
4837 現在の和文フォントのフォント番号.
4838 %</ja>
4839
4840 \attr{ltj@charclass}
4841 %<*en>
4842 The character class of Japanese \textit{glyph\_node}.
4843 %</en>
4844 %<*ja>
4845 和文文字の\textit{glyph\_node}の文字クラス.
4846 %</ja>
4847
4848 \attr{ltj@yablshift}
4849 %<*en>
4850 The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4851 %</en>
4852 %<*ja>
4853 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量.
4854 %</ja>
4855
4856 \attr{ltj@ykblshift}
4857 %<*en>
4858 The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4859 %</en>
4860 %<*ja>
4861 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
4862 %</ja>
4863
4864 \attr{ltj@autospc}
4865 %<*en>
4866 Whether the auto insertion of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is allowed at the node.
4867 %</en>
4868 %<*ja>
4869 そのノードで\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の自動挿入が許されるかどうか.
4870 %</ja>
4871
4872 \attr{ltj@autoxspc}
4873 %<*en>
4874 Whether the auto insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed at the node.
4875 %</en>
4876 %<*ja>
4877 そのノードで\Param{\hyperlink{fld:xks}{xkanjiskip}}の自動挿入が許されるかどうか.
4878 %</ja>
4879
4880 \attr{ltj@icflag}
4881 %<*en>
4882 An attribute for distinguishing `kinds' of a node. One of the following value is
4883 assigned to this attribute:
4884 %</en>
4885 %<*ja>
4886 ノードの「種類」を区別するための属性.以下のうちのひとつが値として割り当てられる:
4887 %</ja>
4888 \begin{description}
4889 \item[\textit{italic} (1)]
4890 %<*en>
4891 Glues from an italic correction
4892            (\verb+\/+). This distinction of origins of glues
4893            (from explicit \verb+\kern+, or from \verb+\/+)
4894            is needed in the insertion process of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4895 %</en>
4896 %<*ja>
4897 イタリック補正(\verb+\/+)によるグルー.このグルーの由来の区別(\verb+\kern+ か
4898 \verb+\/+ か)は\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入過程において必要になる.
4899 %</ja>
4900
4901 \item[\textit{packed} (2)]
4902
4903 \item[\textit{kinsoku} (3)]
4904 %<*en>
4905 Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}).
4906 %</en>
4907 %<*ja>
4908 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
4909 %</ja>
4910
4911 \item[\textit{from\_jfm} (6)]
4912 %<*en>
4913 Glues/kerns from JFM.
4914 %</en>
4915 %<*ja>
4916 JFM由来のグルー/カーン.
4917 %</ja>
4918
4919 %%\item[\textit{line\_end} (5)]
4920 %%%<*en>
4921 %%Kerns for \ldots
4922 %%%</en>
4923 %%%<*ja>
4924 %%和文文字が行末にきたとき,行末との間に挿入されるカーンである.
4925 %%% ぶら下げ組への応用
4926 %%%</ja>
4927
4928 \item[\textit{kanji\_skip} (9)]
4929 %<*en>
4930 Glues for \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}.
4931 %</en>
4932 %<*ja>
4933 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}のグルー.
4934 %</ja>
4935
4936 \item[\textit{xkanji\_skip} (10)]
4937 %<*en>
4938 Glues for \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4939 %</en>
4940 %<*ja>
4941 \Param{\hyperlink{fld:xks}{xkanjiskip}}のグルー.
4942 %</ja>
4943
4944 \item[\textit{processed} (11)]
4945 %<*en>
4946 Nodes which is already processed by \ldots.
4947 %</en>
4948 %<*ja>
4949 \LuaTeX-ja の内部処理によって既に処理されたノード.
4950 %</ja>
4951
4952 \item[\textit{ic\_processed} (12)]
4953 %<*en>
4954 Glues from an italic correction, but also already processed.
4955 %</en>
4956 %<*ja>
4957 イタリック補正に由来するグルーであるが,まだ処理されていないもの.
4958 %</ja>
4959
4960 \item[\textit{boxbdd} (15)]
4961 %<*en>
4962 Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
4963 %</en>
4964 %<*ja>
4965 ある水平ボックスか段落の最初か最後に挿入されたグルー/カーン.
4966 %</ja>
4967 \end{description}
4968
4969 \attr{ltj@kcat$i$}
4970 %<*en>
4971 Where $i$~is a natural number which is less than~7.
4972 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
4973 %</en>
4974 %<*ja>
4975 $i$は7より小さい自然数.
4976 これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
4977 扱われるかを示すビットベクトルを格納する.
4978 %</ja>
4979 \end{list}
4980
4981 %<*en>
4982 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
4983 inrernal processing. All those nodes store a natural number (hence the node's
4984 \texttt{type} is 100). The following \verb+user_id+s are used:
4985 %</en>
4986 %<*ja>
4987 さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
4988 これらの全てのノードは自然数を格納している(したがってノードの\texttt{type}は
4989 100である).次の \verb+user_id+ が使用される:
4990 %</ja>
4991 \begin{description}
4992 \item[30111]
4993 %<*en>
4994 Nodes for indicating that \verb+\inhibitglue+ is
4995            specified. The \texttt{value} field of these nodes doesn't matter.
4996 %</en>
4997 %<*ja>
4998 \verb+\inhibitglue+ が指定されたことを示すノード.これらのノードの
4999 \texttt{value}フィールドは意味を持たない.
5000 %</ja>
5001
5002 \item[30112]
5003 %<*en>
5004 Nodes for \LuaTeX-ja's stack system (see the next
5005            subsection). The \texttt{value} field of these nodes is
5006            current group.
5007 %</en>
5008 %<*ja>
5009 \LuaTeX-jaのスタックシステム(次の節を参照)のためのノード.
5010 これらのノードの\texttt{value}フィールドは現在のグループを表す.
5011 %</ja>
5012
5013 \item[30113]
5014 %<*en>
5015 Nodes for Japanese Characters which the callback process of
5016            \Pkg{luaotfload} won't be applied, and the character code is
5017            stored in the \texttt{value} field. Each node having this
5018            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
5019            the callback process of luaotfload.
5020            This \verb+user_id+ is only used by the \Pkg{luatexja-otf} package.
5021 %</en>
5022 %<*ja>
5023 \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
5024 \texttt{value}フィールドにその文字のコードが格納されている.
5025 この \verb+user_id+ を持つノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
5026 \textbf{後で}`glyph\_node'に変換される.この \verb+user_id+ は %
5027 \Pkg{luatexja-otf} パッケージでのみ使用される.
5028 %</ja>
5029
5030 \item[30114]
5031 Nodes for indicating beginning of a paragraph.
5032 A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
5033 for its label before the actual contents. So \dots
5034 \end{description}
5035 %<*en>
5036 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
5037 %</en>
5038 %<*ja>
5039 これらのwhatsitノードは\textbf{JAglue}の挿入処理の間に取り除かれる.
5040 %</ja>
5041
5042 %<en>\subsection{Stack System of \LuaTeX-ja}
5043 %<ja>\subsection{\LuaTeX-jaのスタックシステム}
5044 \label{ssec-stack}
5045
5046 %<en>\paragraph{Background}
5047 %<ja>\paragraph{背景}
5048 %<*en>
5049 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
5050 are stored in it. To clarify the reason, imagine the parameter
5051 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is stored by a skip, and consider the following
5052 source:
5053 %</en>
5054 %<*ja>
5055 \LuaTeX-jaは独自のスタックシステムを持ち,\LuaTeX-jaのほとんどのパラメータは
5056 これを用いて保持されている.その理由を明らかにするために,
5057 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメータがスキップレジスタで保持されているとし,
5058 以下のコードを考えてみよう:
5059 %</ja>
5060 \begin{LTXexample}
5061 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
5062 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
5063 \box0.ぴよぴよ\par
5064 \end{LTXexample}
5065
5066 %<*en>
5067 As described in Subsection~\ref{ssec-param}, the only effective value of
5068 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} in an hbox is the latest value, so the value of
5069 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} which applied in the entire hbox should be 5\,pt.
5070 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
5071 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
5072 file in the source of \LuaTeX), there are the following codes:
5073 %</en>
5074 %<*ja>
5075 \ref{ssec-param}節で述べたように,ある水平ボックスの中で効力を持つ
5076 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値は最後に現れた値のみであり,したがってボックス全体に適用される
5077 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は5\,ptであるべきである.しかし,\LuaTeX の実装のために,
5078 この`5\,pt'はどのコールバックからも知ることはできない.
5079 \texttt{tex/packaging.w}(これは\LuaTeX のソースファイルである)の中に,
5080 以下のコードがある:
5081 %</ja>
5082 \begin{lstlisting}
5083 void package(int c)
5084 {
5085     scaled h;                   /* height of box */
5086     halfword p;                 /* first node in a box */
5087     scaled d;                   /* max depth */
5088     int grp;
5089     grp = cur_group;
5090     d = box_max_depth;
5091     unsave();
5092     save_ptr -= 4;
5093     if (cur_list.mode_field == -hmode) {
5094         cur_box = filtered_hpack(cur_list.head_field,
5095                                  cur_list.tail_field, saved_value(1),
5096                                  saved_level(1), grp, saved_level(2));
5097         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
5098 \end{lstlisting}
5099 %<*en>
5100 Notice that \verb+unsave+ is executed \emph{before}
5101 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
5102 executed): so `5\,pt' in the above source is orphaned at
5103 \verb+unsave+, and hence it can't be accessed from \verb+hpack_filter+
5104 callback.
5105 %</en>
5106 %<*ja>
5107 \verb+unsave+ が \verb+filtered_hpack+(これは \verb+hpack_filter+ コールバックが
5108 実行されるところである)の\textbf{前に}実行されていることに注意する.
5109 したがって,上記ソース中で`5\,pt'は \verb+unsave+ のところで捨てられ,
5110 \verb+hpack_filter+ からはアクセスすることができない.
5111 %</ja>
5112
5113 %<en>\paragraph{The method}
5114 %<ja>\paragraph{解決法}
5115 %<zh>\paragraph{解决方法}
5116
5117 %<*en>
5118 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
5119 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
5120 %</en>
5121 %<*ja>
5122 スタックシステムのコードはDev-luatexメーリングリストのある投稿\footnote{\texttt{[Dev-luatex] tex.currentgrouplevel}: Jonathan Sauerによる2008/8/19の投稿.}を
5123 ベースにしている.
5124 %</ja>
5125
5126 %<*en>
5127 These are two \TeX\ count registers for maintaining information:
5128 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
5129 the \TeX's group level when the last assignment was done.  Parameters
5130 are stored in one big table named \texttt{charprop\_stack\_table}, where
5131 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
5132 a new stack level is created by \verb+\ltjsetparameter+, all data of the
5133 previous level is copied.
5134 %</en>
5135 %<*ja>
5136 情報を保持するために,2つの\TeX の整数レジスタを用いている:
5137 \verb+\ltj@@stack+ でスタックレベル,\verb+\ltj@@group@level+ で最後の代入が
5138 なされた時点での\TeX のグループレベルを保持している.
5139 パラメータは\texttt{charprop\_stack\_table}という名前のひとつの大きなテーブルに
5140 格納される.ここで,\texttt{charprop\_stack\_table[$i$]}はスタックレベル$i$の
5141 データを格納している.もし新しいスタックレベルが \verb+\ltjsetparameter+ によって
5142 生成されたら,前のレベルの全てのデータがコピーされる.
5143 %</ja>
5144
5145 %<*en>
5146 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
5147 another thing: When a new stack level is about to be created, a whatsit
5148 node whose type, subtype and value are 44~(\textit{user\_defined}),
5149 30112, and current group level respectively is appended to the current
5150 list (we refer this node by \textit{stack\_flag}). This enables us to
5151 know whether assignment is done just inside a hbox. Suppose that the
5152 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
5153 group, then:
5154 %</en>
5155 %<*ja>
5156 上の「背景」で述べた問題を解決するために,\LuaTeX-jaではもう一つの手法を導入する:
5157 新しいスタックレベルが生成されようとするとき,type, subtype, valueがそれぞれ
5158 44~(\textit{user\_defined}), 30112,そして現在のグループレベルであるwhatsitノード
5159 を現在のリストに付け加える(このノードを\textit{stack\_flag}とする).
5160 これにより,ある水平ボックスの中で代入がなされたかどうかを知ることが可能
5161 となる.スタックレベルを$s$,その水平ボックスグループの直後の\TeX のグループレベルを
5162 $t$とすると:
5163 %</ja>
5164 \begin{itemize}
5165 %<*zh>
5166 \item
5167 %</zh>
5168 %<*en>
5169 \item If there is no \textit{stack\_flag} node in the list of the hbox, then
5170       no assignment was occurred inside the hbox. Hence values of
5171       parameters at the end of the hbox are stored in the stack
5172       level~$s$.
5173 %</en>
5174 %<*ja>
5175 \item もしその水平ボックスのリストの中に\textit{stack\_flag}ノードがなければ,
5176   水平ボックスの中では代入は起こらなかったということになる.
5177   したがって,その水平ボックスの終わりにおけるパラメータの値はスタックレベル$s$に
5178   格納されている.
5179 %</ja>
5180
5181 %<*en>
5182 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
5183       an assignment was occurred just inside the hbox group. Hence
5184       values of parameters at the end of the hbox are stored in the
5185       stack level~$s+1$.
5186 %</en>
5187 %<*ja>
5188 \item もし値が$t+1$の\textit{stack\_flag}ノードがあれば,その
5189   水平ボックスグループの中で代入が起こったことになる.
5190   したがって,水平ボックスの終わりにおけるパラメータの値はスタックレベル$s+1$に
5191   格納されている.
5192 %</ja>
5193
5194 %<*en>
5195 \item If there are \textit{stack\_flag} nodes but all of their values
5196       are more than~$t+1$, then an assignment was occurred in the box,
5197       but it is done is `more internal' group. Hence values of
5198       parameters at the end of the hbox are stored in the stack
5199       level~$s$.
5200 %</en>
5201 %<*ja>
5202 \item もし\textit{stack\_flag}ノードがあるがそれらの値が全て$t+1$より大きい
5203   場合,そのボックスの中で代入が起こったが,それは「より内部の」グループで
5204   起こったということになる.したがって,水平ボックスの終わりでのパラメータの
5205   値はスタックレベル$s$に格納されている.
5206 %</ja>
5207 \end{itemize}
5208
5209 %<*en>
5210 Note that to work this trick correctly, assignments to
5211 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
5212 regardless the value of \verb+\globaldefs+.
5213 This problem is resolved by using
5214 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
5215 %</en>
5216 %<*ja>
5217 このトリックを正しく働かせるためには,\verb+\ltj@@stack+ と \verb+\ltj@@group@level+ への
5218 代入は \verb+\globaldefs+ の値によらず常にローカルでなければならないことに注意する.
5219 この問題は \hbox{\verb+\directlua{tex.globaldefs=0}+}(この代入は常にローカル)を
5220 用いることで解決している.
5221 %</ja>
5222
5223 %<en>\section{Linebreak after Japanese Character}
5224 %<ja>\section{和文文字直後の改行}
5225 %<zh>\section{日文字符后断行}
5226 \label{sec-lbreak}
5227 %<en>\subsection{Reference: Behavior in \pTeX}
5228 %<ja>\subsection{参考:\pTeX の動作}
5229 %<zh>\subsection{参考: \pTeX 行为}
5230 %<*en>
5231 In~\pTeX, a line break after a Japanese character doesn't emit a space,
5232 since words are not separated by spaces in Japanese writings. However,
5233 this feature isn't fully implemented in \LuaTeX-ja due to the
5234 specification of callbacks in~\LuaTeX. To clarify the difference between
5235 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
5236 this subsection.
5237
5238 \pTeX's input processor can be described in terms of a finite state
5239 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
5240 internal states are as follows:
5241 \begin{itemize}
5242 \item State~$N$: new line
5243 \item State~$S$: skipping spaces
5244 \item State~$M$: middle of line
5245 \item State~$K$: after a Japanese character
5246 \end{itemize}
5247 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
5248 processor.  State~$K$ is similar to state~$M$, and is entered after
5249 Japanese characters.  The diagram of state transitions are indicated in
5250 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
5251 after `beginning/ending of a group' characters.
5252 %</en>
5253
5254 %<*ja>
5255 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
5256 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
5257 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
5258
5259 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
5260 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
5261 以下に述べるような4状態を持っている.
5262
5263 \begin{itemize}
5264 \item State~$N$: 行の開始.
5265 \item State~$S$: 空白読み飛ばし.
5266 \item State~$M$: 行中.
5267 \item State~$K$: 行中(和文文字の後).
5268 \end{itemize}
5269 また,状態遷移は,図\ref{fig-ptexipro}のようになっており,図中の数字は
5270 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
5271 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
5272 じものになる.
5273
5274 この図から分かることは,
5275 \begin{quote}
5276 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
5277 \end{quote}
5278 ということである.
5279 %</ja>
5280
5281 \begin{figure}[!tb]
5282 \let\sp\textvisiblespace\small
5283 \begin{minipage}{.6\textwidth}%
5284 \begin{center}
5285 \unitlength=6.5mm\sf\mathversion{bold}
5286 \begin{tikzpicture}[
5287   ->, auto, shorten >=1pt
5288 ]
5289 \node [shape=rectangle, font=\scriptsize] (init) at (2,7) {start};
5290 \node [shape=circle,draw, fill=blue!20] (newline) at (4,7) {$N$};
5291 \node [shape=circle,draw, fill=blue!20] (midline) at (4,4) {$M$};
5292 \node [shape=circle,draw, fill=blue!20] (skipspc) at (8,7) {$S$};
5293 \node [shape=circle,draw, fill=red!20]  (kanji) at (8,4) {$K$};
5294 \node [shape=rectangle,draw, fill=green!20] (scanacs) at (6,8) {scan a c.s.};
5295 \node (endk) at (8,2.5) {} ;
5296 \node (endm) at (4,2.5) {} ;
5297 \node (ends) at (8,8.5) {} ;
5298 \node (endn) at (4,8.5) {} ;
5299 \begin{scope}[font=\scriptsize]
5300 \path (newline) edge [bend right]    node [left]{G, O} (midline)
5301       (init)    edge                 node {} (newline)
5302       (midline) edge [bend right=10] node {10} (skipspc)
5303       (skipspc) edge [bend right]    node [left,right=10,above=7]{G, O} (midline)
5304       (skipspc) edge [loop right]    node {10} (skipspc)
5305       (newline) edge [loop right]    node {10} (newline)
5306       (scanacs) edge [bend left]     node [left=3,below]{$(*)$} (skipspc)
5307       (scanacs) edge [bend right]    node [right=30,above=20]{$(*)$} (midline)
5308       (midline) edge                 node {5\ [\sp]} (endm)
5309       (midline) edge [loop left]     node {G, O} (midline)
5310       (skipspc) edge                 node [right] {5} (ends)
5311       (newline) edge                 node {5 [{\tt\char92par}]} (endn);
5312 \begin{scope}[red]
5313 \path (newline) edge [bend right]    node [right=25,below=3]{J} (kanji)
5314       (midline) edge                 node [below]{J} (kanji)
5315       (kanji)   edge [bend left]     node {O} (midline)
5316       (kanji)   edge                 node {10} (skipspc)
5317       (kanji)   edge [loop right]    node {G, J} (kanji)
5318       (skipspc) edge [bend left]     node {J} (kanji)
5319       (kanji)   edge                 node {5} (endk)
5320 ;
5321 \end{scope}
5322 \end{scope}
5323 \end{tikzpicture}
5324 \end{center}
5325 \end{minipage}%
5326 \begin{minipage}{.4\textwidth}
5327 \begin{description}
5328 \item[\textsf{G}] Beginning of group (usually \verb+{+)\\
5329  and ending of group (usually \verb+}+).
5330 \item[\textsf{J}] Japanese characters.
5331 \item[\textsf{5}] \textit{end-of-line} (usually \verb+^^J+).
5332 \item[\textsf{10}] space (usually \sp).
5333 \item[\textsf{O}] other characters, whose category code is in $\{3,4,6,7,8,11,12,13\}$.
5334 \item[\textsf{[\sp]}, \textsf{[{\tt\char92par}]}]
5335 emits a space, or~\verb+\par+.
5336 \end{description}
5337 \end{minipage}
5338 \begin{itemize}
5339 \item We omitted about category codes
5340 9~(\textit{ignored}), 14~(\textit{comment})~and~15~(\textit{invalid})
5341 from the above diagram. We also ignored the input like `\verb+^^A+' or `\verb+^+\verb+^df+'.
5342 \item When a character whose category code is 0 (\textit{escape character}) is seen by \TeX,
5343 the input processor scans a control sequence (\textsf{scan a c.s.}).
5344 These paths are not shown in the above diagram.
5345
5346 After that, the state is changed to State~$S$ (skipping blanks) in most cases, but
5347 to State~$M$ (middle of line) sometimes.
5348 \end{itemize}
5349 %<en>\caption{State transitions of \pTeX's input processor.}
5350 %<ja>\caption{\pTeX の入力処理部の状態遷移.}
5351 \label{fig-ptexipro}
5352 \end{figure}
5353
5354
5355 %<en>\subsection{Behavior in \LuaTeX-ja}
5356 %<ja>\subsection{\LuaTeX-jaの動作}
5357 %<zh>\subsection{\LuaTeX-ja行为}
5358 %<*en>
5359 States in the input processor of \LuaTeX\ is the same as that of \TeX,
5360 and they can't be customized by any callbacks. Hence, we can only use
5361 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
5362 suppress a space by a line break which is after Japanese characters.
5363
5364 However, \verb+token_filter+ callback cannot be used either, since a
5365 character in category code 5~(end-of-line) is converted into an space
5366 token \emph{in the input processor}.  So we can use only the
5367 \verb+process_input_buffer+ callback.  This means that suppressing a
5368 space must be done \emph{just before} an input line is read.
5369
5370 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
5371 \begin{quote}
5372 A character U+FFFFF (its category code is set to 14~(comment) by
5373 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
5374 process it}, if and only if the following three conditions are satisfied:
5375 \begin{enumerate}
5376 \item The category code of \verb+\endlinechar+%
5377 \footnote{Usually, it is $\langle${return}$\rangle$
5378       (whose character code is 13).} is 5~(end-of-line).
5379 \item The category code of U+FFFFF itself is 14~(comment).
5380 \item The input line matches the following `regular expression':
5381 \[
5382   (\text{any char})^*(\textbf{JAchar})
5383   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5384 \]
5385 \end{enumerate}
5386 \end{quote}
5387
5388 \paragraph{Remark}
5389 The following example shows the major difference from the behavior of \pTeX:
5390 \begin{LTXexample}
5391 \ltjsetparameter{autoxspacing=false}
5392 \ltjsetparameter{jacharrange={-6}}xあ
5393 y\ltjsetparameter{jacharrange={+6}}zあ
5394 u
5395 \end{LTXexample}
5396 \begin{itemize}
5397 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
5398 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
5399 \item There is no space between `あ' (in the line~3) and `u', since the
5400       line~3 ends with an \textbf{ALchar}
5401 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
5402 \end{itemize}
5403 %</en>
5404
5405 %<*ja>
5406 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,コールバックによりユーザが
5407 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
5408 きそうなコールバックとしては,\verb+process_input_buffer+や
5409 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
5410 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
5411 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
5412 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
5413 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
5414
5415 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
5416 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
5417 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
5418
5419 \begin{quote}
5420 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
5421 以下の3条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
5422 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
5423 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
5424 \begin{enumerate}
5425 \item \verb+\endlinechar+の文字\footnote{普通は,改行文字(文字コード13番)である.}
5426 のカテゴリーコードが5~(end-of-line)である.
5427 \item U+FFFFFのカテゴリーコードが14~(comment)である.
5428 \item 入力行は次の「正規表現」にマッチしている:
5429 \[
5430   (\text{any char})^*(\textbf{JAchar})
5431   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5432 \]
5433 \end{enumerate}
5434 \end{quote}
5435
5436 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
5437 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
5438 しかしながら,完全に同じ挙動が実現できたわけではない.
5439 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
5440 \begin{LTXexample}
5441 \ltjsetparameter{autoxspacing=false}
5442 \ltjsetparameter{jacharrange={-6}}xあ
5443 y\ltjsetparameter{jacharrange={+6}}zあ
5444 u
5445 \end{LTXexample}
5446 もし\pTeX とまったく同じ挙動を示すならば,出力は
5447 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
5448 上のように異なる挙動となっている.
5449 \begin{itemize}
5450 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
5451       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
5452 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
5453       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
5454 \end{itemize}
5455 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
5456 その行はそこで改行するようにした方がいいだろう.
5457 %</ja>
5458
5459
5460 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
5461 %<ja>\section{JFMグルーの挿入,\Param{kanjiskip}と\Param{xkanjiskip}}
5462 %<zh>\section{JFM的胶插入,\Param{kanjiskip}和\Param{xkanjiskip}}
5463 \label{sec-jfmglue}
5464 %<en>\subsection{Overview}
5465 %<ja>\subsection{概要}
5466 %<zh>\subsection{概要}
5467
5468 \LuaTeX-jaにおける \textbf{JAglue} の挿入方法は,\pTeX のそれとは全く異なる.
5469 \pTeX では次のような仕様であった:
5470 \begin{itemize}
5471 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
5472 追加する過程で行われる.
5473 \item \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は,水平ボックスへのパッケージングや行分割前に行われる.
5474 \item \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}はノードとしては挿入されない.パッケージングや行分割の計算時に
5475 「和文文字を表す2つの<char\_node>の間には\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}がある」ものとみなされる.
5476 \end{itemize}
5477 しかし,\LuaTeX-jaでは,水平ボックスへのパッケージングや行分割前に全ての
5478 \textbf{JAglue},即ちJFMグルー・\Param{\hyperlink{fld:xks}{xkanjiskip}}・\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の
5479 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
5480 カーニング処理がノードベースになったことに対応する変更である.
5481
5482 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
5483 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
5484 るノード達(アクセント位置補正用のカーンや,イタリック補正)をまとめたもの
5485 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
5486 には関係しないものがある.
5487
5488
5489 %<en>\subsection{definition of a `cluster'}
5490 %<ja>\subsection{「クラスタ」の定義}
5491 %<zh>\subsection{“cluster”定义}
5492
5493 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
5494 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
5495 \begin{defn}
5496 %<*en>
5497 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
5498 with the \textit{id} of it:
5499 %</en>
5500 %<*ja>
5501 \textbf{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである:
5502 %</ja>
5503 \begin{enumerate}
5504 %<*en>
5505 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
5506       nodes come from a hbox which is already packaged, by unpackaging
5507       (\verb+\unhbox+).
5508       The \textit{id} is \textit{id\_pbox}.
5509 %</en>
5510 %<*ja>
5511 \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト.
5512   これらのノードはある既にパッケージングされた水平ボックスから \verb+\unhbox+ で
5513   アンパックされたものである.
5514   その\textit{id}は\textit{id\_pbox}である.
5515 %</ja>
5516
5517 %<*en>
5518 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
5519       The \textit{id} is \textit{id\_math}.
5520 %</en>
5521 %<*ja>
5522 \item インライン数式でその境界に2つの\textit{math\_node}を含むもの.
5523   その\textit{id}は\textit{id\_math}である.
5524 %</ja>
5525
5526 %<*en>
5527 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
5528 %</en>
5529 %<*ja>
5530 \item \textit{glpyh\_node}~$p$とそれに関係するノード:
5531 %</ja>
5532 \begin{enumerate}
5533 %<*en>
5534 \item A kern for the italic correction of~$p$.
5535 %</en>
5536 %<*ja>
5537 \item $p$のイタリック補正のためのカーン.
5538 %</ja>
5539
5540 %<*en>
5541 \item An accent attached to $p$ by \verb+\accent+.
5542 %</en>
5543 %<*ja>
5544 \item \verb+\accent+ による$p$に付随したアクセント.
5545 %</ja>
5546 \end{enumerate}
5547 \[
5548 \overbrace{%
5549  \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
5550 \left\{\begin{array}{c}
5551 \Node{glyph}{accent}\\\noalign{\medskip}
5552 \Node{hbox}{accent (shifted vert.)}
5553 \end{array}\right\}\longrightarrow
5554 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
5555 \longrightarrow
5556 \Node{glyph}{$p$}\longrightarrow
5557 \overbrace{%
5558 \Node{kern}{italic corr.}}^{\text{(b)}}
5559 \]
5560
5561 %<*en>
5562 The \textit{id} is \textit{id\_jglyph} or
5563 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
5564 represents a Japanese character or not.
5565 %</en>
5566 %<*ja>
5567 \textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって
5568 \textit{id\_jglyph},もしくは\textit{id\_glyph}となる.
5569 %</ja>
5570
5571 %<*en>
5572 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
5573 The \textit{id} is \textit{id\_hlist} if the node is an
5574       hbox which is not shifted vertically, or \textit{id\_box\_like}
5575       otherwise.
5576 %</en>
5577 %<*ja>
5578 \item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\verb+\vrule+),
5579   そして\textit{unset\_node}.
5580   その\textit{id}は垂直に移動していない水平ボックスならば\textit{id\_hlist},
5581   そうでなければ\textit{id\_box\_like}となる.
5582 %</ja>
5583
5584 %<*en>
5585 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
5586 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
5587       and \textit{id\_disc}, respectively.
5588 %</en>
5589 %<*ja>
5590 \item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行.
5591   その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして
5592   \textit{id\_disc}である.
5593 %</ja>
5594 \end{enumerate}
5595 %<*en>
5596 Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster.
5597 %</en>
5598 %<*ja>
5599 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す.
5600 %</ja>
5601 \end{defn}
5602
5603 \paragraph{\textit{id}の意味}
5604 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
5605 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
5606 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
5607 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
5608 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
5609 説明用に準備した概念であって,実際のLuaコード中にそのように書かれているわけではないことに注意.
5610
5611 \begin{description}
5612 \item[\textit{id\_jglyph}] 和文文字.\\
5613 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
5614 \textit{glyph\_node}そのものである.
5615 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
5616 多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた
5617 \textit{glyph\_node}である可能性もある.
5618 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
5619 一方,後者の場合,
5620 \begin{itemize}
5621 \item $\mathit{Np}.\mathit{head}$は,
5622 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
5623 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
5624 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
5625 \end{itemize}
5626 \item[\textit{id\_math}] インライン数式.\\
5627 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
5628 「文字コード$-1$の欧文文字」とおく.
5629 \item[\textit{id\_hlist}] 縦方向にシフトされていない水平ボックス.\\
5630 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
5631 先頭・末尾のノードである.
5632 \begin{itemize}
5633 \item 状況によっては,\TeX ソースで言うと
5634 \begin{verbatim}
5635 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
5636 \end{verbatim}
5637 のように,$p$の内容が別の水平ボックスで開始・終了している可能性も十分あり得る.そのような場合,
5638 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない}水平ボックスの
5639 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
5640 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた水平ボックス,\verb+\lower1pt\hbox{xyz}+に対応するノードである.
5641 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用のカーンが
5642 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
5643 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
5644 と同様に再帰的に構成要素をたどっていく.
5645 \end{itemize}
5646 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
5647 まとめて1つのクラスタとして取り扱うだけである.
5648 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
5649 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
5650 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
5651 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
5652 全く考慮に入れない.
5653 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
5654 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
5655 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
5656 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
5657 \end{description}
5658
5659 \paragraph{クラスタの別の分類}
5660 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
5661 挿入処理では2つの隣り合ったクラスタの間に
5662 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
5663 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
5664 \begin{description}
5665 \item[和文A] リスト中に直接出現している和文文字.
5666 \textit{id}が\textit{id\_jglyph}であるか,\\
5667 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5668
5669 \item[和文B] リスト中の水平ボックスの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
5670 JFMグルーの挿入が行われない(\Param{\hyperlink{fld:xks}{xkanjiskip}},~\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は入り得る)ことである.\\
5671 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5672
5673 \item[欧文] リスト中に直接/水平ボックスの中身として出現している欧文文字.次の3つの場合が該当:
5674 \begin{itemize}
5675 \item \textit{id}が\textit{id\_glyph}である.
5676 \item \textit{id}が\textit{id\_math}である.
5677 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
5678 \end{itemize}
5679 \item[箱] box,またはそれに類似するもの.次の2つが該当:
5680 \begin{itemize}
5681 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
5682 \item \textit{id}が\textit{id\_box\_like}である.
5683 \end{itemize}
5684
5685 \end{description}
5686
5687 \subsection{段落/水平ボックスの先頭や末尾}
5688 \paragraph{先頭部の処理}
5689 まず,段落/水平ボックスの一番最初にあるクラスタ\textit{Np}を探索する.
5690 水平ボックスの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
5691 \begin{center}
5692 \verb+\parindent+由来の水平ボックス ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない
5693 ようなwhatsit.
5694 \end{center}
5695 これは,\verb+\parindent+由来の水平ボックスがクラスタを構成しないようにするためである.
5696
5697 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
5698 \begin{enumerate}
5699 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
5700 \item 問題のリストが字下げありの段落(\verb+\parindent+由来の水平ボックスあり)の場合は,
5701 この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
5702 \item そうでないとき(\verb+noindent+で開始された段落や水平ボックス)は,
5703 $g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
5704 \end{enumerate}
5705 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
5706 そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する:
5707 \begin{itemize}
5708 \item 問題にしているリストが段落であり,かつ
5709 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
5710 \end{itemize}
5711
5712 \paragraph{末尾の処理}
5713 末尾の処理は,問題のリストが段落のものか水平ボックスのものかによって異なる.
5714 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るグルー/カーンを,
5715 \textit{Nq}の直後に挿入するのみである.
5716
5717 一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と,
5718 \verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は
5719 この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
5720 \begin{enumerate}
5721 \item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する.
5722 \item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
5723 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
5724
5725 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような
5726 最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}
5727 を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
5728 \end{enumerate}
5729
5730 \subsection{概観と典型例:2つの「和文A」の場合}
5731 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
5732 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
5733 \[
5734  \Node{cluster}{\textit{Nq}}\longrightarrow
5735 \overbrace{
5736 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5737 \longrightarrow \Node{cluster}{\textit{Np}}
5738 \]
5739 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
5740 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
5741 \[
5742  \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow
5743 \overbrace{
5744 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5745 \longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}}
5746 \]
5747
5748 以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
5749 この場合が全ての場合の基本となる.
5750
5751 \paragraph{「右空白」の算出}
5752 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
5753 \begin{description}
5754 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
5755       デフォルト値\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなるので,次へ.
5756 \begin{enumerate}
5757 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),
5758       代わりに\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が挿入されることとなる.次へ.
5759 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
5760       共通に使っているJFM内で挿入される空白(グルーかカーン)が決まっているか調べ,決まっていればそれを採用.
5761 \item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである.
5762 この場合,まず
5763 \[
5764 \vcenter{\halign{\hfil$#:={}$&\inhibitglue#\inhibitglue\cr
5765 gb&(\textit{Nq}と「使用フォントが\textit{Nq}のそれと同じで,\hfil\cr
5766 \omit&\quad 文字コードが\textit{Np}のそれの文字」との間に入るグルー/カーン)\hfil\cr
5767 ga&(\inhibitglue 「使用フォントが\textit{Np}のそれと同じで,\hfil\cr
5768 \omit&\quad 文字コードが\textit{Nq}のそれの文字」と\textit{Np}との間に入るグルー/カーン)\hfil\cr
5769 }}
5770 \]
5771 として,前側の文字のJFMを使った時の空白(グルー/カーン)と,後側の文字のJFMを使った時のそれを求める.
5772
5773 $\mathit{gb}$,~$\mathit{ga}$それぞれに対する<ratio>の値を$d_b$,~$d_a$とする.
5774 \begin{itemize}
5775 \item 
5776 $\mathit{ga}$と$\mathit{gb}$の両方が未定義であるならば,JFM由来のグルーは挿入されず,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなる.どちらか片方のみが未定義であるならば,次のステップでその未定義の方は長さ0のkernで,<ratio>の値は0であるかのように扱われる.
5777 \item 
5778 \Param{\hyperlink{fld:diffjfm}{diffrentjfm}}の値が\texttt{pleft}, \texttt{pright}, \texttt{paverage}のとき,
5779 <ratio>の指定に従って比例配分を行う.
5780 JFM由来のグルー/カーンは以下の値となる:
5781 \[
5782  f\left(\frac{1-d_b}2\textit{gb} + \frac{1+d_b}2\textit{ga},
5783 \frac{1-d_a}2\textit{gb} + \frac{1+d_a}2\textit{ga}\right)
5784 \]
5785 ここで.$f(x,y)$は
5786 \[
5787  f(x,y)=\begin{cases}
5788 x&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pleft};\\
5789 y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pright};\\
5790 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{paverage};
5791 \end{cases}.
5792 \]
5793 \item 
5794 \Param{differentmet}がそれ以外の値の時は,<ratio>の値は無視され,JFM由来のグルー/カーンは以下の値となる:
5795 \[
5796  f(\textit{gb},\textit{ga})
5797 \]
5798 ここで.$f(x,y)$は
5799 \[
5800  f(x,y)=\begin{cases}
5801 \min(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{small};\\
5802 \max(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{large};\\
5803 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{average};\\
5804 x+y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{both};
5805 \end{cases}.
5806 \]
5807 \end{itemize}
5808 \end{enumerate}
5809
5810 例えば,
5811 \begin{verbatim}
5812 \jfont\foo=psft:Ryumin-Light:jfm=ujis
5813 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
5814 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
5815 \end{verbatim}
5816 という3フォントを考え,
5817 \[
5818  \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p}
5819 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q}
5820 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r}
5821 \]
5822 という3ノードを考える(それぞれ単独でクラスタをなす).
5823 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で,
5824 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる.
5825 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
5826 以下で定めた量「右空白」として採用する.
5827 この段階においては,\verb+\inhibitglue+は効力を持たないため,
5828 結果として,2つの和文文字間には常に何らかのグルー/カーンが挿入されることとなる.
5829 \begin{enumerate}
5830 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
5831 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
5832 \item ユーザ側から見た\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5833 なければ,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの値を持つglueを採用する.
5834 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値を用いる.
5835 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
5836 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
5837 \end{enumerate}
5838 \end{description}
5839 \paragraph{「左空白」の算出とそれに伴う補正}
5840 「左空白」は過去のバージョンでは定義していたが,このバージョンでは挿入は一切行われない(機能自体削除している).しかし,仕様は流動的であり,将来復活する可能性もあるため,マニュアル中の記述は今のところ極力変更しない.
5841 % 次に,「左空白」にあたる量を算出する:
5842 % \begin{description}
5843 % \item[line-end~{[E]}]
5844 % \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
5845 % \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
5846 % \begin{enumerate}
5847 % \item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
5848 % \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
5849 % \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
5850 % \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
5851 % \end{enumerate}
5852 % \end{description}
5853 \paragraph{禁則用ペナルティの挿入}
5854 まず,
5855 \[
5856  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値})
5857 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値})
5858 \]
5859 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
5860 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
5861 算出では単純な整数の加減算を行う.
5862
5863 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
5864 \begin{description}
5865 \item[P-normal~{[PN]}]
5866 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
5867 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
5868 また,$10000 + (-10000) = 0$としている.
5869
5870 少々困るのは,(a)部分にペナルティが存在していない場合である.
5871 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
5872 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
5873 ということになるが,実際には僅かにこれより複雑である.
5874 \begin{itemize}
5875 \item 「右空白」がカーンであるとき,
5876 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
5877 この場合は$a\neq 0$であってもペナルティの挿入はしない.
5878 \item 「左空白」がカーンとしてきっちり定義されている時(このとき,「右空白」はカーンでない),
5879 この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
5880 \textit{penalty\_node}を作って挿入する.
5881 \item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
5882 \end{itemize}
5883 \end{description}
5884
5885 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
5886   \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$}
5887 \begin{table}[t]
5888 %<en>\caption{Summary of JFM glues.}
5889 %<ja>\caption{JFM グルーの概要.}
5890 %<zh>\caption{JFM胶总结。}
5891 \label{tab-jfmglue}
5892 \begin{center}
5893 \small
5894 \begin{tabular}{c|cccccc}
5895 \toprule
5896 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
5897 \sf 和文A&
5898 \gkf{E}{M→K}{PN}&
5899 \gkf{---}{\OA →K}{PN}&
5900 \gkf{---}{\OA →X}{PN}&
5901 \gkf{---}{\OA}{PA}&
5902 \gkf{---}{\OA}{PN}&
5903 \gkf{---}{\OA}{PS}\\
5904 \sf 和文B&
5905 \gkf{E}{\OB→K}{PA}&
5906 \gkf{---}{K}{PS}&
5907 \gkf{---}{X}{PS}\\
5908 \sf 欧文&
5909 \gkf{E}{\OB →X}{PA}&
5910 \gkf{---}{X}{PS}\cr
5911 \sf 箱&\gkf{E}{\OB}{PA}\\
5912 \sf glue&\gkf{E}{\OB}{PN}\\
5913 \sf kern&\gkf{E}{\OB}{PS}\\
5914 \bottomrule
5915 \end{tabular}
5916 \end{center}
5917 \begin{quote}
5918 %<*en>
5919 Here {\small\gkf{E}{M→K}{PN}} means that
5920 %</en>
5921 %<*ja>
5922 ここで {\small\gkf{E}{M→K}{PN}} は次の意味である:
5923 %</ja>
5924 \begin{enumerate}
5925 %<*en>
5926 \item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'.
5927 If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'.
5928 %</en>
5929 %<*ja>
5930 \item 「右空白」を決めるために,\LuaTeX-ja はまず「JFM由来{[M]}」の方法を試みる.
5931   これが失敗したら,\LuaTeX-ja は「\Param{kanjiskip}~{[K]}」の方法を試みる.
5932 %</ja>
5933
5934 %<*en>
5935 \item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'.
5936 %</en>
5937 %<*ja>
5938 \item \textit{Nq} と \textit{Np} の間の「左空白」は「\textsf{line-end~[E]}」の
5939   方法で決定される.
5940 %</ja>
5941
5942 %<*en>
5943 \item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}.
5944 %</en>
5945 %<*ja>
5946 \item \LuaTeX-jaは2つのクラスタの間の禁則処理用のペナルティを調節するために「\textsf{P-normal~[PN]}」の方法を採用する.
5947 %</ja>
5948 \end{enumerate}
5949 \end{quote}
5950 \end{table}
5951
5952 \subsection{その他の場合}
5953 本節の内容は表\ref{tab-jfmglue}にまとめてある.
5954
5955 \paragraph{和文Aと欧文の間}
5956 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
5957 \begin{itemize}
5958 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5959 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
5960 \item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ.
5961 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
5962 \end{itemize}
5963 \begin{description}
5964 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
5965 未定義でなければそれを「右空白」として採用する.
5966 \textsf{JFM-origin~[M]}の変種と考えて良い.
5967 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
5968 \begin{enumerate}
5969 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
5970 \item そうでなければ,
5971 \textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るグルー/カーンとして定まる.
5972 \end{enumerate}
5973 \item[\Param{\hyperlink{fld:xks}{xkanjiskip}}~{[X]}]
5974 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
5975 以下で定めた量を「右空白」として採用する.
5976 この段階で\verb+\inhibitglue+は効力を持たないのも同じである.
5977 \begin{enumerate}
5978 \item 以下のいずれかの場合は,\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
5979 \begin{itemize}
5980 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
5981 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5982 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
5983 \item \textit{Np}の中身の文字コードについて,「直前への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5984 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
5985 \end{itemize}
5986 \item ユーザ側から見た\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5987 なければ,\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの値を持つglueを採用する.
5988 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
5989 で使われているJFMに指定されている\Param{\hyperlink{fld:xks}{xkanjiskip}}の値を用いる.
5990 \end{enumerate}
5991 \end{description}
5992
5993 \paragraph{欧文と和文Aの間}
5994 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
5995 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
5996 \begin{itemize}
5997 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
5998 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
5999 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
6000 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
6001 \end{itemize}
6002 \begin{description}
6003 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
6004 未定義でなければそれを「右空白」として採用する.
6005 \textsf{JFM-origin~[M]}の変種と考えて良い.
6006 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
6007 \begin{enumerate}
6008 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
6009 \item そうでなければ,
6010 「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るグルー/カーンとして定まる.
6011 \end{enumerate}
6012 \end{description}
6013
6014 \paragraph{和文Aと箱・グルー・カーンの間}
6015 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・グルー・カーンのいずれかであった場合,
6016 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
6017 ペナルティの挿入処理は若干異なったものとなっている.
6018
6019 \begin{itemize}
6020 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
6021 それが失敗した場合は,「右空白」は挿入されない.
6022 \item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
6023 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
6024 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
6025 「$\mathit{Np}.\mathit{head}$に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値」は0とみなされる.言い換えれば,
6026 \[
6027  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値}).
6028 \]
6029 \begin{description}
6030 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
6031 (明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため,
6032 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
6033 \item[グルー] \textit{Np}がグルーの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
6034 \item[カーン] \textit{Np}がカーンであった場合は,両クラスタの間での行分割は
6035 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
6036 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
6037 \end{description}
6038 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
6039 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
6040 \end{itemize}
6041
6042 \begin{description}
6043 \item[P-allow~{[PA]}]
6044 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
6045 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
6046
6047 (a)部分にペナルティが存在していない場合,
6048 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
6049 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
6050 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
6051 \begin{itemize}
6052 \item 「右空白」がグルーでない(カーンか未定義)であるとき.
6053 \item 「左空白」がカーンとしてきっちり定義されている時.
6054 \end{itemize}
6055
6056 \item[P-suppress~{[PS]}]
6057 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
6058 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
6059
6060 (a)部分にペナルティが存在していない場合,
6061 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
6062 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
6063 そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する.
6064 \end{description}
6065
6066 なお,「右空白」はカーン,「左空白」は未定義の
6067 \[
6068  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6069 \]
6070 のような状況を考える.
6071 このとき,$a$,即ち「あ」の\Param{\hyperlink{fld:postbp}{postbreakpenalty}}がいかなる値であっても,
6072 この2クラスタ間は最終的に
6073 \begin{equation}
6074  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
6075 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6076 \label{eq-gref}
6077 \end{equation}
6078 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
6079 \Param{\hyperlink{fld:postbp}{postbreakpenalty}}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
6080 \eqref{eq-gref}と
6081 \[
6082  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
6083 \Node{penalty}{$a$}\longrightarrow
6084 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6085 \]
6086 との間に差異は生じない%
6087 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
6088 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
6089
6090 \paragraph{箱・グルー・カーンと和文Aの間}
6091 \textit{Np}が\textsf{箱}・グルー・カーンのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
6092 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意.
6093 \begin{itemize}
6094 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
6095 それが失敗した場合は,「右空白」は挿入されない.
6096 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
6097 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
6098 $\mathit{Nq}.\mathit{tail}$は無意味なので,
6099 \[
6100  a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値}).
6101 \]
6102 \begin{description}
6103 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
6104 \item[グルー] \textit{Nq}がグルーの場合は,\textsf{P-normal~[PN]}を用いる.
6105 \item[カーン] \textit{Nq}がカーンの場合は,\textsf{P-suppress~[PS]}を用いる.
6106 \end{description}
6107 \end{itemize}
6108
6109 \paragraph{和文Aと和文Bの違い}
6110 先に述べたように,\textsf{和文B}は水平ボックスの中身の先頭(or 末尾)として出現している
6111 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
6112 \begin{itemize}
6113 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
6114 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
6115 「左空白」の算出も行われない.例えば,
6116 \begin{itemize}
6117 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
6118 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
6119 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
6120 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
6121 \end{itemize}
6122 \item \textsf{和文B}と箱・グルー・カーンが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
6123 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
6124 \textsf{P-suppress~[PS]}が用いられる.
6125 \item \textsf{和文B}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}},~\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値は使われず,0として計算される.
6126 \end{itemize}
6127
6128
6129 次が具体例である:
6130 \begin{LTXexample}
6131 あ.\inhibitglue A\\
6132 \hbox{あ.}A\\
6133 あ.A
6134 \end{LTXexample}
6135 \begin{itemize}
6136 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
6137 \Param{\hyperlink{fld:xks}{xkanjiskip}}(四分アキ)が入ることに注意.
6138 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(水平ボックスの中身の末尾として登場しているから)ので,
6139 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{\hyperlink{fld:xks}{xkanjiskip}}が入ることとなる.
6140 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
6141 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
6142 \end{itemize}
6143
6144 \section{psft}
6145 ...
6146
6147 %<en>\section{Patch for the \Pkg{listings} package}
6148 %<zh>\section{Patch for the \Pkg{listings} package}
6149 %<ja>\section{\Pkg{listings} パッケージへの対応}
6150
6151 %<*en>
6152 It is well-known that the \Pkg{listings} package outputs weird results
6153 for Japanese input.
6154 The \Pkg{listings} package makes most of letters active and assigns
6155 output command for each letter \cite{listings}.
6156 But Japanese characters are not included in these activated letters.
6157 For \pTeX{} series, there is no method to make Japanese characters active;
6158 a patch \Pkg{jlisting.sty} \cite{jlisting} resolves the problem forcibly.
6159 %</en>
6160 %<*ja>
6161 \Pkg{listings} パッケージが,そのままでは日本語をまともに出力できないこと
6162 はよく知られている.きちんと整形して出力するために,\Pkg{listings}パッケー
6163 ジは内部で「ほとんどの文字」をアクティブにし,各文字に対してその文字の出
6164 力命令を割り当てている \cite{listings}.
6165 しかし,そこでアクティブにする文字の中に,和文文
6166 字がないためである.\pTeX 系列では,和文文字をアクティブにする手法がなく,
6167 \Pkg{jlisting.sty} というパッチ\cite{jlisting}を用いることで無理やり解決していた.
6168 %</ja>
6169
6170 %<*en>
6171 In \LuaTeX-ja, the problem is resolved by using \verb+process_input_buffer+ callback.
6172 The callback function inserts the output command before each letter above U+0080.
6173 This method can omits the process to make all Japanese characters active
6174 (most of the activated characters are not used in many cases).
6175 %</en>
6176 %<*ja>
6177 \LuaTeX-jaでは,\verb+process_input_buffer+ コールバックを利用することで,
6178 「各行に出現するU+0080以降の文字に対して,それらの出力命令を前置する」という方法をとっている.
6179 これにより,(入力には使用されていないかもしれない)和文文字をもすべてアクティブ化する手間もなく,
6180 見通しが良い実装になっている.
6181 %</ja>
6182
6183 %<*en>
6184 If \Pkg{listings.sty} and \LuaTeX-ja were loaded,
6185 then the patch \Pkg{lltjp-listings.sty} is loaded automatically at \verb+\begin{document}+.
6186 %</en>
6187 %<*ja>
6188 \LuaTeX-ja で利用される \Pkg{listings} パッケージへのパッチ \Pkg{lltjp-listings.sty} は,
6189 \Pkg{listings.sty} と\LuaTeX-jaを読み込んでおけば,
6190 \verb+\begin{document}+ の箇所において自動的に読み込まれるので,通常はあまり
6191 意識する必要はない.
6192 %</ja>
6193
6194 %<en>\paragraph{Class of characters}
6195 %<ja>\paragraph{文字種}
6196
6197 %<*en>
6198 Roughly speaking, the \Pkg{listings} package processes input as follows:
6199 %</en>
6200 %<*ja>
6201 \Pkg{listings} パッケージの内部では,大雑把に言うと
6202 %</ja>
6203 \begin{enumerate}
6204 %<zh>\item ...
6205 %<*en>
6206 \item Collects \textit{letters} and \textit{digits}, which can be used for the name of identifiers.
6207 %</en>
6208 %<*ja>
6209 \item 識別子として使える文字 (``letter'',~``digit'') たちを
6210 集める.
6211 %</ja>
6212 %<*en>
6213 \item When reading an \textit{other}, outputs the collected character string (with modification, if needed).
6214 %</en>
6215 %<*ja>
6216 \item letterでもdigitでもない文字が現れた時に,収集した文字列を(必要なら修飾して)出力する.
6217 %</ja>
6218 %<*en>
6219 \item Collects \textit{others}.
6220 %</en>
6221 %<*ja>
6222 \item 今度は逆に,letterでない文字たちをletterが現れるまで集める.
6223 %</ja>
6224 %<*en>
6225 \item When reading a \textit{letter} or a \textit{digit}, outputs the collected character string.
6226 %</en>
6227 %<*ja>
6228 \item letterが出現したら集めた文字列を出力する.
6229 %</ja>
6230 %<*en>
6231 \item Turns back to 1.
6232 %</en>
6233 %<*ja>
6234 \item 1.に戻る.
6235 %</ja>
6236 \end{enumerate}
6237 %<*en>
6238 By the above process, line breaks inside of an identifier are blocked.
6239 A flag \verb+\lst@ifletter+ indicates whether the previous character can be used
6240 for the name of identifiers or not.
6241 %</en>
6242 %<*ja>
6243 という処理が行われている.これにより,識別子の途中では行分割が行われないようになっている.
6244 直前の文字が識別子として使えるか否かは \verb+\lst@ifletter+ というフラグに格納されている.
6245 %</ja>
6246
6247 %<*en>
6248 For Japanese characters, line breaks are permitted on both sides
6249 except for parentheses, dashes, etc.
6250 To process Japanese characters,
6251 The pacth \Pkg{lltjp-listings.sty} introduces a new flag \verb+\lst@ifkanji+, which indicates
6252 whether the previous character is Japanese character or not.
6253 For illustration, we introduce the following classes of character:
6254 %</en>
6255 %<*ja>
6256 さて,日本語の処理である.殆どの和文文字の前後では行分割が可能であるが,その一方で
6257 括弧類や音引きなどでは禁則処理が必要なことから,\Pkg{lltjp-listings.sty} では,
6258 直前が和文文字であるかを示すフラグ \verb+\lst@ifkanji+ を新たに導入した.
6259 以降,説明のために以下のように文字を分類する:
6260 %</ja>
6261 \begin{center}
6262 \small
6263 \begin{tabular}{lccccc}
6264 \toprule
6265 &Letter&Other&Kanji&Open&Close\\\midrule
6266 \verb+\lst@ifletter+&T&F&T&F&T\\
6267 \verb+\lst@ifkanji+&F&F&T&T&F\\
6268 %<en>Meaning&identifier char&other alphabet&most of Japanese char&open paren&close paren\\
6269 %<ja>意図&識別子中の文字&その他欧文文字&殆どの和文文字&開き括弧類&閉じ括弧類\\
6270 \bottomrule
6271 \end{tabular}
6272 \end{center}
6273 %<*en>
6274 Note that \textit{digits} in the \Pkg{listings} package can be Letter or
6275 Other according to circumstances.
6276 %</en>
6277 %<*ja>
6278 なお,本来の\Pkg{listings} パッケージでの分類``digit''は,
6279 出現状況によって,上の表のLetterとOtherのどちらにもなりうる.
6280 また,KanjiとCloseは \verb+\lst@ifletter+ と \verb+\lst@ifkanji+ の値が一致しているが,
6281 これは間違いではない.
6282 %</ja>
6283
6284 %<*en>
6285 For example, let us consider the case an Open comes after a Letter.
6286 Since an Open represents Japanese open parenthesis,
6287 it is preferred to be permitted to insert line break after the Letter.
6288 Therefore, the collected character string is output in this case.
6289 %</en>
6290 %<*ja>
6291 例えば,Letterの直後にOpenが来た場合を考える.
6292 文字種Openは和文開き括弧類を想定しているので,Letterの直後では行分割が可能であることが望ましい.
6293 そのため,この場合では,すでに収集されている文字列を出力することで行分割を許容するようにした.
6294 %</ja>
6295
6296 %<*en>
6297 The following table summarizes $5\times 5=25$ cases:
6298 %</en>
6299 %<*ja>
6300 同じように,$5\times 5=25$通り全てについて書くと,次のようになる:
6301 %</ja>
6302 \begin{center}
6303 \small
6304 \begin{tabular}{llccccc}
6305 \toprule
6306 %<*en>
6307 &&\multicolumn{4}{c}{Next}\\\cmidrule(lr){3-7}
6308 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6309 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6310 &Letter&collects&\multicolumn{3}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6311 &Other&outputs&collects&\multicolumn{2}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6312 Prev&Kanji&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6313 &Open&\multicolumn{5}{c}{\hrulefill \ collects\ \hrulefill}\\
6314 &Close&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6315 %</en>
6316 %<*ja>
6317 &&\multicolumn{4}{c}{後ろ側の文字}\\\cmidrule(lr){3-7}
6318 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6319 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6320 直&Letter&収集&\multicolumn{3}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6321 前&Other&出力&収集&\multicolumn{2}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6322 文&Kanji&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6323 字&Open&\multicolumn{5}{c}{\hrulefill \ 収集\ \hrulefill}\\
6324 種&Close&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6325 %</ja>
6326 \bottomrule
6327 \end{tabular}
6328 \end{center}
6329 %<en>In the above table,
6330 %<ja>上の表において,
6331 \begin{itemize}
6332 %<zh>\item ...
6333 %<en>\item ``outputs'' means to output the collected character string (i.e., line breaking is permitted there).
6334 %<ja>\item 「出力」は,それまでに集めた文字列を出力(≒ここで行分割可能)を意味する.
6335
6336 %<en>\item ``collects'' means to append the next character to the collected character string (i.e., line breaking is prohibited there).
6337 %<ja>\item 「収集」は,後側の文字を,現在収集された文字列に追加(行分割不可)を意味する.
6338 \end{itemize}
6339
6340 %<en>\paragraph{Classification of characters}
6341 %<ja>\paragraph{和文文字扱いとなる文字}
6342
6343 %<*en>
6344 Characters are classified according to \Param{jacharrange} parameter (see Section \ref{ssec-setrange}):
6345 %</en>
6346 %<*ja>
6347 \Pkg{listings} パッケージにおいて和文文字と扱われる
6348 (前に述べたKanji, Open,あるいは「閉じ括弧類」分類)か否かは,
6349 通常の\textbf{JAchar}/\textbf{Alchar}の範囲の設定(\Param{jacharrange} パラメータ,\ref{ssec-setrange}節を参照)に従って行われる:
6350 %</ja>
6351 \begin{itemize}
6352 %<zh>\item ...
6353
6354 %<en>\item \textbf{ALchars} above U+0080 are Letter.
6355 %<ja>\item (U+0080以降の)\textbf{ALchar}は,すべてLetter扱いである.
6356
6357 %<en>\item \textbf{JAchars} are classified in the order as follows:
6358 %<ja>\item (U+0080以降の)\textbf{JAchar}については,以下の順序に従って文字種を決める:
6359 \begin{enumerate}
6360 %<zh>\item ...
6361 %<en>\item Characters whose \Param{\hyperlink{fld:prebp}{prebreakpenalty}} is greater than or equal to 0 are Open.
6362 %<ja>\item \Param{\hyperlink{fld:prebp}{prebreakpenalty}}が0以上の文字はOpen扱いである.
6363
6364 %<en>\item Characters whose \Param{\hyperlink{fld:postbp}{postbreakpenalty}} is greater than or equal to 0 are Close.
6365 %<ja>\item \Param{\hyperlink{fld:postbp}{postbreakpenalty}}が0以上の文字はClose扱いである.
6366
6367 %<en>\item Characters that don't satisfy the above two conditions are Kanji.
6368 %<ja>\item 上の2条件のどちらにも当てはまらなかった文字は,Kanji扱いである.
6369 \end{enumerate}
6370 \end{itemize}
6371
6372 %<*en>
6373 The width of halfwidth kana (U+FF61--U+FF9F) is same as the width of \textbf{ALchar};
6374 the width of the other \textbf{JAchars} is double the width of \textbf{ALchar}.
6375 %</en>
6376 %<*ja>
6377 なお,半角カナ(U+FF61--U+FF9F)以外の\textbf{JAchar}は欧文文字2文字分の幅をとるものとみなされる.
6378 半角カナは欧文文字1文字分の幅となる.
6379 %</ja>
6380
6381 %<*en>
6382 The classification process is executed every time a character appears in
6383 listing environments.
6384 %</en>
6385 %<*ja>
6386 これらの文字種決定は,実際に \texttt{lstlisting} 環境などの内部で文字が出てくるたびに行われる.
6387 %</ja>
6388
6389 %<*ja>
6390 \section{和文の行長補正方法}
6391 \label{sec-adjspec}
6392 \texttt{luatexja-adjust.sty} で提供される優先順位付きの行長調整の詳細を述
6393 べる.大まかに述べると,次のようになる.
6394 \begin{itemize}
6395 \item 通常の\TeX の行分割方法に従って,段落を行分割する.この段階では,行
6396       長に半端が出た場合,その半端分は\Param{\hyperlink{fld:xks}{xkanjiskip}},
6397       \Param{\hyperlink{fld:kanjiskip}{kanjiskip}},JFMグルーの全てで(優先順位なく)負担される.
6398 \item その後,\texttt{post\_linebreak\_filter} callbackを使い,\textbf{段
6399       落中の各行ごとに},行末文字の位置を調整したり,優先度付きの行長調整
6400       を実現するためにグルーの伸縮度を調整する.
6401 \texttt{luatexja-adjust.sty} の作用は,このcallbackを追加するだけであり,
6402       この章の残りではcallbackでの処理について解説する.
6403 \end{itemize}
6404
6405 \paragraph{準備:合計伸縮量の計算}
6406 グルーの伸縮度(\texttt{plus} や \texttt{minus} で指定されている値)には,
6407 有限値の他に,\texttt{fi},\texttt{fil},\texttt{fill},\texttt{filll}と
6408 いう4つの無限大レベル(後ろの方ほど大きい)があり,行の調整に
6409 \texttt{fi} などの\textbf{無限大レベルの伸縮度が用いられている場合は,そ
6410 の行に対しての処理を中止}する.
6411
6412 よって,以降,問題にしている行の行長調整は伸縮度が有限長のグルーを用いて
6413 行われているとして良い.まず,段落中の行中のグルーを
6414 \begin{itemize}
6415 \item 下のどれにも該当しないグルー
6416 \item JFMグルー(優先度別にまとめられる)
6417 \item 和欧文間空白(\Param{\hyperlink{fld:xks}{xkanjiskip}})
6418 \item 和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})
6419 \end{itemize}
6420 の$1+1+5+1=8$つに類別し,それぞれの種別ごとに許容されている伸縮度の合計を計算する.
6421 また,行長と自然長との差の絶対値を計算し,それを\textit{total}とおく.
6422
6423 \subsection{行末文字の位置調整}
6424 まず,行末が文字クラス$n$の\textbf{Jachar}であった場合,
6425 それを動かすことによって,\textbf{JAglue} が負担する調整量を少なくしようとする.
6426 この行末文字の左右の移動可能量は,JFM中にある文字クラス$n$の定義の
6427 \texttt{end\_stretch},~\texttt{end\_shrink}フィールドに全角単位の値として記述されている.
6428
6429 例えば,行末文字が句点「。」であり,そこで用いられているJFM中に
6430 \begin{verbatim}
6431   [2] = {
6432     chars = { '。', ... }, width = 0.5, ...,
6433     end_stretch = 0.5, end_shrink = 0.5,
6434   }, 
6435 \end{verbatim}
6436 という指定があった場合,この行末の句点は
6437 \begin{itemize}
6438 \item 通常の\TeX の行分割処理で「半角以上の詰め」が行われていた場合,
6439 この分の行中の\textbf{JAglue}の負担を軽減するため,
6440 行末の句点を半角だけ右に移動する(ぶら下げ組を行う).
6441 \item 通常の\TeX の行分割処理で「半角以上の空き」が行われていた場合,
6442 逆に行末句点を半角左に移動させる(見た目的に全角取りとなる).
6443 \item 以上のどちらでもない場合,行末句点の位置調整は行わない.
6444 \end{itemize}
6445 となる.
6446
6447 行末文字を移動した場合,その分だけ\textit{total}の値を引いておく.
6448
6449 \subsection{グルーの調整}
6450 \textit{total}の分だけが,行中のグルーの伸縮度に応じて負担されることになる.
6451 ……
6452
6453 %</ja>
6454
6455 %<*en>
6456 \section{Advanced line-adjustment for Japanese characters}
6457 \dots
6458 %</en>
6459
6460
6461
6462
6463 \begin{thebibliography}{99}
6464   \addcontentsline{toc}{section}{\refname}
6465 \bibitem{texbytopic}
6466 Victor Eijkhout,  \emph{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
6467 \bibitem{listings} C.\ Heinz, B.\ Moses. The \textsf{Listings} Package.
6468 \bibitem{jlisting} Thor Watanabe. Listings\ -\ MyTeXpert. \newblock
6469 \url{http://mytexpert.sourceforge.jp/index.php?Listings}
6470 \bibitem{min10} 乙部厳己,min10フォントについて.
6471 \url{http://argent.shinshu-u.ac.jp/~otobe/tex/files/min10.pdf}
6472 \bibitem{jlreq}  W3C Japanese Layout Task Force~(ed), Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \newblock
6473 \url{http://www.w3.org/TR/jlreq/}%
6474 %<ja> \\日本語訳の書籍版:W3C日本語組版タスクフォース(編),『W3C技術ノート 日本語組版処理の要件』,東京電機大学出版局,2012.
6475 \bibitem{x4051} 日本工業規格(Japanese Industrial Standard) JIS~X~4051,
6476 日本語文書の組版方法(Formatting rules for Japanese documents), 1993, 1995, 2004.
6477 \end{thebibliography}
6478
6479 \newpage
6480 \appendix
6481 \batchmode
6482 %<*!zh>
6483 %<en>\section{The category code of non-kanji characters defined in JIS~X~0213}
6484 %<ja>\section{\LuaTeX-jaにおけるJIS~X~0213非漢字のcatcode}
6485
6486 %<*en>
6487 In these tables, the default catcode (\LuaTeX-ja) and kcatcode ((u)\pTeX) of non-kanji
6488 characters defined in JIS~X~0213 from row 1 to row 13 is summarized.
6489 Each character is printed as follows:
6490 %</en>
6491 %<*ja>
6492 ここでは,JIS~X~0213の非漢字部分(第1区〜第13区)のうち,
6493 どの文字が(u)\pTeX や\LuaTeX-jaで制御綴内に使用可能かを表にしてまとめる.
6494 各文字は
6495 %</ja>
6496 \begin{center}
6497 \tt\fboxsep=1pt\fbox{\hbox to \zw{\gt あ\hss}}\,\scriptsize LUP
6498 \end{center}
6499 %<*ja>
6500 のように表示しており,各文字は次の意味を持っている.
6501 この表の生成は,JIS~X~0208の範囲内の文字については\verb+\jis+命令を使って行なっている.
6502 %</ja>
6503 %<*en>
6504 The tables are generated by using \verb+\jis+ command for characters included in
6505 JIS~X~0208.
6506 Each character in the tables means:
6507 %</en>
6508 \begin{itemize}
6509 %<*en>
6510 \item The background of a character regarded as \textbf{ALchar} in \LuaTeX-ja
6511   is colored light blue.
6512 %</en>
6513 %<*ja>
6514 \item 背景が薄く青く塗られている文字は,
6515 \LuaTeX-ja の標準で\textbf{ALchar}として認識されている文字である.
6516 %</ja>
6517
6518 %<*en>
6519 \item The first letter {\tt L} means that the character is available for
6520   the name of a control sequence in \XeTeX{} and \LuaTeX-ja (its catcode is 11).
6521 %</en>
6522 %<*ja>
6523 \item 1文字目の {\tt L} は,\XeTeX や\LuaTeX-jaにおいてこの文字が制御綴内に
6524 使用可能(catcodeが11)であることを表している.
6525 %</ja>
6526
6527 %<*en>
6528 \item The second letter {\tt U} means that the character is available for
6529   the name of a control sequence in \upTeX{} (its kcatcode is 16 or 17).
6530   \upTeX{} regards these characters as Japanese character.
6531 %</en>
6532 %<*ja>
6533 \item 2文字目の{\tt U} は,\upTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
6534 表している.この範囲内では,\upTeX は標準で全文字を和文文字として扱うようである.
6535 %</ja>
6536
6537 %<*en>
6538 \item The third letter {\tt P} means that the character is available for
6539   the name of a control sequence in \pTeX{} (its kcatcode is 16 or 17).
6540 %</en>
6541 %<*ja>
6542 \item 3文字目の {\tt P} は,\pTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
6543 表している.
6544 %</ja>
6545
6546 %<*en>
6547 \item If the third letter is {\tt -} (or the character is printed in red),
6548   the character is not included in JIS~X~0208.
6549   Therefore, you can consider the character is not available in \pTeX.
6550 %</en>
6551 %<*ja>
6552 \item 3文字目が{\tt -}となっているもの(本体の文字も赤身がかっている)は,
6553 JIS~X~0208にないため\pTeX では使用不能と考えて良いものである.
6554 %</ja>
6555
6556 %<*en>
6557 \item The kana for bidakuon in row 4 and 5 are omitted.
6558 %</en>
6559 %<*ja>
6560 \item 第4区と第5区にある,鼻濁音の仮名については省略した.
6561 %</ja>
6562 \end{itemize}
6563
6564
6565 \makeatletter
6566 \def\uplist{% upTeX で \kcatcode!=18 なもの
6567   \@elt {8486}\@elt {8491}\@elt {8492}\@elt {8499}\@elt {8500}\@elt {8501}%
6568   \@elt {8502}\@elt {8504}\@elt {8508}\@elt {9008}\@elt {9009}\@elt {9010}%
6569   \@elt {9011}\@elt {9012}\@elt {9013}\@elt {9014}\@elt {9015}\@elt {9016}%
6570   \@elt {9017}\@elt {9025}\@elt {9026}\@elt {9027}\@elt {9028}\@elt {9029}%
6571   \@elt {9030}\@elt {9031}\@elt {9032}\@elt {9033}\@elt {9034}\@elt {9035}%
6572   \@elt {9036}\@elt {9037}\@elt {9038}\@elt {9039}\@elt {9040}\@elt {9041}%
6573   \@elt {9042}\@elt {9043}\@elt {9044}\@elt {9045}\@elt {9046}\@elt {9047}%
6574   \@elt {9048}\@elt {9049}\@elt {9050}\@elt {9057}\@elt {9058}\@elt {9059}%
6575   \@elt {9060}\@elt {9061}\@elt {9062}\@elt {9063}\@elt {9064}\@elt {9065}%
6576   \@elt {9066}\@elt {9067}\@elt {9068}\@elt {9069}\@elt {9070}\@elt {9071}%
6577   \@elt {9072}\@elt {9073}\@elt {9074}\@elt {9075}\@elt {9076}\@elt {9077}%
6578   \@elt {9078}\@elt {9079}\@elt {9080}\@elt {9081}\@elt {9082}\@elt {9249}%
6579   \@elt {9250}\@elt {9251}\@elt {9252}\@elt {9253}\@elt {9254}\@elt {9255}%
6580   \@elt {9256}\@elt {9257}\@elt {9258}\@elt {9259}\@elt {9260}\@elt {9261}%
6581   \@elt {9262}\@elt {9263}\@elt {9264}\@elt {9265}\@elt {9266}\@elt {9267}%
6582   \@elt {9268}\@elt {9269}\@elt {9270}\@elt {9271}\@elt {9272}\@elt {9273}%
6583   \@elt {9274}\@elt {9275}\@elt {9276}\@elt {9277}\@elt {9278}\@elt {9279}%
6584   \@elt {9280}\@elt {9281}\@elt {9282}\@elt {9283}\@elt {9284}\@elt {9285}%
6585   \@elt {9286}\@elt {9287}\@elt {9288}\@elt {9289}\@elt {9290}\@elt {9291}%
6586   \@elt {9292}\@elt {9293}\@elt {9294}\@elt {9295}\@elt {9296}\@elt {9297}%
6587   \@elt {9298}\@elt {9299}\@elt {9300}\@elt {9301}\@elt {9302}\@elt {9303}%
6588   \@elt {9304}\@elt {9305}\@elt {9306}\@elt {9307}\@elt {9308}\@elt {9309}%
6589   \@elt {9310}\@elt {9311}\@elt {9312}\@elt {9313}\@elt {9314}\@elt {9315}%
6590   \@elt {9316}\@elt {9317}\@elt {9318}\@elt {9319}\@elt {9320}\@elt {9321}%
6591   \@elt {9322}\@elt {9323}\@elt {9324}\@elt {9325}\@elt {9326}\@elt {9327}%
6592   \@elt {9328}\@elt {9329}\@elt {9330}\@elt {9331}\@elt {9505}\@elt {9506}%
6593   \@elt {9507}\@elt {9508}\@elt {9509}\@elt {9510}\@elt {9511}\@elt {9512}%
6594   \@elt {9513}\@elt {9514}\@elt {9515}\@elt {9516}\@elt {9517}\@elt {9518}%
6595   \@elt {9519}\@elt {9520}\@elt {9521}\@elt {9522}\@elt {9523}\@elt {9524}%
6596   \@elt {9525}\@elt {9526}\@elt {9527}\@elt {9528}\@elt {9529}\@elt {9530}%
6597   \@elt {9531}\@elt {9532}\@elt {9533}\@elt {9534}\@elt {9535}\@elt {9536}%
6598   \@elt {9537}\@elt {9538}\@elt {9539}\@elt {9540}\@elt {9541}\@elt {9542}%
6599   \@elt {9543}\@elt {9544}\@elt {9545}\@elt {9546}\@elt {9547}\@elt {9548}%
6600   \@elt {9549}\@elt {9550}\@elt {9551}\@elt {9552}\@elt {9553}\@elt {9554}%
6601   \@elt {9555}\@elt {9556}\@elt {9557}\@elt {9558}\@elt {9559}\@elt {9560}%
6602   \@elt {9561}\@elt {9562}\@elt {9563}\@elt {9564}\@elt {9565}\@elt {9566}%
6603   \@elt {9567}\@elt {9568}\@elt {9569}\@elt {9570}\@elt {9571}\@elt {9572}%
6604   \@elt {9573}\@elt {9574}\@elt {9575}\@elt {9576}\@elt {9577}\@elt {9578}%
6605   \@elt {9579}\@elt {9580}\@elt {9581}\@elt {9582}\@elt {9583}\@elt {9584}%
6606   \@elt {9585}\@elt {9586}\@elt {9587}\@elt {9588}\@elt {9589}\@elt {9590}%
6607   % ここから JIS X 0213
6608   \@elt {8760}\@elt {8761}\@elt {9083}\@elt {9332}\@elt {9333}\@elt {9334}%
6609   \@elt {9335}\@elt {9336}\@elt {9337}\@elt {9338}\@elt {9339}\@elt {9591}%
6610   \@elt {9592}\@elt {9593}\@elt {9594}\@elt {9595}\@elt {9596}\@elt {9597}%
6611   \@elt {9598}\@elt {9838}\@elt {9839}\@elt {9840}\@elt {9841}\@elt {9842}%
6612   \@elt {9843}\@elt {9844}\@elt {9845}\@elt {9846}\@elt {9847}\@elt {9848}%
6613   \@elt {9849}\@elt {9850}\@elt {9851}\@elt {9852}\@elt {9853}\@elt {9854}%
6614   \@elt {10098}\@elt {10099}\@elt {10100}\@elt {10101}%
6615 }
6616 \def\plist{% pTeX で \kcatcode!=18 なもの
6617   \@elt {8993}\@elt {8994}\@elt {8995}\@elt {8996}\@elt {8997}\@elt {8998}%
6618   \@elt {8999}\@elt {9000}\@elt {9001}\@elt {9002}\@elt {9003}\@elt {9004}%
6619   \@elt {9005}\@elt {9006}\@elt {9007}\@elt {9008}\@elt {9009}\@elt {9010}%
6620   \@elt {9011}\@elt {9012}\@elt {9013}\@elt {9014}\@elt {9015}\@elt {9016}%
6621   \@elt {9017}\@elt {9018}\@elt {9019}\@elt {9020}\@elt {9021}\@elt {9022}%
6622   \@elt {9023}\@elt {9024}\@elt {9025}\@elt {9026}\@elt {9027}\@elt {9028}%
6623   \@elt {9029}\@elt {9030}\@elt {9031}\@elt {9032}\@elt {9033}\@elt {9034}%
6624   \@elt {9035}\@elt {9036}\@elt {9037}\@elt {9038}\@elt {9039}\@elt {9040}%
6625   \@elt {9041}\@elt {9042}\@elt {9043}\@elt {9044}\@elt {9045}\@elt {9046}%
6626   \@elt {9047}\@elt {9048}\@elt {9049}\@elt {9050}\@elt {9051}\@elt {9052}%
6627   \@elt {9053}\@elt {9054}\@elt {9055}\@elt {9056}\@elt {9057}\@elt {9058}%
6628   \@elt {9059}\@elt {9060}\@elt {9061}\@elt {9062}\@elt {9063}\@elt {9064}%
6629   \@elt {9065}\@elt {9066}\@elt {9067}\@elt {9068}\@elt {9069}\@elt {9070}%
6630   \@elt {9071}\@elt {9072}\@elt {9073}\@elt {9074}\@elt {9075}\@elt {9076}%
6631   \@elt {9077}\@elt {9078}\@elt {9079}\@elt {9080}\@elt {9081}\@elt {9082}%
6632   \@elt {9083}\@elt {9084}\@elt {9085}\@elt {9086}\@elt {9249}\@elt {9250}%
6633   \@elt {9251}\@elt {9252}\@elt {9253}\@elt {9254}\@elt {9255}\@elt {9256}%
6634   \@elt {9257}\@elt {9258}\@elt {9259}\@elt {9260}\@elt {9261}\@elt {9262}%
6635   \@elt {9263}\@elt {9264}\@elt {9265}\@elt {9266}\@elt {9267}\@elt {9268}%
6636   \@elt {9269}\@elt {9270}\@elt {9271}\@elt {9272}\@elt {9273}\@elt {9274}%
6637   \@elt {9275}\@elt {9276}\@elt {9277}\@elt {9278}\@elt {9279}\@elt {9280}%
6638   \@elt {9281}\@elt {9282}\@elt {9283}\@elt {9284}\@elt {9285}\@elt {9286}%
6639   \@elt {9287}\@elt {9288}\@elt {9289}\@elt {9290}\@elt {9291}\@elt {9292}%
6640   \@elt {9293}\@elt {9294}\@elt {9295}\@elt {9296}\@elt {9297}\@elt {9298}%
6641   \@elt {9299}\@elt {9300}\@elt {9301}\@elt {9302}\@elt {9303}\@elt {9304}%
6642   \@elt {9305}\@elt {9306}\@elt {9307}\@elt {9308}\@elt {9309}\@elt {9310}%
6643   \@elt {9311}\@elt {9312}\@elt {9313}\@elt {9314}\@elt {9315}\@elt {9316}%
6644   \@elt {9317}\@elt {9318}\@elt {9319}\@elt {9320}\@elt {9321}\@elt {9322}%
6645   \@elt {9323}\@elt {9324}\@elt {9325}\@elt {9326}\@elt {9327}\@elt {9328}%
6646   \@elt {9329}\@elt {9330}\@elt {9331}\@elt {9332}\@elt {9333}\@elt {9334}%
6647   \@elt {9335}\@elt {9336}\@elt {9337}\@elt {9338}\@elt {9339}\@elt {9340}%
6648   \@elt {9341}\@elt {9342}\@elt {9505}\@elt {9506}\@elt {9507}\@elt {9508}%
6649   \@elt {9509}\@elt {9510}\@elt {9511}\@elt {9512}\@elt {9513}\@elt {9514}%
6650   \@elt {9515}\@elt {9516}\@elt {9517}\@elt {9518}\@elt {9519}\@elt {9520}%
6651   \@elt {9521}\@elt {9522}\@elt {9523}\@elt {9524}\@elt {9525}\@elt {9526}%
6652   \@elt {9527}\@elt {9528}\@elt {9529}\@elt {9530}\@elt {9531}\@elt {9532}%
6653   \@elt {9533}\@elt {9534}\@elt {9535}\@elt {9536}\@elt {9537}\@elt {9538}%
6654   \@elt {9539}\@elt {9540}\@elt {9541}\@elt {9542}\@elt {9543}\@elt {9544}%
6655   \@elt {9545}\@elt {9546}\@elt {9547}\@elt {9548}\@elt {9549}\@elt {9550}%
6656   \@elt {9551}\@elt {9552}\@elt {9553}\@elt {9554}\@elt {9555}\@elt {9556}%
6657   \@elt {9557}\@elt {9558}\@elt {9559}\@elt {9560}\@elt {9561}\@elt {9562}%
6658   \@elt {9563}\@elt {9564}\@elt {9565}\@elt {9566}\@elt {9567}\@elt {9568}%
6659   \@elt {9569}\@elt {9570}\@elt {9571}\@elt {9572}\@elt {9573}\@elt {9574}%
6660   \@elt {9575}\@elt {9576}\@elt {9577}\@elt {9578}\@elt {9579}\@elt {9580}%
6661   \@elt {9581}\@elt {9582}\@elt {9583}\@elt {9584}\@elt {9585}\@elt {9586}%
6662   \@elt {9587}\@elt {9588}\@elt {9589}\@elt {9590}\@elt {9591}\@elt {9592}%
6663   \@elt {9593}\@elt {9594}\@elt {9595}\@elt {9596}\@elt {9597}\@elt {9598}%
6664   \@elt {9761}\@elt {9762}\@elt {9763}\@elt {9764}\@elt {9765}\@elt {9766}%
6665   \@elt {9767}\@elt {9768}\@elt {9769}\@elt {9770}\@elt {9771}\@elt {9772}%
6666   \@elt {9773}\@elt {9774}\@elt {9775}\@elt {9776}\@elt {9777}\@elt {9778}%
6667   \@elt {9779}\@elt {9780}\@elt {9781}\@elt {9782}\@elt {9783}\@elt {9784}%
6668   \@elt {9785}\@elt {9786}\@elt {9787}\@elt {9788}\@elt {9789}\@elt {9790}%
6669   \@elt {9791}\@elt {9792}\@elt {9793}\@elt {9794}\@elt {9795}\@elt {9796}%
6670   \@elt {9797}\@elt {9798}\@elt {9799}\@elt {9800}\@elt {9801}\@elt {9802}%
6671   \@elt {9803}\@elt {9804}\@elt {9805}\@elt {9806}\@elt {9807}\@elt {9808}%
6672   \@elt {9809}\@elt {9810}\@elt {9811}\@elt {9812}\@elt {9813}\@elt {9814}%
6673   \@elt {9815}\@elt {9816}\@elt {9817}\@elt {9818}\@elt {9819}\@elt {9820}%
6674   \@elt {9821}\@elt {9822}\@elt {9823}\@elt {9824}\@elt {9825}\@elt {9826}%
6675   \@elt {9827}\@elt {9828}\@elt {9829}\@elt {9830}\@elt {9831}\@elt {9832}%
6676   \@elt {9833}\@elt {9834}\@elt {9835}\@elt {9836}\@elt {9837}\@elt {9838}%
6677   \@elt {9839}\@elt {9840}\@elt {9841}\@elt {9842}\@elt {9843}\@elt {9844}%
6678   \@elt {9845}\@elt {9846}\@elt {9847}\@elt {9848}\@elt {9849}\@elt {9850}%
6679   \@elt {9851}\@elt {9852}\@elt {9853}\@elt {9854}%
6680 }
6681
6682 \def\jlist{% JIS X 0213 だけにあるもの
6683 \@elt{"222F}{"FF07}\@elt{"2230}{"FF02}\@elt{"2231}{"FF0D}\@elt{"2232}{"FF5E}%
6684 \@elt{"2233}{"3033}\@elt{"2234}{"3034}\@elt{"2235}{"3035}\@elt{"2236}{"303B}%
6685 \@elt{"2237}{"303C}\@elt{"2238}{"30FF}\@elt{"2239}{"309F}\@elt{"2242}{"2284}%
6686 \@elt{"2243}{"2285}\@elt{"2244}{"228A}\@elt{"2245}{"228B}\@elt{"2246}{"2209}%
6687 \@elt{"2247}{"2205}\@elt{"2248}{"2305}\@elt{"2249}{"2306}\@elt{"2251}{"2295}%
6688 \@elt{"2252}{"2296}\@elt{"2253}{"2297}\@elt{"2254}{"2225}\@elt{"2255}{"2226}%
6689 \@elt{"2256}{"FF5F}\@elt{"2257}{"FF60}\@elt{"2258}{"3018}\@elt{"2259}{"3019}%
6690 \@elt{"225A}{"3016}\@elt{"225B}{"3017}\@elt{"226B}{"2262}\@elt{"226C}{"2243}%
6691 \@elt{"226D}{"2245}\@elt{"226E}{"2248}\@elt{"226F}{"2276}\@elt{"2270}{"2277}%
6692 \@elt{"2271}{"2194}\@elt{"227A}{"266E}\@elt{"227B}{"266B}\@elt{"227C}{"266C}%
6693 \@elt{"227D}{"2669}\@elt{"2321}{"25B7}\@elt{"2322}{"25B6}\@elt{"2323}{"25C1}%
6694 \@elt{"2324}{"25C0}\@elt{"2325}{"2197}\@elt{"2326}{"2198}\@elt{"2327}{"2196}%
6695 \@elt{"2328}{"2199}\@elt{"2329}{"21C4}\@elt{"232A}{"21E8}\@elt{"232B}{"21E6}%
6696 \@elt{"232C}{"21E7}\@elt{"232D}{"21E9}\@elt{"232E}{"2934}\@elt{"232F}{"2935}%
6697 \@elt{"233A}{"29BF}\@elt{"233B}{"25C9}\@elt{"233C}{"303D}\@elt{"233D}{"FE46}%
6698 \@elt{"233E}{"FE45}\@elt{"233F}{"25E6}\@elt{"2340}{"2022}\@elt{"235B}{"2213}%
6699 \@elt{"235C}{"2135}\@elt{"235D}{"210F}\@elt{"235E}{"33CB}\@elt{"235F}{"2113}%
6700 \@elt{"2360}{"2127}\@elt{"237B}{"30A0}\@elt{"237C}{"2013}\@elt{"237D}{"29FA}%
6701 \@elt{"237E}{"29FB}\@elt{"2474}{"3094}\@elt{"2475}{"3095}\@elt{"2476}{"3096}%
6702 \@elt{"2639}{"2664}\@elt{"263A}{"2660}\@elt{"263B}{"2662}%
6703 \@elt{"263C}{"2666}\@elt{"263D}{"2661}\@elt{"263E}{"2665}\@elt{"263F}{"2667}%
6704 \@elt{"2640}{"2663}\@elt{"2659}{"03C2}\@elt{"265A}{"24F5}\@elt{"265B}{"24F6}%
6705 \@elt{"265C}{"24F7}\@elt{"265D}{"24F8}\@elt{"265E}{"24F9}\@elt{"265F}{"24FA}%
6706 \@elt{"2660}{"24FB}\@elt{"2661}{"24FC}\@elt{"2662}{"24FD}\@elt{"2663}{"24FE}%
6707 \@elt{"2664}{"2616}\@elt{"2665}{"2617}\@elt{"2666}{"3020}\@elt{"2667}{"260E}%
6708 \@elt{"2668}{"2600}\@elt{"2669}{"2601}\@elt{"266A}{"2602}\@elt{"266B}{"2603}%
6709 \@elt{"266C}{"2668}\@elt{"266D}{"25B1}\@elt{"266E}{"31F0}\@elt{"266F}{"31F1}%
6710 \@elt{"2670}{"31F2}\@elt{"2671}{"31F3}\@elt{"2672}{"31F4}\@elt{"2673}{"31F5}%
6711 \@elt{"2674}{"31F6}\@elt{"2675}{"31F7}\@elt{"2676}{"31F8}\@elt{"2677}{"31F9}%
6712 \@elt{"2678}{"31F7}\@elt{"2679}{"31FA}\@elt{"267A}{"31FB}\@elt{"267B}{"31FC}%
6713 \@elt{"267C}{"31FD}\@elt{"267D}{"31FE}\@elt{"267E}{"31FF}\@elt{"2742}{"23BE}%
6714 \@elt{"2743}{"23BF}\@elt{"2744}{"23C0}\@elt{"2745}{"23C1}\@elt{"2746}{"23C2}%
6715 \@elt{"2747}{"23C3}\@elt{"2748}{"23C4}\@elt{"2749}{"23C5}\@elt{"274A}{"23C6}%
6716 \@elt{"274B}{"23C7}\@elt{"274C}{"23C8}\@elt{"274D}{"23C9}\@elt{"274E}{"23CA}%
6717 \@elt{"274F}{"23CB}\@elt{"2750}{"23CC}\@elt{"2772}{"30F7}\@elt{"2773}{"30F8}%
6718 \@elt{"2774}{"30F9}\@elt{"2775}{"30FA}\@elt{"2776}{"22DA}\@elt{"2777}{"22DB}%
6719 \@elt{"2778}{"2153}\@elt{"2779}{"2154}\@elt{"277A}{"2155}\@elt{"277B}{"2713}%
6720 \@elt{"277C}{"2318}\@elt{"277D}{"2423}\@elt{"277E}{"23CE}\@elt{"2841}{"3251}%
6721 \@elt{"2842}{"3252}\@elt{"2843}{"3253}\@elt{"2844}{"3254}\@elt{"2845}{"3255}%
6722 \@elt{"2846}{"3256}\@elt{"2847}{"3257}\@elt{"2848}{"3258}\@elt{"2849}{"3259}%
6723 \@elt{"284A}{"325A}\@elt{"284B}{"325B}\@elt{"284C}{"325C}\@elt{"284D}{"325D}%
6724 \@elt{"284E}{"325E}\@elt{"284F}{"325F}\@elt{"2850}{"32B1}\@elt{"2851}{"32B2}%
6725 \@elt{"2852}{"32B3}\@elt{"2853}{"32B4}\@elt{"2854}{"32B5}\@elt{"2855}{"32B6}%
6726 \@elt{"2856}{"32B7}\@elt{"2857}{"32B8}\@elt{"2858}{"32B9}\@elt{"2859}{"32BA}%
6727 \@elt{"285A}{"32BB}\@elt{"285B}{"32BC}\@elt{"285C}{"32BD}\@elt{"285D}{"32BE}%
6728 \@elt{"285E}{"32BF}\@elt{"2867}{"25D0}\@elt{"2868}{"25D1}\@elt{"2869}{"25D2}%
6729 \@elt{"286A}{"25D3}\@elt{"286B}{"203C}\@elt{"286C}{"2047}\@elt{"286D}{"2048}%
6730 \@elt{"286E}{"2049}\@elt{"286F}{"01CD}\@elt{"2870}{"01CE}\@elt{"2871}{"01D0}%
6731 \@elt{"2872}{"1E3E}\@elt{"2873}{"1E3F}\@elt{"2874}{"01F8}\@elt{"2875}{"01F9}%
6732 \@elt{"2876}{"01D1}\@elt{"2877}{"01D2}\@elt{"2878}{"01D4}\@elt{"2879}{"01D6}%
6733 \@elt{"287A}{"01D8}\@elt{"287B}{"01DA}\@elt{"287C}{"01DC}\@elt{"2921}{"20AC}%
6734 \@elt{"2922}{"00A0}\@elt{"2923}{"00A1}\@elt{"2924}{"00A4}\@elt{"2925}{"00A6}%
6735 \@elt{"2926}{"00A9}\@elt{"2927}{"00AA}\@elt{"2928}{"00AB}\@elt{"2929}{"00AD}%
6736 \@elt{"292A}{"00AE}\@elt{"292B}{"00AF}\@elt{"292C}{"00B2}\@elt{"292D}{"00B3}%
6737 \@elt{"292E}{"00B7}\@elt{"292F}{"00B8}\@elt{"2930}{"00B9}\@elt{"2931}{"00BA}%
6738 \@elt{"2932}{"00BB}\@elt{"2933}{"00BC}\@elt{"2934}{"00BD}\@elt{"2935}{"00BE}%
6739 \@elt{"2936}{"00BF}\@elt{"2937}{"00C0}\@elt{"2938}{"00C1}\@elt{"2939}{"00C2}%
6740 \@elt{"293A}{"00C3}\@elt{"293B}{"00C4}\@elt{"293C}{"00C5}\@elt{"293D}{"00C6}%
6741 \@elt{"293E}{"00C7}\@elt{"293F}{"00C8}\@elt{"2940}{"00C9}\@elt{"2941}{"00CA}%
6742 \@elt{"2942}{"00CB}\@elt{"2943}{"00CC}\@elt{"2944}{"00CD}\@elt{"2945}{"00CE}%
6743 \@elt{"2946}{"00CF}\@elt{"2947}{"00D0}\@elt{"2948}{"00D1}\@elt{"2949}{"00D2}%
6744 \@elt{"294A}{"00D3}\@elt{"294B}{"00D4}\@elt{"294C}{"00D5}\@elt{"294D}{"00D6}%
6745 \@elt{"294E}{"00D8}\@elt{"294F}{"00D9}\@elt{"2950}{"00DA}\@elt{"2951}{"00DB}%
6746 \@elt{"2952}{"00DC}\@elt{"2953}{"00DD}\@elt{"2954}{"00DE}\@elt{"2955}{"00DF}%
6747 \@elt{"2956}{"00E0}\@elt{"2957}{"00E1}\@elt{"2958}{"00E2}\@elt{"2959}{"00E3}%
6748 \@elt{"295A}{"00E4}\@elt{"295B}{"00E5}\@elt{"295C}{"00E6}\@elt{"295D}{"00E7}%
6749 \@elt{"295E}{"00E8}\@elt{"295F}{"00E9}\@elt{"2960}{"00EA}\@elt{"2961}{"00EB}%
6750 \@elt{"2962}{"00EC}\@elt{"2963}{"00ED}\@elt{"2964}{"00EE}\@elt{"2965}{"00EF}%
6751 \@elt{"2966}{"00F0}\@elt{"2967}{"00F1}\@elt{"2968}{"00F2}\@elt{"2969}{"00F3}%
6752 \@elt{"296A}{"00F4}\@elt{"296B}{"00F5}\@elt{"296C}{"00F6}\@elt{"296D}{"00F8}%
6753 \@elt{"296E}{"00F9}\@elt{"296F}{"00FA}\@elt{"2970}{"00FB}\@elt{"2971}{"00FC}%
6754 \@elt{"2972}{"00FD}\@elt{"2973}{"00FE}\@elt{"2974}{"00FF}\@elt{"2975}{"0100}%
6755 \@elt{"2976}{"012A}\@elt{"2977}{"016A}\@elt{"2978}{"0112}\@elt{"2979}{"014C}%
6756 \@elt{"297A}{"0101}\@elt{"297B}{"012B}\@elt{"297C}{"016B}\@elt{"297D}{"0113}%
6757 \@elt{"297E}{"014D}\@elt{"2A21}{"0104}\@elt{"2A22}{"02D8}\@elt{"2A23}{"0141}%
6758 \@elt{"2A24}{"013D}\@elt{"2A25}{"015A}\@elt{"2A26}{"0160}\@elt{"2A27}{"015E}%
6759 \@elt{"2A28}{"0164}\@elt{"2A29}{"0179}\@elt{"2A2A}{"017D}\@elt{"2A2B}{"017B}%
6760 \@elt{"2A2C}{"0105}\@elt{"2A2D}{"02DB}\@elt{"2A2E}{"0142}\@elt{"2A2F}{"013E}%
6761 \@elt{"2A30}{"015B}\@elt{"2A31}{"02C7}\@elt{"2A32}{"0161}\@elt{"2A33}{"015F}%
6762 \@elt{"2A34}{"0165}\@elt{"2A35}{"017A}\@elt{"2A36}{"02DD}\@elt{"2A37}{"017E}%
6763 \@elt{"2A38}{"017C}\@elt{"2A39}{"0154}\@elt{"2A3A}{"0102}\@elt{"2A3B}{"0139}%
6764 \@elt{"2A3C}{"0106}\@elt{"2A3D}{"010C}\@elt{"2A3E}{"0118}\@elt{"2A3F}{"011A}%
6765 \@elt{"2A40}{"010E}\@elt{"2A41}{"0143}\@elt{"2A42}{"0147}\@elt{"2A43}{"0150}%
6766 \@elt{"2A44}{"0158}\@elt{"2A45}{"016E}\@elt{"2A46}{"0170}\@elt{"2A47}{"0162}%
6767 \@elt{"2A48}{"0155}\@elt{"2A49}{"0103}\@elt{"2A4A}{"013A}\@elt{"2A4B}{"0107}%
6768 \@elt{"2A4C}{"010D}\@elt{"2A4D}{"0119}\@elt{"2A4E}{"011B}\@elt{"2A4F}{"010F}%
6769 \@elt{"2A50}{"0111}\@elt{"2A51}{"0144}\@elt{"2A52}{"0148}\@elt{"2A53}{"0151}%
6770 \@elt{"2A54}{"0159}\@elt{"2A55}{"016F}\@elt{"2A56}{"0171}\@elt{"2A57}{"0163}%
6771 \@elt{"2A58}{"02D9}\@elt{"2A59}{"0108}\@elt{"2A5A}{"011C}\@elt{"2A5B}{"0124}%
6772 \@elt{"2A5C}{"0134}\@elt{"2A5D}{"015C}\@elt{"2A5E}{"016C}\@elt{"2A5F}{"0109}%
6773 \@elt{"2A60}{"011D}\@elt{"2A61}{"0125}\@elt{"2A62}{"0135}\@elt{"2A63}{"015D}%
6774 \@elt{"2A64}{"016D}\@elt{"2A65}{"0271}\@elt{"2A66}{"028B}\@elt{"2A67}{"027E}%
6775 \@elt{"2A68}{"0283}\@elt{"2A69}{"0292}\@elt{"2A6A}{"026C}\@elt{"2A6B}{"026E}%
6776 \@elt{"2A6C}{"0279}\@elt{"2A6D}{"0288}\@elt{"2A6E}{"0256}\@elt{"2A6F}{"0273}%
6777 \@elt{"2A70}{"027D}\@elt{"2A71}{"0282}\@elt{"2A72}{"0290}\@elt{"2A73}{"027B}%
6778 \@elt{"2A74}{"026D}\@elt{"2A75}{"025F}\@elt{"2A76}{"0272}\@elt{"2A77}{"029D}%
6779 \@elt{"2A78}{"028E}\@elt{"2A79}{"0261}\@elt{"2A7A}{"014B}\@elt{"2A7B}{"0270}%
6780 \@elt{"2A7C}{"0281}\@elt{"2A7D}{"0127}\@elt{"2A7E}{"0295}\@elt{"2B21}{"0294}%
6781 \@elt{"2B22}{"0266}\@elt{"2B23}{"0298}\@elt{"2B24}{"01C2}\@elt{"2B25}{"0253}%
6782 \@elt{"2B26}{"0257}\@elt{"2B27}{"0284}\@elt{"2B28}{"0260}\@elt{"2B29}{"0193}%
6783 \@elt{"2B2A}{"0153}\@elt{"2B2B}{"0152}\@elt{"2B2C}{"0268}\@elt{"2B2D}{"0289}%
6784 \@elt{"2B2E}{"0258}\@elt{"2B2F}{"0275}\@elt{"2B30}{"0259}\@elt{"2B31}{"025C}%
6785 \@elt{"2B32}{"025E}\@elt{"2B33}{"0250}\@elt{"2B34}{"026F}\@elt{"2B35}{"028A}%
6786 \@elt{"2B36}{"0264}\@elt{"2B37}{"028C}\@elt{"2B38}{"0254}\@elt{"2B39}{"0251}%
6787 \@elt{"2B3A}{"0252}\@elt{"2B3B}{"028D}\@elt{"2B3C}{"0265}\@elt{"2B3D}{"02A2}%
6788 \@elt{"2B3E}{"02A1}\@elt{"2B3F}{"0255}\@elt{"2B40}{"0291}\@elt{"2B41}{"027A}%
6789 \@elt{"2B42}{"0267}\@elt{"2B43}{"025A}\@elt{"2B44}{"00E6}\@elt{"2B45}{"01FD}%
6790 \@elt{"2B46}{"1F70}\@elt{"2B47}{"1F71}\@elt{"2B48}{"0254}\@elt{"2B49}{"0254}%
6791 \@elt{"2B4A}{"028C}\@elt{"2B4B}{"028C}\@elt{"2B4C}{"0259}\@elt{"2B4D}{"0259}%
6792 \@elt{"2B4E}{"025A}\@elt{"2B4F}{"025A}\@elt{"2B50}{"1F72}\@elt{"2B51}{"1F73}%
6793 \@elt{"2B52}{"0361}\@elt{"2B53}{"02C8}\@elt{"2B54}{"02CC}\@elt{"2B55}{"02D0}%
6794 \@elt{"2B56}{"02D1}\@elt{"2B57}{"0306}\@elt{"2B58}{"203F}\@elt{"2B59}{"030B}%
6795 \@elt{"2B5A}{"0301}\@elt{"2B5B}{"0304}\@elt{"2B5C}{"0300}\@elt{"2B5D}{"030F}%
6796 \@elt{"2B5E}{"030C}\@elt{"2B5F}{"0302}\@elt{"2B60}{"02E5}\@elt{"2B61}{"02E6}%
6797 \@elt{"2B62}{"02E7}\@elt{"2B63}{"02E8}\@elt{"2B64}{"02E9}\@elt{"2B65}{"02E9}%
6798 \@elt{"2B66}{"02E5}\@elt{"2B67}{"0325}\@elt{"2B68}{"032C}\@elt{"2B69}{"0339}%
6799 \@elt{"2B6A}{"031C}\@elt{"2B6B}{"031F}\@elt{"2B6C}{"0320}\@elt{"2B6D}{"0308}%
6800 \@elt{"2B6E}{"033D}\@elt{"2B6F}{"0329}\@elt{"2B70}{"032F}\@elt{"2B71}{"02DE}%
6801 \@elt{"2B72}{"0324}\@elt{"2B73}{"0330}\@elt{"2B74}{"033C}\@elt{"2B75}{"0334}%
6802 \@elt{"2B76}{"031D}\@elt{"2B77}{"031E}\@elt{"2B78}{"0318}\@elt{"2B79}{"0319}%
6803 \@elt{"2B7A}{"032A}\@elt{"2B7B}{"033A}\@elt{"2B7C}{"033B}\@elt{"2B7D}{"0303}%
6804 \@elt{"2B7E}{"031A}\@elt{"2C21}{"2776}\@elt{"2C22}{"2777}\@elt{"2C23}{"2778}%
6805 \@elt{"2C24}{"2779}\@elt{"2C25}{"277A}\@elt{"2C26}{"277B}\@elt{"2C27}{"277C}%
6806 \@elt{"2C28}{"277D}\@elt{"2C29}{"277E}\@elt{"2C2A}{"277F}\@elt{"2C2B}{"24EB}%
6807 \@elt{"2C2C}{"24EC}\@elt{"2C2D}{"24ED}\@elt{"2C2E}{"24EE}\@elt{"2C2F}{"24EF}%
6808 \@elt{"2C30}{"24F0}\@elt{"2C31}{"24F1}\@elt{"2C32}{"24F2}\@elt{"2C33}{"24F3}%
6809 \@elt{"2C34}{"24F4}\@elt{"2C35}{"2170}\@elt{"2C36}{"2171}\@elt{"2C37}{"2172}%
6810 \@elt{"2C38}{"2173}\@elt{"2C39}{"2174}\@elt{"2C3A}{"2175}\@elt{"2C3B}{"2176}%
6811 \@elt{"2C3C}{"2177}\@elt{"2C3D}{"2178}\@elt{"2C3E}{"2179}\@elt{"2C3F}{"217A}%
6812 \@elt{"2C40}{"217B}\@elt{"2C41}{"24D0}\@elt{"2C42}{"24D1}\@elt{"2C43}{"24D2}%
6813 \@elt{"2C44}{"24D3}\@elt{"2C45}{"24D4}\@elt{"2C46}{"24D5}\@elt{"2C47}{"24D6}%
6814 \@elt{"2C48}{"24D7}\@elt{"2C49}{"24D8}\@elt{"2C4A}{"24D9}\@elt{"2C4B}{"24DA}%
6815 \@elt{"2C4C}{"24DB}\@elt{"2C4D}{"24DC}\@elt{"2C4E}{"24DD}\@elt{"2C4F}{"24DE}%
6816 \@elt{"2C50}{"24DF}\@elt{"2C51}{"24E0}\@elt{"2C52}{"24E1}\@elt{"2C53}{"24E2}%
6817 \@elt{"2C54}{"24E3}\@elt{"2C55}{"24E4}\@elt{"2C56}{"24E5}\@elt{"2C57}{"24E6}%
6818 \@elt{"2C58}{"24E7}\@elt{"2C59}{"24E8}\@elt{"2C5A}{"24E9}\@elt{"2C5B}{"32D0}%
6819 \@elt{"2C5C}{"32D1}\@elt{"2C5D}{"32D2}\@elt{"2C5E}{"32D3}\@elt{"2C5F}{"32D4}%
6820 \@elt{"2C60}{"32D5}\@elt{"2C61}{"32D6}\@elt{"2C62}{"32D7}\@elt{"2C63}{"32D8}%
6821 \@elt{"2C64}{"32D9}\@elt{"2C65}{"32DA}\@elt{"2C66}{"32DB}\@elt{"2C67}{"32DC}%
6822 \@elt{"2C68}{"32DD}\@elt{"2C69}{"32DE}\@elt{"2C6A}{"32DF}\@elt{"2C6B}{"32E0}%
6823 \@elt{"2C6C}{"32E1}\@elt{"2C6D}{"32E2}\@elt{"2C6E}{"32E3}\@elt{"2C6F}{"32FA}%
6824 \@elt{"2C70}{"32E9}\@elt{"2C71}{"32E5}\@elt{"2C72}{"32ED}\@elt{"2C73}{"32EC}%
6825 \@elt{"2C7D}{"2051}\@elt{"2C7E}{"2042}\@elt{"2D21}{"2460}\@elt{"2D22}{"2461}%
6826 \@elt{"2D23}{"2462}\@elt{"2D24}{"2463}\@elt{"2D25}{"2464}\@elt{"2D26}{"2465}%
6827 \@elt{"2D27}{"2466}\@elt{"2D28}{"2467}\@elt{"2D29}{"2468}\@elt{"2D2A}{"2469}%
6828 \@elt{"2D2B}{"246A}\@elt{"2D2C}{"246B}\@elt{"2D2D}{"246C}\@elt{"2D2E}{"246D}%
6829 \@elt{"2D2F}{"246E}\@elt{"2D30}{"246F}\@elt{"2D31}{"2470}\@elt{"2D32}{"2471}%
6830 \@elt{"2D33}{"2472}\@elt{"2D34}{"2473}\@elt{"2D35}{"2160}\@elt{"2D36}{"2161}%
6831 \@elt{"2D37}{"2162}\@elt{"2D38}{"2163}\@elt{"2D39}{"2164}\@elt{"2D3A}{"2165}%
6832 \@elt{"2D3B}{"2166}\@elt{"2D3C}{"2167}\@elt{"2D3D}{"2168}\@elt{"2D3E}{"2169}%
6833 \@elt{"2D3F}{"216A}\@elt{"2D40}{"3349}\@elt{"2D41}{"3314}\@elt{"2D42}{"3322}%
6834 \@elt{"2D43}{"334D}\@elt{"2D44}{"3318}\@elt{"2D45}{"3327}\@elt{"2D46}{"3303}%
6835 \@elt{"2D47}{"3336}\@elt{"2D48}{"3351}\@elt{"2D49}{"3357}\@elt{"2D4A}{"330D}%
6836 \@elt{"2D4B}{"3326}\@elt{"2D4C}{"3323}\@elt{"2D4D}{"332B}\@elt{"2D4E}{"334A}%
6837 \@elt{"2D4F}{"333B}\@elt{"2D50}{"339C}\@elt{"2D51}{"339D}\@elt{"2D52}{"339E}%
6838 \@elt{"2D53}{"338E}\@elt{"2D54}{"338F}\@elt{"2D55}{"33C4}\@elt{"2D56}{"33A1}%
6839 \@elt{"2D57}{"216B}\@elt{"2D5F}{"337B}\@elt{"2D60}{"301D}\@elt{"2D61}{"301F}%
6840 \@elt{"2D62}{"2116}\@elt{"2D63}{"33CD}\@elt{"2D64}{"2121}\@elt{"2D65}{"32A4}%
6841 \@elt{"2D66}{"32A5}\@elt{"2D67}{"32A6}\@elt{"2D68}{"32A7}\@elt{"2D69}{"32A8}%
6842 \@elt{"2D6A}{"3231}\@elt{"2D6B}{"3232}\@elt{"2D6C}{"3239}\@elt{"2D6D}{"337E}%
6843 \@elt{"2D6E}{"337D}\@elt{"2D6F}{"337C}\@elt{"2D73}{"222E}\@elt{"2D78}{"221F}%
6844 \@elt{"2D79}{"22BF}\@elt{"2D7D}{"2756}\@elt{"2D7E}{"261E}%
6845 }
6846
6847 \newcount\cntA
6848 \newcount\cntB
6849 \newcount\flag
6850 \def\chk@in@#1#2{{\global\flag=0\relax%
6851   \def\@elt##1{\ifnum#2=##1\global\flag=1 \fi}%
6852   #1}}
6853 \def\get@in@#1#2{{%
6854   \global\flag=0\relax%
6855   \def\@elt##1##2{\ifnum#2=##1\global\flag##2 \fi}%
6856   #1}}
6857
6858 \def\outi{%
6859 \get@in@{\jlist}{\cntA}\cntB=\flag
6860 \ifnum\cntB=0{}%
6861   \cntB=\jis\cntA{}%
6862   \ifnum\cntB=0 \else
6863     \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\cntB}}=0
6864     \def\@@@tmp{white}\else\def\@@@tmp{white!85!blue}\fi
6865     \fcolorbox{black}{\@@@tmp}{%
6866       \hbox to \zw{\gt  \hskip-\zw\ltjjachar\cntB  \hss}}\,\scriptsize%
6867     \ifnum\catcode\cntB=11 L\else\ \fi
6868     \chk@in@{\uplist}{\cntA}\ifnum\flag=1 U\else~\fi
6869     \chk@in@{\plist}{\cntA}\ifnum\flag=1 P\else~\fi
6870   \fi
6871 \else
6872   \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\cntB}}=0
6873   \def\@@@tmp{white}\else\def\@@@tmp{white!85!blue}\fi
6874   \fcolorbox{black}{\@@@tmp}{\color{red!50!black}%
6875      \hbox to \zw{\gt  \hskip-\zw\ltjjachar\cntB  \hss}}\,\scriptsize%
6876    \ifnum\catcode\cntB=11 L\else~\fi
6877   \chk@in@{\uplist}{\cntA}\ifnum\flag=1 U\else~\fi-%
6878 \fi\global\advance\cntA1 }
6879
6880 \def\out#1#2{%
6881 \midrule\global\cntA=\numexpr 8192+#1*256+#2*16\relax
6882 "#2{}x&\ifnum#2=2\global\advance\cntA1\else\outi\fi&\outi&\outi&\outi&\outi&\outi&\outi&\outi%"
6883 &\outi&\outi&\outi&\outi&\outi&\outi&\outi&\ifnum#2=7\global\advance\cntA1\else\outi\fi\\
6884 }
6885
6886 \def\test#1{{%
6887 %<en>\subsection*{Row #1}
6888 %<ja>\subsection*{第#1区}
6889 \tt\small\fboxsep=1pt\centering\tabcolsep=0.25\zw
6890 \begin{tabular}{ccccccccccccccccc}\toprule&"0&"1&"2&"3&"4&"5&"6&"7&"8&"9&"A&"B&"C&"D&"E&"F\\
6891 \out{#1}{2}\out{#1}{3}\out{#1}{4}\out{#1}{5}\out{#1}{6}\out{#1}{7}\bottomrule
6892 \end{tabular}\par}\medskip}
6893
6894 \test{1}\test{2}\test{3}\test{4}\test{5}\test{6}\test{7}\test{8}
6895 \test{9}\test{10}\test{11}\test{12}\test{13}
6896
6897 %</!zh>
6898 \errorstopmode
6899
6900 \section{Package versions used in this document}
6901 This document was typeset using the following packages:
6902
6903 \medskip
6904
6905 {\makeatletter\tt\footnotesize
6906   \def\@pkglist#1{%
6907     \filename@parse{#1}\def\@temp{sty}
6908     \ifx\@temp\filename@ext
6909       \edef\reserved@a{%
6910         \filename@base.%
6911         \ifx\filename@ext\relax tex\else\filename@ext\fi}%
6912       \leavevmode\hskip-13em\hbox to 13em{\filename@area\reserved@a\hss}%
6913       \csname ver@\reserved@a\endcsname\par
6914     \fi
6915   }%
6916 \parindent0pt\leftskip13em
6917 \ltjpkglist
6918
6919 \makeatother}
6920 \end{document}
6921 %</!showexpl>
6922 %<*showexpl>
6923 %%
6924 %% config file for showexpl.sty
6925 %%
6926 %% Copyright The LuaTeX-ja project team, 2012
6927 %%
6928 \ProvidesFile{showexpl.cfg}
6929   [2012/05/20 v0.01 Definitions for the showexpl package (luatexja)]
6930 \lstset{}
6931 \def\SX@Info{}
6932 \endinput
6933 %</*showexpl>