I use LaTeX to take quick notes about my programming work. I have a couple of frustrations:

  • I need to use underscore a lot because of variables named with underscores. However, I have to escape each one of them "\_", thus making my notes less readable on the markup side.
  • I commonly want to use "<" and ">" symbols - why oh why are the default representations of these symbols "¿" and "¡"?

Is there anyway I can alter LaTeX so that "_", "<", and ">" literally typeset as "_", "<", and ">"?


There are canonical ways to fix both of these problems. For the underscore:


For the rendering of < and >:


FWIW, since the last month \nonknuthmode is default in ConTeXt. What this means is _, ^, and & work in text mode. So, the following is a valid input:

under_score car^et & ampersand work in text mode, and have their 
usual meaning in math mode
  x_a^b = \cases{ 0 & a < b \cr 1 & a \ge b }
  • 7
    Interesting - this is more-or-less the long-term LaTEX3 plan too. I'll probably take a look at the appropriate ConTeXt code at some stage. – Joseph Wright Feb 19 '11 at 6:01

An obligatory ConTeXt answer (plus Aditya's :)), using \asciimode will make all special characters "un-special" except \, { and }:

$ % & _ # ^ ~ | < >
\{ \} \backslash

Building on (I do that a lot, lately) Roflcoptr suggestion of using \textgreater and \textless, you can do


I am assuming that you are not using _ in maths as well. Otherwise, try


instead of \catcode... \let_\_. EDIT: note the different placement of \catcode....

  • Using \mathcode"8000 (=‘math active’) is a more robust way to do this sort of thing. (See the internals of underscore.sty.) Although I'm not aware of any specific problems with the approach you've taken (perhaps it's less efficient, is all?). – Will Robertson Feb 8 '11 at 5:51
  • 1
    This will probably have the same problem as underscore, where \includegraphics{filename_with_underscore} won't work. – Evgeni Sergeev Aug 1 '13 at 2:39

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.