OSDN Git Service

luatexja.dtx: Fix typos.
[luatex-ja/luatexja.git] / doc / luatexja.dtx
index 76bb7d2..c40adc9 100644 (file)
@@ -1,9 +1,9 @@
 %<*!showexpl>
 %#! lualatex -shell-escape
 
-%<en> \documentclass[a4paper,titlepage]{article}
-%<ja> \documentclass[a4paper,titlepage]{ltjsarticle}
-%<zh> \documentclass[a4paper,titlepage]{ltjsarticle}
+%<en>\documentclass[a4paper,titlepage]{article}
+%<ja>\documentclass[a4paper,titlepage]{ltjsarticle}
+%<zh>\documentclass[a4paper,titlepage]{ltjsarticle}
 
 %%%%%%%%
 \makeatletter
 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
 \DeclareRobustCommand\LuaTeX{Lua\TeX}
 \DeclareRobustCommand\pdfTeX{pdf\TeX}
-\DeclareRobustCommand\pTeX{p\kern-.05em\TeX}
-\DeclareRobustCommand\upTeX{up\kern-.05em\TeX}
+\DeclareRobustCommand\pTeX{p\kern-.15em\TeX}
+\DeclareRobustCommand\upTeX{up\kern-.15em\TeX}
 \DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
@@ -1502,7 +1502,7 @@ and loads \Pkg{luatexja-fontspec} internally.
 %<*en>
 Specifying this option enables us to use \textit{mincho} with two weights (medium~and~bold),
 \textit{gothic} with three weights (medium,~bold and~heavy), and \textit{rounded gothic}%
