2

I would like to use the full name in most circumstances for references. But sometimes, e.g. in

$\xRightarrow{\cref{prop:15.2d}}$

the full name might be too long. In this example, it gives "Proposition 11.15 (d)"

So I would like to use something like

$\xRightarrow{\crefabbr{prop:15.2d}}$

to get something like "11.15 (d)" or "Prop. 11.15 (d)"

Does cleveref have a feature like this?

3

Sure. You can use \crefname, \Crefname inside a group lo locally redefine the string used:

\documentclass{book}
\usepackage{cleveref}
\usepackage{mathtools}

\newtheorem{prop}{Proposition}[section]

\crefname{prop}{\text{Proposition}}{\text{Propositions}}
\Crefname{prop}{\text{Proposition}}{\text{Propositions}}

% Commands for local abbreviations
\newcommand\crefabbr[1]{%
\begingroup
  \crefname{prop}{\text{Prop.}}{\text{Props.}}\cref{#1}
\endgroup%
}
\newcommand\Crefabbr[1]{%
\begingroup
  \Crefname{prop}{Prop.}{Props.}\Cref{#1}
\endgroup%
}

\begin{document}

\chapter{Test}
\section{Test}

$\xRightarrow{\ref{prop:15.2d}}$

$\xRightarrow{\crefabbr{prop:15.2d}}$

$\xRightarrow{\cref{prop:15.2d}}$

\begin{prop}
\label{prop:15.2d}
test
\end{prop}

\end{document}

enter image description here

Notice that if you are only interested in the number, it's enough to use the standard \ref.

| improve this answer | |
  • Thank you! Works like a charm. No, I am not only interested in the number, but also in an abbreviation in front of the number, because I think it makes it easier for the reader to find the referenced entity. – Martin Thoma Jan 28 '14 at 6:37

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.