pdflatex.log
\documentclass{ctexart}, ctexbook, ctexrep, ctexbeamer, or
\usepackage{ctex}) and it was compiled with pdfLaTeX. Compile it with XeLaTeX instead. The
document itself does not need to change.
The font number and size in the message (unisong30 at 632 above) vary with the document and
its font size. Every variant has the same cause and the same fix.
Why pdfLaTeX fails
ctex loads its Chinese fonts from a font set. In TeX Live 2026 on Linux, which is the environment the examples on this page are compiled in, ctex selects the Fandol font set. That font set needs XeLaTeX or LuaLaTeX, so under pdfLaTeX ctex reportsCTeX fontset `fandol' is unavailable in current mode and falls back to the old unisong
font names of the CJK package. TeX Live does not include those fonts, so pdfTeX stops with a
fatal error and writes no PDF.
The first message is the cause. The unisong message is the consequence, and it is the one most
logs show last.
Minimal failing example
ctex-pdflatex.tex
Fix: compile with XeLaTeX
Change the compiler, not the document. The same source compiles with XeLaTeX:ctex-xelatex.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
On the command line, run xelatex main.tex or latexmk -xelatex main.tex instead of
pdflatex main.tex. LuaLaTeX (lualatex main.tex) also compiles this document.
If you must stay on pdfLaTeX
Some journal or university templates only build with pdfLaTeX. In that case, do not load ctex. Use theCJKutf8 package with a font that TeX Live ships, such as gbsn (Simplified Chinese,
Song style), gkai (Simplified Chinese, Kai style), or bsmi (Traditional Chinese):
cjkutf8-pdflatex.tex
目录, 参考文献)
and the \zihao font-size command are not available, so prefer XeLaTeX whenever the template
allows it.
The same error with the CJK package
\begin{CJK}{UTF8}{song} fails under pdfLaTeX in the same way, with a different font name:
pdflatex.log
song with gbsn, or switch to XeLaTeX and ctex.
In LaTeX Cloud Studio
- The project’s LaTeX Engine setting defaults to Auto (Recommended). With Auto, a
document that uses
ctex,ctexart,ctexbook,ctexrep,ctexbeamer,xeCJK,fontspec, orpolyglossia, or calls\setCJKmainfont, compiles with XeLaTeX. Packages loaded from your own.styand.clsfiles count too, and commented-out lines are ignored. - Documents that use
luatexjaor theltjs*classes for Japanese compile with LuaLaTeX. - If the engine is set to PDFLaTeX explicitly, that choice is kept and the compile fails. The
Problems panel then shows
Chinese font unisong30 is not available for pdfLaTeX. Open the project Settings, and under General set LaTeX Engine to Auto (Recommended) or XeLaTeX.
Related pages
- LaTeX in Chinese: set up a Chinese document with XeLaTeX and xeCJK
- Compiler and engine errors:
fontspecand other engine mismatches - Choosing a compiler: pdfLaTeX, XeLaTeX, and LuaLaTeX compared
- LaTeX in Japanese
- Emergency stop: when the compile stops before
\end{document} - Troubleshooting center
