# How to debug hanging xetex compilation

I'm experiencing a weird problem. After updating my MikTeX installation my thesis document no longer compiles. Compilation (with xelatex) hangs and takes up all of one of my CPU's cores.

However, if I take out one particular chapter (the chapters are in separate .tex files which I load with \input) compilation completes without any problems.

But, when I compile that particular chapter separably compilation also completes without problems. In other words, the problem does not seem to be caused by the chapter itself, but rather by some combination of factors. Also, I must stress that things worked fine until I updated MikTex.

Does anyone have any ideas on what might be causing this? Or maybe just some pointers on how I could debug this situation?

EDIT (1)

(removed, the problem was not related to images after all)

EDIT (2)

I did more research and it turns out it has something to do with greek letters in math mode.

I have traced to problem to a few math expressions (between $-signs) containing \mu and \alpha. These are in the aforementioned chapter. If I comment out these expressions (or just remove \mu and \alpha from them) my whole thesis compiles without problem (so including the problematic chapter). What makes this extra strange is that when I compile this chapter (with the \mu and \alpha expressions) in isolation -- by commenting out the loading of all other chapters in my master file -- everything works and the mu's and alpha's look fine in the pdf. My guess it this might be a memory problem. Maybe some sort of font cache can not load the greek glyphs because it is already full with all the glyphs used elsewhere in my thesis. Does this make any sense? Providing a MWE for this problem is hard because it simply does not seem to occur when the input is "minimal". However, this might be a relevant section of my preable: \usepackage{amsmath,amsfonts,amssymb} %MATH FONT: Iwona Light \usepackage[light,math]{iwona} %for basic math symbols %AMS Blackboald (mathbb) font (used for mathematical fields) \DeclareSymbolFont{AMSb}{U}{msb}{m}{n} \protected\def\mathbb#1{{\mathchar\numexpr256*\symAMSb+#1\relax}} \usepackage{mathspec} %Also loads fontspec(!) \defaultfontfeatures{Ligatures=TeX,Scale=MatchUppercase,Numbers={Lining,Proportional}} %MAIN FONT and MATH digits and latin letters: Computer Modern Unicode (CMU) Bright (loaded by filenames to force use of OpenType versions) \setallmainfonts(Digits,Latin)[BoldFont={cmunbbx.otf},ItalicFont={cmunbmo.otf},BoldItalicFont={cmunbxo.otf}]{cmunbmr.otf} %MATH greek letters: Greek font is Iwona Light (loaded by filenames to force use of OpenType versions) \setmathsfont(Greek)[BoldFont={Iwona-Bold.otf},ItalicFont={IwonaLight-Italic.otf},BoldItalicFont={Iwona-BoldItalic.otf},Numbers={Lining,Proportional}]{IwonaLight-Regular.otf} %SANS FONT: idem (no need to set it because CMU Bright already is a sans serif font) %MONOSPACE (typewrite) FONT: CMU Typewriter Text Light \setmonofont[Scale=MatchLowercase]{CMU Typewriter Text Light} \usepackage{xltxtra} %also loads xunicode - The following is not an answer but a comment. I use texlive, but experienced very similar issues to the ones you reported after I updated texlive over the weekend. Late last week there were some updates to the l3* packages and fontspec, but the update to mathspec was delayed until Monday or Tuesday. Because the updates were out of sync, so to say, problems arose. Since running the texlive updater again (early yesterday), everything's back in fine working order. In short, you may have to update your miktex installation again after the packages in question have been incorporated. – Mico Sep 22 '11 at 13:24 Thanks for your command Mico. As I am using mathspec and fontspec this could indeed be the reason... Checking for MikTex updates again... – Matthias Sep 22 '11 at 13:27 I'll keep my fingers crossed for your sake that getting the next update to the fontspec and mathspec files will do the trick. :-) – Mico Sep 22 '11 at 13:43 Unfortunately updating MikTex did not help. There where 2 package updates, but not for mathspec or fontspec. Also I checked and mathspec wasn't updated in MikTex since late 2009 and the last version on CTAN is also from that period. – Matthias Sep 22 '11 at 13:46 I suggest also to look at this thread – egreg Sep 22 '11 at 18:01 ## 1 Answer I was able to fix the problem with these 2 steps (both were necessary): • stopped using \setmathsfont(Greek){Iwona Light} (instead I rely only on \usepackage[light,math]{iwona} which was loaded anyway for symbols/largesymbols/etc. and also applies to greek letters like \alpha) • avoided all used of mathspec's "-feature (for custom spacing in math mode) The compilation problem has not occurred ever since. I should note that mathspec's "-'feature' was also mentioned as the source of xetex compilation hanging in the thread egreg referred to in the comments above. The only downside of no longer using \setmathsfont(Greek) was that I could no longer type greek letters as unicode characters (so αβ instead of \alpha\beta). However I was able to fix that by making all greek characters active (based on their unicode-code) and replacing their occurances with the relevant math command, like so: \catcode\^^^^03b1=13 \let^^^^03b1=\alpha \catcode\^^^^03b2=13 \let^^^^03b2=\beta` I got the idea from this blogpost: http://uucode.com/blog/2010/03/26/unicode-math-in-xelatex I made a custom package (which I may release online if there is interest) in which I did this for all greek letters (upper & lower case). Also, the package makes it possible to use the greek chars in math AND text mode (by auto-wrapping a$-pair around the \alpha, \beta, ... when greek unicode chars appear in text mode).

I realize a better way to do this would be to use unicode-math, but I don't really like any of the fonts which work with that package (because there is no sans serif font afaik).

-