I would like to type Chinese in TeX compiled with LaTeX. I have read the previous post. As I have to stick on article as documentclass, the following solution works for me so far:
% UTF-8 encoding
% bad-looking fonts (CJKfonts package)
% latex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{gbsn}
文章内容。
\clearpage\end{CJK*}
\end{document}
It annoys me to have to enclose Chinese characters within an environment (CJK*). Isn't there a solution to type Chinese any time and any place we want, just as English characters?
Edit 1:
I tried the following code within Emacs, I use C-c C-c to launch LaTeX command within Emacs:
% Compile with xelatex
% UTF-8 encoding
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
文章内容
\end{document}
It returns an error:
--- TeX said ---
********************************************
* XeTeX is required to compile this document.
* Sorry!
********************************************.
\RequireXeTeX ...********************************}
\endgroup \fi
l.25 \RequireXeTeX
But I have already done sudo apt-get install texlive-xetex, I have also installed texlive-full.
xelatex? – guillem Apr 10 '13 at 10:33xelatexorxetex? I am under Ubuntu, and editing a tex underEmacs... – SoftTimur Apr 10 '13 at 10:42xelatexcommand instead oflatex(don't know how you do that on emacs, but on the command line isxelatex mydoc) – guillem Apr 10 '13 at 11:04xelatexrather thanlatex, or inemacs, if you are usingAucTeX, you can achieve that by adding this code into you.emacsfile:(setq TeX-engine 'xetex)– yanpengl Apr 10 '13 at 11:42