Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I currently have this piece of text for a quiz:

\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}

I would like to present the question with the different possibilities to answer and on the next slides the different possibilities to answer should disappear, the rest should not move and the correct answer with an explanation should appear.

The current solution is not optimal, as the question moves. I've also tried visible instead of only, but with this solution the explanation doesn't appear at all.

(I know I could manually fix the "moving question problem" by adding space, but I don't want to do this for all slides.)

share|improve this question
    
Did you try uncover<2>? –  Sigur Dec 15 '12 at 10:01
    
If I use uncover, the answer will be shown before I reveal it. I don't want my students simply to read the answer... –  moose Dec 15 '12 at 10:09
    
I know that there are 2 similar commands and one of them save space for the next one. Are you using transparency 100% to completely hide the items? –  Sigur Dec 15 '12 at 10:12
    
Have you tried replacing \only by \onslide? –  Brent.Longborough Dec 15 '12 at 10:16
1  
@Sigur: With my the theme of my university, it fits on a single slide. –  moose Dec 15 '12 at 10:37

2 Answers 2

up vote 4 down vote accepted

You may try the overprint environment (chap. 9.5, beamer user guide).

\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}
share|improve this answer
    
That's interesting ... onslide<1>{myContent} gives different results than onslide<1> myCodntent. –  moose Dec 15 '12 at 11:11
    
This is great! Exactly what I needed. There is one major drawback, though: it seems I can no longer use the handouts documentclass option if I use an overprint environment. Anyone know a way around this? –  William DeMeo Feb 7 '13 at 20:09
\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}

Here is the sample above: beamer slide

share|improve this answer
    
It seems as if I hadn't expressed myself precisely. I'm sorry for that. I want the correct answer to be able to take the space where the possible answers were. I don't want the correct answer to appear below the possible answers. –  moose Dec 15 '12 at 10:36
    
Hum, OK, I see understand now. Sorry. –  Sigur Dec 15 '12 at 10:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.