I am trying to typeset some equations but the indentation somehow gets messed up.

This is the code:

d^{2} = (x_{1}-x_{2})^{2}+(y_{1}-y_{2})^{2}
y'{} & = |BD| = |BF| - |DF| = |BF| - |AE| \\ 
     & = |AB|cos(\alpha) - |OA|sin(\alpha) = -xsin(\alpha) + ycos(\alpha).

and this is what I am getting:

enter image description here

How can I fix the indentation?

  • What exactly do you wish to achieve? Do you want all the = signs to be aligned?
    – Zxcvasdf
    Jun 21 at 6:38
  • equation environments are unrelated to each others, since they're for independent equations, so each one centers its content. If those two equations following each others are related, then equation isn't the right environment for the job. Please clarify what you expected.
    – Miyase
    Jun 21 at 6:53
  • you are using centred, not left aligned/indented equations. but use \sin and \cos never xsin which is typeset as x times s times i times n times s Jun 21 at 7:02

1 Answer 1


If you want your = signs aligned, use a single align* environment. Also,

  1. Use \sin not sin to get the proper spacing and shape. Similarly for \cos, \tan, \log, \ln, etc.
  2. The {} after y' is unnecessary.
  3. For sub- and superscripts that contain only a single character in the braces, the braces are unnecessary (but fine if you prefer to keep them). For example, d^2 and d^{2} produce identical outputs. Same for x_1 and x_{1}. Note that x_11 is not the same as x_{11}.

enter image description here



d^{2} &= (x_{1}-x_{2})^{2}+(y_{1}-y_{2})^{2}\\
y'{} &= |BD| = |BF| - |DF| = |BF| - |AE| \\ 
     &= |AB|\cos(\alpha) - |OA|\sin(\alpha) = -x\sin(\alpha) + y\cos(\alpha).

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.