If you refer to item labels that are written in math mode from some other math mode occurrence, then you get errors. I guess it's because it leads to nested math modes. Is there any way to avoid these errors?
Here's an example where referring to the first label in math mode gives one error and referring to the second label gives another:
\documentclass{article}
\usepackage{enumitem}
\usepackage{fixltx2e}% For the label with \( \) to work
\begin{document}
\begin{enumerate}[label=$e'_{\arabic*}$]
\item Bla bla bla\label{e1}
\end{enumerate}
\begin{enumerate}[label=\(e'_{\arabic*}\)]
\item Bla bla bla\label{vare1}
\end{enumerate}
\(h \mid \ref{e1}\)
\(h \mid \ref{vare1}\)
\end{document}
Best Answer
You should be able to use
ensuremath
to help you out here. The following compiles for me. I replaced the dollar signs with theensuremath
environment.Alternatively you can use
mbox