# matrices too big to fit the width of a page

When I type matrices in beamer class, they are often too big to fit the width of a page. What is the way to make the matrices smaller? I also want to make the font of the entries of these matrices smaller. I used

$\scriptscriptstyle M_{1,k} = \frac{1}{15} \left( \begin{array}{cccccccc} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 12k b_0 & (12k+15) b_1 & (12k+30) b_2 & (12k+45) b_3 & (12k+60) b_4 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 2k a_0 & (2k+5) a_1 & (2k+10) a_2 & 0 & 0 \\ \end{array} \right)$


But it only makes the scaler 1/15 smaller, not the entries of this matrix. Is there a way to make the entries smaller, without typing \scriptstyle for each entries? Maybe something we can change the whole size by 75%, 50% of the content in $$...$$

• put \scriptsize inside the array? – Seamus Feb 1 '12 at 13:54
• Also, don't do this. No-one will be able to read your slides if you make the text that small. – Seamus Feb 1 '12 at 13:56

One quick (but not very beautiful) solution is to work with \scalebox from the graphicx package, e.g.

\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}

$M_{1,k} = \frac{1}{15} \left( \scalemath{0.3}{ \begin{array}{cccccccc} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 12k b_0 & (12k+15) b_1 & (12k+30) b_2 & (12k+45) b_3 & (12k+60) b_4 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 2k a_0 & (2k+5) a_1 & (2k+10) a_2 & 0 & 0 \\ \end{array} } \right)$

• A choice of \scalemath{0.75} will look quite a bit more beautiful; \scalemath{0.3} renders the contents virtually undecipherable... – Mico Feb 2 '12 at 19:16

I suggest you insert, after the \begin{frame} statement but before the start of the equation, the following instructions.

\footnotesize
\setlength{\arraycolsep}{2.5pt}
\medmuskip = 1mu % default: 4mu plus 2mu minus 4mu


The command \footnotesize will bring about a roughly 20% reduction in fontsize; \arraycolsep=3pt cuts about 40% from the whitespace that gets inserted between columns (useful because you have 7 such whitespaces), and \medmuskip=1mu drastically reduces the amount of whitespace TeX inserts before and after each "+" symbol (and all other symbols of class "mathbin").

Here's a complete MWE and its output:

\documentclass{beamer}
\begin{document}
\begin{frame}
\footnotesize
\setlength{\arraycolsep}{2.5pt} % default: 5pt
\medmuskip = 1mu % default: 4mu plus 2mu minus 4mu
$M_{1,k} = \frac{1}{15} \left( \begin{array}{rrrrrr} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 12k b_0 & (12k+15) b_1 & (12k+30) b_2 & (12k+45) b_3 & (12k+60) b_4 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 2k a_0 & (2k+5) a_1 & (2k+10) a_2 & 0 & 0 \\ \end{array} \right)$
\end{frame}
\end{document}


Addendum: If you need to economize further on whitespace, you could (i) reduce the whitespace around the equal sign by issuing the command \thickmuskip = 2mu and (ii) replace the array preamble line \begin{array}{rrrrrr} with \begin{array}{@{}rrrrrr@{}}; the latter measure will eliminate the whitespace between the opening and closing large parentheses and the first/last column of numbers.

Resize the width to \linewidth

\documentclass{beamer}
\begin{document}
\begin{frame}

\resizebox{\linewidth}{!}{%
$\displaystyle M_{1,k} = \frac{1}{15} \left( \begin{array}{rrrrrrrr} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 12k b_0 & (12k+15) b_1 & (12k+30) b_2 & (12k+45) b_3 & (12k+60) b_4 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 2k a_0 & (2k+5) a_1 & (2k+10) a_2 & 0 & 0 \\ \end{array} \right)$}
\end{frame}

\end{document}