6

I currently have these two equations, but they are too long to fit on one line:

\begin{align*}
            [((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)] &= 
            [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)] \\
            &= (a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2) \\ 
\end{align*}

I want to achieve something to this effect: desired look

I have tried using the split environment within the align environment, but that doesn't allow me to align the line breaks, while also keeping the equal signs independently aligned. I am also open to alternative ideas on how to make this look better. (I do not think the second equality looks great in my mockup.)

  • Welcome to TeX SX! Why do you want to break these equations? Each fits on a single line. – Bernard Jan 25 '16 at 1:54
  • 1
    Welcome to TeX.SE. IMO, I think you should just begin the = on a subsequent line. – Peter Grill Jan 25 '16 at 1:54
  • @Bernard The stuff after the equals sign goes into the margin. (I am doing this within an enumerate environment so that might cause it to go into the margin for me.) – user100000000000000 Jan 25 '16 at 1:54
  • 1
    @PeterGrill Like this? i.imgur.com/RBc3Yzf.png – user100000000000000 Jan 25 '16 at 1:57
  • It goes slightly into the margin, that is true, but doesn't if you load geometry, which defines more sensible margins than the default – unless you use marginal notes. If you don't, with the defaults of geometry, it's fits within text width. – Bernard Jan 25 '16 at 2:03
4

Two more alternatives:

\documentclass[border=3mm,preview]{standalone}
\usepackage{mathtools}

    \begin{document}
    The first option:
\begin{align*}
[((a_0, a_1, a_2) + & (b_0, b_1, b_2)) + (c_0, c_1, c_2)]         \\
    & = [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)] \\
    & = (  a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2)  
\end{align*}
The second one:
\begin{align*}
[((a_0, a_1, a_2) + (b_0, b_1, b_2)) + (c_0, c_1, c_2)]     
    & = \begin{multlined}[t]
            [((a_0 + b_0, a_1 + b_1, a_2 + b_2))\\
                 + (c_0, c_1, c_2)] 
        \end{multlined}\\
    & = \begin{multlined}[t]
            (  a_0 + b_0 + c_0, a_1 + b_1 + c_1, \\
                    a_2 + b_2 + c_2)
        \end{multlined}
\end{align*}
    \end{document}

They gives:

enter image description here

2

yet another possibility -- use aligned within multline:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline*}
 [((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)] \\
 \begin{aligned}
   &= [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)] \\
   &= (a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2)
 \end{aligned} \\
\end{multline*}
\end{document}

output of example code

1

Try using eqnarray like this:

\begin{eqnarray}
            [((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)] & = &
            [((a_0 + b_0, a_1 + b_1, a_2 + b_2))  \\
            &   &              + (c_0, c_1, c_2)] \\
            & = & (a_0 + b_0 + c_0, a_1 + b_1 + c_1, \\
            &   & a_2 + b_2 + c_2) \\ 
\end{eqnarray}

you might need \nonumber to suppress equation numbering, since this it still pretty wide.

1

I would suggest putting the = on its own line along with a \quad spacing before the =. To ensure that the first line does not effect the alignment use mathrlap.

Also, if you are using this within an enumerate list, then you can use aligned. This is assuming that there is not additional text before the math environment. Otherwise, use align*.

enter image description here

Notes:

  • There should not be a \\ in the last line of a display math environment.

Code:

\documentclass{article}
\usepackage{mathtools}
\usepackage{enumitem}

\begin{document}
\begin{align*} 
    \mathrlap{[((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)]} \\
        &\quad= [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)] \\
        &\quad= (a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2) %\\  <--- No \\ on last line.
\end{align*}
Within an enumerate
\begin{enumerate}
\item
$\begin{aligned}[t]
    \mathrlap{[((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)]} \\
        &\quad= [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)] \\
        &\quad= (a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2) %\\  <--- No \\ on last line.
\end{aligned}$
\end{enumerate}
\end{document}
1

Here is a simple solution by manually inserting white space:

\begin{align*}
            [((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)] &= 
            [((a_0 + b_0, a_1 + b_1, a_2 + b_2)) \\
            &~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (c_0, c_1, c_2)] \\
            &= (a_0 + b_0 + c_0, a_1 + b_1 + c_1,\\
            &~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a_2 + b_2 + c_2) \\ 
\end{align*}
  • 1
    Welcome to TeX.SX! Wouldn't \hspace{<length>} be more convenient? – Torbjørn T. Jan 25 '16 at 17:18
0

Here's a hack: introduce a new variable, like so:

We now compute the sum $S$ of our three vectors:
\begin{align*}
S&=[((a_0, a_1, a_2)+(b_0, b_1, b_2)) + (c_0, c_1, c_2)]\\
 &=[((a_0 + b_0, a_1 + b_1, a_2 + b_2)) + (c_0, c_1, c_2)]\\
 &=(a_0 + b_0 + c_0, a_1 + b_1 + c_1, a_2 + b_2 + c_2) 
\end{align*}

This costs an extra line, but is well worth it in my opinion.

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.