I have been struggling with aligning equations of different length. By using this align code (so only using & before the = sign)

    a &= a + b \\
    c + d &= e + f + g\\
    h + i + j &= k\\

I get this as result: enter image description here

The =signs are aligned, but each equation starts on a different place. If I add a & at the start of each equation, the =signs aren't aligned anymore. Ideally I would like all Equations to start at the same place, then add some white space if needed in order to also align all =signs. So I would like it to look it like this:

enter image description here

How to do this?

Kind regards!

1 Answer 1


You can obtain it with alignat:



  & a & &= a + b \\
   & c + d & &= e + f + g\\
   & h + i + j & &= k


enter image description here

  • 1
    +1: Very nice! What is the {2} for? Oct 17, 2020 at 6:12
  • 1
    With alignat, you have to indicate the number of alignment columns – here, two, hence three &.
    – Bernard
    Oct 17, 2020 at 9:09
  • Thank you! Suchs a clean and easy way
    – Carlijn
    Oct 17, 2020 at 13:13
  • Is there also a way to have the equations alligned like above, but instead of appearing in the center of the page, let them appear on the left?
    – Carlijn
    Oct 17, 2020 at 13:33
  • Yes: either you want it be the same for all displayed equations, and you have to use the fleqn as an option to your document class, or it is only for some specific equations, and you have to nest them in a fleqn environment defined by the nccmath package (to be loaded before mathtools).
    – Bernard
    Oct 17, 2020 at 13:45

You must log in to answer this question.

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