2

This might be related to why math fonts aren't showing up, but I encountered this error with LuaLaTeX math font.

The only issue showing up as a font is \mathbf not displaying bold font, so I assume the two are probably correlated.

For instance, here is some sample text and preamble information:

% preamble
    \RequirePackage{fontspec}
    \RequirePackage{unicode-math} 
    \unimathsetup{math-style=TeX}
    \RequirePackage[english]{babel}
    \defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
    \setmainfont{Minion Pro}
    \setsansfont{Myriad Pro}
    \setmonofont{Inconsolata Nerd Font}
    \unimathsetup{math-style=TeX}
    \setmathfont{Libertinus Math}

% text file
\documentclass{article}
\usepackage{random} % contains my fonts; I will provide a link to it
\begin{document}
\section{Testing Math Fonts}
Here is me trying to test out how math fonts work.
\[ 
   \text{Regular: } x + 1 = 2; \, \text{Bold: } \mathbf{x + 1 = 2}; \,  \text{Italic: }\mathit{x+1 = 2}
.\] 
 
\end{document}

And the following output shows italic font working, but not bold: enter image description here

Coincidentally, I also happen to have this warning: enter image description here

Full Logs

Therefore, I think the two are related - a font shape undefined error is causing \mathbf to not show up. In that case, how can I resolve the font shape error?

9
  • I am unable to reproduce the issue you've raised in my TeX distribution (MacTeX2022 with all updates applied) and the math font located at /usr/local/texlive/2022/texmf-dist/fonts/opentype/public/libertinus-fonts/LibertinusMath-Regular.otf. Please tell us which TeX distribution you employ and when you last updated it.
    – Mico
    Commented Dec 8, 2022 at 9:44
  • Ah sorry about that! I just reinstalled TeXLive 2022 recently (~1 week ago); I assume it should be fairly up-to-date.
    – Revise
    Commented Dec 8, 2022 at 9:47
  • don't show only snippets. Make a small, complete example and show it together with the log. Commented Dec 8, 2022 at 9:56
  • 1
    \symbf works, thanks! Also a huge thanks for the explanation as to how this works.
    – Revise
    Commented Dec 8, 2022 at 10:46
  • 1
    I asked for a small but complete example and not for a sty full of junk code. Commented Dec 8, 2022 at 10:46

1 Answer 1

1

(too long for a comment, hence posted as an answer)

As I have already noted in a comment, I am unable to reproduce the missing-bold-math font issue you've encountered on my laptop, where I use MacOS 13.0.1 "Ventura" and MacTeX2022, with all updates applied.

There is separate issue that needs to be addressed, though. Since the serif text font (Minion Pro) and math font (Libertinus Math) are only somewhat close, but not exactly identical, you should be asking yourself why are you using the commands \mathbf and \mathit, as they load characters from the text font, not from the math font. To actually employ the glyphs of the Libertinus Math font, you should be using \symbf and \symit-- which are macros are provided by the unicode-math package -- instead of \mathbf and \mathit.

enter image description here

% !TEX TS-program = lualatex
\documentclass{article} % or some other suitable document classs
\RequirePackage[english]{babel}

%\RequirePackage{fontspec} % 'fontspec' is loaded automatically by 'unicode-math'
\RequirePackage{unicode-math} 
\unimathsetup{math-style=TeX}
\defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
\setmainfont{Minion Pro}
\setsansfont{Myriad Pro}
\setmonofont{Consolas} % I don't have the 'Inconsolata Nerd' font
%\unimathsetup{math-style=TeX} % no need to run the same command twice
\setmathfont{Libertinus Math}

\begin{document}
\begin{tabular}{lll}
Regular              & $xyz + 1 = 2$      & basic text and math font  \\
\textbf{Bold text}   & \textbf{x y z 1 2} & text-font bold glyphs \\
\textit{Italic text} & \textit{x y z 1 2} & text-font italic glyphs \\[1ex]
\textbf{Bold1}   & $\mathbf{xyz + 1 = 2}$ & math, but use text font glyphs \\
\textbf{Bold2}   & $\symbf{xyz + 1 = 2}$  & math, employ \verb+\symbf+ \\[1ex]
\textit{Italic1} & $\mathit{xyz + 1 = 2}$ & math, but use text font glyphs \\
\textit{Italic2} & $\symit{xyz + 1 = 2}$  & math, employ \verb+\symit+
\end{tabular}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .