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
4  
You want the noabbrev package option. It's one of the first things in the manual! –  Noldorin Aug 25 '13 at 21:01

5 Answers 5

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
    
This answer ought to be updated to reflect the creation of the options noabbrev (to suppress abbreviation of the items' names) and nameinlink (to include the items' names in the hyperlink). –  Mico Sep 7 at 10:13

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
4  
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

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

According to the manual:

The default cross-reference names for some languages use common abbreviations for some of the names (e.g. in the default English format, \cref{eq1} will be typeset as eq.~(1)). Some authors may prefer to always use the full name, rather than an abbreviation (equation~(1) instead of eq.~(1)). To disable all use of abbreviations in the default cross-reference names, pass the noabbrev option to the cleveref package

To you second question:

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

According to the manual:

When using the hyperref package, cleveref automatically makes all cross- references into hyperlinks to the corresponding reference. By default, only the label itself forms part of the hyperlink target (i.e. the text you can click on to nav- igate to the cross-reference). The cross-reference name is not part of the hyperlink. By contrast, hyperref’s \autoref command does includes the name as part of the hyperlink. If you prefer to include the names in the hyperlinks when using cleveref, you can pass the nameinlink option to the cleveref package.

share|improve this answer
1  
Regarding the OP's second question: In order to get the item's name become part of the hyperlink, it suffices to specify the option nameinlink when loading the cleveref package. (This option has been around for at least two years.) –  Mico Sep 7 at 10:10
1  
Didn't know that. Strange that this question is 4 years old, one of the first hits in google, all the options are available since >2 years, but i'm the first to formulate the (now) correct answer. –  Sebastian Schmitz Sep 7 at 10:18

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
    
This answer needs to be updated to reflect the availability of the package option nameinlink. –  Mico Sep 7 at 10:15
    
@Mico Actually the "correct" thing would be for you to write a new answer which reflects the new option. ;-) –  Konrad Rudolph Sep 7 at 11:11
    
By now, this posting has already attracted five answers; I'd rather not add a sixth... –  Mico Sep 7 at 11:29

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
    
This answer ought to be updated to reflect the availability of the package noabbrev. –  Mico Sep 7 at 10:14

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.