Align \coloneqq and =
Since align
right-aligns the first field and left aligns the second, one must place the \coloneqq
and subsequent =
in the first align
field so that they get right aligned.
However, align
is set up to provide proper \mathrel
spacing for &=
constructs, but not =&
constructs. Thus, in addition to placing \coloneqq
and subsequent =
at the end of the first align
field of their respective rows, they must be suffixed with an empty {}
placeholder prior to the &
separator, so that the \mathrel
character of these two symbols can be forced to provide the proper spacing following the symbols.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
x \coloneqq{}& a^2 + b^2\\
={}& c^2
\end{align}
\end{document}
Another simple solution with the very small package makebox
, which puts its second argument in a box of the first argument width:
\documentclass{article}
\usepackage{mathtools}
\usepackage{makebox}
\begin{document}
\setlength\fboxsep{0pt}
\begin{align}
x &\coloneqq a^2 + b^2\\
&\mathrel{\makebox*{$\coloneqq$}{\hfill$=$}} c^2
\end{align}
\end{document}
Here is the definition of \coloneqq
:
> \coloneqq=macro:
->\vcentcolon \mathrel {\mkern -1.2mu}=
We can place whatever precedes =
inside \phantom
:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
x &\coloneqq a^2 + b^2\\
&\phantom{\vcentcolon\mathrel{\mkern-1.2mu}}= c^2
\end{align}
\end{document}