0

The cleveref has two main citation commands: \Cref and \cref depending on whether you're referencing in the beginning of the sentence (producing Figure 1) or anywhere else (producing the abbreviated form fig. 1). On rare occasions though, one may want to have the "long" label in the middle of a sentence. How can I have that single label in lowercase? This answer makes all references in small caps, but I'm looking for a solution to keep the standard as provided by the cleveref package, but change it to lowercase ad hoc in some situations.

Ideally I'd like to have a command (say \smallCref) producing figure 1 when needed.

Thanks in advance for any help!

enter image description here

\documentclass{scrreprt}
\usepackage{cleveref}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-a}
    \caption{Foo\label{fig:foo}}
\end{figure}

\Cref{fig:foo} shows a correct usage of \verb|\Cref{}| at the beginning of the sentence. Whereas we can see how to use \verb|\cref{}| at the end of a sentence (\cref{fig:foo}).
\par Sometimes though, one may want to reference \Cref{fig:foo} with the complete label ``figure'', but having it capitalized in the middle of a sentence is weird. How can I have that single reference in smallcaps, leaving all other references in the document in the original capitalization?
\end{document}
  • It looks like you want lower case (figure 1) and not smallcaps (ꜰɪɢᴜʀᴇ 1), is that correct? – Marijn Mar 25 at 10:21
  • That is correct @Marijn sorry I'm not native English speaking and confused small caps with lowercase. I definitely meant lowercase :) I corrected my question – Superuser27 Mar 25 at 10:22
  • 1
    There are many ways to configure the reference commands provided by cleveref, but a quick and dirty hack would be using \lcnamecref{fig:foo}~\labelcref{fig:foo}. Maybe somebody comes up with a clean solution, but this will do in the meantime... – DG' Mar 25 at 10:38
  • 1
    @Superuser27 I made an answer out of it – DG' Mar 25 at 10:47
  • 4
    @Superuser27 Maybe you could change the title of your question from 'small caps' to 'lowercase' so others searching for the same thing can find it – DG' Mar 25 at 10:48
1

Here is a quick and dirty hack. Create a new command, that combines \lcnamecref and \labelcref:

\newcommand{\lccref}[1]{\lcnamecref{#1}~\labelcref{#1}}

Which will give you the following:

\documentclass{scrreprt}
\usepackage{cleveref}
  \newcommand{\lccref}[1]{\lcnamecref{#1}~\labelcref{#1}}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-a}
    \caption{Foo\label{fig:foo}}
\end{figure}

\Cref{fig:foo} shows a correct usage of \verb|\Cref{}| at the beginning of the sentence. Whereas we can see how to use \verb|\cref{}| at the end of a sentence (\cref{fig:foo}).
\par Sometimes though, one may want to reference \lccref{fig:foo} with the complete label ``figure'', but having it capitalized in the middle of a sentence is weird. How can I have that single reference in smallcaps, leaving all other references in the document in the original capitalization?
\end{document}

enter image description here

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.