Consider this MWE:
\documentclass{minimal}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono}
\begin{document}
X marks the spot.
\end{document}
Using the standard ISO of TeXLive 2014 on Ubuntu 14.04.1, LuaLaTex compiles this; XeLaTeX, on the other hand, gives this error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "Latin Modern Roman" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.4 \setmainfont{Latin Modern Roman}
What’s going on, and how do I fix this?
Best Answer
is sufficient. It will set the fonts to Latin Modern by default. That said, your code compiles fine for me.
I am not that familiar with XeLaTeX. However, I know it uses OS fonts and I know it handles things differently from LuaLaTeX. So you may need to tell your system about the TeX fonts. For example, I have the following configuration file
/etc/fonts/conf.avail/09-texlive-fonts.conf
:This is then sym linked from
/etc/fonts/conf.d/
. You then would need to update thefontconfig
cache etc. However, the best way to handle this is to see if your distro has a package which does something similar when its own packages are installed. If it does, just follow the lead of that package, adapting it for an upstream install.Useful commands:
mkfontscale
,mkfontdir
fc-cache
. But check your distro - it may prefer wrappers for some of these commands.Note that my use of
current
may not work for you. You likely need2014
instead.