I am absolutely blown away. I have spent a month on and off looking for a solution to this extremely obvious issue and it has not be addressed anywhere that I can see.

When using align for equations, unless I spam & before every single line I write, the default equation alignment is to the last character of each line, which results in the equations being in a way nobody would ever want to read.

How do I permanently set align to align to the first character of each line without having to & every line?


enter image description here What I want:


enter image description here

  • 2
    align is used to align = character, most of the time, so a reasonnable solution would be to write & = instead of just =. From what I can see, you can do that with just one find / replace in your editor, and that's the way this environment is supposed to be used.
    – Clément
    Nov 16 '15 at 19:53
  • align is for aligned equations where you want to align on a specific operator, usually =. If you don't want to align on the = you should not be using align here. Nov 17 '15 at 0:04
  • unrelated but don't use math italic for multi-letter identifiers (the font is designed to make it not look like a word) use _{\mathrm{spring}} Nov 17 '15 at 0:06

You should do two things: use \documentclass[fleqn]{article} (or whichever document class you're using), but also use gather instead of align. align and its cousins are for vertically aligning text around some specified character, usually =, but gather is for a general list of equations. (You can also use gather* to get an un-numbered version.)


\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\dfr}[2]{\frac{d #1}{d #2}}

Here is some text.
T = \frac{1}{2}m\dot{x}_1^2 + \frac{1}{2}\dot{x}_2^2\\
U_{\text{spring}} = \frac{1}{2}kx^2\\
U = \frac{1}{2}kx_1^2 + \frac{1}{2}kx_2^2 + \frac{1}{2}k_{12}(x_2 - x_1)^2\\
\mathcal L = T-U\\
\pd{\mathcal L}{x_1} = \dfr{}{t}\pd{\mathcal L}{\dot{x}}_1\Rightarrow -
    \frac{1}{2}k2x_1 - \frac{1}{2}k_{12}2(x_2 - x_1)(-) = m\ddot{x}_1\\
m\ddot{x}_1 = -kx_1 + k_{12}x_2 - k_{12}x_1 = -(k+k_{12})x_1 + kx_2\\
=-(k + k_{12})x_1 + k_{12}x_2\\
m\ddot{x}_2 = k_{12}x_1 - (k + k_{12})x_2

enter image description here

If you really want to redefine align in particular, you could call


in your preamble and just use align where I used gather, but that makes your code less clear.

  • Thank you for the suggestion. I am aware of gather, but I like having the option to align some parts by the equals and other parts just default left. I realize that align is set up so that if you want align left, you put an & at the front, but it seems like in general it should be the opposite. It should align left or center by default and if you want align right (I don't know why anyone would ever want that) you could put an & at the end of the line. So, do you know how I can change the default alignment of align?
    – Job Guidos
    Nov 16 '15 at 20:46
  • 1
    I'm not sure how to do exactly what you're looking for, partly because align is supposed to be used to align everything inside it. If you want to align some equations but not others, use an outer gather environment, and then use an aligned environment inside that, containing the equations you want to align around &=. If you want to align some equations, switch to unaligned equations, and then switch back to aligning with the first equations, maybe look into the \intertext command. Nov 16 '15 at 20:58
  • I concur with @ArunDebray : if it looks awfully complicated to do what you want with align, then either align is not the right environment to do that, either what you are trying to do is not really elegant from a typesetting point of view.
    – Clément
    Nov 16 '15 at 22:17
  • @JobGuidos align is not designed to use & at the front. It is designed to put & immediately before the relation on which you want to align. Nov 17 '15 at 0:08

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.