3

When I increase the arraystretch for a table, the vertical space between the top of the text and the bottom of the text is not equally distributed.

Why is that? And what can I do to make it equally distributed?

The code-

\documentclass[12pt]{article}
\renewcommand\arraystretch{10}

\begin{document}
\begin{tabular}{c}
\hline
This is a one row one column table.\\\hline
\end{tabular}
\end{document}

Here's the space distribution-

space_distribution

4

This is well known. I don't know the exact reason, but I know two possible solutions:

  • the makecell package defines a \setcellgapes command, which lets you define a height and a depth to add to the cells. These are added by the \makegapedcells command (does not work with m columns, as mentioned by @Zarko).
  • the cellspace package defines a minimal vertical spacing between the contents of a cell and its top or its bottom: \cellspacetoplimit and \cellspacebottomlimit. They are applied to the cells in columns with specifier prefixed with the letter S (or C if you load siunitx).

Demo:

\documentclass[12pt, landscape]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array, makecell, cellspace}
\setlength{\cellspacetoplimit}{13.2ex}
\setlength{\cellspacebottomlimit}{13.2ex}

\begin{document}

{\renewcommand\arraystretch{10}
\begin{tabular}{c}
\hline
This is a one row one column table.\\\hline
\end{tabular}}
\qquad
{\setcellgapes{13.2ex}\makegapedcells
\begin{tabular}{c}
\hline
This is a one row one column table.\\\hline
\end{tabular}
}
\qquad
\begin{tabular}{Sc}
\hline
This is a one row one column table.\\\hline
\end{tabular}

\end{document} 

enter image description here

  • you should mentioned, that \makegapedcells doesn't work with m columns. – Zarko Oct 6 '17 at 6:31
  • @Zarko: Didn't know that – I've never used it with columns, as far as I can remember. I've added this information (with credits!). Thanks! – Bernard Oct 6 '17 at 9:41
3

The reason for the asymmetry is that Latin letters typically have more height than depth, so the baseline of a text row is typically positioned such that 70% of the space is above the baseline and 30% below.

So you see the same thing if you use \baselinestretch to doublespace rows, the height and depth of a line is increased so typically the space above the top line is increased by more than the space below the last.

In tables the table rows are stacked one above the other with no spacing, and even spacing is achieved by adding a \strut a 0-width rule that as height and depth set to the normal baseline spacing. \arraystretch works by simply multiplying the size of the strut so since its height is more than its depth, the height of the strut gets more added space.

The array package adds an extra feature \addtorowheight which adds to the height of the strut, you could copy its internals to give a command to add to the depth, but actually if you use a multiplier to get the depth right you can always fix up the height by adding (subtracting). so

enter image description here

\documentclass[12pt]{article}
\usepackage{array,booktabs}
\renewcommand\arraystretch{25}
\setlength\extrarowheight{-5pt}

\begin{document}
\begin{tabular}{c}
\hline
This is a one row one column table.\\\hline
\end{tabular}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.