# Bold chinese characters with ctex

I am doing some document with Chinese characters and package ctex

\usepackage[UTF8]{ctex}


However, as soon as I try to typeset something in bold, say

\begin{tikzpicture} \node at (0,0) {\textbf{固态}}; \end{tikzpicture}

I immediately get error

!pdfTeX error: pdflatex.exe (file simhei.ttf): cannot open TrueType font file for reading
==> Fatal error occurred, no output PDF file produced!


Inbetween there are also some warnings

File: CJK.enc 2015/04/18 4.8.4
Now handling font encoding C00 ...
... no UTF-8 mapping file for font encoding C00
Now handling font encoding C05 ...
... no UTF-8 mapping file for font encoding C05
Now handling font encoding C09 ...
... no UTF-8 mapping file for font encoding C09
etc.


I am using miktex.

Now the problem is that all the documentation is in Chinese, but I don't speak any...

• You need font simhei.ttf, which is one of the commercial fonts installed with Windows. Oct 20 '20 at 11:33
• @muzimuzhiZ OK, I have checked, I don't have it (probably because I don't have Chinese Windows). So should I download it (Google found plenty of free SimHei fonts) and put it somewhere in tex font directory and run updmap? Oct 20 '20 at 11:43
• You should be able to install Chinese fonts as an optional feature from the Apps and Features control panel. Oct 20 '20 at 11:50
• If you compile your document with LuaLaTeX, ctex will use luatexja to load fonts, which does have English documentation. Oct 20 '20 at 11:55
• By itself ctex has a fontset= option, which can take the values adobe|fandol|founder|mac|macnew|macold|ubuntu|windows|none Oct 20 '20 at 11:57

The ctex package has a fontset= option, which supports the values

adobe|fandol|founder|mac|macnew|macold|ubuntu|windows|none


On Windows, you can install Chinese fonts as an optional feature from the Apps and Features control panel. This will use SimSun. I compiled in LuaLaTeX rather than PDFLaTeX:

\documentclass{article}
\usepackage[UTF8, fontset=windows]{ctex}

\begin{document}
regular 固态

\textbf{bold 固态}
\end{document}


Examining the source on page 66 of the manual, which, unlike Chinese, I am able to read, ctex defines the command \setCJKmainfont, which you can use to set an arbitrary font. (It also has \setCJKsansfont and \setCJKmonofont.) This would allow someone on another OS to compile your document and get the same output. This works on either LuaLaTeX or XeLaTeX:

\documentclass{article}
\usepackage[UTF8, fontset=none]{ctex}

\setCJKmainfont[Scale=MatchUppercase]{Noto Serif CJK SC}

\begin{document}
regular 固态

\textbf{bold 固态}
\end{document}


However, if neither of us can read a manual in Chinese, it is highly likely that all we really need (or I am capable of) is to copy-and-paste some short Chinese phrases into a document in our native language. The babel package is good for that. This requires LuaLaTeX:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{fontspec}

\babelprovide[import=zh-Hans, onchar=ids fonts]{chinese}
\defaultfontfeatures{ Scale=MatchUppercase, Ligatures=TeX }
\babelfont{rm}
[Ligatures={Common,Discretionary}, Scale=1.0]{New Computer Modern Book}
\babelfont[chinese]{rm}
{Noto Serif CJK SC}

\begin{document}
regular 固态

\textbf{bold 固态}
\end{document}


It even can switch between Simplified Chinese, Traditional Chinese, Japanese Kanji, and more, in the same document.

In your comment, you mention that you ran into one of the big problems with babel: many of its package options are obsolete, and you must use \babelprovide to load some languages instead. As I write, Javier Bezos is currently updating the documentation to warn users about this.

• Such a nice one +1 Oct 20 '20 at 14:03