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?


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}.


| 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 ;)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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