# Adding arrows, text, and overlaying to two nodes pointing to the same node in beamer and tikz

I would like to create a diagram similar to: http://www.texample.net/tikz/examples/marketing-distribution-channel/

Instead, I would like for the 2 nodes at the bottom to point to the top node, and I cannot get them to do so unless they overlap.

Also, I'd like to add text just as in the link, like the test Participation Rate in that link that is just aside the arrows. However, every time that I add text, the nodes shift so far to the right that some are no longer on the screen.

The other thing that I would like to do is after I've shown all of the nodes, I'd like to put up a new frametitle. I was thinking only or uncover may do the trick but it does not seem to. I'd also like to add some text with bullets. Yet, it does not seem to follow the same spacing and font. See overlay 5 versus Slide 2.

I would be grateful for any help.

 \documentclass{beamer}
\mode<presentation>
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\usepackage{color}

\usepackage{tikz}
\ussetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}

\begin{document}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{labels} = [font=\footnotesize, text centered,red]
\tikzstyle{pointer} = [->,red, thick, >=latex']
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
}}

\frame
{
\frametitle{Frame Title Goes Here}
\begin{figure}
\centering
\begin{tikzpicture}[node distance=1cm, auto]

\tikzset{
mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom          color=yellow!50,very thick, inner sep=1em, minimum size=2em, text centered},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
mylabel/.style={text width=10em, text centered}
}
\uncover<1-4>{\node[mynode, align=center,draw,onslide=<1-3>] at (0,0) (a) {Line 1\\Line 2};}
\uncover<1-3>{\node[mynode, align=center,draw,onslide=<1-3>] at (4.75,0) (b) {Line 1\\Line 2};}
\uncover<1-3>{\draw[myarrow] (a) -- (b);}
\uncover<2-3>{\node[mynode, align=center,draw,onslide=<2-3>] at (-2,-3.75) (c) {Line 1:\\Line 2};
\uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
\uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
\uncover<2-3>{\node[mylabel, below = of dummy](label1){\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
\uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1) -| (a.south);}}
\uncover<3-4>{\node[mynode, align=center,draw,onslide=<3-3>] at (2,-3.75) (d) {Line 1\\Line 2};
\uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
\uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) -- ++(0,1) -| (a.south);}}

\end{tikzpicture}
\end{figure}
\uncover<6-6>{Test}
}
\end{document}


EDIT: using the code in the answer, there still seems to be a problem with long text in one of the nodes:

\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}

\begin{document}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{labels} = [font=\footnotesize, text centered,red]
\tikzstyle{pointer} = [->,red, thick, >=latex']
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
}}

\begin{frame}
\only<1-4>{\frametitle{Frame Title Goes Here}}
\only<5->{\frametitle{Some Other Title}}

\only<5->{
\textbf{Sample:}
\begin{itemize}
\item Peace
\item Love
\item War
\end{itemize}

\vspace{0.65cm}
\textbf{Sample2:}
}

\begin{figure}
\centering
\begin{tikzpicture}[node distance=1cm, auto]

\tikzset{
mynode/.style=
{rectangle,rounded corners,draw=black, top color=white,
bottom color=yellow!50,very thick, inner sep=1em, minimum size=2em, align=center},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
mylabel/.style={text width=10em, text centered}
}

\uncover<1-4>{\node[mynode] at (0,0) (a) {Line 1\\Line 2};}
\uncover<1-3>{\node[mynode] at (4.75,0) (b) {Line 1\\Line 2};}
\uncover<1-3>{\draw[myarrow] (a) -- (b);}
\uncover<2-3>{\node[mynode] at (-2,-3.75) (c) {Line 1:\\Line 2};
\uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
\uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
\uncover<2-3>{\node[mylabel, below = of dummy] (label1)
{\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
\uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1)
node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.250);}}
\uncover<3-4>{\node[mynode] at (2,-3.75) (d) {Line 1\\Line 2};
\uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
\uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) --  ++(0,1)
node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.290);}}

\end{tikzpicture}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Some Other Title}
\textbf{Sample:}
\begin{itemize}
\item Peace
\item Love
\item War
\end{itemize}

\vspace{0.65cm}
\textbf{Sample2:}
\end{frame}

\end{document}

-

## 1 Answer

Perhaps something like this is what you need?

\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}

\begin{document}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{labels} = [font=\footnotesize, text centered,red]
\tikzstyle{pointer} = [->,red, thick, >=latex']
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
}}

\begin{frame}
\only<1-4>{\frametitle{Frame Title Goes Here}}
\only<5->{\frametitle{Some Other Title}}

\only<5->{
\textbf{Sample:}
\begin{itemize}
\item Peace
\item Love
\item War
\end{itemize}

\vspace{0.65cm}
\textbf{Sample2:}
}

\only<1-4>{%
\begin{figure}
\centering
\begin{tikzpicture}[node distance=1cm, auto]

\tikzset{
mynode/.style=
{rectangle,rounded corners,draw=black, top color=white,
bottom color=yellow!50,very thick, inner sep=1em, minimum size=2em, align=center},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
mylabel/.style={text width=10em, text centered}
}

\uncover<1-4>{\node[mynode] at (0,0) (a) {Line 1\\Line 2};}
\uncover<1-3>{\node[mynode] at (4.75,0) (b) {Line 1\\Line 2};}
\uncover<1-3>{\draw[myarrow] (a) -- (b);}
\uncover<2-3>{\node[mynode] at (-2,-3.75) (c) {Line 1:\\Line 2};
\uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
\uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
\uncover<2-3>{\node[mylabel, below = of dummy] (label1)
{\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
\uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1)
node[swap,anchor=east,text width=3cm] {some really really really long text goes here} -| (a.250);}}
\uncover<3-4>{\node[mynode] at (2,-3.75) (d) {Line 1\\Line 2};
\uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
\uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) --  ++(0,1)
node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.290);}}

\end{tikzpicture}
\end{figure}}
\end{frame}

\end{document}

-
Thank you for your response! It is very helpful. If I add too much text in the "Text goes here" part, it pushes all of the nodes to the right. Do I adjust that with the text width? Also, is there a way to use the equivalent of \\ with that? I get syntax errors when I try \\. – J G Sep 11 '12 at 20:48
@JG yes, you can use text width as option to the node to control the width; using this option, you can use \\ to explicitly break lines. – Gonzalo Medina Sep 11 '12 at 21:00
@GonzaloMedina: To be able to add explicit line breaks, it's sufficient to specify an align option, you don't have to fix the text width. – Jake Sep 11 '12 at 21:02
@Jake you're right. I mentioned the text width option since it allows to fix the width and automatically produce break lines. – Gonzalo Medina Sep 11 '12 at 21:04
@GonzaloMedina: Yeah, sorry, the comment was more directed at J G, in case he also wanted an option to produce manual line breaks without hardcoding the text width. – Jake Sep 11 '12 at 21:09