align* 缺少 $ 错误

align* 缺少 $ 错误
\begin{align*}
P_n(x+1) &=\lim_{\epsilon\to 0} \frac{1}{2^2 n!}~\frac{d^n}{d\epsilon^n}[\epsilon^n(2+\epsilon)^n]\\
&=\lim_{\epsilon \to 0} \frac{1}{2^2 n!}~\frac{d^n}{d\epsilon^n} [ 2^n\epsilon^n +\underbrace{\text{higher order terms in \epsilon}}_{0(\epsilon^{n+1})} ]\\
&=\lim_{\epsilon\to 0} \frac{1}{2^2 n!}~2n~\frac{d^n\epsilon^n}{d\epsilon^n} + \underbrace{\frac{d^n 0}{d\epsilon^n}(\epsilon^{n+1})...}_{\text{vanishes as} \epsilon \to 0}
\end{align*}

我不断得到:

!缺失$插入 $ 。l.166\end{align*}

我不知道该把 放在哪里$。我以为我不需要它,因为align*已经处于数学模式了?我之前在文档中有一个类似的块,我把它放在那里:

\begin{align*}
\frac{d^{2n}}{dx^{2n}} (x^2-1)^n &= \frac{d^{2n}}{dx^{2n}}(x^{2n}+\text{lower order terms which vanish under 2n differentiation})\\
&=(2n)! + 0\\
\therefore\int_{-1}^1 P_n(x)P_n(x)dx &= \frac{(2n)!(-1)^n}{(2^n n!)^2}\int_{-1}^1 (1-x^2)^n dx
\end{align*}

结果很好。

答案1

下支撑中的\epsilon需要处于数学模式:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\differential{\mathop{}\!\mathrm{d}}
\newcommand*\diff[3][]{\frac{\differential^{#1} #2}{\differential #3}}

\begin{document}

\begin{align*}
  P_{n}(x + 1)
  &= \lim_{\epsilon \to 0} \frac{1}{2^{2}n!}\diff[n]{}{\epsilon^{n}}{[\epsilon^{n}(2 + \epsilon)^{n}]}\\
  &= \lim_{\epsilon \to 0} \frac{1}{2^{2}n!}\diff[n]{}{\epsilon^{n}}{[2^{n}\epsilon^{n} + \underbrace{\text{higher order terms in $\epsilon$}}_{o(\epsilon^{n + 1})}]}\\
  &= \lim_{\epsilon \to 0} \frac{1}{2^{2}n!}2n\diff[n]{\epsilon^{n}}{\epsilon^{n}} + \underbrace{\diff[n]{o(\epsilon^{n + 1})}{\epsilon^{n}}}_{\substack{\text{vanishes as}\\ \epsilon \to 0}}
\end{align*}

\end{document}

输出

注意代码的改进。(其中一些改进与下面 Mico 的评论有关。)

相关内容