# I don't understand where this error is coming from

the code and relevant preamble that's giving me a hard time is:

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{amsfonts}

\begin{document}

\begin{aligned} & [e^{\frac{ipL}{\hbar}},e^{\frac{2\pi ix}{L'}}]f(x)=e^{\frac{ipL} {\hbar}}e^{\frac{2\pi ix}{L'}}f(x)-e^{\frac{2\pi ix}{L'}}e^{\frac{ipL} {\hbar}}f(x) \\ &=e^{\frac{ipL}{\hbar}}e^{\frac{2\pi ix}{L'}}f(x)+e^{i\pi}e^{\frac{2\pi ix} {L'}}e^{\frac{ipL}{\hbar}}f(x) \\ &=f(x+L)(e^{\frac{2\pi i(x+L)}{L'}}+e^{\frac{i\pi(2(x+L)+L')}{L'}}) \\ &=e^{\frac{ipL}{\hbar}}e^{2\pi ix}{L'}f(x)(e^{2\pi i\frac{L}{L'}}+e^{\pi i(2\frac{L}{L'}+1)}) \\ &=e^{\frac{ipL}{\hbar}}e^{2\pi ix}{L'}f(x)(Cos(2\pi\frac{L}{L'}) + iSin(2\pi\frac{L}{L'}) + Cos(2\pi\frac{L}{L'}+\pi) + iSin(2\pi\frac{L}{L'} + \pi)) \\ &\Longrightarrow [e^{\frac{ipL}{\hbar}},e^{\frac{2\pi ix}{L'}}] = 0~\text{for}~\frac{L}{L'} \in \mathbb{Z}\text{\footnote{Cos(2\pi\frac{L}{L'}) + iSin(2\pi\frac{L}{L'}) + Cos(2\pi\frac{L}{L'}+\pi) + iSin(2\pi\frac{L}{L'} + \pi) \longrightarrow \cancelto{1}{Cos(2n\pi)} + \cancelto{0}{iSin(2n\pi)} + \cancelto{-1}{Cos(2n\pi\frac+\pi)} + \cancelto{0}{iSin(2n\pi + \pi)}=1-1=0}} \end{aligned}

\end{document}


my error claims to be a lack of a '$' somewhere, an unclosed math environment? but I've scanned through a few times and no such thing stands out to me • You have a \footnote{$...} directive whose argument is not terminated with a $ symbol. – Mico Nov 26 '17 at 23:29 • please consider writing \cos, \sin etc. – samcarter is at topanswers.xyz Nov 26 '17 at 23:33 ## 1 Answer There were two errors: First, \footnote should not be used in equation in general (the footnote number can easily be confused with an exponent), and when you have to, except for very simple equation, you should use the pair \footnotemark ...\footnotetext. Second, your footnote lacked a final $.

I took the opportunity to improve the general layout of this equation, changing some alignment points, and changing the size of some delimiters.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\begin{aligned} \Bigl [e^{\frac{ipL}{\hbar}},e^{\frac{2\pi ix}{L'}}\Bigr] & f(x) =e^{\frac{ipL} {\hbar}}e^{\frac{2\pi ix}{L'}}f(x)-e^{\frac{2\pi ix}{L'}}e^{\frac{ipL} {\hbar}}f(x) \\ &=e^{\frac{ipL}{\hbar}}e^{\frac{2\pi ix}{L'}}f(x)+e^{i\pi}e^{\frac{2\pi ix} {L'}}e^{\frac{ipL}{\hbar}}f(x) \\ &=f(x+L)\Bigl(e^{\frac{2\pi i(x+L)}{L'}}+e^{\frac{i\pi(2(x+L)+L')}{L'}}\Bigr) \\ &=e^{\frac{ipL}{\hbar}}e^{2\pi ix}{L'}f(x)\Bigl(e^{2\pi i\frac{L}{L'}}+e^{\pi i(2\frac{L}{L'}+1)}\Bigr) \\ &=e^{\frac{ipL}{\hbar}}\cos\Bigl(2\pi\frac{L}{L'}+\pi\Bigr) + i\sin\Bigl(2\pi\frac{L}{L'} + \pi\Bigr) \\[1ex] \Longrightarrow\quad \Bigl[e^{\frac{ipL}{\hbar}},e^{\frac{2\pi ix}{L'}}\Bigr]& = 0\;\text{for}~\frac{L}{L'} \in \mathbb{Z}\,\footnotemark \end{aligned}