2 %#! lualatex -shell-escape
4 % To typeset this manual, you need following two fonts:
5 % - KozMinPr6N-Regular.otf
6 % - KozGoPr6N-Medium.otf
7 % - KozGoPr6N-Regular.otf
9 %<en>\documentclass[a4paper,titlepage]{article}
10 %<ja>\documentclass[a4paper,titlepage]{ltjsarticle}
16 %%%%%%%% record loaded packages
18 \newif\if@real@append@list
19 \def\@append@newentry#1#2{{%
20 \@real@append@listtrue \def\@tempa{#2}%
21 \let\@pkglist\@append@newentry@pkglist#1%
23 \let\@pkglist=\relax\xdef#1{#1\@pkglist{#2}}%
25 \def\@append@newentry@pkglist#1{%
27 \ifx\@tempa\@tempb\@real@append@listfalse\fi}
28 \def\@addtofilelist#1{\@append@newentry\ltjpkglist{#1}}
32 \usepackage[margin=25mm,lmargin=30mm,rmargin=30mm,footskip=6mm]{geometry}
33 \usepackage{luatexja-adjust}\ltjdisableadjust
34 \parskip=\smallskipamount
35 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
36 {3.25ex \@plus1ex \@minus.2ex}%
38 {\normalfont\normalsize\bfseries\raisebox{.2ex}{$\mdlgblksquare\mkern1mu$}}}
41 \usepackage[textwidth=45\zw, lines=45, footskip=6mm]{geometry}
42 \usepackage{luatexja-adjust}%\ltjdisableadjust
43 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
46 \usepackage{amsmath,array,tikz,pict2e,multienum,float}
47 \usepackage{booktabs,multicol}
53 \def\IVS#1{\char\numexpr "E0100+#1\relax}%"
55 \textcolor{blue}{\raisebox{3.5pt}{\tt%
56 \fboxsep=0.5pt\fbox{\tiny \oalign{0#1#2\crcr#3#4#5\crcr}}}}%
59 \gdef\IVSB#1{\expandafter\IVSA\directlua{
60 local cat_str = luatexbase.catcodetables['string']
61 tex.sprint(cat_str, string.format('%X', 0xE00EF+#1))
64 \usepackage{listings,showexpl}
66 basicstyle=\ttfamily\small, pos=r, breaklines=true,
67 numbers=none, rframe={}, basewidth=0.5em, numberstyle=\tiny, numbersep=0.5em,
68 explpreset={numberstyle=\tiny, numbers=left, numbersep=1em, columns=fixed}
70 % Suppress output from showexpl to stdout.
76 \title{The \LuaTeX-ja package}
77 \author{The \LuaTeX-ja project team}
80 \title{\LuaTeX-jaパッケージ}
81 \author{\LuaTeX-jaプロジェクトチーム}
86 allbordercolors=1 1 1,
89 pdfauthor={The LuaTeX-ja project team},
90 pdftitle={The LuaTeX-ja package}
93 pdfauthor={LuaTeX-jaプロジェクトチーム},
94 pdftitle={LuaTeX-jaパッケージ}
98 %%%%%%%% definition env.
100 \theoremstyle{definition}
101 %<en>\newtheorem{defn}{Definition}
102 %<ja>\newtheorem{defn}{定義}
105 \usepackage{luatexja-otf}
106 %<ja>\usepackage{lmodern}
107 \directlua{luatexja.otf.enable_ivs()}
108 \usepackage[kozuka-pr6n]{luatexja-preset}
110 \def\emph#1{\textbf{\textgt{#1}}}
111 \def\headfont{\normalfont\bfseries\gtfamily}
115 \usepackage{unicode-math}
116 \setmainfont[Ligatures=TeX]{TeX Gyre Termes}
117 \setsansfont[Scale=0.95,Ligatures=TeX]{TeX Gyre Heros}
118 \setmathfont{xits-math.otf}
121 \DeclareRobustCommand\ttfamily
122 {\not@math@alphabet\ttfamily\mathtt
123 \romanfamily\ttdefault\ttjfam\selectfont}
124 \newjfontfamily\ttjfam{KozGoPr6N-Regular.otf}
128 \usepackage{metalogo}
129 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
130 \DeclareRobustCommand\LuaTeX{Lua\TeX}
131 \DeclareRobustCommand\pdfTeX{pdf\TeX}
132 \DeclareRobustCommand\pTeX{p\kern-.15em\TeX}
133 \DeclareRobustCommand\upTeX{up\kern-.15em\TeX}
134 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
135 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
136 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
138 %%%%%%%% other macros
139 \newenvironment{cslist}{%
142 \parindent=0pt\def\makelabel##1{{\tt\char92##1}}
143 \def\{{\char`\{}\def\}{\char`\}}
145 \def\item[##1]{\par\smallskip\par\hskip-\leftskip\makelabel{##1}\par}
146 \@totalleftmargin\leftskip
151 \def\labelenumii{(\arabic{enumii})}
152 \long\def\@makecaption#1#2{%
153 \vskip\abovecaptionskip
154 \sbox\@tempboxa{{\small #1. #2}}%
155 \ifdim \wd\@tempboxa >\hsize
158 \global \@minipagefalse
159 \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
161 \vskip\belowcaptionskip}
163 \def\_{\leavevmode \kern .06em\vbox {\hrule \@width .333em}}
169 \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr
170 #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}}
172 \protected\def\Param#1{\textsf{#1}} % parameter name
173 \protected\def\Pkg#1{\underline{\smash{\texttt{#1}}}} % packages/classes
182 \def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
189 \textbf{This documentation is far from complete. It may have many
190 grammatical (and contextual) errors.} Also, several parts
191 are written in Japanese only.
194 \emph{\large 本ドキュメントはまだまだ未完成です.}
198 %<en>\part{User's manual}
199 %<ja>\part{ユーザーズマニュアル}
201 %<en>\section{Introduction}
206 The \LuaTeX-ja package is a macro package for typesetting high-quality
207 Japanese documents when using \LuaTeX.
210 \LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
211 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
213 %<en>\subsection{Backgrounds}
217 Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
218 are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
219 extension of \TeX: so it can produce high-quality Japanese documents
220 without using very complicated macros. But this point is a mixed
221 blessing: \pTeX\ is left behind from other extensions of \TeX,
222 especially \eTeX\ and \pdfTeX, and from changes about
223 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
226 従来,「\TeX を用いて日本語組版を行う」といったとき,エンジンとしては
227 ASCII \pTeX やそれの拡張物が用いられることが一般的であった.\pTeX は\TeX
228 のエンジン拡張であり,(少々仕様上不便な点はあるものの)商業印刷の分野に
229 も用いられるほどの高品質な日本語組版を可能としている.だが,それは弱点に
230 もなってしまった:\pTeX という(組版的に)満足なものがあったため,海外で
231 行われている数々の\TeX の拡張――例えば\eTeX や\pdfTeX ――や,TrueType,
232 OpenType, Unicodeといった計算機で日本語を扱う際の状況の変化に追従すること
237 Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
238 of \pTeX) and \epTeX\ (merging of \pTeX\ and
239 \eTeX\ extension), have developed to fill those gaps to some
240 extent, but gaps still exist.
243 ここ数年,若干状況は改善されてきた.現在手に入る大半の\pTeX バイナリでは
244 外部UTF-8入力が利用可能となり,さらにUnicode化を推進し,\pTeX の内部処理
245 までUnicode化した\upTeX も開発されている.また,\pTeX に\eTeX 拡張をマー
246 ジした\epTeX も登場し,\TeX\ Live\ 2011では\pLaTeX が\epTeX の上で動作す
247 るようになった.だが,\pdfTeX 拡張(PDF直接出力やmicro-typesetting)を
248 \pTeX に対応させようという動きはなく,海外とのgapは未だにあるのが現状であ
253 However, the appearance of \LuaTeX\ changed the whole situation. With
254 using Lua ``callbacks'', users can customize the internal processing of
255 \LuaTeX. So there is no need to modify sources of engines to
256 support Japanese typesetting: to do this, we only have to write Lua
257 scripts for appropriate callbacks.
260 しかし,\LuaTeX の登場で,状況は大きく変わることになった.Luaコードで
261 ``callback''を書くことにより,\LuaTeX の内部処理に割り込みをかけることが可
262 能となった.これは,エンジン拡張という真似をしなくても,Luaコードとそれに
263 関する\TeX マクロを書けば,エンジン拡張とほぼ同程度のことができるようになっ
264 たということを意味する.\LuaTeX-jaは,このアプローチによってLuaコード・
265 \TeX マクロによって日本語組版を\LuaTeX の上で実現させようという目的で開発
269 %<en>\subsection{Major Changes from \pTeX}
270 %<ja>\subsection{\pTeX からの主な変更点}
274 The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
275 target of development was to implement features of \pTeX. However,
276 \emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
277 specifications/behaviors of \pTeX\ were not adopted}.
280 \LuaTeX-jaは,\pTeX に多大な影響を受けている.初期の開発目標は,\pTeX の機
281 能をLuaコードにより実装することであった.しかし,開発が進むにつれ,\pTeX
282 の完全な移植は不可能であり,また\pTeX における実装がいささか不可解になっ
283 ているような状況も発見された.そのため,\emph{\LuaTeX-jaは,もはや
284 \pTeX の完全な移植は目標とはしない.\pTeX における不自然な仕様・挙動があ
289 The followings are major changes from \pTeX:
292 以下は \pTeX からの主な変更点である.
297 \item A Japanese font is a tuple of a ``real'' font, a Japanese font
298 metric (\emph{JFM}, for short).
301 \item 和文フォントは(小塚明朝,IPA明朝などの)実際のフォント,和文フォン
302 トメトリック(JFMと呼ぶ\footnote{混乱を防ぐため,p\TeX の意味での
303 JFM (\texttt{min10.tfm}) などは本ドキュメントでは\emph{和文用
304 TFM}とよぶことにする.})の組である.
308 \item In \pTeX, a line break after Japanese character is ignored (and
309 doesn't yield a space), since line breaks (in source files) are
310 permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
311 doesn't have this function completely, because of a specification
315 \item 日本語の文書中では改行はほとんどどこでも許されるので,\pTeX では和文文字
316 直後の改行は無視される(スペースが入らない)ようになっていた.しかし,
317 \LuaTeX-ja では \LuaTeX の仕様のためにこの機能は完全には実装されていない.
321 \item The insertion process of glues/kerns between two Japanese
322 characters and between a Japanese character and other characters
323 (we refer glues/kerns of both kinds as \textbf{JAglue}) is rewritten from
327 \item 2つの和文文字の間や,和文文字と欧文文字の間に入るグルー/カーン
328 (両者をあわせて\textbf{JAglue}と呼ぶ)の挿入処理が0から書き直されている.
333 \item As \LuaTeX's internal ligature handling is ``node-based''
334 (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
335 insertion process of \textbf{JAglue} is now ``node-based''.
338 \item \LuaTeX の内部での合字の扱いは「ノード」を単位として行われるようになっている(例えば,
339 \verb+of{}fice+ で合字は抑制されない).それに合わせ,\textbf{JAglue}の挿入処理も
344 \item Furthermore, nodes between two characters which have no effects in
345 line break (\textit{e.g.}, \verb+\special+ node) and kerns from
346 italic correction are ignored in the insertion process.
349 \item さらに,2つの文字の間にある行末では効果を持たないノード(例えば \verb+\special+ ノード)や,
350 イタリック補正に伴い挿入されるカーンは挿入処理中では無視される.
354 \item \emph{Caution: due to above two points, many methods which did for the
355 dividing the process of the insertion of \textbf{JAglue} in \pTeX\ are not
356 effective anymore.} In concrete terms, the following two methods are not effective anymore:
359 \item \emph{注意:上の2つの変更により,従来\textbf{JAglue}の挿入処理を分断するのに
360 使われていたいくつかの方法は用いることができない.具体的には,次の方法はもはや無効である:}
366 If you want to do so, please put an empty hbox between it instead:
369 もし同じことをやりたければ,空の水平ボックスを間に挟めばよい:
377 \item In the process, two Japanese fonts which only differ in their ``real''
378 fonts are identified.
381 \item 処理中では,2つの和文フォントは,実フォントが異なるだけの場合には同一視
387 \item \LuaTeX-jaでは,\pTeX と同様に漢字・仮名を制御綴内に用いることができ,
388 \verb+\西暦+ などが正しく動作するようにしている.
389 但し,制御綴中に使える和文文字が\pTeX・\upTeX と全く同じではないことに注意すること.
393 \item At the present, vertical typesetting (\emph{tategaki}), is not
394 supported in \LuaTeX-ja.
397 \item 現時点では,縦書きは\LuaTeX-jaではサポートされていない.
402 For detailed information, see Part~\ref{part-imp}.
405 詳細については第\ref{part-imp}部を参照.
408 %<en>\subsection{Notations}
409 %<ja>\subsection{用語と記法}
412 In this document, the following terms and notations are used:
415 本ドキュメントでは,以下の用語と記法を用いる:
419 \item Characters are classified into following two types.
420 Note that the classification can be customized by a user
421 (see Subsection~\ref{ssec-setrange}).
424 \item 文字は次の2種類に分けられる.この類別はユーザが後から変更可能である
425 (\ref{ssec-setrange}節を参照).
429 \item \textbf{JAchar}: standing for characters which used in Japanese typesetting,
430 such as Hiragana,~Katakana, Kanji, and~other Japanese punctuation marks.
433 \item \textbf{JAchar}: ひらがな,カタカナ,漢字,和文用の約物といった
437 %<en>\item \textbf{ALchar}: standing for all other characters like latin alphabets.
438 %<ja>\item \textbf{ALchar}: ラテンアルファベットを始めとする,その他全ての文字を指す.
442 We say \emph{alphabetic fonts} for fonts used in \textbf{ALchar},
443 and \emph{Japanese fonts} for fonts used in \textbf{JAchar}.
446 そして,\textbf{ALchar}の出力に用いられるフォントを\emph{欧文フォント}と呼び,
447 \textbf{JAchar}の出力に用いられるフォントを\emph{和文フォント}と呼ぶ.
450 \item A word in a sans-serif font (like \Param{\hyperlink{fld:prebp}{prebreakpenalty}})
451 means an internal parameter for Japanese typesetting, and it
452 is used as a key in \verb+\ltjsetparameter+ command.
455 \item サンセリフ体で書かれた語(例:\Param{\hyperlink{fld:prebp}{prebreakpenalty}})は日本語組版用の
456 パラメータを表し,これらは \verb+\ltjsetparameter+ コマンドのキーとして
460 \item A word in typewriter font with underline (like \Pkg{fontspec})
461 means a package or a class of \LaTeX.
464 \item 下線付きタイプライタ体の語(例:\Pkg{fontspec})は\LaTeX の
468 \item In this document, natural numbers start from~0.
471 \item 本ドキュメントでは,自然数は0から始まる.
475 %<en>\subsection{About the Project}
476 %<ja>\subsection{プロジェクトについて}
478 %<en>\paragraph{Project Wiki} Project Wiki is under construction.
479 %<ja>\paragraph{プロジェクトWiki} プロジェクトWikiは構築中である.
482 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
483 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
484 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28zh%29} (Chinese)
489 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
490 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
491 \item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28zh%29}(中国語)
495 %<en>This project is hosted by SourceForge.JP.
496 %<ja>本プロジェクトはSourceForge.JPのサービスを用いて運営されている.
498 %<en>\paragraph{Members}\
499 %<ja>\paragraph{開発メンバー}\
502 \begin{multienumerate}
503 \def\labelenumi{$\bullet$}
504 \mitemxxx{Hironori KITAGAWA}{Kazuki MAEDA}{Takayuki YATO}
505 \mitemxxx{Yusuke KUROKI}{Noriyuki ABE}{Munehiro YAMAMOTO}
506 \mitemxxx{Tomoaki HONDA}{Shuzaburo SAITO}{MA Qiyuan}
510 \begin{multienumerate}
511 \def\labelenumi{$\bullet$}
512 \mitemxxx{北川 弘典}{前田 一貴}{八登 崇之}
513 \mitemxxx{黒木 裕介}{阿部 紀行}{山本 宗宏}
514 \mitemxxx{本田 知亮}{齋藤 修三郎}{馬 起園}
518 % \paragraph{Acknowledgments} -- 挿入するならここ
521 %<en>\section{Getting Started}
523 %<en>\subsection{Installation}
524 %<ja>\subsection{インストール}
526 %<en>To install the \LuaTeX-ja\ package, you will need:
527 %<ja>\LuaTeX-jaパッケージのインストールには,次のものが必要である.
529 \item \LuaTeX\ beta-0.74.0 (or later)
530 \item \Pkg{luaotfload} v2.2 (or later)
531 \item \Pkg{luatexbase} v0.6
532 \item \Pkg{xunicode} v0.981~(2011/09/09)
533 \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files)
537 \emph{This version of \LuaTeX-ja no longer supports \TeX~Live~2012 (or older version),
538 since \LuaTeX\ binary and \Pkg{luaotfload} is updated in
543 Now \LuaTeX-ja is available from the following archive and distributions:
545 \item CTAN (in the \texttt{macros/luatex/generic/luatexja} directory)
546 \item MiK\TeX\ (in \texttt{luatexja.tar.lzma})
547 \item \TeX\ Live (in \texttt{texmf-dist/tex/luatex/luatexja})
548 \item W32\TeX\ (in \texttt{luatexja.tar.xz})
551 If you are using \TeX~Live~2013, you can install \LuaTeX-ja
552 from \TeX~Live manager (\texttt{tlmgr}):
554 $ tlmgr install luatexja
558 \emph{本バージョンの\LuaTeX-jaは\TeX~Live~2012以前では動作しない.}
559 これは,\LuaTeX と\Pkg{luaotfload}が\TeX~Live~2013において更新されたことによる.
563 現在,\LuaTeX-jaは以下のアーカイブ,およびディストリビューションに収録されている:
565 \item CTAN (\texttt{macros/luatex/generic/luatexja})
566 \item MiK\TeX\ (\texttt{luatexja.tar.lzma})
567 \item \TeX\ Live (\texttt{texmf-dist/tex/luatex/luatexja})
568 \item W32\TeX\ (\texttt{luatexja.tar.xz})
571 例えば\TeX~Live~2013を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を
574 $ tlmgr install luatexja
578 %<en>\paragraph{Manual installation}
579 %<ja>\paragraph{手動インストール方法}
583 \item Download the source archive, by one of the following method.
584 At the present, \LuaTeX-ja has no \emph{stable} release.
587 \item Copy the Git repository:
589 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
591 \item Download the \texttt{tar.gz} archive of HEAD in the \texttt{master} branch from
593 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
597 Note that the \texttt{master} branch, and hence the archive in CTAN, are not updated frequently;
598 the forefront of development is not the \texttt{master} branch.
601 \item ソースアーカイブを以下のいずれかの方法で取得する.現在公開されているのはあくまでも
605 \item Gitリポジトリの内容をコピーする:
607 $ git clone git://git.sourceforge.jp/gitroot/luatex-ja/luatexja.git
609 \item \texttt{master}ブランチのスナップショット(\texttt{tar.gz}形式)をダウンロードする.
611 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
614 \texttt{master}ブランチ(従って,CTAN内のアーカイブも)はたまにしか更新されないことに注意.
615 主な開発は\texttt{master}の外で行われ,比較的まとまってきたらそれを\texttt{master}に
620 \item Extract the archive. You will see \texttt{src/} and several other sub-directories.
621 But only the contents in \texttt{src/} are needed to work \LuaTeX-ja.
624 \item 「Gitリポジトリをコピー」以外の方法でアーカイブを取得したならば,それを展開する.
625 \texttt{src/}をはじめとしたいくつかのディレクトリができるが,
626 動作には\texttt{src/}以下の内容だけで十分.
630 \item If you downloaded this package from CTAN, you have to run following commands
632 and \texttt{ltj-kinsoku.lua} (the file which stores default ``\textit{kinsoku}'' parameters):
635 \item もしCTANから本パッケージを取得したのであれば,日本語用クラスファイルや
637 格納した \texttt{ltj-kinsoku.lua} を生成するために,
642 $ lualatex ltjclasses.ins
643 $ lualatex ltjsclasses.ins
644 $ lualatex ltjltxdoc.ins
645 $ luatex ltj-kinsoku_make.tex
648 Note that \texttt{*.\{dtx,ins\}} and \texttt{ltj-kinsoku\_make.tex} are not needed in regular use.
651 ここで使用した \texttt{*.\{dtx,ins\}} と \texttt{ltj-kinsoku\_make.tex} は
658 \item Copy all the contents of \texttt{src/} into one of your \texttt{TEXMF} tree.
659 \texttt{TEXMF/tex/luatex/luatexja/} is an example location.
660 If you cloned entire Git repository, making a symbolic link of \texttt{src/}
661 instead copying is also good.
664 \item \texttt{src}の中身を自分の\texttt{TEXMF}ツリーにコピーする.
665 場所の例としては,例えば\texttt{TEXMF/tex/luatex/luatexja/}がある.
666 シンボリックリンクが利用できる環境で,かつリポジトリを直接取得したのであれば,
667 (更新を容易にするために)コピーではなくリンクを貼ることを勧める.
670 \item If \texttt{mktexlsr} is needed to update the file name database, make it so.
673 \item 必要があれば,\texttt{mktexlsr}を実行する.
678 \paragraph{Note for MiK\TeX\ Users}
679 \LuaTeX-ja requires that several CMap files%
680 \footnote{\texttt{UniJIS2004-UTF32-H} and \texttt{Adobe-Japan1-UCS2}.}
681 must be found from \LuaTeX.
682 Strictly speaking, those CMaps are needed
683 only in the first run of \LuaTeX-ja after installing or updating.
685 But it seems that MiK\TeX\ does not satisfy this condition,
686 so you will encounter an error like the following:
689 \LuaTeX-jaが動作するためには,\emph{導入・更新後の初回起動時に}
690 \texttt{UniJIS2004-UTF32-H}, \texttt{Adobe-Japan1-UCS2}という2つのCMapが
691 \LuaTeX によって見つけられることが必要である.
692 しかしMiK\TeX ではそのようになっていないので,次のエラーが発生するだろう:
695 ! LuaTeX error ...iles (x86)/MiKTeX 2.9/tex/luatex/luatexja/ltj-rmlgbm.lua
696 bad argument #1 to 'open' (string expected, got nil)
700 If so, please execute a batch file which is written on
701 \href{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{ the Project Wiki (English)}.
702 This batch file creates a temporaly directory, copy CMaps in it,
703 run \LuaTeX-ja in this directory, and finally delete the temporaly directory.
707 \href{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{%
708 プロジェクトWiki英語版トップページ}中に書かれているバッチファイルを
709 実行して欲しい.このバッチファイルは,作業用ディレクトリにCMap達を
710 コピーし,その中で\LuaTeX-ja の初回起動を行い,作業用ディレクトリを消す作業をしている.
713 %<en>\subsection{Cautions}
714 %<ja>\subsection{注意点}
718 \item The encoding of your source file must be UTF-8. No other
719 encodings, such as EUC-JP or Shift-JIS, are not supported.
722 \item 原稿のソースファイルの文字コードはUTF-8固定である.
723 従来日本語の文字コードとして用いられてきたEUC-JPやShift-JISは使用できない.
726 \item \LuaTeX-ja is very slower than \pTeX.
727 Generally speaking, LuaJIT\TeX\ processes \LuaTeX-ja
728 about 30\% faster than \LuaTeX, but not always.
731 \item \LuaTeX-jaは動作が\pTeX に比べて非常に遅い.
732 コードを調整して徐々に速くしているが,まだ満足できる速度ではない.
733 LuaJIT\TeX を用いると\LuaTeX のだいたい1.3倍の速度で動くようであるが,
734 IPA mj明朝などの大きいフォントを用いた場合には\LuaTeX よりも遅くなることもある.
738 %<en>\subsection{Using in plain \TeX}
739 %<ja>\subsection{plain \TeX で使う}
742 %<en>To use \LuaTeX-ja in plain \TeX, simply put the following at the beginning of the document:
743 %<ja>\LuaTeX-jaを plain \TeX で使うためには,単に次の行をソースファイルの冒頭に追加すればよい:
747 %<en>This does minimal settings (like \texttt{ptex.tex}) for typesetting Japanese documents:
748 %<ja>これで(\texttt{ptex.tex}のように)日本語組版のための最低限の設定がなされる:
752 \item The following 6~Japanese fonts are preloaded:
754 \begin{tabular}{ccccc}
756 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
757 \emph{mincho}&Ryumin-Light &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
758 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
764 \item 以下の6つの和文フォントが定義される:
766 \begin{tabular}{ccccc}
768 \emph{字体}&\emph{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
769 明朝体&Ryumin-Light &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
770 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
777 \item It is widely accepted that fonts ``Ryumin-Light'' and
778 ``GothicBBB-Medium'' aren't embedded into PDF files, and a PDF reader
779 substitute them by some external Japanese fonts (\textit{e.g.},
780 Ryumin-Light is substituted with Kozuka Mincho in Adobe Reader).
781 We adopt this custom to the default setting.
784 \item ``Ryumin-Light''と``GothicBBB-Medium''はPDFファイルに埋め込まずに
785 名前参照のみで用いることが広く受け入れられており,この場合PDFリーダーが
786 適切な外部フォントで代用する(例えば,Adobe ReaderではRyumin-Lightは
787 小塚明朝で代替される).そこで,これらを引き続きデフォルトのフォントと
792 \item A character in an alphabetic font is generally smaller than a
793 Japanese font in the same size. So actual size specification of
794 these Japanese fonts is in fact smaller than that of alphabetic
795 fonts, namely scaled by 0.962216.
798 \item 欧文フォントの文字は和文フォントの文字よりも,同じ文字サイズでも
799 一般に小さくデザインされている.そこで,標準ではこれらの和文フォントの実際のサイズは指定された値よりも
800 小さくなるように設定されており,具体的には指定の0.962216倍にスケールされる.
801 この0.962216という数値も,\pTeX におけるスケーリングを踏襲した値である.
806 \item The amount of glue that are inserted between a \textbf{JAchar} and
807 an \textbf{ALchar} (the parameter \Param{\hyperlink{fld:xks}{xkanjiskip}}) is set to
810 \item \textbf{JAchar}と\textbf{ALchar}の間に入るグルー(\Param{\hyperlink{fld:xks}{xkanjiskip}})の
814 (0.25\cdot 0.962216\cdot 10\,\mathrm{pt})^{+1\,\text{pt}}_{-1\,\text{pt}}
815 = 2.40554\,\mathrm{pt}^{+1\,\text{pt}}_{-1\,\text{pt}}.
819 %<en>\subsection{Using in \LaTeX}
820 %<ja>\subsection{\LaTeX で使う}
826 Using in \LaTeXe\ is basically same. To set up the minimal environment
827 for Japanese, you only have to load \texttt{luatexja.sty}:
830 \LaTeXe を用いる場合も基本的には同じである.日本語組版のための最低限の環境を
831 設定するためには,\texttt{luatexja.sty}を読み込むだけでよい:
834 \usepackage{luatexja}
837 It also does minimal settings (counterparts in \pLaTeX\ are \texttt{%
838 plfonts.dtx} and \texttt{pldefs.ltx}):
841 これで\pLaTeX の\texttt{plfonts.dtx}と\texttt{pldefs.ltx}に相当する最低限の設定が
847 \item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
848 When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
851 \item \texttt{JY3}は和文フォント用のフォントエンコーディングである(横書き用).\\
852 将来的に,\LuaTeX-jaで縦書きがサポートされる際には,\texttt{JT3}を縦書き用として
857 \item Traditionally, Japanese documents use two typeface category: \emph{mincho}~(明朝体) and
858 \emph{gothic}~(\textgt{ゴシック体}). \emph{mincho} is used in the main text, while \emph{gothic}
859 is used in the headings or for emphasis.
861 \begin{tabular}{lllc}
863 \textbf{classification}&&&\textbf{family name}\\\midrule
864 \emph{mincho} (明朝体)&\verb+\textmc{...}+&\verb+{\mcfamily ...}+&\verb+\mcdefault+\\
865 \emph{gothic} (\textgt{ゴシック体})&\verb+\textgt{...}+&\verb+{\gtfamily ...}+&\verb+\gtdefault+\\
870 By default, the following fonts are used for \emph{mincho} and \emph{gothic}:
872 \begin{tabular}{ccccc}
874 \textbf{classification}&\textbf{family name}&\verb+\mdseries+&\verb+\bfseries+&\textbf{scale}\\\midrule
875 \emph{mincho} (明朝体)&\tt mc&Ryumin-Light &GothicBBB-Medium&0.962216\\
876 \emph{gothic} (\textgt{ゴシック体})&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
880 Note that the bold series in both family are same as the medium series of \emph{gothic} family.
881 This is a convention in \pLaTeX. This is trace that there were only 2~fonts (these are Ryumin-Light
882 and GothicBBB-Medium) in early years of DTP. There is no italic nor slanted shape for
883 these \texttt{mc}~and~\texttt{gt}.
886 \item \pLaTeX と同様に,標準では「明朝体」「ゴシック体」の2種類を用いる:
888 \begin{tabular}{cllc}
890 \emph{字体}&&&\emph{ファミリ名}\\\midrule
891 明朝体&\verb+\textmc{...}+&\verb+{\mcfamily ...}+&\verb+\mcdefault+\\
892 \textgt{ゴシック体}&\verb+\textgt{...}+&\verb+{\gtfamily ...}+&\verb+\gtdefault+\\
896 \item 標準では,次のフォントファミリが用いられる:
898 \begin{tabular}{ccccc}
900 \emph{字体}&\emph{ファミリ}&\verb+\mdseries+&\verb+\bfseries+&\emph{スケール}\\\midrule
901 明朝体&\tt mc&Ryumin-Light &GothicBBB-Medium&0.962216\\
902 ゴシック体&\tt gt&GothicBBB-Medium&GothicBBB-Medium&0.962216\\
906 どちらのファミリにおいても,そのboldシリーズで使われるフォントは
907 ゴシック体のmediumシリーズで使われるフォントと同じあることに注意.
908 これは初期のDTPにおいて和文フォントが2つ(それがちょうど\
909 Ryumin-Light, GothicBBB-Mediumだった)しか利用できなかった時の名残であり,\pLaTeX{}
914 %<en>\item Japanese characters in math mode are typeset by the font family \texttt{mc}.
915 %<ja>\item 数式モード中の和文文字は明朝体(\texttt{mc})で出力される.
919 However, above settings are not sufficient for Japanese-based
920 documents. To typeset Japanese-based documents, you are better to use
921 class files other than \texttt{article.cls}, \texttt{book.cls}, and so on. At
922 the present, we have the counterparts of \Pkg{jclasses} (standard
923 classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
924 Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
927 しかしながら,上記の設定は日本語の文書にとって十分とは言えない.
928 日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls}といった
929 欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
930 現時点では,\Pkg{jclasses}(\pLaTeX の標準クラス)と\Pkg{jsclasses}
931 (奥村晴彦氏によるクラスファイル)に対応するものとして,\Pkg{ltjclasses},
932 \Pkg{ltjsclasses}がそれぞれ用意されている.
935 %<en>\section{Changing Fonts}
936 %<ja>\section{フォントの変更}
938 \subsection{plain \TeX~and~\LaTeXe}
941 \paragraph{plain \TeX}
943 To change Japanese fonts in plain \TeX, you must use the command
944 \verb+\jfont+. So please see Subsection~\ref{ssec-jfont}.
947 plain \TeX で和文フォントを変更するためには,\pTeX のように \verb+\jfont+ 命令を直接用いる.
948 \ref{ssec-jfont}節を参照.
951 \paragraph{\LaTeXe\ (NFSS2)}
953 For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (in \texttt{plfonts.dtx}).
956 \LaTeXe については,\LuaTeX-jaではフォント選択システムを\pLaTeXe\ (\texttt{plfonts.dtx})
961 \item Commands \verb+\fontfamily+, \verb+\fontseries+,
962 \verb+\fontshape+, and \verb+\selectfont+ can be used to change
963 attributes of Japanese fonts.
966 \item \verb+\fontfamily+, \verb+\fontseries+, \verb+\fontshape+, そして
967 \verb+\selectfont+ が和文フォントの属性を変更するために使用できる.
972 \begin{tabular}{cccccc}
974 &\textbf{encoding}&\textbf{family}&\textbf{series}&\textbf{shape}&\textbf{selection}\\\midrule
976 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
979 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
981 both&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
982 auto select&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
989 \begin{tabular}{cccccc}
991 &\emph{エンコーディング}&\emph{ファミリ}&\emph{シリーズ}&\emph{シェープ}&\emph{選択}\\\midrule
993 &\verb+\romanencoding+&\verb+\romanfamily+&\verb+\romanseries+&\verb+\romanshape+
996 &\verb+\kanjiencoding+&\verb+\kanjifamily+&\verb+\kanjiseries+&\verb+\kanjishape+
998 両方&---&--&\verb+\fontseries+&\verb+\fontshape+&---\\
999 自動選択&\verb+\fontencoding+&\verb+\fontfamily+&---&---&\verb+\usefont+\\
1006 \verb+\fontencoding{+<encoding>\verb+}+ changes the encoding of alphabetic fonts
1007 or Japanese fonts depending on the argument. For example,
1008 \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to
1009 \texttt{JY3},and \verb+\fontencoding{T1}+ changes the encoding of
1010 alphabetic fonts to \texttt{T1}.
1011 \verb+\fontfamily+ also changes the current Japanese font family,
1012 the current alphabetic font family, \emph{or both}.
1013 For the detail, see Subsection~\ref{ssub-nfsspat}.
1016 ここで,\verb+\fontencoding{+<encoding>\verb+}+ は,引数により和文側か欧文
1017 側かのどちらかのエンコーディングを変更する.例えば,
1018 \verb+\fontencoding{JY3}+ は和文フォントのエンコーディングを
1019 \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を
1020 \texttt{T1}へと変更する.\verb+\fontfamily+ も引数により和文側,欧文
1021 側,\emph{あるいは両方}のフォントファミリを変更する.詳細は
1022 \ref{ssub-nfsspat}節を参照すること.
1026 \item For defining a Japanese font family, use
1027 \verb+\DeclareKanjiFamily+ instead of
1028 \verb+\DeclareFontFamily+. However, in the present implementation,
1029 using \verb+\DeclareFontFamily+ doesn't cause any problem.
1030 \item Defining a Japanese font shape can be done by usual \verb+\DeclareFontShape+:
1033 \item 和文フォントファミリの定義には \verb+\DeclareFontFamily+ の
1034 代わりに \verb+\DeclareKanjiFamily+ を用いる.しかし,現在の
1035 実装では \verb+\DeclareFontFamily+ を用いても問題は生じない.
1036 \item 和文フォントのシェイプを定義するには,通常の \verb+\DeclareFontShape+ を使えば良い:
1039 \DeclareFontShape{JY3}{mc}{bx}{n}{<-> s*KozMinPr6N-Bold:jfm=ujis}{}
1040 % Kozuka Mincho Pr6N Bold
1043 仮名書体を使う場合など,複数の和文フォントを組み合わせて使いたい場合は
1044 \ref{ssec-altfont}節の \verb+\ltjdeclarealtfont+ と,その\LaTeX 版の\
1045 \verb+\DeclareAlternateKanjiFont+(\ref{ssub-nfsspat}節)を参照せよ.
1050 \paragraph{Remark: Japanese Characters in Math Mode}
1051 Since \pTeX\ supports Japanese characters in math mode, there are
1052 sources like the following:
1055 \paragraph{注意:数式モード中の和文文字}
1056 \pTeX では,特に何もしないでも数式中に和文文字を記述することができた.そのため,
1061 $f_{高温}$~($f_{\text{high temperature}}$).
1062 \[ y=(x-1)^2+2\quad よって\quad y>0 \]
1063 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
1066 We (the project members of \LuaTeX-ja) think that using
1067 Japanese characters in math mode are allowed if and only if these are used as identifiers.
1068 In this point of view,
1071 \LuaTeX-jaプロジェクトでは,数式モード中での和文文字はそれらが識別子として用いられる
1078 \item The lines 1~and~2 above are not correct, since ``高温'' in above is used as a textual label, and
1079 ``よって'' is used as a conjunction.
1082 \item 上記数式のうち1, 2行目は正しくない.なぜならば「高温」が意味のあるラベルと
1083 して,「よって」が接続詞として用いられているからである.
1085 %<en>\item However, the line~3 is correct, since ``素'' is used as an identifier.
1086 %<ja>\item しかしながら,3行目は「素」が単なる識別子として用いられているので正しい.
1088 %<en>Hence, in our opinion, the above input should be corrected as:
1089 %<ja>したがって,\LuaTeX-jaプロジェクトの意見としては,上記の入力は次のように直されるべきである:
1092 ($f_{\text{high temperature}}$).
1094 \mathrel{\text{よって}}\quad y>0 \]
1095 $5\in 素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
1098 We also believe that using Japanese characters as identifiers is rare,
1099 hence we don't describe how to change Japanese fonts in math mode in
1100 this chapter. For the method, please see Subsection~\ref{ssec-math}.
1103 また\LuaTeX-jaプロジェクトでは,和文文字が識別子として用いられることはほとんどない
1104 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
1105 記述しない.この方法については\ref{ssec-math}節を参照のこと.
1109 \subsection{fontspec}
1110 \label{ssec-fontspec}
1112 To coexist with the \Pkg{fontspec} package, it is needed to load
1113 \Pkg{luatexja-fontspec} package in the preamble. This additional
1114 package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
1118 \Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いるためには,
1119 \Pkg{luatexja-fontspec}パッケージをプリアンブルで読み込む必要がある.このパッケージ
1120 は必要ならば自動で\Pkg{luatexja}パッケージと\Pkg{fontspec}パッケージを読み込む.
1124 In \Pkg{luatexja-fontspec} package, the following seven~commands are defined as
1125 counterparts of original commands in the \Pkg{fontspec} package:
1128 \Pkg{luatexja-fontspec}パッケージでは,以下の7つのコマンドを\Pkg{fontspec}
1129 パッケージの元のコマンドに対応するものとして定義している:
1133 \begin{center}\small
1134 \begin{tabular}{ccccc}
1137 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
1139 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
1142 &\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
1144 &\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
1150 \begin{center}\small
1151 \begin{tabular}{cccc}
1154 &\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+\\
1156 &\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+\\
1159 &\verb+\newjfontfamily+&\verb+\newjfontface+&\verb+\defaultjfontfeatures+\\
1161 &\verb+\newfontfamily+&\verb+\newfontface+&\verb+\defaultfontfeatures+\\
1164 &\verb+\addjfontfeatures+\\
1166 &\verb+\addfontfeatures+\\
1171 \begin{LTXexample}[width=0.4\textwidth]
1172 \fontspec[Numbers=OldStyle]{LMSans10-Regular}
1173 \jfontspec[CJKShape=NLC]{KozMinPr6N-Regular}
1176 \jfontspec[CJKShape=JIS1990]{KozMinPr6N-Regular}
1181 Note that there is no command named \verb+\setmonojfont+, since it is
1182 popular for Japanese fonts that nearly all Japanese glyphs have same
1183 widths. Also note that the kerning feature is set off by default in
1184 these seven commands, since this feature and \textbf{JAglue} will clash (see
1188 和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
1189 \verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
1190 ンドではKerning featureはデフォルトではoffとなっている.これはこの
1191 featureが\textbf{JAglue}と衝突するためである(\ref{para-kern}節を参照).
1194 %<en>\subsection{Presets}
1195 %<ja>\subsection{プリセット設定}
1199 To use standard Japanese font settings easily, one can load \Pkg{luatexja-preset}
1200 package with several options. This package provides functions in a part of
1201 \Pkg{otf} package and a part of \Pkg{PXchfon} package by Takayuki Yato,
1202 and loads \Pkg{luatexja-fontspec}, hence \Pkg{fontspec} internally.
1204 If you need to pass some options to \Pkg{fontspec}, load \Pkg{fontspec} manually
1205 before \Pkg{luatexja-preset}:
1208 よく使われている和文フォント設定を一行で指定できるようにしたのが
1209 \Pkg{luatexja-preset}パッケージである.このパッケージは,
1210 \Pkg{otf}パッケージの一部機能と八登崇之氏による\Pkg{PXchfon}パッケージの一部機能とを
1211 合わせたような格好をしており,内部で\Pkg{luatexja-fontspec},従って
1212 \Pkg{fontspec}を読み込んでいる.
1214 もし\Pkg{fontspec}パッケージに何らかのオプションを渡す必要がある
1215 \footnote{例えば,数式フォントまで置換されてしまい,\texttt{\char92mathit}によってギリシャ文字の
1216 斜体大文字が出なくなる,など.}場合は,
1217 次のように\Pkg{luatexja-preset}の前に\Pkg{fontspec}を手動で読みこめば良い:
1220 \usepackage[no-math]{fontspec}
1221 \usepackage[...]{luatexja-preset}
1224 %<en>\paragraph{General options}
1225 %<ja>\paragraph{一般的なオプション}
1226 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1229 Use one-weighted \textit{mincho} and \textit{gothic} font families.
1230 This means that \verb+\mcfamily\bfseries+, \verb+\gtfamily\bfseries+ and
1231 \verb+\gtfamily\mdseries+ use the same font.
1232 \emph{This option is enabled by default.}
1235 \LaTeXe 環境下での標準設定のように,明朝体・ゴシック体を各1ウェイトで使用する.
1237 \verb+\mcfamily\bfseries+, \verb+\gtfamily\bfseries+, \verb+\gtfamily\mdseries+は
1238 みな同じフォントとなる.\emph{このオプションは標準で有効になっている.}
1242 Use \textit{mincho} with two weights (medium~and~bold),
1243 \textit{gothic} with three weights (medium, bold~and~heavy), and \textit{rounded gothic}%
1244 \footnote{Provided by \texttt{\char92mgfamily} and \texttt{\char92textmg\{...\}},
1245 because \textit{rounded gothic} is called \textit{maru gothic} (丸ゴシック) in Japanese.}.
1246 The heavy weight of \textit{gothic} can be used by ``changing the family'' \verb+\gtebfamily+,
1247 or \verb+\textgteb{...}+.
1248 This is because \Pkg{fontspec} package can handle only medium (\verb+\mdseries+) and
1249 bold (\verb+\bfseries+).
1252 明朝体2ウェイト・ゴシック体3ウェイトと,
1253 丸ゴシック体 (\verb+\mgfamily+, \verb+\textmg{...}+) を使用可能とする.
1254 ゴシック体は細字・太字・極太の3ウェイトがあるが,
1255 極太ゴシック体はファミリの切り替え (\verb+\gtebfamily+, \verb+\textgteb{...}+) %
1256 で実現している.\Pkg{fontspec}では通常 (\verb+\mdseries+) と太字 (\verb+\bfseries+) しか扱えないために
1261 Use horizontal kana alternates, and define a command \verb+\rubyfamily+ to use kana
1262 characters designed for ruby.
1264 %<ja>横組専用仮名を用いる.また,\verb+\rubyfamily+ でルビ用仮名が使用可能となる.
1266 %<en>Substitute bold series of \textit{gothic} for bold series of \textit{mincho}.
1267 %<ja>「明朝の太字」をゴシック体の太字によって代替する.
1269 %<en>Use 90JIS glyph variants if possible.
1270 %<ja>出来る限り90JISの字形を使う.
1272 %<en>Use JIS2004 glyph variants if possible.
1273 %<ja>出来る限りJIS2004の字形を使う.
1276 Use the JFM \texttt{jfm-jis.lua}, instead of \texttt{jfm-ujis.lua}, which is the default JFM of
1280 用いるJFMを(JISフォントメトリック類似の)\texttt{jfm-jis.lua}にする.このオプションがない時は
1281 \LuaTeX-ja標準の\texttt{jfm-ujis.lua}が用いられる.
1285 Note that \texttt{90jis} and \texttt{jis2004} only affect with \textit{mincho},
1286 \textit{gothic} (and possibly \textit{rounded gothic}) defined by this package.
1287 We didn't taken account of when both \texttt{90jis} and \texttt{jis2004} are specified.
1290 \texttt{90jis}と\texttt{jis2004}については本パッケージで定義された
1291 明朝体・ゴシック体(・丸ゴシック体)にのみ有効である.両オプションが
1292 同時に指定された場合の動作については全く考慮していない.
1295 %<en>\paragraph{Presets for multi weight settings}
1296 %<ja>\paragraph{多ウェイト用プリセットの一覧}
1298 Besides \texttt{morisawa-pro}~and~\texttt{morisawa-pr6n} presets,
1299 fonts are specified by fontname, not by filename.
1302 \texttt{morisawa-pro}, \texttt{morisawa-pr6n}以外はフォントの指定は
1303 (ファイル名でなく)フォント名で行われる.
1305 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
1306 \item[kozuka-pro] Kozuka Pro (Adobe-Japan1-4) fonts.
1307 %<en> \\[-\dimexpr\medskipamount+\baselineskip\relax]
1308 \item[kozuka-pr6] Kozuka Pr6 (Adobe-Japan1-6) fonts.
1309 %<en> \\[-\dimexpr\medskipamount+\baselineskip\relax]
1310 \item[kozuka-pr6n] Kozuka Pr6N (Adobe-Japan1-6, JIS04-savvy) fonts.
1313 Kozuka Pro/Pr6N fonts are bundled with Adobe's software, such as Adobe~InDesign.
1314 There is not rounded gothic family in Kozuka fonts.
1317 小塚Pro書体・Pr6N書体はAdobe InDesign等のAdobe製品にバンドルされている.
1318 「小塚丸ゴシック」は存在しないので,便宜的に小塚ゴシックHによって代用している.
1320 \begin{center}\small
1321 \begin{tabular}{cllll}
1323 \bf family&\bf series&\tt kozuka-pro&\tt kozuka-pr6&\tt kozuka-pr6n\\
1325 &medium&KozMinPro-Regular&KozMinProVI-Regular&KozMinPr6N-Regular\\
1326 %<en>\smash{\raisebox{1.5ex}{\textit{mincho}}}%
1327 %<ja>\smash{\raisebox{1.5ex}{\gt 明朝}}%
1328 &bold&KozMinPro-Bold&KozMinProVI-Bold&KozMinPr6N-Bold\\
1330 &&KozGoPro-Regular*&KozGoProVI-Regular*&KozGoPr6N-Regular*\\
1331 &\smash{\raisebox{1.5ex}{medium}}
1332 &KozGoPro-Medium&KozGoProVI-Medium&KozGoPr6N-Medium\\
1334 %<en>\smash{\raisebox{2ex}{\textit{gothic}}}%
1335 %<ja>\smash{\raisebox{2ex}{\gt ゴシック}}%
1336 &bold&KozGoPro-Bold&KozGoProVI-Bold&KozGoPr6N-Bold\\
1337 &heavy&KozGoPro-Heavy&KozGoProVI-Heavy&KozGoPr6N-Heavy\\
1339 %<en>\textit{rounded gothic}
1341 &&KozGoPro-Heavy&KozGoProVI-Heavy&KozGoPr6N-Heavy\\
1347 In above table, starred fonts (KozGo\dots-Regular) are used for medium series of \textit{gothic},
1348 \emph{if and only if \texttt{deluxe} option is specified}.
1351 上の表において,*つきのフォント(KozGo\dots-Regular)は,\emph{\texttt{deluxe}オプション非指定時に}
1357 \item[hiragino-pro] Hiragino Pro (Adobe-Japan1-5) fonts.
1358 %<en> \\[-\dimexpr\medskipamount+\baselineskip\relax]
1359 \item[hiragino-pron] Hiragino ProN (Adobe-Japan1-5, JIS04-savvy) fonts.
1362 Hiragino fonts are bundled with Mac OS~X 10.5 or later.
1363 Some editions of a Japanese word-processor ``一太郎2012'' includes Hiragino ProN fonts.
1364 Note that the heavy weight of \textit{gothic} family only supports
1365 Adobe-Japan1-3 character collection (Std/StdN).
1368 ヒラギノフォントは,Mac OS~X以外にも,一太郎2012の上位エディションにもバンドルされている.
1369 極太ゴシックとして用いるヒラギノ角ゴW8は,Adobe-Japan1-3の範囲しかカバーしていない
1370 Std/StdNフォントであり,その他はAdobe-Japan1-5対応である.
1372 \begin{center}\small
1373 \begin{tabular}{clll}
1375 \bf family&\bf series&\tt hiragino-pro&\tt hiragino-pron\\
1377 &medium&Hiragino~Mincho~Pro~W3&Hiragino~Mincho~ProN~W3\\
1378 %<en>\smash{\raisebox{1.5ex}{\textit{mincho}}}%
1379 %<ja>\smash{\raisebox{1.5ex}{\gt 明朝}}%
1380 &bold&Hiragino~Mincho~Pro~W6&Hiragino~Mincho~ProN~W6\\
1382 &&Hiragino~Kaku~Gothic~Pro~W3*&Hiragino~Kaku~Gothic~ProN~W3*\\
1383 &\smash{\raisebox{1.5ex}{medium}}
1384 &Hiragino~Kaku~Gothic~Pro~W6&Hiragino~Kaku~Gothic~ProN~W6\\
1386 %<en>\smash{\raisebox{2ex}{\textit{gothic}}}%
1387 %<ja>\smash{\raisebox{2ex}{\gt ゴシック}}%
1388 &bold&Hiragino~Kaku~Gothic~Pro~W6&Hiragino~Kaku~Gothic~ProN~W6\\
1389 &heavy&Hiragino~Kaku~Gothic~Std~W8&Hiragino~Kaku~Gothic~StdN~W8\\
1391 %<en>\textit{rounded gothic}
1393 &&Hiragino~Maru~Gothic~ProN~W4&Hiragino~Maru~Gothic~ProN~W4\\
1400 \item[morisawa-pro] Morisawa Pro (Adobe-Japan1-4) fonts.
1401 %<en> \\[-\dimexpr\medskipamount+\baselineskip\relax]
1402 \item[morisawa-pr6n] Morisawa Pr6N (Adobe-Japan1-6, JIS04-savvy) fonts.
1403 \begin{center}\small
1404 \begin{tabular}{cl>{\tt}l>{\tt}l}
1406 \bf family&\bf series&morisawa-pro&morisawa-pr6n\\
1408 &medium&A-OTF-RyuminPro-Light.otf&A-OTF-RyuminPr6N-Light.otf\\
1409 %<en>\smash{\raisebox{1.5ex}{\textit{mincho}}}%
1410 %<ja>\smash{\raisebox{1.5ex}{\gt 明朝}}%
1411 &bold&A-OTF-FutoMinA101Pro-Bold.otf&A-OTF-FutoMinA101Pr6N-Bold.otf\\
1414 &A-OTF-GothicBBBPro-Medium.otf&A-OTF-GothicBBBPr6N-Medium.otf\\
1415 %<en>\textit{gothic}%
1417 &bold&A-OTF-FutoGoB101Pro-Bold.otf&A-OTF-FutoGoB101Pr6N-Bold.otf\\
1418 &heavy&A-OTF-MidashiGoPro-MB31.otf&A-OTF-MidashiGoPr6N-MB31.otf\\
1420 %<en>\textit{rounded gothic}
1422 &&A-OTF-Jun101Pro-Light.otf&A-OTF-Jun101Pr6N-Light.otf\\
1427 \item[yu-win] Yu fonts bundled with Windows~8.1.
1428 %<en> \\[-\dimexpr\medskipamount+\baselineskip\relax]
1429 \item[yu-osx] Yu fonts bundled with OSX~Mavericks.
1430 \begin{center}\small
1431 \begin{tabular}{clll}
1433 \bf family&\bf series&\tt yu-win&\tt yu-osx\\
1435 &medium&YuMincho-Regular&YuMincho~Medium\\
1436 %<en>\smash{\raisebox{1.5ex}{\textit{mincho}}}%
1437 %<ja>\smash{\raisebox{1.5ex}{\gt 明朝}}%
1438 &bold&YuMincho-Demibold&YuMincho~Demibold\\
1440 &&YuGothic-Regular*&YuGothic~Medium*\\
1441 &\smash{\raisebox{1.5ex}{medium}}
1442 &YuGothic-Bold&YuGothic~Bold\\
1444 %<en>\textit{gothic}%
1446 &bold&YuGothic-Bold&YuGothic~Bold\\
1447 &heavy&YuGothic-Bold&YuGothic~Bold\\
1449 %<en>\textit{rounded gothic}
1451 &&YuGothic-Bold&YuGothic~Bold\\
1457 %<en>\paragraph{Presets for single weight}
1458 %<ja>\paragraph{単ウェイト用プリセット一覧}
1460 Next, we describe settings for using only single weight.
1461 In four settings below, we use same fonts for medium and bold (and heavy) weights.
1462 (Hence \verb+\mcfamily\bfseries+ and \verb+\mcfamily\mdseries+ yields same Japanese fonts,
1463 even if \texttt{deluxe} option is also specified).
1466 次に,単ウェイト用の設定を述べる.この4設定では「細字」「太字」の区別はない.
1467 また,丸ゴシック体はゴシック体と同じフォントを用いる.
1469 \par\nobreak\medskip
1471 \begin{tabular}{lllll}
1473 &\tt noembed&\tt ipa&\tt ipaex&\tt ms\\
1476 \it mincho&Ryumin-Light (non-embedded)
1477 &IPAMincho&IPAexMincho&MS Mincho\\
1478 \it gothic&GothicBBB-Medium (non-embedded)
1479 &IPAGothic&IPAexGothic&MS Gothic\\
1482 \gtfamily 明朝体&Ryumin-Light(非埋込)
1483 &IPA明朝&IPAex明朝&MS明朝\\
1484 \gtfamily ゴシック体&GothicBBB-Medium(非埋込)
1485 &IPAゴシック&IPAexゴシック&MSゴシック\\
1488 \end{tabular}\par\medskip}
1491 %<en>\paragraph{Using HG fonts}
1492 %<ja>\paragraph{HGフォントの利用}
1494 We can use HG~fonts bundled with Microsoft~Office for realizing multiple weights.
1497 すぐ前に書いた単ウェイト用設定を,Microsoft Office等に付属するHGフォントを使って
1500 \par\nobreak\medskip
1502 \begin{tabular}{llll}
1504 &\tt ipa-hg&\tt ipaex-hg&\tt ms-hg\\
1508 &IPAMincho&IPAexMincho&MS Mincho\\\midrule
1510 \multicolumn{3}{c}{HG Mincho E}\\\midrule
1512 ~~without \texttt{deluxe}
1513 &IPAGothic&IPAexGothic&MS Gothic\\
1514 ~~with {\tt jis2004}
1515 &IPAGothic&IPAexGothic&MS Gothic\\
1518 \multicolumn{3}{c}{HG Gothic M}\\\midrule
1520 \multicolumn{3}{c}{HG Gothic E}\\\midrule
1522 \multicolumn{3}{c}{HG Soei Kaku Gothic UB}\\\midrule
1524 \multicolumn{3}{c}{HG Maru Gothic PRO}\\
1528 &IPA明朝&IPAex明朝&MS明朝\\\midrule
1530 \multicolumn{3}{c}{HG明朝E}\\\midrule
1533 &IPAゴシック&IPAexゴシック&MSゴシック\\
1535 &IPAゴシック&IPAexゴシック&MSゴシック\\
1538 \multicolumn{3}{c}{HGゴシックM}\\\midrule
1540 \multicolumn{3}{c}{HGゴシックE}\\\midrule
1542 \multicolumn{3}{c}{HG創英角ゴシックUB}\\\midrule
1544 \multicolumn{3}{c}{HG丸ゴシック体PRO}\\
1547 \end{tabular}\par\medskip}
1550 Note that HG~Mincho~E, HG~Gothic~E, HG Soei Kaku Gothic UB, and HG Maru Gothic PRO
1551 are internally specified by:
1553 \item[default] by font name (\texttt{HGMinchoE}, etc.).
1554 \item[{\tt 90jis}] by filename (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}).
1555 \item[{\tt jis2004}] by filename (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}).
1559 なお,HG明朝E・HGゴシックE・HG創英角ゴシックUB・HG丸ゴシック体PROの4つについては,内部で
1561 \item[標準] フォント名(\texttt{HGMinchoE} など)
1562 \item[{\tt 90jis}指定時] ファイル名 (%
1563 \texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf})
1564 \item[{\tt jis2004}指定時] ファイル名 (%
1565 \texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf})
1567 として指定を行っているので注意すること.
1572 \subsection{\texttt{\char`\\CID}, \texttt{\char`\\UTF}, and macros in \Pkg{otf} package}
1573 Under \pLaTeX, \Pkg{otf} package (developed by Shuzaburo Saito) is
1574 used for typesetting characters which is in Adobe-Japan1-6 CID but not
1575 in JIS~X~0208. Since this package is widely used, \LuaTeX-ja
1576 supports some of functions in \Pkg{otf} package.
1577 If you want to use these functions, load \Pkg{luatexja-otf} package.
1580 \subsection{\texttt{\char`\\CID}, \texttt{\char`\\UTF}と\Pkg{otf}パッケージのマクロ}
1581 \pLaTeX では,JIS~X~0208にないAdobe-Japan1-6の文字を出力するために,
1582 齋藤修三郎氏による\Pkg{otf}パッケージが用いられていた.このパッケージは
1583 広く用いられているため,\LuaTeX-jaにおいても\Pkg{otf}パッケージの機能の
1584 一部をサポートしている.これらの機能を用いるためには\Pkg{luatexja-otf}パッケージ
1589 \jfontspec{KozMinPr6N-Regular.otf}
1590 森\UTF{9DD7}外と内田百\UTF{9592}とが\UTF{9AD9}島屋に行く。
1592 \CID{7652}飾区の\CID{13706}野家,
1594 高崎と\CID{8705}\UTF{FA11}
1600 \Pkg{otf}パッケージでは,それぞれ次のようなオプションが存在した:
1602 \item[\texttt{deluxe}] 明朝体・ゴシック体各2ウェイトと,丸ゴシック体を扱えるようになる.
1603 \item[\texttt{expert}] 仮名が横組・縦組専用のものに切り替わり,ルビ用仮名も扱えるようになる.
1604 \item[\texttt{bold}] ゴシック体を標準で太いウェイトのものに設定する.
1606 しかしこれらのオプションは\Pkg{luatexja-otf}パッケージには存在しない.
1607 \Pkg{otf}パッケージが文書中で使用する和文用TFMを自前の物に置き換えていたのに対し,
1608 \Pkg{luatexja-otf}パッケージでは,そのようなことは行わないからである.
1611 \Pkg{luatexja-preset} パッケージにプリセットを使う時に一緒に指定するか,
1612 あるいは対応する内容を\ref{ssub-chgfnt}節 (NFSS2) や
1613 \ref{ssec-fontspec}節 (\Pkg{fontspec}) の方法で手動で指定する必要がある.
1617 %<en>\section{Changing Parameters}
1618 %<ja>\section{パラメータの変更}
1621 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
1622 most of them are not stored as internal register of \TeX, but as an
1623 original storage system in \LuaTeX-ja. Hence, to assign or acquire those
1624 parameters, you have to use commands \verb+\ltjsetparameter+ and
1625 \verb+\ltjgetparameter+.
1628 \LuaTeX-jaには多くのパラメータが存在する.そして\LuaTeX の仕様のために,
1629 その多くは\TeX のレジスタにではなく,\LuaTeX-ja独自の方法で保持されている.
1630 これらのパラメータを設定・取得するためには \verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ を
1634 %<en>\subsection{Editing the Range of \textbf{JAchar}s}
1635 %<ja>\subsection{\textbf{JAchar}の範囲の設定}
1636 \label{ssec-setrange}
1639 \LuaTeX-ja divides the Unicode codespace \texttt{U+0080}--\texttt{U+10FFFF}
1640 into \emph{character ranges},
1641 numbered 1 to 217. The grouping can be (globally) customized by \verb+\ltjdefcharrange+.
1642 The next line adds whole characters in Supplementary Ideographic Plane
1643 and the character ``漢'' to the character range~100.
1646 \LuaTeX-jaは,Unicodeの \texttt{U+0080}--\texttt{U+10FFFF} の空間を
1647 1番から217番までの\emph{文字範囲}に分割している.
1648 区分けは \verb+\ltjdefcharrange+ を用いることで(グローバルに)変更することができ,
1649 例えば,次は追加漢字面(SIP)にある全ての文字と「漢」を「100番の文字範囲」に追加する.
1652 \ltjdefcharrange{100}{"20000-"2FFFF,`漢}
1655 A character can belong to only one character range.
1656 For example, whole SIP belong to the range~4 in the default setting of \LuaTeX-ja,
1657 and if you execute the above line, then SIP will belong to the range~100 and be
1658 removed from the range~4.
1661 各文字はただ一つの文字範囲に所属することができる.
1662 例えば,SIPは全て\LuaTeX-jaのデフォルトでは4番の文字範囲に
1663 属しているが,上記の指定を行えばSIPは100番に属すようになり,4番からは除かれる.
1667 The distinction between \textbf{ALchar} and \textbf{JAchar} is done for character ranges.
1668 This can be edited by setting the \textsf{jacharrange} parameter.
1669 For example, this is just the default setting of \LuaTeX-ja, and
1672 \item a character which belongs character ranges 1,~4, and~5 is \textbf{ALchar},
1673 \item a character which belongs character ranges 2,~3, 6, 7, and~8 is \textbf{JAchar}.
1677 \textbf{ALchar}と\textbf{JAchar}の区別は文字範囲ごとに行われる.
1678 これは\textsf{jacharrange}パラメータによって編集できる.
1679 例えば,以下は\LuaTeX-jaの初期設定であり,次の内容を設定している:
1681 \item 1番,4番,5番の文字範囲に属する文字は\textbf{ALchar}.
1682 \item 2番,3番,6番,7番,8番の文字範囲に属する文字は\textbf{JAchar}.
1686 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
1689 The argument to \textsf{jacharrange} parameter is a list of non-zero integer.
1690 Negative integer $-n$ in the list means that ``each character in the range~$n$ is a \textbf{ALchar}'', and positive integer $+n$ means
1691 that ``\dots\ is a \textbf{JAchar}''.
1694 \textsf{jacharrange}パラメータの引数は非零の整数のリストである.
1695 リスト中の負の整数$-n$は「文字範囲$n$に属する文字は\textbf{ALchar}として
1696 扱う」ことを意味し,正の整数$+n$は「\textbf{JAchar}として扱う」ことを意味する.
1700 \paragraph{Default Setting}
1701 \LuaTeX-ja predefines eight character ranges for convenience. They are
1702 determined from the following data:
1706 \LuaTeX-jaでは8つの文字範囲を予め定義しており,
1707 これらは以下のデータに基づいて決定している.
1710 %<en>\item Blocks in Unicode~6.0.
1711 %<ja>\item Unicode~6.0のブロック.
1712 %<en>\item The \texttt{Adobe-Japan1-UCS2} mapping between a CID Adobe-Japan1-6 and Unicode.
1713 %<ja>\item Adobe-Japan1-6のCIDとUnicodeの間の対応表\texttt{Adobe-Japan1-UCS2}.
1714 %<en>\item The \Pkg{PXbase} bundle for \upTeX\ by Takayuki Yato.
1715 %<ja>\item 八登崇之氏による\upTeX 用の\Pkg{PXbase}バンドル.
1719 Now we describe these eight ranges. The superscript ``J'' or ``A'' after the
1720 number shows whether each character in the range is treated as
1721 \textbf{JAchar}s or not by default. These settings are similar to the
1722 \texttt{prefercjk} settings defined in \texttt{PXbase} bundle.
1723 Any characters above \texttt{U+0080} which does not belong to
1724 these eight ranges belongs to the character range~217.
1727 以下ではこれら8つの文字範囲について記述する.添字のアルファベット「J」「A」
1728 は,その文字範囲内の文字が\textbf{JAchar}か\textbf{ALchar}かを表している.これらの設定は
1729 \texttt{PXbase}バンドルで定義されている\texttt{prefercjk}と類似のものである.
1730 なお,\texttt{U+0080} 以降でこれら8つの文字範囲に属さない文字は,217番の文字範囲に属することになっている.
1734 \item[Range~8${}^{\text{J}}$] The intersection of the upper half of ISO~8859-1
1735 (Latin-1 Supplement) and JIS~X~0208 (a basic character set for Japanese). This character range
1736 consists of the following characters:
1739 \item[範囲8${}^{\text{J}}$] ISO~8859-1の上位領域(ラテン1補助)と
1740 JIS~X~0208の共通部分.この文字範囲は
1743 \begin{multicols}{2}
1745 \def\ch#1#2{\item \char"#1\ (\texttt{U+00#1}, #2)}%"
1746 \ch{A7}{Section Sign}
1748 \ch{B0}{Degree sign}
1749 \ch{B1}{Plus-minus sign}
1750 \ch{B4}{Spacing acute}
1751 \ch{B6}{Paragraph sign}
1752 \ch{D7}{Multiplication sign}
1753 \ch{F7}{Division Sign}
1758 \item[Range~1${}^{\text{A}}$] Latin characters that some of them are included in Adobe-Japan1-6.
1759 This range consists of the following Unicode ranges, \emph{except characters in the range~8 above}:
1762 \item[範囲1${}^{\text{A}}$] ラテン文字のうち,Adobe-Japan1-6との共通部分があるもの.
1763 この範囲は以下のUnicodeのブロックのうち
1764 \emph{範囲8を除いた}部分で構成されている:
1766 \begin{multicols}{2}
1768 \item \texttt{U+0080}--\texttt{U+00FF}: Latin-1 Supplement
1769 \item \texttt{U+0100}--\texttt{U+017F}: Latin Extended-A
1770 \item \texttt{U+0180}--\texttt{U+024F}: Latin Extended-B
1771 \item \texttt{U+0250}--\texttt{U+02AF}: IPA Extensions
1772 \item \texttt{U+02B0}--\texttt{U+02FF}: Spacing Modifier Letters
1773 \item \texttt{U+0300}--\texttt{U+036F}: \\\null\hfill Combining Diacritical Marks
1774 \item \texttt{U+1E00}--\texttt{U+1EFF}: \\\null\hfill Latin Extended Additional
1779 \item[Range~2${}^{\text{J}}$] Greek and Cyrillic letters. JIS~X~0208 (hence most of Japanese
1780 fonts) has some of these characters.
1783 \item[範囲2${}^{\text{J}}$] ギリシャ文字とキリル文字.JIS~X~0208(したがってほとんどの
1786 \begin{multicols}{2}
1788 \item \texttt{U+0370}--\texttt{U+03FF}: Greek and Coptic
1789 \item \texttt{U+0400}--\texttt{U+04FF}: Cyrillic
1790 \item \texttt{U+1F00}--\texttt{U+1FFF}: Greek Extended
1795 \item[Range~3${}^{\text{J}}$] Punctuations and Miscellaneous symbols. The block list is
1796 indicated in Table~\ref{table-rng3}.
1799 \item[範囲3${}^{\text{J}}$] 句読点と記号類.ブロックのリストは表\ref{table-rng3}%
1803 %<en>\caption{Unicode blocks in predefined character range~3.}
1804 %<ja>\caption{文字範囲3に指定されているUnicodeブロック.}
1806 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1808 \begin{tabular}{llll}
1809 "2000--"206F&General Punctuation&
1810 "2070--"209F&Superscripts and Subscripts\\
1811 "20A0--"20CF&Currency Symbols&
1812 "20D0--"20FF&Comb.\ Diacritical Marks for Symbols\\
1813 "2100--"214F&Letterlike Symbols&
1814 "2150--"218F&Number Forms\\
1815 "2190--"21FF&Arrows&
1816 "2200--"22FF&Mathematical Operators\\
1817 "2300--"23FF&Miscellaneous Technical&
1818 "2400--"243F&Control Pictures\\
1819 "2500--"257F&Box Drawing&
1820 "2580--"259F&Block Elements\\
1821 "25A0--"25FF&Geometric Shapes&
1822 "2600--"26FF&Miscellaneous Symbols\\
1823 "2700--"27BF&Dingbats&
1824 "2900--"297F&Supplemental Arrows-B\\
1825 "2980--"29FF&Misc.\ Mathematical Symbols-B&
1826 "2B00--"2BFF&Miscellaneous Symbols and Arrows
1830 \item[Range~4${}^{\text{A}}$] Characters usually not in Japanese fonts. This range consists
1831 of almost all Unicode blocks which are not in other
1832 predefined ranges. Hence, instead of showing the block list,
1833 we put the definition of this range itself:
1836 \item[範囲4${}^{\text{A}}$] 通常和文フォントには含まれていない文字.
1837 この範囲は他の範囲にないほとんど全てのUnicodeブロック
1838 で構成されている.したがって,ブロックのリストを示す
1842 \ltjdefcharrange{4}{%
1843 "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
1844 "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F,
1845 "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese
1847 %<en>\item[Range~5${}^{\text{A}}$] Surrogates and Supplementary Private Use Areas.
1848 %<ja>\item[範囲5${}^{\text{A}}$] 代用符号と補助私用領域.
1849 %<en>\item[Range~6${}^{\text{J}}$] Characters used in Japanese. The block list is indicated in Table~\ref{table-rng6}.
1850 %<ja>\item[範囲6${}^{\text{J}}$] 日本語で用いられる文字.ブロックのリストは表\ref{table-rng6}に示す.
1852 %<en>\caption{Unicode blocks in predefined character range~6.}
1853 %<ja>\caption{文字範囲6に指定されているUnicodeブロック.}
1855 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1857 \begin{tabular}{llll}
1858 "2460--"24FF&Enclosed Alphanumerics&
1859 "2E80--"2EFF&CJK Radicals Supplement\\
1860 "3000--"303F&CJK Symbols and Punctuation&
1861 "3040--"309F&Hiragana\\
1862 "30A0--"30FF&Katakana&
1863 "3190--"319F&Kanbun\\
1864 "31F0--"31FF&Katakana Phonetic Extensions&
1865 "3200--"32FF&Enclosed CJK Letters and Months\\
1866 "3300--"33FF&CJK Compatibility&
1867 "3400--"4DBF&CJK Unified Ideographs Extension A\\
1868 "4E00--"9FFF&CJK Unified Ideographs&
1869 "F900--"FAFF&CJK Compatibility Ideographs\\
1870 "FE10--"FE1F&Vertical Forms&
1871 "FE30--"FE4F&CJK Compatibility Forms\\
1872 "FE50--"FE6F&Small Form Variants&
1873 "{20}000--"{2F}FFF&(Supplementary Ideographic Plane)\\
1874 "{E0}100--"{E0}1EF&Variation Selectors Supplement
1878 \item[Range~7${}^{\text{J}}$] Characters used in CJK languages, but not included in Adobe-Japan1-6.
1879 The block list is indicated in Table~\ref{table-rng7}.
1882 \item[範囲7${}^{\text{J}}$] CJK言語で用いられる文字のうち,Adobe-Japan1-6に
1884 ブロックのリストは表\ref{table-rng7}に示す.
1887 %<en>\caption{Unicode blocks in predefined character range~7.}
1888 %<ja>\caption{文字範囲7に指定されているUnicodeブロック.}
1890 \catcode`\"=13\def"#1#2#3#4{\texttt{U+#1#2#3#4}}%"
1892 \begin{tabular}{llll}
1893 "1100--"11FF&Hangul Jamo&
1894 "2F00--"2FDF&Kangxi Radicals\\
1895 "2FF0--"2FFF&Ideographic Description Characters&
1896 "3100--"312F&Bopomofo\\
1897 "3130--"318F&Hangul Compatibility Jamo&
1898 "31A0--"31BF&Bopomofo Extended\\
1899 "31C0--"31EF&CJK Strokes&
1900 "A000--"A48F&Yi Syllables\\
1901 "A490--"A4CF&Yi Radicals&
1902 "A830--"A83F&Common Indic Number Forms\\
1903 "AC00--"D7AF&Hangul Syllables&
1904 "D7B0--"D7FF&Hangul Jamo Extended-B
1910 %<en>\subsection{\Param{kanjiskip} and \Param{xkanjiskip}}
1911 %<ja>\subsection{\Param{kanjiskip}と\Param{xkanjiskip}}
1914 %<en>\textbf{JAglue} is divided into the following three categories:
1915 %<ja>\textbf{JAglue}は以下の3つのカテゴリに分類される:
1918 \item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued
1919 around a Japanese character, this glue will not be inserted at the
1923 \item JFMで指定されたグルー/カーン.もし \verb+\inhibitglue+ が和文文字の周りで
1924 発行されていれば,このグルーは挿入されない.
1927 \item The default glue which inserted between two \textbf{JAchar}s (\Param{%
1931 \item デフォルトで2つの\textbf{JAchar}の間に挿入されるグルー(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}).
1934 \item The default glue which inserted between a \textbf{JAchar} and an
1935 \textbf{ALchar} (\Param{\hyperlink{fld:xks}{xkanjiskip}}).
1938 \item デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルー(\Param{\hyperlink{fld:xks}{xkanjiskip}}).
1942 The value (a skip) of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or
1943 \Param{\hyperlink{fld:xks}{xkanjiskip}} can be changed as the following.
1944 Note that only their values \emph{at the end of a paragraph or a horizontal box are
1945 adopted in the whole paragraph or the whole horizontal box.
1949 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や\Param{\hyperlink{fld:xks}{xkanjiskip}}の値
1953 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt},
1954 xkanjiskip={0.25\zw plus 1pt minus 1pt}}
1958 It may occur that JFM contains the data of ``ideal width of
1959 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}''
1960 and/or ``ideal width of \Param{\hyperlink{fld:xks}{xkanjiskip}}''.
1961 To use these data from JFM, set the value of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} or
1962 \Param{\hyperlink{fld:xks}{xkanjiskip}} to \verb+\maxdimen+.
1965 JFMは「望ましい\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値」や
1966 「望ましい\Param{\hyperlink{fld:xks}{xkanjiskip}}の値」を持っていることがある.
1967 これらのデータを使うためには,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}や%
1968 \Param{\hyperlink{fld:xks}{xkanjiskip}}の値を \verb+\maxdimen+ の値に設定すればよい.
1971 %<en>\subsection{Insertion Setting of \Param{xkanjiskip}}
1972 %<ja>\subsection{\Param{xkanjiskip} の挿入設定}
1975 It is not desirable that \Param{\hyperlink{fld:xks}{xkanjiskip}} is inserted into every
1976 boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
1977 \Param{\hyperlink{fld:xks}{xkanjiskip}} should not be inserted after opening parenthesis
1978 (\textit{e.g.}, compare ``(あ'' and ``(\hskip\ltjgetparameter{xkanjiskip}あ'').
1979 \LuaTeX-ja can control whether \Param{\hyperlink{fld:xks}{xkanjiskip}} can be inserted
1980 before/after a character, by changing \Param{jaxspmode} for \textbf{JAchar}s and
1981 \Param{alxspmode} parameters \textbf{ALchar}s respectively.
1984 \Param{\hyperlink{fld:xks}{xkanjiskip}}がすべての\textbf{JAchar}と\textbf{ALchar}の境界に
1985 挿入されるのは望ましいことではない.例えば,\Param{\hyperlink{fld:xks}{xkanjiskip}}は開き括弧の
1986 後には挿入されるべきではない(「(あ」と「(\hskip\ltjgetparameter{xkanjiskip}あ」を
1988 \LuaTeX-jaでは\Param{\hyperlink{fld:xks}{xkanjiskip}}をある文字の前/後に挿入するかどうかを,
1989 \textbf{JAchar}に対しては\Param{jaxspmode}を,\textbf{ALchar}に対しては
1990 \Param{alxspmode}をそれぞれ変えることで制御することができる.
1993 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}}
1998 The second argument \texttt{preonly} means that the insertion of
1999 \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before this character, but not after.
2000 the other possible values are \texttt{postonly}, \texttt{allow}, and \texttt{inhibit}.
2003 2つ目の引数の \texttt{preonly}は「\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入はこの文字の
2004 前でのみ許され,後では許さない」ことを意味する.他に指定可能な値は
2005 \texttt{postonly}, \texttt{allow}, \texttt{inhibit}である.
2009 \Param{jaxspmode} and \Param{alxspmode} use a same table to store the parameters
2010 on the current version. Therefore, line~1 in the code above can be rewritten
2015 仕様では,\Param{jaxspmode}, \Param{alxspmode}はテーブルを共有しており,
2016 上のコードの1行目を次のように変えても同じことになる:
2019 \ltjsetparameter{alxspmode={`あ,preonly}, jaxspmode={`\!,postonly}}
2022 One can use also numbers to specify these two parameters (see Subsection~\ref{ssec-param}).
2025 また,これら2パラメータには数値で値を指定することもできる(\ref{ssec-param}節を参照).
2029 If you want to enable/disable all insertions of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} and
2030 \Param{\hyperlink{fld:xks}{xkanjiskip}}, set \Param{autospacing} and \Param{autoxspacing}
2031 parameters to \texttt{true}/\texttt{false}, respectively.
2034 もし全ての\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入を有効化/無効化
2035 したければ,それぞれ\Param{autospacing}と\Param{autoxspacing}を
2036 \texttt{true}/\texttt{false}に設定すればよい.
2039 %<en>\subsection{Shifting the baseline}
2040 %<ja>\subsection{ベースラインの移動}
2042 To make a match between a Japanese font and an alphabetic font, sometimes
2043 shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
2044 by setting \verb+\ybaselineshift+ to a non-zero length (the
2045 baseline of \textbf{ALchar} is shifted below). However, for documents
2046 whose main language is not Japanese, it is good to shift the baseline of
2047 Japanese fonts, but not that of alphabetic fonts.
2048 Because of this, \LuaTeX-ja can independently set the shifting amount
2049 of the baseline of alphabetic fonts (\Param{yalbaselineshift}
2050 parameter) and that of Japanese fonts (\Param{yjabaselineshift}
2054 和文フォントと欧文フォントを合わせるためには,時々どちらかのベースラインの移動が
2055 必要になる.\pTeX ではこれは \verb+\ybaselineshift+ を設定することで
2056 なされていた(\textbf{ALchar}のベースラインがその分だけ下がる).しかし,日本語が主ではない
2057 文書に対しては,欧文フォントではなく和文フォントのベースラインを移動した方がよい.
2058 このため,\LuaTeX-jaでは欧文フォントのベースラインのシフト量
2059 (\Param{yalbaselineshift}パラメータ)と和文フォントのベースラインのシフト量
2060 (\Param{yjabaselineshift}パラメータ)を独立に設定できるようになっている.
2064 \vrule width 150pt height 0.4pt depth 0pt \hskip-120pt
2065 \ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
2066 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
2069 Here the horizontal line in above is the baseline of a line.
2072 上の例において引かれている水平線がベースラインである.
2076 There is an interesting side-effect: characters in different size can be
2077 vertically aligned center in a line, by setting two parameters appropriately.
2078 The following is an example (beware the value is not well tuned):
2081 この機能には面白い使い方がある:2つのパラメータを適切に設定することで,サイズの
2082 異なる文字を中心線に揃えることができる.
2083 以下は一つの例である(値はあまり調整されていないことに注意):
2088 \ltjsetparameter{yjabaselineshift=-1pt,
2089 yalbaselineshift=-1pt}
2096 \paragraph{数式における挙動:\pTeX との違い}
2097 \textbf{ALchar}のベースラインを補正する \Param{yalbaselineshift} パラメータは
2098 ほぼ\pTeX における \verb+\ybaselineshift+ に対応しているものであるが,
2099 数式中の挙動は異なっているので注意が必要である.
2100 例えば,表\ref{tab:math_bsa}のように,数式中に明示的に現れた \verb+\hbox+ は,
2102 \item \pTeX では,ボックス全体が \verb+\ybaselineshift+ だとシフトされるので,
2103 表\ref{tab:math_bsa}中の``い''のように,ボックス中の和文文字は
2104 \verb+\ybaselineshift+だけシフトされ,一方,``for all''のように,
2105 ボックス内の欧文文字は2重にシフトされることになる.
2106 \item 一方,\LuaTeX-jaではそのようなことはおこらず,
2107 数式中に明示的に現れた \verb+\hbox+ はシフトしない.そのため,
2108 表\ref{tab:math_bsa}中の``い''も``for all''も,それぞれ本文中に
2113 \caption{数式関係のベースライン補正($\Param{yalbaselineshift}=10\,\textrm{pt}$)}
2114 \label{tab:math_bsa}
2115 \newdimen\origbaselineskip
2116 \origbaselineskip=\baselineskip
2117 \begin{tabular}{lp{30\zw}}
2119 \emph{入力}&\vspace*{\dimexpr-\origbaselineskip-\smallskipamount}
2121 数式abc: $あa\hbox{い}$, $\int_0^x t\,dt=x^2\!/2$,
2122 $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$
2124 \noalign{\vskip-\origbaselineskip}
2127 {\ltjsetparameter{yalbaselineshift=10pt}%
2128 数式abc: $あa\lower10pt\hbox{い}$, $\int_0^x t\,dt=x^2\!/2$,
2129 $\Phi\vdash F(x)\ \lower10pt\hbox{for all}\ x\in A$
2133 {\ltjsetparameter{yalbaselineshift=10pt}%
2134 数式abc: $あa\hbox{い}$, $\int_0^x t\,dt=x^2\!/2$,
2135 $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$
2137 \noalign{\vskip-\origbaselineskip}
2143 %<en>\part{Reference}
2148 \section{\LuaTeX-jaにおける \texttt{\char92catcode}}
2149 \subsection{予備知識:\pTeX と\upTeX における \texttt{\char92kcatcode}}
2150 \pTeX,\upTeX においては,和文文字が制御綴内で利用できるかどうか
2151 は \verb+\kcatcode+ の値によって決定されるのであった.
2152 詳細は表\ref{table-kcat}を参照されたい.
2155 \section{\texttt{\char92catcode} in \LuaTeX-ja}
2156 \subsection{Preliminaries: \texttt{\char92kcatcode} in \pTeX\ and \upTeX}
2157 In \pTeX~and~\upTeX, the value of \verb+\kcatcode+ determines
2158 whether a Japanese character can be used in a control word.
2159 For the detail, see Table~\ref{table-kcat}.
2164 \caption{\texttt{\char92kcatcode} in \upTeX}
2169 \begin{tabular}{ccccc}
2171 \bfseries \verb+\kcatcode+&
2174 \bfseries control word&
2175 \bfseries widow penalty\hbox{}$^*$&
2176 \bfseries linebreak\\
2181 \bfseries 文字ウィドウ処理\hbox{}$^*$&
2185 15&non-cjk&\multicolumn{3}{c}{(treated as usual \LaTeX)}\\
2186 16&kanji&Y&Y&ignored\\
2187 17&kana&Y&Y&ignored\\
2188 18&other&N&N&ignored\\
2189 19&hangul&Y&Y&space\\
2191 \end{tabular}\hfill\null
2196 文字ウィドウ処理\hbox{}$^*$: 「漢字が一文字だけ次の行に行くのを防ぐ」\
2197 \texttt{\char`\\jcharwidowpenalty} が,
2198 その文字の直前に挿入されうるか否か,を示す.
2203 \verb+\kcatcode+ can be set by a row of JIS~X~0208 in \pTeX,
2204 and generally by a Unicode block\footnote{%
2205 \upTeX\ divides \texttt{U+FF00}--\texttt{U+FFEF} (Halfwidth and Fullwidth Forms)
2206 into three subblocks, and \texttt{\char92kcatcode} can be set by a subblock.
2208 in \upTeX. So characters which can be used in a control word
2209 slightly differ between \pTeX~and~\upTeX.
2212 \pTeX では \verb+\kcatcode+ はJIS~X~0208の区単位,
2213 \upTeX では概ねUnicodeブロック単位\footnote{%
2214 \texttt{U+FF00}--\texttt{U+FFEF} (Halfwidth and Fullwidth Forms)は
2215 「全角英数字」「半角カナ」「その他」と3つに分割されており,
2216 それぞれ別々に \texttt{\char92kcatcode} が指定できるようになっている.
2217 }で設定可能になっている.そのため,\pTeX と\upTeX の初期状態では
2218 制御綴内で使用可能な文字が微妙に異なっている.
2222 \subsection{Case of \LuaTeX-ja}
2223 The role of \verb+\kcatcode+ in \pTeX~and~\upTeX\ caan be
2224 divided into the following four kinds,
2225 and \LuaTeX-ja can control these four kinds separately:
2228 \emph{Distinction between\textbf{JAchar} or \textbf{ALchar}}
2229 is controlled by using the character range, see Subsection~\ref{ssec-setrange}.
2231 \emph{Whether the character can be used in a control word}
2232 is controlled by setting \verb+\catcode+ to 11~(enabled) or 12~(disabled), as usual.
2234 \emph{Whether \Param{jcharwidowpenalty} can be inserted before the character}
2235 is controlled by the lowermost bit of the \Param{kcatcode} parameter.
2237 \emph{Ignoring linebreak after a \textbf{JAchar}} is always ignored.
2241 \subsection{\LuaTeX-jaの場合}
2242 \LuaTeX-jaでは,従来の\pTeX・\upTeX における \verb+\kcatcode+ の役割を
2245 \item[欧文/和文の区別 (\upTeX)]
2246 \verb+\ltjdefcharrange+ と\textsf{jacharrange}パラメータ(\ref{ssec-setrange}節)
2248 \LuaTeX 自身の \verb+\catcode+ でよい
2249 \item[\Param{jcharwidowpenalty}が挿入可か]
2250 \Param{kcatcode}パラメータの最下位ビット
2252 日本語しか想定していないので\textbf{JAchar}については一律有効
2257 Default setting of \verb+\catcode+ of \LuaTeX\ can be found
2258 in \texttt{luatex-unicode-letters.tex},
2259 which is based on \texttt{unicode-letters.tex} (for \XeTeX).
2260 However, the default setting of \verb+\catcode+ differs
2261 between \XeTeX\ and \LuaTeX, by the following reasons:
2263 \item \texttt{luatex-unicode-letters.tex} is based on old \texttt{unicode-letters.tex}.
2264 \item The latter half of \texttt{unicode-letters.tex} sets
2265 \verb+\catcode+ of Kanji and kana characters to 11,
2266 via setting \verb+\XeTeXcharclass+.
2268 However, this latter half is simply omitted in
2269 \texttt{luatex-unicode-letters.tex}, hence
2270 \verb+\catcode+ of Kanji and kana characters remains 12 in \LuaTeX.
2272 In other words, Kanji nor kana characters cannot be used in
2273 a control word, in the default setting of \LuaTeX.
2275 This would be inconvenient for \pTeX~users to shifting to \LuaTeX-ja,
2276 since several control words containing Kanji, such as \verb+\西暦+,
2278 Hence, \LuaTeX-ja have a counterpart of \texttt{unicode-letters.tex}
2279 for \LuaTeX, \emph{to match the \texttt{\char`\\catcode} setting with that of \XeTeX.}
2282 ネイティブにUnicode全部の文字を扱える\XeTeX や\LuaTeX では,
2283 文字が制御綴内で使用できるかは通常の欧文文字と同じく \verb+\catcode+
2284 で指定することとなる.\XeTeX における \verb+\catcode+ の初期設定は\
2285 \texttt{unicode-letters.tex} 中に記述されており,\LuaTeX ではそれを
2286 元にした \texttt{luatex-unicode-letters.tex} を用いている.
2288 だが,\XeTeX における \verb+\catcode+ の初期設定と
2289 \LuaTeX におけるそれは一致していない:
2291 \item \texttt{luatex-unicode-letters.tex} の元になった\
2292 \texttt{unicode-letters.tex} が古い
2293 \item \texttt{unicode-letters.tex} の後半部では
2294 \verb+\XeTeXcharclass+ の設定を行なっており,
2295 それによって漢字や仮名の \verb+\catcode+ が11に設定されている.
2297 しかし,\texttt{luatex-unicode-letters.tex} ではこの「後半部」が
2298 まるごと省略されており,漢字や仮名の \verb+\catcode+ は12のまま.
2300 言い換えると,\LuaTeX の初期状態では漢字や仮名を制御綴内に
2303 これでは \pTeX で使用できた \verb+\西暦+ などが使えないこととなり,
2304 \LuaTeX-jaへの移行で手間が生じる.そのため,\LuaTeX-jaでは
2305 \texttt{unicode-letters.tex} の後半部にあたる内容を自前でパッチし,
2306 結果として\textbf{\XeTeX における初期設定と同じになるようにしている.}
2311 %<en>\caption{Difference of the set of non-kanji JIS~X~0208 characters which can be used in a control word}
2312 %<ja>\caption{制御綴中に使用出来るJIS~X~0208非漢字の違い}
2313 \label{table-kcat-diff}
2315 {\fboxsep0pt\fcolorbox{cyan}{white}%
2316 {\large\char"#1#2#3#4}}\ (\texttt{U+#1#2#3#4})} %"
2317 \leavevmode\hbox to 0pt{\hss\begin{tabular}{cccccc}
2319 %<en>&\bf row&\bf column&\bf \pTeX&\bf \upTeX&\bf\LuaTeX-ja\\
2320 %<ja>&\bf 区&\bf 点&\bf \pTeX&\bf \upTeX&\fontseries{b}\selectfont\LuaTeX-ja\\
2324 \D 309B&1&11&N&Y&N\\
2325 \D 309C&1&12&N&Y&N\\
2326 \D FF40&1&14&N&N&Y\\
2327 \D FF3E&1&16&N&N&Y\\
2328 \D FFE3&1&17&N&N&Y\\
2329 \D FF3F&1&18&N&N&Y\\
2330 \D 30FD&1&19&N&Y&Y\\
2331 \D 30FE&1&20&N&Y&Y\\
2332 \D 309D&1&21&N&Y&Y\\
2333 \D 309E&1&22&N&Y&Y\\
2334 \D 3003&1&23&N&N&Y\\
2335 \D 4EDD&1&24&N&Y&Y\\
2336 \D 3005&1&25&N&N&Y\\
2337 \D 3006&1&26&N&N&Y\\
2338 \D 3007&1&27&N&N&Y\\
2339 \D 30FC&1&28&N&Y&Y\\
2342 \begin{tabular}{cccccc}
2344 %<en>&\bf row&\bf column&\bf \pTeX&\bf \upTeX&\bf\LuaTeX-ja\\
2345 %<ja>&\bf 区&\bf 点&\bf \pTeX&\bf \upTeX&\fontseries{b}\selectfont\LuaTeX-ja\\
2347 \D FF0F&1&31&N&N&Y\\
2348 \D FF3C&1&32&N&N&Y\\
2349 \D FF5C&1&35&N&N&Y\\
2350 \D FF0B&1&60&N&N&Y\\
2351 \D FF1D&1&65&N&N&Y\\
2352 \D FF1C&1&67&N&N&Y\\
2353 \D FF1E&1&68&N&N&Y\\
2354 \D FF03&1&84&N&N&Y\\
2355 \D FF06&1&85&N&N&Y\\
2356 \D FF0A&1&86&N&N&Y\\
2357 \D FF20&1&87&N&N&Y\\
2359 \D 3013&2&14&N&N&Y\\
2360 \D FFE2&2&44&N&N&Y\\
2361 \D 212B&2&82&N&N&Y\\
2362 %<en>\multicolumn{3}{c}{$\vphantom{\D 3000}$\hbox{}Greek letters (row 6)}&Y&N&Y\\
2363 %<en>\multicolumn{3}{c}{$\vphantom{\D 3000}$\hbox{}Cyrillic letters (row 7)}&N&N&Y\\
2364 %<ja>\multicolumn{3}{c}{$\vphantom{\D 3000}$\hbox{}ギリシャ文字(6区)}&Y&N&Y\\
2365 %<ja>\multicolumn{3}{c}{$\vphantom{\D 3000}$\hbox{}キリル文字(7区)}&N&N&Y\\
2366 $\vphantom{\D 3000}$\\
2368 \end{tabular}\hss}\par
2372 \subsection{Non-kanji Characters in a Control Word}
2373 Because the engine differ, so non-kanji JIS~X~0208 characters
2374 which can be used in a control word differ in \pTeX, in \upTeX,~and~in \LuaTeX-ja.
2375 Table~\ref{table-kcat-diff} shows the difference.
2376 Except for four characters ``・'',~``゛'', ``゜'',~``゠'',
2377 \LuaTeX-ja admits more characters in a control word than \upTeX.
2378 \emph{Note that the ideographic space~\texttt{U+3000} can be used
2379 in a control word in \LuaTeX-ja.}
2381 Difference becomes larger, if we consider
2382 non-kanji JIS~X~0213 characters.
2383 For the detail, see \url{https://github.com/h-kitagawa/kct}.
2386 \subsection{制御綴中に使用出来るJIS非漢字の違い}
2388 エンジンが異なるので,\pTeX, \upTeX, \LuaTeX-ja
2389 において制御綴中に使用可能なJIS~X~0208の文字は異なる.
2390 異なっているところだけを載せると,表\ref{table-kcat-diff}のようになる.
2391 「・」「゛」「゜」「゠」を除けば,\LuaTeX-jaでは\upTeX より多くの文字が
2393 \textbf{特に重要なのは,全角空白(\texttt{U+3000})が
2394 \LuaTeX-jaでは制御綴中に使用可能であることである.}
2396 JIS~X~0213の範囲に広げると,差異はさらに大きくなる.
2397 詳細については例えば \url{https://github.com/h-kitagawa/kct} 中の\
2398 \texttt{kct-uni-out.pdf} などを参照すること.
2402 %<en>\section{Font Metric and Japanese Font}
2403 %<ja>\section{フォントメトリックと和文フォント}
2404 %<en>\subsection{\texttt{\char92jfont}}
2405 %<ja>\subsection{\texttt{\char92jfont} 命令}
2409 To load a font as a Japanese font, you must use the
2410 \verb+\jfont+ instead of~\verb+\font+, while
2411 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
2412 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
2413 so TrueType/OpenType fonts with features can be used for Japanese fonts:
2416 フォントを和文フォントとして読み込むためには,\verb+\jfont+ を
2417 \verb+\font+ プリミティブの代わりに用いる.
2418 \verb+\jfont+ の文法は \verb+\font+ と同じである.
2419 \LuaTeX-jaは\Pkg{luaotfload}パッケージを自動的に読み込むので,
2420 TrueType/OpenTypeフォントにfeatureを指定したものを和文フォントとして用いる
2423 \begin{LTXexample}[width=0.3\textwidth]
2424 \jfont\tradgt={file:KozMinPr6N-Regular.otf:script=latn;%
2425 +trad;-kern;jfm=ujis} at 14pt
2430 Note that the defined control sequence
2431 (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a
2432 \textit{font\_def} token, but a macro.
2433 Hence the input like \verb+\fontname\tradgt+
2434 causes a error. We denote control sequences which are defined in
2435 \verb+\jfont+ by <jfont\_cs>.
2438 なお,\verb+\jfont+ で定義された制御綴(上の例だと \verb+\tradgt+)
2439 は\textit{font\_def}トークンではなくマクロである.従って,\verb+\fontname\tradgt+ のような
2440 入力はエラーとなる.以下では \verb+\jfont+ で定義された
2446 As noted in Introduction, a JFM has measurements of characters and
2447 glues/kerns that are automatically inserted for Japanese
2448 typesetting. The structure of JFM will be described in the next
2449 subsection. At the calling of \verb+\jfont+, you must specify
2450 which JFM will be used for this font by the following keys:
2453 「はじめに」の節で述べたように,JFMは文字と和文組版で自動的に挿入される
2454 グルー/カーンの寸法情報を持っている.JFMの構造は次の小節で述べる.
2455 \verb+\jfont+ 命令の呼び出しの際には,どのJFMを用いるのかを以下のキーで
2459 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2462 Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
2463 a file named \texttt{jfm-<name>.lua}.
2465 The following JFMs are shipped with \LuaTeX-ja:
2468 JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
2469 \texttt{jfm-<name>.lua}を読み込む.以下のJFMが\LuaTeX-jaには同梱されている:
2473 \item[\tt jfm-ujis.lua] A standard JFM in \LuaTeX-ja. This JFM is
2474 based on \verb+upnmlminr-h.tfm+, a metric for UTF/OTF package that
2475 is used in \upTeX. When you use the \Pkg{luatexja-otf} package, you should use this JFM.
2478 \item[\tt jfm-ujis.lua] \LuaTeX-jaの標準JFMである.このJFMは\upTeX で
2479 用いられるUTF/OTFパッケージ用の和文用TFMである \verb+upnmlminr-h.tfm+ を
2480 元にしている.\Pkg{luatexja-otf}パッケージを使うときはこのJFMを指定するべきである.
2483 \item[\tt jfm-jis.lua] A counterpart for \verb+jis.tfm+, ``JIS font
2484 metric'' which is widely used in \pTeX. A major difference between
2485 \texttt{jfm-ujis.lua} and this \texttt{jfm-jis.lua} is that
2486 most characters under \texttt{jfm-ujis.lua} are square-shaped,
2487 while that under \texttt{jfm-jis.lua} are horizontal
2491 \item[\tt jfm-jis.lua] \pTeX で広く用いられている「JISフォントメトリック」
2492 \verb+jis.tfm+ に相当するJFMである.\texttt{jfm-ujis.lua}とこの
2493 \texttt{jfm-jis.lua}の主な違いは,\texttt{jfm-ujis.lua}ではほとんどの文字が
2494 正方形状であるのに対し,\texttt{jfm-jis.lua}では横長の長方形状である.
2497 \item[\tt jfm-min.lua] A counterpart for \verb+min10.tfm+, which is one
2498 of the default Japanese font metric shipped with \pTeX. There
2499 are notable difference between this JFM and other 2~JFMs, as
2500 shown in Table~\ref{tab-difjfm}.
2503 \item[\tt jfm-min.lua] \pTeX に同梱されているデフォルトの和文用TFM
2504 である \verb+min10.tfm+ に相当するJFMである.このJFMと他の2つのJFMの間には
2505 表\ref{tab-difjfm}に示すような特筆すべき違いがある.
2510 \item[jfmvar=<string>] Sometimes there is a need that \ldots.
2513 \item[jfmvar=<string>] 標準では,JFMとサイズが同じで,
2514 実フォントだけが異なる2つの和文フォントは「区別されない」.例えば
2515 下の例において,最初の「)」と「【」の実フォントは異なるが,
2516 JFMもサイズも同じなので,普通に「)【」と入力した時と同じように半角空きとなる.
2521 \begin{LTXexample}[width=0.3\textwidth]
2522 \ltjsetparameter{differentjfm=both}
2523 \jfont\F=file:KozMinPr6N-Regular.otf:jfm=ujis
2524 \jfont\G=file:KozGoPr6N-Medium.otf:jfm=ujis
2525 \jfont\H=file:KozGoPr6N-Medium.otf:jfm=ujis;jfmvar=hoge
2527 \F ){\G 【】}( % halfwidth space
2528 ){\H 『』}( % fullwidth space
2530 \ltjsetparameter{differentjfm=paverage}
2535 %<en>\caption{Differences between JFMs shipped with \LuaTeX-ja}
2536 %<ja>\caption{\LuaTeX-ja に同梱されている JFM の違い}
2538 \ltjsetparameter{jacharrange={+3}}
2540 \def\r#1{{\jfont\g=file:KozMinPr6N-Regular.otf:jfm=#1 at 14.43324pt \g
2541 \setbox0=\vtop{\hsize=7\zw\noindent ◆◆◆◆◆◆◆
2542 ある日モモちゃんがお使いで迷子になって泣きました.}\copy0
2543 \vrule height 0pt depth \dp0}}
2544 \def\s#1{{\jfont\g=file:KozMinPr6N-Regular.otf:jfm=#1 at 14.43324pt \g
2545 \setbox0=\vtop{\hsize=7\zw\noindent ちょっと!何}\copy0}}
2546 \def\t#1{{\jfont\g=file:KozMinPr6N-Regular.otf:jfm=#1 at 19.24432pt \g
2548 \vrule width 0.4pt height\ht0 depth\dp0\kern-.2pt\copy0
2549 \kern-\wd0\vrule width\wd0height .2pt depth .2pt
2550 \kern-\wd0\raise\ht0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2551 \kern-\wd0\lower\dp0\hbox{\vrule width\wd0height .2pt depth .2pt}%
2552 \kern-.2pt\vrule width 0.4pt height\ht0 depth \dp0}}
2553 \begin{tabular}{rccc}
2555 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
2557 %<en>Example~1\cite{min10}
2559 &\r{ujis}&\r{jis}&\r{min}\\
2562 &\s{ujis}&\s{jis}&\s{min}\\
2563 Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
2566 \ltjsetparameter{jacharrange={-3}}
2569 %<en>\paragraph{Note: kern feature}
2570 %<ja>\paragraph{注意:kern feature}
2573 Some fonts have information for inter-glyph spacing. However, this
2574 information is not well-compatible with \LuaTeX-ja. More concretely,
2575 this kerning space from this information are inserted \emph{before} the
2576 insertion process of \textbf{JAglue}, and this causes incorrect spacing
2577 between two characters when both a glue/kern from the data in the font
2578 and it from JFM are present.
2581 いくつかのフォントはグリフ間のスペースについての情報を持っている.しかし,
2582 この情報は\LuaTeX-ja とはあまり相性がよくない.具体的には,この情報に基づいて挿入
2583 されるカーニングスペースは\textbf{JAglue}の挿入過程の\textbf{前に}挿入され,
2584 JFMに基づくグルー/カーンも挿入される場合には2文字間の意図しないスペースの原因と
2589 \item You should specify \texttt{-kern} in
2590 \verb+jfont+ when you want to use other font features,
2591 such as \texttt{script=...}\,.
2594 \item \texttt{script=...}といったfeatureを使いたい場合には,\verb+\jfont+
2595 に\texttt{-kern}を指定するべきである.
2598 \item If you want to use Japanese fonts in proportional width, and use
2599 information from this font, use \texttt{jfm-prop.lua} for its JFM, and\,\ldots.
2602 \item もしプロポーショナル幅の和文フォントをそのフォントの情報に基づいて使いたい
2603 ならば,\texttt{jfm-prop.lua}をJFMとして指定し,……
2610 \paragraph{\texttt{extend}と\texttt{slant}}
2611 OpenType font featureと見かけ上同じような形式で指定できるものに,
2613 \item[\texttt{extend=}<extend>] 横方向に<extend>倍拡大する.
2614 \item[\texttt{slant=}<slant>] <slant>に指定された割合だけ傾ける.
2617 \texttt{extend}や\texttt{slant}を指定した場合は,それに応じたJFMを指定すべきである%
2618 \footnote{\LuaTeX-jaでは,これらに対するJFMを特に提供することはしない予定である.}.
2619 例えば,次の例では無理やり通常のJFMを使っているために,文字間隔やイタリック補正量が
2623 \paragraph{\texttt{extend} and \texttt{slant}}
2624 The following setting can be specified as OpenType font features:
2626 \item[\texttt{extend=}<extend>] expand the font horizontally by <extend>.
2627 \item[\texttt{slant=}<slant>] slant the font.
2629 Note that \LuaTeX-ja doesn't adjust JFMs by these \texttt{extend} and \texttt{slant}
2630 settings; you have to write new JFMs on purpose.
2631 For example, the following example uses the standard JFM \texttt{jfm-ujis.lua}, hence
2632 letter-spacing and the width of italic correction are not correct:
2634 \begin{LTXexample}[width=0.3\textwidth]
2635 \jfont\E=file:KozMinPr6N-Regular.otf:extend=1.5;jfm=ujis
2638 \jfont\S=file:KozMinPr6N-Regular.otf:slant=1;jfm=ujis
2643 %<en>\subsection{Prefix \texttt{psft}}
2644 %<ja>\subsection{\texttt{psft}プリフィックス}
2647 Besides ``\texttt{file:}''\ and ``\texttt{name:}''\ prefixes which
2648 are introduced in the \Pkg{luaotfload} package,
2649 \LuaTeX-ja adds ``\texttt{psft:}''\ prefix in \verb+\jfont+ (and~\verb+\font+),
2650 to specify a ``name-only'' Japanese font which
2651 will not be embedded to PDF. Typical use of this prefix is to specify
2652 standard, non-embedded Japanese fonts, namely, ``Ryumin-Light'' and
2653 ``GothicBBB-Medium''.
2655 \emph{OpenType font features, such as ``{\tt +jp90}'',
2656 have no meaning in name-only fonts using this ``{\tt psft:}''\ prefix.
2657 This is because we can't expect what fonts are actually used by the PDF reader.}
2658 Note that \texttt{extend}~and~\texttt{slant} settings (see~above) are supported
2659 with \texttt{psft} prefix, because they are only simple linear transformations.
2662 \Pkg{luaotfload}で使用可能になった
2663 \texttt{file:}\ と \texttt{name:}\ のプリフィックスに加えて,
2664 \verb+\jfont+(と \verb+\font+ プリミティブ)では
2665 \texttt{psft:}プリフィックスを用いることができる.
2666 このプリフィックスを用いることで,PDFには埋め込まれない「名前だけの」
2667 和文フォントを指定することができる.「標準的な」非埋め込み和文フォント,
2668 つまり「Ryumin-Light」「GothicBBB-Medium」の指定でこのプリフィックスが使われる.
2670 \emph{\texttt{psft} プリフィックスの下では
2671 \texttt{+jp90} などのOpenType font featureの効力はない.
2672 非埋込フォントをPDFに使用すると,実際にどのようなフォントが
2673 表示に用いられるか予測できないからである.}\
2674 \texttt{extend} と \texttt{slant} 指定は単なる変形のため
2675 \texttt{psft} プリフィックスでも使用可能である.
2678 %<en>\paragraph{\texttt{cid} key}
2679 %<ja>\paragraph{\texttt{cid}キー}
2683 The default font defined by using \texttt{psft:} prefix is for Japanese typesetting;
2684 it is Adobe-Japan1-6 CID-keyed font.
2685 One can specify \texttt{cid} key to use other CID-keyed non-embedded fonts
2686 for Chinese or Korean typesetting.
2689 標準で\texttt{psft:}プリフィックスで定義されるフォントは日本語用のもので
2690 あり,Adobe-Japan1-6のCIDに対応したものとなる.しかし,\LuaTeX-jaは中国語
2691 の組版にも威力を発揮することが分かり,日本語フォントでない非埋込フォント
2692 の対応も必要となった.そのために追加されたのが\texttt{cid}キーである.
2694 \texttt{cid}キーに値を指定すると,そのCIDを持った非埋込フォントを定義することができる:
2696 \begin{lstlisting}[numbers=left]
2697 \jfont\testJ={psft:Ryumin-Light:cid=Adobe-Japan1-6;jfm=jis} % Japanese
2698 \jfont\testD={psft:Ryumin-Light:jfm=jis} % default value is Adobe-Japan1-6
2699 \jfont\testC={psft:AdobeMingStd-Light:cid=Adobe-CNS1-6;jfm=jis} % Traditional Chinese
2700 \jfont\testG={psft:SimSun:cid=Adobe-GB1-5;jfm=jis} % Simplified Chinese
2701 \jfont\testK={psft:Batang:cid=Adobe-Korea1-2;jfm=jis} % Korean
2704 Note that the code above specifies \texttt{jfm-jis.lua}, which is for Japanese fonts,
2705 as JFM for Chinese and Korean fonts.
2708 上のコードでは中国語・韓国語用フォントに対してもJFMに
2709 日本語用の\texttt{jfm-jis.lua}を指定しているので注意されたい.
2713 At present, \LuaTeX-ja supports only 4 values written in the sample code above.
2714 Specifying other values, e.g.,
2717 今のところ,\LuaTeX-jaは上のサンプルコード中に書いた4つの値しかサポートしていない.
2720 \jfont\test={psft:Ryumin-Light:cid=Adobe-Japan2;jfm=jis}
2723 produces the following error:
2726 のようにそれら以外の値を指定すると,エラーが発生する:
2728 \begin{lstlisting}[numbers=left]
2729 ! Package luatexja Error: bad cid key `Adobe-Japan2'.
2731 See the luatexja package documentation for explanation.
2732 Type H <return> for immediate help.
2738 I couldn't find any non-embedded font information for the CID
2739 `Adobe-Japan2'. For now, I'll use `Adobe-Japan1-6'.
2740 Please contact the LuaTeX-ja project team.
2744 %<en>\subsection{Structure of a JFM File}
2745 %<ja>\subsection{JFMファイルの構造}
2746 \label{ssec-jfm-str}
2747 %<en>A JFM file is a Lua script which has only one function call:
2748 %<ja>JFMファイルはただ一つの関数呼び出しを含むLuaスクリプトである:
2750 luatexja.jfont.define_jfm { ... }
2753 Real data are stored in the table which indicated above by
2754 \verb+{ ... }+. So, the rest of this subsection are devoted to describe the
2755 structure of this table. Note that all lengths in a JFM file are
2756 floating-point numbers in design-size unit.
2759 実際のデータは上で \verb+{ ... }+ で示されたテーブルの中に格納されている.
2760 以下ではこのテーブルの構造について記す.
2761 なお,JFMファイル中の長さは全てdesign-sizeを単位とする浮動小数点数であることに
2765 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2767 \item[dir=<direction>]
2771 %<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
2772 %<ja>JFMの書字方向.現時点では横書き(\texttt{'yoko'})のみがサポートされる.
2778 %<en>The amount of the length of the ``full-width''.
2785 %<en>The amount of the ``full-height'' (height + depth).
2786 %<ja>「全角高さ」(height + depth)の長さ.通常は全角幅と同じ長さになるだろう.
2788 \item[kanjiskip=\{<natural>, <stretch>, <shrink>\}]
2793 This field specifies the ``ideal'' amount of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}. As noted
2794 in Subsection~\ref{subs-kskip}, if the parameter
2795 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is \verb+\maxdimen+, the value specified
2796 in this field is actually used (if this field is not specified in
2797 JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink>
2798 fields are in design-size unit too.
2801 理想的な\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の量を指定する.\ref{subs-kskip}節で述べたように,
2802 もし\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が \verb+\maxdimen+ の値ならば,このフィールドで指定された
2803 値が実際には用いられる(指定なしは0\,ptとして扱われる).<stretch>と<shrink>のフィールドもdesign-size
2807 \item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}]
2812 Like the \texttt{kanjiskip} field, this field specifies the ``ideal''
2813 amount of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
2816 \texttt{kanjiskip}フィールドと同様に,\Param{\hyperlink{fld:xks}{xkanjiskip}}の理想的な量を
2822 \paragraph{Character classes}
2823 Besides from above fields, a JFM file have several sub-tables those
2824 indices are natural numbers. The table indexed by~$i\in\omega$ stores
2825 information of \emph{character class}~$i$. At least, the character class~0 is
2826 always present, so each JFM file must have a sub-table whose index is
2827 \texttt{[0]}. Each sub-table (its numerical index is denoted by $i$) has
2828 the following fields:
2832 上記のフィールドに加えて,JFMファイルはそのインデックスが自然数であるいくつかの
2833 サブテーブルを持つ.インデックスが$i\in\omega$であるテーブルは\emph{文字クラス}$i$の
2834 情報を格納する.少なくとも,文字クラス0は常に存在するので,JFMファイルはインデックス
2835 が\texttt{[0]}のサブテーブルを持たなければならない.それぞれのサブテーブル
2836 (そのインデックスを$i$で表わす)は以下のフィールドを持つ:
2839 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
2840 \item[chars=\{<character>, ...\}]
2841 %<en>(required except character class~0)
2845 This field is a list of characters which are in this character
2846 type~$i$. This field is optional if $i=0$, since all
2847 \textbf{JAchar} which do not belong any character classes other
2848 than 0 are in the character class 0
2849 (hence, the character class~0 contains most of
2850 \textbf{JAchar}s). In the list, character(s) can be specified in the following form:
2852 \item a Unicode code point
2853 \item the character itself (as a Lua string, like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+})
2854 \item a string like \hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+} (the character followed by an asterisk)
2855 \item several ``imaginary'' characters (We will describe these later.)
2859 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
2860 場合には任意である(文字クラス0には,0以外の文字クラスに属するものを
2861 除いた全ての\textbf{JAchar}が属するから).このリスト中で文字を指定するには,以下の方法がある:
2863 \item Unicode におけるコード番号
2864 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ'+}」のような,文字それ自体
2865 \item 「\hbox{\ltjsetparameter{autoxspacing=false}\verb+'あ*'+}」のような,文字それ自体の後にアスタリスクをつけたもの
2866 \item いくつかの「仮想的な文字」(後に説明する)
2870 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]
2875 Specifythe width of characters in character class~$i$, the height, the depth and
2876 the amount of italic correction. All characters in character class~$i$ are regarded that its width, height, and depth are
2877 as values of these fields.
2878 But there is one exception: if \texttt{'prop'} is specified in \texttt{width} field, width of a character becomes that of its ``real'' glyph.
2881 文字クラス$i$に属する文字の幅,高さ,深さ,イタリック補正の量を指定する.
2882 文字クラス$i$に属する全ての文字は,その幅,高さ,深さがこのフィールドで指定した
2884 しかし,例外が一つある:もし \texttt{'prop'} が \texttt{width} フィールドに
2885 指定された場合,文字の幅はその「実際の」グリフの幅となる.
2888 \item[left=<length>, down=<length>, align=<align>]\
2891 These fields are for adjusting the position of the ``real'' glyph. Legal
2892 values of \texttt{align} field are \texttt{'left'},
2893 \texttt{'middle'}, and \texttt{'right'}. If one of these
2894 3~fields are omitted, \texttt{left} and \texttt{down} are
2895 treated as~0, and \texttt{align} field is treated as
2897 The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
2900 これらのフィールドは実際のグリフの位置を調整するためにある.
2901 \texttt{align} フィールドに指定できる値は \texttt{'left'}, \texttt{'middle'},
2902 \texttt{'right'} のいずれかである.もしこれら3つのフィールドのうちの1つが省かれた
2903 場合,\texttt{left} と \texttt{down} は0,\texttt{align} フィールドは
2904 \ \texttt{'left'} であるものとして扱われる.
2905 これら3つのフィールドの意味については図\ref{fig-pos}で説明する.
2909 In most cases, \texttt{left} and \texttt{down} fields are~0, while
2910 it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
2911 For example, setting the \texttt{align} field to \texttt{'right'} is practically needed
2912 when the current character class is the class for opening delimiters'.
2915 多くの場合,\texttt{left}と\texttt{down}は0である一方,
2916 \texttt{align}フィールドが\texttt{'middle'}や\texttt{'right'}であることは
2918 例えば,\texttt{align}フィールドを\texttt{'right'}に指定することは,
2919 文字クラスが開き括弧類であるときに実際必要である.
2923 \begin{minipage}{0.4\textwidth}%
2924 \begin{center}\unitlength=10pt\small
2925 \begin{picture}(15,12)(-1,-4)
2926 \color{black!10!white}% real glyph :step1
2927 \put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
2929 \color{red!20!white}% real glyph :step1
2930 \put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2932 \color{red}% real glyph
2934 \put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2935 \put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
2936 \put(-1,5.5){\line(1,0){6}}
2937 \put(-1,-4){\line(1,0){6}}
2939 \color{green!20!white}% real glyph :step1
2940 \put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
2942 \color{black}% real glyph :step1
2944 \put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
2945 \put(12,0){\line(0,1){8}\vector(0,-1){3}}
2946 \put(0,8){\line(1,0){12}}
2947 \put(0,-3){\line(1,0){12}}
2948 \put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
2949 \put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
2950 \put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
2952 \color{green!50!black}% real glyph :step1
2954 \put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
2955 \put(9,0){\line(0,1){7}\line(0,-1){2.5}}
2956 \put(3,7){\line(1,0){6}}
2957 \put(3,-2.5){\line(1,0){6}}
2958 \newsavebox{\eqdist}
2959 \savebox{\eqdist}(0,0)[b]{%
2961 \put(-0.08,0.2){\line(0,-1){0.4}}%
2962 \put(0.08,0.2){\line(0,-1){0.4}}}
2963 \put(1.5,0){\usebox{\eqdist}}
2964 \put(10.5,0){\usebox{\eqdist}}
2966 \color{blue}% shifted
2968 \put(3,-1.5){\vector(-1,0){4}}
2969 \put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
2970 \put(3,0){\vector(0,-1){1.5}}
2971 \put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
2975 \begin{minipage}{0.6\textwidth}%
2977 Consider a node containing Japanese character whose value of the \texttt{align}
2978 field is \texttt{'middle'}.
2981 \texttt{align}フィールドの値が\texttt{'middle'}である和文文字を含むノードを
2987 The black rectangle is a frame of the node.
2988 Its width, height, and depth are specified by JFM.
2992 その幅,高さ,深さはJFMによって指定される.
2996 Since the \texttt{align} field is \texttt{'middle'},
2997 the ``real'' glyph is centered horizontally (the green rectangle).
3000 \texttt{align}フィールドは\texttt{middle}なので,実際のグリフは
3001 水平方向の中心に配置される(緑色の長方形).
3005 Furthermore, the glyph is shifted according to values of fields
3006 \texttt{left} and \texttt{down}. The ultimate position of the real
3007 glyph is indicated by the red rectangle.
3010 さらに,グリフは\texttt{left}と\texttt{down}の値に従ってシフトされる.
3011 最終的な実際のグリフの位置は赤色の長方形で示された位置になる.
3018 %<en>The position of the real glyph.
3024 \item[kern={\{[$j$]=<kern>, [$j'$]=\{<kern>, [<ratio>]\}, ...\}}]
3026 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>, [<priority>], [<ratio>]\}, ...\}}]
3028 文字クラス$i$の文字と$j$の文字の間に挿入されるkernやglueの量を指定する.
3030 <priority>は \Pkg{luatexja-adjust} による優先順位付き
3031 行長調整(\ref{ssec-adj}節)が有効なときのみ意味を持つ.
3032 このフィールドは省略可能であり,行調整処理におけるこのglueの優先
3033 度を$-2$から$+2$の間の整数で指定する.<priority>の省略時の値
3034 は0であり,範囲外の値が指定されたときの動作は未定義である.
3036 <ratio>も省略可能フィールドであり,$-1$から$+1$の実数値をとる.省略時の値は0である.
3038 \item $-1$はこのグルーが「前の文字」由来であることを示す.
3039 \item $+1$はこのグルーが「後の文字」由来であることを示す.
3040 \item それ以外の値は,「前の文字」由来のグルーと「後の文字」由来の
3043 なお,このフィールドの値は\Param{\hyperlink{fld:diffjfm}{differentjfm}}の値が
3044 \texttt{pleft},~\texttt{pright},~\texttt{paverage}の値のときのみ実際に用いられる.
3046 例えば,\cite{x4051}では,句点と中点の間には,
3047 句点由来の二分空きと中点由来の四分空きが挿入されるが,この場合には
3049 \item <width>には$0.5+0.25=0.75$を指定する.
3050 \item <ratio>には次の値を指定する.
3052 -1\cdot \frac{0.5}{0.5+0.25} + 1 \cdot \frac{0.25}{0.5+0.25} = -\frac13
3057 Specifies the width of kern or glue which will be inserted
3058 between characters in character class~$i$ and those in character class~$j$.
3060 <priority> is an integer in $[-2,2]$ (treated as 0 if omitted), and this is
3061 used only in line adjustment with priority by \Pkg{luatexja-adjust}
3062 (see Subsection~\ref{ssec-adj}).
3068 \item[end\_stretch=<kern>]
3069 \item[end\_shrink=<kern>]
3072 優先順位付き行長調整が有効であり,かつ現在の文字クラスの文字が行
3073 末に来た時に,行長を詰める調整・伸ばす調整のた
3074 めにこの文字と行末の間に挿入可能なカーンの大きさを指定する.
3080 \paragraph{文字クラスの決定}
3081 文字からその文字の属する文字クラスを算出する過程は少々複雑である.
3082 次の内容を一部に含んだ \texttt{jfm-test.lua} を用いて説明する.
3085 chars = { '漢', 'ヒ*' },
3086 align = 'left', left = 0.0, down = 0.0,
3087 width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
3090 chars = { '。', '、*', 'ヒ' },
3091 align = 'left', left = 0.0, down = 0.0,
3092 width = 0.5, height = 0.88, depth = 0.12, italic=0.0,
3096 \begin{LTXexample}[width=0.3\textwidth]
3097 \jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert
3098 \setbox0\hbox{\a 。\inhibitglue 漢}
3101 では,全角二分(15.0\,pt)となるのが自然……と思うかもしれないが,上の実行結果では20\,ptとなっている.
3104 \item \verb+vert+ featureによって句点が縦書き用のグリフと置き換わる(\Pkg{luaotfload} による処理).
3105 \item しかしこのグリフは「文字コード」\texttt{U+F0000}以降とみなされている
3106 (実際にいくらになるかは,フォントによって異なる).
3107 \item よって,文字クラス0とみなされるため,結果として「。」の幅は全角だと認識されてしまう.
3110 一方,「\texttt{'、*'}」のようにアスタリスクつきの指定があると,
3112 \begin{LTXexample}[width=0.3\textwidth]
3113 \jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert
3116 ここで,読点「、」の文字クラスは,以下のようにして決まる.
3118 \item とりあえず句点の時と同じように,\Pkg{luaotfload} によって縦書き用読点のグリフに置き換わる.
3119 \item 置換後のグリフの「文字コード」は\texttt{U+F0000}以降であり,
3120 そのままでは文字クラスは0と判定される.
3121 \item ところが,JFMには「\texttt{'、*'}」指定があるので,置換前の横書き用読点のグリフ「、」(\texttt{U+3001})によって文字クラスを判定する.
3122 \item 結果として,上の出力例中の読点の文字クラスは2000となる.
3125 なお,置換後のグリフで判定した文字クラスの値が0でなければ,そちらをそのまま作用する.
3126 \begin{LTXexample}[width=0.3\textwidth]
3127 \jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+hwid
3131 \texttt{hwid} featureにより,「ヒ」が半角の「ヒ」に置き換わるが,
3132 文字クラスは「ヒ」の属する0\emph{ではなく},「ヒ」の属する2000となる.
3135 %<ja>\paragraph{仮想的な文字}
3136 %<en>\paragraph{Imaginary characters}
3138 As described before, you can specify several \emph{imaginary characters} in
3139 \texttt{chars} field. The most of these characters are regarded as the
3140 characters of class 0 in \pTeX.
3141 As a result, \LuaTeX-ja can control typesetting finer than \pTeX.
3142 The following is the list of imaginary characters:
3145 上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
3146 指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
3147 クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
3148 い組版調整ができるようになっている.以下でその一覧を述べる:
3151 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3153 %%<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
3154 %%<ja>JFMやサイズが異なる2つの\textbf{JAchar}の間の境界として用いられる.
3157 %<en>The beginning/ending of a horizontal box, and the beginning of a noindented paragraph.
3158 %<ja>水平ボックスの先頭と末尾,及びインデントされていない(\verb+\noindent+ で開始された)段落の先頭を表す.
3161 %<en>The beginning of an (indented) paragraph.
3162 %<ja>通常の(\verb+\noindent+ で開始されていない)段落の先頭.
3165 %<en>A boundary between \textbf{JAchar} and anything else (such as \textbf{ALchar}, kern, glue,\,\ldots).
3166 %<ja>和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
3169 %<en>The left/right boundary of an inline math formula.
3173 %<en>\paragraph{Porting JFM from \pTeX}
3174 %<ja>\paragraph{\pTeX 用和文用TFMの移植}
3176 % ToDo: English version.
3183 以下に,\pTeX 用に作られた和文用TFMを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
3185 \item 実際に出力される和文フォントのサイズがdesign sizeとなる.
3186 このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
3187 トメトリック等を移植する場合は,次のようにするべきである:
3189 \item JFM中の全ての数値を$1/0.962216$倍しておく.
3190 \item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
3191 \LaTeX でのフォント宣言なら,例えば次のように:
3193 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
3196 \item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
3198 \item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
3199 文字クラスに関してはグルー/カーンの設定はしない.
3202 水平ボックスの先頭・末尾とインデントされていない(\verb+\noindent+ で開始さ
3203 れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
3204 \item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
3206 ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
3207 段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
3208 は,段落の最初に手動で \verb+\inhibitglue+ を追加するか,あるいは
3209 \ \verb+\everypar+ のハックを行い,それを自動化させるしかなかった.
3211 一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
3212 うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
3213 \texttt{'parbdd'}を入れれば全角下がりとなる.
3215 \begin{LTXexample}[width=0.4\textwidth]
3216 \jfont\g=file:KozMinPr6N-Regular.otf:jfm=test \g
3217 \parindent1\zw\noindent{}◆◆◆◆◆
3224 但し,\verb+\everypar+ を利用している場合にはこの仕組みは正しく動かない.
3225 そのような例としては箇条書き中の \verb+\item+ で始まる段落があり,\Pkg{ltjsclasses}では
3226 人工的に「\texttt{'parbdd'}の意味を持つ」whatsitノードを作ることによって対処している%
3227 \footnote{\texttt{ltjsclasses.dtx} を参照されたい.
3228 JFM側で一部の対処ができることにより,\Pkg{jsclasses}のようにif文の判定はしていない.}.
3232 %<en>\subsection{Math Font Family}
3233 %<ja>\subsection{数式フォントファミリ}
3237 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
3238 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX\ can handles 256~families, but
3239 an external package is needed to support this in plain \TeX\ and
3240 \LaTeX.}, and each family has three fonts:
3241 \verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
3244 \TeX\ は数式フォントを16のファミリ\footnote{Omega, Aleph, \LuaTeX,そして
3245 $\varepsilon$-\kern-.125em(u)\pTeX\ では256の数式ファミリを扱うことができるが,
3246 これをサポートするためにplain \TeX と\LaTeX では外部パッケージを読み込む必要が
3247 ある.}で管理し,それぞれのファミリは3つのフォントを持っている:
3248 \verb+\textfont+, \verb+\scriptfont+ そして \verb+\scriptscriptfont+ である.
3252 \LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
3253 Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
3254 font families. There is no relation between the value of
3255 \verb+\fam+ and that of \verb+\jfam+; with appropriate settings,
3256 you can set both \verb+\fam+ and \verb+\jfam+ to the same value.
3259 \LuaTeX-jaの数式中での和文フォントの扱いも同様である.
3260 表\ref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する
3261 ものを示している.\verb+\fam+ と \verb+\jfam+ の値の間には関係はなく,
3262 適切な設定の下では \verb+\fam+ と \verb+\jfam+ の両方に同じ値を設定することができる.
3266 %<en>\caption{Commands for Japanese math fonts}
3267 %<ja>\caption{和文数式フォントに対する命令}
3270 \def\{{\char`\{}\def\}{\char`\}}\small
3273 %<en>\bf Japanese fonts&\bf alphabetic fonts\\
3274 %<ja>\bf 和文フォント&\bf 欧文フォント\\
3276 \verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
3277 \tt\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
3278 \tt\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
3279 \tt\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
3284 %<en>\subsection{Callbacks}
3285 %<ja>\subsection{コールバック}
3288 Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
3289 be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks.
3292 \LuaTeX 自体のものに加えて,\LuaTeX-jaもコールバックを持っている.
3293 これらのコールバックには,他のコールバックと同様に \verb+luatexbase.add_to_callback+
3294 関数などを用いることでアクセスすることができる.
3297 {\def\makelabel#1{\bfseries#1}}
3298 %<en>\item[\texttt{luatexja.load\_jfm} callback]
3299 %<ja>\item[\texttt{luatexja.load\_jfm}コールバック]
3301 With this callback you can overwrite JFMs.
3302 This callback is called when a new JFM is loaded.
3305 このコールバックを用いることでJFMを上書きすることができる.
3306 このコールバックは新しいJFMが読み込まれるときに呼び出される.
3309 \begin{lstlisting}[numbers=left]
3310 function (<table> jfm_info, <string> jfm_name)
3311 return <table> new_jfm_info
3316 The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except
3317 this argument has \texttt{chars} field which contains character codes
3318 whose character class is not~0.
3321 引数 \verb+jfm_info+ はJFMファイルのテーブルと似たものが格納されるが,
3322 クラス0を除いた文字のコードを含んだ\texttt{chars}フィールドを持つ点が異なる.
3326 An example of this callback is the \texttt{ltjarticle} class, with
3327 forcefully assigning character class~0 to \texttt{'parbdd'}
3328 in the JFM \texttt{jfm-min.lua}.
3331 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
3332 \texttt{jfm-min.lua}中の\texttt{'parbdd'}を強制的にクラス0に割り当てている.
3335 %<en>\item[\texttt{luatexja.define\_font} callback]
3336 %<ja>\item[\texttt{luatexja.define\_font}コールバック]
3338 This callback and the next callback form a pair, and you can assign letters which don't have
3339 fixed code points in Unicode to non-zero character classes.
3340 This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
3343 このコールバックと次のコールバックは組をなしており,Unicode中に固定された文字コード
3344 番号を持たない文字を非零の文字クラスに割り当てることができる.
3345 このコールバックは新しい和文フォントが読み込まれたときに呼び出される.
3348 \begin{lstlisting}[numbers=left]
3349 function (<table> jfont_info, <number> font_number)
3350 return <table> new_jfont_info
3355 You may assume that \verb+jfont_info+ has the following fields:
3358 \verb+jfont_info+ は以下の2フィールドを持つ:
3361 \item[\tt size\_cache]
3363 使用されているJFMの情報が格納されているテーブルで,
3364 \emph{このテーブルを書き換えてはならない}.
3365 中身はほぼJFMファイルに書かれている唯一のテーブルであるが,次のように若干変わっている:
3367 \item 各文字クラス$i$に属する文字達のテーブル\
3368 \texttt{[$i$].chars=\{<character>, ...\}} は,トップレベルにまとめられ,
3369 \texttt{chars=\{[<character>]=\,$i$, ...\}} という形になっている.
3370 \item \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} の各フィールドの値は,
3371 実際に使われるフォントサイズに合わせたsp ($1\,\mathrm{sp}=2^{-16}\,\mathrm{pt}$)単位の長さに変わっている.
3372 \item 各文字クラス$i$の情報を格納したテーブルも,\texttt{char\_type} フィールドの下にまとめられている.
3373 例えば,文字クラス1に属する文字の高さは \texttt{char\_type[1].height} で参照できる.
3374 \item \texttt{dir} フィールドはこのテーブルにはない.
3378 A table which contains the information of a JFM, and \emph{this table must not be changed}.
3379 The contents of this table are similar to that which is written is the JFM file, but
3380 the following differ:
3382 \item There is a \texttt{chars} table, \dots
3383 \item The value in \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} fields are
3384 now scaled by real font size, and in scaled-pont unit.
3386 \item There is no \texttt{dir} field in this table.
3391 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
3392 %<ja>\verb+\jfont+ の呼び出しの際に\texttt{jfmvar=...}で指定された値.
3396 The returned table \verb+new_jfont_info+ also should include these two fields.
3397 The \verb+font_number+ is a font number.
3400 戻り値の \verb+new_jfont_info+ テーブルもこれら2つのフィールドを含まなければならないが,
3401 それ以外にユーザが勝手にフィールドを付け加えることは自由である.
3402 \verb+font_number+ はフォント番号である.
3406 A good example of this and the next callbacks is the \Pkg{luatexja-otf}
3407 package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
3408 CID characters in a JFM. This callback doesn't replace any
3412 これと次のコールバックの良い使用例は\Pkg{luatexja-otf}パッケージであり,
3413 JFM中でAdobe-Japan1 CIDの文字を \verb+"AJ1-xxx"+ の形で指定するために
3417 %<en>\item[\texttt{luatexja.find\_char\_class} callback]
3418 %<ja>\item[\texttt{luatexja.find\_char\_class}コールバック]
3420 This callback is called just when \LuaTeX-ja is trying to determine which
3421 character class a character \verb+chr_code+ belongs.
3422 A function used in this callback should be in the following form:
3425 このコールバックは\LuaTeX-jaが \verb+chr_code+ の文字がどの文字クラスに
3426 属するかを決定しようとする際に呼び出される.
3427 このコールバックで呼び出される関数は次の形をしていなければならない:
3429 \begin{lstlisting}[numbers=left]
3430 function (<number> char_class, <table> jfont_info, <number> chr_code)
3431 if char_class~=0 then return char_class
3434 return (<number> new_char_class or 0)
3440 The argument \verb+char_class+ is the result of \LuaTeX-ja's default
3441 routine or previous function calls in this callback, hence
3442 this argument may not be 0. Moreover, the returned
3443 \verb+new_char_class+ should be as same as \verb+char_class+ when \verb+char_class+
3444 is not~0, otherwise you will overwrite the \LuaTeX-ja's
3448 引数 \verb+char_class+ は\LuaTeX-jaのデフォルトルーチンか,このコールバックの
3449 直前の関数呼び出しの結果を含んでおり,したがってこの値は0ではないかもしれない.
3450 さらに,戻り値の \verb+new_char_class+ は \verb+char_class+ が非零のときには
3451 \verb+char_class+ の値と同じであるべきで,そうでないときは\LuaTeX-jaの
3452 デフォルトルーチンを書き換えることになる.
3455 %<en>\item[\texttt{luatexja.set\_width} callback]
3456 %<ja>\item[\texttt{luatexja.set\_width}コールバック]
3458 This callback is called when \LuaTeX-ja is trying to encapsule a
3459 \textbf{JAchar} \textit{glyph\_node}, to adjust its
3460 dimension and position.
3463 このコールバックは\LuaTeX-jaが\textbf{JAchar}の寸法と位置を調節するために
3464 その\textit{glyph\_node}をカプセル化しようとする際に呼び出される.
3466 \begin{lstlisting}[numbers=left]
3467 function (<table> shift_info, <table> jfont_info, <number> char_class)
3468 return <table> new_shift_info
3473 The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
3474 \texttt{down} and \texttt{left} fields, which are the amount of shifting
3475 down/left the character in a scaled-point.
3478 引数 \verb+shift_info+ と戻り値の \verb+new_shift_info+ は
3479 \texttt{down}と\texttt{left}のフィールドを持ち,これらの値は
3480 文字の下/左へのシフト量(スケールド・ポイント単位)である.
3484 A good example is \Pkg{test/valign.lua}.
3485 After loading this file, the vertical position of glyphs is automatically
3486 adjusted; the ratio $(\hbox{height}:\hbox{depth})$ of glyphs is adjusted
3487 to be that of letters in the character class~0. For example, suppose that
3489 \item The setting of the JFM: $(\hbox{height})=88x$, $(\hbox{depth})=12x$
3490 (the standard values of Japanese OpenType fonts);
3491 \item The value of the real font: $(\hbox{height})=28y$, $(\hbox{depth})=5y$
3492 (the standard values of Japanese TrueType fonts).
3494 Then, the position of glyphs is shifted up by
3497 良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
3498 JFM内で規定された文字クラス0の文字における$(\hbox{高
3499 さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
3502 \item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
3503 (和文OpenTypeフォントの標準値)
3504 \item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
3506 となっていたとする.すると,実際の文字の出力位置は,以下の量だけ上にぜらされることとなる:
3509 \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{25}y= 1.04y.
3515 %<en>\section{Parameters}
3516 %<ja>\section{パラメータ}
3517 \subsection{\texttt{\char`\\ltjsetparameter}}
3521 As described before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
3522 commands for accessing most parameters of \LuaTeX-ja. One of the main
3523 reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\
3524 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+)
3525 is the position of \verb+hpack_filter+ callback in the source
3526 of \LuaTeX, see Section~\ref{sec-para}.
3529 先に述べたように,\verb+\ltjsetparameter+ と \verb+\ltjgetparameter+ は
3530 \LuaTeX-jaのほとんどのパラメータにアクセスするための命令である.
3531 \LuaTeX-jaが\pTeX のような文法(例えば,\verb+\prebreakpenalty`)=10000+)を
3532 採用しない理由の一つは,\LuaTeX のソースにおける \verb+hpack_filter+
3533 コールバックの位置にある.\ref{sec-para}節を参照.
3537 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are commands
3538 for assigning parameters. These take one argument which is a
3539 \texttt{<key>=<value>} list.
3540 The list of allowed keys are described in the next subsection.
3541 The difference between
3542 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ is only the
3543 scope of assignment;
3544 \verb+\ltjsetparameter+ does a local assignment and
3545 \verb+\ltjglobalsetparameter+ does a global one.
3546 They also obey the value of \verb+\globaldefs+,
3547 like other assignment.
3550 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ はパラメータを
3551 指定するための命令である.これらは\texttt{<key>=<value>}のリストを
3552 引数としてとる.許されるキーの一覧は次の節にある.
3553 \verb+\ltjsetparameter+ と \verb+\ltjglobalsetparameter+ の違いはスコープの
3555 \verb+\ltjsetparameter+ はローカルな指定,\verb+\ltjglobalsetparameter+ は
3557 これらは他のパラメータ指定と同様に \verb+\globaldefs+ の値に従う.
3561 The following is the list of parameters which can be specified by the
3562 \verb+\ltjsetparameter+ command. [\verb+\cs+] indicates the counterpart
3563 in \pTeX, and symbols beside each parameter has the following meaning:
3566 以下は \verb+\ltjsetparameter+ に指定することができるパラメータの一覧である.
3567 [\verb+\cs+]は\pTeX における対応物を示す.
3568 また,それぞれのパラメータの右上にある記号には次の意味がある:
3572 \item ``\ast'' : values at the end of a paragraph or a horizontal box are
3573 adopted in the whole paragraph or the whole horizontal box.
3576 \item ``\ast'':段落や水平ボックスの終端での値がその段落/水平ボックス全体で用いられる.
3579 \item ``\dagger'': assignments are always global.
3582 \item ``\dagger'':指定は常にグローバルになる.
3586 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
3587 \item[\Param{jcharwidowpenalty}\,=<penalty>$^\ast$] [\verb+\jcharwidowpenalty+]
3589 Penalty value for suppressing orphans. This penalty is inserted just
3590 after the last \textbf{JAchar} which is not regarded as a
3591 (Japanese) punctuation mark.
3594 パラグラフの最後の字が孤立して改行されるのを防ぐためのペナルティの値.
3595 このペナルティは(日本語の)句読点として扱われない最後の\textbf{JAchar}の直後に
3599 \item[\Param{kcatcode}\,=\{<chr\_code>,<natural number>\}$^\ast$]\
3601 An additional attributes which each character whose character code is <chr\_code> has.
3602 At the present version, the lowermost bit of <natural number> indicates
3603 whether the character is considered as a punctuation mark
3604 (see the description of \Param{jcharwidowpenalty} above).
3607 文字コードが<chr\_code>の文字が持つ付加的な属性値(attribute).
3608 現在のバージョンでは,<natural number>の最下位ビットが,その文字が句読点と
3609 みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照).
3612 \item[\Param{\hypertarget{fld:prebp}{prebreakpenalty}}\,=\{<chr\_code>,<penalty>\}$^\ast$] [\verb+\prebreakpenalty+]\
3614 文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために,
3615 この文字の前に挿入/追加されるペナルティの量を指定する.
3617 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので,
3619 \ltjsetparameter{prebreakpenalty={`〙,10000}}
3621 と,最大値の10000が標準で指定されている.他にも,小書きのカナなど,絶対禁止とい
3622 うわけではないができれば行頭にはきて欲しくない場合に,0と
3623 10000の間の値を指定するのも有用であろう.
3626 Set a penalty which is inserted automatically before the character <chr\_code>,
3627 to prevent a line starts from this character. For example, a line cannot started
3628 with one of closing brackets ``〗'', so \LuaTeX-ja sets
3630 \ltjsetparameter{prebreakpenalty={`〙,10000}}
3636 \item[\Param{\hypertarget{fld:postbp}{postbreakpenalty}}\,=\{<chr\_code>,<penalty>\}$^\ast$] [\verb+\postbreakpenalty+]
3638 文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために,
3639 この文字の後に挿入/追加されるペナルティの量を指定する.
3641 \pTeX では,\verb+\prebreakpenalty+, \verb+\postbreakpenalty+において,
3643 \item 一つの文字に対して,pre, postどちらか一つしか指定することができなかっ
3645 \item pre, post合わせて256文字分の情報を格納することしかできなかった.
3647 という制限があったが,\LuaTeX-jaではこれらの制限は解消されている.
3650 Set a penalty which is inserted automatically after the character <chr\_code>,
3651 to prevent a line ends with this character.
3652 \pTeX\ has following restrictions on \verb+\prebreakpenalty+ and \verb+\postbreakpenalty+,
3653 but they don't exist in \LuaTeX-ja:
3657 \item[\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$]
3658 %<en>[\verb+\textfont+ in \TeX]
3659 %<ja>[\TeX の \verb+\textfont+]
3660 \item[\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$]
3661 %<en>[\verb+\scriptfont+ in \TeX]
3662 %<ja>[\TeX の \verb+\scriptfont+]
3663 \item[\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$]
3664 %<en>[\verb+\scriptscriptfont+ in \TeX]
3665 %<ja>[\TeX の \verb+\scriptscriptfont+]
3666 \item[\Param{yjabaselineshift}\,=<dimen>]\
3667 \item[\Param{yalbaselineshift}\,=<dimen>] [\verb+\ybaselineshift+]
3669 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}$^\ast$]
3672 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
3673 The followings are allowed for <mode>:
3676 文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
3681 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
3682 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
3683 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
3684 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
3685 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
3686 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
3687 %<en>\item[3, \texttt{allow}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed both before the character and after the character. This is the default value.
3688 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
3691 This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
3694 このパラメータは\pTeX の \verb+\inhibitxspcode+ プリミティブと似ているが,
3697 \item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}$^\ast$] [\verb+\xspcode+]
3700 Setting whether inserting \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before/after a
3701 \textbf{ALchar} whose character code is <chr\_code>.
3702 The followings are allowed for <mode>:
3705 文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{\hyperlink{fld:xks}{xkanjiskip}}の
3710 %<en>\item[0, \texttt{inhibit}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is inhibited before the character, nor after the character.
3711 %<ja>\item[0, \texttt{inhibit}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも禁止される.
3712 %<en>\item[1, \texttt{preonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character, but not after.
3713 %<ja>\item[1, \texttt{preonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前では許されるが,後ろでは許されない.
3714 %<en>\item[2, \texttt{postonly}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed after the character, but not before.
3715 %<ja>\item[2, \texttt{postonly}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の後ろでは許されるが,前では許されない.
3716 %<en>\item[3, \texttt{allow}] Insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed before the character and after the character. This is the default value.
3717 %<ja>\item[3, \texttt{allow}] \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は文字の前/後ろのいずれでも許される.これがデフォルトの値である.
3720 Note that parameters \Param{jaxspmode} and \Param{alxspmode} share a common table, hence these two parameters are synonyms of each other.
3723 \Param{jaxspmode}と\Param{alxspmode}は共通のテーブルを用いているため,
3724 これら2つのパラメータは互いの異名となっていることに注意する.
3727 \item[\Param{autospacing}\,=<bool>] [\verb+\autospacing+]
3728 \item[\Param{autoxspacing}\,=<bool>] [\verb+\autoxspacing+]
3729 \item[\Param{\hypertarget{fld:kanjiskip}{kanjiskip}}\,=<skip>$^\ast$] [\verb+\kanjiskip+]
3731 デフォルトで2つの\textbf{JAchar}の間に挿入されるグルーである.
3732 通常では,\pTeX と同じようにフォントサイズに比例して変わることはない.
3733 しかし,自然長が \verb+\maxdimen+ の場合は,例外的に和文フォントのJFM側で指定されている
3734 値を採用(こちらはフォントサイズに比例)することになっている.
3737 \item[\Param{\hypertarget{fld:xks}{xkanjiskip}}\,=<skip>$^\ast$] [\verb+\xkanjiskip+]
3739 デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルーである.
3740 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}と同じように,通常ではフォントサイズに比例して変わることはないが,
3741 自然長が \verb+\maxdimen+ の場合が例外である.
3745 \item[\Param{\hypertarget{fld:diffjfm}{differentjfm}}\,=<mode>$^\dagger$]
3748 Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different.
3749 The allowed arguments are the followings:
3752 JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグルー/カーンをどのように
3766 The default value is \texttt{paverage}. \dots
3769 デフォルト値は \texttt{paverage} である.
3770 各々の値による差異の詳細は\ref{ssec-cluster-wa}節の「『右空白』の算出」を参照してほしい.
3773 \item[\Param{jacharrange}\,=<ranges>]
3774 \item[\Param{kansujichar}\,=\{<digit>, <chr\_code>\}$^\ast$] [\verb+\kansujichar+]
3777 \subsection{\texttt{\char`\\ltjgetparameter}}
3779 \verb+\ltjgetparameter+ is a conteol sequence for acquiring parameters. It
3780 always takes a parameter name as first argument.
3783 \verb+\ltjgetparameter+ はパラメータの値を取得するための命令であり,
3787 \ltjgetparameter{differentjfm},
3788 \ltjgetparameter{autospacing},
3789 \ltjgetparameter{kanjiskip},
3790 \ltjgetparameter{prebreakpenalty}{`)}.
3794 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
3795 always a string}. This is outputted by \texttt{tex.write()}, so any
3796 character other than space~``\texttt{\char32}''~(\texttt{U+0020}) has the category code
3797 12~(other), while the space has 10~(space).
3800 \emph{{\normalfont\tt\char92ltjgetparameter}の戻り値は常に文字列である.}
3801 これは\texttt{tex.write()}によって出力しているためで,空白「\texttt{\char32}」
3802 (\texttt{U+0020})を除いた文字のカテゴリーコードは全て12~(other)となる.
3803 一方,空白のカテゴリーコードは10~(space)である.
3809 If first argument is one of the
3810 following, no additional argument is needed.
3813 第1引数が次のいずれかの場合には,追加の引数は必要ない.
3817 jcharwidowpenalty, yjabaselineshift, yalbaselineshift, autospacing, autoxspacing,\\
3818 kanjiskip, xkanjiskip, differentjfm
3821 Note that \verb+\ltjgetparameter{autospacing}+~and~\verb+\ltjgetparameter{autoxspacing}+
3823 \texttt{true}~nor~\texttt{false}.
3826 \verb+\ltjgetparameter{autospacing}+ と \verb+\ltjgetparameter{autoxspacing}+ は,
3827 \texttt{true}や\texttt{false}を返すの\emph{ではなく},
3833 If first argument is one of the
3834 following, an additional argument---a character code, for example---is needed.
3837 第1引数が次のいずれかの場合には,さらに文字コードを第二引数としてとる.
3841 kcatcode, prebreakpenalty, postbreakpenalty, jaxspmode, alxspmode
3844 \verb+\ltjgetparameter{jaxspmode}{...}+~and~\verb+\ltjgetparameter{alxspmode}{...}+
3845 returns 0,~1, 2,~or~3, instead of \texttt{preonly} etc.
3848 \verb+\ltjgetparameter{jaxspmode}{...}+ や \verb+\ltjgetparameter{alxspmode}{...}+\
3849 は,\texttt{preonly} などといった文字列ではなく,0から3までの値を返す.
3854 \verb+\ltjgetparameter{jacharrange}{+<range>\verb+}+ returns \texttt{0}
3855 if ``characters which belong to the character range~<range> are \textbf{JAchar}'',
3856 \texttt{1} if ``\dots are \textbf{ALchar}''.
3857 Although there is no character range~$-1$, specifying $-1$ to <range> does not cause an
3861 \verb+\ltjgetparameter{jacharrange}{+<range>\verb+}+ は,<range>が\textbf{JAchar}達の
3862 範囲ならば0を,そうでなければ1を返す.「$-1$番の文字範囲」は存在しないが,<range>に$-1$を
3863 指定してもエラーは発生しない(1を返す).
3868 For an integer~<digit> between 0~and~9,
3869 \verb+\ltjgetparameter{kansujichar}{+<digit>\verb+}+ returns the character code
3870 of the result of \verb+\kansuji+<digit>.
3874 \verb+\ltjgetparameter{kansujichar}{+<digit>\verb+}+ は,\verb+\kansuji+<digit>で出力され
3881 The following parameter names \emph{cannot be specified} in \verb+\ltjgetparameter+.
3884 次のパラメータ名を \verb+\ltjgetparameter+ に指定することはできない.
3888 jatextfont, jascriptfont, jascriptscriptfont, jacharrange
3893 \verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+ returns
3894 the range number which <chr\_code> belongs to
3895 (although there is no parameter named ``chartorange'').
3897 If <chr\_code> is between 0 and 127, this <chr\_code> does not belong to
3898 any character range. In this case,
3899 \verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+
3902 Hence, one can know whether <chr\_code> is \textbf{JAchar} or not
3906 \verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+ によって
3907 <chr\_code>の属する文字範囲の番号を知ることができる.
3909 <chr\_code>に0--127の値を指定した場合(このとき,<chr\_code>が属する
3910 文字範囲は存在しない)は$-1$が返る.
3912 そのため,<chr\_code>が\textbf{JAchar}か\textbf{ALchar}かは
3916 \ttfamily \verb+\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{+%
3917 <chr\_code>\verb+}}+\\\null\hfill\verb+% 0 if JAchar, 1 if ALchar+
3925 %<en>\section{Other Commands for plain \TeX\ and \LaTeXe}
3926 %<ja>\section{plainでも\LaTeX でも利用可能なその他の命令}
3927 %<en>\subsection{Commands for Compatibility with \pTeX}
3928 %<ja>\subsection{\pTeX 互換用命令}
3931 The following commands are implemented for compatibility with \pTeX.
3932 Note that the former five commands don't support JIS~X~0213, but only JIS~X~0208.
3933 The last \verb+\kansuji+ converts an integer into its Chinese numerals.
3936 以下の命令は\pTeX との互換性のために実装されている.そのため,JIS~X~0213には対応せず,
3937 \pTeX と同じようにJIS~X~0208の範囲しかサポートしていない.
3940 \verb+\kuten+, \verb+\jis+, \verb+\euc+, \verb+\sjis+, \verb+\jis+, \verb+\kansuji+
3943 These six commands takes an internal integer, and returns a \emph{string}.
3946 これら6命令は内部整数を引数とするが,実行結果は\textbf{文字列}であることに注意.
3951 \the\hoge, \kansuji\hoge\\
3952 \jis\hoge, \char\jis\hoge\\
3957 To change characters of Chinese numerals for each digit, set \Param{kansujichar} parameter:
3959 \ltjsetparameter{kansujichar={1,`壹}}
3960 \ltjsetparameter{kansujichar={7,`漆}}
3961 \ltjsetparameter{kansujichar={0,`零}}
3967 %<en>\subsection{\texttt{\char`\\inhibitglue}}
3968 %<ja>\subsection{\texttt{\char`\\inhibitglue}}
3970 \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
3971 The following is an example, using a special JFM that there will be a glue between
3972 the beginning of a box and ``あ'', and also between ``あ''~and~``ウ''.
3975 \verb+\inhibitglue+ は\textbf{JAglue}の挿入を抑制する.
3976 以下は,ボックスの始めと「あ」の間,「あ」「ウ」の間にグルーが入る特別なJFMを用いた例で
3981 \jfont\g=file:KozMinPr6N-Regular.otf:jfm=test \g
3982 \fbox{\hbox{あウあ\inhibitglue ウ}}
3983 \inhibitglue\par\noindent あ1
3984 \par\inhibitglue\noindent あ2
3985 \par\noindent\inhibitglue あ3
3986 \par\hrule\noindent あoff\inhibitglue ice
3990 With the help of this example, we remark the specification of \verb+\inhibitglue+:
3993 この例を援用して,\verb+\inhibitglue+ の仕様について述べる.
3997 \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
4001 \item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
4002 4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
4003 \verb+\noindent+ の時点で水平モードになるからである.
4007 \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
4008 mode is only effective on the spot; does not get over boundary of
4009 paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
4010 kernings, as shown in the last line of above example.
4013 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
4015 さらに,\verb+\inhibitglue+ は上の例の最終行のように(欧文における)リガチャとカーニングを
4016 打ち消す.これは,\verb+\inhibitglue+ が内部的には「現在のリスト中にwhatsitノードを
4017 追加する」ことを行なっているからである.
4021 \item The call of \verb+\inhibitglue+ in math mode is just ignored.
4024 \item \verb+\inhibitglue+ を数式モード中で呼び出した場合はただ無視される.
4028 \item \LaTeX で\LuaTeX-ja を使用する場合は,
4029 \verb+\inhibitglue+ の代わりとして \verb+\<+ を使うことができる.
4030 既に \verb+\<+ が定義されていた場合は,\LuaTeX-ja の読み込みで強制的に上書きされるので
4036 \subsection{\texttt{\char`\\ltjdeclarealtfont}}
4037 \label{ssec-altfont}
4040 \verb+\jfont+ の書式を見ればわかるように,基本的には\LuaTeX-jaにおける1つの和文フォントに
4041 使用出来る「実際のフォント」は1つである.
4042 しかし,\verb+\ltjdeclarealtfont+ を用いると,この原則から外れることができる.
4044 \verb+\ltjdeclarealtfont+ は以下の書式で使用する:
4046 \ttfamily \char`\\ltjdeclarealtfont<base\_font\_cs><alt\_font\_cs>{<range>}
4048 これは「現在の和文フォント」が<base\_font\_cs>であるとき,
4049 <range>に属する文字は<alt\_font\_cs>を用いて組版される,という意味である.
4051 \item <base\_font\_cs>, <alt\_font\_cs>は
4052 \verb+\jfont+ によって定義された和文フォントである.
4053 \item <range>は文字コードの範囲を表すコンマ区切りのリストであるが,
4054 例外として負数$-n$は「<base\_font\_cs>のJFMの文字クラス$n$に属する全ての文字」
4057 <range>中に<alt\_font\_cs>中に実際には存在しない文字が指定された場合は,
4061 例えば,\verb+\hoge+ のJFMが\LuaTeX-ja標準の
4062 \ \texttt{jfm-ujis.lua} であった場合,
4064 \ltjdeclarealtfont\hoge\piyo{"3000-"30FF, {-1}-{-1}}
4066 は「\verb+\hoge+ を利用しているとき,
4067 \texttt{U+3000}-\texttt{U+30FF}と
4068 文字クラス1(開き括弧類)中の文字だけは \verb+\piyo+ を用いる」
4069 ことを設定する.\verb+{-1}-{-1}+ という変わった指定の仕方をしているのは,
4070 普通に \texttt{-1} と指定したのでは正しく$-1$と読み取られないという
4076 %<en>\section{Commands for \LaTeXe}
4077 %<ja>\section{\LaTeXe 用の命令}
4079 %<en>\subsection{Patch for NFSS2}
4080 %<ja>\subsection{NFSS2へのパッチ}
4081 \label{ssub-nfsspat}
4084 \begin{lstlisting}[numberstyle=\tiny, numbers=left, numbersep=1em]
4085 \DeclareKanjiFamily{JY3}{edm}{}
4086 \DeclareFontShape{JY3}{edm}{m}{n} {<-> s*IPAexMincho:jfm=ujis}{}
4087 \DeclareFontShape{JY3}{edm}{m}{green}{<-> s*IPAexMincho:jfm=ujis;color=007F00}{}
4088 \DeclareFontShape{JY3}{edm}{m}{blue} {<-> s*IPAexMincho:jfm=ujis;color=0000FF}{}
4089 \DeclareAlternateKanjiFont{JY3}{edm}{m}{n}{JY3}{edm}{m}{green}{"4E00-"67FF,{-2}-{-2}}
4090 \DeclareAlternateKanjiFont{JY3}{edm}{m}{n}{JY3}{edm}{m}{blue}{ "6800-"9FFF}
4091 {\kanjifamily{edm}\selectfont
4092 日本国民は、正当に選挙された国会における代表者を通じて行動し、……}
4095 \DeclareKanjiFamily{JY3}{edm}{}
4096 \DeclareFontShape{JY3}{edm}{m}{n} {<-> s*KozMinPr6N-Regular:jfm=ujis}{}
4097 \DeclareFontShape{JY3}{edm}{m}{green}{<-> s*KozMinPr6N-Regular:jfm=ujis;color=007F00}{}
4098 \DeclareFontShape{JY3}{edm}{m}{blue} {<-> s*KozMinPr6N-Regular:jfm=ujis;color=0000FF}{}
4099 \DeclareAlternateKanjiFont{JY3}{edm}{m}{n}{JY3}{edm}{m}{green}{"4E00-"67FF,{-2}-{-2}}
4100 \DeclareAlternateKanjiFont{JY3}{edm}{m}{n}{JY3}{edm}{m}{blue}{ "6800-"9FFF}
4102 {\kanjifamily{edm}\selectfont
4103 日本国民は、正当に選挙された国会における代表者を通じて行動し、……}
4105 %<ja>\caption{\texttt{\char92DeclareAlternateKanjiFont} の使用例}
4106 %<en>\caption{An example of \texttt{\char92DeclareAlternateKanjiFont}}
4107 \label{fig:altkanji}
4111 As described in Subsection~\ref{ssec-ltx}, Japanese patch for NFSS2 in \LuaTeX-ja
4112 is based on \texttt{plfonts.dtx} which plays the same role in \pLaTeXe.
4113 For an convenience, we will describe
4114 commands which are not described in Subsection~\ref{ssub-chgfnt}.
4117 \ref{ssec-ltx}節で述べたように,\LuaTeX-jaのNFSS2への日本語パッチは
4118 \pLaTeXe で同様の役割を果たす \texttt{plfonts.dtx} をほぼそのまま利用している.
4119 便宜のため,ここでは\ref{ssub-chgfnt}節で述べていなかった命令について
4124 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
4127 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
4128 and Japanese font families are only made by their
4129 encodings. For example, encodings OT1 and T1 are for
4130 alphabetic font families, and a Japanese font family cannot
4131 have these encodings. This command defines a new encoding
4132 scheme for Japanese font family (in horizontal direction).
4135 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
4136 そのエンコーディングによってのみ区別される.
4137 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
4138 和文フォントファミリはこれらのエンコーディングを持つことはできない.
4139 このコマンドは横書き用和文フォントのための新しいエンコーディングを
4143 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
4144 \item[DeclareKanjiSubstitution\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}]
4145 \item[DeclareErrorKanjiFont\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}]
4148 The above 3~commands are just the counterparts for \verb+DeclareFontEncodingDefaults+ and~others.
4151 上記3つのコマンドはちょうど \verb+DeclareFontEncodingDefaults+ などに対応するものである.
4154 \item[reDeclareMathAlphabet\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}]
4158 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する.
4159 具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\verb+\mathrm+ 等)と,和文数式用フォ
4160 ントファミリ変更の命令<ja-cmd>(\verb+\mathmc+ 等)の2つを同時に行う命令として
4161 <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と
4162 <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変
4163 更させるようにするのが一般的と思われる.
4166 {\let\item=\origitem
4168 <unified-cmd>\{<arg>\}\quad$\longrightarrow$\quad
4169 (<al-cmd>の1段展開結果)\{<ja-cmd>の1段展開結果)\{<arg>\}\}
4171 と定義を行うので,使用には注意が必要である:
4172 \vspace{-\medskipamount}
4174 \item <al-cmd>,~<ja-cmd>は既に定義されていなければならない.
4175 \verb+\reDeclareMathAlphabet+\\の後に
4176 両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない.
4177 \item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと\texttt{@}をつけた命令を指定した時の動作は保証できない.
4181 \item[DeclareRelationFont\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\
4182 \hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}]
4184 This command sets the ``accompanied'' alphabetic font family (given by the latter 4~arguments)
4185 with respect to a Japanese font family given by the former 4~arguments.
4188 いわゆる「従属欧文」を設定するための命令である.前半の4引数で表される和文フォントファミリに対して,
4189 そのフォントに対応する「従属欧文」のフォントファミリを後半の4引数により与える.
4191 \item[SetRelationFont]
4193 This command is almost same as \verb+\DeclareRelationFont+, except that this command does a local
4194 assignment, where \verb+\DeclareRelationFont+ does a global assignment.
4197 このコマンドは \verb+\DeclareRelationFont+ とローカルな指定であることを除いて
4198 ほとんど同じである(\verb+\DeclareRelationFont+ はグローバル).
4203 Change current alphabetic font encoding/family/\dots\ to the `accompanied' alphabetic
4204 font family with respect to current Japanese font family,
4206 \verb+\DeclareRelationFont+ or \verb+\SetRelationFont+.
4207 Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect.
4210 現在の欧文フォントエンコーディング/ファミリ/…… を,
4211 \verb+\DeclareRelationFont+ か \verb+\SetRelationFont+ で指定された
4212 現在の和文フォントファミリに対応する「従属欧文」フォントファミリに変更する.
4213 \verb+\fontfamily+ のように,有効にするためには \verb+\selectfont+ が必要である.
4216 \item[adjustbaseline]
4219 \item[fontfamily\{<family>\}]
4221 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
4222 to <family>. Which family will be changed is determined as follows:
4225 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
4226 和文,\emph{もしくは両方})を<family>に変更する.
4227 どのファミリが変更されるかは以下のようにして決定される:
4230 \vspace{-\medskipamount}
4233 \item Let current encoding scheme for Japanese fonts be
4234 <ja-enc>. Current Japanese font family will be changed to
4235 <family>, if one of the following two conditions is met:
4238 \item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
4239 現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
4244 \item The family <family> under the encoding <ja-enc> has been already defined by
4245 \verb+\DeclareKanijFamily+.
4248 \item エンコーディング<ja-enc>におけるファミリ<family>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
4251 \item A font definition named \texttt{<ja-enc><family>.fd} (the file name is
4252 all lowercase) exists.
4255 \item フォント定義ファイル\texttt{<ja-enc><family>.fd}(ファイル名は全て小文字)が存在する.
4259 \item Let current encoding scheme for alphabetic fonts be
4260 <al-enc>. For alphabetic font family, the criterion as above is used.
4263 \item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
4264 欧文フォントファミリに対しても,上記の基準が用いられる.
4267 \item There is a case which none of the above applies, that is, the font
4268 family named <family> doesn't seem to be defined neither under the
4269 encoding <ja-enc>, nor under <al-enc>.
4270 In this case, the default family for font substitution is used for
4271 alphabetic and Japanese fonts. Note that current encoding will not
4272 be set to <family>, unlike the original implementation in \LaTeX.
4275 \item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
4276 どちらでも定義されないような場合がある.
4277 この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
4278 和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
4279 現在のエンコーディングは<family>には設定されないことに注意する.
4282 %<en>\vspace{-\medskipamount}
4285 \item[DeclareAlternateKanjiFont\{<base-encoding>\}\{<base-family>\}\{<base-series>\}\{<base-shape>\}\\
4286 \hfill\{<alt-encoding>\}\{<alt-family>\}\{<alt-series>\}\{<alt-shape>\}\{<range>\}]
4288 \ref{ssec-altfont}節の
4289 \verb+\ltjdeclarealtfont+ と同様に,前半の4引数の和文フォント(基底フォント)のうち<range>中の文字を
4290 第5--第8引数の和文フォントを使って組むように指示する.使用例を図\ref{fig:altkanji}に載せた.
4293 \vspace{-\medskipamount}
4296 \verb+\ltjdeclarealtfont+ では基底フォント・置き換え先和文フォントはあらかじめ定義されてい
4297 ないといけない(その代わり即時発効)であったが,
4298 \verb+\DeclareAlternateKanjiFont+ の設定が
4299 実際に効力が発揮するのは,書体変更やサイズ変更を行った時,
4300 あるいは(これらを含むが)\verb+\selectfont+ が実行された時である.
4302 段落や水平ボックスの最後での設定値が段落/水平ボックス全体にわたって通用する点や,
4303 <range>に負数$-n$を指定した場合,それが「基底フォントの文字クラス$n$に属する文字全体」
4304 と解釈されるのは \verb+\ltjdeclarealtfont+ と同じである.
4306 %<en>\vspace{-\medskipamount}
4310 As \verb+\ltjdeclarealtfont+, characters in <range> of the Japanese font (we say the \emph{base font})
4311 which specified by first 4 arguments are typeset
4312 by the Japanese font which specified by fifth to eighth arguments.
4313 An example is shown in Figure~\ref{fig:altkanji}.
4318 As closing this subsection, we shall introduce an example of
4319 \verb+\SetRelationFont+ and \verb+\userelfont+:
4322 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
4323 紹介しておこう.\verb+\userelfont+ の使用によって,「abc」の部分のフォントが
4324 Avant Garde (OT1/pag/m/n) に変わっていることがわかる.
4326 \begin{LTXexample}[width=0.3\textwidth]
4328 \SetRelationFont{JY3}{\k@family}{m}{n}{OT1}{pag}{m}{n}
4329 % \k@family: current Japanese font family
4330 \userelfont\selectfont あいうabc
4333 %<en>\section{Extensions}
4335 \subsection{\texttt{luatexja-fontspec.sty}}
4338 As described in Subsection~\ref{ssec-fontspec}, this optional package
4339 provides the counterparts for several commands defined in the
4340 \Pkg{fontspec} package.
4341 In addition to OpenType font features in the original \Pkg{fontspec},
4342 the following ``font features'' specifications are allowed for
4343 the commands of Japanese version:
4346 \ref{ssec-fontspec}節で述べたように,この追加パッケージは\Pkg{fontspec}
4347 パッケージで定義されているコマンドに対応する和文フォント用のコマンドを提供する.
4348 \Pkg{fontspec}パッケージで指定可能な各種font featureに加えて,和文版のコマンドには
4349 以下の``font feature''を指定することができる:
4353 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4356 \item[JFM-var=<name>] \
4359 These 3 font features correspond to \texttt{cid}, \texttt{jfm} and
4360 \texttt{jfmvar} keys for \verb+\jfont+ respectively.
4361 \texttt{CID} is effective only when with \texttt{NoEmbed}
4363 See Subsections~\ref{ssec-jfont} and \ref{ssec-psft} for details.
4366 これら3つのキーはそれぞれ \verb+\jfont+ に対する
4367 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
4368 \texttt{CID} は下の \texttt{NoEmbed} と合わせて用いられたときのみ有効である.
4369 \verb+\jfont+ プリミティブに対する
4370 \texttt{cid}, \texttt{jfm}, \texttt{jfmvar}キーの詳細は\ref{ssec-jfont}節
4371 と\ref{ssec-psft}節を参照.
4376 By specifying this font feature, one can use ``name-only'' Japanese font which
4377 will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
4380 これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
4381 できる.\ref{ssec-psft}節を参照.
4386 なお,\Pkg{luatexja-fontspec} 読み込み時には和文フォント定義ファイル%
4387 \texttt{<ja-enc><family>.fd}は全く参照されなくなる.
4392 \subsection{\texttt{luatexja-otf.sty}}
4395 This optional package supports typesetting characters in
4396 Adobe-Japan1. the package \Pkg{luatexja-otf} offers the following 2~low-level
4400 この追加パッケージはAdobe-Japan1の文字の出力をサポートする.
4401 \Pkg{luatexja-otf}は以下の2つの低レベルコマンドを提供する:
4403 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4404 \item[\char92CID\{<number>\}]
4406 Typeset a character whose CID number is <number>.
4409 CID番号が<number>の文字を出力する.
4412 \item[\char92UTF\{<hex\_number>\}]
4414 Typeset a character whose character code is <hex\_number> (in hexadecimal).
4415 This command is similar to \verb+\char"+<hex\_number>,\ %"
4416 but please remind remarks below.
4419 文字コードが(16進で)<hex\_number>の文字を出力する.
4420 このコマンドは \verb+\char"+<hex\_number>と似ているが,下の記述に注意すること.%"
4424 %<en>\paragraph{Remarks}
4427 Characters by \verb+\CID+ and \verb+\UTF+ commands are different from
4428 ordinary characters in the following points:
4431 \verb+\CID+ と \verb+\UTF+ コマンドによって出力される文字は
4436 \item Always treated as \textbf{JAchar}s.
4439 \item 常に\textbf{JAchar}として扱われる.
4442 \item Processing codes for supporting OpenType features (\textit{e.g.},
4443 glyph replacement and kerning) by the \Pkg{luaotfload} package
4444 is not performed to these characters.
4447 \item OpenType feature(例えばグリフ置換やカーニング)をサポートするための
4448 \Pkg{luaotfload}パッケージのコードはこれらの文字には働かない.
4453 %<en>\paragraph{Additional Syntax of JFM}
4454 %<ja>\paragraph{JFMへの記法の追加}
4457 The package \Pkg{luatexja-otf} extends the syntax of JFM; the entries of \texttt{
4458 chars} table in JFM now allows a string in the form
4459 \verb+'AJ1-xxx'+, which stands for the character
4460 whose CID number in Adobe-Japan1 is \verb+xxx+.
4462 This extened notation is used in the standard JFM \texttt{jfm-ujis.lua}
4463 to typeset halfwidth Hiragana glyphs (CID~516--598) in halfwidth.
4466 \Pkg{luatexja-otf}パッケージを読み込むと,
4467 JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形の文字列が
4468 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
4470 この拡張記法は,標準JFM~\texttt{jfm-ujis.lua}で,半角ひらがなのグリフ(CID~516--598)を
4471 正しく半角幅で組むために利用されている.
4475 \paragraph{IVS Support}
4476 Recent fonts support Ideographic Variation Selector (IVS).
4477 It seems that \Pkg{luaotfload} and \Pkg{fontspec} packages do not support
4478 IVS, so we implemented IVS support in \Pkg{luatexja-otf}.
4479 \emph{IVS support is experimental; if you want to enable this, load
4480 \Pkg{luatexja-otf} and execute the following:}
4484 最近のOpenTypeフォントやTrueTypeフォントには,
4485 \texttt{U+E0100}--\texttt{U+E01EF}の範囲の「文字」
4486 (漢字用異体字セレクタ)を後置することによって
4487 字形を指定する仕組み(IVS)が含まれている.
4488 執筆時点の2013年12月では,\Pkg{luaotfload}や\Pkg{fontspec}パッケージ類は
4489 IVSに対応してはいないようである.これらのパッケージで対応してくれるのが理想的だが,
4490 それまでのつなぎとして,\Pkg{luatexja-otf}パッケージ内にIVS対応を仕込んでおいた.
4494 \emph{IVS対応は試験的なものである.
4495 有効にするには,\Pkg{luatexja-otf}パッケージを読み込んだ上で以下の命令を実行する%
4496 \footnote{この命令を2回以上実行しても意味がない.}:}
4499 \directlua{luatexja.otf.enable_ivs()}
4501 %<ja> すると,上の命令を実行した箇所以降では,以下のようにIVSによる字形指定が有効となる.
4502 %<en> After executing the command above, you can use IVS like the following:
4505 \jfontspec{KozMinPr6N-Regular}
4514 左上側の入力においては,漢字用異体字セレクタを明示するため,
4515 例えばVariation~Selector~18 (\texttt{U+E0101})を\IVSB{18}のように表記している.
4520 Specifying glyph variants by IVS precedes glyph replacement by font features.
4521 For example, only ``葛'' in ``葛西'' is changed by font features
4522 \texttt{jp78}~or~\texttt{jp90}, which does not followed by any variation selector.
4525 また,IVSによる字形指定は,font featureによるそれに優先されることとした.
4526 下の例において,\texttt{jp78}, \texttt{jp90} 指定で字形が変化した文字は
4527 異体字セレクタが続いていない「葛西」中の「葛」のみである.
4531 {\jfontspec[#1]{KozMinPr6N-Regular}%
4534 \texttt{jp78}:\TEST{CJKShape=JIS1978}
4535 \texttt{jp90}:\TEST{CJKShape=JIS1990}
4539 現状では,\TeX 側のインターフェースとなる \Pkg{luatexja-otf.sty} は一切変更していない
4540 ので,ZRさんによる\Pkg{PXipamjm}パッケージ%
4541 \footnote{\url{https://github.com/zr-tex8r/PXipamjm}. 説明は彼のブログ記事
4542 「pxipamjm パッケージの説明書のような何か(\url{http://d.hatena.ne.jp/zrbabbler/20131221})」
4545 異体字の一覧表示を行いたい場合は,gitリポジトリ内の \texttt{test/test19-ivs.tex} 中にある
4546 Lua・\TeX コードが参考になるだろう.
4550 \subsection{\texttt{luatexja-adjust.sty}}
4554 \hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
4555 \hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw%
4556 \hskip\dimexpr.5\zw-.2pt\relax}\hss}}
4557 \def\sb{\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
4558 ■\hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw%
4559 \hskip\dimexpr.5\zw-.2pt\relax}\hss}}
4561 \def\outbox#1{{\Large%
4562 \ltjsetparameter{kanjiskip=0pt plus .2\zw minus .2\zw}%
4563 \setbox\gridbox=\hbox to 20\zw{\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb\sq\sq\sq\sq\sb}%
4564 \hbox{\textcolor{cyan!50!white}{\copy\gridbox}\hskip-20\zw%
4565 \vbox{\hsize=20\zw\noindent\leftskip0pt\rightskip0pt\parfillskip0pt#1}\vrule}%
4571 no adjustment&\outbox{以上の原理は,「包除原理」とよく呼ばれるが\hskip-.5\zw\null}\\
4574 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}%
4577 \outbox{以上の原理は,「包除原理」とよく呼ばれるが}
4578 %<en>\ltjdisableadjust
4585 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is 0\,pt${}^{+1/5\,\mathrm{em}}_{-1/5\,\mathrm{em}}$ in this figure,
4586 for making the difference obvious.
4587 %<ja>\caption{行長調整}\label{fig-adj}
4588 %<en>\caption{Line adjustment}\label{fig-adj}
4596 \pTeX では,行長調整において優先度の概念が存在しなかったため,図
4597 \ref{fig-adj}上段における半角分の半端は,図\ref{fig-adj}中段のように,鍵
4598 括弧周辺の空白と和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})の両方によって負担される.し
4599 かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい
4600 ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文
4601 文字はベタ組で組まれる(図\ref{fig-adj}下段)ことになっている.この追加
4602 パッケージは\cite{jlreq}や\cite{x4051}における規定のような,優先順位付き
4603 の行長調整を提供する.詳細な仕様については\ref{sec-adjspec}を参照してほしい.
4605 \item 優先度付き行長調整は,段落を行分割した後に個々の行について行われるものである.
4606 そのため,行分割の位置は変化することはない.
4608 また,\verb+\hbox to ... {...}+ のような「幅が指定されたhbox」では無効である.
4609 \item 優先度付き行長調整を行うと,和文処理グルーの自然長は変化しないが,伸び量や縮み量は
4610 一般に変化する.そのため,既に組まれた段落を \verb+\unhbox+ などを利用して組み直す処理を
4615 \Pkg{luatexja-adjust} は,以下の命令を提供する.これらはすべてグローバルに効力を発揮する.
4617 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
4618 \item[\char92ltjdisableadjust]
4621 \item[\char92ltjenableadjust]
4624 \item[\textsf{adjust}=<bool>] \verb+\ltjsetparameter+ で指定可能な追加パラメータであり,
4625 <bool>が\textit{true}なら \verb+\ltjenableadjust+ を,
4626 そうでなければ \verb+\ltjdisableadjust+ を実行する.
4639 %<en>\part{Implementations}
4642 %<en>\section{Storing Parameters}
4643 %<ja>\section{パラメータの保持}
4645 %<en>\subsection{Used Dimensions, Attributes and Whatsit Nodes}
4646 %<ja>\subsection{\LuaTeX-jaで用いられるレジスタとwhatsitノード}
4649 Here the following is the list of dimensions and attributes which are used in \LuaTeX-ja.
4652 以下は\LuaTeX-jaで用いられる寸法レジスタ(dimension),属性レジスタ(attribute)の
4656 \def\makelabel{\ttfamily}\advance\leftmargin1\zw
4657 \def\dim#1{\item[\char`\\#1\ \textrm{(dimension)}]}
4658 \def\attr#1{\item[\char`\\#1\ \textrm{(attribute)}]}
4663 \verb+\jQ+ is equal to
4664 $1\,\textrm{Q}=0.25\,\textrm{mm}$, where ``Q''~(also called ``級'') is
4665 a unit used in Japanese phototypesetting.
4666 So one should not change the value of this dimension.
4669 \verb+\jQ+ は写植で用いられた$1\,\textrm{Q}=0.25\,\textrm{mm}$%
4670 (「級」とも書かれる)に等しい.したがって,
4671 この寸法レジスタの値を変更してはならない.
4676 There is also a unit called ``歯'' which equals to $0.25\,\textrm{mm}$ and
4677 used in Japanese phototypesetting.
4678 This \verb+\jH+ is the same \verb+\dimen+ register as \verb+\jQ+.
4681 同じく写植で用いられていた単位として「歯」があり,これも$0.25\,\textrm{mm}$と
4682 等しい.この \verb+\jH+ は \verb+\jQ+ と同じ寸法レジスタを指す.
4687 A temporal register for the ``full-width'' of current Japanese font.
4690 現在の和文フォントの「全角幅」を保持する一時レジスタ.
4695 A temporal register for the ``full-height'' (usually the sum of height of imaginary body and its depth) of current Japanese font.
4698 現在の和文フォントの「全角高さ」(通常,高さと深さの和)を保持する一時レジスタ.
4703 Current number of Japanese font family for math formulas.
4706 数式用の和文フォントファミリの現在の番号.
4711 The font index of current Japanese font.
4717 \attr{ltj@charclass}
4719 The character class of Japanese \textit{glyph\_node}.
4722 和文文字の\textit{glyph\_node}の文字クラス.
4725 \attr{ltj@yablshift}
4727 The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4730 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量.
4733 \attr{ltj@ykblshift}
4735 The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\,\textrm{pt}$).
4738 スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
4743 Whether the auto insertion of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is allowed at the node.
4746 そのノードで\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の自動挿入が許されるかどうか.
4751 Whether the auto insertion of \Param{\hyperlink{fld:xks}{xkanjiskip}} is allowed at the node.
4754 そのノードで\Param{\hyperlink{fld:xks}{xkanjiskip}}の自動挿入が許されるかどうか.
4759 An attribute for distinguishing ``kinds'' of a node. One of the following value is
4760 assigned to this attribute:
4763 ノードの「種類」を区別するための属性.以下のうちのひとつが値として割り当てられる:
4766 \item[\textit{italic} (1)]
4768 Glues from an italic correction
4769 (\verb+\/+). This distinction of origins of glues
4770 (from explicit \verb+\kern+, or from \verb+\/+)
4771 is needed in the insertion process of \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4774 イタリック補正(\verb+\/+)によるグルー.このグルーの由来の区別(\verb+\kern+ か
4775 \hskip\ltjgetparameter{xkanjiskip}
4776 \verb+\/+ か)は\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入過程において必要になる.
4779 \item[\textit{packed} (2)]
4781 \item[\textit{kinsoku} (3)]
4783 Penalties inserted for the word-wrapping process of Japanese characters (\emph{kinsoku}).
4786 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
4789 \item[\textit{from\_jfm} (6)]
4791 Glues/kerns from JFM.
4797 %%\item[\textit{line\_end} (5)]
4802 %%和文文字が行末にきたとき,行末との間に挿入されるカーンである.
4806 \item[\textit{kanji\_skip} (9)]
4808 Glues for \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}.
4811 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}のグルー.
4814 \item[\textit{xkanji\_skip} (10)]
4816 Glues for \Param{\hyperlink{fld:xks}{xkanjiskip}}.
4819 \Param{\hyperlink{fld:xks}{xkanjiskip}}のグルー.
4822 \item[\textit{processed} (11)]
4824 Nodes which is already processed by \ldots.
4827 \LuaTeX-ja の内部処理によって既に処理されたノード.
4830 \item[\textit{ic\_processed} (12)]
4832 Glues from an italic correction, but also already processed.
4835 イタリック補正に由来するグルーであるが,まだ処理されていないもの.
4838 \item[\textit{boxbdd} (15)]
4840 Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
4843 ある水平ボックスか段落の最初か最後に挿入されたグルー/カーン.
4849 Where $i$~is a natural number which is less than~7.
4850 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
4854 これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
4855 扱われるかを示すビットベクトルを格納する.
4860 Furthermore, \LuaTeX-ja uses several user-defined whatsit nodes for
4861 inrernal processing. All those nodes store a natural number (hence the node's
4862 \texttt{type} is 100).
4863 Their \texttt{user\_id} (used for distinguish user-defined whatsits)
4864 are allocated by \texttt{luatexbase.newuserwhatsitid}.
4867 さらに,\LuaTeX-jaはいくつかのuser-defined whatsit nodeを内部処理に用いる.
4868 これらのwhatsitノードの \texttt{type} は100であり,ノードは自然数を格納している.
4869 user-defined whatsitを識別するための \texttt{user\_id} は\
4870 \texttt{luatexbase.newuserwhatsitid} により確保されている.
4873 \item[\textit{inhibitglue}]
4875 Nodes for indicating that \verb+\inhibitglue+ is
4876 specified. The \texttt{value} field of these nodes doesn't matter.
4879 \verb+\inhibitglue+ が指定されたことを示すノード.これらのノードの\
4880 \texttt{value} フィールドは意味を持たない.
4883 \item[\textit{stack\_marker}]
4885 Nodes for \LuaTeX-ja's stack system (see the next
4886 subsection). The \texttt{value} field of these nodes is
4887 current group level.
4890 \LuaTeX-jaのスタックシステム(次の節を参照)のためのノード.
4891 これらのノードの \texttt{value} フィールドは現在のグループネストレベルを表す.
4894 \item[\textit{char\_by\_cid}]
4896 Nodes for Japanese Characters which the callback process of
4897 \Pkg{luaotfload} won't be applied, and the character code is
4898 stored in the \texttt{value} field. Each node of this type are
4899 converted to a \textit{glyph\_node} \emph{after}
4900 the callback process of luaotfload.
4901 Nodes of this type is used in \verb+\CID+, \verb+\UTF+ and IVS support.
4904 \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
4905 \texttt{value} フィールドに文字コードが格納されている.
4906 この種類のノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
4907 \emph{後で}\textit{glyph\_node}に変換される.
4908 \verb+\CID+, \verb+\UTF+やIVS対応処理でこの種類のノードが利用されている.
4911 \item[\textit{begin\_par}]
4913 Nodes for indicating beginning of a paragraph.
4914 A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
4915 for its label before the actual contents. So \dots
4919 list環境,itemize環境などにおいて,\verb+\item+ で始まる各項目は……
4924 These whatsits will be removed during the process of inserting \textbf{JAglue}s.
4927 これらのwhatsitノードは\textbf{JAglue}の挿入処理の間に取り除かれる.
4930 %<en>\subsection{Stack System of \LuaTeX-ja}
4931 %<ja>\subsection{\LuaTeX-jaのスタックシステム}
4934 %<en>\paragraph{Background}
4937 \LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
4938 are stored in it. To clarify the reason, imagine the parameter
4939 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is stored by a skip, and consider the following
4943 \LuaTeX-jaは独自のスタックシステムを持ち,\LuaTeX-jaのほとんどのパラメータは
4944 これを用いて保持されている.その理由を明らかにするために,
4945 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメータがスキップレジスタで保持されているとし,
4949 \ltjsetparameter{kanjiskip=0pt}ふがふが.%
4951 \ltjsetparameter{kanjiskip=5pt}ほげほげ}
4956 As described in Subsection~\ref{ssec-param}, the only effective value of
4957 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} in an hbox is the latest value, so the value of
4958 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} which applied in the entire hbox should be 5\,pt.
4959 However, by the implementation method of \LuaTeX, this ``5\,pt'' cannot be
4960 known from any callbacks. In the \texttt{tex/packaging.w}, which is a
4961 file in the source of \LuaTeX, there are the following codes:
4964 \ref{ssec-param}節で述べたように,ある水平ボックスの中で効力を持つ
4965 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値は最後に現れた値のみであり,したがってボックス全体に適用される
4966 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は5\,ptであるべきである.しかし,\LuaTeX の実
4967 装を観察すると,この5\,ptという長さはどのコールバックからも知ることはできないことがわかる.
4968 \LuaTeX のソースファイルの1つ \texttt{tex/packaging.w} の中に,
4971 \begin{lstlisting}[numbers=left,firstnumber=1226]
4974 scaled h; /* height of box */
4975 halfword p; /* first node in a box */
4976 scaled d; /* max depth */
4982 if (cur_list.mode_field == -hmode) {
4983 cur_box = filtered_hpack(cur_list.head_field,
4984 cur_list.tail_field, saved_value(1),
4985 saved_level(1), grp, saved_level(2));
4986 subtype(cur_box) = HLIST_SUBTYPE_HBOX;
4989 Notice that \texttt{unsave()} is executed \emph{before}
4990 \texttt{filtered\_hpack()}, where \texttt{hpack\_filter} callback is
4991 executed) here. So ``5\,pt'' in the above source is orphaned at
4992 \texttt{unsave()}, and hence it can't be accessed from \texttt{hpack\_filter}
4996 \texttt{unsave()} が \texttt{filtered\_hpack()}(これは \texttt{hpack\_filter} コールバックが
4997 実行されるところである)の\emph{前に}実行されていることに注意する.
4998 したがって,上記ソース中で5\,ptは \texttt{unsave()} のところで捨てられ,
4999 \texttt{hpack\_filter} コールバックからはアクセスすることができない.
5002 %<en>\paragraph{The method}
5003 %<ja>\paragraph{解決法}
5006 The code of stack system is based on that in a post of Dev-luatex mailing list\footnote{%
5007 \texttt{[Dev-luatex] tex.currentgrouplevel}, a post at 2008/8/19 by Jonathan Sauer.}.
5010 スタックシステムのコードはDev-luatexメーリングリストのある投稿\footnote{%
5011 texttt{[Dev-luatex] tex.currentgrouplevel}: Jonathan Sauerによる2008/8/19の投稿.}を
5016 These are two \TeX\ count registers for maintaining information:
5017 \verb+\ltj@@stack+ for the stack level, and \verb+\ltj@@group@level+ for
5018 the \TeX's group level when the last assignment was done. Parameters
5019 are stored in one big table named \texttt{charprop\_stack\_table}, where
5020 \texttt{charprop\_stack\_table[$i$]} stores data of stack level~$i$. If
5021 a new stack level is created by \verb+\ltjsetparameter+, all data of the
5022 previous level is copied.
5025 情報を保持するために,2つの\TeX の整数レジスタを用いている:
5026 \verb+\ltj@@stack+ でスタックレベル,\verb+\ltj@@group@level+ で最後の代入が
5027 なされた時点での\TeX のグループレベルを保持している.
5028 パラメータは\texttt{charprop\_stack\_table}という名前のひとつの大きなテーブルに
5029 格納される.ここで,\texttt{charprop\_stack\_table[$i$]}はスタックレベル$i$の
5030 データを格納している.もし新しいスタックレベルが \verb+\ltjsetparameter+ によって
5031 生成されたら,前のレベルの全てのデータがコピーされる.
5035 To resolve the problem mentioned in above paragraph ``Background'', \LuaTeX-ja uses
5036 another thing: When a new stack level is about to be created, a whatsit
5037 node whose type, subtype and value are 44~(\textit{user\_defined}),
5038 \textit{stack\_marker} and current group level respectively is appended to the current
5039 list (we refer this node by \textit{stack\_flag}). This enables us to
5040 know whether assignment is done just inside a hbox. Suppose that the
5041 stack level is~$s$ and the \TeX's group level is~$t$ just after the hbox
5045 上の「背景」で述べた問題を解決するために,\LuaTeX-jaではもう一つの手法を導入する:
5046 新しいスタックレベルが生成されようとするとき,type, subtype, valueがそれぞれ
5047 44~(\textit{user\_defined}), \textit{stack\_marker},そして現在のグループレベルであるwhatsitノード
5048 を現在のリストに付け加える(このノードを\textit{stack\_flag}とする).
5049 これにより,ある水平ボックスの中で代入がなされたかどうかを知ることが可能
5050 となる.スタックレベルを$s$,その水平ボックスグループの直後の\TeX のグループレベルを
5055 \item If there is no \textit{stack\_flag} node in the list of the hbox, then
5056 no assignment was occurred inside the hbox. Hence values of
5057 parameters at the end of the hbox are stored in the stack
5061 \item もしその水平ボックスのリストの中に\textit{stack\_flag}ノードがなければ,
5062 水平ボックスの中では代入は起こらなかったということになる.
5063 したがって,その水平ボックスの終わりにおけるパラメータの値はスタックレベル$s$に
5068 \item If there is a \textit{stack\_flag} node whose value is~$t+1$, then
5069 an assignment was occurred just inside the hbox group. Hence
5070 values of parameters at the end of the hbox are stored in the
5074 \item もし値が$t+1$の\textit{stack\_flag}ノードがあれば,その
5075 水平ボックスグループの中で代入が起こったことになる.
5076 したがって,水平ボックスの終わりにおけるパラメータの値はスタックレベル$s+1$に
5081 \item If there are \textit{stack\_flag} nodes but all of their values
5082 are more than~$t+1$, then an assignment was occurred in the box,
5083 but it is done in more internal group. Hence values of
5084 parameters at the end of the hbox are stored in the stack
5088 \item もし\textit{stack\_flag}ノードがあるがそれらの値が全て$t+1$より大きい
5089 場合,そのボックスの中で代入が起こったが,それは「より内部の」グループで
5090 起こったということになる.したがって,水平ボックスの終わりでのパラメータの
5091 値はスタックレベル$s$に格納されている.
5096 Note that to work this trick correctly, assignments to
5097 \verb+\ltj@@stack+ and \verb+\ltj@@group@level+ have to be local always,
5098 regardless the value of \verb+\globaldefs+.
5099 To solve this problem, we use another trick: the assignment
5100 \hbox{\verb+\directlua{tex.globaldefs=0}+} is always local.
5103 このトリックを正しく働かせるためには,\verb+\ltj@@stack+ と \verb+\ltj@@group@level+ への
5104 代入は \verb+\globaldefs+ の値によらず常にローカルでなければならないことに注意する.
5105 この問題は \hbox{\verb+\directlua{tex.globaldefs=0}+}(この代入は常にローカル)を
5109 %<en>\section{Linebreak after a Japanese Character}
5110 %<ja>\section{和文文字直後の改行}
5112 %<en>\subsection{Reference: Behavior in \pTeX}
5113 %<ja>\subsection{参考:\pTeX の動作}
5115 In~\pTeX, a line break after a Japanese character doesn't emit a space,
5116 since words are not separated by spaces in Japanese writings. However,
5117 this feature isn't fully implemented in \LuaTeX-ja due to the
5118 specification of callbacks in~\LuaTeX. To clarify the difference between
5119 \pTeX~and~\LuaTeX, We briefly describe the handling of a line break in~\pTeX, in
5122 \pTeX's input processor can be described in terms of a finite state
5123 automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
5124 internal states are as follows:
5126 \item State~$N$: new line
5127 \item State~$S$: skipping spaces
5128 \item State~$M$: middle of line
5129 \item State~$K$: after a Japanese character
5131 The first three states---$N$,~$S$, and~$M$---are as same as \TeX's input
5132 processor. State~$K$ is similar to state~$M$, and is entered after
5133 Japanese characters. The diagram of state transitions are indicated in
5134 Figure~\ref{fig-ptexipro}. Note that \pTeX\ doesn't leave state~$K$
5135 after ``beginning/ending of a group'' characters.
5139 欧文では文章の改行は単語間でしか行わない.そのため,\TeX では,(文字の直後の)改行は
5140 空白文字と同じ扱いとして扱われる.一方,和文ではほとんどどこでも改行が可能なため,
5141 \pTeX では和文文字の直後の改行は単純に無視されるようになっている.
5143 このような動作は,\pTeX が\TeX からエンジンとして拡張されたことによって可能になったことである.
5144 \pTeX の入力処理部は,\TeX におけるそれと同じように,有限オートマトンとして記述することができ,
5148 \item State~$N$: 行の開始.
5149 \item State~$S$: 空白読み飛ばし.
5150 \item State~$M$: 行中.
5151 \item State~$K$: 行中(和文文字の後).
5153 また,状態遷移は,図\ref{fig-ptexipro}のようになっており,図中の数字は
5154 カテゴリーコードを表している.最初の3状態は\TeX の入力処理部と同じであり,
5155 図中から状態$K$と「$j$」と書かれた矢印を取り除けば,\TeX の入力処理部と同
5160 行が和文文字(とグループ境界文字)で終わっていれば,改行は無視される
5166 \let\sp\textvisiblespace\small
5167 \begin{minipage}{.6\textwidth}%
5169 \unitlength=6.5mm\sf\mathversion{bold}
5170 \begin{tikzpicture}[
5171 ->, auto, shorten >=1pt
5173 \node [shape=rectangle, font=\scriptsize] (init) at (2,7) {start};
5174 \node [shape=circle,draw, fill=blue!20] (newline) at (4,7) {$N$};
5175 \node [shape=circle,draw, fill=blue!20] (midline) at (4,4) {$M$};
5176 \node [shape=circle,draw, fill=blue!20] (skipspc) at (8,7) {$S$};
5177 \node [shape=circle,draw, fill=red!20] (kanji) at (8,4) {$K$};
5178 \node [shape=rectangle,draw, fill=green!20] (scanacs) at (6,8) {scan a c.s.};
5179 \node (endk) at (8,2.5) {} ;
5180 \node (endm) at (4,2.5) {} ;
5181 \node (ends) at (8,8.5) {} ;
5182 \node (endn) at (4,8.5) {} ;
5183 \begin{scope}[font=\scriptsize]
5184 \path (newline) edge [bend right] node [left]{G, O} (midline)
5185 (init) edge node {} (newline)
5186 (midline) edge [bend right=10] node {10} (skipspc)
5187 (skipspc) edge [bend right] node [left,right=10,above=7]{G, O} (midline)
5188 (skipspc) edge [loop right] node {10} (skipspc)
5189 (newline) edge [loop right] node {10} (newline)
5190 (scanacs) edge [bend left] node [left=3,below]{$(*)$} (skipspc)
5191 (scanacs) edge [bend right] node [right=30,above=20]{$(*)$} (midline)
5192 (midline) edge node {5\ [\sp]} (endm)
5193 (midline) edge [loop left] node {G, O} (midline)
5194 (skipspc) edge node [right] {5} (ends)
5195 (newline) edge node {5 [{\tt\char92par}]} (endn);
5197 \path (newline) edge [bend right] node [right=25,below=3]{J} (kanji)
5198 (midline) edge node [below]{J} (kanji)
5199 (kanji) edge [bend left] node {O} (midline)
5200 (kanji) edge node {10} (skipspc)
5201 (kanji) edge [loop right] node {G, J} (kanji)
5202 (skipspc) edge [bend left] node {J} (kanji)
5203 (kanji) edge node {5} (endk)
5210 \begin{minipage}{.4\textwidth}
5212 \item[\textsf{G}] Beginning of group (usually \verb+{+)\\
5213 and ending of group (usually \verb+}+).
5214 \item[\textsf{J}] Japanese characters.
5215 \item[\textsf{5}] \textit{end-of-line} (usually \verb+^+\verb+^J+).
5216 \item[\textsf{10}] space (usually \sp).
5217 \item[\textsf{O}] other characters, whose category code is in $\{3,4,6,7,8,11,12,13\}$.
5218 \item[\textsf{[\sp]}, \textsf{[{\tt\char92par}]}]
5219 emits a space, or~\verb+\par+.
5223 \item We omitted about category codes
5224 9~(\textit{ignored}), 14~(\textit{comment}), and~15~(\textit{invalid})
5225 from the above diagram. We also ignored the input like ``\verb+^+\verb+^A+'' or ``\verb+^+\verb+^df+''.
5226 \item When a character whose category code is 0 (\textit{escape character}) is seen by \TeX,
5227 the input processor scans a control sequence (\textsf{scan a c.s.}).
5228 These paths are not shown in the above diagram.
5230 After that, the state is changed to State~$S$ (skipping blanks) in most cases, but
5231 to State~$M$ (middle of line) sometimes.
5233 %<en>\caption{State transitions of \pTeX's input processor}
5234 %<ja>\caption{\pTeX の入力処理部の状態遷移}
5235 \label{fig-ptexipro}
5239 %<en>\subsection{Behavior in \LuaTeX-ja}
5240 %<ja>\subsection{\LuaTeX-jaの動作}
5242 States in the input processor of \LuaTeX\ is the same as that of \TeX,
5243 and they can't be customized by any callbacks. Hence, we can only use
5244 \verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
5245 suppress a space by a line break which is after Japanese characters.
5247 However, \verb+token_filter+ callback cannot be used either, since a
5248 character in category code 5~(\textit{end-of-line}) is converted into an space
5249 token \emph{in the input processor}. So we can use only the
5250 \verb+process_input_buffer+ callback. This means that suppressing a
5251 space must be done \emph{just before} an input line is read.
5253 Considering these situations, handling of an end-of-line in \LuaTeX-ja are as follows:
5255 A character \texttt{U+FFFFF} (its category code is set to 14~(\textit{comment}) by
5256 \LuaTeX-ja) is appended to an input line, \emph{before \LuaTeX\ actually
5257 process it}, if and only if the following three conditions are satisfied:
5259 \item The category code of \verb+\endlinechar+%
5260 \footnote{Usually, it is $\langle$\textit{return}$\rangle$
5261 (whose character code is 13).} is 5~(\textit{end-of-line}).
5262 \item The category code of \texttt{U+FFFFF} itself is 14~(\textit{comment}).
5263 \item The input line matches the following ``regular expression'':
5265 (\text{any char})^*(\textbf{JAchar})
5266 \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5272 The following example shows the major difference from the behavior of \pTeX.
5274 \fontspec[Ligatures=TeX]{TeX Gyre Termes}
5275 \ltjsetparameter{autoxspacing=false}
5276 \ltjsetparameter{jacharrange={-6}}xあ
5277 y\ltjsetparameter{jacharrange={+6}}zい
5280 It is not strange that ``あ'' does not printed in the above output.
5281 This is because \TeX\ Gyre\ Termes does not contain ``あ'', and because
5282 ``あ'' in line~3 is considered as an \textbf{ALchar}.
5284 Note that there is no space before ``y'' in the output, but
5285 there is a space before ``u''. This follows from following reasons:
5287 \item When line~3 is processed by \texttt{process\_input\_buffer} callback,
5288 ``あ'' is considered as an \textbf{JAchar}.
5289 Since line~3 ends with an \textbf{JAchar},
5290 the comment character \texttt{U+FFFFF} is appended to this line,
5291 and hence the linebreak immediately after this line is ignored.
5292 \item When line~4 is processed by \texttt{process\_input\_buffer} callback,
5293 ``い'' is considered as an \textbf{ALchar}.
5294 Since line~4 ends with an \textbf{ALchar}, the linebreak immediately after this line
5300 \LuaTeX の入力処理部は\TeX のそれと全く同じであり,コールバックによりユーザが
5301 カスタマイズすることはできない.このため,改行抑制の目的でユーザが利用で
5302 きそうなコールバックとしては,\verb+process_input_buffer+や
5303 \verb+token_filter+に限られてしまう.しかし,\TeX の入力処理部をよく見る
5304 と,後者も役には経たないことが分かる:改行文字は,入力処理部によってトー
5305 クン化される時に,カテゴリーコード10の32番文字へと置き換えられてしまうた
5306 め,\verb+token_filter+で非標準なトークン読み出しを行おうとしても,空白文
5307 字由来のトークンと,改行文字由来のトークンは区別できないのだ.
5309 すると,我々のとれる道は,\verb+process_input_buffer+を用いて
5310 \LuaTeX の入力処理部に引き渡される前に入力文字列を編集するというものしかない.
5311 以上を踏まえ,\LuaTeX-jaにおける「和文文字直後の改行抑制」の処理は,次のようになっている:
5314 各入力行に対し,\emph{その入力行が読まれる前の内部状態で}
5315 以下の3条件が満たされている場合,\LuaTeX-jaは\texttt{U+FFFFF}の文字
5316 \footnote{この文字はコメント文字として扱われるように\LuaTeX-ja内部で設定をしている.}
5317 を末尾に追加する.よって,その場合に改行は空白とは見做されないこととなる.
5319 \item \verb+\endlinechar+の文字\footnote{普通は,改行文字(文字コード13番)である.}
5320 のカテゴリーコードが5~(\textit{end-of-line})である.
5321 \item \texttt{U+FFFFF}のカテゴリーコードが14~(\textit{comment})である.
5322 \item 入力行は次の「正規表現」にマッチしている:
5324 (\text{any char})^*(\textbf{JAchar})
5325 \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
5330 この仕様は,前節で述べた\pTeX の仕様にできるだけ近づけたものとなっている.条件1.は,
5331 \texttt{verbatim}系環境などの日本語対応マクロを書かなくてすませるためのものである.
5333 しかしながら,\pTeX と完全に同じ挙動が実現できたわけではない.
5334 次のように,和文文字の範囲を変更したちょうどその行においては挙動が異なる:
5336 \fontspec[Ligatures=TeX]{TeX Gyre Termes}
5337 \ltjsetparameter{autoxspacing=false}
5338 \ltjsetparameter{jacharrange={-6}}xあ
5339 y\ltjsetparameter{jacharrange={+6}}zい
5342 上ソース中の「あ」は欧文文字扱いであり.
5343 ここで使用している欧文フォント\TeX\ Gyre Termesは「あ」を含まない.
5344 よって,出力に「あ」は現れないことは不思議ではない.
5345 それでも,\pTeX とまったく同じ挙動を示すならば,出力は
5346 「\hbox{\ltjsetparameter{autoxspacing=false}x yzいu}」となるはずである.しかし,実際には
5347 上のように異なる挙動となっているが,それは以下の理由による:
5349 \item 3行目を \texttt{process\_input\_buffer} で処理する時点では,
5350 「あ」は和文文字扱いである.よって3行目は和文文字で終わることになり,
5351 コメント文字 \texttt{U+FFFFF} が追加される.
5352 よって,直後の改行文字は無視されることになり,空白は入らない.
5353 \item 4行目を \texttt{process\_input\_buffer} で処理する時点では,
5354 「い」は欧文文字扱いである.よって4行目は欧文文字で終わることになり,
5357 このため,トラブルを避けるために,和文文字の範囲を\verb+\ltjsetparameter+で編集した場合,
5358 その行はそこで改行するようにした方がいいだろう.
5363 %<en>\section{Insertion of JFM glues, \Param{kanjiskip} and \Param{xkanjiskip}}
5364 %<ja>\section{JFMグルーの挿入,\Param{kanjiskip}と\Param{xkanjiskip}}
5366 %<en>\subsection{Overview}
5367 %<ja>\subsection{概要}
5369 \LuaTeX-jaにおける \textbf{JAglue} の挿入方法は,\pTeX のそれとは全く異なる.
5370 \pTeX では次のような仕様であった:
5372 \item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
5374 \item \Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は,水平ボックスへのパッケージングや行分割前に行われる.
5375 \item \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}はノードとしては挿入されない.パッケージングや行分割の計算時に
5376 「和文文字を表す2つの<char\_node>の間には\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}がある」ものとみなされる.
5378 しかし,\LuaTeX-jaでは,水平ボックスへのパッケージングや行分割前に全ての
5379 \textbf{JAglue},即ちJFMグルー・\Param{\hyperlink{fld:xks}{xkanjiskip}}・\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の
5380 3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
5381 カーニング処理がノードベースになったことに対応する変更である.
5383 \LuaTeX-jaにおける\textbf{JAglue}挿入処理では,次節で定義する
5384 「クラスタ」を単位にして行われる.大雑把にいうと,「クラスタ」は文字とそれに付随す
5385 るノード達(アクセント位置補正用のカーンや,イタリック補正)をまとめたもの
5386 であり,2つのクラスタの間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
5390 %<en>\subsection{Definition of a Cluster}
5391 %<ja>\subsection{「クラスタ」の定義}
5393 \def\OA{$\text{\sf O}_{\text{\sf A}}$}
5394 \def\OB{$\text{\sf O}_{\text{\sf B}}$}
5397 A \emph{cluster} is a list of consecutive nodes in one of the following forms,
5398 with the \textit{id} of it:
5401 \emph{クラスタ}は以下の形のうちのどれかひとつをとる連続的なノードのリストである:
5405 \item Nodes whose value of\ \verb+\ltj@icflag+ is in $[3,15)$. These
5406 nodes come from a hbox which is already packaged, by unpackaging
5408 The \textit{id} is \textit{id\_pbox}.
5411 \item その \verb+\ltj@icflag+ の値が$[3,15)$に入るノードのリスト.
5412 これらのノードはある既にパッケージングされた水平ボックスから \verb+\unhbox+ で
5414 その\textit{id}は\textit{id\_pbox}である.
5418 \item A inline math formula, including two \textit{math\_node}s at the boundary of it.
5419 The \textit{id} is \textit{id\_math}.
5422 \item インライン数式でその境界に2つの\textit{math\_node}を含むもの.
5423 その\textit{id}は\textit{id\_math}である.
5427 \item A \textit{glyph\_node}~$p$ with nodes which relate with it:
5430 \item \textit{glpyh\_node}~$p$とそれに関係するノード:
5434 \item A kern for the italic correction of~$p$.
5437 \item $p$のイタリック補正のためのカーン.
5441 \item An accent attached to $p$ by \verb+\accent+.
5444 \item \verb+\accent+ による$p$に付随したアクセント.
5449 \Node{kern}{$\mathit{subtype}=2$}\longrightarrow
5450 \left\{\begin{array}{c}
5451 \Node{glyph}{accent}\\\noalign{\medskip}
5452 \Node{hbox}{accent (shifted vert.)}
5453 \end{array}\right\}\longrightarrow
5454 \Node{kern}{$\mathit{subtype}=2$}}^{\text{(a)}}
5456 \Node{glyph}{$p$}\longrightarrow
5458 \Node{kern}{italic corr.}}^{\text{(b)}}
5462 The \textit{id} is \textit{id\_jglyph} or
5463 \textit{id\_glyph}, according to whether the \textit{glyph\_node}
5464 represents a Japanese character or not.
5467 \textit{id}は\textit{glyph\_node}が和文文字を表すかどうかによって
5468 \textit{id\_jglyph},もしくは\textit{id\_glyph}となる.
5472 \item An box-like node, that is, an hbox, a vbox, a rule (\verb+\vrule+) and an \textit{unset\_node}.
5473 The \textit{id} is \textit{id\_hlist} if the node is an
5474 hbox which is not shifted vertically, or \textit{id\_box\_like}
5478 \item ボックス様のノード,つまり水平ボックス,垂直ボックス,罫線 (\verb+\vrule+),
5479 そして\textit{unset\_node}.
5480 その\textit{id}は垂直に移動していない水平ボックスならば\textit{id\_hlist},
5481 そうでなければ\textit{id\_box\_like}となる.
5485 \item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
5486 The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
5487 and \textit{id\_disc}, respectively.
5490 \item グルー,subtypeが 2~(\textit{accent})ではないカーン,そして任意改行.
5491 その\textit{id}はそれぞれ\textit{id\_glue}, \textit{id\_kern},そして
5492 \textit{id\_disc}である.
5496 Let \textit{Np}, \textit{Nq} and \textit{Nr} denote a cluster.
5499 以下では\textit{Np}, \textit{Nq}, \textit{Nr}でクラスタを表す.
5503 \paragraph{\textit{id}の意味}
5504 $\mathit{Np}.\mathit{id}$の意味を述べるとともに,
5505 「先頭の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{head}$と,
5506 「最後の文字」を表す\textit{glyph\_node}~$\mathit{Np}.\mathit{tail}$を次のように定義する.
5507 直感的に言うと,\textit{Np}は$\mathit{Np}.\mathit{head}$で始まり$\mathit{Np}.\mathit{tail}$で終わるような単語,
5508 と見做すことができる.これら$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は
5509 説明用に準備した概念であって,実際のLuaコード中にそのように書かれているわけではないことに注意.
5512 \item[\textit{id\_jglyph}] 和文文字.\\
5513 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は,その和文文字を表している
5514 \textit{glyph\_node}そのものである.
5515 \item[\textit{id\_glyph}] 和文文字を表していない\textit{glyph\_node}~$p$.\\
5516 多くの場合,$p$は欧文文字を格納しているが,「ffi」などの合字によって作られた
5517 \textit{glyph\_node}である可能性もある.
5518 前者の場合,$\mathit{Np}.\mathit{head}$,~$\mathit{Np}.\mathit{tail} = p$である.
5521 \item $\mathit{Np}.\mathit{head}$は,
5522 合字の構成要素の先頭→(その\textit{glyph\_node}における)合字の構成要素の先頭→……
5523 と再帰的に検索していってたどり着いた\textit{glyph\_node}である.
5524 \item $\mathit{Np}.\mathit{last}$は,同様に末尾→末尾→と検索してたどり着いた\textit{glyph\_node}である.
5526 \item[\textit{id\_math}] インライン数式.\\
5527 便宜的に,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$ともに
5528 「文字コード$-1$の欧文文字」とおく.
5529 \item[\textit{id\_hlist}] 縦方向にシフトされていない水平ボックス.\\
5530 この場合,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$はそれぞれ$p$の内容を表すリストの,
5533 \item 状況によっては,\TeX ソースで言うと
5535 \hbox{\hbox{abc}...\hbox{\lower1pt\hbox{xyz}}}
5537 のように,$p$の内容が別の水平ボックスで開始・終了している可能性も十分あり得る.そのような場合,
5538 $\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は,
5539 \emph{垂直方向にシフトされていない}水平ボックスの
5540 場合だけ内部を再帰的に探索する.例えば上の例では,$\mathit{Np}.\mathit{head}$は文字「a」を表すノードであり,
5541 一方$\mathit{Np}.\mathit{tail}$は垂直方向にシフトされた水平ボックス,
5542 \verb+\lower1pt\hbox{xyz}+ に対応するノードである.
5543 \item また,先頭にアクセント付きの文字がきたり,末尾にイタリック補正用のカーンが
5544 来ることもあり得る.この場合は,クラスタの定義のところにもあったように,それらは無視して算出を行う.
5545 \item 最初・最後のノードが合字によって作られた\textit{glyph\_node}のときは,それぞれに対して\textit{id\_glyph}%
5546 と同様に再帰的に構成要素をたどっていく.
5548 \item[\textit{id\_pbox}] 「既に処理された」ノードのリストであり,これらのノードが二度処理を受けないために
5549 まとめて1つのクラスタとして取り扱うだけである.
5550 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出する,
5551 \item[\textit{id\_disc}] discretionary break (\verb+\discretionary{pre}{post}{nobreak}+).\\
5552 \textit{id\_hlist}と同じ方法で$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$を算出するが,
5553 第3引数の \texttt{nobreak}(行分割が行われない時の内容)を使う.言い換えれば,ここで行分割が発生した時の状況は
5555 \item[\textit{id\_box\_like}] \textit{id\_hlist}とならないboxや,rule.\\
5556 この場合は,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$のデータは利用されないので,2つの算出は無意味である.
5557 敢えて明示するならば,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$は共にnil値である.
5558 \item[他] 以上にない\textit{id}に対しても,$\mathit{Np}.\mathit{head}$, $\mathit{Np}.\mathit{tail}$の算出は無意味.
5561 \paragraph{クラスタの別の分類}
5562 さらに,JFMグルー挿入処理の実際の説明により便利なように,\textit{id}とは別のクラスタの分類を行っておく.
5563 挿入処理では2つの隣り合ったクラスタの間に
5564 空白等の実際の挿入を行うことは前に書いたが,ここでの説明では,問題にしているクラスタ\textit{Np}は「後ろ側」のクラスタである
5565 とする.「前側」のクラスタについては,以下の説明で\textit{head}が\textit{last}に置き換わることに注意すること.
5567 \item[和文A] リスト中に直接出現している和文文字.
5568 \textit{id}が\textit{id\_jglyph}であるか,\\
5569 \textit{id}が\textit{id\_pbox}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5571 \item[和文B] リスト中の水平ボックスの中身の先頭として出現した和文文字.和文Aとの違いは,これの前に
5572 JFMグルーの挿入が行われない(\Param{\hyperlink{fld:xks}{xkanjiskip}},~\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}は入り得る)ことである.\\
5573 \textit{id}が\textit{id\_hlist}か\textit{id\_disc}であって$\mathit{Np}.\mathit{head}$が\textbf{JAchar}であるとき.
5575 \item[欧文] リスト中に直接/水平ボックスの中身として出現している欧文文字.次の3つの場合が該当:
5577 \item \textit{id}が\textit{id\_glyph}である.
5578 \item \textit{id}が\textit{id\_math}である.
5579 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textbf{ALchar}.
5581 \item[箱] box,またはそれに類似するもの.次の2つが該当:
5583 \item \textit{id}が\textit{id\_pbox}か\textit{id\_hlist}か\textit{id\_disc}であって,$\mathit{Np}.\mathit{head}$が\textit{glyph\_node}でない.
5584 \item \textit{id}が\textit{id\_box\_like}である.
5589 \subsection{段落/水平ボックスの先頭や末尾}
5591 まず,段落/水平ボックスの一番最初にあるクラスタ\textit{Np}を探索する.
5592 水平ボックスの場合は何の問題もないが,段落の場合では以下のノード達を事前に読み飛ばしておく:
5594 \item \verb+\parindent+ 由来の水平ボックス($\mathit{subtype}=3$)
5595 \item \textit{subtype}が44~(\textit{user\_defined})でないようなwhatsit
5597 これは,\verb+\parindent+由来の水平ボックスがクラスタを構成しないようにするためである.
5599 次に,\textit{Np}の直前に空白$g$を必要なら挿入する:
5601 \item この処理が働くような\textit{Np}は\textsf{和文A}である.
5602 \item 問題のリストが字下げありの段落(\verb+\parindent+ 由来の水平ボックスあり)の場合は,
5603 この空白$g$は「文字コード \texttt{'parbdd'} の文字」と\textit{Np}の間に入るグルー/カーンである.
5604 \item そうでないとき(\verb+noindent+ で開始された段落や水平ボックス)は,
5605 $g$は「文字コード \texttt{'boxbdd'} の文字」と\textit{Np}の間に入るグルー/カーンである.
5607 ただし,もし$g$がglueであった場合,この挿入によって\textit{Np}による行分割が新たに可能になるべきではない.
5608 そこで,以下の場合には,$g$の直前に \verb+\penalty10000+ を挿入する:
5610 \item 問題にしているリストが段落であり,かつ
5611 \item \textit{Np}の前には予めペナルティがなく,$g$はglue.
5615 末尾の処理は,問題のリストが段落のものか水平ボックスのものかによって異なる.
5616 後者の場合は容易い:最後のクラスタを\textit{Nq}とおくと,\textit{Nq}と「文字コード\
5617 \texttt{'boxbdd'} の文字」の間に入るグルー/カーンを,
5618 \textit{Nq}の直後に挿入するのみである.
5620 一方.前者(段落)の場合は,リストの末尾は常に \verb+\penalty10000+ と,
5621 \verb+\parfillskip+ 由来のグルーが存在する.%よって,最後のクラスタ\textit{Np}は
5622 %この \verb+\parfillskip+ 由来のグルーとなり,実質的な中身の最後はその1つ前のクラスタ\textit{Nq}となる.
5623 段落の最後の「通常の和文文字${}+{}$句点」が独立した行となるのを防ぐために,
5624 \Param{jcharwidowpenalty}の値の分だけ適切な場所のペナルティを増やす.
5626 ペナルティ量を増やす場所は,\textit{head}が\textbf{JAchar}であり,
5627 かつその文字の\Param{kcatcode}が偶数であるような
5628 最後のクラスタの直前にあるものたちである%
5629 \footnote{大雑把に言えば,\Param{kcatcode}が奇数であるような\textbf{JAchar}%
5631 \Param{kcatcode}の最下位ビットはこの\Param{jcharwidowpenalty}用にのみ利用される.}.
5633 \subsection{概観と典型例:2つの「和文A」の場合}
5634 \label{ssec-cluster-wa}
5635 先に述べたように,2つの隣り合ったクラスタ,\textit{Nq}と\textit{Np}の間には,
5636 ペナルティ,\verb+\vadjust+,whatsitなど,行組版には関係しないものがある.模式的に表すと,
5638 \Node{cluster}{\textit{Nq}}\longrightarrow
5640 \Node{penalty}{$p$}\longrightarrow \cdots\longrightarrow \Node{whatsit}{}}^{\textrm{(a)}}
5641 \longrightarrow \Node{cluster}{\textit{Np}}
5643 のようになっている.間の(a)に相当する部分には,何のノードもない場合ももちろんあり得る.
5644 そうして,JFMグルー挿入後には,この2クラスタ間は次のようになる:
5646 \Node{cluster}{\textit{Nq}}\longrightarrow%\Node{kern}{左空白}\longrightarrow
5648 \Node{penalty}{$p+x$}\longrightarrow \cdots\longrightarrow
5649 \Node{whatsit}{}}^{\textrm{(a)}}\longrightarrow
5650 \Node{glue or kern}{\raisebox{-.2\zw}{右空白}}\longrightarrow
5651 \Node{cluster}{\textit{Np}}
5654 以後,\emph{典型的な例として,クラスタ\textit{Nq}と\textit{Np}が共に\textsf{\textmd{和文A}}である場合を見ていこう,}
5657 \paragraph{「右空白」の算出}
5658 まず,「右空白」にあたる量を算出する.通常はこれが,隣り合った2つの和文文字間に入る空白量となる.
5660 \item[JFM由来{[M]}] JFMの文字クラス指定によって入る空白を以下によって求める.この段階で空白量が未定義(未指定)だった場合,
5661 デフォルト値\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなるので,次へ.
5663 \item もし両クラスタの間で \verb+\inhibitglue+ が実行されていた場合(証としてwhatsitノードが自動挿入される),
5664 代わりに\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}が挿入されることとなる.次へ.
5665 \item \textit{Nq}と\textit{Np}が同じJFM・同じ\texttt{jfmvar}キー・同じサイズの和文フォントであったならば,
5666 共通に使っているJFM内で挿入される空白(グルーかカーン)が決まっているか調べ,決まっていればそれを採用.
5667 \item 1.でも2.でもない場合は,JFM・\texttt{jfmvar}・サイズの3つ組は\textit{Nq}と\textit{Np}で異なる.
5670 \vcenter{\halign{\hfil$#:={}$&\inhibitglue#\inhibitglue\cr
5671 gb&(\textit{Nq}と「使用フォントが\textit{Nq}のそれと同じで,\hfil\cr
5672 \omit&\quad 文字コードが\textit{Np}のそれの文字」との間に入るグルー/カーン)\hfil\cr
5673 ga&(\inhibitglue 「使用フォントが\textit{Np}のそれと同じで,\hfil\cr
5674 \omit&\quad 文字コードが\textit{Nq}のそれの文字」と\textit{Np}との間に入るグルー/カーン)\hfil\cr
5677 として,前側の文字のJFMを使った時の空白(グルー/カーン)と,後側の文字のJFMを使った時のそれを求める.
5679 $\mathit{gb}$,~$\mathit{ga}$それぞれに対する<ratio>の値を$d_b$,~$d_a$とする.
5682 $\mathit{ga}$と$\mathit{gb}$の両方が未定義であるならば,JFM由来のグルーは挿入されず,
5683 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を採用することとなる.
5684 どちらか片方のみが未定義であるならば,次のステップでその未定義の方は長さ0のkernで,<ratio>の値は0であるかのように扱われる.
5686 \Param{\hyperlink{fld:diffjfm}{diffrentjfm}}の値が \texttt{pleft}, \texttt{pright},
5687 \texttt{paverage} のとき,
5688 <ratio>の指定に従って比例配分を行う.
5689 JFM由来のグルー/カーンは以下の値となる:
5691 f\left(\frac{1-d_b}2\textit{gb} + \frac{1+d_b}2\textit{ga},
5692 \frac{1-d_a}2\textit{gb} + \frac{1+d_a}2\textit{ga}\right)
5696 f(x,y)=\begin{cases}
5697 x&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pleft};\\
5698 y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{pright};\\
5699 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{paverage};
5703 \Param{differentjfm}がそれ以外の値の時は,<ratio>の値は無視され,JFM由来のグルー/カーンは以下の値となる:
5705 f(\textit{gb},\textit{ga})
5709 f(x,y)=\begin{cases}
5710 \min(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{small};\\
5711 \max(x,y)&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{large};\\
5712 (x+y)/2&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{average};\\
5713 x+y&\text{if\ }\Param{\hyperlink{fld:diffjfm}{diffrentjfm}}=\texttt{both};
5721 \jfont\foo=psft:Ryumin-Light:jfm=ujis
5722 \jfont\bar=psft:GothicBBB-Medium:jfm=ujis
5723 \jfont\baz=psft:GothicBBB-Medium:jfm=ujis;jfmvar=piyo
5727 \overbrace{\Node{glyph}{{\tt\char`\\foo}, `あ'}}^{p}
5728 \longrightarrow \overbrace{\Node{glyph}{{\tt\char`\\bar}, `い'}}^{q}
5729 \longrightarrow \overbrace{\Node{glyph}{{\tt\char`\\baz}, `う'}}^{r}
5731 という3ノードを考える(それぞれ単独でクラスタをなす).
5732 この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず2.の状況となる一方で,
5733 $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar} キーの内容が異なるので3.の状況となる.
5734 \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合,
5735 以下で定めた量「右空白」として採用する.
5736 この段階においては,\verb+\inhibitglue+ は効力を持たないため,
5737 結果として,2つの和文文字間には常に何らかのグルー/カーンが挿入されることとなる.
5739 \item 両クラスタ(厳密には$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$)の中身の文字コードに対する
5740 \Param{autospacing}パラメタが両方ともfalseだった場合は,長さ0のglueとする.
5741 \item ユーザ側から見た\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの自然長が${\tt \char`\\maxdimen}=(2^{30}-1)\,{\rm sp}$で
5742 なければ,\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}パラメタの値を持つglueを採用する.
5743 \item 2.でない場合は,\textit{Nq}, \textit{Np}で使われているJFMに指定されている\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}の値を用いる.
5744 どちらか片方のクラスタだけが和文文字(\textsf{和文A}・\textsf{和文B})のときは,そちらのクラスタで使われている
5745 JFM由来の値だけを用いる.もし両者で使われているJFMが異なった場合は,上の[M]~3.と同様の方法を用いて調整する.
5748 %\paragraph{「左空白」の算出とそれに伴う補正}
5749 %「左空白」は過去のバージョンでは定義していたが,このバージョンでは
5750 %挿入は一切行われない(機能自体削除している).
5751 %しかし,仕様は流動的であり,将来復活する可能性もあるため,マニュアル中の記述は今のところ極力変更しない.
5752 \paragraph{禁則用ペナルティの挿入}
5755 a:=(\text{\textit{Nq}{\footnotemark}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値})
5756 +(\text{\textit{Np}{\footnotemark}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値})
5758 とおく\footnotetext{厳密にはそれぞれ$\mathit{Nq}.\mathit{tail}$,$\mathit{Np}.\mathit{head}$.}.
5759 ペナルティは通常$[-10000,10000]$の整数値をとり,また$\pm 10000$は正負の無限大を意味することになっているが,この$a$の
5762 $a$は禁則処理用に\textit{Nq}と\textit{Np}の間に加えられるべきペナルティ量である.
5764 \item[P-normal~{[PN]}]
5765 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティ(\textit{penalty\_node})があれば処理は簡単である:
5766 それらの各ノードにおいて,ペナルティ値を($\pm 10000$を無限大として扱いつつ)$a$だけ増加させればよい.
5767 また,$10000 + (-10000) = 0$としている.
5769 少々困るのは,(a)部分にペナルティが存在していない場合である.
5770 直感的に,補正すべき量$a$が0でないとき,その値をもつ\textit{penalty\_node}を作って
5771 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入……
5772 ということになるが,実際には僅かにこれより複雑である.
5774 \item 「右空白」がカーンであるとき,
5775 それは「\textit{Nq}と\textit{Np}の間で改行は許されない」ことを意図している.そのため,
5776 この場合は$a\neq 0$であってもペナルティの挿入はしない.
5777 \item そうでないないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
5778 %\item 「左空白」がカーンとしてきっちり定義されている時(このとき,「右空白」はカーンでない),
5779 %この「左空白」の直後での行分割を許容しないといけないので,$a=0$であっても
5780 %\textit{penalty\_node}を作って挿入する.
5781 %\item 以上のどれでもないときは,$a\neq 0$ならば\textit{penalty\_node}を作って挿入する.
5785 \def\gkf#1#2#3{\sf$\displaystyle\vphantom{\Bigg(}%
5786 \frac{\hbox to 4\zw{\hss#2\hss}}{\hbox{#3}}$}
5788 %<en>\caption{Summary of JFM glues}
5789 %<ja>\caption{JFM グルーの概要}
5793 \begin{tabular}{c|cccccc}
5795 {\bf\textit{Np}}↓&\sf 和文A&\sf 和文B&\sf 欧文&\sf 箱&\sf glue&\sf kern\\\midrule
5798 \gkf{---}{\OA →K}{PN}&
5799 \gkf{---}{\OA →X}{PN}&
5802 \gkf{---}{\OA}{PS}\\
5808 \gkf{E}{\OB →X}{PA}&
5810 \sf 箱&\gkf{E}{\OB}{PA}\\
5811 \sf glue&\gkf{E}{\OB}{PN}\\
5812 \sf kern&\gkf{E}{\OB}{PS}\\
5818 In the table above, {\small\gkf{E}{M→K}{PN}} means that
5821 上の表において,{\small\gkf{E}{M→K}{PN}}は次の意味である:
5825 \item To determine the ``right-space'', \LuaTeX-ja first attempts by the method ``\textsf{JFM-origin~[M]}''.
5826 If this attempt fails, \LuaTeX-ja use the method ``\textsf{\Param{kanjiskip}~[K]}''.
5829 \item 「右空白」を決めるために,\LuaTeX-ja はまず「JFM由来{[M]}」の方法を試みる.
5830 これが失敗したら,\LuaTeX-ja は「\Param{kanjiskip}~{[K]}」の方法を試みる.
5834 % \item The ``left space'' between \textit{Nq}~and~\textit{Np} is
5835 % determined by the method ``\textsf{line-end~[E]}''.
5838 % \item \textit{Nq} と \textit{Np} の間の「左空白」は「\textsf{line-end~[E]}」の
5843 \item \LuaTeX-ja adopts the method ``\textsf{P-normal~[PN]}'' to adjust the penalty
5844 between two clusters for \emph{kinsoku shori}.
5847 \item \LuaTeX-jaは2つのクラスタの間の禁則処理用のペナルティを調節するために「\textsf{P-normal~[PN]}」の方法を採用する.
5854 本節の内容は表\ref{tab-jfmglue}にまとめてある.
5856 \paragraph{和文Aと欧文の間}
5857 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{欧文}の場合,JFMグルー挿入処理は次のようにして行われる.
5859 \item 「右空白」については,まず以下に述べる\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5860 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
5861 %\item 「左空白」については,既に述べた\textsf{line-end~[E]}をそのまま採用する.それに伴う「右空白」の補正も%同じ.
5862 \item 禁則用ペナルティも,以前述べた\textsf{P-normal~[PN]}と同じである.
5865 \item[Boundary-B~{[\OB]}] 和文文字と「和文でないもの」との間に入る空白を以下によって求め,
5866 未定義でなければそれを「右空白」として採用する.
5867 \textsf{JFM-origin~[M]}の変種と考えて良い.
5868 これによって定まる空白の典型例は,和文の閉じ括弧と欧文文字の間に入る半角アキである.
5870 \item もし両クラスタの間で \verb+\inhibitglue+ が実行されていた場合%
5871 (証としてwhatsitノードが自動挿入される),「右空白」は未定義.
5873 \textit{Nq}と「文字コードが {\tt'jcharbdd'} の文字」との間に入るグルー/カーンとして定まる.
5875 \item[\Param{xkanjiskip}~{[X]}]
5876 この段階では,\textsf{\Param{kanjiskip}~[K]}のときと同じように,
5877 以下で定めた量を「右空白」として採用する.
5878 \verb+\inhibitglue+ は効力を持たない.
5880 \item 以下のいずれかの場合は,\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入は抑止される.しかし,実際には行分割を許容するために,長さ0のglueを採用する:
5882 \item 両クラスタにおいて,それらの中身の文字コードに対する\Param{autoxspacing}パラメタが共にfalseである.
5883 \item \textit{Nq}の中身の文字コードについて,「直後への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5884 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが2以上).
5885 \item \textit{Np}の中身の文字コードについて,「直前への\Param{\hyperlink{fld:xks}{xkanjiskip}}の挿入」が禁止されている
5886 (つまり,\Param{jaxspmode}~(or \Param{alxspmode})パラメタが偶数).
5888 \item ユーザ側から見た\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの自然長が${\tt \char`\\maxdimen}=(2^{30}-1)\,{\rm sp}$で
5889 なければ,\Param{\hyperlink{fld:xks}{xkanjiskip}}パラメタの値を持つglueを採用する.
5890 \item 2.でない場合は,\textit{Nq}, \textit{Np}(\textsf{和文A}/\textsf{和文B}なのは片方だけ)
5891 で使われているJFMに指定されている\Param{\hyperlink{fld:xks}{xkanjiskip}}の値を用いる.
5895 \paragraph{欧文と和文Aの間}
5896 \textit{Nq}が\textsf{欧文}で,\textit{Np}が\textsf{和文A}の場合,JFMグルー挿入処理は上の場合とほぼ同じである.
5897 \textsf{和文A}のクラスタが逆になるので,\textsf{Boundary-A~[\OA]}の部分が変わるだけ.
5899 \item 「右空白」については,まず以下に述べる\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
5900 それが失敗した場合は,\textsf{\Param{\hyperlink{fld:xks}{xkanjiskip}}~[X]}によって定める.
5901 %\item \textit{Nq}が和文でないので,「左空白」は算出されない.
5902 \item 禁則用ペナルティは,以前述べた\textsf{P-normal~[PN]}と同じである.
5905 \item[Boundary-A~{[\OA]}] 「和文でないもの」と和文文字との間に入る空白を以下によって求め,
5906 未定義でなければそれを「右空白」として採用する.
5907 \textsf{JFM-origin~[M]}の変種と考えて良い.
5908 これによって定まる空白の典型例は,欧文文字と和文の開き括弧との間に入る半角アキである.
5910 \item もし両クラスタの間で \verb+\inhibitglue+ が実行されていた場合(証としてwhatsitノードが自動挿入される),次へ.
5912 「文字コードが {\tt'jcharbdd'} の文字」と\textit{Np}との間に入るグルー/カーンとして定まる.
5916 \paragraph{和文Aと箱・グルー・カーンの間}
5917 \textit{Nq}が\textsf{和文A}で,\textit{Np}が\textsf{箱}・グルー・カーンのいずれかであった場合,
5918 両者の間に挿入されるJFMグルーについては同じ処理である.しかし,そこでの行分割に対する仕様が異なるので,
5919 ペナルティの挿入処理は若干異なったものとなっている.
5922 \item 「右空白」については,既に述べた\textsf{Boundary-B~[\OB]}により空白を決定しようと試みる.
5923 それが失敗した場合は,「右空白」は挿入されない.
5924 %\item 「左空白」については,既に述べた\textsf{line-end~[E]}の算出方法をそのまま採用する.それに伴う「右空白」の補正も同じ.
5925 \item 禁則用ペナルティの処理は,後ろのクラスタ\textit{Np}の種類によって異なる.
5926 なお,$\mathit{Np}.\mathit{head}$は無意味であるから,
5927 「$\mathit{Np}.\mathit{head}$に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値」は0とみなされる.言い換えれば,
5929 a:=(\text{\textit{Nq}の文字に対する\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値}).
5932 \item[箱] \textit{Np}が\textsf{箱}であった場合は,両クラスタの間での行分割は
5933 (明示的に両クラスタの間に \verb+\penalty10000+ があった場合を除き)いつも許容される.そのため,
5934 ペナルティ処理は,後に述べる\textsf{P-allow~[PA]}が\textsf{P-normal~[PN]}の代わりに用いられる.
5935 \item[グルー] \textit{Np}がグルーの場合,ペナルティ処理は\textsf{P-normal~[PN]}を用いる.
5936 \item[カーン] \textit{Np}がカーンであった場合は,両クラスタの間での行分割は
5937 (明示的に両クラスタの間にペナルティがあった場合を除き)許容されない.
5938 ペナルティ処理は,後に述べる\textsf{P-suppress~[PS]}を使う.
5940 これらの\textsf{P-normal~[PN]},\textsf{P-allow~[PA]},\textsf{P-suppress~[PS]}の違いは,
5941 \textit{Nq}と\textit{Np}の間(以前の図だと(a)の部分)にペナルティが存在しない場合にのみ存在する.
5945 \item[P-allow~{[PA]}]
5946 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
5947 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
5949 (a)部分にペナルティが存在していない場合,
5950 \LuaTeX-ja は\textit{Nq}と\textit{Np}の間の行分割を可能にしようとする.
5951 そのために,以下の場合に$a$をもつ\textit{penalty\_node}を作って
5952 「右空白」の(もし未定義なら\textit{Np}の)直前に挿入する:
5954 \item 「右空白」がグルーでない(カーンか未定義)であるとき.
5955 %\item 「左空白」がカーンとしてきっちり定義されている時.
5958 \item[P-suppress~{[PS]}]
5959 \textit{Nq}と\textit{Np}の間の(a)部分にペナルティがあれば,\textsf{P-normal~[PN]}と同様に,
5960 それらの各ノードにおいてペナルティ値を$a$だけ増加させる.
5962 (a)部分にペナルティが存在していない場合,
5963 \textit{Nq}と\textit{Np}の間の行分割は元々不可能のはずだったのであるが,
5964 \LuaTeX-ja はそれをわざわざ行分割可能にはしない.
5965 そのため,「右空白」がglueであれば,その直前に \verb+\penalty10000+ を挿入する.
5968 なお,「右空白」はカーンの%,「左空白」は未定義の
5970 \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5973 このとき,$a$,即ち「あ」の\Param{\hyperlink{fld:postbp}{postbreakpenalty}}がいかなる値であっても,
5976 \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
5977 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5980 となり,$a$分のペナルティは挿入されないことに注意して欲しい.
5981 \Param{\hyperlink{fld:postbp}{postbreakpenalty}}は($a$は)殆どの場合が非負の値と考えられ,そのような場合では
5984 \overbrace{\Node{glyph}{`あ'}}^{\mathit{Nq}}\longrightarrow
5985 \Node{penalty}{$a$}\longrightarrow
5986 \Node{kern}{右空白}\longrightarrow \overbrace{\Node{glue}{1\,pt}}^{\mathit{Np}}
5989 \footnote{kern$\rightarrow$glueが1つの行分割可能点(行分割に伴うペナルティは0)
5990 であるため,たとえ$a=10000$であっても,\textit{Nq}と\textit{Np}の間で行分割を禁止することはできない.}.
5992 \paragraph{箱・グルー・カーンと和文Aの間}
5993 \textit{Np}が\textsf{箱}・グルー・カーンのいずれかで,\textit{Np}が\textsf{和文A}であった場合は,
5994 すぐ上の(\textit{Nq}と\textit{Np}の順序が逆になっている)場合と同じである.
5995 %が,「左空白」がなくなることにのみ注意.
5997 \item 「右空白」については,既に述べた\textsf{Boundary-A~[\OA]}により空白を決定しようと試みる.
5998 それが失敗した場合は,「右空白」は挿入されない.
5999 %\item \textit{Nq}が和文でないので,「左空白」は算出されない.
6000 \item 禁則用ペナルティの処理は,\textit{Nq}の種類によって異なる.
6001 $\mathit{Nq}.\mathit{tail}$は無意味なので,
6003 a:=(\text{\textit{Np}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}}の値}).
6006 \item[箱] \textit{Nq}が\textsf{箱}の場合は,\textsf{P-allow~[PA]}を用いる.
6007 \item[グルー] \textit{Nq}がグルーの場合は,\textsf{P-normal~[PN]}を用いる.
6008 \item[カーン] \textit{Nq}がカーンの場合は,\textsf{P-suppress~[PS]}を用いる.
6012 \paragraph{和文Aと和文Bの違い}
6013 先に述べたように,\textsf{和文B}は水平ボックスの中身の先頭(or 末尾)として出現している
6014 和文文字である.リスト内に直接ノードとして現れている和文文字(\textsf{和文A})との違いは,
6016 \item \textsf{和文B}に対しては,JFMの文字クラス指定から定まる空白
6017 \textsf{JFM-origin~[M]},\textsf{Boundary-A~[\OA]},\textsf{Boundary-B~[\OB]})の挿入は行われない.
6021 \item 片方が\textsf{和文A},もう片方が\textsf{和文B}のクラスタの場合,
6022 \textsf{Boundary-A~[\OA]}または\textsf{Boundary-B~[\OB]}の挿入を試み,それがダメなら
6023 \Param{kanjiskip}~\textsf{[K]}の挿入を行う.
6024 \item \textsf{和文B}の2つのクラスタの間には,\Param{kanjiskip}~\textsf{[K]}が自動的に入る.
6026 \item \textsf{和文B}と箱・グルー・カーンが隣接したとき(どちらが前かは関係ない),間にJFMグルー・ペナルティの挿入は一切しない.
6027 \item \textsf{和文B}と\textsf{和文B},また\textsf{和文B}と\textsf{欧文}とが隣接した時は,禁則用ペナルティ挿入処理は
6028 \textsf{P-suppress~[PS]}が用いられる.
6029 \item \textsf{和文B}の文字に対する\Param{\hyperlink{fld:prebp}{prebreakpenalty}},~\Param{\hyperlink{fld:postbp}{postbreakpenalty}}の値は使われず,0として計算される.
6040 \item 1行目の\verb+\inhibitglue+は\textsf{Boundary-B~[\OB]}の処理のみを抑止するので,ピリオドと「A」の間には
6041 \Param{\hyperlink{fld:xks}{xkanjiskip}}(四分アキ)が入ることに注意.
6042 \item 2行目のピリオドと「A」の間においては,前者が\textsf{和文B}となる(水平ボックスの中身の末尾として登場しているから)ので,
6043 そもそも\textsf{Boundary-B~[\OB]}の処理は行われない.よって,\Param{\hyperlink{fld:xks}{xkanjiskip}}が入ることとなる.
6044 \item 3行目では,ピリオドの属するクラスタは\textsf{和文A}である.これによって,
6045 ピリオドと「A」の間には\textsf{Boundary-B~[\OB]}由来の半角アキが入ることになる.
6049 %<en>\section{Patch for the \Pkg{listings} Package}
6050 %<ja>\section{\Pkg{listings} パッケージへの対応}
6053 It is well-known that the \Pkg{listings} package outputs weird results
6055 The \Pkg{listings} package makes most of letters active and assigns
6056 output command for each letter~(\cite{listings}).
6057 But Japanese characters are not included in these activated letters.
6058 For \pTeX{} series, there is no method to make Japanese characters active;
6059 a patch \Pkg{jlisting.sty}~(\cite{jlisting}) resolves the problem forcibly.
6062 \Pkg{listings} パッケージが,そのままでは日本語をまともに出力できないこと
6063 はよく知られている.きちんと整形して出力するために,\Pkg{listings}パッケー
6064 ジは内部で「ほとんどの文字」をアクティブにし,各文字に対してその文字の出
6065 力命令を割り当てている(\cite{listings}).
6066 しかし,そこでアクティブにする文字の中に,和文文
6067 字がないためである.\pTeX 系列では,和文文字をアクティブにする手法がなく,
6068 \Pkg{jlisting.sty} というパッチ(\cite{jlisting})を用いることで無理やり解決していた.
6072 In \LuaTeX-ja, the problem is resolved by using the \verb+process_input_buffer+ callback.
6073 The callback function inserts the output command (active character \texttt{U+FFFFF})
6074 before each letter above \texttt{U+0080}.
6075 This method can omits the process to make all Japanese characters active
6076 (most of the activated characters are not used in many cases).
6079 \LuaTeX-jaでは,\verb+process_input_buffer+ コールバックを利用することで,
6080 「各行に出現する\texttt{U+0080}以降の文字に対して,それらの出力命令を前置する」
6081 という方法をとっている.出力命令としては,アクティブ文字化した \texttt{U+FFFFF} を用いている.
6082 これにより,(入力には使用されていないかもしれない)和文文字をもすべてアクティブ化する手間もなく,
6088 If the \Pkg{listings} package and \LuaTeX-ja were loaded,
6089 then the patch \Pkg{lltjp-listings} is loaded automatically at \verb+\begin{document}+.
6092 \LuaTeX-ja で利用される \Pkg{listings} パッケージへのパッチ \Pkg{lltjp-listings} は,
6093 \Pkg{listings} と\LuaTeX-jaを読み込んでおけば,
6094 \verb+\begin{document}+ の箇所において自動的に読み込まれるので,通常はあまり
6098 %<en>\subsection{Notes}
6099 %<ja>\subsection{注意}
6101 \paragraph{Escaping to \LaTeX}
6102 We used the \verb+process_input_buffer+ callback to output \textbf{JAchar}s.
6103 But it has a drawback; any commands whose name contains a \textbf{JAchar}
6104 cannot be used in any ``escape to \LaTeX''.
6106 Consider the following input:
6109 \paragraph{\LaTeX へのエスケープ}
6110 日本語対応を行うために \verb+process_input_buffer+ を使用したことで,
6111 \texttt{texcl},~\texttt{escapeinside}といった\emph{「\LaTeX へのエスケープ」中では,
6112 \textbf{JAchar}を名称の一部に含む制御綴は使用不可能}である.
6116 \begin{lstlisting}[escapechar=`\#]
6120 %<en>The line~2 is transformed by the callback to
6121 %<ja>ここで,2行目は \verb+process_input_buffer+ の作用により,
6122 \begin{lstlisting}[showspaces, escapechar=\!]
6123 #\!\IVSA FFFFF!ほ!\IVSA FFFFF !げ x!\IVSA FFFFF !ぴ!\IVSA FFFFF !よ#
6126 before the line is actually processed.
6127 In the escape (between the character ``\verb+#+''),
6128 the category code of \texttt{U+FFFFF} is set to 9~(\emph{ignored}).
6129 Hence the control symbol ``\verb+\+\IVSA FFFFF'' will be executed,
6130 instead of ``\verb+\ほげ+''.
6133 と変換されてから,実際の処理に回される.
6134 「\verb+#+」で挟まれた「\LaTeX へのエスケープ」中では\
6135 \texttt{U+FFFFF} のカテゴリーコードは9~(\textit{ignored})となるので,
6137 「\verb+\+\IVSA FFFFF」というcontrol symbolが実行されることになる.
6141 \paragraph{異体字セレクタの扱い}
6142 \texttt{lstlisting} 環境などの内部にある異体字セレクタを扱うため,
6143 \Pkg{lltjp-listings} では \texttt{vsraw} と \texttt{vscmd} という2つのキーを追加した.
6144 しかし,\Pkg{lltjp-listings} が実際にロードされるのは \verb+\begin{document}+\
6145 のところであるので,プリアンブル内ではこれらの追加キーは使用できない.
6147 \texttt{ivsraw}は,ブール値の値をとるキーであり,標準ではfalseである.
6149 \item trueの場合は,異体字セレクタは「直前の文字に続けて」出力される.
6150 もしもIVSサポート(\ref{ssec-ltjotf}節)が有効になっていた場合は,
6151 以下の例(左側は入力,右側はその出力)のようになる.
6153 \begin{lstlisting}[vsraw=true]
6157 \item falseの場合は,異体字セレクタは適当な命令によって「見える形で」出力される.
6158 どのような形で出力されるかを規定するのが \texttt{vscmd} キーであり,
6159 \Pkg{lltjp-listings} の標準設定では以下の例の右側のように出力される.
6161 \begin{lstlisting}[vsraw=false,
6162 vscmd=\ltjlistingsvsstdcmd]
6166 ちなみに,本ドキュメントでは次のようにしている:
6167 \begin{lstlisting}[numbers=left]
6168 \def\IVSA#1#2#3#4#5{%
6169 \textcolor{blue}{\raisebox{3.5pt}{\tt%
6170 \fboxsep=0.5pt\fbox{\tiny \oalign{0#1#2\crcr#3#4#5\crcr}}}}%
6173 \gdef\IVSB#1{\expandafter\IVSA\directlua{
6174 local cat_str = luatexbase.catcodetables['string']
6175 tex.sprint(cat_str, string.format('%X', 0xE00EF+#1))
6177 \lstset{vscmd=\IVSB}
6182 %<en>\subsection{Class of Characters}
6183 %<ja>\subsection{文字種}
6185 %<en>Roughly speaking, the \Pkg{listings} package processes input as follows:
6186 %<ja>\Pkg{listings} パッケージの内部では,大雑把に言うと
6188 %<en>\item Collects \textit{letters} and \textit{digits}, which can be used for the name of identifiers.
6189 %<ja>\item 識別子として使える文字 (``letter'',~``digit'') たちを集める.
6190 %<en>\item When reading an \textit{other}, outputs the collected character string (with modification, if needed).
6191 %<ja>\item letterでもdigitでもない文字が現れた時に,収集した文字列を(必要なら修飾して)出力する.
6192 %<en>\item Collects \textit{others}.
6193 %<ja>\item 今度は逆に,letterでない文字たちをletterが現れるまで集める.
6194 %<en>\item When reading a \textit{letter} or a \textit{digit}, outputs the collected character string.
6195 %<ja>\item letterが出現したら集めた文字列を出力する.
6196 %<en>\item Turns back to 1.
6200 By the above process, line breaks inside of an identifier are blocked.
6201 A flag \verb+\lst@ifletter+ indicates whether the previous character can be used
6202 for the name of identifiers or not.
6205 という処理が行われている.これにより,識別子の途中では行分割が行われないようになっている.
6206 直前の文字が識別子として使えるか否かは \verb+\lst@ifletter+ というフラグに格納されている.
6210 For Japanese characters, line breaks are permitted on both sides
6211 except for brackets, dashes, etc.
6212 Hence the patch \Pkg{lltjp-listings} introduces
6213 a new flag \verb+\lst@ifkanji+, which indicates
6214 whether the previous character is a Japanese character or not.
6215 For illustration, we introduce following classes of characters:
6218 さて,日本語の処理である.殆どの和文文字の前後では行分割が可能であるが,その一方で
6219 括弧類や音引きなどでは禁則処理が必要なことから,\Pkg{lltjp-listings} では,
6220 直前が和文文字であるかを示すフラグ \verb+\lst@ifkanji+ を新たに導入した.
6221 以降,説明のために以下のように文字を分類する:
6225 \begin{tabular}{lccccc}
6227 &Letter&Other&Kanji&Open&Close\\\midrule
6228 \verb+\lst@ifletter+&T&F&T&F&T\\
6229 \verb+\lst@ifkanji+&F&F&T&T&F\\
6230 %<en>Meaning&char in an identifier&other alphabet&%
6231 %<en>most of Japanese char&opening brackets&closing brackets\\
6232 %<ja>意図&識別子中の文字&その他欧文文字&殆どの和文文字&開き括弧類&閉じ括弧類\\
6237 Note that \textit{digits} in the \Pkg{listings} package can be Letter or
6238 Other according to circumstances.
6241 なお,本来の\Pkg{listings} パッケージでの分類``digit''は,
6242 出現状況によって,上の表のLetterとOtherのどちらにもなりうる.
6243 また,KanjiとCloseは \verb+\lst@ifletter+ と \verb+\lst@ifkanji+ の値が一致しているが,
6248 For example, let us consider the case an Open comes after a Letter.
6249 Since an Open represents Japanese open brackets,
6250 it is preferred to be permitted to insert line break after the Letter.
6251 Therefore, the collected character string is output in this case.
6254 例えば,Letterの直後にOpenが来た場合を考える.
6255 文字種Openは和文開き括弧類を想定しているので,Letterの直後では行分割が可能であることが望ましい.
6256 そのため,この場合では,すでに収集されている文字列を出力することで行分割を許容するようにした.
6260 The following table summarizes $5\times 5=25$ cases:
6263 同じように,$5\times 5=25$通り全てについて書くと,次のようになる:
6267 \begin{tabular}{llccccc}
6270 &&\multicolumn{4}{c}{Next}\\\cmidrule(lr){3-7}
6271 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6272 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6273 &Letter&collects&\multicolumn{3}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6274 &Other&outputs&collects&\multicolumn{2}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6275 Prev&Kanji&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6276 &Open&\multicolumn{5}{c}{\hrulefill \ collects\ \hrulefill}\\
6277 &Close&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
6280 &&\multicolumn{4}{c}{後ろ側の文字}\\\cmidrule(lr){3-7}
6281 &&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
6282 &\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
6283 直&Letter&収集&\multicolumn{3}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6284 前&Other&出力&収集&\multicolumn{2}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6285 文&Kanji&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6286 字&Open&\multicolumn{5}{c}{\hrulefill \ 収集\ \hrulefill}\\
6287 種&Close&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
6292 %<en>In the above table,
6295 %<en>\item ``outputs'' means to output the collected character string (i.e., line breaking is permitted there).
6296 %<ja>\item 「出力」は,それまでに集めた文字列を出力(≒ここで行分割可能)を意味する.
6298 %<en>\item ``collects'' means to append the next character to the collected character string (i.e., line breaking is prohibited there).
6299 %<ja>\item 「収集」は,後側の文字を,現在収集された文字列に追加(行分割不可)を意味する.
6303 Charatcers above \texttt{U+0080} \emph{except Variation Selectors}
6304 are classified into above 5~classes by the following rules:
6307 \texttt{U+0080}以降の\emph{異体字セレクタ以外の}各文字が
6308 Letter, Other, Kanji, Open, Closeのどれに属するかは次によって決まる:
6311 %<en>\item \textbf{ALchar}s above \texttt{U+0080} are classified as Letter.
6312 %<ja>\item (\texttt{U+0080}以降の)\textbf{ALchar}は,すべてLetter扱いである.
6314 %<en>\item \textbf{JAchar}s are classified in the order as follows:
6315 %<ja>\item \textbf{JAchar}については,以下の順序に従って文字種を決める:
6317 %<en>\item Characters whose \Param{\hyperlink{fld:prebp}{prebreakpenalty}} is greater than or equal to 0 are classified as Open.
6318 %<ja>\item \Param{\hyperlink{fld:prebp}{prebreakpenalty}}が0以上の文字はOpen扱いである.
6320 %<en>\item Characters whose \Param{\hyperlink{fld:postbp}{postbreakpenalty}} is greater than or equal to 0 are classified as Close.
6321 %<ja>\item \Param{\hyperlink{fld:postbp}{postbreakpenalty}}が0以上の文字はClose扱いである.
6323 %<en>\item Characters that don't satisfy the above two conditions are classified as Kanji.
6324 %<ja>\item 上の3条件のどちらにも当てはまらなかった文字は,Kanji扱いである.
6329 The width of halfwidth kana (\texttt{U+FF61}--\texttt{U+FF9F})
6330 is same as the width of \textbf{ALchar};
6331 the width of the other \textbf{JAchar}s is double the width of \textbf{ALchar}.
6334 なお,半角カナ(U+FF61--U+FF9F)以外の\textbf{JAchar}は欧文文字2文字分の幅をとるものとみなされる.
6339 This classification process is executed every time a character appears in
6340 the \texttt{lstlisting} environment or other environments/commands.
6343 これらの文字種決定は,実際に \texttt{lstlisting} 環境などの内部で文字が出てくるたびに行われる.
6349 \Pkg{luatexja-adjust} で提供される優先順位付きの行長調整の詳細を述
6350 べる.大まかに述べると,次のようになる.
6352 \item 通常の\TeX の行分割方法に従って,段落を行分割する.この段階では,行
6353 長に半端が出た場合,その半端分は\textbf{JAglue}(\Param{\hyperlink{fld:xks}{xkanjiskip}},
6354 \Param{\hyperlink{fld:kanjiskip}{kanjiskip}},JFMグルー)と
6355 それ以外のグルーの全てで(優先順位なく)負担される.
6356 \item その後,\texttt{post\_linebreak\_filter} callbackを使い,\emph{段
6357 落中の各行ごとに},行末文字の位置を調整したり,優先度付きの行長調整
6358 を実現するためにグルーの伸縮度を調整する.
6359 その処理においては,グルーの自然長と\textbf{JAglue}以外の
6360 グルーの伸び量・縮み量は変更せず,必要に応じて\textbf{JAglue}の伸び量・縮み量のみを
6363 \Pkg{luatexja-adjust} の作用は,この処理を行うcallbackを追加するだけであり,
6364 この章の残りではcallbackでの処理について解説する.
6367 \paragraph{準備:合計伸縮量の計算}
6368 グルーの伸縮度(\texttt{plus} や \texttt{minus} で指定されている値)には,
6369 有限値の他に,\texttt{fi},\texttt{fil},\texttt{fill},\texttt{filll}と
6370 いう4つの無限大レベル(後ろの方ほど大きい)があり,行の調整に
6371 \texttt{fi} などの\emph{無限大レベルの伸縮度が用いられている場合は,そ
6374 よって,以降,問題にしている行の行長調整は伸縮度が有限長のグルーを用いて
6375 行われているとして良い.さらに,簡単のため,この行はグルーが広げられている
6376 (自然長で組むと望ましい行長よりの短い)場合しか扱わない.
6380 \item \textbf{JAglue}ではないグルー
6381 \item JFMグルー(優先度\footnote{%
6382 \ref{ssec-jfm-str}節にあるように,
6383 各JFMグルーには$-2$から2までの優先度がついている.}%
6385 \item 和欧文間空白(\Param{\hyperlink{fld:xks}{xkanjiskip}})
6386 \item 和文間空白(\Param{\hyperlink{fld:kanjiskip}{kanjiskip}})
6388 の$1+1+5+1=8$つに類別し,それぞれの種別ごとに
6389 許容されている伸び量(\texttt{stretch}の値)の合計を計算する.
6390 また,行長と自然長との差を\textit{total}とおく.
6393 \subsection{第1段階:行末文字の位置調整}
6394 行末が文字クラス$n$の\textbf{JAchar}であった場合,
6395 それを動かすことによって,\textit{total}のうち
6396 \textbf{JAglue}が負担する分を少なくしようとする.
6399 \texttt{end\_stretch},~\texttt{end\_shrink}フィールドに
6402 例えば,行末文字が句点「。」であり,そこで用いられているJFM中に
6405 chars = { '。', ... }, width = 0.5, ...,
6406 end_stretch = 0.5, end_shrink = 0.5,
6409 という指定があった場合,この行末の句点は
6411 \item 通常の\TeX の行分割処理で「半角以上の詰め」が行われていた場合,
6412 この行中の\textbf{JAglue}の負担を軽減するため,
6413 行末の句点を半角だけ右に移動する(ぶら下げ組を行う).
6414 \item 通常の\TeX の行分割処理で「半角以上の空き」が行われていた場合,
6415 逆に行末句点を半角左に移動させる(見た目的に全角取りとなる).
6416 \item 以上のどちらでもない場合,行末句点の位置調整は行わない.
6420 行末文字を移動した場合,その分だけ\textit{total}の値を引いておく.
6423 \textit{total}の分だけが,行中のグルーの伸び量に応じて負担されることになる.
6424 負担するグルーの優先度は以下の順であり,
6425 できるだけ\Param{\hyperlink{fld:kanjiskip}{kanjiskip}}を自然長のままにすることを
6427 \begin{enumerate}\def\labelenumi{(\Alph{enumi})}
6428 \item \textbf{JAglue}以外のグルー
6432 \item 優先度$-1$のJFMグルー
6433 \item 優先度$-2$のJFMグルー
6434 \item \Param{\hyperlink{fld:xks}{xkanjiskip}}
6435 \item \Param{\hyperlink{fld:kanjiskip}{kanjiskip}}
6438 \item 行末の和文文字を移動したことで$\textit{total}=0$となれば,
6439 調整の必要はなく,行が格納されている水平ボックスの
6440 \texttt{glue\_set}, \texttt{glue\_sign}, \texttt{glue\_order}を再計算すればよい.
6441 以降,$\textit{total}\neq 0$と仮定する.
6442 \item \textit{total}が「\textbf{JAglue}以外のグルーの伸び量の合計」(以下,(A)の伸び量の
6444 それらのグルーに\textit{total}を負担させ,\textbf{JAglue}達自身は自然長で組むことができる.
6447 \item 各\textbf{JAglue}の伸び量を0とする.
6448 \item 行が格納されている水平ボックスの
6449 \texttt{glue\_set}, \texttt{glue\_sign}, \texttt{glue\_order}を再計算する.
6450 これによって,\textit{total}は\textbf{JAglue}以外のグルーによって負担される.
6452 \item \textit{total}が「(A)の伸び量の合計」以上ならば,(A)--(H)のどこまで負担すれば
6453 \textit{total}以上になるかを計算する.
6456 \textit{total} = (\text{(A)--(B)の伸び量の合計}) + p\cdot (\text{(C)の伸び量の合計}),
6459 であった場合,各グルーは次のように組まれる:
6461 \item (A),~(B)に属するグルーは各グルーで許された伸び量まで伸ばす.
6462 \item (C)に属するグルーはそれぞれ$p\times (\text{伸び量})$だけ伸びる.
6463 \item (D)--(H)に属するグルーは自然長のまま.
6465 実際には,前に述べた「設計」に従い,次のように処理している:
6467 \item (C)に属するグルーの伸び量を$p$倍する.
6468 \item (D)--(H)に属するグルーの伸び量を0とする.
6469 \item 行が格納されている水平ボックスの
6470 \texttt{glue\_set}, \texttt{glue\_sign}, \texttt{glue\_order}を再計算する.
6471 これによって,\textit{total}は\textbf{JAglue}以外のグルーによって負担される.
6473 \item \textit{total}が(A)--(H)の伸び量の合計よりも大きい場合,どうしようもないので
6474 \verb+^^;+何もせず,何もしない.
6481 \verb+luatexja.otf.enable_ivs()+ を実行し,IVS対応を有効にした状態では,
6482 \verb+pre_linebreak_filter+ や \verb+hpack_filter+ コールバックには
6483 次の4つが順に実行される状態となっている:
6485 \item[\tt ltj.do\_ivs] \textit{glyph\_node}~$p$の直後に,異体字セレクタ(を表す\textit{glyph\_node})
6486 が連続した場合に,$p$のフォントに対応したが持つ「異体字情報」に従って出力するグリフを変える.
6488 しかし,単に$p.\textit{char}$を変更するだけでは,後から
6489 font featureの適用(すぐ下)により置換される可能性がある.そのため,
6490 \verb+\CID+ や \verb+\UTF+ と同じように,\textit{glyph\_node}~$p$の代わりに
6491 \texttt{user\_id} が\textit{char\_by\_cid}であるようなuser-defined whatsitを用いている.
6492 \item[(\Pkg{luaotfload} によるfont featureの適用)]
6493 \item[\tt ltj.otf] \texttt{user\_id} が\textit{char\_by\_cid}であるようなuser-defined whatsitを
6494 きちんと\textit{glyph\_node}に変換する.この処理は,\verb+\CID+, \verb+\UTF+やIVSによる置換が,
6495 font featureの適用で上書きされてしまうのを防止するためである.
6496 \item[\tt ltj.main\_process] \textbf{JAglue}の挿入処理(\ref{sec-jfmglue}節)と,
6497 JFMの指定に従って各\textbf{JAchar}の「寸法を補正」することを行う.
6500 問題は各フォントの持っているIVS情報をどのように取得するか,である.
6501 \Pkg{luaotfload} はフォント番号<font\_number>の情報を\
6502 \texttt{fonts.hashes.idenfifiers[<font\_number>]} 以下に格納している.
6503 しかし,OpenTypeフォントのIVS情報は格納されていないようである%
6504 \footnote{TrueTypeフォントに関しては,
6506 \texttt{fonts.hashes.idenfiers[<font\_number>]%
6507 .resources.variants[<selector>][<base\_char>]}
6509 に,<base\_char>番の文字の後に異体字セレクタ<selector>が続いた場合に
6513 一方,\LuaTeX 内部の \texttt{fontloader} の返すテーブルには
6514 OpenTypeフォントでもTrueTypeフォントでもIVS情報が格納されている.
6516 そのため,\LuaTeX-jaのIVS対応においては,\texttt{fontloader} を直接用いることにしている.
6517 20140114.0以降でキャッシュを用いるようにした要因はここにあり,
6518 \texttt{fontloader.to\_table} の呼び出しでかなりメモリと時間を消費することから,
6519 IVS情報をキャッシュに保存することで2回目以降の実行時間を節約している.
6521 \section{複数フォントの「合成」(未完)}
6523 \section{\LuaTeX-jaにおけるキャッシュ}
6524 \Pkg{luaotfload}パッケージが,各TrueType・]OpenTypeフォントの情報を
6525 キャッシュとして保存しているのと同様の方法で,
6526 \LuaTeX-jaもいくつかのキャッシュファイルを作成するようになった.
6528 \item 通常,キャッシュは\texttt{\$TEXMFVAR/luatexja/}以下に保存され,
6530 \item 「通常の」テキスト形式のキャッシュ(拡張子は \texttt{.lua})以外にも,
6531 それをバイナリ形式(バイトコード)に変換したものもサポートしている.
6533 \item \LuaTeX とLuaJIT\TeX ではバイトコードの形式が異なるため,バイナリ形式の
6534 キャッシュは共有できない.\LuaTeX 用のバイナリキャッシュは \texttt{.luc},
6535 LuaJIT\TeX 用のは \texttt{.lub} と拡張子を変えることで対応している.
6536 \item キャッシュを読み込む時,同名のバイナリキャッシュがあれば,
6537 テキスト形式のものよりそちらを優先して読み込む.
6538 \item テキスト形式のキャッシュが更新/作成される際は,そのバイナリ版も
6540 また,(バイナリ版が見つからず)テキスト形式のキャッシュ側が読み込まれたときは,
6541 \LuaTeX-jaはバイナリキャッシュを作成する.
6546 \section{Cache Management of \LuaTeX-ja}
6547 \LuaTeX-ja creates some cache files to reduce the loading time.
6548 in a similar way to the \Pkg{luaotfload} package:
6550 \item Cache files are usually stored in (and loaded from)
6551 \texttt{\$TEXMFVAR/luatexja/}.
6552 \item In addition to caches of the text form (the extension is ``\texttt{.lua}''),
6553 caches of the \emph{binary}, precompiled form are supported.
6555 \item We cannot share same binary cache for \LuaTeX\ and LuaJIT\TeX.
6556 Hence we distinguish them by their extension, ``\texttt{.luc}'' for \LuaTeX\
6557 and ``\texttt{.lub}'' for LuaJIT\TeX.
6558 \item In loading a cache, the binary cache precedes
6560 \item When \LuaTeX-ja updates a cache \texttt{hoge.lua},
6561 its binary version is also updated.
6567 \subsection{キャッシュの使用箇所}
6569 \LuaTeX-ja では以下の3種類のキャッシュを使用している:
6571 {\def\makelabel#1{\ttfamily#1}}
6572 \item[ltj-cid-auto-adobe-japan1.lua]
6573 Ryumin-Lightのような非埋め込みフォントの情報を格納しており,
6574 (それらが\LuaTeX-jaの標準和文フォントなので)\LuaTeX-jaの読み込み時に自動で読まれる.
6575 生成には\texttt{UniJIS2004-UTF32-H}, \texttt{Adobe-Japan1-UCS2}という2つの
6578 \pageref{para-cid}ページで述べたように,\texttt{cid}キーを使って
6579 非埋め込みの中国語・韓国語フォントを定義する場合,同様のキャッシュが生成される.
6580 キャッシュの名称,必要となるCMapについては表\ref{tab:cid-cache}を参照して欲しい.
6583 フォント``\texttt{***}''における異体字情報を格納している.構造は以下の通り:
6586 \subsection{Use of Cache}
6588 \LuaTeX-ja uses the following cache:
6590 {\def\makelabel#1{\ttfamily#1}}
6591 \item[ltj-cid-auto-adobe-japan1.lua]
6592 The font table of a CID-keyed non-embedded Japanese font.
6593 This is loaded in every run.
6594 It is created from two CMaps, \texttt{UniJIS2004-UTF32-H} and
6595 \texttt{Adobe-Japan1-UCS2},
6596 and this is why these two CMaps are needed in the first run of \LuaTeX-ja.
6598 Similar caches are created as Table~\ref{tab:cid-cache},
6599 if you specified \texttt{cid} key in \verb+\jfont+
6600 to use other CID-keyed non-embedded fonts for Chinese or Korean,
6601 as in Page~\pageref{para-cid}.
6604 This file stores the table of Unicode variants in a font ``\texttt{***}''.
6605 The structure of the table is the following:
6610 \caption{\texttt{cid} key and corresponding files}
6611 \label{tab:cid-cache}
6612 \vspace*{\medskipamount}
6613 \begin{tabular}{>{\tt}l>{\tt}l>{\tt}l>{\tt}l}
6615 \bf \texttt{cid} key&\bf name of the cache &
6616 \multicolumn{2}{c}{\bf used CMaps}\\
6618 Adobe-Japan1-*<j-cid-auto-adobe-japan1.lua&UniJIS2004-UTF32-H&Adobe-Japan1-UCS2\\
6619 Adobe-Korea1-*<j-cid-auto-adobe-korea1.lua&UniKS-UTF32-H&Adobe-Korea1-UCS2\\
6620 Adobe-GB1-*<j-cid-auto-adobe-gb1.lua&UniGB-UTF32-H&Adobe-GB1-UCS2\\
6621 Adobe-CNS1-*<j-cid-auto-adobe-cns1.lua&UniCNS-UTF32-H&Adobe-CNS1-UCS2\\
6629 [10955]={ -- U+2ACB "Subset Of Above Not Equal To"
6630 [65024]=983879, -- <2ACB FE00>
6632 [37001]={ -- U+9089 "邉"
6633 [0]=37001, -- <9089 E0100>
6634 991049, -- <9089 E0101>
6639 ["chksum"]="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", -- checksum of the fontfile
6640 ["version"]=4, -- version of the cache
6644 \item[ltj-jisx0208.\{luc|lub\}]
6645 \LuaTeX-ja配布中の\texttt{ltj-jisx0208.lua}をバイナリ化したものである.
6646 これはJIS~X~0208とUnicodeとの変換テーブルであり,
6647 \pTeX との互換目的の文字コード変換命令で用いられる.
6650 \item[ltj-jisx0208.\{luc|lub\}]
6651 The binary version of \texttt{ltj-jisx0208.lua}.
6652 This is the conversion table between JIS~X~0208 and Unicode
6653 which is used in Kanji-code conversion commands for compatibility with \pTeX.
6658 \subsection{Internal}
6659 Cache management system of \LuaTeX-ja is stored in \texttt{luatexja.base}
6660 (\texttt{ltj-base.lua}).
6661 There are three public functions for cache management in \texttt{luatexja.base},
6662 where <filename> stands for the filename \emph{without suffix}:
6664 {\def\makelabel#1{\ttfamily#1}}
6665 \item[save\_cache(<filename>, <data>)]
6666 Save a non-nil table <data> into a cache <filename>.
6667 Both the text form <filename>\texttt{.lua} and its binary version
6668 are created or updated.
6670 \item[save\_cache\_luc(<filename>, <data>{[, <serialized\_data>]})]\
6672 Same as \texttt{save\_cache}, except that only the binary cache is updated.
6673 The third argument <serialized data> is not usually given.
6674 But if this is given, it is treated as a string representation of <data>.
6676 \item[load\_cache(<filename>, <outdate>)]
6677 Load the cache <filename>.
6678 <outdate> is a function which takes one argument (the contents of the cache),
6679 and its return value is whether the cache is outdated.
6681 \texttt{load\_cache} first tries to
6682 read the binary cache <filename>\texttt{.\{luc|lub\}}.
6683 If its contents is up-to-date, \texttt{load\_cache} returns the contents.
6684 If the binary cache is not found or
6685 its contents is outdated, \texttt{load\_cache} tries to
6686 read the text form <filename>\texttt{.lua}.
6687 Hence, the return value of \texttt{load\_cache} is non-nil,
6688 if and only if the updated cache is found.
6692 \begin{thebibliography}{99}
6693 \addcontentsline{toc}{section}{\refname}
6694 \bibitem{texbytopic}
6695 Victor Eijkhout. \newblock \textit{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
6696 \bibitem{listings} C.\ Heinz, B.\ Moses. \newblock The \textsf{Listings} Package.
6697 \bibitem{uptex} Takuji Tanaka. \newblock
6698 upTeX---Unicode version of pTeX with CJK extensions,
6699 TUG 2013, October 2013.
6702 \url{http://tug.org/tug2013/slides/TUG2013_upTeX.pdf}
6703 \bibitem{jlisting} Thor Watanabe. \newblock Listings\ -\ MyTeXpert.
6706 \url{http://mytexpert.sourceforge.jp/index.php?Listings}
6707 \bibitem{jlreq} W3C Japanese Layout Task Force~(ed). \newblock
6708 Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \newblock
6709 \url{http://www.w3.org/TR/jlreq/}%
6710 %<ja> \\日本語訳の書籍版:W3C日本語組版タスクフォース(編),『W3C技術ノート 日本語組版処理の要件』,東京電機大学出版局,2012.
6711 \bibitem{min10} 乙部厳己,min10フォントについて.\\\null\hfill
6712 \url{http://argent.shinshu-u.ac.jp/~otobe/tex/files/min10.pdf}
6713 \bibitem{x4051} 日本工業規格(Japanese Industrial Standard), JIS~X~4051,
6714 日本語文書の組版方法(Formatting rules for Japanese documents), 1993, 1995, 2004.
6715 \end{thebibliography}
6720 \section{Package versions used in this document}
6721 This document was typeset using the following packages:
6725 {\makeatletter\tt\footnotesize
6727 \filename@parse{#1}\def\@temp{sty}
6728 \ifx\@temp\filename@ext
6731 \ifx\filename@ext\relax tex\else\filename@ext\fi}%
6732 \leavevmode\hskip-13em\hbox to 13em{\filename@area\reserved@a\hss}%
6733 \csname ver@\reserved@a\endcsname\par
6736 \parindent0pt\leftskip13em
6744 %% config file for showexpl.sty
6746 %% Copyright The LuaTeX-ja project team, 2012
6748 \ProvidesFile{showexpl.cfg}
6749 [2012/05/20 v0.01 Definitions for the showexpl package (luatexja)]