# Has a recent update broken mathbf when using mathspec?

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}
$$\nabla \times \mathbf{B} = \mu_0 \mathbf{J}$$
\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)?

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

## 2 Answers

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}

$$\nabla \times \mathbf{B} = \mu_0 \mathbf{J}$$

\end{document}
• 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. Feb 18 '20 at 15:14
• Why three identical lines \xpatchcmd{\setmathrm{bx}{b}{}{}? Feb 21 '20 at 4:13
• @mrclary Because there are three occurrences of bx to do with and \xpatchcmd does only one replacement. Feb 21 '20 at 8:30

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}
$$\nabla \times \mathbf{B} = \mu_0 \mathbf{J}$$
\end{document}

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

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