My question begins like this one: Polyglossia and toc.
For some reason, the french
option of polyglossia
removes part numbers from the table of contents, leaving an ugly space in its wake. The question linked above asks for a way to add these numbers back, and it received a good but very complicated answer. I'm not asking for the same thing: I don't want the numbers back, I just want to remove that space, and I believe there is an easy way to do that.
Indeed, adding an \unskip
in the argument of \part
is sufficient to remove the unwanted horizontal space from the table of contents. See the MWE:
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{french}
\begin{document}
\tableofcontents
\part{English part with a number}
\begin{french}
\part{French part with an ugly space}
\part{\unskip French part with nothing}
\end{french}
\end{document}
(The change of language between parts is only there to show the difference. My document will be in French only.)
Result:
Now I just want to find a way to remove that space to all parts, without needing to add \unskip
every time. I thought of a naive way:
\renewcommand{\part}[1]{\part{\unskip #1}}
But when I try to compile, nothing happens, the compilation seems stuck.
So, what's the easiest way to get rid of that unwanted space in the table of contents?
\let\oldpart\part
\renewcommand{\part}[1]{\oldpart{\unskip #1}}
. However, egreg's answer is undoubtedly more appropriate, which is why I accepted it. I don't think my own fix would add much value if I posted it as a second answer, so I'm just mentioning it here, in case someone went through the same reasoning. – SDF Jun 17 '17 at 5:56