TikZ 图片形状

TikZ 图片形状

我对 TikZ 包很陌生,我需要使用以下形状绘制一些流程图。

但是我不知道如何绘制下面的第 4 个和第 6 个。如果能帮助我绘制下面列表中的所有形状就太好了(为了完整性)。

在此处输入图片描述

对你的帮助表示感谢。

笔记:我拜访了节点形状 TikZ但它包含一些其他形状。

答案1

按照您的列表,这里有一堆TikZ用于绘制节点的样式:您可以根据需要随意自定义颜色和尺寸。它们是非常基本的样式,只要对 pgfmanual 中存在的形状有一个模糊的概念就可以编写。当特殊库应该在序言中加载时,会有注释。

代码:

\documentclass[a4paper,11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,shapes.geometric,shapes.symbols,shapes.misc}

\tikzset{
    start-end/.style={
        draw,
        rectangle,
        rounded corners,
    },
    input/.style={ % requires library shapes.geometric
        draw,
        trapezium,
        trapezium left angle=60,
        trapezium right angle=120,
    },
    operation/.style={
        draw,
        rectangle
    },
    loop/.style={ % requires library shapes.misc
        draw,
        chamfered rectangle,
        chamfered rectangle xsep=2cm
    },
    decision/.style={ % requires library shapes.geometric
        draw,
        diamond,
        aspect=#1
    },
    decision/.default=1,
    print/.style={ % requires library shapes.symbols
        draw,
        tape,
        tape bend top=none
    },
    connection/.style={
        draw,
        circle,
        radius=5pt,
    },
    process rectangle outer width/.initial=0.15cm,
    predefined process/.style={
        rectangle,
        draw,
        append after command={
        \pgfextra{
          \draw
          ($(\tikzlastnode.north west)-(0,0.5\pgflinewidth)$)--
          ($(\tikzlastnode.north west)-(\pgfkeysvalueof{/tikz/process rectangle outer width},0.5\pgflinewidth)$)--
          ($(\tikzlastnode.south west)+(-\pgfkeysvalueof{/tikz/process rectangle outer width},+0.5\pgflinewidth)$)--
          ($(\tikzlastnode.south west)+(0,0.5\pgflinewidth)$);
          \draw
          ($(\tikzlastnode.north east)-(0,0.5\pgflinewidth)$)--
          ($(\tikzlastnode.north east)+(\pgfkeysvalueof{/tikz/process rectangle outer width},-0.5\pgflinewidth)$)--
          ($(\tikzlastnode.south east)+(\pgfkeysvalueof{/tikz/process rectangle outer width},0.5\pgflinewidth)$)--
          ($(\tikzlastnode.south east)+(0,0.5\pgflinewidth)$);
        }  
        },
        text width=#1,
        align=center
    },
    predefined process/.default=1.75cm,
    man op/.style={ % requires library shapes.geometric
        draw,
        trapezium,
        shape border rotate=180,
        text width=2cm,
        align=center,
    },
    extract/.style={
        draw,
        isosceles triangle,
        isosceles triangle apex angle=60,
        shape border rotate=90
    },
    merge/.style={
        draw,
        isosceles triangle,
        isosceles triangle apex angle=60,
        shape border rotate=-90
    },
}

\begin{document}
\begin{tikzpicture}
\node[start-end] (start) {Start/End};
\node[below of=start,input](inp){Input};
\node[below of=inp,operation] (op) {Operation};
\node[below of=op,loop] (lp) {Loop};
\node[right= 10pt of lp,loop=1.6] (lp2) {Preparation};
\node[below= 5pt of lp,decision] (dec) {Decision};
\node[right= 10pt of dec,decision=1.6] (dec2) {Decision};
\node[right= 10pt of dec2,decision=2.5] (dec3) {Decision};
\node[below= 5pt of dec,print] (pr) {Print};
\node[below= 10pt of pr,predefined process] (prproc) {Predefined process};
\node[below= 10pt of prproc,man op] (manop) {Manual Operation};
\node[below of=manop,connection, label=below:Connection] (con) {};
\node[below of=con,extract, label=below:Extract] (extr) {};
\node[below of=extr,merge, label=below:Merge] (mrg) {};
\end{tikzpicture}
\end{document}

结果:

在此处输入图片描述

2013 年 7 月 22 日版本:根据 @Qrrbrbirlbel 的评论,包含一个小修复。小修复解决了文本宽度缩小的问题,但随着基本矩形路径中的线宽发生变化,外部矩形的路径不会发生变化。这个解决方案确实是了解如何在具有以下选项的情况下将选项传递给后期操作的正确时机\pgfextra活动状态时将选项传递给后期操作的正确时机

相关内容