tikz 中箭头上的标签

tikz 中箭头上的标签

这个问题是我被严重接受的

tikz 中箭头的贝塞尔曲线

我想到了以下方法。贝塞尔曲线箭头有效,但我的标签无效:

\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}

Windows 10 上的 TeXWorks 抱怨

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

我如何为该箭头创建标签?

答案1

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

作品:我已经找到了必要的成分

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

答案2

使用以下解决方案edge

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

完整示例:

\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}

在此处输入图片描述

与曲线路径构造(edge蓝色绘制)相比: 在此处输入图片描述

相关内容