# Set horizontal width of matrix in amsmath [duplicate]

I have a 16x16 pmatrix. How do i set the width so it doesn't overflow my column? E.g. something like [width = 0.9\columnwidth].

I do not want to have to manually adjust the spacing, which by the way, seems too wide to me anyway.

-
Since pmatrix uses array, the only way to shrink it to the desired width would be to scale the entire pmatrix. –  Werner Jan 2 '12 at 16:17
how do i do that? –  Ferguzz Jan 2 '12 at 16:18
@Ferguzz: See @ PeterGrill's answer. The use of ! for the "unknown" dimension maintains the aspect ratio of the resizing. –  Werner Jan 2 '12 at 16:27

## marked as duplicate by Marco Daniel, Werner, cmhughes, Seamus, Joseph Wright♦Jan 5 '12 at 22:29

You can use \resizebox from the graphicx package. Here I have used the [showframe] option of the geometry package so that the column edges are visible:

If you don't want the matrix to use the full line width you can use {0.9\linewidth} so that it re sizes to 90% of the line width.

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
\noindent
$\begin{pmatrix} Column1 & Column2 & Column3 & Column4 & Column5 & Column6 & Column7 & Column8 & Column9 \end{pmatrix}$

\noindent
\resizebox{\linewidth}{!}{%
$\begin{pmatrix} Column1 & Column2 & Column3 & Column4 & Column5 & Column6 & Column7 & Column8 & Column9 \end{pmatrix}$%
}
\end{document}

-
\resizebox{\linewidth}{!}{% otherwise you'll get an unwanted space. Same before the closing } –  Herbert Jan 2 '12 at 16:57
@Herbert: Thanks. Have corrected that. –  Peter Grill Jan 2 '12 at 17:06
thanks. good answer and does what i need. i am still intrigued as to how to set the default spacing for pmatrix. i will post here if i do find out. –  Ferguzz Jan 2 '12 at 20:16
To set horizontal spacing in math arrays: \setlength{\arraycolsep}{3pt}.
Even though this fixes the width between columns in an array (pmatrix is typeset in using an array) to 3pt, which is less than the default 6pt, does it really answer your question? Remember, in this Q&A format, the "Answer" section is devoted to answers. –  Werner Jan 3 '12 at 1:25
True. However, such things only become clear once you've examined the answers clearly. For tabular spacing and future reference, see Column padding in tables. –  Werner Jan 3 '12 at 1:48