0

I have browsed multiple other entries related to hyphenation and none seemed to actually present the same situation. I have an utterly long document (my PhD thesis) in the body of which I use a custom font (i.e. not CMU Sans-Serif, but Akkurat). In many occasions, when the compiler is unable to cut words using its hyphenation rules it leaves these words floating beyond the limits of text width for that page.

I cannot provide a MWE because I wouldn't know how to purposefully generate one, and I think the error is pretty easy to see in pictures:

enter image description here

I don't want to disable hyphenation, and I cannot solve each individual case one by one. As a matter of fact, there are lines where I simply don't even know how to solve the problem without changing the wording of sentences or simply allowing "wrong" hyphenation manually. Plus, there are also many other cases in which the text is automatically generated (e.g. bibliography) and I can't just cut-off words where I want. Example:

enter image description here

I could certainly do something like this:

\hyphenation{Sprin-ger}
% ... or a one-off solution in-text:
(...) this is a line that has the word Sprin\-ger and I can solve manually. 

and solve some of the cases, but this kind of solutions are the ones I found before, tried in my case without success, and want to avoid altogether (if possible). I neither want to resort to \raggedright in specific paragraphs or sections, since that would be extremely weird for the document text align style (which I need to have justified throughout).

Is there a way to tell LaTeX to actually use hyphenation normally, while preventing these ugly errors? I'd like these lines to simply force those words to the next line in a configuration-based/generic manner (i.e. I can't fix every single line one by one, because the document has hundreds of these and they are very prone to appear/disappear in different locations of the document if I slightly change the text somewhere else).


NB. I'm editing everything in Overleaf + XeLaTeX.

  • 1
    Well you can simply use e.g. \raggedright before the bibliography. You can also try \emergencystretch 1em or even \sloppy. – Ulrike Fischer Aug 3 at 15:13
  • Thanks @UlrikeFischer. I'd rather not use \raggedright, since this would change the align style of my a part of document and I need all of it justified. Would you care to expand on the "rules of thumb" to choosing the 1em in \emergencystretch1em? – Carles Araguz Aug 3 at 15:18
  • 1
  • 1
    I would try to use \emergencystretch only while writing the thesis. Once it is finished, I would turn it off and try to solve as many problems as possible. Either by adding hyphenation points or by (slightly) rewording sentences. Only if some cannot be solved, I would turn it on again. As for bibliographies; those can be really tricky. I ended up using \raggedright for the bibliography of my PhD thesis. – Ralf Stubner Aug 3 at 19:47
  • 1
    try putting \begin{sloppypar}..\end{sloppypar} around affected paragraphs – David Carlisle Aug 4 at 6:33

Your Answer

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

Browse other questions tagged or ask your own question.