According to Guide to LaTeX, 4th edition, when creating a \label{name},

The keyword name may be any combination of letters, numbers, or symbols.

Is the name of a label case-sensitive? Can the name contain spaces?

I'm asking because when using Vim's snipmate TeX snippet, if I type sec and hit tab, I automatically get:

\section{section name}
\label{sec:section name}

Then when I enter the section name in the \section, Vim automatically puts the same text after the sec: portion of the \label. Since my sections are often multiple, capitalized words, the label name ends up containing spaces and are capitalized. For instance, I might get:

\section{Planned Testing}
\label{sec:Planned Testing}

Prior to allowing Snipmate in Vim automatically enter the label name based on the section name, I would have manually typed:

\section{Planned Testing}

Spaces not allowed

Syntastic in Vim shows an error if a label name contains spaces.


1 Answer 1


Is the name of a label case-sensitive? Can the name contain spaces?

Yes and yes.

References are stored as a macro using \csname r@<name>\endcsname, so anything allowed within \csname...\endcsname is valid (as reference, see Understanding how references and labels work and What exactly do \csname and \endcsname do?). This includes a distinction between case (since, by nature \macro is different from \Macro, \MaCRo, \MACRO, ...).

As a small example consider:

enter image description here

\expandafter\def\csname some bizarre Name 123\endcsname{Stuff}
\csname some bizarre Name 123\endcsname

\section{A section}\label{sec:A section}
See~\ref{sec:A section} and~\ref{sec:a section}.
  • 10
    although spaces are permitted in the name of a label, it's generally recommended that you not use them. they have been known to cause problems in journal production, so if you are submitting an article for publication, it's best to stick to the simplest option that will get the job done reliably. Dec 12, 2013 at 18:57

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.