格式化跨多行的大型矩阵

格式化跨多行的大型矩阵

我有以下乳胶来创建矩阵:

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{graphicx,ctable,booktabs}

\begin{document}
$\left(\begin{array}{rrr}
-\frac{200 \, x^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \frac{200 \, x^{2}}{x^{2} + y^{2}} + \frac{200 \, {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{\sqrt{x^{2} + y^{2}}} + \frac{2000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)} y}{x^{3} {\left(\frac{y^{2}}{x^{2}} + 1\right)}} + \frac{5000 \, \pi^{2} y^{2}}{x^{4} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} - \frac{2000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)} y^{3}}{x^{5} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} & -\frac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \frac{200 \, x y}{x^{2} + y^{2}} - \frac{1000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)}}{x^{2} {\left(\frac{y^{2}}{x^{2}} + 1\right)}} - \frac{5000 \, \pi^{2} y}{x^{3} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} + \frac{2000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)} y^{2}}{x^{4} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} & \frac{1000 \, \pi y}{x^{2} {\left(\frac{y^{2}}{x^{2}} + 1\right)}} \\
-\frac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \frac{200 \, x y}{x^{2} + y^{2}} - \frac{1000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)}}{x^{2} {\left(\frac{y^{2}}{x^{2}} + 1\right)}} - \frac{5000 \, \pi^{2} y}{x^{3} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} + \frac{2000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)} y^{2}}{x^{4} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} & -\frac{200 \, y^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \frac{200 \, y^{2}}{x^{2} + y^{2}} + \frac{200 \, {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{\sqrt{x^{2} + y^{2}}} + \frac{5000 \, \pi^{2}}{x^{2} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} - \frac{2000 \, \pi {\left(5 \, \pi \arctan\left(\frac{y}{x}\right) - z\right)} y}{x^{3} {\left(\frac{y^{2}}{x^{2}} + 1\right)}^{2}} & -\frac{1000 \, \pi}{x {\left(\frac{y^{2}}{x^{2}} + 1\right)}} \\
\frac{1000 \, \pi y}{x^{2} {\left(\frac{y^{2}}{x^{2}} + 1\right)}} & -\frac{1000 \, \pi}{x {\left(\frac{y^{2}}{x^{2}} + 1\right)}} & 202
\end{array}\right)$
\end{document}

结果如下: 大型矩阵

我该如何正确格式化上述矩阵以使其不被截断?我该如何让它跨越多行?

答案1

我不确定这对你来说是否足够好,但显示这个矩阵的一种方法是:

  1. 为经常出现的表达式定义符号。
  2. 即使使用 #1,这仍然需要缩放矩阵以适应线宽

在此处输入图片描述


另一个解决方案是为这四个复杂的条目定义一个符号:

在此处输入图片描述

笔记:

  • [showframe]选项已应用于包裹geometry 仅显示页边距。
  • 许多\,都被淘汰了——它们是没有必要的,因为没有它们,间距也是正确的。

代码:

\documentclass[12pt]{article}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{mathtools}
\usepackage{graphicx}

\newcommand{\SQ}{\phi}
\newcommand{\SQExpanded}{x^{2} + y^{2}}
\newcommand{\FivePi}{\omega}
\newcommand{\FivePiExpanded}{5 \pi \arctan\left(\frac{y}{x}\right) - z}
\newcommand{\Denominator}{\left(\frac{\phi}{x^2}\right)}
% ----
\newcommand{\A}{%
-\frac{200 x^{2} {\left(\sqrt{\SQ} - 1\right)}}{{\left(\SQ\right)}^{\frac{3}{2}}} + \frac{200  x^{2}}{\SQ} + \frac{200  {\left(\sqrt{\SQ} - 1\right)}}{\sqrt{\SQ}} + \frac{2000  \pi {\FivePi} y}{x^{3} {\Denominator}} + \frac{5000  \pi^{2} y^{2}}{x^{4} {\Denominator}^{2}} - \frac{2000  \pi {\FivePi} y^{3}}{x^{5} {\Denominator}^{2}}%
}%
\newcommand{\B}{%
-\frac{200  x y {\left(\sqrt{\SQ} - 1\right)}}{{\left(\SQ\right)}^{\frac{3}{2}}} + \frac{200  x y}{\SQ} - \frac{1000  \pi {\FivePi}}{x^{2} {\Denominator}} - \frac{5000  \pi^{2} y}{x^{3} {\Denominator}^{2}} + \frac{2000  \pi {\FivePi} y^{2}}{x^{4} {\Denominator}^{2}}%
}
\newcommand{\C}{%
-\frac{200  x y {\left(\sqrt{\SQ} - 1\right)}}{{\left(\SQ\right)}^{\frac{3}{2}}} + \frac{200  x y}{\SQ} - \frac{1000  \pi {\FivePi}}{x^{2} {\Denominator}} - \frac{5000  \pi^{2} y}{x^{3} {\Denominator}^{2}} + \frac{2000  \pi {\FivePi} y^{2}}{x^{4} {\Denominator}^{2}}%
}
\newcommand{\D}{%
-\frac{200  y^{2} {\left(\sqrt{\SQ} - 1\right)}}{{\left(\SQ\right)}^{\frac{3}{2}}} + \frac{200  y^{2}}{\SQ} + \frac{200  {\left(\sqrt{\SQ} - 1\right)}}{\sqrt{\SQ}} + \frac{5000  \pi^{2}}{x^{2} {\Denominator}^{2}} - \frac{2000  \pi {\FivePi} y}{x^{3} {\Denominator}^{2}}%
}

\begin{document}
The matrix is as follows
\par\noindent
\scalebox{0.70}{\renewcommand{\arraystretch}{2.5}%%
$\left(\begin{array}{rrr}
                                      \A & \B      &  \frac{1000  \pi y}{x^{2} {\Denominator}} \\
                                      \C & \D      & -\frac{1000  \pi}{x {\Denominator}} \\
\frac{1000  \pi y}{x^{2} {\Denominator}} & -\frac{1000  \pi}{x {\Denominator}} & 202
\end{array}\right)$}

where
\begin{align*}
        \SQ &= \SQExpanded  \\
    \FivePi &= \FivePiExpanded
\end{align*}
An alternate solution is:
\[ \renewcommand{\arraystretch}{2.0}
\left(\begin{array}{ccc}
                                       A &  B      &  \frac{1000  \pi y}{x^{2} {\Denominator}} \\
                                       C &  D      & -\frac{1000  \pi}{x {\Denominator}} \\
\frac{1000  \pi y}{x^{2} {\Denominator}} & -\frac{1000  \pi}{x {\Denominator}} & 202
\end{array}\right)
\]
where
\begin{align*}
    A &= \A \\
    B &= \B \\
    C &= \C \\
    D &= \D \\
    \shortintertext{and}
    \SQ &= \SQExpanded  \\
\FivePi &= \FivePiExpanded
\end{align*}
\end{document}

答案2

我认为将这个非常大的 3x3 矩阵压缩成一行(或三行)不会带来多大好处。顺便说一句,因为矩阵是对称的,我认为明确提及这一事实会很好。

我建议您做类似下面的事情,这样读者就有机会在闲暇时检查矩阵中每个元素的内容。(如果您不喜欢使用方括号,当然可以自由地恢复使用圆括号。)

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{mathtools,amsthm,amssymb}
\begin{document}
Consider the symmetric matrix
\begin{align*}
A &=
\begin{pmatrix}
a_{11} & a_{12} & a_{13}\\
a_{21} & a_{22} & a_{23}\\
a_{31} & a_{32} & a_{33}\\
\end{pmatrix}\\
\intertext{where}
a_{11} &=
-\frac{200 \, x^2 [\sqrt{x^2 + y^2} - 1]}{\left(x^2 + y^2\right)^{3/2}} +
\frac{200 \, x^2}{x^2 + y^2} +
\frac{200 \, [\sqrt{x^2 + y^2} - 1]}{\sqrt{x^2 + y^2}} \\
&\qquad{}+\frac{2000 \, \pi [5 \, \pi \arctan(y/x) - z] y}{x^3 [(y^2/x^2) + 1]} +
\frac{5000 \, \pi^2 y^2}{x^4 {[(y^2/x^2) + 1]}^2} \\
&\qquad{}- \frac{2000 \, \pi [5 \, \pi \arctan(y/x) - z] y^3}{x^5 \left[(y^2/x^2) + 1\right]^2}\\[1ex]
a_{12} &=
-\frac{200 \, x y [\sqrt{x^2 + y^2} - 1]}{\left(x^2 + y^2\right)^{3/2}} + \frac{200 \, x y}{x^2 + y^2}
- \frac{1000 \, \pi [5 \, \pi \arctan(y/x) - z]}{x^2 [(y^2/x^2) + 1]} \\
&\qquad{}- \frac{5000 \, \pi^2 y}{x^3 \left[(y^2/x^2) + 1\right]^2} + \frac{2000 \, \pi [5 \, \pi \arctan(y/x) - z] y^2}{x^4 \left[(y^2/x^2) + 1\right]^2}\\[1ex]
a_{13} &=
\frac{1000 \, \pi y}{x^2 [(y^2/x^2) + 1]}\\
a_{21} &= a_{21}\\
a_{22} &=
-\frac{200 \, y^2 [\sqrt{x^2 + y^2} - 1]}{\left(x^2 + y^2\right)^{3/2}} + \frac{200 \, y^2}{x^2 + y^2}
+ \frac{200 \,[\sqrt{x^2 + y^2} - 1]}{\sqrt{x^2 + y^2}} \\
&\qquad{}+ \frac{5000 \, \pi^2}{x^2 \left[(y^2/x^2) + 1\right]^2} - \frac{2000 \, \pi [5 \, \pi \arctan(y/x) - z] y}{x^3 \left[(y^2/x^2) + 1\right]^2}\\[1ex]
a_{23} &=
-\frac{1000 \, \pi}{x [(y^2/x^2) + 1]}\\
a_{31} &= a_{13}\\
a_{32} &= a_{23}\\
\shortintertext{and}
a_{33} &= 202.
\end{align*}
\end{document}

答案3

我建议(至少在本地)使用 a smaller fontsize(11pt 即可),只写出最长项的显著开头(带点),并在下面给出完整项作为解释。该nccmath包需要编写medium sized分数,因为它的 medsize环境将数学公式的大小减少了约 80%,大小介于 displaystyle 和 textstyle 之间。我还在环境中使用包中的mathrlap和,以便(希望)获得“解释”的清晰布局:mathllapmathtoolsflalign*

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in, showframe]{geometry}
\usepackage{amsthm,amssymb}

\usepackage{mathtools}

\usepackage{nccmath}

\begin{document}

  \[ \begin{pmatrix}
 -\mfrac{200 \, x^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \mfrac{200 \, x^{2}}{x^{2} + y^{2}} + \cdots
& -\mfrac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \mfrac{200 \, x y}{x^{2} + y^{2}} - \cdots
& \mfrac{1000 \, \pi y}{x^{2} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}}
\\%
-\mfrac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \mfrac{200 \, x y}{x^{2} + y^{2}} - \cdots
& -\mfrac{200 \, y^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \mfrac{200 \, y^{2}}{x^{2} + y^{2}} + \cdots
& -\mfrac{1000 \, \pi}{x {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}}
\\%

\mfrac{1000 \, \pi y}{x^{2} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}}
& -\mfrac{1000 \, \pi}{x {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}}
& 202
    \end{pmatrix} \]
 where:
 \fontsize{10}{10}\selectfont
\begin{flalign*}%\MoveEqLeft[40]
 & \mathrlap{\begin{medsize} -\dfrac{200 \, x^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \dfrac{200 \, x^{2}}{x^{2} + y^{2}} + \cdots =-\dfrac{200 \, x^{2} {\left(\sqrt{x^{2}   + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}}  + \dfrac{200 \, x^{2}}{x^{2} + y^{2}}+ \dfrac{200 \, {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{\sqrt{x^{2} + y^{2}}}\end{medsize}} &  &
   \\
  & &  & \mathllap{\begin{medsize} + \dfrac{2000 \, \pi {\left(5 \, \pi \arctan\left(\dfrac{y}{x}\right) - z\right)} y}{x^{3} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}} + \dfrac{5000 \, \pi^{2} y^{2}}{x^{4} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}} - \dfrac{2000 \, \pi {\left(5 \, \pi \arctan\left(\dfrac{y}{x}\right) - z\right)} y^{3}}{x^{5} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}}\end{medsize}}
        \\[6pt]
      \mathrlap{\begin{medsize}-\dfrac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\dfrac{3}{2}}} + \dfrac{200 \, x y}{x^{2} + y^{2}} - \cdots = -\dfrac{200 \, x y {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}}  + \dfrac{200 \, x y}{x^{2} + y^{2}} - \dfrac{1000 \, \pi {\left(5 \, \pi \arctan\left(\dfrac{y}{x}\right) - z\right)}}{x^{2} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}} \end{medsize}}
      \\
