4

I have this equation on Overleaf that aligns to the right instead of the left. I have followed instructions on other questions found here but it doesn't work.

{\setlength{\abovedisplayskip}{0pt}%
\begin{flalign}
     -\frac{\tau}{2} \sum (x_n - \mu)^2 -b_0\tau -\frac{\lambda_0\tau}{2} (\mu - \mu_0)^2 \\
     = -\frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau - \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)\\
     = -\frac{\tau}{2}(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n) - b_0\tau - \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)
\end{flalign}%
}%

enter image description here

How can I align to the left?

1
  • 2
    Please make your given code snippet compilable ...
    – Mensch
    Dec 23, 2018 at 17:17

2 Answers 2

5

i guess that you are looking for the following:

enter image description here

\documentclass{article}
    \usepackage{mathtools}

\begin{document}
\begin{equation}
  \begin{split}
    \MoveEqLeft
-\frac{\tau}{2}\sum (x_n-\mu)^2-b_0\tau
    -\frac{\lambda_0\tau}{2}(\mu-\mu_0)^2 \\
    & = - \frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau -
            \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)\\
    & = -\frac{\tau}{2}\Bigl(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n\Bigr) - b_0\tau -
            \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0))
  \end{split}
\end{equation}
\end{document}
5
  • @Mico, thank you very much. i consider your suggestion.
    – Zarko
    Dec 23, 2018 at 17:38
  • Sorry for not being sufficiently clear earlier about where the large parentheses should go. I've taken the liberty of providing an update.
    – Mico
    Dec 23, 2018 at 18:20
  • @Mico, thank you very much. i should see, which parenthesis are in pair.
    – Zarko
    Dec 23, 2018 at 18:47
  • If there are more equalities in the same line and you'd like to them to break, to the next line, when there's no more space, how can you do that? Apr 11, 2021 at 21:31
  • @Verónica, on the same way as are break other lines now. if this make you some problem, please ask new question where provide complete small document (MWE: Minimal Working Example) which demonstrate your problem.
    – Zarko
    Apr 11, 2021 at 22:53
3
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{flalign}
 -& \frac{\tau}{2}\sum (x_n-\mu)^2-b_0\tau -\frac{\lambda_0\tau}{2}(\mu-\mu_0)^2 \notag \\
  &= -\frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau -
      \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)                                   \\
  &= -\frac{\tau}{2}\Bigl(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n\Bigr) - b_0\tau - 
      \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)) \notag
\end{flalign}

\end{document}

enter image description here

0

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.