7

The following MWE illustrates code that was working until sometime over the last couple weeks.

\documentclass{article}
\usepackage{mathspec}
\setallmainfonts{Times New Roman}

\begin{document}
\begin{equation}
    \nabla \times \mathbf{B} = \mu_0 \mathbf{J}
\end{equation}
\end{document}

I now get a warning:

LaTeX Font Warning: Font shape `TU/TimesNewRoman(0)/bx/n' undefined (Font) using `TU/TimesNewRoman(0)/m/n' instead on input line 13.

I update my LaTeX packages weekly, so I'm not sure which package or version caused the change in behavior.

I suspect an issue with fontspec since it was updated recently and mathspec hasn't been updated in years. However, the warning message does not manifest when using fontspec instead:

...
\usepackage{fontspec}
\setmainfont{Times New Roman}
...

Has a bug been introduced somewhere that can explain this?

mathspec is version 0.2b, but doesn't appear to have been updated since 2016. fontspec was recently updated (Feb. 3) and is now version 2.7h.

Is mathspec no longer maintained? Or should fontspec be used directly (mathspec loads fontspec)?

1
  • this may be due to the changes in latex23 2020-02-02 handling of bold, see ltnews31 will investigate.... Feb 18, 2020 at 8:22

2 Answers 2

7

This is clearly due to the new LaTeX kernel using b as the default value for \bfseries.

Probably fontspec should also define bx weight for compatibility, but in the meantime you can patch mathspec to use b instead of bx.

\documentclass{article}
\usepackage{mathspec}
\usepackage{xpatch}

\xpatchcmd{\setmathrm}{bx}{b}{}{}
\xpatchcmd{\setmathrm}{bx}{b}{}{}
\xpatchcmd{\setmathrm}{bx}{b}{}{}
\xpatchcmd{\setmathsf}{bx}{b}{}{}
\makeatletter
\xpatchcmd{\eu@get@familyseriesshape}{bx}{b}{}{}
\xpatchcmd{\@eu@mkern}{bx}{b}{}{}
\makeatother

\setallmainfonts{Times New Roman}

\begin{document}

\begin{equation}
\nabla \times \mathbf{B} = \mu_0 \mathbf{J}
\end{equation}

\end{document}
3
  • While Ulrike's answer appears simpler, it must be implemented after the font declaration. This kluge can be implemented before the font declaration, which suits my particular application better.
    – mrclary
    Feb 18, 2020 at 15:14
  • Why three identical lines \xpatchcmd{\setmathrm{bx}{b}{}{}?
    – mrclary
    Feb 21, 2020 at 4:13
  • @mrclary Because there are three occurrences of bx to do with and \xpatchcmd does only one replacement.
    – egreg
    Feb 21, 2020 at 8:30
6

You can add a declaration so that the text font knows bx too:

\documentclass{article}
\usepackage{mathspec}
\setallmainfonts{Times New Roman}
\DeclareFontShape{TU}{\familydefault}{bx}{n}{<-> ssub*\familydefault/b/n}{}

\begin{document}
\begin{equation}
    \nabla \times \mathbf{B} = \mu_0 \mathbf{J}
\end{equation}
\end{document}

fontspec will probably do this by default in the next version.

2
  • 1
    Simpler and without using \normalfont is \DeclareFontShape{TU}{\familydefault}{bx}{n}{<-> ssub*\familydefault/b/n}{}
    – egreg
    Feb 18, 2020 at 11:23
  • @egreg right, I obviously overcomplicated. I edited the answer. Feb 18, 2020 at 11:36

You must log in to answer this question.

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