I have a big matrix which exceeds the width of page, how can I fix this problem?
You can use the nccmath
package, an extension to amsmath that defines medium-sized mathematics, intermediate between textstyle and displaystyle (ca 80 % of the displaystyle size). With a suitable text width, it's OK but, of course, everything depends on what you actually have. Here is an illustration with textwidth=16cm and both styles:
\documentclass{article}
\usepackage[showframe, nomarginpar, textwidth = 16cm]{geometry}
\usepackage{amsmath}
\usepackage{nccmath}
\newenvironment{mpmatrix}{\begin{medsize}\begin{pmatrix}}%
{\end{pmatrix}\end{medsize}}%
\begin{document}
\[
\begin{mpmatrix}
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o & a+b+c+d+e+f+g+h+i+j+k+l+m+n+o \\
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o &a+b+c+d+e+f+g+h+i+j+k+l+m+n+o
\end{mpmatrix},
\]
\[
\begin{pmatrix}
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o & a+b+c+d+e+f+g+h+i+j+k+l+m+n+o \\
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o &a+b+c+d+e+f+g+h+i+j+k+l+m+n+o
\end{pmatrix},
\]
\end{document}
-
@rose: Before you start using
nccmath
too much in your code I thought I'd refer you to: Is there a replacement for nccmath?. I was usingnccmath
for a while but then abandoned it due to the problems listed in that question. – Peter Grill Mar 19 '14 at 4:43
In those cases, I'd suggest you to use some names for the entries and then explain those names in the text, as the following example illustrates:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{pmatrix}
\alpha & \beta \\
\gamma & \delta
\end{pmatrix},
\]
where $\alpha=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o$, $\beta=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o$, $\gamma=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o$
and $\delta=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o$.
\end{document}
Using smallmatrix
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent X \hrulefill X
\[
\begin{smallmatrix}
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o & a+b+c+d+e+f+g+h+i+j+k+l+m+n+o \\
a+b+c+d+e+f+g+h+i+j+k+l+m+n+o &a+b+c+d+e+f+g+h+i+j+k+l+m+n+o
\end{smallmatrix}
\]
\noindent X\hrulefill X
\end{document}
Or use of array
in an math environment
Code
\documentclass[12pt]{article}
\usepackage{amsmath}
\thispagestyle{empty}
\begin{document}
\[
\left (
\begin{array}{ccc}
\begin{array}{l}
a+b+c+d+e+f+g+h\\
+i+j+k+l+m+n+o
\end{array}
& \cdots &
\begin{array}{l}
a+b+c+d+e+f+g+h\\
+i+j+k+l+m+n+o
\end{array} \\
\vdots & \ddots & \vdots\\
\begin{array}{l}
a+b+c+d+e+f+g+h\\
+i+j+k+l+m+n+o
\end{array} &
\cdots &
\begin{array}{l}
a+b+c+d+e+f+g+h\\
+i+j+k+l+m+n+o \\
\end{array}
\end{array}
\right )
\]
\end{document}