0

For some reason, using \substack as a label's tag causes such errors

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{gather}
p+q=w \\
a+b=c \label{eq:1} \tag{$\substack{a\\a}$}
\end{gather}

\eqref{eq:1}

\end{document}

However anything else, even math like \vec{a} inside \tag works perfectly fine.

Why does \substack do that and how can I fix the issue?

1 Answer 1

1

with texlive 2022 you get

! TeX capacity exceeded, sorry [input stack size=10000].
\protect ->\noexpand \protect 
                              \noexpand 
l.9 \end{gather}
                
!  ==> Fatal error occurred, no output PDF file produced!

with texlive 2021

! TeX capacity exceeded, sorry [input stack size=5000].
\restore@math@cr ->\def \math@cr@@@ 
                                    {\cr }
l.9 \end{gather}
                
!  ==> Fatal error occurred, no output PDF file produced!

With 2020 you get the error you show

! Use of \math@cr@@ doesn't match its definition.
\new@ifnextchar ...ved@d = #1\def \reserved@a {#2}
                                                  \def \reserved@b {#3}\futu...
l.9 \end{gather}
                
? 

With the current texlive 2022 you can use \protect. That also worked in 2021, but not the older texlive 2020 release.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{gather}
p+q=w \\
a+b=c \label{eq:1} \tag{$\protect\substack{a\\a}$}
\end{gather}

\eqref{eq:1}

\end{document}
4
  • Is there anything I can do with texlive 2019?
    – antshar
    May 21, 2022 at 12:16
  • @antshar probably \tag{$\protect\substack{a\protect\\a}$} (that works in 2020, I don't have 2019). In 30 years of latex use, I think it's the first time I have ever seen anyone use a two line \tag what is the use case here? May 21, 2022 at 12:44
  • I just wanted to create sequential tags with asterisks i.e ∗, ⁑, ⁂, but didn't mentioned that because someone could write a pseudo-solution based on using unicode characters instead, but I need \substack because of it's versatility.
    – antshar
    May 21, 2022 at 14:15
  • Thanks, this code with multiple \protects works well. I think it worth adding it to the answer too.
    – antshar
    May 21, 2022 at 14:18

You must log in to answer this question.

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