對齊時出現未知錯誤

對齊時出現未知錯誤

這個對齊有什麼問題嗎?當我編譯它時,我收到錯誤訊息。下面是程式碼:

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

相關內容