对齐时出现未知错误

对齐时出现未知错误

这个对齐有什么问题?我在编译时收到错误消息。以下是代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amsthm,amssymb,mathrsfs,latexsym,paralist}
\usepackage[makeroom]{cancel}

\begin{document}

    \begin{align*}
        \phi(f_0) &=
        \frac{\cancel{\phi(f_1)}\phi(g)}{\phi(e)}
        e^{i\pi(\cancel{\theta_{21}}-\cancel{\theta_{11}})}
        = \frac{\phi(f_1)^\cancel{2}}{\phi(f_2)}
        e^{i\pi(\cancel{\theta_{21}}+\theta_{12}-\theta_{22}-\cancel{\theta_{11}})}\\
        & \Rightarrow \frac{\phi(g)}{\phi(e)} = \frac{\phi(f_1)}{\phi(f_2)}e^{i\pi(\theta_{12}-\theta_{22})} . . . (\star)
    \end{align*}

 \end{document}

这是 ShareLatex 中的输出错误:

*缺失{插入。

\mathchoice l.194 \end{align*} 此处左括号是必需的,因此我添加了一个。您可能需要删除和/或插入一些更正,以便我能尽快找到匹配的右括号。*

答案1

您不能\cancel直接将这样的命令放入上标中。您需要在其周围加上花括号。

\documentclass{article}
\usepackage{mathtools,cancel}
\begin{document}
\begin{align*}
  \phi(f_0) &= \frac{\cancel{\phi(f_1)}\phi(g)}{\phi(e)}
  e^{i\pi(\cancel{\theta_{21}}-\cancel{\theta_{11}})}
  = \frac{\phi(f_1)^{\cancel{2}}}{\phi(f_2)}
  e^{i\pi(\cancel{\theta_{21}}+\theta_{12}-\theta_{22}-\cancel{\theta_{11}})}\\
  & \Rightarrow \frac{\phi(g)}{\phi(e)}
  = \frac{\phi(f_1)}{\phi(f_2)}e^{i\pi(\theta_{12}-\theta_{22})} . . . (\star)
\end{align*}
\end{document}

相关内容