Math & Scienceamsmath | Correct Alignment for multi-line Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
marcdein
Posts: 40
Joined: Sat Dec 19, 2009 2:11 pm

amsmath | Correct Alignment for multi-line Equations

Post by marcdein »

I have an equation like the following

Code: Select all

\begin{align}
A &= B + C \\
  & + D
  &= E + F + G
\end{align}
In my text, B, C, D are actually some pretty long expressions, which is why I have to go over to the next line. My question: how can I align the second line so that the "+" in "+ D" is actually aligned with B rather than with the equal sign of the previous line?

Of course, I still want the equal sign in the third line to be aligned with the one in the first line.
Last edited by Stefan Kottwitz on Sun Feb 05, 2012 5:31 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

marcdein
Posts: 40
Joined: Sat Dec 19, 2009 2:11 pm

amsmath | Correct Alignment for multi-line Equations

Post by marcdein »

I figured out how to do it using the {split} environment together with the new command:

Code: Select all

\newcommand{\newln}{\\&\quad{}}
Last edited by Stefan Kottwitz on Sun Feb 05, 2012 5:32 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

amsmath | Correct Alignment for multi-line Equations

Post by Stefan Kottwitz »

Thanks for posting your solution!

It works also with align:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
A &= B + C \\
  &\quad + D \\
  &= E + F + G
\end{align}
\end{document}
Stefan
LaTeX.org admin
Post Reply