TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '12 at 2:26
@JeffE Have you configured your default compiler to be XeLaTeX? – hpesoj626 Dec 13 '12 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 '12 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 E Dec 13 '12 at 3:41
@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 E Dec 13 '12 at 4:09
up vote 5 down vote accepted

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.

share|improve this answer
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 '14 at 9:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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