# xetex installation broken?

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?

• 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. Oct 4, 2011 at 15:13

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.

• For Chinese it's best to load the xeCJK package, I think. See How does one type Chinese in LaTeX. Oct 4, 2011 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. Oct 5, 2011 at 0:01
• Maybe, we can use \documentclass{ctexart} directly, but the font is default. Oct 5, 2011 at 2:24
• \setmainfont{Arial Unicode MS} works great.
– vy32
Oct 5, 2011 at 2:45