16

I want to show the derivation of a formula where I encounter long formulae. Unfortunately the derivation is very complex, so I have to show some intermediate steps.

My problem is, that I want to mix the behaviour of multline with align. The first line should be aligned left and the whole rest should be aligned right with respect to the longest line. This block should be aligned at the =.

At the moment, I use the align environment. But in this case, the first line is still aligned left to the $ of the other lines.

Important note: I don't like magic numbers. So I prefer solutions which are completely automatic.


My approach so far:

\documentclass{scrartcl}
% Kodierung
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
% Sprache (neue deutsche Rechtschreibung)
\usepackage[ngerman]{babel}
% Mathematik
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}
    \begin{align}
        (a+b+c+d+e+f) \\ % aligned left
        % the following block should be aligned right
        &= a+b+c+d+e+f+g+h+i+j+k+l+m+n\\
    \begin{split}
        &= a+b+c+d+e+f+g+h+i+j+k+l+m+n \\
        & \quad +o+p+q+r+s+t+u+v+w+x+y+z+1+2+3+4
    \end{split}\\
        &= a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p
    \end{align}
\end{document}
1

2 Answers 2

9

Here is what I would do (require mathtools package)

\begin{align}
   \MoveEqLeft[3]  (a+b+c+d+e+f) \\ 
    ={}& a+b+c+d+e+f+g+h+i+j+k+l+m+n\\
\begin{split}
    ={}& a+b+c+d+e+f+g+h+i+j+k+l+m+n \\
    &  +o+p+q+r+s+t+u+v+w+x+y+z+1+2+3+4
\end{split}\\
    ={}& a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p
\end{align}

I would not want to start using multline effects in it, ends up looking strange. The above sort of follows the guides set out by the AMS.

enter image description here

6

Here is a version without magic numbers. It uses the mathtools to make the first line appear to have zero width.

\begin{align}
    \mathclap{(a+b+c+d+e+f)} & \notag \\
    &= a+b+c+d+e+f+g+h+i+j+k+l+m+n \\
    &= a+b+c+d+e+f+g+h+i+j+k+l+m+n \notag \\
    & \quad +o+p+q+r+s+t+u+v+w+x+y+z+1+2+3+4 \\
    &= a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p
\end{align}

with mathclap

6
  • Which gives you problems, if the lines are long, then the first line goes into the left margin. The magic number is not that magic, it is the number of ems to move the first line backwards. Plus it follows the MAS recommendstion about the indentation from the left
    – daleif
    Feb 15, 2013 at 13:44
  • I have to admit, that your answer is the best according to my question for shorter equations like daleif noted. I meant magic numbers like here where the length of the environment is given by the user.
    – Stefan
    Feb 15, 2013 at 13:49
  • 1
    I would not use that constrction either. The only reason why I use a number here is because I align to the right of the =. The default is 2, as recommended by AMS
    – daleif
    Feb 15, 2013 at 13:51
  • @daleif I removed the 3 and aligned to the left of the = to follow the recommendation.
    – Stefan
    Feb 15, 2013 at 13:58
  • Then you have to add the \quad which is cumbersome (I have macros in my editor to do &= -> = {} & so I save some time). Besides, aligning to the right is not as often as aligning to the left.
    – daleif
    Feb 15, 2013 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .