
以下は、キャプション内のラベルを参照する最小限の動作しない例です。autonum パッケージ。
\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}
コンパイル時に次のエラーが発生します。
! Argument of \@caption has an extra }.
! Paragraph ended before \@caption was complete.
たとえば、方程式の代わりに別の図を参照すると、同じ結果が得られます。
このエラーを回避するにはどうすればよいですか?
答え1
使用\protect
\caption{\protect\ref{eq::label}}