# Vertical Spacing in Tabular with bmatrix

I am unable to manually add vertical space between the second and third row. It should be controlled by the second parameter to \MyTable but that parameter seems to be have no effect:

## Notes:

• The \MyTable macro was created specifically for this test case so that I can easily test various settings. This problem occurs even without a macro being used for the table.
• Using \renewcommand*{\arraystretch}{1.5} just before \begin{tabular} does not help in this case as it also stretches out the bmatrix.

## Code:

\documentclass{article}
\usepackage[paperwidth=21cm]{geometry}% To eliminate warning in MWE
\usepackage{amsmath}
\usepackage{booktabs}

\newcommand*{\MyTable}[2]{%
\begin{tabular}[t]{@{}cc@{}}\toprule
#1 & #2 \\
\cmidrule{1-2}
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ \end{bmatrix}$                              & $1 \times 4$ \\[#1]
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \\ \end{bmatrix}$                              & $4 \times 4$ \\[#2]
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ a_{41} & a_{42} & a_{43} \\ \end{bmatrix}$                              & $4 \times 3$ \\
\bottomrule
\end{tabular}%
}

\begin{document}\noindent
\MyTable{0.0ex}{0.0ex}
\MyTable{2.0ex}{2.0ex}
\MyTable{2.0ex}{4.0ex}
\end{document}

• I have no problem to see it with e.g. \MyTable{2.0ex}{12.0ex}  or 10mm. The first effect is seen at 5ex. It depends to the math mode that you cannot really see it. – user2478 May 24 '14 at 8:02

I do not know why it doesn't work. But using \noalign{\vspace{#2}} works.

\documentclass{article}
\usepackage[paperwidth=21cm]{geometry}% To eliminate warning in MWE
\usepackage{amsmath}
\usepackage{booktabs}

\newcommand*{\MyTable}[2]{%
\begin{tabular}[t]{@{}cc@{}}\toprule
#1 & #2 \\
\cmidrule{1-2}
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ \end{bmatrix}$                             & $1 \times 4$ \\[#1]
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \\ \end{bmatrix}$                             & $4 \times 4$ \\\noalign{\vspace{#2}}
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ a_{41} & a_{42} & a_{43} \\ \end{bmatrix}$                             & $4 \times 3$ \\
\bottomrule
\end{tabular}%
}

\begin{document}\noindent
\MyTable{0.0ex}{0.0ex}
\MyTable{2.0ex}{2.0ex}
\MyTable{2.0ex}{4.0ex}
\end{document}


• The spacing inserted with \\[<length>] is just added to the minimum depth of the row; if the natural depth exceeds the minimum depth resulting from this, no space is added. With \noalign{\vspace{<lenght>} you're adding the space no matter what. Another way is to say \\ \\[-1ex], that is, adding a dummy row and some backing up. – egreg May 24 '14 at 10:24
• @egreg thanks. I doubted it but was not sure. Thank you. – user11232 May 24 '14 at 20:38
• This is a good solution to the problem as I don't need to think about how much to adjust the baseline by -- all I really care about is the space between the bottom of one row and the top of the next one. – Peter Grill May 25 '14 at 0:17

The amounts of extra vertical space you're providing -- 2ex and 4ex -- aren't enough to have an effect. To wit, if you chose 10ex or 15ex, the effect is readily apparent.

If you're not sure from where to start the calculation of the desired amount of extra vertical spacing: The "baseline" is where the 1\times4, 4\times4, and 4\times3 terms show up.

\documentclass{article}
\usepackage[paperwidth=21cm]{geometry}% To eliminate warning in MWE
\usepackage{amsmath}
\usepackage{booktabs}

\newcommand*{\MyTable}[2]{%
\begin{tabular}[t]{@{}cc@{}}\toprule
#1 & #2 \\
\cmidrule{1-2}
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ \end{bmatrix}$                              & $1 \times 4$ \\[#1]
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \\ \end{bmatrix}$                              & $4 \times 4$ \\[#2]
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ a_{41} & a_{42} & a_{43} \\ \end{bmatrix}$                              & $4 \times 3$ \\
\bottomrule
\end{tabular}%
}

\begin{document}\noindent
\MyTable{0ex}{0ex}
\MyTable{10ex}{10ex}
\MyTable{15ex}{15ex}
\end{document}

• Thanks. I had erroneously assumed that the space added was from the bottom of the row. – Peter Grill May 24 '14 at 19:04
• While this does explain what is going on, @HarishKumar's provides an easy to use solution, so accepting that one instead. – Peter Grill May 25 '14 at 0:15

You can also try to add \rule{0pt}{#n}

\documentclass{article}
\usepackage[paperwidth=21cm]{geometry}% To eliminate warning in MWE
\usepackage{amsmath}
\usepackage{booktabs}

\newcommand*{\MyTable}[2]{%
\begin{tabular}[t]{@{}cc@{}}\toprule
#1 & #2 \\
\cmidrule{1-2}
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ \end{bmatrix}$                              & $1 \times 4$ \\ \rule{0pt}{#1}
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \\ \end{bmatrix}$                              & $4 \times 4$ \\ \rule{0pt}{#2}
% -------------------------------------------
$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ a_{41} & a_{42} & a_{43} \\ \end{bmatrix}$                              & $4 \times 3$ \\
\bottomrule
\end{tabular}%
}

\begin{document}\noindent
\MyTable{6ex}{6ex}
\MyTable{7ex}{7ex}
\MyTable{8ex}{8ex}
\end{document}

• This does not seem to work with smaller amounts but only with larger amounts, just as the MWE does. – Peter Grill May 24 '14 at 19:03