-\footnote{Provided by \texttt{\char92mgfamily}, 
+\footnote{Provided by \texttt{\char92mgfamily},
 because \textit{rounded gothic} is called \textit{maru gothic} (丸ゴシック) in Japanese.}.
 The heavy weight of \textit{gothic} can be used by ``changing the family'' \verb+\gtebfamily+.
 This is because \Pkg{fontspec} package can handle only medium (\verb+\mdseries+) and
@@ -1546,7 +1546,7 @@ Use JIS2004 glyphs if possible.
 %</ja>
 \item[jis]
 %<*en>
-Use the JFM \texttt{jfm-jis.lua}, instead of the default JFM of 
+Use the JFM \texttt{jfm-jis.lua}, instead of the default JFM of
 \LuaTeX-ja, \texttt{jfm-ujis.lua}.
 %</en>
 %<*ja>
@@ -1707,7 +1707,7 @@ Jun Pro 101&Jun Pr6N 101\\
 %<*en>
 Next, we describe settings for using only single weight.
 In four settings below, we use same fonts for medium and bold (and heavy) weights.
-(Hence \verb+\mcfamily\bfseries+ and \verb+\mcfamily\mdseries+ yields same Japanese fonts, 
+(Hence \verb+\mcfamily\bfseries+ and \verb+\mcfamily\mdseries+ yields same Japanese fonts,
 if \texttt{deluxe} option is also specified).
 %</en>
 %<*ja>
@@ -1892,7 +1892,7 @@ parameters, you have to use commands \verb+\ltjsetparameter+ and
 %<en>\subsection{Editing the range of \textbf{JAchar}s}
 %<ja>\subsection{\textbf{JAchar}の範囲の設定}
 %<zh>\subsection{\textbf{JAchar}范围设定}
-
+\label{ssec-setrange}
 
 %<*en>
 To edit the range of \textbf{JAchar}s, you have to assign a non-zero
@@ -1913,7 +1913,7 @@ and the character `漢' to the range number~100.
 下面就分配了整个表意文字补充平面和汉字“漢”为100。
 %</zh>
 \begin{lstlisting}
-\ltjdefcharrange{100}{"10000-"1FFFF,`漢}
+\ltjdefcharrange{100}{"20000-"2FFFF,`漢}
 \end{lstlisting}
 %<*en>
 This assignment of numbers to ranges are always global, so you should
@@ -2684,59 +2684,6 @@ xyz漢字
 \end{LTXexample}
 
 
-%<en>\subsection{Cropmark}
-%<ja>\subsection{トンボ}
-%<zh>\subsection{裁剪框标记}
-
-%<*en>
-Cropmark is a mark for indicating 4~corners and horizontal/vertical
-center of the paper. In Japanese, we call cropmark as tombo(w).
-\pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel.
-The following steps are needed to typeset cropmark:
-%</en>
-%<*ja>
-トンボは用紙の四つ角と水平/垂直方向の中心を表す印である.
-\pLaTeX と \LuaTeX-jaではトンボの出力をサポートしている.
-トンボを出力するためには以下の手順が必要である:
-%</ja>
-%<*zh>
-裁剪框标记是在一页的四角和水平/垂直中央放置的标记。在日文中,裁剪框被称为“トンボ”。
-\pLaTeX 和\LuaTeX-ja均在底层支持裁剪框标记。需要下列步骤来实现:
-%</zh>
-
-\begin{enumerate}
-%<*en>
-\item First, define the banner which will be printed at the upper left
-      of the paper. This is done by assigning a token list to
-      \verb+\@bannertoken+.
-
-For example, the following sets banner as `\texttt{filename (YYYY-MM-DD hh:mm)}':
-%</en>
-%<*ja>
-\item まず,用紙の左上に印刷されるバナーを定義する.これは \verb+\@bannertoken+
-      にトークンリストを与えることでなされる.
-
-例えば,以下はバナーとして`\texttt{filename (YYYY-MM-DD hh:mm)}'を設定する:
-%</ja>
-%<*zh>
-\item 首先,首先定义页面左上角将会出现的注记。这由向\verb!@bannertoken!分配一个token列完成。\\
-例如,下列所示将会设定注记为“\textsf{filename (YYYY-MM-DD hh:mm)}”:
-%</zh>
-
-\begin{verbatim}
-\makeatletter
-
-\hour\time \divide\hour by 60 \@tempcnta\hour \multiply\@tempcnta 60\relax
-\minute\time \advance\minute-\@tempcnta
-\@bannertoken{%
-   \jobname\space(\number\year-\two@digits\month-\two@digits\day
-   \space\two@digits\hour:\two@digits\minute)}%
-\end{verbatim}
-
-\item ...
-\end{enumerate}
-
-
 %<en>\part{Reference}
 %<ja>\part{リファレンス}
 %<zh>\part{参考指南}
@@ -2910,9 +2857,9 @@ JFMの名前を指定する.もし以前に指定されたJFMが読み込ま
 \toprule
 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
 \midrule
-%<en>Example~1\footnotemark
-%<ja>例1\footnotemark
-%<zh>例1\footnotemark
+%<en>Example~1\cite{min10}
+%<ja>例1\cite{min10}
+%<zh>例1\cite{min10}
 &\r{ujis}&\r{jis}&\r{min}\\
 %<en>Example~2
 %<ja>例2
@@ -2924,8 +2871,6 @@ Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
 \end{center}
 \ltjsetparameter{jacharrange={-3}}
 \end{table}
-\footnotetext{from: 乙部厳己, min10フォントについて.
-\texttt{http://argent.shinshu-u.ac.jp/\~{\ }otobe/tex/files/min10.pdf}.}
 
 %<en>\paragraph{Note: kern feature}
 %<ja>\paragraph{注意:kern feature}
@@ -3219,13 +3164,16 @@ the following fields:
 %<*en>
 This field is a list of characters which are in this character
             type~$i$. This field is optional if $i=0$, since all
-            \textbf{JAchar} which are not in any character class other
+            \textbf{JAchar} which do not belong  any character classes other
             than 0 are in the character class 0
              (hence, the character class~0 contains most of
-            \textbf{JAchar}s). In the list, a character can be
-            specified by its code number, or by the character itself
-            (as a string of length~1). Moreover, there are `imaginary
-            characters' which can be specified in the list. We will describe these later.
+            \textbf{JAchar}s). In the list, character(s) can be specified in the following form:
+\begin{itemize}
+\item a Unicode code point
+\item the character itself (as a Lua string, like \verb+'あ'+)
+\item a string like \verb+'あ*'+ (the character followed by an asterisk)
+\item several ``imaginary'' characters (We will describe these later.)
+\end{itemize}
 %</en>
 %<*ja>
 このフィールドは文字クラス$i$に属する文字のリストである.このフィールドは$i=0$の
@@ -3430,7 +3378,23 @@ Furthermore, the glyph is shifted according to values of fields
 
 \item[kern={\{[$j$]=<kern>, ...\}}]
 
-\item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
+\item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>, [<priority>]\}, ...\}}]
+%<*ja>
+文字クラス$i$の文字と$j$の文字の間に挿入されるkernやglueの量を指定する.
+             <priority>は省略可能であり,行調整処理におけるこのglueの優先
+             度を$-2$から$+2$の間の整数で指定する.<priority>の省略時の値
+             は0であり,範囲外の値が指定されたときの動作は未定義である).
+
+%</ja>
+
+\item[end\_stretch=<kern>]
+\item[end\_shrink=<kern>]
+%<*ja>
+これらのフィールドは省略可能である.
+現在の文字クラスの文字が行末に来た時に,行長を詰める調整・伸ばす調整のた
+             めにこの文字と行末の間に挿入可能なカーンの大きさを指定する.
+%</ja>
+
 \end{list}
 
 %<*ja>
@@ -3441,7 +3405,7 @@ Furthermore, the glyph is shifted according to values of fields
 たとえば,次の内容を一部に含んだ \texttt{jfm-test.lua} を考えよう:
 \begin{lstlisting}
    [0] = {
-      chars = { '漢', 'ヒ*' }, 
+      chars = { '漢', 'ヒ*' },
       align = 'left', left = 0.0, down = 0.0,
       width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
    },
