Bold italic math with unicode-math
A "poor person's \boldmath
can be obtained by
\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\setmathfont[version=bold,FakeBold=3.5]{XITS Math}
\begin{document}
This should be entirely bold: {\boldmath$O(\log n)$} \\
This should not be bold: $O(\log n)$
\end{document}
I presume that this is how word processors fake bold for fonts not having a real one.
Note: choosing XITS "non math" for math symbols may have adverse effects.
When using the package unicode-math
, you will find the \bm
and \boldsymbol
don't work. You can nonetheless specify how you want it to deal with your bold math symbols using an option while loading it. \usepackage[bold-style=ISO]{unicode-math}
will give the recommended italic bold math symbols for both greek and latin characters, while \usepackage[bold-style=TEX]{unicode-math}
will give upright latin characters. This is explained in the unicode-math
documentation.
A mwe:
\documentclass{article}
\usepackage[bold-style=ISO]{unicode-math}
%\usepackage[bold-style=TEX]{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
This is bold and italic $\mathbf{O(\log n)}+\mathbf{O(\lambda,\,\epsilon)}$ where it must :)
\end{document}