2

I am looking for a way, to change the height of a row in a tabular environment (or evenly add space at the top and bottom) but without changing the size of an included matrix.

If I use \renewcommand{arraystretch}{1.5} (which works perfectly in any other case) unfortunately also changes the size of my matrix. See MWE:

\documentclass[a4paper,12pt]{report}

\usepackage{amsmath}
\begin{document}

\begin{tabular}{|c|c|}\hline
$\begin{pmatrix}
1\\2\\3 
\end{pmatrix}$&2 \\ \hline
\end{tabular}

\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|}\hline
$\begin{pmatrix}
1\\2\\3 
\end{pmatrix}$&2 \\ \hline
\end{tabular}

\end{document}

Which gives me the following output:

and

But I actually want something like this:

Is there any way to do this?

chris
  • 325
  • 3
  • 11

1 Answers1

2

The cellspace package is done for that: you can define minimal vertical spacings at the top and bottom of cells in columns with specifier prefixed with the letter S (or C if you load siunitx):

\documentclass[a4paper,12pt]{report}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}

\usepackage{amsmath} \begin{document}

\begin{tabular}{|Sc|c|}\hline $\begin{pmatrix} 1\2\3 \end{pmatrix}$&2 \ \hline \end{tabular}

\end{document}

enter image description here

Bernard
  • 271,350
  • It works but it gives me 2 warnings: Command \@startpbox has changed. Check if current package is valid. (and same with \@endpbox) You have an idea how to get rid of it? – chris Jan 20 '19 at 17:32
  • 1
    @chris/ I have the latest version (1.7, from 8/12/2018), and have the same warnings. Maybe this is linked to a recent change in array (dated 30/12/2018). I'll send a message to the package author. – Bernard Jan 20 '19 at 18:15