[Tex/LaTex] How to turn off hyphenation in ToC only

hyphenationtable of contentstocloft

Here's what my template looked like before:

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

I changed it to this:

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}{\cftsecfont}{\raggedright}

but ToC still hyphenates.

How do I turn off hyphenation in the ToC?

Best Answer

It could be done in the following way without the tocloft package:

\begingroup
\raggedright
\tableofcontents
\endgroup
Related Question