TikZ:创建具有不同高度的向下节点链

TikZ:创建具有不同高度的向下节点链

我想创建 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}

在此处输入图片描述

相关内容