我怎样才能使这个等式一致?

我怎样才能使这个等式一致?

我想对齐这个方程。我试过了

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
If $U$, $V$, $W$, $u$, $v$, $v$, $w$ are lengths of edges of the tetrahedron (first three form a triangle; $u$  opposite to $U$ and so on), 
\[\text{volume} = \frac{\sqrt {\,( - a + b + c + d)\,(a - b + c + d)\,(a + b - c + d)\,(a + b + c - d)}}{192\,u\,v\,w}\]
where
\begin{align*}
a  &= \sqrt{xYZ}, & b  = \sqrt{yZX},\\
c  &= \sqrt{zXY}, &d  = \sqrt{xyz},\\
X  &= (w - U + v)\cdot(U + v + w),   &x  = (U - v + w)\cdot(v - w + U),\\
Y &= (u - V + w)\cdot(V + w + u),  &y  = (V - w + u)\cdot(w - u + V),\\
Z  &= (v - W + u)\cdot(W + u + v), &z = (W - u + v)\cdot(u - v + W).
\end{align*}
\end{document}

在此处输入图片描述

我感觉它不太好。我该如何修复它?

答案1

您应该&=在右侧的公式中使用 。如果您觉得两个块之间的间距太大,请使用alignat*,其中间距已明确标记。下面我都尝试过了。

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{amsmath}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}

If $U$, $V$, $W$, $u$, $v$, $v$, $w$ are the edge lengths of the tetrahedron 
(first three form a triangle; $u$ opposite to $U$ and so on),
\[
\text{volume} = 
  \frac{\sqrt {\,(-a+b+c+d)\,(a-b+c+d)\,(a+b-c+d)\,(a+b+c-d)}}
       {192uvw}
\]
where
\begin{align*}
a &= \sqrt{xYZ},                  & b &= \sqrt{yZX},\\
c &= \sqrt{zXY},                  & d &= \sqrt{xyz},\\
X &= (w - U + v)\cdot(U + v + w), & x &= (U - v + w)\cdot(v - w + U),\\
Y &= (u - V + w)\cdot(V + w + u), & y &= (V - w + u)\cdot(w - u + V),\\
Z &= (v - W + u)\cdot(W + u + v), & z &= (W - u + v)\cdot(u - v + W).
\end{align*}
where
\begin{alignat*}{2}
a &= \sqrt{xYZ},                        & b &= \sqrt{yZX},\\
c &= \sqrt{zXY},                        & d &= \sqrt{xyz},\\
X &= (w - U + v)\cdot(U + v + w),\qquad & x &= (U - v + w)\cdot(v - w + U),\\
Y &= (u - V + w)\cdot(V + w + u),\qquad & y &= (V - w + u)\cdot(w - u + V),\\
Z &= (v - W + u)\cdot(W + u + v),\qquad & z &= (W - u + v)\cdot(u - v + W).
\end{alignat*}
\end{document}

请注意,分母中不应添加任何细空格;)(平方根中的对之间可能很好。

还要注意,如果加载,amsfonts和将毫无用处。amssymbfourier

在此处输入图片描述

答案2

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
If $U$, $V$, $W$, $u$, $v$, $v$, $w$ are lengths of edges of the tetrahedron (first three form a triangle; $u$  opposite to $U$ and so on), 
\[\text{volume} = \frac{\sqrt {\,( - a + b + c + d)\,(a - b + c + d)\,(a + b - c + d)\,(a + b + c - d)}}{192\,u\,v\,w}\]
where
\begin{align*}
a  &= \sqrt{xYZ}, & b &= \sqrt{yZX},\\
c  &= \sqrt{zXY}, & d &= \sqrt{xyz},\\
X  &= (w - U + v)\cdot(U + v + w), & x&= (U - v + w)\cdot(v - w + U),\\
Y  &= (u - V + w)\cdot(V + w + u), & y&= (V - w + u)\cdot(w - u + V),\\
Z  &= (v - W + u)\cdot(W + u + v), & z&= (W - u + v)\cdot(u - v + W).
\end{align*}
\end{document}

答案3

如果你不喜欢 a、b、c 和 d 向右偏移,那么这样做可行:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{tabstackengine}
\stackMath
\begin{document}
If $U$, $V$, $W$, $u$, $v$, $v$, $w$ are lengths of edges of the tetrahedron (first three form a triangle; $u$ opposite to $U$ and so on), 
\[\text{volume} = \frac{\sqrt {\,( - a + b + c + d)\,(a - b + c + d)\,(a + b - c + d)\,(a + b + c - d)}}{192\,u\,v\,w}\]
where

{\centering\setstackEOL{\#}\TABbinary%
\tabbedLongstack[l]{
a&=& \sqrt{xYZ},\#
c&=& \sqrt{zXY},\#
X&=& (w - U + v)\cdot(U + v + w),\#
Y&=& (u - V + w)\cdot(V + w + u),\#
Z&=& (v - W + u)\cdot(W + u + v),
}
$\qquad\qquad$\tabbedLongstack[l]{
b&=& \sqrt{yZX},\#
d&=& \sqrt{xyz},\#
x&=& (U - v + w)\cdot(v - w + U),\#
y&=& (V - w + u)\cdot(w - u + V),\#
z&=& (W - u + v)\cdot(u - v + W).
}\par
}
\end{document}

在此处输入图片描述

此外,如果您希望左侧的变量彼此居中,那么\tabularLongstack就足够了,如下所示:

{\centering\setstackEOL{\#}\setstacktabulargap{0pt}\TABbinary%
\tabularLongstack{ccl}{
a&=& \sqrt{xYZ},\#
c&=& \sqrt{zXY},\#
X&=& (w - U + v)\cdot(U + v + w),\#
Y&=& (u - V + w)\cdot(V + w + u),\#
Z&=& (v - W + u)\cdot(W + u + v),
}
$\qquad\qquad$\tabularLongstack{ccl}{
b&=& \sqrt{yZX},\#
d&=& \sqrt{xyz},\#
x&=& (U - v + w)\cdot(v - w + U),\#
y&=& (V - w + u)\cdot(w - u + V),\#
z&=& (W - u + v)\cdot(u - v + W).
}\par
}

在此处输入图片描述

顺便说一句,stackEOL 从 更改为\\因为\#重新\centering定义\\的方式破坏了 TABstacks。

相关内容