1

I tried to use the code provided in this thread to use the Computer Modern italics' ampersand in a document typesetted in Libertine. However this only works in the "body" of the text but not in section titles.

\documentclass[a4paper]{article}    
\usepackage{libertine}

\makeatletter \DeclareRobustCommand*{&}{% \nfss@text{% \fontfamily{cmr}% \selectfont \itshape \symbol{ `&}% }% }

\begin{document} \section{Image & Direct Image} Image & Direct Image \end{document}

enter image description here

Any help appreciated.

Mogu
  • 321

1 Answers1

1

The libertine package sets \bfdefault to b and indeed you get the warning

LaTeX Font Warning: Font shape `OT1/cmr/b/it' undefined
(Font)              using `OT1/cmr/b/n' instead on input line 16.

but you can help and define your own font substitution rule.

\documentclass[a4paper]{article}
\usepackage{libertine}

% provide the necessary substitution rule \DeclareFontShape{OT1}{cmr}{b}{it}{<->ssub*cmr/bx/it}{}

\makeatletter \DeclareRobustCommand*{&amp;}{% \nfss@text{% \fontfamily{cmr}\itshape \symbol{`&amp;}% }% } \makeatother % <- don't forget

\begin{document} \section{Image &amp; Direct Image} Image &amp; Direct Image \end{document}

enter image description here

egreg
  • 1,121,712
  • Thanks! I don't know whether or not it'd useful to say this, but I'm not getting the warning with the previous code (I'm compiling with pdflatex). – Mogu Jun 16 '21 at 10:28
  • @Mogu Not all front-ends show every warning. Check in the log file – egreg Jun 16 '21 at 10:39