Fix Latex Align Problem: Left Margin

  • Topic: LaTeX 
  • Thread starter aaaa202
  • Start date
  • Tags Tags
    Latex
1 reply · 2K views · last reply
aaaa202
Messages
1,144
Reaction score
2
Whenever I write equations in an align they end up very messed up. I have attached picture of how they look. How do I get the equations to start at the left and not suddenly to the right?
My align environment says:
\langle x^2 \rangle = \int_{-\infty}^{\infty}e^{-\mid \alpha_{0}\mid^{2}}\sum_{n=0}^{\infty}\frac{(\alpha_{0}e^{i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)\frac{\hbar}{2m\omega}(a_{+}+a_{-})^2\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)dx \\
= \frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}\frac{(\alpha_{0}e^{i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)(a_{+}^2+a_{-}^2+a_{+}a_{-}+a_{-}a_{+})\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)dx\\ = \frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}[a_{+}^2\frac{(\alpha_{0}e^{-i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)]^{*}[(a_{+}^2+n+n+1)\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)]dx\\
=\frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}[\frac{\sqrt{n+1}\sqrt{n+2}(\alpha_{0}e^{-i\omega t})^n}{\sqrt{n!}}\psi_{n+2}(x)]^{*}[\sum_{m=0}^{\infty})(2n+1)\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)+\sum_{m=0}^{\infty}\sqrt{n+1}\sqrt{n+2}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m+2}(x)]dx]\\ =
\end{align*}
Seems messy, but all I want you to is identify what is making the equations start all the way at the left and go out of the margin.
 
Attachments
  • Screenshot of a LaTeX align environment showing a long multi-line quantum mechanics derivation of the expectation value of x squared for a coherent state, with lines shifted to the right and clipped at the edge of the window.
    latex.png
    7.8 KB · Views: 541
aaaa202 said:
Whenever I write equations in an align they end up very messed up. I have attached picture of how they look. How do I get the equations to start at the left and not suddenly to the right?
I'm only moderately knowledgeable about LaTeX, especially the alignment bits. It seems that when you use align or align*, you need to indicate where you want the alignment to occur. To align at the =, use & in front of =.

I have done that below, and it renders more closely like what you want.
aaaa202 said:
[tex] \begin{align*}\langle x^2 \rangle &= \int_{-\infty}^{\infty}e^{-\mid \alpha_{0}\mid^{2}}\sum_{n=0}^{\infty}\frac{(\alpha_0 e^{i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)\frac{\hbar}{2m\omega}(a_{+}+a_{-})^2\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)dx \\<br /> &= \frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}\frac{(\alpha_{0}e^{i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)(a_{+}^2+a_{-}^2+a_{+}a_{-}+a_{-}a_{+})\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)dx\\ <br /> &= \frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}[a_{+}^2\frac{(\alpha_{0}e^{-i\omega t})^n}{\sqrt{n!}}\psi_{n}(x)]^{*}[(a_{+}^2+n+n+1)\sum_{m=0}^{\infty}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)]dx\\ <br /> &=\frac{\hbar}{2m\omega}e^{-\mid \alpha_{0}\mid^{2}}\int_{-\infty}^{\infty}\sum_{n=0}^{\infty}[\frac{\sqrt{n+1}\sqrt{n+2}(\alpha_{0}e^{-i\omega t})^n}{\sqrt{n!}}\psi_{n+2}(x)]^{*}[\sum_{m=0}^{\infty})(2n+1)\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m}(x)+\sum_{m=0}^{\infty} \sqrt{n+1}\sqrt{n+2}\frac{(\alpha_{0}e^{-i\omega t})^m}{\sqrt{m!}}\psi_{m+2}(x)]dx]\\ <br /> \end{align*}[/tex]

Seems messy, but all I want you to is identify what is making the equations start all the way at the left and go out of the margin.
 
Last edited: