3

I know this thread which implementation is about verb and \texttt such that you have something inside the phrase. I do not want to change the phrase at all. I want to have this as text in my document

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
hp_feb04_macro.pdf
\end{document}

Unsuccessful attempts for hp_feb04_macro.pdf

\verb|hp_feb04_macro.pdf|

which changes the uncerscore something something else (-, I think). And

\texttt{hp\_feb04\_macro.pdf}

which I do not like since my desktop search is then deteriorated.

How can you have underscore in your text without \verb and \texttt?

1 Answers1

7

If you need to use your hp_feb04_macro.pdf in some macro, enclose the macro inside the \startunderscoreletter and \stopunderscoreletter pair.

\documentclass{article}
\usepackage[T1]{fontenc}
\newcommand{\startunderscoreletter}{\catcode`_ 12\relax}
\newcommand{\stopunderscoreletter}{\catcode`_ 8\relax}
\begin{document}\thispagestyle{empty}
\startunderscoreletter
hp_feb04_macro.pdf
\stopunderscoreletter

test math $a_i$
\end{document}

underscore