Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to replace the letters in the math font so that it matches the main font. Curiously, this works for the italic version, yet not for bold and roman. Why is that?

\documentclass{article}

\usepackage{unicode-math}

\defaultfontfeatures{Extension = .otf}
\setmainfont[ItalicFont = *-Italic, 
             BoldFont = *-Bold]{BemboStd}
\setmathfont{latinmodern-math}
\setmathfont[range=\mathrm]{BemboStd}
\setmathfont[range=\mathit]{BemboStd-Italic}
\setmathfont[range=\mathbf]{BemboStd-Bold}

\begin{document}

\noindent
abc \textit{abc} \textbf{abc} \\
$ \mathrm{abc} \ abc \ \mathbf{abc} $

\end{document}

enter image description here

Edit: Just in case it might be helpful to the next person, I'm now using

\setmathfont[range=\mathup/{latin,Latin}]{BemboStd}
\setmathfont[range=\mathit/{latin,Latin}]{BemboStd-Italic}
\setmathfont[range=\mathbfup/{latin,Latin}]{BemboStd-Bold}

as to only substitute the normal letters, and leave all the greek and \partial glyphs alone.

share|improve this question
1  
Try \setmathfont[range=\mathup]{BemboStd} \setmathfont[range=\mathit]{BemboStd-Italic} \setmathfont[range=\mathbfup]{BemboStd-Bold} –  karlkoeller Dec 15 '13 at 20:15
    
Thanks! This works. Although I don't know why. –  Psirus Dec 15 '13 at 20:20

1 Answer 1

up vote 7 down vote accepted

Substituting \mathrm with \mathup and \mathbf with \mathbfup works:

\documentclass{article}

\usepackage{unicode-math}

\defaultfontfeatures{Extension = .otf}
\setmainfont[ItalicFont = *-Italic,
             BoldFont = *-Bold]{BemboStd}
\setmathfont{latinmodern-math}
\setmathfont[range=\mathup]{BemboStd}
\setmathfont[range=\mathit]{BemboStd-Italic}
\setmathfont[range=\mathbfup]{BemboStd-Bold}

\begin{document}

\noindent
abc \textit{abc} \textbf{abc} \\
$ \mathrm{abc} \ abc \ \mathbf{abc} $

\end{document} 

enter image description here

You can find the reason why this works and your solution does not, in the following table (page 9 of unicode-math documentation)

enter image description here

As you can see \mathrm and \mathbf alphabets are not defined in Unicode.

share|improve this answer
    
Thanks for the additional explanation! –  Psirus Dec 15 '13 at 20:41
    
@Psirus You're welcome. –  karlkoeller Dec 15 '13 at 20:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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