# Having multiple alignment points in a alignat

Ahoy,

so basically, I have a three-line set of equations. I want the first two lines to be aligned at the first = sign, and the last line's right end to be at the second-to last line's right end.

I tried to make sense of the alignat environment for this purpose, but I found it very difficult to actually understand what the commands do. My minimum (not-)working example is as follows:

\documentclass[10pt]{article}
\usepackage{amsmath}

\begin{document}
\begin{alignat}{2}
a &= b + c &\\
G (y_k^n) &= G((y_k^n)_0 + \delta y_k^n) = (G)_0 + \delta G = 0, & \\
& k=0,\ldots 3; n=0,\ldots, N-1 & \nonumber
\end{alignat}
\end{document}


which currently produces:

How do I persuade it to put the last line at the right edge of the second line?

• Welcome to TeX.SE.
– Mico
Jul 15 at 15:55

Here's a solution that doesn't use an alignat environment. It works by nesting an aligned environment inside an align environment.

Observe that there are no & alignment markers inside the two-line aligned environment; this forces both lines to be aligned flush-right (aka ragged-left).

\documentclass{article}
\usepackage{amsmath} % for 'align' and 'aligned' environments
\begin{document}
\begin{align}
a &= b + c \\
G (y_k^n) &=
\begin{aligned}[t]
G((y_k^n)_0 + \delta y_k^n) = (G)_0 + \delta G = 0 , \\
k=0,\dots 3;\ n=0,\dots, N-1 .
\end{aligned}
\end{align}
\end{document}

• Thank you very much, this looks exactly like what I need. Jul 17 at 9:17
• @DonLouigi - You're most welcome!
– Mico
Jul 17 at 9:34