When I compile a document using the CMU Serif font:

%!TeX program = xelatex

\setmainfont{CMU Serif}

Lorem ipsum...

I get an error: Package fontspec: The font "CMU Serif" cannot be found, even if the font is actually installed in /usr/share/texlive/texmf-dist/fonts/opentype/public/cm-unicode/.

I know that I can load the fond by giving a filename (several filenames with the variants), but why does \setmainfont{CMU Serif} not work?

EDIT : Several topics here mention a /.../fonts/conf/texlive-fontconfig.conf file, but there is no such file on my computer. I have no idea whether it is related to my problem, so i just mention it.

  • have you tried lualatex instead of xelatex? xelatex is motoriously crankry about where it looks for fonts. I cannot get it to use texlive fonts on my Linux box. No issues what so ever with lualatex
    – daleif
    Commented May 4, 2021 at 13:25
  • 2
    linux systems need additional fontconfig setup if you want to call fonts by font name, see tug.org/texlive/doc/texlive-en/texlive-en.html#x1-330003.4.4 Commented May 4, 2021 at 13:26
  • On my system that config file lives in /opt/texlive/2021/texmf-var/fonts/conf/texlive-fontconfig.conf. From the PATH you gave it seems you are using a TeXLive from a Linux dist. No idea if they include texlive-fontconfig.conf
    – daleif
    Commented May 4, 2021 at 13:29
  • @UlrikeFischer see my EDIT : maybe is this the cause of my problem? Commented May 4, 2021 at 13:30
  • 1
    please don't change the question title (most questions get solved:-) just mark the question as answerd by accepting the answer. Commented May 4, 2021 at 17:19

1 Answer 1


My setup is different than yours but you can probably adapt it. My version of texlive-fontconfig.conf has the following contents

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

You will need to adapt the first two <dir>'s to what fits your system. And it is recommended (David via chat) to delete the type1 line.

Once you have that proceed as described in


that worked fine on my system, where xelatex normally cannot use the TL fonts.

That is I did:

sudo cp texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf 
sudo fc-cache -fsv
  • 1
    It works, thanks a lot! Commented May 4, 2021 at 14:18

You must log in to answer this question.

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