For some reason the inclusion of the fontspec package causes XeLaTeX to not compile properly.

Here is an MWE (inspired by Rob Hyndman):





If I remove the the fontspec package, everything works fine. With it, I get lots of errors and the resulting PDF has the following text on top:

require(’luaotfload-main’) local v oid = luaotfload.main()

The FileList in the .log file is:

 article.cls    2014/09/29 v1.4h Standard LaTeX document class
 size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 lipsum.sty    2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text
fontspec.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
  expl3.sty    2012/04/23 v3570 L3 Experimental code bundle wrapper
l3names.sty    2012/03/04 v3494 L3 Experimental namespace for primitives
l3bootstrap.sty    2011/12/29 v3110 L3 Experimental bootstrap code
   etex.sty    2016/01/11 v2.6 eTeX basic definition package (PEB,DPC)
  color.sty    2016/01/03 v1.1b Standard LaTeX Color (DPC)
  color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
xetex.def    2015/09/11 v4.06 LaTeX color/graphics driver for XeTeX (TeX  Live/RRM/JK)    
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
 graphics.sty    2016/01/03 v1.0q Standard LaTeX Graphics (DPC,SPQR)
   trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
l3basics.sty    2012/03/04 v3491 L3 Experimental basic definitions
l3expan.sty    2012/02/26 v3460 L3 Experimental argument expansion
   l3tl.sty    2012/03/04 v3490 L3 Experimental token lists
  l3seq.sty    2012/03/04 v3490 L3 Experimental sequences and stacks
  l3int.sty    2012/03/04 v3490 L3 Experimental integers
l3quark.sty    2012/02/12 v3384 L3 Experimental quarks
  l3prg.sty    2012/03/04 v3490 L3 Experimental control structures
l3clist.sty    2012/03/04 v3490 L3 Experimental comma separated lists
l3token.sty    2012/03/04 v3491 L3 Experimental token manipulation
 l3prop.sty    2012/03/04 v3490 L3 Experimental property lists
  l3msg.sty    2012/04/23 v3568 L3 Experimental messages
 l3file.sty    2012/03/09 v3520 L3 Experimental file and I/O operations
 l3skip.sty    2012/03/05 v3499 L3 Experimental dimensions and skips
 l3keys.sty    2012/03/03 v3487 L3 Experimental key-value interfaces
   l3fp.sty    2012/03/04 v3490 L3 Experimental floating-point operations
  l3box.sty    2012/03/04 v3490 L3 Experimental boxes
l3coffins.sty    2012/03/03 v3482 L3 Experimental coffin code layer
l3color.sty    2011/09/07 v2776 L3 Experimental colour support
l3luatex.sty    2012/02/09 v3355 L3 Experimental LuaTeX-specific functions
 xparse.sty    2012/04/23 v3570 L3 Experimental document command parser
luaotfload.sty    2015/12/09 v2.6 OpenType layout system
fontspec-luatex.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX

 eu2enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
 eu2lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many   other characters in Unicode lower plane
  eu2lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
  graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
  t3cmr.fd    2001/12/31 TIPA font definitions
  • 1
    Unrelated to the question, but \setromanfont is deprecated. You should use \setmainfont instead. Apart from that your MWE compiles fine for me. Is your TeX distribution up-to-date? (tex.stackexchange.com/questions/55437/…) – Benjamin Feb 24 '16 at 16:43
  • Thanks - edited and replaced the deprecated command. I thought that my MikTex distribution was up-to-date. I just ran the update and there were a bunch of packages that needed an update. After the update it still doesn't work but the error messages are different. At the top of my PDF the following text has been added: require(’luaotfload-main’) local v oid = luaotfload.main() require(”fontspec”) Ligatures=Common GeorgiaTahomaEU2 – Felix Thoemmes Feb 24 '16 at 16:53
  • @felize2000 This looks a lot like xetex not being detected properly. What versions of the packages and xetex are you using? – Henri Menke Feb 24 '16 at 17:03
  • I can replicate the problem on my system (MacTeX2015 under MacOSX 10.11.3), i..e, the MWE won't compile under XeLaTeX. Interestingly, though, the MWE compiles just fine under LuaLaTeX. It could be that you've stumbled onto a bug in fontspec or in one or more of the packages that are loaded by fontspec. – Mico Feb 24 '16 at 17:11
  • 1
    'Works for me' with an up-to-date system. Can you add \listfiles to your input and edit the resulting File list from the .log into the question. – Joseph Wright Feb 24 '16 at 17:13

SOLVED: Based on egreg's comments about outdated packages involving l3packages and others, I uninstalled these packages in the package manager, and then deleted the subfolders of these packages from the MikTeX folder. Re-compiling now produces a perfect PDF (even when using \setmainfont{Georgia}).

Thanks everybody!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.