[Tex/LaTex] straight edge between big nodes in tikz

edgenode-connectionstikz-pgf

I have two rectangle nodes and want to put an edge between them. I want the edge have its arrow between the top center and the top left end of the lower node. I tried to do this with specifying in and out angle, however, this bends the line and makes the arrow look very ugly:

enter image description here

The code:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
  \begin{tikzpicture}
    \node[draw,rectangle] (u1) at (3,8) {run $A$};
    \node[draw,rectangle,align=left] (nextYES) at (3,6.5) {choose $(x,y,z)\\in V_{\mathbb{H}^3{'}}$\\ with $|L(x,y,z)| > 1$};
    \draw (u1) edge[->,>=latex,out=225,in=150] (nextYES);
  \end{tikzpicture}
\end{frame}
\end{document}

Is there a way to make the edge straight, with the edge anchored at the current point (or somewhere nearby) and not turning the arrow at all?

Best Answer

Using in, out will result in a curved path; to get a staright line with the required specifications you have several possibilities:

  1. Use the <point>.<angle> anchors:

    \documentclass{beamer}
    \usepackage{tikz}
    \begin{document}
    \begin{frame}
      *\begin{tikzpicture}
        \node[draw,rectangle] (u1) at (3,8) {run $A$};
        \node[draw,rectangle,align=left] (nextYES) at (3,6.5) {choose $(x,y,z)$\\in $V_{\mathbb{H}^3{'}}$\\ with $|L(x,y,z)| > 1$};
        \draw (u1.230) edge[->,>=latex] (nextYES.140);
      \end{tikzpicture}
    \end{frame}
    \end{document}
    

    enter image description here

  2. Use (possible shifts) and anchors:

    \documentclass{beamer}
    \usepackage{tikz}
    \begin{document}
    \begin{frame}
      \begin{tikzpicture}
        \node[draw,rectangle] (u1) at (3,8) {run $A$};
        \node[draw,rectangle,align=left] (nextYES) at (3,6.5) {choose $(x,y,z)$\\in $V_{\mathbb{H}^3{'}}$\\ with $|L(x,y,z)| > 1$};
        \draw (u1.south) edge[->,>=latex] (nextYES.north west);
      \end{tikzpicture}
    \end{frame}
    \end{document}
    

    enter image description here

    \documentclass{beamer}
    \usepackage{tikz}
    \begin{document}
    \begin{frame}
      \begin{tikzpicture}
        \node[draw,rectangle] (u1) at (3,8) {run $A$};
        \node[draw,rectangle,align=left] (nextYES) at (3,6.5) {choose $(x,y,z)$\\in $V_{\mathbb{H}^3{'}}$\\ with $|L(x,y,z)| > 1$};
        \draw ([xshift=15pt]u1.south west) edge[->,>=latex] ([xshift=15pt]nextYES.north west);
      \end{tikzpicture}
    \end{frame}
    \end{document}
    

    enter image description here

  3. Use the calc library to get some intermediate points (perhaps an overkill here):

    \documentclass{beamer}
    \usepackage{tikz}
    \usetikzlibrary{calc}
    
    \begin{document}
    \begin{frame}
      \begin{tikzpicture}
        \node[draw,rectangle] (u1) at (3,8) {run $A$};
        \node[draw,rectangle,align=left] (nextYES) at (3,6.5) {choose $(x,y,z)$\\in $V_{\mathbb{H}^3{'}}$\\ with $|L(x,y,z)| > 1$};
        \draw 
        ( $ (u1.south west)!0.25!(u1.south east) $ ) edge[->,>=latex] 
        ( $ (nextYES.north west)!0.15!(nextYES.north east) $ );
      \end{tikzpicture}
    \end{frame}
    \end{document}
    

    enter image description here