LaTeX and special/chinese unicode characters

Problem:

You want to create a pdf file (with latex) containing some chinese characters.

Solution

My initial idea was that enabling UTF-8 will suffice to include any chinese character to the output pdf:

example.tex
\\documentclass{article}
\\usepackage[utf8]{inputenc}
\\begin{document}
\u4f60\u597d
\\end{document}

however after getting many “Unicode char … not set up for use with LaTeX” errors, I wondered if this would be the right idea. Instead use:

install_latex_cjk.sh
sudo apt-get install latex-cjk-all

to install the latex asian character support packages. The following code will then work, to create a pdf with chinese characters:

cjk_example.tex
\\documentclass[UTF8,nofonts,10pt,a4paper]{article}
\\usepackage{CJKutf8}
\\begin{document}
\\begin{CJK}{UTF8}{gbsn}
\u4f60\u597d
\\end{CJK}
\\end{document}

Check out similar posts by category: LaTeX