unicode-math icon indicating copy to clipboard operation
unicode-math copied to clipboard

Using `\setmainfont` after `\usepackage{unicode-math}` breaks `\mathbf`

Open redtrumpet opened this issue 5 years ago • 2 comments

Description

When I use \setmainfont{Libertinus Serif} after \usepackage{unicode-math}, \mathbf produces an error, that it cannot find the bold font shape. Curiously, \textbf inside math environments still works.

Add info or delete as appropriate:

  • Relevant for XeTeX
  • Relevant for LuaTeX

Minimal example demonstrating the issue

This produces an error, and the x is printed in non-bold font.

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont{Libertinus Serif}
\setmathfont{Libertinus Math}

\begin{document}
\(\mathbf{x}\)
\end{document}

This works:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage{unicode-math}
\setmathfont{Libertinus Math}


\begin{document}
\(\mathbf{x}\)
\end{document}

Further details

I get the following error message:

LaTeX Font Warning: Font shape `TU/LibertinusSerif(1)/bx/n' undefined
(Font)              using `TU/LibertinusSerif(1)/m/n' instead on input line 11.


[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./doc.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

I'm using locally installed versions of Libertinus Serif and Libertinus Math. I also tried using the libertinus package, and with this I always get the error. According to its documentation, it invokes the commands in the same order as my MWE.

redtrumpet avatar Oct 28 '20 18:10 redtrumpet

I cannot see it with an up-to-date TL2020 and xelatex or lualatex:

File List article.cls 2020/04/10 v1.4m Standard LaTeX document class size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option) fontspec.sty 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX xparse.sty 2020-10-27 L3 Experimental document command parser expl3.sty 2020-10-27 L3 programming layer (loader) l3backend-luatex.def 2020-09-24 L3 backend support: PDF output (LuaTeX) fontspec-luatex.sty 2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX

fontenc.sty fontspec.cfg unicode-math.sty 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX unicode-math-luatex.sty 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaT eX l3keys2e.sty 2020-10-27 LaTeX2e option processing using LaTeX3 keys fix-cm.sty 2015/01/14 v1.1t fixes to LaTeX ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file amsmath.sty 2020/09/23 v2.17i AMS math features amstext.sty 2000/06/29 v2.01 AMS text amsgen.sty 1999/11/30 v2.0 generic functions amsbsy.sty 1999/11/29 v1.2d Bold Symbols amsopn.sty 2016/03/08 v2.02 operator names lualatex-math.sty 2020/09/25 v1.9 Patches for mathematics typesetting with L uaLaTeX etoolbox.sty 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)


and the embedded fonts:

bash-3.2$ pdffonts figures.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
UQWCOG+LibertinusSerif-Bold          CID Type 0C       Identity-H       yes yes yes      4  0
VBSBYN+LibertinusSerif-Regular       CID Type 0C       Identity-H       yes yes yes      5  0

hvoss49 avatar Oct 28 '20 18:10 hvoss49

Okay, so I was still using TexLive 2019 (standard on Ubuntu 20.04), and after updating to TL 2020 the error disappeared. Not sure what changed, since the unicode-math version did not change.

redtrumpet avatar Oct 29 '20 09:10 redtrumpet