现在,我的文档如下所示:
或者像这样:
我很烦恼,因为方程式到处都是,而且排列不均匀。例如,我希望每行都与左侧对齐问题 1或者问题 2。 有什么建议么?
\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper an
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=\bfseries Problem \arabic*:]
\item %PROBLEM 1
Find $\textbf{A}+\textbf{B}$, $\textbf{AB}$, $\textbf{BA}$.\\\\
a) $\textbf{A} = \begin{bmatrix} 1 & 2 \\ 3 & -1 \end{bmatrix}\,\,\,\,\,$ and $\,\,\,\,\,\textbf{B} = \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}$. \,\,\,\,\,\textbf{A} is $2\times2$ and \textbf{B} is $2\times2$.
\[\textbf{A}+\textbf{B}=\begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix} + \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}=\begin{bmatrix} 1+2 & 2+1 \\3+1 & -1+1 \end{bmatrix}=\begin{bmatrix} 3 & 3 \\4 & 0 \end{bmatrix}\]
\[\textbf{AB}=\begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix} \cdot \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}=\begin{bmatrix} 1\cdot2+2\cdot1 & 1\cdot 1+2\cdot1 \\3\cdot2+(-1)\cdot1 & 3\cdot1+(-1)\cdot1 \end{bmatrix}=\begin{bmatrix} 4 & 3 \\5 & 2 \end{bmatrix}\]
\[\textbf{BA}= \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}\cdot \begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix}=\begin{bmatrix} 2\cdot1+1\cdot3 & 2\cdot 2+1\cdot(-1) \\1\cdot1+1\cdot3 & 1\cdot2+1\cdot(-1) \end{bmatrix}=\begin{bmatrix} 5 & 3 \\4 & 1 \end{bmatrix}\]\\
b) $\textbf{A} = \begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}\,\,\,\,\,$and
$\,\,\,\,\,\textbf{B} = \begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}$. \,\,\,\,\,\,\textbf{A} is $2\times3$ and \textbf{B} is $3\times2$.
$\textbf{A}+\textbf{B}$ is undefined because the two matrices are incompatible for addition.
\[ \textbf{AB}=\begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}\cdot\begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}=\begin{bmatrix} 2\cdot2+3\cdot4+1\cdot1 & 2\cdot (-2)+3\cdot3+1\cdot 5 \\0\cdot2+(-1)\cdot4 +2\cdot 1 & 0\cdot(-2)+(-1)\cdot3 +2\cdot5 \end{bmatrix}=\begin{bmatrix} 17 & 10 \\-2 & 7 \end{bmatrix} \]
\[ \textbf{BA}=\begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}\cdot \begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}=\begin{bmatrix} 2\cdot2+(-2)\cdot0 & 2\cdot 3+(-2)\cdot(1) &2\cdot1+(-2)\cdot 2 \\4\cdot2+3\cdot0&4\cdot3 +3\cdot (-1) & 4\cdot1+3\cdot2\\ 1\cdot2+5\cdot0&1\cdot3+5\cdot(-1)&1\cdot1+5\cdot2 \end{bmatrix}=\begin{bmatrix} 4 & 8&-2 \\8 & 9&10\\2&-2&11 \end{bmatrix} \]
\item %PROBLEM 2
Let $\textbf{a}' = \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix}$. Find \textbf{a}$'$\textbf{a} and \textbf{aa}$'$.
\textbf{a}$'$ is the transpose of $\textbf{a} = \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix}$
\[\textbf{a}'\textbf{a} = \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix} \cdot \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix} = \begin{bmatrix}
3^2 + 6^2 + (-3)^2 + 5^2 + 9^2 + 2^2 \\
\end{bmatrix} =[164] \]
\[\textbf{aa}' = \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix}\cdot \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix} = \begin{bmatrix}
3^2& 3\cdot 6 & 3\cdot (-3) & 3\cdot 5 & 3\cdot 9 & 3\cdot 2 \\
6\cdot 3& 6^2 & 6\cdot (-3) & 6\cdot 5 & 6\cdot 9 & 6\cdot 2 \\
(-3)\cdot 3& (-3)\cdot 6 & (-3)^2 & (-3)\cdot 5 & (-3)\cdot 9 & (-3)\cdot 2 \\
5\cdot 3& 5\cdot 6 & 5\cdot (-3) & 5^2 & 5\cdot 9 & 5\cdot 2 \\
9\cdot 3& 9\cdot 6 & 9\cdot (-3) & 9\cdot 5 & 9^2 & 9\cdot 2 \\
2\cdot 3& 2\cdot 6 & 2\cdot (-3) & 2\cdot 5 & 2\cdot 9 & 2^2 \\
\end{bmatrix} \\=\begin{bmatrix}
9& 18 & 9 & 15 & 27 & 6 \\
18& 36 & -18 & 30 & 54 & 12 \\
-9& -18 & 9 & -15 & 27 & -6 \\
15& 30 & 15 & 10 & 45 & 10 \\
27& 54 & 27 & 45 & 81 & 18 \\
6& 12 & 6 & 10 & 18 & 4 \\
\end{bmatrix} \]
Let $\textbf{b}' = \begin{bmatrix}
1 & 1 & 1 & 1 & 1 & 1 \\
\end{bmatrix}\,\,\,\,\,$
and
$\,\,\,\,\,\textbf{c}' = \begin{bmatrix}
1 & -1 & 1 & -1 & 1 & -1 \\
\end{bmatrix}$. Find \textbf{b}$'$\textbf{c} and \textbf{bc}$'$.
\end{enumerate}
\end{document}
答案1
我基本上从您的 MWE 中实施了两项更改。首先,我在调用align=left
中使用了enumerate
。然后,我将的实例替换为\[ ... \]
。$ ...$
请注意,在某些情况下,您可能必须在分隔符\displaystyle
内调用$
,但这里并非如此。
此外,对于换行的数学表达式,我添加了一些幻影以获得适当的缩进。
\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper an
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=\bfseries Problem \arabic*:, align=left]
\parskip 1em
\item %PROBLEM 1
Find $\textbf{A}+\textbf{B}$, $\textbf{AB}$, $\textbf{BA}$.\\
\item[a)] $\textbf{A} = \begin{bmatrix} 1 & 2 \\ 3 & -1 \end{bmatrix}\,\,\,\,\,$ and $\,\,\,\,\,\textbf{B} = \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}$. \,\,\,\,\,\textbf{A} is $2\times2$ and \textbf{B} is $2\times2$.
$\textbf{A}+\textbf{B}=\begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix} + \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}=\begin{bmatrix} 1+2 & 2+1 \\3+1 & -1+1 \end{bmatrix}=\begin{bmatrix} 3 & 3 \\4 & 0 \end{bmatrix}$
$\textbf{AB}=\begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix} \cdot \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}=\begin{bmatrix} 1\cdot2+2\cdot1 & 1\cdot 1+2\cdot1 \\3\cdot2+(-1)\cdot1 & 3\cdot1+(-1)\cdot1 \end{bmatrix}=\begin{bmatrix} 4 & 3 \\5 & 2 \end{bmatrix}$
$\textbf{BA}= \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}\cdot \begin{bmatrix} 1 & 2 \\ 3 & -1\end{bmatrix}=\begin{bmatrix} 2\cdot1+1\cdot3 & 2\cdot 2+1\cdot(-1) \\1\cdot1+1\cdot3 & 1\cdot2+1\cdot(-1) \end{bmatrix}=\begin{bmatrix} 5 & 3 \\4 & 1 \end{bmatrix}$
\item[b)] $\textbf{A} = \begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}\,\,\,\,\,$and
$\,\,\,\,\,\textbf{B} = \begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}$. \,\,\,\,\,\,\textbf{A} is $2\times3$ and \textbf{B} is $3\times2$.
$\textbf{A}+\textbf{B}$ is undefined because the two matrices are incompatible for addition.
$\textbf{AB}=\begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}\cdot\begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}=\begin{bmatrix} 2\cdot2+3\cdot4+1\cdot1 & 2\cdot (-2)+3\cdot3+1\cdot 5 \\0\cdot2+(-1)\cdot4 +2\cdot 1 & 0\cdot(-2)+(-1)\cdot3 +2\cdot5 \end{bmatrix}=\phantom{\textbf{AB}=}\begin{bmatrix} 17 & 10 \\-2 & 7 \end{bmatrix}$
$\textbf{BA}=\begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}\cdot \begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}=\begin{bmatrix} 2\cdot2+(-2)\cdot0 & 2\cdot 3+(-2)\cdot(1) &2\cdot1+(-2)\cdot 2 \\4\cdot2+3\cdot0&4\cdot3 +3\cdot (-1) & 4\cdot1+3\cdot2\\ 1\cdot2+5\cdot0&1\cdot3+5\cdot(-1)&1\cdot1+5\cdot2 \end{bmatrix}=\phantom{\textbf{BA}=}\begin{bmatrix} 4 & 8&-2 \\8 & 9&10\\2&-2&11 \end{bmatrix} $
\item %PROBLEM 2
Let $\textbf{a}' = \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix}$. Find \textbf{a}$'$\textbf{a} and \textbf{aa}$'$.
\textbf{a}$'$ is the transpose of $\textbf{a} = \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix}$
\[\textbf{a}'\textbf{a} = \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix} \cdot \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix} = \begin{bmatrix}
3^2 + 6^2 + (-3)^2 + 5^2 + 9^2 + 2^2 \\
\end{bmatrix} =[164] \]
$\textbf{aa}' = \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \\
\end{bmatrix}\cdot \begin{bmatrix}
3 & 6 &-3 & 5 & 9& 2 \\
\end{bmatrix} = \begin{bmatrix}
3^2& 3\cdot 6 & 3\cdot (-3) & 3\cdot 5 & 3\cdot 9 & 3\cdot 2 \\
6\cdot 3& 6^2 & 6\cdot (-3) & 6\cdot 5 & 6\cdot 9 & 6\cdot 2 \\
(-3)\cdot 3& (-3)\cdot 6 & (-3)^2 & (-3)\cdot 5 & (-3)\cdot 9 & (-3)\cdot 2 \\
5\cdot 3& 5\cdot 6 & 5\cdot (-3) & 5^2 & 5\cdot 9 & 5\cdot 2 \\
9\cdot 3& 9\cdot 6 & 9\cdot (-3) & 9\cdot 5 & 9^2 & 9\cdot 2 \\
2\cdot 3& 2\cdot 6 & 2\cdot (-3) & 2\cdot 5 & 2\cdot 9 & 2^2 \\
\end{bmatrix} \\\phantom{\textbf{aa}'}=\begin{bmatrix}
9& 18 & 9 & 15 & 27 & 6 \\
18& 36 & -18 & 30 & 54 & 12 \\
-9& -18 & 9 & -15 & 27 & -6 \\
15& 30 & 15 & 10 & 45 & 10 \\
27& 54 & 27 & 45 & 81 & 18 \\
6& 12 & 6 & 10 & 18 & 4 \\
\end{bmatrix} $
Let $\textbf{b}' = \begin{bmatrix}
1 & 1 & 1 & 1 & 1 & 1 \\
\end{bmatrix}\,\,\,\,\,$
and
$\,\,\,\,\,\textbf{c}' = \begin{bmatrix}
1 & -1 & 1 & -1 & 1 & -1 \\
\end{bmatrix}$. Find \textbf{b}$'$\textbf{c} and \textbf{bc}$'$.
\end{enumerate}
\end{document}
答案2
这里有一个解决方案:由于您加载了amsthm
I 定义problem
为example-style
新定理。这满足了问题的自动编号和交叉引用。此外,问题以斜体排版。如果您喜欢罗马字体,请将示例样式更改为其他definition
样式。
此外,由于定理之间的垂直间距似乎太紧,我在软件包的帮助下etoolbox
,更准确地说是它的\AtBeginEnvironment
命令,添加了一些垂直间距。
至于对齐,我使用环境align*
。在我看来,如果某些矩阵的列右对齐,它们看起来会更好(那些具有一些负系数的矩阵)。对于这些,我使用了环境bmatrix*
frommathtools
和选项[r]
。不要加载amsmath
:mathtools
会为您完成。
\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper
\usepackage{mathtools, amsthm, amssymb}
\usepackage{enumitem}
\usepackage{etoolbox}
\theoremstyle{example}
\newtheorem{problem}{Problem}
\AtBeginEnvironment{problem}{\vspace{1ex}}{}{}
\begin{document}
\begin{problem}\label{pb1}% PROBLEM 1
Find $\mathbf{A}+\mathbf{B}$, $\mathbf{AB}$, $\mathbf{BA}$.
\end{problem}
\begin{enumerate}[label = \alph*), wide = 0em]
\item $\mathbf{A} = \begin{bmatrix} 1 & 2 \\ 3 & -1 \end{bmatrix}$\enspace and \enspace$\mathbf{B} = \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}$. $ \mathbf{A} $ is $2\times2$ and $ \mathbf{B} $ is $2\times2$.
\begin{align*}
\mathbf{A}+\mathbf{B} &= \begin{bmatrix*}[r] 1 & 2 \\ 3 & -1\end{bmatrix*} + \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} = \begin{bmatrix*}[r] 1+2 & 2+1 \\ 3+1 & -1+1 \end{bmatrix*}= \begin{bmatrix} 3 & 3 \\ 4 & 0 \end{bmatrix}\\[1ex]
%
\mathbf{AB} &= \begin{bmatrix*}[r] 1 & 2 \\ 3 & -1\end{bmatrix*} \cdot \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}= \begin{bmatrix} 1\cdot2+2\cdot1 & 1\cdot 1+2\cdot1 \\3\cdot2+(-1)\cdot1 & 3\cdot1+(-1)\cdot1 \end{bmatrix} = \begin{bmatrix} 4 & 3 \\ 5 & 2 \end{bmatrix} \\[1ex]
%
\mathbf{BA} &= \begin{bmatrix} 2 & 1 \\1 & 1 \end{bmatrix}\cdot \begin{bmatrix*}[r] 1 & 2 \\ 3 & -1\end{bmatrix*} = \begin{bmatrix} 2\cdot1+1\cdot3 & 2\cdot 2+1\cdot(-1) \\1\cdot1+1\cdot3 & 1\cdot2+1\cdot(-1) \end{bmatrix} = \begin{bmatrix} 5 & 3 \\ 4 & 1 \end{bmatrix} \\
\end{align*}
\item $\mathbf{A} = \begin{bmatrix} 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix}$\enspace and\enspace$ \mathbf{B} = \begin{bmatrix} 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix}$. $ \mathbf{A} $ is $2\times3$ and $ \mathbf{B} $ is $3\times2$.
$\mathbf{A}+\mathbf{B}$ is undefined because the two matrices are incompatible for addition.
\begin{align*}
\mathbf{AB} = \begin{bmatrix*}[r] 2 & 3 & 1 \\ 0 & -1 & 2 \end{bmatrix*} \cdot
\smash{\begin{bmatrix*}[r] 2 & -2 \\ 4 & 3 \\ 1 & 5 \end{bmatrix*}}
& = \begin{bmatrix}
2\cdot 2+3\cdot 4+1\cdot 1 & 2\cdot (-2)+3\cdot 3+1\cdot 5 \\
0\cdot2+(-1)\cdot 4 +2\cdot 1 & 0\cdot (-2)+(-1)\cdot 3 +2\cdot 5
\end{bmatrix}\\
& = \begin{bmatrix*}[r] 17 & 10 \\-2 & 7 \end{bmatrix*}\\[1.5ex]
%
\mathbf{BA} = \begin{bmatrix*}[r] 2 & -2 \\ 4 & 3 \\1 & 5 \end{bmatrix*}\cdot
\begin{bmatrix*}[r] 2 & 3 & 1\\ 0 & -1 & 2 \end{bmatrix*}
& = \begin{bmatrix}
2\cdot 2+(-2)\cdot 0 & 2\cdot 3+(-2)\cdot (-1) & 2\cdot 1+(-2)\cdot 2 \\4\cdot 2+3\cdot 0&4\cdot3 +3\cdot (-1) & 4\cdot1+3\cdot2 \\
1\cdot 2+5\cdot 0& 1\cdot3 + 5\cdot (-1)&1\cdot 1+5\cdot 2
\end{bmatrix}\\
& = \begin{bmatrix*}[r] 4 & 8 & -2 \\
8 & 9 & 10\\ 2 & -2 & 11
\end{bmatrix*}
\end{align*}
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{problem}\label{pb2} %PROBLEM 2
Let $\mathbf{a}' = \begin{bmatrix}3 & 6 &-3 & 5 & 9& 2 \\ \end{bmatrix}$. Find $\mathbf{a}'\mathbf{a}$ and $\mathbf{aa}'$.
\end{problem}
$\mathbf{a}'$ is the transpose of $\mathbf{a} = \begin{bmatrix}3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \end{bmatrix}$.
\begin{align*}
\mathbf{a}' \mathbf{a} & = \begin{bmatrix} 3 & 6 &-3 & 5 & 9& 2 \end{bmatrix} \cdot \begin{bmatrix}
3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \end{bmatrix} = \begin{bmatrix} 3^2 + 6^2 + (-3)^2 + 5^2 + 9^2 + 2^2
\end{bmatrix} = [164] \\
%
\mathbf{aa}' & = \begin{bmatrix} 3 \\ 6 \\-3 \\ 5 \\ 9\\ 2 \end{bmatrix}\cdot \begin{bmatrix} 3 & 6 &-3 & 5 & 9& 2 \end{bmatrix}
= \begin{bmatrix}
3^2& 3\cdot 6 & 3\cdot (-3) & 3\cdot 5 & 3\cdot 9 & 3\cdot 2 \\
6\cdot 3& 6^2 & 6\cdot (-3) & 6\cdot 5 & 6\cdot 9 & 6\cdot 2 \\
(-3)\cdot 3& (-3)\cdot 6 & (-3)^2 & (-3)\cdot 5 &( -3)\cdot 9 & (-3)\cdot 2 \\
5\cdot 3& 5\cdot 6 & 5\cdot (-3) & 5^2 & 5\cdot 9 & 5\cdot 2 \\
9\cdot 3& 9\cdot 6 & 9\cdot (-3) & 9\cdot 5 & 9^2 & 9\cdot 2 \\
2\cdot 3& 2\cdot 6 & 2\cdot (-3) & 2\cdot 5 & 2\cdot 9 & 2^2
\end{bmatrix} \\
& = \begin{bmatrix*}[r]
9& 18 & 9 & 15 & 27 & 6 \\
18& 36 & -18 & 30 & 54 & 12 \\
-9& -18 & 9 & -15 & 27 & -6 \\
15& 30 & 15 & 10 & 45 & 10 \\
27& 54 & 27 & 45 & 81 & 18 \\
6& 12 & 6 & 10 & 18 & 4
\end{bmatrix*}
\end{align*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{problem}\label{pb3}%% PROBLEM 3
Let $\mathbf{b}' = \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 \end{bmatrix}$\enspace and\enspace$ \mathbf{c}' = \begin{bmatrix} 1 & -1 & 1 & -1 & 1 & -1 \end{bmatrix}$. Find $\mathbf{b}'\mathbf{c}$ and $\mathbf{bc}'$.
\end{problem}
\end{document}
生成的 .pdf 的第一页: