# Multiple labels in Cref

Following is a simple code to show my problem with the cleveref package. When using multiple labels it breaks on the second label...

\documentclass[11pt]{article}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage{amsthm}

\usepackage{cleveref}

\newtheorem{lemma}{Lemma}

\crefname{lemma}{lemma}{lemmas}

\begin{document}
\begin{lemma} \label{lem:fast}
a
\end{lemma}

\begin{lemma} \label{lem:slow}
b
\end{lemma}

\Cref{lem:fast} \\
\Cref{lem:slow} \\
\Cref{lem:fast, lem:slow} \\

\end{document}


Omit the space after the comma.

\documentclass[11pt]{article}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage{amsthm}

\usepackage{cleveref}

\newtheorem{lemma}{Lemma}

\crefname{lemma}{lemma}{lemmas}

\begin{document}
\begin{lemma} \label{lem:fast}
a
\end{lemma}

\begin{lemma} \label{lem:slow}
b
\end{lemma}

\Cref{lem:fast} \\
\Cref{lem:slow} \\
\Cref{lem:fast,lem:slow} \\% <--- no space after the comma

\end{document}


The solution to this problem is to remove the space after the ,, this has been suggested by lockstep already.

Now, why is the space there important?

When a label is defined, space does matter, since in the very end, \newlabel uses

\@namedef{}{} effectively, where space actually is allowed in the first argument, i.e. in the sense that a command sequence is defined that has space characters in its name.

\cref (or \Cref) try to get the relevant stored label content as being splitted by the comma separated list, where the space character is regarded to belong to the label, so \cref{foo,foobar} and \cref{foo, foobar} give different results.

The same issue would be given with \ref{ foo} when the label is called foo and not _foo, where _ stands for space here, however, without the comma separated list feature then.