# autonum does not like \ref in a \caption

The following is a minimal non-working example of a reference to some label within a caption while using the autonum package.

\documentclass{article}
\usepackage{autonum}
\begin{document}

\begin{align}
E = mc^2 \label{eq::label}
\end{align}

\begin{figure}
y \caption{ \ref{eq::label} }
\end{figure}

\end{document}


Upon compiling I get the following errors:

! Argument of \@caption has an extra }.
! Paragraph ended before \@caption was complete.


I get the same result, if I refer to, say another figure, instead of an equation.

How can I avoid this error?

-
Use \protect
\caption{\protect\ref{eq::label}}

Thanks for highlighting the problem. I just uploaded version 0.3.2 which contains the fix. So the user supplied \protect is not needed with that version anymore. It may take some time until 0.3.2 has propagated via CTAN. –  Patrick Häcker Sep 3 '12 at 20:43