Underscores in words (text)

You may prefer the character from the tt font:

\documentclass{article}

\begin{document}

\texttt{Samp\_Dist\_Corr}

\verb|Samp_Dist_Corr|

\texttt{Samp\char`_Dist\char`_Corr}

\end{document}

enter image description here

Or probably better add \usepackage[T1]{fontenc} then all the above forms will use the character from the font.


You can use \textunderscore also.

\documentclass{article}
%
\begin{document}
Samp\textunderscore Distt\textunderscore Corr

\texttt{Samp\textunderscore Distt\textunderscore Corr}
\end{document}

enter image description here

Underscore is not merging at the bottom of D actually. It is very close to it.


A fairly elementary way of stripping special meaning from things is to \detokenize them:

enter image description here

\documentclass{article}
\begin{document}
\texttt{\detokenize{Samp_Dist_Corr}}

\texttt{\detokenize{a@b\c_d&e~f g}}
\end{document}

Note how a space is inserted after a "control sequence". See What are the exact semantics of \detokenize?