\usepackage{luatexja-otf}
%<ja>\usepackage{lmodern}
\directlua{luatexja.otf.enable_ivs()}
+\usepackage[match]{luatexja-fontspec}
\usepackage[kozuka-pr6n]{luatexja-preset}
+\setmonojfont{KozGoPr6N-Regular.otf}
%<*ja>
\def\emph#1{\textbf{\textgt{#1}}}
\def\headfont{\normalfont\bfseries\gtfamily}
\setmathfont{xits-math.otf}
\frenchspacing
%</en>
-\DeclareRobustCommand\ttfamily
- {\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\ttjfam\selectfont}
-\newjfontfamily\ttjfam{KozGoPr6N-Regular.otf}
-
%%%%%%%% logo
\usepackage{metalogo}
日本語文書を組版するためには,\texttt{article.cls}, \texttt{book.cls}といった
欧文用のクラスファイルではなく,和文用のクラスファイルを用いた方がよい.
現時点では,\Pkg{jclasses}(\pLaTeX の標準クラス)と\Pkg{jsclasses}
-ï¼\88奥æ\9d\91æ\99´å½¦æ°\8fã\81«ã\82\88ã\82\8bã\82¯ã\83©ã\82¹ã\83\95ã\82¡ã\82¤ã\83«)に対応するものとして,\Pkg{ltjclasses},
+ï¼\88奥æ\9d\91æ\99´å½¦æ°\8fã\81«ã\82\88ã\82\8bã\80\8c\pLaTeXe æ\96°ã\83\89ã\82ã\83¥ã\83¡ã\83³ã\83\88ã\82¯ã\83©ã\82¹ã\80\8d)に対応するものとして,\Pkg{ltjclasses},
\Pkg{ltjsclasses}がそれぞれ用意されている.
%</ja>
\label{ssec-fontspec}
%<*en>
To coexist with the \Pkg{fontspec} package, it is needed to load
-\Pkg{luatexja-fontspec} package in the preamble. This additional
-package automatically loads \Pkg{luatexja} and \Pkg{fontspec}
+\Pkg{luatexja-fontspec} package in the preamble, as follows:
+\begin{quote}
+\ttfamily \textbackslash usepackage[<options>]\{luatexja-fontspec\}
+\end{quote}
+This \Pkg{luatexja-fontspec} package
+automatically loads \Pkg{luatexja} and \Pkg{fontspec}
package, if needed.
%</en>
%<*ja>
-\Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いるためには,
-\Pkg{luatexja-fontspec}パッケージをプリアンブルで読み込む必要がある.このパッケージ
+\Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いる場合,
+\Pkg{luatexja-fontspec}パッケージを読み込む:
+\begin{quote}
+\ttfamily \textbackslash usepackage[<options>]\{luatexja-fontspec\}
+\end{quote}
+このパッケージ
は必要ならば自動で\Pkg{luatexja}パッケージと\Pkg{fontspec}パッケージを読み込む.
%</ja>
\Pkg{luatexja-fontspec}パッケージでは,以下の7つのコマンドを\Pkg{fontspec}
パッケージの元のコマンドに対応するものとして定義している:
%</ja>
-
%<*en>
\begin{center}\small
\begin{tabular}{ccccc}
\toprule
Japanese fonts
-&\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\newjfontfamily+\\
+&\verb+\jfontspec+&\verb+\setmainjfont+&\verb+\setsansjfont+&\verb+\setmonojfont+$^*$\\
alphabetic fonts
-&\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\newfontfamily+\\
+&\verb+\fontspec+&\verb+\setmainfont+&\verb+\setsansfont+&\verb+\setmonofont+\\
\midrule
Japanese fonts
-&\verb+\newjfontface+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
+&\verb+\newjfontfamily+&\verb+\newjfontface+
+&\verb+\defaultjfontfeatures+&\verb+\addjfontfeatures+\\
alphabetic fonts
-&\verb+\newfontface+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
+&\verb+\newfontfamily+&\verb+\newfontface+
+&\verb+\defaultfontfeatures+&\verb+\addfontfeatures+\\
\bottomrule
\end{tabular}
\end{center}
\end{tabular}
\end{center}
%</ja>
-\begin{LTXexample}[width=0.4\textwidth]
-\fontspec[Numbers=OldStyle]{LMSans10-Regular}
-\jfontspec[CJKShape=NLC]{KozMinPr6N-Regular}
-JIS~X~0213:2004→辻
+%<*en>
+The package option of \Pkg{luatexja-fontspec} are the followings:
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
+ \item[match] If this option is specified, usual family-changing commands such as
+\verb+\rmfamily+,~\verb+\textrm+, \verb+\sffamily+,~\dots\ also change Japanese font family.
-\jfontspec[CJKShape=JIS1990]{KozMinPr6N-Regular}
-JIS~X~0208:1990→辻
-\end{LTXexample}
+Note that \emph{\texttt{\textup{\textbackslash setmonojfont}} is defined
+if and only if this \texttt{\textup{match}} option is specified}.
-%<*en>
-Note that there is no command named \verb+\setmonojfont+, since it is
-popular for Japanese fonts that nearly all Japanese glyphs have same
+ \item[pass=<opts>]
+Specify options <opts> which will be passed to the \Pkg{fontspec} package.
+\end{list}
+The reason that \verb+\setmonojfont+ is not defined by default is that
+it is popular for Japanese fonts that nearly all Japanese glyphs have same
widths. Also note that kerning information in a font is not used
-(that is, \texttt{kern} feature is set off) by default in these seven commands.
+(that is, \texttt{kern} feature is set off) by default in these seven (or~eight) commands.
This is because of the compatibility with previous versions of \LuaTeX-ja
(see \ref{para-kern}).
%</en>
%<*ja>
-和文フォントについては全ての和文文字のグリフがほぼ等幅であるのが普通であるため,
-\verb+\setmonojfont+ コマンドは存在しないことに注意.また,これらの和文用の7つのコマ
-ンドではフォント内のペアカーニング情報は標準では使用されない,
+\Pkg{luatexja-fontspec} パッケージのオプションは以下の通りである:
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
+ \item[match] このオプションが指定されると,「\pLaTeXe 新ドキュメントクラス」のように\
+\verb+\rmfamily+, \verb+\textrm{...}+, \verb+\sffamily+ 等が
+欧文フォントだけでなく和文フォントも変更するようになる.
+
+\emph{なお,{\tt \textbackslash setmonojfont} はこの \texttt{match} オプションが
+指定された時のみ定義される.}この命令は標準の「タイプライタ体に対応する和文フォント」を指定する.
+
+ \item[pass=<opts>]
+\Pkg{fontspec} パッケージに渡すオプション <opts> を指定する.
+\end{list}
+標準で \verb+\setmonojfont+ コマンドが定義されないのは,
+和文フォントではほぼ全ての和文文字のグリフが等幅であるのが伝統的であったことによる.
+また,これらの和文用のコマンドではフォント内のペアカーニング情報は標準では使用されない,
言い換えれば \texttt{kern} featureは標準では無効化となっている.
これは以前のバージョンの\LuaTeX-jaとの互換性のためである(\ref{para-kern}節を参照).
%</ja>
+\begin{LTXexample}[width=0.4\textwidth]
+\fontspec[Numbers=OldStyle]{LMSans10-Regular}
+\jfontspec[CJKShape=NLC]{KozMinPr6N-Regular}
+JIS~X~0213:2004→辻
+
+\jfontspec[CJKShape=JIS1990]{KozMinPr6N-Regular}
+JIS~X~0208:1990→辻
+\end{LTXexample}
+
%<en>\subsection{Presets}
%<ja>\subsection{プリセット設定}
\label{ssec-preset}
\verb+\input+ で読み込み可能である.
%</ja>
\subsection{\texttt{luatexja-fontspec.sty}}
+\label{ssec-fontspec2}
%<*en>
As described in Subsection~\ref{ssec-fontspec}, this optional package
provides the counterparts for several commands defined in the
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-fontspec}[2014/01/23 fontspec support of LuaTeX-ja]
-
-\RequirePackage{fontspec,luatexja}
+\ProvidesPackage{luatexja-fontspec}[2014/03/25 fontspec support of LuaTeX-ja]
+\RequirePackage{l3keys2e,luatexja}
\ExplSyntaxOn
+\bool_new:N \ltj_fontspec_match
+\cs_set:Nn \ltj_fontspec_pass_opts: {}
+\keys_define:nn { luatexja-fontspec }
+ {
+ match .bool_set:N = \ltj_fontspec_match,
+ match .default:n = true,
+ pass .code:n = \cs_set:Nn \ltj_fontspec_pass_opts: {#1},
+ }
+\ProcessKeysOptions { luatexja-fontspec }
+\RequirePackage[\ltj_fontspec_pass_opts:]{fontspec}
+
+%%%%%%%% Change Japanese font family by \rmfamily or not
+\bool_if:NTF \ltj_fontspec_match
+{
+ \renewcommand\jttdefault{\gtdefault}
+ \DeclareRobustCommand\rmfamily
+ {\not@math@alphabet\rmfamily\mathrm
+ \romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
+ \DeclareRobustCommand\sffamily
+ {\not@math@alphabet\sffamily\mathsf
+ \romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
+ \DeclareRobustCommand\ttfamily
+ {\not@math@alphabet\ttfamily\mathtt
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
+ \DeclareDocumentCommand \setmonojfont { O{} m } {
+ \ltj_fontspec_set_family:Nnn \jttdefault {#1}{#2}
+ \normalfont
+ }
+}{
+}
+
%%%%%%%% Messages
\cs_new:Npn \ltj_fontspec_warning:n { \msg_warning:nn {ltj-fontspec} }
%% \DeclareFontShape{JT3}{gt}{m}{sl}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{it}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
+\renewcommand\jttdefault{\gtdefault}
\DeclareRobustCommand\rmfamily
{\not@math@alphabet\rmfamily\mathrm
\romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
\romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
%%
\AtBeginDocument{%
\reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc}
%% \DeclareFontShape{JT3}{gt}{m}{sl}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{it}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
+\renewcommand\jttdefault{\gtdefault}
\DeclareRobustCommand\rmfamily
{\not@math@alphabet\rmfamily\mathrm
\romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
\romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
%%
\AtBeginDocument{%
\reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc}
% これがあると |grfext.sty| を読み込んだ際にエラーを引き起こすので削除しました。
% \end{itemize}
%
-% [2014-02-07] jsclasses 2014-02-07 ベースにしました.
+% [2014-02-07 LTJ] jsclasses 2014-02-07 ベースにしました.
%
% \StopEventually{}
%
% 和文でイタリック体,斜体,サンセリフ体,
% タイプライタ体の代わりにゴシック体を使うことにします。
%
+% [2014-03-25 LTJ] タイプライタ体に合わせるファミリを |\jttdefault| とし,
+% 通常のゴシック体と別にできるようにしました.|\jttdefault| は,標準で
+% |\gtdefault| と定義しています.
+%
% [2003-03-16] イタリック体,斜体について,和文でゴシックを当てていましたが,
% 数学の定理環境などで多量のイタリック体を使うことがあり,ゴシックに
% すると黒々となってしまうという弊害がありました。
%% \DeclareFontShape{JT3}{gt}{m}{sl}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{it}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
+\renewcommand\jttdefault{\gtdefault}
\DeclareRobustCommand\rmfamily
{\not@math@alphabet\rmfamily\mathrm
\romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
\romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
% \end{macrocode}
%%
% Lua\TeX-jaでは和文組版に伴うグルーはノードベースで挿入するようになり,また
% はトンボの内側に |1in| のスペース(|1truein| ではなく)を挿入するので,
% 場合分けしています。
%
-% [2011-10-03] Lua\TeX{} (pdf\TeX?) では |1truein| ではなく
+% [2011-10-03 LTJ] Lua\TeX{} (pdf\TeX?) では |1truein| ではなく
% |1in| になるようです。
%
% \begin{macrocode}
% [2003-06-26] |\headheight| を |\topskip| に直しました。
% 以前はこの二つは値が同じであったので,変化はないはずです。
%
-% [2011-10-03] ここも |\oddsidemargin| のときと同様に |-\inv@mag in| ではなく
+% [2011-10-03 LTJ] ここも |\oddsidemargin| のときと同様に |-\inv@mag in| ではなく
% |-1in| にします。
%
% \begin{macrocode}
% 二つ挿入した |\everyparhook| のうち後者が |\paragraph| 類の後で2回実行され,
% それ以降は前者が実行されます。
%
-% [2011-10-05] Lua\TeX-jaでは |\everyparhook| は不要なので削除。
+% [2011-10-05 LTJ] Lua\TeX-jaでは |\everyparhook| は不要なので削除。
%
% \begin{macrocode}
\def\@xsect#1{%
%
% 段落頭のかぎかっこなどを見かけ1字半下げから全角1字下げに直します。
%
-% [2012-04-24] LuaTeX-jaではJFMに段落開始時の括弧類の字下げ幅をコントロール
+% [2012-04-24 LTJ] LuaTeX-jaではJFMに段落開始時の括弧類の字下げ幅をコントロール
% する機能がありますが,|\item| 直後ではラベル用のボックスが段落先頭になる
% ため,うまく働きませんでした.形を変えて復活させます.
%
%% \DeclareFontShape{JT3}{gt}{m}{sl}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{it}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
+\renewcommand\jttdefault{\gtdefault}
\DeclareRobustCommand\rmfamily
{\not@math@alphabet\rmfamily\mathrm
\romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
\romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
%%
\AtBeginDocument{%
\reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc}
%% \DeclareFontShape{JT3}{gt}{m}{sl}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{it}{<->ssub*gt/m/n}{}
%% \DeclareFontShape{JT3}{mc}{bx}{sl}{<->ssub*gt/m/n}{}
+\renewcommand\jttdefault{\gtdefault}
\DeclareRobustCommand\rmfamily
{\not@math@alphabet\rmfamily\mathrm
\romanfamily\rmdefault\kanjifamily\mcdefault\selectfont}
\romanfamily\sfdefault\kanjifamily\gtdefault\selectfont}
\DeclareRobustCommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
- \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont}
+ \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont}
%%
\AtBeginDocument{%
\reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc}
\newcommand\mcdefault{mc}
\newcommand\gtdefault{gt}
+\newcommand\jttdefault{\gtdefault}
\newcommand\kanjiencodingdefault{JY3}
\newcommand\kanjifamilydefault{\mcdefault}
\newcommand\kanjiseriesdefault{\mddefault}
\DeclareFontShape{JY3}{mc}{bx}{n}{<-> ssub*gt/m/n}{}
\DeclareFontShape{JY3}{gt}{bx}{n}{<-> ssub*gt/m/n}{}
-%fontencoding{JT3}\selectfont
\kanjiencoding{JY3}\selectfont\adjustbaseline
\DeclareTextFontCommand{\textmc}{\mcfamily}