![tikz 中箭头上的标签](https://linux22.com/image/416510/tikz%20%E4%B8%AD%E7%AE%AD%E5%A4%B4%E4%B8%8A%E7%9A%84%E6%A0%87%E7%AD%BE.png)
这个问题是我被严重接受的
我想到了以下方法。贝塞尔曲线箭头有效,但我的标签无效:
\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} ;
作品:我已经找到了必要的成分
答案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}