[Tex/LaTex] hyphenation not working

hyphenation

I really searched a lot and tried a lot of hints (also from this site), but I cannot get the global hyphenation command working.

In my text, I can set the correct hyphernation like this:

LensKit"=Frame"-work

but if I try to set it globally it's not working:

\hyphenation{LensKit-Frame-work}

What am I doing wrong?

Here is a small example of my code:

\documentclass[a4paper,twoside,11pt,ngerman]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{bibgerm}

\hyphenation{LensKit-Frame-work}

\clubpenalty = 10000
% Keine einzelnen Zeilen am Ende eines Abschnitts (Hurenkinder)
\widowpenalty = 10000 \displaywidowpenalty = 10000
% EOF

\begin{document}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.   LensKit"=Frame\-work LensKit"=Frame\-work LensKit"=Frame\-work LensKit"=Frame\-work LensKit"=Frame\-work  LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework LensKit-Framework 

\end{document}

Best Answer

There are a number of problems.

  1. You're not loading babel, so the ngerman option doesn't do anything. Actually the bibgerm package loads the obsolete german package.

  2. Your \hyphenation instruction refers to the word "LensKitFramework" without explicit hyphens. TeX never hyphenates a word with an explicit hyphen, unless the user authorizes it to do, for instance with the "- shorthand.

  3. The packages ae and aecompl are obsolete.

  4. The instruction \clubpenalty = 10000 *doesn't do what you're expecting.

Of course points 3. and 4. are not connected with the problem at hand, which you can solve by defining a macro:

\newcommand\LensKitFramework{LensKit"-Framework}
\hyphenation{frame-work}

Let's see the complete preamble:

\documentclass[a4paper,twoside,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{bibgerm}


\hyphenation{frame-work}


\clubpenalty = 10000
\makeatletter
\@clubpenalty = 10000 % LaTeX uses `\@clubpenalty to restore the value of `\clubpenalty`
\makeatother
% Keine einzelnen Zeilen am Ende eines Abschnitts (Hurenkinder)
\widowpenalty = 10000 \displaywidowpenalty = 10000
% EOF

\begin{document}
\newcommand{\LensKitFramework}{LensKit-""Framework}

Here we use \LensKitFramework{} and it will hyphenate correctly.

The definition should go after \begin{document}, because it's only then that shorthands are activated.

Related Question