在疊加中使用列中的數字時保留佈局

在疊加中使用列中的數字時保留佈局

微量元素:

\documentclass{beamer}
\begin{document}

\begin{frame}{hello}
\begin{overlayarea}{\textwidth}{1\textheight}
\begin{columns}[onlytextwidth]
    \begin{column}{0.6\textwidth}
        \begin{itemize}
          \item<1-> statement 1
          \item<2-> statement 2
        \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
      \centering
      \includegraphics<1->[width=40mm]{cat.jpg}
      \includegraphics<2->[width=40mm]{ctanlion.png}%
    \end{column}
​  \end{columns}
\end{overlayarea}
\end{frame}

\end{document}

在此輸入影像描述 在此輸入影像描述

在此 MWE 中,貓的位置固定在兩張幻燈片上。但是,一旦我添加獅子圖像,statement 1和的位置statement 2就會下移。我想修復兩張投影片中statement 1和的位置。不一定要與獅子圖像對齊。statement 2statement 2

答案1

避免此類問題的最簡單方法是使用頂部對齊框架:

\documentclass{beamer}
\begin{document}

\begin{frame}[t]{hello}
%%\begin{overlayarea}{\textwidth}{1\textheight}
\begin{columns}[onlytextwidth,T]
  \begin{column}{0.6\textwidth}
        \begin{itemize}
          \item<1-> statement 1
          \item<2-> statement 2
        \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
      \centering
      \includegraphics<1->[width=40mm]{example-image-duck}
      \includegraphics<2->[width=40mm]{example-image-duck}%
    \end{column}
  \end{columns}
%%\end{overlayarea}
\end{frame}

\end{document}

在此輸入影像描述

或者您可以使用overlayarea第二列的內部:

\documentclass{beamer}
\begin{document}

\begin{frame}{hello}
\begin{columns}[onlytextwidth]
  \begin{column}{0.6\textwidth}
        \begin{itemize}
          \item<1-> statement 1
          \item<2-> statement 2
        \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
          \begin{overlayarea}{\textwidth}{142pt}
      \centering%
      \includegraphics<1->[width=40mm]{example-image-duck}
        \includegraphics<2->[width=40mm]{example-image-duck}%
      \end{overlayarea}
    \end{column}
  \end{columns}
\end{frame}

\end{document}

在此輸入影像描述

(調整 的值142pt以符合兩個影像的組合高度)

我知道你說過它們不一定必須對齊,但如果你想Statement 2對齊,那麼你可以使用兩個columns

\documentclass{beamer}
\begin{document}

\begin{frame}{hello}
\begin{columns}[onlytextwidth]
  \begin{column}{0.6\textwidth}
        \begin{itemize}
          \item statement 1
        \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
      \centering
      \includegraphics[width=40mm]{example-image-duck}
    \end{column}
  \end{columns}
\begin{columns}<2->[onlytextwidth]
  \begin{column}{0.6\textwidth}
        \begin{itemize}
          \item statement 2
        \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
      \centering
      \includegraphics[width=40mm]{example-image-duck}%
    \end{column}
  \end{columns}  
\end{frame}

\end{document}

在此輸入影像描述

相關內容