How can I create a new shape for the comment, using \pgfdeclareshape?
Tikz manual description of creating a new node on page 625 is too hard for me.
So I could write:
Code: Select all
\node [comment, below of=node-1] (node-2) {comment comment comment};
\path [line] (node-1) -- (node-2);
\node[terminator, below of=node-2, node distance=1.5cm] (node-3) {end};
\path [line] (node-2) -- (node-3);
Code: Select all
\documentclass{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage[cm]{fullpage}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,backgrounds,calc}
\begin{document}
\begin{tikzpicture}[node distance = 1.7cm, auto]
\tikzset{
line/.style = {draw},
comment/.style = {rectangle, draw, text centered, rounded corners, minimum height=2em,fill=white},
terminator/.style = {shape=rounded rectangle, draw, inner sep=2mm},
}
\node[terminator] (node-1) {begin};
\node [comment, below of=node-1] (node-2) {comment comment comment};
\begin{scope}[on background layer]
\draw[fill=gray!10] ($(node-2.south west)+(-2mm,-2mm)$) rectangle ($(node-2.north east)+(2mm, 2mm)$);
\end{scope}
\path [line] (node-1) -- ($(node-2.north)+(0mm,+2mm)$);
\node[terminator, below of=node-2, node distance=1.5cm] (node-3) {end};
\path [line] ($(node-2.south)+(0mm,-2mm)$) -- (node-3);
\end{tikzpicture}
\end{document}