Take the 2-minute tour ×
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.

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}
share|improve this question
1  
\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... –  cgnieder Oct 10 '12 at 17:05
2  
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
1  
Why not \href{http://it.wikipedia.org/wiki/Pagina_principale}{\spacedallcaps{test}}? –  cgnieder Oct 13 '12 at 11:31
show 2 more comments

1 Answer 1

up vote 2 down vote accepted

If you want only test in spaced capital letters, obviously

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

is the answer.

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.

share|improve this answer
add comment

Your Answer

 
discard

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.