@@ -3512,10 +3476,10 @@ The following is the list of `imaginary characters':
 下列为“假想字符”列表:
 %</zh>
 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
-\item['lineend']
-%<en>An ending of a line.
-%<ja>行の終端を表す.
-%<zh>行尾结束字符。
+%%\item['lineend']
+%%%<en>An ending of a line.
+%%%<ja>行の終端を表す.
+%%%<zh>行尾结束字符。
 
 \item['diffmet']
 %<en>Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
@@ -3707,7 +3671,7 @@ this argument has \texttt{chars} field which contains character codes
 %<*en>
 An example of this callback is the \texttt{ltjarticle} class, with
             forcefully assigning character class~0 to \texttt{'parbdd'}
-            in the JFM \texttt{jfm-min.lua}. 
+            in the JFM \texttt{jfm-min.lua}.
 %</en>
 %<*ja>
 このコールバックの使用例は\texttt{ltjarticle}クラスにあり,
@@ -3757,7 +3721,19 @@ You may assume that \verb+jfont_info+ has the following fields:
 \item \texttt{dir} フィールドはこのテーブルにはない.
 \end{itemize}
 %</ja>
-%<!ja> ...
+%<*en>
+A table which contains the information of a JFM, and \emph{this table must not be changed}.
+The contents of this table are similar to that which is written is the JFM file, but
+the following differ:
+\begin{itemize}
+\item There is a \texttt{chars} table, \dots
+\item The value in \texttt{zw},~\texttt{zh}, \texttt{kanjiskip},~\texttt{xkanjiskip} fields are
+now scaled by real font size, and in scaled-pont unit.
+\item ...
+\item There is no \texttt{dir} field in this table.
+\end{itemize}
+%</en>
+%<zh> ...
 
 \item[\tt var]
 %<en>The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
@@ -4190,7 +4166,8 @@ JFM(もしくはサイズ)が異なる2つの\textbf{JAchar}の間にグル
 %<zh>\subsection{基本语句兼容性}
 
 %<*en>
-The following primitives are implemented for compatibility with \pTeX:
+The following primitives are implemented for compatibility with \pTeX.
+Note that these primitives don't support JIS~X~0213, but only JIS~X~0208.
 %</en>
 %<*ja>
 以下のプリミティブは\pTeX との互換性のために実装されている:
@@ -4266,8 +4243,9 @@ With the help of this example, we remark the specification of \verb+\inhibitglue
 %<*ja>
 \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
   有効であり,段落の境界を乗り越えない.
-  さらに,\verb+\inhibitglue+ は上の例の最終行のようにリガチャとカーニングを
-  打ち消す.
+  さらに,\verb+\inhibitglue+ は上の例の最終行のように(欧文における)リガチャとカーニングを
+  打ち消す.これは,\verb+\inhibitglue+ が内部的には「現在のリスト中にwhatsitノードを
+  追加する」ことを行なっているからである.
 %</ja>
 
 %<*en>
@@ -4471,19 +4449,15 @@ As closing this subsection, we shall introduce an example of
 %</en>
 %<*ja>
 この節の終わりに,\verb+\SetRelationFont+ と \verb+\userelfont+ の例を
-紹介しておこう.
+紹介しておこう.\verb+\userelfont+ の使用によって,「abc」の部分のフォントが
+Avant Garde (OT1/pag/m/n) に変わっていることがわかる.
 %</ja>
 \begin{LTXexample}
-\gtfamily{}あいうabc
+\kanjifamily{gt}\selectfont あいうxyz
 \SetRelationFont{JY3}{gt}{m}{n}{OT1}{pag}{m}{n}
-\userelfont\selectfont{}あいうabc
+\userelfont\selectfont あいうabc
 \end{LTXexample}
 
-
-%<en>\subsection{Cropmark/`tombow'}
-%<ja>\subsection{トンボ}
-% ToDo
-
 %<en>\section{Extensions}
 %<ja>\section{拡張}
 \subsection{\texttt{luatexja-fontspec.sty}}
@@ -4613,6 +4587,43 @@ JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形
 使えるようになる.これはAdobe-Japan1におけるCID番号が \verb+xxx+ の文字を表す.
 %</ja>
 
+\subsection{\texttt{luatexja-adjust.sty}}
+%<*en>
+...
+%</en>
+%<*ja>
+\pTeX では,行長調整において優先度の概念が存在しなかったため,図
+\ref{fig-adj-input}から半角分の半端は,図\ref{fig-adj-ptex}のように,鍵括
+弧周辺の空白と和文間空白(\Param{kanjiskip}))の両方によって負担される.し
+かし,「日本語組版の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}においては,
+この図\ref{fig-adj-input}のような状況では半端は鍵括弧周辺の空白のみで負担
+し,その他の和文文字はベタ組で組まれることになっている.この追加パッケー
+ジは\cite{jlreq}や\cite{x4051}における規定のような,優先順位付きの行長調
+整を提供する.
+
+
+\texttt{luatexja-adjust.sty}は,以下の命令を提供する.これらはすべてグローバルに効力を発揮する.
+
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
+\item[\char92ltjdisableadjust]
+優先順位付きの行長調整を無効化し,
+\pTeX や\LuaTeX-jaデフォルトのような,優先度なしの行長調整に戻す.
+
+\item[\char92ltjenableadjust]
+優先順位付きの行長調整を有効化する.
+
+\item[優先度設定……]
+
+\end{list}
+
+
+
+
+
+%</ja>
+
+
+
 %<en>\part{Implementations}
 %<ja>\part{実装}
 \label{part-imp}
