I’m a big fan of ampersands – so much that I heed SimpleBits’ advice to “use the best available ampersand” quite religiously.
For that purpose, I’ve defined the following shortcut in LaTeX:
\let\amp\&
\renewcommand\&{{\scalebox{1.2}{\textnormal{\fontspec{Baskerville}\itshape\amp}}}}
In brief, this changes all uses of the “normal” ampersand to a stylish variant, e.g.:
This is a text \& it contains an ampersand.
(Using \&
instead of just &
since that’s how LaTeX works – the latter is already reserved to separate columns in table environments.)
However, this always uses the same font – here, Baskerville – no matter whether it fits or not. I’d like to use a different font depending on the font family used. That is, I want to use another ampersand in combination with sans serif text, and in particular I want to prevent rewriting of the ampersand in a monospace context. So in the following two contexts, I don’t want to trigger the above definition:
{\sffamily a \& b}
{\ttfamily a \& b}
How do I do that?
I imagine something like the following:
\renewcommand\&{
\ifsans
{\fontspec{Trebuchet MS}{\textnormal{\itshape\amp}}}
\else
\ifmono
\amp
\else
{\fontspec{Baskerville}\scalebox{1.2}{\textnormal{\itshape\amp}}}
\fi
\fi}