# Matrix vertical alignment in combination with double spacing

Why does the following code mess up the vertical alignment in the matrices?

\documentclass{article}

\usepackage{amsmath}
\usepackage{setspace}

\doublespacing

\begin{document}

The first case is
$\left[\begin{matrix} 1 & 2 & 3 \end{matrix}\right]$.

The second case is
$\renewcommand\arraystretch{0.5}\left[\begin{matrix} 1 & 2 & 3 \end{matrix}\right]$.

\end{document}


In the first case, the numbers are clearly too low, and the brackets are too long. This is due to the value of baselinestretch, which I cancel out by taking arraystretch = 1/baselinestretch in the second case. But here, the numbers come out just too high, and moreover the brackets are too long.

How to deal with this?

-
what happens if your remove the doublespacing command? Also, the first case should be $\begin{bmatrix} 1 & 2 & 3 \end{bmatrix}$. The second case is strange here and should be avoided. –  pluton May 9 '12 at 2:02
@pluton: Without the doublespacing command everything looks fine. Using bmatrix gives exactly the same output. –  Yori May 9 '12 at 2:06
and you want to keep the doublespacing option? –  pluton May 9 '12 at 2:11
Yes, I need to keep double spacing –  Yori May 9 '12 at 3:52
Matrices (even one row matrices) are "vertical objects", so the interline space influences their typesetting. –  egreg May 9 '12 at 6:28

The matrices are centred rather than aligned on the baseline of a row. You get slightly better spacing if you use bmatrix or with delarray you can align on the top row (but then you don't get the spacing adjustments of the AMS version)

\documentclass{article}

\usepackage{amsmath,delarray}
\usepackage{setspace}
\doublespacing
\begin{document}
The first case is $\left[\begin{matrix} 1 & 2 & 3 \end{matrix}\right]$.

The first case is $\begin{bmatrix} 1 & 2 & 3 \end{bmatrix}$. bm

The first case is $\begin{array}[t]\lbrack{ccc}\rbrack 1 & 2 & 3 \end{array}$. da

The second case is
$\renewcommand\arraystretch{0.5}\left[\begin{matrix} 1 & 2 & 3 \end{matrix}\right]$.

The second case is
$\renewcommand\arraystretch{0.5}\begin{bmatrix} 1 & 2 & 3 \end{bmatrix}$. bm

The second case is
$\renewcommand\arraystretch{0.5}\begin{array}[t]\lbrack{ccc}\rbrack 1 & 2 & 3 \end{array}$. da

\end{document}

-
Thanks. I think I found what was the problem: a (to me) unexpected value of baselinestretch, see my comment above. –  Yori May 9 '12 at 13:01