我试图显示一个分为 3 列的方程式,如下图所示。
我设法使用不间断空格(〜)创建了上述图像,但由于它们没有正确对齐,因此在编辑器和文档中看起来显然都是垃圾。
\begin{align*}
\mathrm{Area~of~\Delta ABD}~~~~~~~~~~~~ &= ~~~~~~~~~~\mathrm{area~of~\Delta ABC} ~~ &+ ~~~~~~~ \mathrm{area~of~\Delta ACD} \\
\frac{x*z*\sin(\alpha+\beta)}{2}~~~~~~~~~~~~ &= ~~~~~~~~~~~~ \frac{x*y*\sin\alpha}{2} &+ ~~~~~~~~~~~ \frac{z*y*\sin\beta}{2}
\end{align*}
Both sides are multiplied by 2:
\begin{align*}
x*z*\sin(\alpha+\beta)~~~~~~~~~~ &= ~~~~~~~~~~~~~~~ x*y*\sin\alpha &+ ~~~~~~~~~~ z*y*\sin\beta
\end{align*}
Both sides are divided by $x*z$:
\begin{align*}
\sin(\alpha+\beta)~~~~~~~~~~~~~~~~ &= ~~~~~~~~~~~~~~~~~~ \frac{y*\sin\alpha}{z} &+ ~~~~~~~~~~~ \frac{y*\sin\beta}{x}
\end{align*}
As $\frac{y}{z}=\cos(\beta)$ and $\frac{y}{x}=\cos(\alpha)$ we get:
\begin{align*}
\sin(\alpha+\beta) ~~~~~~~~~~~~~~~~~~~ &= ~~~~~~~~~~~~~~~ \cos\beta*\sin\alpha &+ ~~~~~~~ \cos\alpha*\sin(\beta)
\end{align*}
我想知道怎样才能用一种不那么可怕的方式来做这件事?
答案1
如果列内容居中以及符号对齐=
对+
您来说很重要,我建议您采用array
如下四列环境:
\sin
除了删除 和参数周围不需要的(且适得其反的)花括号之外\cos
,我还删除了所有乘法符号,并用内联数学分数等价物*
替换了一些表达式。\frac
\documentclass{article} % or some other suitable document class
\usepackage{array} % for "\newcolumntype" macro
\newcolumntype{L}{>{$}l<{$}} % automatic text mode, left-aligned
\begin{document}
\[
\renewcommand\arraystretch{1.667}
\begin{array}{@{} l @{\qquad\qquad} c @{{}={}} c @{{}+{}} c @{}}
& \textnormal{Area of $\Delta\mathit{ABD}$}
& \textnormal{Area of $\Delta\mathit{ABC}$}
& \textnormal{Area of $\Delta\mathit{ACD}$} \\[0.5ex]
& \frac{1}{2}x z\sin(\alpha+\beta)
& \frac{1}{2}x y\sin\alpha
& \frac{1}{2}z y\sin\beta \\
\multicolumn{4}{@{}L}{Multiply both sides by 2:}\\
& xz\sin(\alpha+\beta)
& xy\sin\alpha
& zy\sin\beta\\
\multicolumn{4}{@{}L}{Divide both sides by $x z$:}\\
& \sin(\alpha+\beta)
& (y/z)\sin\alpha
& (y/x)\sin\beta \\
\multicolumn{4}{@{}L}{As $y/z=\cos\beta$ and $y/x=\cos\alpha$ we get}\\
& \sin(\alpha+\beta)
& \cos\beta\sin\alpha
& \cos\alpha\sin\beta\,.
\end{array}
\]
\end{document}
答案2
您可以像这样对齐,尽管您的第一个“文本”行相当宽,因此对齐的 + 看起来有点间隔。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
\text{Area of $\Delta ABD$} &= \text{area of $\Delta ABC$}&&+ \text{area of $\Delta ACD$} \\
\frac{x*z*\sin(\alpha+\beta)}{2} &= \frac{x*y*\sin\alpha}{2} &&+ \frac{z*y*\sin\beta}{2}\\
\intertext{Both sides are multiplied by $2$:}
x*z*\sin(\alpha+\beta) &= x*y*\sin\alpha &&+ z*y*\sin\beta
\intertext{Both sides are divided by $x*z$:}
\sin(\alpha+\beta) &= \frac{y*\sin\alpha}{z} &&+ \frac{y*\sin\beta}{x}
\intertext{As $\frac{y}{z}=\cos(\beta)$ and $\frac{y}{x}=\cos(\alpha)$ we get:}
\sin(\alpha+\beta) &= \cos\beta*\sin\alpha &&+ \cos\alpha*\sin(\beta)
\end{alignat*}
\end{document}
答案3
我建议用三种方法来解决这个问题。第一种方法与你的方法类似;对于第二种方法,我使用中间列居中,以尽量减少空白。
在第三种情况下,不寻求任何对齐:每个公式都有三个部分,读者将能够在各个步骤中匹配它们。
请避免使用 ∗ 进行乘法。
\documentclass{article} % or some other suitable document class
\usepackage{amsmath,mathtools}
\usepackage{IEEEtrantools}
\newcommand{\IEEEintertext}[1]{\noalign{#1\vspace{1ex}}}
\begin{document}
\section{Your approach}
\begin{alignat*}{2}
\text{Area of $\Delta\mathit{ABD}$} &= \text{Area of $\Delta\mathit{ABC}$}
&&+ \text{Area of $\Delta\mathit{ACD}$} \\
\frac{x z\sin(\alpha+\beta)}{2} &= \frac{x y\sin\alpha}{2} &&+ \frac{z y\sin\beta}{2} \\
\shortintertext{Multiply both sides by 2:}
xz\sin(\alpha+\beta) &= xy\sin\alpha &&+ zy\sin\beta\\
\shortintertext{Divide both sides by $x z$:}
\sin(\alpha+\beta) &= \frac{y\sin\alpha}{z} &&+ \frac{y\sin\beta}{x} \\
\shortintertext{As $y/z=\cos\beta$ and $y/x=\cos\alpha$ we get}
\sin(\alpha+\beta) &= \cos\beta\sin\alpha &&+ \cos\alpha\sin\beta\,.
\end{alignat*}
\section{With slightly different alignment}
\begin{IEEEeqnarray*}{rCcCl}
\text{Area of $\Delta\mathit{ABD}$} &=& \text{Area of $\Delta\mathit{ABC}$}
&+& \text{Area of $\Delta\mathit{ACD}$} \\[1ex]
\frac{x z\sin(\alpha+\beta)}{2} &=& \frac{x y\sin\alpha}{2} &+& \frac{z y\sin\beta}{2} \\[1ex]
\IEEEintertext{Multiply both sides by 2:}
xz\sin(\alpha+\beta) &=& xy\sin\alpha &+& zy\sin\beta\\[1ex]
\IEEEintertext{Divide both sides by $x z$:}
\sin(\alpha+\beta) &=& \frac{y\sin\alpha}{z} &+& \frac{y\sin\beta}{x} \\[1ex]
\IEEEintertext{As $y/z=\cos\beta$ and $y/x=\cos\alpha$ we get}
\sin(\alpha+\beta) &=& \cos\beta\sin\alpha &+& \cos\alpha\sin\beta\,.
\end{IEEEeqnarray*}
\section{An altogether different method}
We start from the fact that
\[
\text{Area of $\Delta\mathit{ABD}$} = \text{Area of $\Delta\mathit{ABC}$}
+ \text{Area of $\Delta\mathit{ACD}$}
\]
Writing down the formulas and removing the common denominator $2$ gives
\[
xz\sin(\alpha+\beta) = xy\sin\alpha + zy\sin\beta
\]
Now we can divide both sides by $xz$ to obtain
\[
\sin(\alpha+\beta)=\frac{y}{z}\sin\alpha+\frac{y}{x}\sin\beta
\]
However, by definition, $y/z=\cos\beta$ and $y/x=\cos\alpha$, so we finally get
\[
\sin(\alpha+\beta)=\cos\beta\sin\alpha+\cos\alpha\sin\beta
\]
\end{document}