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

1
  • 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
    Commented May 3, 2012 at 17:56

1 Answer 1

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

1
  • 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? Commented Aug 14, 2017 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .