I installed TexLive 2018 from https://www.tug.org/texlive/quickinstall.html

Consider this script:

\setmainfont{Tex Gyre Termes}

When I compile it with xelatex I get:

(/usr/local/texlive/2018/texmf-dist/tex/latex/fontspec/fontspec.cfg)))kpathsea:make_tex: Invalid filename `Tex Gyre Termes', contains ' '

! Package fontspec Error: The font "Tex Gyre Termes" cannot be found.

I try to add package tex-gyre in Ubuntu:

sudo su
[sudo] password for v: 
root@v-VirtualBox:/home/v# export PATH=$PATH:/usr/local/texlive/2018/bin/x86_64-linux/
root@v-VirtualBox:/home/v# which tlmgr
root@v-VirtualBox:/home/v# tlmgr install tex-gyre
tlmgr: package repository http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet (verified)
tlmgr install: package already present: tex-gyre

I have a lot of tex-gyre files in the directory /usr/share/texmf/fonts/opentype/public/tex-gyre/. There are also many .otfs in /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/tex-gyre/. Furthermore, it is available in Libre Office:

enter image description here

Why is it not accessible to xelatex?

** Why is the font Tex Gyre Termes missing and how to install it? **


Once I download the .zip from http://www.gust.org.pl/projects/e-foundry/tex-gyre/termes/qtm2.004otf.zip how and where exactly do I install the .otf files?


The problem was resolved by changing

\setmainfont{Tex Gyre Termes}


\setmainfont{TeX Gyre Termes}
  • Does it work when you capitalize the X in TeX? – Davislor Jan 17 at 14:58

There is one important difference between the font handling in LuaLaTeX and XeLaTeX: While LuaLaTeX allows you to access all your fonts by file name or font name, XeLaTeX restricts this:

  • System fonts in your system font directory (the fonts visible to other programs) can only be called by the font name (like "TeX Gyre Termes").
  • Fonts installed in the TeX directories can only be called by their file names.

Now installing tex-gyre through TeX Live installs the font in the TeX directories, so you have to use the file name.

If accessing the font by font name is really important to you, you could either add the TeX font path to your system font path or use LuaTeX.

But this would not be very portable, so we want to use file names instead. You could specify the filename in fontspec, but there is no need for fontspec here. You just need a NFSS font definition for the font:

Save the following file under the name tutgtermes.fd (in your texmf-local directory for a system-wide install or in your document path)

\ProvidesFile{tutgtermes.fd}[2019/01/17 v0.0 OpenType font definitions for TeX Gyre Termes]
  <->\UnicodeFontFile{texgyretermes-regular}{\UnicodeFontTeXLigatures +smcp}
  <->\UnicodeFontFile{texgyretermes-italic}{\UnicodeFontTeXLigatures +smcp}
  <->\UnicodeFontFile{texgyretermes-bold}{\UnicodeFontTeXLigatures +smcp}
  <->\UnicodeFontFile{texgyretermes-bolditalic}{\UnicodeFontTeXLigatures +smcp}
  <->ssub * tgtermes/b/n
  <->ssub * tgtermes/b/it
  <->ssub * tgtermes/b/sc
  <->ssub * tgtermes/b/scit

Now LaTeX knows all TeX Gyre Termes shapes as the family tgtermes (with encoding TU aka Unicode). You can use the font with


If you really want to use fontspec, you could instead give fontspec a hint where to find the fonts: Create a file named texgyretermes.fontspec with

\defaultfontfeatures[TeX Gyre Termes]
  Extension      = .otf ,
  UprightFont    = texgyretermes-regular,
  BoldFont       = texgyretermes-bold,
  ItalicFont     = texgyretermes-italic,
  BoldItalicFont = texgyretermes-bolditalic,

Then fontspec finds the font:

\setmainfont{TeX Gyre Termes}

The last version is quite fragile and might break if you change anything in the name.


You should be able to install all the TeX Gyre fonts using tlmgr, as you did:

tlmgr install tex-gyre

If that doesn't work, you can always download the fonts from the website and install them as normal fonts, which should allow fontspec to find them.

As your log appears to be complaining about a space, have you tried removing it? This certainly works for me:


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.