I recently migrated to Ubuntu from Mac OS. I installed TexLive and it works. However, fontspec
doesn't work, no matter what fonts I use. This goes for fonts native to Ubuntu and fonts that I have installed in ~/.fonts/
myself. I know that these fonts are installed, because I can use them in LibreOffice
, including those that I have installed myself. However, if I load fontspec
, I invariably get the error:
*************************************************
* LaTeX warning: "xparse/redefine-command"
*
* Redefining document command \oldstylenums with arg. spec. 'm' on line 128.
*************************************************
) (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmr.fd)kpathsea:make_tex: Invalid fontname `[lmroman10-regular]', contains '['
! Font EU1/lmr/m/n/10=[lmroman10-regular]:mapping=tex-text at 10.0pt not loadab
le: Metric (TFM) file or installed font not found.
<to be read again>
relax
l.100 \fontencoding\encodingdefault\selectfont
A M(non)WE is:
\documentclass[utf8,12pt,letterpaper]{article}
\usepackage{fontspec}
\setmainfont[Ligatures={Common,TeX},Contextuals=NoAlternate]{DejaVuSerif.ttf}
\begin{document}
test
\end{document}
I compile in xelatex
(this is necessary since I will want to use CJK).
I've googled and googled and reinstalled TexLive
several times, rebooted the system, etc. I'm out of ideas. All help greatly appreciated!
Best Answer
Your TeX Live installation is faulty or incomplete. It misses the Latin Modern fonts in OpenType format which are necessary for
fontspec
to work, because they are the “fallback fonts”.If you have the “vanilla” TeX Live, use
tlmgr
to install/reinstall(or just the
lm
package). For a TeX Live/Debian, useapt-get
to install all “recommended” packages.In any case, a full install is preferable than adjusting it when things go wrong. Within TeX Live/Debian it's always difficult to understand what Debian package contains what we need.