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!

1 Answer 1

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).

7
  • You beat me to the "sloppy" answer by about five seconds. :-)
    – Mico
    Commented Apr 9, 2015 at 15:32
  • @Mico Hehe, it happens very rarely :-)
    – user11232
    Commented Apr 9, 2015 at 15:32
  • You could also use raggedright or related options in tex.stackexchange.com/questions/185970/… Commented Apr 9, 2015 at 15:35
  • @R.Schumacher: I was about to add it. Thanks for the reminder. :-)
    – user11232
    Commented Apr 9, 2015 at 15:37
  • \sloppy will persist through the entire document unless delimited. usually, it's better to use \begin{sloppypar} ... \end{sloppypar} around just the affected region. (been recommended before: How to avoid using \sloppy document-wide to fix overfull \hbox problems?) Commented Apr 9, 2015 at 15:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .