1

I know there have been many posts with similar titles, but somehow I couldn't find anything that seemed related. Here is a MWE, where I would expect all rows to have an even distance. But obviously the first and second row are closer together than the second and the third:

\documentclass[]{scrartcl}

    \usepackage{tikz}
    \usetikzlibrary{matrix}

    \usepackage[utf8]{inputenc}

    \begin{document}
    \begin{figure}
    \centering
        \begin{tikzpicture}         
        \matrix[
            matrix of nodes,
            anchor=north, 
             column 1/.style={nodes={anchor=base west,align=center}},
             column 2/.style={nodes={anchor=base west,align=center}},
             column 3/.style={nodes={anchor=base west,align=center}},
             column 4/.style={nodes={anchor=base west,align=center}}
        ]
        {    Some text& \\ 
             Some text&    Some longer text\\  
             Some text&
             Some text\\};
        \end{tikzpicture} %
        \caption{test test}
    \end{figure}

    \end{document}

1 Answer 1

1

Because the second line contains letter g that has descender and first line doesn't. You can add some text depth to all nodes or use a \strut inside all cells.

\documentclass[]{scrartcl}

    \usepackage{tikz}
    \usetikzlibrary{matrix}

    \usepackage[utf8]{inputenc}

    \begin{document}
    \begin{figure}
    \centering
        \begin{tikzpicture}
        \matrix[
            matrix of nodes,
            anchor=north,
            nodes={text depth=0.55ex},   %% <----------------------here
             column 1/.style={nodes={anchor=base west,align=center}},
             column 2/.style={nodes={anchor=base west,align=center}},
             column 3/.style={nodes={anchor=base west,align=center}},
             column 4/.style={nodes={anchor=base west,align=center}}
        ]
        {    Some text& \\
             Some text&    Some longer text\\
             Some text&  Some text\\};
        \end{tikzpicture} %
        \caption{test test}
    \end{figure}

    \end{document}

enter image description here

You must log in to answer this question.

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