3

What is wrong with this align? I get error message when I compile it. Below is the code:

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

This is the output error in ShareLatex:

*Missing { inserted.

\mathchoice l.194 \end{align*} A left brace was mandatory here, so I've put one in. You might want to delete and/or insert some corrections so that I will find a matching right brace soon.*

1

1 Answer 1

5

You can't put a command like \cancel into a superscript directly. You need to put curly brackets around it.

\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}
4
  • Curly brackets around what?
    – user76825
    Commented Apr 23, 2015 at 4:22
  • 1
    Look at the seventh line in the code above: = \frac{\phi(f_1)^{\cancel ...
    – JRN
    Commented Apr 23, 2015 at 4:37
  • Yes, that fixes it. Awesome, freaking spent like an hour on this. Cool. Thank you!
    – user76825
    Commented Apr 23, 2015 at 5:00
  • 1
    You might want to accept this answer by putting your mouse cursor near the upper left of the answer and clicking on the check mark.
    – JRN
    Commented Apr 23, 2015 at 5:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .