我想创建 TikZ 节点的向下链。一些节点被旋转,并且它们的高度可能不同。
考虑下面的 MWE 的输出:
水平链可以适应节点的不同宽度,而向下链则不能。这可能与旋转有关吗?您知道如何让向下链像水平链一样避免节点交叉吗?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,shapes}
\tikzstyle{arrow}
= [ shape=single arrow
, single arrow head extend=.75em
, single arrow head indent=.25em
, minimum width=3em
, draw
]
\tikzstyle{rarrow}
= [ shape=single arrow
, single arrow head extend=.75em
, single arrow head indent=.25em
, minimum width=3em
, draw
, rotate=-90
]
\begin{document}
\begin{tikzpicture}[start chain,every node/.style={on chain,join}]
\node[arrow] {foo};
\node[arrow] {foo};
\node[arrow] {foooooooooo};
\node[arrow] {foo};
\end{tikzpicture}\\
\begin{tikzpicture}[start chain=going below,every node/.style={on chain,join}]
\node[rarrow] {foo};
\node[rarrow] {foo};
\node[rarrow] {foooooooooo};
\node[rarrow] {foo};
\end{tikzpicture}
\end{document}
答案1
tikzpicture
由于环境彼此独立,因此这是一个非常快速的解决方法:
\documentclass{article}
\parindent=0pt
\usepackage{tikz}
\usetikzlibrary{chains,shapes}
\tikzstyle{arrow}
= [ shape=single arrow
, single arrow head extend=.75em
, single arrow head indent=.25em
, minimum width=3em
, draw
]
\tikzstyle{rarrow}
= [ shape=single arrow
, single arrow head extend=.75em
, single arrow head indent=.25em
, minimum width=3em
, draw
]
\begin{document}
\begin{tikzpicture}[start chain,every node/.style={on chain,join}]
\node[arrow] {foo};
\node[arrow] {foo};
\node[arrow] {foooooooooo};
\node[arrow] {foo};
\end{tikzpicture}\\
\rotatebox{-90}{%
\begin{tikzpicture}[start chain,
every node/.style={on chain,join}]
\node[rarrow] {foo};
\node[rarrow] {foo};
\node[rarrow] {foooooooooo};
\node[rarrow] {foo};
\end{tikzpicture}}
\end{document}