我有一張逐漸打開的幻燈片。假設它通常有 n 張幻燈片。但「現在」我決定不再從投影片 1 開始,而是從投影片 2 開始。我該如何解決這個問題?
我在下面提供了一個最小的例子。請注意,我複製了所有幻燈片,以便我可以將標籤定義為幻燈片的參數以及「通常的方式」——只是為了表明這不會改變任何內容。
這裡是程式碼:
\documentclass{beamer}
\begin{document}
\begin{frame}<2->{Title of Slide 1}\label{LabelOfSlideOne}
Slide 1 has three subslides, opened one by one, normally. Here, however, we start at slide number 2!
\begin{itemize}[<+->]
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
\begin{frame}<2->[label=LabelOfSlideTwo]{Title of Slide 2}
Slide 2 is exactly as slide 1, we simply define the label differently.
\begin{itemize}[<+->]
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
\begin{frame}{Title of Slide 3}\label{LabelOfSlideThree}
Slide 3 has two subslides, we show them incrementally, as normal.
\begin{itemize}[<+->]
\item 1
\item 2
\end{itemize}
\end{frame}
\begin{frame}[label=LabelOfSlideFour]{Title of Slide 4}
Slide 4 is exactly as slide 3, we simply define the label differently.
\begin{itemize}[<+->]
\item 1
\item 2
\end{itemize}
\end{frame}
\begin{frame}{Slide 5: Test all the references!}
\begin{itemize}
\item This should show a 1: \ref{LabelOfSlideOne}
\item This should show a 2: \ref{LabelOfSlideTwo}
\item This should show a 3: \ref{LabelOfSlideThree}
\item This should show a 4: \ref{LabelOfSlideFour}
\end{itemize}
\end{frame}
\end{document}
這就是結果:
這表明雖然通常情況下定義標籤效果很好(最後兩張投影片),當我們不顯示所有投影片(前兩張投影片)時,它就不起作用。
那麼...如何解決這個問題呢?
答案1
有幾種方法可以避免該問題:
您可以在特定覆蓋層上指定標籤,例如
\label<2>{LabelOfSlideOne}
您可以引用標籤的特定覆蓋層,例如
\ref{LabelOfSlideTwo<2>}
\documentclass{beamer}
\begin{document}
\begin{frame}<2->{Title of Slide 1}\label<2>{LabelOfSlideOne}
Slide 1 has three subslides, opened one by one, normally. Here, however, we start at slide number 2!
\begin{itemize}[<+->]
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
\begin{frame}<2->[label=LabelOfSlideTwo]{Title of Slide 2}
Slide 2 is exactly as slide 1, we simply define the label differently.
\begin{itemize}[<+->]
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
\begin{frame}{Title of Slide 3}\label{LabelOfSlideThree}
Slide 3 has two subslides, we show them incrementally, as normal.
\begin{itemize}[<+->]
\item 1
\item 2
\end{itemize}
\end{frame}
\begin{frame}[label=LabelOfSlideFour]{Title of Slide 4}
Slide 4 is exactly as slide 3, we simply define the label differently.
\begin{itemize}[<+->]
\item 1
\item 2
\end{itemize}
\end{frame}
\begin{frame}{Slide 5: Test all the references!}
\begin{itemize}
\item This should show a 1: \ref{LabelOfSlideOne}
\item This should show a 2: \ref{LabelOfSlideTwo<2>}
\item This should show a 3: \ref{LabelOfSlideThree}
\item This should show a 4: \ref{LabelOfSlideFour}
\end{itemize}
\end{frame}
\end{document}