Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Use \protect

\caption{\protect\ref{eq::label}}
share|improve this answer
    
That works, thank you. –  sirinac Sep 3 '12 at 14:51
1  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.