TikZ PGF – Setting Rectangle Split with the Same Height in TikZ

heighttikz-pgf

I want to have same height for the splitted rectangle's rows. Their height changes based on the character inside each section, for example . is much smaller than having larger characters like f.

my code:

\documentclass[5p,times]{elsarticle}
\usepackage{tikz}
\usetikzlibrary{
    chains,
    positioning,
    shapes.geometric,
    shapes
}
\begin{document}
\section{Example}
\noindent
\begin{tikzpicture}[
        data/.style={
                draw,
                rectangle split,
                rectangle split parts=4,
                text centered,
                font=\scriptsize
            }
    ]
    \node [data,label=below:{test}] (n1) {
            GOOGLE
            \nodepart{second} IPFS
            \nodepart{third} ipfs
            \nodepart{fourth} .
        };
\end{tikzpicture}
\end{document}

output:

enter image description here

Here all the sections have different height, for example forth row is much smaller. Is it possible to make all rows same height?

Could be related to: How to set rectangle split with the same size (width and height)?

Best Answer

The straight-forward approach would be to apply minimum height to the nodes. But as the TikZ manual states (on page 820 of the current version):

When split vertically, the rectangle split will meet any minimum width requirements, but any minimum height will be ignored.

However, as stated in the comments, you can add \strut to the contents of each of the nodes. You can use the following approach to do this automatically using execute at begin node:

\documentclass[5p,times]{elsarticle}
\usepackage{tikz}
\usetikzlibrary{
    chains,
    positioning,
    shapes.geometric,
    shapes
}
\begin{document}
\section{Example}
\noindent
\begin{tikzpicture}[
    data/.style={
            draw,
            rectangle split,
            rectangle split parts=4,
            text centered,
            font=\scriptsize,
            execute at begin node=\strut
        }
    ]
    \node [data,label=below:{test}] (n1) {
        GOOGLE
        \nodepart{second} IPFS
        \nodepart{third} ipfs
        \nodepart{fourth} .
    };
\end{tikzpicture}
\end{document}

enter image description here