Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 4 down vote accepted

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 theenter image description here 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}
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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