# Defining cross-reference names for custom theorem environments in cleveref

I am concerned with the difference between this working example

\documentclass{article}
\usepackage{amsthm}
\usepackage[capitalise]{cleveref}

\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}\label{thm1}
My first theorem
\end{thm}

\begin{thm}\label{thm2}
My second theorem
\end{thm}

Using \cref{thm1,thm2} we obtain another theorem.
\end{document}


whose last line is displayed as

Using ?? 1?? 2 we obtain another theorem.

and the code

\documentclass{article}
\usepackage{amsthm}
\usepackage[capitalise]{cleveref}

\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}\label{thm1}
My first theorem
\end{theorem}

\begin{theorem}\label{thm2}
My second theorem
\end{theorem}

Using \cref{thm1,thm2} we obtain another theorem.
\end{document}


whose last displayed line is the intended

Using Theorems 1 and 2 we obtain another theorem.

I found inside cleveref.sty the right (non abbreviated) names of the basic \newtheorem definitions (theorem,lemma, corollary, proposition, definition) which are predefined in cleveref. But what is the full description that one must give to cleveref so that it handles a theorem environment properly (including the capitalise option)?

You can use the \crefname{<type>}{<singular>}{<plural>} syntax to define cross reference names for customized theorem-like environments. (see page 12 of the cleveref manual)

\documentclass{article}
\usepackage{amsthm}
\usepackage[capitalise]{cleveref}

\newtheorem{thm}{Theorem}
\crefname{thm}{Theorem}{Theorems}

\begin{document}

\begin{thm}\label{thm1}
My first theorem
\end{thm}

\begin{thm}\label{thm2}
My second theorem
\end{thm}

Using \cref{thm1,thm2} we obtain another theorem.
\end{document}


• Thanks. However as far as i understand, this is not in the spirit of cleveref. \crefname should be the lowercase version, while \Crefname is the "beginning of a sentence" form. How do I give the full description to cleveref so that i get the same result as in my second example (also with respect to the capitalise option)? – Yann Pequignot Jul 4 '13 at 11:58
• Of course there's no "conflict" between \crefname and the capitalise option. To quote the manual: "if you explicitly define a \cref variant to not be capitalised, cleveref will still honour your definition. In other words, you're responsible for defining the capitalisation correctly in your own format definitions." If you want capitalised names in your own format definitions, define \crefname to be capitalised. – Toby Cubitt Nov 24 '13 at 13:32
• It's a common misconception that \Crefname means the "capitalised variant" of \crefname. It doesn't. \Crefname is the start-of-sentence variant of \crefname. E.g. it doesn't abbreviate names (since you standard style dictates that you shouldn't use abbreviations at the beginning of sentences in English). – Toby Cubitt Nov 24 '13 at 13:34
• @KevinC Your solution is perfectly fine. If you want capitalised cross-reference names, define \crefname to use capitalised words. If you want non-capitalised names, define \crefname to use lower-case words. Yes, this does indeed mean that you'll need to change your \crefname definitions if you change your mind about using the capitalise package option. – Toby Cubitt Nov 24 '13 at 17:35
• You really don't want cleveref to try to (un)capitalise your own \crefname definitions for you automatically. Apart from the risk of this going wrong (your \crefname could involve arbitrarily complex LaTeX code), you might well want lower-case names in some cases. Cleveref is clever, but it's not telepathic! It can't tell when you want the capitalisation to respect the package option, and when you're intentionally overriding it. If you really need your \crefname definitions to respect capitalise, use \if@cref@capitalised in the definition \crefname definition. – Toby Cubitt Nov 24 '13 at 17:39