4

I want to reduce the size of the vertical space in matrix environment and have a result something like this

a more compact matrix

But at present I manage something like below

Not so compact matrix

with the following code

  $\begin{bmatrix}
    00 & 08 & 10 & 18 & 20 & 28 & 30 & 38 \\
    01 & 09 & 11 & 19 & 21 & 29 & 31 & 39 \\
    02 & 0a & 12 & 1a & 22 & 2a & 32 & 3a \\
    03 & 0b & 13 & 1b & 23 & 2b & 33 & 3b \\
    04 & 0c & 14 & 1c & 24 & 2c & 34 & 3c \\
    05 & 0d & 15 & 1d & 25 & 2d & 35 & 3d \\
    06 & 0e & 16 & 1e & 26 & 2e & 36 & 3e \\
    07 & 0f & 17 & 1f & 27 & 2f & 37 & 3f
  \end{bmatrix}$

I can change the font using \mathsf{}, but other than that, how I reduce the vertical space between the rows? I did find things like array stretch to increase vertical space between rows in matrix, but not something that can decrease the space.

Soham
  • 163

2 Answers2

3

You're probably using setspace with the \doublespacing option, which gives

enter image description here

very much like your picture.

Since \doublespacing sets the \baselinestretch to 1.6667, you can countermand it for arrays with

\renewcommand{\arraystretch}{0.6}

because 0.6 is the inverse of 1.6667.

\documentclass{article}
\usepackage{amsmath}
\usepackage{setspace}
\doublespacing
\renewcommand{\arraystretch}{0.6} % because \baselinestretch is 1.6667

\begin{document}
$\begin{bmatrix}
    00 & 08 & 10 & 18 & 20 & 28 & 30 & 38 \\
    01 & 09 & 11 & 19 & 21 & 29 & 31 & 39 \\
    02 & 0a & 12 & 1a & 22 & 2a & 32 & 3a \\
    03 & 0b & 13 & 1b & 23 & 2b & 33 & 3b \\
    04 & 0c & 14 & 1c & 24 & 2c & 34 & 3c \\
    05 & 0d & 15 & 1d & 25 & 2d & 35 & 3d \\
    06 & 0e & 16 & 1e & 26 & 2e & 36 & 3e \\
    07 & 0f & 17 & 1f & 27 & 2f & 37 & 3f
  \end{bmatrix}$

\end{document}

enter image description here

egreg
  • 1,121,712
1

As pointed out by OP on comments, \renewcommand*{\arraystretch}{.5} should work.

Sigur
  • 37,330