OSDN Git Service

Update manuals to match current lltjfont.sty
[luatex-ja/luatexja.git] / doc / luatexja.dtx
index c5b7bea..1c30699 100644 (file)
@@ -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. ...
 %</en>
 %<*ja>
 \paragraph{組方向}
-版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている.
+20150420.0版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている.
 なお,\LuaTeX 本体も,$\Omega$流の組方向をサポートしているが,それとは全くの別物であること
 に注意してほしい.
 \LuaTeX のコールバックや実装により,特に異なった組方向のボックスを扱う場合には
@@ -519,16 +521,16 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}.
 %<ja>\paragraph{プロジェクトWiki} プロジェクトWikiは構築中である.
 %<*en>
 \begin{itemize}
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28zh%29} (Chinese)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28zh%29} (Chinese)
 \end{itemize}
 %</en>
 %<*ja>
 \begin{itemize}
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
-\item \url{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28zh%29}(中国語)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage}(日本語)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}(英語)
+\item \url{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28zh%29}(中国語)
 \end{itemize}
 %</ja>
 
@@ -743,6 +745,20 @@ For changes from \pTeX, see Subsection~\ref{ssec:chgptex}.
       従来日本語の文字コードとして用いられてきたEUC-JPやShift-JISは使用できない.
 %</ja>
 %<*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}.
+%</en>
+%<*ja>
+\item 
+標準では,\LuaTeX-jaはギリシャ文字やキリル文字,それに\P や\S などの記号を和文フォントを使っ
+      て組む.ギリシャ語などを本格的に組むなどこの状況が望ましくない場合,
+      プリアンブルに \lstinline!\ltjsetparameter{jacharrange={-2,-3,-8}}! を入れると
+      上記種類の文字は欧文フォントを用いて組まれるようになる.
+      詳しい説明は\ref{ssec-setrange}節を参照してほしい.
+%</ja>
+%<*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 よりも遅くなることもある.
 %</ja>
+
 \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 ではそのようになっていないので,次のエラーが発生するだろう:
 %</ja>
 \begin{lstlisting}
 ! LuaTeX error ...iles (x86)/MiKTeX 2.9/tex/luatex/luatexja/ltj-rmlgbm.lua
@@ -777,13 +794,14 @@ bad argument #1 to 'open' (string expected, got nil)
 
 %<*en>
 If so, please execute a batch file which is written on
-\href{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{ the Project Wiki (English)}.
+\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.
 %</en>
 %<*ja>
 そのような場合には,
-\href{http://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{%
+\href{https://osdn.jp/projects/luatex-ja/wiki/FrontPage%28en%29}{%
   プロジェクトWiki英語版トップページ}中に書かれているバッチファイルを
 実行して欲しい.このバッチファイルは,作業用ディレクトリにCMap達を
 コピーし,その中で\LuaTeX-ja の初回起動を行い,作業用ディレクトリを消す作業をしている.
@@ -1087,13 +1105,12 @@ For \LaTeXe, \LuaTeX-ja adopted most of the font selection system of \pLaTeXe\ (
 %</ja>
 \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.
 %</en>
 %<*ja>
-\item 和文フォントの属性を変更するには,\cs{fontfamily}, \cs{fontseries}, \cs{fontshape},
-      ã\81\9dã\81\97ã\81¦ã\81\9dã\82\8cã\82\89ã\82\92å\8f\8dæ\98 ã\81\95ã\81\9bã\82\8bã\81\9fã\82\81ã\81« \cs{selectfont} ã\82\92ç\94¨ã\81\84ã\82\8cã\81°ã\82\88ã\81\84
+\item 和文フォントの属性を変更するには,\cs{fontfamily}, \cs{fontseries}, \cs{fontshape} を使用する.
+      ã\82\82ã\81¡ã\82\8dã\82\93ï¼\8cã\81\9dã\82\8cã\82\89ã\82\92å®\9fé\9a\9bã\81«å\8f\8dæ\98 ã\81\95ã\81\9bã\82\8bã\81«ã\81¯æ\89\8bå\8b\95ã\81§ \cs{selectfont} ã\82\92å®\9fè¡\8cã\81\99ã\82\8bå¿\85è¦\81ã\81\8cã\81\82ã\82\8b
 %</ja>
 
 %<*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}:
 %</en>
 %<*ja>
 \item 和文フォントファミリの定義には \cs{DeclareFontFamily} の
-      代わりに \cs{DeclareKanjiFamily} を用いる.しかし,現在の
-      実装では \cs{DeclareFontFamily} を用いても問題は生じない.
+      代わりに \cs{DeclareKanjiFamily} を用いる.以前の
+      実装では \cs{DeclareFontFamily} を用いても問題は生じなかったが,現在の実装では
+      そうはいかない.
 \item 和文フォントのシェイプを定義するには,通常の \cs{DeclareFontShape} を使えば良い:
 %</ja>
 \begin{lstlisting}
@@ -1928,8 +1947,8 @@ parameters, you have to use commands \cs{ltjsetparameter} and
 用いる.
 %</ja>
 
-%<en>\subsection{Editing the Range of \textbf{JAchar}s}
-%<ja>\subsection{\textbf{JAchar}の範囲の設定}
+%<en>\subsection{Range of \textbf{JAchar}s}
+%<ja>\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}\{<family>\}]
 %<*en>
 As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both})
