# Incorrect space in tabular around an array

I have searched a little in the forum, and I can't find a satisfying solution to my problem.

I want to create a tabular in which I compare two different situations, and a line of the comparison is an array/matrix. I want the spacing for the tabular to be a little bigger because everything is too tight. So I use a change of \arraystretch within groups:

\begin{center}
\renewcommand*{\arraystretch}{1.5}
\begin{tabular}{|c|c|}
\hline
Problem (1) & Problem (2)\\
\hline
\begingroup
\renewcommand*{\arraystretch}{1}
$\left\{ \begin{array}{c} G_1 = 1\\ G_2 = 0 \end{array} \right.$
\endgroup
&
\begingroup
\renewcommand*{\arraystretch}{1}
$\left\{ \begin{array}{c} G_1 = 0\\ G_2 = 1 \end{array} \right.$
\endgroup
\\
\hline
displacement $u_1(x,y) = \chi_1(y)$ & displacement $u_1(x,y) = \chi_2(y)$\\
\hline
\end{tabular}
\end{center}


It works well for the text lines, but with the array/matrix inside, it does not put any additional space on top and on the bottom, which is not what I expected. If you increase the \arraystretch over 3 though, you will see a space on the top af the arrays, then increase to 4 will allow you to see the space appear on the bottom.

Does anyone have any idea how to make LaTeX understand that the array is supposed to be surrounded by space?

Additional question: with a great number for the \arraystretch (over 4), the vertical alignment doesn't seem centered but a little on the bottom. Is there any option other than use tabularx, minipages etc.?

You don't really need to change the value of \arraystretch. The makecell package can give some vertical padding to rowsFurther more you can have rules with variable thickness, and line breaks inside cells, with the eponymous command. For the formulae, it is simpler to use the cases environment.

I agree with @Mico's comments on using booktabs rules command, and no vertical rules. Should you use vertical rules, I show how you can improve (to my taste!) such tables.

\documentclass{article}
\usepackage{array, booktabs}
\usepackage{makecell}
\setcellgapes{3pt}
\usepackage{mathtools}
\begin{document}

\begin{center}
\makegapedcells
\begin{tabular}{!{\vrule width 1pt}c|c!{\vrule width 1pt}}
\Xhline{1pt}
Problem (1) & Problem (2) \\
\hline
$\begin{cases} G_1 = 1\\ G_2 = 0 \end{cases}$
&
$\begin{cases} G_1 = 0\\ G_2 = 1 \end{cases}$
\\
\hline
\makecell{displacement \\$u_1(x,y) = \chi_1(y)$} & \makecell{displacement \\ $u_1(x,y) = \chi_2(y)$}\\
\Xhline{1pt}
\end{tabular}
\end{center}
\vskip1cm
\begin{center}
\makegapedcells
\begin{tabular}{@{}cc@{}}
\toprule
Problem (1) & Problem (2) \\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}
$\begin{dcases} G_1 = 1\\ G_2 = 0 \end{dcases}$
&
$\begin{cases} G_1 = 0\\ G_2 = 1 \end{cases}$
\\
displacement $u_1(x,y) = \chi_1(y)$ & displacement $u_1(x,y) = \chi_2(y)$ \\
\bottomrule
\end{tabular}
\end{center}
\end{document}


• Thank you very much for you very extensive question. As I commented below I went for the last proposition which seems much better to me. Feb 20 '16 at 21:38

Rather than spend time figuring out the spacing above and below various \hlines, you could simply get rid of the interior horizontal lines (and all vertical lines) and use the line-drawing macros of the booktabs package to draw the top and bottom lines. Of course, you can still use the instruction \renewcommand{\arraystretch}{1.5} if you wish.

I hope you will agree with me that this layout is at least as readable as the one with lots more vertical and horizontal lines...

\documentclass{article}
\usepackage{amsmath}  % for 'cases' environment
\usepackage{booktabs} % for \toprule, \bottomrule, and \addlinespace macros
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{@{}cc@{}}
\toprule
Problem (1) & Problem (2) \\ \addlinespace
$\begin{cases} G_1 = 1\\G_2 = 0 \end{cases}$
&
$\begin{cases} G_1 = 0\\G_2 = 1 \end{cases}$ \\ \addlinespace
displacement $u_1(x,y) = \chi_1(y)$ &
displacement $u_1(x,y) = \chi_2(y)$ \\
\bottomrule
\end{tabular}
\end{center}
\end{document}

• Thank you very much for your quick answer! I got rid of the vertical and horizontal lines as you proposed, this is indeed much more readable and elegant. Feb 20 '16 at 21:37