\mathcal と \mathscr のみに stix フォントを使用する

\mathcal と \mathscr のみに stix フォントを使用する

フォント パッケージが特定の記号にのみ影響するように制限するにはどうすればよいですか? 私の場合は、とstixに関連付けられているフォントのみを変更したいと思います。\mathcal{}\mathscr{}

答え1

stix.sty関連情報にアクセスして抽出する必要があります:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareFontEncoding{LS1}{}{}
\DeclareFontEncoding{LS2}{}{\noaccents@}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareFontSubstitution{LS2}{stix}{m}{n}
\makeatother

\DeclareMathAlphabet\mathscr{LS1}{stixscr}{m}{n}
\SetMathAlphabet\mathscr{bold}{LS1}{stixscr}{b}{n}
\DeclareMathAlphabet\mathcal{LS2}{stixcal}{m}{n}
\SetMathAlphabet\mathcal{bold}{LS2}{stixcal}{b}{n}

\begin{document}

This is \verb|\mathscr|: $\mathscr{A}\mathscr{B}$

This is \verb|\mathcal|: $\mathcal{A}\mathcal{B}$

\boldmath

This is \verb|\mathscr|: $\mathscr{A}\mathscr{B}$

This is \verb|\mathcal|: $\mathcal{A}\mathcal{B}$

\end{document}

ここに画像の説明を入力してください

出力pdffonts:

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
HHWGLO+CMR10                         Type 1            yes yes no       4  0
DTZOCG+CMTT10                        Type 1            yes yes no       5  0
LUIFQC+STIXMathScript-Regular        Type 1            yes yes no       6  0
OBDLAV+STIXMathCalligraphy-Regular   Type 1            yes yes no       7  0
GYLRUW+STIXMathScript-Bold           Type 1            yes yes no       8  0
UVZWHB+STIXMathCalligraphy-Bold      Type 1            yes yes no       9  0

比較のために

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathrsfs}

\begin{document}

This is \verb|\mathscr|: $\mathscr{A}\mathscr{B}$

This is \verb|\mathcal|: $\mathcal{A}\mathcal{B}$

\boldmath

This is \verb|\mathscr|: $\mathscr{A}\mathscr{B}$

This is \verb|\mathcal|: $\mathcal{A}\mathcal{B}$

\end{document}

ここに画像の説明を入力してください

関連情報