Skip to main content

The PreTeXt Guide

Section 40.4 LaTeX Font Configuration (Ubuntu/Debian Linux)

Actual font installation is missing here, since I (RAB) cannot recall just when or how certain fonts arrived on my system. Certainly they were almost all via Ubuntu/Debian packages, though they could have been specific to Live. Specifically, the texlive-fonts-recommended and texlive-fonts-extra are two packages that will make many fonts available to / on an Ubuntu/Debian system. The following is offered in the hope that it will be useful to other publishers on other Unix-like systems.
There is a system directory
/etc/fonts/conf.d
with a wide variety of configuration files for various fonts, or collections of fonts. Here I find files (symlinks, really)
65-fonts-lmodern.conf
65-fonts-texgyre.conf
The first points to the extensive Latin Modern fonts, which are an improved version of the original Computer Modern fonts, and are PreTeXt’s default font for out-of-the-box . We have never had a report of these not being available in an author’s distribution. The file indicates that the fonts can be found at
/usr/share/texmf/fonts/opentype/public/lm
/usr/share/texmf/fonts/opentype/public/lm-math
The second configuration file points to multiple fonts from the TeX Gyre Collection
 1 
www.gust.org.pl/projects/e-foundry/tex-gyre/
of GUST: Polska Grupa Użytkowników Systemu . Examining the file indicates these fonts can be found at:
/usr/share/texmf/fonts/opentype/public/tex-gyre
/usr/share/texmf/fonts/opentype/public/tex-gyre-math
As of 2019-11-09 these were the only fonts known to my system in OTF format. This despite having directories full of fonts at:
/usr/share/texlive/texmf-dist/fonts/opentype
/usr/share/texlive/texmf-dist/fonts/truetype
and more. You might have similar directories with the year of your version of Live as a directory. The solution is to create a new file (as root) named
/etc/fonts/conf.d/09-texlive-fontconfig.conf
with contents
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/share/texlive/texmf-dist/fonts/opentype</dir>
  <dir>/usr/share/texlive/texmf-dist/fonts/truetype</dir>
</fontconfig>
and then running fc-cache -f -v to update what fonts are known to the system. It is possible that you can put this file somewhere in your home directory if you do not have administrative access, but we have not tested that approach. Note that some versions of the above file that you might find online will include a type1 directory. It is best to not include this directory, since these fonts are best used only with pdflatex and if known to the system they can mistakenly be incorporated by xelatex, with disasterous results. Typically you will get an unusable PDF and your xelatex run will have the error message
xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object
near the very end of the command-line output.
Apparently, the texlive-fontconfig.conf file is not distributed with Debian Linux as this search
 2 
packages.debian.org/search?arch=any&mode=filename&searchon=contents&keywords=fontconfig.conf
will demonstrate. Please report any change in this situation.
When installing the Open Dyslexic font via an Ubuntu package (2020-04-28), xelatex became confused by the presence of Web Open Font Format (WOFF) versions which were installed along with the OTF versions. The solution is to create a new file (as root) named
/etc/fonts/conf.d/70-no-woff.conf
with contents
<fontconfig>
  <selectfont>
    <rejectfont>
      <glob>/usr/share/fonts/woff/*</glob>
    </rejectfont>
  </selectfont>
</fontconfig>
and then running fc-cache -f -v to update what fonts are known to the system. See the tex.stackexchange.com
 3 
tex.stackexchange.com/questions/392144
post.