[Tex/LaTex] typing chinese character in texmaker on Mac OS X

macmactextexmaker

I would like to use Chinese characters in TexMaker on Mac OS X (using latest mactex). It appears not to be supported OOTB, any Chinese characters appears as a series of "▯▯▯▯▯". I do have the chinese input sources on the mac of course, and I tried using different font in texmaker.

I tested on windows and the same version of texmaker is able to type chinese characters.

Any idea how to make it work on Mac?

Best Answer

actually I didn't use TexMaker on Mac before. I use TexShop and I thinks it is convenient to use to type in Chinese. If you use TexShop, please set your unicode to UTF-8 in preference.

Here is the code for reference:

\usepackage[T1]{fontenc}
\usepackage{xeCJK}
\setCJKmainfont{BiauKai}
\newCJKfontfamily\Kai{魏碑-繁}       % Set main font in your document.
\newCJKfontfamily\ChCal{行楷-繁}     % Set a new font so that you can 
\newCJKfontfamily\ChBlack{蘭亭黑-繁} % change the font in the document. 
\XeTeXlinebreaklocale "zh"          % Following set to break line automatically.
\XeTeXlinebreakskip = 0pt plus 1pt 
\usepackage{xltxtra,xunicode}

\begin{document}
     中文字測試
\end{document}

If you'd like to change your font, just use

\ChCal{行楷-繁}

command, for example.

In TexShop, you can use the font directly installed on your Mac. You don't need to download another set of font, like CJK font by Han-tsong Wang.

Related Question