0

I use \setmainfont{CMU Serif} to change the font. But CMU Serif doesn’t support small caps emphasis font as you can see with the following MWE:

\documentclass[a5paper,10pt,twoside,french]{book}
\usepackage{fontenc}
\usepackage{fontspec}

\setmainfont{CMU Serif}

\begin{document}

\textsl{\textsc{gnu}'s not Unix} (\verb|\textsl{}|) \par \textit{\textsc{gnu}'s not Unix} (\verb|\textit{}|) \par \emph{GNU: \textsc{gnu}'s not Unix} (\verb|\emph{}|)

\end{document}

Witch produce the following rendering:

Rendering of the MWE

But the default font (witch seems to be European Computer Modern) produce a well render according to this tread.

So is theire a way to set European Computer Modern just for small caps inside emphasis context (or reverse)?

fauve
  • 2,501

3 Answers3

2

You can slant the upright small caps

enter image description here

\documentclass[a5paper,10pt,twoside,french]{book}
%%%\usepackage{fontenc}
\usepackage{fontspec}

\setmainfont{CMU Serif}[ItalicFeatures= { SmallCapsFont={CMU Serif}, SmallCapsFeatures={Letters=SmallCaps,FakeSlant=0.2} }]

\begin{document}

\textsl{\textsc{gnu}'s not Unix} (\verb|\textsl{}|) \par \textit{\textsc{gnu}'s not Unix} (\verb|\textit{}|) \par \emph{GNU: \textsc{gnu}'s not Unix} (\verb|\emph{}|)

\end{document}

Or use Latin Modern small caps enter image description here

\documentclass[a5paper,10pt,twoside,french]{book}
%%%\usepackage{fontenc}
\usepackage{fontspec}

\setmainfont{CMU Serif}[ItalicFeatures= { SmallCapsFont=LMRomanCaps10-Oblique}]

\begin{document}

\textsl{\textsc{gnu}'s not Unix} (\verb|\textsl{}|) \par \textit{\textsc{gnu}'s not Unix} (\verb|\textit{}|) \par \emph{GNU: \textsc{gnu}'s not Unix} (\verb|\emph{}|)

\end{document}

David Carlisle
  • 757,742
  • Hmm… The slanting still ugly. It’s not a real emphasis. But we could use European Compuuter Modern for all small caps. – fauve Sep 24 '22 at 12:48
  • ec fonts are not Unicode encoded opentype so would take some more setup and some lack of warning about incorrect character if you used non ascii letters – David Carlisle Sep 24 '22 at 12:52
  • 1
    I found a solution working with Latin Modern as described here https://tex.stackexchange.com/questions/79086/how-to-use-all-variants-of-latin-modern-roman-with-fontspec/79093#79093 with LMRomanCaps10-Oblique instead of ec. – fauve Sep 24 '22 at 13:25
  • @fauve ah I tried LM but fontspec didn't find the right font automatically: specifying that variant explicitly works as you say, I added it above – David Carlisle Sep 24 '22 at 15:08
1

If you just need slanted/italic small caps for Latin letters, you can substitute with Latin Modern:

\documentclass[a5paper,10pt,twoside]{book}

\usepackage{fontspec}

\setmainfont{CMU Serif}[ SlantedFont=CMU Serif Roman Slanted, UprightFeatures={SmallCapsFont=LMRomanCaps10-Regular}, ItalicFeatures={SmallCapsFont=LMRomanCaps10-Oblique}, SlantedFeatures={SmallCapsFont=LMRomanCaps10-Oblique}, ]

\begin{document}

\textsl{\textsc{gnu}'s not Unix} (\verb|\textsl{}|)

\textit{\textsc{gnu}'s not Unix} (\verb|\textit{}|)

\emph{GNU: \textsc{gnu}'s not Unix} (\verb|\emph{}|)

\end{document}

enter image description here

egreg
  • 1,121,712
-1

Maybe we can fake \textsc.

\documentclass{book}

\usepackage{fontspec}

\setmainfont{CMU Serif}

\begin{document}

\textsl{\textsc{gnu}'s not Unix} (\verb|\textsl{}|) \par \textit{\textsc{gnu}'s not Unix} (\verb|\textit{}|) \par \emph{\textsc{gnu}'s not Unix} (\verb|\emph{}|)

\textsl{\textup{G{\scriptsize NU}}'s not Unix} (\verb|\textsl{}|) \par \textit{\textup{G{\scriptsize NU}}'s not Unix} (\verb|\textit{}|) \par \emph{\textup{G{\scriptsize NU}}'s not Unix} (\verb|\emph{}|)

\textsl{G{\scriptsize NU}'s not Unix} (\verb|\textsl{}|) \par \textit{G{\scriptsize NU}'s not Unix} (\verb|\textit{}|) \par \emph{G{\scriptsize NU}'s not Unix} (\verb|\emph{}|)

\end{document}

enter image description here

Clara
  • 6,012