3

What is the best practice for adding/uncover TikZ pictures on top of a beamer slide? I have tried the following approach

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
  \frametitle{Testing}
  \begin{itemize}
  \item<1-> A
  \item<2-> B
  \item<3-> C
  \item<4-> D
  \end{itemize}
  \begin{picture}(0, 0) {
     \onslide<2>{
       \put(0,30){
         \begin{tikzpicture}
           \draw[black,thick,<->] (0,0) -- (1,0) node {Line 1};
         \end{tikzpicture}
      }}
     \onslide<3>{
       \put(20,100){
         \begin{tikzpicture}
           \draw[black,thick,<->] (0,0) -- (3,2) node {Line 2};
          \end{tikzpicture}
     }}}
   \end{picture}
\end{frame}
\end{document}

of wrapping the TikZ pictures in a picture environment at the bottom of the slide. However, the picture environment still occupies space on the slide, affecting the positioning of the other elements on the slide.

Also if, I add a new item to the list, I have to recalculate (by trial and failure) the position of the picture environment.

Is there a better way of doing this?

2
  • 1
    What do you want to achieve here? Take a look at overlay (the TikZ picture doesn’t occupy any space) as well as remember picture (which makes it possible to reference the page as a node itself). Oct 23 '13 at 20:46
  • 2
    Looks like tikzmark is going to be your friend: tex.blogoverflow.com/2013/04/beware-the-tikzmark-my-son
    – Herr K.
    Oct 23 '13 at 21:02
2

Would this be what you have tried to achieve? Gradually showing how to to draw via tikz. Here only the last page is shown. Drawing starts from slide 3 to 5 where uncover commands are used.

enter image description here

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{matrix, shapes, arrows, positioning}
\begin{document}
\begin{frame}
\frametitle{Testing}
\begin{columns}
\column{0.5\textwidth}
  \begin{itemize}
  \item<1-> A
  \item<2-> B
  \item<3-> C : draw line 1. 
  \item<4-> D : draw line 2.
  \item<5-> E : draw line 2
  \item<6>  F
  \end{itemize}
\column{0.5\textwidth}
\begin{tikzpicture}
\uncover<3->{\draw[black,thick,->] (0,0) -- (2,0) node[right] {Line 1};}
\uncover<4->{\draw[black,thick,->] (0,0) -- (3,2) node[above] {Line 2};}
\uncover<5->{\draw[black,thick,->] (2,0) -- (3,2) node[below right] {Line 3};}
\end{tikzpicture}
\end{columns}
\end{frame}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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