I'm trying to use CMU Serif Upright Italic for some upright symbols in a document processed with XeLaTeX but am geting error "The font CMU Serif Upright Italic" can not be found."
Is this font not part of TeXLive? And if not, where does one get it?
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[math-style=ISO]{unicode-math}
\setdefaultlanguage[variant=american]{english}
\setotherlanguages{french,german,polish,russian}
%% Choose Latin Modern...
\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX}
\setmainfont{Latin Modern Roman}[Scale=1.0]
\setmathfont{Latin Modern Math}
\setmathfont{CMU Serif Upright Italic}[range=up]
\newcommand\upi{\symup{i}}
\newcommand\upe{\symup{e}}
\newcommand{\uppi}{\symup{\pi}}
\begin{document}
$\upe^{\uppi \upi} = - 1$
\end{document}
Best Answer
If you’re not sure where a file is installed, start by running
fc-match "CMU Serif Upright Italic"
to replicate XeLaTeX’s font search, andluaotfload-tool --find="CMU Serif Upright Italic"
to replicate LuaLaTeX’s. I suspect the latter will work, but if it doesn’t, the next thing to try iskpsewhich cmunui.otf
. If that doesn’t find it, make sure thecm-unicode
TeX Live or MikTeX package is installed. In particular, looking for a font with\setmathfont
is often not enough to alert MikTeX that it should install a package.This problem is often caused on Linux by the system font database not knowing to index your custom TeX Live directory for fonts. The file you need to enable this on Debian or Ubuntu is included with the TeX Live distribution, but you have to install it to the right system directory yourself.
to see if you have the file, and then
to install it in the system configuration directory with a reasonable priority. I’ve additionally created another file on my own box for the fonts in my
texmf-local
directory with the same format, but you have the option to install OpenType fonts to/usr/local/share/fonts/
or~/.fonts/
instead of TEXMFLOCAL.Then run
to update the font caches.
You can instead use LuaLaTeX, which should work out of the box.
Finally, loading the file by its filename should still work even if XeTeX does not have its display name indexed: