2

Italics go missing when I change to a font that is installed and I can't figure out why.

Here is the installed font, (as shown in Mac OS's Font Book): enter image description here

Here's a MWE:

\documentclass[fontsize=14.5pt,
paper=a6,
DIV=14,
pagesize]{scrartcl}                 
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{BentonModernFour}
%\setromanfont[Mapping=tex-text]{BentonModernFour-Roman}% Doesn't work
%\setromanfont[Mapping=tex-text]{Hoefler Text} %Works
\begin{document}

No one gave their real names but \textit{nommes de guerre}.

\end{document}

Yields only this: enter image description here

I've looked at: including own fonts in xelatex with fontspec doesn't work for "bold" "italic" font faces

But this doesn't work for me. I've also looked at Fontspec can't find italic font (installed later) but will use condensed (installed first) on OSX

which explains how to update the font cache for LuaLaTeX, but not XeLaTeX. LuaLaTeX yields the desired output, but XeLaTeX does not. How can I fix this? Here is the log file: https://www.dropbox.com/s/kb86n5as1sog613/mwe%2Bitalics%2Bxe.log?dl=0

Apparently, this is a recurring problem. Here's someone on a different forum from 2012: https://latex.org/forum/viewtopic.php?t=20135

Adding ItalFont=(name of font)as a fontspec option didn't work. As did ItalicFont=*.otf (see image) Ita

enter image description here

  • 1
    Don't use xltxtra and xunicode – DG' Jan 24 at 13:53
  • Deleting xlxtra and xunicode did not fix the problem. – Michael Kane Jan 24 at 14:09
  • 1
    If fontspec can't find a shape, use the key ItalicFont to set the font manually. – Ulrike Fischer Jan 24 at 14:40
  • @UlrikeFischer: syntax? ItalicFont=*? See edit above. – Michael Kane Jan 24 at 15:23
  • 1
    fontspec has a documentation. Did you check it? – Ulrike Fischer Jan 24 at 15:33
2

This should work.

a) Select font by name:

\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont[UprightFont       = *-Roman ,
             BoldFont          = *-Bold ,
             ItalicFont        = *-Italic ,
             BoldItalicFont    = *-BoldItalic ,
             Ligatures=TeX]{BentonModernFour}
\begin{document}

No one gave their real names but \textit{nommes de guerre}.

\end{document}

b) Select font by file:

\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont[Path=/path/to/font/files/ ,
             Extension = .otf ,
             UprightFont       = *-Roman ,
             BoldFont          = *-Bold ,
             ItalicFont        = *-Italic ,
             BoldItalicFont    = *-BoldItalic ,
             Ligatures=TeX]{BentonModernFour}
\begin{document}

No one gave their real names but \textit{nommes de guerre}.

\end{document}

enter image description here

BTW: You can find a more detailed explanation on how font selection works in the fontspec-manual

  • Indeed it did. But why does "ItalicFont=*.otf" not work? – Michael Kane Jan 24 at 16:33
  • You can either specify the font by name (what we're doing here) or by filename. In that case you have to provide the full filename, extension, and the path to the fonts. – DG' Jan 24 at 16:37
  • The problem is that the issue only occurs sporadically. Sometimes, merely identifying a font family works without more, e.g., "\setromanfont[Mapping=tex-text]{Hoefler Text}" Other times, even though the different fonts are installed in the same directory, italics or bold do not display correctly. It is even stranger when LuaLaTeX and XeLaTeX compiles yield different results with respect to the generation of italics. All of this can not be random behavior, there has to be a reason why one works and the other doesn't. – – Michael Kane Jan 24 at 18:41
1
\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont{BentonModernFour}[
  UprightFont    = *-Roman,
  BoldFont       = *-Bold,
  ItalicFont     = *-Italic,
  BoldItalicFont = *-BoldItalic,
]
\begin{document}
foo \textit{bar}
\end{document}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.