2

I am having a hard time with the "Too many math alphabets in version bold" error. Here is the minimal working example on the latest version of Texlive that comes with Ubuntu 18.04:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}

$\widetilde{\boldsymbol{\mathsf{x}}}_n$ \begin{equation} \widetilde{\boldsymbol{\mathsf{x}}}_n \end{equation}

\end{document}

I have been searching around but could not find the reason why this causes an error. It seems like having both \widetilde{\boldsymbol{\mathsf{x}}}_n in in-line and displayed equation causes this error, but I have absolutely no clues why and how to fix this :-(.

My question: Is there a way to fix this?

Any help/hint is highly appreciated.

PS 1: This error appears to be different than the one in "Too many math alphabets" error so I believe it is not a duplicate.

PS 2: As David Carlisle kindly pointed out in the comment, the first error in the log file is

! Use of \reserved@a doesn't match its definition.
\reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf  \fi \use@mathgroup
weirdo
  • 269
  • 1
  • 3
  • 7
  • The posted code does not give the error that you show in the title. – David Carlisle Nov 29 '20 at 23:31
  • I do not have that error on Ubuntu 20.04 and the TexLive that comes with it, but for some strange reason this happens on Ubuntu 18.04 and its TexLive on apt-get....According to the log file, it is TexLive 2017. – weirdo Nov 29 '20 at 23:35
  • which texlive version does that give in the initial banner I could try an older system, it seems strange though: this example should get nowhere near the 16 allowed. You could show the log file from that example – David Carlisle Nov 29 '20 at 23:36
  • 1
    is that the first error or fo you get ! Use of \reserved@a doesn't match its definition. first? – David Carlisle Nov 29 '20 at 23:38
  • The first line of the log file says "This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex 2020.10.5) 29 NOV 2020 18:38 entering extended mode restricted \write18 enabled. %&-line parsing enabled." – weirdo Nov 29 '20 at 23:39
  • What you said is indeed the first error in the log file. – weirdo Nov 29 '20 at 23:42
  • only the first error is usually relevant, if you choose to scroll past an error what you get is usually spurious errors due to the simplistic approach TeX takes for error recovery of inserting whatever it takes to get past the error then hoping all is well. – David Carlisle Nov 29 '20 at 23:55
  • The first error in the log file is indeed ! Use of \reserved@a doesn't match its definition. But I have no clues why....:-( – weirdo Nov 30 '20 at 00:05
  • 1
    This was an error in texlive 2016 and 2017 fixed in 2018. – David Carlisle Nov 30 '20 at 00:17

1 Answers1

4

I think you just need this fix

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\makeatletter
\def\@mathmeasure#1#2#3{\setbox#1\hbox{%
  \m@th$#2#3$}}
\makeatother
\begin{document}
$\widetilde{\boldsymbol{\mathsf{x}}}_n$
\begin{equation}
\tracingall
\widetilde{\boldsymbol{\mathsf{x}}}_n
\end{equation}

\end{document}

note the current amsmath source says

%    As of 2018/12 release we don't turn off |\evermath| as this
%    optimization can be harmful.
% \changes{v2.17b}{2018/12/01}{Don't drop \cs{frozen@everymath}}

That could have been me, but I don't recall, perhaps it was Frank:-)

As a general rule only look at the first error reported. The math alphabet error is entirely spurious but to get it you need to step past 18!!!! earlier error messages:

! Use of \reserved@a doesn't match its definition.
\reserved@b ->\relax 
                     \ifmmode \else \non@alpherr \mathsf  \fi \use@mathgroup...
l.8 \widetilde{\boldsymbol{\mathsf{x}}}
                                       _n
? 
! Undefined control sequence.
<argument> \@nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Use of \reserved@a doesn't match its definition. \reserved@b ->\relax \ifmmode \else \non@alpherr \mathsf \fi \use@mathgroup... l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? ! Undefined control sequence. <argument> @nil

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ?

! LaTeX Error: Too many math alphabets used in version bold.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.8 \widetilde{\boldsymbol{\mathsf{x}}} _n ? x

David Carlisle
  • 757,742
  • 1
    This does fix my problem! Thank you so much!! I will keep in mind the first error in the log file when reporting issues. – weirdo Nov 30 '20 at 00:23