[XeTeX] UTF8 and XeTeX?
Jonathan Kew
jonathan_kew at sil.org
Thu Jul 19 15:16:55 CEST 2007
On 19 Jul 2007, at 2:11 am, Thomas Hühn wrote:
> Hi
>
> I'm writing a source file in UTF8 and don't understand how to make
> XeTeX
> process it.
>
> Here is a minimal example:
>
> \documentclass{article}
> \usepackage[utf8]{inputenc}
> \begin{document}
> Hällo
> \end{document}
For xetex, do *not* use \usepackage[utf8]{inputenc}, because this
tries to interpret the individual bytes of UTF-8 characters via TeX
macros. But xetex already handles the UTF-8 encoding itself and works
with the actual Unicode character values.
Therefore,
\documentclass{article}
\begin{document}
Hällo
\end{document}
will run without the error message; but the ä will be missing from
the output because that Unicode character is not present in Computer
Modern. So you also need to choose a Unicode font; use fontspec to do
this:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times Roman} % or whatever...
\begin{document}
Hällo
\end{document}
If you simply load the fontspec package but don't specify a font, it
will load Latin Modern, which looks like Computer Modern but includes
many more characters (encoded according to Unicode), so that should
also work.
JK
More information about the XeTeX
mailing list