4

When I draw a commutative diagram with tikz, I normally use the syntax

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};
\path[->]
(a) edge (b)
(b) edge (c)
(a) edge [bend left] (c)
(a) edge [bend right] (c);
\end{tikzpicture}
\end{center}

\end{document}

This time, due to the size of the nodes, I need to use .. controls (2,2) .. to make the arrows avoid the nodes. But when I type

\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};
\draw[->]
(a) edge (b)
(b) edge (c)
(a) .. controls (2,2) ..  (c)
(a) .. controls (2,-2) .. (c);
\end{tikzpicture}
\end{center}

the arrow tip appears only at the last line drawn using the controls syntax (and at the two edges). How can I specify that I want an arrow tip at every line?

7
  • Wouldn't it be simpler to do with tikz-cd?
    – Bernard
    Jun 24, 2016 at 13:29
  • @Bernard: I'm used to using the tikzpicture environment. Usually, my diagrams are much larger and more complex. Jun 24, 2016 at 13:31
  • You can use edge[bend left=45]
    – percusse
    Jun 24, 2016 at 14:14
  • 3
    You can do \draw[->] .. ; for each line rather than \draw[->] .. .. .. ..; for all lines.
    – Manuel
    Jun 24, 2016 at 15:04
  • 1
    The thing is that in most cases, you only want the arrow tip at the end of the whole path - you don't want one at the end of every subpath. So PGF/TikZ goes with the usually-what-you-want. The best way to do this is to use distinct paths. You could use e.g. markings or decorations probably, but that's very clunky.
    – cfr
    Jun 24, 2016 at 21:21

1 Answer 1

3

You can use arrows.meta library and looseness key to control the distance from the control point to the two end points as said in the pgfmanual.

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage[tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}
\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};

\path[->]
(a) edge (b)
(b) edge (c)
(a) edge [out=80,in=100,looseness=5] (c)
(a) edge [out=-55,in=-125,looseness=1.5] (c);
\end{tikzpicture}

\end{center}
\end{document}

enter image description here

3
  • That almost worked, but the shape of the edge does just not fit my diagram. I need the edge to move very far upward, then make a very sharp curve to the right, and then go on for a rather short distance. With the looseness alone, I cannot achieve this. Jun 24, 2016 at 15:01
  • @StefanHamcke You can, adding one intermediate point (or may be more for more control).
    – Manuel
    Jun 24, 2016 at 15:03
  • @StefanHamcke Or you can try to change the in and out angles. It will change the shape of the edge. Jun 24, 2016 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .