# How to change table row heights and center their contents?

How can I decrease(or increase) the row height of a specific row in a table and center its content both horizontally and vertically?

A related answer discusses how to decrease the height of a row, but how can I center the text in that table cell? I am using dcolumn as a column type therefore cannot use any other columns type which does the centering.

\usepackage{dcolumn}
\newcolumntype{L}{D{.}{.}{1.1}}

\renewcommand{\arraystretch}{2}
\begin{table}
\centering
\begin{tabular}{|c|c|L|}
\hline
a & b & 1.1\\ [-5pt]
\hline
d & e & 2.2 \\ [1pt]
\hline
g & h & 3.3 \\ [6pt]
\hline
\end{tabular}
\end{table}


I want an output similar to this:

• Please provide a complete MWE, so we can see what types of entries you are working with. Sep 18, 2013 at 7:40
• Where is the dcolomun? Sep 18, 2013 at 10:46

## 1 Answer

A very basic approach:

\documentclass{article}
\usepackage{dcolumn}
\newcolumntype{L}{@{\hspace{1.5em}}D{.}{.}{1.1}@{\hspace{1.5em}}}
\newcolumntype{V}{>{\centering\arraybackslash}m{3em}}
\newcolumntype{N}{@{}m{0pt}@{}}

\begin{document}

%\renewcommand{\arraystretch}{2}
\begin{table}
\centering
\begin{tabular}{|V|V|L|N}
\hline
a & b & 1.1 &\\
\hline
d & e & 2.2 &\\[15pt]
\hline
g & h & 3.3 &\\[35pt]
\hline
\end{tabular}
\end{table}

\end{document}


Result:

Notes:

1. I've redefined your column type L adding some space at the left and at the right.
2. I've defined a standard array column type V for the remaining columns (it is possible since dcolumn loads array).
3. I've defined an invisible column type N to avoid the problem described here: Vertical alignment in table: m-column, row size - problem in last column.
4. I've commented out \renewcommand{\arraystretch}{2}.
• Compiling the document with pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019) displays the shown table but cells are not vertically center aligned.
– gfe
Jun 16, 2020 at 12:34