3

I would like to split and align an equation which is really long on both sides.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
    & 2\sin(x - w)\sin(y - z) + 2\sin(y - w)\sin(z - x) + 2\sin(z - w)\sin(x - y)\\
\begin{split}
    ={} & \cos(x + z - y - w) - \cos(x + y - z - w) + \cos (x + y - z - w) - \cos(y + z - x - w)\\
    & + \cos(y + z - x - w) - \cos(x + z - y - w)
\end{split}\\
    ={} & 0 
\end{align*}
\end{document}

When I run the code, I get the following output. enter image description here

The problem is that I want the '2' to align with the rest of the '='s. I also want the '+' in the third line to stay how it is right now (i.e. not aligned with the rest of the '='s.) How can I do this?

3

Welcome to TeX.SE!

With use of instruction \MoveEqLeft and environment \multlined, defined in the mathtools package macro's you can write your equations as follows:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align*}
    \MoveEqLeft
2\sin(x - w)\sin(y - z) + 2\sin(y - w)\sin(z - x) + 2\sin(z - w)\sin(x - y)\\
    & = \begin{multlined}[t]
          \cos(x + z - y - w) - \cos(x + y - z - w) + \cos (x + y - z - w)\\ 
        - \cos(y + z - x - w) + \cos(y + z - x - w) - \cos(x + z - y - w) 
        \end{multlined} \\
    & = 0
\end{align*}
\end{document}

enter image description here

2
  • Thank you so much! I was struggling with this for too long :(
    – radiuszero
    Jul 26 at 8:02
  • @radiuszero, you are welcome! Happy TeX-ing!
    – Zarko
    Jul 26 at 8:37

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.