@@ -4761,7 +4772,7 @@ Penalties inserted for the word-wrapping process of Japanese characters (\emph{k
 和文文字のワードラップ過程において挿入されたペナルティ(\emph{kinsoku}).
 %</ja>
 
-\item[\textit{from\_jfm} (4)]
+\item[\textit{from\_jfm} (6)]
 %<*en>
 Glues/kerns from JFM.
 %</en>
@@ -4769,16 +4780,16 @@ Glues/kerns from JFM.
 JFM由来のグルー/カーン.
 %</ja>
 
-\item[\textit{line\_end} (5)]
-%<*en>
-Kerns for \ldots
-%</en>
-%<*ja>
-和文文字が行末にきたとき,行末との間に挿入されるカーンである.
-% ぶら下げ組への応用
-%</ja>
+%%\item[\textit{line\_end} (5)]
+%%%<*en>
+%%Kerns for \ldots
+%%%</en>
+%%%<*ja>
+%%和文文字が行末にきたとき,行末との間に挿入されるカーンである.
+%%% ぶら下げ組への応用
+%%%</ja>
 
-\item[\textit{kanji\_skip} (6)]
+\item[\textit{kanji\_skip} (9)]
 %<*en>
 Glues for \Param{kanjiskip}.
 %</en>
@@ -4786,7 +4797,7 @@ Glues for \Param{kanjiskip}.
 \Param{kanjiskip}のグルー.
 %</ja>
 
-\item[\textit{xkanji\_skip} (7)]
+\item[\textit{xkanji\_skip} (10)]
 %<*en>
 Glues for \Param{xkanjiskip}.
 %</en>
@@ -4794,7 +4805,7 @@ Glues for \Param{xkanjiskip}.
 \Param{xkanjiskip}のグルー.
 %</ja>
 
-\item[\textit{processed} (8)]
+\item[\textit{processed} (11)]
 %<*en>
 Nodes which is already processed by \ldots.
 %</en>
@@ -4802,7 +4813,7 @@ Nodes which is already processed by \ldots.
 \LuaTeX-ja の内部処理によって既に処理されたノード.
 %</ja>
 
-\item[\textit{ic\_processed} (9)]
+\item[\textit{ic\_processed} (12)]
 %<*en>
 Glues from an italic correction, but also already processed.
 %</en>
@@ -5184,19 +5195,19 @@ after `beginning/ending of a group' characters.
 \item[\textsf{5}] \textit{end-of-line} (usually \verb+^^J+).
 \item[\textsf{10}] space (usually \sp).
 \item[\textsf{O}] other characters, whose category code is in $\{3,4,6,7,8,11,12,13\}$.
-\item[\textsf{[\sp]}, \textsf{[{\tt\char92par}]}] 
+\item[\textsf{[\sp]}, \textsf{[{\tt\char92par}]}]
 emits a space, or~\verb+\par+.
 \end{description}
 \end{minipage}
 \begin{itemize}
-\item We omitted about category codes 
+\item We omitted about category codes
 9~(\textit{ignored}), 14~(\textit{comment})~and~15~(\textit{invalid})
 from the above diagram. We also ignored the input like `\verb+^^A+' or `\verb+^+\verb+^df+'.
-\item When a character whose category code is 0 (\textit{escape character}) is seen by \TeX, 
-the input processor scans a control sequence (\textsf{scan a c.s.}). 
+\item When a character whose category code is 0 (\textit{escape character}) is seen by \TeX,
+the input processor scans a control sequence (\textsf{scan a c.s.}).
 These paths are not shown in the above diagram.
 
-After that, the state is changed to State~$S$ (skipping blanks) in most cases, but 
+After that, the state is changed to State~$S$ (skipping blanks) in most cases, but
 to State~$M$ (middle of line) sometimes.
 \end{itemize}
 %<en>\caption{State transitions of \pTeX's input processor.}
@@ -5655,18 +5666,19 @@ JFM由来の値だけを用いる.もし両者で使われているJFMが異
 \end{enumerate}
 \end{description}
 \paragraph{「左空白」の算出とそれに伴う補正}
-次に,「左空白」にあたる量を算出する:
-\begin{description}
-\item[line-end~{[E]}]
-\textit{Nq}と\textit{Np}の間で行分割が起きたときに,
-\textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
-\begin{enumerate}
-\item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
-\item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
-\textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
-\item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
-\end{enumerate}
-\end{description}
+「左空白」は過去のバージョンでは定義していたが,このバージョンでは挿入は一切行われない(機能自体削除している).しかし,仕様は流動的であり,将来復活する可能性もあるため,マニュアル中の記述は今のところ極力変更しない.
+% 次に,「左空白」にあたる量を算出する:
+% \begin{description}
+% \item[line-end~{[E]}]
+% \textit{Nq}と\textit{Np}の間で行分割が起きたときに,
+% \textit{Nq}と行末の間に入る空白である.ぶら下げ組の組版などに用いられることを期待している.
+% \begin{enumerate}
+% \item 既に算出した「右空白」がカーンである場合は,「左空白」は挿入されない.
+% \item 「右空白」がglueか未定義(長さ0のglueとみなす)の場合は,「左空白」は
+% \textit{Nq}と「文字コード\texttt{'lineend'}の文字」との間に入るカーンとして,JFMから決定される.
+% \item 2.で決まった「左空白」の長さが0でなければ,その分だけ先ほど算出した「右空白」の自然長を引く.
+% \end{enumerate}
+% \end{description}
 \paragraph{禁則用ペナルティの挿入}
 まず,
 \[
@@ -5960,38 +5972,373 @@ $\mathit{Nq}.\mathit{tail}$は無意味なので,
 
 \section{psft}
 
+%<en>\section{Patch for the \Pkg{listings} package}
+%<ja>\section{\Pkg{listings} パッケージへの対応}
+
+%<*en>
+It is well-known that the \Pkg{listings} package outputs weird results
+for Japanese input.
+The \Pkg{listings} package makes most of letters active and assigns
+output command for each letter \cite{listings}.
+But Japanese characters are not included in these activated letters.
+For \pTeX{} series, there is no method to make Japanese characters active;
+a patch \Pkg{jlisting.sty} \cite{jlisting} resolves the problem forcibly.
+%</en>
+%<*ja>
+\Pkg{listings} パッケージが,そのままでは日本語をまともに出力できないこと
+はよく知られている.きちんと整形して出力するために,\Pkg{listings}パッケー
+ジは内部で「ほとんどの文字」をアクティブにし,各文字に対してその文字の出
+力命令を割り当てている \cite{listings}.
+しかし,そこでアクティブにする文字の中に,和文文
+字がないためである.\pTeX 系列では,和文文字をアクティブにする手法がなく,
+\Pkg{jlisting.sty} というパッチ\cite{jlisting}を用いることで無理やり解決していた.
+%</ja>
+
+%<*en>
+In \LuaTeX-ja, the problem is resolved by using \verb+process_input_buffer+ callback.
+The callback function inserts the output command before each letter above U+0080.
+This method can omits the process to make all Japanese characters active
+(most of the activated characters are not used in many cases).
+%</en>
+%<*ja>
+\LuaTeX-jaでは,\verb+process_input_buffer+ コールバックを利用することで,
+「各行に出現するU+0080以降の文字に対して,それらの出力命令を前置する」という方法をとっている.
+これにより,(入力には使用されていないかもしれない)和文文字をもすべてアクティブ化する手間もなく,
+見通しが良い実装になっている.
+%</ja>
+
+%<*en>
+If \Pkg{listings.sty} and \LuaTeX-ja were loaded,
+then the patch \Pkg{lltjp-listings.sty} is loaded automatically at \verb+\begin{document}+.
+%</en>
+%<*ja>
+\LuaTeX-ja で利用される \Pkg{listings} パッケージへのパッチ \Pkg{lltjp-listings.sty} は,
+\Pkg{listings.sty} と\LuaTeX-jaを読み込んでおけば,
+\verb+\begin{document}+ の箇所において自動的に読み込まれるので,通常はあまり
+意識する必要はない.
+%</ja>
+
+%<en>\paragraph{Class of characters}
+%<ja>\paragraph{文字種}
+
+%<*en>
+Roughly speaking, the \Pkg{listings} package processes input as follows:
+%</en>
+%<*ja>
+\Pkg{listings} パッケージの内部では,大雑把に言うと
+%</ja>
+\begin{enumerate}
+%<*en>
+\item Collects \textit{letters} and \textit{digits}, which can be used for the name of identifiers.
+%</en>
+%<*ja>
+\item 識別子として使える文字 (``letter'',~``digit'') たちを
+集める.
+%</ja>
+
+%<*en>
+\item When reading an \textit{other}, outputs the collected character string (with modification, if needed).
+%</en>
+%<*ja>
+\item letterでもdigitでもない文字が現れた時に,収集した文字列を(必要なら修飾して)出力する.
+%</ja>
+
+%<*en>
+\item Collects \textit{others}.
+%</en>
+%<*ja>
+\item 今度は逆に,letterでない文字たちをletterが現れるまで集める.
+%</ja>
+
+%<*en>
+\item When reading a \textit{letter} or a \textit{digit}, outputs the collected character string.
+%</en>
+%<*ja>
+\item letterが出現したら集めた文字列を出力する.
+%</ja>
+
+%<*en>
+\item Turns back to 1.
+%</en>
+%<*ja>
+\item 1.に戻る.
+%</ja>
+\end{enumerate}
+%<*en>
+By the above process, line breaks inside of an identifier are blocked.
+A flag \verb+\lst@ifletter+ indicates whether the previous character can be used
+for the name of identifiers or not.
+%</en>
+%<*ja>
+という処理が行われている.これにより,識別子の途中では行分割が行われないようになっている.
+直前の文字が識別子として使えるか否かは \verb+\lst@ifletter+ というフラグに格納されている.
+%</ja>
+
+%<*en>
+For Japanese characters, line breaks are permitted on both sides
+except for parentheses, dashes, etc.
+To process Japanese characters,
+The pacth \Pkg{lltjp-listings.sty} introduces a new flag \verb+\lst@ifkanji+, which indicates
+whether the previous character is Japanese character or not.
+For illustration, we introduce the following classes of character:
+%</en>
+%<*ja>
+さて,日本語の処理である.殆どの和文文字の前後では行分割が可能であるが,その一方で
+括弧類や音引きなどでは禁則処理が必要なことから,\Pkg{lltjp-listings.sty} では,
+直前が和文文字であるかを示すフラグ \verb+\lst@ifkanji+ を新たに導入した.
+以降,説明のために以下のように文字を分類する:
+%</ja>
+\begin{center}
+\small
+\begin{tabular}{lccccc}
+\toprule
+&Letter&Other&Kanji&Open&Close\\\midrule
+\verb+\lst@ifletter+&T&F&T&F&T\\
+\verb+\lst@ifkanji+&F&F&T&T&F\\
+%<en>Meaning&identifier char&other alphabet&most of Japanese char&open paren&close paren\\
+%<ja>意図&識別子中の文字&その他欧文文字&殆どの和文文字&開き括弧類&閉じ括弧類\\
+\bottomrule
+\end{tabular}
+\end{center}
+%<*en>
+Note that \textit{digits} in the \Pkg{listings} package can be Letter or
+Other according to circumstances.
+%</en>
+%<*ja>
+なお,本来の\Pkg{listings} パッケージでの分類``digit''は,
+出現状況によって,上の表のLetterとOtherのどちらにもなりうる.
+また,KanjiとCloseは \verb+\lst@ifletter+ と \verb+\lst@ifkanji+ の値が一致しているが,
+これは間違いではない.
+%</ja>
+
+%<*en>
+For example, let us consider the case an Open comes after a Letter.
+Since an Open represents Japanese open parenthesis,
+it is preferred to be permitted to insert line break after the Letter.
+Therefore, the collected character string is output in this case.
+%</en>
+%<*ja>
+例えば,Letterの直後にOpenが来た場合を考える.
+文字種Openは和文開き括弧類を想定しているので,Letterの直後では行分割が可能であることが望ましい.
+そのため,この場合では,すでに収集されている文字列を出力することで行分割を許容するようにした.
+%</ja>
+
+%<*en>
+The following table summarizes $5\times 5=25$ cases:
+%</en>
+%<*ja>
+同じように,$5\times 5=25$通り全てについて書くと,次のようになる:
+%</ja>
+\begin{center}
+\small
+\begin{tabular}{llccccc}
+\toprule
+%<*en>
+&&\multicolumn{4}{c}{Next}\\\cmidrule(lr){3-7}
+&&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
+&\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
+&Letter&collects&\multicolumn{3}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
+&Other&outputs&collects&\multicolumn{2}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
+Prev&Kanji&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
+&Open&\multicolumn{5}{c}{\hrulefill \ collects\ \hrulefill}\\
+&Close&\multicolumn{4}{c}{\hrulefill \ outputs\ \hrulefill}&collects\\
+%</en>
+%<*ja>
+&&\multicolumn{4}{c}{後ろ側の文字}\\\cmidrule(lr){3-7}
+&&\hbox to 4em{\hss Letter\hss}&\hbox to 4em{\hss Other\hss}
+&\hbox to 4em{\hss Kanji\hss}&\hbox to 4em{\hss Open\hss}&Close\\\midrule
+直&Letter&収集&\multicolumn{3}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
+前&Other&出力&収集&\multicolumn{2}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
+文&Kanji&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
+字&Open&\multicolumn{5}{c}{\hrulefill \ 収集\ \hrulefill}\\
+種&Close&\multicolumn{4}{c}{\hrulefill \ 出力\ \hrulefill}&収集\\
+%</ja>
+\bottomrule
+\end{tabular}
+\end{center}
+%<en>In the above table,
+%<ja>上の表において,
+\begin{itemize}
+%<en>\item ``outputs'' means to output the collected character string (i.e., line breaking is permitted there).
+%<ja>\item 「出力」は,それまでに集めた文字列を出力(≒ここで行分割可能)を意味する.
+
+%<en>\item ``collects'' means to append the next character to the collected character string (i.e., line breaking is prohibited there).
+%<ja>\item 「収集」は,後側の文字を,現在収集された文字列に追加(行分割不可)を意味する.
+\end{itemize}
+
+%<en>\paragraph{Classification of characters}
+%<ja>\paragraph{和文文字扱いとなる文字}
+
+%<*en>
+Characters are classified according to \Param{jacharrange} parameter (see Section \ref{ssec-setrange}):
+%</en>
+%<*ja>
+\Pkg{listings} パッケージにおいて和文文字と扱われる
+(前に述べたKanji, Open,あるいは「閉じ括弧類」分類)か否かは,
+通常の\textbf{JAchar}/\textbf{Alchar}の範囲の設定(\Param{jacharrange} パラメータ,\ref{ssec-setrange}節を参照)に従って行われる:
+%</ja>
+\begin{itemize}
+%<en>\item \textbf{ALchars} above U+0080 are Letter.
+%<ja>\item (U+0080以降の)\textbf{ALchar}は,すべてLetter扱いである.
+
+%<en>\item \textbf{JAchars} are classified in the order as follows:
+%<ja>\item (U+0080以降の)\textbf{JAchar}については,以下の順序に従って文字種を決める:
+\begin{enumerate}
+%<en>\item Characters whose \Param{prebreakpenalty} is greater than or equal to 0 are Open.
+%<ja>\item \Param{prebreakpenalty} が0以上の文字はOpen扱いである.
+
+%<en>\item Characters whose \Param{postbreakpenalty} is greater than or equal to 0 are Close.
+%<ja>\item \Param{postbreakpenalty} が0以上の文字はClose扱いである.
+
+%<en>\item Characters that don't satisfy the above two conditions are Kanji.
+%<ja>\item 上の2条件のどちらにも当てはまらなかった文字は,Kanji扱いである.
+\end{enumerate}
+\end{itemize}
+
+%<*en>
+The width of halfwidth kana (U+FF61--U+FF9F) is same as the width of \textbf{ALchar};
+the width of the other \textbf{JAchars} is double the width of \textbf{ALchar}.
+%</en>
+%<*ja>
+なお,半角カナ(U+FF61--U+FF9F)以外の\textbf{JAchar}は欧文文字2文字分の幅をとるものとみなされる.
+半角カナは欧文文字1文字分の幅となる.
+%</ja>
+
+%<*en>
+The classification process is executed every time a character appears in
+listing environments.
+%</en>
+%<*ja>
+これらの文字種決定は,実際に \texttt{lstlisting} 環境などの内部で文字が出てくるたびに行われる.
+%</ja>
+
+%<*ja>
+\section{和文の行長補正方法}
+\texttt{luatexja-adjust.sty} で提供される優先順位付きの行長調整の詳細を述
+べる.大まかに述べると,次のようになる.
+\begin{itemize}
+\item 通常の\TeX の行分割方法に従って,段落を行分割する.この段階では,行長に半端が出た場合,その半端分は\Param{xkanjiskip},\Param{kanjiskip},JFMグルーの全てで(優先順位なく)負担される.
+\item その後,\texttt{post\_linebreak\_filter} callbackによって,\textbf{段落中の各行ごとに},
+      行末文字の位置を調整したり,優先度付きの行長調整を実現するためにグルーの伸縮度を調整する.
+\texttt{luatexja-adjust.sty} の作用は,このcallbackを追加するだけである.
+\end{itemize}
+
+段落中の行中のグルーは,
+\begin{itemize}
+\item 下のどれにも該当しないグルー
+\item 和欧文間空白(\Param{xkanjiskip})
+\item JFMグルー(JFM中で優先度を$-2$--$+2$の整数値で指定できるが,優先度別にまとめられる)
+\item 和文間空白(\Param{kanjiskip})
+\end{itemize}
+の$1+1+5+1=8$つに類別される,
+
+\subsection{行末文字の位置調整}
+まず,
+
+%</ja>
+
+%<*en>
+\section{Advanced line-adjustment for Japanese characters}
+\dots
+%</en>
+
+
+
+
 \begin{thebibliography}{99}
   \addcontentsline{toc}{section}{\refname}
 \bibitem{texbytopic}
 Victor Eijkhout,  \emph{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.
+\bibitem{listings} C.\ Heinz, B.\ Moses. The \textsf{Listings} Package.
+\bibitem{jlisting} Thor Watanabe. Listings\ -\ MyTeXpert. \newblock
+\url{http://mytexpert.sourceforge.jp/index.php?Listings}
+\bibitem{min10} 乙部厳己,「min10フォントについて」.
+\url{http://argent.shinshu-u.ac.jp/\~{\ }otobe/tex/files/min10.pdf}
 \end{thebibliography}
 
 \newpage
 \appendix
 
-%<*ja>
-\section{\LuaTeX-jaにおけるJIS~X~0213非漢字のcatcode}
 
+%<en>\section{The category code of non-kanji characters defined in JIS~X~0213}
+%<ja>\section{\LuaTeX-jaにおけるJIS~X~0213非漢字のcatcode}
+
+%<*en>
+In these tables, the default catcode (\LuaTeX-ja) and kcatcode ((u)\pTeX) of non-kanji
+characters defined in JIS~X~0213 from row 1 to row 13 is summarized.
+Each character is printed as follows:
+%</en>
+%<*ja>
 ここでは,JIS~X~0213の非漢字部分(第1区〜第13区)のうち,
 どの文字が(u)\pTeX や\LuaTeX-jaで制御綴内に使用可能かを表にしてまとめる.
 各文字は
+%</ja>
 \begin{center}
 \tt\fboxsep=1pt\fbox{\hbox to \zw{\gt あ\hss}}\,\scriptsize LUP
 \end{center}
+%<*ja>
 のように表示しており,各文字は次の意味を持っている.
-この表の生成は,JIS X 0208の範囲内の文字については\verb+\jis+命令を使って行なっている.
+この表の生成は,JIS~X~0208の範囲内の文字については\verb+\jis+命令を使って行なっている.
+%</ja>
+%<*en>
+The tables are generated by using \verb+\jis+ command for characters included in
+JIS~X~0208.
+Each character in the tables means:
+%</en>
 \begin{itemize}
+%<*en>
+\item The background of a character regarded as \textbf{ALchar} in \LuaTeX-ja
+  is colored light blue.
+%</en>
+%<*ja>
 \item 背景が薄く青く塗られている文字は,
 \LuaTeX-ja の標準で\textbf{ALchar}として認識されている文字である.
+%</ja>
+
+%<*en>
+\item The first letter {\tt L} means that the character is available for
+  the name of a control sequence in \XeTeX{} and \LuaTeX-ja (its catcode is 11).
+%</en>
+%<*ja>
 \item 1文字目の {\tt L} は,\XeTeX や\LuaTeX-jaにおいてこの文字が制御綴内に
 使用可能(catcodeが11)であることを表している.
+%</ja>
+
+%<*en>
+\item The second letter {\tt U} means that the character is available for
+  the name of a control sequence in \upTeX{} (its kcatcode is 16 or 17).
+  \upTeX{} regards these characters as Japanese character.
+%</en>
+%<*ja>
 \item 2文字目の{\tt U} は,\upTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
 表している.この範囲内では,\upTeX は標準で全文字を和文文字として扱うようである.
+%</ja>
+
+%<*en>
+\item The third letter {\tt P} means that the character is available for
+  the name of a control sequence in \pTeX{} (its kcatcode is 16 or 17).
+%</en>
+%<*ja>
 \item 3文字目の {\tt P} は,\pTeX においてこの文字が制御綴内に使用可能(kcatcodeは16,~17)であることを
 表している.
+%</ja>
+
+%<*en>
+\item If the third letter is {\tt -} (or the character is printed in red),
+  the character is not included in JIS~X~0208.
+  Therefore, you can consider the character is not available.
+%</en>
+%<*ja>
 \item 3文字目が{\tt -}となっているもの(本体の文字も赤身がかっている)は,
 JIS~X~0208にないため使用不能と考えて良いものである.
+%</ja>
+
+%<*en>
+\item The kana for bidakuon in row 4 and 5 are omitted.
+%</en>
+%<*ja>
 \item 第4区と第5区にある,鼻濁音の仮名については省略した.
+%</ja>
 \end{itemize}
 
 
@@ -6317,7 +6664,9 @@ JIS~X~0208にないため使用不能と考えて良いものである.
 }
 
 \def\test#1{{%
-\subsection*{第#1区}\tt\small\fboxsep=1pt\centering\tabcolsep=0.25\zw
+%<en>\subsection*{Row #1}
+%<ja>\subsection*{第#1区}
+\tt\small\fboxsep=1pt\centering\tabcolsep=0.25\zw
 \begin{tabular}{ccccccccccccccccc}\toprule&"0&"1&"2&"3&"4&"5&"6&"7&"8&"9&"A&"B&"C&"D&"E&"F\\
 \out{#1}{2}\out{#1}{3}\out{#1}{4}\out{#1}{5}\out{#1}{6}\out{#1}{7}\bottomrule
 \end{tabular}\par}\medskip}
@@ -6325,8 +6674,6 @@ JIS~X~0208にないため使用不能と考えて良いものである.
 \test{1}\test{2}\test{3}\test{4}\test{5}\test{6}\test{7}\test{8}
 \test{9}\test{10}\test{11}\test{12}\test{13}
 
-%</ja>
-
 
 \section{Package versions used in this document}
 This document was typeset using the following packages:
@@ -6354,7 +6701,7 @@ This document was typeset using the following packages:
 %%
 %% config file for showexpl.sty
 %%
-%% Copyright The LuaTeX-ja project team, 2005
+%% Copyright The LuaTeX-ja project team, 2012
 %%
 \ProvidesFile{showexpl.cfg}
   [2012/05/20 v0.01 Definitions for the showexpl package (luatexja)]