I create a link with \nameref:

\section*{\Huge {\color{DarkRed}This is a headline}}


When I reference to this section with

\nameref{sec:headline}


The link is displayed the same size (Huge) and color (Dark Red) as the section title.

The hyperref setup is:

\usepackage[colorlinks=true,linkcolor=black]{hyperref}


How can I avoid that link color and size are taken from the section setup. I want to keep them independent from one another.

EDIT: Minimal working example:

\documentclass{article}

\begin{document}

\newpage

\end{document}

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Marco Daniel Feb 23 '13 at 14:47
Don't use any font commands as an argument of \section! – Marco Daniel Feb 23 '13 at 14:48

If you want to change the appearance in general, then use a more powerful class (scrartcl/KOMA-Script, memoir, …) or a package (sectsty, …):

• Then you have a clean markup.

Package gettitlestring

Package hyperref uses package nameref. Since 2009/12/08 it uses package gettitlestring to get and process the title data. With method expand commands can be redefined via \GetTitleStringDisableCommands similar to hyperref's \pdfstringdefDisableCommands for bookmarks.

\documentclass{article}

\usepackage{nameref}[2009/12/08]% uses package gettitlestring'

\GetTitleStringSetup{expand}
\GetTitleStringDisableCommands{%
\let\Huge\empty % disables \Huge
% or \renewcommand*{\Huge}{}%
\let\color\@gobble % disables \color{...}
% or \renewcommand*{\color}[1]{}%
}

\begin{document}

\newpage

\end{document}


However, only expandable redefinitions can be used. LaTeX's scanning for optional arguments does not work.

-
In my opinion you has provided a workaround instead of a "clear" solution. With the mentioned classes of KOMA you can set the font eg. by addkomafont what should be the correct answer here (This is my personal opinion) – Marco Daniel Feb 23 '13 at 15:51
@MarcoDaniel The question is not clear, if a solution for all sections headers is needed or if only a particular \section is affected. Right at the beginning I have given the general solutions. The documentation of the classes and packages should be sufficient and there are probably quite a few "duplicate" questions. However I have some doubts that the workaround solution, which is useful for some circumstances, has already hit common knowledge. – Heiko Oberdiek Feb 23 '13 at 16:14

If I understand it correctly with komascript it is fairly easy:

\documentclass{scrartcl}

`