## LaTeX forum ⇒ General ⇒ ToC : how to make titles stay on a single line ? Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
Cham
Posts: 830
Joined: Sat Apr 02, 2011 4:06 pm

### ToC : how to make titles stay on a single line ?

I'm having a glitch with some section titles in the ToC. Some titles are a bit long and LaTeX put them in two lines. I would much prefer to show them on a single line only instead. Here's a MWE :

\documentclass[11pt,letterpaper,twoside]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage[french]{babel}\usepackage{lmodern}\usepackage{textcomp}\usepackage{microtype}\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry} \begin{document} \tableofcontents \newpage\section{Présentation du cours} \section{Contenu et programation des activités \newline d'apprentissage} \end{document}

Here's a preview of what this code is doing and the problem indicated in red :
ToC.jpg (22.95 KiB) Viewed 229 times

How to make the second title on a single line in the ToC ?

Johannes_B
Site Moderator
Posts: 3639
Joined: Thu Nov 01, 2012 4:08 pm
Use the optional argument.

\documentclass[11pt,letterpaper,twoside]{article}    \usepackage[T1]{fontenc}    \usepackage[utf8]{inputenc}    \usepackage[french]{babel}    \usepackage{lmodern}    \usepackage{textcomp}    \usepackage{microtype}    \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}     \begin{document}     \tableofcontents     \section{Présentation du cours}     \section{Contenu et programation des activités \newline d'apprentissage}    \section{Hi \newline Cham}    \section[Hi Wombat]{Hi \newline Wombat}     \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 830
Joined: Sat Apr 02, 2011 4:06 pm
Oh my god ! I apparently made a really stupid mistake. I didn't noticed the \newline command in my title !

I'm an idiot ! Case appears to be trivially solved now !