2

It's said that \textit will select an italic font, instead of doing some geographical change to the font. This means it will generate exactly the same thing as using italic font directly. However, I found it strange when using \textit because it generates something different from the original italic font.

%!TEX program = xelatex
\documentclass{article}

\usepackage{fontspec}
\newfontfamily\avr{Avenir Next Regular}[Ligatures=TeX]
\newfontfamily\avd{Avenir Next Demi Bold}[Ligatures=TeX]
\newfontfamily\avdi{Avenir Next Demi Bold Italic}[Ligatures=TeX]
\begin{document}
\section{}
{\avd This is "Avenir Next Demi Bold" font.}
\section{}
{\avdi This is "Avenir Next Demi Bold Italic" font.}
\section{}
\textit{\avd{This is textit\{"Avenir Next Demi Bold" font.\}}}
\section{}
\avr Why the last two have different ``boldness''?
\end{document}

difference shown in the picture

Obviously 2 and 3 are different. Can someone tell me why?

  • 1
    It can happen. Font names are not exact, they differ often from font to font and so the heuristic to identify italic or bold can fail. – Ulrike Fischer Oct 24 '18 at 6:35
  • @UlrikeFischer So I should directly use the italic font? – user155860 Oct 24 '18 at 7:36
  • Use the ItalicFont key to setup the italic font, see the fontspec documentation. – Ulrike Fischer Oct 24 '18 at 8:06
  • 1
    You probably want \newfontface instead of \newfontfamily. – egreg Oct 24 '18 at 8:36
  • 2
    you have declared your three fonts as new families so (to latex/fontspec) they are just unrelated fonts avdi has not been declared as the italic version of avd. – David Carlisle Oct 24 '18 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.