I would like to simply write a _ in latex. But when I compile it is makes the text afterwards italic and weird, how can I just write an under dash?

For example:

\indent Locate the file in /lbne/app/forest/setup_help.txt

This produces "Locate the file in /lbne/app/forest/setuphelp.txt

And I want it to produce:

"Locate the file in /lbne/app/forest/setup_help.txt

  • 2
    Often asked question: Try: setup\_help. The _ is an active character, reserved for subscripts in math mode, the literal _ is obtained by the control symbol (as D.E. Knuth calls it) \_ – user31729 Sep 8 '15 at 21:05
  • This might help too. – Czechnology Feb 3 '17 at 16:09

The character _ is an active one, reserved for math mode, beginning subscript as in $a_{1}$ etc. The literal underscore character can be obtained without changing the font with the control symbol \_ or using a verbatim display, however, this changes the font to typewriter \texttt.



With \verb!\_!:

Locate the file in /lbne/app/forest/setup\_help.txt

With font change:

Locate the file in \verb!/lbne/app/forest/setup_help.txt!


enter image description here

| improve this answer | |
  • 2
    For this there's also \path from the url package. – egreg Sep 8 '15 at 21:28

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