I'm trying to write HMX_Y, and because someone out there (mr. or ms. TeX) thinks this is a math notation, I have to use verbatim function to convince him (or her) otherwise. So far I've been using examplep package and the command \Q{HMX_Y}. However I would like the text to be in the same style and font as the rest of the document (and not in typewriter style). Any tips how to do this?

This is the line where I'm trying to set the fonts to normal (as examplep documentation suggests) but I must be doing something wrong (as it's not working).

\usepackage[Q=yes, url=yes, source-verbatimfont=normalfont]{examplep}

Any help much appreciated.

3 Answers 3


Of course, you can also just type HMX\_Y when you're in text mode to get the underscore (which is even shorter than \Q{HMX_Y}!)

Probably you already knew that, and your question was about how not to type the \ before the underscore, but I still wanted to point out the most simple solution.


See https://texfaq.org/FAQ-underscore

Short summary: in textmode you can use \textunderscore to get the underscore, but you should make sure to set your font encoding to T1 because the default encoding does not have the underscore character.

You can also use the underscore package here to simplify typing.

  • 3
    As mentioned in a few comments on other answers, the even easier way is to just type HMX\\_Y. The slash before the underscore tells TeX not to use it as a command character, but a literal one. Jul 31, 2010 at 17:49
  • 1
    \\_ and \textunderscore do not seem to have the same definition, BTW: \\_ is \x@protect \\_\protect \\_ while \textunderscore is \T1-cmd \textunderscore \T1\textunderscore. I don't know what this difference means. Jul 31, 2010 at 19:06

Reading the documentation of the examplep package it seems that the option you actually need is


however, it doesn't work. The package complains that normalfont is not a valid option. Furthermore, even hacking into \pexa@@verbatimfont and redefining it to \normalfont doesn't work either, because (as Willie Wong pointed out) the default font encoding doesn't have an underscore character there!

Indeed, underscore is the package you're looking for, but you might want to consider submitting a bug report to the author of examplep nevertheless.

  • Since the author of examplep does not seem to be active any more, I'm collecting issues for examplep at github.com/koppor/examplep.
    – koppor
    May 9, 2020 at 11:17

You must log in to answer this question.

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