Centering equations within alignat command
This is similar to a problem I addressed in this answer. You can do this by inserting some "rubber lengths", i.e. stretchable space, if you override the alignment defaults of the alignat
environment. In your case:
\documentclass{article}
\usepackage{amsmath}
\newcommand*\centermathcell[1]{\omit\hfil$\displaystyle#1$\hfil\ignorespaces}
\begin{document}
\begin{alignat*}{2}
v_2(16) &={}& \centermathcell{\frac{2}{5}[v_3(32)+v_3(8)]} &= 0, \\
v_2(4) &={}& \centermathcell{\frac{2}{5}[v_3(8)+v_3(2)]} &= 1.20,\\
v_2(1) &={}& \centermathcell{\frac{2}{5}[v_3(2)+v_3(0.50)]} &= 3.
\end{alignat*}
\end{document}
The macro \centermathcell
(which is descriptively named but which you can of course shorten) uses \omit
to remove the default alignment in the current cell, and replaces it with centering. (The \ignorespaces
is there to prevent whitespace after \centermathcell
from creating spurious gaps in the output.) I've reorganized the columns a bit so that the material which must be centered entirely occupies its own column.
This has the advantage over using the array
environment that the behavior of alignat
is otherwise preserved, and is less verbose than the \fakewidth
idea. It has the disadvantage of going outside the LaTeX typesetting structures and coding paradigm, since \omit
is a TeX primitive and you are "not supposed to know" how alignat
is implemented (in this case, as an \halign
of some sort).
To have each of the three "columns" centered, you could use the array
environment. Note (i) the specification of the =
column dividers in the header of the array environment, to ensure math-appropriate spacing, and (ii) the reset of the \arraystretch
parameter to get a look that's appropriate for a group of displayed equations.
\documentclass{article}
\begin{document}
\renewcommand\arraystretch{1.33} % default value: 1.0
\[
\begin{array}{c @{{}={}} c @{{}={}} c}
v_2(16) & \frac{2}{5}[v_3(32)+v_3(8)] & 0, \\
v_2(4) & \frac{2}{5}[v_3(8) +v_3(2)] & 1.20,\\
v_2(1 ) & \frac{2}{5}[v_3(2) +v_3(0.50)] & 3.
\end{array}
\]
\end{document}
If you want to typeset the left-most column flush-right against the first =
sign and the right-most column flush-left against the second =
sign, you could set {r @{{}={}} c @{{}={}} l}
as the array header specification.
Rather than center-set the middle portions of the equations, I would actually recommend maintaining the alignat*
environment while adding a further alignment point, at the +
sign. I'd also use \tfrac
rather than frac
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{3}
v_2(16)&=\tfrac{2}{5}[v_3(32) &&+v_3(8)] &&= 0, \\
v_2(4) &=\tfrac{2}{5}[v_3(8) &&+v_3(2)] &&= 1.20,\\
v_2(1) &=\tfrac{2}{5}[v_3(2) &&+v_3(0.50)] &&= 3.
\end{alignat*}
\end{document}
If you type
\documentclass{amsart}
\newlength\wantedwidth
\newcommand{\fakewidth}[2]{%
\settowidth{\wantedwidth}{\ensuremath{#2}}%
\makebox[\wantedwidth]{\ensuremath{#1}}%
}
\begin{document}
\begin{alignat*}{2}
v_2(16)&=\fakewidth{\frac{2}{5}[v_3(32)+v_3(8)]}
{\frac{2}{5}[v_3(2)+v_3(0.50)]}
&&= \fakewidth{0,}{1.20} \\
v_2(4)&=\fakewidth{\frac{2}{5}[v_3(8)+v_3(2)]}
{\frac{2}{5}[v_3(2)+v_3(0.50)]}
&&= 1.20,\\
v_2(1)&=\fakewidth{\frac{2}{5}[v_3(2)+v_3(0.50)]}
{\frac{2}{5}[v_3(2)+v_3(0.50)]}
&&= \fakewidth{3.}{1.20}
\end{alignat*}
\end{document}
then you'll get