
Ich möchte alle Gleichheitszeichen ausrichten. Ich habe also viele der Lösungen in diesem Forum ausprobiert, aber ohne Erfolg. Ich habe es immer noch nicht zum Laufen gebracht. Hier ist mein Code:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.25}
\usepackage{braket}
\usepackage{mathtools}
\everymath{\displaystyle}
\begin{document}
[...]
Where $H\left(\frac{\omega_{0}}{2},\mu\right)$ is the Hamiltonian for isotropic $2-D$ oscillator with frequency $\frac{\omega_{0}}{2}\\
\begin{align}
\left[H\left(\frac{\omega_{0}}{2},\mu\right),L_{z}\right]&=\left[H\left(\frac{\omega_{0}}{2},\mu\right),xp_{y}-yp_{x}\right]\\
\qquad &=\frac{1}{2\mu}\left(\left[p_{x}^2,xp_{y}\right]+\left[p_{y}^2,-yp_{x}\right]\right)+\frac{\mu\omega_{0}^2}{8}\left(\left[x^2,-yp_{x}\right]+\left[y^2,xp_{y}\right]\right)\\
\qquad &=\frac{1}{2\mu}\left[2p_{x}p_{y}(-i\hbar)+2(i\hbar)p_{y}p_{x}\right]+\frac{\mu\omega_{0}^2}{8}\left[2yx(-i\hbar)+2xy(i\hbar)\right]\\
\qquad &=0\textrm{\qquad, }\left([p_{x},p_{y}]=[x,y]=0\right)$\\
\end{align}
[...]
\end{document}
Ich erhalte immer diese Fehlermeldung:
! Package amsmath Error: \begin{align} allowed only in paragraph mode.
See the amsmath package documentation for explanation.
Type H <return> for immediate help.
...
l.65 \begin{align}
Kannst du mir helfen?
Antwort1
Ich gehe davon aus, dass all
damit „alle außer den endgültigen Vektoren“ gemeint ist.
Die Zeilen, in denen der Code geändert wurde, sind hier mit % gekennzeichnet.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.25}
\usepackage{braket}
\usepackage{mathtools}
\everymath{\displaystyle}
\begin{document}
[...]
Where $H\left(\frac{\omega_{0}}{2},\mu\right)$ is the Hamiltonian for isotropic $2-D$ oscillator with frequency $\frac{\omega_{0}}{2}$ %here
\begin{align}
\left[H\left(\frac{\omega_{0}}{2},\mu\right),L_{z}\right]&=\left[H\left(\frac{\omega_{0}}{2},\mu\right),xp_{y}-yp_{x}\right]\\
\qquad &=\frac{1}{2\mu}\left(\left[p_{x}^2,xp_{y}\right]+\left[p_{y}^2,-yp_{x}\right]\right)+\frac{\mu\omega_{0}^2}{8}\left(\left[x^2,-yp_{x}\right]+\left[y^2,xp_{y}\right]\right)\\
\qquad &=\frac{1}{2\mu}\left[2p_{x}p_{y}(-i\hbar)+2(i\hbar)p_{y}p_{x}\right]+\frac{\mu\omega_{0}^2}{8}\left[2yx(-i\hbar)+2xy(i\hbar)\right]\\
\qquad &=0\textrm{\qquad, }\left([p_{x},p_{y}]=[x,y]=0\right) %here
\end{align}
[...]
\end{document}
Beachten Sie außerdem, dass \\
eine gleichungsähnliche Umgebung völlig unnötig ist.
Antwort2
Przemysław Scherwentke hatantworteteIhre Frage, aber am Code müssen einige Verbesserungen vorgenommen werden:
\documentclass{article}
\usepackage{amsmath}
\everymath{\displaystyle}
\setlength\parindent{4em}
\begin{document}
[\dots]
where $H{\mkern -5mu}\left(\frac{\omega_{0}}{2}, \mu\right){\mkern -5mu}$ is the Hamiltonian for isotropic $\mathrm{2D}$ oscillator with frequency $\frac{\omega_{0}}{2}$;
\begin{align}
\left[H{\mkern -5mu}\left(\frac{\omega_{0}}{2}, \mu\right){\mkern -5mu}, L_{z}\right]
&= \left[H{\mkern -5mu}\left(\frac{\omega_{0}}{2}, \mu\right){\mkern -5mu}, xp_{y} - yp_{x}\right]\\
&= \frac{1}{2\mu}{\mkern -3mu}\left(\left[p_{x}^{2}, xp_{y}\right] + \left[p_{y}^{2}, -yp_{x}\right]\right){\mkern -3mu} + \frac{\mu\omega_{0}^{2}}{8}{\mkern -3mu}\left(\left[x^{2}, -yp_{x}\right] + \left[y^{2}, xp_{y}\right]\right){\mkern -3mu}\\
&= \frac{1}{2\mu}[2p_{x}p_{y}(-i\hbar) + 2(i\hbar)p_{y}p_{x}] + \frac{\mu\omega_{0}^{2}}{8}[2yx(-i\hbar) + 2xy(i\hbar)]\\
&= 0,\qquad ([p_{x}, p_{y}] = [x, y] = 0)
\end{align}
[\dots]
\end{document}
Aktualisieren
Die Einbeziehung von Micos Vorschlag führt zu folgendem Ergebnis:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mleftright}
\everymath{\displaystyle}
\setlength\parindent{4em}
\begin{document}
[\dots]
where $H\mleft(\frac{\omega_{0}}{2}, \mu\mright)$ is the Hamiltonian for isotropic $\mathrm{2D}$ oscillator with frequency $\frac{\omega_{0}}{2}$;
\begin{align}
\left[H\mleft(\frac{\omega_{0}}{2}, \mu\mright), L_{z}\right]
&= \mleft[H\mleft(\frac{\omega_{0}}{2}, \mu\mright), xp_{y} - yp_{x}\mright]\\
&= \frac{1}{2\mu}\mleft(\mleft[p_{x}^{2}, xp_{y}\mright] + \mleft[p_{y}^{2}, -yp_{x}\mright]\right) + \frac{\mu\omega_{0}^{2}}{8}\left(\mleft[x^{2}, -yp_{x}\mright] + \mleft[y^{2}, xp_{y}\mright]\mright)\\
&= \frac{1}{2\mu}[2p_{x}p_{y}(-i\hbar) + 2(i\hbar)p_{y}p_{x}] + \frac{\mu\omega_{0}^2}{8}[2yx(-i\hbar) + 2xy(i\hbar)]\\
&= 0,\qquad ([p_{x}, p_{y}] = [x, y] = 0)
\end{align}
[\dots]
\end{document}
Hier dasmleftright
{\mkern -<x>mu}
Um die Konstruktionen zu entfernen, wird ein Paket hinzugefügt .