[Tex/LaTex] Packages CJK versus CJKutf8

cjkfontsunicode

I read texdoc cjk and this CJK documentation recommends \usepackage{CJK} to enable CJK functionality. However, I see a lot of examples use \usepackage{CJKutf8}. The CJK package documentation doesn't recommend, or even mention, CJKutf8. What is the difference between these two?

Best Answer

CJKutf8 package is a part of CJK bundle, it is designed for documents in UTF-8 encoding only, and it actually loads CJK package internally.

The main aim of CJKutf8 package is, to use utf8 option in inputenc package together with CJK package. That is to say, CJKutf8 patches original CJK package to make it work well with inputenc. And it loads inputenc package with utf8 option internally.

Most users do not need to know the technical details. But you can use CJKutf8 to typeset French, German and Chinese in one document easily. That's it.

enter image description here

% !TEX encoding = UTF-8
% !TEX program = pdflatex
\documentclass{article}
\usepackage{CJKutf8}
\usepackage[utf8]{inputenc} % optional
\usepackage[T1]{fontenc}

\begin{document}
% We always use CJK package globally to prevent some bugs.
\begin{CJK}{UTF8}{gbsn}

Without \texttt{CJKutf8} package, the result will be wrong.

Café: 咖啡厅

Gödel: 哥德尔

© 版权所有

\clearpage\end{CJK}
\end{document}