TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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
up vote 9 down vote accepted

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.


 Column1 & Column2 & Column3 & Column4 & Column5 & Column6 & Column7 & Column8 & Column9

 Column1 & Column2 & Column3 & Column4 & Column5 & Column6 & Column7 & Column8 & Column9
share|improve this answer
\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}.

Default is 6pt.

Source: http://www.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html

share|improve this answer
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
yes this exactly the answer i was searching for. in the question what i meant by 'I do not want to have to manually adjust the spacing' was 'I do not want to have to manually adjust the spacing using \! for each entry.' perhaps i should have been more clear. – Ferguzz Jan 3 '12 at 1:27
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.