3

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:

enter image description here

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

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:

enter image description here

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}.

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.