I'd like my cross reference to be formatted in sans-serif, but I've not been able to find the way.

I'm currently using both cleveref and hyperref packages.

  • We've got a nice concept here: Providing a starter document ;-)
    – user31729
    Commented Jul 20, 2016 at 20:21

1 Answer 1


As far as a I know there's no way to use \crefdefaultlabelformat in order to query the current counter type to be referenced and thereby getting the relevant name of the counter as being defined with \crefname and \Crefname.

However, the \crefformat can be used to change the specific formating with to sans-serif with this setup (shown for the section counter)

\crefformat{section}{#2{\sffamily\cref@section@name\ #1}#3}

The same can be done for \Crefformat, replacing \cref@section@name by \Cref@section@name)

As it stands, the \crefmultiformat and \crefrangeformat commands are not changed (yet).

In order to prevent tedious code copying, I've provided a way with expl3 syntax to store the counter types to a \seq list and then changing the format in a loop within \switchtosansserifformat.



\seq_new:N \l_atcold_counter_seq 

  \seq_set_from_clist:Nn \l_atcold_counter_seq {#1}

  \seq_map_inline:Nn \l_atcold_counter_seq {%
    \crefformat{##1}{####2{\protect\sffamily\use:c{cref@##1@name}\ ####1}####3}
    \Crefformat{##1}{####2{\protect\sffamily\use:c{Cref@##1@name}\ ####1}####3}


Outlook: In \cref{foo} we will see that ... and \cref{foofigure} shows that ... and \cref{footable} has the relevant data

Outlook: In \Cref{foo} we will see that ... and \Cref{foofigure} shows that ... and \Cref{footable} has the relevant data


\section{Foo} \label{foo}

  \caption{A foo figure}\label{foofigure}

  \caption{A foo table}\label{footable}


enter image description here

  • OMG! This is a lot of code! I thought this was a common will and that I could have called cleverref with an additional parameter or smartly using \crefdefaultlabelformat... That's why there is no starter document in my question: I was expecting a one-line answer. Therefore, although your answer address correctly my question, I'll wait before accepting it, hoping for a one-liner.
    – Atcold
    Commented Jul 20, 2016 at 21:12
  • @Atcold: Yes, that would be really nice, but redefining cleveref code would not be simpler, in my point of view. If you don't like the expl3 list, you have to use \crefformat for each counter name. If I would knew a shorter version (=better version?) I would post it, of course.
    – user31729
    Commented Jul 20, 2016 at 21:13
  • Yeah, I understand you are iterating here. But I was convinced I did ask a dummy question due to my lack of experience with LaTeX. Btw, thank you very much for your input!
    – Atcold
    Commented Jul 20, 2016 at 21:16
  • @Atcold: I'll try to look into \crefdefaultlabelformat, perhaps it's possible with a one-liner ;-) -- Oh my, very tricky. At the moment, I think, my version is the shortest one, but let's wait ;-)
    – user31729
    Commented Jul 20, 2016 at 21:19
  • Hold on, I may have a suggestion. What I actually wanted was to have all 'links' (the stuff that hyperref colours up) in a more visible character, like sans-serif. Maybe 'we' could add that in addition to the colour change. What do you think?
    – Atcold
    Commented Jul 22, 2016 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .