Verbatim text can't be shown correctly in pdf

I try to change the font of verbatim text as below

% Used by @verbatim ... @endverbatim
\newenvironment{DoxyVerb}{%
\verbatim%
\fontencoding{OT1}\fontfamily{ptm}\fontseries{m}\fontshape{n}%
\fontsize{10pt}{10}\selectfont%
}{%
\endverbatim%
\normalsize%
}

But I don't know why some characters cannot be shown in pdf

The example call is the verbatim text in the above figure. The variable name should be parameter_table_build_number, but pdf shows the underscore as an upper dot. I copied that dot and paste into notepad, it shows me the underscore. I searched the underscore in pdf, and it also indicates that dot is the underscore.

However, if I change the font to \footnotesize, it show me the correct character but the verbatim text will exceeds the paper's boundary.

Could anybody tell me how to fix this problem? Thanks a lot.

-
please edit your question and add a working minimal example. –  Marco Daniel Jul 21 '11 at 21:10
See this link first. listings package is very helpful to handle code inclusion. You should use it. –  xport Jul 21 '11 at 21:26
Do not ask the same question time and time again. It is a duplicate of your previous quesion: How to configure the verbatim text? The answers in two questions should be merged. –  Leo Liu Jul 29 '11 at 20:10

You can't use \verbatim ... \endverbatim inside a macro. A detailed explanation you can find here: TeX Frequently Asked Questions - Why doesn’t verbatim work within …?

You can use packages like listings, fancyvrb ...

Here an example with fancyvrb:

\documentclass[]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}

\DefineVerbatimEnvironment{DoxyVerb}{Verbatim}%
{fontfamily=ptm,fontseries=m,fontshape=n}

\begin{document}
\begin{DoxyVerb}
get_asd_asd
\end{DoxyVerb}
\end{document}

EDIT: Using listings:

\documentclass[]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{listings}
\lstnewenvironment{lstDoxyVerb}%
{\lstset{basicstyle=\fontsize{10pt}{10}\usefont{OT1}{ptm}{m}{n}}}%
{}
\begin{document}

\begin{lstDoxyVerb}
get_asd_asd
\end{lstDoxyVerb}
\end{document}
-
Awesome!!! This is what I want. Thanks a lot –  Jason Xu Jul 22 '11 at 13:19