Protecting the argument of a command from the effect of the command

How can I "protect" an argument of a command from the effect of the command?

The link is interrupted by \spacedallcaps

\documentclass{scrreprt}

\usepackage[pdfspacing]{classicthesis}

\begin{document}

\spacedallcaps{\href{http://it.wikipedia.org/wiki/Pagina_principale}{test}}

\end{document}

-
\textbf{\textnormal{normal} boldface}; please, make the title of this question to reflect the exact topic you're discussing. – egreg Oct 10 '12 at 16:54
In general? You need to know what a command does to be able to counteract what it does or to know you can't do anything. Every command is different... – clemens Oct 10 '12 at 17:05
In general, setting it first in a box would remove any formatting from impacting it. However, depending on the use, it might also not fit well with the rest of the text, removing any inter-word shrink/stretch. – Werner Oct 10 '12 at 17:08
@Werner \unhbox should avoid this issue, no? – Stephan Lehmke Oct 10 '12 at 20:11
Why not \href{http://it.wikipedia.org/wiki/Pagina_principale}{\spacedallcaps{test}}? – clemens Oct 13 '12 at 11:31

If you want only test in spaced capital letters, obviously

\href{http://it.wikipedia.org/wiki/Pagina_principale}{\spacedallcaps{test}}


But if you want to make a chapter title into a link (classicthesis uses \spacedallcaps in that case, if I remember correctly), then you have to resort to a hack:

\documentclass{scrbook}
\usepackage[pdfspacing]{classicthesis}
\newcommand\mytemp{}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\renewcommand\mytemp{http://it.wikipedia.org/wiki/Pagina_principale}
\chapter[test]{\href{\noexpand\mytemp}{test}}
\end{document}


The problem is not to show the link address to \MakeUppercase that would turn it in uppercase too.

However I don't recommend turning a chapter title into a link; better putting the link just at the start of the chapter text.

-