1

I have a lot of equations which are too big to fit in a line, like this:

enter image description here

So basically I have to align '=' for a set of equations and '+' inside the equation when it enters a new line.

I'm trying to align the '=' signs in one column and the '+' signs in another, sort of like this:

enter image description here

I tried using split in align but that just makes it more deranged.

6

In this case, your best bet is to use align* for the outer alignment (the = signs), and aligned for the inner one (the + signs): this is because \begin{aligned}...\end{aligned} is designed to be nested within other kinds of display math. However, you also want to vertically align the inner one (at the pluses) with the outer one, so you'll write it as \begin{aligned}[t]...\end{aligned}.

Here's what it looks like in code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
A_1 &= \begin{aligned}[t]
    a_1 &+ a_2 + a_3 + a_4 + a_5 + a_6 + a_7\\
    &+ a_8 + a_9 + a_{10} + a_{11} + a_{12} + a_{13}\\
    &+ a_{14} + a_{15} + a_{16} + a_{17} + a_{18} + a_{19}
    \end{aligned}\\
A_2 &=
    \begin{aligned}[t]
    a_2 &+ b_2 + b_3 + b_4 + b_5 + b_6 + b_7\\
    &+ b_8 + b_9 + b_{10} + b_{11} + b_{12} + b_{13}\\
    &+ b_{14} + b_{15} + b_{16} + b_{17} + b_{18} + b_{19}
    \end{aligned}
\end{align*}
\end{document}

enter image description here

  • Thanks. This solves the bigger problem. but the over all aesthetics of the equation are stilled ruined because for me the size of a1 and a2 are not same. is there any way to bring all the '+' in a column too ? – Kunal Tiwari Jan 16 '16 at 19:08
  • In that case, try putting the whole thing in an alignat environment, placing & at the = and column of + signs; that might be what you're looking for. – Arun Debray Jan 16 '16 at 19:15
  • 2
    +1 but you should add \! before each aligned – Andrew Swann Jan 16 '16 at 20:34
3

As Arun Debray explained in his comment, use the alignat environment:

\documentclass[varwidth]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
A_1 &=
    a_1 &&+ a_2 + a_3 + a_4 + a_5 + a_6 + a_7\\
    &&&+ a_8 + a_9 + a_{10} + a_{11} + a_{12} + a_{13}\\
    &&&+ a_{14} + a_{15} + a_{16} + a_{17} + a_{18} + a_{19}\\
A_2 &=
    a_{222} &&+ b_2 + b_3 + b_4 + b_5 + b_6 + b_7\\
    &&&+ b_8 + b_9 + b_{10} + b_{11} + b_{12} + b_{13}\\
    &&&+ b_{14} + b_{15} + b_{16} + b_{17} + b_{18} + b_{19}
\end{alignat*}
\end{document}

alignat

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.