Intento que mi nodo autodefinido \preproc tenga el mismo tamaño que los bloques definidos, pero no lo consigo. Intenté usar una altura y un ancho mínimos (como lo hice en la definición de estilo para los bloques), pero no con el resultado que quiero (el proceso previo del nodo no cambiará de tamaño como quería). ¿Alguien tiene alguna sugerencia sobre cómo hacer esto?
\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,matrix,scopes}
\tikzset{auto,
font=\sffamily,
%
decision/.style={
diamond,
thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=6.5em,
text badly centered,
font=\sffamily,
inner sep=1pt,
text depth=3ex
},
%
decision answer/.style={
color=black
},
%
block/.style={
rectangle,
thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=8em,
text centered,
font=\sffamily,
inner sep=1em,
rounded corners,
minimum height=4em
},
startend/.style={
rectangle,
thick,
draw=black!50,
top color=white,
bottom color=blue!20,
text width=8em,
text centered,
font=\sffamily,
inner sep=1em,
rounded corners,
minimum height=4em
},
%
cloud/.style={
draw=red!50!black!50,
thick,
ellipse,
top color=white,
bottom color=red!50!black!20,
minimum height=2em
font=\sffamily,
},
%
line/.style={
draw,
thick,
%rounded corners=3pt,
color=black!50,
-latex',
shorten >=0pt
},
%
process/.style={
draw=black!50,
thick,
rectangle,
rectangle split,
rectangle split horizontal,
rectangle split parts=3,
rounded corners,
top color=white,
bottom color=black!20,
minimum height=4em,
font={\bfseries\sffamily},
}
}
\newcommand{\preproc}[2]{
\node[process](#1){\nodepart{two}\shortstack{#2}};
}
\newcommand{\procstart}{
\node[startend](start){Start};
}
\newcommand{\procend}{
\node[startend](end){Ende};
}
\begin{document}
\begin{tikzpicture}
\matrix [column sep=10mm, row sep=7mm,ampersand replacement=\&]
{
\procstart;\& \& \\
\preproc{VakOn}{Predfined\\ Process}; \& \& \\
\node[block](TimeOn){Timer\\on}; \& \& \\
\node[inner sep=-2](TimeOnPunkt){}; \& \& \\
\node[decision](VakOK){Question\\1?}; \& \node[decision](TimerOK){Timer\\<\,x?}; \& \\
\& \node[decision](VakTol){Question\\2?}; \& \\
\& \preproc{Warnung}{Predef.\\ Warning}; \& \preproc{Fehler}{Predefined \\Failure}; \\
\node[block](TimeOff){Timer\\off}; \& \& \\
\preproc{VakOff}{Predef.\\Process}; \& \& \\
\node[block](EQV){EQV}; \& \& \\
\procend;\& \& \\
};
\begin{scope}[every path/.style=line]
\path (start) -- (VakOn);
\path (VakOn) -- (TimeOn);
\path (TimeOn) -- (VakOK);
\path (VakOK) -- node [decision answer, pos=.03] {yes} (TimeOff);
\path (VakOK) -- node [decision answer, pos=.4] {no} (TimerOK);
\path (TimerOK) |- node [decision answer, pos=.1] {yes} (TimeOnPunkt);
\path (TimerOK) -- node [decision answer,pos=.2] {no} (VakTol);
\path (VakTol) -- node [decision answer, pos=.2] {yes} (Warnung);
\path (VakTol) -| node [decision answer, pos=.1] {no} (Fehler);
\path (Warnung) |- (TimeOff);
\path (TimeOff) -- (VakOff);
\path (VakOff) -- (EQV);
\path (EQV) -- (end);
%\path [dashed] (expert.north) -++(0,1) -| (system);
\end{scope}
\end{tikzpicture}
\end{document}
Respuesta1
Necesita pasar el texto width=xx \nodepart[text width=7em]{two}
en la prepproc
definición. Además, para tener el texto centrado, la solución añade align=center
estilo process
.
Código
\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,matrix,scopes}
\tikzset{auto,
font=\sffamily,
%
decision/.style={
diamond,
thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=6.5em,
text badly centered,
font=\sffamily,
inner sep=1pt,
text depth=3ex
},
%
decision answer/.style={
color=black
},
%
block/.style={
rectangle,
thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=8em,
text centered,
font=\sffamily,
inner sep=1em,
rounded corners,
minimum height=4em
},
startend/.style={
rectangle,
thick,
draw=black!50,
top color=white,
bottom color=blue!20,
text width=8em,
text centered,
font=\sffamily,
inner sep=1em,
rounded corners,
minimum height=4em
},
%
cloud/.style={
draw=red!50!black!50,
thick,
ellipse,
top color=white,
bottom color=red!50!black!20,
minimum height=2em
font=\sffamily,
},
%
line/.style={
draw,
thick,
%rounded corners=3pt,
color=black!50,
-latex',
shorten >=0pt
},
%
process/.style={
draw=black!50,
thick,
rectangle,
rectangle split,
rectangle split horizontal,
rectangle split parts=3,
rounded corners, align=center,
top color=white,
bottom color=black!20,
minimum height=4em,
font={\bfseries\sffamily},
}
}
\newcommand{\preproc}[2]{
\node[process](#1){\nodepart[text width=7em]{two}\shortstack{#2}};
}
\newcommand{\procstart}{
\node[startend](start){Start};
}
\newcommand{\procend}{
\node[startend](end){Ende};
}
\begin{document}
\begin{tikzpicture}
\matrix [column sep=20mm, row sep=7mm,ampersand replacement=\&]
{
\procstart;\& \& \\
\preproc{VakOn}{Predfined\\ Process}; \& \& \\
\node[block](TimeOn){Timer\\on}; \& \& \\
\node[inner sep=-2](TimeOnPunkt){}; \& \& \\
\node[decision](VakOK){Question\\1?}; \& \node[decision](TimerOK){Timer\\<\,x?}; \& \\
\& \node[decision](VakTol){Question\\2?}; \& \\
\& \preproc{Warnung}{Predef.\\ Warning}; \& \preproc{Fehler}{Predefined \\Failure}; \\
\node[block](TimeOff){Timer\\off}; \& \& \\
\preproc{VakOff}{Predef.\\Process}; \& \& \\
\node[block](EQV){EQV}; \& \& \\
\procend;\& \& \\
};
\begin{scope}[every path/.style=line]
\path (start) -- (VakOn);
\path (VakOn) -- (TimeOn);
\path (TimeOn) -- (VakOK);
\path (VakOK) -- node [decision answer, pos=.03] {yes} (TimeOff);
\path (VakOK) -- node [decision answer, pos=.4] {no} (TimerOK);
\path (TimerOK) |- node [decision answer, pos=.1] {yes} (TimeOnPunkt);
\path (TimerOK) -- node [decision answer,pos=.2] {no} (VakTol);
\path (VakTol) -- node [decision answer, pos=.2] {yes} (Warnung);
\path (VakTol) -| node [decision answer, pos=.1] {no} (Fehler);
\path (Warnung) |- (TimeOff);
\path (TimeOff) -- (VakOff);
\path (VakOff) -- (EQV);
\path (EQV) -- (end);
%\path [dashed] (expert.north) -++(0,1) -| (system);
\end{scope}
\end{tikzpicture}
\end{document}