# Bold sans serif math font

Inspired by Mr. Carlisle's answer here, I was wondering how to use a bold sans serif math font.

The way one can create normal bold sans serif text is as follows:

\documentclass[]{standalone}

\begin{document}
\textbf{\textsf{This text is bold.}}
\end{document}


How would I get bold sans serif math, though? I tried many combinations, such as:

\documentclass[]{standalone}

\begin{document}
\textbf{$\mathsf{x^2+2}$}
\end{document}


None of these seem to give bold sans serif math effect, though!

• you can use \boldmath as I used in the referenced answer, or for a subterm inside a larger math expression, you can use \bm from the package of that name. – David Carlisle Nov 20 '16 at 15:08

\documentclass[]{standalone}
\usepackage{bm}
\begin{document}
{\boldmath $\mathsf{x^2+2}$}

$\bm{\mathsf{x^2+2}}$
\end{document}


• This happens to be that one combination that I hadn't tried! Thanks again! – Skeleton Bow Nov 20 '16 at 15:34

To extend the answer into the unicode space, the unicode-math package (using fontspec in the background) allows mapping one (or more) ranges of alphabet symbols, say italic and upright, to another range, say bold sans upright, with the range option. The 17 ranges (up, it, frak, tt, cal, etc) can be restricted to lower/upper/Latin/Greek or numbers, as well.

For specific (grouped) symbols, the various \sym..{} commands, like \symbf{} for bold face, perform a similar function.

Key to the illustration: Italic (magenta); italic mapped to bold sans upright (red); both italic and upright mapped to bfsfup; upright version of \sym..{} command; the \symbfsfup command.

\documentclass[12pt]{standalone}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana Math}[Colour=blue]
%\setmathfont{Asana Math}[range={it},Colour=magenta]
\setmathfont{Asana Math}[range={it->bfsfup,up->bfsfup},Colour=red]
\setmainfont{Noto Serif}
\begin{document}
\begin{tabular}{rl}
\verb|range={it->bfsfup,up->bfsfup}| & $AB ab \Phi \Mu \Lambda \phi \mu \lambda 123$ \\
\end{tabular}
\end{document}


As of 2020, unicode-math provides the alphabets \symbfsfup, \symbfsfit, \mathbfsfup and \mathbfsfit.

If you are using PDFLaTeX, the isomath package provides \mathsfbfit.

You might choose to declare a sansbold math version, perhaps for math expressions in bold sans-serif headers. In unicode-math, there is no bold sans-serif math font defined, but you might fake one with FakeBold.

\documentclass{article}
\usepackage{unicode-math}

\pagestyle{empty}

\defaultfontfeatures{ Scale = MatchLowercase, Ligatures = TeX }
\setmathfont{Latin Modern Math}
\setmathfont[ version=sansbold,
FakeBold = 1.2
]{Fira Math}

\newcommand\sansboldmath{\mathversion{sansbold}}

\begin{document}

\section{\sffamily\bfseries\upshape\sansboldmath
Proving $$\symup{e}^{\symup{i} \uppi} + 1 = 0$$ }

\end{document}


To do the equivalent in legacy NFSS, you would need to find sans-serif bold math fonts that match the encoding of your main math font. The newtxsf package might work with newtxmath or newpxmath.