8

I have following code:

\section{This is some long text and probably it will be broken}

I would like to prevent word division like:

This is some long text and pro-
bably it will be broken

And the second issue is to break it in a nice way, for example:

This is some long text and probably it will be
broken

looks bad, because only word 'broken' will be placed in second line. It would be nicer to do it in this way:

This is some long text and probably
it will be broken
12

You can use a manual line change in the title (and the optional argument of the \section command to prevent the line change from appearing in the headings and in the ToC). Another option would be to use the \sloppy command and non-breaking spaces (but this will probably produce a bad box):

\documentclass{article}

\begin{document}
\tableofcontents

\section[This is some long text and probably it will be broken]{This is some long text and probably\\ it will be broken}

\section{\sloppy This is some long text and probably it~will~be~broken}

\end{document}
1

I had to brake the line in a part title that had custom line spacing. I tried a lot of solutions. The only thing that worked stably for me was

\usepackage{setspace} 
...

\begin{spacing}{1.1}
    \part{\sloppy Introduction and state~of~the~art}
\end{spacing}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.