1

Note: This question is only for the macOS operating system

The Times New Roman font in my mac doesn't have small caps shapes. So I want to set TeX Gyre Termes as the small caps fallback font.

Using TeX Gyre Termes as the main font

\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyretermes}%
  [
    Extension      = .otf,
    UprightFont    = *-regular,
    BoldFont       = *-bold,
    ItalicFont     = *-italic,
    BoldItalicFont = *-bolditalic
  ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}

\end{document}

The result is satisfactory as can be seen below:

enter image description here

Using Times New Roman as the main font

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}

\end{document}

As the log shows, the font shapes m/sc, b/sc and m/scit are all missing.

enter image description here

Using TeX Gyre Termes as fallback

attempt 1: using font name

According to the fontspec manual, we can set small caps fallback as follows:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}%
  [
    SmallCapsFont     = TeX Gyre Termes,
    SmallCapsFeatures = {Letters=SmallCaps}
  ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}

\end{document}

The above example can be compiled only by lualatex (since macOS users can not use fonts in texmf tree by font name when using xelatex). However, lualatex can't either give the satisfactory result:

enter image description here

After installing the TeX Gyre Termes font into my system, xelatex can be used too but the result is the same the above screenshot.

attempt 2: using file name

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}%
[
  UprightFeatures = 
    {
      SmallCapsFont = {texgyretermes-regular.otf},
      SmallCapsFeatures = {Letters=SmallCaps}
    },
  BoldFeatures = 
    {
      SmallCapsFont = {texgyretermes-bold.otf},
      SmallCapsFeatures = {Letters=SmallCaps}
    },
  ItalicFeatures = 
   {
     SmallCapsFont = {texgyretermes-italic.otf},
     SmallCapsFeatures = {Letters=SmallCaps}
   },
  BoldItalicFeatures =
    {
      SmallCapsFont = {texgyretermes-bolditalic.otf},
      SmallCapsFeatures = {Letters=SmallCaps}
    }
 ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}

\end{document}

This fails for both xelatex and lualatex.

Question

Without having to install TeX Gyre Termes into system, how to set the small caps fallback font correctly under both xelatex and lualatex for macOS users?

2
  • I chose to create hard links for OpenType and TrueType fonts in texmf-dist tree. mkdir ~/Library/Fonts/texlive-opentype; find `kpsewhich -var-value TEXMFDIST`/fonts/opentype -name '*.otf' -type f -exec ln \{\} ~/Library/Fonts/texlive-opentype \; See this article in Chinese. Commented Apr 28 at 6:37
  • @muzimuzhiZ A told me fonts on Macs always got installed into /Library/Fonts. Actually, I think A said they'd been installed there since forever, but I was sure they were/could be installed into ~/Library/Fonts. Since I no longer have a Mac, this wasn't something I could readily establish. Thank you for inadvertently suggesting I'm not going completely mad. (I'd suggested /Library/Fonts was not equivalent to ~/.fonts on Linux because I thought it should be ~/Library/Fonts, /Library/Fonts being more like /usr/local/share/fonts.)
    – cfr
    Commented May 5 at 6:44

2 Answers 2

4
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}%
  [
   BoldFeatures = 
     {SmallCapsFont={TeX Gyre Termes Bold},
      SmallCapsFeatures = {Letters=SmallCaps}} ,
   ItalicFeatures = 
    {SmallCapsFont={TeX Gyre Termes Italic},
     SmallCapsFeatures = {Letters=SmallCaps}} ,
  ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}
\textbf{\textit{\textsc{hello}}}
\end{document}

enter image description here

In system where fonts in the texmf tree can not be found by file name this could work (untested)

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}%
  [
   BoldFeatures = 
     {SmallCapsFont={texgyretermes-bold},
      SmallCapsFeatures = {Extension=.otf,Letters=SmallCaps}} ,
   ItalicFeatures = 
    {SmallCapsFont={texgyretermes-italic},
     SmallCapsFeatures = {Extension=.otf,Letters=SmallCaps}} ,
  ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}
\textbf{\textit{\textsc{hello}}}
\end{document}
5
  • There is a restricted condition in my question.
    – Stephen
    Commented Apr 28 at 10:36
  • on my system (windows) this works fine with xelatex and lualatex. Commented Apr 28 at 10:38
  • This does not work for macOS users.
    – Stephen
    Commented Apr 28 at 10:40
  • I added an edit. Commented Apr 28 at 10:47
  • Can't work too.
    – Stephen
    Commented Apr 28 at 12:02
0

On my mac system, the next code works:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}%
  [
    SmallCapsFont     = TeX Gyre Termes,
    SmallCapsFeatures = {Letters=SmallCaps},
   BoldFeatures = 
     {SmallCapsFont={TeX Gyre Termes Bold},
      SmallCapsFeatures = {Letters=SmallCaps}} ,
   ItalicFeatures = 
    {SmallCapsFont={TeX Gyre Termes Italic},
     SmallCapsFeatures = {Letters=SmallCaps}} ,
   BoldItalicFeatures = 
    {SmallCapsFont={TeX Gyre Termes BoldItalic},
     SmallCapsFeatures = {Letters=SmallCaps}} ,
  ]
\begin{document}

hello
\textsc{hello}
\textbf{\textsc{hello}}
\textit{\textsc{hello}}
\textbf{\textit{\textsc{hello}}}
\end{document}
2
  • Is this for LuaTeX? On a Mac, don't you have to have installed the font as a system font for this to work with XeTeX? I understood you couldn't call them by name otherwise ....
    – cfr
    Commented May 11 at 0:36
  • Yes, it is for lualatex. Sorry I didn't mention that. Commented May 11 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .