14

I have a split rectangle node, and I would like either for the entire node to be a certain height, with the splits spread equally, or each nodepart to be a certain height. I have the following code, in which only the first part is stretched, how can I apply this to all nodeparts?

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}

\begin{tikzpicture}[auto,
    rect/.style={
        rectangle split,
        rectangle split parts=4,
        draw=black,
        rounded corners, 
        text width=7cm,
        text height=3cm
    }]  


    % Split Rectangle
    \node [rect] {
        First Item
        \nodepart{two} Second Item
        \nodepart{three} $\vdots$
        \nodepart{four}  Last Item
        };

\end{tikzpicture}
\end{document}

enter image description here

Chris
  • 587
  • 5
    From the manual page 450, When split vertically, the rectangle split will observe any minimum width requirements but any minimum height will be ignored. But you can use inner sep, not so useful though. If necessary, switch to matrix node. – percusse May 03 '12 at 17:56

1 Answers1

10
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
  \def\mystrut{\vrule height 1.5cm depth 1.5cm width 0pt} 

 \begin{document}    

   \begin{tikzpicture}[auto,
    rect/.style={
        rectangle split,
        rectangle split parts=4,
        draw=black,
        rounded corners
    }]  


    % Split Rectangle
    \node [rect] {
      \mystrut  First Item
        \nodepart{two}\mystrut Second Item
        \nodepart{three} $\vdots$
        \nodepart{four} \mystrut Last Item
        };

\end{tikzpicture}
\end{document}    

enter image description here

Alain Matthes
  • 95,075
  • in the section of your code after % Split Rectangle, when I add \centerline{......} \centerline{........} after \nodepart{one} \mystrut, it will only modify the height of the box around the first line instead of the entire \nodepart{one}, how can I fix it? – Faceb Faceb Aug 14 '17 at 20:30