When I compile a document using the CMU Serif font:
%!TeX program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{CMU Serif}
\begin{document}
Lorem ipsum...
\end{document}
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.
lualatex
instead ofxelatex
?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 withlualatex
/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 includetexlive-fontconfig.conf