[Tex/LaTex] Set horizontal width of matrix in amsmath

amsmathmatrices

Possible Duplicate:
Is there a way to slightly shrink a table, including font size, to fit within the column boundaries?

I have a 16×16 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.

Best Answer

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:

enter image description here

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}