# Multiline equation with LHS alone on first line?

I would like my multiline equations to look like this:

Left-hand-side of my equation
= right-hand-side number 1
= right-hand-side number 2
= etc.


I know there is a simple way to do this, because I found it a while ago when I was looking for something else. But now that I actually want it, I can't find it again.

I do not require equation numbers.

EDIT: The "simple way to do this" I had been half-recalling was \lefteqn{}, but as far as I understand that only works (and I use the word "works" loosely) within the evil eqnarray environment.

• \lefteqn probably is the only almost good feature of eqnarray. :) Commented Feb 14, 2012 at 22:44
• I noticed that mathtools has the command \MoveEqLeft which seems to do exactly the same as my answer below. Commented Apr 17, 2012 at 12:00

Ok, converting my comment on @egreg's solution into an answer:

\begin{align*}
\hspace{2em}&\hspace{-2em}Any short or long LHS\\
&= ax^3 + bx^2 + cx + d \\
&= f(x)
\end{align*}


This puts the first LHS on a separate line, and the equation is centered correctly, independent of the size of LHS.

Additional note: I've defined a shorthand command for \hspace{2em}&\hspace{-2em} myself. I wasn't sure that putting the & into a command would work, but it does.

• Yes, a major plus for me about this solution is that I could define such a command as you mention, and then all it would take to modify my existing equations would be to add, say, \lhs in front of them. Commented Feb 15, 2012 at 15:16

this should do it.

\documentclass{article}
\usepackage{amsmath}
\multlinegap=30pt
\begin{document}
\begin{multline*}
\text{Left-hand-side of my equation}\\
\begin{aligned}
&= \text{right-hand-side number 1}\\
&= \text{right-hand-side number 2}\\
&= \text{etc.}
\end{aligned}
\end{multline*}
\end{document}


Edit: \multlinegap specifies the indent from the left and right margins. the default is 10pt, but often a wider gap is desirable.

• This answer positions the start of the first line all the way on the left margin, and the rightmost point of the aligned block all the way on the right margin. That leaves the column of equals signs at an arbitrary indentation. I'd prefer a solution where the equals signs were indented the same amount each time I used it, regardless of the lengths of the particular equations, and then the entire thing were horizontally centered. Commented Feb 14, 2012 at 22:53
• i've added a modification that will indent the display farther from the margins. this can be set globally in the preamble, or individually for a particular display. if reset for just one display, either enclose the entire display in a group (with {...} or \begingroup ... \endgroup) or reset it before the next display. Commented Feb 15, 2012 at 15:01
• +1 I think this should be the default behavior of multiline for equations with more than 2 lines!
– OSE
Commented Nov 19, 2014 at 23:12
• @OSE -- that wouldn't necessarily be appropriate if the lines after the first "aren't on the same level" (i think there's an example illustrating this somewhere in the amsmath documentation), but i'll consider adding a suggestion to the amsmath list. Commented Nov 19, 2014 at 23:19
• @barbarabeeton That's a good point. I think Eq. (2) in Table 3.1 of the amsmath documentation is one such example. In my case, your answer here is exactly what I wanted and it is not too much trouble to add the extra aligned environment.
– OSE
Commented Nov 20, 2014 at 18:18

Simpler than Werner's but using the same idea for centering with respect to the supposed long left hand side:

\begin{align*}
\makebox[2em][l]{\text{Here is your LHS that may be very long}} &
\hspace{-2em}\hphantom{\text{Here is your LHS that may be very long}}\\
&= ax^3 + bx^2 + cx + d \\
&= f(x)
\end{align*}


If instead it's one of the right hand sides to be overlong, one can use

\begin{align*}
\makebox[2em][l]{\text{Not so long LHS}} & \\
&= ax^3 + bx^2 + cx + d + ay^3 + by^2 + cy + d \\
&= f(x,y)
\end{align*}


• What would be the deciding factor for which of your two solutions to use? My guess is that I would use the top solution if my left-hand-side were longer than all of my right-hand-sides, and I would use the bottom solution if at least one of my right-hand-sides were longer than my left-hand-side. Is that correct? If so, my situation happens to be the latter case. Commented Feb 14, 2012 at 22:59
• Yes, that's the idea. If the LHS is the longest line, it should govern the centering (first solution); with the second solution, the centering will be determined by the full display: two ems (or what you choose) plus the longest RHS. Commented Feb 14, 2012 at 23:06
• I'm using the following first line: \hspace{2em}&\hspace{-2em}Any short or long LHS. I think this should handle the centering for both cases. Commented Feb 14, 2012 at 23:15
• @eldering Yes, it does. Would you write that as an answer? Commented Feb 14, 2012 at 23:37
• @eldering I second egreg. Yours is absolutely the best and most elegant solution for my needs; write it as an answer and I will accept it. Commented Feb 15, 2012 at 2:37

You can use a regular align* (from amsmath) and then add some overlapping with box-lengths. Here's a minimal example:

\documentclass{article}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\newsavebox{\LHS}\savebox{\LHS}{\text{Here is your LHS that may be very long}}
\newsavebox{\relation}\savebox{\relation}{$\qquad\;{=}\;$}
\begin{align*}
\rlap{\usebox{\LHS}}
&= ax^3 + bx^2 + cx + d \\
&= f(x)
\end{align*}
\end{document}


The first line (LHS) is set in whichever way you want using \rlap (to obtain a right-overlap). and stored in the box \LHS. The second line contains a blank mockup of \LHS with the appropriate correction of space allocation.

You can change the \qquad to suit your needs, to increase/decrease the horizontal displacement of the start of the =.

In case you want to choose the exact point of alignment, you can use plain align(*):

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
ax &+ by + cx \\
&= 2x + 3y + 4z \\
&= 17.
\end{align*}
\end{document}


• In addition to being a bit of a kludge, this doesn't work in the case that the left-hand-side is a fraction or some other non-&-friendly construct. Commented Feb 14, 2012 at 22:33
• I dispute that this is a kludge. It is precisely what the & is designed for, never mind that you may only have seen it used for equals signs. Fractions, I give you. Commented Feb 15, 2012 at 0:08
• I guess I called it a kludge in that it artificially constrains you to aligning your subsequent lines at discrete locations — namely the boundaries between symbols in your first line. As a further consequence, it means that you can't have reproducible behavior from one instance of doing this to another, since there's no guarantee that next time, there will be a symbol-boundary exactly the same distance into the first line. Commented Feb 15, 2012 at 2:33
• If you need precise measurements, then yes, you should use one of the other methods. However, it is usually much better design to align visual elements of your equations (or at least align relative to them) than to insist on arbitrary absolute positioning. It is, in addition, much easier to do. Commented Feb 15, 2012 at 2:43
• This worked for me. It is much simpler and served my purpose. My problem was lengthy fractional construct in the RHS, leaving room for it by moving LHS this way solved it. Commented Dec 6, 2016 at 14:56

Perhaps you are looking for align* from amsmath?

\begin{align*}
\sum X_i\\
&= \prod Y_i \\
&=\Gamma \text{foo}
\end{align*}

• Possibly \makebox[3em][l]{$\displaystyle Long LHS$}& for the first line, to fix the alignment point. Commented Feb 14, 2012 at 17:26