# How to change part name in TOC only (with babel)? Or How to patch a bug in babel french with amsart

When I use babel with french option and amsart, I get the word "partie" in the TOC and not "Partie" which is the correct typographic rule in french (in the main document I get "Première partie" which is ok because "partie" is not the first word so not cap needed).

Here is my MWE

\documentclass{amsart}
\usepackage[french]{babel}

\begin{document}
\tableofcontents
\part{Essai}

\end{document}


I just want to correct this mistake without using titletoc package. Does anybody have a solution?

• I'd say there is a bug in french, because with your MWE I'm getting Première partie 1. Essai (note the extra ‘1’) and there is an extra space in the toc lines. May 3, 2020 at 6:16

As already pointed out, babel-french's option PartNameFull=false provides a fix: then you get "Partie I", "Partie II" (Roman numerals) both in the document and in the TOC.

In order to get "Première partie" both in the document and in the TOC, you could try something like this:

\documentclass[french]{amsart}
\usepackage{babel}
\usepackage{blindtext}
% Patch amsart.cls:
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@sect}{\@seccntformat{#1}}%
% To get "Première partie." in the TOC:
\renewcommand{\tocpart}[3]{\indentlabel\ignorespaces
\ifcase#2\or{Première}\or{Deuxième}\or{Troisième}\else{?}\fi
% To get "Partie 1." in the TOC only, uncomment these two lines:
%\renewcommand{\tocpart}[3]{\indentlabel\ignorespaces
\makeatother
\begin{document}
\tableofcontents
\part{Un essai}
\blindtext
\section{test test test}
\blindtext
\part{Second essai}
\end{document}


This works for up to three parts, extending the \tocpart command is obvious in case you need more.

With amsbook.cls, you could use etoolbox this way:

\documentclass[french]{amsbook}
\usepackage{babel}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@part}{\ \thepart}{}{}{}
\makeatother


Each class would require a specific treatment, so I just provide the PartNameFull=false option in babel-french to work around this issue.

• Quite an interesting answer. I am tempted to accept it as an answer provided 1/ there are some nasty side effects for this patch: 1.1/ the numbering of section, subsection and others completely disappear from the main body of my document (but not in the TOC)! It should come from your <\def\@seccntformat#1{\unskip.\quad}> line but I do not know how to change it. 1.2/ I got "Première partie" and so on right in the TOC but in the main body I only got "Partie" without numbering neither "Première Partie". Quite not right. Could you please try to patch your patch? (see next comment) May 3, 2020 at 16:44
• (following of my previous comment) 2/ What my neurotic mind really wants is to keep "Première partie" formatting in the main body of my document (but without numbering with ordinals!) and just "Partie" with the corresponding number in the TOC. Can you please improve your next patch in that direction? May 3, 2020 at 16:47
• You are right my patch was too rough. I have just edited my answer. It seems to work now, leaving "Première partie" both in TOC and document. May 3, 2020 at 20:30
• Please note that the patch is not meant for multilingual documents (French only). May 3, 2020 at 20:39
• Sorry, it works here. Didn't you forget to delete \frenchsetup{PartNameFull=false}? May 3, 2020 at 20:45

\addto\captionsfrench{% <===============================================
\renewcommand\partname{Partie}%
}


A complete MWE with two parts

\documentclass{amsart}

\usepackage[french]{babel}
\usepackage{blindtext}

\renewcommand\partname{Partie}%
}

\begin{document}
\tableofcontents
\part{Essai}
\blindtext
\section{test test test}
\blindtext
\part{test part 2}

\end{document}


gives you the following result:

BTW: in the manual of babel-french you can find in chapter 1.2.1 \frenchsetup:

and please see the red marked text there. The resulting pdf is the same I showed above.

With option PartNameFull=true in the mwe above you get the following pdf:

Please see the wrong TOC entries for the parts: It should be Partie 1 instead partie 1 or it should be Première partie without number.

This bug should be reported to the author of babel-french, e-mail address see the documentation (texdoc babel-french).

• Thank you for your answer, but unfortunately I just want to change the name of part in TOC not in the main document, where I like "Première partie". With your solution it becomes "Partie 1". May 2, 2020 at 20:17
• Ok so if I understood well, either I setup the option to True and then I get the double bug (no cap in TOC at the word "partie" and "Première partie 1." in the main body), either I setup the option to False and then I get the word "Partie" in the TOC and the main body (like in your MWE but with no need for your correction) which is typographically correct but lack the elegance of "Première Partie" and so on. A pity! May 3, 2020 at 10:40