# Polyglossia and toc

I'm using xelatex, with the package polyglossia (french).

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:

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

vangelis

Polyglossia uses a ‘poor person's way’ to remove the part number from the part page: it simply redefines \thepart to produce nothing.

Here's a better way for the book class (other classes may need a different patch to \@part).

\documentclass[a4paper,12pt]{book}
\usepackage{etoolbox}

\usepackage{polyglossia}
\setmainlanguage{french}
\setotherlanguage{latin}
\setotherlanguage[variant=ancient]{greek}

\makeatletter
% avoid the redefinition of \thepart
\patchcmd{\captionsfrench}{\def\thepart{}}{}{}{}
% patch \@part not to print the part number
\patchcmd{\@part}{\nobreakspace\thepart}{}{}{}
\makeatother

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\part{Part title}
\chapter{Chapter title}
\section{section title}

\part{another part}

\end{document}


If you use

\titleformat{\part}[display]
{\raggedleft\huge\fontfamily{ppl}}
{\MakeUppercase{\partname} \thepart}
{0pt}
{}


for setting the part title, then the patch to \@part is useless and you can simply correct with

\titleformat{\part}[display]
{\raggedleft\huge}
{\MakeUppercase{\partname}}
{0pt}
{}


Of course \fontfamily{ppl} is completely useless in that position. There are two cases: you want to use Palatino for the part titles or not. If yes, then Palatino should be the main font of the document, so you don't need specifying \fontfamily{ppl}; if no, you again don't need it. On the other hand, if you don't follow the command with \selectfont it will do nothing.

Another caveat: avoid specifying \XeTeXinputencoding: save your documents as UTF-8 and your life will be better.

• It seems to work for the table of contents. – user40856 Nov 11 '13 at 19:38
• Ok, I solve the problem by suppressing \thepart in the titleformat command : \titleformat{\part} [display] {\raggedleft\huge\fontfamily{ppl}} {\MakeUppercase{\partname}} {0pt} {}% Thanks again ! – user40856 Nov 11 '13 at 19:49