# Use italic ampersand in different sizes depending on environment

This is going to be a little complicated: in the spirit of Bringhurst I am trying to incorporate italic ampersands into headings. I am using a LuaLaTeX modified version of classicthesis, hence the layout is relatively complex. I hope the following illustrates the problem. I tried to generate an MWE, but the table of content generation of classicthesis is a little to complex for me.

classicthesis uses spaced capitals for chapter headings and small caps for section headings. The normalsized ampersand is fine for chapters, but to large for for sections. I created two versions \amper and \ampersmall:

\newcommand{\amper}{\protect\textit{\&}\xspace}
\newcommand{\ampersmall}{\protect\footnotesize\textit{\&}\xspace\normalsize}


The result is fine in the text:

Chapter with large ampersand

Section with small ampersand

Hence, I would like the exact opposite in the TOC: small ampersand for chapters, normal ampersand for sections.

Does anyone has a suggestion how to accomplish switching the ampersand-macros in the TOC?

-

It's generally not a good idea to put font-dependent stuff into moving arguments, because as you see, things can get formatted differently in different places.

I tried to

1. Check whether the current font is small caps and
2. use a relative size change.

The result:

\documentclass{article}

\usepackage{xspace}
\usepackage{relsize}

\newcommand*\scname{sc}

\makeatletter
\DeclareRobustCommand{\amper}{%
\ifx\f@shape\scname
{\smaller\textit{\&}}%
\else
\textit{\&}%
\fi
\xspace}
\makeatother

\begin{document}

\textbf{cat \amper dog}
\textsc{cat \amper dog}

\end{document}


Enjoy!

-
Thanks, on first glance that appears to be working perfectly. I'll check more thoroughly if it breaks stuff at certain places. Concerning your first comment (font-dependent stuff in moving arguments), can this be overcome regarding this issue? –  Jörg Mar 28 '12 at 17:53
I tried to overcome it in the sense of making a definition which reacts to the font configuration at hand, but in the end you're always bound to forsee what variance the context may have. –  Stephan Lehmke Mar 28 '12 at 17:54

This does not directly answer your question, but how about using different definitions for \amper & friends in the ToC vs. everywhere else? Example:

\documentclass{article}

\usepackage{xcolor}

\DeclareRobustCommand{\strong}[1]{\textcolor{red}{#1}}

\DeclareRobustCommand{\renewstrong}{%
\DeclareRobustCommand{\strong}[1]{\textcolor{blue}{##1}}%
}


That works as well and is probably more robust than the answer from @stephan-lehmke, but his approach has the advantage of needing only one \amper command that adjusts automatically, while different definitions require one for large and one for small (as I originally stated). Stephan's approach appears to be stable with classicthesis, hence I am going for that. –  Jörg Mar 29 '12 at 12:04