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 have the following slide in my beamer presentation :

\documentclass[11pt]{beamer}
\usepackage{ulem}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usetikzlibrary{positioning}
\usepackage{philex}

\begin{document}

\begin{frame}{Contraintes sur le mouvement}

\lb{}{La fille que j'aidais aime ce que tu détestes.}
\begin{center}
\begin{tikzpicture}[scale=.6]
\tikzset{every tree node/.style={align=center,anchor=north}}% to allow linebreaks

\Tree 
[.TP
[.DP 
    [.DP \edge[roof]; {La fille} ]
    [.CP 
        [.C que ]
        [.TP 
            [.\node(tempsAidais)[draw] {T};  ]
            [.\node(aidais){VP};  \edge[roof]; {j'aidais\\\Huge\color{blue}?} ] ] ] ]
[.T$'$  
[.\node(tempsAime)[draw] {T};  ]
[.VP 
[.DP \edge[roof]; {\sout{La fille...}} ] 
[.V$'$ 
%[.V \fbox{aime} ]
[.V \node(aime){aime\\\Huge\color{blue}?}; ]
[.CP 
        [.C ce que ]
        [.TP 
            [.\node(tempsDétestes)[draw] {T};  ]
            [.\node(détestes){VP};  \edge[roof]; {tu détestes\\\Huge\color{blue}?} ] ] ] ] ] ] ] ]

\node (aidais2) [below=.7cm of aidais] {};
\node (détestes2) [below=.7cm of détestes] {};

\draw[-latex] (aidais2.south) to[out=270,in=225,looseness=2] (tempsAidais.265);
\draw[-latex] (aime.south) to[out=270,in=270,looseness=2] (tempsAime.280);
\draw[-latex] (détestes2.south) to[out=270,in=260,looseness=2] (tempsDétestes.south);



\end{tikzpicture}
\end{center}
\end{frame}

\end{document}

I would like to present it first without the interrogation dots, the squares around the Ts, and arrows. Then add the interrogation dots. Then the squares around the Ts. And finally add the arrows.

I could do 4 dirrefent frames, but in that case the counter of my numbered example would be incremented.

So is there a way to progressively draw a tikz picture on a single frame?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

A combination of \only and \uncover could be used. The reason for using \uncover for the arrows is that with \only the arrows are not considered at all for the first three slides, causing a change in the bounding box, making the tree jump around a bit (replace \uncover with \only to see what I mean).

\documentclass[11pt]{beamer}
\usepackage{ulem}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usetikzlibrary{positioning}
\usepackage{philex}

\begin{document}

\begin{frame}{Contraintes sur le mouvement}

\lb{}{La fille que j'aidais aime ce que tu détestes.}
\begin{center}
\begin{tikzpicture}[scale=.6]
\tikzset{every tree node/.style={align=center,anchor=north}}% to allow linebreaks

\Tree 
[.TP
[.DP 
    [.DP \edge[roof]; {La fille} ]
    [.CP 
        [.C que ]
        [.TP 
            [.\node(tempsAidais) {T};  ]
            [.\node(aidais){VP};  \edge[roof]; {j'aidais\only<2->{\\\Huge\color{blue}?}} ] ] ] ]
[.T$'$  
[.\node(tempsAime) {T};  ]
[.VP 
[.DP \edge[roof]; {\sout{La fille...}} ] 
[.V$'$ 
%[.V \fbox{aime} ]
[.V \node(aime){aime\only<2->{\\\Huge\color{blue}?}}; ]
[.CP 
        [.C ce que ]
        [.TP 
            [.\node(tempsDétestes) {T};  ]
            [.\node(détestes){VP};  \edge[roof]; {tu détestes\only<2->{\\\Huge\color{blue}?}} ] ] ] ] ] ] ] ]

\only<3->{%
\foreach \n in {tempsAidais,tempsAime,tempsDétestes}
  \draw (\n.south east) rectangle (\n.north west);
}

\uncover<4>{\node (aidais2) [below=.7cm of aidais] {};
\node (détestes2) [below=.7cm of détestes] {};

\draw[-latex] (aidais2.south) to[out=270,in=225,looseness=2] (tempsAidais.265);
\draw[-latex] (aime.south) to[out=270,in=270,looseness=2] (tempsAime.280);
\draw[-latex] (détestes2.south) to[out=270,in=260,looseness=2] (tempsDétestes.south);
}


\end{tikzpicture}
\end{center}
\end{frame}

\end{document}

enter image description here

share|improve this answer
add comment

You can do it with imbricated \alt. For example if you want to have three steps in your tikz picture, do :

\alt<3>{ your tikz picture at step 3}{
   \alt<2>{ your tikz picture at step 2}{
      your tikz picture at step 1}}

It implies a lot of copy-paste and it is surely not optimal but it worked for me.

For example :

\usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [rectangle, draw, fill=orange!60,rounded corners]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}
\alt<3>{ 
   \node [block] (1) {plop1};
   \node [block, right of=1, node distance=4cm] (2) {plop2};
   \path [line] (1) -- (2);
}{
   \alt<2>{ 
       \node [block] (1) {plop1};
       \node [block, right of=1, node distance=4cm] (2) {plop2};
    }{
       \node [block] (1) {plop1};
    }
}
\end{tikzpicture}
share|improve this answer
add comment

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.