-to <family>. Which family will be changed is determined as follows:
+to <family>.
+
+First, Whether Japanese font family will be changed is determined by following conditions.
+We use an auxiliary list~$N_{\mathrm{J}}$.
 %</en>
 %<*ja>
 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文,
 和文,\emph{もしくは両方})を<family>に変更する.
-どのファミリが変更されるかは以下のようにして決定される:
+まず,和文フォントファミリが変更されるかは以下の順序で決定される.
+補助的に「和文フォントファミリではない」ファミリを格納したリスト$N_{\mathrm{J}}$を用いる.
 %</ja>
-\begin{itemize}
+\begin{enumerate}
 %<*en>
-\item Let current encoding scheme for Japanese fonts be
-      <ja-enc>. Current Japanese font family will be changed to
-      <family>, if one of the following two conditions is met:
+\item If the family~<family> has been defined already by \cs{DeclareKanjiFamily},
+      current Japanese font family will be changed to <family>.
+      Note that <family> need not be defined under \emph{current} Japanese font encoding.
 %</en>
 %<*ja>
-\item 現在の和文フォントに対するエンコーディングが<ja-enc>であるとしよう.
-  現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに
-  <family>に変更される:
+\item ファミリ<family>が既に \cs{DeclareKanjiFamily} によって定義されている場合,
+      和文フォントファミリは<family>に変更される.
+      ここで,<family>は現在の和文フォントエンコーディングで定義されていなくてもよい.
 %</ja>
-\begin{itemize}
 %<*en>
-\item The family <family> under the encoding <ja-enc> has been already defined by
-      \cs{DeclareKanijFamily}.
+\item If the family~<family> has been listed in a list~$N_{\mathrm{J}}$, this means
+      that <family> is not a Japanese font family, hence current Japanese font family
+      won't be changed.
 %</en>
 %<*ja>
-\item ã\82¨ã\83³ã\82³ã\83¼ã\83\87ã\82£ã\83³ã\82°<ja-enc>ã\81«ã\81\8aã\81\91ã\82\8bã\83\95ã\82¡ã\83\9fã\83ª<family>ã\81\8c
-既に \cs{DeclareKanjiFamily} によって定義されている
+\item ã\83\95ã\82¡ã\83\9fã\83ª<family>ã\81\8cã\83ªã\82¹ã\83\88$N_{\mathrm{J}}$ã\81«æ\97¢ã\81«å\90«ã\81¾ã\82\8cã\81¦ã\81\84ã\82\8cã\81°ï¼\8cã\81\9dã\82\8cã\81¯
+      <family>が和文フォントファミリではないことを意味するので,和文フォントファミリは変更されない
 %</ja>
 %<*en>
