Chinese typing on mac

ctex bundle use Chinese fonts for Windows by default. You can use the fonts installed in Mac.

% !TEX program = XeLaTeX
% !TEX encoding = UTF-8
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont[BoldFont=STHeiti,ItalicFont=STKaiti]{STSong}
\setCJKsansfont[BoldFont=STHeiti]{STXihei}
\setCJKmonofont{STFangsong}

\begin{document}
文章内容。
\end{document}

There is nothing much to summerize, just change the fonts following the xeCJK manual. On Mac OS X, STSong and other SinoType fonts are preinstlled.

Alternatively, you can also use free Fandol fonts for Chinese documents, which are preinstlled in latest TeX Live (MacTeX).

% !TEX program = XeLaTeX
% !TEX encoding = UTF-8
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont[BoldFont=FandolSong-Bold.otf,ItalicFont=FandolKai-Regular.otf]{FandolSong-Regular.otf}
\setCJKsansfont[BoldFont=FandolHei-Bold.otf]{FandolHei-Regular.otf}
\setCJKmonofont{FandolFang-Regular.otf}

\begin{document}
文章内容。
\end{document}

We plan to release a new version of ctex bundle later this year, which provides more font sets for those Mac OS X and Linux users.


According to this blog, the following tex file is work for me on my MAC with the TeXShop.

\documentclass{article}

\usepackage{CJKutf8}

\begin{document}
\begin{CJK}{UTF8}{gbsn}
文章内容。

Contents of the article.
\end{CJK}
\end{document}

Things are much improved for the current version of ctex (from TL2015 and later).

If you use \documentclass{ctexart} and compile it with XeLaTeX or LuaLaTeX, the package will detect the OS it's running on, and use Chinese fonts pre-installed on the system. If it doesn't get it right, you can pass in the fontset option to help it along:

\documentclass[fontset=ubuntu]{ctexart} % Uses the Arphic fonts
\documentclass[fontset=mac]{ctexart}
\documentclass[fontset=windows]{ctexart}

And if you have the relevant fonts installed on your OS:

\documentclass[fontset=adobe]{ctexart}
\documentclass[fontset=fandol]{ctexart}

The ctex bundle actually includes the Fandol fonts, but this is installed by default in the TEXMF tree only, not in the operating system's fonts. Therefore you may run into problems if you use XeLaTeX with the fandol option, because XeLaTeX doesn't support/use fontconfig. However! all is well if you compile with LuaLaTeX.

For all these options, the most important font families \songti, \heiti, \kaishu are available. \fangsong is unavailable in ubuntu, while windows has extra \youyuan and \lishu.

Tags:

Cjk

Texshop