[Tex/LaTex] Ampersand symbol in \textit

ampersanditalic

I need this exact symbol of & but when I try to put it into \textit{}, it outputs a very different version of this symbol. How do I achieve this symbol & in \textit{}?

Best Answer

If you want that & doesn't change shape when in an italic context, redefine \& to use \textup:

\documentclass{article}

\renewcommand{\&}{\textup{\symbol{`\&}}}

\begin{document}

This \& that

\textit{This \& that}

\end{document}

enter image description here

If you want it to be slanted in italic contexts:

\documentclass{article}

\DeclareRobustCommand{\&}{%
  \ifdim\fontdimen1\font>0pt
    \textsl{\symbol{`\&}}%
  \else
    \symbol{`\&}%
  \fi
}

\begin{document}

This \& that

\textit{This \& that}

\end{document}

enter image description here

A bit of explanation: the first font parameter in a font tells TeX about its slant. If it's positive, then the font is slanted to the right. It is true for italic and slanted fonts. So, if the parameter is positive for the current font (that in TeX is accessible as \font), we enclose \symbol{`\&} in \textsl. However, this will do nothing sensible if the current font family doesn't have a slanted variant (as opposed to italics).

Related Question