-\item A font definition named \texttt{<ja-enc><family>.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~<enc> such that
+      a font definition named \texttt{<enc><family>.fd} (the file name is
+      all lowercase) exists. If so, current Japanese font family will be changed to
+      <family>~(the font definition file won't be loaded here). 
+      If not, current Japanese font family won't be changed, and
+      <family> is appended to the list~$N_{\mathrm{J}}$.
 %</en>
 %<*ja>
-\item フォント定義ファイル\texttt{<ja-enc><family>.fd}(ファイル名は全て小文字)が存在する.
+\item もし\Pkg{luatexja-fontspec}パッケージが読み込まれていれば,ここで終了であり,
+和文フォントファミリは変更されないことになる.
+
+もし\Pkg{luatexja-fontspec}パッケージが読み込まれていなければ,和文エンコーディング<enc>で
+フォント定義ファイル\texttt{<enc><family>.fd}(ファイル名は全て小文字)が存在するようなも
+      のがあるかどうかを調べる.
+存在すれば,和文フォントファミリは<family>に変更される(フォント定義ファイルは変更されな
+      い).
+存在しなければ,リスト$N_{\mathrm{J}}$に<family>を追加するだけで,和文フォントファミリは変更されない.
+
 %</ja>
-\end{itemize}
+\end{enumerate}
+
 %<*en>
-\item Let current encoding scheme for alphabetic fonts be
-      <al-enc>. 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.
 %</en>
 %<*ja>
-\item 現在の欧文フォントに対するエンコーディングを<al-enc>とする.
-  欧文フォントファミリに対しても,上記の基準が用いられる.
+次に,欧文フォントファミリについての判定を述べていく.
+補助的に「欧文フォントファミリと判明した」ファミリのリスト$F_{\textrm{A}}$と,
+「欧文フォントファミリではない」ファミリを格納したリスト$N_{\mathrm{A}}$を用いる.
 %</ja>
+
+\begin{enumerate}
 %<*en>
-\item There is a case which none of the above applies, that is, the font
-      family named <family> doesn't seem to be defined neither under the
-      encoding <ja-enc>, nor under <al-enc>.
-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 <family>, unlike the original implementation in \LaTeX.
+\item If the family~<family> has been listed in a list~$F_{\mathrm{A}}$, 
+      current alphabetic font family will be changed to <family>.
+      Note that <family> need not be defined under \emph{current} alphabetic font encoding.
 %</en>
 %<*ja>
-\item 上記のいずれもが適用されない,つまり<family>が<ja-enc>と<al-enc>の
-  どちらでも定義されないような場合がある.
-  この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
-  和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり,
-  現在のエンコーディングは<family>には設定されないことに注意する.
+\item ファミリ<family>がリスト$F_{\mathrm{A}}$に既に含まれていれば,
+      欧文フォントファミリは<family>に変更される.
+      ここで,<family>は現在の欧文フォントエンコーディングで定義されていなくてもよい.
 %</ja>
-\end{itemize}%
-%<en>\vspace{-\medskipamount}
+%<*en>
+\item If the family~<family> has been listed in a list~$N_{\mathrm{A}}$, this means
+      that <family> is not a alphabetic font family, hence current alphabetic font family
+      won't be changed.
+%</en>
+%<*ja>
+\item ファミリ<family>がリスト$N_{\mathrm{A}}$に既に含まれていれば,それは
+      <family>が欧文フォントファミリではないことを意味するので,欧文フォントファミリは変更されない.
+%</ja>
+%<*en>
+\item If there exists an alphabetic font encoding such that the family~<family> has been
+      defined under it, current alphabetic font family will be changed to <family>, and
+      <family> is appended to the list~$F_{\mathrm{A}}$.
+%</en>
+%<*ja>
+\item ある欧文フォントエンコーディング下でファミリ<family>が定義されていれば,
+      リスト$F_{\mathrm{A}}$に<family>を追加し,欧文フォントファミリは<family>に変更される.
+%</ja>
+%<*en>
+\item Now \LuaTeX-ja looks whether there exists an alphabetic font encoding~<enc> such that
+      a font definition named \texttt{<enc><family>.fd} (the file name is
+      all lowercase) exists. If so, current alphabetic font family will be changed to
+      <family>~(the font definition file won't be loaded here). 
+      If not, current alphabetic font family won't be changed, and
+      <family> is appended to the list~$N_{\mathrm{A}}$.
+%</en>
+%<*ja>
+\item 最終段階では,欧文エンコーディング<enc>で
+フォント定義ファイル\texttt{<enc><family>.fd}(ファイル名は全て小文字)が存在するようなも
+      のがあるかどうかを調べる.
+存在すれば,欧文フォントファミリは<family>に変更される(フォント定義ファイルは変更されな
+      い).
+存在しなければ,リスト$N_{\mathrm{A}}$に<family>を追加するだけで,欧文フォントファミリは変更されない.
+
+%</ja>
+\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 <family> 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 <family>, 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}}$.
+%</en>
+%<*ja>
+さて,引数によっては,「和文フォントファミリも欧文フォントファミリも変更されませんでした」
+という時代もあり得る.
+  この場合,引数<family>は不正だった,ということになるので,
+代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと
+  和文フォントに用いられる.
+%%%LaTeX のオリジナルの実装とは異なり,
+%%%  現在のエンコーディングは<family>には設定されないことに注意する.
+
+なお,\cs{DeclareFontFamily}を\LuaTeX-jaの読み込み後に実行した場合は,
+第2引数(ファミリ名)が自動的に$F_{\mathrm{A}}$に追加される.
+%</ja>
 
 \begin{figure}[!tb]
 \begin{LTXexample}[pos=b]