I want my cross reference links to look like:

Chapter X: Chapter Title

To achieve that I have created the following command:

\newcommand{\fancyref}[1]{\autoref{#1}: \nameref{#1}}

The problem is that the : character is not part of the generated hyperlink.

Could someone help?

Thanks in advance.

Warning I get when compiling Leo Liu's example:

LaTeX Warning: Reference `*' on page 1 undefined on input line 10.


LaTeX Warning: There were undefined references.

1 Answer 1


I think you can use:

\hyperref[label]{\autoref*{label}: \nameref*{label}}

Full example:

  \hyperref[#1]{\autoref*{#1}: \nameref*{#1}}}


  • It didn't quite work for me. It is giving fata errors. I think the problem is the * how can I have the * in a newcommand definition? Jan 17, 2011 at 17:51
  • @Tiago: I add a full example works for me. Check your code if there is something wrong. The * avoids a hyper link here.
    – Leo Liu
    Jan 18, 2011 at 5:23
  • Perhaps we have different versions, but when i compile your example I get the error in my question above. Jan 18, 2011 at 9:02
  • Today I have updated my TeX distribution. I can confirm that this now works for me. Jan 26, 2011 at 21:48

You must log in to answer this question.

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