I use amsmath and I have matrices in my equations. The rows are too close to each other.

How can I make the spacing between the matrix lines wider?

This question is marked "community wiki".

asked 01 Feb, 10:31

Community's gravatar image

Community
372
accept rate: 0%


You could redefine \arraystretch. This can be made locally, within a group or environment. For example:

\begingroup
\renewcommand*{\arraystretch}{1.5}
% your pmatrix expression
\endgroup

But you could do it in the preamble too, then it would have effect on all matrices and arrays.

Here's a redefinition of an internal amsmath LaTeX macro for customizing line spacing in specific matrices arbitrarily as desired:

\makeatletter
\renewcommand*\env@matrix[1][\arraystretch]{%
  \edef\arraystretch{#1}%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{*\c@MaxMatrixCols c}}
\makeatother

After putting this in your preamble, you can write

\begin{pmatrix}[1.5]
...

vary the value as you like, with pmatrix, vmatrix, bmatrix and alike, or use it without the optional argument as usually.

I used it similar in my blog some years ago.

Complete small example to show the difference:

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][\arraystretch]{%
  \edef\arraystretch{#1}%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{*\c@MaxMatrixCols c}}
\makeatother
\begin{document}
\[
  \begin{pmatrix}
    1 & 0 \\
    0 & 1
  \end{pmatrix}
  =
  \begin{pmatrix}[1.5]
    1 & 0 \\
    0 & 1
  \end{pmatrix}
\]
\end{document}

matrices in two sizes

I originally wrote this text on TeX.SE and share it here.

permanent link

answered 01 Feb, 10:33

stefan's gravatar image

stefan ♦♦
862
accept rate: 42%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1
×1
×1
×1

question asked: 01 Feb, 10:31

question was seen: 969 times

last updated: 01 Feb, 10:33

Related questions