[XeTeX] How to prevent Chinese chars to be treated as part of TeX command?

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Oct 17 08:02:15 CEST 2009


mhbezine209 mhbezine2009 wrote:
> I find a problem of XeTeX: I often encounter errors like
> "! Undefined control sequence l.6 \TeX你好"
> when I typeset Chinese documents with XeTeX.
> See example below to have an idea on the source of errors.
> ------cut from here----------
> \documentclass{article}
> \usepackage{xeCJK}
> \begin{document}
> \TeXÄãºÃHello
> \end{document}
> -------end----------------------
> 
> Such errors occur when chinese characters (or any other non-ASCII unicode
> chars) follow a valid command immediately.
> In other words, if there is no space between Chinese characters and a
> command name,
> XeTeX will treat the Chinese characters as part of the command name, so it
> issues an error message.  I do not know whether it is a bug of XeTeX or it
> is intended. Anyway, I find this design is very annoying because I must
> manually add a white space or {} after each command name so as to avoid such
> errors. Does anybody to have good solution to resolve this problem? It would
> be disirable if this feature of XeTeX can be disabled with one command or a
> macro. I think it would be better to restrict command names in ASCII chars.
> Thanks for any discussion on this issue:-)
> 

TeX treats any "letters" as part of a control sequence, so if I write:

\TeXHello

TeX will complain and I need to write

\TeX Hello. All XeTeX is doing is extending this concept to UTF-8 by
setting a lot
more characters up as "letters". So everything seems pretty consistent
to me.
Most users want to use non-ASCII characters in csnames with XeTeX, in
any case.
--
Joseph Wright

-- 
Joseph Wright          Tel.   01604 810094
Morning Star           Mobile 07974 148180
2 Dowthorpe End
Earls Barton
Northants NN6 0NH


More information about the XeTeX mailing list