TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

What are the valid characters to use in labels? I thought that only alphabetic characters were valid, but I tested ' and ! and they work. What are the restrictions to these names?

share|improve this question
up vote 19 down vote accepted

ASCII character that are not special for TeX are acceptable, including punctuation characters; don't use accented characters when the package inputenc is loaded.

Also some of the special characters can be employed: &, _, ^, but not %, ~, #, and \. Even { and } might be used, as long as they are properly balanced. However this is not recommended practice. The underscore and & may be useful delimiters for giving structure to the labels; often the colon is used for this.

Warning. Some characters might give problems when babel is loaded along with varioref (for example the colon : with French and the double quote " with many languages). Without varioref these should be OK. As Martin points out, some packages might redefine _, making it unusable in labels.

share|improve this answer
I disagree on # and ~. Both generate errors for me. # can't be used in macro definitions done internally by \label and ~ can expand to \nobreakspace {} which will break when written to the .aux file. Also some people like to redefine _ which would also break if it is defined fragile. I would avoid all characters special to TeX and also all non-ASCII characters. – Martin Scharrer May 15 '11 at 22:21
Excelent, that gives a lot of options to my automatic system generator. Thanks. – mjsr May 15 '11 at 22:22
@MartinScharrer do you think that using all the letters and punctuation characters is perfectly safe? – mjsr May 15 '11 at 22:24
The important point here, though, is that spaces are allowed. This can be very helpful in formulating non-cryptic label names. – Ryan Reich May 16 '11 at 3:42
@user14996 Yes, there's no problem in using them; -- is transformed into an en dash at a deeper level, at printing time, not when tokens are formed. – egreg Sep 3 '12 at 9:29

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.