LaTeX Fix Latex Align Problem: Left Margin

  • Thread starter Thread starter aaaa202
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
The discussion focuses on issues with LaTeX's align environment causing equations to misalign and extend beyond the left margin. Users are advised to use the ampersand (&) symbol to specify alignment points, particularly before the equal sign. Properly placing the & ensures that equations align correctly at the desired locations. The conversation highlights the importance of understanding the alignment syntax in LaTeX to achieve the intended formatting. Correct usage of the align environment can significantly improve the presentation of mathematical equations.
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

  • latex.png
    latex.png
    7.8 KB · Views: 513
Physics news on Phys.org
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:
<br /> \begin{align*}\langle x^2 \rangle &amp;= \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 /> &amp;= \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 /> &amp;= \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 /> &amp;=\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*}

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:

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
4
Views
1K
Replies
12
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
10
Views
3K