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.

It seems that the cleveref package does not capitalize properly when referring to a newtheorem if both \crefname and \Crefname have been defined. Or is it just me? Here is my MWE:

 \documentclass[a4paper,10pt]{article}
 \usepackage{amsthm}
 \newtheorem{theorem}{Theorem}
 \usepackage[capitalise]{cleveref}
 \crefname{theorem}{theoLowercase}{theoLowercaseS}
 \Crefname{theorem}{TheoUpperCase}{TheoUppercasesS}
 \begin{document}
 \begin{theorem}\label{theo:test}
    Test theorem
 \end{theorem}
 This is a reference to \cref{theo:test}.

 \begin{figure} Test Figure
    \caption{Test figure caption}
    \label{fig:test}
 \end{figure}
 This is a reference to \cref{fig:test}.
 \end{document}

On my machine, the refrence to the theorem uses the lowercase version if both \crefname and \Crefname are defined, namely :

This is a reference to theoLowercase 1.

If I comment out the \crefname definition on line 5, I get the expected:

This is a reference to TheoUpperCase 1.

In both cases, the reference to the figure is correctly capitalized though.

Am I crazy?

share|improve this question
    
It is the expected behavior, since you are explicitly defining it with \crefname. –  karlkoeller Jul 30 '13 at 11:27

2 Answers 2

Seems to be "by design". Quoting from section 6.1 of the cleveref manual:

[With the capitalise option,] [a]ll the default cross-reference formats will [...] have the first letter capitalised, as will the automatically generated \cref variants [...] (However, if you explicitly define a \cref variant to not be capitalised, cleveref will still honour your denition. In other words, you're responsible for defining the capitalisation correctly in your own format denitions.)

If you want your custom definitions to be respondend to the capitalise option, use the internal \if@cref@capitalise conditional:

\documentclass[a4paper,10pt]{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\usepackage[capitalise]{cleveref}
\makeatletter
\if@cref@capitalise
\crefname{theorem}{TheoUpperCase}{TheoUppercasesS}
\else
\crefname{theorem}{theoLowercase}{theoLowercaseS}
\fi
\makeatother
\Crefname{theorem}{TheoUpperCase}{TheoUppercasesS}
\begin{document}
\begin{theorem}\label{theo:test}
   Test theorem
\end{theorem}
This is a reference to \cref{theo:test}.

\begin{figure} Test Figure
   \caption{Test figure caption}
   \label{fig:test}
\end{figure}
This is a reference to \cref{fig:test}.
\end{document}
share|improve this answer

You can use the capitalise option if you want \cref references to be capitalised in common cases.

If you define your own command (in your case \crefname{theorem}{theoLowercase}{theoLowercaseS}), when you use \cref referred to a theorem, the package cleveref "respects" your definition (not capitalised).

You can notice that it works if you delete the two definitions of yours:

\documentclass[a4paper,10pt]{article}
 \usepackage{amsthm}
 \newtheorem{theorem}{Theorem}
 \usepackage[capitalise]{cleveref}
 \begin{document}
 \begin{theorem}\label{theo:test}
    Test theorem
 \end{theorem}
 This is a reference to \cref{theo:test} and \Cref{theo:test}.

 \begin{figure} Test Figure
    \caption{Test figure caption}
    \label{fig:test}
 \end{figure}
 This is a reference to \cref{fig:test} and \Cref{fig:test}.
 \end{document} 

enter image description here

share|improve this answer

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.