# Alternatives other than using \ _ in the latex document

Are there other ways to compile a latex document other than the alternative of using \_ and which contains a two words with the " _ " symbol between them? Source: As explained in the Other Symbols section at Wikipedia

My MWE:

Correct shape:

\documentclass{article}
\begin{document}
an\_SYMBOL
\end{document}


Wront shape:

\documentclass{article}
\begin{document}
an_SYMBOL
\end{document}

• It depends what you are doing. If these things are just verbatim code, you can use \verb|an_SYMBOL|. Or if you load the fancyvrb package and use \DefineShortVerb{\|} in the preamble you can simply use |an_SYMBOL| to get the same effect. – Alan Munn Mar 17 at 22:15
• Thank you @AlanMunn. – Diego Bnei Noah Mar 18 at 14:01
• – Paul Gaborit Mar 18 at 14:34
• Or try the underscore package... – Paul Gaborit Mar 18 at 14:36

Since underscores are not used very often in regular text, it's likely that your use of them is for small snippets of code. If this is the case, it's simplest to use a verbatim environment or macro. This will render pretty much anything as it is typed, with no escaping of special characters required. It will also display the text in the current \ttfamily font.

Without any packages you can use \verb|a_SYMBOL|. The | character used to delimit the text can be | or any non-reserved non-alphanumeric character.

\documentclass{article}

\begin{document}
\verb|an_SYMBOL|

\verb!an_SYMBOL!

\verb.an_SYMBOL.

\end{document}


If you have a lot of these, it's useful to make the markup even simpler. You can do this by loading the fancyvrb package (other packages can do the same thing) and define the delimiter explicitly, in which case you don't need the \verb part:

\documentclass{article}
\usepackage{fancyvrb}
\DefineShortVerb{\|}
\begin{document}
|a_SYMBOL|

\end{document}

• Thank you @AlanMunn. Vim editor commands considers this set of words as one at a time that you want to delete or replace using the "d + k" + w "or" c + k + w ", respectively. Where k is the amount of words you want to delete or replace. So by linking words with "_", and since I'm not prioritizing aesthetics but saving commands, and therefore saving time too, I can just type "c + w" to replace a set of words at once , or use "d + w" to delete a set of words at once. Yes, this is a useful subject to use in code. My question arose from the fact that I need to draw mindmaps are filled with texts. – Diego Bnei Noah Mar 19 at 1:38