I'm revising one of the final drafts of my thesis and on several pages there are words running into the right margin.
My question is whether rewording the paragraph is the only way to get rid of this problem? (I'd like to avoid using the command \sloppy
because it screws up spacing between words.)
The related question How can I make my text never go over the right margin by always hyphenating or breaking on word-boundaries? offers using \sloppy
or rewording the paragraph as solutions. I'd like to know whether there are alternative solutions.
Update (January 31st 2016). Using the microtype package did the job. Thanks to Henri Menke for suggesting this.
Best Answer
The German LaTeX Wikibook contains a chapter about hyphenation -- here's the link.
babel Package
First of all make sure that you use the babel package. It loads hyphenation rules for the language you use.
hyphsubst Package
If you write in German maybe the hyphsubst package is a good option.
Manually Help LaTeX with the Hyphenation (Globally)
As stated here or here or here for example you can add specific hyphenation rules in the preamble of your document:
Manually Help LaTeX with the Hyphenation (Locally)
I would recommend this as the last step when you finished your document. Then you can manually help LaTeX.
The command \overfullrule=2pt in the preamble will show you where LaTeX has a problem with hyphenation:
Here's a list of manual options:
\-
Hyphenation a word only here and nowhere else (all other hyphenation rules are not valid anymore)."-
Hyphenation a word also here (the other hyphenation rules are still valid)."=
This produces a dash. Hyphenation is allowed here and the other hyphenation rules are still valid. Normally if a word contains a dash the dash is the only place where a hyphenation can occur."~
This produces a dash where no hyphenation is allowed.""
Here a hyphenation can occur but no automatic hyphenation dash will be produced by LaTeX.microtype Package
The microtype package also improves hyphenation. The following cite is taken from the package manual: