# How to reduce vertical space in matrix?

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

But at present I manage something like below

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.

• Did you try \renewcommand*{\arraystretch}{.5}? – Sigur Jun 6 '14 at 16:31
• No haven't tried that, just doing it. – Soham Jun 6 '14 at 16:32
• Thanks, sigur. That worked perfectly for me. I used \renewcommand\arraystretch{0.75} Was sceptical if stretch could be given a shrinking value. – Soham Jun 6 '14 at 16:37
• BTW, the hexadecimal letters a to f should not be set in math italics, but upright. – Heiko Oberdiek Jun 6 '14 at 19:25

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

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}


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