2

EDIT: The mentioned solution on the bottom of this page works perfectly for the label output. But now I am struggling with the distance of the \crefname and the counter. Instead of a space I would like to have a smaller distance between fig. and the number. Instead of fig.~1 I'd like to have fig\,1 but it appears that I am losing myself in the code of the cref manual.

I am using a combination of varioref, cleveref and hyperref to use a - I would say - more "sophisticated" referencing behaviour. It enables me to simply use \vref{labelname} to get the output

Table 1 on page 1

My MWE looks like this:

\documentclass{scrreprt}

\usepackage[T1]{fontenc}%Kodierung
\usepackage[utf8]{inputenc}%%Kodierung
\usepackage[english,ngerman]{babel}%language
\usepackage[format=plain,indention=1em,labelfont=bf,font=footnotesize,justification=justified,position=bottom]{caption}  %schönere Captions durch den \caption-Befehl

%%%%%%%%%%
%REFERENCES
%%%%%%%%%%
\usepackage[ngerman]{varioref}  
\usepackage[linktocpage=true,bookmarksopen,hidelinks,ngerman,hyperfootnotes=false]{hyperref}%Hyperrefpaket    
\usepackage[ngerman,nameinlink,sort]{cleveref}

\renewcommand*babel\reftextfaraway[1]{auf S.\,\pageref{#1}}%
\addto\extrasngerman{\renewcommand{\reftextfaraway}[1]{auf S.\,\pageref{#1}}} %Short page labels


\begin{document}

\chapter{Chapter 1}

\begin{table}
\caption{Text}
\label{text}
\end{table}

\newpage

\vref{text}

\end{document}

Now, what I want is: I would like to change the way the Table or Figure or whatever is named in the text, when I use a 'ref' command. Instead of

Figure 1 on page 1

I would like to get (preferably in German but I guess this is reached by a general trigger or babel)

Fig. 1 on p. 1

Through research I already figured out how to modify the label in the float itself by adding this code (since I am using the babel package this is needed):

\addto\captionsngerman{\renewcommand{\figurename}{Abb.}}
\addto\captionsngerman{\renewcommand{\tablename}{Tab.}}

Also, in a forum I found a way to modify the pagelabel output but I failed at changing the text output of my referencing command. I tried

\addto\captionsngerman{\renewcommand{\crefname}{Abb.}}

But, this simply gives me an error of a missing control sequence.

6

As discussed in the cleveref manual (page 12), use (don't redefine) the \crefname and \Crefname macros:

\addto\captionsngerman{
    % Second argument is singular, third is plural
    \crefname{figure}{abb.}{abb.}
    \Crefname{figure}{Abb.}{Abb.}
}
  • Damn, under section 7.1.2. How couldn't I find it? Thanks. Now I would like to change the space between the label and the counter to "\," instead of "~". In the manual I only can find how to change the space for \crefrange. I am quite lost with the \crefdefaultlabelformat. I cannot see a way to modify spaces with this command. Do you know how to accomplish this -- most probably simpliest -- task? – Kris Nov 13 '13 at 10:25
  • 1
    You can only do this with the low-level formatting commands \crefformat etc. See section 7.2 of the manual for details. – Toby Cubitt Nov 18 '13 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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