# Equations in captions causing compile error while converting LaTeX to HTML [closed]

I can manage to convert LaTeX files into HTML with Tex4ht while keeping equations as they are with the config file provided by @michal.h21 on https://tex.stackexchange.com/a/185802/52068

But it fails when there is an equation with single dollar sign ($equation$) in caption of the images.

With Error:

TeX capacity exceeded, sorry [input stack size=30000]

MWE:

\begin{figure}[h]
\begin{center}
\includegraphics[width=0.9\textwidth]{F39_B.png}
\caption{Teleportation: the system consists initially of two entangled electrons (2 and 3) with Alice and Bob, respectively, in the state $\ket{\Upsilon}$ (see text). Alice measures one of the Bell states, shown here as $\ket{\Phi^+}$, for example. She sends this outcome classically to Bob, who then corrects the entangled state, here using the identity operator, to put his electron into the state $\ket{\nearrow}$. }
\label{fig:teleport1}
\end{center}
\end{figure}

Not sure if I need to add some other parameters to the config file in order to cover equations in captions or there is something wrong with my LaTeX file.