X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=doc%2Fluatexja.dtx;h=1c306990f4182d295c57ff5a1b44f33a0c03fdfb;hb=f4648633114b448dadb484b114606ac663073819;hp=5fb9f15dbda4077bdcd3391f8ea69658bea5ecfa;hpb=9ea8f9cbe5824b0642cd6f3a74a31cf81af96ed4;p=luatex-ja%2Fluatexja.git diff --git a/doc/luatexja.dtx b/doc/luatexja.dtx index 5fb9f15..1c30699 100644 --- a/doc/luatexja.dtx +++ b/doc/luatexja.dtx @@ -44,6 +44,7 @@ \usepackage[margin=25mm,lmargin=30mm,rmargin=30mm,footskip=6mm]{geometry} \usepackage{luatexja-adjust}\ltjdisableadjust \parskip=\smallskipamount +\makeatletter \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% {3.25ex \@plus1ex \@minus.2ex}% {-1em}% @@ -77,6 +78,7 @@ explpreset={numberstyle=\tiny, numbers=left, numbersep=1em, columns=fixed} } % Suppress output from showexpl to stdout. +\makeatletter \let\SX@Info\relax %%%%%%%% colors @@ -418,13 +420,13 @@ The insertion process of glues/kerns between two Japanese %<*en> \paragraph{Directions} -From this version, \LuaTeX-ja supports vertical writing; +From version~20150420.0, \LuaTeX-ja supports vertical writing; but this feature must \emph{not} be confused with $\Omega$-style direction support of \LuaTeX\ itself. ... % %<*ja> \paragraph{組方向} -本版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている. +20150420.0版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている. なお,\LuaTeX 本体も,$\Omega$流の組方向をサポートしているが,それとは全くの別物であること に注意してほしい. \LuaTeX のコールバックや実装により,特に異なった組方向のボックスを扱う場合には @@ -743,6 +745,20 @@ For changes from \pTeX, see Subsection~\ref{ssec:chgptex}. 従来日本語の文字コードとして用いられてきたEUC-JPやShift-JISは使用できない. % %<*en> +\item By default, \LuaTeX-ja uses Japanese fonts to typeset Greek and Cyrillic letters, + and some Unicode symbols such as \P~and~\S. To change this behavior, + put \lstinline!\ltjsetparameter{jacharrange={-2,-3,-8}}! in the preamble. + For the detailed description, see Subsection~\ref{ssec-setrange}. +% +%<*ja> +\item +標準では,\LuaTeX-jaはギリシャ文字やキリル文字,それに\P や\S などの記号を和文フォントを使っ + て組む.ギリシャ語などを本格的に組むなどこの状況が望ましくない場合, + プリアンブルに \lstinline!\ltjsetparameter{jacharrange={-2,-3,-8}}! を入れると + 上記種類の文字は欧文フォントを用いて組まれるようになる. + 詳しい説明は\ref{ssec-setrange}節を参照してほしい. +% +%<*en> \item \LuaTeX-ja is very slower than \pTeX. Generally speaking, LuaJIT\TeX\ processes \LuaTeX-ja about 30\% faster than \LuaTeX, but not always. @@ -753,9 +769,10 @@ about 30\% faster than \LuaTeX, but not always. LuaJIT\TeX を用いると\LuaTeX のだいたい1.3倍の速度で動くようであるが, IPA mj明朝などの大きいフォントを用いた場合には\LuaTeX よりも遅くなることもある. % + \item% %<*en> -\textbf{Outdated note for MiK\TeX\ users}\quad +\textbf{(Outdated) note for MiK\TeX\ users}\quad \LuaTeX-ja requires that several CMap files% \footnote{\texttt{UniJIS2004-UTF32-\{H,V\}} and \texttt{Adobe-Japan1-UCS2}.} must be found from \LuaTeX. @@ -768,7 +785,7 @@ so you will encounter an error like the following: \LuaTeX-jaが動作するためには,\emph{導入・更新後の初回起動時に} \texttt{UniJIS2004-UTF32-\{H,V\}}, \texttt{Adobe-Japan1-UCS2}という3つのCMapが \LuaTeX によって見つけられることが必要である. -しかしやや古いMiK\TeX ではそのようになっていないので,次のエラーが発生するだろう: +しかし古いバージョンのMiK\TeX ではそのようになっていないので,次のエラーが発生するだろう: % \begin{lstlisting} ! LuaTeX error ...iles (x86)/MiKTeX 2.9/tex/luatex/luatexja/ltj-rmlgbm.lua @@ -779,7 +796,8 @@ bad argument #1 to 'open' (string expected, got nil) If so, please execute a batch file which is written on \href{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{ the Project Wiki (English)}. This batch file creates a temporary directory, copy CMaps in it, -run \LuaTeX-ja in this directory, and finally delete the temporary directory. +run a test file which loads \LuaTeX-ja in this directory, +and finally delete the temporary directory. % %<*ja> そのような場合には, @@ -1087,13 +1105,12 @@ For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ ( % \begin{itemize} %<*en> -\item Commands \cs{fontfamily}, \cs{fontseries}, - \cs{fontshape}, and \cs{selectfont} can be used to change +\item Commands \cs{fontfamily}, \cs{fontseries}, and \cs{fontshape} can be used to change attributes of Japanese fonts. % %<*ja> -\item 和文フォントの属性を変更するには,\cs{fontfamily}, \cs{fontseries}, \cs{fontshape}, - そしてそれらを反映させるために \cs{selectfont} を用いればよい. +\item 和文フォントの属性を変更するには,\cs{fontfamily}, \cs{fontseries}, \cs{fontshape} を使用する. + もちろん,それらを実際に反映させるには手動で \cs{selectfont} を実行する必要がある. % %<*en> @@ -1154,14 +1171,16 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ %<*en> \item For defining a Japanese font family, use \cs{DeclareKanjiFamily} instead of - \cs{DeclareFontFamily}. However, in the present implementation, - using \cs{DeclareFontFamily} doesn't cause any problem. + \cs{DeclareFontFamily}. (In previous version of \LuaTeX-ja, + using \cs{DeclareFontFamily} didn't cause any problem. But this no longer applies + the current version.) \item Defining a Japanese font shape can be done by usual \cs{DeclareFontShape}: % %<*ja> \item 和文フォントファミリの定義には \cs{DeclareFontFamily} の - 代わりに \cs{DeclareKanjiFamily} を用いる.しかし,現在の - 実装では \cs{DeclareFontFamily} を用いても問題は生じない. + 代わりに \cs{DeclareKanjiFamily} を用いる.以前の + 実装では \cs{DeclareFontFamily} を用いても問題は生じなかったが,現在の実装では + そうはいかない. \item 和文フォントのシェイプを定義するには,通常の \cs{DeclareFontShape} を使えば良い: % \begin{lstlisting} @@ -1928,8 +1947,8 @@ parameters, you have to use commands \cs{ltjsetparameter} and 用いる. % -%\subsection{Editing the Range of \textbf{JAchar}s} -%\subsection{\textbf{JAchar}の範囲の設定} +%\subsection{Range of \textbf{JAchar}s} +%\subsection{\textbf{JAchar}の範囲} \label{ssec-setrange} %<*en> @@ -5821,67 +5840,144 @@ In \LuaTeX-ja, this \cs{adjustbaseline} does same task, namely setting the \item[\cs{fontfamily}\{\}] %<*en> As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both}) -to . Which family will be changed is determined as follows: +to . + +First, Whether Japanese font family will be changed is determined by following conditions. +We use an auxiliary list~$N_{\mathrm{J}}$. % %<*ja> 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文, 和文,\emph{もしくは両方})をに変更する. -どのファミリが変更されるかは以下のようにして決定される: +まず,和文フォントファミリが変更されるかは以下の順序で決定される. +補助的に「和文フォントファミリではない」ファミリを格納したリスト$N_{\mathrm{J}}$を用いる. % -\begin{itemize} +\begin{enumerate} %<*en> -\item Let current encoding scheme for Japanese fonts be - . Current Japanese font family will be changed to - , if one of the following two conditions is met: +\item If the family~ has been defined already by \cs{DeclareKanjiFamily}, + current Japanese font family will be changed to . + Note that need not be defined under \emph{current} Japanese font encoding. % %<*ja> -\item 現在の和文フォントに対するエンコーディングがであるとしよう. - 現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに - に変更される: +\item ファミリが既に \cs{DeclareKanjiFamily} によって定義されている場合, + 和文フォントファミリはに変更される. + ここで,は現在の和文フォントエンコーディングで定義されていなくてもよい. % -\begin{itemize} %<*en> -\item The family under the encoding has been already defined by - \cs{DeclareKanijFamily}. +\item If the family~ has been listed in a list~$N_{\mathrm{J}}$, this means + that is not a Japanese font family, hence current Japanese font family + won't be changed. % %<*ja> -\item エンコーディングにおけるファミリが -既に \cs{DeclareKanjiFamily} によって定義されている. +\item ファミリがリスト$N_{\mathrm{J}}$に既に含まれていれば,それは + が和文フォントファミリではないことを意味するので,和文フォントファミリは変更されない. % %<*en> -\item A font definition named \texttt{.fd} (the file name is - all lowercase) exists. +\item If the \Pkg{luatexja-fontspec} package is loaded, we stop here, and current Japanese font family + won't be changed. + + If the \Pkg{luatexja-fontspec} package is \emph{not} loaded, +now \LuaTeX-ja looks whether there exists a Japanese font encoding~ such that + a font definition named \texttt{.fd} (the file name is + all lowercase) exists. If so, current Japanese font family will be changed to + ~(the font definition file won't be loaded here). + If not, current Japanese font family won't be changed, and + is appended to the list~$N_{\mathrm{J}}$. % %<*ja> -\item フォント定義ファイル\texttt{.fd}(ファイル名は全て小文字)が存在する. +\item もし\Pkg{luatexja-fontspec}パッケージが読み込まれていれば,ここで終了であり, +和文フォントファミリは変更されないことになる. + +もし\Pkg{luatexja-fontspec}パッケージが読み込まれていなければ,和文エンコーディングで +フォント定義ファイル\texttt{.fd}(ファイル名は全て小文字)が存在するようなも + のがあるかどうかを調べる. +存在すれば,和文フォントファミリはに変更される(フォント定義ファイルは変更されな + い). +存在しなければ,リスト$N_{\mathrm{J}}$にを追加するだけで,和文フォントファミリは変更されない. + % -\end{itemize} +\end{enumerate} + %<*en> -\item Let current encoding scheme for alphabetic fonts be - . For alphabetic font family, the criterion as above is used. +Next, whether alphabetic font family will be changed is determined by following conditions. +We use an auxiliary lists $F_{\mathrm{A}}$~and~$N_{\mathrm{A}}$, and +patches \cs{DeclareFontEncoding}~and~\cs{DeclareFontFamily} to keep track of alphabetic + font encodings~and~families. % %<*ja> -\item 現在の欧文フォントに対するエンコーディングをとする. - 欧文フォントファミリに対しても,上記の基準が用いられる. +次に,欧文フォントファミリについての判定を述べていく. +補助的に「欧文フォントファミリと判明した」ファミリのリスト$F_{\textrm{A}}$と, +「欧文フォントファミリではない」ファミリを格納したリスト$N_{\mathrm{A}}$を用いる. % + +\begin{enumerate} %<*en> -\item There is a case which none of the above applies, that is, the font - family named doesn't seem to be defined neither under the - encoding , nor under . -In this case, the default family for font substitution is used for - alphabetic and Japanese fonts. Note that current encoding will not - be set to , unlike the original implementation in \LaTeX. +\item If the family~ has been listed in a list~$F_{\mathrm{A}}$, + current alphabetic font family will be changed to . + Note that need not be defined under \emph{current} alphabetic font encoding. % %<*ja> -\item 上記のいずれもが適用されない,つまりがとの - どちらでも定義されないような場合がある. - この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと - 和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり, - 現在のエンコーディングはには設定されないことに注意する. +\item ファミリがリスト$F_{\mathrm{A}}$に既に含まれていれば, + 欧文フォントファミリはに変更される. + ここで,は現在の欧文フォントエンコーディングで定義されていなくてもよい. % -\end{itemize}% -%\vspace{-\medskipamount} +%<*en> +\item If the family~ has been listed in a list~$N_{\mathrm{A}}$, this means + that is not a alphabetic font family, hence current alphabetic font family + won't be changed. +% +%<*ja> +\item ファミリがリスト$N_{\mathrm{A}}$に既に含まれていれば,それは + が欧文フォントファミリではないことを意味するので,欧文フォントファミリは変更されない. +% +%<*en> +\item If there exists an alphabetic font encoding such that the family~ has been + defined under it, current alphabetic font family will be changed to , and + is appended to the list~$F_{\mathrm{A}}$. +% +%<*ja> +\item ある欧文フォントエンコーディング下でファミリが定義されていれば, + リスト$F_{\mathrm{A}}$にを追加し,欧文フォントファミリはに変更される. +% +%<*en> +\item Now \LuaTeX-ja looks whether there exists an alphabetic font encoding~ such that + a font definition named \texttt{.fd} (the file name is + all lowercase) exists. If so, current alphabetic font family will be changed to + ~(the font definition file won't be loaded here). + If not, current alphabetic font family won't be changed, and + is appended to the list~$N_{\mathrm{A}}$. +% +%<*ja> +\item 最終段階では,欧文エンコーディングで +フォント定義ファイル\texttt{.fd}(ファイル名は全て小文字)が存在するようなも + のがあるかどうかを調べる. +存在すれば,欧文フォントファミリはに変更される(フォント定義ファイルは変更されな + い). +存在しなければ,リスト$N_{\mathrm{A}}$にを追加するだけで,欧文フォントファミリは変更されない. + +% +\end{enumerate} +%<*en> +Of course, there is a case that ``Japanese font family nor alphabetic font family is changed''. +In this case, \LuaTeX-ja treats ``the argument is wrong'', so +the default family for font substitution is used for alphabetic and Japanese fonts. +%%% Note that current font encoding will not +%%% be set to , unlike the original implementation in \LaTeX. +Note that the execution of \cs{DeclareFontFamily} \emph{after} loading of \LuaTeX-ja makes +the second argument (family) is appended to the list~$F_{\mathrm{A}}$. +% +%<*ja> +さて,引数によっては,「和文フォントファミリも欧文フォントファミリも変更されませんでした」 +という時代もあり得る. + この場合,引数は不正だった,ということになるので, +代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと + 和文フォントに用いられる. +%%%LaTeX のオリジナルの実装とは異なり, +%%% 現在のエンコーディングはには設定されないことに注意する. + +なお,\cs{DeclareFontFamily}を\LuaTeX-jaの読み込み後に実行した場合は, +第2引数(ファミリ名)が自動的に$F_{\mathrm{A}}$に追加される. +% \begin{figure}[!tb] \begin{LTXexample}[pos=b]