When I use \eqref (from amsmath) in the optional argument to the proof environment (from amsthm) and the three packages thmtools, hyperref, and showkeys are loaded, TeX runs into an infinite loop. Here is a minimal failing example:

\usepackage{amsmath, amsthm} 



\begin{proof}[Proof of~\eqref{simple}]
Count on your fingers.


The error message is:

! TeX capacity exceeded, sorry [parameter stack size=10000].
\@x@protect #1\fi #2#3->
                    \fi \protect #1
l.14 \begin{proof}[Proof of~\eqref{simple}]

No pages of output.

Does anyone know why this is happening and how to fix it?

  • 3
    – daleif
    Commented Oct 2, 2013 at 10:55
  • Wow. It's that simple. Amazing how the problem surfaces only with a strange combination of packages and circumstances. I guess that's the unpredictability of using fragile commands in moving arguments. Commented Oct 2, 2013 at 19:34
  • @daleif an answer?
    – egreg
    Commented Oct 4, 2014 at 22:11

1 Answer 1


\eqref is not robust, thus in some cases it needs protection, that is \protect\eqref

You must log in to answer this question.

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