I installed TexLive 2018 from https://www.tug.org/texlive/quickinstall.html
Consider this script:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Tex Gyre Termes}
\begin{document}
\end{document}
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
/usr/local/texlive/2018/bin/x86_64-linux//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 .otf
s in /usr/local/texlive/2018/texmf-dist/fonts/opentype/public/tex-gyre/
. Furthermore, it is available in Libre Office:
Why is it not accessible to xelatex
?
** Why is the font Tex Gyre Termes
missing and how to install it? **
Update
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?
Solution
The problem was resolved by changing
\setmainfont{Tex Gyre Termes}
to
\setmainfont{TeX Gyre Termes}
Best Answer
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:
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 yourtexmf-local
directory for a system-wide install or in your document path)Now LaTeX knows all TeX Gyre Termes shapes as the family
tgtermes
(with encodingTU
aka Unicode). You can use the font withIf you really want to use fontspec, you could instead give fontspec a hint where to find the fonts: Create a file named
texgyretermes.fontspec
withThen fontspec finds the font:
The last version is quite fragile and might break if you change anything in the name.