# pdflatex tex issue with section which contains underscore

I have a tex file which is like this :

  \cleardoublepage
\phantomsection
1,subsection,1,Section A - Project Identification, p2,
1,subsection,1,Section C - Basic or Applied Research,p3,
3,subsection,1,Section D - Additional project information,p4
}]{fixed_2010_2.pdf}


pdflatex fails to compile wherever there is undercore in section title

e.g  200_project_title:


It would be great if someone help me fine out a better way to pass section title without escaping those underscore and possibility handling other special characters which might mess up with compilation

thanks

EDIT: using \begingroup \catcode'\_=12 \tableofcontents \endgroup

EDIT: using in preamble : \usepackage[T1]{fontenc} and for table of contents \begingroup \catcode'\_=12 \tableofcontents \endgroup

Working one after you kind suggestions and answers: This working now for me (do not know any hazards yet) thank you for all your suggestions:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage[
pdfpagelabels=true,
pdftitle={Report Title},
pdfauthor={sakhunzai},
]{hyperref}
\usepackage[T1]{fontenc}

\hypersetup{
}

\begin{document}
\catcode\_=12

\cleardoublepage
\pdfbookmark{\contentsname}{toc}
\pagenumbering{roman}
\tableofcontents

\cleardoublepage
\phantomsection
1,subsection,1,Section A - Project Identification, p2,
1,subsection,1,Section C - Basic or Applied Research,p3,
3,subsection,1,Section D - Additional project information,p4
}]{fixed_2010_2.pdf}
\end{document}

-
Without a MWE this is untested but if you don't have any underscores in math in section titles you can probably go \begingroup \catcode'\_=12 \tableofcontents \endgroup so _ is a normal character while the toc file is being processed. (with a backtick not ' but I can't remember how to get that in this chat) –  David Carlisle Nov 15 '12 at 11:30
@DavidCarlisle , thanks for your comments ,it fixed the issue partially e.g now I see a dot in place of underscore –  sakhunzai Nov 15 '12 at 11:47
@DavidCarlisle Use two backquotes to delimit a code that contains backquotes: \begingroup\catcode\_=12 \tableofcontents\endgroup. Another way would be to write 200\_project\_title: (which would work also with OT1 encoded fonts). –  egreg Nov 15 '12 at 11:50
I just added \begin{document}\catcode_=12 and rest of script , its working bookmarks look great but the Content area showing a dot , please check the attachedscreen shot , thanks for your direction –  sakhunzai Nov 15 '12 at 11:58
@sakhunzai you probably need to use a font encoding that has underscores in the underscpre position use \usepackage[T1]{fontenc} –  David Carlisle Nov 15 '12 at 11:58

If you want to avoid using \_ for underscore you need to make it an ordinary character and use a font encoding that supports it so add

 \usepackage[T1]{fontenc}


\begingroup \catcode'\_=12 \tableofcontents \endgroup

If for some reason you are committed to OT1 fonts and still want to avoid quoting _ then you could instead use
\begingroup \catcode'\_=13 \def_{\_} \tableofcontents \endgroup

looks OK except that you globally redefined _ to be an ordinary character (as opposed to just locally while the toc is read) which is OK so long as you don't need it for a math subscript anywhere (you can still get math subscripts using \sb`) –  David Carlisle Nov 15 '12 at 12:51