Math & ScienceMultiline Equation with Alignment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
mbaqar
Posts: 4
Joined: Sat Apr 13, 2024 3:19 pm

Multiline Equation with Alignment

Post by mbaqar »

Hi
I have to compose a very long equation keeping the alignment intact. I have tried a number of options but in vain. Please examine the following code:

Code: Select all

\begin{equation}
\begin{split}
x &= a + b + c + d &\\
   &= e + f + g + h + i +j + k + l + m + n + o &\\ p + q + r + s  + t \\
   &= u 
\end{split}
\end{equation}
I want to set this equation in a manner that "p" appears below "e". I have been using different hacks but nothing doing.

Please help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10311
Joined: Mon Mar 10, 2008 9:44 pm

Re: Multiline Equation with Alignment

Post by Stefan Kottwitz »

You can nest split or aligned environments, or use an alignat environment for aligning at several places, but a quick easy way is to have an invisible equal sign:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
x &= a + b + c + d \\
  &= e + f + g + h + i +j + k + l + m + n + o + {}\\
  &\mathrel{\hphantom{=}} p + q + r + s  + t \\
  &= u
\end{split}
\end{equation}
\end{document}
Stefan
LaTeX.org admin
mbaqar
Posts: 4
Joined: Sat Apr 13, 2024 3:19 pm

Re: Multiline Equation with Alignment

Post by mbaqar »

Thanks a lot Stefan. I am grateful.
Post Reply