0

I would like to write

\texttt{set_x}

where "_" is an character and not a "math instruction". But Latex recognise it like a math instruction and ask for the missing $$...How can I do?

3

1 Answer 1

2

Instead of \texttt{set_x}, you could just as easily use verbatim, for example you could do \verb¬set_x¬. The verbatim environment and commands typeset exactly what is typed, and ignores any LaTeX commands.

The issue with using \texttt{set\_x} or \texttt{set\textunderscore x} is that the underscore will be a different font to the rest of the text.

Hope this helps!

1
  • 1
    A better encoding (e.g. T1) helps to get a better underscore. OT1 is lacking the glyph, thus it is replaced by a rule. Apr 14, 2014 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .