# Problem using thmtools, hyperref and showkeys all together

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:

\documentclass{article}
\usepackage{amsmath, amsthm}
\usepackage{thmtools}
\usepackage{hyperref}
\usepackage{showkeys}

\begin{document}

$$1+1=2 \label{simple}$$

\begin{proof}[Proof of~\eqref{simple}]
\end{proof}

\end{document}


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?

• \protect\eqref – daleif Oct 2 '13 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. – Ari Brodsky Oct 2 '13 at 19:34
• @daleif an answer? – egreg Oct 4 '14 at 22:11

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