我怎样才能用投影仪替换文本框?

我怎样才能用投影仪替换文本框?

我目前有一段用于测验的文字:

\begin{frame}{Quiz}
    \begin{block}{Frage}
        With generics the compiler has more information about the 
        types of the objects, so explicit casts don't have to be used 
        and the compiler can produce type safe code.

        What implications have the generics for the runtime 
        performance of the  program which uses them?
    \end{block}

    \only<1>{
    \begin{itemize}
        \item With the generics the compiler can optimize the code for 
              used types. This and the omission of the casts are the 
              reasons why the code compiled with the generics is 
              \textbf{quicker} than the one compiled without.
        \item The usage of generics has \textbf{no implications} for 
              the runtime performance of the compiled programs.
        \item The improved flexibility and type safety means that the 
              compiler has to generate concrete implementation from 
              the generic template for each used type. This means 
              that applications start \textbf{a bit slower}.
    \end{itemize}}
    \only<2>{
        The Java Virtual Machine and the copiled byte code are Generics 
        agnostic. The comiled byte code does not differ from byte code 
        compiled from sources which don't use the generics.
        So using the generics has \textbf{no impact} on the runtime 
        performance of compiled Java code.
    }
\end{frame}

我想提出具有不同答案可能性的问题,并且在下一张幻灯片中,不同的答案可能性应该消失,其余的不应该移动,并且应该出现带有解释的正确答案。

随着问题的进展,当前的解决方案并不是最佳的。我也尝试过使用visible而不是only,但使用这个解决方案时,解释根本就不会出现。

(我知道我可以通过添加空间手动修复“移动问题问题”,但我不想对所有幻灯片都这样做。)

答案1

您可以尝试overprint环境(第 9.5 章,beamer 用户指南)。

\documentclass{beamer}

\begin{document}
\begin{frame}{Quiz}
    \begin{block}{Frage}
        With generics the compiler has more information about the 
        types of the objects, so explicit casts don't have to be used 
        and the compiler can produce type safe code.

        What implications have the generics for the runtime 
        performance of the  program which uses them?
    \end{block}

    \begin{overprint}
      \onslide<1>
      \begin{itemize}
      \item With the generics the compiler can optimize the code for 
        used types. This and the omission of the casts are the 
        reasons why the code compiled with the generics is 
        \textbf{quicker} than the one compiled without.
      \item The usage of generics has \textbf{no implications} for 
        the runtime performance of the compiled programs.
      \item The improved flexibility and type safety means that the 
        compiler has to generate concrete implementation from 
        the generic template for each used type. This means 
        that applications start \textbf{a bit slower}.
      \end{itemize}
      \onslide<2>
      The Java Virtual Machine and the copiled byte code are Generics 
      agnostic. The comiled byte code does not differ from byte code 
      compiled from sources which don't use the generics.
      So using the generics has \textbf{no impact} on the runtime 
      performance of compiled Java code.
    \end{overprint}

  \end{frame}
\end{document}

答案2

作为 Paul Gaborit 回答的补充,以及关于 Handout 的评论,Beamer 用户指南中是这样说的:

\onslide 命令的叠加规范必须是不相交的。这对于讲义来说可能是一个问题,因为在那里,所有叠加规范都默认为 1。如果您使用选项讲义,您可以通过将其他 \onslide 设置为 0 来禁用除一个 \onslide 之外的所有 \onslide。

例子:

\begin{overprint}
\onslide<1| handout:1>
Some text for the first slide.\\
Possibly several lines long.
\onslide<2| handout:0>
Replacement on the second slide. Supressed for handout.
\end{overprint}

答案3

\documentclass[11pt,a4paper]{beamer}

\begin{document}

\begin{frame}{Quiz}
    \begin{block}{Frage}
        With generics the compiler has more information about the 
        types of the objects, so explicit casts don't have to be used 
        and the compiler can produce type safe code.

        What implications have the generics for the runtime 
        performance of the  program which uses them?
    \end{block}

    \uncover<1>{
    \begin{itemize}
        \item With the generics the compiler can optimize the code for 
              used types\ldots
        \item The usage of generics has \textbf{no implications} for 
              the runtime performance of the compiled programs.
        \item The improved flexibility and type safety means that the 
              compiler has to\ldots
    \end{itemize}}
    \uncover<2>{
        The Java Virtual Machine and the copiled byte code are Generics 
        agnostic. The comiled byte code does not differ from byte code 
        compiled from sources \ldots
    }
\end{frame}
\end{document}

相关内容