# missing \endgroup inserted in \lstlistings

I am getting the following error

missing \endgroup inserted

\begin{lstlisting}[mathescape]
K$_{i}$ = $\displaystyle \frac{$\delta$}{max$\delta$}$
\end{lstlisting}


I just use the package listings

• Why do you do a $ within the arguments of \frac? Those are already in math mode. – TeXnician Jun 2 '17 at 15:02 • why are you using listings here? your $ are clearly in the wrong place the second math escape is $\displaystyle \frac{$ with just the start of the fraction. – David Carlisle Jun 2 '17 at 15:02
• @user3319015 What is the intended output? – user36296 Jun 2 '17 at 15:10
• I am new to using \listings. After removing the \$ near \delta, I get the desired result. @David Carlisle,@samcarter: I am using \listing to avoid equation numbers, and I am using it to show a snippet of pseudocode used in a different research paper. Thank You very much for your help – user3319015 Jun 3 '17 at 8:58
• "using listings to avoid equation numbers"????????????????????? that is so weird. Every latex environment that adds an equation number has a version that does not add a number. here don't you just want $K_{i}= \frac{\delta}{\max \delta}$ ??? – David Carlisle Jun 3 '17 at 9:14

listings is for syntax highlighting computer program code, using it for mathematics is painful to enter and will produce weirdly typeset output.
$K_{i}= \frac{\delta}{\max \delta}$