Fix Latex Align Problem: Left Margin

  • Context: LaTeX 
  • Thread starter Thread starter aaaa202
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
SUMMARY

The discussion focuses on resolving alignment issues in LaTeX when using the align environment. Users reported that equations were not starting at the left margin and were extending beyond the page width. The solution involves correctly placing the alignment character '&' before the equal sign '=' in the align environment to ensure proper alignment. This adjustment allows the equations to align neatly and start from the left margin as intended.

PREREQUISITES
  • Familiarity with LaTeX typesetting
  • Understanding of the align environment in LaTeX
  • Knowledge of mathematical notation in LaTeX
  • Basic experience with LaTeX document structure
NEXT STEPS
  • Research the use of the align* environment in LaTeX for unnumbered equations
  • Learn about the ampersand '&' character for alignment in LaTeX
  • Explore LaTeX packages that enhance equation formatting, such as amsmath
  • Study best practices for managing long equations in LaTeX to prevent overflow
USEFUL FOR

LaTeX users, mathematicians, and researchers who need to format complex equations and ensure proper alignment in their documents.

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: 523
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:
[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:

Similar threads

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