![將標籤加入到鏈連接箭頭線上](https://rvso.com/image/472700/%E5%B0%87%E6%A8%99%E7%B1%A4%E5%8A%A0%E5%85%A5%E5%88%B0%E9%8F%88%E9%80%A3%E6%8E%A5%E7%AE%AD%E9%A0%AD%E7%B7%9A%E4%B8%8A.png)
我想在鏈連接箭頭線上添加一些標籤。
可以添加任何命令來將樣式與標籤連接嗎?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,chains}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm,
arrow/.style={->, >=Stealth, thick},
every on chain/.append style={draw,join,rounded corners,minimum width=2cm, minimum height=1cm, align=center},
every join/.style={arrow},
start chain=C1 going right,
]
\def\nodes{
A/A2B,
B/B2C,
C/C2A%
}
\foreach \name/\label [count=\i] in \nodes {
\typeout{debugme \label}
\node[on chain,join] (N\i) {\name};
}
\end{tikzpicture}
\end{document}
答案1
來自 js bibra 的回答,chain-end
與chain-begin
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
%positioning,
% scopes,
quotes,}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm,
arrow/.style={->, >=Stealth, thick},
every on chain/.append style={draw,join,rounded corners,minimum width=2cm, minimum height=1cm, align=center},
every join/.style={arrow},
start chain=going right,
]
\def\nodes{
A/,
B/A2B,
C/B2C%
}
\foreach \name/\label [count=\i] in \nodes {
% \node[on chain,join=by {->,"\label"}] (N\i) {\name};
\node[on chain,join=by {"\label"}] (N\i) {\name};
}
\draw [arrow] (chain-end.south) -- ++(0,-1.) -| (chain-begin.south) node[above,pos=0.25]{C2A};
\end{tikzpicture}
\end{document}
答案2
自從最後一個節點顯示為空框以來的部分答案 - 無法找到如何刪除它 - 可能一些退伍軍人會介入提供幫助
輸出
微量元素
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,chains,positioning,scopes,quotes}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm,
arrow/.style={->, >=Stealth, thick},
every on chain/.append style={draw,join,rounded corners,minimum width=2cm, minimum height=1cm, align=center},
every join/.style={arrow},
start chain=C1 going right,
]
\def\nodes{
A/,
B/A2B,
C/B2C,
/C2A%
}
\foreach \name/\label [count=\i] in \nodes {
\node[on chain,join=by {->,"\label"}] (N\i) {\name};
}
\end{tikzpicture}
\end{document}