# Latin Modern Math doesn't have a bold font, but does have glyphs for Unicode block Mathematical Alphanumeric Symbols. Can \boldmath output them?

It is known that Latin Modern Math does not have a standalone bold font. If you load Latin Modern Math with package unicode-math, and try to use \boldmath, the fontshape with be substituted with the regular font. A minimum working example comparing \boldmath to the unicode-math commands \symbfit & \symbfup, which output bold Latin Modern Math as desired, is as follows:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}

\begin{document}

{\boldmath $a~A~\omega~\Omega$} \par
$\symbfit{a~A~\omega}~\symbfup{\Omega}$

\end{document}


The compiler reports:

The bold Latin Modern Math glyphs come from the Unicode block Mathematical Alphanumeric Symbols, as shown below (taken from the unicode-math documentation):

My question is:

### Can I redefine \boldmath to make it behave as desired by outputting the bold Unicode characters?

To answer in advance "Why must you use \boldmath?", it is because I have been using \boldmath a lot in my documents before starting to use unicode-math. My main usages are:

1. Bold math in section titles, but implemented in such a way that does not interfere with the formatting of Table of Contents.
\documentclass{article}

\makeatletter
\makeatother

\begin{document}

\tableofcontents
\section{Bold math in section titles $a~A~\omega~\Omega$}
\subsection{But regular font in ToC $a~A~\omega~\Omega$}

\end{document}


1. Make all characters including operators bold, instead of just the letters.
\documentclass{article}
\usepackage{amsmath}

\begin{document}

\boldmath $2\hat{a} + \tilde{b} = \sqrt{\dot{c}}$ \\
\unboldmath $2\hat{a} + \tilde{b} = \sqrt{\dot{c}}$

\end{document}


### P.S.

1. I also plan to to apply the solution to \bm if possible.
2. The reason why I started using unicode-math is that I want to import some glyphs from other fonts, like integrals from XITS Math, \mathscr from STIX Two Math, \mathbb from TeX Gyre Termes Math, etc. I can achieve that in some other ways, but I don't want to give up unicode-math without a fight.
• You only need this in math mode, right? (at least in this case it's probably possible to redefine the math code of the characters) (otherwise there's still the regex substitution method but it's kind of fragile...) Apr 2 at 11:01
• @user202729 Yes, I only need this in math mode and am looking for packages or commands that can do the redefining. Apr 2 at 11:51
• I don't think there's package (this is oddly specific.) but you can learn what mathcode means yourself etc. and do the work. Programming in TeX is highly difficult though package writing - Where do I start LaTeX programming? - TeX - LaTeX Stack Exchange Apr 2 at 12:02
• @user202729 Thanks, I'll find time to read it. Apr 2 at 12:58

I don't think that it would be a good idea. Only a rather small subset of the mathematic has bold versions. It is better to use FakeBold:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{Latin Modern Math}[version=bold,FakeBold={3}]
\begin{document}
$a~A~\omega~\Omega$ $\hat f(t) = \int_0^t \hat f'(x)\, dx$

{\boldmath $a~A~\omega~\Omega$ $\hat f(t) = \int_0^t \hat f'(x)\, dx$}

\end{document}


• You're right. Only some letters have bold version and no operators or other symbols at all. This made me reconsider. (The reason why I'm not willing to use fake bold is... well, the fact that the well-designed real bold exists and will show up in bold texts...) Apr 2 at 15:50
• @YukaiQian the bold math letters in the main font really don't work for \boldmath, in particular they are designed for one-letter bold symbols, there is no kerning or ligatures between the letters so a bold sin or diff will look much better with faked bold normal font than trying to make words with math alphabet characters. Apr 2 at 16:08
• @DavidCarlisle That is indeed important to know. Thanks. I'll consider it. Apr 2 at 16:53
• compare diff to 𝐝𝐢𝐟𝐟 Apr 2 at 16:56

You could use a font that has both weights.

New Computer Modern Math is another derivative of computer modern, so very similar to latin modern but more extensive and with two weights. Its Book weight isn't very bold but is noticeably darker than the Regular:

\documentclass{article}

\usepackage{unicode-math}

\setmathfont{NewCMMath-Regular.otf}
\setmathfont[version=bold]{NewCMMath-Book.otf}

\begin{document}

$y=\sum f(x)$

\boldmath

$y=\sum f(x)$
\end{document}

• Thanks. I've tried both this and mlmoderm. Unfortunately, neither is bold enough to distinguish itself from regular Latin Modern as standalone letters. Apr 2 at 15:52