3

I am using fontspec and the unicode-math packages to load the Libertinus Serif and Libertinus Math fonts respectively. However, when I use the \mathbf command in math mode, the font inexplicably changes to Latin Modern. Here is a MWE:

\documentclass{scrartcl}
\usepackage{fontspec,realscripts}
\setmainfont{Libertinus Serif}
\newfontfamily\lmr{Latin Modern Roman}

\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\setmathfont[range=\mathbf]{Libertinus Serif}

\begin{document}
$1234567890$ \textbf{1234567890} $\mathbf{1234567890}$ \textbf{\lmr 1234567890}
\end{document}

How do I get the bold version of Libertinus Serif using \mathbf?

EDIT Adding the following does not help either:

\setmathfont[range=\mathbf]{Libertinus Serif}
4

You can declare the font for \mathbf in the usual way, also you can use \symbf which rather than use a separate font, uses the bold alphabet in the upper plane 1 math alphabet block in the regular math font. (Older versions of uniocde-math defined \mathbf to use this range)

enter image description here

\documentclass{scrartcl}
\usepackage{fontspec,realscripts}
\setmainfont{Libertinus Serif}
\newfontfamily\lmr{Latin Modern Roman}

\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\setmathfont[range=\mathbf]{Libertinus Serif}
\DeclareMathAlphabet      {\mathbf}{\encodingdefault}{\familydefault}{bx}{n}
\begin{document}
$1234567890$ \textbf{1234567890} $\mathbf{1234567890} \symbf{123456789}$ \textbf{\lmr 1234567890}
\end{document}
  • Thank you. I like the option to use \symbf as I dont like to change the default definitions. @Herbert's solution seems clean too. Unfortunately my upvote won't show due to poor reputation. – latex_guy Oct 7 '16 at 7:22
  • Don't worry, mine will – Skeleton Bow Dec 10 '16 at 22:33
1

Let unicode-math load all font related packages packages:

\documentclass{scrartcl}
\usepackage{realscripts}
\usepackage{unicode-math}
\setmainfont{Libertinus Serif}
\newfontfamily\lmr{Latin Modern Roman}

\setmathfont{Libertinus Math}
\setmathfont[range=\mathbf]{Libertinus Serif}

\begin{document}
    $1234567890$ \textbf{1234567890} $\mathbf{1234567890}$ \textbf{\lmr 1234567890}
\end{document}
  • Thanks. This seems like a clean solution. Apparently my upvote wont show as I have poor reputation. Can you briefly explain why this solution works? – latex_guy Oct 7 '16 at 7:20
  • This doesn't seem to work. – pheon Feb 19 '17 at 2:13
  • "This doesn't seem to work" is not a useful comment. It works for me! – user2478 Feb 19 '17 at 9:12
  • When I make it, XeLaTeX is substituting CMBX10 for the \mathbf{} Retrieving info from pages 1-1... Fonts (1): 1 (3 0 R): Type1 'EOGXUB+CMBX10' (4 0 R) – pheon Mar 29 '17 at 1:12
0

This seems to be an alternative solution

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

\setmainfont{Libertinus Serif}
\setmathfont{Libertinus Math}
\setmathfontface\mathbf{Libertinus Serif Semibold}
\newfontfamily\lmr{Latin Modern Roman}
\begin{document}
$1234567890G$ \textbf{1234567890G} $\mathbf{1234567890G}$ \textbf{\lmr 1234567890G}

\end{document}

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.