[Tex/LaTex] TikZ choose the origin/end point of path

tikz-pgf

Considering the following code:

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>

\begin{document}
\pagestyle{empty}


% Define block styles
\tikzstyle{block} = [rectangle, draw, node distance=3cm,
    text width=5em, text centered, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (A) {A};
    \node [block, right of=A] (B) {B}; 
    \node [block, below of=A] (C) {long text long text long text long
      text long text long text long text };
    % Draw edges
    \path [line] (A) -- (C);
    \path [line] (B) -- (C);
\end{tikzpicture}
\end{document}

Give as output:

enter image description here

How can I have the two arrow from A and B to be on the same side of the long text block?

Since it is a MWE, I want to keep the same code as possible (so no macro if able) and two straight lines.

Best Answer

You can use the anchors for the nodes (and shiftings if required); for example, <name>.north or <name>.<angle>, or something like

($(<name>.north)!0.5!(<name>.north east)$);

(requires the calc library).

An example showing some of these possibilities:

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>

\begin{document}
\pagestyle{empty}


% Define block styles
\tikzstyle{block} = [rectangle, draw, node distance=3cm,
    text width=5em, text centered, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (A) {A};
    \node [block, right of=A] (B) {B}; 
    \node [block, below of=A] (C) {long text long text long text long
      text long text long text long text };
    % Draw edges
    \path [line] (A) -- (C);
    \path [line] ([yshift=12pt]B.south west) -- (C.90);
    \path [line,blue] (B) -- ($(C.north)!0.5!(C.north east)$);
    \path [line,red] (B.south west) -- (C.62);
\end{tikzpicture}
\end{document}

enter image description here