%<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
\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{参考指南}
%<*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$の
\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+.
%<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 との互換性のために実装されている:
%<*ja>
\item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
有効であり,段落の境界を乗り越えない.
- さらに,\verb+\inhibitglue+ は上の例の最終行のようにリガチャとカーニングを
- 打ち消す.
+ さらに,\verb+\inhibitglue+ は上の例の最終行のように(欧文における)リガチャとカーニングを
+ 打ち消す.これは,\verb+\inhibitglue+ が内部的には「現在のリスト中にwhatsitノードを
+ 追加する」ことを行なっているからである.
%</ja>
%<*en>
%</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}}
\section{psft}
+%<*ja>
+\section{\Pkg{listings} パッケージへの対応}
+\Pkg{listings} パッケージが,そのままでは日本語をまともに出力できないこと
+はよく知られている,きちんと整形して出力するために,\Pkg{listings}パッケー
+ジは内部で「ほとんどの文字」をアクティブにし,各文字に対してその文字の出
+力命令を割り当てている (\cite{listings}).
+しかし,そこでアクティブにする文字の中に,和文文
+字がないためである.p\TeX 系列では,和文文字をアクティブにする手法がなく,
+\Pkg{jlisting.sty} というパッチ\cite{jlisting}を用いることで無理やり解決していたが,
+\LuaTeX-jaでは,(\LuaTeX がネイティブでUnicodeを理解することから)「和文
+文字をアクティブ化し,それらに対して適切に出力命令を設定する」というより正統的な
+方法を取ることにした.
+
+\LuaTeX-ja で利用される \Pkg{listings} パッケージへのパッチ \Pkg{lltjp-listings.sty} は,
+\Pkg{listings.sty} と\LuaTeX-jaを読み込んでおけば,
+\verb+\begin{document}+ の箇所において自動的に読み込まれるので,通常はあまり
+意識する必要はない.
+
+\paragraph{文字種}
+\Pkg{listings} パッケージの内部では,大雑把に言うと
+\begin{enumerate}
+\item 識別子として使える文字 (``letter'',~``digit'') たちを
+集める.
+\item letterでもdigitでもない文字が現れた時に,収集した文字列を(必要なら修飾して)出力する.
+\item 今度は逆に,letterでない文字たちをletterが現れるまで集める.
+\item letterが出現したら集めた文字列を出力する.
+\item 1.に戻る.
+\end{enumerate}
+という処理が行われている.これにより,識別子の途中では行分割が行われないようになっている.
+直前の文字が識別子として使えるか否かは \verb+\lst@ifletter+ というフラグに格納されている.
+
+さて,日本語の処理である.殆どの和文文字の前後では行分割が可能であるが,その一方で
+括弧類や音引きなどでは禁則処理が必要なことから,\Pkg{lltjp-listings.sty} では,
+直前が和文文字であるかを示すフラグ \verb+lst@kanji+ を新たに導入した.
+以降,説明のために以下のように文字を分類する:
+\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\\
+意図&識別子中の文字&その他欧文文字&殆どの和文文字&開き括弧類&閉じ括弧類\\
+\bottomrule
+\end{tabular}
+\end{center}
+なお,本来の\Pkg{listings} パッケージでの分類``digit''は,
+出現状況によって,上の表のLetterとOtherのどちらにもなりうる.
+また,KanjiとCloseは \verb+\lst@ifletter+ と \verb+\lst@ifkanji+ の値が一致しているが,
+これは間違いではない.
+
+例えば,Letterの直後にOpenが来た場合を考える.
+文字種Openは和文開き括弧類を想定しているので,Letterの直後では行分割が可能であることが望ましい.
+そのため,この場合では,すでに収集されている文字列を出力することで行分割を許容するようにした.
+同じように,$5\times 5=25$通り全てについて書くと,次のようになる:
+\begin{center}
+\small
+\begin{tabular}{llccccc}
+\toprule
+&&\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}&収集\\
+\bottomrule
+\end{tabular}
+\end{center}
+上の表において,
+\begin{itemize}
+\item 「出力」は,それまでに集めた文字列を出力(≒ここで行分割可能)を意味する.
+\item 「収集」は,後側の文字を,現在収集された文字列に追加(行分割不可)を意味する.
+\end{itemize}
+
+\paragraph{和文文字扱いとなる文字}
+\Pkg{listings} パッケージにおいて和文文字と扱われる
+(前に述べたKanji, Open,あるいは「閉じ括弧類」分類)か否かは,
+通常の\textbf{JAchar}/\textbf{Alchar}の範囲の設定(\ref{ssec-setrange}節)とは全く関係ない.
+
+また,禁則処理に関する\Param{prebreakpenalty},~\Param{postbreakpenalty}の設定も
+\Pkg{listings} パッケージ内部ではまったく影響しない.
+
+\medskip
+現在の実装では,
+\begin{itemize}
+\item 基本多言語面のU+2000--U+FFFF,追加漢字面の文字は,以下の場合を除きKanji扱いとなり,
+また欧文文字2文字分の幅をとる..但し,以下は例外.
+\item U+FF61--U+FF9Fの半角カナはKanji扱いだが,欧文文字1文字分しか幅がない.
+\item 禁則処理のパラメータの標準値を定めている \texttt{luatexja-kinsoku.tex}\ %
+において \Param{prebreakpenalty} が
+10000と設定されている文字はClose扱いである.
+\item \texttt{luatexja-kinsoku.tex} で \Param{postbreakpenalty} が10000
+と設定されている文字はOpen扱いである.
+\end{itemize}
+これらの設定をユーザが\TeX ソースで変更させる仕組みはまだ作成していない.
+
+%</ja>
+%<*en>
+\section{Patch for the \Pkg{listings} package}
+\dots
+%</en>
+
\begin{thebibliography}{99}
\addcontentsline{toc}{section}{\refname}
\bibitem{texbytopic}
%%
%% 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)]