发现其他内容后重新定位内容

发现其他内容后重新定位内容

更新:

考虑以下乳胶文档:

\documentclass{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[t,fragile]
  \frametitle{Implementing FA}
  \begin{minipage}{.45\linewidth}
        \begin{tabular}{l | c | c |}
      \multicolumn{1}{r}{} &  \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} \\ \cline{2-3}
      S & \onslide<2->{\textcolor{blue}{T}}  & \onslide<3->{\textcolor{blue}{U}}  \\ \cline{2-3}
      T & \onslide<4->{\textcolor{blue}{T}}  & \onslide<5->{\textcolor{blue}{U}}  \\ \cline{2-3}
      U & \onslide<6->{\textcolor{blue}{T}}  & \onslide<7->{\textcolor{blue}{U}}  \\ \cline{2-3}
    \end{tabular}
  \end{minipage}\hfill
  \begin{minipage}{.45\linewidth}
    \begin{onlyenv}<9->
\begin{lstlisting}
i = 0;
state = 0;

while (input[i])
{
  state = A[state,input[i++]];
}
\end{lstlisting}
        \end{onlyenv}
      \end{minipage}
\end{frame}
\end{document}

一旦幻灯片 9 被取消转换,第一个(左侧)小页面上的表格就会被重新定位。如何禁止这种情况?

答案1

一个选项是使用st的(顶部对齐)选项minipage

\documentclass{beamer}
\usepackage{listings}

\begin{document}
\begin{frame}[t,fragile]
\frametitle{Implementing FA}

\begin{minipage}[t]{.45\linewidth}
\begin{tabular}{l | c | c |}
      \multicolumn{1}{r}{} &  \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} \\ \cline{2-3}
      S & \onslide<2->{\textcolor{blue}{T}}  & \onslide<3->{\textcolor{blue}{U}}  \\ \cline{2-3}
      T & \onslide<4->{\textcolor{blue}{T}}  & \onslide<5->{\textcolor{blue}{U}}  \\ \cline{2-3}
      U & \onslide<6->{\textcolor{blue}{T}}  & \onslide<7->{\textcolor{blue}{U}}  \\ \cline{2-3}
\end{tabular}
\end{minipage}\hfill
\begin{minipage}[t]{.45\linewidth}
\begin{onlyenv}<9->
\begin{lstlisting}[breaklines=true]
i = 0;
state = 0;

while (input[i])
{
  state = A[state,input[i++]];
}
\end{lstlisting}
\end{onlyenv}
\end{minipage}
\end{frame}

\end{document}

在此处输入图片描述

相同的想法,但是使用本机的columns\column命令(本质上在内部它将转换为minipages):

\documentclass{beamer}
\usepackage{listings}

\begin{document}
\begin{frame}[t,fragile]
\frametitle{Implementing FA}

\begin{columns}
\column[t]{.45\linewidth}
\begin{tabular}{l | c | c |}
      \multicolumn{1}{r}{} &  \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} \\ \cline{2-3}
      S & \onslide<2->{\textcolor{blue}{T}}  & \onslide<3->{\textcolor{blue}{U}}  \\ \cline{2-3}
      T & \onslide<4->{\textcolor{blue}{T}}  & \onslide<5->{\textcolor{blue}{U}}  \\ \cline{2-3}
      U & \onslide<6->{\textcolor{blue}{T}}  & \onslide<7->{\textcolor{blue}{U}}  \\ \cline{2-3}
\end{tabular}
\column[t]{.45\linewidth}
\begin{onlyenv}<9->
\begin{lstlisting}[breaklines=true]
i = 0;
state = 0;

while (input[i])
{
  state = A[state,input[i++]];
}
\end{lstlisting}
\end{onlyenv}
\end{columns}
\end{frame}

\end{document}

相关内容