1

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}
12
  • The fonts shipped with your tex distribution can be found in usr/local/texlive/2021/texmf-dist/fonts on Mac OS. Try to figure out from the filename the font you are willing to type set with. Maybe you have it may be not, so check for it there.
    – tush
    Nov 5, 2021 at 20:32
  • 1
  • I have the full TeXLive 2021 installed. Where in usr/local/texlive/2021/texmf-dist/fonts should I look: type1, truetype, opentype, ... ?? And still the question remains as how to form the corect Name for the argument to \setmathfont.
    – murray
    Nov 5, 2021 at 21:32
  • @murray Just use LuaLaTeX and the whole issue magically disappears... (Also LuaLaTeX will print the paths for all used fonts in the end, so there you can see which name you need for XeLaTeX) Nov 5, 2021 at 21:34
  • @DavidCarlisle: I'm working in macOS. Does running fc-cache -f interfere with my local texmf tree, which is in /Users/me/Library/texmf, and normal updating of things when I run the gui TeXLive Utility app?
    – murray
    Nov 5, 2021 at 21:35

1 Answer 1

1

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, and luaotfload-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 is kpsewhich cmunui.otf. If that doesn’t find it, make sure the cm-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.

kpsewhich texlive-fontconfig.conf

to see if you have the file, and then

sudo cp $(kpsewhich texlive-fontconfig.conf) /etc/fonts/conf.d/09-texlive.conf

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

fc-cache -f -s -v

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:

\setmathfont{cmunui.otf}[range=up,
                         Scale=MatchLowercase]
2
  • I am using macOS, not LInux. macOS/MacTeX users inform me that fc-cache won't do what's needed but merely populate the X11 cache for X11 use.
    – murray
    Nov 6, 2021 at 15:06
  • File cmunui.otf is where it should be (/usr/local/texlive/2021/texmf-dist/fonts/opentype/public/cm-unicode/cmunui.otf). I added the file to Font Book and now it's accessible using XeLaTeX. In any case, loading the font by name cmunui.otf certainly works with XeLaTeX. So I'll gladly accept the answer even though te fc-cache command seems irrelevant for the macOS/MacTeX environment.
    – murray
    Nov 6, 2021 at 15:16

You must log in to answer this question.

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