# Line break in section name

Is there any easy way to force a line break in a section name manually, without getting the line break in the Table of Contents? It's because I have a rather long section name, and it breaks just only the last three letters and it looks stupid, but there is no problem in ToC. I have tried double-\ but it breaks the line in the ToC as well.

I have looked at How to put a line-break in section heading? and tried

\texorpdfstring


And it does break the line, but the new line starts below the section number, not below the section name.

(I'm using PDFLaTeX for compiling in TexMaker, and I would prefer not to change that.)

Another solution could be to squeeze the title a bit, if that is possible? I don't think it would be noticeable.

• try putting the broken word in an \mbox. and/or try using a tie ~ to attach a couple of words that you want to keep together. – barbara beeton Dec 14 '12 at 0:02
• The accepted answer to the question you linked mentions using the optional argument; I've rephrased the answer so that it becomes more explicit. – Gonzalo Medina Dec 14 '12 at 0:29
• I'm sorry, didn't get that by then I think. I see now... – Niels Møller Dec 14 '12 at 0:30

You can use the optional argument for the section (inside [...]) which will used for running content:

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\tableofcontents

\section[my section]{This is going to \\ go for two lines}
\lipsum

\end{document}


Make sure to use a short title in the optional argument.

• This worked! Thanks! I actually just used the same title in the optional argument, as there is no problem in ToC (it's only 3 letters too much for one line in the text). – Niels Møller Dec 14 '12 at 0:02