当我写这个矩阵时,它超出了页面的范围。
\begin{equation}
\begin{bmatrix}
1 & x_2x_6 + x_1x_3x_6 + x_1x_4x_5 + x_2x_3x_4x_5
+x_1x_3x_4x_5 + x_1x_5x_6 + x_2x_3x_5x_6 + x_1x_3x_5x_6 &x_1x_5x_7+x_2x_3x_5x_7+x_1x_3x_5x_7 \\
x_2x_6+ x_1x_3x_6 + x_4+x_4x_5x_6 + x_3x_4x_5x_6+ x_3x_5x_6 & 1 & x_8+x_4x_7+x_3x_5x_6x_7\\
x_1x_5x_7+x_3x_5x_7 & x_8+x_4x_7+x_5x_6x_7 & 1
\end{bmatrix}
\end{equation}
我怎样才能解决这个问题?
答案1
除了可以轻松地放在一页上之外,以下解决方案还具有为表达式引入名称的优点,以便您以后引用这些表达式。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{bmatrix}
1 & a_{12} & a_{13} \\
a_{21}& 1 & a_{23} \\
a_{21}& a_{32} & 1
\end{bmatrix}
\end{equation}
where
\begin{align*}
a_{12} &=x_2x_6 + x_1x_3x_6
+ x_1x_4x_5 + x_2x_3x_4x_5\\
&\quad + x_1x_3x_4x_5 + x_1x_5x_6
+ x_2x_3x_5x_6
+ x_1x_3x_5x_6 \\
a_{13} &=x_1x_5x_7+x_2x_3x_5x_7
+ x_1x_3x_5x_7 \\
a_{21} &= x_2x_6+ x_1x_3x_6 + x_4
+ x_4x_5x_6 + x_3x_4x_5x_6
+ x_3x_5x_6 \\
a_{23} &= x_8+x_4x_7+x_3x_5x_6x_7\\
a_{31} &= x_1x_5x_7+x_3x_5x_7\\
a_{32} &= x_8+x_4x_7+x_5x_6x_7
\end{align*}
\end{document}
答案2
您可以aligned
将长进入的环境\medmath
与nccmath
(约 80 %\displaystyle
)结合起来,并进行游戏arraycolsep
:
\documentclass{article}
\usepackage{mathtools, nccmath}
\usepackage[ showframe]{geometry}
\begin{document}
\begin{equation}\setlength\arraycolsep{4pt}
\medmath{\begin{bmatrix}
1 &\begin{aligned}x_2x_6 + x_1x_3x_6 + x_1x_4x_5 + x_2x_3x_4x_5 \\[-0.8ex]{}
+x_1x_3x_4x_5+ x_1x_5x_6 + x_2x_3x_5x_6 + x_1x_3x_5x_6\end{aligned} &\begin{aligned}x_1x_5x_7+x_2x_3x_5x_7\\[-0.8ex]{}+x_1x_3x_5x_7 \end{aligned} \\[3ex]
\begin{aligned}x_2x_6 + x_1x_3x_6 + x_4+x_4x_5x_6\\[-0.8ex] {} + x_3x_4x_5x_6+ x_3x_5x_6\end{aligned} & 1 & x_8+x_4x_7+x_3x_5x_6x_7\\[3ex]
x_1x_5x_7+x_3x_5x_7 & x_8+x_4x_7+x_5x_6x_7 & 1
\end{bmatrix}}
\end{equation}
\end{document}
答案3
这不是我最喜欢的解决方案,但是如果您想在矩阵中逐字逐句地拥有表达式,并且不想减小矩阵内相对于周围文本的字体大小,这是一种方法。
\documentclass{article}
\usepackage{amsmath}
\newcommand\wrapped[1]%
{\renewcommand\arraystretch{1}%
\begin{array}{@{}l@{}}#1\end{array}%
}
\begin{document}
\begin{equation}
\renewcommand\arraystretch{1.5}
\begin{bmatrix}
1
& \wrapped
{x_2x_6 + x_1x_3x_6\\
{} + x_1x_4x_5 + x_2x_3x_4x_5\\
{} +x_1x_3x_4x_5 + x_1x_5x_6\\
{} + x_2x_3x_5x_6\\
{} + x_1x_3x_5x_6
}
& \wrapped
{x_1x_5x_7+x_2x_3x_5x_7\\
{}+x_1x_3x_5x_7
}
\\
\wrapped
{x_2x_6+ x_1x_3x_6 + x_4\\
{}+x_4x_5x_6 + x_3x_4x_5x_6\\
{}+ x_3x_5x_6
}
& 1
& x_8+x_4x_7+x_3x_5x_6x_7
\\
x_1x_5x_7+x_3x_5x_7
& x_8+x_4x_7+x_5x_6x_7
& 1
\end{bmatrix}
\end{equation}
\end{document}