为 tikz 图创建不规则五边形节点的示例

为 tikz 图创建不规则五边形节点的示例

在此处输入图片描述我正在尝试创建一个不规则五边形节点,用于多个系统图。我似乎无法从以下我能找到的示例中让代码工作。下面是我尝试但没有成功的示例。请提供一个示例来说明如何操作。

    \documentclass{article}
    \usepackage{tikz}
    \usepackage{pgf}

    \pgfdeclareshape{materialtransfer}{

\inheritsavedanchors[from={rectangle}]
\inheritanchor[from={rectangle}]{center}
\inheritanchor[from={rectangle}]{east}
\inheritanchor[from={rectangle}]{west}
\anchor{text}{\pgfpointorigin}

\backgroundpath{%
    % store lower left in xa/ya and upper right in xb/yb
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y

    % compute tip of ``arrow''
    \pgf@xc=\pgf@xb
    \pgf@yc=\pgf@yb \advance\pgf@yc by-.5\ht\pgnodeparttextbox
    % compute arrow defelction point
    \pgf@xd = \pgf@xa \advance\pgf@xd by 0.8\wd\pgnodeparttextbox
    \pgf@yd = \pgf@yb

    % construct main path
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfpoint{\pgf@xd}{\pgf@yd}}
    \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
    \pgfpathlineto{\pgfpoint{-\pgf@xd}{-\pgf@yd}}
    \pgfpathclose

    \pgfusepath{draw}
        }
    }

    \begin{document}
    \begin{tikzpicture}[node distance=2cm]{
        \pgfnode{materialtransfer}{center}{Raw material}{rawmaterial}{\pgfusepath{draw}}
    }
    \end{tikzpicture}
    \end{document}

答案1

\documentclass{standalone}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{backgrounds, shapes}

\begin{document}
\begin{tikzpicture}[background rectangle/.style={draw=blue!50,fill=blue!10,
      rounded corners=1ex},
    show background rectangle]


    \node[name=s1, signal, minimum width=2cm, minimum height=1cm,
    draw=black] {};

  \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容