Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to include some source files using \verbatiminput{}. Some of these filenames have underscores in them. This works fine by default. But if I try to include the underscore package so that I can use underscores in text and within \texttt{}, suddenly my verbatim input stops working (it tries to read the file specified by the name before the underscore, and it just prints out the text after the underscore). How can I fix this?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

The documentation of the underscore package states that _ must be avoided in file names. However, if you do need to use an _ in the file name, there is the [strings] package option which along with the \UnderscoreCommands can be used to specify a list of commands where an _ is needed.

Below, I have added the command \verbatiminput to the this list -- the others are directly from the documentation. Note that this list must be defined before the package is loaded.


\do\citeNP \do\citeA \do\citeANP \do\citeN \do\shortcite%
\do\shortciteNP \do\shortciteA \do\shortciteANP \do\shortciteN%
\do\citeyear \do\citeyearNP%

\texttt{Am going to include the file a_b here}% This still produces the correct output
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.