[Tex/LaTex] Display reference name, label number and target name with cleveref

cleverefcross-referencing

I want to reference a section with cleveref like in the following example:

\section{Foobar}
\label{sec:foobar}

See \cref{sec:foobar}.

The output of this is:

See section 1.

But what I would like is this:

See section 1 Foobar.

I understand that there is no command by default, that produces this output.

So I tried to build my own command like suggested for the hyperref package in this question. However, I could not find an equivalent command to hyperref's \nameref in cleveref's documentation.

Is it possible to create a new command, that produces my desired output?

Best Answer

According to @AndrewSwann's suggestion, I created a command, that makes use of both cleveref's \Cref and hyperref's \nameref:

\newcommand*{\fullref}[1]{\hyperref[{#1}]{\Cref*{#1} \nameref*{#1}}}

The benefit compared to the solution in this question, which only uses hyperref, is that the use of \Cref allows for capitalized reference names.

Both \Cref and \nameref create a single link. Encapsulating them in \hyperref merges them to a single link.