如何使用和在下面的代码中移除/抑制从节点3
到节点的边?4
chains
join
我是否必须将其拆分foreach
成两个较小的?
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning, arrows.meta, chains}
\begin{document}
\begin{tikzpicture}[node distance = 1.00cm,
every node/.style = {draw, circle, fill = blue!20},
every join/.style = {->},
start chain = path]
\foreach \i in {1, ..., 7} {
\node [on chain, join] {\i};
}
\end{tikzpicture}
\end{document}
答案1
像这样?
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning, arrows.meta, chains}
\begin{document}
\begin{tikzpicture}[node distance = 1.00cm,
every node/.style = {draw, circle, fill = blue!20},
every join/.style = {->},
start chain = path]
\foreach \i in {1, ..., 7} {
\ifnum\i=4
\node [on chain] {\i};
\else
\node [on chain, join] {\i};
\fi
}
\end{tikzpicture}
\end{document}
或者
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning, arrows.meta, chains}
\begin{document}
\begin{tikzpicture}[node distance = 1.00cm,
every node/.style = {draw, circle, fill = blue!20, on chain},
every join/.style = {->},
start chain = path]
\foreach \i in {1, ..., 7} {
\ifnum\i=4
\node {\i};
\else
\node [join] {\i};
\fi
}
\end{tikzpicture}
\end{document}