&  &  &  \mathllap{\begin{medsize}
          - \dfrac{5000 \, \pi^{2} y}{x^{3} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}} + \dfrac{2000 \, \pi {\left(5 \, \pi \arctan\left(\dfrac{y}{x}\right) - z\right)} y^{2}}{x^{4} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}}
        \end{medsize}}
      \\[6pt]
 & \mathrlap{\begin{medsize}      -\dfrac{200 \, y^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \dfrac{200 \, y^{2}}{x^{2} + y^{2}} + \cdots  =  -\dfrac{200 \, y^{2} {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{{\left(x^{2} + y^{2}\right)}^{\frac{3}{2}}} + \dfrac{200 \, y^{2}}{x^{2} + y^{2}} + \dfrac{200 \, {\left(\sqrt{x^{2} + y^{2}} - 1\right)}}{\sqrt{x^{2} + y^{2}}}
 \end{medsize}}
         \\
 &  &  &  \mathllap{\begin{medsize}+ \dfrac{5000 \, \pi^{2}}{x^{2} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}} - \dfrac{2000 \, \pi {\left(5 \, \pi \arctan\left(\dfrac{y}{x}\right) - z\right)} y}{x^{3} {\left(\dfrac{y^{2}}{x^{2}} + 1\right)}^{2}}
 \end{medsize}}
\end{flalign*}
\normalsize

\end{document}

结果(此处的框架显示所有内容均在边缘内):

在此处输入图片描述

相关内容