[Tex/LaTex] Writing paths in tikz

beamertikz-pgf

I am trying to connect some nodes in tikz but could not get some stuff right. Regarding the third path:

1-) How can I make it go to the left or from the top of "Third quantity" towards the center bottom of the specified term in the equation? Currently it is going up and arriving to the left.

2-) Is is possible to put "Second quantity" and "Third quantity" in the same line?

\documentclass{beamer} %
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}

\author{Author}
\title{Presentation title}

\begin{document}

\tikzstyle{every picture}+=[remember picture]

\everymath{\displaystyle}


\begin{frame}
\frametitle{Description}

\tikzstyle{na} = [baseline=-.5ex]

First quantity
    \tikz[na] \node[coordinate] (n1) {};

\begin{equation*}
 A = B +
    \tikz[baseline]{
        \node[fill=blue!20,anchor=base] (t1)
        {$ 2C\times D$};
    } +
    \tikz[baseline]{
        \node[fill=red!20, ellipse,anchor=base] (t2)
        {$F\otimes G$};
    } +
    \tikz[baseline]{
        \node[fill=green!20,anchor=base] (t3)
        {$H$};
    }
\end{equation*}

Second quantity
    \tikz[na]\node [coordinate] (n2) {};
        \begin{flushright}
        \tikz[na]\node [coordinate] (n3) {};
Third quantity (check p.46)
\end{flushright}

\begin{tikzpicture}[overlay]
    \path[->]<1-> (n1) edge [bend left] (t1);
    \path[->]<1-> (n2) edge [bend right] (t2);
    \path[->]<1-> (n3) edge [bend left](t3);
\end{tikzpicture}
\end{frame}

\end{document}

Best Answer

If I understand you correctly, for 1), use out=90,in=270 instead of bend left for the edge used to darw the line. For 2),remove the flushright environment, and add an \hfill between the node belonging to Second.. and Third ...

(I may have misunderstood what you meant about the first problem, please comment if you want something different.)

enter image description here

\documentclass{beamer} %
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}

\author{Author}
\title{Presentation title}

\begin{document}

\tikzstyle{every picture}+=[remember picture]

\everymath{\displaystyle}


\begin{frame}
\frametitle{Description}

\tikzstyle{na} = [baseline=-.5ex]

First quantity
    \tikz[na] \node[coordinate] (n1) {};

\begin{equation*}
 A = B +
    \tikz[baseline]{
        \node[fill=blue!20,anchor=base] (t1)
        {$ 2C\times D$};
    } +
    \tikz[baseline]{
        \node[fill=red!20, ellipse,anchor=base] (t2)
        {$F\otimes G$};
    } +
    \tikz[baseline]{
        \node[fill=green!20,anchor=base] (t3)
        {$H$};
    }
\end{equation*}

\bigskip

Second quantity
    \tikz[na]\node [coordinate] (n2) {}; \hfill
        \tikz[na]\node [coordinate] (n3) {};
Third quantity (check p.46)


\begin{tikzpicture}[overlay]
    \path[->]<1-> (n1) edge [bend left] (t1);
    \path[->]<1-> (n2) edge [bend right] (t2);
    \path[->]<1-> (n3) edge [out=90,in=270](t3);
\end{tikzpicture}
\end{frame}

\end{document}

If you want the arrows to start in the middle of the words, there are a couple of options. One is to move the \tikz\node... between the words, as this is what defines the start point. In this case you may want to move it up a bit, so instead of using the na style, add something like baseline=-1.5ex.

The second option is to place the words themselves in a node, so instead of saying Second quantity\tikz\node..., use \tikz[na]\node(n2){Second quantity};. You can then start the arrows in n2.south (or north). Both options are demonstrated in the code below.

enter image description here

\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}

\author{Author}
\title{Presentation title}

\tikzset{every picture/.append style={remember picture},
na/.style={baseline=-.5ex}}

\everymath{\displaystyle}
\begin{document}
\begin{frame}
\frametitle{Description}
First quantity
    \tikz[na] \node[coordinate] (n1) {};

\begin{equation*}
 A = B +
    \tikz[baseline]{
        \node[fill=blue!20,anchor=base] (t1)
        {$ 2C\times D$};
    } +
    \tikz[baseline]{
        \node[fill=red!20, ellipse,anchor=base] (t2)
        {$F\otimes G$};
    } +
    \tikz[baseline]{
        \node[fill=green!20,anchor=base] (t3)
        {$H$};
    }
\end{equation*}

\bigskip

% first option: place the text in a node, refer to nodename.south (or north)
\tikz[na]\node(n2){Second quantity};
\hfill
% second option: move the coordinate node between the words, and move the baseline a bit upwards.
Third \tikz[baseline=-1.5ex]\node [coordinate] (n3) {};quantity (check p.46)

\begin{tikzpicture}[overlay]
    \path[->]<1-> (n1) edge [bend left] (t1);
    \path[->]<1-> (n2.south) edge [bend right] (t2);
    \path[->]<1-> (n3) edge [out=90,in=270](t3);
\end{tikzpicture}
\end{frame}

\end{document}