13

I try to compile a document that is written in Chinese using xelatex. But I find that the compiling speed is insanely slow: after about 1.14 minute, the final pdf file is generated. Here is a MWE:

\documentclass{article}
\usepackage{xeCJK}
\begin{document}
 测试
\end{document}

If I change the Chinese version to English version (e.g., simply replace 「测试」 with "test"), it makes no difference and the compiling time is more or less the same.

If I comment out \usepackage{xeCJK} and compile the English version using pdflatex. The compilation speed is fast (around 1.5 seconds).

How to solve this problem? Ps, I am using a Windows 8.1 machine.

2

1 Answer 1

14

After some search in the internet and tex.sx, I finally know the cause. I have installed a new font into my computer a few days ago but have not run the fc-cache program. Following the post here, here is the solution: go the directory where the Texlive bin resides (in my computer, it is D:\texlive\2016\bin\win32) and execute fc-cache -f (if fc-cache is on system PATH, then you do not have to go to that directory.). It should takes a few seconds or minutes. Then open the cmd and compile your tex file again, you will find that the compiling time is acceptable now.

Also, I have verified that we should run fc-cache -f every time a font is installed or removed. Then the compiling time using xelatex should be normal.

8
  • 1
    I had to use fc-cache -f to force the recreation. fc-cache alone didn't work for me. And if you call fc-cache on a command line you don't have to go to the bin-folder, like the other tools, fc-cache is in your path. Mar 6, 2017 at 10:55
  • @UlrikeFischer, on my computer, simply execute fc-cache.exe works. But I do agree that using fc-cache -f is safer :)
    – jdhao
    Mar 6, 2017 at 11:10
  • I don't doubt that it worked for you ;-). I only added the comment in case someone else has to use -f to. Mar 6, 2017 at 11:33
  • 2
    I need to run fc-cache.exe as administrator on my Windows 7 machine for it to work properly. And sometimes I need to run it even though I haven't (un)installed any fonts. At seemingly random times xelatex runs slow and this fixes my problem, regardless of whether or not I'm using fontspec and friends.
    – GregH
    Sep 4, 2017 at 12:34
  • 1
    @JasperMay Use TexLive.
    – jdhao
    Jan 11, 2020 at 10:13

You must log in to answer this question.

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