我的代码是:
\begin{tikzpicture}[nodeTot/.style={draw, circle, minimum size=1cm},
nodeItem/.style={draw, rectangle, minimum size=1.2cm}]
\node (t1) [nodeTot] at (0,0) {100};
\node (t2) [nodeTot] at +(-135:2cm) {50};
\node (t3) [nodeTot] at t2.center +(-135:2cm) {10};
\end{tikzpicture}
上述方法不起作用。我需要将节点 t3 相对于 t2 定位,而不使用++(-135:2cm)
t2,因为我还需要将其他节点相对于 t1 设置到位。我该如何实现这一点?
答案1
我会把节点放在一条路径中:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[nodeTot/.style={draw, circle, minimum size=1cm},
nodeItem/.style={draw, rectangle, minimum size=1.2cm}]
\draw (0,0) node[nodeTot](t1){100} ++(-135:2cm) node[nodeTot](t2){50} ++(-135:2cm) node[nodeTot](t3){10};
\draw[->] (t1) to [bend left=50] (t3);
\draw[<->] (t2) -- (t1);
\end{tikzpicture}
\end{document}