TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.
share|improve this question
up vote 3 down vote accepted

I think you can use:

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

Full example:

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


share|improve this answer
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? – Tiago Veloso Jan 17 '11 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 '11 at 5:23
Perhaps we have different versions, but when i compile your example I get the error in my question above. – Tiago Veloso Jan 18 '11 at 9:02
Today I have updated my TeX distribution. I can confirm that this now works for me. – Tiago Veloso Jan 26 '11 at 21:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.