Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I found the post How does one type Chinese in LaTeX? about how to typeset Chinese in Latex. I just encountered the same problem, and my questions are:

1.To type Chinese or Japanese, I have to have some particular packages (such as CJK/XeCJK) installed, don't I?

2.I'm confused by the first solution in that post, it looks like this:

% UTF-8 encoding
% Compile with latex+dvipdfmx, pdflatex or xelatex
% XeLaTeX is recommanded
% Some Chinese fonts should be installed in your system (SimSun, SimHei, FangSong, KaiTi)
\documentclass[UTF8]{ctexart}
\begin{document}
文章内容。
\end{document}

The above solution just uses a class ctexart without any particular packages, and I tried to replace ctexart with article, it failed. So I wonder what is special about ctexart which can display Chinese without any add-on packages?

share|improve this question
3  
The ctexart document class itself loads CJK (if using pdflatex) or the xeCJK (if using xelatex) package, hence it works! –  LianTze Lim Mar 26 '13 at 7:46
    
@LianTzeLim, so if I want to type CJK characters, I have to get those packages (CJK or XeCJK) ready anyway, right? –  loganecolss Mar 26 '13 at 7:49
1  
That's right. You can install these packages pretty easily via the package management tools that come with TeXlive or MikTeX. –  LianTze Lim Mar 26 '13 at 8:02
    
@Mico, well, :-| –  loganecolss Mar 26 '13 at 13:31
    
@Mico, done, thank LianTzelim anyway. –  loganecolss Mar 26 '13 at 13:41
add comment

2 Answers

up vote 4 down vote accepted
  1. The following works pretty well in both LuaLaTeX and XeTeX without any special packages. fontspec (which I don't count among special packages) simply uses the SimSun font from Windows's font directory (as suggested in the code you're providing).

    \documentclass{article}
    \usepackage{fontspec}
    \setmainfont{SimSun}
    \begin{document}
    文章内容。
    \end{document}
    

    enter image description here

  2. ctexart simply loads the packages it needs, see LianTze Lim's comment.

share|improve this answer
    
Thanks, your fontspec solution works, but let me get it straight, why fontspec works? This package tell the tex engine how to handle the Chinese character? –  loganecolss Mar 26 '13 at 7:53
    
fontspec is a package that basically provides a connection between XeTeX or LuaTeX and the fonts installed on your system, particularly .otf and .ttf files. When using Xe or Lua, fontspec is almost a must-load, even for people typesetting texts in plain English. If I wanted to use Times New Roman, I'd simply use that same code I gave you, but say \setmainfont{Times New Roman} instead. Note that in traditional pdfTeX, fontspec is neither required, nor does it work, as fonts are handled differently there. See also here. –  Nils L Mar 26 '13 at 7:58
    
So, I have to compile the .tex using LuaTex or XeTex if I use fontspec, right? –  loganecolss Mar 26 '13 at 8:06
    
that is correct. –  Nils L Mar 26 '13 at 8:08
    
BTW, if I don't use \setmainfont{SimSun}, nothing shows in pdf, why? Without setmainfont, tex doesn't know how to do with the CJK characters? Furthermore, why use \setCJKmainfont when using package CJK? Can't I use setmainfont? –  loganecolss Mar 26 '13 at 9:07
show 2 more comments

ctexart, ctexbook and ctexrep are the equivalent to "article", "book" and "report" of the standard classes. You should definitely use those if you have Chinese text.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.