[Tex/LaTex] Problem with underscore character

characters

I'm writing my thesis in latex, and I've included some figures and some labels with character _ in the name. Now that i'm adding \listoffigures, i find some errors with missing $ inserted.

How can I solve this problem and add my list of figures, without changing every underscore character?

EDIT

Problem is soved without this figure:

\begin{figure}[t]
    \centering
    \subfigure[$\mathrm{RMSE}$]
   {
   \label{fig:cfrcovar1}
    \includegraphics[width=0.46\textwidth]{Immagini/Confronto_metodi_covar.png}   
   }
    \subfigure[Stime $\hat{\beta}$]
   {
   \label{fig:cfrcovar2}
    \includegraphics[width=0.46\textwidth]{Immagini/Confronto_metodi_beta.png}
   }
    \caption{Confronto tra i metodi, caso con covariate}
    \label{fig:cfrcovar}
\end{figure}

something wrong about it?

Best Answer

The problem is due to the line

\caption{Per alcuni istanti di tempo, funzione test $f(\underline p,t)$ reale, dati 
simulati, stime ottenute rispettivamente con GAMM con soap film smoothing, GAMM con thin 
plate splines e stima con STR-PDE nel caso con covariata.}

First of all, you should write \underline{p} and not \underline p since \underline takes an argument.

Moreover, since you are using it in a \caption it needs to be \protected, otherwise its meaning is expanded in the .lof file.

In other words, you have to write

$f(\protect\underline{p},t)$

instead of

$f(\underline p,t)$
Related Question