[XeTeX] Table of contents

José Carlos Santos jcsantos at fc.up.pt
Fri Apr 30 16:02:46 CEST 2010

On 30-04-2010 12:21, Ulrike Fischer wrote:

>> 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.

Thanks. I have already done that.

Best regards,

Jose Carlos Santos

More information about the XeTeX mailing list