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 have xetex installed on a Mac with the texlive 2011 installation.

here is my source file:

\documentclass[11pt]{article}
\begin{document}
Web 安全与电子商务 
\end{document}

here is my error:

$ xetex xetex
This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011)
 restricted \write18 enabled.
entering extended mode
(./xetex.tex
! Undefined control sequence.
l.1 \documentclass
                  [11pt]{article}
? ^D
! Emergency stop.
l.1 \documentclass
                  [11pt]{article}
No pages of output.
Transcript written on xetex.log.

here is my logfile:

$ cat xetex.log 
This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011) (format=xetex 2011.7.3)  4 OCT 2011 11:04
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**xetex
(./xetex.tex
! Undefined control sequence.
l.1 \documentclass
                  [11pt]{article}
? 
! Emergency stop.
l.1 \documentclass
                  [11pt]{article}
End of file on the terminal!

No pages of output.
$ 

What am I doing wrong?

share|improve this question
6  
You should call xelatex, not xetex: xelatex filename However the code is not sufficient to typeset Chinese characters: you should choose a Chinese font and load it with the fontspec package. –  egreg Oct 4 '11 at 15:13
    
Wow, I feel stupid. Thanks. –  vy32 Oct 4 '11 at 21:05
    
Why don't you put that in as a answer so I can accept it? –  vy32 Oct 4 '11 at 21:06

1 Answer 1

up vote 7 down vote accepted

You should call

xelatex filename

and not xetex filename, as the latter will process the file with the LaTeX format over the XeTeX engine.

However the minimal example would not give any sensible result, because the default font doesn't know Chinese characters and fontspec should be loaded:

\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont{My Chinese Font}
\begin{document}
Web 安全与电子商务 
\end{document}

where My Chinese Font should be substituted by the name of a font containing Chinese characters.

share|improve this answer
    
For Chinese it's best to load the xeCJK package, I think. See How does one type Chinese in LaTeX. –  Alan Munn Oct 4 '11 at 23:58
    
@AlanMunn Yes, if the document has substantial parts in Chinese; however this doesn't relieve from choosing a suitable font with \setCJKmainfont. –  egreg Oct 5 '11 at 0:01
    
Maybe, we can use \documentclass{ctexart} directly, but the font is default. –  Pig Cry Oct 5 '11 at 2:24
    
\setmainfont{Arial Unicode MS} works great. –  vy32 Oct 5 '11 at 2:45

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.