2

This question is a follow-up for my badly accepted

Bézier curves for arrows in tikz

I have come up with the following. The Bézier-curve arrow works, but my label doesn't:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\usetikzlibrary{arrows.meta,positioning}

\begin{center} \begin{tikzpicture}[state/.style={rectangle,draw=black, rounded corners},arrow/.style={->,semithick}]

\node[state] (theory) at (0,4) {theory}; \node[state] (chain) at (4,-2) {chain}; \node[state] (prove) at (0,0) {prove}; \node[state] (state) at (8,0) {state}; \draw [arrow] (state) .. controls (8,-2) and (6,-2) .. (chain) {then}; \end{tikzpicture} \end{center}

\end{document}

TeXWorks on Windows 10 complains about

! Use of \pgfutil@next doesn't match its definition.
l.16 ... controls (8,-2) and (6,-2) .. (chain) {th
                                                  en};
? 

How can I create a label for this arrow?

Gergely
  • 1,065
  • 1
  • 8
  • 17
  • Where do you want to put the label? At the midway from (state) to (chain), or around the (chain)? Also, edge is recommended to draw arrows like this, see the complete step-by-step example in PGF manual, sec. 3. – muzimuzhi Z Jun 24 '20 at 11:01
  • I would like to put it on the curve, not at the tip of the arrow. – Gergely Jun 24 '20 at 11:14

2 Answers2

1
\draw [arrow] (state) .. controls (8,-2) and (6,-2) ..   (chain) node [midway, below] {then} ;

works: I have found the necessary ingredients at

https://tex.stackexchange.com/a/170716/27523

Gergely
  • 1,065
  • 1
  • 8
  • 17
1

A solution using edge:

\draw[arrow] (state) edge[out=-90, in=0, looseness=1.1] node[auto] {then} (chain);

Full example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}

\begin{document}

\begin{center} \begin{tikzpicture}[state/.style={rectangle,draw=black, rounded corners},arrow/.style={->,semithick}] \node[state] (theory) at (0,4) {theory}; \node[state] (chain) at (4,-2) {chain}; \node[state] (prove) at (0,0) {prove}; \node[state] (state) at (8,0) {state}; \draw[arrow] (state) edge[out=-90, in=0, looseness=1.1] node[auto] {then} (chain); \end{tikzpicture} \end{center}

\end{document}

enter image description here

Compared to the curved path construction (edge draws in blue): enter image description here

muzimuzhi Z
  • 26,474