From 0f8db6b48459d4fbfa7497448127e65515a2e195 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 7 Sep 2020 21:21:12 +0000 Subject: bxjscls (7sep20) git-svn-id: svn://tug.org/texlive/trunk@56285 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx | 354 ++++++++++++++++----- 1 file changed, 267 insertions(+), 87 deletions(-) (limited to 'Master/texmf-dist/source/latex/bxjscls') diff --git a/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx b/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx index 6c76dbe6ee7..2b949d2c92c 100644 --- a/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx +++ b/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx @@ -56,7 +56,8 @@ %<*driver> \ProvidesFile{bxjscls.dtx} % - [2020/05/28 v2.1 BXJS document classes] + [2020/09/04 v2.2 BXJS document classes] +% [2020/05/28 v2.1 BXJS document classes] % [2020/04/04 v2.0a BXJS document classes] % [2020/03/25 v2.0 BXJS document classes] % [2020/02/15 v1.9k BXJS document classes] @@ -782,23 +783,52 @@ \DeclareOption{a4paper}{\bxjs@setpaper{a4paper}} \DeclareOption{a5paper}{\bxjs@setpaper{a5paper}} \DeclareOption{a6paper}{\bxjs@setpaper{a6paper}} -\DeclareOption{b4paper}{\bxjs@setpaper{{257truemm}{364truemm}}} -\DeclareOption{b5paper}{\bxjs@setpaper{{182truemm}{257truemm}}} -\DeclareOption{b6paper}{\bxjs@setpaper{{128truemm}{182truemm}}} +\DeclareOption{b4paper}{\bxjs@setpaper{b4j}} +\DeclareOption{b5paper}{\bxjs@setpaper{b5j}} +\DeclareOption{b6paper}{\bxjs@setpaper{b6j}} \DeclareOption{a4j}{\bxjs@setpaper{a4paper}} \DeclareOption{a5j}{\bxjs@setpaper{a5paper}} -\DeclareOption{b4j}{\bxjs@setpaper{{257truemm}{364truemm}}} -\DeclareOption{b5j}{\bxjs@setpaper{{182truemm}{257truemm}}} +\DeclareOption{b4j}{\bxjs@setpaper{b4j}} +\DeclareOption{b5j}{\bxjs@setpaper{b5j}} \DeclareOption{a4var}{\bxjs@setpaper{{210truemm}{283truemm}}} \DeclareOption{b5var}{\bxjs@setpaper{{182truemm}{230truemm}}} +\DeclareOption{letterpaper}{\bxjs@setpaper{letterpaper}} +\DeclareOption{legalpaper}{\bxjs@setpaper{legalpaper}} +\DeclareOption{executivepaper}{\bxjs@setpaper{executivepaper}} +% \end{macrocode} +% |geometry| の用紙サイズのオプション名を全てサポートする。 +% \begin{macrocode} +\def\bxjs@tmpb#1#2{\DeclareOption{#1}{\bxjs@setpaper{#2}}} +\@for\bxjs@tmpa:={% + a0,a1,a2,c0,c1,c2,c3,c4,c5,c6,ansia,ansib,ansic,ansid,ansie% +}\do{\edef\bxjs@next{% + \noexpand\bxjs@tmpb{\bxjs@tmpa paper}{\bxjs@tmpa paper}% +}\bxjs@next} +\bxjs@tmpb{screen}{screen} +% \end{macrocode} +% ただし |b?paper| はJISのB列に従う。 +% \begin{macrocode} +\@for\bxjs@tmpa:={0,1,2,3}\do{\edef\bxjs@next{% + \noexpand\bxjs@tmpb{b\bxjs@tmpa paper}{b\bxjs@tmpa j}% +}\bxjs@next} % \end{macrocode} -% \Note |...var| をPandocで使えるように後ろに |paper| をつけた形を用意する。 +% |B?paper| でISOのB列を指定できるようにする。 +% \begin{macrocode} +\@for\bxjs@tmpa:={0,1,2,3,4,5,6}\do{\edef\bxjs@next{% + \noexpand\bxjs@tmpb{A\bxjs@tmpa paper}{a\bxjs@tmpa paper}% + \noexpand\bxjs@tmpb{B\bxjs@tmpa paper}{b\bxjs@tmpa paper}% +}\bxjs@next} +% \end{macrocode} +% Pandocでは用紙サイズ指定について「後ろに |paper| を付けた名前 +% のオプション」を指定する。 +% これに対処するため、後ろに |paper| をつけた形を用意する。 +% さらに、「用紙サイズを |custom| とすると何も設定しない」ように +% するため |custompaper| というオプションを用意する。 % \begin{macrocode} \DeclareOption{a4varpaper}{\bxjs@setpaper{{210truemm}{283truemm}}} \DeclareOption{b5varpaper}{\bxjs@setpaper{{182truemm}{230truemm}}} -\DeclareOption{letterpaper}{\bxjs@setpaper{letterpaper}} -\DeclareOption{legalpaper}{\bxjs@setpaper{legalpaper}} -\DeclareOption{executivepaper}{\bxjs@setpaper{executivepaper}} +\DeclareOption{screenpaper}{\bxjs@setpaper{screen}} +\DeclareOption{custompaper}{} % \end{macrocode} % \end{ZRnote} % @@ -1977,16 +2007,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\ifbxjs@strong@cmd} -% 〔スイッチ〕 |strong-cmd| の指定値。 -% \begin{macrocode} -\newif\ifbxjs@strong@cmd \bxjs@strong@cmdtrue -\let\bxjs@kv@strongcmd@true\bxjs@strong@cmdtrue -\let\bxjs@kv@strongcmd@false\bxjs@strong@cmdfalse -\define@key{bxjs}{strong-cmd}[true]{\bxjs@set@keyval{strongcmd}{#1}{}} -% \end{macrocode} -% \end{macro} -% % \end{ZRnote} % % \paragraph{オプションの実行} @@ -2679,35 +2699,6 @@ % \end{macrocode} % \end{macro} % -% \begin{ZRnote} -% \begin{macro}{\strong} -% \begin{environment}{strongenv} -% |fontspec| で提供される |\strong| 命令と |strongenv| 環境を -% 全てのエンジンで使えるようにする。 -% \Note -% \begin{macrocode} -\ifbxjs@strong@cmd\jsAtEndOfClass{% - \ifx\strong\@undefined\ifx\strongenv\@undefined - \DeclareRobustCommand{\strongenv}{\bxjs@strong@font}% - \DeclareTextFontCommand{\strong}{\strongenv}% -% \end{macrocode} -% |fontspec| と互換の |\strongfontdeclare| 命令も提供する。 -% ただし、BXJSでの |\strong| は多段階には対応しないので、 -% 引数のコンマ区切りリストのうちの先頭の項目だけが意味をもつ。 -% 既定の設定は |\bfseries|(太字)である。 -% \Note |\strongfontdeclare| は試験的機能とする。 -% \begin{macrocode} - \@ifdefinable{\strongfontdeclare}{\bxjs@protected\def\strongfontdeclare#1{% - \bxjs@strong@font@declare@a#1,\@nil}}% - \def\bxjs@strong@font@declare@a#1,#2\@nil{\def\bxjs@strong@font{#1}}% - \def\bxjs@strong@font{\bfseries}% - \fi\fi -}\fi -% \end{macrocode} -% \end{environment} -% \end{macro} -% \end{ZRnote} -% % \section{フォントサイズ} % % フォントサイズを変える命令(|\normalsize|,|\small| など) @@ -8945,15 +8936,8 @@ % % \paragraph{和文フォント指定の扱い} % -% |standard| 和文ドライバでは |\jsJaFont| の値を和文フォントの -% “プリセット”の指定として用いる。 -% プリセットの値は、{\TeX} Liveの |kanji-config-updmap| コマンドで -% 使う“ファミリ”と同じにすることを想定する。 -% 特別な値として、|auto| は |kanji-config-updmap| で現在指定 -% されているファミリを表す。 -% %^^A---------------- -% \subsection{共通処理(1)} +% \subsection{準備} % % まず minimal ドライバを読み込む。 % \begin{macrocode} @@ -8967,7 +8951,8 @@ \bxjs@simplejasetupfalse % \end{macrocode} % -% \paragraph{japaramオプションの処理} +%^^A---------------- +% \subsection{和文ドライバパラメタ} % % |japaram| の値をkey-valueリストとして解釈する。 % keyvalのファミリは |bxjsStd| とする。 @@ -9016,12 +9001,29 @@ \edef\bxjs@jp@font{#1}} % \end{macrocode} % +% \begin{macro}{\ifbxjs@jp@strong@cmd} +% |\strong| 命令を補填するか。 +% \begin{macrocode} +\newif\ifbxjs@jp@strong@cmd \bxjs@jp@strong@cmdtrue +% \end{macrocode} +% +% |strong-cmd| オプションの処理。 +% \begin{macrocode} +\let\bxjs@kv@strongcmd@true\bxjs@jp@strong@cmdtrue +\let\bxjs@kv@strongcmd@false\bxjs@jp@strong@cmdfalse +\define@key{bxjs}{strong-cmd}[true]{\bxjs@set@keyval{strongcmd}{#1}{}} +% \end{macrocode} +% \end{macro} +% % 実際の |japaram| の値を適用する。 % \begin{macrocode} \def\bxjs@next#1{\bxjs@safe@setkeys{bxjsStd}{#1}} \expandafter\bxjs@next\expandafter{\jsJaParam} % \end{macrocode} % +%^^A---------------- +% \subsection{共通処理(1)} +% % \paragraph{jis2004パラメタ} % % |jis2004| パラメタが有効の場合は、グローバルオプションに |jis2004| @@ -9091,6 +9093,35 @@ % \end{macrocode} % \end{macro} % +% \paragraph{\textbackslash strong命令の補填} +% +% \begin{macro}{\strong} +% \begin{environment}{strongenv} +% |fontspec| で提供される |\strong| 命令と |strongenv| 環境を +% 全てのエンジンで使えるようにする。 +% \Note +% \begin{macrocode} +\ifbxjs@jp@strong@cmd\jsAtEndOfClass{% + \ifx\strong\@undefined\ifx\strongenv\@undefined + \DeclareRobustCommand{\strongenv}{\bxjs@strong@font}% + \DeclareTextFontCommand{\strong}{\strongenv}% +% \end{macrocode} +% |fontspec| と互換の |\strongfontdeclare| 命令も提供する。 +% ただし、BXJSでの |\strong| は多段階には対応しないので、 +% 引数のコンマ区切りリストのうちの先頭の項目だけが意味をもつ。 +% 既定の設定は |\bfseries|(太字)である。 +% \Note |\strongfontdeclare| は試験的機能とする。 +% \begin{macrocode} + \@ifdefinable{\strongfontdeclare}{\bxjs@protected\def\strongfontdeclare#1{% + \bxjs@strong@font@declare@a#1,\@nil}}% + \def\bxjs@strong@font@declare@a#1,#2\@nil{\def\bxjs@strong@font{#1}}% + \def\bxjs@strong@font{\bfseries}% + \fi\fi +}\fi +% \end{macrocode} +% \end{environment} +% \end{macro} +% % \paragraph{共通命令の実装} % % |\jQ| 等の「単位」系の共通命令を実装する。 @@ -9281,6 +9312,13 @@ % % \paragraph{和文フォント指定の扱い} % +% |standard| 和文ドライバでは |\jsJaFont| の値を和文フォントの +% “プリセット”の指定として用いる。 +% プリセットの値は、{\TeX} Liveの |kanji-config-updmap| コマンドで +% 使う“ファミリ”と同じにすることを想定する。 +% 特別な値として、|auto| は |kanji-config-updmap| で現在指定 +% されているファミリを表す。 +% % \begin{macro}{\bxjs@adjust@jafont} % |\jsJaFont| に入っている和文フォント設定の値を“調整”して、 % その結果を |\bxjs@tmpa| に返す。 @@ -9369,6 +9407,29 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\bxjs@resolve@jafont@paren} +% |jafont|パラメタ値内の|()|を解決する。 +% |\bxjs@resolve@jafont@paren\CS| で、|\CS| の内容中の |(...)| +% を |\bxjs@jafont@paren{...}| に置き換える。 +% \begin{macrocode} +\@onlypreamble\bxjs@resolve@jafont@paren +\def\bxjs@resolve@jafont@paren#1{% + \def\bxjs@tmpb{\let#1}% + \expandafter\bxjs@resolve@jafont@paren@a#1\@nil()\@nil\relax} +\@onlypreamble\bxjs@resolve@jafont@paren@a +\def\bxjs@resolve@jafont@paren@a#1(#2)#3\@nil#4\relax{% + \ifx\relax#4\relax \bxjs@tmpb\jsJaFont + \else + \edef\bxjs@tmpa{#1\bxjs@jafont@paren{#2}#3}% + \bxjs@tmpb\bxjs@tmpa + \fi} +% \end{macrocode} +% \end{macro} +% +% \paragraph{和文として出力} +% +% 「欧文扱い」となっている文字を和文として出力するための機能。 +% % \begin{macro}{\jachar} % |\jachar{|\meta{文字}|}|\Means % 和文文字として出力する。 @@ -9478,25 +9539,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\bxjs@resolve@jafont@paren} -% |jafont|パラメタ値内の|()|を解決する。 -% |\bxjs@resolve@jafont@paren\CS| で、|\CS| の内容中の |(...)| -% を |\bxjs@jafont@paren{...}| に置き換える。 -% \begin{macrocode} -\@onlypreamble\bxjs@resolve@jafont@paren -\def\bxjs@resolve@jafont@paren#1{% - \def\bxjs@tmpb{\let#1}% - \expandafter\bxjs@resolve@jafont@paren@a#1\@nil()\@nil\relax} -\@onlypreamble\bxjs@resolve@jafont@paren@a -\def\bxjs@resolve@jafont@paren@a#1(#2)#3\@nil#4\relax{% - \ifx\relax#4\relax \bxjs@tmpb\jsJaFont - \else - \edef\bxjs@tmpa{#1\bxjs@jafont@paren{#2}#3}% - \bxjs@tmpb\bxjs@tmpa - \fi} -% \end{macrocode} -% \end{macro} -% %^^A---------------- % \subsection{{\pTeX}用設定} % @@ -10275,7 +10317,7 @@ % \end{macrocode} % %^^A---------------- -%\subsection{フォント設定} +% \subsection{フォント設定} % % T1エンコーディングに変更する。 % \Note 以下のコードは |\usepackage[T1]{fontenc}| と同等。 @@ -10340,7 +10382,13 @@ %^^A======================================================== % \section{和文ドライバ:pandoc \ZRX} % -% Pandoc用の何か。 +% 「Pandocモード」で使用される和文ドライバ。 +% standardドライバの機能を継承するが、 +% 「Pandocの既定のlatexテンプレート」が使われることを前提として、 +% それとBXJSの設定を整合させるための措置を加えている。 +% +%^^A---------------- +% \subsection{準備} % % standardドライバの設定を引き継ぐ。 % \begin{macrocode} @@ -10368,7 +10416,64 @@ % \end{macro} % %^^A---------------- -%\subsection{duploadシステム} +% \subsection{和文ドライバパラメタ} +% +% keyvalのファミリは |bxjsPan| とする。 +% +% \begin{macro}{\ifbxjs@jp@fix@strong} +% 重要要素を補正するか。 +% \begin{macrocode} +\newif\ifbxjs@jp@fix@strong \bxjs@jp@fix@strongtrue +% \end{macrocode} +% \end{macro} +% +% |fix-strong| オプションの処理。 +% \begin{macrocode} +\let\bxjs@kv@fixstrong@true\bxjs@jp@fix@strongtrue +\let\bxjs@kv@fixstrong@false\bxjs@jp@fix@strongfalse +\define@key{bxjsPan}{fix-strong}[true]{% + \bxjs@set@keyval{fixstrong}{#1}{}} +% \end{macrocode} +% +% \begin{macro}{\ifbxjs@jp@fix@code} +% インラインコード要素を補正するか。 +% \begin{macrocode} +\newif\ifbxjs@jp@fix@code \bxjs@jp@fix@codetrue +% \end{macrocode} +% \end{macro} +% +% |fix-code| オプションの処理。 +% \begin{macrocode} +\let\bxjs@kv@fixcode@true\bxjs@jp@fix@codetrue +\let\bxjs@kv@fixcode@false\bxjs@jp@fix@codefalse +\define@key{bxjsPan}{fix-code}[true]{% + \bxjs@set@keyval{fixcode}{#1}{}} +% \end{macrocode} +% +% \begin{macro}{\bxjs@jp@strong} +% 重要要素に適用される書体変更の種類。 +% \begin{macrocode} +\chardef\bxjs@jp@strong=0 +% \end{macrocode} +% \end{macro} +% +% |strong| オプションの処理。 +% \begin{macrocode} +\def\bxjs@kv@strong@bold{\chardef\bxjs@jp@strong=0 } +\def\bxjs@kv@strong@sans{\chardef\bxjs@jp@strong=1 } +\def\bxjs@kv@strong@boldsans{\chardef\bxjs@jp@strong=2 } +\define@key{bxjsPan}{strong}{% + \bxjs@set@keyval{strong}{#1}{}} +% \end{macrocode} +% +% 実際の |japaram| の値を適用する。 +% \begin{macrocode} +\def\bxjs@next#1{\bxjs@safe@setkeys{bxjsPan}{#1}} +\expandafter\bxjs@next\expandafter{\jsJaParam} +% \end{macrocode} +% +%^^A---------------- +% \subsection{duploadシステム} % % パッケージが重複して読み込まれたときに“option clash”の % 検査をスキップする。 @@ -10424,7 +10529,7 @@ % \end{macro} % %^^A---------------- -%\subsection{lang変数} +% \subsection{lang変数} % |lang=ja| という言語指定が行われると、 % Pandocはこれに対応していないため % 不完全なBabelやPolyglossiaの設定を出力してしまう。 @@ -10607,7 +10712,7 @@ % \end{macrocode} % %^^A---------------- -%\subsection{geometry変数} +% \subsection{geometry変数} % |geometry| を“再度読み込んだ”場合に、 % そのパラメタで |\setpagelayout*| が呼ばれるようにする。 % @@ -10617,7 +10722,7 @@ % \end{macrocode} % %^^A---------------- -%\subsection{CJKmainfont変数} +% \subsection{CJKmainfont変数} % Lua{\TeX}(+ Lua{TeX}-ja)の場合に CJKmainfont 変数が % 指定された場合は |\setmainjfont| の指定にまわす。 % \begin{macrocode} @@ -10626,7 +10731,14 @@ \providecommand*{\setCJKmainfont}{\setmainjfont} \fi % \end{macrocode} -% ムニャムニャムニャ。 +% +%^^A---------------- +% \subsection{Option clash対策} +% +% |xeCJK| パッケージについて。 +% \Note |xeCJK| はクラス内で既に読み込まれているので、 +% |space| は(意図通りに)無効になる。 +% \Note v2.8~v2.9.2の間。 % \begin{macrocode} \if x\jsEngine \expandafter\g@addto@macro\csname opt@xeCJK.sty\endcsname{% @@ -10635,7 +10747,7 @@ % \end{macrocode} % %^^A---------------- -%\subsection{paragraphのマーク} +% \subsection{paragraphのマーク} % % BXJSクラスでは |\paragraph| の見出しの前に |\jsParagraphMark| % で指定したマークが付加され、既定ではこれは“■”である。 @@ -10675,7 +10787,7 @@ % \end{macrocode} % %^^A---------------- -%\subsection{全角空白文字} +% \subsection{全角空白文字} % % \begin{macrocode} \ifnum0\if x\jsEngine1\fi\if l\jsEngine1\fi>\z@ @@ -10690,7 +10802,7 @@ % \end{macrocode} % %^^A---------------- -% \paragraph{hyperref対策} +% \subsection{hyperref対策} % % |hyperref| の |unicode| オプションの固定を行う。 % \begin{macrocode} @@ -10702,6 +10814,74 @@ % \end{macrocode} % %^^A---------------- +% \subsection{Pandoc要素に対する和文用の補正} +% +% \paragraph{重要要素} +% 重要(Strong)要素に対する{\LaTeX}出力は |\textbf| となるが、 +% 代わりに |\strong| を使いたいため、 +% |\textbf| を書き換えてしまう(うわぁ)。 +% \begin{macrocode} +\ifbxjs@jp@fix@strong\ifbxjs@jp@strong@cmd + \let\orgtextbf\textbf + \DeclareRobustCommand\bxjstextbf[1]{% + \begingroup + \let\textbf\orgtextbf + \strong{#1}% + \endgroup}% + \g@addto@macro\bxjs@begin@document@hook{% + \let\textbf\bxjstextbf} +\fi\fi +% \end{macrocode} +% +% |\strong| の書体を設定する。 +% \begin{macrocode} +\jsAtEndOfClass{% + \ifx\strongfontdeclare\@undefined\else + \ifcase\bxjs@jp@strong + \or \strongfontdeclare{\sffamily}% + \or \strongfontdeclare{\sffamily\bfseries}% + \fi + \fi} +% \end{macrocode} +% +% \paragraph{インラインコード要素} +% +% インラインコード(Code)要素に対する{\LaTeX}出力は |\texttt| となる。 +% |\texttt| の両端に欧文ゴーストが入るようにする。 +% \begin{macrocode} +\ifbxjs@jp@fix@code + \chardef\bxjs@eghost@c=23 + \ifx j\jsEngine \xspcode\bxjs@eghost@c=3 + \else\ifx l\jsEngine \ltjsetparameter{alxspmode={\bxjs@eghost@c,3}} + \else\ifx x\jsEngine %no-op + \else \let\bxjs@eghost@c\@undefined + \fi\fi\fi + \ifx\bxjs@eghost@c\@undefined\else + \font\bxjs@eghost@f=ec-lmr10 at 1.23456pt + \def\bxjs@pan@eghost{\bxjs@eghost@f\bxjs@eghost@c} + \let\orgtexttt\texttt + \DeclareRobustCommand\bxjstexttt[1]{% + \ifmmode \nfss@text{\ttfamily #1}% + \else + \ifvmode \leavevmode \fi + \bxjs@pan@eghost\null + \begingroup \ttfamily #1\endgroup + \null\bxjs@pan@eghost + \fi} + \g@addto@macro\bxjs@begin@document@hook{% + \let\texttt\bxjstexttt} +% \end{macrocode} +% さらに |\verb| の外側にも欧文ゴーストが入るようにする。 +% \Note |bxjaghost| の実装を参考にした。 +% \begin{macrocode} + \expandafter\def\expandafter\verb\expandafter{% + \expandafter\bxjs@pan@eghost\verb} + \g@addto@macro\verb@egroup{\bxjs@pan@eghost} + \fi +\fi +% \end{macrocode} +% +%^^A---------------- % \subsection{完了} % おしまい。 % \begin{macrocode} -- cgit v1.2.3