2

I would like to have a figure, where every edge has an arrow. When I \draw edges with tikz, something strange happens: The "same" code yields different results.

Code

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,
                   auto,node distance=3.5cm, thick,node/.style={circle,draw}]
        \node[node] (L) {Lousy};
        \node[node] (R) [right of=L] {Right};

        \draw
            (L) to [in=300, out=240, looseness=3] node [below] {A} (L)
            (R) to [in=300, out=240, looseness=3] node [below] {A, B, C} (R)
            ;
\end{tikzpicture}

Result

enter image description here

Observation

While on the left side there is no arrow, on the right side there is an arrow. The function call drawing the edge seems to be the same, though.

I am rather new to tikz, and I have no idea how to fix this. Any insight on why this happens and how to fix it, would be very appreciated.

  • It is because the arrow is only drawn at the END of the path – Bordaigorl Nov 16 '16 at 16:22
4

Two \draw commands are needed. With -> among the options in the surrounding tikzpicture:

    \draw
        (L) to [in=300, out=240, looseness=3] node [below] {A} (L)
        ;
    \draw
        (R) to [in=300, out=240, looseness=3] node [below] {A, B, C} (R)
        ;

Details are explained in the pgf/TikZ manual, "16.2 Where and When Arrow Tips Are Placed".

3

You should use two separate paths, one for each arrow:

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,
                   auto,node distance=3.5cm, thick,node/.style={circle,draw}]
        \node[node] (L) {Lousy};
        \node[node] (R) [right of=L] {Right};

        \draw
            (L) to [in=300, out=240, looseness=3] node [below] {A} (L);
        \draw
            (R) to [in=300, out=240, looseness=3] node [below] {A, B, C} (R);
\end{tikzpicture}

If you want to keep it in one path, use the edge operation instead of to:

\draw
    (L) edge [in=300, out=240, looseness=3] node [below] {A} (L)
    (R) edge [in=300, out=240, looseness=3] node [below] {A, B, C} (R)
    ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.