2

How can I write _ in LaTeX without it trying to force me to use math mode, which I do not want to use, as it will (after compilation) not display an _.

3

If you're absolutely certain that you'll never need to use _ in math mode -- where it serves to initiate a subscript term -- you could proceed by changing the character's category code to "12" ("other").

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\catcode`\_=12 % change catcode of "_" to "other" (no. 12)

\begin{document}
a_long_string_with_lots_of_underscore_characters
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.