24.10.11

Nice overlay effect in LaTeX Beamer

By Christian Gogolin in http://www.cgogolin.de/Computer.html


screenshot of a sample slideWhen doing slides for a talk you sometimes want to first give an overview of a certain idea and then explain some parts of it in more detail. One way of doing this is to uncover the information bitwise. Sometimes this might not be ideal for a couple of reasons. For example, you must be careful to leave enough space for the extra information, which can easily lead to an odd looking layout. Alternatively, and in particular if you have quite a lot of extra information, you could create an entirely new page covering the extra information and then come back to the overview page once you have finished explaining them. This approach also has certain downsides, the most important of which probably is that the audience might miss the fact that you are still talking about the same thing. Especially if you want to provide details concerning several different aspects of you main idea this can be very confusing.
So, what to do?
I think that a quite elegant way to deal with such a situation is the following: Put the details in a box that hovers above the overview slide. This way you can avoid ending up with a cluttered layout and still give the audience some visual guidance that will help them to intuitively understand that you have not switched subject but are rather giving some details. An example of how this can look like can be seen in the picture on the left or in the slides of my talk"Thermalization in nature and on a quantum computer".
And here is how you can implement this using TikZ and LaTeX Beamer:
\newcommand<>{\hover}[1]{\uncover#2{%
 \begin{tikzpicture}[remember picture,overlay]%
 \draw[fill,opacity=0.4] (current page.south west)
 rectangle (current page.north east);
 \node at (current page.center) {#1};
 \end{tikzpicture}}
 }
      
This command will cover the entire page with an opaque black rectangle and the draw what ever you give it as main argument in the middle of the page above this rectangle. The <> after the \newcommand makes it overlay specification aware. A standard use case would be the following:

      \begin{frame}
      \frametitle{A frame}
      Some text
      \hover<2>{
      \begin{minipage}{0.8\linewidth}
      \begin{block}{A block hovering above the slide}
      I am visible on slide two.
      \end{block}
      \end{minipage}
      }
      \end{frame}
      
The effect works particularly well with the option [realshadow] of my inner themebeamerinnerthemechamfered.
There is however one problem with LaTeX Beamer themes that include a foot line. The foot line is drawn after the content of the frame. There is thus no (easy) way to have the opaque rectangle cover the foot line. The foot line of my outer theme beamerouterthemewuerzburg can be suppressed by giving the [nofootline] option.

No hay comentarios:

Publicar un comentario