Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)?

share|improve this question

1 Answer 1

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}

enter image description here

share|improve this answer
    
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
    
Let me be try to make it clearer. In your example code, if you now get rid of the capitalise option, you get exactly the same result. How do I work around this? –  Yann Pequignot Jul 4 '13 at 12:12
1  
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
1  
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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.