OSDN Git Service

Merge branch 'kmaeda-manual' into kitagawa_test
[luatex-ja/luatexja.git] / doc / manual.dtx
1 %#! lualatex -shell-escape manual.ins
2
3 %<*en>
4 \documentclass[a4paper,titlepage]{article}
5 \usepackage[margin=25mm,footskip=5mm]{geometry}
6 %</en>
7 %<*ja>
8 \documentclass[a4paper,titlepage]{ltjsarticle}
9 \usepackage[margin=25mm, footskip=5mm]{geometry}
10 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
11 %</ja>
12
13 \usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float,makecell}
14 \usepackage{booktabs,listings,showexpl,multicol}
15 \usepackage{luatexja-otf}
16 \usepackage{luatexja-fontspec}
17 \usepackage[unicode]{hyperref}
18 \usepackage[all]{xy}
19 \SelectTips{cm}{}
20 \def\labelenumii{(\arabic{enumii})}
21
22 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
23 \DeclareRobustCommand\LuaTeX{Lua\TeX}
24 \DeclareRobustCommand\pdfTeX{pdf\TeX}
25 \DeclareRobustCommand\pTeX{p\kern-.05em\TeX}
26 \DeclareRobustCommand\upTeX{up\kern-.05em\TeX}
27 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
28 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
29 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
30
31 \ltjsetparameter{jacharrange={-3}}
32 \ltjdefcharrange{6}{`■,`…,`→,`←,`↓,`↑,`─}
33 \theoremstyle{definition}
34 %<en>\newtheorem{defn}{Definition}
35 %<ja>\newtheorem{defn}{定義}
36
37 \newenvironment{cslist}{%
38   \leftskip2em\parindent=0pt\def\makelabel##1{{\tt\char92##1}}
39   \def\{{\char`\{}\def\}{\char`\}}
40   \let\origitem=\item
41   \def\item[##1]{\par\smallskip\par\hskip-\leftskip\makelabel{##1}\par}
42 }{}
43
44 \makeatletter
45 \long\def\@makecaption#1#2{%
46   \vskip\abovecaptionskip
47   \sbox\@tempboxa{{\small #1. #2}}%
48   \ifdim \wd\@tempboxa >\hsize
49     {\small #1. #2}\par
50   \else
51     \global \@minipagefalse
52     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
53   \fi
54   \vskip\belowcaptionskip}
55 % Suppress output from showexpl to stdout.
56 \let\SX@Info\relax
57 \makeatother
58
59 \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr
60   #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}}
61
62 %<*en>
63 \title{The \LuaTeX-ja package}
64 \author{The \LuaTeX-ja project team}
65 %</en>
66 %<*ja>
67 \title{\LuaTeX-jaパッケージ}
68 \author{\LuaTeX-jaプロジェクトチーム}
69 %</ja>
70
71 \lstset{
72   basicstyle=\ttfamily\small, pos=o, breaklines=true,
73   numbers=none, rframe={}, basewidth=0.5em
74 }
75
76 \parskip=\smallskipamount
77 \protected\def\Param#1{\textsf{#1}} % parameter name
78 \protected\def\Pkg#1{\underline{\smash{\texttt{#1}}}} % packages/classes
79
80 \begin{document}
81 \catcode`\<=13
82 \def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
83 \maketitle
84
85 \tableofcontents
86 \bigskip
87
88 %<*en>
89 \textbf{This documentation is far from complete. It may have many
90 grammatical (and contextual) errors.}
91 %</en>
92 %<*ja>
93 \textbf{\large 本ドキュメントはまだまだ未完成です.}
94 %</ja>
95
96 \clearpage
97 %<en>\part{User's manual}
98 %<ja>\part{ユーザーズマニュアル}
99
100 %<en>\section{Introduction}
101 %<ja>\section{はじめに}
102
103 %<*en>
104 The \LuaTeX-ja package is a macro package for typesetting high-quality
105 Japanese documents when using \LuaTeX.
106 %</en>
107 %<*ja>
108 \LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
109 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
110 %</ja>
111
112 %<en>\subsection{Backgrounds}
113 %<ja>\subsection{背景}
114
115 %<*en>
116 Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
117 are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
118 extension of \TeX: so it can produce high-quality Japanese documents
119 without using very complicated macros. But this point is a mixed
120 blessing: \pTeX\ is left behind from other extensions of \TeX,
121 especially \eTeX\ and \pdfTeX, and from changes about
122 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
123 %</en>
124 %<*ja>
125 従来,「\TeX を用いて日本語組版を行う」といったとき,エンジンとしては
126 ASCII \pTeX やそれの拡張物が用いられることが一般的であった.\pTeX は\TeX
127 のエンジン拡張であり,(少々仕様上不便な点はあるものの)商業印刷の分野に
128 も用いられるほどの高品質な日本語組版を可能としている.だが,それは弱点に
129 もなってしまった:\pTeX という(組版的に)満足なものがあったため,海外で
130 行われている数々の\TeX の拡張──例えば\eTeX や\pdfTeX ──や,TrueType,
131 OpenType, Unicodeといった計算機で日本語を扱う際の状況の変化に追従すること
132 を怠ってしまったのだ.
133 %</ja>
134
135 %<*en>
136 Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
137 of \pTeX) and \epTeX\ (merging of \pTeX\ and
138 \eTeX\ extension), have developed to fill those gaps to some
139 extent, but gaps still exist.
140 %</en>
141 %<*ja>
142 ここ数年,若干状況は改善されてきた.現在手に入る大半の\pTeX バイナリでは
143 外部UTF-8入力が利用可能となり,さらにUnicode化を推進し,\pTeX の内部処理
144 までUnicode化した\upTeX も開発されている.また,\pTeX に\eTeX 拡張をマー
145 ジした\epTeX も登場し,\TeX\ Live\ 2011では\pLaTeX が\epTeX の上で動作す
146 るようになった.だが,\pdfTeX 拡張(PDF 直接出力やmicro-typesetting)を
147 \pTeX に対応させようという動きはなく,海外とのgapは未だにあるのが現状であ
148 る.
149 %</ja>
150
151 %<*en>
152 However, the appearance of \LuaTeX\ changed the whole situation. With
153 using Lua `callbacks', users can customize the internal processing of
154 \LuaTeX. So there is no need to modify sources of engines to
155 support Japanese typesetting: to do this, we only have to write Lua
156 scripts for appropriate callbacks.
157 %</en>
158 %<*ja>
159 しかし,\LuaTeX の登場で,状況は大きく変わることになった.Luaコードで
160 `callback'を書くことにより,\LuaTeX の内部処理に割り込みをかけることが可
161 能となった.これは,エンジン拡張という真似をしなくても,Luaコードとそれに
162 関する\TeX マクロを書けば,エンジン拡張とほぼ同程度のことができるようになっ
163 たということを意味する.\LuaTeX-jaは,このアプローチによってLuaコード・
164 \TeX マクロによって日本語組版を\LuaTeX の上で実現させようという目的で開発
165 が始まったパッケージである.
166 %</ja>
167
168 %<en>\subsection{Major Changes from \pTeX}
169 %<ja>\subsection{\pTeX からの主な変更点}
170
171 %<*en>
172 The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
173 target of development was to implement features of \pTeX. However,
174 \emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
175 specifications/behaviors of \pTeX\ were not adopted}.
176 %</en>
177 %<*ja>
178 \LuaTeX-jaは,\pTeX に多大な影響を受けている.初期の開発目標は,\pTeX の機
179 能をLuaコードにより実装することであった.しかし,開発が進むにつれ,\pTeX
180 の完全な移植は不可能であり,また\pTeX における実装がいささか不可解になっ
181 ているような状況も発見された.そのため,\textbf{\LuaTeX-ja は,もはや
182 \pTeX の完全な移植は目標とはしない.\pTeX における不自然な仕様・挙動があ
183 れば,そこは積極的に改める.}
184 %</ja>
185
186 %<*en>
187 The followings are major changes from \pTeX:
188 %</en>
189 %<*ja>
190 以下は \pTeX からの主な変更点である.
191 %</ja>
192
193 \begin{itemize}
194 %<*en>
195 \item A Japanese font is a tuple of a `real' font, a Japanese font
196       metric (\textbf{JFM}, for short), and an optional string called
197       `variation'.
198 %</en>
199 %<*ja>
200 \item 和文フォントは(小塚明朝,IPA明朝などの)実際のフォント,和文フォントメトリック(JFM と呼ぶ),そ
201       して `variation' と呼ばれる文字列の組である.
202 %</ja>
203
204 %<*en>
205 \item In \pTeX, a line break after Japanese character is ignored (and
206       doesn't yield a space), since line breaks (in source files) are
207       permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
208       doesn't have this function completely, because of a specification
209       of \LuaTeX.
210 %</en>
211 %<*ja>
212 \item 日本語の文書中では改行はほとんどどこでも許されるので,\pTeX では和文文字
213       直後の改行は無視される(スペースが入らない)ようになっていた.しかし,
214       \LuaTeX-ja では \LuaTeX の仕様のためにこの機能は完全には実装されていない.
215 %</ja>
216
217 %<*en>
218 \item The insertion process of glues/kerns between two Japanese
219       characters and between a Japanese character and other characters
220       (we refer these glues/kerns as \textbf{JAglue}) is rewritten from
221       scratch.
222 %</en>
223 %<*ja>
224 \item 2つの和文文字の間,和文文字と欧文文字の間に入るグルー/カーン
225       (\textbf{JAglue} と呼ぶ)の挿入処理が0から書き直されている.
226 %</ja>
227
228 \begin{itemize}
229 %<*en>
230 \item As \LuaTeX's internal character handling is `node-based'
231       (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
232       insertion process of \textbf{JAglue} is now `node-based'.
233 %</en>
234 %<*ja>
235 \item \LuaTeX の内部での文字の扱いが「ノードベース」になっているように(例えば,
236       \verb+of{}fice+ で合字は抑制されない),\textbf{JAglue} の挿入処理も
237       「ノードベース」である.
238 %</ja>
239
240 %<*en>
241 \item Furthermore, nodes between two characters which have no effects in
242       line break (\textit{e.g.}, \verb+\special+ node) and kerns from
243       italic correction are ignored in the insertion process.
244 %</en>
245 %<*ja>
246 \item さらに,2つの文字の間にある行末では効果を持たないノード(例えば
247       \verb+\special+ ノード)や,イタリック補正に伴い挿入されるカーンは
248       挿入処理中では無視される.
249 %</ja>
250
251 %<*en>
252 \item \emph{Caution: due to above two points, many methods which did the
253       dividing the process of the insertion of \textbf{JAglue} in \pTeX\ are not
254       effective anymore.} In concrete terms, the following two methods are not effective anymore:
255 %</en>
256 %<*ja>
257 \item \textbf{注意:上の2つの変更により,従来 \textbf{JAglue} の挿入処理を分断するのに
258       使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:}
259 %</ja>
260 \begin{verbatim}
261   ちょ{}っと  ちょ\/っと
262 \end{verbatim}
263 %<*en>
264       If you want to do so, please put an empty hbox between it instead:
265 %</en>
266 %<*ja>
267       もし同じことをやりたければ,空のhboxを間に挟めばよい:
268 %</ja>
269 \begin{verbatim}
270   ちょ\hbox{}っと
271 \end{verbatim}
272
273
274 %<*en>
275 \item In the process, two Japanese fonts which only differ in their `real'
276       fonts are identified.
277 %</en>
278 %<*ja>
279 \item 処理中では,2つの和文フォントは,「実際の」フォントのみが異なる場合に同一視
280       される.
281 %</ja>
282 \end{itemize}
283
284 %<*en>
285 \item At the present, vertical typesetting (\emph{tategaki}), is not
286       supported in \LuaTeX-ja.
287 %</en>
288 %<*ja>
289 \item 現時点では,縦書きは \LuaTeX-ja ではサポートされていない.
290 %</ja>
291
292 \end{itemize}
293
294 %<*en>
295 For detailed information, see Part~\ref{part-imp}.
296 %</en>
297 %<*ja>
298 詳細については第 \ref{part-imp} 部を見よ.
299 %</ja>
300
301 %<en>\subsection{Notations}
302 %<ja>\subsection{用語と記法}
303
304 %<*en>
305 In this document, the following terms and notations are used:
306 %</en>
307 %<*ja>
308 本ドキュメントでは,以下の用語と記法を用いる:
309 %</ja>
310
311 \begin{itemize}
312 %<*en>
313 \item Characters are divided into two types:
314 %</en>
315 %<*ja>
316 \item 文字は2種類に分けられる:
317 %</ja>
318 \begin{itemize}
319 %<*en>
320 \item \textbf{JAchar}: standing for Japanese characters such as
321       Hiragana, Katakana, Kanji and other punctuation marks for
322       Japanese.
323 %</en>
324 %<*ja>
325 \item \textbf{JAchar}: ひらがな,カタカナ,漢字,和文用の約物といった和文文字の
326       ことを指す.
327 %</ja>
328
329 %<*en>
330 \item \textbf{ALchar}: standing for all other characters like alphabets.
331 %</en>
332 %<*ja>
333 \item \textbf{ALchar}: アルファベットを始めとする,その他全ての文字を指す.
334 %</ja>
335 \end{itemize}
336
337 %<*en>
338 We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts' for fonts used in \textbf{JAchar}.
339 %</en>
340 %<*ja>
341 そして,\textbf{ALchar} の出力に用いられるフォントを「欧文フォント」と呼び,
342 \textbf{JAchar} の出力に用いられるフォントを「和文フォント」と呼ぶ.
343 %</ja>
344
345 %<*en>
346 \item A word in a sans-serif font (like \Param{prebreakpenalty})
347       means an internal parameter for Japanese typesetting, and it
348       is used as a key in \verb+\ltjsetparameter+ command.
349 %</en>
350 %<*ja>
351 \item サンセリフ体で書かれた語(例:\Param{prebreakpenalty})は日本語組版用の
352       パラメータを表し,これらは \verb+\ltjsetparameter+ コマンドのキーとして
353       用いられる.
354 %</ja>
355
356 %<*en>
357 \item A word in typewriter font with underline (like \Pkg{fontspec})
358       means a package or a class of \LaTeX.
359 %</en>
360 %<*ja>
361 \item 下線付きのタイプライタ体で書かれた語(例:\Pkg{fontspec})は \LaTeX の
362       パッケージやクラスを表す.
363 %</ja>
364
365 %<*en>
366 \item The word `primitive' is used not only for primitives in \LuaTeX,
367       but also for control sequences that defined in the core module of
368       \LuaTeX-ja.
369 %</en>
370 %<*ja>
371 \item 「プリミティブ」という語を,\LuaTeX のプリミティブだけではなく \LuaTeX-ja
372       のコアモジュールで定義されたコントロールシーケンスに対しても用いる.
373 %</ja>
374
375 %<*en>
376 \item In this document, natural numbers start from~0.
377 %</en>
378 %<*ja>
379 \item 本ドキュメントでは,自然数は0から始まる.
380 %</ja>
381 \end{itemize}
382
383 %<en>\subsection{About the project}
384 %<ja>\subsection{プロジェクトについて}
385
386 %<*en>
387 \paragraph{Project Wiki} Project Wiki is under construction.
388 %</en>
389 %<*ja>
390 \paragraph{プロジェクト Wiki} プロジェクト Wiki は構築中である.
391 %</ja>
392
393 %<*en>
394 \begin{itemize}
395 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
396 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
397 \end{itemize}
398 %</en>
399 %<*ja>
400 \begin{itemize}
401 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
402 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
403 \end{itemize}
404 %</ja>
405
406 %<*en>
407 This project is hosted by SourceForge.JP.
408 %</en>
409 %<*ja>
410 本プロジェクトは SourceForge.JP のサービスを用いて運営されている.
411 %</ja>
412
413 %<en>\paragraph{Members}\
414 %<ja>\paragraph{開発メンバー}\
415 %<*en>
416 \begin{multienumerate}
417 \def\labelenumi{$\bullet$}
418 \mitemxxx{Hironori KITAGAWA}{Kazuki MAEDA}{Takayuki YATO}
419 \mitemxxx{Yusuke KUROKI}{Noriyuki ABE}{Munehiro YAMAMOTO}
420 \mitemxxx{Tomoaki HONDA}{Shuzaburo SAITO}{MA Qiyuan}
421 \end{multienumerate}
422 %</en>
423 %<*ja>
424 \begin{multienumerate}
425 \def\labelenumi{$\bullet$}
426 \mitemxxx{北川 弘典}{前田 一貴}{八登 崇之}
427 \mitemxxx{黒木 裕介}{阿部 紀行}{山本 宗宏}
428 \mitemxxx{本田 知亮}{齋藤 修三郎}{馬 起園}
429 \end{multienumerate}
430 %</ja>
431
432
433 % \paragraph{Acknowledgments} -- 挿入するならここ
434
435 \clearpage
436 %<en>\section{Getting Started}
437 %<ja>\section{使い方}
438 %<en>\subsection{Installation}
439 %<ja>\subsection{インストール}
440
441 %<*en>
442 To install the \LuaTeX-ja\ package, you will need:
443 %</en>
444 %<*ja>
445 \LuaTeX-ja パッケージのインストールには,次のものが必要である.
446 %</ja>
447 \begin{itemize}
448 %<*en>
449 \item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.\\
450 If you are using \TeX~Live~2011 or current W32\TeX, you don't have to worry.
451 %</en>
452 %<*ja>
453 \item \LuaTeX(バージョン 0.65.0-beta 以降)とその支援パッケージ.
454       \TeX~Live~2011 や W32\TeX の最新版ならば問題ない.
455 %</ja>
456 %<*en>
457 \item The source archive of \LuaTeX-ja, of course\texttt{:)}
458 %</en>
459 %<*ja>
460 \item \LuaTeX-ja のソースアーカイブ(もちろん \texttt{:)}).
461 %</ja>
462 \end{itemize}
463
464 %<*en>
465 The installation methods are as follows:
466 %</en>
467 %<*ja>
468 インストール方法は以下のようになる:
469 %</ja>
470 \begin{enumerate}
471 %<*en>
472 \item Download the source archive.
473
474       At the present, \LuaTeX-ja has no official release, so you have to retrieve
475       the archive from the repository.
476       You can retrieve the Git repository via
477 %</en>
478 %<*ja>
479 \item ソースアーカイブをダウンロードする.
480
481       現時点では,\LuaTeX-ja の公式リリースはまだない.そのため,Git レポジトリを
482       次のようにすることで取得する必要がある:
483 %</ja>
484 \begin{verbatim}
485 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
486 \end{verbatim} 
487 %<*en>
488       or download the archive of HEAD in \texttt{master} branch from
489 %</en>
490 %<*ja>
491       もしくは,\texttt{master} ブランチの HEAD のアーカイブを以下からダウンロードしてもよい:
492 %</ja>
493 \begin{flushleft}
494 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
495 \end{flushleft}
496
497 %<*en>
498 Note that the forefront of development may not be in \texttt{master} branch.
499 %</en>
500 %<*ja>
501 \texttt{master} ブランチはたまにしか更新されない.
502 最新の開発中のコードは \texttt{master} ブランチには含まれていない場合がかなり多いので注意.
503 %</ja>
504
505 %<*en>
506 \item Extract the archive. You will see \texttt{src/} and several other sub-directories.
507 %</en>
508 %<*ja>
509 \item 後者の方法でアーカイブ取得したならば,それを展開する.
510       \texttt{src/} をはじめとしたいくつかのディレクトリができるが,
511       動作には \texttt{src/} 以下の内容だけで十分.
512 %</ja>
513
514 %<*en>
515 \item Copy all the contents of \texttt{src/} into one of your \texttt{TEXMF} tree.
516 %</en>
517 %<*ja>
518 \item \texttt{src/} の中身全てを自分の \texttt{TEXMF} ツリーにコピーする.
519       シンボリックリンクが利用できる環境で,かつレポジトリを直接取得したのであれば,コピーではなく
520       リンクを貼るのが適切だろう.
521 %</ja>
522
523 %<*en>
524 \item If \texttt{mktexlsr} is needed to update the file name database, make it so.
525 %</en>
526 %<*ja>
527 \item 必要があれば,\texttt{mktexlsr} を実行する.
528 %</ja>
529 \end{enumerate}
530
531 %<en>\subsection{Cautions}
532 %<ja>\subsection{注意点}
533
534 \begin{itemize}
535 %<*en>
536 \item The encoding of your source file must be UTF-8. No other
537       encodings, such as EUC-JP or Shift-JIS, are not supported.
538 %</en>
539 %<*ja>
540 \item 原稿のソースファイルの文字コードは UTF-8 固定である.
541       従来日本語の文字コードとして用いられてきた EUC-JP や Shift-JIS は使用できない.
542 %</ja>
543
544 %<*en>
545 \item May be conflict with other packages.
546
547       For example, the default setting of \textbf{JAchar} in the present
548       version does not coexist with the \Pkg{unicode-math}
549       package. Putting the following line in preamble makes that
550       mathematical symbols will be typeset correctly, but several
551       Japanese characters will be treated as an \textbf{ALchar} as
552       side-effect:
553 %</en>
554 %<*ja>
555 \item いくつかのパッケージと衝突する.
556
557       例えば,\textbf{JAchar} の範囲の設定がデフォルトのままだと,現行の
558       バージョンでは \Pkg{unicode-math} パッケージと共存できない.
559       以下の行をプリアンブルに追加することで数学記号が正しく出るように
560       なるが,副作用としていくつかの和文文字が \textbf{ALchar} として
561       扱われるようになってしまう:
562 %</ja>
563 \begin{verbatim}
564 \ltjsetparameter{jacharrange={-3, -8}}
565 \end{verbatim}
566 \end{itemize}
567
568 %<en>\subsection{Using in plain \TeX}
569 %<ja>\subsection{plain \TeX で使う}
570 \label{ssec-plain}
571
572 %<*en>
573 To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
574 %</en>
575 %<*ja>
576 \LuaTeX-ja を plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
577 %</ja>
578 \begin{verbatim}
579 \input luatexja.sty
580 \end{verbatim}
581 %<*en>
582 This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents:
583 %</en>
584 %<*ja>
585 これで(\texttt{ptex.tex} のように)日本語組版のための最低限の設定がなされる:
586 %</ja>
587
588 \begin{itemize}
589 %<*en>
590 \item The following 6~Japanese fonts are preloaded:
591 \begin{center}
592 \begin{tabular}{ccccc}
593 \toprule
594 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
595 \emph{mincho}&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
596 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
597 \bottomrule
598 \end{tabular}
599 \end{center}
600 %</en>
601 %<*ja>
602 \item 以下の6つの和文フォントが定義される:
603 \begin{center}
604 \begin{tabular}{ccccc}
605 \toprule
606 \textbf{字体}&\textbf{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
607 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
608 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
609 \bottomrule
610 \end{tabular}
611 \end{center}
612 %</ja>
613 \begin{itemize}
614 %<*en>
615 \item The `Q(級)' is a unit used in Japanese phototypesetting, and
616       $1\,\textrm{Q}=0.25\,\textrm{mm}$. This length is stored in a
617       dimension \verb+\jQ+.
618 %</en>
619 %<*ja>
620 \item `Q(級)' は日本の写植で用いられる単位で,$1\,\textrm{Q}=0.25\,\textrm{mm}$
621       である.この長さは \verb+\jQ+ に保持されている.
622 %</ja>
623
624 %<*en>
625 \item It is widely accepted that the font `Ryumin-Light' and
626       `GothicBBB-Medium' aren't embedded into PDF files, and PDF reader
627       substitute them by some external Japanese fonts (\textit{e.g.},
628       Kozuka Mincho is used for Ryumin-Light in Adobe Reader). We adopt this custom to
629       the default setting.
630 %</en>
631 %<*ja>
632 \item `Ryumin-Light' と `GothicBBB-Medium' は PDF ファイルに埋め込まずに
633       名前参照のみで用いることが広く受け入れられており,この場合 PDF リーダーが
634       適切な外部フォントで代用する(例えば,Adobe Reader では Ryumin-Light は
635       小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと
636       して採用する.
637 %</ja>
638
639 %<*en>
640 \item A character in an alphabetic font is generally smaller than a
641       Japanese font in the same size. So actual size specification of
642       these Japanese fonts is in fact smaller than that of alphabetic
643       fonts, namely scaled by 0.962216.
644 %</en>
645 %<*ja>
646 \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも
647       一般に小さくデザインされている.そこで,標準ではこれらの和文フォントの実際のサイズは指定された値よりも
648       小さくなるように設定されており,具体的には指定の 0.962216 倍にスケールされる.
649       この 0.962216 という数値も,p\TeX におけるスケーリングを踏襲した値である.
650 %</ja>
651 \end{itemize}
652
653 %<*en>
654 \item The amount of glue that are inserted between a \textbf{JAchar} and
655       an \textbf{ALchar} (the parameter \Param{xkanjiskip}) is set to
656 %</en>
657 %<*ja>
658 \item \textbf{JAchar} と \textbf{ALchar} の間に入るグルー (\Param{xkanjiskip}) の
659       量は次のように設定されている:
660 %</ja>
661 \[
662  (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}}
663  = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}.
664 \]
665 \end{itemize}
666
667 %<en>\subsection{Using in \LaTeX}
668 %<ja>\subsection{\LaTeX で使う}
669 \label{ssec-ltx}
670
671 \paragraph{\LaTeXe}
672
673 %<*en>
674 Using in \LaTeXe\ is basically same. To set up the minimal environment
675 for Japanese, you only have to load \texttt{luatexja.sty}:
676 %</en>
677 %<*ja>
678 \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を
679 設定するためには,\texttt{luatexja.sty} を読み込むだけでよい:
680 %</ja>
681 \begin{verbatim}
682 \usepackage{luatexja}
683 \end{verbatim}
684 %<*en>
685 It also does minimal settings (counterparts in \pLaTeX\ are \texttt{
686 plfonts.dtx} and \texttt{pldefs.ltx}):
687 %</en>
688 %<*ja>
689 これで \pLaTeX の \texttt{plfonts.dtx} と \texttt{pldefs.ltx} に相当する最低限の設定が
690 なされる:
691 %</ja>
692
693 \begin{itemize}
694 %<*en>
695 \item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
696 When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
697 %</en>
698 %<*ja>
699 \item \texttt{JY3} は和文フォント用のフォントエンコーディングである(横書き用).\\
700 将来的に,\LuaTeX-ja で縦書きがサポートされる際には,\texttt{JT3} を縦書き用として
701 用いる予定である.
702 %</ja>
703
704 %<*en>
705 \item Two font families \texttt{mc} and \texttt{gt} are defined:
706 \begin{center}
707 \begin{tabular}{ccccc}
708 \toprule
709 \textbf{classification}&\textbf{family}&\verb+\mdseries+&\verb+\bfseries+&\textbf{scale}\\\midrule
710 \emph{mincho}&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
711 \emph{gothic}&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
712 \bottomrule
713 \end{tabular}
714 \end{center}
715 Remark that the bold series in both family are same as the medium series of \emph{gothic} family.
716 This is a convention in \pLaTeX. This is a trace that there were only 2~fonts (these are Ryumin-Light
717 and GothicBBB-Medium) in early years of DTP.
718 %</en>
719 %<*ja>
720 \item 2つのフォントファミリ \texttt{mc} と \texttt{gt} が定義されている:
721 \begin{center}
722 \begin{tabular}{ccccc}
723 \toprule
724 \textbf{字体}&\textbf{ファミリ}&\verb+\mdseries+&\verb+\bfseries+&\textbf{スケール}\\\midrule
725 明朝体&\tt mc&Ryumin-Light    &GothicBBB-Medium&0.962216\\
726 ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
727 \bottomrule
728 \end{tabular}
729 \end{center}
730 どちらのファミリにおいても,その bold シリーズはゴシック体の medium シリーズで
731 あることに注意.これは初期の DTP において和文フォントが2つ(それがちょうど\
732 Ryumin-Light, GothicBBB-Medium だった)しか利用できなかった時の名残であり,\pLaTeX{}
733 での標準設定とも同じである.
734 %</ja>
735
736 %<*en>
737 \item Japanese characters in math mode are typeset by the font family \texttt{mc}.
738 %</en>
739 %<*ja>
740 \item 数式モード中の和文文字は \texttt{mc} ファミリで出力される.
741 %</ja>
742 \end{itemize}
743
744 %<*en>
745 However, above settings are not sufficient for Japanese-based
746 documents. To typeset Japanese-based documents, you are better to use
747 class files other than \texttt{article.cls}, \texttt{book.cls}, and so on.  At
748 the present, we have the counterparts of \Pkg{jclasses} (standard
749 classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
750 Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
751 %</en>
752 %<*ja>
753 しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
754 日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls} といった
755 欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
756 現時点では,\Pkg{jclasses} (\pLaTeX の標準クラス)と \Pkg{jsclasses}
757 (奥村晴彦氏によるクラスファイル)に対応するものとして,\Pkg{ltjclasses},
758 \Pkg{ltjsclasses} がそれぞれ用意されている.
759 %</ja>
760
761 %<*en>
762 \paragraph{\texttt{\char92 CID, \texttt{\char92 UTF}} and macros in OTF package}
763 Under \pLaTeX, \Pkg{otf} package (developed by Shuzaburo Saito) is
764 used for typesetting characters which is in Adobe-Japan1-6 CID but not
765 in JIS~X~0208. Since this package is widely used, \LuaTeX-ja
766 supports some of functions in \Pkg{otf} package.
767 If you want to use these functions, load \Pkg{luatexja-otf} package.
768 %</en>
769 %<*ja>
770 \paragraph{\texttt{\char92 CID, \texttt{\char92 UTF}} と OTF パッケージのマクロ}
771 \pLaTeX では,JIS~X~0208 にない Adobe-Japan1-6 の文字を出力するために,
772 齋藤修三郎氏による \Pkg{otf} パッケージが用いられていた.このパッケージは
773 広く用いられているため,\LuaTeX-ja においても \Pkg{otf} パッケージの機能の
774 一部をサポートしている.これらの機能を用いるためには \Pkg{luatexja-otf} パッケージ
775 を読み込めばよい.
776 %</ja>
777
778 \begin{LTXexample}
779 森\UTF{9DD7}外と内田百\UTF{9592}とが\UTF{9AD9}島屋に行く。
780
781 \CID{7652}飾区の\CID{13706}野家,
782 葛飾区の吉野家
783 \end{LTXexample}
784 %lltjp-listings.sty要修正?:↑「森」の直後で改行.
785
786
787 %<en>\subsection{Changing Fonts}
788 %<ja>\subsection{フォントの変更}
789 \label{ssub-chgfnt}
790
791 %<*en>
792 \paragraph{Remark: Japanese Characters in Math Mode}
793 Since \pTeX\ supports Japanese characters in math mode, there are
794 sources like the following:
795 %</en>
796 %<*ja>
797 \paragraph{意見:数式モード中の和文文字}
798 \pTeX では,特に何もしないでも数式中に和文文字を記述することができた.そのため,
799 以下のようなソースが見られた:
800 %</ja>
801 \begin{LTXexample}
802 $f_{高温}$~($f_{\text{high temperature}}$).
803 \[ y=(x-1)^2+2\quad よって\quad y>0 \]
804 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
805 \end{LTXexample}
806 %<*en>
807 We (the project members of \LuaTeX-ja) think that using
808 Japanese characters in math mode are allowed if and only if these are used as identifiers.
809 In this point of view,
810 %</en>
811 %<*ja>
812 \LuaTeX-ja プロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる
813 ときのみ許されると考えている.
814 この観点から,
815 %</ja>
816 \begin{itemize}
817 %<*en>
818 \item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and
819 `よって' is used as a conjunction.
820 %</en>
821 %<*ja>
822 \item 上記数式のうち 1, 2 行目は正しくない.なぜならば `高温' が意味のあるラベルと
823       して,`よって' が接続詞として用いられているからである.
824 %</ja>
825 %<*en>
826 \item However, the line~3 is correct, since `素' is used as an identifier.
827 %</en>
828 %<*ja>
829 \item しかしながら,3行目は `素' が識別子として用いられているので正しい.
830 %</ja>
831 \end{itemize}
832 %<*en>
833 Hence, in our opinion, the above input should be corrected as:
834 %</en>
835 %<*ja>
836 したがって,\LuaTeX-ja プロジェクトの意見としては,上記の入力は次のように直されるべき
837 である:
838 %</ja>
839 \begin{LTXexample}
840 $f_{\text{高温}}$~%
841 ($f_{\text{high temperature}}$).
842 \[ y=(x-1)^2+2\quad
843   \mathrel{\text{よって}}\quad y>0 \]
844 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
845 \end{LTXexample}
846 %BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない.
847 %<*en>
848 We also believe that using Japanese characters as identifiers is rare,
849 hence we don't describe how to change Japanese fonts in math mode in
850 this chapter. For the method, please see Part~\ref{part-ref}.
851 %</en>
852 %<*ja>
853 また \LuaTeX-ja プロジェクトでは,和文文字が識別子として用いられることはほとんどない
854 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
855 記述しない.この方法については第 \ref{part-ref} 部を参照のこと.
856 %</ja>
857
858 %<*en>
859 \paragraph{plain \TeX}
860 To change Japanese fonts in plain \TeX, you must use the primitive
861 \verb+\jfont+. So please see Part~\ref{part-ref}.
862 %</en>
863 %<*ja>
864 \paragraph{plain \TeX}
865 plain \TeX で和文フォントを変更するためには,\verb+\jfont+ プリミティブを用いなけれ
866 ばならない.第 \ref{part-ref} 部を参照せよ.
867 %</ja>
868
869 %<*en>
870 \paragraph{NFSS2}
871 For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (in \texttt{plfonts.dtx}).
872 %</en>
873 %<*ja>
874 \paragraph{NFSS2}
875 \LaTeXe については,\LuaTeX-ja ではフォント選択システムを \pLaTeXe\ (\texttt{plfonts.dtx})
876 の大部分を採用している.
877 %</ja>
878 \begin{itemize}
879 %<*en>
880 \item Two control sequences \verb+\mcdefault+ and \verb+\gtdefault+ are
881       used to specify the default font families for \emph{mincho} and
882       \emph{gothic}, respectively. Default values: \texttt{mc} for
883       \verb+\mcdefault+ and \texttt{gt} for \verb+\gtdefault+.
884 %</en>
885 %<*ja>
886 \item 2つのコントロールシーケンス \verb+\mcdefault+ と \verb+\gtdefault+ がそれぞ
887       れ明朝体とゴシック体のデフォルトのフォントファミリを指定するために用いられる.
888       初期値:\verb+\mcdefault+ は \texttt{mc},\verb+\gtdefault+ は \texttt{gt}.
889 %</ja>
890 %<*en>
891 \item Commands \verb+\fontfamily+, \verb+\fontseries+,
892       \verb+\fontshape+ and \verb+\selectfont+ can be used to change
893       attributes of Japanese fonts.
894 %</en>
895 %<*ja>
896 \item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして
897       \verb+\selectfont+ が和文フォントの属性を変更するために使用できる.
898 %</ja>
899
900 %<*en>
901 \begin{center}
902 \begin{tabular}{cccccc}
903 \toprule
904 &\textbf{encoding}&\textbf{family}&\textbf{series}&\textbf{shape}&\textbf{selection}\\\midrule
905 alphabetic fonts
906 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
907 &\verb+\useroman+\\
908 Japanese fonts
909 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
910 &\verb+\usekanji+\\
911 both&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
912 auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
913 \bottomrule
914 \end{tabular}
915 \end{center}
916 %</en>
917 %<*ja>
918 \begin{center}
919 \begin{tabular}{cccccc}
920 \toprule
921 &\textbf{エンコーディング}&\textbf{ファミリ}&\textbf{シリーズ}&\textbf{シェープ}&\textbf{選択}\\\midrule
922 欧文フォント
923 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
924 &\verb+\useroman+\\
925 和文フォント
926 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
927 &\verb+\usekanji+\\
928 両方&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
929 自動選択&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
930 \bottomrule
931 \end{tabular}
932 \end{center}
933 %</ja>
934
935 %<*en>
936       \verb+\fontencoding{<encoding>}+ changes the encoding of alphabetic fonts
937       or Japanese fonts depending on the argument. For example,
938       \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to
939       \texttt{JY3} and \verb+\fontencoding{T1}+ changes the encoding of
940       alphabetic fonts to \texttt{T1}.
941       \verb+\fontfamily+ also changes the family of Japanese fonts, alphabetic
942       fonts, \emph{or both}. For detail, see Subsection~\ref{ssub-nfsspat}.
943 %</en>
944 %<*ja>
945       ここで,\verb+\fontencoding{<encoding>}+は,引数により和文側か欧文
946       側かのどちらかのエンコーディングを変更する.例えば,
947       \verb+\fontencoding{JY3}+は和文フォントのエンコーディングを
948       \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を
949       \texttt{T1}へと変更する.\verb+\fontfamily+も引数により和文側,欧文
950       側,\textbf{あるいは両方}のフォントファミリを変更する.詳細は
951       \ref{ssub-nfsspat}節を参照すること.
952 %</ja>
953
954 %<*en>
955 \item For defining a Japanese font family, use
956       \verb+\DeclareKanjiFamily+ instead of
957       \verb+\DeclareFontFamily+. However, in the present implementation,
958       using \verb+\DeclareFontFamily+ doesn't cause any problem.
959 %</en>
960 %<*ja>
961 \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の代わりに
962       \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の実装では
963       \verb+\DeclareFontFamily+ を用いても問題は生じない.
964 %</ja>
965 \end{itemize}
966
967 \subsection{fontspec}
968 %<*en>
969 To coexist with the \Pkg{fontspec} package, it is needed to load
970 \Pkg{luatexja-fontspec} package in the preamble. This additional
971 package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
972 package, if needed.
973 %</en>
974 %<*ja>
975 \Pkg{fontspec} パッケージと同様の機能を和文フォントに対しても用いるためには,
976 \Pkg{luatexja-fontspec} パッケージをプリアンブルで読み込む必要がある.このパッケージ
977 は必要ならば自動で \Pkg{luatexja} パッケージと \Pkg{fontspec} パッケージを読み込む.
978 %</ja>
979
980 %<*en>
981 In \Pkg{luatexja-fontspec} package, the following 7~commands are defined as
982 counterparts of original commands in the \Pkg{fontspec} package:
983 %</en>
984 %<*ja>
985 \Pkg{luatexja-fontspec} パッケージでは,以下の7つのコマンドを \Pkg{fontspec}
986 パッケージの元のコマンドに対応するものとして定義している:
987 %</ja>
988 %<*en>
989 \begin{center}
990 \begin{tabular}{ccccc}
991 \toprule
992 Japanese fonts
993 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
994 alphabetic fonts
995 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
996 \midrule
997 Japanese fonts
998 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
999 alphabetic fonts
1000 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1001 \bottomrule
1002 \end{tabular}
1003 \end{center}
1004 %</en>
1005 %<*ja>
1006 \begin{center}
1007 \begin{tabular}{ccccc}
1008 \toprule
1009 和文フォント
1010 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1011 欧文フォント
1012 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1013 \midrule
1014 和文フォント
1015 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1016 欧文フォント
1017 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1018 \bottomrule
1019 \end{tabular}
1020 \end{center}
1021 %</ja>
1022
1023 \begin{LTXexample}
1024 \fontspec[Numbers=OldStyle]{TeX Gyre Termes}
1025 \jfontspec{IPAexMincho}
1026 JIS~X~0213:2004→辻
1027
1028 \addjfontfeatures{CJKShape=JIS1990}
1029 JIS~X~0208:1990→辻
1030 \end{LTXexample}
1031
1032 %<*en>
1033 Note that there is no command named \verb+\setmonojfont+, since it is
1034 popular for Japanese fonts that nearly all Japanese glyphs have same
1035 widths.  Also note that the kerning feature is set off by default in
1036 these 7~commands, since this feature and \textbf{JAglue} will clash (see
1037 \ref{para-kern}).
1038 %</en>
1039 %<*ja>
1040 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
1041 \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
1042 ンドでは Kerning feature はデフォルトでは off となっている.これはこの
1043 feature が \textbf{JAglue} と衝突するためである(\ref{para-kern} 節を参照).
1044 %</ja>
1045
1046 %<*en>
1047 \paragraph{Caution}
1048 \Pkg{xunicode} package will be reloaded during the loading of \Pkg{luatexja-fontspec} package.
1049 However, this reloading won't work for the current version (2011/09/09,~v0.981) of
1050 \Pkg{xunicode} package. Hence we have to patch it, using the following patch, for example:
1051 %</en>
1052 %<*ja>
1053 \paragraph{注意}
1054 \Pkg{luatexja-fontspec}パッケージでは,内部で \Pkg{xunicode} パッケージの再読み込みを
1055 行っているが, \textbf{\TeX\ Live\ 2011 他に含まれている \Pkg{xunicode} パッケージ
1056 (2011/09/09,~v0.981) ではその再読み込みがうまく動作せず},例えば
1057 以下のようなパッチを当てる必要がある:
1058 %</ja>
1059 \begin{lstlisting}
1060 --- xunicode.sty.orig   2011-09-12 08:31:47.000000000 +0900
1061 +++ xunicode.sty        2011-11-16 22:06:17.061413113 +0900
1062 @@ -1475,7 +1475,11 @@
1063
1064  \newtoks\tipasavetokens
1065  \newtoks\tipachecktokens
1066 +
1067 +\fi
1068  \newif\iftipaonetoken
1069 +\expandafter\ifx\csname ReloadXunicode\endcsname\relax
1070 +
1071  \def\tipalasttoken{!@! do nothing with this !@!}
1072  \def\tipacatchonechar#1{\begingroup
1073   \def\textipa##1{##1}% prevent recursion
1074 \end{lstlisting}
1075 %<*ja>
1076 なお,上流で v0.984 (2011/10/14) でこの問題は修正されているそうです(が,2012/03/20
1077 現在,まだ CTAN には上がっていない).
1078 %</ja>
1079
1080
1081 %<en>\section{Changing Parameters}
1082 %<ja>\section{パラメータの変更}
1083
1084 %<*en>
1085 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
1086 most of them are not stored as internal register of \TeX, but as an
1087 original storage system in \LuaTeX-ja. Hence, to assign or acquire those
1088 parameters, you have to use commands \verb+\ltjsetparameter+ and
1089 \verb+\ltjgetparameter+.
1090 %</en>
1091 %<*ja>
1092 \LuaTeX-ja には多くのパラメータが存在する.そして \LuaTeX の振る舞いのために,
1093 その多くは \TeX のレジスタにではなく,\LuaTeX-ja 独自の方法で保持されている.
1094 そのため,これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と
1095 \verb+\ltjgetparameter+ を用いる必要がある.
1096 %</ja>
1097
1098 %<en>\subsection{Editing the range of \textbf{JAchar}s}
1099 %<ja>\subsection{\textbf{JAchar} の範囲の設定}
1100
1101 %<*en>
1102 To edit the range of \textbf{JAchar}s, you have to assign a non-zero
1103 natural number which is less than 217 to the character range first. This
1104 can be done by using \verb+\ltjdefcharrange+ primitive. For example, the
1105 next line assigns whole characters in Supplementary Multilingual Plane
1106 and the character `漢' to the range number~100.
1107 %</en>
1108 %<*ja>
1109 \textbf{JAchar} の範囲を設定するためには,まず各文字に0より大きく217より小さい index を
1110 割り当てる必要がある.これには \verb+\ltjdefcharrange+ プリミティブを用いる.
1111 例えば,次のように書くことで追加多言語面 (SMP) にある全ての文字と `漢' が
1112 「100番の文字範囲」に属するように設定される.
1113 %</ja>
1114 \begin{lstlisting}
1115 \ltjdefcharrange{100}{"10000-"1FFFF,`漢}
1116 \end{lstlisting}
1117 %<*en>
1118 This assignment of numbers to ranges are always global, so you should
1119 not do this in the middle of a document.
1120 %</en>
1121 %<*ja>
1122 この文字範囲の割り当てはいつもグローバルであり,したがって文書の途中で
1123 この操作をするべきではない.
1124 %</ja>
1125
1126 %<*en>
1127 If some character has been belonged to some non-zero numbered range,
1128 this will be overwritten by the new setting. For example, whole SMP
1129 belong to the range~4 in the default setting of \LuaTeX-ja, and if you
1130 specify the above line, then SMP will belong to the range~100 and be
1131 removed from the range~4.
1132 %</en>
1133 %<*ja>
1134 もし指定されたある文字がある非零番号の範囲に属していたならば,これは新しい設定で
1135 上書きされる.例えば,SMP は全て \LuaTeX-ja のデフォルトでは4番の文字範囲に
1136 属しているが,上記の指定を行えば SMP は100番に属すようになり,4番からは除かれる.
1137 %</ja>
1138
1139 %<*en>
1140 After assigning numbers to ranges, the \textsf{jacharrange} parameter can
1141 be used to customize which character range will be treated as ranges of
1142 \textbf{JAchar}s, as the following line (this is just the default
1143 setting of \LuaTeX-ja):
1144 %</en>
1145 %<*ja>
1146 文字範囲に番号を割り当てた後は,\textsf{jacharrange} パラメータが \textbf{JAchar} と
1147 して扱われる文字の範囲を設定するために用いられる.例えば,以下は \LuaTeX-ja の
1148 初期設定である:
1149 %</ja>
1150 \begin{verbatim}
1151 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
1152 \end{verbatim}
1153 %<*en>
1154 The argument to \textsf{jacharrange} parameter is a list of integer.
1155 Negative integer $-n$ in the list means that `the characters that belong to
1156 range~$n$ are treated as \textbf{ALchar}', and positive integer $+n$ means
1157 that `the characters that belong to range~$n$ are treated as \textbf{JAchar}'.
1158 %</en>
1159 %<*ja>
1160 \textsf{jacharrange} パラメータには整数のリストを与える.
1161 リスト中の負の整数 $-n$ は「文字範囲 $n$ に属する文字は \textbf{ALchar} として
1162 扱われる」ことを意味し,正の整数 $+n$ は \textbf{JAchar} として扱うことを意味する.
1163 %</ja>
1164
1165 %<*en>
1166 \paragraph{Default Setting}
1167 \LuaTeX-ja predefines eight character ranges for convenience. They are
1168 determined from the following data:
1169 %</en>
1170 %<*ja>
1171 \paragraph{初期設定}
1172 \LuaTeX-ja では8つの文字範囲を設定している.これらは以下のデータに基づいて決定して
1173 いる.
1174 %</ja>
1175 \begin{itemize}
1176 %<*en>
1177 \item Blocks in Unicode~6.0.
1178 %</en>
1179 %<*ja>
1180 \item Unicode~6.0 のブロック.
1181 %</ja>
1182 %<*en>
1183 \item The \texttt{Adobe-Japan1-UCS2} mapping between a CID Adobe-Japan1-6 and Unicode.
1184 %</en>
1185 %<*ja>
1186 \item \texttt{Adobe-Japan1-UCS2} による Adobe-Japan1-6 の CID と Unicode の間の
1187       マッピング.
1188 %</ja>
1189 %<*en>
1190 \item The \texttt{PXbase} bundle for \upTeX\ by Takayuki Yato.
1191 %</en>
1192 %<*ja>
1193 \item 八登崇之氏による \upTeX 用の \texttt{PXbase} バンドル.
1194 %</ja>
1195 \end{itemize}
1196
1197 %<*en>
1198 Now we describe these eight ranges. The alphabet `J' or `A' after the
1199 number shows whether characters in the range is treated as
1200 \textbf{JAchar}s or not by default. These settings are similar to the
1201 \texttt{prefercjk} settings defined in \texttt{PXbase} bundle.
1202 %</en>
1203 %<*ja>
1204 以下ではこれら8つの文字範囲について記述する.番号のあとのアルファベット `J' と `A'
1205 はデフォルトで \textbf{JAchar} として扱われるかどうかを示す.これらの設定は
1206 \texttt{PXbase} バンドルで定義されている \texttt{prefercjk} と類似のものである.
1207 %</ja>
1208 \begin{description}
1209 %<*en>
1210 \item[Range~8${}^{\text{J}}$] Symbols in the intersection of the upper half of ISO~8859-1
1211          (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range
1212          consists of the following characters:
1213 %</en>
1214 %<*ja>
1215 \item[範囲 8${}^{\text{J}}$] ISO~8859-1 の上位領域(ラテン1補助)と
1216                              JIS~X~0208 の共通部分にある記号.この文字範囲は
1217                              以下の文字で構成される:
1218 %</ja>
1219 \begin{multicols}{2}
1220 \begin{itemize}
1221 \def\ch#1#2{\item \char"#1\ (\texttt{U+00#1}, #2)}%"
1222 %<*en>
1223 \ch{A7}{Section Sign}
1224 \ch{A8}{Diaeresis}
1225 \ch{B0}{Degree sign}
1226 \ch{B1}{Plus-minus sign}
1227 \ch{B4}{Spacing acute}
1228 \ch{B6}{Paragraph sign}
1229 \ch{D7}{Multiplication sign}
1230 \ch{F7}{Division Sign}
1231 %</en>
1232 %<*ja>
1233 \ch{A7}{節記号}
1234 \ch{A8}{トレマ}
1235 \ch{B0}{度}
1236 \ch{B1}{正又は負符号}
1237 \ch{B4}{アキュート・アクセント}
1238 \ch{B6}{段落記号}
1239 \ch{D7}{乗算記号}
1240 \ch{F7}{除算記号}
1241 %</ja>
1242 \end{itemize}
1243 \end{multicols}
1244
1245 %<*en>
1246 \item[Range~1${}^{\text{A}}$] Latin characters that some of them are included in Adobe-Japan1-6.
1247 This range consist of the following Unicode ranges, \emph{except characters in the range~8 above}:
1248 %</en>
1249 %<*ja>
1250 \item[範囲 1${}^{\text{A}}$] ラテン文字.一部はAdobe-Japan1-6 にも含まれている.
1251                              この範囲は以下の Unicode のブロックから構成されている.
1252                              \textbf{ただし,範囲 8 は除く.}
1253 %</ja>
1254 \begin{multicols}{2}
1255 \begin{itemize}
1256 %<*en>
1257 \item \texttt{U+0080}--\texttt{U+00FF}: Latin-1 Supplement
1258 \item \texttt{U+0100}--\texttt{U+017F}: Latin Extended-A
1259 \item \texttt{U+0180}--\texttt{U+024F}: Latin Extended-B
1260 \item \texttt{U+0250}--\texttt{U+02AF}: IPA Extensions
1261 \item \texttt{U+02B0}--\texttt{U+02FF}: Spacing Modifier Letters
1262 \item \texttt{U+0300}--\texttt{U+036F}: Combining Diacritical Marks
1263 \item \texttt{U+1E00}--\texttt{U+1EFF}: Latin Extended Additional
1264 %</en>
1265 %<*ja>
1266 \item \texttt{U+0080}--\texttt{U+00FF}: ラテン1補助
1267 \item \texttt{U+0100}--\texttt{U+017F}: ラテン文字拡張A
1268 \item \texttt{U+0180}--\texttt{U+024F}: ラテン文字拡張B
1269 \item \texttt{U+0250}--\texttt{U+02AF}: IPA拡張(国際音声記号)
1270 \item \texttt{U+02B0}--\texttt{U+02FF}: 前進を伴う修飾文字
1271 \item \texttt{U+0300}--\texttt{U+036F}: ダイアクリティカルマーク(合成可能)
1272 \item \texttt{U+1E00}--\texttt{U+1EFF}: ラテン文字拡張追加
1273 %</ja>
1274 \par\
1275 \end{itemize}
1276 \end{multicols}
1277 %<*en>
1278 \item[Range~2${}^{\text{J}}$] Greek and Cyrillic letters. JIS~X~0208 (hence most of Japanese
1279            fonts) has some of these characters.
1280 %</en>
1281 %<*ja>
1282 \item[範囲 2${}^{\text{J}}$] ギリシャ文字とキリル文字.JIS~X~0208(したがって多くの
1283                              和文フォント)はこれらの文字を持つ.
1284 %</ja>
1285 \begin{multicols}{2}
1286 \begin{itemize}
1287 %<*en>
1288 \item \texttt{U+0370}--\texttt{U+03FF}: Greek and Coptic
1289 \item \texttt{U+0400}--\texttt{U+04FF}: Cyrillic
1290 \item \texttt{U+1F00}--\texttt{U+1FFF}: Greek Extended
1291 %</en>
1292 %<*ja>
1293 \item \texttt{U+0370}--\texttt{U+03FF}: ギリシア文字及びコプト文字
1294 \item \texttt{U+0400}--\texttt{U+04FF}: キリル文字
1295 \item \texttt{U+1F00}--\texttt{U+1FFF}: キリル文字補助
1296 %</ja>
1297 \\\
1298 \end{itemize}
1299 \end{multicols}
1300 %<*en>
1301 \item[Range~3${}^{\text{J}}$] Punctuations and Miscellaneous symbols. The block list is
1302            indicated in Table~\ref{table-rng3}.
1303 %</en>
1304 %<*ja>
1305 \item[範囲 3${}^{\text{J}}$] 句読点と記号類.ブロックのリストは表~\ref{table-rng3}
1306                              に示してある.
1307 %</ja>
1308 \begin{table}[!tb]
1309 %<*en>
1310 \caption{Unicode blocks in predefined character range~3.}
1311 %</en>
1312 %<*ja>
1313 \caption{文字範囲 3 に指定されている Unicode ブロック.}
1314 %</ja>
1315 \label{table-rng3}
1316 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1317 \begin{center}\small
1318 \begin{tabular}{llll}
1319 %<*en>
1320 "2000--"206F&General Punctuation&
1321 "2070--"209F&Superscripts and Subscripts\\
1322 "20A0--"20CF&Currency Symbols&
1323 "20D0--"20FF&Comb.\ Diacritical Marks for Symbols\\
1324 "2100--"214F&Letterlike Symbols&
1325 "2150--"218F&Number Forms\\
1326 "2190--"21FF&Arrows&
1327 "2200--"22FF&Mathematical Operators\\
1328 "2300--"23FF&Miscellaneous Technical&
1329 "2400--"243F&Control Pictures\\
1330 "2500--"257F&Box Drawing&
1331 "2580--"259F&Block Elements\\
1332 "25A0--"25FF&Geometric Shapes&
1333 "2600--"26FF&Miscellaneous Symbols\\
1334 "2700--"27BF&Dingbats&
1335 "2900--"297F&Supplemental Arrows-B\\
1336 "2980--"29FF&Misc.\ Mathematical Symbols-B&
1337 "2B00--"2BFF&Miscellaneous Symbols and Arrows\\
1338 "E000--"F8FF&Private Use Area&
1339 %</en>
1340 %<*ja>
1341 "2000--"206F&一般句読点&
1342 "2070--"209F&上付き・下付き\\
1343 "20A0--"20CF&通貨記号&
1344 "20D0--"20FF&記号用ダイアクリティカルマーク(合成可能)\\
1345 "2100--"214F&文字様記号&
1346 "2150--"218F&数字に準じるもの\\
1347 "2190--"21FF&矢印&
1348 "2200--"22FF&数学記号(演算子)\\
1349 "2300--"23FF&その他の技術用記号&
1350 "2400--"243F&制御機能用記号\\
1351 "2500--"257F&罫線素片&
1352 "2580--"259F&ブロック要素\\
1353 "25A0--"25FF&幾何学模様&
1354 "2600--"26FF&その他の記号\\
1355 "2700--"27BF&装飾記号&
1356 "2900--"297F&補助矢印B\\
1357 "2980--"29FF&その他の数学記号B&
1358 "2B00--"2BFF&その他の記号及び矢印\\
1359 "E000--"F8FF&私用領域(外字領域)&
1360 %</ja>
1361 \end{tabular}
1362 \end{center}
1363 \end{table}
1364 %<*en>
1365 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
1366            of almost all Unicode blocks which are not in other
1367            predefined ranges. Hence, instead of showing the block list,
1368            we put the definition of this range itself:
1369 %</en>
1370 %<*ja>
1371 \item[範囲 4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
1372                              この範囲は他の範囲にないほとんど全ての Unicode ブロック
1373                              で構成されている.したがって,ブロックのリストを示す
1374                              代わりに,範囲の定義そのものを示す:
1375 %</ja>
1376 \begin{lstlisting}
1377 \ltjdefcharrange{4}{%
1378    "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
1379   "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB50-"FE0F,
1380   "FE20-"FE2F, "FE70-"FEFF, "FB00-"FB4F, "10000-"1FFFF} % non-Japanese
1381 \end{lstlisting}
1382 %<*en>
1383 \item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
1384 %</en>
1385 %<*ja>
1386 \item[範囲 5${}^{\text{A}}$] 代用符号と補助私用領域.
1387 %</ja>
1388 %<*en>
1389 \item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
1390 %</en>
1391 %<*ja>
1392 \item[範囲 6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは
1393                              表~\ref{table-rng6} に示す.
1394 %</ja>
1395 \begin{table}[!tb]
1396 %<*en>
1397 \caption{Unicode blocks in predefined character range~6.}
1398 %</en>
1399 %<*ja>
1400 \caption{文字範囲 6 に指定されている Unicode ブロック.}
1401 %</ja>
1402 \label{table-rng6}
1403 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1404 \begin{center}\small
1405 \begin{tabular}{llll}
1406 %<*en>
1407 "2460--"24FF&Enclosed Alphanumerics&
1408 "2E80--"2EFF&CJK Radicals Supplement\\
1409 "3000--"303F&CJK Symbols and Punctuation&
1410 "3040--"309F&Hiragana\\
1411 "30A0--"30FF&Katakana&
1412 "3190--"319F&Kanbun\\
1413 "31F0--"31FF&Katakana Phonetic Extensions&
1414 "3200--"32FF&Enclosed CJK Letters and Months\\
1415 "3300--"33FF&CJK Compatibility&
1416 "3400--"4DBF&CJK Unified Ideographs Extension A\\
1417 "4E00--"9FFF&CJK Unified Ideographs&
1418 "F900--"FAFF&CJK Compatibility Ideographs\\
1419 "FE10--"FE1F&Vertical Forms&
1420 "FE30--"FE4F&CJK Compatibility Forms\\
1421 "FE50--"FE6F&Small Form Variants&
1422 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)
1423 %</en>
1424 %<*ja>
1425 "2460--"24FF&囲み英数字&
1426 "2E80--"2EFF&CJK部首補助\\
1427 "3000--"303F&CJKの記号及び句読点&
1428 "3040--"309F&平仮名\\
1429 "30A0--"30FF&片仮名&
1430 "3190--"319F&漢文用記号(返り点)\\
1431 "31F0--"31FF&片仮名拡張&
1432 "3200--"32FF&囲みCJK文字・月\\
1433 "3300--"33FF&CJK互換用文字&
1434 "3400--"4DBF&CJK統合漢字拡張A\\
1435 "4E00--"9FFF&CJK統合漢字&
1436 "F900--"FAFF&CJK互換漢字\\
1437 "FE10--"FE1F&縦書き形&
1438 "FE30--"FE4F&CJK互換形\\
1439 "FE50--"FE6F&小字形&
1440 "{20}000--"{2F}FFF&(追加多言語面)
1441 %</ja>
1442 \end{tabular}
1443 \end{center}
1444 \end{table}
1445 %<*en>
1446 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in  Adobe-Japan1-6.
1447 The block list is indicated in Table~\ref{table-rng7}.
1448 %</en>
1449 %<*ja>
1450 \item[範囲 7${}^{\text{J}}$] CJK 言語で用いられる文字のうち,Adobe-Japan1-6 に
1451                             含まれていないもの.
1452                             ブロックのリストは表~\ref{table-rng7} に示す.
1453 %</ja>
1454 \begin{table}[!tb]
1455 %<*en>
1456 \caption{Unicode blocks in predefined character range~7.}
1457 %</en>
1458 %<*ja>
1459 \caption{文字範囲 7 に指定されている Unicode ブロック.}
1460 %</ja>
1461 \label{table-rng7}
1462 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1463 \begin{center}\small
1464 \begin{tabular}{llll}
1465 %<*en>
1466 "1100--"11FF&Hangul Jamo&
1467 "2F00--"2FDF&Kangxi Radicals\\
1468 "2FF0--"2FFF&Ideographic Description Characters&
1469 "3100--"312F&Bopomofo\\
1470 "3130--"318F&Hangul Compatibility Jamo&
1471 "31A0--"31BF&Bopomofo Extended\\
1472 "31C0--"31EF&CJK Strokes&
1473 "A000--"A48F&Yi Syllables\\
1474 "A490--"A4CF&Yi Radicals&
1475 "A830--"A83F&Common Indic Number Forms\\
1476 "AC00--"D7AF&Hangul Syllables&
1477 "D7B0--"D7FF&Hangul Jamo Extended-B
1478 %</en>
1479 %<*ja>
1480 "1100--"11FF&ハングル字母&
1481 "2F00--"2FDF&康熙部首\\
1482 "2FF0--"2FFF&漢字構成記述文字&
1483 "3100--"312F&注音字母 (注音符号)\\
1484 "3130--"318F&ハングル互換字母&
1485 "31A0--"31BF&注音字母拡張\\
1486 "31C0--"31EF&CJKの筆画&
1487 "A000--"A48F&イ文字\\
1488 "A490--"A4CF&イ文字部首&
1489 "A830--"A83F&共通インド数字に準じるもの\\
1490 "AC00--"D7AF&ハングル音節文字&
1491 "D7B0--"D7FF&ハングル字母拡張B
1492 %</ja>
1493 \end{tabular}
1494 \end{center}
1495 \end{table}
1496 \end{description}
1497
1498
1499 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
1500 %<ja>\subsection{\Param{kanjiskip} と \Param{xkanjiskip}}
1501 \label{subs-kskip}
1502
1503 %<*en>
1504 \textbf{JAglue} is divided into the following three categories:
1505 %</en>
1506 %<*ja>
1507 \textbf{JAglue} は以下の3つのカテゴリに分類される:
1508 %</ja>
1509 \begin{itemize}
1510 %<*en>
1511 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
1512       around a Japanese character, this glue will be not inserted at the
1513       place.
1514 %</en>
1515 %<*ja>
1516 \item JFM で指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
1517       発行されていれば,このグルーは挿入されない.
1518 %</ja>
1519 %<*en>
1520 \item The default glue which inserted between two \textbf{JAchar}s (\Param{
1521       kanjiskip}).
1522 %</en>
1523 %<*ja>
1524 \item デフォルトで2つの \textbf{JAchar} の間に挿入されるグルー(\Param{kanjiskip}).
1525 %</ja>
1526 %<*en>
1527 \item The default glue which inserted between a \textbf{JAchar} and an
1528       \textbf{ALchar} (\Param{xkanjiskip}).
1529 %</en>
1530 %<*ja>
1531 \item デフォルトで \textbf{JAchar} と \textbf{ALchar} の間に挿入されるグルー(\Param{xkanjiskip}).
1532 %</ja>
1533 \end{itemize}
1534 %<*en>
1535 The value (a skip) of \Param{kanjiskip} or \Param{xkanjiskip} can be
1536 changed as the following.
1537 %</en>
1538 %<*ja>
1539 \Param{kanjiskip} や \Param{xkanjiskip} の値は以下のようにして変更可能である.
1540 %</ja>
1541 \begin{lstlisting}
1542 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
1543                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
1544 \end{lstlisting}
1545
1546 %<*en>
1547 It may occur that JFM contains the data of `ideal width of \Param{kanjiskip}'
1548 and/or `ideal width of \Param{xkanjiskip}'.
1549 To use these data from JFM, set the value of \Param{kanjiskip} or
1550 \Param{xkanjiskip} to \verb+\maxdimen+.
1551 %</en>
1552 %<*ja>
1553 JFM は「望ましい \Param{kanjiskip} の値」や「望ましい \Param{xkanjiskip} の値」を
1554 持っていることがある.
1555 これらのデータを使うためには,\Param{kanjiskip} や \Param{xkanjiskip} の値を
1556 \verb+\maxdimen+ の値に設定すればよい.
1557 %</ja>
1558
1559 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
1560 %<ja>\subsection{\Param{xkanjiskip} の設定の挿入}
1561
1562 %<*en>
1563 It is not desirable that \Param{xkanjiskip} is inserted into every
1564 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
1565 \Param{xkanjiskip} should not be inserted after opening parenthesis
1566 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
1567 \LuaTeX-ja can control whether \Param{xkanjiskip} can be inserted
1568 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
1569 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
1570 %</en>
1571 %<*ja>
1572 \Param{xkanjiskip} がすべての \textbf{JAchar} と \textbf{ALchar} の境界に
1573 挿入されるのは望ましいことではない.例えば,\Param{xkanjiskip} は開き括弧の
1574 後には挿入されるべきではない(`(あ' と `(\hskip\ltjgetparameter{xkanjiskip}あ' を
1575 比べてみよ).
1576 \LuaTeX-ja では \Param{xkanjiskip} をある文字の前/後に挿入するかどうかを,
1577 \textbf{JAchar} に対しては \Param{jaxspmode} を,\textbf{ALchar} に対しては
1578 \Param{alxspmode} をそれぞれ変えることで制御することができる.
1579 %</ja>
1580 \begin{LTXexample}
1581 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
1582 pあq い!う
1583 \end{LTXexample}
1584
1585 %<*en>
1586 The second argument \texttt{preonly} means `the insertion of
1587 \Param{xkanjiskip} is allowed before this character, but not after'.
1588 the other possible values are \texttt{postonly}, \texttt{allow} and \texttt{
1589 inhibit}. ...
1590 %</en>
1591 %<*ja>
1592 2つ目の引数の \texttt{preonly} は「\Param{xkanjiskip} の挿入はこの文字の
1593 前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は
1594 \texttt{postonly}, \texttt{allow}, \texttt{inhibit} である.
1595
1596 なお,現行の
1597 仕様では,\Param{jaxspmode}, \Param{alxspmode} はテーブルを共有しており,
1598 上のソースの1行目を次のように変えても同じことになる:
1599 \begin{verbatim}
1600 \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
1601 \end{verbatim}
1602 また,これら2パラメータには数値で値を指定することもできる(第\ref{part-ref}部を参照).
1603 %</ja>
1604
1605 %<*en>
1606 If you want to enable/disable all insertions of \Param{kanjiskip} and
1607 \Param{xkanjiskip}, set \Param{autospacing} and \Param{autoxspacing}
1608 parameters to \texttt{true}/\texttt{false}, respectively.
1609 %</en>
1610 %<*ja>
1611 もし全ての \Param{kanjiskip} と \Param{xkanjiskip} の挿入を有効化/無効化
1612 したければ,それぞれ \Param{autospacing} と \Param{autoxspacing} を
1613 \texttt{true}/\texttt{false} に設定すればよい.
1614 %</ja>
1615
1616 %<en>\subsection{Shifting Baseline}
1617 %<ja>\subsection{ベースラインの移動}
1618
1619 %<*en>
1620 To make a match between a Japanese font and an alphabetic font, sometimes
1621 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
1622 by setting \verb+\ybaselineshift+ to a non-zero length (the
1623 baseline of alphabetic fonts is shifted below). However, for documents
1624 whose main language is not Japanese, it is good to shift the baseline of
1625 Japanese fonts, but not that of alphabetic fonts.
1626 Because of this, \LuaTeX-ja can independently set the shifting amount
1627 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
1628 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
1629 parameter).
1630 %</en>
1631 %<*ja>
1632 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
1633 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を非零の長さに設定することで
1634 なされていた(欧文フォントのベースラインが下がる).しかし,日本語が主ではない
1635 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
1636 このため,\LuaTeX-ja では欧文フォントのベースラインのシフト量
1637 (\Param{yalbaselineshift} パラメータ)と和文フォントのベースラインのシフト量
1638 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
1639 %</ja>
1640
1641 \begin{LTXexample}
1642 \vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
1643 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
1644 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
1645 \end{LTXexample}
1646 %<*en>
1647 Here the horizontal line in above is the baseline of a line.
1648 %</en>
1649 %<*ja>
1650 上の例において引かれている水平線がベースラインである.
1651 %</ja>
1652
1653 %<*en>
1654 There is an interesting side-effect: characters in different size can be
1655 vertically aligned center in a line, by setting two parameters appropriately.
1656 The following is an example (beware the value is not well tuned):
1657 %</en>
1658 %<*ja>
1659 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
1660 異なる文字を中心線に揃えることができるのだ.
1661 以下は一つの例である(値はあまり調整されていないことに注意):
1662 %</ja>
1663 \begin{LTXexample}
1664 xyz漢字
1665 {\scriptsize
1666   \ltjsetparameter{yjabaselineshift=-1pt,
1667     yalbaselineshift=-1pt}
1668   XYZひらがな
1669 }abcかな
1670 \end{LTXexample}
1671
1672
1673 %<en>\subsection{Cropmark}
1674 %<ja>\subsection{トンボ}
1675
1676 %<*en>
1677 Cropmark is a mark for indicating 4~corners and horizontal/vertical
1678 center of the paper. In Japanese, we call cropmark as tombo(w).
1679 \pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel.
1680 The following steps are needed to typeset cropmark:
1681 %</en>
1682 %<*ja>
1683 トンボは用紙の四つ角と水平/垂直方向の中心を表す印である.
1684 \pLaTeX と \LuaTeX-ja ではトンボの出力をサポートしている.
1685 トンボを出力するためには以下の手順が必要である:
1686 %</ja>
1687
1688 \begin{enumerate}
1689 %<*en>
1690 \item First, define the banner which will be printed at the upper left
1691       of the paper. This is done by assigning a token list to
1692       \verb+\@bannertoken+.
1693
1694 For example, the following sets banner as `\texttt{filename (YYYY-MM-DD hh:mm)}':
1695 %</en>
1696 %<*ja>
1697 \item まず,用紙の左上に印刷されるバナーを定義する.これは \verb+\@bannertoken+
1698       にトークンリストを与えることでなされる.
1699
1700 例えば,以下はバナーとして `\texttt{filename (YYYY-MM-DD hh:mm)}' を設定する:
1701 %</ja>
1702
1703 \begin{verbatim}
1704 \makeatletter
1705
1706 \hour\time \divide\hour by 60 \@tempcnta\hour \multiply\@tempcnta 60\relax
1707 \minute\time \advance\minute-\@tempcnta
1708 \@bannertoken{%
1709    \jobname\space(\number\year-\two@digits\month-\two@digits\day
1710    \space\two@digits\hour:\two@digits\minute)}%
1711 \end{verbatim}
1712
1713 \item ...
1714 \end{enumerate}
1715
1716
1717 %<en>\part{Reference}
1718 %<ja>\part{リファレンス}
1719 \label{part-ref}
1720 %<en>\section{Font Metric and Japanese Font}
1721 %<ja>\section{フォントメトリックと和文フォント}
1722 %<en>\subsection{\texttt{\char92jfont} primitive}
1723 %<ja>\subsection{\texttt{\char92jfont} プリミティブ}
1724
1725 %<*en>
1726 To load a font as a Japanese font, you must use the
1727 \verb+\jfont+ primitive instead of~\verb+\font+, while
1728 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
1729 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
1730 so TrueType/OpenType fonts with features can be used for Japanese fonts:
1731 %</en>
1732 %<*ja>
1733 フォントを和文フォントとして読み込むためには,\verb+\jfont+ プリミティブを
1734 \verb+\font+ プリミティブの代わりに用いる.
1735 \verb+\jfont+ プリミティブの文法は \verb+\font+ と同じである.
1736 \LuaTeX-ja は \Pkg{luaotfload} パッケージを自動的に読み込むので,
1737 TrueType/OpenType フォントに feature を指定したものを和文フォントとして用いる
1738 ことができる:
1739 %</ja>
1740 \begin{LTXexample}
1741 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
1742   +trad;-kern;jfm=ujis} at 14pt
1743 \tradgt{}当/体/医/区
1744 \end{LTXexample}
1745
1746 %<*en>
1747 Note that the defined control sequence
1748 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
1749 \textit{font\_def} token, hence the input like \verb+\fontname\tradgt+
1750 causes a error.  We denote control sequences which are defined in
1751 \verb+\jfont+ by <jfont\_cs>.
1752 %</en>
1753 %<*ja>
1754 なお,\verb+\jfont+ で定義されたコントロールシーケンス(上の例だと \verb+\tradgt+)
1755 は \textit{font\_def} トークンではないので,\verb+\fontname\tradgt+ のような
1756 入力はエラーとなることに注意する.以下では \verb+\jfont+ で定義された
1757 コントロールシーケンスを <jfont\_cs> で表す.
1758 %</ja>
1759
1760 \paragraph{JFM}
1761 %<*en>
1762 As noted in Introduction, a JFM has measurements of characters and
1763 glues/kerns that are automatically inserted for Japanese
1764 typesetting. The structure of JFM will be described in the next
1765 subsection. At the calling of \verb+\jfont+ primitive, you must specify
1766 which JFM will be used for this font by the following keys:
1767 %</en>
1768 %<*ja>
1769 「はじめに」の節で述べたように,JFM は文字と和文組版で自動的に挿入される
1770 グルー/カーンの寸法情報を持っている.JFM の構造は次の小節で述べる.
1771 \verb+\jfont+ プリミティブの呼び出しの際には,どの JFM を用いるのかを以下のキーで
1772 指定する必要がある:
1773 %</ja>
1774
1775 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1776 \item[jfm=<name>]
1777 %<*en>
1778 Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
1779 a file named \texttt{jfm-<name>.lua}.
1780
1781 The following JFMs are shipped with \LuaTeX-ja:
1782 %</en>
1783 %<*ja>
1784 JFM の名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
1785 \texttt{jfm-<name>.lua} を読み込む.
1786
1787 以下の JFM が \LuaTeX-ja には同梱されている:
1788 %</ja>
1789 \begin{description}
1790 %<*en>
1791 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
1792   based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
1793   is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM.
1794 %</en>
1795 %<*ja>
1796 \item[\tt jfm-ujis.lua] \LuaTeX-ja の標準 JFM である.この JFM は \upTeX で
1797   用いられる UTF/OTF パッケージ用のメトリックである \verb+upnmlminr-h.tfm+ を
1798   元にしている.\Pkg{luatexja-otf} パッケージを使うときはこの JFM を指定するべきである.
1799 %</ja>
1800 %<*en>
1801 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, `JIS font
1802   metric' which is widely used in \pTeX. A major difference of
1803   \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
1804   most characters under \texttt{jfm-ujis.lua} are square-shaped,
1805   while that under \texttt{jfm-jis.lua} are horizontal
1806   rectangles.
1807 %</en>
1808 %<*ja>
1809 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JIS フォントメトリック」
1810   \verb+jis.tfm+ に相当する JFM である.\texttt{jfm-ujis.lua} とこの
1811   \texttt{jfm-jis.lua} の主な違いは,\texttt{jfm-ujis.lua} ではほとんどの文字が
1812   正方形状であるのに対し,\texttt{jfm-jis.lua} では横長の長方形状である.
1813 %</ja>
1814 %<*en>
1815 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
1816   of the default Japanese font metric shipped with \pTeX. There
1817   are notable difference between this JFM and other 2~JFMs, as
1818   shown in Table~\ref{tab-difjfm}.
1819 %</en>
1820 %<*ja>
1821 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文フォントメトリック
1822   である \verb+min10.tfm+ に相当する JFM である.この JFM と他の2つの JFM の間には
1823   表 \ref{tab-difjfm} に示すような特筆すべき違いがある.
1824 %</ja>
1825 \end{description}
1826
1827 \item[jfmvar=<string>] Sometimes there is a need that ...
1828 \end{list}
1829
1830 \begin{table}[t]
1831 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
1832 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
1833 \label{tab-difjfm}
1834 \ltjsetparameter{jacharrange={+3}}
1835 \begin{center}
1836 \def\r#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1837 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
1838 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
1839 \vrule height 0pt depth \dp0}}
1840 \def\s#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 14.43324pt \g
1841 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
1842 \def\t#1{{\jfont\g=psft:Ryumin-Light:jfm=#1 at 19.24432pt \g
1843 \setbox0=\hbox{漢}%
1844 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
1845 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
1846 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1847 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
1848 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
1849 \begin{tabular}{rccc}
1850 \toprule
1851 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
1852 \midrule
1853 %<en>Example~1\footnotemark
1854 %<ja>例1\footnotemark
1855 &\r{ujis}&\r{jis}&\r{min}\\
1856 %<en>Example~2
1857 %<ja>例2
1858 &\s{ujis}&\s{jis}&\s{min}\\
1859 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
1860 \bottomrule
1861 \end{tabular}
1862 \end{center}
1863 \ltjsetparameter{jacharrange={-3}}
1864 \end{table}
1865 \footnotetext{from: 乙部厳己, min10フォントについて.
1866 \texttt{http://argent.shinshu-u.ac.jp/\~{\ }otobe/tex/files/min10.pdf}.}
1867
1868 %<en>\paragraph{Note: kern feature}
1869 %<ja>\paragraph{注意:kern feature}
1870 \label{para-kern}
1871 %<*en>
1872 Some fonts have information for inter-glyph spacing. However, this
1873 information is not well-compatible with \LuaTeX-ja.  More concretely,
1874 this kerning space from this information are inserted \emph{before} the
1875 insertion process of \textbf{JAglue}, and this causes incorrect spacing
1876 between two characters when both a glue/kern from the data in the font
1877 and it from JFM are present.
1878 %</en>
1879 %<*ja>
1880 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
1881 この情報は \LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
1882 されるカーニングスペースは \textbf{JAglue} の挿入過程の\textbf{前に}挿入され,
1883 JFM に基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
1884 なる.
1885 %</ja>
1886
1887 \begin{itemize}
1888 %<*en>
1889 \item You should specify \texttt{-kern} in
1890   \verb+jfont+ primitive, when you want to use other font features,
1891   such as \texttt{script=...}\,.
1892 %</en>
1893 %<*ja>
1894 \item  \texttt{script=...} といった feature を使いたい場合には,\verb+\jfont+
1895   プリミティブに \texttt{-kern} を指定するべきである.
1896 %</ja>
1897 %<*en>
1898 \item If you want to use Japanese fonts in proportional width, and use
1899       information from this font, use \texttt{jfm-prop.lua} for its JFM, and ...
1900 %</en>
1901 %<*ja>
1902 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
1903   ならば,\texttt{jfm-prop.lua} を JFM として指定し,……
1904 %</ja>
1905
1906 TODO: kanjiskip?
1907 \end{itemize}
1908
1909
1910 %<en>\subsection{Prefix \texttt{psft}}
1911 %<ja>\subsection{\texttt{psft} プレフィックス}
1912 %<*en>
1913 Besides \texttt{file:}\ and \texttt{name:}\ prefixes, one can use \texttt{psft:}\
1914 prefix in \verb+\jfont+ (and~\verb+\font+) primitive,
1915 to specify a `name-only' Japanese font which
1916 will be not embedded to PDF. Typical use of this prefix is to specify
1917 the `standard' Japanese fonts, namely, `Ryumin-Light' and
1918 `GothicBBB-Medium'. For kerning or other information, that of Kozuka
1919 Mincho Pr6N Regular (this is a font by Adobe Inc., and included in
1920 Japanese Font Packs for Adobe Reader) will be used.
1921 %</en>
1922 %<*ja>
1923 \texttt{file:} と \texttt{name:} のプレフィックスに加えて,
1924 \verb+\jfont+ プリミティブ(と \verb+\font+ プリミティブ)では
1925 \texttt{psft:} プレフィックスを用いることができる.
1926 このプレフィックスを用いることで,PDF には埋め込まれない「名前だけの」
1927 和文フォントを指定することができる.典型的な使い方は「標準的な」和文フォント,
1928 つまり `Ryumin-Light' と `GothicBBB-Medium' を指定することである.
1929 この場合,カーニング他の情報は小塚明朝 Pr6N Regular
1930 (Adobe 社によるフォントで,Adobe Reader の日本語フォントパックに含まれている)
1931 が用いられる.
1932 %</ja>
1933
1934 \paragraph{\texttt{cid} key}
1935 \label{para-cid}
1936
1937  \texttt{cid} key, ...
1938
1939
1940 %<en>\subsection{Structure of JFM file}
1941 %<ja>\subsection{JFM ファイルの構造}
1942
1943 %<*en>
1944 A JFM file is a Lua script which has only one function call:
1945 %</en>
1946 %<*ja>
1947 JFM ファイルはただ一つの関数呼び出しを含む Lua スクリプトである:
1948 %</ja>
1949 \begin{verbatim}
1950 luatexja.jfont.define_jfm { ... }
1951 \end{verbatim}
1952 %<*en>
1953 Real data are stored in the table which indicated above by
1954 \verb+{ ... }+.  So, the rest of this subsection are devoted to describe the
1955 structure of this table.  Note that all lengths in a JFM file are
1956 floating-point numbers in design-size unit.
1957 %</en>
1958 %<*ja>
1959 実際のデータは上で \verb+{ ... }+ で示されたテーブルの中に格納されている.
1960 以下ではこのテーブルの構造について記す.
1961 なお,JFM ファイル中の長さは全て design-size を単位とする浮動小数点数であることに
1962 注意する.
1963 %</ja>
1964
1965 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1966
1967 \item[dir=<direction>]
1968 %<en>(required)
1969 %<ja>(必須)
1970
1971 %<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
1972 %<ja>JFM の書字方向.現時点では \texttt{'yoko'} のみがサポートされる.
1973
1974 \item[zw=<length>]
1975 %<en>(required)
1976 %<ja>(必須)
1977
1978 %<en>The amount of the length of the `full-width'.
1979 %<ja>「全角幅」の長さ.
1980
1981 \item[zh=<length>]
1982 %<en>(required)
1983 %<ja>(必須)
1984
1985 %<en>The amount of the length of the `full-height' (height + depth).
1986 %<ja>「全角高さ」(height + depth)の長さ.
1987
1988 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}]
1989 %<en>(optional)
1990 %<ja>(任意)
1991
1992 %<*en>
1993 This field specifies the `ideal' amount of \Param{kanjiskip}. As noted
1994              in Subsection~\ref{subs-kskip}, if the parameter
1995              \Param{kanjiskip} is \verb+\maxdimen+, the value specified
1996              in this field is actually used (if this field is not specified in
1997              JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
1998              fields are in design-size unit too.
1999 %</en>
2000 %<*ja>
2001 「理想的な」 \Param{kanjiskip} の量を指定する.\ref{subs-kskip} 節で述べたように,
2002 もし \Param{kanjiskip} が \verb+\maxdimen+ の値ならば,このフィールドで指定された
2003 値が実際には用いられる(もしこのフィールドが JFM で指定されていなければ,
2004 0\,pt であるものとして扱われる).<stretch> と <shrink> のフィールドも design-size
2005 が単位であることに注意せよ.
2006 %</ja>
2007
2008 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}]
2009 %<en>(optional)
2010 %<ja>(任意)
2011
2012 %<*en>
2013 Like the \Param{kanjiskip} field, this field specifies the `ideal'
2014              amount of \Param{xkanjiskip}.
2015 %</en>
2016 %<*ja>
2017 \Param{kanjiskip} フィールドと同様に,\Param{xkanjiskip} の「理想的な」量を
2018 指定する.
2019 %</ja>
2020 \end{list}
2021
2022 %<*en>
2023 Besides from above fields, a JFM file have several sub-tables those
2024 indices are natural numbers.  The table indexed by~$i\in\omega$ stores
2025 information of `character class'~$i$. At least, the character class~0 is
2026 always present, so each JFM file must have a sub-table whose index is
2027 \texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
2028 the following fields:
2029 %</en>
2030 %<*ja>
2031 上記のフィールドに加えて,JFM ファイルはそのインデックスが自然数であるいくつかの
2032 サブテーブルを持つ.インデックスが $i\in\omega$ であるテーブルは「文字クラス」$i$ の
2033 情報を格納する.少なくとも,文字クラス0は常に存在するので,JFM ファイルはインデックス
2034 が \texttt{[0]} のサブテーブルを持たなければならない.それぞれのサブテーブル
2035 (そのインデックスを $i$ で表わす)は以下のフィールドを持つ:
2036 %</ja>
2037
2038 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2039 \item[chars=\{<character>, ...\}]
2040 %<en>(required except character class~0)
2041 %<ja>(文字クラス0を除いて必須)
2042
2043 %<*en>
2044 This field is a list of characters which are in this character
2045              type~$i$. This field is not required if $i=0$, since all
2046              \textbf{JAchar} which are not in any character class other
2047              than 0 are in the character class 0
2048              (hence, the character class~0 contains most of
2049              \textbf{JAchar}s). In the list, a character can be
2050              specified by its code number, or by the character itself
2051              (as a string of length~1). Moreover, there are `imaginary
2052              characters' which specified in the list. We will describe these later.
2053 %</en>
2054 %<*ja>
2055 このフィールドは文字クラス~$i$ に属する文字のリストである.このフィールドは $i=0$ の
2056 場合には必須ではない.なぜならば,文字クラス 0 には,0 以外の文字クラスに属するものを
2057 除いた全ての \textbf{JAchar} が属するからである(よって,文字クラス 0 はほとんどの
2058 \textbf{JAchar} を含む).このリストでは,文字はその文字コードを用いて,もしくは
2059 文字それ自体(長さ1の文字列)によって指定される.さらに,このリストで指定される
2060 「仮想的な文字」も存在する.これらについては後に記す.
2061 %</ja>
2062
2063 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
2064 %<en>(required)
2065 %<ja>(必須)
2066
2067 %<*en>
2068 Specify width of characters in character class~$i$, height, depth and
2069 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height and depth are
2070 as values of these fields.
2071 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its `real' glyph
2072 %</en>
2073 %<*ja>
2074 文字クラス~$i$ に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
2075 文字クラス~$i$ に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
2076 値であるものとして扱われる.
2077 しかし,例外が一つある:もし \texttt{'prop'} が \texttt{width} フィールドに
2078 指定された場合,文字の幅はその「実際の」グリフの幅となる.
2079 %</ja>
2080
2081 \item[left=<length>, down=<length>, align=<align>]\
2082
2083 %<*en>
2084 These fields are for adjusting the position of the `real' glyph. Legal
2085              values of \texttt{align} field are \texttt{'left'},
2086              \texttt{'middle'} and \texttt{'right'}. If one of these
2087              3~fields are omitted, \texttt{left} and \texttt{down} are
2088              treated as~0, and \texttt{align} field is treated as
2089              \texttt{'left'}.
2090 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
2091 %</en>
2092 %<*ja>
2093 これらのフィールドは「実際の」グリフの位置を調整するためにある.
2094 \texttt{align} フィールドに指定できる値は \texttt{'left'}, \texttt{'middle'},
2095 \texttt{'right'} のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
2096 場合,\texttt{left} と \texttt{down} は 0,\texttt{align} フィールドは
2097 \texttt{'left'} であるものとして扱われる.
2098 これら3つのフィールドの意味については図\ref{fig-pos} で説明する.
2099 %</ja>
2100
2101 %<*en>
2102 In most cases, \texttt{left} and \texttt{down} fields are~0, while
2103 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
2104 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
2105 when the current character class is the class for opening delimiters'.
2106 %</en>
2107 %<*ja>
2108 多くの場合,\texttt{left} と \texttt{down} は 0 である一方,
2109 \texttt{align} フィールドが \texttt{'middle'} や \texttt{'right'} であることは
2110 珍しいことではない.
2111 例えば,\texttt{align} フィールドを \texttt{'right'} に指定することは,
2112 文字クラスが開き括弧類であるときに実際必要である.
2113 %</ja>
2114 \begin{figure}[!tb]
2115 \begin{minipage}{0.4\textwidth}%
2116 \begin{center}\unitlength=10pt\small
2117 \begin{picture}(15,12)(-1,-4)
2118 \color{black!10!white}% real glyph :step1
2119 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
2120
2121 \color{red!20!white}% real glyph :step1
2122 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2123
2124 \color{red}% real glyph
2125 \thicklines
2126 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2127 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
2128 \put(-1,5.5){\line(1,0){6}}
2129 \put(-1,-4){\line(1,0){6}}
2130
2131 \color{green!20!white}% real glyph :step1
2132 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2133
2134 \color{black}% real glyph :step1
2135 \thicklines
2136 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
2137 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
2138 \put(0,8){\line(1,0){12}}
2139 \put(0,-3){\line(1,0){12}}
2140 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
2141 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
2142 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
2143
2144 \color{green!50!black}% real glyph :step1
2145 \thicklines
2146 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2147 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
2148 \put(3,7){\line(1,0){6}}
2149 \put(3,-2.5){\line(1,0){6}}
2150 \newsavebox{\eqdist}
2151 \savebox{\eqdist}(0,0)[b]{%
2152   \thinlines
2153   \put(-0.08,0.2){\line(0,-1){0.4}}%
2154   \put(0.08,0.2){\line(0,-1){0.4}}}
2155 \put(1.5,0){\usebox{\eqdist}}
2156 \put(10.5,0){\usebox{\eqdist}}
2157
2158 \color{blue}% shifted
2159 \thicklines
2160 \put(3,-1.5){\vector(-1,0){4}}
2161 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
2162 \put(3,0){\vector(0,-1){1.5}}
2163 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
2164 \end{picture}
2165 \end{center}
2166 \end{minipage}%
2167 \begin{minipage}{0.6\textwidth}%
2168 %<*en>
2169 Consider a node containing Japanese character whose value of the \texttt{align}
2170 field is \texttt{'middle'}.
2171 %</en>
2172 %<*ja>
2173 \texttt{align} フィールドの値が \texttt{'middle'} である和文文字を含むノードを
2174 考えよう.
2175 %</ja>
2176 \begin{itemize}
2177 \item
2178 %<*en>
2179 The black rectangle is a frame of the node.
2180 Its width, height and depth are specified by JFM.
2181 %</en>
2182 %<*ja>
2183 黒色の長方形はノードの枠である.
2184 その幅,高さ,深さは JFM によって指定される.
2185 %</ja>
2186 \item
2187 %<*en>
2188 Since the \texttt{align} field is \texttt{'middle'},
2189 the `real' glyph is centered horizontally (the green rectangle).
2190 %</en>
2191 %<*ja>
2192 \texttt{align} フィールドは \texttt{middle} なので,「実際の」グリフは
2193 水平方向の中心に配置される(緑色の長方形).
2194 %</ja>
2195 \item
2196 %<*en>
2197 Furthermore, the glyph is shifted according to values of fields
2198       \texttt{left} and \texttt{down}. The ultimate position of the real
2199       glyph is indicated by the red rectangle.
2200 %</en>
2201 %<*ja>
2202 さらに,グリフは \texttt{left} と \texttt{down} の値に従ってシフトされる.
2203 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
2204 %</ja>
2205 \end{itemize}
2206 \end{minipage}
2207 \caption{
2208 %<en>The position of the `real' glyph.
2209 %<ja>「実際の」グリフの位置.
2210 }
2211 \label{fig-pos}
2212 \end{figure}
2213
2214
2215 \item[kern={\{[$j$]=<kern>, ...\}}]
2216
2217 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
2218 \end{list}
2219
2220 %<*en>
2221 The followings are `imaginary characters' which can be specified in \texttt{chars} field.
2222 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2223 \item['lineend'] An ending of a line.
2224 \item['diffmet'] Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
2225 \item['boxbdd'] The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
2226 \item['parbdd'] The beginning of an (indented) paragraph.
2227 \item['jcharbdd'] A boundary between \textbf{JAchar} and anything else
2228              (such as \textbf{ALchar}, kern, glue, ...).
2229 \item[$-1$] The left/right boundary of an inline math formula.
2230 \end{list}
2231 %</en>
2232
2233 %<*ja>
2234 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
2235 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
2236 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
2237 い組版調整ができるようになっている.以下でその一覧を述べる:
2238 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2239 \item['lineend'] 行の終端を表す.
2240 \item['diffmet']
2241
2242 \item['boxbdd'] hboxの先頭と末尾,及びインデントされていない
2243              (\verb+\noindent+で開始された)段落の先頭を表す.
2244 \item['parbdd'] 通常の(\verb+\noindent+で開始されていない)段落の先頭.
2245 \item['jcharbdd'] 和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
2246 \item[$-1$] 行中数式と地の文との境界.
2247 \end{list}
2248
2249 \paragraph{\pTeX 用和文フォントメトリックの移植}
2250 以下に,\pTeX 用和文フォントメトリックを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
2251 \begin{itemize}
2252 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
2253 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
2254       トメトリック等を移植する場合は,
2255 \begin{itemize}
2256 \item JFM中の全ての数値を$1/0.962216$倍しておく.
2257 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
2258       \LaTeX でのフォント宣言なら,例えば次のように:
2259 \begin{verbatim}
2260 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
2261 \end{verbatim}
2262 \end{itemize}
2263 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
2264       (JFM中に単に書かなければよい).
2265 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
2266       文字クラスに関してはglue/kernの設定はしない.
2267
2268 これは,\pTeX では,
2269       hboxの先頭・末尾とインデントされていない(\verb+\noindent+で開始さ
2270       れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
2271 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
2272
2273 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
2274       段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
2275       は,段落の最初に手動で\verb+\inhibitglue+を追加するか,あるいは
2276       \verb+\everypar+のhackを行い,それを自動化させるしかなかった.
2277
2278 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
2279 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
2280 \texttt{'parbdd'}を入れれば全角下がりとなる.
2281
2282 \ltjsetparameter{jacharrange={+3}}
2283 \begin{LTXexample}
2284 \jfont\g=psft:Ryumin-Light:jfm=test \g
2285 \parindent1\zw\noindent{}◆◆◆◆◆
2286 \par 「◆◆←二分下がり
2287 \par 【◆◆←全角下がり
2288 \par 〔◆◆←全角二分下がり
2289 \end{LTXexample}
2290 \end{itemize}
2291 \ltjsetparameter{jacharrange={-3}}
2292 %</ja>
2293
2294 %<en>\subsection{Math Font Family}
2295 %<ja>\subsection{数式フォントファミリ}
2296 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
2297 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX can handles 256~families, but
2298 an external package is needed to support this in plain \TeX\ and
2299 \LaTeX.}, and each family has three fonts:
2300 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
2301
2302 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
2303 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
2304 font families. There is no relation between the value of
2305 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
2306 you can set both \verb+\fam+ and \verb+\jfam+ to~the same value.
2307
2308 \begin{table}[!tb]
2309 \caption{Primitives for Japanese math fonts.}
2310 \label{tab-math}
2311 \begin{center}\def\{{\char`\{}\def\}{\char`\}}
2312 \begin{tabular}{lll}
2313 \toprule
2314 &Japanese fonts&alphabetic fonts\\
2315 \midrule
2316 font family&\verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
2317 text size&\tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
2318 script size&\tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
2319 scriptscript size&\tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
2320 \bottomrule
2321 \end{tabular}
2322 \end{center}
2323 \end{table}
2324
2325 %<en>\subsection{Callbacks}
2326 %<ja>\subsection{コールバック}
2327 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
2328 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks
2329 \begin{list}{}%
2330 {\def\makelabel#1{\bfseries#1}}
2331 \item[\texttt{luatexja.load\_jfm} callback]
2332 With this callback you can overwrite JFMs.
2333 This callback is called when a new JFM is loaded.
2334
2335 \begin{verbatim}
2336 function (<table> jfm_info, <string> jfm_name)
2337   return <table> new_jfm_info
2338 end
2339 \end{verbatim}
2340
2341 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
2342 this argument has \texttt{chars} field which contains character codes
2343              whose character class is not~0.
2344
2345 An example of this callback is the \texttt{ltjarticle} class, with
2346              forcefully assigning character class~0 to \texttt{'parbdd'}
2347              in the JFM \texttt{jfm-min.lua}. This callback doesn't
2348              replace any code of \LuaTeX-ja.
2349
2350 \item[\texttt{luatexja.define\_font} callback]
2351 This callback and the next callback form a pair, and you can assign letters which don't have
2352              fixed code points in Unicode to non-zero character classes.
2353 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
2354 \begin{verbatim}
2355 function (<table> jfont_info, <number> font_number)
2356   return <table> new_jfont_info
2357 end
2358 \end{verbatim}
2359
2360 You may assume that \verb+jfont_info+ has the following fields:
2361 \begin{description}
2362 \item[\tt jfm] The index number of JFM.
2363 \item[\tt size] Font size in a scaled point (${}=2^{-16}\,\textrm{pt}$).
2364 \item[\tt var] The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
2365 \end{description}
2366
2367 The returned table \verb+new_jfont_info+ also should include these three fields.
2368 The \verb+font_number+ is a font number.
2369
2370 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
2371              package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
2372              CID characters in a JFM. This callback doesn't replace any
2373              code of \LuaTeX-ja.
2374
2375
2376 \item[\texttt{luatexja.find\_char\_class} callback]
2377 This callback is called just when \LuaTeX-ja inready to determine which
2378              character class a character \verb+chr_code+ belongs.
2379 A function used in this callback should be in the following form:
2380 \begin{lstlisting}[numbers=left]
2381 function (<number> char_class, <table> jfont_info, <number> chr_code)
2382   if char_class~=0 then return char_class
2383   else
2384     ....
2385     return (<number> new_char_class or 0)
2386   end
2387 end
2388 \end{lstlisting}
2389
2390 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
2391              routine or previous function calls in this callback, hence
2392              this argument may not be 0. Moreover, the returned
2393              \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
2394              is not~0, otherwise you will overwrite the \LuaTeX-ja's
2395              default routine.
2396
2397 This callback doesn't replace any code of \LuaTeX-ja.
2398
2399 \item[\texttt{luatexja.set\_width} callback]
2400 This callback is called when \LuaTeX-ja is trying to encapsule a
2401              \textbf{JAchar} \textit{glyph\_node}, to adjust its
2402              dimension and position.
2403 \begin{lstlisting}[numbers=left]
2404 function (<table> shift_info, <table> jfont_info, <number> char_class)
2405   return <table> new_shift_info
2406 end
2407 \end{lstlisting}
2408
2409 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
2410 \texttt{down} and \texttt{left} fields, which are the amount of shifting
2411              down/left the character in a scaled-point.
2412
2413 %<*ja>
2414 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
2415              JFM内で規定された文字クラス0の文字における$(\hbox{高
2416              さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
2417              下位置が自動調整される.例えば,
2418 \begin{itemize}
2419 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
2420 (和文OpenTypeフォントの標準値)
2421 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
2422 \end{itemize}
2423 となっていたとする.すると,実際の文字の出力位置は,
2424 \[
2425  \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{825}y= 0.03\dot1\dot5y
2426 \]
2427 だけ上にずらされることになる,
2428 %</ja>
2429 \end{list}
2430
2431
2432
2433 %<en>\section{Parameters}
2434 %<ja>\section{パラメータ}
2435 %<en>\subsection{\texttt{\char92 ltjsetparameter} primitive}
2436 %<ja>\subsection{\texttt{\char92 ltjsetparameter} プリミティブ}
2437 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
2438 primitives for accessing most parameters of \LuaTeX-ja. One of the main
2439 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
2440 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
2441 is the position of \verb+hpack_filter+ callback in the source
2442 of \LuaTeX, see Section~\ref{sec-para}.
2443
2444 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives
2445 for assigning parameters. These take one argument which is a
2446 \texttt{<key>=<value>} list. Allowed keys are described in the next
2447 subsection.
2448 The difference between
2449 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
2450 scope of assignment;
2451 \verb+\ltjsetparameter+ does a local assignment and
2452 \verb+\ltjglobalsetparameter+ does a global one.
2453 They also obey the value of \verb+\globaldefs+,
2454 like other assignment.
2455
2456 \verb+\ltjgetparameter+ is the primitive for acquiring parameters. It
2457 always takes a parameter name as first argument, and also takes the
2458 additional argument---a character code, for example---in some cases.
2459 \begin{LTXexample}
2460 \ltjgetparameter{differentjfm},
2461 \ltjgetparameter{autospacing},
2462 \ltjgetparameter{prebreakpenalty}{`)}.
2463 \end{LTXexample}
2464 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
2465 always a string}. This is outputted by \texttt{tex.write()}, so any
2466 character other than space~`\texttt{\char32}'~(U+0020) has the category code
2467 12~(other), while the space has 10~(space).
2468
2469 %<en>\subsection{List of Parameters}
2470 %<ja>\subsection{パラメータ一覧}
2471 The following is the list of parameters which can be specified by the
2472 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
2473 in \pTeX, and symbols beside each parameter has the following meaning:
2474 \begin{itemize}
2475 \item No mark: values at the end of the paragraph or the hbox are
2476       adopted in the whole paragraph/hbox.
2477 \item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
2478 \item `\dagger': assignments are always global.
2479 \end{itemize}
2480
2481 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2482 \item[\Param{jcharwidowpenalty}\,=<penalty>] [\verb+\jcharwidowpenalty+]
2483
2484 Penalty value for suppressing orphans. This penalty is inserted just
2485              after the last \textbf{JAchar} which is not regarded as a
2486              (Japanese) punctuation mark.
2487
2488 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}]\
2489
2490 An additional attributes having each character whose character code is <chr\_code>.
2491 At the present version, the lowermost bit of <natural number> indicates
2492              whether the character is considered as a punctuation mark
2493              (see the description of \Param{jcharwidowpenalty} above).
2494
2495
2496 \item[\Param{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\prebreakpenalty+]\
2497 %<*ja>
2498 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
2499              この文字の前に挿入/追加されるペナルティの量を指定する.
2500
2501 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,標準で読み込まれる
2502              \texttt{luatexja-kinsoku.tex}において
2503 \begin{verbatim}
2504 \ltjsetparameter{prebreakpenalty={`〙,10000}}
2505 \end{verbatim}
2506 と,最大値の10000が指定されている.他にも,小書きのカナなど,絶対禁止とい
2507              うわけではないができれば行頭にはきて欲しくない場合に,0と
2508              10000の間の値を指定するのも有用であろう.
2509 \begin{verbatim}
2510 \ltjsetparameter{prebreakpenalty={`ゕ,150}}
2511 \end{verbatim}
2512 %</ja>
2513
2514 \item[\Param{postbreakpenalty}\,=\{<chr\_code>,<penalty>\}] [\verb+\postbreakpenalty+]
2515 %<*ja>
2516 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
2517              この文字の後に挿入/追加されるペナルティの量を指定する.
2518
2519 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
2520 \begin{itemize}
2521 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
2522       た(後から指定した方で上書きされる).
2523 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
2524 \end{itemize}
2525 という制限があったが,\LuaTeX-ja ではこれらの制限は解消されている.
2526 %</ja>
2527
2528 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\textfont+ in \TeX]
2529 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\scriptfont+ in \TeX]
2530 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}] [\verb+\scriptscriptfont+ in \TeX]
2531 \item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
2532 \item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
2533
2534 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
2535
2536 Setting whether inserting  \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
2537 The followings are allowed for <mode>:
2538 \begin{description}
2539 \item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
2540 \item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
2541 \item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
2542 \item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character.
2543 This is the default value.
2544 \end{description}
2545 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
2546
2547
2548 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
2549
2550 Setting whether inserting \Param{xkanjiskip} is allowed before/after a
2551              \textbf{ALchar} whose character code is <chr\_code>.
2552 The followings are allowed for <mode>:
2553 \begin{description}
2554 \item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited
2555            before the character, nor after the character.
2556 \item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed
2557            before the character, but not after.
2558 \item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed
2559            after the character, but not before.
2560 \item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed both
2561            before the character and after the character.
2562 This is the default value.
2563 \end{description}
2564 Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
2565
2566 \item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
2567 \item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
2568 \item[\Param{kanjiskip}\,=<skip>] [\verb+\kanjiskip+]
2569 \item[\Param{xkanjiskip}\,=<skip>] [\verb+\xkanjiskip+]
2570
2571 \item[\Param{differentjfm}\,=<mode>$^\dagger$]
2572
2573 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
2574 The allowed arguments are the followings:
2575 \begin{description}
2576 \item[\texttt{average}]
2577 \item[\texttt{both}]
2578 \item[\texttt{large}]
2579 \item[\texttt{small}]
2580 \end{description}
2581
2582 \item[\Param{jacharrange}\,=<ranges>$^\ast$]
2583 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
2584 \end{list}
2585
2586
2587 %<en>\section{Other Primitives}
2588 %<ja>\section{その他のプリミティブ}
2589 %<en>\subsection{Primitives for Compatibility}
2590 %<ja>\subsection{互換プリミティブ}
2591 The following primitives are implemented for compatibility with \pTeX:
2592 \begin{list}{}{\def\makelabel{\ttfamily\char92 }\advance\leftmargin1\zw}
2593 \item[kuten]
2594 \item[jis]
2595 \item[euc]
2596 \item[sjis]
2597 \item[ucs]
2598 \item[kansuji]
2599 \end{list}
2600 %<en>\subsection{\texttt{\char92 inhibitglue} primitive}
2601 %<ja>\subsection{\texttt{\char92 inhibitglue} プリミティブ}
2602 The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
2603 The following is an example, using a special JFM that there will be a glue between
2604 the beginning of a box and `あ', and also between `あ' and `ウ'.
2605
2606 \begin{LTXexample}
2607 \jfont\g=psft:Ryumin-Light:jfm=test \g
2608 \fbox{\hbox{あウあ\inhibitglue ウ}}
2609 \inhibitglue\par\noindent あ1
2610 \par\inhibitglue\noindent あ2
2611 \par\noindent\inhibitglue あ3
2612 \par\inhibitglue\hrule あoff\inhibitglue ice
2613 \end{LTXexample}
2614
2615 With the help of this example, we remark the specification of \verb+\inhibitglue+:
2616 \begin{itemize}
2617 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
2618       effective at the beginning of the next paragraph. This is realized
2619       by hacking \verb+\everypar+.
2620 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
2621       mode is only effective on the spot; does not get over boundary of
2622       paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
2623       kernings, as shown in line~4 of above example.
2624 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
2625 \end{itemize}
2626
2627 %<en>\section{Control Sequences for \LaTeXe}
2628 %<ja>\section{\LaTeXe 用のコントロールシーケンス}
2629 %<en>\subsection{Patch for NFSS2}
2630 %<ja>\subsection{NFSS2 へのパッチ}
2631 \label{ssub-nfsspat}
2632 As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
2633 \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
2634 For an convenience, we will describe
2635 commands which are not described in Subsection~\ref{ssub-chgfnt}.
2636
2637 \begin{cslist}%
2638 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
2639 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
2640              and Japanese font families is only made by its
2641              encoding. For example, encodings OT1 and T1 are for
2642              alphabetic font families, and a Japanese font family cannot
2643              have these encodings. This command defines a new encoding
2644              scheme for Japanese font family (in horizontal direction).
2645
2646 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
2647 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
2648 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
2649
2650 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
2651
2652 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
2653 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
2654 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd> (\verb+\mathrm+等)と,和文数式用フォ
2655              ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+等)の2つを同時に行う命令として
2656              <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
2657              <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
2658              更させるようにするのが一般的と思われる.
2659
2660 {\let\item=\origitem
2661 本命令は
2662 \begin{center}\tt
2663 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
2664 (<al-cmd>を1段展開したもの)\{<ja-cmd>を1段展開したもの)\{<arg>\}\}
2665 \end{center}
2666 と定義を行うので,使用には注意が必要である:
2667 \begin{itemize}
2668 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.\verb+\reDeclareMathAlphabet+後に
2669 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
2670 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと \texttt{@} をつけた命令を指定した時の動作は保証できない.
2671 \end{itemize}}
2672
2673 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
2674   \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
2675 %<*en>
2676 This command sets the `accompanied' alphabetic font family (given by the latter 4~arguments)
2677 with respect to a Japanese font family given by the former 4~arguments.
2678 %</en>
2679 %<*ja>
2680 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
2681 そのフォントに対応する「従属欧文」フォントファミリを後半の4引数により与える.
2682 %</ja>
2683 \item[SetRelationFont]
2684 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
2685 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
2686 \item[userelfont]
2687 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
2688              font family with respect to current Japanese font family,
2689              which was set by
2690              \verb+\DeclareRelationFont+ or \verb+SetRelationFont+.
2691 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
2692
2693 \item[adjustbaseline]
2694 ...
2695
2696 \item[fontfamily\{<family>\}]
2697 {\let\item\origitem
2698 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
2699 to <family>. Which family will be changed is determined as follows:
2700 \begin{itemize}
2701 \item Let current encoding scheme for Japanese fonts be
2702       <ja-enc>. Current Japanese font family will be changed to
2703       <family>, if one of the following two conditions is met:
2704 \begin{itemize}
2705 \item The family <fam> under the encoding <ja-enc> is already defined by
2706       \verb+\DeclareKanijFamily+.
2707 \item A font definition named \texttt{<enc><ja-enc>.fd} (the file name is
2708       all lowercase) exists.
2709 \end{itemize}
2710 \item Let current encoding scheme for Japanese fonts be
2711       <al-enc>. For alphabetic font family, the criterion as above is used.
2712 \item There is a case which none of the above applies, that is, the font
2713       family named <family> doesn't seem to be defined neither under the
2714       encoding <ja-enc>, nor under <al-enc>.
2715
2716 In this case, the default family for font substitution is used for
2717       alphabetic and Japanese fonts. Note that current encoding will not
2718       be set to <family>, unlike the original implementation in \LaTeX.
2719 \end{itemize}
2720 }
2721 \end{cslist}
2722
2723 As closing this subsection, we shall introduce an example of
2724 \verb+SetRelationFont+ and \verb+\userelfont+:
2725 \begin{LTXexample}
2726 \gtfamily{}あいうabc
2727 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
2728 \userelfont\selectfont{}あいうabc
2729 \end{LTXexample}
2730
2731
2732 %<en>\subsection{Cropmark/`tombow'}
2733 %<ja>\subsection{トンボ}
2734
2735 %<en>\section{Extensions}
2736 %<ja>\section{拡張}
2737 \subsection{\texttt{luatexja-fontspec.sty}}
2738
2739 \subsection{\texttt{luatexja-otf.sty}}
2740 This optional package supports typesetting characters in
2741 Adobe-Japan1. \texttt{luatexja-otf.sty} offers the following 2~low-level
2742 commands:
2743 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2744 \item[\char92CID\{<number>\}]
2745 Typeset a character whose CID number is <number>.
2746 \item[\char92UTF\{<hex\_number>\}]
2747 Typeset a character whose character code is <hex\_number> (in hexadecimal).
2748 This command is similar to \verb+\char"+<hex\_number>,\ %"
2749 but please remind remarks below.
2750 \end{list}
2751
2752 \paragraph{Remarks}
2753 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
2754 ordinary characters in the following points:
2755 \begin{itemize}
2756 \item Always treated as \textbf{JAchar}s.
2757 \item Processing codes for supporting OpenType features (\textit{e.g.},
2758       glyph replacement and kerning) by the \Pkg{luaotfload} package
2759       is not performed to these characters.
2760 \end{itemize}
2761
2762
2763 \paragraph{Additionally Syntax of JFM}
2764 \texttt{luatexja-otf.sty} extends the syntax of JFM; the entries of \texttt{
2765 chars} table in JFM now allows a string in the form
2766 \verb+'AJ1-xxx'+, which stands for the character
2767 whose CID number in Adobe-Japan1 is \verb+xxx+.
2768
2769 %<en>\part{Implementations}
2770 %<ja>\part{実装}
2771 \label{part-imp}
2772 %<en>\section{Storing Parameters}
2773 %<ja>\section{パラメータの保持}
2774 \label{sec-para}
2775 %<en>\subsection{Used Dimensions, Attributes and whatsit nodes}
2776 %<ja>\subsection{用いられる寸法レジスタ,属性レジスタ,whatsit ノード}
2777 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
2778 \begin{list}{}{%
2779 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
2780 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
2781 \def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
2782 }
2783
2784 \dim{jQ}
2785 As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to
2786                         $1\,\textrm{Q}=0.25\,\textrm{mm}$, where `Q'~(also called `級') is
2787                         a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
2788 \dim{jH}
2789 There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
2790                         used in Japanese phototypesetting. This
2791                         \verb+\jH+ is a synonym of \verb+\jQ+.
2792 \dim{ltj@zw} A temporal register for the `full-width' of current Japanese font.
2793 \dim{ltj@zh} A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
2794 \attr{jfam} Current number of Japanese font family for math formulas.
2795 \attr{ltj@curjfnt} The font index of current Japanese font.
2796 \attr{ltj@charclass} The character class of Japanese \textit{glyph\_node}.
2797 \attr{ltj@yablshift} The amount of shifting the baseline of alphabetic
2798                         fonts in scaled point ($2^{-16}\,\textrm{pt}$).
2799 \attr{ltj@ykblshift} The amount of shifting the baseline of Japanese
2800                         fonts in scaled point ($2^{-16}\,\textrm{pt}$).
2801 \attr{ltj@autospc} Whether the auto insertion of \Param{kanjiskip} is allowed at the node.
2802 \attr{ltj@autoxspc} Whether the auto insertion of \Param{xkanjiskip} is allowed at the node.
2803 \attr{ltj@icflag} An attribute for distinguishing `kinds' of a node. One of the following value is
2804                         assigned to this attribute:
2805 \begin{description}
2806 \item[\textit{italic} (1)] Glues from an italic correction
2807            (\verb+\/+). This distinction of origins of glues
2808            (from explicit \verb+\kern+, or from \verb+\/+)
2809            is needed in the insertion process of \Param{xkanjiskip}.
2810 \item[\textit{packed} (2)]
2811 \item[\textit{kinsoku} (3)] Penalties inserted for the word-wrapping  process of Japanese characters (\emph{kinsoku}).
2812 \item[\textit{from\_jfm} (4)] Glues/kerns from JFM.
2813 \item[\textit{line\_end} (5)] Kerns for ...
2814 \item[\textit{kanji\_skip} (6)] Glues for \Param{kanjiskip}.
2815 \item[\textit{xkanji\_skip} (7)] Glues for \Param{xkanjiskip}.
2816 \item[\textit{processed} (8)] Nodes which is already processed by ...
2817 \item[\textit{ic\_processed} (9)] Glues from an italic correction, but also already processed.
2818 \item[\textit{boxbdd} (15)] Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
2819 \end{description}
2820 \attr{ltj@kcat$i$} Where $i$~is a natural number which is less than~7.
2821 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
2822 \end{list}
2823
2824 Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
2825 typesetting. All those nodes store a natural number (hence the node's
2826 \texttt{type} is 100).
2827 \begin{description}
2828 \item[30111] Nodes for indicating that \verb+\inhibitglue+ is
2829            specified. The \texttt{value} field of these nodes doesn't matter.
2830 \item[30112] Nodes for \LuaTeX-ja's stack system (see the next
2831            subsection). The \texttt{value} field of these nodes is
2832            current group.
2833 \item[30113] Nodes for Japanese Characters which the callback process of
2834            luaotfload won't be applied, and the character code is
2835            stored in the \texttt{value} field. Each node having this
2836            \verb+user_id+ is converted to a `glyph\_node' \emph{after}
2837            the callback process of luaotfload.
2838 \end{description}
2839 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
2840
2841 %<en>\subsection{Stack System of \LuaTeX-ja}
2842 %<ja>\subsection{\LuaTeX-ja のスタックシステム}
2843 \label{ssec-stack}
2844 \paragraph{Background}
2845 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
2846 are stored in it.  To clarify the reason, imagine the parameter
2847 \Param{kanjiskip} is stored by a skip, and consider the following
2848 source:
2849 \begin{LTXexample}
2850 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
2851 \setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
2852 \box0.ぴよぴよ\par
2853 \end{LTXexample}
2854
2855 As described in Part~\ref{part-ref}, the only effective value of
2856 \Param{kanjiskip} in an hbox is the latest value, so the value of
2857 \Param{kanjiskip} which applied in the entire hbox should be 5\,pt.
2858 However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
2859 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
2860 file in the source of \LuaTeX), there are the following codes:
2861 \begin{lstlisting}
2862 void package(int c)
2863 {
2864     scaled h;                   /* height of box */
2865     halfword p;                 /* first node in a box */
2866     scaled d;                   /* max depth */
2867     int grp;
2868     grp = cur_group;
2869     d = box_max_depth;
2870     unsave();
2871     save_ptr -= 4;
2872     if (cur_list.mode_field == -hmode) {
2873         cur_box = filtered_hpack(cur_list.head_field,
2874                                  cur_list.tail_field, saved_value(1),
2875                                  saved_level(1), grp, saved_level(2));
2876         subtype(cur_box) = HLIST_SUBTYPE_HBOX;
2877 \end{lstlisting}
2878 Notice that \verb+unsave+ is executed \emph{before}
2879 \verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
2880 executed): so `5\,pt' in the above source is orphaned at
2881 \texttt+unsave+, and hence it can't be accessed from \verb+hpack_filter+
2882 callback.
2883
2884 \paragraph{The method}
2885 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
2886 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
2887
2888 These are two \TeX\ count registers for maintaining information:
2889 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
2890 the \TeX's group level when the last assignment was done.  Parameters
2891 are stored in one big table named \texttt{charprop\_stack\_table}, where
2892 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
2893 a new stack level is created by \verb+\ltjsetparameter+, all data of the
2894 previous level is copied.
2895
2896 To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
2897 another thing: When a new stack level is about to be created, a whatsit
2898 node whose type, subtype and value are 44~(\textit{user\_defined}),
2899 30112, and current group level respectively is appended to the current
2900 list (we refer this node by \textit{stack\_flag}). This enables us to
2901 know whether assignment is done just inside a hbox. Suppose that the
2902 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
2903 group, then:
2904 \begin{itemize}
2905 \item If there is no \textit{stack\_flag} node in the list of hbox, then
2906       no assignment was occurred inside the hbox. Hence values of
2907       parameters at the end of the hbox are stored in the stack
2908       level~$s$.
2909 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
2910       an assignment was occurred just inside the hbox group. Hence
2911       values of parameters at the end of the hbox are stored in the
2912       stack level~$s+1$.
2913 \item If there are \textit{stack\_flag} nodes but all of their values
2914       are more than~$t+1$, then an assignment was occurred in the box,
2915       but it is done is `more internal' group. Hence values of
2916       parameters at the end of the hbox are stored in the stack
2917       level~$s$.
2918 \end{itemize}
2919
2920 Note that to work this trick correctly, assignments to
2921 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
2922 regardless the value of \verb+\globaldefs+.
2923 This problem is resolved by using
2924 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
2925
2926
2927 %<en>\section{Linebreak after Japanese Character}
2928 %<ja>\section{和文文字直後の改行}
2929 \label{sec-lbreak}
2930 %<en>\subsection{Reference: Behavior in \pTeX}
2931 %<ja>\subsection{参考: \pTeX の動作}
2932 %<*en>
2933 In~\pTeX, a line break after a Japanese character doesn't emit a space,
2934 since words are not separated by spaces in Japanese writings. However,
2935 this feature isn't fully implemented in \LuaTeX-ja due to the
2936 specification of callbacks in~\LuaTeX. To clarify the difference between
2937 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
2938 this subsection.
2939
2940 \pTeX's input processor can be described in terms of a finite state
2941 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
2942 internal states are as follows:
2943 \begin{itemize}
2944 \item State~$N$: new line
2945 \item State~$S$: skipping spaces
2946 \item State~$M$: middle of line
2947 \item State~$K$: after a Japanese character
2948 \end{itemize}
2949 The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
2950 processor.  State~$K$ is similar to state~$M$, and is entered after
2951 Japanese characters.  The diagram of state transitions are indicated in
2952 Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
2953 after `beginning/ending of a group' characters.
2954 %</en>
2955
2956 %<*ja>
2957 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
2958 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
2959 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
2960
2961 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
2962 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
2963 以下に述べるような4状態を持っている.
2964
2965 \begin{itemize}
2966 \item State~$N$: 行の開始.
2967 \item State~$S$: 空白読み飛ばし.
2968 \item State~$M$: 行中.
2969 \item State~$K$: 行中(和文文字の後).
2970 \end{itemize}
2971 また,状態遷移は,図\ref{fig-ptexipro} のようになっており,図中の数字は
2972 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
2973 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
2974 じものになる.
2975
2976 この図から分かることは,
2977 \begin{quote}
2978 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
2979 \end{quote}
2980 ということである.
2981 %</ja>
2982
2983 \begin{figure}[!tb]
2984 \begin{gather*}
2985  \def\sp{\texttt{\char32}}
2986  \xymatrix{&&
2987    {\text{scan a cs}}\ar@(r,ul)[dr]&\\
2988 \ar[r]&
2989    *++[o][F-]{N}\ar[ur]^0\ar[dd]_{d,\ g}\ar[u]^{5\ (\texttt{\char92par})}
2990      \ar@{->}@(d,l)[ddrr]_(0.45){j}&&
2991    *++[o][F-]{S}\ar@(l,dr)[ul]^0\ar@(l,ur)[ddll]_{d,\ g}\ar[u]_{5}
2992      \ar@{->}@(r,r)[dd]^{j}\\&\\&
2993    *++[o][F-]{M}\ar[uuur]^0\ar@(r,dl)[uurr]_(0.55){10\ (\sp)}
2994      \ar[d]_{5\ ({\sp})}\ar@{->}@(dr,dl)[rr]_{j}&&
2995    *++[o][F-]{K}\ar@{->}@(ul,d)[uuul]^0\ar@{->}[ll]^{d}
2996      \ar@{->}@(ur,dr)[uu]^{10\ (\sp)}\ar@{->}[d]_5\\
2997    &&&
2998  }\\
2999  d:=\{3,4,6,7,8,11,12,13\},\quad g:=\{1,2\},\quad j:=(\text{Japanese characters})
3000 \end{gather*}
3001 \begin{itemize}
3002 \item Numbers represent category codes.
3003 \item Category codes 9~(ignored), 14~(comment)~and~15~(invalid) are omitted in above diagram.
3004 \end{itemize}
3005 \caption{State transitions of \pTeX's input processor.}
3006 \label{fig-ptexipro}
3007 \end{figure}
3008
3009
3010 %<en>\subsection{Behavior in \LuaTeX-ja}
3011 %<ja>\subsection{\LuaTeX-ja の動作}
3012 %<*en>
3013 States in the input processor of \LuaTeX\ is the same as that of \TeX,
3014 and they can't be customized by any callbacks. Hence, we can only use
3015 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
3016 suppress a space by a line break which is after Japanese characters.
3017
3018 However, \verb+token_filter+ callback cannot be used either, since a
3019 character in category code 5~(end-of-line) is converted into an space
3020 token \emph{in the input processor}.  So we can use only the
3021 \verb+process_input_buffer+ callback.  This means that suppressing a
3022 space must be done \emph{just before} an input line is read.
3023
3024 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
3025 \begin{quote}
3026 A character U+FFFFF (its category code is set to 14~(comment) by
3027 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
3028 process it}, if and only if the following two conditions are satisfied:
3029 \begin{enumerate}
3030 \item The category code of the character $\langle${return}$\rangle$
3031       (whose character code is 13) is 5~(end-of-line).
3032 \item The input line matches the following `regular expression':
3033 \[
3034   (\text{any char})^*(\textbf{JAchar})
3035   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
3036 \]
3037 \end{enumerate}
3038 \end{quote}
3039
3040 \paragraph{Remark}
3041 The following example shows the major difference from the behavior of \pTeX:
3042 \begin{LTXexample}
3043 \ltjsetparameter{autoxspacing=false}
3044 \ltjsetparameter{jacharrange={-6}}xあ
3045 y\ltjsetparameter{jacharrange={+6}}zあ
3046 u
3047 \end{LTXexample}
3048 \begin{itemize}
3049 \item There is no space between `x' and `y', since the line~2 ends with a \textbf{JAchar} `あ'
3050 (this `あ' considered as an \textbf{JAchar} at the ending of line~1).
3051 \item There is no space between `あ' (in the line~3) and `u', since the
3052       line~3 ends with an \textbf{ALchar}
3053 (the letter `あ' considered as an \textbf{ALchar} at the ending of line~2).
3054 \end{itemize}
3055 %</en>
3056
3057 %<*ja>
3058 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,callbackによりユーザが
3059 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
3060 きそうなcallbackとしては,\verb+process_input_buffer+や
3061 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
3062 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
3063 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
3064 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
3065 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
3066
3067 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
3068 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
3069 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
3070
3071 \begin{quote}
3072 各入力行に対し,\textbf{その入力行が読まれる前の内部状態で}
3073 以下の2条件が満たされている場合,\LuaTeX-jaはU+FFFFF番の文字
3074 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
3075 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
3076 \begin{enumerate}
3077 \item 改行文字(文字コード13番)のカテゴリーコードが5~(end-of-line)である.
3078 \item 入力行は次の「正規表現」にマッチしている:
3079 \[
3080   (\text{any char})^*(\textbf{JAchar})
3081   \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
3082 \]
3083 \end{enumerate}
3084 \end{quote}
3085
3086 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.最初の条件は,
3087 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
3088 しかしながら,完全に同じ挙動が実現できたわけではない.
3089 差異は,次の例が示すように,和文文字の範囲を変更した行の改行において見られる:
3090 \begin{LTXexample}
3091 \ltjsetparameter{autoxspacing=false}
3092 \ltjsetparameter{jacharrange={-6}}xあ
3093 y\ltjsetparameter{jacharrange={+6}}zあ
3094 u
3095 \end{LTXexample}
3096 もし\pTeX とまったく同じ挙動を示すならば,出力は
3097 「\hbox{\ltjsetparameter{autoxspacing=false}x yzあu}」となるべきである.しかし,実際には
3098 上のように異なる挙動となっている.
3099 \begin{itemize}
3100 \item 2行目は「あ」という和文文字で終わる(2行目を処理する前の時点では,
3101       「あ」は和文文字扱いである)ため,直後の改行文字は無視される.
3102 \item 3行目は「あ」という欧文文字で終わる(2行目を処理する前の時点では,
3103       「あ」は欧文文字扱いである)ため,直後の改行文字は空白に置き換わる.
3104 \end{itemize}
3105 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
3106 その行はそこで改行するようにした方がいいだろう.
3107 %</ja>
3108
3109
3110 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
3111 %<ja>\section{JFM グルーの挿入,\Param{kanjiskip} と \Param{xkanjiskip}}
3112 %<en>\subsection{Overview}
3113 %<ja>\subsection{概要}
3114
3115
3116 \LuaTeX-ja における和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.
3117 \pTeX では次のような仕様であった:
3118 \begin{itemize}
3119 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
3120 追加する過程で行われる.
3121 \item \Param{xkanjiskip}の挿入は,hboxへのパッケージングや行分割前に行われる.
3122 \item \Param{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に
3123 「和文文字を表す2つの<char\_node>の間には\Param{kanjiskip}がある」ものとみなされる.
3124 \end{itemize}
3125 しかし,\LuaTeX-jaでは,hboxへのパッケージングや行分割前に全ての
3126 \textbf{JAglue},即ちJFMグルー・\Param{xkanjiskip}・\Param{kanjiskip}の
3127 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
3128 カーニング処理がノードベースになったことに対応する変更である.
3129
3130 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
3131 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
3132 るノード達(アクセント位置補正用のkernや,イタリック補正)をまとめたもの
3133 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
3134 には関係しないものがある.
3135
3136
3137 %<en>\subsection{definition of a `cluster'}
3138 %<ja>\subsection{「クラスタ」の定義}
3139
3140 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
3141 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
3142 \begin{defn}
3143 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
3144 with the \textit{id} of it:
3145 \begin{enumerate}
3146 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$.  These
3147       nodes come from a hbox which is already packaged, by unpackaging
3148       (\verb+\unhbox+).
3149       The \textit{id} is \textit{id\_pbox}.
3150 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
3151       The \textit{id} is \textit{id\_math}.
3152 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
3153 \begin{enumerate}
3154 \item A kern for the italic correction of~$p$.
3155 \item An accent attached to $p$ by \verb+\accent+.
3156 \end{enumerate}
3157 \[
3158 \overbrace{%
3159  \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
3160 \left\{\begin{array}{c}
3161 \Node{glyph}{accent}\\\noalign{\medskip}
3162 \Node{hbox}{accent (shifted vert.)}
3163 \end{array}\right\}\longrightarrow
3164 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
3165 \longrightarrow
3166 \Node{glyph}{$p$}\longrightarrow
3167 \overbrace{%
3168 \Node{kern}{italic corr.}}^{\text{(b)}}
3169 \]
3170
3171 The \textit{id} is \textit{id\_jglyph} or
3172 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
3173 represents a Japanese character or not.
3174 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
3175 The \textit{id} is \textit{id\_hlist} if the node is an
3176       hbox which is not shifted vertically, or \textit{id\_box\_like}
3177       otherwise.
3178 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
3179 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
3180       and \textit{id\_disc}, respectively.
3181 \end{enumerate}
3182 We denote a cluster by \textit{Np}, \textit{Nq} and \textit{Nr}.
3183 \end{defn}
3184
3185 以降は日本語.
3186
3187 \paragraph{\textit{id}の意味}
3188 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
3189 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
3190 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
3191 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
3192 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
3193 説明用に準備した概念であって,実際の Lua コード中にそのように書かれているわけではないことに注意.
3194
3195 \begin{description}
3196 \item[\textit{id\_jglyph}] 和文文字.\\
3197 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
3198 \textit{glyph\_node}そのものである.
3199 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
3200 多くの場合,$p$は欧文文字を格納しているが,`ffi'などの合字によって作られた
3201 \textit{glyph\_node}である可能性もある.
3202 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
3203 一方,後者の場合,
3204 \begin{itemize}
3205 \item $\mathit{Np}.\mathit{head}$は,
3206 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
3207 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
3208 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
3209 \end{itemize}
3210 \item[\textit{id\_math}] インライン数式.\\
3211 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
3212 「文字コード$-1$の欧文文字」とおく.
3213 \item[\textit{id\_hlist}] 縦方向にシフトされていない hbox.\\
3214 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
3215 先頭・末尾のノードである.
3216 \begin{itemize}
3217 \item 状況によっては,\TeX ソースで言うと
3218 \begin{verbatim}
3219 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
3220 \end{verbatim}
3221 のように,$p$の内容が別の hbox で開始・終了している可能性も十分あり得る.そのような場合,
3222 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,\textbf{垂直方向にシフトされていない} hbox の
3223 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
3224 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた hbox,\verb+\lower1pt\hbox{xyz}+に対応するノードである.
3225 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用の kern が
3226 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
3227 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
3228 と同様に再帰的に構成要素をたどっていく.
3229 \end{itemize}
3230 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
3231 まとめて1つのクラスタとして取り扱うだけである.
3232 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
3233 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
3234 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
3235 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
3236 全く考慮に入れない.
3237 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
3238 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
3239 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
3240 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
3241 \end{description}
3242
3243 \paragraph{クラスタの別の分類}
3244 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
3245 挿入処理では2つの隣り合ったクラスタの間に
3246 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
3247 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
3248 \begin{description}
3249 \item[和文A] リスト中に直接出現している和文文字.
3250 \textit{id}が\textit{id\_jglyph}であるか,\\
3251 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
3252
3253 \item[和文B] リスト中のhboxの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
3254 JFMグルーの挿入が行われない(\Param{xkanjiskip},~\Param{kanjiskip}は入り得る)ことである.\\
3255 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
3256
3257 \item[欧文] リスト中に直接/hboxの中身として出現している欧文文字.次の3つの場合が該当:
3258 \begin{itemize}
3259 \item \textit{id}が\textit{id\_glyph}である.
3260 \item \textit{id}が\textit{id\_math}である.
3261 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
3262 \end{itemize}
3263 \item[箱] box,またはそれに類似するもの.次の2つが該当:
3264 \begin{itemize}
3265 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
3266 \item \textit{id}が\textit{id\_box\_like}である.
3267 \end{itemize}
3268
3269 \end{description}
3270
3271 \subsection{段落/hboxの先頭や末尾}
3272 \paragraph{先頭部の処理}
3273 まず,段落/hboxの一番最初にあるクラスタ\textit{Np}を探索する.
3274 hboxの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
3275 \begin{center}
3276 \verb+\parindent+由来のhbox ($\mathit{subtype}=3$),及び\textit{subtype}が44~(\textit{user\_defined})でない
3277 ようなwhatsit.
3278 \end{center}
3279 これは,\verb+\parindent+由来のhboxがクラスタを構成しないようにするためである.
3280
3281 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
3282 \begin{enumerate}
3283 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
3284 \item 問題のリストが字下げありの段落(\verb+\parindent+由来のhboxあり)の場合は,
3285 この空白$g$は「文字コード\texttt{'parbdd'}の文字」と\textit{Np}の間に入るglue/kernである.
3286 \item そうでないとき(\verb+noindent+で開始された段落や,hbox)は,
3287 $g$は「文字コード\texttt{'boxbdd'}の文字」と\textit{Np}の間に入るglue/kernである.
3288 \end{enumerate}
3289 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
3290 そこで,以下の場合には,$g$の直前に\verb+\penalty10000+を挿入する:
3291 \begin{itemize}
3292 \item 問題にしているリストが段落であり,かつ
3293 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
3294 \end{itemize}
3295
3296 \paragraph{末尾の処理}
3297 末尾の処理は,問題のリストが段落のものかhboxのものかによって異なる.
3298 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\texttt{'boxbdd'}の文字」の間に入るglue/kernを,
3299 \textit{Nq}の直後に挿入するのみである.
3300
3301 一方.前者(段落)の場合は,リストの末尾は常に\verb+\penalty10000+と,
3302 \verb+\parfillskip+由来のグルーが存在する.よって,最後のクラスタ\textit{Np}は
3303 この\verb+\parfillskip+由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
3304 \begin{enumerate}
3305 \item まず\textit{Nq}の直後に(後に述べる)\textsf{line-end~[E]}によって定まる空白を挿入する.
3306 \item 次に,段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
3307 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
3308
3309 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,かつその文字の\Param{kcatcode}が偶数であるような
3310 最後のクラスタの直前にあるものたちである\footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}
3311 を約物として考えていることになる.\Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
3312 \end{enumerate}
3313
3314 \subsection{概観と典型例:2つの「和文A」の場合}
3315 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
3316 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
3317 \[
3318  \Node{cluster}{\textit{Nq}}\longrightarrow
3319 \overbrace{
3320 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
3321 \longrightarrow \Node{cluster}{\textit{Np}}
3322 \]
3323 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
3324 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
3325 \[
3326  \Node{cluster}{\textit{Nq}}\longrightarrow\Node{kern}{左空白}\longrightarrow
3327 \overbrace{
3328 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{(a)}
3329 \longrightarrow \Node{glue or kern}{右空白}\longrightarrow \Node{cluster}{\textit{Np}}
3330 \]
3331
3332 以後,\textbf{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
3333 この場合が全ての場合の基本となる.
3334
3335 \paragraph{「右空白」の算出}
3336 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
3337 \begin{description}
3338 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
3339       デフォルト値\Param{kanjiskip}を採用することとなるので,次へ.
3340 \begin{enumerate}
3341 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),
3342       代わりに\Param{kanjiskip}が挿入されることとなる.次へ.
3343 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
3344       共通に使っているJFM内で挿入される空白 (glue or kern) が決まっているか調べる.
3345 \item 1.でも2.でもない場合は,\textit{Nq}と\textit{Np}が違うJFM/\texttt{jfmvar}/サイズである.
3346 この場合,まず
3347 \[
3348 \vcenter{\halign{\hfil$#:={}$&(\inhibitglue#\inhibitglue)\cr
3349 gb&\textit{Nq}と「文字コードが{\tt'diffmet'}の文字」との間に入るglue/kern\cr
3350 ga&「文字コードが{\tt'diffmet'}の文字」と\textit{Np}との間に入るglue/kern\cr
3351 }}
3352 \]
3353 として,左側由来・右側由来の空白 (glue/kern) を(それぞれのJFMから)求める.
3354 $\mathit{ga}$と$\mathit{gb}$のどちらか片方が未定義であるならば,定義されている側の値をそのまま採用する.
3355 もし$\mathit{ga}$と$\mathit{gb}$が両方決まっているならば,両者の値を平均\footnote{\Param{differentjfm}パラメタの
3356 値によって,「大きい方」「小さい方」「合計」に変えることができる.}した値を採用する.
3357 \end{enumerate}
3358
3359 例えば,
3360 \begin{verbatim}
3361 \jfont\foo=psft:Ryumin-Light:jfm=ujis
3362 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
3363 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
3364 \end{verbatim}
3365 という3フォントを考え,
3366 \[
3367  \overbrace{\Node{glyph}{{\tt\char92 foo}, `あ'}}^{p}
3368 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 bar}, `い'}}^{q}
3369 \longrightarrow \overbrace{\Node{glyph}{{\tt\char92 baz}, `う'}}^{r}
3370 \]
3371 という3ノードを考える(それぞれ単独でクラスタをなす).
3372 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず(2)の状況となる一方で,
3373 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar}キーの内容が異なるので(3)の状況となる.
3374 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
3375 \Param{kanjiskip}の値を以下で定め,それを「右空白」として採用する.
3376 この段階においては,\verb+\inhibitglue+は効力を持たないため,
3377 結果として,2つの和文文字間には常に何らかのglue/kernが挿入されることとなる.
3378 \begin{enumerate}
3379 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
3380 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
3381 \item ユーザ側から見た\Param{kanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
3382 なければ,\Param{kanjiskip}パラメタの値を持つglueを採用する.
3383 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{kanjiskip}の値を用いる.
3384 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
3385 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
3386 \end{enumerate}
3387 \end{description}
3388 \paragraph{「左空白」の算出とそれに伴う補正}
3389 次に,「左空白」にあたる量を算出する:
3390 \begin{description}
3391 \item[line-end~{[E]}]
3392 \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
3393 \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
3394 \begin{enumerate}
3395 \item 既に算出した「右空白」がkernである場合は,「左空白」は挿入されない.
3396 \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
3397 \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るkernとして,JFMから決定される.
3398 \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
3399 \end{enumerate}
3400 \end{description}
3401 \paragraph{禁則用ペナルティの挿入}
3402 まず,
3403 \[
3404  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値})
3405 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値})
3406 \]
3407 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
3408 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
3409 算出では単純な整数の加減算を行う.
3410
3411 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
3412 \begin{description}
3413 \item[P-normal~{[PN]}]
3414 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
3415 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
3416 また,$10000 + (-10000) = 0$としている.
3417
3418 少々困るのは,(a)部分にペナルティが存在していない場合である.
3419 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
3420 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
3421 ということになるが,実際には僅かにこれより複雑である.
3422 \begin{itemize}
3423 \item 「右空白」がkernであるとき,
3424 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
3425 この場合は$a\neq 0$であってもペナルティの挿入はしない.
3426 \item 「左空白」がkernとしてきっちり定義されている時(このとき,「右空白」はkernでない),
3427 この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
3428 \textit{penalty\_node}を作って挿入する.
3429 \item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
3430 \end{itemize}
3431 \end{description}
3432
3433 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
3434   \frac{\hbox to 1\zw{#1}\hbox to 4.5\zw{\hss #2}}{\hbox{#3}}$}
3435 \begin{table}[t]
3436 \caption{Summary of JFM glues}
3437 \label{tab-jfmglue}
3438 \begin{center}
3439 \small
3440 \begin{tabular}{>{\sf}c|cccccc}
3441 \toprule
3442 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
3443 和文A&
3444 \gkf{E}{M→K}{PN}&
3445 \gkf{---}{\OA →K}{PN}&
3446 \gkf{---}{\OA →X}{PN}&
3447 \gkf{---}{\OA}{PA}&
3448 \gkf{---}{\OA}{PN}&
3449 \gkf{---}{\OA}{PS}\\
3450 和文B&
3451 \gkf{E}{\OB→K}{PA}&
3452 \gkf{---}{K}{PS}&
3453 \gkf{---}{X}{PS}\\
3454 欧文&
3455 \gkf{E}{\OB →X}{PA}&
3456 \gkf{---}{X}{PS}\cr
3457 箱&\gkf{E}{\OB}{PA}\\
3458 glue&\gkf{E}{\OB}{PN}\\
3459 kern&\gkf{E}{\OB}{PS}\\
3460 \bottomrule
3461 \end{tabular}
3462 \end{center}
3463 \begin{quote}
3464 Here {\small\gkf{E}{M→K}{PN}} means that
3465 \begin{enumerate}
3466 \item To determine the `right-space', \LuaTeX-ja first attempts by the method `\textsf{JFM-origin~[M]}'.
3467 If this attempt fails, \LuaTeX-ja use the method `\textsf{\Param{kanjiskip}~[K]}'.
3468 \item The `left space' between \textit{Nq}~and~\textit{Np} is determined by the method `\textsf{line-end~[E]}'.
3469 \item \LuaTeX-ja adopts the method `\textsf{P-normal~[PN]}' to adjust the penalty between two clusters for \emph{kinsoku shori}.
3470 \end{enumerate}
3471 \end{quote}
3472 \end{table}
3473
3474 \subsection{その他の場合}
3475 本節の内容は表\ref{tab-jfmglue}にまとめてある.
3476
3477 \paragraph{和文Aと欧文の間}
3478 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
3479 \begin{itemize}
3480 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
3481 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
3482 \item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も同じ.
3483 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
3484 \end{itemize}
3485 \begin{description}
3486 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
3487 未定義でなければそれを「右空白」として採用する.
3488 \textsf{JFM-origin~[M]}の変種と考えて良い.
3489 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
3490 \begin{enumerate}
3491 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
3492 \item そうでなければ,
3493 \textit{Nq}と「文字コードが{\tt'jcharbdd'}の文字」との間に入るglue/kernとして定まる.
3494 \end{enumerate}
3495 \item[\Param{xkanjiskip}~{[X]}]
3496 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
3497 \Param{xkanjiskip}の値を以下で定め,それを「右空白」として採用する.
3498 この段階で\verb+\inhibitglue+は効力を持たないのも同じである.
3499 \begin{enumerate}
3500 \item 以下のいずれかの場合は,\Param{xkanjiskip}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
3501 \begin{itemize}
3502 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
3503 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{xkanjiskip}の挿入」が禁止されている
3504 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
3505 \item \textit{Np}の中身の文字コードについて,「直前への\Param{xkanjiskip}の挿入」が禁止されている
3506 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
3507 \end{itemize}
3508 \item ユーザ側から見た\Param{xkanjiskip}パラメタの自然長が${\tt \char92 maxdimen}=(2^{30}-1)\,{\rm sp}$で
3509 なければ,\Param{xkanjiskip}パラメタの値を持つglueを採用する.
3510 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
3511 で使われているJFMに指定されている\Param{xkanjiskip}の値を用いる.
3512 \end{enumerate}
3513 \end{description}
3514
3515 \paragraph{欧文と和文Aの間}
3516 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
3517 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
3518 \begin{itemize}
3519 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
3520 それが失敗した場合は,\textsf{\Param{xkanjiskip}~[X]}によって定める.
3521 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
3522 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
3523 \end{itemize}
3524 \begin{description}
3525 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
3526 未定義でなければそれを「右空白」として採用する.
3527 \textsf{JFM-origin~[M]}の変種と考えて良い.
3528 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
3529 \begin{enumerate}
3530 \item もし両クラスタの間で\verb+\inhibitglue+が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
3531 \item そうでなければ,
3532 「文字コードが{\tt'jcharbdd'}の文字」と\textit{Np}との間に入るglue/kernとして定まる.
3533 \end{enumerate}
3534 \end{description}
3535
3536 \paragraph{和文Aと箱・glue・kernの間}
3537 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・glue・kernのいずれかであった場合,
3538 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
3539 ペナルティの挿入処理は若干異なったものとなっている.
3540
3541 \begin{itemize}
3542 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
3543 それが失敗した場合は,「右空白」は挿入されない.
3544 \item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
3545 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
3546 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
3547 「$\mathit{Np}.\mathit{head}$に対する\Param{prebreakpenalty}の値」は0とみなされる.言い換えれば,
3548 \[
3549  a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{postbreakpenalty}の値}).
3550 \]
3551 \begin{description}
3552 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
3553 (明示的に両クラスタの間に\verb+\penalty10000+があった場合を除き)いつも許容される.そのため,
3554 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
3555 \item[glue] \textit{Np}がglueの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
3556 \item[kern] \textit{Np}がkernであった場合は,両クラスタの間での行分割は
3557 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
3558 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
3559 \end{description}
3560 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
3561 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
3562 \end{itemize}
3563
3564 \begin{description}
3565 \item[P-allow~{[PA]}]
3566 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
3567 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
3568
3569 (a)部分にペナルティが存在していない場合,
3570 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
3571 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
3572 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
3573 \begin{itemize}
3574 \item 「右空白」がglueでない(kernか未定義)であるとき.
3575 \item 「左空白」がkernとしてきっちり定義されている時.
3576 \end{itemize}
3577
3578 \item[P-suppress~{[PS]}]
3579 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
3580 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
3581
3582 (a)部分にペナルティが存在していない場合,
3583 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
3584 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
3585 そのため,「右空白」がglueであれば,その直前に\verb+\penalty10000+を挿入する.
3586 \end{description}
3587
3588 なお,「右空白」はkern,「左空白」は未定義の
3589 \[
3590  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
3591 \]
3592 のような状況を考える.
3593 このとき,$a$,即ち「あ」の\Param{postbreakpenalty}がいかなる値であっても,
3594 この2クラスタ間は最終的に
3595 \begin{equation}
3596  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
3597 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
3598 \label{eq-gref}
3599 \end{equation}
3600 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
3601 \Param{postbreakpenalty}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
3602 \eqref{eq-gref}と
3603 \[
3604  \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
3605 \Node{penalty}{$a$}\longrightarrow
3606 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
3607 \]
3608 との間に差異は生じない%
3609 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
3610 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
3611
3612 \paragraph{箱・glue・kernと和文Aの間}
3613 \textit{Np}が\textsf{箱}・glue・kernのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
3614 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合とほぼ同じであるが,「左空白」がなくなることにのみ注意.
3615 \begin{itemize}
3616 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
3617 それが失敗した場合は,「右空白」は挿入されない.
3618 \item \textit{Nq}が和文でないので,「左空白」は算出されない.
3619 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
3620 $\mathit{Nq}.\mathit{tail}$は無意味なので,
3621 \[
3622  a:=(\text{\textit{Np}{\footnotemark}の文字に対する\Param{prebreakpenalty}の値}).
3623 \]
3624 \begin{description}
3625 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
3626 \item[glue] \textit{Nq}がglueの場合は,\textsf{P-normal~[PN]}を用いる.
3627 \item[kern] \textit{Nq}がkernの場合は,\textsf{P-suppress~[PS]}を用いる.
3628 \end{description}
3629 \end{itemize}
3630
3631 \paragraph{和文Aと和文Bの違い}
3632 先に述べたように,\textsf{和文B}はhboxの中身の先頭(or 末尾)として出現している
3633 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
3634 \begin{itemize}
3635 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
3636 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
3637 「左空白」の算出も行われない.例えば,
3638 \begin{itemize}
3639 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
3640 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
3641 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
3642 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
3643 \end{itemize}
3644 \item \textsf{和文B}と箱・glue・kernが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
3645 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
3646 \textsf{P-suppress~[PS]}が用いられる.
3647 \item \textsf{和文B}の文字に対する\Param{prebreakpenalty},~\Param{postbreakpenalty}の値は使われず,0として計算される.
3648 \end{itemize}
3649
3650
3651 次が具体例である:
3652 \begin{LTXexample}
3653 あ.\inhibitglue A\\
3654 \hbox{あ.}A\\
3655 あ.A
3656 \end{LTXexample}
3657 \begin{itemize}
3658 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
3659 \Param{xkanjiskip}(四分アキ)が入ることに注意.
3660 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(hboxの中身の末尾として登場しているから)ので,
3661 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{xkanjiskip}が入ることとなる.
3662 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
3663 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
3664 \end{itemize}
3665
3666 \section{psft}
3667 \end{document}