[OS X TeX] Writing an Underscore in LaTeX

Michael Sharpe msharpe at ucsd.edu
Thu Jul 28 19:46:23 CEST 2011


On Jul 28, 2011, at 9:58 AM, William Adams wrote:

> With help from Rich Zaccone on the Texhax mailing list and some Google searching, I can now report that the solution is to:
> 
> add the following to the pre-amble:
> 
> \usepackage{lmodern}
> \usepackage[T1]{fontenc}
> \usepackage{textcomp}
> 
> and then prefix _ with \string:
> 
> \begin{description}
> \item[HKEY\string_USERS] For storing blah blah
> \item[HKEY\string_CLASSES\string_ROOT]
> \item[HKEY\string_CURRENT\string_CONFIG]
> \end{description}

Another solution is

\def\un{\texttt{\char"5F}}

so that \un in text substitutes the underscore glyph from the typewriter font.

Michael


More information about the macostex-archives mailing list