Possible Duplicate:
Escaping from the escaping hell
I did scour the internet for solution but I found no satisfactory answer for this problem.
I have a bash script that searches my folder for .pdf images and creates a latex file with several includegraphics commands with the file names as the figure caption.
However, my file names have underscores and this is unavoidable. When I run pdflatex on the below latex file, I do get a pdf file with all my figures as required but the captions are all italicized or subscripted.
Any ideas on how I might avoid this (how should I allow underscores in figure captions?):
Latex file:
\documentclass[a4paper,10pt]{article}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{eps2pdf}
\usepackage{subfigure}
\usepackage{float}
\usepackage[super,numbers,sort&compress]{natbib}
\usepackage{color}
\usepackage{grrfile}
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}
\renewcommand{\thefootnote}{\alph{footnote}}
% \usepackage[dvips]{hyperref}
\date{07/31/12}
\begin{document}
\clearpage
\begin{figure}[h]
\begin{center}
\centering
\includegraphics[scale=0.75]{/home/dnaneet/Research/Dissertation/APS2012/G=0.0/L_2lambda_max_1wl_zg_2m.pdf}
\caption{L_2lambda_max_1wl_zg_2m.pdf}
\label{fig:fig1}
\end{center}
\end{figure}
\end{document}
Edit:
Using the underscore package helped only partially:
The caption is fine now and the file name is displayed.
Since the file name has underscore, that messed up the path and hence the figures aren't displayed anymore.
underscorepackage only "_ in text mode (i.e., \textunderscore) prints an underscore"... – drN Jul 31 '12 at 18:31underscorepackage. No change in the situaiton. In fact it is worse as the figures are no longer displayed in the eventual pdf file. – drN Jul 31 '12 at 18:33:)however, like you noticed , the path is screwed up now!:P– drN Jul 31 '12 at 18:37