XeTeXPolyglossia and toc

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
vangelis
Posts: 3
Joined: Mon Nov 11, 2013 2:36 pm

Polyglossia and toc

Post by vangelis »

Hello,

I've got a problem with the formatting of the table of contents, using xetex and the package polyglossia (language : french). I don' manage to get the number of parts before the title ...

Here is an ECM to understand this :

Code: Select all

\documentclass[a4paper,12pt]{book} 
\XeTeXinputencoding iso-8859-1
\usepackage{polyglossia}
\setmainlanguage{french}
\setotherlanguage{latin}
\setotherlanguage[variant=ancient]{greek}

\begin{document}
\tableofcontents
\part{Part title}
\chapter{Chapter title}
\section{section title}
\part{another part}
\end{document}
With this code here is the appearance of the toc :
Part title (without number ...)
1 chapter title
1.1. Section

...


And I would like this formatting :
I. Title
1 Chapter title
1.1 Section title ...

What should I do to have the "I" enabled in the toc ? Can somebody help me ?
Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

vangelis
Posts: 3
Joined: Mon Nov 11, 2013 2:36 pm

Polyglossia and toc

Post by vangelis »

The problem is solved with the following code in the preamble :

Code: Select all

\makeatletter
% avoid the redefinition of `\thepart`
\patchcmd{\captionsfrench}{\def\thepart{}}{}{}{}
% patch \@part not to print the part number
\patchcmd{\@part}{\nobreakspace\thepart}{}{}{}
\makeatother
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Polyglossia and toc

Post by localghost »

Just for information to other users for awareness of possibly already existing solutions. The question has also been posted to {TeX} SX. Please read what our administrator thinks about that.
Board Rules wrote:A crossposting is always contra-productive. But there is nothing really against it as long as it is mentioned. This means that a direct link has to be added. So other users who want to help are preserved from double efforts and waste of time.
Such kind of x-posting without notification represents a direct violation of our rules and has to be prevented absolutely in future questions.

It is suggestive to contact the package maintainer because with babel this behaviour does not occur.
Post Reply