4

I don't understand how to get bold italics fonts with unicode maths. When I load unicode-maths the bold italics from \boldmaths becomes normal, and \mathbf gives right fonts.

Thank you for your help.

\documentclass[a4paper,11pt]{article}

\usepackage[tuenc]{fontspec}
\usepackage[a4paper]{geometry}
\usepackage[french]{babel}

\usepackage[bold-style=ISO]{unicode-math} %works without this
    \setmathfont{Latin Modern Math}
    \setmathfont[range={\mathscr,\mathbfscr}]{XITS Math}

\begin{document}

$x+y=z$

{\boldmath$x+y=z$}

$\mathbf{x+y=z}$

\end{document}
  • Try mathbfit – Yan Zhou Dec 8 '16 at 18:48
  • 1
    There is no bold Latin Modern Math font. – egreg Dec 8 '16 at 19:06
4

There is no bold Latin Modern Math font. You could fake it, but I don't believe it's what you want.

You should recall that unicode-math defines \symbf which should be used to get a letter in boldface, rather than \mathbf, which uses the text bold font.

\documentclass[a4paper,11pt]{article}

\usepackage[tuenc]{fontspec}
\usepackage[a4paper]{geometry}
\usepackage[french]{babel}

\usepackage[bold-style=ISO]{unicode-math}                    
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathscr,\mathbfscr}]{XITS Math}

\begin{document}

$x+y=z$

$\symbf{x}+\symbf{y}=\symbf{z}$

\end{document}

enter image description here

  • Do you mean there's no separate font called "Latin Modern Math Bold", as in a separate font file? LM math does have bold math. (Maybe it is only me confused). – Yan Zhou Dec 8 '16 at 21:52
  • Thank you for your answer. But with LaTeX I usualy used \newcommand{\gras}[1]{\ifmmode\hbox{\bfseries\boldmath$#1$}\else{\bfseries\boldmath#1}\fi} to get bold either in text or math mode. Is it possible to get somethinf like this with \symbf ? – Oli Dec 9 '16 at 14:07
  • @Oli Do you know about the bm package? – egreg Dec 9 '16 at 14:16
  • I had a look. But how to use it such as {\bfseries\boldmath $0123abc$ efg}: with the {\cmd abd} syntax ? – Oli Dec 9 '16 at 17:42
  • @Oli Defining \gras to do different jobs in math and text is wrong to begin with. Anyway, the usage in unicode-math is with \symbf and there's not much more to say. – egreg Dec 9 '16 at 17:48
1

Aside from egreg's answer, you can always force a certain math bold style by mathbfup and mathbfit and related symbf macros. You can also force mathbf to use bold math font instead of text font by the mathbf=sym option. See example,

\documentclass{article}
\usepackage[mathbf=sym]{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{XITS Math}[range={scr,bfscr}]

\begin{document}
\def\sample{0123ABCDabcd\Delta\Gamma\Omega\alpha\beta\gamma}
\[ \sample \]            % normal math
\[ \mathbf{\sample} \]   % default bold symbol
\[ \symbf{\sample} \]    % default bold symbol
\[ \mathbfup{\sample} \] % always upper right bold
\[ \mathbfit{\sample} \] % always italic bold
\end{document}

enter image description here

  • Thank you. But with \mathbfit 0123 should be bold too. They are not bold. – Oli Dec 9 '16 at 14:04
  • @Oli The font does not have bold italic numbers, and thus you get normal numbers instead. If you need bold math italic numbers, you need to choose a font that has it – Yan Zhou Dec 9 '16 at 14:34
  • OK. With LaTeX A simple \boldmath with \usepackage{lmodern} has all this bold fonts ... So it is strange that Latin Modern does'nt have them with XeLaTeX ... – Oli Dec 9 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.