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’d like to use the cleveref package but I don’t like that it inserts most names as abbreviations; for instance, it will print “… fig. 2.1 …” instead of “… figure 2.1 …”.

Is there a way of changing that without manually changing all the crefnames? There doesn’t seem to be an appropriate option.

Furthermore, when used in conjunction with the hyperref package, only the number is actually linked. The text in front of it (“figure” in my example) isn’t. Can this also be changed (again, without redefining all the commands)?

share|improve this question
1  
Which are those names? Afaik there are just 2 abbreviations for figure and equation. So, 2 \crefname would be sufficient. –  Stefan Kottwitz Dec 2 '10 at 18:45
    
@Stefan: whoops. How weird. I hadn’t actually paid attention to that. Fair enough, that’s a manageable scope. –  Konrad Rudolph Dec 2 '10 at 19:15
2  
You want the noabbrev package option. It's one of the first things in the manual! –  Noldorin Aug 25 '13 at 21:01
add comment

4 Answers 4

up vote 7 down vote accepted

Hm, there indeed seems to be no option for non-abbreviation, which is annoying, because \Cref does it, only along with capitalization. Looking briefly at the source, we at least have a convenient list I ran through "lowercase selection":

 \AtBeginDocument{%
    \crefname{equation}{equation}{equations}%
    \crefname{chapter}{chapter}{chapters}%
    \crefname{section}{section}{sections}%
    \crefname{appendix}{appendix}{appendices}%
    \crefname{enumi}{item}{items}%
    \crefname{footnote}{footnote}{footnotes}%
    \crefname{figure}{figure}{figures}%
    \crefname{table}{table}{tables}%
    \crefname{theorem}{theorem}{theorems}%
    \crefname{lemma}{lemma}{lemmas}%
    \crefname{corollary}{corollary}{corollaries}%
    \crefname{proposition}{proposition}{propositions}%
    \crefname{definition}{definition}{definitions}%
    \crefname{result}{result}{results}%
    \crefname{example}{example}{examples}%
    \crefname{remark}{remark}{remarks}%
    \crefname{note}{note}{notes}%
}

but I agree that it's clumsy.

share|improve this answer
2  
According to the cleveref documentation, the user interface command is \crefname rather than the internal name \crefname@preamble. –  Lev Bishop Dec 24 '10 at 0:21
add comment

There is a new pre-release version (v0.18) of cleveref which supports a noabbrev option which does this automatically. The new version is not yet on CTAN but can be downloaded on the package author's website: http://www.dr-qubit.org/latex.php#cleveref

share|improve this answer
3  
By now this new version has been released to CTAN. (In fact the CTAN version is now at v0.18.4 and the pre-release at qubit's website is at v0.18.5.) –  Matthias Mar 7 '12 at 17:35
add comment

Furthermore, when used in conjunction with the hyperref package, only the number is actually linked. The text in front of it (“figure” in my example) isn’t. Can this also be changed (again, without redefining all the commands)?

I’ve thrown together the following macro to change this. I’m not particularly satisfied since I still need to maintain a list of all label types but this is the best I got:

\newcommand*\@cref@format[1]{%
  \crefformat{#1}{##2\@nameuse{cref@#1@name}~##1##3}%
  \Crefformat{#1}{##2\@nameuse{Cref@#1@name}~##1##3}}

\newcommand*\@labeltypes{
  algorithm,
  appendix,
  chapter,
  corollary,
  definition,
  enumi,
  equation,
  example,
  figure,
  footnote,
  lemma,
  line,
  note,
  part,
  proposition,
  remark,
  result,
  section,
  table,
  theorem}

\@for\@i:=\@labeltypes\do{%
  \trim@spaces@in\@i
  \expandafter\@cref@format\expandafter{\@i}}

This requires the trimspaces package.

share|improve this answer
add comment

We don't seem to need the \Crefformat part of the above definition by Konrad. I suggest the following.

\usepackage{catoptions}
\usepackage{hyperref}
\usepackage{cleveref}[2011/03/22]
% \makeatletter
\def\setupcrefformat{%
  \docommalist{algorithm,appendix,chapter,corollary,definition,
    enumi,equation,example,figure,footnote,lemma,line,note,part,
    proposition,remark,result,section,table,theorem
  }{%
    \crefformat{##1}{####2##1~####1####3}%
    % We don't seem to need the following:
    % \Crefformat{##1}{####2\@nameuse{Cref@##1@name}~####1####3}%
  }%
}
% \makeatother
\setupcrefformat

\docommalist trims leading and trailing spaces around the list elements.

share|improve this answer
add comment

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.