TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 used the \nameref command to reference to names of captions etc. I also used the option colorlinks=true so I have colored references which can be distinguished form "normal" text.

In my print version of the document I colored the links to black. Now I'd like to set them to italic or surround them with apostrophes or something like that.

I already tried to renew the \nameref command, but I didn't get it to work


I allways get an error message, which says

LaTeX Error: \namref undefined.

Any ideas?

share|improve this question
Welcome to TeX.sx! – hpesoj626 Oct 28 '12 at 22:54
If it is exactly that message then you have a typo. The redefinition can't work this way, though. See tex.stackexchange.com/a/48575/5049 for reasons why. – clemens Oct 28 '12 at 23:04
up vote 4 down vote accepted

Option hidelinks is available since hyperref 2011/02/05 v6.82a. \nameref can be redefined the following way (assuming the star form is not needed):



\section{Hello World}
This is section \nameref{sec:hello}.


share|improve this answer
Would you consider something like \LetLtxMacro*\newcs\oldcs that checks whether \newcs is already defined? – egreg Oct 28 '12 at 23:22
@egreg You can already use \LetLtxMacro\newcs\oldcs if \oldcs is undefined. Then \newcs is just undefined (as \let would have done). An error/warning message does not help much, if then \newcs is defined with \oldcs. Therefore I have used \@ifdefinable to get an error message and to disable the redefinition. – Heiko Oberdiek Oct 29 '12 at 1:21
The error would be raised anyway, and such redefinitions by a user (as opposed to a package writer) are usually made during document preparation, so it's not so important that the compilation is "almost successful". In any case the code must be corrected. – egreg Oct 29 '12 at 8:36

Starting of what you wrote, I've made this :


The [1] says that this command will only take one input, and the #1 is what you'll write bewteen braces in yous source file.

You'll use it like this :


It works for me ;)

share|improve this answer

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.