1

I am drawing a graph where I need to connect two nodes with bended arrow line.

The problem is that instead of having single arrow on that bended line, I am getting two arrows. The arrow marked with red circle is the one I don't want. How to remove it?

Graph image

\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}    
\begin{document}

\tikzstyle{node}=[ circle, inner sep=2.4mm, draw=black, line width=0.2mm, ]

\tikzstyle{linea}=[ draw=black, line width=0.34mm, -triangle 60 ]

\begin{tikzpicture}[y=-1cm]
\node (n1) at (1, 0.5) {}; \node (n2) [node] at (1, 2) {A}; \node (n3) [node] at (1, 4) {x};
\path [linea] (n1) -- (n2); \path [linea] (n2) -- (n3); \path [linea, bend left] (n3.west) edge (n2.west);
\end{tikzpicture} \end{document}

1 Answers1

4

Adaptations

  • use \tikzset instead of \tikzstyle (see Should \tikzset or \tikzstyle be used to define TikZ styles?)
  • add \usetikzlibrary{automata} and use option state for the nodes
  • add \usetikzlibrary{positioning} for relative positioning
  • minimized example
  • added comparison between edge and to
  • If you want to use egde you shouldn't use draw (see lower image).
  • If you want to use to you should use draw (see upper image).
  • If you only need to connect two nodes, the usual way would be to use:
    \draw[linea] (a) to[bend right] (b); % with bend
    \draw[linea] (a) -- (b); % without bend
    

Result

enter image description here

Code

\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows, automata, positioning}

\begin{document}

\begin{tikzpicture}[ linea/.style={ draw, -triangle 60 }, ] \node [state] (a) {a}; \node [state, right=of a] (b) {b}; \node [state, right=of b] (c) {c}; \path [linea, bend left, red] (a.north) edge (b.north) edge node[above]{\texttt{edge}} (c.north); \path [linea, blue, bend right] (a.south) to (b.south) to node[below]{\texttt{to}} (c.south); \end{tikzpicture} \verb|draw| and \verb|\path ...| = \verb|\draw ...|

\begin{tikzpicture}[ linea/.style={ -triangle 60 }, ] \node [state] (a) {a}; \node [state, right=of a] (b) {b}; \node [state, right=of b] (c) {c}; \path [linea, bend left, red] (a.north) edge (b.north) edge node[above]{\texttt{edge}} (c.north); \path [linea, blue, bend right] (a.south) to (b.south) to node[below]{\texttt{to}} (c.south); \end{tikzpicture} no \verb|draw| and \verb|\path|

\end{document}

dexteritas
  • 9,161