
すべての等号を揃えたいです。そこでこのフォーラムの多くの解決策を試しましたが、効果はありませんでした。それでもうまくいきませんでした。これが私のコードです:
\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}
常に次のエラーメッセージが表示されます:
! 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}
私たちを手伝ってくれますか?
答え1
all
これは「最終ベクトルを除くすべてのベクトル」を意味するものと想定しています。
コードが変更された行は %here でマークされています。
\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}
さらに、\\
方程式のような環境が完全に不要になることに注意してください。
答え2
プシェミスワフ・シェルヴェンケは答えたあなたの質問ですが、コードにはいくつか改善すべき点があります:
\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}
アップデート
Mico の提案を取り入れると、次のようになります。
\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}
ここでは、mleftright
構造を削除するパッケージが追加されます{\mkern -<x>mu}
。