I am trying to define a TikZ node style that comprises three rectangles one after another, as if by the following code:
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[draw,
minimum width=3cm,
minimum height=1.2cm,
outer sep=0] (subr) at (0,0) {Subroutine};
\draw (subr.north west) -- ++(-0.3,0) |- (subr.south west);
\draw (subr.north east) -- ++(0.3,0) |- (subr.south east);
\end{tikzpicture}
\end{document}
I want to capture all of the above into a single node style like below:
\tikzstyle{subroutine} = {
draw,
thick, etc...
???
}
so I can simply use it as follows:
\begin{tikzpicture}
\node[subroutine] at (0,0) {Subroutine};
\end{tikzpicture}
(The grey border is from my document viewer, it is not a part of the actual tikz drawing)
Best Answer
The TikZ's library
shapes.multipart
does that kind of things.For more details, see Section 71.6. Shapes with Multiple Text Parts in the pgfmanual.