There are several questions on this site about \boldmath
with unicode-math
. As Example 1 below shows, \boldmath
does not in general work for unicode fonts with a MATH table, unless there is a specific bold version of the math font. So far, I have not found one for any fonts except XITS Math; from what I have heard, Lucida has one, too, but it is not free. How can I set the \boldmath font with unicode-math? provides an ugly solution that only works for XeLaTeX. Since I am using LuaLaTeX, I am looking for something else (and prettier).
Bold italic math with unicode-math contains a solution to get it to work using unicode fonts without a proper MATH table. The solution also works for fonts with a proper MATH table, provided you replace the math font with the italic text font (see Example 2). As the example shows, the accent (\hat
) does not look good in this case.
So the preferable solution would be:
- Ordinary, non-bold math should be typeset using TeX Gyre Pagella Math
\boldmath
math should be typeset using the bold italic text font TeX Gyre Pagella Bold Italic
I tried that in Example 3 below, but it seems text and math fonts do not work together in this case, for integral signs and everything else break.
Finally, I tried in Example 4 to play around with version=bold
, but curiously, this makes all math bold. Is this a bug?
Can someone get this to work for me?
% !TeX program=luatex
\documentclass{article}
\usepackage{fontspec,amsmath}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\usepackage{unicode-math}
\newcommand\mytest{
\[ \hat f(t) = \int_0^t \hat f'(x)\, dx \]
{\boldmath \[ \hat f(t) = \int_0^t \hat f'(x)\, dx \]}
}
\begin{document}
Example 1:
\setmathfont{TeX Gyre Pagella Math}
\mytest
Example 2:
\setmathfont{TeX Gyre Pagella Math}
\setmathfont[
range=\mathit/{latin,Latin,greek,Greek,num},
BoldFont=TeX Gyre Pagella Bold Italic
]{TeX Gyre Pagella Italic}
\mytest
Example 3:
\setmathfont[BoldFont=TeX Gyre Pagella Bold Italic]{TeX Gyre Pagella Math}
\mytest
Example 4:
\setmathfont{TeX Gyre Pagella Math}
\setmathfont[
version=bold,
range=\mathit/{latin,Latin,greek,Greek,num}
]{TeX Gyre Pagella Bold Italic}
\mytest
\end{document}
\boldmath
has always made all math symbols bold.:-D
Please, give me just a minute...