当使用 bm 包中的 \hm 时,如何在不改变间距和符号选择的情况下声明重数学版本?

当使用 bm 包中的 \hm 时,如何在不改变间距和符号选择的情况下声明重数学版本?

考虑以下 MWE,它修改自我的答案在这里

\documentclass{article}
\newcommand\gmfamily{\fontfamily{mdugm}\selectfont}

\DeclareMathVersion{varnormal}
\DeclareMathVersion{heavy}
\newcommand\mdmath{\mathversion{varnormal}}
\newcommand\mdboldmath{\mathversion{heavy}}
\newcommand\heavymath{\mathversion{heavy}}

\SetSymbolFont{letters}{varnormal}{OML}{mdugm}{m}{it}
\SetSymbolFont{letters}{heavy}{OML}{mdugm}{b}{it}
\SetSymbolFont{operators}{varnormal}{OT1}{mdugm}{m}{n}
\SetSymbolFont{operators}{heavy}{OT1}{mdugm}{b}{n}
\SetSymbolFont{symbols}{varnormal}{OMS}{mdugm}{m}{n}
\SetSymbolFont{symbols}{heavy}{OMS}{mdugm}{b}{n}
\SetSymbolFont{largesymbols}{varnormal}{OMX}{mdugm}{m}{n}
\SetSymbolFont{largesymbols}{heavy}{OMX}{mdugm}{b}{n}
\SetMathAlphabet{\mathrm}{varnormal}{OT1}{mdugm}{m}{n}
\SetMathAlphabet{\mathrm}{heavy}{OT1}{mdugm}{b}{n}

\SetMathAlphabet{\mathit}{varnormal}{OT1}{mdugm}{m}{it}
\SetMathAlphabet{\mathit}{heavy}{OT1}{mdugm}{b}{it}

\usepackage{bm}

\begin{document}

\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
\]}
\[
  \hm{\sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0}
\]

\end{document}

这产生了以下对我来说意想不到的结果:

意想不到的结果

问题:我如何修改此示例,以便数学版本的组合varnormalheavy激活\mdmath\hm产生预期的结果,即(圆)括号和限制被正确排版?

请注意,该问题不是字体本身所固有的。也不是使用骨髓 本身。以下代码可以正常工作:

\documentclass{article}
\renewcommand\rmdefault{mdugm}

\DeclareSymbolFont{letters}{OML}{mdugm}{m}{it}
\SetSymbolFont{letters}{bold}{OML}{mdugm}{b}{it}
\DeclareSymbolFont{operators}{OT1}{mdugm}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{mdugm}{b}{n}
\DeclareSymbolFont{symbols}{OMS}{mdugm}{m}{n}
\SetSymbolFont{symbols}{bold}{OMS}{mdugm}{b}{n}
\DeclareSymbolFont{largesymbols}{OMX}{mdugm}{m}{n}
\SetSymbolFont{largesymbols}{bold}{OMX}{mdugm}{b}{n}
\DeclareMathAlphabet{\mathrm}{OT1}{mdugm}{m}{n}
\SetMathAlphabet{\mathrm}{bold}{OT1}{mdugm}{b}{n}
\DeclareMathAlphabet{\mathit}{OT1}{mdugm}{m}{it}
\SetMathAlphabet{\mathit}{bold}{OT1}{mdugm}{b}{it}

\usepackage{bm}

\begin{document}

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

\end{document}

这按预期工作:

预期成绩

重要的:在我最初的回答中,我使用常规 Garamond 作为版本varnormal,使用粗体 Garamond 作为版本heavy,并将normalbold数学版本保留给不同的字体系列。因此,简单地不声明heavyvarnormal数学版本并不是解决方案,尽管这显然是 MWE 中显而易见的答案。

可以通过定义第二个包来解决这个问题,变量,这样varbm.sty就是数学版varbold的 就是bm.sty数学版的bold。(当然,在这种情况下,heavy根本不需要使用。)这很好用,也是我在我的修改答案。但是,这似乎有点过头了,因为它涉及复制几乎所有的内容bm.sty。即使这实际上是最好的解决方案,我仍然想知道在这种情况下到底出了什么问题。

答案1

如果您声明一个重数学版本,您需要为其定义一些字体,这里我只是使它们与粗体相同(这意味着您或多或少会用完 16 个数学字体,但您会得到粗体括号)

\documentclass{article}
\DeclareMathVersion{heavy}
\renewcommand\rmdefault{mdugm}
 \newcommand\heavymath{\mathversion{heavy}}

\DeclareSymbolFont{letters}{OML}{mdugm}{m}{it}
\SetSymbolFont{letters}{bold}{OML}{mdugm}{b}{it}
\SetSymbolFont{letters}{heavy}{OML}{mdugm}{b}{it}
\DeclareSymbolFont{operators}{OT1}{mdugm}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{mdugm}{b}{n}
\SetSymbolFont{operators}{heavy}{OT1}{mdugm}{b}{n}
\DeclareSymbolFont{symbols}{OMS}{mdugm}{m}{n}
\SetSymbolFont{symbols}{bold}{OMS}{mdugm}{b}{n}
\DeclareSymbolFont{largesymbols}{OMX}{mdugm}{m}{n}
\SetSymbolFont{largesymbols}{bold}{OMX}{mdugm}{b}{n}
\SetSymbolFont{largesymbols}{heavy}{OMX}{mdugm}{b}{n}
\DeclareMathAlphabet{\mathrm}{OT1}{mdugm}{m}{n}
\SetMathAlphabet{\mathrm}{bold}{OT1}{mdugm}{b}{n}
\SetMathAlphabet{\mathrm}{heavy}{OT1}{mdugm}{b}{n}
\DeclareMathAlphabet{\mathit}{OT1}{mdugm}{m}{it}
\SetMathAlphabet{\mathit}{bold}{OT1}{mdugm}{b}{it}
\SetMathAlphabet{\mathit}{heavy}{OT1}{mdugm}{b}{it}

\usepackage{bm}


\begin{document}


This is Garamond font.
$a^2 + b^2 = c^2$.
Maths font
\[
  \sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0
\]
and bold maths font
\[
  \bm{\sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0}
\]
and heavy maths font (which should just be bold?)
\[
  \hm{\sum_i \int_a^b \left( \frac1{K+1} \oplus\alpha_i \right) \,\mathrm{d}x = 0}
\]

\end{document}

相关内容