3

I'm using polyglossia package in my document and have some parts where I don't want to have hyphynation so I'm using \disablehyphenation command as documented. Now when I'm having very long words in a line I would expect the second long word to go to the next line (see section 1 in the image below). But when the first word gets shorter the second one does no longer go to the second line.

enter image description here

Here is my MWE:

\documentclass{scrartcl}

\usepackage{polyglossia}

\begin{document}
    \fontsize{30}{30}\selectfont
    \disablehyphenation
    \section{expected}
    Aquickbrownfoxjumpsoverthelazydog Aquickbrownfoxjumpsoverthelazydog
    \section{unexpected}
    Aquickbrownfoxjumpsoverthelazy Aquickbrownfoxjumpsoverthelazydog
\end{document}

Any ideas how to force the second word to be on the next line? (manual Newline is no option - its generated content)

Thanks in advance!

5

Desperate times, desperate measures.. Use \sloppy

\documentclass{scrartcl}

\usepackage{polyglossia}

\begin{document}
    \fontsize{30}{30}\selectfont
    \disablehyphenation
    \sloppy
    \section{expected}
    Aquickbrownfoxjumpsoverthelazydog Aquickbrownfoxjumpsoverthelazydog
    \section{unexpected}
    Aquickbrownfoxjumpsoverthelazy Aquickbrownfoxjumpsoverthelazydog
\end{document}

enter image description here

If you want this effect locally, use sloppypar environment like

\begin{sloppypar}
content
\end{sloppypar}

On the other hand, you can also use \raggedright (thanks to R. Schumacher for reminding).

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.