2

I'm having trouble changing the font family inside of my document. I want my document to be in Times New Roman, which is small and has the appropriate characters. However, I have sections of the paper that require small caps as well as special characters, which Times New Roman does not provide. I would like to switch to Charis SIL (which is a less compact font) for this. Here is an example of the code I am using:

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{expex}
\lingset{belowglpreambleskip=0ex, aboveglftskip=0ex, everygla={\upshape}}

\setmainfont{Times New Roman}

\begin{document}

This text is in the default font, Times New Roman. The example should be in Charis SIL.

{\fontfamily{Charis SIL}\selectfont

\ex \label{gohome}
\begingl
\glpreamble ʔucačiƛs wałšiƛ. //
\gla ʔu-ca-čiƛ=s wał-šiƛ //
\glb \textsc{x}-go-\textsc{perf}=\textsc{strg.1sg} go.home-\textsc{perf} //
\glft `I went home.' //
\endgl
\xe

}

\end{document}

However, I get a strange output:

enter image description here

Not only do I not get the font selection, but I get the odd "sil.fd SIL.fd" in front. Now, if I set the document font to Charis SIL, e.g.

\setmainfont{Times New Roman}

...this is what I see for the relevant section: enter image description here

Is there any way to selectively alternate between my main document font and Charis SIL?

3
  • Welcome! \fontfamily expects the name of a TeX font family, so LaTeX looks for an appropriately named .fd file in the current encoding. None exists, so it tells you it can't switch and falls back to the default. Please edit your question to provide code for a complete but minimal document which generates the problematic output you show. If you can do this without relying on non-standard fonts, that's best. (Times New Roman is commercial, for example.)
    – cfr
    Mar 2, 2018 at 1:07
  • Ah, okay. I suppose there is no .fd file but the font exists on my computer. LaTeX can pick it up if I set it as the default font, but not if I use \selectfont. I will update the post. Mar 3, 2018 at 5:28
  • Not really. The font does not exist for LaTeX at all. However, XeTeX and LuaTeX can use fonts installed for your OS. You can't set it as the default font for other engines any more than you can \selectfont it with those engines.
    – cfr
    Mar 3, 2018 at 17:26

1 Answer 1

2

Here's a minimal example showing how to switch fonts. I assume you are using fontspec with LuaTeX or XeTeX. I don't have either of the fonts you're using, so I show the switch from TeX Gyre Termes to STIX.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeXGyreTermes}
\usepackage{kantlipsum}
\newfontfamily\stix{STIX}
\begin{document}
\kant[1]
{%
  \stix
  \kant[2]%
}
\end{document}

The first paragraph uses TeX Gyre Termes; the second STIX.

switch fonts mid-document

0

You must log in to answer this question.

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