I'm using TexStudio 2.5.1 on Windows 7 with MiKTeX. The following brief .tex file will cause xelatex to hang:


Using this command to compile:

xelatex.exe -synctex=1 -interaction=nonstopmode "test".tex

By 'hang', I mean that the xelatex process will take up an entire core and 200+ MB of memory, and not finish after several minutes. I get no error messages because the process never finishes.

If I comment out the fontspec line, it doesn't hang. But I'd like to use the fontspec package in my document. Why does it hang and how can I fix it?

As a side note, using lualatex instead of xelatex will succeed, but then using \setmainfont{Georgia} will make that hang as well.

  • 1
    Welcome to TeX.SE! You mention the operating system (Windows 7) and front end (TeX Studio) you use; which TeX distribution do you use? This may be important -- e.g., I use MacTeX2012 running under MacOSX 10.8.2, and your MWE (with or without the \usepackage{fontspec} directive) compiles just fine under XeLaTeX on this system. Incidentally, since you use TeXStudio, why are you issuing compile directives from a command line? And, have you tried executing "xelatex test" from the command line?
    – Mico
    Dec 13, 2012 at 2:26
  • @JeffE Have you configured your default compiler to be XeLaTeX?
    – hpesoj626
    Dec 13, 2012 at 2:35
  • @hpesoj626 - I apologize for not making one of my questions clear enough: I wasn't asking how to configure TeXstudio, but why the OP doesn't seem to be using TeXstudio's front-end capabilities to compile the .tex file.
    – Mico
    Dec 13, 2012 at 3:10
  • @Mico: Sorry, I forgot to mention -- I'm using MiKTeX (latest version). I did actually use the built-in compile tool, I only pasted the command line in case it was relevant. xelatex test eventually gives me ! Undefined control sequence.
    – Jeff
    Dec 13, 2012 at 3:41
  • 1
    @Speravir: Thanks, it didn't occur to me that it was updating the font cache. I just needed to let it run its full course. If you post that as an answer I'll accept it.
    – Jeff
    Dec 13, 2012 at 4:09

1 Answer 1


fontspec uses a font caching system. This cache needs to be created first and later updated on a regular basis. Upon creation or updating some information about all TrueType and OpenType fonts installed in your TeX distribution and in your operating system is collected.
(About the algorithms behind collecting and updating, how often or some kind of trigger or so, an expert has to answer.)

Depending on, how many fonts you have installed, these operations take some time, especially on the very first run, of course. That’s the reason, why you observed the hanging in both xelatex and lualatex.

  • Thanks for the info: it started compiling a single page document ten minutes ago and it's still running O_o I must have too many fonts installed :-/
    – m-r-r
    Oct 1, 2014 at 9:35
  • Ah, the old "verbosity is for less hardcore programs".
    – Gustaphe
    Mar 23, 2017 at 14:49

You must log in to answer this question.

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