To my dismay, I've learned that it is unsafe to use the colon (:) in labels if you are using babel-french together with at least one other package, namely, crossreftool, which operates upon labels.

The reason is that babel-french makes : active (likewise ; and ! and ?).

So I need a different character, instead of the colon, in labels, e.g.,in


where the colon separates the type of object (theorem, definition, equation, etc.) being labeled from the hyphenated phrase identifying the particular object of that type.

(See Another babel-french incompatibility with crossreftools and babel and crossreftools incompatibility?.)


Aside hyphen (-) and alphanumerics, which of these characters are safe to use in labels?

  • period (.)
  • bar character (|)
  • at symbol (@)

That is, are there other packages that make either of these active and hence will cause trouble?

(For author's convenience both in typing source and in reading it, I really did like :, which visually separates just enough but is not as obtrusive as |. A single period is, of course, easy to type, but perhaps does not give sufficient visual separation.)

  • 1
    It is somewhat frequent that | gets set active for a short verb command, but that is usually done by the user or in some of the classes intended for documentation. So I'd say it is as safe as using :. The user should know if one can use it or not. But to my knowledge . should be pretty safe, I've yet to learn about a package which sets . active. – Skillmon Oct 5 at 17:16
  • Assuming that . is safe, it might be safer to use .. in case it turns not that . is not safe. That will make it significantly easier then to replace all instances of .. by another character (e.g., by -, which I want to avoid since I use in the "descriptive" part of the label. – murray Oct 5 at 18:58
  • Or you could use @, that one should be of category other in almost every LaTeX document (except someone forgot to put a \makeatother after a \makeatletter, but that would be definitely a user's fault). – Skillmon Oct 5 at 21:03
  • And what about a simple space? e.g.; \label{fig foo} I can't imagine to someone thinking of using the space to do anything other than left a space. Moreover, as separator is unrivaled. – Fran Oct 6 at 6:56
  • Note also the number of spaces is also irrelevant here, so you use different number of spaces in the labels and references without causing an error. – Fran Oct 6 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.