Cómo alinear el signo igual

Cómo alinear el signo igual

ingrese la descripción de la imagen aquí Quiero alinear todos los signos iguales. Así que probé muchas de las soluciones de este foro pero sin resultado. Todavía no pude hacerlo funcionar. Aquí está mi código:

\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}

Siempre recibo este mensaje de error:

    ! 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}

¿Usted me podría ayudar?

Respuesta1

Supongo que eso allsignifica "todos menos los vectores finales".

Las líneas donde se cambió el código están marcadas como %aquí.

\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}

ingrese la descripción de la imagen aquí

Además, tenga en cuenta que \\antes un entorno similar a una ecuación es completamente innecesario.

Respuesta2

Przemysław Scherwentke tienecontestadasu pregunta, pero hay algunas mejoras que hacer en el código:

\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}

salida1

Actualizar

La incorporación de la sugerencia de Mico da lo siguiente:

\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}

salida2

Aquí elmleftrightSe agrega un paquete para eliminar las {\mkern -<x>mu}construcciones.

información relacionada