使用 \DeclareMathVersion

使用 \DeclareMathVersion

据我所知,\DeclareMathVersion它可用于在数学字体变体之间切换。我想知道如何在利用两种字体的文档中使用它:Times Roman 用于正文,Garamond 用于标题和标题。(这种风格当然是不合常规的,但效果很好。)

Times、through\usepackage{txfonts}和 Garamond through\usepackage[urw-garamond]{mathdesign}都提供数学字体。以下示例排版需要什么?

虽然我相信\DeclareMathVersion这是解决方案,但文档很少。不过,我看过几本 LaTeX 排版书,它们都实现了这种切换。可能与仅在文档的某些部分更改数学字体?

\documentclass{article}

\usepackage[urw-garamond]{mathdesign}
\usepackage{txfonts}

% ...

\begin{document}
 % This will be in times
 \[ \int e^{ax}\sin(bx+c)dx \]
 % We want this in Garamond
 % ...
 \[ \int e^{ax}\sin(bx+c)dx \]
\end{document}

答案1

使用 定义新的数学版本后\DeclareMathVersion,您可以使用\DeclareMathAlphabet\SetMathAlphabet\DeclareSymbolFont手动\SetSymbolFont设置所有数学系列。您必须重命名数学系列名称。您必须确保数学系列不超过 16 个字母系列(但符号系列可以更多)。并且可能存在编码问题。

无论如何,虽然它相当复杂,但还是可能的:

在此处输入图片描述

\documentclass{article}
%%% text fonts
\renewcommand\rmdefault{txr}
\newcommand\gmfamily{\fontfamily{mdugm}\selectfont}

%%% New math versions
\DeclareMathVersion{varnormal}
\DeclareMathVersion{varbold}
\newcommand\txmath{\mathversion{normal}}
\newcommand\txboldmath{\mathversion{bold}}
\newcommand\mdmath{\mathversion{varnormal}}
\newcommand\mdboldmath{\mathversion{varbold}}

%%% Math symbol fonts
%%% some examples only
% Math letters from txfonts and mdugm
\SetSymbolFont{letters}{normal}{OML}{txmi}{m}{it}
\SetSymbolFont{letters}{bold}{OML}{txmi}{bx}{it}
\SetSymbolFont{letters}{varnormal}{OML}{mdugm}{m}{it}
\SetSymbolFont{letters}{varbold}{OML}{mdugm}{b}{it}
% Math operators
\SetSymbolFont{operators}{normal}{OT1}{txr}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{txr}{bx}{n}
\SetSymbolFont{operators}{varnormal}{OT1}{mdugm}{m}{n}
\SetSymbolFont{operators}{varbold}{OT1}{mdugm}{b}{n}
% Math symbols
\SetSymbolFont{symbols}{normal}{OMS}{txsy}{m}{n}
\SetSymbolFont{symbols}{bold}{OMS}{txsy}{bx}{n}
\SetSymbolFont{symbols}{varnormal}{OMS}{mdugm}{m}{n}
\SetSymbolFont{symbols}{varbold}{OMS}{mdugm}{b}{n}
% Large symbols
\SetSymbolFont{largesymbols}{normal}{OMX}{txex}{m}{n}
\SetSymbolFont{largesymbols}{bold}{OMX}{txex}{bx}{n}
\SetSymbolFont{largesymbols}{varnormal}{OMX}{mdugm}{m}{n}
\SetSymbolFont{largesymbols}{varbold}{OMX}{mdugm}{b}{n}

%%% Math alphabets, at most 16 families
%%% some examples only
\SetMathAlphabet{\mathrm}{normal}{OT1}{txr}{m}{n}
\SetMathAlphabet{\mathrm}{bold}{OT1}{txr}{bx}{n}
\SetMathAlphabet{\mathrm}{varnormal}{OT1}{mdugm}{m}{n}
\SetMathAlphabet{\mathrm}{varbold}{OT1}{mdugm}{b}{n}

\SetMathAlphabet{\mathit}{normal}{OT1}{txr}{m}{it}
\SetMathAlphabet{\mathit}{bold}{OT1}{txr}{bx}{it}
\SetMathAlphabet{\mathit}{varnormal}{OT1}{mdugm}{m}{it}
\SetMathAlphabet{\mathit}{varbold}{OT1}{mdugm}{b}{it}

\begin{document}

This is Times font. $a^2 + b^2 = c^2$. Math font
\[
  \sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0
\]
and bold math font
{\txboldmath\[
  \sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0
\]}

\gmfamily\mdmath
This is Garamond font. $a^2 + b^2 = c^2$. Math font
\[
  \sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0
\]
and bold math font
{\mdboldmath\[
  \sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0
\]}

\end{document}

相关内容