3

I'm working on a book document with xelatex. The document is divided into parts, and I have the occasional need to switch between two languages.

I've found that when my document contains more than one language, the part number is not displayed anymore:

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\begin{document}
  \selectlanguage{french}
  \selectlanguage{english}

  \part{My Part}
\end{document}

Will result in:

Not displaying part number

If I use just one language, I'm not having any problem:

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\begin{document}
  % \selectlanguage{french}
  \selectlanguage{english}

  \part{My Part}
\end{document}

Displaying part number

Chapters and sections work good in any case.

1

The french language redefines \thepart to issue nothing, because it wants “Première partie”. So if you switch to French, the command is redefined, but switching to English doesn't define it back.

\documentclass{book}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}

\makeatletter
\let\latex@thepart\thepart
\appto\noextras@french{\let\thepart\latex@thepart}
\makeatother

\begin{document}

\selectlanguage{french}
\selectlanguage{english}

\part{My Part}

\end{document}

Save the original \thepart command and restore it when the language switches from French to another one.

  • Thanks a lot, it makes a lot of sense, and your solution is working great! – Romain Endelin Feb 7 '16 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.