Ich versuche, meinen selbst definierten Knoten \preproc auf die gleiche Größe wie die definierten Blöcke zu bringen, aber ich schaffe es nicht. Ich habe versucht, die Mindesthöhe und -breite zu verwenden (wie ich es in der Stildefinition für die Blöcke getan habe), aber nicht mit dem gewünschten Ergebnis (der Knoten preproc wird nicht wie gewünscht in der Größe angepasst). Hat jemand einen Vorschlag, wie das geht?
\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}
Antwort1
\nodepart[text width=7em]{two}
Sie müssen den Text width=xx in der Definition übergeben prepproc
. Um den Text zu zentrieren, fügt die Lösung außerdem align=center
den process
Stil hinzu.
Code
\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}