# Getting incorrect underscores from macro in an lstlisting

I have a macro that I define as

\newcommand{\versionPath}{5\textunderscore0\textunderscore7}

to denote the word *5_0_7*, which I use in lstlisting's like this:

\begin{lstlisting}
(*\versionPath*)
\end{lstlisting}

The configuration of my lstset is:

% Configuration for the listing package.
\lstset{%
language=,
escapeinside={(*}{*)},%
frame=single,
breaklines=true,
basicstyle=\color{blue}\ttfamily\scriptsize,
rulecolor=\color{light-gray},
keywordstyle=\ttfamily\color{red},
upquote=true,
columns=fullflexible,
literate={*}{{\char42}}1
{-}{{\char45}}1
}

The problem is that once compiled, the underscores in the macro look slightly different to those produced otherwise in the lstlisting, and when copied from the PDF they turn up as blank spaces. How do I get the underscores in the macro to format properly?

-
perhaps you might make a minimal (but compilable) example; without an example, those of us who don't regularly use listings are stuck trying to replicate you problem. (fwiw, \_, in the default case, doesn't produce a character, so there's nothing to copy out of the pdf file.) – wasteofspace Nov 16 '12 at 14:14
Does tex.stackexchange.com/q/34129/5763 help? – Martin Schröder Nov 16 '12 at 14:15
If you need that \_ or \textunderscore produces a copyable character, load \usepackage[T1]{fontenc}. – egreg Nov 16 '12 at 16:56
@egreg: You solution works great, so that should be the answer. – Peter Grill Nov 17 '12 at 5:34
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Jan 16 '14 at 13:04