What are the valid characters to use in labels? I thought that only alphabetic characters were valid, but I tested
! and they work. What are the restrictions to these names?
ASCII characters in the 32-127 range that are not special for TeX are acceptable, including punctuation characters; don't use accented characters when the package
inputenc is loaded. Sticking to letters, numbers, hyphen, colon, and perhaps
& seems the best. Spaces are also allowed, but not recommended, mostly because editors might break lines at them.
Some of the special characters can be employed:
^, but not
} 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.