Graphics, Figures & TablesFit wide matrix to page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Al.x
Posts: 10
Joined: Tue Oct 27, 2009 3:53 pm

Fit wide matrix to page

Post by Al.x »

Hi,

I'm trying to fit a fairly wide matrix on a page. I've already made it \tiny, and it looks fairly good, but it is still slightly outside my right margin. I saw an example of someone who tried \makebox around a table to fit a wide table, and that seems to work, but I haven't been able to do something similar with my matrix.

Anyway, here's my code (slightly altered to fit):

Code: Select all

\[ \mathcal{Q} = 
\tiny
\left( \begin{array}{ccccccccccccccc}
0.29 & ...(more data)... & 0.52 \\
...(more data)...
0.34 & ...(more data)... & 2.00 \\
\end{array} \right)\] 
This isn't the first time I've run into this type of problem, that is, fitting something that's too wide to a page. I've looked everywhere! Isn't there some package I can use that tells LaTeX to go screw itself and fit something to the center of a page?

Regards,
Alex

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Fit wide matrix to page

Post by Stefan Kottwitz »

Hi Alex,

welcome to the board!
You could use \resizebox of the graphicx package.

Stefan
LaTeX.org admin
Al.x
Posts: 10
Joined: Tue Oct 27, 2009 3:53 pm

Re: Fit wide matrix to page

Post by Al.x »

Hi Stefan,

Thanks for your suggestion, but that isn't what I had in mind. I've already made it as small as possible (if I make it any smaller, the reader is going to need a magnifying glass).

I simply want to center the matrix to the page. Btw, I'm not really sure how you would use \resizebox around the math environment. I gave it a try and the compiler (which is xelatex btw) failed.

Alexander
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Fit wide matrix to page

Post by Stefan Kottwitz »

Hi Alexander,

have a look at Centering wide tables or figures, that example yould be modified:

Code: Select all

\noindent\makebox[\textwidth]{%
\tiny
\(\displaystyle \mathcal{Q} =
\left( \begin{array}{ccccccccccccccc}
0.29 & ...(more data)... & 0.52 \\
...(more data)...
0.34 & ...(more data)... & 2.00 \\
\end{array} \right)\)}
Stefan
LaTeX.org admin
Al.x
Posts: 10
Joined: Tue Oct 27, 2009 3:53 pm

Re: Fit wide matrix to page

Post by Al.x »

Well I'll be.... It worked!

Dude. Thanks.

So - small round-off question: why did you change "\[" to "\("? I see that it is necessary, cause it doesn't work with "\[". Is that some fancy math mode?

Alex
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Fit wide matrix to page

Post by Stefan Kottwitz »

\( ... \) is inline math mode like $...$. \[ ... \] could work for instance together with \parbox or a minipage inside \makebox.

Stefan
LaTeX.org admin
Al.x
Posts: 10
Joined: Tue Oct 27, 2009 3:53 pm

Re: Fit wide matrix to page

Post by Al.x »

Nice! Haven't seen that before :shock:

Have a good one...

Alex
Post Reply