25

I am running TeXLive 2016 on a Windows 7 machine. In the past, when I ran XeLaTeX on a new file that used mathspec, the first compilation would take a long time, regardless of the length of the document. (For what it's worth, I am using the Calibri font.) Watching the Build Output scroll by (using TeXnicCenter), there would always be a pause on the line

xelatex> (c:/texlive/2016/texmf-dist/tex/latex/euenc/eu1enc.def)

which comes right before the line

xelatex> (c:/texlive/2016/texmf-dist/tex/latex/euenc/eu1lmr.fd).

After this first compilation, xelatex would run fast, comparable to pdflatex (if I didn't use mathspec).

Now it hangs at this spot all the time, adding 20+ seconds to each compilation. Is there something that I can do to speed this up?

EDIT: On the advice from the comment, I ran a process monitor and it seems that xelatex.exe is reading every font in my fonts directory. Is there a way to keep that from happening?

7
  • 1
    I see the slow down too but as it gets faster on the next compilations for me it is difficult to debug. You could try a process monitor technet.microsoft.com/en-gb/sysinternals/processmonitor to identify what is happening at the slow down. Aug 17, 2016 at 16:40
  • 1
    I have texlive 2014 & 2016 installed on my machine, and have been using 2016 for a short while. This problem just started this week. When I use 2014, the problem is gone.
    – GregH
    Aug 18, 2016 at 18:28
  • For anyone who has a similar problem: my resolution was to uninstall TeXLive 2016 and reinstall it. The problem seems to be gone now.
    – GregH
    Aug 22, 2016 at 15:13
  • 1
    Did you reinstall w/ 2014 or 2016? I'm having this same problem too.
    – Daniel
    Aug 28, 2016 at 14:28
  • @Daniel I un- & re-installed 2016. Fixed the problem ... and it is still fixed. Hope it works for you.
    – GregH
    Aug 28, 2016 at 19:35

5 Answers 5

29

I've been wrestling with the same issue too after upgrading TeXLive from 2013 to 2016. Each compilation started to take over a minute and the process monitor showed a lot of font files being read.

Running fc-cache.exe from the LaTeX distribution's bin folder (as indicated by the comment above) fixed the issue without reinstalling TeXLive.

Please note that the distribution's texmf-var\fonts\cache folder needs to be writeable to the user running fc-cache.exe.

7
  • 1
    I've marked this as the answer though I haven't verified it (yet-hope I won't need to!) Seems a much less drastic solution over reinstalling all of TeX.
    – GregH
    Aug 31, 2016 at 20:11
  • 2
    The problem reappeared for me, and I tried running fc-cache.exe. That didn't work, as I received errors related to permissions. I ran it again as an administrator, and it ran successfully but didn't fix the problem. My next solution, which I will list as an official answer, is to run xelatex.exe as an administrator always. See answer for details.
    – GregH
    Sep 12, 2016 at 18:18
  • The solution (running fc-cache.exe) worked for me. xelatex runs much faster now.
    – djhurio
    Mar 1, 2017 at 16:04
  • 1
    Running the fc-cache.exe also solves my problem. I have verified that each time a font is installed or removed, we should run the fc-cache.exe command in order to rebuild the font cache. After the rebuilding process, the compilation time using xelatex returns to normal state.
    – jdhao
    Mar 6, 2017 at 10:26
  • Hi, I want to ask what's the corresponding directory in MikTeX for texmf-var\fonts\cache? :)
    – Eric
    Jun 19, 2017 at 17:40
5

Another solution is to change the properties of xelatex.exe so that it runs as administrator always. (Right click on the file in the bin\win32 folder, then click on the Compatibility tab, and click box at bottom to "Run this program as an administrator.")

This then required that I elevate TeXnicCenter to run as administrator, too. After making these changes, the problem may go away.

4
  • Why would this help?
    – Ziyuan
    Nov 2, 2016 at 20:27
  • I tried this and now I get an error Error : could not start the command : xelatex -synctex=1 -interaction=nonstopmode "test2".tex
    – ಠ_ಠ
    May 13, 2017 at 1:25
  • Did you elevate your text editor to run as administrator, too? One reason I tried using this was that running fc-cache.exe stopped with an error saying I didn't have proper permissions or access or something. Running as admin fixed that. But it didn't seem to fix everything, so I also did this. Changing your text editor to run as admin is also annoying at times; my machine asks me every time I open it if I really want to.
    – GregH
    May 13, 2017 at 10:55
  • 1
    After running fc-cache, the problem was not solved for me. But running texworks as administrator after that solved my issue. Aug 16, 2019 at 14:02
3

This is similar to what has already been posted, but not identical, so here goes.

If none of the other answers are working for a future reader, try running fc-cache -f (thanks to Hao and Ulrike Fischer for this solution) in a directory that looks something like D:\texlive\2016\bin\win32 (which is exactly what it was on my machine, I run Win10) or -- provided your PATHa is set to it -- anywhere else on your computer will do just fine. This worked for me.

This solution seems to not have worked in another, still unresolved case.

a: If you don't know what that means, don't worry about it right now. You can worry about that when you try to install the newest vanilla TexLive and have to set your paths manually. Which is fun to do, provided you have time to learn the ways of the jedi.

2

Uninstall and reinstall TeXLive 2016. I don't know why that works, but it seems that it may fix the problem for some users.

3
  • Just realized that's maybe not the root of the problem. The problem returned after I installed a new font. I tried updating the cache with fc-cache -fv but the compiler hangs at eu1lmr again :(.
    – Daniel
    Aug 28, 2016 at 21:04
  • Sorry your problem came back. Was pretty sure the reinstall was a fix that really didn't address what was really going wrong - but at least it worked. Still very open for the "real" solution.
    – GregH
    Aug 29, 2016 at 10:39
  • Seems like the problem recurs (at least for me) whenever system fonts are added/removed/changed. The problem goes away if I run cmd in administrator mode, then use the command fc-cache -fv, followed by a system restart.
    – Daniel
    Aug 30, 2016 at 19:33
0

I am using TeXStudio as the text editor for TeXLive 2016 in Windows 10. I tried all the above solutions. However just fc-cache -fv worked for me. Just this command inside cmd could update texmf-var\fonts\cache and the rest has no effect, even when I just dropped the v (It is for writing on the terminal).

Please make sure to use cmd with Administrator access and not PowerShell. However the last provided command worked inside PowerShell, but fc-cache -f has no output there in contrast with cmd although it was not asked to be verbose!

However, I should mention that the speed-up is not permanent, It should be repeated every six-month (at least this is how it works for me!).

I also should mention that I have never experienced this issue while using TeXWorks, although it uses the same xelatex version.

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.