OSDN Git Service

Regenerated manual pdfs.
[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,ipa]{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 "E000--"F8FF&Private Use Area&
2261 %</en>
2262 %<*ja>
2263 "2000--"206F&一般句読点&
2264 "2070--"209F&上付き・下付き\\
2265 "20A0--"20CF&通貨記号&
2266 "20D0--"20FF&記号用ダイアクリティカルマーク(合成可能)\\
2267 "2100--"214F&文字様記号&
2268 "2150--"218F&数字に準じるもの\\
2269 "2190--"21FF&矢印&
2270 "2200--"22FF&数学記号(演算子)\\
2271 "2300--"23FF&その他の技術用記号&
2272 "2400--"243F&制御機能用記号\\
2273 "2500--"257F&罫線素片&
2274 "2580--"259F&ブロック要素\\
2275 "25A0--"25FF&幾何学模様&
2276 "2600--"26FF&その他の記号\\
2277 "2700--"27BF&装飾記号&
2278 "2900--"297F&補助矢印B\\
2279 "2980--"29FF&その他の数学記号B&
2280 "2B00--"2BFF&その他の記号及び矢印\\
2281 "E000--"F8FF&私用領域(外字領域)&
2282 %</ja>
2283 %<*zh>
2284 "2000--"206F&一般标点符号&
2285 "2070--"209F&上标及下标\\
2286 "20A0--"20CF&货币符号&
2287 "20D0--"20FF& 符号用组合附加符号\\
2288 "2100--"214F&类字母符号&
2289 "2150--"218F&数字形式\\
2290 "2190--"21FF&箭头符号&
2291 "2200--"22FF&数学运算符号\\
2292 "2300--"23FF&杂项技术符号&
2293 "2400--"243F&控制图像\\
2294 "2500--"257F&制表符&
2295 "2580--"259F&区块元素\\
2296 "25A0--"25FF&几何形状&
2297 "2600--"26FF&杂项符号\\
2298 "2700--"27BF&什锦符号&
2299 "2900--"297F&补充性箭头-B\\
2300 "2980--"29FF&混合数学符号-B&
2301 "2B00--"2BFF&杂项符号和箭头符号\\
2302 "E000--"F8FF&私用区域&
2303 %</zh>
2304 \end{tabular}
2305 \end{center}
2306 \end{table}
2307 %<*en>
2308 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
2309            of almost all Unicode blocks which are not in other
2310            predefined ranges. Hence, instead of showing the block list,
2311            we put the definition of this range itself:
2312 %</en>
2313 %<*ja>
2314 \item[範囲4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
2315                              この範囲は他の範囲にないほとんど全てのUnicodeブロック
2316                              で構成されている.したがって,ブロックのリストを示す
2317                              代わりに,範囲の定義そのものを示す:
2318 %</ja>
2319 %<*zh>
2320 \item[范围4${}^\text{A}$] 通常情况下不包含于日文字体的部分。本范围包含有其他
2321 范围尚未涵盖部分。故,我们直接给出定义:
2322 %</zh>
2323 \begin{lstlisting}
2324 \ltjdefcharrange{4}{%
2325    "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
2326   "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F,
2327   "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF} % non-Japanese
2328 \end{lstlisting}
2329 %<*en>
2330 \item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
2331 %</en>
2332 %<*ja>
2333 \item[範囲5${}^{\text{A}}$] 代用符号と補助私用領域.
2334 %</ja>
2335 %<*zh>
2336 \item[范围5${}^\text{A}$] 代替以及补充私有使用区域。
2337 %</zh>
2338 %<*en>
2339 \item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
2340 %</en>
2341 %<*ja>
2342 \item[範囲6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは
2343                              表\ref{table-rng6}に示す.
2344 %</ja>
2345 %<*zh>
2346 \item[范围6${}^\text{J}$] 日文字符。
2347 %</zh>
2348 \begin{table}[!tb]
2349 %<*en>
2350 \caption{Unicode blocks in predefined character range~6.}
2351 %</en>
2352 %<*ja>
2353 \caption{文字範囲6に指定されているUnicodeブロック.}
2354 %</ja>
2355 %<*zh>
2356 \caption{字符范围6定义的Unicode范围}
2357 %</zh>
2358 \label{table-rng6}
2359 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
2360 \begin{center}\small
2361 \begin{tabular}{llll}
2362 %<*en>
2363 "2460--"24FF&Enclosed Alphanumerics&
2364 "2E80--"2EFF&CJK Radicals Supplement\\
2365 "3000--"303F&CJK Symbols and Punctuation&
2366 "3040--"309F&Hiragana\\
2367 "30A0--"30FF&Katakana&
2368 "3190--"319F&Kanbun\\
2369 "31F0--"31FF&Katakana Phonetic Extensions&
2370 "3200--"32FF&Enclosed CJK Letters and Months\\
2371 "3300--"33FF&CJK Compatibility&
2372 "3400--"4DBF&CJK Unified Ideographs Extension A\\
2373 "4E00--"9FFF&CJK Unified Ideographs&
2374 "F900--"FAFF&CJK Compatibility Ideographs\\
2375 "FE10--"FE1F&Vertical Forms&
2376 "FE30--"FE4F&CJK Compatibility Forms\\
2377 "FE50--"FE6F&Small Form Variants&
2378 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)
2379 %</en>
2380 %<*ja>
2381 "2460--"24FF&囲み英数字&
2382 "2E80--"2EFF&CJK部首補助\\
2383 "3000--"303F&CJKの記号及び句読点&
2384 "3040--"309F&平仮名\\
2385 "30A0--"30FF&片仮名&
2386 "3190--"319F&漢文用記号(返り点)\\
2387 "31F0--"31FF&片仮名拡張&
2388 "3200--"32FF&囲みCJK文字・月\\
2389 "3300--"33FF&CJK互換用文字&
2390 "3400--"4DBF&CJK統合漢字拡張A\\
2391 "4E00--"9FFF&CJK統合漢字&
2392 "F900--"FAFF&CJK互換漢字\\
2393 "FE10--"FE1F&縦書き形&
2394 "FE30--"FE4F&CJK互換形\\
2395 "FE50--"FE6F&小字形&
2396 "{20}000--"{2F}FFF&(追加漢字面)
2397 %</ja>
2398 %<*zh>
2399 "2460--"24FF&圈状字母数字&
2400 "2E80--"2EFF&CJK部首补充\\
2401 "3000--"303F&CJK标点符号&
2402 "3040--"309F&平假名\\
2403 "30A0--"30FF&片假名&
2404 "3190--"319F&汉文标注号\\
2405 "31F0--"31FF&片假名音标补充&
2406 "3200--"32FF&圈状CJK字母及月份\\
2407 "3300--"33FF&CJK兼容&
2408 "3400--"4DBF&CJK统一表意文字扩充A\\
2409 "4E00--"9FFF&CJK统一表意文字&
2410 "F900--"FAFF&CJK兼容表意文字\\
2411 "FE10--"FE1F&直行标点&
2412 "FE30--"FE4F&CJK兼容形式\\
2413 "FE50--"FE6F&小写变体&
2414 "{20}000--"{2F}FFF&(补充字符)
2415 %</zh>
2416 \end{tabular}
2417 \end{center}
2418 \end{table}
2419 %<*en>
2420 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in  Adobe-Japan1-6.
2421 The block list is indicated in Table~\ref{table-rng7}.
2422 %</en>
2423 %<*ja>
2424 \item[範囲7${}^{\text{J}}$] CJK言語で用いられる文字のうち,Adobe-Japan1-6に
2425                             含まれていないもの.
2426                             ブロックのリストは表\ref{table-rng7}に示す.
2427 %</ja>
2428 %<*zh>
2429 \item[范围7${}^\text{J}$] 不包含于Adobe-Japan1-6的CJK字符,参见表\ref{table-rng7}。
2430 %</zh>
2431 \begin{table}[!tb]
2432 %<*en>
2433 \caption{Unicode blocks in predefined character range~7.}
2434 %</en>
2435 %<*ja>
2436 \caption{文字範囲7に指定されているUnicodeブロック.}
2437 %</ja>
2438 %<*zh>
2439 \caption{字符范围7定义的Unicode范围}
2440 %</zh>
2441 \label{table-rng7}
2442 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
2443 \begin{center}\small
2444 \begin{tabular}{llll}
2445 %<*en>
2446 "1100--"11FF&Hangul Jamo&
2447 "2F00--"2FDF&Kangxi Radicals\\
2448 "2FF0--"2FFF&Ideographic Description Characters&
2449 "3100--"312F&Bopomofo\\
2450 "3130--"318F&Hangul Compatibility Jamo&
2451 "31A0--"31BF&Bopomofo Extended\\
2452 "31C0--"31EF&CJK Strokes&
2453 "A000--"A48F&Yi Syllables\\
2454 "A490--"A4CF&Yi Radicals&
2455 "A830--"A83F&Common Indic Number Forms\\
2456 "AC00--"D7AF&Hangul Syllables&
2457 "D7B0--"D7FF&Hangul Jamo Extended-B
2458 %</en>
2459 %<*ja>
2460 "1100--"11FF&ハングル字母&
2461 "2F00--"2FDF&康熙部首\\
2462 "2FF0--"2FFF&漢字構成記述文字&
2463 "3100--"312F&注音字母 (注音符号)\\
2464 "3130--"318F&ハングル互換字母&
2465 "31A0--"31BF&注音字母拡張\\
2466 "31C0--"31EF&CJKの筆画&
2467 "A000--"A48F&イ文字\\
2468 "A490--"A4CF&イ文字部首&
2469 "A830--"A83F&共通インド数字に準じるもの\\
2470 "AC00--"D7AF&ハングル音節文字&
2471 "D7B0--"D7FF&ハングル字母拡張B
2472 %</ja>
2473 %<*zh>
2474 "1100--"11FF&谚文字母&
2475 "2F00--"2FDF&康熙部首\\
2476 "2FF0--"2FFF&汉字结构描述字符&
2477 "3100--"312F&注音字母\\
2478 "3130--"318F&谚文兼容字母&
2479 "31A0--"31BF&注音字母扩充\\
2480 "31C0--"31EF&CJK笔划&
2481 "A000--"A48F&彝文音节\\
2482 "A490--"A4CF&彝文字母&
2483 "A830--"A83F&一般印度数字\\
2484 "AC00--"D7AF&谚文音节&
2485 "D7B0--"D7FF&谚文字母扩充-B
2486 %</zh>
2487 \end{tabular}
2488 \end{center}
2489 \end{table}
2490 \end{description}
2491
2492
2493 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
2494 %<ja>\subsection{\Param{kanjiskip}と\Param{xkanjiskip}}
2495 %<zh>\subsection{\Param{kanjiskip}和\Param{xkanjiskip}}
2496 \label{subs-kskip}
2497
2498 %<*en>
2499 \textbf{JAglue} is divided into the following three categories:
2500 %</en>
2501 %<*ja>
2502 \textbf{JAglue}は以下の3つのカテゴリに分類される:
2503 %</ja>
2504 %<*zh>
2505 \textbf{JAglue}分为以下三个范畴:
2506 %</zh>
2507 \begin{itemize}
2508 %<*en>
2509 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
2510       around a Japanese character, this glue will not be inserted at the
2511       place.
2512 %</en>
2513 %<*ja>
2514 \item JFMで指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
2515       発行されていれば,このグルーは挿入されない.
2516 %</ja>
2517 %<*zh>
2518 \item JFM设定的胶或出格值。如果在一个日文字符附近使用\verb!\inhibitglue!,则胶便不会插入。
2519 %</zh>
2520 %<*en>
2521 \item The default glue which inserted between two \textbf{JAchar}s (\Param{%
2522       kanjiskip}).
2523 %</en>
2524 %<*ja>
2525 \item デフォルトで2つの\textbf{JAchar}の間に挿入されるグルー(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}).
2526 %</ja>
2527 %<*zh>
2528 \item 两个\textbf{JAchar}之间默认插入的胶(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})。
2529 %</zh>
2530 %<*en>
2531 \item The default glue which inserted between a \textbf{JAchar} and an
2532       \textbf{ALchar} (\Param{\hyperlink{fld:xks}{xkanjiskip}}).
2533 %</en>
2534 %<*ja>
2535 \item デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルー(\Param{\hyperlink{fld:xks}{xkanjiskip}}).
2536 %</ja>
2537 %<*zh>
2538 \item \textbf{JAchar}和\textbf{ALchar}之间默认插入的胶(\Param{\hyperlink{fld:xks}{xkanjiskip}})。
2539 %</zh>
2540 \end{itemize}
2541 %<*en>
2542 The value (a skip) of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or \Param{\hyperlink{fld:xks}{xkanjiskip}} can be
2543 changed as the following.
2544 %</en>
2545 %<*ja>
2546 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や\Param{\hyperlink{fld:xks}{xkanjiskip}}の値は以下のようにして変更可能である.
2547 %</ja>
2548 %<*zh>
2549 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}和\Param{\hyperlink{fld:xks}{xkanjiskip}}的设定如下所示:
2550 %</zh>
2551 \begin{lstlisting}
2552 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
2553                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
2554 \end{lstlisting}
2555
2556 %<*en>
2557 It may occur that JFM contains the data of `ideal width of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}'
2558 and/or `ideal width of \Param{\hyperlink{fld:xks}{xkanjiskip}}'.
2559 To use these data from JFM, set the value of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or
2560 \Param{\hyperlink{fld:xks}{xkanjiskip}} to \verb+\maxdimen+.
2561 %</en>
2562 %<*ja>
2563 JFMは「望ましい\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値」や「望ましい\Param{\hyperlink{fld:xks}{xkanjiskip}}の値」を
2564 持っていることがある.
2565 これらのデータを使うためには,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や\Param{\hyperlink{fld:xks}{xkanjiskip}}の
2566 値を \verb+\maxdimen+ の値に設定すればよい.
2567 %</ja>
2568 %<*zh>
2569 当JFM包含“\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}理想宽度”和/或“\Param{\hyperlink{fld:xks}{xkanjiskip}}理想宽度”数据时,
2570 上述设定产生作用。如果想用JFM中的数据,请设定\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}或\textsf{xkanjiskip}为\verb!\maxdimen!。
2571 %</zh>
2572
2573 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
2574 %<ja>\subsection{\Param{xkanjiskip} の挿入設定}
2575 %<zh>\subsection{\Param{xkanjiskip}插入设定}
2576
2577 %<*en>
2578 It is not desirable that \Param{\hyperlink{fld:xks}{xkanjiskip}} is inserted into every
2579 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
2580 \Param{\hyperlink{fld:xks}{xkanjiskip}} should not be inserted after opening parenthesis
2581 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
2582 \LuaTeX-ja can control whether \Param{\hyperlink{fld:xks}{xkanjiskip}} can be inserted
2583 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
2584 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
2585 %</en>
2586 %<*ja>
2587 \Param{\hyperlink{fld:xks}{xkanjiskip}}がすべての\textbf{JAchar}と\textbf{ALchar}の境界に
2588 挿入されるのは望ましいことではない.例えば,\Param{\hyperlink{fld:xks}{xkanjiskip}}は開き括弧の
2589 後には挿入されるべきではない(`(あ'と`(\hskip\ltjgetparameter{xkanjiskip}あ'を
2590 比べてみよ).
2591 \LuaTeX-jaでは\Param{\hyperlink{fld:xks}{xkanjiskip}}をある文字の前/後に挿入するかどうかを,
2592 \textbf{JAchar}に対しては\Param{jaxspmode}を,\textbf{ALchar}に対しては
2593 \Param{alxspmode}をそれぞれ変えることで制御することができる.
2594 %</ja>
2595 %<*zh>
2596 并不是在所有的\textbf{JAchar}和\textbf{ALchar}周围插入\textsf{xkanjiskip}都是合适的。
2597 比如,在开标点之后插入\Param{\hyperlink{fld:xks}{xkanjiskip}}并不合适[如,比较“(あ”和“(\hskip\ltjgetparameter{xkanjiskip}あ”]。
2598 \LuaTeX-ja可以通过设定\textbf{JAchar}的\Param{jaxspmode}以及\textbf{ALchar}的\Param{alxspmode}来控制
2599 \Param{\hyperlink{fld:xks}{xkanjiskip}}在字符前后的插入。
2600 %</zh>
2601 \begin{LTXexample}
2602 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
2603 pあq い!う
2604 \end{LTXexample}
2605
2606 %<*en>
2607 The second argument \texttt{preonly} means `the insertion of
2608 \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before this character, but not after'.
2609 the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{
2610 inhibit}.
2611 %</en>
2612 %<*ja>
2613 2つ目の引数の \texttt{preonly}は「\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入はこの文字の
2614 前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は
2615 \texttt{postonly}, \texttt{allow}, \texttt{inhibit}である.
2616 %</ja>
2617 %<*zh>
2618 第二个参数\textsf{preonly}表示的含义为“允许在该字符前插入\textsf{xkanjiskip},但不允许在该字符之后插入”。
2619 其他参数还有\textsf{postonly},\textsf{allow}和\textsf{inhibit}。
2620 %</zh>
2621
2622 %<*en>
2623 \Param{jaxspmode} and \Param{alxspmode} use a same table to store the parameters
2624 on the current version. Therefore, line 1 in the code above can be rewritten
2625 as follows:
2626 %</en>
2627 %<*ja>
2628 なお,現行の
2629 仕様では,\Param{jaxspmode}, \Param{alxspmode}はテーブルを共有しており,
2630 上のコードの1行目を次のように変えても同じことになる:
2631 %</ja>
2632 %<*zh>
2633 当前版本的\Param{jaxspmode}和\Param{alxspmode}使用相同的的表保存参数。
2634 因此,上一行可被写作:
2635 %</zh>
2636 \begin{verbatim}
2637 \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
2638 \end{verbatim}
2639 %<*en>
2640 One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}).
2641 %</en>
2642 %<*ja>
2643 また,これら2パラメータには数値で値を指定することもできる(\ref{ssec-param}節を参照).
2644 %</ja>
2645 %<*zh>
2646 你也可以使用数字来定义两个参数(参见\ref{ssec-param})。
2647 %</zh>
2648
2649 %<*en>
2650 If you want to enable/disable all insertions of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} and
2651 \Param{\hyperlink{fld:xks}{xkanjiskip}}, set \Param{autospacing} and \Param{autoxspacing}
2652 parameters to \texttt{true}/\texttt{false}, respectively.
2653 %</en>
2654 %<*ja>
2655 もし全ての\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入を有効化/無効化
2656 したければ,それぞれ\Param{autospacing}と\Param{autoxspacing}を
2657 \texttt{true}/\texttt{false}に設定すればよい.
2658 %</ja>
2659 %<*zh>
2660 如果你想要启用/屏蔽所有的\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}和\Param{\hyperlink{fld:xks}{xkanjiskip}}插入,设定
2661 \Param{autospacing}和\Param{autoxspcing}为\texttt{ture}/\texttt{false}即可。
2662 %</zh>
2663
2664 %<en>\subsection{Shifting Baseline}
2665 %<ja>\subsection{ベースラインの移動}
2666 %<zh>\subsection{基线浮动}
2667 %<*en>
2668 To make a match between a Japanese font and an alphabetic font, sometimes
2669 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
2670 by setting \verb+\ybaselineshift+ to a non-zero length (the
2671 baseline of alphabetic fonts is shifted below). However, for documents
2672 whose main language is not Japanese, it is good to shift the baseline of
2673 Japanese fonts, but not that of alphabetic fonts.
2674 Because of this, \LuaTeX-ja can independently set the shifting amount
2675 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
2676 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
2677 parameter).
2678 %</en>
2679 %<*ja>
2680 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
2681 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで
2682 なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない
2683 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
2684 このため,\LuaTeX-jaでは欧文フォントのベースラインのシフト量
2685 (\Param{yalbaselineshift}パラメータ)と和文フォントのベースラインのシフト量
2686 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
2687 %</ja>
2688 %<*zh>
2689 为了确保日文字体和西文字体能够对其,有时需要浮动其中一者的基线。
2690 在\pTeX 中,此项设定由设定\verb!\yabaselineshift!为非零长度(西文字体基线应向下浮动)。
2691 不过,如果文档的中主要语言不是日文,那么最好上浮日文字体的基线,西文字体不变。
2692 如上所述,\LuaTeX-ja可以独立设定西文字体的基线(\Param{yabaselineshift}参数)和日文字体的基线(\Param{yjabaselineshift}参数)。
2693 %</zh>
2694
2695 \begin{LTXexample}
2696 \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
2697 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
2698 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
2699 \end{LTXexample}
2700 %<*en>
2701 Here the horizontal line in above is the baseline of a line.
2702 %</en>
2703 %<*ja>
2704 上の例において引かれている水平線がベースラインである.
2705 %</ja>
2706 %<*zh>
2707 上述水平线为此行基线。
2708 %</zh>
2709
2710 %<*en>
2711 There is an interesting side-effect: characters in different size can be
2712 vertically aligned center in a line, by setting two parameters appropriately.
2713 The following is an example (beware the value is not well tuned):
2714 %</en>
2715 %<*ja>
2716 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
2717 異なる文字を中心線に揃えることができるのだ.
2718 以下は一つの例である(値はあまり調整されていないことに注意):
2719 %</ja>
2720 %<*zh>
2721 这里还有一个有趣的副作用:不同大小的字符可以通过适当调整这两个参数而在一行中垂直居中。
2722 下面是一个例子(注意,参数值并没有刻意调整):
2723 %</zh>
2724 \begin{LTXexample}
2725 xyz漢字
2726 {\scriptsize
2727   \ltjsetparameter{yjabaselineshift=-1pt,
2728     yalbaselineshift=-1pt}
2729   XYZひらがな
2730 }abcかな
2731 \end{LTXexample}
2732
2733
2734 %<en>\part{Reference}
2735 %<ja>\part{リファレンス}
2736 %<zh>\part{参考指南}
2737 \label{part-ref}
2738 %<en>\section{Font Metric and Japanese Font}
2739 %<ja>\section{フォントメトリックと和文フォント}
2740 %<zh>\section{字体测度和日文字体}
2741 %<en>\subsection{\texttt{\char92jfont}}
2742 %<ja>\subsection{\texttt{\char92jfont} 命令}
2743 %<zh>\subsection{\texttt{\char92jfont}基本语句}
2744 \label{ssec-jfont}
2745
2746 %<*en>
2747 To load a font as a Japanese font, you must use the
2748 \verb+\jfont+ instead of~\verb+\font+, while
2749 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
2750 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
2751 so TrueType/OpenType fonts with features can be used for Japanese fonts:
2752 %</en>
2753 %<*ja>
2754 フォントを和文フォントとして読み込むためには,\verb+\jfont+ を
2755 \verb+\font+ プリミティブの代わりに用いる.
2756 \verb+\jfont+ の文法は \verb+\font+ と同じである.
2757 \LuaTeX-jaは\Pkg{luaotfload}パッケージを自動的に読み込むので,
2758 TrueType/OpenTypeフォントにfeatureを指定したものを和文フォントとして用いる
2759 ことができる:
2760 %</ja>
2761 %<*zh>
2762 为了加载日文字体,需要使用\verb!\jfont!基本语句替代\verb!\font!,前者支持后者所有相同句法。
2763 \LuaTeX-ja自动加载\Pkg{luaotfload}宏包,故TrueType/OpenType字体的特性可以使用于日文字体:
2764 %</zh>
2765 \begin{LTXexample}
2766 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
2767   +trad;-kern;jfm=ujis} at 14pt
2768 \tradgt{}当/体/医/区
2769 \end{LTXexample}
2770
2771 %<*en>
2772 Note that the defined control sequence
2773 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
2774 \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+
2775 causes a error.  We denote control sequences which are defined in
2776 \verb+\jfont+ by <jfont\_cs>.
2777 %</en>
2778 %<*ja>
2779 なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+)
2780 は\textit{font\_def}トークンではないので,\verb+\fontname\tradgt+ のような
2781 入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された
2782 コントロールシーケンスを<jfont\_cs>で表す.
2783 %</ja>
2784 %<*zh>
2785 注意定义的控制序列(上例中的\verb!\tradgt!)使用的\verb!\jfont!并不是一个\textit{font\_def}标记,
2786 故类似\verb!\fontname\tradgt!输入会引起错误。
2787 我们将定义\verb!\jfont!采用<jfont\_cs>。
2788 %</zh>
2789
2790 \paragraph{JFM}
2791 %<*en>
2792 As noted in Introduction, a JFM has measurements of characters and
2793 glues/kerns that are automatically inserted for Japanese
2794 typesetting. The structure of JFM will be described in the next
2795 subsection. At the calling of \verb+\jfont+, you must specify
2796 which JFM will be used for this font by the following keys:
2797 %</en>
2798 %<*ja>
2799 「はじめに」の節で述べたように,JFMは文字と和文組版で自動的に挿入される
2800 グルー/カーンの寸法情報を持っている.JFMの構造は次の小節で述べる.
2801 \verb+\jfont+ 命令の呼び出しの際には,どのJFMを用いるのかを以下のキーで
2802 指定する必要がある:
2803 %</ja>
2804 %<*zh>
2805 在引言中已提及此项,所谓JFM是字符亮度和日文排版中自动插入的胶/出格。
2806 JFM的结构将在下节进行描述。在使用\verb!\jfont!基本语句时,必须设定JFM如下两个键:
2807 %</zh>
2808
2809 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2810 \item[jfm=<name>]
2811 %<*en>
2812 Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
2813 a file named \texttt{jfm-<name>.lua}.
2814
2815 The following JFMs are shipped with \LuaTeX-ja:
2816 %</en>
2817 %<*ja>
2818 JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
2819 \texttt{jfm-<name>.lua}を読み込む.
2820
2821 以下のJFMが\LuaTeX-jaには同梱されている:
2822 %</ja>
2823 %<*zh>
2824 设定JFM名称。设定的JFM如未加载,\LuaTeX-ja会搜寻并加载一个命名为\texttt{jfm-}<\textit{name}>\texttt{.lua}的文件。
2825
2826 \LuaTeX-ja提供如下JFM:
2827 %</zh>
2828 \begin{description}
2829 %<*en>
2830 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
2831   based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
2832   is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM.
2833 %</en>
2834 %<*ja>
2835 \item[\tt jfm-ujis.lua] \LuaTeX-jaの標準JFMである.このJFMは\upTeX で
2836   用いられるUTF/OTFパッケージ用の和文用TFMである \verb+upnmlminr-h.tfm+ を
2837   元にしている.\Pkg{luatexja-otf}パッケージを使うときはこのJFMを指定するべきである.
2838 %</ja>
2839 %<*zh>
2840 \item[\tt jfm-ujis.lua] \LuaTeX-ja标准JFM。次JFM基于\upTeX 使用的UTF/OTF宏包的\verb!upnmlminr-h.tfm!。
2841 如果你使用\Pkg{luatexja-otf}宏包,你将会用到此JFM。
2842 %</zh>
2843 %<*en>
2844 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font
2845   metric' which is widely used in \pTeX. A major difference of
2846   \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
2847   most characters under \texttt{jfm-ujis.lua} are square-shaped,
2848   while that under \texttt{jfm-jis.lua} are horizontal
2849   rectangles.
2850 %</en>
2851 %<*ja>
2852 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JISフォントメトリック」
2853   \verb+jis.tfm+ に相当するJFMである.\texttt{jfm-ujis.lua}とこの
2854   \texttt{jfm-jis.lua}の主な違いは,\texttt{jfm-ujis.lua}ではほとんどの文字が
2855   正方形状であるのに対し,\texttt{jfm-jis.lua}では横長の長方形状である.
2856 %</ja>
2857 %<*zh>
2858 \item[\tt jfm-jis.lua] 相当于\pTeX 使用的\verb!jis.tfm!(“JIS font metric”)。
2859   \texttt{jfm-ujis.lua}和\texttt{jfm-jis.lua}主要区别是:
2860   \texttt{jfm-ujis.lua}下的大部分字符是方形,
2861   \texttt{jfm-jis.lua}下则为长方形。
2862 %</zh>
2863 %<*en>
2864 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
2865   of the default Japanese font metric shipped with \pTeX. There
2866   are notable difference between this JFM and other 2~JFMs, as
2867   shown in Table~\ref{tab-difjfm}.
2868 %</en>
2869 %<*ja>
2870 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文用TFM
2871   である \verb+min10.tfm+ に相当するJFMである.このJFMと他の2つのJFMの間には
2872   表\ref{tab-difjfm}に示すような特筆すべき違いがある.
2873 %</ja>
2874 %<*zh>
2875 \item[\tt jfm-min.lua] 相当于\pTeX 中默认的\verb!min10.tfm!。
2876   这个JFM与其他2个JFM的区别如表\ref{tab-difjfm}所示。
2877 %</zh>
2878 \end{description}
2879
2880 \item[jfmvar=<string>] Sometimes there is a need that \ldots.
2881 \end{list}
2882
2883 \begin{table}[t]
2884 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
2885 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
2886 %<zh>\caption{\LuaTeX-ja下不同JFM表现}
2887 \label{tab-difjfm}
2888 \ltjsetparameter{jacharrange={+3}}
2889 \begin{center}\small
2890 \def\r#1{{\jfont\g=name:IPAMincho:jfm=#1 at 14.43324pt \g
2891 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
2892 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
2893 \vrule height 0pt depth \dp0}}
2894 \def\s#1{{\jfont\g=name:IPAMincho:jfm=#1 at 14.43324pt \g
2895 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
2896 \def\t#1{{\jfont\g=name:IPAMincho:jfm=#1 at 19.24432pt \g
2897 \setbox0=\hbox{漢}%
2898 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
2899 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
2900 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2901 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2902 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
2903 \begin{tabular}{rccc}
2904 \toprule
2905 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
2906 \midrule
2907 %<en>Example~1\cite{min10}
2908 %<ja>例1\cite{min10}
2909 %<zh>例1\cite{min10}
2910 &\r{ujis}&\r{jis}&\r{min}\\
2911 %<en>Example~2
2912 %<ja>例2
2913 %<zh>例2
2914 &\s{ujis}&\s{jis}&\s{min}\\
2915 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
2916 \bottomrule
2917 \end{tabular}
2918 \end{center}
2919 \ltjsetparameter{jacharrange={-3}}
2920 \end{table}
2921
2922 %<en>\paragraph{Note: kern feature}
2923 %<ja>\paragraph{注意:kern feature}
2924 %<zh>\paragraph{注意:kern feature}
2925 \label{para-kern}
2926 %<*en>
2927 Some fonts have information for inter-glyph spacing. However, this
2928 information is not well-compatible with \LuaTeX-ja.  More concretely,
2929 this kerning space from this information are inserted \emph{before} the
2930 insertion process of \textbf{JAglue}, and this causes incorrect spacing
2931 between two characters when both a glue/kern from the data in the font
2932 and it from JFM are present.
2933 %</en>
2934 %<*ja>
2935 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
2936 この情報は\LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
2937 されるカーニングスペースは\textbf{JAglue}の挿入過程の\textbf{前に}挿入され,
2938 JFMに基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
2939 なる.
2940 %</ja>
2941 %<*zh>
2942 一些字体具有内部字形间距信息。但是,这些信息在\LuaTeX-ja下并不良好兼容。
2943 仔细些说,出格间距是在\textbf{JAglue}插入\textbf{之前}而先行插入的,
2944 这就造成了字体数据中和JFM中的胶/出格在两个字符间插入出错。
2945 %</zh>
2946 \begin{itemize}
2947 %<*en>
2948 \item You should specify \texttt{-kern} in
2949   \verb+jfont+ when you want to use other font features,
2950   such as \texttt{script=...}\,.
2951 %</en>
2952 %<*ja>
2953 \item  \texttt{script=...}といったfeatureを使いたい場合には,\verb+\jfont+
2954   に\texttt{-kern}を指定するべきである.
2955 %</ja>
2956 %<*zh>
2957 \item 当你想使用其他字体特性如\texttt{script=...}的时候,可以在\verb!jfont!基本语句中设置\texttt{-kern}
2958 %</zh>
2959 %<*en>
2960 \item If you want to use Japanese fonts in proportional width, and use
2961       information from this font, use \texttt{jfm-prop.lua} for its JFM, and\ldots.
2962 %</en>
2963 %<*ja>
2964 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
2965   ならば,\texttt{jfm-prop.lua}をJFMとして指定し,……
2966 %</ja>
2967 %<*zh>
2968 \item 如果你想使用比例宽度的日文字体,并且使用此字体信息,使用\texttt{jfm-prop.lua}为其JFM,……
2969 %</zh>
2970 TODO: kanjiskip?
2971 \end{itemize}
2972
2973
2974 %<en>\subsection{Prefix \texttt{psft}}
2975 %<ja>\subsection{\texttt{psft}プリフィックス}
2976 %<zh>\subsection{\texttt{psft}前缀}
2977 \label{ssec-psft}
2978 %<*en>
2979 Besides `\texttt{file:}'\ and `\texttt{name:}'\ prefixes, one can use `\texttt{psft:}'\
2980 prefix in \verb+\jfont+ (and~\verb+\font+),
2981 to specify a `name-only' Japanese font which
2982 will not be embedded to PDF. Typical use of this prefix is to specify
2983 the `standard' Japanese fonts, namely, `Ryumin-Light' and
2984 `GothicBBB-Medium'.
2985 \emph{You should not specify any font features, such as `{\tt +jp90}', 
2986 in the definition of `name-only' fonts using this `{\tt psft:}'\ prefix.}
2987 %</en>
2988 %<*ja>
2989 \texttt{file:} と \texttt{name:} のプリフィックスに加えて,
2990 \verb+\jfont+(と \verb+\font+ プリミティブ)では
2991 \texttt{psft:}プリフィックスを用いることができる.
2992 このプリフィックスを用いることで,PDFには埋め込まれない「名前だけの」
2993 和文フォントを指定することができる.「標準的な」和文フォント,
2994 つまり`Ryumin-Light'と`GothicBBB-Medium'の指定でこのプリフィックスが使われる.
2995 \textbf{非埋込フォントをPDFに使用すると,実際にどのようなフォントが表示に用いられるか予測できない.
2996 そのため,本プリフィックス指定時には,\texttt{+jp90} などのfont featureは指定すべきでない.}
2997 %</ja>
2998 %<*zh>
2999 除使用\texttt{file:}和\texttt{name:}外,我们还可以在\verb!\jfont!(以及\verb!\font!)
3000 中使用\texttt{psft:}来设定一个“名义上”的并不嵌入PDF中的日文字体。
3001 此前缀的典型使用是定义“标准”日文字体,即“Ryumin-Light”和“GothicBBB-Medium”。
3002 %</zh>
3003
3004 %<*zh>
3005 \paragraph{\texttt{cid}键} 
3006 默认使用\texttt{psft:}前缀定义的字体是为Adobe-Japan1-6 CID字体。
3007 也可以使用\texttt{cid}键来使用其他的CID字体,如中文和韩文。
3008 %</zh>
3009 %<en>\paragraph{\texttt{cid} key}
3010 %<ja>\paragraph{\texttt{cid}キー}
3011 \label{para-cid}
3012
3013 %<*en>
3014 The default font defined by using \texttt{psft:} prefix is for Japanese typesetting;
3015 it is Adobe-Japan1-6 CID-keyed font.
3016 One can specify \texttt{cid} key to use other CID-keyed non-embedded fonts
3017 for Chinese or Korean typesetting.
3018 \begin{lstlisting}[numbers=left]
3019 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % Japanese
3020 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % default value is Adobe-Japan1-6
3021 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % Traditional Chinese
3022 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % Simplified Chinese
3023 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % Korean
3024 \end{lstlisting}
3025 Note that the code above specifies \texttt{jfm-jis.lua}, which is for Japanese fonts,
3026 as JFM for Chinese and Korean fonts.
3027 %</en>
3028 %<*ja>
3029 標準で\texttt{psft:}プリフィックスで定義されるフォントは日本語用のもので
3030 あり,Adobe-Japan1-6のCIDに対応したものとなる.しかし,\LuaTeX-jaは中国語
3031 の組版にも威力を発揮することが分かり,日本語フォントでない非埋込フォント
3032 の対応も必要となった.そのために追加されたのが\texttt{cid}キーである.
3033
3034 \texttt{cid}キーに値を指定すると,そのCIDを持った非埋込フォントを定義することができる:
3035 \begin{lstlisting}[numbers=left]
3036 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis}     % 日本語
3037 \jfont\testD={psft:Ryumin-Light:jfm=jis}                        % 無指定時は Adobe-Japan1-6
3038 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-5;jfm=jis} % 中国語繁体字
3039 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis}              % 中国語簡体字
3040 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis}           % 韓国語
3041 \end{lstlisting}
3042 上のコードでは中国語・韓国語用フォントに対してもJFMに
3043 日本語用の\texttt{jfm-jis.lua}を指定しているので注意されたい.
3044 %</ja>
3045
3046 %<*en>
3047 At present, \LuaTeX-ja supports only 4 values written in the sample code above.
3048 Specifying other values, e.g.,
3049 %</en>
3050 %<*ja>
3051 今のところ,\LuaTeX-jaは上のサンプルコード中に書いた4つの値しかサポートしていない.
3052 %</ja>
3053 \begin{lstlisting}
3054 \jfont\test={psft:Ryumin-Light:cid=Adobe-Japan2;jfm=jis}
3055 \end{lstlisting}
3056 %<*en>
3057 occurs the following error:
3058 %</en>
3059 %<*ja>
3060 のようにそれら以外の値を指定すると,
3061 %</ja>
3062 \begin{lstlisting}[numbers=left]
3063 ! Package luatexja Error: bad cid key `Adobe-Japan2'.
3064
3065 See the luatexja package documentation for explanation.
3066 Type  H <return>  for immediate help.
3067 <to be read again>
3068                    \par
3069 l.78
3070
3071 ? h
3072 I couldn't find any non-embedded font information for the CID
3073 `Adobe-Japan2'. For now, I'll use `Adobe-Japan1-6'.
3074 Please contact the LuaTeX-ja project team.
3075 ?
3076 \end{lstlisting}
3077 %<*ja>
3078 というエラーが出る.
3079 %</ja>
3080
3081 %<en>\subsection{Structure of JFM file}
3082 %<ja>\subsection{JFMファイルの構造}
3083 %<zh>\subsection{JFM结构}
3084
3085 %<*en>
3086 A JFM file is a Lua script which has only one function call:
3087 %</en>
3088 %<*ja>
3089 JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである:
3090 %</ja>
3091 %<*zh>
3092 JFM文件为下列函数调用的Lua脚本:
3093 %</zh>
3094 \begin{verbatim}
3095 luatexja.jfont.define_jfm { ... }
3096 \end{verbatim}
3097 %<*en>
3098 Real data are stored in the table which indicated above by
3099 \verb+{ ... }+.  So, the rest of this subsection are devoted to describe the
3100 structure of this table.  Note that all lengths in a JFM file are
3101 floating-point numbers in design-size unit.
3102 %</en>
3103 %<*ja>
3104 実際のデータは上で \verb+{ ... }+ で示されたテーブルの中に格納されている.
3105 以下ではこのテーブルの構造について記す.
3106 なお,JFMファイル中の長さは全てdesign-sizeを単位とする浮動小数点数であることに
3107 注意する.
3108 %</ja>
3109 %<*zh>
3110 实际的数据保存在表中,即如上的\verb!{ ... }!。
3111 以下部分描述表结构。
3112 请注意,在JFM中的所有长度都是按照以design-size为单位的浮点数。
3113 %</zh>
3114
3115 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3116
3117 \item[dir=<direction>]
3118 %<en>(required)
3119 %<ja>(必須)
3120 %<zh>(必须)
3121
3122 %<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
3123 %<ja>JFMの書字方向.現時点では\texttt{'yoko'}のみがサポートされる.
3124 %<zh>JFM的方向,现在只支持\texttt{yoko}(水平)。
3125
3126 \item[zw=<length>]
3127 %<en>(required)
3128 %<ja>(必須)
3129 %<zh>(必须)
3130
3131 %<en>The amount of the length of the `full-width'.
3132 %<ja>「全角幅」の長さ.
3133 %<zh>“全角”长度。
3134
3135 \item[zh=<length>]
3136 %<en>(required)
3137 %<ja>(必須)
3138 %<zh>(必须)
3139
3140 %<en>The amount of the length of the `full-height' (height + depth).
3141 %<ja>「全角高さ」(height + depth)の長さ.
3142 %<zh>“全角高度”(height + depth)长度。
3143
3144 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}]
3145 %<en>(optional)
3146 %<ja>(任意)
3147 %<zh>(可选)
3148
3149 %<*en>
3150 This field specifies the `ideal' amount of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}. As noted
3151              in Subsection~\ref{subs-kskip}, if the parameter
3152              \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is \verb+\maxdimen+, the value specified
3153              in this field is actually used (if this field is not specified in
3154              JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
3155              fields are in design-size unit too.
3156 %</en>
3157 %<*ja>
3158 「理想的な」\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の量を指定する.\ref{subs-kskip}節で述べたように,
3159 もし\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が \verb+\maxdimen+ の値ならば,このフィールドで指定された
3160 値が実際には用いられる(もしこのフィールドがJFMで指定されていなければ,
3161 0\,ptであるものとして扱われる).<stretch>と<shrink>のフィールドもdesign-size
3162 が単位であることに注意せよ.
3163 %</ja>
3164 %<*zh>
3165 这部分为“理想长度”\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}。\ref{subs-kskip}节有详述,如果参数\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}
3166 为\verb!\maxdimen!,则值设定将会被使用(若再JFM中未设定,则被视为0\,pt)。
3167 请注意,<stretch>和<shrink>的长度均为design-size单位。
3168 %</zh>
3169
3170 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}]
3171 %<en>(optional)
3172 %<ja>(任意)
3173 %<zh>(可选)
3174
3175 %<*en>
3176 Like the \texttt{kanjiskip} field, this field specifies the `ideal'
3177              amount of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
3178 %</en>
3179 %<*ja>
3180 \texttt{kanjiskip}フィールドと同様に,\Param{\hyperlink{fld:xks}{xkanjiskip}}の「理想的な」量を
3181 指定する.
3182 %</ja>
3183 %<*zh>
3184 和\texttt{kanjiskip}类似,此部分设定\Param{\hyperlink{fld:xks}{xkanjiskip}}的“理想长度”。
3185 %</zh>
3186 \end{list}
3187
3188 %<*en>
3189 \paragraph{Character classes}
3190 Besides from above fields, a JFM file have several sub-tables those
3191 indices are natural numbers.  The table indexed by~$i\in\omega$ stores
3192 information of `character class'~$i$. At least, the character class~0 is
3193 always present, so each JFM file must have a sub-table whose index is
3194 \texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
3195 the following fields:
3196 %</en>
3197 %<*ja>
3198 \paragraph{文字クラス}
3199 上記のフィールドに加えて,JFMファイルはそのインデックスが自然数であるいくつかの
3200 サブテーブルを持つ.インデックスが$i\in\omega$であるテーブルは「文字クラス」$i$の
3201 情報を格納する.少なくとも,文字クラス0は常に存在するので,JFMファイルはインデックス
3202 が\texttt{[0]}のサブテーブルを持たなければならない.それぞれのサブテーブル
3203 (そのインデックスを$i$で表わす)は以下のフィールドを持つ:
3204 %</ja>
3205 %<*zh>
3206 \paragraph{Character classes}
3207 除了上面涉及到的内容,JFM文件中还有几个以自然数进行声明的次级表。
3208 这些表依靠满足$i\in\omega$的“字符类”$i$来索引。
3209 一般,最少需要的是字符类0,故每一个JFM文件必须有次级表索引为\texttt{[0]}。
3210 %</zh>
3211
3212 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3213 \item[chars=\{<character>, ...\}]
3214 %<en>(required except character class~0)
3215 %<ja>(文字クラス0を除いて必須)
3216 %<zh>(字符类0外必须)
3217
3218 %<*en>
3219 This field is a list of characters which are in this character
3220              type~$i$. This field is optional if $i=0$, since all
3221              \textbf{JAchar} which do not belong  any character classes other
3222              than 0 are in the character class 0
3223              (hence, the character class~0 contains most of
3224              \textbf{JAchar}s). In the list, character(s) can be specified in the following form:
3225 \begin{itemize}
3226 \item a Unicode code point
3227 \item the character itself (as a Lua string, like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+})
3228 \item a string like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+} (the character followed by an asterisk)
3229 \item several ``imaginary'' characters (We will describe these later.)
3230 \end{itemize}
3231 %</en>
3232 %<*ja>
3233 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
3234 場合には任意である(文字クラス0には,0以外の文字クラスに属するものを
3235 除いた全ての\textbf{JAchar}が属するから).このリスト中で文字を指定するには,以下の方法がある:
3236 \begin{itemize}
3237 \item Unicode におけるコード番号
3238 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+}」のような,文字それ自体
3239 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+}」のような,文字それ自体の後にアスタリスクをつけたもの
3240 \item いくつかの「仮想的な文字」(後に説明する)
3241 \end{itemize}
3242 %</ja>
3243 %<*zh>
3244 这部分为字符集$i$的字符列表。当$i=0$时不需要设定此部分,因为不在字符集0种的\textbf{JAchar}
3245 字符都包含在字符集0中(也就是字符集0包含大多数的\textbf{JAchar})。在这个字符列表中,每一个
3246 字符据可以使用其编码,或者字符本身(长度为1的字符串)。另外还有部分“假想字符”可在此列表中
3247 使用。我们会在下面描述。
3248 %</zh>
3249
3250 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
3251 %<en>(required)
3252 %<ja>(必須)
3253 %<zh>(必须)
3254
3255 %<*en>
3256 Specify width of characters in character class~$i$, height, depth and
3257 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
3258 as values of these fields.
3259 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
3260 %</en>
3261 %<*ja>
3262 文字クラス$i$に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
3263 文字クラス$i$に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
3264 値であるものとして扱われる.
3265 しかし,例外が一つある:もし \texttt{'prop'} が \texttt{width} フィールドに
3266 指定された場合,文字の幅はその「実際の」グリフの幅となる.
3267 %</ja>
3268 %<*zh>
3269 设定字符类$i$的宽度,高度和深度以及意大利体校正。在字符集$i$中,所有字符的宽度,高度
3270 和深度的值为上述设定之值。不过还有例外,如果\texttt{'prop'}设定了\texttt{width}部分,那么
3271 字符的宽度则为其“真实”字形宽度。
3272 %</zh>
3273
3274 \item[left=<length>, down=<length>, align=<align>]\
3275
3276 %<*en>
3277 These fields are for adjusting the position of the `real' glyph. Legal
3278              values of \texttt{align} field are \texttt{'left'},
3279              \texttt{'middle'} and \texttt{'right'}. If one of these
3280              3~fields are omitted, \texttt{left} and \texttt{down} are
3281              treated as~0, and \texttt{align} field is treated as
3282              \texttt{'left'}.
3283 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
3284 %</en>
3285 %<*ja>
3286 これらのフィールドは「実際の」グリフの位置を調整するためにある.
3287 \texttt{align}フィールドに指定できる値は\texttt{'left'}, \texttt{'middle'},
3288 \texttt{'right'}のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
3289 場合,\texttt{left}と\texttt{down}は0,\texttt{align}フィールドは
3290 \texttt{'left'}であるものとして扱われる.
3291 これら3つのフィールドの意味については図\ref{fig-pos}で説明する.
3292 %</ja>
3293 %<*zh>
3294 此部分为“真实”字形对齐位置。\texttt{align}的合法值为\texttt{'left'},
3295 \texttt{'middle'}和\texttt{'right'}。如此三项被省略,则\texttt{left}和
3296 \texttt{down}被视作0,\texttt{align}被视作\texttt{'left'}。
3297 此部分三个域的作用,请参见图\ref{fig-pos}。
3298 %</zh>
3299
3300 %<*en>
3301 In most cases, \texttt{left} and \texttt{down} fields are~0, while
3302 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
3303 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
3304 when the current character class is the class for opening delimiters'.
3305 %</en>
3306 %<*ja>
3307 多くの場合,\texttt{left}と\texttt{down}は0である一方,
3308 \texttt{align}フィールドが\texttt{'middle'}や\texttt{'right'}であることは
3309 珍しいことではない.
3310 例えば,\texttt{align}フィールドを\texttt{'right'}に指定することは,
3311 文字クラスが開き括弧類であるときに実際必要である.
3312 %</ja>
3313 %<*zh>
3314 在大多数情况下,\texttt{left}和\texttt{down}域为0,但是在\texttt{align}域为
3315 \texttt{'middle'}或者\texttt{'right'}时则是不正常的。例如,必须设定\texttt{align}
3316 为\texttt{'right'}时,则当前字符类必须为开定界符。
3317 %</zh>
3318 \begin{figure}[!tb]
3319 \begin{minipage}{0.4\textwidth}%
3320 \begin{center}\unitlength=10pt\small
3321 \begin{picture}(15,12)(-1,-4)
3322 \color{black!10!white}% real glyph :step1
3323 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
3324
3325 \color{red!20!white}% real glyph :step1
3326 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
3327
3328 \color{red}% real glyph
3329 \thicklines
3330 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
3331 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
3332 \put(-1,5.5){\line(1,0){6}}
3333 \put(-1,-4){\line(1,0){6}}
3334
3335 \color{green!20!white}% real glyph :step1
3336 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
3337
3338 \color{black}% real glyph :step1
3339 \thicklines
3340 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
3341 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
3342 \put(0,8){\line(1,0){12}}
3343 \put(0,-3){\line(1,0){12}}
3344 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
3345 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
3346 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
3347
3348 \color{green!50!black}% real glyph :step1
3349 \thicklines
3350 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
3351 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
3352 \put(3,7){\line(1,0){6}}
3353 \put(3,-2.5){\line(1,0){6}}
3354 \newsavebox{\eqdist}
3355 \savebox{\eqdist}(0,0)[b]{%
3356   \thinlines
3357   \put(-0.08,0.2){\line(0,-1){0.4}}%
3358   \put(0.08,0.2){\line(0,-1){0.4}}}
3359 \put(1.5,0){\usebox{\eqdist}}
3360 \put(10.5,0){\usebox{\eqdist}}
3361
3362 \color{blue}% shifted
3363 \thicklines
3364 \put(3,-1.5){\vector(-1,0){4}}
3365 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
3366 \put(3,0){\vector(0,-1){1.5}}
3367 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
3368 \end{picture}
3369 \end{center}
3370 \end{minipage}%
3371 \begin{minipage}{0.6\textwidth}%
3372 %<*en>
3373 Consider a node containing Japanese character whose value of the \texttt{align}
3374 field is \texttt{'middle'}.
3375 %</en>
3376 %<*ja>
3377 \texttt{align}フィールドの値が\texttt{'middle'}である和文文字を含むノードを
3378 考えよう.
3379 %</ja>
3380 %<*zh>
3381 假定一个node包含日语字符,且其值为\texttt{align}的\texttt{'middle'}。
3382 %</zh>
3383 \begin{itemize}
3384 \item
3385 %<*en>
3386 The black rectangle is a frame of the node.
3387 Its width, height and depth are specified by JFM.
3388 %</en>
3389 %<*ja>
3390 黒色の長方形はノードの枠である.
3391 その幅,高さ,深さはJFMによって指定される.
3392 %</ja>
3393 %<*zh>
3394 黑色长方形为node框。其宽度,高度,深度均为JFM所设定。
3395 %</zh>
3396 \item
3397 %<*en>
3398 Since the \texttt{align} field is \texttt{'middle'},
3399 the `real' glyph is centered horizontally (the green rectangle).
3400 %</en>
3401 %<*ja>
3402 \texttt{align}フィールドは\texttt{middle}なので,「実際の」グリフは
3403 水平方向の中心に配置される(緑色の長方形).
3404 %</ja>
3405 %<*zh>
3406 因\texttt{align}被设定为\texttt{middle},故“真实”字形为水平居中(绿长方形中)。
3407 %</zh>
3408 \item
3409 %<*en>
3410 Furthermore, the glyph is shifted according to values of fields
3411       \texttt{left} and \texttt{down}. The ultimate position of the real
3412       glyph is indicated by the red rectangle.
3413 %</en>
3414 %<*ja>
3415 さらに,グリフは\texttt{left}と\texttt{down}の値に従ってシフトされる.
3416 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
3417 %</ja>
3418 %<*zh>
3419 此外,字形移位由\texttt{left}和\texttt{down}决定。最终字形位置为红长方形所示。
3420 %</zh>
3421 \end{itemize}
3422 \end{minipage}
3423 \medskip
3424
3425 \caption{%
3426 %<en>The position of the `real' glyph.
3427 %<ja>「実際の」グリフの位置.
3428 %<zh>“真实”字形位置
3429 }
3430 \label{fig-pos}
3431 \end{figure}
3432
3433 \item[kern={\{[$j$]=<kern>, [$j'$]=\{<kern>, [<ratio>]\}, ...\}}]
3434
3435 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>, [<priority>], [<ratio>]\}, ...\}}]
3436 %<*ja>
3437 文字クラス$i$の文字と$j$の文字の間に挿入されるkernやglueの量を指定する.
3438
3439              <priority>は\texttt{luatexja-adjust.sty} による優先順位付き
3440              行長調整(\ref{ssec-adj}節)が有効なときのみ意味を持つ.
3441 このフィールドは省略可能であり,行調整処理におけるこのglueの優先
3442              度を$-2$から$+2$の間の整数で指定する.<priority>の省略時の値
3443              は0であり,範囲外の値が指定されたときの動作は未定義である).
3444
3445 <ratio>も省略可能フィールドであり,$-1$から$+1$の実数値をとる.省略時の値は0である.
3446 \begin{itemize}
3447 \item $-1$はこのグルーが「前の文字」由来であることを示す.
3448 \item $+1$はこのグルーが「後の文字」由来であることを示す.
3449 \item それ以外の値は,「前の文字」由来のグルーと「後の文字」由来の
3450 グルーが混合されていることを示す.
3451 \end{itemize}
3452 なお,このフィールドの値は\Param{\hyperlink{fld:diffjfm}{differentjfm}}の値が\texttt{pleft},~\texttt{pright},~\texttt{paverage}の値のときのみ実際に用いられる.
3453
3454 例えば,\cite{x4051}では,句点と中点の間には,
3455 句点由来の二分空きと中点由来の四分空きが挿入されるが,この場合には
3456 \begin{itemize}
3457 \item <width>には$0.5+0.25=0.75$を指定する.
3458 \item <ratio>には次の値を指定する.
3459 \[
3460  -1\cdot \frac{0.5}{0.5+0.25} + 1 \cdot \frac{0.25}{0.5+0.25} = -\frac13
3461 \]
3462 \end{itemize}
3463
3464 %</ja>
3465
3466 \item[end\_stretch=<kern>]
3467 \item[end\_shrink=<kern>]
3468 %<*ja>
3469 これらのフィールドは省略可能である.
3470 優先順位付き行長調整が有効であり,かつ現在の文字クラスの文字が行
3471              末に来た時に,行長を詰める調整・伸ばす調整のた
3472              めにこの文字と行末の間に挿入可能なカーンの大きさを指定する.
3473 %</ja>
3474
3475 \end{list}
3476
3477 %<*ja>
3478 \paragraph{文字クラスの決定}
3479 文字クラスの決定は少々複雑である.ここでは例を用いて説明しよう.
3480
3481
3482 たとえば,次の内容を一部に含んだ \texttt{jfm-test.lua} を考えよう:
3483 \begin{lstlisting}
3484    [0] = {
3485       chars = { '漢', 'ヒ*' },
3486       align = 'left', left = 0.0, down = 0.0,
3487       width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
3488    },
3489    [2000] = {
3490       chars = { '。', '、*', 'ヒ' },
3491       align = 'left', left = 0.0, down = 0.0,
3492       width = 0.5, height = 0.88, depth = 0.12, italic=0.0,
3493    },
3494 \end{lstlisting}
3495 句点「。」の幅は二分であるので
3496 \begin{LTXexample}
3497 \jfont\a=name:IPAMincho:jfm=test;+vert
3498 \setbox0\hbox{\a 。\inhibitglue 漢}
3499 \the\wd0
3500 \end{LTXexample}
3501 では,全角二分(15.0\,pt)とならなければおかしいが,上の実行結果では20\,ptとなっている.
3502 それは以下の事情によるものである:
3503 \begin{enumerate}
3504 \item \verb+vert+ featureによって句点が縦書き用のグリフと置き換わる(\Pkg{luaotfload} による処理).
3505 \item しかしこのグリフは「文字コード」U+F0000以降とみなされている
3506 (実際にいくらになるかは,フォントによって異なる).
3507 \item よって,文字クラス0とみなされるため,結果として「。」の幅は全角だと認識されてしまう.
3508 \end{enumerate}
3509
3510 一方,「\texttt{'、*'}」のようにアスタリスクつきの指定があると,
3511 状況は異なってくる.
3512 \begin{LTXexample}
3513 \jfont\a=name:IPAMincho:jfm=test;+vert
3514 \a 漢、\inhibitglue 漢
3515 \end{LTXexample}
3516 ここで,読点「、」の文字クラスは,以下のようにして決まる.
3517 \begin{enumerate}
3518 \item とりあえず句点の時と同じように,\Pkg{luaotfload} によって縦書き用読点のグリフに置き換わる.
3519 \item 置換後のグリフの「文字コード」はU+F0000以降であり,
3520 そのままでは文字クラスは0と判定される.
3521 \item ところが,JFMには「\texttt{'、*'}」指定があるので,置換前の横書き用読点のグリフ「、」(文字コードはU+3001)によって文字クラスを判定する.
3522 \item 結果として,上の出力例中の読点の文字クラスは2000となる.
3523 \end{enumerate}
3524
3525 なお,置換後のグリフで判定した文字クラスの値が0でなければ,そちらをそのまま作用する.
3526 \begin{LTXexample}
3527 \jfont\a=name:IPAMincho:jfm=test;+hwid
3528 \a 漢ヒひ
3529 \end{LTXexample}
3530 上の例では,
3531 \texttt{hwid} featureにより,「ヒ」が半角の「ヒ」に置き換わるが,
3532 文字クラスは「ヒ」の属する0\textbf{ではなく},「ヒ」の属する2000となる.
3533 %</ja>
3534
3535 %<ja>\paragraph{仮想的な文字}
3536 %<!ja>\paragraph{Imaginary characters}
3537 %<*en>
3538 As described before, you can specify several `imaginary characters' in
3539 \texttt{chars} field. The most of these characters are regarded as the
3540 characters of class 0 in \pTeX.
3541 As a result, \LuaTeX-ja can control typesetting finer than \pTeX.
3542 The following is the list of `imaginary characters':
3543 %</en>
3544 %<*ja>
3545 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
3546 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
3547 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
3548 い組版調整ができるようになっている.以下でその一覧を述べる:
3549 %</ja>
3550 %<*zh>
3551 如上所述,你可以在\texttt{chars}中设定多个“假想字符”。这些字符中的多数字符在
3552 \pTeX 中式被视作字符集0中字符。故此,\LuaTeX-ja可以比\pTeX 做得更好。
3553 下列为“假想字符”列表:
3554 %</zh>
3555 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3556 %%\item['lineend']
3557 %%%<en>An ending of a line.
3558 %%%<ja>行の終端を表す.
3559 %%%<zh>行尾结束字符。
3560
3561 %%\item['diffmet']
3562 %%<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
3563 %%<ja>JFMやサイズが異なる2つの\textbf{JAchar}の間の境界として用いられる.
3564 %%<zh>用于两个不同大小或不同JFM的两个\textbf{JAchar}间边界。
3565
3566 \item['boxbdd']
3567 %<en>The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
3568 %<ja>水平ボックスの先頭と末尾,及びインデントされていない(\verb+\noindent+ で開始された)段落の先頭を表す.
3569 %<zh>水平合字结束或结尾,以及未缩进段落开头。
3570
3571 \item['parbdd']
3572 %<en>The beginning of an (indented) paragraph.
3573 %<ja>通常の(\verb+\noindent+ で開始されていない)段落の先頭.
3574 %<zh>缩进段落开头。
3575
3576 \item['jcharbdd']
3577 %<en>A boundary between \textbf{JAchar} and anything else (such as \textbf{ALchar}, kern, glue,\,\ldots).
3578 %<ja>和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
3579 %<zh>日文字符和其他(如\textbf{ALchar},胶,出格等)边界。
3580
3581 \item[$-1$]
3582 %<en>The left/right boundary of an inline math formula.
3583 %<ja>行中数式と地の文との境界.
3584 %<zh>行中数学式的左/右边界。
3585 \end{list}
3586
3587 %<en>\paragraph{Porting JFM from \pTeX}
3588 %<ja>\paragraph{\pTeX 用和文用TFMの移植}
3589 %<zh>\paragraph{\pTeX 下使用的TFM移植}
3590
3591 % ToDo: English version.
3592
3593 %<*en>
3594 \ldots
3595 %</en>
3596
3597 %<*ja>
3598 以下に,\pTeX 用に作られた和文用TFMを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
3599 \begin{itemize}
3600 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
3601 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
3602       トメトリック等を移植する場合は,
3603 \begin{itemize}
3604 \item JFM中の全ての数値を$1/0.962216$倍しておく.
3605 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
3606       \LaTeX でのフォント宣言なら,例えば次のように:
3607 \begin{verbatim}
3608 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
3609 \end{verbatim}
3610 \end{itemize}
3611 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
3612       (JFM中に単に書かなければよい).
3613 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
3614       文字クラスに関してはグルー/カーンの設定はしない.
3615
3616 これは,\pTeX では,
3617       水平ボックスの先頭・末尾とインデントされていない(\verb+\noindent+ で開始さ
3618       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
3619 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
3620
3621 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
3622       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
3623       は,段落の最初に手動で \verb+\inhibitglue+ を追加するか,あるいは
3624       \ \verb+\everypar+ のハックを行い,それを自動化させるしかなかった.
3625
3626 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
3627 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
3628 \texttt{'parbdd'}を入れれば全角下がりとなる.
3629
3630 \begin{LTXexample}
3631 \jfont\g=name:IPAMincho:jfm=test \g
3632 \parindent1\zw\noindent{}◆◆◆◆◆
3633 \par 「◆◆←二分下がり
3634 \par 【◆◆←全角下がり
3635 \par 〔◆◆←全角二分下がり
3636 \end{LTXexample}
3637 \end{itemize}
3638
3639 但し,\verb+\everypar+ を利用している場合にはこの仕組みは正しく動かない.
3640 そのような例としては箇条書き中の \verb+\item+ で始まる段落があり,\Pkg{ltjsclasses}では
3641 人工的に「\texttt{'parbdd'}の意味を持つ」whatsitノードを作ることによって対処している%
3642 \footnote{\texttt{no\_runtime/ltjsclasses.dtx} を参照されたい.
3643 JFM側で一部の対処ができることにより,\Pkg{jsclasses}のようにif文の判定はしていない.}
3644 %</ja>
3645 %<*zh>
3646 下面,给出用于\pTeX 使用的JFM移植到\LuaTeX-ja过程中需要注意的几点。
3647 %</zh>
3648
3649
3650 %<en>\subsection{Math Font Family}
3651 %<ja>\subsection{数式フォントファミリ}
3652 %<zh>\subsection{数学字体族}
3653 \label{ssec-math}
3654
3655 %<*en>
3656 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
3657 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX\ can handles 256~families, but
3658 an external package is needed to support this in plain \TeX\ and
3659 \LaTeX.}, and each family has three fonts:
3660 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
3661 %</en>
3662 %<*ja>
3663 \TeX\ は数式フォントを16のファミリ\footnote{Omega, Aleph, \LuaTeX,そして
3664   $\varepsilon$-\kern-.125em(u)\pTeX\ では256の数式ファミリを扱うことができるが,
3665   これをサポートするためにplain \TeX と\LaTeX では外部パッケージを読み込む必要が
3666   ある.}で管理し,それぞれのファミリは3つのフォントを持っている:\verb+\textfont+, \verb+\scriptfont+ そして \verb+\scriptscriptfont+ である.
3667 %</ja>
3668
3669 %<*en>
3670 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
3671 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
3672 font families. There is no relation between the value of
3673 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
3674 you can set both \verb+\fam+ and \verb+\jfam+ to the same value.
3675 %</en>
3676 %<*ja>
3677 \LuaTeX-jaの数式中での和文フォントの扱いも同様である.
3678 表\ref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する
3679 ものを示している.\verb+\fam+ と \verb+\jfam+ の値の間には関係はなく,
3680 適切な設定の下では \verb+\fam+ と \verb+\jfam+ の両方に同じ値を設定することができる.
3681 %</ja>
3682
3683 \begin{table}[!tb]
3684 %<en>\caption{Control sequences for Japanese math fonts}
3685 %<ja>\caption{和文数式フォントに対する命令}
3686 %<zh>\caption{日语数学字体基本语句}
3687 \label{tab-math}
3688 \begin{center}
3689 \def\{{\char`\{}\def\}{\char`\}}\small
3690 \begin{tabular}{ll}
3691 \toprule
3692 %<en>\bf Japanese fonts&\bf alphabetic fonts\\
3693 %<ja>\bf 和文フォント&\bf 欧文フォント\\
3694 %<zh>\bf 日文字体&\bf 西文字体\\
3695 \midrule
3696 \verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
3697 \tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
3698 \tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
3699 \tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
3700 \bottomrule
3701 \end{tabular}
3702 \end{center}
3703 \end{table}
3704
3705 %<en>\subsection{Callbacks}
3706 %<ja>\subsection{コールバック}
3707 %<zh>\subsection{回调}
3708
3709 %<*en>
3710 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
3711 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks.
3712 %</en>
3713 %<*ja>
3714 \LuaTeX 自体のものに加えて,\LuaTeX-jaもコールバックを持っている.
3715 これらのコールバックには,他のコールバックと同様に \verb+luatexbase.add_to_callback+
3716 関数などを用いることでアクセスすることができる.
3717 %</ja>
3718 \begin{list}{}%
3719 {\def\makelabel#1{\bfseries#1}}
3720 %<en>\item[\texttt{luatexja.load\_jfm} callback]
3721 %<ja>\item[\texttt{luatexja.load\_jfm}コールバック]
3722 %<zh>\item[\texttt{luatexja.load\_jfm}回调]
3723 %<*en>
3724 With this callback you can overwrite JFMs.
3725 This callback is called when a new JFM is loaded.
3726 %</en>
3727 %<*ja>
3728 このコールバックを用いることでJFMを上書きすることができる.
3729 このコールバックは新しいJFMが読み込まれるときに呼び出される.
3730 %</ja>
3731
3732 \begin{lstlisting}[numbers=left]
3733 function (<table> jfm_info, <string> jfm_name)
3734   return <table> new_jfm_info
3735 end
3736 \end{lstlisting}
3737
3738 %<*en>
3739 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
3740 this argument has \texttt{chars} field which contains character codes
3741              whose character class is not~0.
3742 %</en>
3743 %<*ja>
3744 引数 \verb+jfm_info+ はJFMファイルのテーブルと似たものが格納されるが,
3745 クラス0を除いた文字のコードを含んだ\texttt{chars}フィールドを持つ点が異なる.
3746 %</ja>
3747
3748 %<*en>
3749 An example of this callback is the \texttt{ltjarticle} class, with
3750              forcefully assigning character class~0 to \texttt{'parbdd'}
3751              in the JFM \texttt{jfm-min.lua}.
3752 %</en>
3753 %<*ja>
3754 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
3755 \texttt{jfm-min.lua}中の\texttt{'parbdd'}を強制的にクラス0に割り当てている.
3756 %</ja>
3757
3758 %<en>\item[\texttt{luatexja.define\_font} callback]
3759 %<ja>\item[\texttt{luatexja.define\_font}コールバック]
3760 %<zh>\item[\texttt{luatexja.define\_font}回调]
3761 %<*en>
3762 This callback and the next callback form a pair, and you can assign letters which don't have
3763              fixed code points in Unicode to non-zero character classes.
3764 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
3765 %</en>
3766 %<*ja>
3767 このコールバックと次のコールバックは組をなしており,Unicode中に固定された文字コード
3768 番号を持たない文字を非零の文字クラスに割り当てることができる.
3769 このコールバックは新しい和文フォントが読み込まれたときに呼び出される.
3770 %</ja>
3771
3772 \begin{lstlisting}[numbers=left]
3773 function (<table> jfont_info, <number> font_number)
3774   return <table> new_jfont_info
3775 end
3776 \end{lstlisting}
3777
3778 %<*en>
3779 You may assume that \verb+jfont_info+ has the following fields:
3780 %</en>
3781 %<*ja>
3782 \verb+jfont_info+ は以下の2フィールドを持つ:
3783 %</ja>
3784 \begin{description}
3785 \item[\tt size\_cache]
3786 %<*ja>
3787 使用されているJFMの情報が格納されているテーブルで,
3788 \textbf{このテーブルを書き換えてはならない}.
3789 中身はほぼJFMファイルに書かれている唯一のテーブルであるが,次のように若干変わっている:
3790 \begin{itemize}
3791 \item 各文字クラス$i$に属する文字達のテーブル
3792 \texttt{[$i$].chars=\{<character>, ...\}}は,トップレベルにまとめられ,
3793 \texttt{chars=\{[<character>]=$i$, ...\}}という形になっている.
3794 \item \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} の各フィールドの値は,
3795 実際に使われるフォントサイズに合わせたsp ($1\,\mathrm{sp}=2^{-6}\,\mathrm{pt}$)単位の長さに変わっている.
3796 \item 各文字クラス$i$の情報を格納したテーブルも,\texttt{char\_type} フィールドの下にまとめられている.
3797 例えば,文字クラス1に属する文字の高さは \texttt{char\_type[1].height} で参照できる.
3798 \item \texttt{dir} フィールドはこのテーブルにはない.
3799 \end{itemize}
3800 %</ja>
3801 %<*en>
3802 A table which contains the information of a JFM, and \emph{this table must not be changed}.
3803 The contents of this table are similar to that which is written is the JFM file, but
3804 the following differ:
3805 \begin{itemize}
3806 \item There is a \texttt{chars} table, \dots
3807 \item The value in \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} fields are
3808 now scaled by real font size, and in scaled-pont unit.
3809 \item ...
3810 \item There is no \texttt{dir} field in this table.
3811 \end{itemize}
3812 %</en>
3813 %<zh> ...
3814
3815 \item[\tt var]
3816 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
3817 %<ja>\verb+\jfont+ の呼び出しの際に\texttt{jfmvar=...}で指定された値.
3818 %<zh>\verb!\jfont!调用的\texttt{jfmvar=...}值。
3819 \end{description}
3820
3821 %<*en>
3822 The returned table \verb+new_jfont_info+ also should include these two fields.
3823 The \verb+font_number+ is a font number.
3824 %</en>
3825 %<*ja>
3826 戻り値の \verb+new_jfont_info+ テーブルもこれら2つのフィールドを含まなければならないが,
3827 それ以外にユーザが勝手にフィールドを付け加えることは自由である.
3828 \verb+font_number+ はフォント番号である.
3829 %</ja>
3830
3831 %<*en>
3832 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
3833              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
3834              CID characters in a JFM. This callback doesn't replace any
3835              code of \LuaTeX-ja.
3836 %</en>
3837 %<*ja>
3838 これと次のコールバックの良い使用例は\Pkg{luatexja-otf}パッケージであり,
3839 JFM中でAdobe-Japan1 CIDの文字を \verb+"AJ1-xxx"+ の形で指定するために
3840 用いられている.
3841 %</ja>
3842
3843 %<en>\item[\texttt{luatexja.find\_char\_class} callback]
3844 %<ja>\item[\texttt{luatexja.find\_char\_class}コールバック]
3845 %<zh>\item[\texttt{luatexja.find\_char\_class}回调]
3846 %<*en>
3847 This callback is called just when \LuaTeX-ja is trying to determine which
3848              character class a character \verb+chr_code+ belongs.
3849 A function used in this callback should be in the following form:
3850 %</en>
3851 %<*ja>
3852 このコールバックは\LuaTeX-jaが \verb+chr_code+ の文字がどの文字クラスに
3853 属するかを決定しようとする際に呼び出される.
3854 このコールバックで呼び出される関数は次の形をしていなければならない:
3855 %</ja>
3856 \begin{lstlisting}[numbers=left]
3857 function (<number> char_class, <table> jfont_info, <number> chr_code)
3858   if char_class~=0 then return char_class
3859   else
3860     ....
3861     return (<number> new_char_class or 0)
3862   end
3863 end
3864 \end{lstlisting}
3865
3866 %<*en>
3867 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
3868              routine or previous function calls in this callback, hence
3869              this argument may not be 0. Moreover, the returned
3870              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
3871              is not~0, otherwise you will overwrite the \LuaTeX-ja's
3872              default routine.
3873 %</en>
3874 %<*ja>
3875 引数 \verb+char_class+ は\LuaTeX-jaのデフォルトルーチンか,このコールバックの
3876 直前の関数呼び出しの結果を含んでおり,したがってこの値は0ではないかもしれない.
3877 さらに,戻り値の \verb+new_char_class+ は \verb+char_class+ が非零のときには
3878 \verb+char_class+ の値と同じであるべきで,そうでないときは\LuaTeX-jaの
3879 デフォルトルーチンを書き換えることになる.
3880 %</ja>
3881
3882 %<en>\item[\texttt{luatexja.set\_width} callback]
3883 %<ja>\item[\texttt{luatexja.set\_width}コールバック]
3884 %<zh>\item[\texttt{luatexja.set\_width}回调]
3885 %<*en>
3886 This callback is called when \LuaTeX-ja is trying to encapsule a
3887              \textbf{JAchar} \textit{glyph\_node}, to adjust its
3888              dimension and position.
3889 %</en>
3890 %<*ja>
3891 このコールバックは\LuaTeX-jaが\textbf{JAchar}の寸法と位置を調節するために
3892 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
3893 %</ja>
3894 \begin{lstlisting}[numbers=left]
3895 function (<table> shift_info, <table> jfont_info, <number> char_class)
3896   return <table> new_shift_info
3897 end
3898 \end{lstlisting}
3899
3900 %<*en>
3901 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
3902 \texttt{down} and \texttt{left} fields, which are the amount of shifting
3903              down/left the character in a scaled-point.
3904 %</en>
3905 %<*ja>
3906 引数 \verb+shift_info+ と戻り値の \verb+new_shift_info+ は
3907 \texttt{down}と\texttt{left}のフィールドを持ち,これらの値は
3908 文字の下/左へのシフト量(スケールド・ポイント単位)である.
3909 %</ja>
3910
3911 %<*en>
3912 A good example is \Pkg{test/valign.lua}.
3913 After loading this file, the vertical position of glyphs is automatically
3914 adjusted; the ratio $(\hbox{height}:\hbox{depth})$ of glyphs is adjusted
3915 to be that of letters in the character class~0. For example, suppose that
3916 \begin{itemize}
3917 \item The setting of the JFM: $(\hbox{height})=88x$, $(\hbox{depth})=12x$
3918   (the standard values of Japanese OpenType fonts);
3919 \item The value of the real font: $(\hbox{height})=28y$, $(\hbox{depth})=5y$
3920   (the standard values of Japanese TrueType fonts).
3921 \end{itemize}
3922 Then, the position of glyphs is shifted up by
3923 \[
3924  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3925 \]
3926 %</en>
3927 %<*ja>
3928 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
3929              JFM内で規定された文字クラス0の文字における$(\hbox{高
3930              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
3931              下位置が自動調整される.例えば,
3932 \begin{itemize}
3933 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
3934 (和文OpenTypeフォントの標準値)
3935 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
3936 \end{itemize}
3937 となっていたとする.すると,実際の文字の出力位置は,
3938 \[
3939  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3940 \]
3941 だけ上にずらされることになる.
3942 %</ja>
3943 \end{list}
3944
3945
3946
3947 %<en>\section{Parameters}
3948 %<ja>\section{パラメータ}
3949 %<zh>\section{参数}
3950 %<en>\subsection{\texttt{\char92 ltjsetparameter}}
3951 %<ja>\subsection{\texttt{\char92 ltjsetparameter}命令}
3952 %<zh>\subsection{\texttt{\char92 ltjsetparameter}基本参数}
3953
3954 %<*en>
3955 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
3956 control sequences for accessing most parameters of \LuaTeX-ja. One of the main
3957 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
3958 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
3959 is the position of \verb+hpack_filter+ callback in the source
3960 of \LuaTeX, see Section~\ref{sec-para}.
3961 %</en>
3962 %<*ja>
3963 先に述べたように,\verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ は
3964 \LuaTeX-jaのほとんどのパラメータにアクセスするための命令である.
3965 \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を
3966 採用しない理由の一つは,\LuaTeX のソースにおける \verb+hpack_filter+
3967 コールバックの位置にある.\ref{sec-para}節を参照.
3968 %</ja>
3969
3970 %<*en>
3971 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are control sequences
3972 for assigning parameters. These take one argument which is a
3973 \texttt{<key>=<value>} list. Allowed keys are described in the next
3974 subsection.
3975 The difference between
3976 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
3977 scope of assignment;
3978 \verb+\ltjsetparameter+ does a local assignment and
3979 \verb+\ltjglobalsetparameter+ does a global one.
3980 They also obey the value of \verb+\globaldefs+,
3981 like other assignment.
3982 %</en>
3983 %<*ja>
3984 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ はパラメータを
3985 指定するための命令である.これらは\texttt{<key>=<value>}のリストを
3986 引数としてとる.許されるキーは次の節に記述する.
3987 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ の違いはスコープの
3988 違いのみである.
3989 \verb+\ltjsetparameter+ はローカルな指定,\verb+\ltjglobalsetparameter+ は
3990 グローバルな指定を行う.
3991 これらは他のパラメータ指定と同様に \verb+\globaldefs+ の値に従う.
3992 %</ja>
3993
3994 %<*en>
3995 \verb+\ltjgetparameter+ is for acquiring parameters. It
3996 always takes a parameter name as first argument, and also takes the
3997 additional argument---a character code, for example---in some cases.
3998 %</en>
3999 %<*ja>
4000 \verb+\ltjgetparameter+ はパラメータの値を取得するための命令であり,
4001 常にパラメータの名前を第一引数にとる.
4002 そして,いくつかの場合には加えてさらに引数(例えば文字コード)をとる.
4003 %</ja>
4004 \begin{LTXexample}
4005 \ltjgetparameter{differentjfm},
4006 \ltjgetparameter{autospacing},
4007 \ltjgetparameter{prebreakpenalty}{`)}.
4008 \end{LTXexample}
4009 %<*en>
4010 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
4011 always a string}. This is outputted by \texttt{tex.write()}, so any
4012 character other than space~`\texttt{\char32}'~(U+0020) has the category code
4013 12~(other), while the space has 10~(space).
4014 %</en>
4015 %<*ja>
4016 \textbf{{\normalfont\tt\char92ltjgetparameter}の戻り値は常に文字列である.}
4017 これは\texttt{tex.write()}によって出力しているためで,スペース`\texttt{\char32}'~(U+0020)を除いた文字のカテゴリーコードは全て12~(other)となる.
4018 一方,スペースのカテゴリーコードは10~(space)である.
4019 %</ja>
4020
4021 %<en>\subsection{List of Parameters}
4022 %<ja>\subsection{パラメータ一覧}
4023 %<zh>\subsection{参数一览}
4024 \label{ssec-param}
4025
4026 %<*en>
4027 The following is the list of parameters which can be specified by the
4028 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
4029 in \pTeX, and symbols beside each parameter has the following meaning:
4030 %</en>
4031 %<*ja>
4032 以下は \verb+\ltjsetparameter+ に指定することができるパラメータの一覧である.
4033 [\verb+\cs+]は\pTeX における対応物を示す.
4034 また,それぞれのパラメータの右上にある記号には次の意味がある:
4035 %</ja>
4036 \begin{itemize}
4037 %<*zh>
4038 \item % avoiding from error ``Something's wrong--perhaps a missing \item.''.
4039 %</zh>
4040 %<*en>
4041 \item No mark: values at the end of the paragraph or the hbox are
4042       adopted in the whole paragraph/hbox.
4043 %</en>
4044 %<*ja>
4045 \item 記号なし:段落や水平ボックスの終端での値がその段落/水平ボックス全体で用いられる.
4046 %</ja>
4047 %<*en>
4048 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
4049 %</en>
4050 %<*ja>
4051 \item `\ast':ローカルなパラメータであり,段落/水平ボックス内のどこででも値を変えることができる.
4052 %</ja>
4053 %<*en>
4054 \item `\dagger': assignments are always global.
4055 %</en>
4056 %<*ja>
4057 \item `\dagger':指定は常にグローバルになる.
4058 %</ja>
4059 \end{itemize}
4060
4061 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4062 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
4063 %<*en>
4064 Penalty value for suppressing orphans. This penalty is inserted just
4065              after the last \textbf{JAchar} which is not regarded as a
4066              (Japanese) punctuation mark.
4067 %</en>
4068 %<*ja>
4069 パラグラフの最後の字が孤立して改行されるのを防ぐためのペナルティの値.
4070 このペナルティは(日本語の)句読点として扱われない最後の\textbf{JAchar}の直後に
4071 挿入される.
4072 %</ja>
4073
4074 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
4075 %<*en>
4076 An additional attributes which each character whose character code is <chr\_code> has.
4077 At the present version, the lowermost bit of <natural number> indicates
4078              whether the character is considered as a punctuation mark
4079              (see the description of \Param{jcharwidowpenalty} above).
4080 %</en>
4081 %<*ja>
4082 文字コードが<chr\_code>の文字が持つ付加的な属性値(attribute).
4083 現在のバージョンでは,<natural number>の最下位ビットが,その文字が句読点と
4084 みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照).
4085 %</ja>
4086
4087 \item[\Param{\hypertarget{fld:prebp}{prebreakpenalty}}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
4088 %<*ja>
4089 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
4090              この文字の前に挿入/追加されるペナルティの量を指定する.
4091
4092 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,
4093 \begin{verbatim}
4094 \ltjsetparameter{prebreakpenalty={`〙,10000}}
4095 \end{verbatim}
4096 と,最大値の10000が標準で指定されている.他にも,小書きのカナなど,絶対禁止とい
4097              うわけではないができれば行頭にはきて欲しくない場合に,0と
4098              10000の間の値を指定するのも有用であろう.
4099 %</ja>
4100
4101 \item[\Param{\hypertarget{fld:postbp}{postbreakpenalty}}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
4102 %<*ja>
4103 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
4104              この文字の後に挿入/追加されるペナルティの量を指定する.
4105
4106 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
4107 \begin{itemize}
4108 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
4109       た(後から指定した方で上書きされる).
4110 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
4111 \end{itemize}
4112 という制限があったが,\LuaTeX-jaではこれらの制限は解消されている.
4113 %</ja>
4114
4115 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}]
4116 %<en>[\verb+\textfont+ in \TeX]
4117 %<ja>[\TeX の \verb+\textfont+]
4118 %<zh>[\TeX 的\verb+\textfont+]
4119 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}]
4120 %<en>[\verb+\scriptfont+ in \TeX]
4121 %<ja>[\TeX の \verb+\scriptfont+]
4122 %<zh>[\TeX 中的\verb+\scriptfont+]
4123 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}]
4124 %<en>[\verb+\scriptscriptfont+ in \TeX]
4125 %<ja>[\TeX の \verb+\scriptscriptfont+]
4126 %<zh>[\TeX 中的\verb+\scriptscriptfont+]
4127 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
4128 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
4129
4130 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
4131
4132 %<*en>
4133 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
4134 The followings are allowed for <mode>:
4135 %</en>
4136 %<*ja>
4137 文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
4138 挿入を許すかどうかの設定.
4139 以下の<mode>が許される:
4140 %</ja>
4141 \begin{description}
4142 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
4143 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
4144 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{\hyperlink{fld:xks}{xkanjiskip}}均被禁止。
4145 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
4146 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
4147 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但其后不允许插入。
4148 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
4149 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
4150 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但之前不允许插入。
4151 %<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.
4152 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
4153 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{\hyperlink{fld:xks}{xkanjiskip}}。此为默认值。
4154 \end{description}
4155 %<*en>
4156 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
4157 %</en>
4158 %<*ja>
4159 このパラメータは\pTeX の \verb+\inhibitxspcode+ プリミティブと似ているが,
4160 互換性はない.
4161 %</ja>
4162 %<*zh>
4163 此参数类似\pTeX 基本语句\verb!\inhibitxspcode!,但是和\verb!\inhibitxspcode!不兼容。
4164 %</zh>
4165 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
4166
4167 %<*en>
4168 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a
4169              \textbf{ALchar} whose character code is <chr\_code>.
4170              The followings are allowed for <mode>:
4171 %</en>
4172 %<*ja>
4173 文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
4174 挿入を許すかどうかの設定.
4175 以下の<mode>が許される:
4176 %</ja>
4177 \begin{description}
4178 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
4179 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
4180 %<zh>\item[0, \texttt{inhibit}] 插入文字前/后的\Param{\hyperlink{fld:xks}{xkanjiskip}}均被禁止。
4181 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
4182 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
4183 %<zh>\item[1, \texttt{preonly}] 文字前允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但其后不允许插入。
4184 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
4185 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
4186 %<zh>\item[2, \texttt{postonly}] 文字后允许插入\Param{\hyperlink{fld:xks}{xkanjiskip}},但之前不允许插入。
4187 %<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.
4188 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
4189 %<zh>\item[3, \texttt{allow}] 文字前后均可插入\Param{\hyperlink{fld:xks}{xkanjiskip}}。此为默认值。
4190 \end{description}
4191 %<*en>
4192 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
4193 %</en>
4194 %<*ja>
4195 \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため,
4196 これら2つのパラメータは互いの異名となっていることに注意する.
4197 %</ja>
4198 %<*zh>
4199 注意参数\Param{jaxspmode}和\Param{alxspmode}公用一个表,故这两个参数互为同义语。
4200 %</zh>
4201
4202 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
4203 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
4204 \item[\Param{\hypertarget{fld:kanjiskip}{kanjiskip}}\,=<skip>] [\verb+\kanjiskip+]
4205 %<*ja>
4206 デフォルトで2つの\textbf{JAchar}の間に挿入されるグルーである.
4207 通常では,\pTeX と同じようにフォントサイズに比例して変わることはない.
4208 しかし,自然長が \verb+\maxdimen+ の場合は,例外的に和文フォントのJFM側で指定されている
4209 値を採用(こちらはフォントサイズに比例)することになっている.
4210 %</ja>
4211
4212 \item[\Param{\hypertarget{fld:xks}{xkanjiskip}}\,=<skip>] [\verb+\xkanjiskip+]
4213 %<*ja>
4214 デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルーである.
4215 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と同じように,通常ではフォントサイズに比例して変わることはないが,
4216 自然長が \verb+\maxdimen+ の場合が例外である.
4217 %</ja>
4218
4219
4220 \item[\Param{\hypertarget{fld:diffjfm}{differentjfm}}\,=<mode>$^\dagger$]
4221
4222 %<*en>
4223 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
4224 The allowed arguments are the followings:
4225 %</en>
4226 %<*ja>
4227 JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグルー/カーンをどのように
4228 入れるかを指定する.
4229 許される値は以下の通り:
4230 %</ja>
4231 %<*zh>
4232 对于处理不同大小或者JFM的两种\textbf{JAchar}之间的胶/出格。
4233 有下列参数:
4234 %</zh>
4235 \begin{description}
4236 \item[\texttt{average}]
4237 \item[\texttt{both}]
4238 \item[\texttt{large}]
4239 \item[\texttt{small}]
4240 \item[\texttt{pleft}]
4241 \item[\texttt{pright}]
4242 \item[\texttt{paverage}]
4243 \end{description}
4244
4245 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
4246 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
4247 \end{list}
4248
4249
4250 %<en>\section{Other Control Sequences}
4251 %<ja>\section{その他の命令}
4252 %<zh>\section{其他基本语句}
4253 %<en>\subsection{Control Sequences for Compatibility}
4254 %<ja>\subsection{\pTeX 互換用命令}
4255 %<zh>\subsection{基本语句兼容性}
4256
4257 %<*en>
4258 The following control sequences are implemented for compatibility with \pTeX.
4259 Note that these don't support JIS~X~0213, but only JIS~X~0208.
4260 %</en>
4261 %<*ja>
4262 以下の命令は\pTeX との互換性のために実装されている.そのため,JIS~X~0213には対応せず,
4263 \pTeX と同じようにJIS~X~0208の範囲しかサポートしていない.
4264 %</ja>
4265 %<*zh>
4266 下列基本语句的实现与\pTeX 兼容:
4267 %</zh>
4268 \begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw}
4269 \item[kuten]
4270 \item[jis]
4271 \item[euc]
4272 \item[sjis]
4273 \item[ucs]
4274 \item[kansuji]
4275 \end{list}
4276
4277 %<en>\subsection{\texttt{\char92 inhibitglue}}
4278 %<ja>\subsection{\texttt{\char92 inhibitglue}}
4279 %<zh>\subsection{\texttt{\char92 inhibitglue}基本语句}
4280 %<*en>
4281 \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
4282 The following is an example, using a special JFM that there will be a glue between
4283 the beginning of a box and `あ', and also between `あ' and `ウ'.
4284 %</en>
4285 %<*ja>
4286 \verb+\inhibitglue+ は\textbf{JAglue}の挿入を抑制する.
4287 以下は,ボックスの始めと`あ'の間,`あ'と`ウ'の間にグルーが入る特別なJFMを用いた例で
4288 ある.
4289 %</ja>
4290 %<*zh>
4291 基本语句\verb!\inhibitglue!会压缩\textbf{JAchar}的插入。
4292 下面的例子使用了特殊的JFM。在一个盒子和“あ”之间,以及“あ”和“ウ”之间存在胶。
4293 %</zh>
4294
4295 \begin{LTXexample}
4296 \jfont\g=name:IPAMincho:jfm=test \g
4297 \fbox{\hbox{あウあ\inhibitglue ウ}}
4298 \inhibitglue\par\noindent あ1
4299 \par\inhibitglue\noindent あ2
4300 \par\noindent\inhibitglue あ3
4301 \par\hrule\noindent あoff\inhibitglue ice
4302 \end{LTXexample}
4303
4304 %<*en>
4305 With the help of this example, we remark the specification of \verb+\inhibitglue+:
4306 %</en>
4307 %<*ja>
4308 この例を援用して,\verb+\inhibitglue+ の仕様について述べる.
4309 %</ja>
4310 %<*zh>
4311 如上例子,我们注意到\verb!\inhibtglue!的用法。
4312 %</zh>
4313 \begin{itemize}
4314 %<*zh>
4315 \item
4316 %</zh>
4317 %<*en>
4318 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
4319       simply ignored.
4320 %</en>
4321 %<*ja>
4322 \item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
4323 4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
4324 \verb+\noindent+ の時点で水平モードになるからである.
4325 %</ja>
4326
4327 %<*en>
4328 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
4329       mode is only effective on the spot; does not get over boundary of
4330       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
4331       kernings, as shown in the last line of above example.
4332 %</en>
4333 %<*ja>
4334 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
4335   有効であり,段落の境界を乗り越えない.
4336   さらに,\verb+\inhibitglue+ は上の例の最終行のように(欧文における)リガチャとカーニングを
4337   打ち消す.これは,\verb+\inhibitglue+ が内部的には「現在のリスト中にwhatsitノードを
4338   追加する」ことを行なっているからである.
4339 %</ja>
4340
4341 %<*en>
4342 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
4343 %</en>
4344 %<*ja>
4345 \item \verb+\inhibitglue+ を数式モード中で呼び出した場合はただ無視される.
4346 %</ja>
4347 \end{itemize}
4348
4349 %<en>\section{Control Sequences for \LaTeXe}
4350 %<ja>\section{\LaTeXe 用の命令}
4351 %<zh>\section{\LaTeXe 下使用的控制序列}
4352
4353 %<en>\subsection{Patch for NFSS2}
4354 %<ja>\subsection{NFSS2へのパッチ}
4355 %<zh>\subsection{NFSS2补丁}
4356 \label{ssub-nfsspat}
4357
4358 %<*en>
4359 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
4360 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
4361 For an convenience, we will describe
4362 control sequences which are not described in Subsection~\ref{ssub-chgfnt}.
4363 %</en>
4364 %<*ja>
4365 \ref{ssec-ltx}節で述べたように,\LuaTeX-jaはNFSS2への日本語パッチである
4366 \pLaTeXe の\texttt{plfonts.dtx}を単純に取り入れている.
4367 便宜のため,ここでは\ref{ssub-chgfnt}節で述べていなかった命令について
4368 記述しておく.
4369 %</ja>
4370
4371 \begin{cslist}%
4372 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
4373
4374 %<*en>
4375 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
4376              and Japanese font families are only made by their
4377              encodings. For example, encodings OT1 and T1 are for
4378              alphabetic font families, and a Japanese font family cannot
4379              have these encodings. This command defines a new encoding
4380              scheme for Japanese font family (in horizontal direction).
4381 %</en>
4382 %<*ja>
4383 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
4384 そのエンコーディングからのみ作られる.
4385 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
4386 和文フォントファミリはこれらのエンコーディングを持つことはできない.
4387 このコマンドは和文フォントファミリ(横書き用)のための新しいエンコーディングを
4388 定義する.
4389 %</ja>
4390
4391 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
4392 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
4393 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
4394
4395 %<*en>
4396 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
4397 %</en>
4398 %<*ja>
4399 上記3つのコマンドはちょうど \verb+DeclareFontEncodingDefaults+ などに対応するものである.
4400 %</ja>
4401
4402 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
4403
4404 % ToDo: en
4405 %<*ja>
4406 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
4407 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\verb+\mathrm+ 等)と,和文数式用フォ
4408              ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+ 等)の2つを同時に行う命令として
4409              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
4410              <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
4411              更させるようにするのが一般的と思われる.
4412
4413 {\let\item=\origitem
4414 本命令は
4415 \begin{center}\tt
4416 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
4417 (<al-cmd>を1段展開したもの)\{<ja-cmd>を1段展開したもの)\{<arg>\}\}
4418 \end{center}
4419 と定義を行うので,使用には注意が必要である:
4420 \begin{itemize}
4421 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に
4422 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
4423 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと\texttt{@}をつけた命令を指定した時の動作は保証できない.
4424 \end{itemize}}
4425 %</ja>
4426
4427 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
4428   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
4429 %<*en>
4430 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
4431 with respect to a Japanese font family given by the former 4~arguments.
4432 %</en>
4433 %<*ja>
4434 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
4435 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
4436 %</ja>
4437 \item[SetRelationFont]
4438 %<*en>
4439 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
4440 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
4441 %</en>
4442 %<*ja>
4443 このコマンドは \verb+\DeclareRelationFont+ とローカルな指定であることを除いて
4444 ほとんど同じである(\verb+\DeclareRelationFont+ はグローバル).
4445 %</ja>
4446
4447 \item[userelfont]
4448 %<*en>
4449 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
4450              font family with respect to current Japanese font family,
4451              which was set by
4452              \verb+\DeclareRelationFont+ or \verb+\SetRelationFont+.
4453 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
4454 %</en>
4455 %<*ja>
4456 現在の欧文フォントエンコーディング/ファミリ/…… を,
4457 \verb+\DeclareRelationFont+ か \verb+\SetRelationFont+ で指定された
4458 現在の和文フォントファミリに対応する「従属欧文」フォントファミリに変更する.
4459 \verb+\fontfamily+ のように,有効にするためには \verb+\selectfont+ が必要である.
4460 %</ja>
4461
4462 \item[adjustbaseline]
4463 \ldots
4464
4465 \item[fontfamily\{<family>\}]
4466 {\let\item\origitem
4467 %<*en>
4468 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
4469 to <family>. Which family will be changed is determined as follows:
4470 %</en>
4471 %<*ja>
4472 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
4473 和文,\textbf{もしくは両方})を<family>に変更する.
4474 どのファミリが変更されるかは以下のようにして決定される:
4475 %</ja>
4476 \begin{itemize}
4477 %<*zh>
4478 \item
4479 %</zh>
4480 %<*en>
4481 \item Let current encoding scheme for Japanese fonts be
4482       <ja-enc>. Current Japanese font family will be changed to
4483       <family>, if one of the following two conditions is met:
4484 %</en>
4485 %<*ja>
4486 \item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
4487   現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
4488   <family>に変更される:
4489 %</ja>
4490 \begin{itemize}
4491 %<*en>
4492 \item The family <family> under the encoding <ja-enc> has been already defined by
4493       \verb+\DeclareKanijFamily+.
4494 %</en>
4495 %<*ja>
4496 \item エンコーディング<ja-enc>におけるファミリ<family>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
4497 %</ja>
4498 %<*en>
4499 \item A font definition named \texttt{<ja-enc><family>.fd} (the file name is
4500       all lowercase) exists.
4501 %</en>
4502 %<*zh>
4503 \item
4504 %</zh>
4505 %<*ja>
4506 \item フォント定義ファイル\texttt{<ja-enc><family>.fd}(ファイル名は全て小文字)が存在する.
4507 %</ja>
4508 \end{itemize}
4509 %<*en>
4510 \item Let current encoding scheme for alphabetic fonts be
4511       <al-enc>. For alphabetic font family, the criterion as above is used.
4512 %</en>
4513 %<*ja>
4514 \item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
4515   欧文フォントファミリに対しても,上記の基準が用いられる.
4516 %</ja>
4517 %<*en>
4518 \item There is a case which none of the above applies, that is, the font
4519       family named <family> doesn't seem to be defined neither under the
4520       encoding <ja-enc>, nor under <al-enc>.
4521 In this case, the default family for font substitution is used for
4522       alphabetic and Japanese fonts. Note that current encoding will not
4523       be set to <family>, unlike the original implementation in \LaTeX.
4524 %</en>
4525 %<*ja>
4526 \item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
4527   どちらでも定義されないような場合がある.
4528   この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
4529   和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
4530   現在のエンコーディングは<family>には設定されないことに注意する.
4531 %</ja>
4532 \end{itemize}
4533 }
4534 \end{cslist}
4535
4536 %<*en>
4537 As closing this subsection, we shall introduce an example of
4538 \verb+\SetRelationFont+ and \verb+\userelfont+:
4539 %</en>
4540 %<*ja>
4541 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
4542 紹介しておこう.\verb+\userelfont+ の使用によって,「abc」の部分のフォントが
4543 Avant Garde (OT1/pag/m/n) に変わっていることがわかる.
4544 %</ja>
4545 \begin{LTXexample}
4546 \kanjifamily{gt}\selectfont あいうxyz
4547 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
4548 \userelfont\selectfont あいうabc
4549 \end{LTXexample}
4550
4551 %<en>\section{Extensions}
4552 %<ja>\section{拡張}
4553 \subsection{\texttt{luatexja-fontspec.sty}}
4554
4555 %<*en>
4556 As described in Subsection~\ref{ssec-fontspec}, this optional package
4557 provides the counterparts for several commands defined in the
4558 \Pkg{fontspec} package.
4559 In addition to `font features' in the original \Pkg{fontspec},
4560 the following `font features' specifications are allowed for
4561 the commands of Japanese version:
4562 %</en>
4563 %<*ja>
4564 \ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}
4565 パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
4566 オリジナルの\Pkg{fontspec}での`font feature'に加えて,和文版のコマンドには
4567 以下の`font feature'を指定することができる:
4568 %</ja>
4569
4570
4571 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4572 \item[CID=<name>]
4573 \item[JFM=<name>]
4574 \item[JFM-var=<name>] \
4575
4576 %<*en>
4577 These 3 font features correspond to \texttt{cid}, \texttt{jfm} and
4578 \texttt{jfmvar} keys for \verb+\jfont+ respectively.
4579 \texttt{CID} is effective only when with \texttt{NoEmbed}
4580 described below.
4581 See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details.
4582 %</en>
4583 %<*ja>
4584 これら3つのキーはそれぞれ \verb+\jfont+ に対する
4585 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
4586 \texttt{CID} は下の \texttt{NoEmbed} と合わせて用いられたときのみ有効である.
4587 \verb+\jfont+ プリミティブに対する
4588 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーの詳細は\ref{ssec-jfont}節
4589              と\ref{ssec-psft}節を参照.
4590 %</ja>
4591
4592 \item[NoEmbed]
4593 %<*en>
4594 By specifying this font feature, one can use `name-only' Japanese font which
4595 will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
4596 %</en>
4597 %<*ja>
4598 これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
4599 できる.\ref{ssec-psft}節を参照.
4600 %</ja>
4601 \end{list}
4602
4603 %<*ja>
4604 なお,\texttt{luatexja-fontspec.sty} 読み込み時には和文フォント定義ファイル%
4605 \texttt{<ja-enc><family>.fd}は全く参照されなくなる.
4606 %</ja>
4607
4608
4609
4610 \subsection{\texttt{luatexja-otf.sty}}
4611
4612 %<*en>
4613 This optional package supports typesetting characters in
4614 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
4615 commands:
4616 %</en>
4617 %<*ja>
4618 この追加パッケージはAdobe-Japan1の文字の出力をサポートする.
4619 \texttt{luatexja-otf.sty}は以下の2つの低レベルコマンドを提供する:
4620 %</ja>
4621 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4622 \item[\char92CID\{<number>\}]
4623 %<*en>
4624 Typeset a character whose CID number is <number>.
4625 %</en>
4626 %<*ja>
4627 CID番号が<number>の文字を出力する.
4628 %</ja>
4629
4630 \item[\char92UTF\{<hex\_number>\}]
4631 %<*en>
4632 Typeset a character whose character code is <hex\_number> (in hexadecimal).
4633 This command is similar to \verb+\char"+<hex\_number>,\ %"
4634 but please remind remarks below.
4635 %</en>
4636 %<*ja>
4637 文字コードが(16進で)<hex\_number>の文字を出力する.
4638 このコマンドは \verb+\char"+<hex\_number>と似ているが,下の記述に注意すること.%"
4639 %</ja>
4640 \end{list}
4641
4642 %<en>\paragraph{Remarks}
4643 %<ja>\paragraph{注意}
4644 %<*en>
4645 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
4646 ordinary characters in the following points:
4647 %</en>
4648 %<*ja>
4649 \verb+\CID+ と \verb+\UTF+ コマンドによって出力される文字は
4650 以下の点で通常の文字と異なる:
4651 %</ja>
4652 \begin{itemize}
4653 %<*zh>
4654 \item
4655 %</zh>
4656 %<*en>
4657 \item Always treated as \textbf{JAchar}s.
4658 %</en>
4659 %<*ja>
4660 \item 常に\textbf{JAchar}として扱われる.
4661 %</ja>
4662 %<*en>
4663 \item Processing codes for supporting OpenType features (\textit{e.g.},
4664       glyph replacement and kerning) by the \Pkg{luaotfload} package
4665       is not performed to these characters.
4666 %</en>
4667 %<*ja>
4668 \item OpenType feature(例えばグリフ置換やカーニング)をサポートするための
4669   \Pkg{luaotfload}パッケージのコードはこれらの文字には働かない.
4670 %</ja>
4671 \end{itemize}
4672
4673
4674 %<en>\paragraph{Additional Syntax of JFM}
4675 %<ja>\paragraph{JFMへの記法の追加}
4676
4677 %<*en>
4678 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
4679 chars} table in JFM now allows a string in the form
4680 \verb+'AJ1-xxx'+, which stands for the character
4681 whose CID number in Adobe-Japan1 is \verb+xxx+.
4682 %</en>
4683 %<*ja>
4684 \texttt{luatexja-otf.sty}はJFMの記法を拡張する.
4685 JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形の文字列が
4686 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
4687 %</ja>
4688
4689 \subsection{\texttt{luatexja-adjust.sty}}
4690 \label{ssec-adj}
4691 \begin{figure}[t]
4692 \def\sq{%
4693   \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 \def\sb{\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
4697   ■\hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw%
4698   \hskip\dimexpr.5\zw-.2pt\relax}\hss}}
4699 \newbox\gridbox
4700 \def\outbox#1{{\Large%
4701   \ltjsetparameter{kanjiskip=0pt plus .2\zw minus .2\zw}%
4702   \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}%
4703   \hbox{\textcolor{cyan!50!white}{\copy\gridbox}\hskip-20\zw%
4704   \vbox{\hsize=20\zw\noindent\leftskip0pt\rightskip0pt\parfillskip0pt#1}\vrule}%
4705 }}
4706
4707 {\centering
4708 \begin{tabular}{lc}
4709 \toprule
4710 no adjustment&\outbox{以上の原理は,「包除原理」とよく呼ばれるが\hskip-.5\zw\null}\\
4711 without priority&%
4712 \ltjdisableadjust
4713 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}%
4714 \ltjenableadjust\\
4715 with priority&%
4716 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}
4717 %<!ja>\ltjdisableadjust
4718 \\
4719 \bottomrule
4720 \end{tabular}\par}
4721 \smallskip
4722
4723 Note: the value of 
4724 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is 0\,pt${}^{+1/5\,\mathrm{em}}_{-1/5\,\mathrm{em}}$ in this figure,
4725 for making the difference obvious.
4726 %<ja>\caption{行長調整}\label{fig-adj}
4727 %<en>\caption{Line adjustment}\label{fig-adj}
4728 \end{figure}
4729
4730
4731 %<*en>
4732 ...
4733 %</en>
4734 %<*ja>
4735 \pTeX では,行長調整において優先度の概念が存在しなかったため,図
4736 \ref{fig-adj}上段における半角分の半端は,図\ref{fig-adj}中段のように,鍵
4737 括弧周辺の空白と和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})の両方によって負担される.し
4738 かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい
4739 ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文
4740 文字はベタ組で組まれる(図\ref{fig-adj}下段)ことになっている.この追加
4741 パッケージは\cite{jlreq}や\cite{x4051}における規定のような,優先順位付き
4742 の行長調整を提供する.詳細な仕様については\ref{sec-adjspec}を参照.
4743
4744
4745 \texttt{luatexja-adjust.sty}は,以下の命令を提供する.これらはすべてグローバルに効力を発揮する.
4746
4747 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4748 \item[\char92ltjdisableadjust]
4749 優先順位付きの行長調整を無効化する.
4750
4751 \item[\char92ltjenableadjust]
4752 優先順位付きの行長調整を有効化する.
4753
4754 \item[優先度設定……]
4755
4756 \end{list}
4757
4758
4759
4760
4761
4762 %</ja>
4763
4764
4765
4766 %<en>\part{Implementations}
4767 %<ja>\part{実装}
4768 \label{part-imp}
4769 %<en>\section{Storing Parameters}
4770 %<ja>\section{パラメータの保持}
4771 \label{sec-para}
4772 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
4773 %<ja>\subsection{\LuaTeX-jaで用いられる寸法レジスタ,属性レジスタ,whatsitノード}
4774
4775 %<*en>
4776 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
4777 %</en>
4778 %<*ja>
4779 以下は\LuaTeX-jaで用いられる寸法レジスタ(dimension),属性レジスタ(attribute)の
4780 リストである.
4781 %</ja>
4782 \begin{list}{}{%
4783 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
4784 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
4785 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
4786 }
4787
4788 \dim{jQ}
4789 %<*en>
4790 \verb+\jQ+ is equal to
4791                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
4792                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
4793 %</en>
4794 %<*ja>
4795 \verb+\jQ+ は$1\,\textrm{Q}=0.25\,\textrm{mm}$
4796 と等しい.ここで,`Q'(もしくは「級」)は日本の写植で用いられる単位である.したがって,
4797 この寸法レジスタの値を変更してはならない.
4798 %</ja>
4799
4800 \dim{jH}
4801 %<*en>
4802 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
4803                         used in Japanese phototypesetting. This
4804                         \verb+\jH+ is a synonym of \verb+\jQ+.
4805 %</en>
4806 %<*ja>
4807 同じく写植で用いられていた単位として「歯」があり,これも$0.25\,\textrm{mm}$と
4808 等しい.\verb+\jH+ は \verb+\jQ+ の別名である.
4809 %</ja>
4810
4811 \dim{ltj@zw}
4812 %<*en>
4813 A temporal register for the `full-width' of current Japanese font.
4814 %</en>
4815 %<*ja>
4816 現在の和文フォントの「全角幅」を保持する一時レジスタ.
4817 %</ja>
4818
4819 \dim{ltj@zh}
4820 %<*en>
4821 A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
4822 %</en>
4823 %<*ja>
4824 現在の和文フォントの「全角高さ」(通常,高さと深さの和)を保持する一時レジスタ.
4825 %</ja>
4826
4827 \attr{jfam}
4828 %<*en>
4829 Current number of Japanese font family for math formulas.
4830 %</en>
4831 %<*ja>
4832 数式用の和文フォントファミリの現在の番号.
4833 %</ja>
4834
4835 \attr{ltj@curjfnt}
4836 %<*en>
4837 The font index of current Japanese font.
4838 %</en>
4839 %<*ja>
4840 現在の和文フォントのフォント番号.
4841 %</ja>
4842
4843 \attr{ltj@charclass}
4844 %<*en>
4845 The character class of Japanese \textit{glyph\_node}.
4846 %</en>
4847 %<*ja>
4848 和文文字の\textit{glyph\_node}の文字クラス.
4849 %</ja>
4850
4851 \attr{ltj@yablshift}
4852 %<*en>
4853 The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4854 %</en>
4855 %<*ja>
4856 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量.
4857 %</ja>
4858
4859 \attr{ltj@ykblshift}
4860 %<*en>
4861 The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4862 %</en>
4863 %<*ja>
4864 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
4865 %</ja>
4866
4867 \attr{ltj@autospc}
4868 %<*en>
4869 Whether the auto insertion of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is allowed at the node.
4870 %</en>
4871 %<*ja>
4872 そのノードで\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の自動挿入が許されるかどうか.
4873 %</ja>
4874
4875 \attr{ltj@autoxspc}
4876 %<*en>
4877 Whether the auto insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed at the node.
4878 %</en>
4879 %<*ja>
4880 そのノードで\Param{\hyperlink{fld:xks}{xkanjiskip}}の自動挿入が許されるかどうか.
4881 %</ja>
4882
4883 \attr{ltj@icflag}
4884 %<*en>
4885 An attribute for distinguishing `kinds' of a node. One of the following value is
4886 assigned to this attribute:
4887 %</en>
4888 %<*ja>
4889 ノードの「種類」を区別するための属性.以下のうちのひとつが値として割り当てられる:
4890 %</ja>
4891 \begin{description}
4892 \item[\textit{italic} (1)]
4893 %<*en>
4894 Glues from an italic correction
4895            (\verb+\/+). This distinction of origins of glues
4896            (from explicit \verb+\kern+, or from \verb+\/+)
4897            is needed in the insertion process of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4898 %</en>
4899 %<*ja>
4900 イタリック補正(\verb+\/+)によるグルー.このグルーの由来の区別(\verb+\kern+ か
4901 \verb+\/+ か)は\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入過程において必要になる.
4902 %</ja>
4903
4904 \item[\textit{packed} (2)]
4905
4906 \item[\textit{kinsoku} (3)]
4907 %<*en>
4908 Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}).
4909 %</en>
4910 %<*ja>
4911 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
4912 %</ja>
4913
4914 \item[\textit{from\_jfm} (6)]
4915 %<*en>
4916 Glues/kerns from JFM.
4917 %</en>
4918 %<*ja>
4919 JFM由来のグルー/カーン.
4920 %</ja>
4921
4922 %%\item[\textit{line\_end} (5)]
4923 %%%<*en>
4924 %%Kerns for \ldots
4925 %%%</en>
4926 %%%<*ja>
4927 %%和文文字が行末にきたとき,行末との間に挿入されるカーンである.
4928 %%% ぶら下げ組への応用
4929 %%%</ja>
4930
4931 \item[\textit{kanji\_skip} (9)]
4932 %<*en>
4933 Glues for \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}.
4934 %</en>
4935 %<*ja>
4936 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}のグルー.
4937 %</ja>
4938
4939 \item[\textit{xkanji\_skip} (10)]
4940 %<*en>
4941 Glues for \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4942 %</en>
4943 %<*ja>
4944 \Param{\hyperlink{fld:xks}{xkanjiskip}}のグルー.
4945 %</ja>
4946
4947 \item[\textit{processed} (11)]
4948 %<*en>
4949 Nodes which is already processed by \ldots.
4950 %</en>
4951 %<*ja>
4952 \LuaTeX-ja の内部処理によって既に処理されたノード.
4953 %</ja>
4954
4955 \item[\textit{ic\_processed} (12)]
4956 %<*en>
4957 Glues from an italic correction, but also already processed.
4958 %</en>
4959 %<*ja>
4960 イタリック補正に由来するグルーであるが,まだ処理されていないもの.
4961 %</ja>
4962
4963 \item[\textit{boxbdd} (15)]
4964 %<*en>
4965 Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
4966 %</en>
4967 %<*ja>
4968 ある水平ボックスか段落の最初か最後に挿入されたグルー/カーン.
4969 %</ja>
4970 \end{description}
4971
4972 \attr{ltj@kcat$i$}
4973 %<*en>
4974 Where $i$~is a natural number which is less than~7.
4975 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
4976 %</en>
4977 %<*ja>
4978 $i$は7より小さい自然数.
4979 これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
4980 扱われるかを示すビットベクトルを格納する.
4981 %</ja>
4982 \end{list}
4983
4984 %<*en>
4985 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
4986 inrernal processing. All those nodes store a natural number (hence the node's
4987 \texttt{type} is 100). The following \verb+user_id+s are used:
4988 %</en>
4989 %<*ja>
4990 さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
4991 これらの全てのノードは自然数を格納している(したがってノードの\texttt{type}は
4992 100である).次の \verb+user_id+ が使用される:
4993 %</ja>
4994 \begin{description}
4995 \item[30111]
4996 %<*en>
4997 Nodes for indicating that \verb+\inhibitglue+ is
4998            specified. The \texttt{value} field of these nodes doesn't matter.
4999 %</en>
5000 %<*ja>
5001 \verb+\inhibitglue+ が指定されたことを示すノード.これらのノードの
5002 \texttt{value}フィールドは意味を持たない.
5003 %</ja>
5004
5005 \item[30112]
5006 %<*en>
5007 Nodes for \LuaTeX-ja's stack system (see the next
5008            subsection). The \texttt{value} field of these nodes is
5009            current group.
5010 %</en>
5011 %<*ja>
5012 \LuaTeX-jaのスタックシステム(次の節を参照)のためのノード.
5013 これらのノードの\texttt{value}フィールドは現在のグループを表す.
5014 %</ja>
5015
5016 \item[30113]
5017 %<*en>
5018 Nodes for Japanese Characters which the callback process of
5019            \Pkg{luaotfload} won't be applied, and the character code is
5020            stored in the \texttt{value} field. Each node having this
5021            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
5022            the callback process of luaotfload.
5023            This \verb+user_id+ is only used by the \Pkg{luatexja-otf} package.
5024 %</en>
5025 %<*ja>
5026 \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
5027 \texttt{value}フィールドにその文字のコードが格納されている.
5028 この \verb+user_id+ を持つノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
5029 \textbf{後で}`glyph\_node'に変換される.この \verb+user_id+ は %
5030 \Pkg{luatexja-otf} パッケージでのみ使用される.
5031 %</ja>
5032
5033 \item[30114]
5034 Nodes for indicating beginning of a paragraph.
5035 A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
5036 for its label before the actual contents. So \dots
5037 \end{description}
5038 %<*en>
5039 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
5040 %</en>
5041 %<*ja>
5042 これらのwhatsitノードは\textbf{JAglue}の挿入処理の間に取り除かれる.
5043 %</ja>
5044
5045 %<en>\subsection{Stack System of \LuaTeX-ja}
5046 %<ja>\subsection{\LuaTeX-jaのスタックシステム}
5047 \label{ssec-stack}
5048
5049 %<en>\paragraph{Background}
5050 %<ja>\paragraph{背景}
5051 %<*en>
5052 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
5053 are stored in it. To clarify the reason, imagine the parameter
5054 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is stored by a skip, and consider the following
5055 source:
5056 %</en>
5057 %<*ja>
5058 \LuaTeX-jaは独自のスタックシステムを持ち,\LuaTeX-jaのほとんどのパラメータは
5059 これを用いて保持されている.その理由を明らかにするために,
5060 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメータがスキップレジスタで保持されているとし,
5061 以下のコードを考えてみよう:
5062 %</ja>
5063 \begin{LTXexample}
5064 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
5065 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
5066 \box0.ぴよぴよ\par
5067 \end{LTXexample}
5068
5069 %<*en>
5070 As described in Subsection~\ref{ssec-param}, the only effective value of
5071 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} in an hbox is the latest value, so the value of
5072 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} which applied in the entire hbox should be 5\,pt.
5073 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
5074 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
5075 file in the source of \LuaTeX), there are the following codes:
5076 %</en>
5077 %<*ja>
5078 \ref{ssec-param}節で述べたように,ある水平ボックスの中で効力を持つ
5079 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値は最後に現れた値のみであり,したがってボックス全体に適用される
5080 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は5\,ptであるべきである.しかし,\LuaTeX の実装のために,
5081 この`5\,pt'はどのコールバックからも知ることはできない.
5082 \texttt{tex/packaging.w}(これは\LuaTeX のソースファイルである)の中に,
5083 以下のコードがある:
5084 %</ja>
5085 \begin{lstlisting}
5086 void package(int c)
5087 {
5088     scaled h;                   /* height of box */
5089     halfword p;                 /* first node in a box */
5090     scaled d;                   /* max depth */
5091     int grp;
5092     grp = cur_group;
5093     d = box_max_depth;
5094     unsave();
5095     save_ptr -= 4;
5096     if (cur_list.mode_field == -hmode) {
5097         cur_box = filtered_hpack(cur_list.head_field,
5098                                  cur_list.tail_field, saved_value(1),
5099                                  saved_level(1), grp, saved_level(2));
5100         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
5101 \end{lstlisting}
5102 %<*en>
5103 Notice that \verb+unsave+ is executed \emph{before}
5104 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
5105 executed): so `5\,pt' in the above source is orphaned at
5106 \verb+unsave+, and hence it can't be accessed from \verb+hpack_filter+
5107 callback.
5108 %</en>
5109 %<*ja>
5110 \verb+unsave+ が \verb+filtered_hpack+(これは \verb+hpack_filter+ コールバックが
5111 実行されるところである)の\textbf{前に}実行されていることに注意する.
5112 したがって,上記ソース中で`5\,pt'は \verb+unsave+ のところで捨てられ,
5113 \verb+hpack_filter+ からはアクセスすることができない.
5114 %</ja>
5115
5116 %<en>\paragraph{The method}
5117 %<ja>\paragraph{解決法}
5118 %<zh>\paragraph{解决方法}
5119
5120 %<*en>
5121 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
5122 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
5123 %</en>
5124 %<*ja>
5125 スタックシステムのコードはDev-luatexメーリングリストのある投稿\footnote{\texttt{[Dev-luatex] tex.currentgrouplevel}: Jonathan Sauerによる2008/8/19の投稿.}を
5126 ベースにしている.
5127 %</ja>
5128
5129 %<*en>
5130 These are two \TeX\ count registers for maintaining information:
5131 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
5132 the \TeX's group level when the last assignment was done.  Parameters
5133 are stored in one big table named \texttt{charprop\_stack\_table}, where
5134 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
5135 a new stack level is created by \verb+\ltjsetparameter+, all data of the
5136 previous level is copied.
5137 %</en>
5138 %<*ja>
5139 情報を保持するために,2つの\TeX の整数レジスタを用いている:
5140 \verb+\ltj@@stack+ でスタックレベル,\verb+\ltj@@group@level+ で最後の代入が
5141 なされた時点での\TeX のグループレベルを保持している.
5142 パラメータは\texttt{charprop\_stack\_table}という名前のひとつの大きなテーブルに
5143 格納される.ここで,\texttt{charprop\_stack\_table[$i$]}はスタックレベル$i$の
5144 データを格納している.もし新しいスタックレベルが \verb+\ltjsetparameter+ によって
5145 生成されたら,前のレベルの全てのデータがコピーされる.
5146 %</ja>
5147
5148 %<*en>
5149 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
5150 another thing: When a new stack level is about to be created, a whatsit
5151 node whose type, subtype and value are 44~(\textit{user\_defined}),
5152 30112, and current group level respectively is appended to the current
5153 list (we refer this node by \textit{stack\_flag}). This enables us to
5154 know whether assignment is done just inside a hbox. Suppose that the
5155 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
5156 group, then:
5157 %</en>
5158 %<*ja>
5159 上の「背景」で述べた問題を解決するために,\LuaTeX-jaではもう一つの手法を導入する:
5160 新しいスタックレベルが生成されようとするとき,type, subtype, valueがそれぞれ
5161 44~(\textit{user\_defined}), 30112,そして現在のグループレベルであるwhatsitノード
5162 を現在のリストに付け加える(このノードを\textit{stack\_flag}とする).
5163 これにより,ある水平ボックスの中で代入がなされたかどうかを知ることが可能
5164 となる.スタックレベルを$s$,その水平ボックスグループの直後の\TeX のグループレベルを
5165 $t$とすると:
5166 %</ja>
5167 \begin{itemize}
5168 %<*zh>
5169 \item
5170 %</zh>
5171 %<*en>
5172 \item If there is no \textit{stack\_flag} node in the list of the hbox, then
5173       no assignment was occurred inside the hbox. Hence values of
5174       parameters at the end of the hbox are stored in the stack
5175       level~$s$.
5176 %</en>
5177 %<*ja>
5178 \item もしその水平ボックスのリストの中に\textit{stack\_flag}ノードがなければ,
5179   水平ボックスの中では代入は起こらなかったということになる.
5180   したがって,その水平ボックスの終わりにおけるパラメータの値はスタックレベル$s$に
5181   格納されている.
5182 %</ja>
5183
5184 %<*en>
5185 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
5186       an assignment was occurred just inside the hbox group. Hence
5187       values of parameters at the end of the hbox are stored in the
5188       stack level~$s+1$.
5189 %</en>
5190 %<*ja>
5191 \item もし値が$t+1$の\textit{stack\_flag}ノードがあれば,その
5192   水平ボックスグループの中で代入が起こったことになる.
5193   したがって,水平ボックスの終わりにおけるパラメータの値はスタックレベル$s+1$に
5194   格納されている.
5195 %</ja>
5196
5197 %<*en>
5198 \item If there are \textit{stack\_flag} nodes but all of their values
5199       are more than~$t+1$, then an assignment was occurred in the box,
5200       but it is done is `more internal' group. Hence values of
5201       parameters at the end of the hbox are stored in the stack
5202       level~$s$.
5203 %</en>
5204 %<*ja>
5205 \item もし\textit{stack\_flag}ノードがあるがそれらの値が全て$t+1$より大きい
5206   場合,そのボックスの中で代入が起こったが,それは「より内部の」グループで
5207   起こったということになる.したがって,水平ボックスの終わりでのパラメータの
5208   値はスタックレベル$s$に格納されている.
5209 %</ja>
5210 \end{itemize}
5211
5212 %<*en>
5213 Note that to work this trick correctly, assignments to
5214 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
5215 regardless the value of \verb+\globaldefs+.
5216 This problem is resolved by using
5217 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
5218 %</en>
5219 %<*ja>
5220 このトリックを正しく働かせるためには,\verb+\ltj@@stack+ と \verb+\ltj@@group@level+ への
5221 代入は \verb+\globaldefs+ の値によらず常にローカルでなければならないことに注意する.
5222 この問題は \hbox{\verb+\directlua{tex.globaldefs=0}+}(この代入は常にローカル)を
5223 用いることで解決している.
5224 %</ja>
5225
5226 %<en>\section{Linebreak after Japanese Character}
5227 %<ja>\section{和文文字直後の改行}
5228 %<zh>\section{日文字符后断行}
5229 \label{sec-lbreak}
5230 %<en>\subsection{Reference: Behavior in \pTeX}
5231 %<ja>\subsection{参考:\pTeX の動作}
5232 %<zh>\subsection{参考: \pTeX 行为}
5233 %<*en>
5234 In~\pTeX, a line break after a Japanese character doesn't emit a space,
5235 since words are not separated by spaces in Japanese writings. However,
5236 this feature isn't fully implemented in \LuaTeX-ja due to the
5237 specification of callbacks in~\LuaTeX. To clarify the difference between
5238 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
5239 this subsection.
5240
5241 \pTeX's input processor can be described in terms of a finite state
5242 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
5243 internal states are as follows:
5244 \begin{itemize}
5245 \item State~$N$: new line
5246 \item State~$S$: skipping spaces
5247 \item State~$M$: middle of line
5248 \item State~$K$: after a Japanese character
5249 \end{itemize}
5250 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
5251 processor.  State~$K$ is similar to state~$M$, and is entered after
5252 Japanese characters.  The diagram of state transitions are indicated in
5253 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
5254 after `beginning/ending of a group' characters.
5255 %</en>
5256
5257 %<*ja>
5258 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
5259 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
5260 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
5261
5262 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
5263 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
5264 以下に述べるような4状態を持っている.
5265
5266 \begin{itemize}
5267 \item State~$N$: 行の開始.
5268 \item State~$S$: 空白読み飛ばし.
5269 \item State~$M$: 行中.
5270 \item State~$K$: 行中(和文文字の後).
5271 \end{itemize}
5272 また,状態遷移は,図\ref{fig-ptexipro}のようになっており,図中の数字は
5273 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
5274 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
5275 じものになる.
5276
5277 この図から分かることは,
5278 \begin{quote}
5279 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
5280 \end{quote}
5281 ということである.
5282 %</ja>
5283
5284 \begin{figure}[!tb]
5285 \let\sp\textvisiblespace\small
5286 \begin{minipage}{.6\textwidth}%
5287 \begin{center}
5288 \unitlength=6.5mm\sf\mathversion{bold}
5289 \begin{tikzpicture}[
5290   ->, auto, shorten >=1pt
5291 ]
5292 \node [shape=rectangle, font=\scriptsize] (init) at (2,7) {start};
5293 \node [shape=circle,draw, fill=blue!20] (newline) at (4,7) {$N$};
5294 \node [shape=circle,draw, fill=blue!20] (midline) at (4,4) {$M$};
5295 \node [shape=circle,draw, fill=blue!20] (skipspc) at (8,7) {$S$};
5296 \node [shape=circle,draw, fill=red!20]  (kanji) at (8,4) {$K$};
5297 \node [shape=rectangle,draw, fill=green!20] (scanacs) at (6,8) {scan a c.s.};
5298 \node (endk) at (8,2.5) {} ;
5299 \node (endm) at (4,2.5) {} ;
5300 \node (ends) at (8,8.5) {} ;
5301 \node (endn) at (4,8.5) {} ;
5302 \begin{scope}[font=\scriptsize]
5303 \path (newline) edge [bend right]    node [left]{G, O} (midline)
5304       (init)    edge                 node {} (newline)
5305       (midline) edge [bend right=10] node {10} (skipspc)
5306       (skipspc) edge [bend right]    node [left,right=10,above=7]{G, O} (midline)
5307       (skipspc) edge [loop right]    node {10} (skipspc)
5308       (newline) edge [loop right]    node {10} (newline)
5309       (scanacs) edge [bend left]     node [left=3,below]{$(*)$} (skipspc)
5310       (scanacs) edge [bend right]    node [right=30,above=20]{$(*)$} (midline)
5311       (midline) edge                 node {5\ [\sp]} (endm)
5312       (midline) edge [loop left]     node {G, O} (midline)
5313       (skipspc) edge                 node [right] {5} (ends)
5314       (newline) edge                 node {5 [{\tt\char92par}]} (endn);
5315 \begin{scope}[red]
5316 \path (newline) edge [bend right]    node [right=25,below=3]{J} (kanji)
5317       (midline) edge                 node [below]{J} (kanji)
5318       (kanji)   edge [bend left]     node {O} (midline)
5319       (kanji)   edge                 node {10} (skipspc)
5320       (kanji)   edge [loop right]    node {G, J} (kanji)
5321       (skipspc) edge [bend left]     node {J} (kanji)
5322       (kanji)   edge                 node {5} (endk)
5323 ;
5324 \end{scope}
5325 \end{scope}
5326 \end{tikzpicture}
5327 \end{center}
5328 \end{minipage}%
5329 \begin{minipage}{.4\textwidth}
5330 \begin{description}
5331 \item[\textsf{G}] Beginning of group (usually \verb+{+)\\
5332  and ending of group (usually \verb+}+).
5333 \item[\textsf{J}] Japanese characters.
5334 \item[\textsf{5}] \textit{end-of-line} (usually \verb+^^J+).
5335 \item[\textsf{10}] space (usually \sp).
5336 \item[\textsf{O}] other characters, whose category code is in $\{3,4,6,7,8,11,12,13\}$.
5337 \item[\textsf{[\sp]}, \textsf{[{\tt\char92par}]}]
5338 emits a space, or~\verb+\par+.
5339 \end{description}
5340 \end{minipage}
5341 \begin{itemize}
5342 \item We omitted about category codes
5343 9~(\textit{ignored}), 14~(\textit{comment})~and~15~(\textit{invalid})
5344 from the above diagram. We also ignored the input like `\verb+^^A+' or `\verb+^+\verb+^df+'.
5345 \item When a character whose category code is 0 (\textit{escape character}) is seen by \TeX,
5346 the input processor scans a control sequence (\textsf{scan a c.s.}).
5347 These paths are not shown in the above diagram.
5348
5349 After that, the state is changed to State~$S$ (skipping blanks) in most cases, but
5350 to State~$M$ (middle of line) sometimes.
5351 \end{itemize}
5352 %<en>\caption{State transitions of \pTeX's input processor.}
5353 %<ja>\caption{\pTeX の入力処理部の状態遷移.}
5354 \label{fig-ptexipro}
5355 \end{figure}
5356
5357
5358 %<en>\subsection{Behavior in \LuaTeX-ja}
5359 %<ja>\subsection{\LuaTeX-jaの動作}
5360 %<zh>\subsection{\LuaTeX-ja行为}
5361 %<*en>
5362 States in the input processor of \LuaTeX\ is the same as that of \TeX,
5363 and they can't be customized by any callbacks. Hence, we can only use
5364 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
5365 suppress a space by a line break which is after Japanese characters.
5366
5367 However, \verb+token_filter+ callback cannot be used either, since a
5368 character in category code 5~(end-of-line) is converted into an space
5369 token \emph{in the input processor}.  So we can use only the
5370 \verb+process_input_buffer+ callback.  This means that suppressing a
5371 space must be done \emph{just before} an input line is read.
5372
5373 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
5374 \begin{quote}
5375 A character U+FFFFF (its category code is set to 14~(comment) by
5376 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
5377 process it}, if and only if the following three conditions are satisfied:
5378 \begin{enumerate}
5379 \item The category code of \verb+\endlinechar+%
5380 \footnote{Usually, it is $\langle${return}$\rangle$
5381       (whose character code is 13).} is 5~(end-of-line).
5382 \item The category code of U+FFFFF itself is 14~(comment).
5383 \item The input line matches the following `regular expression':
5384 \[
5385   (\text{any char})^*(\textbf{JAchar})
5386   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5387 \]
5388 \end{enumerate}
5389 \end{quote}
5390
5391 \paragraph{Remark}
5392 The following example shows the major difference from the behavior of \pTeX:
5393 \begin{LTXexample}
5394 \ltjsetparameter{autoxspacing=false}
5395 \ltjsetparameter{jacharrange={-6}}xあ
5396 y\ltjsetparameter{jacharrange={+6}}zあ
5397 u
5398 \end{LTXexample}
5399 \begin{itemize}
5400 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
5401 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
5402 \item There is no space between `あ' (in the line~3) and `u', since the
5403       line~3 ends with an \textbf{ALchar}
5404 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
5405 \end{itemize}
5406 %</en>
5407
5408 %<*ja>
5409 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,コールバックによりユーザが
5410 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
5411 きそうなコールバックとしては,\verb+process_input_buffer+や
5412 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
5413 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
5414 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
5415 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
5416 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
5417
5418 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
5419 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
5420 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
5421
5422 \begin{quote}
5423 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
5424 以下の3条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
5425 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
5426 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
5427 \begin{enumerate}
5428 \item \verb+\endlinechar+の文字\footnote{普通は,改行文字(文字コード13番)である.}
5429 のカテゴリーコードが5~(end-of-line)である.
5430 \item U+FFFFFのカテゴリーコードが14~(comment)である.
5431 \item 入力行は次の「正規表現」にマッチしている:
5432 \[
5433   (\text{any char})^*(\textbf{JAchar})
5434   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5435 \]
5436 \end{enumerate}
5437 \end{quote}
5438
5439 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
5440 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
5441 しかしながら,完全に同じ挙動が実現できたわけではない.
5442 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
5443 \begin{LTXexample}
5444 \ltjsetparameter{autoxspacing=false}
5445 \ltjsetparameter{jacharrange={-6}}xあ
5446 y\ltjsetparameter{jacharrange={+6}}zあ
5447 u
5448 \end{LTXexample}
5449 もし\pTeX とまったく同じ挙動を示すならば,出力は
5450 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
5451 上のように異なる挙動となっている.
5452 \begin{itemize}
5453 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
5454       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
5455 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
5456       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
5457 \end{itemize}
5458 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
5459 その行はそこで改行するようにした方がいいだろう.
5460 %</ja>
5461
5462
5463 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
5464 %<ja>\section{JFMグルーの挿入,\Param{kanjiskip}と\Param{xkanjiskip}}
5465 %<zh>\section{JFM的胶插入,\Param{kanjiskip}和\Param{xkanjiskip}}
5466 \label{sec-jfmglue}
5467 %<en>\subsection{Overview}
5468 %<ja>\subsection{概要}
5469 %<zh>\subsection{概要}
5470
5471 \LuaTeX-jaにおける \textbf{JAglue} の挿入方法は,\pTeX のそれとは全く異なる.
5472 \pTeX では次のような仕様であった:
5473 \begin{itemize}
5474 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
5475 追加する過程で行われる.
5476 \item \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は,水平ボックスへのパッケージングや行分割前に行われる.
5477 \item \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}はノードとしては挿入されない.パッケージングや行分割の計算時に
5478 「和文文字を表す2つの<char\_node>の間には\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}がある」ものとみなされる.
5479 \end{itemize}
5480 しかし,\LuaTeX-jaでは,水平ボックスへのパッケージングや行分割前に全ての
5481 \textbf{JAglue},即ちJFMグルー・\Param{\hyperlink{fld:xks}{xkanjiskip}}・\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の
5482 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
5483 カーニング処理がノードベースになったことに対応する変更である.
5484
5485 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
5486 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
5487 るノード達(アクセント位置補正用のカーンや,イタリック補正)をまとめたもの
5488 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
5489 には関係しないものがある.
5490
5491
5492 %<en>\subsection{definition of a `cluster'}
5493 %<ja>\subsection{「クラスタ」の定義}
5494 %<zh>\subsection{“cluster”定义}
5495
5496 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
5497 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
5498 \begin{defn}
5499 %<*en>
5500 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
5501 with the \textit{id} of it:
5502 %</en>
5503 %<*ja>
5504 \textbf{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである:
5505 %</ja>
5506 \begin{enumerate}
5507 %<*en>
5508 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
5509       nodes come from a hbox which is already packaged, by unpackaging
5510       (\verb+\unhbox+).
5511       The \textit{id} is \textit{id\_pbox}.
5512 %</en>
5513 %<*ja>
5514 \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト.
5515   これらのノードはある既にパッケージングされた水平ボックスから \verb+\unhbox+ で
5516   アンパックされたものである.
5517   その\textit{id}は\textit{id\_pbox}である.
5518 %</ja>
5519
5520 %<*en>
5521 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
5522       The \textit{id} is \textit{id\_math}.
5523 %</en>
5524 %<*ja>
5525 \item インライン数式でその境界に2つの\textit{math\_node}を含むもの.
5526   その\textit{id}は\textit{id\_math}である.
5527 %</ja>
5528
5529 %<*en>
5530 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
5531 %</en>
5532 %<*ja>
5533 \item \textit{glpyh\_node}~$p$とそれに関係するノード:
5534 %</ja>
5535 \begin{enumerate}
5536 %<*en>
5537 \item A kern for the italic correction of~$p$.
5538 %</en>
5539 %<*ja>
5540 \item $p$のイタリック補正のためのカーン.
5541 %</ja>
5542
5543 %<*en>
5544 \item An accent attached to $p$ by \verb+\accent+.
5545 %</en>
5546 %<*ja>
5547 \item \verb+\accent+ による$p$に付随したアクセント.
5548 %</ja>
5549 \end{enumerate}
5550 \[
5551 \overbrace{%
5552  \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
5553 \left\{\begin{array}{c}
5554 \Node{glyph}{accent}\\\noalign{\medskip}
5555 \Node{hbox}{accent (shifted vert.)}
5556 \end{array}\right\}\longrightarrow
5557 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
5558 \longrightarrow
5559 \Node{glyph}{$p$}\longrightarrow
5560 \overbrace{%
5561 \Node{kern}{italic corr.}}^{\text{(b)}}
5562 \]
5563
5564 %<*en>
5565 The \textit{id} is \textit{id\_jglyph} or
5566 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
5567 represents a Japanese character or not.
5568 %</en>
5569 %<*ja>
5570 \textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって
5571 \textit{id\_jglyph},もしくは\textit{id\_glyph}となる.
5572 %</ja>
5573
5574 %<*en>
5575 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
5576 The \textit{id} is \textit{id\_hlist} if the node is an
5577       hbox which is not shifted vertically, or \textit{id\_box\_like}
5578       otherwise.
5579 %</en>
5580 %<*ja>
5581 \item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\verb+\vrule+),
5582   そして\textit{unset\_node}.
5583   その\textit{id}は垂直に移動していない水平ボックスならば\textit{id\_hlist},
5584   そうでなければ\textit{id\_box\_like}となる.
5585 %</ja>
5586
5587 %<*en>
5588 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
5589 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
5590       and \textit{id\_disc}, respectively.
5591 %</en>
5592 %<*ja>
5593 \item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行.
5594   その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして
5595   \textit{id\_disc}である.
5596 %</ja>
5597 \end{enumerate}
5598 %<*en>
5599 Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster.
5600 %</en>
5601 %<*ja>
5602 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す.
5603 %</ja>
5604 \end{defn}
5605
5606 \paragraph{\textit{id}の意味}
5607 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
5608 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
5609 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
5610 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
5611 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
5612 説明用に準備した概念であって,実際のLuaコード中にそのように書かれているわけではないことに注意.
5613
5614 \begin{description}
5615 \item[\textit{id\_jglyph}] 和文文字.\\
5616 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
5617 \textit{glyph\_node}そのものである.
5618 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
5619 多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた
5620 \textit{glyph\_node}である可能性もある.
5621 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
5622 一方,後者の場合,
5623 \begin{itemize}
5624 \item $\mathit{Np}.\mathit{head}$は,
5625 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
5626 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
5627 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
5628 \end{itemize}
5629 \item[\textit{id\_math}] インライン数式.\\
5630 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
5631 「文字コード$-1$の欧文文字」とおく.
5632 \item[\textit{id\_hlist}] 縦方向にシフトされていない水平ボックス.\\
5633 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
5634 先頭・末尾のノードである.
5635 \begin{itemize}
5636 \item 状況によっては,\TeX ソースで言うと
5637 \begin{verbatim}
5638 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
5639 \end{verbatim}
5640 のように,$p$の内容が別の水平ボックスで開始・終了している可能性も十分あり得る.そのような場合,
5641 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない}水平ボックスの
5642 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
5643 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた水平ボックス,\verb+\lower1pt\hbox{xyz}+に対応するノードである.
5644 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用のカーンが
5645 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
5646 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
5647 と同様に再帰的に構成要素をたどっていく.
5648 \end{itemize}
5649 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
5650 まとめて1つのクラスタとして取り扱うだけである.
5651 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
5652 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
5653 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
5654 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
5655 全く考慮に入れない.
5656 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
5657 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
5658 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
5659 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
5660 \end{description}
5661
5662 \paragraph{クラスタの別の分類}
5663 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
5664 挿入処理では2つの隣り合ったクラスタの間に
5665 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
5666 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
5667 \begin{description}
5668 \item[和文A] リスト中に直接出現している和文文字.
5669 \textit{id}が\textit{id\_jglyph}であるか,\\
5670 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5671
5672 \item[和文B] リスト中の水平ボックスの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
5673 JFMグルーの挿入が行われない(\Param{\hyperlink{fld:xks}{xkanjiskip}},~\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は入り得る)ことである.\\
5674 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5675
5676 \item[欧文] リスト中に直接/水平ボックスの中身として出現している欧文文字.次の3つの場合が該当:
5677 \begin{itemize}
5678 \item \textit{id}が\textit{id\_glyph}である.
5679 \item \textit{id}が\textit{id\_math}である.
5680 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
5681 \end{itemize}
5682 \item[箱] box,またはそれに類似するもの.次の2つが該当:
5683 \begin{itemize}
5684 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
5685 \item \textit{id}が\textit{id\_box\_like}である.
5686 \end{itemize}
5687
5688 \end{description}
5689
5690 \subsection{段落/水平ボックスの先頭や末尾}
5691 \paragraph{先頭部の処理}
5692 まず,段落/水平ボックスの一番最初にあるクラスタ\textit{Np}を探索する.
5693 水平ボックスの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
5694 \begin{center}
5695 \verb+\parindent+由来の水平ボックス ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない
5696 ようなwhatsit.
5697 \end{center}
5698 これは,\verb+\parindent+由来の水平ボックスがクラスタを構成しないようにするためである.
5699
5700 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
5701 \begin{enumerate}
5702 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
5703 \item 問題のリストが字下げありの段落(\verb+\parindent+由来の水平ボックスあり)の場合は,
5704 この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
5705 \item そうでないとき(\verb+noindent+で開始された段落や水平ボックス)は,
5706 $g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るグルー/カーンである.
5707 \end{enumerate}
5708 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
5709 そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する:
5710 \begin{itemize}
5711 \item 問題にしているリストが段落であり,かつ
5712 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
5713 \end{itemize}
5714
5715 \paragraph{末尾の処理}
5716 末尾の処理は,問題のリストが段落のものか水平ボックスのものかによって異なる.
5717 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るグルー/カーンを,
5718 \textit{Nq}の直後に挿入するのみである.
5719
5720 一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と,
5721 \verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は
5722 この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
5723 \begin{enumerate}
5724 \item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する.
5725 \item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
5726 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
5727
5728 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような
5729 最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}
5730 を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
5731 \end{enumerate}
5732
5733 \subsection{概観と典型例:2つの「和文A」の場合}
5734 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
5735 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
5736 \[
5737  \Node{cluster}{\textit{Nq}}\longrightarrow
5738 \overbrace{
5739 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5740 \longrightarrow \Node{cluster}{\textit{Np}}
5741 \]
5742 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
5743 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
5744 \[
5745  \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow
5746 \overbrace{
5747 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
5748 \longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}}
5749 \]
5750
5751 以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
5752 この場合が全ての場合の基本となる.
5753
5754 \paragraph{「右空白」の算出}
5755 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
5756 \begin{description}
5757 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
5758       デフォルト値\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなるので,次へ.
5759 \begin{enumerate}
5760 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),
5761       代わりに\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が挿入されることとなる.次へ.
5762 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
5763       共通に使っているJFM内で挿入される空白(グルーかカーン)が決まっているか調べ,決まっていればそれを採用.
5764 \item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである.
5765 この場合,まず
5766 \[
5767 \vcenter{\halign{\hfil$#:={}$&\inhibitglue#\inhibitglue\cr
5768 gb&(\textit{Nq}と「使用フォントが\textit{Nq}のそれと同じで,\hfil\cr
5769 \omit&\quad 文字コードが\textit{Np}のそれの文字」との間に入るグルー/カーン)\hfil\cr
5770 ga&(\inhibitglue 「使用フォントが\textit{Np}のそれと同じで,\hfil\cr
5771 \omit&\quad 文字コードが\textit{Nq}のそれの文字」と\textit{Np}との間に入るグルー/カーン)\hfil\cr
5772 }}
5773 \]
5774 として,前側の文字のJFMを使った時の空白(グルー/カーン)と,後側の文字のJFMを使った時のそれを求める.
5775
5776 $\mathit{gb}$,~$\mathit{ga}$それぞれに対する<ratio>の値を$d_b$,~$d_a$とする.
5777 \begin{itemize}
5778 \item 
5779 $\mathit{ga}$と$\mathit{gb}$の両方が未定義であるならば,JFM由来のグルーは挿入されず,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなる.どちらか片方のみが未定義であるならば,次のステップでその未定義の方は長さ0のkernで,<ratio>の値は0であるかのように扱われる.
5780 \item 
5781 \Param{\hyperlink{fld:diffjfm}{diffrentjfm}}の値が\texttt{pleft}, \texttt{pright}, \texttt{paverage}のとき,
5782 <ratio>の指定に従って比例配分を行う.
5783 JFM由来のグルー/カーンは以下の値となる:
5784 \[
5785  f\left(\frac{1-d_b}2\textit{gb} + \frac{1+d_b}2\textit{ga},
5786 \frac{1-d_a}2\textit{gb} + \frac{1+d_a}2\textit{ga}\right)
5787 \]
5788 ここで.$f(x,y)$は
5789 \[
5790  f(x,y)=\begin{cases}
5791 x&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pleft};\\
5792 y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pright};\\
5793 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{paverage};
5794 \end{cases}.
5795 \]
5796 \item 
5797 \Param{differentmet}がそれ以外の値の時は,<ratio>の値は無視され,JFM由来のグルー/カーンは以下の値となる:
5798 \[
5799  f(\textit{gb},\textit{ga})
5800 \]
5801 ここで.$f(x,y)$は
5802 \[
5803  f(x,y)=\begin{cases}
5804 \min(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{small};\\
5805 \max(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{large};\\
5806 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{average};\\
5807 x+y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{both};
5808 \end{cases}.
5809 \]
5810 \end{itemize}
5811 \end{enumerate}
5812
5813 例えば,
5814 \begin{verbatim}
5815 \jfont\foo=psft:Ryumin-Light:jfm=ujis
5816 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
5817 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
5818 \end{verbatim}
5819 という3フォントを考え,
5820 \[
5821  \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p}
5822 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q}
5823 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r}
5824 \]
5825 という3ノードを考える(それぞれ単独でクラスタをなす).
5826 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で,
5827 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる.
5828 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
5829 以下で定めた量「右空白」として採用する.
5830 この段階においては,\verb+\inhibitglue+は効力を持たないため,
5831 結果として,2つの和文文字間には常に何らかのグルー/カーンが挿入されることとなる.
5832 \begin{enumerate}
5833 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
5834 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
5835 \item ユーザ側から見た\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5836 なければ,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの値を持つglueを採用する.
5837 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値を用いる.
5838 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
5839 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
5840 \end{enumerate}
5841 \end{description}
5842 \paragraph{「左空白」の算出とそれに伴う補正}
5843 「左空白」は過去のバージョンでは定義していたが,このバージョンでは挿入は一切行われない(機能自体削除している).しかし,仕様は流動的であり,将来復活する可能性もあるため,マニュアル中の記述は今のところ極力変更しない.
5844 % 次に,「左空白」にあたる量を算出する:
5845 % \begin{description}
5846 % \item[line-end~{[E]}]
5847 % \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
5848 % \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
5849 % \begin{enumerate}
5850 % \item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
5851 % \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
5852 % \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
5853 % \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
5854 % \end{enumerate}
5855 % \end{description}
5856 \paragraph{禁則用ペナルティの挿入}
5857 まず,
5858 \[
5859  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値})
5860 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値})
5861 \]
5862 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
5863 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
5864 算出では単純な整数の加減算を行う.
5865
5866 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
5867 \begin{description}
5868 \item[P-normal~{[PN]}]
5869 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
5870 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
5871 また,$10000 + (-10000) = 0$としている.
5872
5873 少々困るのは,(a)部分にペナルティが存在していない場合である.
5874 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
5875 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
5876 ということになるが,実際には僅かにこれより複雑である.
5877 \begin{itemize}
5878 \item 「右空白」がカーンであるとき,
5879 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
5880 この場合は$a\neq 0$であってもペナルティの挿入はしない.
5881 \item 「左空白」がカーンとしてきっちり定義されている時(このとき,「右空白」はカーンでない),
5882 この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
5883 \textit{penalty\_node}を作って挿入する.
5884 \item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
5885 \end{itemize}
5886 \end{description}
5887
5888 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
5889   \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$}
5890 \begin{table}[t]
5891 %<en>\caption{Summary of JFM glues.}
5892 %<ja>\caption{JFM グルーの概要.}
5893 %<zh>\caption{JFM胶总结。}
5894 \label{tab-jfmglue}
5895 \begin{center}
5896 \small
5897 \begin{tabular}{c|cccccc}
5898 \toprule
5899 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
5900 \sf 和文A&
5901 \gkf{E}{M→K}{PN}&
5902 \gkf{---}{\OA →K}{PN}&
5903 \gkf{---}{\OA →X}{PN}&
5904 \gkf{---}{\OA}{PA}&
5905 \gkf{---}{\OA}{PN}&
5906 \gkf{---}{\OA}{PS}\\
5907 \sf 和文B&
5908 \gkf{E}{\OB→K}{PA}&
5909 \gkf{---}{K}{PS}&
5910 \gkf{---}{X}{PS}\\
5911 \sf 欧文&
5912 \gkf{E}{\OB →X}{PA}&
5913 \gkf{---}{X}{PS}\cr
5914 \sf 箱&\gkf{E}{\OB}{PA}\\
5915 \sf glue&\gkf{E}{\OB}{PN}\\
5916 \sf kern&\gkf{E}{\OB}{PS}\\
5917 \bottomrule
5918 \end{tabular}
5919 \end{center}
5920 \begin{quote}
5921 %<*en>
5922 Here {\small\gkf{E}{M→K}{PN}} means that
5923 %</en>
5924 %<*ja>
5925 ここで {\small\gkf{E}{M→K}{PN}} は次の意味である:
5926 %</ja>
5927 \begin{enumerate}
5928 %<*en>
5929 \item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'.
5930 If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'.
5931 %</en>
5932 %<*ja>
5933 \item 「右空白」を決めるために,\LuaTeX-ja はまず「JFM由来{[M]}」の方法を試みる.
5934   これが失敗したら,\LuaTeX-ja は「\Param{kanjiskip}~{[K]}」の方法を試みる.
5935 %</ja>
5936
5937 %<*en>
5938 \item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'.
5939 %</en>
5940 %<*ja>
5941 \item \textit{Nq} と \textit{Np} の間の「左空白」は「\textsf{line-end~[E]}」の
5942   方法で決定される.
5943 %</ja>
5944
5945 %<*en>
5946 \item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}.
5947 %</en>
5948 %<*ja>
5949 \item \LuaTeX-jaは2つのクラスタの間の禁則処理用のペナルティを調節するために「\textsf{P-normal~[PN]}」の方法を採用する.
5950 %</ja>
5951 \end{enumerate}
5952 \end{quote}
5953 \end{table}
5954
5955 \subsection{その他の場合}
5956 本節の内容は表\ref{tab-jfmglue}にまとめてある.
5957
5958 \paragraph{和文Aと欧文の間}
5959 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
5960 \begin{itemize}
5961 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5962 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
5963 \item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ.
5964 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
5965 \end{itemize}
5966 \begin{description}
5967 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
5968 未定義でなければそれを「右空白」として採用する.
5969 \textsf{JFM-origin~[M]}の変種と考えて良い.
5970 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
5971 \begin{enumerate}
5972 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
5973 \item そうでなければ,
5974 \textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るグルー/カーンとして定まる.
5975 \end{enumerate}
5976 \item[\Param{\hyperlink{fld:xks}{xkanjiskip}}~{[X]}]
5977 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
5978 以下で定めた量を「右空白」として採用する.
5979 この段階で\verb+\inhibitglue+は効力を持たないのも同じである.
5980 \begin{enumerate}
5981 \item 以下のいずれかの場合は,\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
5982 \begin{itemize}
5983 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
5984 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5985 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
5986 \item \textit{Np}の中身の文字コードについて,「直前への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5987 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
5988 \end{itemize}
5989 \item ユーザ側から見た\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
5990 なければ,\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの値を持つglueを採用する.
5991 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
5992 で使われているJFMに指定されている\Param{\hyperlink{fld:xks}{xkanjiskip}}の値を用いる.
5993 \end{enumerate}
5994 \end{description}
5995
5996 \paragraph{欧文と和文Aの間}
5997 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
5998 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
5999 \begin{itemize}
6000 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
6001 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
6002 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
6003 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
6004 \end{itemize}
6005 \begin{description}
6006 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
6007 未定義でなければそれを「右空白」として採用する.
6008 \textsf{JFM-origin~[M]}の変種と考えて良い.
6009 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
6010 \begin{enumerate}
6011 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
6012 \item そうでなければ,
6013 「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るグルー/カーンとして定まる.
6014 \end{enumerate}
6015 \end{description}
6016
6017 \paragraph{和文Aと箱・グルー・カーンの間}
6018 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・グルー・カーンのいずれかであった場合,
6019 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
6020 ペナルティの挿入処理は若干異なったものとなっている.
6021
6022 \begin{itemize}
6023 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
6024 それが失敗した場合は,「右空白」は挿入されない.
6025 \item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
6026 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
6027 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
6028 「$\mathit{Np}.\mathit{head}$に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値」は0とみなされる.言い換えれば,
6029 \[
6030  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値}).
6031 \]
6032 \begin{description}
6033 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
6034 (明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため,
6035 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
6036 \item[グルー] \textit{Np}がグルーの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
6037 \item[カーン] \textit{Np}がカーンであった場合は,両クラスタの間での行分割は
6038 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
6039 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
6040 \end{description}
6041 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
6042 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
6043 \end{itemize}
6044
6045 \begin{description}
6046 \item[P-allow~{[PA]}]
6047 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
6048 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
6049
6050 (a)部分にペナルティが存在していない場合,
6051 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
6052 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
6053 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
6054 \begin{itemize}
6055 \item 「右空白」がグルーでない(カーンか未定義)であるとき.
6056 \item 「左空白」がカーンとしてきっちり定義されている時.
6057 \end{itemize}
6058
6059 \item[P-suppress~{[PS]}]
6060 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
6061 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
6062
6063 (a)部分にペナルティが存在していない場合,
6064 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
6065 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
6066 そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する.
6067 \end{description}
6068
6069 なお,「右空白」はカーン,「左空白」は未定義の
6070 \[
6071  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6072 \]
6073 のような状況を考える.
6074 このとき,$a$,即ち「あ」の\Param{\hyperlink{fld:postbp}{postbreakpenalty}}がいかなる値であっても,
6075 この2クラスタ間は最終的に
6076 \begin{equation}
6077  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
6078 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6079 \label{eq-gref}
6080 \end{equation}
6081 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
6082 \Param{\hyperlink{fld:postbp}{postbreakpenalty}}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
6083 \eqref{eq-gref}と
6084 \[
6085  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
6086 \Node{penalty}{$a$}\longrightarrow
6087 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
6088 \]
6089 との間に差異は生じない%
6090 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
6091 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
6092
6093 \paragraph{箱・グルー・カーンと和文Aの間}
6094 \textit{Np}が\textsf{箱}・グルー・カーンのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
6095 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意.
6096 \begin{itemize}
6097 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
6098 それが失敗した場合は,「右空白」は挿入されない.
6099 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
6100 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
6101 $\mathit{Nq}.\mathit{tail}$は無意味なので,
6102 \[
6103  a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値}).
6104 \]
6105 \begin{description}
6106 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
6107 \item[グルー] \textit{Nq}がグルーの場合は,\textsf{P-normal~[PN]}を用いる.
6108 \item[カーン] \textit{Nq}がカーンの場合は,\textsf{P-suppress~[PS]}を用いる.
6109 \end{description}
6110 \end{itemize}
6111
6112 \paragraph{和文Aと和文Bの違い}
6113 先に述べたように,\textsf{和文B}は水平ボックスの中身の先頭(or 末尾)として出現している
6114 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
6115 \begin{itemize}
6116 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
6117 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
6118 「左空白」の算出も行われない.例えば,
6119 \begin{itemize}
6120 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
6121 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
6122 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
6123 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
6124 \end{itemize}
6125 \item \textsf{和文B}と箱・グルー・カーンが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
6126 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
6127 \textsf{P-suppress~[PS]}が用いられる.
6128 \item \textsf{和文B}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}},~\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値は使われず,0として計算される.
6129 \end{itemize}
6130
6131
6132 次が具体例である:
6133 \begin{LTXexample}
6134 あ.\inhibitglue A\\
6135 \hbox{あ.}A\\
6136 あ.A
6137 \end{LTXexample}
6138 \begin{itemize}
6139 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
6140 \Param{\hyperlink{fld:xks}{xkanjiskip}}(四分アキ)が入ることに注意.
6141 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(水平ボックスの中身の末尾として登場しているから)ので,
6142 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{\hyperlink{fld:xks}{xkanjiskip}}が入ることとなる.
6143 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
6144 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
6145 \end{itemize}
6146
6147 \section{psft}
6148 ...
6149
6150 %<en>\section{Patch for the \Pkg{listings} package}
6151 %<zh>\section{Patch for the \Pkg{listings} package}
6152 %<ja>\section{\Pkg{listings} パッケージへの対応}
6153
6154 %<*en>
6155 It is well-known that the \Pkg{listings} package outputs weird results
6156 for Japanese input.
6157 The \Pkg{listings} package makes most of letters active and assigns
6158 output command for each letter \cite{listings}.
6159 But Japanese characters are not included in these activated letters.
6160 For \pTeX{} series, there is no method to make Japanese characters active;
6161 a patch \Pkg{jlisting.sty} \cite{jlisting} resolves the problem forcibly.
6162 %</en>
6163 %<*ja>
6164 \Pkg{listings} パッケージが,そのままでは日本語をまともに出力できないこと
6165 はよく知られている.きちんと整形して出力するために,\Pkg{listings}パッケー
6166 ジは内部で「ほとんどの文字」をアクティブにし,各文字に対してその文字の出
6167 力命令を割り当てている \cite{listings}.
6168 しかし,そこでアクティブにする文字の中に,和文文
6169 字がないためである.\pTeX 系列では,和文文字をアクティブにする手法がなく,
6170 \Pkg{jlisting.sty} というパッチ\cite{jlisting}を用いることで無理やり解決していた.
6171 %</ja>
6172
6173 %<*en>
6174 In \LuaTeX-ja, the problem is resolved by using \verb+process_input_buffer+ callback.
6175 The callback function inserts the output command before each letter above U+0080.
6176 This method can omits the process to make all Japanese characters active
6177 (most of the activated characters are not used in many cases).
6178 %</en>
6179 %<*ja>
6180 \LuaTeX-jaでは,\verb+process_input_buffer+ コールバックを利用することで,
6181 「各行に出現するU+0080以降の文字に対して,それらの出力命令を前置する」という方法をとっている.
6182 これにより,(入力には使用されていないかもしれない)和文文字をもすべてアクティブ化する手間もなく,
6183 見通しが良い実装になっている.
6184 %</ja>
6185
6186 %<*en>
6187 If \Pkg{listings.sty} and \LuaTeX-ja were loaded,
6188 then the patch \Pkg{lltjp-listings.sty} is loaded automatically at \verb+\begin{document}+.
6189 %</en>
6190 %<*ja>
6191 \LuaTeX-ja で利用される \Pkg{listings} パッケージへのパッチ \Pkg{lltjp-listings.sty} は,
6192 \Pkg{listings.sty} と\LuaTeX-jaを読み込んでおけば,
6193 \verb+\begin{document}+ の箇所において自動的に読み込まれるので,通常はあまり
6194 意識する必要はない.
6195 %</ja>
6196
6197 %<en>\paragraph{Class of characters}
6198 %<ja>\paragraph{文字種}
6199
6200 %<*en>
6201 Roughly speaking, the \Pkg{listings} package processes input as follows:
6202 %</en>
6203 %<*ja>
6204 \Pkg{listings} パッケージの内部では,大雑把に言うと
6205 %</ja>
6206 \begin{enumerate}
6207 %<zh>\item ...
6208 %<*en>
6209 \item Collects \textit{letters} and \textit{digits}, which can be used for the name of identifiers.
6210 %</en>
6211 %<*ja>
6212 \item 識別子として使える文字 (``letter'',~``digit'') たちを
6213 集める.
6214 %</ja>
6215 %<*en>
6216 \item When reading an \textit{other}, outputs the collected character string (with modification, if needed).
6217 %</en>
6218 %<*ja>
6219 \item letterでもdigitでもない文字が現れた時に,収集した文字列を(必要なら修飾して)出力する.
6220 %</ja>
6221 %<*en>
6222 \item Collects \textit{others}.
6223 %</en>
6224 %<*ja>
6225 \item 今度は逆に,letterでない文字たちをletterが現れるまで集める.
6226 %</ja>
6227 %<*en>
6228 \item When reading a \textit{letter} or a \textit{digit}, outputs the collected character string.
6229 %</en>
6230 %<*ja>
6231 \item letterが出現したら集めた文字列を出力する.
6232 %</ja>
6233 %<*en>
6234 \item Turns back to 1.
6235 %</en>
6236 %<*ja>
6237 \item 1.に戻る.
6238 %</ja>
6239 \end{enumerate}
6240 %<*en>
6241 By the above process, line breaks inside of an identifier are blocked.
6242 A flag \verb+\lst@ifletter+ indicates whether the previous character can be used
6243 for the name of identifiers or not.
6244 %</en>
6245 %<*ja>
6246 という処理が行われている.これにより,識別子の途中では行分割が行われないようになっている.
6247 直前の文字が識別子として使えるか否かは \verb+\lst@ifletter+ というフラグに格納されている.
6248 %</ja>
6249
6250 %<*en>
6251 For Japanese characters, line breaks are permitted on both sides
6252 except for parentheses, dashes, etc.
6253 To process Japanese characters,
6254 The pacth \Pkg{lltjp-listings.sty} introduces a new flag \verb+\lst@ifkanji+, which indicates
6255 whether the previous character is Japanese character or not.
6256 For illustration, we introduce the following classes of character:
6257 %</en>
6258 %<*ja>
6259 さて,日本語の処理である.殆どの和文文字の前後では行分割が可能であるが,その一方で
6260 括弧類や音引きなどでは禁則処理が必要なことから,\Pkg{lltjp-listings.sty} では,
6261 直前が和文文字であるかを示すフラグ \verb+\lst@ifkanji+ を新たに導入した.
6262 以降,説明のために以下のように文字を分類する:
6263 %</ja>
6264 \begin{center}
6265 \small
6266 \begin{tabular}{lccccc}
6267 \toprule
6268 &Letter&Other&Kanji&Open&Close\\\midrule
6269 \verb+\lst@ifletter+&T&F&T&F&T\\
6270 \verb+\lst@ifkanji+&F&F&T&T&F\\
6271 %<en>Meaning&identifier char&other alphabet&most of Japanese char&open paren&close paren\\
6272 %<ja>意図&識別子中の文字&その他欧文文字&殆どの和文文字&開き括弧類&閉じ括弧類\\
6273 \bottomrule
6274 \end{tabular}
6275 \end{center}
6276 %<*en>
6277 Note that \textit{digits} in the \Pkg{listings} package can be Letter or
6278 Other according to circumstances.
6279 %</en>
6280 %<*ja>
6281 なお,本来の\Pkg{listings} パッケージでの分類``digit''は,
6282 出現状況によって,上の表のLetterとOtherのどちらにもなりうる.
6283 また,KanjiとCloseは \verb+\lst@ifletter+ と \verb+\lst@ifkanji+ の値が一致しているが,
6284 これは間違いではない.
6285 %</ja>
6286
6287 %<*en>
6288 For example, let us consider the case an Open comes after a Letter.
6289 Since an Open represents Japanese open parenthesis,
6290 it is preferred to be permitted to insert line break after the Letter.
6291 Therefore, the collected character string is output in this case.
6292 %</en>
6293 %<*ja>
6294 例えば,Letterの直後にOpenが来た場合を考える.
6295 文字種Openは和文開き括弧類を想定しているので,Letterの直後では行分割が可能であることが望ましい.
6296 そのため,この場合では,すでに収集されている文字列を出力することで行分割を許容するようにした.
6297 %</ja>
6298
6299 %<*en>
6300 The following table summarizes $5\times 5=25$ cases:
6301 %</en>
6302 %<*ja>
6303 同じように,$5\times 5=25$通り全てについて書くと,次のようになる:
6304 %</ja>
6305 \begin{center}
6306 \small
6307 \begin{tabular}{llccccc}
6308 \toprule
6309 %<*en>
6310 &&\multicolumn{4}{c}{Next}\\\cmidrule(lr){3-7}
6311 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6312 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6313 &Letter&collects&\multicolumn{3}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6314 &Other&outputs&collects&\multicolumn{2}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6315 Prev&Kanji&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6316 &Open&\multicolumn{5}{c}{\hrulefill \ collects\ \hrulefill}\\
6317 &Close&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6318 %</en>
6319 %<*ja>
6320 &&\multicolumn{4}{c}{後ろ側の文字}\\\cmidrule(lr){3-7}
6321 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6322 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6323 直&Letter&収集&\multicolumn{3}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6324 前&Other&出力&収集&\multicolumn{2}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6325 文&Kanji&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6326 字&Open&\multicolumn{5}{c}{\hrulefill \ 収集\ \hrulefill}\\
6327 種&Close&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6328 %</ja>
6329 \bottomrule
6330 \end{tabular}
6331 \end{center}
6332 %<en>In the above table,
6333 %<ja>上の表において,
6334 \begin{itemize}
6335 %<zh>\item ...
6336 %<en>\item ``outputs'' means to output the collected character string (i.e., line breaking is permitted there).
6337 %<ja>\item 「出力」は,それまでに集めた文字列を出力(≒ここで行分割可能)を意味する.
6338
6339 %<en>\item ``collects'' means to append the next character to the collected character string (i.e., line breaking is prohibited there).
6340 %<ja>\item 「収集」は,後側の文字を,現在収集された文字列に追加(行分割不可)を意味する.
6341 \end{itemize}
6342
6343 %<en>\paragraph{Classification of characters}
6344 %<ja>\paragraph{和文文字扱いとなる文字}
6345
6346 %<*en>
6347 Characters are classified according to \Param{jacharrange} parameter (see Section \ref{ssec-setrange}):
6348 %</en>
6349 %<*ja>
6350 \Pkg{listings} パッケージにおいて和文文字と扱われる
6351 (前に述べたKanji, Open,あるいは「閉じ括弧類」分類)か否かは,
6352 通常の\textbf{JAchar}/\textbf{Alchar}の範囲の設定(\Param{jacharrange} パラメータ,\ref{ssec-setrange}節を参照)に従って行われる:
6353 %</ja>
6354 \begin{itemize}
6355 %<zh>\item ...
6356
6357 %<en>\item \textbf{ALchars} above U+0080 are Letter.
6358 %<ja>\item (U+0080以降の)\textbf{ALchar}は,すべてLetter扱いである.
6359
6360 %<en>\item \textbf{JAchars} are classified in the order as follows:
6361 %<ja>\item (U+0080以降の)\textbf{JAchar}については,以下の順序に従って文字種を決める:
6362 \begin{enumerate}
6363 %<zh>\item ...
6364 %<en>\item Characters whose \Param{\hyperlink{fld:prebp}{prebreakpenalty}} is greater than or equal to 0 are Open.
6365 %<ja>\item \Param{\hyperlink{fld:prebp}{prebreakpenalty}}が0以上の文字はOpen扱いである.
6366
6367 %<en>\item Characters whose \Param{\hyperlink{fld:postbp}{postbreakpenalty}} is greater than or equal to 0 are Close.
6368 %<ja>\item \Param{\hyperlink{fld:postbp}{postbreakpenalty}}が0以上の文字はClose扱いである.
6369
6370 %<en>\item Characters that don't satisfy the above two conditions are Kanji.
6371 %<ja>\item 上の2条件のどちらにも当てはまらなかった文字は,Kanji扱いである.
6372 \end{enumerate}
6373 \end{itemize}
6374
6375 %<*en>
6376 The width of halfwidth kana (U+FF61--U+FF9F) is same as the width of \textbf{ALchar};
6377 the width of the other \textbf{JAchars} is double the width of \textbf{ALchar}.
6378 %</en>
6379 %<*ja>
6380 なお,半角カナ(U+FF61--U+FF9F)以外の\textbf{JAchar}は欧文文字2文字分の幅をとるものとみなされる.
6381 半角カナは欧文文字1文字分の幅となる.
6382 %</ja>
6383
6384 %<*en>
6385 The classification process is executed every time a character appears in
6386 listing environments.
6387 %</en>
6388 %<*ja>
6389 これらの文字種決定は,実際に \texttt{lstlisting} 環境などの内部で文字が出てくるたびに行われる.
6390 %</ja>
6391
6392 %<*ja>
6393 \section{和文の行長補正方法}
6394 \label{sec-adjspec}
6395 \texttt{luatexja-adjust.sty} で提供される優先順位付きの行長調整の詳細を述
6396 べる.大まかに述べると,次のようになる.
6397 \begin{itemize}
6398 \item 通常の\TeX の行分割方法に従って,段落を行分割する.この段階では,行
6399       長に半端が出た場合,その半端分は\Param{\hyperlink{fld:xks}{xkanjiskip}},
6400       \Param{\hyperlink{fld:kanjiskip}{kanjiskip}},JFMグルーの全てで(優先順位なく)負担される.
6401 \item その後,\texttt{post\_linebreak\_filter} callbackを使い,\textbf{段
6402       落中の各行ごとに},行末文字の位置を調整したり,優先度付きの行長調整
6403       を実現するためにグルーの伸縮度を調整する.
6404 \texttt{luatexja-adjust.sty} の作用は,このcallbackを追加するだけであり,
6405       この章の残りではcallbackでの処理について解説する.
6406 \end{itemize}
6407
6408 \paragraph{準備:合計伸縮量の計算}
6409 グルーの伸縮度(\texttt{plus} や \texttt{minus} で指定されている値)には,
6410 有限値の他に,\texttt{fi},\texttt{fil},\texttt{fill},\texttt{filll}と
6411 いう4つの無限大レベル(後ろの方ほど大きい)があり,行の調整に
6412 \texttt{fi} などの\textbf{無限大レベルの伸縮度が用いられている場合は,そ
6413 の行に対しての処理を中止}する.
6414
6415 よって,以降,問題にしている行の行長調整は伸縮度が有限長のグルーを用いて
6416 行われているとして良い.まず,段落中の行中のグルーを
6417 \begin{itemize}
6418 \item 下のどれにも該当しないグルー
6419 \item JFMグルー(優先度別にまとめられる)
6420 \item 和欧文間空白(\Param{\hyperlink{fld:xks}{xkanjiskip}})
6421 \item 和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})
6422 \end{itemize}
6423 の$1+1+5+1=8$つに類別し,それぞれの種別ごとに許容されている伸縮度の合計を計算する.
6424 また,行長と自然長との差の絶対値を計算し,それを\textit{total}とおく.
6425
6426 \subsection{行末文字の位置調整}
6427 まず,行末が文字クラス$n$の\textbf{Jachar}であった場合,
6428 それを動かすことによって,\textbf{JAglue} が負担する調整量を少なくしようとする.
6429 この行末文字の左右の移動可能量は,JFM中にある文字クラス$n$の定義の
6430 \texttt{end\_stretch},~\texttt{end\_shrink}フィールドに全角単位の値として記述されている.
6431
6432 例えば,行末文字が句点「。」であり,そこで用いられているJFM中に
6433 \begin{verbatim}
6434   [2] = {
6435     chars = { '。', ... }, width = 0.5, ...,
6436     end_stretch = 0.5, end_shrink = 0.5,
6437   }, 
6438 \end{verbatim}
6439 という指定があった場合,この行末の句点は
6440 \begin{itemize}
6441 \item 通常の\TeX の行分割処理で「半角以上の詰め」が行われていた場合,
6442 この分の行中の\textbf{JAglue}の負担を軽減するため,
6443 行末の句点を半角だけ右に移動する(ぶら下げ組を行う).
6444 \item 通常の\TeX の行分割処理で「半角以上の空き」が行われていた場合,
6445 逆に行末句点を半角左に移動させる(見た目的に全角取りとなる).
6446 \item 以上のどちらでもない場合,行末句点の位置調整は行わない.
6447 \end{itemize}
6448 となる.
6449
6450 行末文字を移動した場合,その分だけ\textit{total}の値を引いておく.
6451
6452 \subsection{グルーの調整}
6453 \textit{total}の分だけが,行中のグルーの伸縮度に応じて負担されることになる.
6454 ……
6455
6456 %</ja>
6457
6458 %<*en>
6459 \section{Advanced line-adjustment for Japanese characters}
6460 \dots
6461 %</en>
6462
6463
6464
6465
6466 \begin{thebibliography}{99}
6467   \addcontentsline{toc}{section}{\refname}
6468 \bibitem{texbytopic}
6469 Victor Eijkhout,  \emph{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
6470 \bibitem{listings} C.\ Heinz, B.\ Moses. The \textsf{Listings} Package.
6471 \bibitem{jlisting} Thor Watanabe. Listings\ -\ MyTeXpert. \newblock
6472 \url{http://mytexpert.sourceforge.jp/index.php?Listings}
6473 \bibitem{min10} 乙部厳己,min10フォントについて.
6474 \url{http://argent.shinshu-u.ac.jp/~otobe/tex/files/min10.pdf}
6475 \bibitem{jlreq}  W3C Japanese Layout Task Force~(ed), Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \newblock
6476 \url{http://www.w3.org/TR/jlreq/}%
6477 %<ja> \\日本語訳の書籍版:W3C日本語組版タスクフォース(編),『W3C技術ノート 日本語組版処理の要件』,東京電機大学出版局,2012.
6478 \bibitem{x4051} 日本工業規格(Japanese Industrial Standard) JIS~X~4051,
6479 日本語文書の組版方法(Formatting rules for Japanese documents), 1993, 1995, 2004.
6480 \end{thebibliography}
6481
6482 \newpage
6483 \appendix
6484 \batchmode
6485 %<*!zh>
6486 %<en>\section{The category code of non-kanji characters defined in JIS~X~0213}
6487 %<ja>\section{\LuaTeX-jaにおけるJIS~X~0213非漢字のcatcode}
6488
6489 %<*en>
6490 In these tables, the default catcode (\LuaTeX-ja) and kcatcode ((u)\pTeX) of non-kanji
6491 characters defined in JIS~X~0213 from row 1 to row 13 is summarized.
6492 Each character is printed as follows:
6493 %</en>
6494 %<*ja>
6495 ここでは,JIS~X~0213の非漢字部分(第1区〜第13区)のうち,
6496 どの文字が(u)\pTeX や\LuaTeX-jaで制御綴内に使用可能かを表にしてまとめる.
6497 各文字は
6498 %</ja>
6499 \begin{center}
6500 \tt\fboxsep=1pt\fbox{\hbox to \zw{\gt あ\hss}}\,\scriptsize LUP
6501 \end{center}
6502 %<*ja>
6503 のように表示しており,各文字は次の意味を持っている.
6504 この表の生成は,JIS~X~0208の範囲内の文字については\verb+\jis+命令を使って行なっている.
6505 %</ja>
6506 %<*en>
6507 The tables are generated by using \verb+\jis+ command for characters included in
6508 JIS~X~0208.
6509 Each character in the tables means:
6510 %</en>
6511 \begin{itemize}
6512 %<*en>
6513 \item The background of a character regarded as \textbf{ALchar} in \LuaTeX-ja
6514   is colored light blue.
6515 %</en>
6516 %<*ja>
6517 \item 背景が薄く青く塗られている文字は,
6518 \LuaTeX-ja の標準で\textbf{ALchar}として認識されている文字である.
6519 %</ja>
6520
6521 %<*en>
6522 \item The first letter {\tt L} means that the character is available for
6523   the name of a control sequence in \XeTeX{} and \LuaTeX-ja (its catcode is 11).
6524 %</en>
6525 %<*ja>
6526 \item 1文字目の {\tt L} は,\XeTeX や\LuaTeX-jaにおいてこの文字が制御綴内に
6527 使用可能(catcodeが11)であることを表している.
6528 %</ja>
6529
6530 %<*en>
6531 \item The second letter {\tt U} means that the character is available for
6532   the name of a control sequence in \upTeX{} (its kcatcode is 16 or 17).
6533   \upTeX{} regards these characters as Japanese character.
6534 %</en>
6535 %<*ja>
6536 \item 2文字目の{\tt U} は,\upTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
6537 表している.この範囲内では,\upTeX は標準で全文字を和文文字として扱うようである.
6538 %</ja>
6539
6540 %<*en>
6541 \item The third letter {\tt P} means that the character is available for
6542   the name of a control sequence in \pTeX{} (its kcatcode is 16 or 17).
6543 %</en>
6544 %<*ja>
6545 \item 3文字目の {\tt P} は,\pTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
6546 表している.
6547 %</ja>
6548
6549 %<*en>
6550 \item If the third letter is {\tt -} (or the character is printed in red),
6551   the character is not included in JIS~X~0208.
6552   Therefore, you can consider the character is not available in \pTeX.
6553 %</en>
6554 %<*ja>
6555 \item 3文字目が{\tt -}となっているもの(本体の文字も赤身がかっている)は,
6556 JIS~X~0208にないため\pTeX では使用不能と考えて良いものである.
6557 %</ja>
6558
6559 %<*en>
6560 \item The kana for bidakuon in row 4 and 5 are omitted.
6561 %</en>
6562 %<*ja>
6563 \item 第4区と第5区にある,鼻濁音の仮名については省略した.
6564 %</ja>
6565 \end{itemize}
6566
6567
6568 \makeatletter
6569 \def\uplist{% upTeX で \kcatcode!=18 なもの
6570   \@elt {8486}\@elt {8491}\@elt {8492}\@elt {8499}\@elt {8500}\@elt {8501}%
6571   \@elt {8502}\@elt {8504}\@elt {8508}\@elt {9008}\@elt {9009}\@elt {9010}%
6572   \@elt {9011}\@elt {9012}\@elt {9013}\@elt {9014}\@elt {9015}\@elt {9016}%
6573   \@elt {9017}\@elt {9025}\@elt {9026}\@elt {9027}\@elt {9028}\@elt {9029}%
6574   \@elt {9030}\@elt {9031}\@elt {9032}\@elt {9033}\@elt {9034}\@elt {9035}%
6575   \@elt {9036}\@elt {9037}\@elt {9038}\@elt {9039}\@elt {9040}\@elt {9041}%
6576   \@elt {9042}\@elt {9043}\@elt {9044}\@elt {9045}\@elt {9046}\@elt {9047}%
6577   \@elt {9048}\@elt {9049}\@elt {9050}\@elt {9057}\@elt {9058}\@elt {9059}%
6578   \@elt {9060}\@elt {9061}\@elt {9062}\@elt {9063}\@elt {9064}\@elt {9065}%
6579   \@elt {9066}\@elt {9067}\@elt {9068}\@elt {9069}\@elt {9070}\@elt {9071}%
6580   \@elt {9072}\@elt {9073}\@elt {9074}\@elt {9075}\@elt {9076}\@elt {9077}%
6581   \@elt {9078}\@elt {9079}\@elt {9080}\@elt {9081}\@elt {9082}\@elt {9249}%
6582   \@elt {9250}\@elt {9251}\@elt {9252}\@elt {9253}\@elt {9254}\@elt {9255}%
6583   \@elt {9256}\@elt {9257}\@elt {9258}\@elt {9259}\@elt {9260}\@elt {9261}%
6584   \@elt {9262}\@elt {9263}\@elt {9264}\@elt {9265}\@elt {9266}\@elt {9267}%
6585   \@elt {9268}\@elt {9269}\@elt {9270}\@elt {9271}\@elt {9272}\@elt {9273}%
6586   \@elt {9274}\@elt {9275}\@elt {9276}\@elt {9277}\@elt {9278}\@elt {9279}%
6587   \@elt {9280}\@elt {9281}\@elt {9282}\@elt {9283}\@elt {9284}\@elt {9285}%
6588   \@elt {9286}\@elt {9287}\@elt {9288}\@elt {9289}\@elt {9290}\@elt {9291}%
6589   \@elt {9292}\@elt {9293}\@elt {9294}\@elt {9295}\@elt {9296}\@elt {9297}%
6590   \@elt {9298}\@elt {9299}\@elt {9300}\@elt {9301}\@elt {9302}\@elt {9303}%
6591   \@elt {9304}\@elt {9305}\@elt {9306}\@elt {9307}\@elt {9308}\@elt {9309}%
6592   \@elt {9310}\@elt {9311}\@elt {9312}\@elt {9313}\@elt {9314}\@elt {9315}%
6593   \@elt {9316}\@elt {9317}\@elt {9318}\@elt {9319}\@elt {9320}\@elt {9321}%
6594   \@elt {9322}\@elt {9323}\@elt {9324}\@elt {9325}\@elt {9326}\@elt {9327}%
6595   \@elt {9328}\@elt {9329}\@elt {9330}\@elt {9331}\@elt {9505}\@elt {9506}%
6596   \@elt {9507}\@elt {9508}\@elt {9509}\@elt {9510}\@elt {9511}\@elt {9512}%
6597   \@elt {9513}\@elt {9514}\@elt {9515}\@elt {9516}\@elt {9517}\@elt {9518}%
6598   \@elt {9519}\@elt {9520}\@elt {9521}\@elt {9522}\@elt {9523}\@elt {9524}%
6599   \@elt {9525}\@elt {9526}\@elt {9527}\@elt {9528}\@elt {9529}\@elt {9530}%
6600   \@elt {9531}\@elt {9532}\@elt {9533}\@elt {9534}\@elt {9535}\@elt {9536}%
6601   \@elt {9537}\@elt {9538}\@elt {9539}\@elt {9540}\@elt {9541}\@elt {9542}%
6602   \@elt {9543}\@elt {9544}\@elt {9545}\@elt {9546}\@elt {9547}\@elt {9548}%
6603   \@elt {9549}\@elt {9550}\@elt {9551}\@elt {9552}\@elt {9553}\@elt {9554}%
6604   \@elt {9555}\@elt {9556}\@elt {9557}\@elt {9558}\@elt {9559}\@elt {9560}%
6605   \@elt {9561}\@elt {9562}\@elt {9563}\@elt {9564}\@elt {9565}\@elt {9566}%
6606   \@elt {9567}\@elt {9568}\@elt {9569}\@elt {9570}\@elt {9571}\@elt {9572}%
6607   \@elt {9573}\@elt {9574}\@elt {9575}\@elt {9576}\@elt {9577}\@elt {9578}%
6608   \@elt {9579}\@elt {9580}\@elt {9581}\@elt {9582}\@elt {9583}\@elt {9584}%
6609   \@elt {9585}\@elt {9586}\@elt {9587}\@elt {9588}\@elt {9589}\@elt {9590}%
6610   % ここから JIS X 0213
6611   \@elt {8760}\@elt {8761}\@elt {9083}\@elt {9332}\@elt {9333}\@elt {9334}%
6612   \@elt {9335}\@elt {9336}\@elt {9337}\@elt {9338}\@elt {9339}\@elt {9591}%
6613   \@elt {9592}\@elt {9593}\@elt {9594}\@elt {9595}\@elt {9596}\@elt {9597}%
6614   \@elt {9598}\@elt {9838}\@elt {9839}\@elt {9840}\@elt {9841}\@elt {9842}%
6615   \@elt {9843}\@elt {9844}\@elt {9845}\@elt {9846}\@elt {9847}\@elt {9848}%
6616   \@elt {9849}\@elt {9850}\@elt {9851}\@elt {9852}\@elt {9853}\@elt {9854}%
6617   \@elt {10098}\@elt {10099}\@elt {10100}\@elt {10101}%
6618 }
6619 \def\plist{% pTeX で \kcatcode!=18 なもの
6620   \@elt {8993}\@elt {8994}\@elt {8995}\@elt {8996}\@elt {8997}\@elt {8998}%
6621   \@elt {8999}\@elt {9000}\@elt {9001}\@elt {9002}\@elt {9003}\@elt {9004}%
6622   \@elt {9005}\@elt {9006}\@elt {9007}\@elt {9008}\@elt {9009}\@elt {9010}%
6623   \@elt {9011}\@elt {9012}\@elt {9013}\@elt {9014}\@elt {9015}\@elt {9016}%
6624   \@elt {9017}\@elt {9018}\@elt {9019}\@elt {9020}\@elt {9021}\@elt {9022}%
6625   \@elt {9023}\@elt {9024}\@elt {9025}\@elt {9026}\@elt {9027}\@elt {9028}%
6626   \@elt {9029}\@elt {9030}\@elt {9031}\@elt {9032}\@elt {9033}\@elt {9034}%
6627   \@elt {9035}\@elt {9036}\@elt {9037}\@elt {9038}\@elt {9039}\@elt {9040}%
6628   \@elt {9041}\@elt {9042}\@elt {9043}\@elt {9044}\@elt {9045}\@elt {9046}%
6629   \@elt {9047}\@elt {9048}\@elt {9049}\@elt {9050}\@elt {9051}\@elt {9052}%
6630   \@elt {9053}\@elt {9054}\@elt {9055}\@elt {9056}\@elt {9057}\@elt {9058}%
6631   \@elt {9059}\@elt {9060}\@elt {9061}\@elt {9062}\@elt {9063}\@elt {9064}%
6632   \@elt {9065}\@elt {9066}\@elt {9067}\@elt {9068}\@elt {9069}\@elt {9070}%
6633   \@elt {9071}\@elt {9072}\@elt {9073}\@elt {9074}\@elt {9075}\@elt {9076}%
6634   \@elt {9077}\@elt {9078}\@elt {9079}\@elt {9080}\@elt {9081}\@elt {9082}%
6635   \@elt {9083}\@elt {9084}\@elt {9085}\@elt {9086}\@elt {9249}\@elt {9250}%
6636   \@elt {9251}\@elt {9252}\@elt {9253}\@elt {9254}\@elt {9255}\@elt {9256}%
6637   \@elt {9257}\@elt {9258}\@elt {9259}\@elt {9260}\@elt {9261}\@elt {9262}%
6638   \@elt {9263}\@elt {9264}\@elt {9265}\@elt {9266}\@elt {9267}\@elt {9268}%
6639   \@elt {9269}\@elt {9270}\@elt {9271}\@elt {9272}\@elt {9273}\@elt {9274}%
6640   \@elt {9275}\@elt {9276}\@elt {9277}\@elt {9278}\@elt {9279}\@elt {9280}%
6641   \@elt {9281}\@elt {9282}\@elt {9283}\@elt {9284}\@elt {9285}\@elt {9286}%
6642   \@elt {9287}\@elt {9288}\@elt {9289}\@elt {9290}\@elt {9291}\@elt {9292}%
6643   \@elt {9293}\@elt {9294}\@elt {9295}\@elt {9296}\@elt {9297}\@elt {9298}%
6644   \@elt {9299}\@elt {9300}\@elt {9301}\@elt {9302}\@elt {9303}\@elt {9304}%
6645   \@elt {9305}\@elt {9306}\@elt {9307}\@elt {9308}\@elt {9309}\@elt {9310}%
6646   \@elt {9311}\@elt {9312}\@elt {9313}\@elt {9314}\@elt {9315}\@elt {9316}%
6647   \@elt {9317}\@elt {9318}\@elt {9319}\@elt {9320}\@elt {9321}\@elt {9322}%
6648   \@elt {9323}\@elt {9324}\@elt {9325}\@elt {9326}\@elt {9327}\@elt {9328}%
6649   \@elt {9329}\@elt {9330}\@elt {9331}\@elt {9332}\@elt {9333}\@elt {9334}%
6650   \@elt {9335}\@elt {9336}\@elt {9337}\@elt {9338}\@elt {9339}\@elt {9340}%
6651   \@elt {9341}\@elt {9342}\@elt {9505}\@elt {9506}\@elt {9507}\@elt {9508}%
6652   \@elt {9509}\@elt {9510}\@elt {9511}\@elt {9512}\@elt {9513}\@elt {9514}%
6653   \@elt {9515}\@elt {9516}\@elt {9517}\@elt {9518}\@elt {9519}\@elt {9520}%
6654   \@elt {9521}\@elt {9522}\@elt {9523}\@elt {9524}\@elt {9525}\@elt {9526}%
6655   \@elt {9527}\@elt {9528}\@elt {9529}\@elt {9530}\@elt {9531}\@elt {9532}%
6656   \@elt {9533}\@elt {9534}\@elt {9535}\@elt {9536}\@elt {9537}\@elt {9538}%
6657   \@elt {9539}\@elt {9540}\@elt {9541}\@elt {9542}\@elt {9543}\@elt {9544}%
6658   \@elt {9545}\@elt {9546}\@elt {9547}\@elt {9548}\@elt {9549}\@elt {9550}%
6659   \@elt {9551}\@elt {9552}\@elt {9553}\@elt {9554}\@elt {9555}\@elt {9556}%
6660   \@elt {9557}\@elt {9558}\@elt {9559}\@elt {9560}\@elt {9561}\@elt {9562}%
6661   \@elt {9563}\@elt {9564}\@elt {9565}\@elt {9566}\@elt {9567}\@elt {9568}%
6662   \@elt {9569}\@elt {9570}\@elt {9571}\@elt {9572}\@elt {9573}\@elt {9574}%
6663   \@elt {9575}\@elt {9576}\@elt {9577}\@elt {9578}\@elt {9579}\@elt {9580}%
6664   \@elt {9581}\@elt {9582}\@elt {9583}\@elt {9584}\@elt {9585}\@elt {9586}%
6665   \@elt {9587}\@elt {9588}\@elt {9589}\@elt {9590}\@elt {9591}\@elt {9592}%
6666   \@elt {9593}\@elt {9594}\@elt {9595}\@elt {9596}\@elt {9597}\@elt {9598}%
6667   \@elt {9761}\@elt {9762}\@elt {9763}\@elt {9764}\@elt {9765}\@elt {9766}%
6668   \@elt {9767}\@elt {9768}\@elt {9769}\@elt {9770}\@elt {9771}\@elt {9772}%
6669   \@elt {9773}\@elt {9774}\@elt {9775}\@elt {9776}\@elt {9777}\@elt {9778}%
6670   \@elt {9779}\@elt {9780}\@elt {9781}\@elt {9782}\@elt {9783}\@elt {9784}%
6671   \@elt {9785}\@elt {9786}\@elt {9787}\@elt {9788}\@elt {9789}\@elt {9790}%
6672   \@elt {9791}\@elt {9792}\@elt {9793}\@elt {9794}\@elt {9795}\@elt {9796}%
6673   \@elt {9797}\@elt {9798}\@elt {9799}\@elt {9800}\@elt {9801}\@elt {9802}%
6674   \@elt {9803}\@elt {9804}\@elt {9805}\@elt {9806}\@elt {9807}\@elt {9808}%
6675   \@elt {9809}\@elt {9810}\@elt {9811}\@elt {9812}\@elt {9813}\@elt {9814}%
6676   \@elt {9815}\@elt {9816}\@elt {9817}\@elt {9818}\@elt {9819}\@elt {9820}%
6677   \@elt {9821}\@elt {9822}\@elt {9823}\@elt {9824}\@elt {9825}\@elt {9826}%
6678   \@elt {9827}\@elt {9828}\@elt {9829}\@elt {9830}\@elt {9831}\@elt {9832}%
6679   \@elt {9833}\@elt {9834}\@elt {9835}\@elt {9836}\@elt {9837}\@elt {9838}%
6680   \@elt {9839}\@elt {9840}\@elt {9841}\@elt {9842}\@elt {9843}\@elt {9844}%
6681   \@elt {9845}\@elt {9846}\@elt {9847}\@elt {9848}\@elt {9849}\@elt {9850}%
6682   \@elt {9851}\@elt {9852}\@elt {9853}\@elt {9854}%
6683 }
6684
6685 \def\jlist{% JIS X 0213 だけにあるもの
6686 \@elt{"222F}{"FF07}\@elt{"2230}{"FF02}\@elt{"2231}{"FF0D}\@elt{"2232}{"FF5E}%
6687 \@elt{"2233}{"3033}\@elt{"2234}{"3034}\@elt{"2235}{"3035}\@elt{"2236}{"303B}%
6688 \@elt{"2237}{"303C}\@elt{"2238}{"30FF}\@elt{"2239}{"309F}\@elt{"2242}{"2284}%
6689 \@elt{"2243}{"2285}\@elt{"2244}{"228A}\@elt{"2245}{"228B}\@elt{"2246}{"2209}%
6690 \@elt{"2247}{"2205}\@elt{"2248}{"2305}\@elt{"2249}{"2306}\@elt{"2251}{"2295}%
6691 \@elt{"2252}{"2296}\@elt{"2253}{"2297}\@elt{"2254}{"2225}\@elt{"2255}{"2226}%
6692 \@elt{"2256}{"FF5F}\@elt{"2257}{"FF60}\@elt{"2258}{"3018}\@elt{"2259}{"3019}%
6693 \@elt{"225A}{"3016}\@elt{"225B}{"3017}\@elt{"226B}{"2262}\@elt{"226C}{"2243}%
6694 \@elt{"226D}{"2245}\@elt{"226E}{"2248}\@elt{"226F}{"2276}\@elt{"2270}{"2277}%
6695 \@elt{"2271}{"2194}\@elt{"227A}{"266E}\@elt{"227B}{"266B}\@elt{"227C}{"266C}%
6696 \@elt{"227D}{"2669}\@elt{"2321}{"25B7}\@elt{"2322}{"25B6}\@elt{"2323}{"25C1}%
6697 \@elt{"2324}{"25C0}\@elt{"2325}{"2197}\@elt{"2326}{"2198}\@elt{"2327}{"2196}%
6698 \@elt{"2328}{"2199}\@elt{"2329}{"21C4}\@elt{"232A}{"21E8}\@elt{"232B}{"21E6}%
6699 \@elt{"232C}{"21E7}\@elt{"232D}{"21E9}\@elt{"232E}{"2934}\@elt{"232F}{"2935}%
6700 \@elt{"233A}{"29BF}\@elt{"233B}{"25C9}\@elt{"233C}{"303D}\@elt{"233D}{"FE46}%
6701 \@elt{"233E}{"FE45}\@elt{"233F}{"25E6}\@elt{"2340}{"2022}\@elt{"235B}{"2213}%
6702 \@elt{"235C}{"2135}\@elt{"235D}{"210F}\@elt{"235E}{"33CB}\@elt{"235F}{"2113}%
6703 \@elt{"2360}{"2127}\@elt{"237B}{"30A0}\@elt{"237C}{"2013}\@elt{"237D}{"29FA}%
6704 \@elt{"237E}{"29FB}\@elt{"2474}{"3094}\@elt{"2475}{"3095}\@elt{"2476}{"3096}%
6705 \@elt{"2639}{"2664}\@elt{"263A}{"2660}\@elt{"263B}{"2662}%
6706 \@elt{"263C}{"2666}\@elt{"263D}{"2661}\@elt{"263E}{"2665}\@elt{"263F}{"2667}%
6707 \@elt{"2640}{"2663}\@elt{"2659}{"03C2}\@elt{"265A}{"24F5}\@elt{"265B}{"24F6}%
6708 \@elt{"265C}{"24F7}\@elt{"265D}{"24F8}\@elt{"265E}{"24F9}\@elt{"265F}{"24FA}%
6709 \@elt{"2660}{"24FB}\@elt{"2661}{"24FC}\@elt{"2662}{"24FD}\@elt{"2663}{"24FE}%
6710 \@elt{"2664}{"2616}\@elt{"2665}{"2617}\@elt{"2666}{"3020}\@elt{"2667}{"260E}%
6711 \@elt{"2668}{"2600}\@elt{"2669}{"2601}\@elt{"266A}{"2602}\@elt{"266B}{"2603}%
6712 \@elt{"266C}{"2668}\@elt{"266D}{"25B1}\@elt{"266E}{"31F0}\@elt{"266F}{"31F1}%
6713 \@elt{"2670}{"31F2}\@elt{"2671}{"31F3}\@elt{"2672}{"31F4}\@elt{"2673}{"31F5}%
6714 \@elt{"2674}{"31F6}\@elt{"2675}{"31F7}\@elt{"2676}{"31F8}\@elt{"2677}{"31F9}%
6715 \@elt{"2678}{"31F7}\@elt{"2679}{"31FA}\@elt{"267A}{"31FB}\@elt{"267B}{"31FC}%
6716 \@elt{"267C}{"31FD}\@elt{"267D}{"31FE}\@elt{"267E}{"31FF}\@elt{"2742}{"23BE}%
6717 \@elt{"2743}{"23BF}\@elt{"2744}{"23C0}\@elt{"2745}{"23C1}\@elt{"2746}{"23C2}%
6718 \@elt{"2747}{"23C3}\@elt{"2748}{"23C4}\@elt{"2749}{"23C5}\@elt{"274A}{"23C6}%
6719 \@elt{"274B}{"23C7}\@elt{"274C}{"23C8}\@elt{"274D}{"23C9}\@elt{"274E}{"23CA}%
6720 \@elt{"274F}{"23CB}\@elt{"2750}{"23CC}\@elt{"2772}{"30F7}\@elt{"2773}{"30F8}%
6721 \@elt{"2774}{"30F9}\@elt{"2775}{"30FA}\@elt{"2776}{"22DA}\@elt{"2777}{"22DB}%
6722 \@elt{"2778}{"2153}\@elt{"2779}{"2154}\@elt{"277A}{"2155}\@elt{"277B}{"2713}%
6723 \@elt{"277C}{"2318}\@elt{"277D}{"2423}\@elt{"277E}{"23CE}\@elt{"2841}{"3251}%
6724 \@elt{"2842}{"3252}\@elt{"2843}{"3253}\@elt{"2844}{"3254}\@elt{"2845}{"3255}%
6725 \@elt{"2846}{"3256}\@elt{"2847}{"3257}\@elt{"2848}{"3258}\@elt{"2849}{"3259}%
6726 \@elt{"284A}{"325A}\@elt{"284B}{"325B}\@elt{"284C}{"325C}\@elt{"284D}{"325D}%
6727 \@elt{"284E}{"325E}\@elt{"284F}{"325F}\@elt{"2850}{"32B1}\@elt{"2851}{"32B2}%
6728 \@elt{"2852}{"32B3}\@elt{"2853}{"32B4}\@elt{"2854}{"32B5}\@elt{"2855}{"32B6}%
6729 \@elt{"2856}{"32B7}\@elt{"2857}{"32B8}\@elt{"2858}{"32B9}\@elt{"2859}{"32BA}%
6730 \@elt{"285A}{"32BB}\@elt{"285B}{"32BC}\@elt{"285C}{"32BD}\@elt{"285D}{"32BE}%
6731 \@elt{"285E}{"32BF}\@elt{"2867}{"25D0}\@elt{"2868}{"25D1}\@elt{"2869}{"25D2}%
6732 \@elt{"286A}{"25D3}\@elt{"286B}{"203C}\@elt{"286C}{"2047}\@elt{"286D}{"2048}%
6733 \@elt{"286E}{"2049}\@elt{"286F}{"01CD}\@elt{"2870}{"01CE}\@elt{"2871}{"01D0}%
6734 \@elt{"2872}{"1E3E}\@elt{"2873}{"1E3F}\@elt{"2874}{"01F8}\@elt{"2875}{"01F9}%
6735 \@elt{"2876}{"01D1}\@elt{"2877}{"01D2}\@elt{"2878}{"01D4}\@elt{"2879}{"01D6}%
6736 \@elt{"287A}{"01D8}\@elt{"287B}{"01DA}\@elt{"287C}{"01DC}\@elt{"2921}{"20AC}%
6737 \@elt{"2922}{"00A0}\@elt{"2923}{"00A1}\@elt{"2924}{"00A4}\@elt{"2925}{"00A6}%
6738 \@elt{"2926}{"00A9}\@elt{"2927}{"00AA}\@elt{"2928}{"00AB}\@elt{"2929}{"00AD}%
6739 \@elt{"292A}{"00AE}\@elt{"292B}{"00AF}\@elt{"292C}{"00B2}\@elt{"292D}{"00B3}%
6740 \@elt{"292E}{"00B7}\@elt{"292F}{"00B8}\@elt{"2930}{"00B9}\@elt{"2931}{"00BA}%
6741 \@elt{"2932}{"00BB}\@elt{"2933}{"00BC}\@elt{"2934}{"00BD}\@elt{"2935}{"00BE}%
6742 \@elt{"2936}{"00BF}\@elt{"2937}{"00C0}\@elt{"2938}{"00C1}\@elt{"2939}{"00C2}%
6743 \@elt{"293A}{"00C3}\@elt{"293B}{"00C4}\@elt{"293C}{"00C5}\@elt{"293D}{"00C6}%
6744 \@elt{"293E}{"00C7}\@elt{"293F}{"00C8}\@elt{"2940}{"00C9}\@elt{"2941}{"00CA}%
6745 \@elt{"2942}{"00CB}\@elt{"2943}{"00CC}\@elt{"2944}{"00CD}\@elt{"2945}{"00CE}%
6746 \@elt{"2946}{"00CF}\@elt{"2947}{"00D0}\@elt{"2948}{"00D1}\@elt{"2949}{"00D2}%
6747 \@elt{"294A}{"00D3}\@elt{"294B}{"00D4}\@elt{"294C}{"00D5}\@elt{"294D}{"00D6}%
6748 \@elt{"294E}{"00D8}\@elt{"294F}{"00D9}\@elt{"2950}{"00DA}\@elt{"2951}{"00DB}%
6749 \@elt{"2952}{"00DC}\@elt{"2953}{"00DD}\@elt{"2954}{"00DE}\@elt{"2955}{"00DF}%
6750 \@elt{"2956}{"00E0}\@elt{"2957}{"00E1}\@elt{"2958}{"00E2}\@elt{"2959}{"00E3}%
6751 \@elt{"295A}{"00E4}\@elt{"295B}{"00E5}\@elt{"295C}{"00E6}\@elt{"295D}{"00E7}%
6752 \@elt{"295E}{"00E8}\@elt{"295F}{"00E9}\@elt{"2960}{"00EA}\@elt{"2961}{"00EB}%
6753 \@elt{"2962}{"00EC}\@elt{"2963}{"00ED}\@elt{"2964}{"00EE}\@elt{"2965}{"00EF}%
6754 \@elt{"2966}{"00F0}\@elt{"2967}{"00F1}\@elt{"2968}{"00F2}\@elt{"2969}{"00F3}%
6755 \@elt{"296A}{"00F4}\@elt{"296B}{"00F5}\@elt{"296C}{"00F6}\@elt{"296D}{"00F8}%
6756 \@elt{"296E}{"00F9}\@elt{"296F}{"00FA}\@elt{"2970}{"00FB}\@elt{"2971}{"00FC}%
6757 \@elt{"2972}{"00FD}\@elt{"2973}{"00FE}\@elt{"2974}{"00FF}\@elt{"2975}{"0100}%
6758 \@elt{"2976}{"012A}\@elt{"2977}{"016A}\@elt{"2978}{"0112}\@elt{"2979}{"014C}%
6759 \@elt{"297A}{"0101}\@elt{"297B}{"012B}\@elt{"297C}{"016B}\@elt{"297D}{"0113}%
6760 \@elt{"297E}{"014D}\@elt{"2A21}{"0104}\@elt{"2A22}{"02D8}\@elt{"2A23}{"0141}%
6761 \@elt{"2A24}{"013D}\@elt{"2A25}{"015A}\@elt{"2A26}{"0160}\@elt{"2A27}{"015E}%
6762 \@elt{"2A28}{"0164}\@elt{"2A29}{"0179}\@elt{"2A2A}{"017D}\@elt{"2A2B}{"017B}%
6763 \@elt{"2A2C}{"0105}\@elt{"2A2D}{"02DB}\@elt{"2A2E}{"0142}\@elt{"2A2F}{"013E}%
6764 \@elt{"2A30}{"015B}\@elt{"2A31}{"02C7}\@elt{"2A32}{"0161}\@elt{"2A33}{"015F}%
6765 \@elt{"2A34}{"0165}\@elt{"2A35}{"017A}\@elt{"2A36}{"02DD}\@elt{"2A37}{"017E}%
6766 \@elt{"2A38}{"017C}\@elt{"2A39}{"0154}\@elt{"2A3A}{"0102}\@elt{"2A3B}{"0139}%
6767 \@elt{"2A3C}{"0106}\@elt{"2A3D}{"010C}\@elt{"2A3E}{"0118}\@elt{"2A3F}{"011A}%
6768 \@elt{"2A40}{"010E}\@elt{"2A41}{"0143}\@elt{"2A42}{"0147}\@elt{"2A43}{"0150}%
6769 \@elt{"2A44}{"0158}\@elt{"2A45}{"016E}\@elt{"2A46}{"0170}\@elt{"2A47}{"0162}%
6770 \@elt{"2A48}{"0155}\@elt{"2A49}{"0103}\@elt{"2A4A}{"013A}\@elt{"2A4B}{"0107}%
6771 \@elt{"2A4C}{"010D}\@elt{"2A4D}{"0119}\@elt{"2A4E}{"011B}\@elt{"2A4F}{"010F}%
6772 \@elt{"2A50}{"0111}\@elt{"2A51}{"0144}\@elt{"2A52}{"0148}\@elt{"2A53}{"0151}%
6773 \@elt{"2A54}{"0159}\@elt{"2A55}{"016F}\@elt{"2A56}{"0171}\@elt{"2A57}{"0163}%
6774 \@elt{"2A58}{"02D9}\@elt{"2A59}{"0108}\@elt{"2A5A}{"011C}\@elt{"2A5B}{"0124}%
6775 \@elt{"2A5C}{"0134}\@elt{"2A5D}{"015C}\@elt{"2A5E}{"016C}\@elt{"2A5F}{"0109}%
6776 \@elt{"2A60}{"011D}\@elt{"2A61}{"0125}\@elt{"2A62}{"0135}\@elt{"2A63}{"015D}%
6777 \@elt{"2A64}{"016D}\@elt{"2A65}{"0271}\@elt{"2A66}{"028B}\@elt{"2A67}{"027E}%
6778 \@elt{"2A68}{"0283}\@elt{"2A69}{"0292}\@elt{"2A6A}{"026C}\@elt{"2A6B}{"026E}%
6779 \@elt{"2A6C}{"0279}\@elt{"2A6D}{"0288}\@elt{"2A6E}{"0256}\@elt{"2A6F}{"0273}%
6780 \@elt{"2A70}{"027D}\@elt{"2A71}{"0282}\@elt{"2A72}{"0290}\@elt{"2A73}{"027B}%
6781 \@elt{"2A74}{"026D}\@elt{"2A75}{"025F}\@elt{"2A76}{"0272}\@elt{"2A77}{"029D}%
6782 \@elt{"2A78}{"028E}\@elt{"2A79}{"0261}\@elt{"2A7A}{"014B}\@elt{"2A7B}{"0270}%
6783 \@elt{"2A7C}{"0281}\@elt{"2A7D}{"0127}\@elt{"2A7E}{"0295}\@elt{"2B21}{"0294}%
6784 \@elt{"2B22}{"0266}\@elt{"2B23}{"0298}\@elt{"2B24}{"01C2}\@elt{"2B25}{"0253}%
6785 \@elt{"2B26}{"0257}\@elt{"2B27}{"0284}\@elt{"2B28}{"0260}\@elt{"2B29}{"0193}%
6786 \@elt{"2B2A}{"0153}\@elt{"2B2B}{"0152}\@elt{"2B2C}{"0268}\@elt{"2B2D}{"0289}%
6787 \@elt{"2B2E}{"0258}\@elt{"2B2F}{"0275}\@elt{"2B30}{"0259}\@elt{"2B31}{"025C}%
6788 \@elt{"2B32}{"025E}\@elt{"2B33}{"0250}\@elt{"2B34}{"026F}\@elt{"2B35}{"028A}%
6789 \@elt{"2B36}{"0264}\@elt{"2B37}{"028C}\@elt{"2B38}{"0254}\@elt{"2B39}{"0251}%
6790 \@elt{"2B3A}{"0252}\@elt{"2B3B}{"028D}\@elt{"2B3C}{"0265}\@elt{"2B3D}{"02A2}%
6791 \@elt{"2B3E}{"02A1}\@elt{"2B3F}{"0255}\@elt{"2B40}{"0291}\@elt{"2B41}{"027A}%
6792 \@elt{"2B42}{"0267}\@elt{"2B43}{"025A}\@elt{"2B44}{"00E6}\@elt{"2B45}{"01FD}%
6793 \@elt{"2B46}{"1F70}\@elt{"2B47}{"1F71}\@elt{"2B48}{"0254}\@elt{"2B49}{"0254}%
6794 \@elt{"2B4A}{"028C}\@elt{"2B4B}{"028C}\@elt{"2B4C}{"0259}\@elt{"2B4D}{"0259}%
6795 \@elt{"2B4E}{"025A}\@elt{"2B4F}{"025A}\@elt{"2B50}{"1F72}\@elt{"2B51}{"1F73}%
6796 \@elt{"2B52}{"0361}\@elt{"2B53}{"02C8}\@elt{"2B54}{"02CC}\@elt{"2B55}{"02D0}%
6797 \@elt{"2B56}{"02D1}\@elt{"2B57}{"0306}\@elt{"2B58}{"203F}\@elt{"2B59}{"030B}%
6798 \@elt{"2B5A}{"0301}\@elt{"2B5B}{"0304}\@elt{"2B5C}{"0300}\@elt{"2B5D}{"030F}%
6799 \@elt{"2B5E}{"030C}\@elt{"2B5F}{"0302}\@elt{"2B60}{"02E5}\@elt{"2B61}{"02E6}%
6800 \@elt{"2B62}{"02E7}\@elt{"2B63}{"02E8}\@elt{"2B64}{"02E9}\@elt{"2B65}{"02E9}%
6801 \@elt{"2B66}{"02E5}\@elt{"2B67}{"0325}\@elt{"2B68}{"032C}\@elt{"2B69}{"0339}%
6802 \@elt{"2B6A}{"031C}\@elt{"2B6B}{"031F}\@elt{"2B6C}{"0320}\@elt{"2B6D}{"0308}%
6803 \@elt{"2B6E}{"033D}\@elt{"2B6F}{"0329}\@elt{"2B70}{"032F}\@elt{"2B71}{"02DE}%
6804 \@elt{"2B72}{"0324}\@elt{"2B73}{"0330}\@elt{"2B74}{"033C}\@elt{"2B75}{"0334}%
6805 \@elt{"2B76}{"031D}\@elt{"2B77}{"031E}\@elt{"2B78}{"0318}\@elt{"2B79}{"0319}%
6806 \@elt{"2B7A}{"032A}\@elt{"2B7B}{"033A}\@elt{"2B7C}{"033B}\@elt{"2B7D}{"0303}%
6807 \@elt{"2B7E}{"031A}\@elt{"2C21}{"2776}\@elt{"2C22}{"2777}\@elt{"2C23}{"2778}%
6808 \@elt{"2C24}{"2779}\@elt{"2C25}{"277A}\@elt{"2C26}{"277B}\@elt{"2C27}{"277C}%
6809 \@elt{"2C28}{"277D}\@elt{"2C29}{"277E}\@elt{"2C2A}{"277F}\@elt{"2C2B}{"24EB}%
6810 \@elt{"2C2C}{"24EC}\@elt{"2C2D}{"24ED}\@elt{"2C2E}{"24EE}\@elt{"2C2F}{"24EF}%
6811 \@elt{"2C30}{"24F0}\@elt{"2C31}{"24F1}\@elt{"2C32}{"24F2}\@elt{"2C33}{"24F3}%
6812 \@elt{"2C34}{"24F4}\@elt{"2C35}{"2170}\@elt{"2C36}{"2171}\@elt{"2C37}{"2172}%
6813 \@elt{"2C38}{"2173}\@elt{"2C39}{"2174}\@elt{"2C3A}{"2175}\@elt{"2C3B}{"2176}%
6814 \@elt{"2C3C}{"2177}\@elt{"2C3D}{"2178}\@elt{"2C3E}{"2179}\@elt{"2C3F}{"217A}%
6815 \@elt{"2C40}{"217B}\@elt{"2C41}{"24D0}\@elt{"2C42}{"24D1}\@elt{"2C43}{"24D2}%
6816 \@elt{"2C44}{"24D3}\@elt{"2C45}{"24D4}\@elt{"2C46}{"24D5}\@elt{"2C47}{"24D6}%
6817 \@elt{"2C48}{"24D7}\@elt{"2C49}{"24D8}\@elt{"2C4A}{"24D9}\@elt{"2C4B}{"24DA}%
6818 \@elt{"2C4C}{"24DB}\@elt{"2C4D}{"24DC}\@elt{"2C4E}{"24DD}\@elt{"2C4F}{"24DE}%
6819 \@elt{"2C50}{"24DF}\@elt{"2C51}{"24E0}\@elt{"2C52}{"24E1}\@elt{"2C53}{"24E2}%
6820 \@elt{"2C54}{"24E3}\@elt{"2C55}{"24E4}\@elt{"2C56}{"24E5}\@elt{"2C57}{"24E6}%
6821 \@elt{"2C58}{"24E7}\@elt{"2C59}{"24E8}\@elt{"2C5A}{"24E9}\@elt{"2C5B}{"32D0}%
6822 \@elt{"2C5C}{"32D1}\@elt{"2C5D}{"32D2}\@elt{"2C5E}{"32D3}\@elt{"2C5F}{"32D4}%
6823 \@elt{"2C60}{"32D5}\@elt{"2C61}{"32D6}\@elt{"2C62}{"32D7}\@elt{"2C63}{"32D8}%
6824 \@elt{"2C64}{"32D9}\@elt{"2C65}{"32DA}\@elt{"2C66}{"32DB}\@elt{"2C67}{"32DC}%
6825 \@elt{"2C68}{"32DD}\@elt{"2C69}{"32DE}\@elt{"2C6A}{"32DF}\@elt{"2C6B}{"32E0}%
6826 \@elt{"2C6C}{"32E1}\@elt{"2C6D}{"32E2}\@elt{"2C6E}{"32E3}\@elt{"2C6F}{"32FA}%
6827 \@elt{"2C70}{"32E9}\@elt{"2C71}{"32E5}\@elt{"2C72}{"32ED}\@elt{"2C73}{"32EC}%
6828 \@elt{"2C7D}{"2051}\@elt{"2C7E}{"2042}\@elt{"2D21}{"2460}\@elt{"2D22}{"2461}%
6829 \@elt{"2D23}{"2462}\@elt{"2D24}{"2463}\@elt{"2D25}{"2464}\@elt{"2D26}{"2465}%
6830 \@elt{"2D27}{"2466}\@elt{"2D28}{"2467}\@elt{"2D29}{"2468}\@elt{"2D2A}{"2469}%
6831 \@elt{"2D2B}{"246A}\@elt{"2D2C}{"246B}\@elt{"2D2D}{"246C}\@elt{"2D2E}{"246D}%
6832 \@elt{"2D2F}{"246E}\@elt{"2D30}{"246F}\@elt{"2D31}{"2470}\@elt{"2D32}{"2471}%
6833 \@elt{"2D33}{"2472}\@elt{"2D34}{"2473}\@elt{"2D35}{"2160}\@elt{"2D36}{"2161}%
6834 \@elt{"2D37}{"2162}\@elt{"2D38}{"2163}\@elt{"2D39}{"2164}\@elt{"2D3A}{"2165}%
6835 \@elt{"2D3B}{"2166}\@elt{"2D3C}{"2167}\@elt{"2D3D}{"2168}\@elt{"2D3E}{"2169}%
6836 \@elt{"2D3F}{"216A}\@elt{"2D40}{"3349}\@elt{"2D41}{"3314}\@elt{"2D42}{"3322}%
6837 \@elt{"2D43}{"334D}\@elt{"2D44}{"3318}\@elt{"2D45}{"3327}\@elt{"2D46}{"3303}%
6838 \@elt{"2D47}{"3336}\@elt{"2D48}{"3351}\@elt{"2D49}{"3357}\@elt{"2D4A}{"330D}%
6839 \@elt{"2D4B}{"3326}\@elt{"2D4C}{"3323}\@elt{"2D4D}{"332B}\@elt{"2D4E}{"334A}%
6840 \@elt{"2D4F}{"333B}\@elt{"2D50}{"339C}\@elt{"2D51}{"339D}\@elt{"2D52}{"339E}%
6841 \@elt{"2D53}{"338E}\@elt{"2D54}{"338F}\@elt{"2D55}{"33C4}\@elt{"2D56}{"33A1}%
6842 \@elt{"2D57}{"216B}\@elt{"2D5F}{"337B}\@elt{"2D60}{"301D}\@elt{"2D61}{"301F}%
6843 \@elt{"2D62}{"2116}\@elt{"2D63}{"33CD}\@elt{"2D64}{"2121}\@elt{"2D65}{"32A4}%
6844 \@elt{"2D66}{"32A5}\@elt{"2D67}{"32A6}\@elt{"2D68}{"32A7}\@elt{"2D69}{"32A8}%
6845 \@elt{"2D6A}{"3231}\@elt{"2D6B}{"3232}\@elt{"2D6C}{"3239}\@elt{"2D6D}{"337E}%
6846 \@elt{"2D6E}{"337D}\@elt{"2D6F}{"337C}\@elt{"2D73}{"222E}\@elt{"2D78}{"221F}%
6847 \@elt{"2D79}{"22BF}\@elt{"2D7D}{"2756}\@elt{"2D7E}{"261E}%
6848 }
6849
6850 \newcount\cntA
6851 \newcount\cntB
6852 \newcount\flag
6853 \def\chk@in@#1#2{{\global\flag=0\relax%
6854   \def\@elt##1{\ifnum#2=##1\global\flag=1 \fi}%
6855   #1}}
6856 \def\get@in@#1#2{{%
6857   \global\flag=0\relax%
6858   \def\@elt##1##2{\ifnum#2=##1\global\flag##2 \fi}%
6859   #1}}
6860
6861 \def\outi{%
6862 \get@in@{\jlist}{\cntA}\cntB=\flag
6863 \ifnum\cntB=0{}%
6864   \cntB=\jis\cntA{}%
6865   \ifnum\cntB=0 \else
6866     \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\cntB}}=0
6867     \def\@@@tmp{white}\else\def\@@@tmp{white!85!blue}\fi
6868     \fcolorbox{black}{\@@@tmp}{%
6869       \hbox to \zw{\gt  \hskip-\zw\ltjjachar\cntB  \hss}}\,\scriptsize%
6870     \ifnum\catcode\cntB=11 L\else\ \fi
6871     \chk@in@{\uplist}{\cntA}\ifnum\flag=1 U\else~\fi
6872     \chk@in@{\plist}{\cntA}\ifnum\flag=1 P\else~\fi
6873   \fi
6874 \else
6875   \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\cntB}}=0
6876   \def\@@@tmp{white}\else\def\@@@tmp{white!85!blue}\fi
6877   \fcolorbox{black}{\@@@tmp}{\color{red!50!black}%
6878      \hbox to \zw{\gt  \hskip-\zw\ltjjachar\cntB  \hss}}\,\scriptsize%
6879    \ifnum\catcode\cntB=11 L\else~\fi
6880   \chk@in@{\uplist}{\cntA}\ifnum\flag=1 U\else~\fi-%
6881 \fi\global\advance\cntA1 }
6882
6883 \def\out#1#2{%
6884 \midrule\global\cntA=\numexpr 8192+#1*256+#2*16\relax
6885 "#2{}x&\ifnum#2=2\global\advance\cntA1\else\outi\fi&\outi&\outi&\outi&\outi&\outi&\outi&\outi%"
6886 &\outi&\outi&\outi&\outi&\outi&\outi&\outi&\ifnum#2=7\global\advance\cntA1\else\outi\fi\\
6887 }
6888
6889 \def\test#1{{%
6890 %<en>\subsection*{Row #1}
6891 %<ja>\subsection*{第#1区}
6892 \tt\small\fboxsep=1pt\centering\tabcolsep=0.25\zw
6893 \begin{tabular}{ccccccccccccccccc}\toprule&"0&"1&"2&"3&"4&"5&"6&"7&"8&"9&"A&"B&"C&"D&"E&"F\\
6894 \out{#1}{2}\out{#1}{3}\out{#1}{4}\out{#1}{5}\out{#1}{6}\out{#1}{7}\bottomrule
6895 \end{tabular}\par}\medskip}
6896
6897 \test{1}\test{2}\test{3}\test{4}\test{5}\test{6}\test{7}\test{8}
6898 \test{9}\test{10}\test{11}\test{12}\test{13}
6899
6900 %</!zh>
6901 \errorstopmode
6902
6903 \section{Package versions used in this document}
6904 This document was typeset using the following packages:
6905
6906 \medskip
6907
6908 {\makeatletter\tt\footnotesize
6909   \def\@pkglist#1{%
6910     \filename@parse{#1}\def\@temp{sty}
6911     \ifx\@temp\filename@ext
6912       \edef\reserved@a{%
6913         \filename@base.%
6914         \ifx\filename@ext\relax tex\else\filename@ext\fi}%
6915       \leavevmode\hskip-13em\hbox to 13em{\filename@area\reserved@a\hss}%
6916       \csname ver@\reserved@a\endcsname\par
6917     \fi
6918   }%
6919 \parindent0pt\leftskip13em
6920 \ltjpkglist
6921
6922 \makeatother}
6923 \end{document}
6924 %</!showexpl>
6925 %<*showexpl>
6926 %%
6927 %% config file for showexpl.sty
6928 %%
6929 %% Copyright The LuaTeX-ja project team, 2012
6930 %%
6931 \ProvidesFile{showexpl.cfg}
6932   [2012/05/20 v0.01 Definitions for the showexpl package (luatexja)]
6933 \lstset{}
6934 \def\SX@Info{}
6935 \endinput
6936 %</*showexpl>