我需要创建一个类似下图的流程图。
我无法在节点内添加节点。
\documentclass{article}
\usepackage{tikz}
\usepackage[papersize={14cm,14cm}]{geometry}
\usetikzlibrary{chains,shapes.arrows, arrows, positioning,}
\begin{document}
\tikzset{>=stealth',
punktchain/.style={rectangle, rounded corners,
% fill=black!10,
draw=black, very thick,
inner sep=2pt, text width=3.1cm, minimum height=3em,
text centered, on chain},
connector/.style = {->,very thick},
element/.style={tape,top color=white,
bottom color=blue!50!black!60!,
minimum width=8em, draw=blue!40!black!90, very thick,
text width=10em, minimum height=3.5em,
text centered, on chain},
every join/.style={->, very thick, shorten >=1pt},
tuborg/.style={decorate, very thick},
tubnode/.style={midway, right=5pt},
inclass/.style = {punktchain, minimum height=6mm,
inner sep=1mm, top color=red!15, bottom color=red!5},}
\begin{figure}
\centering
\small % \fontsize{8pt}{9pt}\selectfont
\begin{tikzpicture} [auto, >=stealth', node distance=1cm, start
chain=going below]
\node[punktchain, text width = 7cm, xshift=2cm] (A2) {Items};
\node[inclass,below=of A2.south] (A21) {item1};
\node[inclass,below=of A21.south] (A22) {item2};
\node[inclass,below=of A22.south] (A23) {ittem3};
\node[punktchain, text width = 7cm] (A3) {items};
\end{tikzpicture}
\end{figure}
\end{document}
答案1
在姆韦下面我只考虑必要的样式定义和包含三个元素的 supoze tgant 节点,其顶部和底部的宽度与 noce 相同:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows, chains, fit, positioning,}
\begin{document}
\tikzset{ > = stealth',
punktchain/.style = {rectangle, rounded corners, draw, very thick,
text width=3.1cm, minimum height=3em, inner sep=2pt,
align=center, on chain},
inclass/.style = {punktchain, minimum height=6mm,
top color=red!15, bottom color=red!5},
}
\begin{tikzpicture}[
node distance=8mm,
start chain=going below,
every label/.append style={font=\footnotesize}
]
\node (A2) [punktchain, text width=7cm] {Items};
%
\node (A21) [inclass, label=above left:label] {item1};
\node (A22) [inclass] {item2};
\node (A23) [inclass] {ittem3};
%
\node (A3) [punktchain, text width=7cm] {items};
%
\node [draw, very thick, rounded corners,
inner ysep=4mm, inner xsep=0mm,
minimum width=7cm, fit= (A21) (A22 -| A2.west) (A22 -| A2.east) (A23)] {};
\end{tikzpicture}
\end{document}