2

This question already has an answer here:

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?

marked as duplicate by Werner tables Jan 20 at 19:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Please have a look at this post. Unfortunately the accepted answer may not be the most useful one. – user121799 Jan 20 at 17:14
  • And this answer may be more directly applicable. – user121799 Jan 20 at 17:21
1

The cellspace package is done for that: you can define minimal vertical spacings at the toˆp 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

  • 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 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 at 18:15

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