0

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}

enter image description here 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. – Ulrike Fischer May 22 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. – jxhyc May 22 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. – Ulrike Fischer May 22 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. – jxhyc May 22 at 14:59
  • try to set another fontset, see tex.stackexchange.com/a/284933/2388 – Ulrike Fischer May 22 at 15:26
0

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

使用Fandol中文字体,不支持pdfLaTeX。

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

| improve this answer | |
  • I don’t understand when did I specify that – jxhyc May 22 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. – sikouhjw May 22 at 15:25

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.