I’m using $$\LaTeX$$ for a quite long time. And for the most of time, I used it to typeset English materials. And since it gives me a way of writing non-ASCII characters using pure ASCII characters, I really enjoy it.

Recently I’m starting to use ctexart in order to typeset Chinese texts. And I found that there are many configurations I needed to tune in order to get the right effects (which one isn’t?). Well, actually it’s not a fair opinion to say to ctexart. It has simplified the entire workflow already. At least, I can use all the standard packages without a single problem.

You can find a complete documentation from here.

### Select The Right Compiler

In principle, on major Linux distributions and Windows, you can use most of compiling sequence to work with ctexart. However, the way of OSX handling fonts is a nightmare. This particular situation made me to use XeLaTeX instead. Honestly, I don’t have any hard feeling of using XeLaTeX, I’m just feeling more comfortable when I use LaTeX or PDFLaTeX as my default compiling sequence.

### Configure Fonts on OSX

1\setCJKmainfont[BoldFont=STHeiti, ItalicFont=STKaiti]{STSong}
2\setCJKsansfont[BoldFont=STHeiti]{STXihei}
3\setCJKmonofont{STFangsong}


### Define a Custom Framed Box

 1\newcounter{faqbox}[section]
2\renewcommand{\thefaqbox}{\thechapter.\arabic{faqbox}}
3\usepackage[framemethod=TikZ]{mdframed}
4\newenvironment{faqbox}[1][]{
5    \refstepcounter{faqbox}
6    \begin{mdframed}[
7        frametitle={FAQ \thefaqbox\ #1},
8        skipabove=\baselineskip plus 2pt minus 1pt,
9        skipbelow=\baselineskip plus 2pt minus 1pt,
10        linewidth=0.5pt,
11        frametitlerule=true,
12        frametitlebackgroundcolor=gray!30
13    ]
14}{
15    \end{mdframed}
16}


### Custom Chapter Display Style

You can use titlesec to redefine the specific style of your chapter’s style.

 1\titleformat
2{\chapter} % command
3[display] % shape
4{\bfseries\Large} % format
5{第 \ {\Huge\thechapter} 章} % label
6{0.5ex} % sep
7{
8    \rule{\textwidth}{1pt}
9    \vspace{1ex}
10    %\centering
11} % before-code
12[
13%\vspace{-0.5ex}%
14%\rule{\textwidth}{0.3pt}
15] % after-code