Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to align this equation. I tried

\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}

enter image description here

I feel it is not good. How can I repair it?

share|improve this question
    
You should use &= also in the equations on the right side –  egreg Feb 22 at 16:13

3 Answers 3

up vote 6 down vote accepted

You should use &= also in the equations on the right side. If you feel that the spacing between the two blocks is too wide, use alignat*, where the spacing is explicitly marked. Below I have tried both.

\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}

Note that no thin spaces should be added in the denominator; between the )( pairs in the square root they may be good.

Note also that amsfonts and amssymb are useless if you load fourier.

enter image description here

share|improve this answer
    
Second versione with \qquad is very nice –  marchetto Feb 22 at 16:25
\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}

share|improve this answer

If you don't like the a, b, c, and d being offset to the right, then this would work:

\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}

enter image description here

Furthermore, if you would prefer the variables on the left to be centered wrt each other, then a \tabularLongstack would suffice, as such:

{\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
}

enter image description here

Incidentally, the stackEOL is changed from \\ to \# because \centering redefines \\ in a way that breaks the TABstacks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.