Consider the following MWE which is modified from my answer here:
\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}
This produces the following unexpected (to me) results:
Question: How can I modify this example so that the combination of the maths versions varnormal and heavy activated by \mdmath and \hm produce the expected results i.e. so that the (round) brackets and limits are typeset correctly?
Note that the issue is not inherent to the fonts themselves. Nor is it an effect of using bm per se. The following code works fine:
\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}
This works as expected:
Important: in my original answer, I'm using regular Garamond as the varnormal version and bold Garamond as the heavy version, with the normal and bold maths versions reserved for a different font family. So simply not declaring the heavy or varnormal maths versions is not a solution even though it would clearly be the obvious answer in the MWE.
It is possible to workaround this problem by defining a second package, varbm, such that varbm.sty is to maths version varbold what bm.sty is to maths version bold. (In that case, of course, heavy needn't be used at all.) This works fine and is what I've done in my revised answer. However, it seems overkill as it involves duplicating almost all of bm.sty. Even if it is, in fact, the best solution, I'd still like to know exactly what is going wrong in this case.


bmis doing. (The source does not mean much to me.) – cfr Aug 02 '15 at 19:13\bmwill not select anything useful for the\hmunleaa\mathversion{heavy}has useful fonts declared, if you declare a math version but declare no fonts it will be the same a s mathversion normal – David Carlisle Aug 02 '15 at 19:44\Setbut\Declared? (The example above does\Setthem but does not\Declarethem.) – cfr Aug 02 '15 at 20:19