[Tex/LaTex] \hyphenation does not work

hyphenationline-breaking

TeX trys to hypehnate my word "universeller" in a totally wrong way. It makes it to "Üniverseller" and removes the quotation marks in the front before.

When I use \mbox it writes the word over the margin break point and if i write the word in \hyphenation{universeller} it doesn't even show the word. Any idea why?\hyphenation{uni-ver-sel-ler} also doesnt work

If I write it normally Tex makes the two words "Fabian" universeller to Fabianüni-:

enter image description here

Best Answer

If you load the babel package with the [ngerman] option -- I'm taking a wild guess here that your document's language is German... -- LaTeX should have no problem hyphenating the word "universeller". See the MWE (minimum working example) below, which uses the LuaLaTeX format just to be able to use the nifty showhyphens package to indicate all hyphenation points with thin red vertical bars.

For sure do not place the word universeller into an \mbox unless you want to disable hyphenation. And don't provide the instruction \hyphenation{universeller} unless you, again, want to disable its hyphenation.

Furthermore, don't write "universeller" since with the ngerman option set, babel will interpret "u as a shortcut command for \"{u} and therefore typeset ü rather than "u. For the automatic use of language-appropriate quotation marks, do consider using the csquote package and its \enquote command, i.e., start writing \enquote{universeller}. (As @Dan has pointed out in a comment, the babel shortcut " gobbles up space after it. This explains why it's necessary to write ...seller" \ --- in the MWE to get a space between the end of the word and the em-dash. It also explains what you get the decidedly incorrect ”Fabianüniverseller...)

enter image description here

\documentclass[ngerman]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Latin Modern Roman}
\usepackage{showhyphens,csquotes,babel}
\begin{document}
universeller

"universeller" \ --- This is a mistake!

``universeller'' --- U.S.-style quotation marks

\enquote{universeller} --- German-style quotation marks
\end{document}
Related Question