# [XeTeX] Table of contents

Ulrike Fischer news3 at nililand.de
Fri Apr 30 13:21:43 CEST 2010

Am Thu, 29 Apr 2010 19:01:19 +0100 schrieb José Carlos Santos:

> Hi all:
>
> Please consider this file:
>
> ------------------------------- test.tex -------------------------------
> \documentclass[10pt,a4paper]{book}
> \usepackage[frenchb]{babel}
> \usepackage{fontspec}
> \usepackage{xunicode}
> \usepackage{xltxtra}
> \begin{document}
> \frontmatter
> \tableofcontents
> \XeTeXinputencoding "cp1252"
> \XeTeXdefaultencoding "cp1252"
> \mainmatter\setcounter{secnumdepth}{2}
> \chapter{Général de Gaulle}
> Il était français.
> \end{document}
> ------------------------------------------------------------------------
>
> As you may guess from its contents, the encoding that I am using is
> cp1252. If I compile this file, then, at the table of contents I get
> "GÃ©nÃ©ral de Gaulle", instead of "Général de Gaulle".
>
> I can eliminate this by commenting the line
>
> \XeTeXdefaultencoding "cp1252"
>
> but I want to have it there in order to be able to have a file for each
> chapter and to use the \include command. What should I do?

\XeTeXinputencoding declares the encoding for the current file from
the point on you used it. It has no effect on included files.

\XeTeXdefaultencoding declares the encoding for all included files,
it doesn't affect the current file.

Despite the "default" in the name it is not a good idea to use this
command to set a default encoding: Xetex writes all files (e.g. aux,
toc, idx, ...) in utf8, so always some files input by xetex are in
utf8 and not in cp1252.

The easiest solution to your problem (if your editor can do it) is
to use utf8 for all your files. If you want to use cp1252 you should
put  \XeTeXinputencoding "cp1252" at the start of all included
files.

--
Ulrike Fischer



More information about the XeTeX mailing list