0

With LaTeX, how do I achieve the following aligned equation?

enter image description here

Dashed lines indicate desired alignments. Solid boxes denote some random expressions.

3
  • 2
    You can use the aligned environment. Do you have a minimal example? – Bernard Dec 27 '15 at 22:22
  • @Bernard, I didn't. Because I had no idea how to do this. But egreg's idea seems promising. – MetroWind Dec 27 '15 at 23:36
  • Egreg used aligned. You should take a look at amsmath documentation. Also mathmode is a comprehensive document about every possible layout problems for maths. – Bernard Dec 27 '15 at 23:52
3

Your mileage may vary, but here's the idea:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
   & x^2y+xy(x+y)^6 \\
={}& \!\begin{aligned}[t]
       xy(   & x+x^6+6x^5y+15x^4y^2+20x^3y^3\\
       {}+{} & 15x^2y^4+6xy^5+y^6)
     \end{aligned}
\end{split}
\end{equation}

\end{document}

enter image description here

2
  • you beat me by 8 seconds ;) – Runar Dec 27 '15 at 22:28
  • @runartrollet Maybe it's not the same idea. – egreg Dec 27 '15 at 22:29
1

Another approach:

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

\begin{document}
\begin{equation}
    \begin{aligned}
    A&=&2+2&=4\\
    B&=&4\cdot2&=8\\
    &+4&&=12\\
\end{aligned}
\end{equation}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.