将方程式 \label{} 放入列表 \item 中,其中项目将作为覆盖物选择性地显示,似乎会导致 LaTeX 隐藏其自身的引用。这是一个最小工作示例:
\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]
\fontsize{6pt}{7.2}\selectfont
Outside of the \texttt{list} environment (with overlays), there is no
problem resolving equation number references, e.g.
\texttt{\textbackslash ref\{eq:eq1\}} resolves to eq \ref{eq:eq1}:
\begin{equation}
x=1
\label{eq:eq1}
\end{equation}
However within a simple list, where an \texttt{\textbackslash item} appears
within an overlay: equation reference labels are not accessible (even
within the overlay itself). See below:
\begin{list}{}{}
\only<1>{\item Item 1: Not very interesting.}
\only<2>{\item Item 2:
\begin{equation}
x=2
\label{eq:eq2}
\end{equation}
The reference \texttt{\textbackslash ref\{eq:eq2\}} appears unresolved as
eq \ref{eq:eq2}, although eq \ref{eq:eq1} (outside the list) is still
resolved OK.}
\end{list}
\end{frame}
\end{document}
粘贴上述代码并在其上运行 pdflatex,我得到如下输出:
多次重新运行 latex 仍无法解决缺少的引用:日志文件包含:
LaTeX Warning: There were undefined references.
)pdfTeX warning (dest): name{eq:eq2} has been referenced but does not exist, replaced by a fixed one
还能给我指点一下如何显示这些引用吗?
答案1
两种可能性:
正如已经说过的
@gernot
那样\label<2>{eq:eq2}
list
首先,您使用有什么特殊原因吗? Beamer 对itemize
环境有很好的支持,即使您不想要 itemize 符号,您也可以这样做:
\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]
\begin{equation}
x=1
\label{eq:eq1}
\end{equation}
\begin{itemize}[<+->]
\item[] Item 1: Not very interesting.
\item[] Item 2:
\begin{equation}
x=2
\label{eq:eq2}
\end{equation}
\ref{eq:eq2} \ref{eq:eq1}
\end{itemize}
\end{frame}
\end{document}