如何使用 TikZ 绘制框图?

如何使用 TikZ 绘制框图?

我想用 Ti 绘制这样的框图Z. 我无法找到箭头/适合框图的教程。

框图

答案1

两种可能的解决方案。第一种比较简单的解决方案是:

\documentclass[tikz,border=2mm]{standalone}
    \usetikzlibrary{arrows.meta,calc,positioning}

    \begin{document}
\begin{tikzpicture}[
node distance= 9mm and 3 mm,
inout/.style = {minimum width=#1,
                draw, thick, rounded corners, 
                minimum height=9mm, align=center},
inter/.style = {minimum width=#1,
                draw, thick, minimum height=9mm,
                font=\Large\bfseries},
Arrow/.style = {line width=2mm, draw=gray, 
                -{Triangle[length=3mm,width=4mm]},
                shorten >=1mm, shorten <=1mm},
                    ]
\node[inout=22mm]               (a)   {property};
\node[inout=22mm,right=of a]    (b)   {automaton\\ model};
\path   let \p1 = (a.west),
            \p2 = (b.east),
            \n1 = {veclen(\x2-\x1,\y2-\y1)} in 
        node[inter=\n1,
             below right=9mm and 0mm of a.south west] (c) {Intersection}
        node[inout=\n1,below=of c] (d) {empty language\\ 
                                        (property sastified)};
\draw[Arrow]    (a) -- (a |- c.north);
\draw[Arrow]    (b) -- (b |- c.north);
\draw[Arrow]    (c) -- (d);
\end{tikzpicture}
    \end{document}

在此处输入图片描述

和更花哨的带有箭头的箭头,用箭头形状确定:

\documentclass[tikz,border=2mm]{standalone}
    \usetikzlibrary{arrows.meta,calc,positioning,
                    shapes.arrows}

    \begin{document}
\begin{tikzpicture}[
node distance= 9mm and 3 mm,
inout/.style = {minimum width=#1,
                draw, thick, rounded corners, 
                minimum height=9mm, align=center},
inter/.style = {minimum width=#1,
                draw, thick, minimum height=9mm,
                font=\Large\bfseries},
Arrow/.style = {single arrow,draw,
                minimum height=7mm, minimum width=3mm,
                rotate=-90},             
                    ]
\node[inout=22mm]               (a)   {property};
\node[inout=22mm,right=of a]    (b)   {automaton\\ model};
\path   let \p1 = (a.west),
            \p2 = (b.east),
            \n1 = {veclen(\x2-\x1,\y2-\y1)} in 
        node[inter=\n1,
             below right=9mm and 0mm of a.south west] (c) {Intersection}
        node[inout=\n1,below=of c] (d) {empty language\\ 
                                        (property sastified)};
\node[Arrow]  at ($(a)!0.65!(a |- c.north)$) {};
\node[Arrow]  at ($(b)!0.65!(b |- c.north)$) {};
\node[Arrow]  at ($(c)!0.65!(d.north)$) {};
\end{tikzpicture}
    \end{document}

在此处输入图片描述

相关内容