TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ">"?

share|improve this question
For your second question, see tex.stackexchange.com/questions/10300/include-and-symbol/… – Caramdir Feb 7 '11 at 23:49
up vote 28 down vote accepted

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


For the rendering of < and >:

share|improve this answer
wow - that was simple – John Berryman Feb 8 '11 at 4:02

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 }
share|improve this answer
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
share|improve this answer

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....

share|improve this answer
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
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 posting your answer, you agree to the privacy policy and terms of service.

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