# critical package ctex error:ctex fontset"fandol" is unavailable in current

I am trying to use some Chinese characters in my Latex document(But it is not entirely in Chinese) and this is the website that I came across. According to the author, all I need is to use ctex package, but when I copy paste the example code in his website it failed to compile with the error message critical package ctex error:ctex fontset"fandol" is unavailable in current I wonder what went wrong? And if his method is incorrect, I wonder if there is another way that allow me to type Chinese successfuly. (I can not change the documentclass as I am trying to use a poster theme template and the documentclass ,I assume, is predefined.)

MWE:

\documentclass[UTF8]{ctexart}
\usepackage[T1]{fontenc}

\begin{document}

\end{document}


edit: include the error message and picture edit2: uploaded the wrong one. inlcude the correct picture[!

• your example works for me with pdflatex + windows + a current texlive. May 22 '20 at 14:04
• added the picture. It is not compilable on my Macbook. Do you think it has anything to do with font selection on my local computer? But it also failed to compile on overleaf. May 22 '20 at 14:11
• You are using xelatex, so remove \usepackage[T1]{fontenc}. Beside this: "warning" is a warning/info not an error. Check if the output is okay. May 22 '20 at 14:23
• Sorry I uploaded the wrong picture. You are right it is compilable using XeLaTex, But when I tried to compile it on LaTex, the compilation was not successful. Would you be kind enough to point out what went wrong? I am not sure my other code, which was written with Latex in mind, can be compiled in XeLaTex without any problem. May 22 '20 at 14:59
• try to set another fontset, see tex.stackexchange.com/a/284933/2388 May 22 '20 at 15:26

You cannot use pdflatex to compile Chinese documents that specify fandol fonts because

Using Fandol Chinese fonts, pdfLaTeX is not supported.

Reference texdoc ctex, sec 4.3中文字库

You may need to install other Chinese fonts, such as: Source Han Serif

• I don’t understand when did I specify that May 22 '20 at 15:21
• @jxhyc If a fontset value is not specified, the CTEX macro set will automatically detect the operating system used by the user and configure the appropriate font. So Overleaf specifies by default that fandol, Mac OS X compiler Chinese is not available under pdflatex. May 22 '20 at 15:25

This works for me

if your content goes like this

\documentclass{article}
\usepackage[UTF8]{ctex}
\begin{document}
中文输入
\end{document}


Just add this line %!TEX program = xelatex to the top of your TeX file like this:

%!TEX program = xelatex
\documentclass{article}
\usepackage[UTF8]{ctex}
\begin{document}
中文输入
\end{document}