autonum 不喜歡 \caption 中的 \ref

autonum 不喜歡 \caption 中的 \ref

以下是一個最小的非工作範例,在使用時引用標題中的某些標籤自動程式包

\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}}

相關內容