From 6c1ed7f65a0ecfb3767f69ac91ae8652f5e548d9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Mar 2022 21:08:33 +0000 Subject: bxjscls (20mar22) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62826 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx | 267 ++++++++++++++++----- 1 file changed, 213 insertions(+), 54 deletions(-) (limited to 'Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx') diff --git a/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx b/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx index 92ea5eaa127..233746e4501 100644 --- a/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx +++ b/Master/texmf-dist/source/latex/bxjscls/bxjscls.dtx @@ -33,7 +33,7 @@ % Copyright 1999-2016 Haruhiko Okumura % Copyright 2016-2020 Japanese TeX Development Community % -% Copyright 2013-2021 Takayuki YATO (aka. "ZR") +% Copyright 2013-2022 Takayuki YATO (aka. "ZR") % % \fi % \CheckSum{0} @@ -56,7 +56,8 @@ %<*driver> \ProvidesFile{bxjscls.dtx} % - [2021/05/18 v2.5a BXJS document classes] + [2022/03/20 v2.6 BXJS document classes] +% [2021/05/18 v2.5a BXJS document classes] % [2021/02/02 v2.5 BXJS document classes] % [2021/01/27 v2.4a BXJS document classes] % [2020/10/16 v2.4 BXJS document classes] @@ -481,6 +482,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ifbxjs@explIII} +% 〔スイッチ〕 +% expl3がカーネルに組み込まれているか。 +% \begin{macrocode} +\newif\ifbxjs@explIII +\@ifl@t@r\fmtversion{2020/02/02}{\bxjs@explIIItrue}{} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\ifbxjs@TUenc} % 〔スイッチ〕 % {\LaTeX}の既定のフォントエンコーディングがTUであるか。 @@ -509,6 +519,20 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\bxjs@CGHN} +% カーネルの2021/11/15版の改修で“要素の順が変わった”フック名について、 +% 新仕様の名前を“使用中の{\LaTeX}において正しい名前”に変換する。 +% \Note 例えば、“|package/after/PKG|”は新仕様で +% “|package/PKG/after|”に変更された。 +% \begin{macrocode} +\@ifl@t@r\fmtversion{2021/11/15}{% + \def\bxjs@CGHN#1{#1}% +}{%else + \def\bxjs@CGHN#1{\bxjs@CGHN@a#1//}% + \def\bxjs@CGHN@a#1/#2/#3//{#1/#3/#2}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\bxjs@cond} % |\bxjs@cond\ifXXX|……|\fi{|\Meta{真}|}{|\Meta{偽}|}|\par % {\TeX}のif-文(|\ifXXX|……\Meta{真}|\else|\Meta{偽}|\fi|)を @@ -555,6 +579,37 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\bxjs@trim} +% |\bxjs@trim\CS| で、|\CS| の内容のトークン列を先頭と末尾の +% 空白トークン群を除去したものに置き換える。 +% \begin{macrocode} +\def\bxjs@trim#1{\expandafter\bxjs@trim@a#1\@nil#1} +\def\bxjs@trim@a{\futurelet\bxjs@tmpb\bxjs@trim@b} +\def\bxjs@trim@b{\bxjs@cond\ifx\bxjs@tmpb\@sptoken\fi + {\bxjs@trim@c\bxjs@trim@a}{\bxjs@trim@d}} +\def\bxjs@trim@c#1 {#1} +\def\bxjs@trim@d#1\@nil{\bxjs@trim@e#1\@nil: \@nil\@nnil} +\def\bxjs@trim@e#1 \@nil#2\@nnil{\bxjs@cond\ifx\@nnil#2\@nnil\fi + {\bxjs@trim@f#1\@nnil}{\bxjs@trim@e#1\@nil: \@nil\@nnil}} +\def\bxjs@trim@f#1\@nil#2\@nnil#3{\def#3{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bxjs@set@array@from@clist} +% |\bxjs@set@array@from@clist{|\Meta{配列名接頭辞}|}{|% +% \Meta{コンマ区切りリスト}|}|\Means +% コンマ区切りの値のリストから擬似配列を生成する。 +% \Note 各要素について、先頭・末尾の空白トークン群は除去される。 +% \begin{macrocode} +\def\bxjs@set@array@from@clist#1#2{% + \@tempcnta\z@ + \@for\bxjs@tmpa:=\@empty#2\do{% + \bxjs@trim\bxjs@tmpa \bxjs@cslet{#1/\the\@tempcnta}\bxjs@tmpa + \advance\@tempcnta\@ne} + \bxjs@cslet{#1/\the\@tempcnta}\relax} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\bxjs@gset@tempcnta} % |calc| の整数式を用いて |\@tempcnta| の値を設定する。 % \begin{macrocode} @@ -2243,10 +2298,17 @@ % \Note ただし |ja| 非指定の場合はスキップする % (0.3 版との互換性のため)。 % \begin{macrocode} - \ifx\bxjs@driver@opt\@undefined \ifx\bxjs@jadriver@opt\@undefined\else - \ClassWarningNoLine\bxjs@clsname - {No driver option is given} - \fi\fi + \ifx\bxjs@driver@opt\@undefined + \if \ifbxjs@explIII T\else\ifx\bxjs@jadriver@opt\@undefined F\else T\fi\fi T% + \ClassWarningNoLine\bxjs@clsname + {A driver option is MISSING!!\MessageBreak + You should properly specify one of the valid\MessageBreak + driver options according to the DVI driver\MessageBreak + that is in use:\MessageBreak + \@spaces dvips, dvipdfmx, dviout, xdvi,\MessageBreak + \@spaces nodvidriver} + \fi + \fi % \end{macrocode} % |dvi=XXX| が指定されていた場合は、 % |XXX| が指定された時と同じ動作にする。 @@ -9221,10 +9283,18 @@ % 既定の設定は |\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}% + \newcommand*{\strongfontdeclare}{\bxjs@strongfontdeclare}% + \newcount\bxjs@strong@level + \bxjs@protected\def\bxjs@strongfontdeclare#1{% + \bxjs@set@array@from@clist{bxjs@strong}{#1}% + \bxjs@strong@level\z@}% + \bxjs@strongfontdeclare{\bfseries}% + \def\bxjs@strong@font{% + \bxjs@csletcs{bxjs@tmpa}{bxjs@strong/\the\bxjs@strong@level}% + \ifx\bxjs@tmpa\relax + \advance\bxjs@strong@level\m@ne \bxjs@strong@font + \else \advance\bxjs@strong@level\@ne \bxjs@tmpa + \fi}% \fi\fi }\fi % \end{macrocode} @@ -9822,7 +9892,7 @@ % \begin{macrocode} \ifjsWithupTeX\ifbxjs@old@hook@system\else \IfFileExists{pxjahyper-uni.def}{% - \AddToHook{package/after/hyperref}{\input{pxjahyper-uni.def}} + \AddToHook{\bxjs@CGHN{package/hyperref/after}}{\input{pxjahyper-uni.def}} }{} \fi\fi \fi @@ -10557,6 +10627,24 @@ \fi % \end{macrocode} % +% \begin{macro}{\ifbxjs@bxghost@available} +% 〔スイッチ〕|bxghost| パッケージが利用できるか。 +% \begin{macrocode} +\newif\ifbxjs@bxghost@available +\ifjsWitheTeX + \RequirePackage{pdftexcmds}[2009/09/22]% v0.5 + \IfFileExists{bxghost.sty}{% + \bxjs@bxghost@availabletrue + \@namedef{bxjs@bgbv/79E70A0991967E27981832C84DB5DF99}{1}%v0.2.0 + \ifx\pdf@filemdfivesum\@undefined\else + \expandafter\ifx\csname bxjs@bgbv/\pdf@filemdfivesum{bxghost.sty}% + \endcsname\relax\else \bxjs@bxghost@availablefalse \fi + \fi + }{} +\fi +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\bxjs@endpreamble@hook} % |etoolbox| の |\AtEndPreamble| で実行されるBXJSクラス用のフック。 % \Note {\eTeX}以外では無効になる。 @@ -10685,8 +10773,9 @@ % この時に何らかのコードを実行させることができる。 % % \begin{macro}{\bxjs@set@dupload@proc} -% |\bxjs@set@dupload@proc{|\Meta{ファイル名}|}{|\Meta{定義本体}|}| -% 特定のファイルの読込が |\@filewithoptions| で指示されて、しかも +% |\bxjs@set@dupload@proc{|\Meta{ファイル名}|}{|\Meta{定義本体}|}|\Means +% 指定の名前の特定のファイルの読込が |\@filewithoptions| で +% 指示されて、しかも % そのファイルが読込済である場合に、オプション重複検査をスキップして、 % 代わりに\Meta{定義本体}のコードを実行する。 % このコード中で |#1| は渡されたオプション列のテキストに置換される。 @@ -10698,7 +10787,7 @@ \def\bxjs@set@dupload@proc@a#1{% \@onlypreamble#1\def#1##1} \def\bxjs@unset@dupload@proc#1{% - \expandafter\let\csname bxjs@dlp/#1\endcsname\@undefined} + \bxjs@cslet{bxjs@dlp/#1}\@undefined} % \end{macrocode} % \end{macro} % @@ -10739,6 +10828,9 @@ % Pandocはこれに対応していないため % 不完全なBabelやPolyglossiaの設定を出力してしまう。 % これを防ぐための対策を行う。 +% \Note Pandoc 2.12版で |lang=ja| 指定に対応し、 +% 正しく{\LaTeX}側の言語名 |japanese| に変換されるようになった。 +% しかし、日本語指定の場合は相変わらず調整処理が必要である。 % % \begin{macro}{\bxjs@polyglossia@options} % Polyglossiaのオプション列のテキスト。 @@ -10757,7 +10849,7 @@ % \end{macro} % % \paragraph{Polyglossiaについて} -% つまり{\XeTeX}・{Lua\TeX}の場合。 +% つまり{\XeTeX}および{Lua\TeX}(古いPandocで)の場合。 % \Note この場合 |etoolbox| が使用可能になっている。 % \begin{macrocode} \ifnum0\if x\jsEngine1\fi\if l\jsEngine1\fi>0 @@ -10770,7 +10862,7 @@ \bxjs@set@dupload@proc{polyglossia.sty}{% \bxjs@unset@dupload@proc{polyglossia.sty}% \ClassWarning\bxjs@clsname - {Package polyglossia is required}% + {Package polyglossia is requested}% \def\bxjs@polyglossia@options{#1}% % \end{macrocode} % @@ -10783,33 +10875,27 @@ % \end{macrocode} % もし、言語名が空の |\setmainlanguage{}| が実行された場合は、 % |lang=ja| が指定されたと見なす。 -% \begin{macrocode} - \ifblank{##2}{% - \ClassWarning\bxjs@clsname - {Main language is invalid, thus the fallback\MessageBreak - definitions will be employed}% - \bxjs@pandoc@polyglossia@ja -% \end{macrocode} % 言語名が |japanese| だった場合も同様。 % \begin{macrocode} - }{\ifstrequal{##2}{japanese}{% + \ifboolexpr{test{\ifblank{##2}}or test{\ifstrequal{##2}{japanese}}}{% \ClassWarning\bxjs@clsname - {Main language is japanese, thus the fallback\MessageBreak + {Main language is 'japanese', thus fallback\MessageBreak definitions will be employed}% \bxjs@pandoc@polyglossia@ja % \end{macrocode} -% 言語名が非空ならば、本来の |polyglossia| の処理を実行する。 +% それ以外は、改めて |polyglossia| を読み込んで、 +% 本来の処理を実行する。 % \begin{macrocode} }{%else \ClassWarning\bxjs@clsname - {Main language is valid (##2),\MessageBreak + {Main language is '##2',\MessageBreak thus polyglossia will be loaded}% \csundef{ver@polyglossia.sty}% \edef\bxjs@next{% \noexpand\RequirePackage[\bxjs@polyglossia@options]{polyglossia}[]% }\bxjs@next \setmainlanguage[##1]{##2}% - }}}} + }}} % \end{macrocode} % % プレアンブルで |polyglossia| の読込が指示されなかった場合、 @@ -10866,7 +10952,7 @@ \bxjs@set@dupload@proc{babel.sty}{% \bxjs@unset@dupload@proc{babel.sty}% \ClassWarning\bxjs@clsname - {Package babel is required}% + {Package babel is requested}% % \end{macrocode} % パッケージオプションに言語名が空の |main=| があるかを調べる。 % ある場合は |lang=ja| 対策を実行する。 @@ -10875,23 +10961,25 @@ % \begin{macrocode} \@tempswafalse \let\bxjs@babel@options\@empty \def\bxjs@tmpb{main=}% + \def\bxjs@next{main=japanese}% \@for\bxjs@tmpa:=#1\do{% \ifx\bxjs@tmpa\bxjs@tmpb \@tempswatrue + \else\ifx\bxjs@tmpa\bxjs@next \@tempswatrue \else \edef\bxjs@babel@options{\bxjs@babel@options,\bxjs@tmpa}% - \fi}% + \fi\fi}% \if@tempswa \ClassWarning\bxjs@clsname - {Main language is invalid, so fallback\MessageBreak + {Main language is 'japanese', thus fallback\MessageBreak definitions will be employed}% - \bxjs@pandoc@polyglossia@ja + \bxjs@pandoc@babel@ja % \end{macrocode} % ない場合は、本来の |babel| の処理を実行する。 % \begin{macrocode} \else \ClassWarning\bxjs@clsname - {Main language is valid,\MessageBreak + {Main language is not 'japanese',\MessageBreak thus babel will be loaded}% - \expandafter\let\csname ver@babel.sty\endcsname\@undefined + \bxjs@cslet{ver@babel.sty}\@undefined \RequirePackage[#1]{babel}[]% \fi} % \end{macrocode} @@ -10901,7 +10989,7 @@ % \begin{macrocode} \g@addto@macro\bxjs@endpreamble@hook{% \ifx\bxjs@babel@options\relax - \expandafter\let\csname ver@babel.sty\endcsname\@undefined + \bxjs@cslet{ver@babel.sty}\@undefined \fi} % \end{macrocode} % @@ -10910,7 +10998,7 @@ % \begin{macrocode} \@onlypreamble\bxjs@pandoc@babel@ja \def\bxjs@pandoc@babel@ja{% - \expandafter\let\csname ver@babel.sty\endcsname\@undefined + \bxjs@cslet{ver@babel.sty}\@undefined \edef\bxjs@next{% \noexpand\RequirePackage[\bxjs@babel@options,english]{babel}[]% }\bxjs@next @@ -10996,6 +11084,7 @@ \parindent=\the\parindent\relax \parskip=\the\parskip\relax}} \fi +% \end{macrocode} % % \paragraph{secnumdepthについて} % |secnumdepth| の値を決めるのはnumbersections変数 @@ -11003,13 +11092,18 @@ % やsecnumdepth変数であるが、何れにしても |secnumdepth| % の値は書き換えられる。 % そのため、|secnumdepth| を復帰させる。 +% \begin{macrocode} \ifbxjs@jp@or@secnumdepth\else \bxjs@info@or@ban{secnumdepth} \eappto\bxjs@endpreamble@hook{% \c@secnumdepth=\the\c@secnumdepth\relax} \fi +% \end{macrocode} % % \paragraph{block-headingについて} +% |\paragraph|、|\subparagraph| を別行見出しに変える処理を抑止する。 +% \Note 2.7.1版以前では別行見出し変更が既定で有効であった。 +% \begin{macrocode} \ifbxjs@jp@or@block@heading\else \let\bxjs@frozen@paragraph\paragraph \let\bxjs@frozen@subparagraph\subparagraph @@ -11019,6 +11113,10 @@ \let\paragraph\bxjs@frozen@paragraph \let\subparagraph\bxjs@frozen@subparagraph} \fi +% \end{macrocode} +% +% 以上。 +% \begin{macrocode} \fi % \end{macrocode} % @@ -11065,15 +11163,27 @@ %^^A---------------- % \subsection{全角空白文字} % +% {\LaTeX}でない入力では、全角空きを入れるために全角空白文字 +% (U+3000)が使われる可能性があるので、 +% 全角空白文字を和文文字でなく空きとして扱うようにしておく。 +% \Note {(u)\pLaTeX}では対応できないので対象外。 +% +% \begin{macro}{\pandocZWSpace} +% 全角空白文字の入力で実行されるコード。 +% \begin{macrocode} +\def\pandocZWSpace{\zwspace} +% \end{macrocode} +% \end{macro} +% 全角空白文字の入力で |\pandocZWSpace| が実行されるようにする。 % \begin{macrocode} \ifnum0\if x\jsEngine1\fi\if l\jsEngine1\fi>\z@ \catcode"3000=\active \begingroup \catcode`\!=7 - \protected\gdef!!!!3000{\zwspace} + \protected\gdef!!!!3000{\pandocZWSpace} \endgroup \else\ifx\DeclareUnicodeCharacter\@undefined\else \DeclareUnicodeCharacter{3000}{\bxjs@zsp@char} - \bxjs@protected\def\bxjs@zsp@char{\zwspace} + \bxjs@protected\def\bxjs@zsp@char{\pandocZWSpace} \fi\fi % \end{macrocode} % @@ -11099,13 +11209,13 @@ % \begin{macrocode} \ifbxjs@jp@fix@strong\ifbxjs@jp@strong@cmd \let\orgtextbf\textbf - \DeclareRobustCommand\bxjstextbf[1]{% + \DeclareRobustCommand\pandocTextbf[1]{% \begingroup \let\textbf\orgtextbf \strong{#1}% \endgroup}% \g@addto@macro\bxjs@begin@document@hook{% - \let\textbf\bxjstextbf} + \let\textbf\pandocTextbf} \fi\fi % \end{macrocode} % @@ -11124,8 +11234,18 @@ % % インラインコード(Code)要素に対する{\LaTeX}出力は |\texttt| となる。 % |\texttt| の両端に欧文ゴーストが入るようにする。 +% さらに |\verb| の外側にも欧文ゴーストが入るようにする。 +% % \begin{macrocode} \ifbxjs@jp@fix@code +% \end{macrocode} +% |bxghost| パッケージが利用できる場合はその機能を利用する。 +% 使えない場合は自前実装を用いる。 +% \begin{macrocode} + \ifbxjs@bxghost@available + \RequirePackage[verb]{bxghost}[2020/01/31]% v0.3.0 + \let\bxjs@eghostguarded\eghostguarded + \else \chardef\bxjs@eghost@c=23 \ifx j\jsEngine \xspcode\bxjs@eghost@c=3 \else\ifx l\jsEngine \ltjsetparameter{alxspmode={\bxjs@eghost@c,3}} @@ -11135,24 +11255,29 @@ \ifx\bxjs@eghost@c\@undefined\else \font\bxjs@eghost@f=ec-lmr10 at 1.23456pt \def\bxjs@pan@eghost{\bgroup\bxjs@eghost@f\bxjs@eghost@c\egroup} + \def\bxjs@eghostguarded#1{% + \bxjs@pan@eghost\null#1\null\bxjs@pan@eghost} + \fi + \fi + \ifx\bxjs@eghostguarded\@undefined\else \let\orgtexttt\texttt - \DeclareRobustCommand\bxjstexttt[1]{% + \DeclareRobustCommand\pandocTexttt[1]{% \ifmmode \nfss@text{\ttfamily #1}% \else \ifvmode \leavevmode \fi - \bxjs@pan@eghost\null - \begingroup \ttfamily #1\endgroup - \null\bxjs@pan@eghost + \bxjs@eghostguarded{\begingroup\ttfamily#1\endgroup}% \fi} \g@addto@macro\bxjs@begin@document@hook{% - \let\texttt\bxjstexttt} + \let\texttt\pandocTexttt} % \end{macrocode} -% さらに |\verb| の外側にも欧文ゴーストが入るようにする。 -% \Note |bxjaghost| の実装を参考にした。 +% |bxghost| を使わない場合の |\verb| の処理。 +% \Note |bxghost| の実装を参考にした。 % \begin{macrocode} + \ifbxjs@bxghost@available\else \expandafter\def\expandafter\verb\expandafter{% \expandafter\bxjs@pan@eghost\verb} \g@addto@macro\verb@egroup{\bxjs@pan@eghost} + \fi \fi \fi % \end{macrocode} @@ -12024,6 +12149,24 @@ FE70,FFF0,% % \end{macrocode} % \end{macro} % +% \begin{macro}{\bxjsp@begin@document@hook} +% 文書本体開始時フック。 +% \begin{macrocode} +\@onlypreamble\bxjsp@begin@document@hook +\let\bxjsp@begin@document@hook\@empty +\AtBeginDocument{\bxjsp@begin@document@hook} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifbxjsp@babel@used} +% 〔スイッチ〕Babelが読み込まれたか。 +% \begin{macrocode} +\newif\ifbxjsp@babel@used +\g@addto@macro\bxjsp@begin@document@hook{% + \@ifpackageloaded{babel}{\bxjsp@babel@usedtrue}{}} +% \end{macrocode} +% \end{macro} +% %^^A---------------- %\subsection{パッケージオプション} % @@ -12151,20 +12294,36 @@ FE70,FFF0,% % 1.9f版で非数式の |\ldots| を全て |…| に戻す動作に変更した。 % \begin{macrocode} \DeclareRobustCommand{\pandocLdots}{% - \relax\ifmmode \expandafter\bxjsp@org@ldots - \else \expandafter\bxjsp@ja@ellipsis - \fi} + \let\bxjsp@do\bxjsp@ja@ellipsis + \ifmmode \let\bxjsp@do\bxjsp@org@ldots + \else\ifbxjsp@babel@used + \expandafter\ifx\csname bxjsp@ld/\languagename\endcsname\relax + \let\bxjsp@do\bxjsp@org@ldots \fi + \fi\fi \bxjsp@do} +\@namedef{bxjsp@ld/japanese}{1} \def\bxjsp@ja@ellipsis{…} \let\bxjsp@org@ldots\ldots % \end{macrocode} % \end{macro} % -% |\ldots| の実装を置き換える。 -% \Note B|english| オプション指定時は置き換えない。 +% |\ldots| の実装を |\pandocLdots| に置き換える。 % \begin{macrocode} -\AtBeginDocument{% +\g@addto@macro\bxjsp@begin@document@hook{% \let\bxjsp@org@ldots\ldots - \ifbxjsp@english\else \let\ldots\pandocLdots \fi} +% \end{macrocode} +% もしここで |\newcommand\pandocLdots{\ldots}| という定義である場合は +% 置き換えない。 +% \begin{macrocode} + \long\def\bxjsp@tmpa{\ldots}% + \ifx\pandocLdots\bxjsp@tmpa\else +% \end{macrocode} +% |english| オプションが指定されていてかつBabelが読み込まれていない場合も +% 置き換えない。 +% \begin{macrocode} + \ifnum0\ifbxjsp@english\ifbxjsp@babel@used\else1\fi\fi=0 + \let\ldots\pandocLdots + \fi + \fi} % \end{macrocode} % % |\ldots| の直後の文字が非英字の場合、Pandocは「|\ldots。|」の -- cgit v1.2.3