3

I have just installed MacTex and I am running this simple program:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{dejavu}

\begin{document}

\setsansfont{DejaVu Sans}
\setromanfont{DejaVu Serif}
\setmonofont{DejaVu Sans Mono}

\begin{abstract}
This is the paper's abstract \ldots
\end{abstract}

\section{Introduction}
This is time for all good men to come to the aid of their party!

\end{document}

When I run this command : xelatex simple.tex I get:

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./simple.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/local/texlive/2016/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3enc.def
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/xelatex/xetex-def/xetex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))))
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/dejavu/dejavu.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/dejavu/DejaVuSansMono.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/dejavu/DejaVuSans.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/dejavu/DejaVuSerif.sty))
(./simple.aux) (/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3cmr.fd)

LaTeX Font Warning: Font shape `EU1/DejaVuSerif-TLF/m/n' undefined
(Font)              using `EU1/lmr/m/n' instead on input line 6.

kpathsea:make_tex: Invalid fontname `DejaVu Sans', contains ' '

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "DejaVu Sans" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.8 \setsansfont{DejaVu Sans}

I opened up my TexLive Utility to see if the dejavu package is installed and it is.

What is going on here?

2

On Mac OS xetex + fontspec will not find OpenType fonts from the TeXLive tree if you use font names:

  • either use filenames,

  • or (simplest and recommended by some) copy over those fonts you need to a location recognized by MacOS, thus ~/Library/Fonts

  • or add a symlink inside ~/Library/Fonts, this is what I have done once and for all, I add two symlinks with targets respectively /Library/TeX/Root/texmf-dist/fonts/opentype and /Library/TeX/Root/texmf-dist/fonts/truetype. This assumes a "texdist" like structure is present. I understand it is now implemented via TeXLiveUtility in MacTeX, but as MacTeX has decided for TL2017 to drop MacOSes like Mavericks, I am not MacTeX user anymore hence I am not 100% sure these locations (themselves symlinks) exist under the above names. This set-up needs no yearly update. It does not create issues with LuaLaTeX either as the latter (via luaotfload) is (since some time, it wasn't though further back in the past) able to trim its database of fonts from duplicates originating in finding same fonts both in directly in TeXLive tree and indirectly via the two user added symlinks above to official MacOS location, targeting TeXLive tree repertories.

1

kpathsea:make_tex: Invalid fontname `DejaVu Sans', contains ' '

It says that your font name has space

For Ubuntu, if in case dejavu is indeed missing install it using:

sudo apt install fonts-dejavu*

Or install all texlive fonts

sudo apt install texlive-fonts-recommended
sudo apt install texlive-fonts-extra

I also found dejavu font here https://ctan.org/pkg/dejavu. I was able to download the zip file containing required files but I didn't install it because texlive-fonts-extra fixed the 'DejaVuSans.sty' missing issue on my computer. But if you want to install it check out this blog : https://nathanvan.wordpress.com/2012/06/14/managing-latex-packages-manually-in-ubuntu-12-04/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy