숏스택이 있는 노드의 크기

숏스택이 있는 노드의 크기

나는 자체 정의된 노드 \preproc를 정의된 블록과 동일한 크기로 얻으려고 시도했지만 얻지 못했습니다. 블록에 대한 스타일 정의에서 했던 것처럼 최소 높이와 최소 너비를 사용하려고 했지만 원하는 결과가 나오지 않았습니다(노드 preproc의 크기가 원하는 대로 조정되지 않음). 누구든지 이 작업을 수행하는 방법에 대한 제안이 있습니까?

\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}

여기에 이미지 설명을 입력하세요

답변1

\nodepart[text width=7em]{two}정의 에서 텍스트 너비=xx를 전달해야 합니다 prepproc. 또한 텍스트를 중앙에 배치하기 위해 솔루션이 스타일 align=center에 추가됩니다 process.

여기에 이미지 설명을 입력하세요

암호

\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}

관련 정보