[Tex/LaTex] Hyphenation Problem with german

babelgermanhyphenation

i have a problem with hyphenation and i could not find a solution.

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[german,ngerman]{babel}
\selectlanguage{ngerman}
\usepackage{cite}

\hyphenation{(Web"~)""Frame"-works}

The error message is:

Description Path Resource Location Type
Improper \hyphenation will be flushed. \hyphenation{(Web"~ (followed by: )""Frame"-works}) line 84 Texlipse Build Error
Description Path Resource Location Type
Not a letter. \hyphenation{( (followed by: Web"~)""Frame"-works}) line 84 Texlipse Build Error
I think the problem is the charackter ")"

Edit:

Thanks for all answers:

First i want to achieve the example here: http://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_Silbentrennung
"~ : Mit dieser Anweisung setzt man einen Bindestrich, an dem nicht getrennt werden soll, beispielsweise bei Wortergänzungen in Klammern: (Haupt"~)""Straße
The \hyphenation (Web-)Framework should prevent hyphenation (Web-). Example (Web-

)Framwork is wrong.
I know the parenthesis aren't letters for TEX, but see the example it works. So I wonder what is wrong.

So here is the example:

\documentclass[
   11pt,                % Schriftgroesse 12pt
   a4paper,             % Layout fuer Din A4
   ngerman,             % deutsche Sprache, global
   oneside,            % einseitig
   headinclude,         % Kopfzeile wird Seiten-Layouts mit beruecksichtigt
   BCOR12mm,            % Korrektur fuer die Bindung
   DIV14,               % DIV-Wert fuer die Erstellung des Satzspiegels, siehe scrguide
   fleqn,               % fleqn: Glgen links (statt mittig)
   %draft,               % Keine Bilder in der Anzeige, overfull hboxes werden angezeigt
   appendixprefix,              %berschriften des Anhangs +"Anhang"
  %chapterprefix,               %berschriften der Kapitel +"KAPITEL"
   abstracton,
   pdftex                       %Ueberschrift Zusammenfassung einschalten
     ]{scrreprt}

\usepackage[german,ngerman]{babel}
\selectlanguage{german}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\hyphenation{(Web"~)""Frame"-works}  
\begin{document}
(Web-)Frameworks asdasd (Web-)Frameworks asd (Web-)Frameworks (Web-)Frameworks
(Web-)Frameworks asdsada (Web-)Frameworks asd (Web-)Frameworks (Web-)Frameworks
(Web-)Frameworks asdasdasd (Web-)Frameworks (Web-)Frameworks (Web-)Frameworks
(Web-)Frameworks asdasdas (Web-)Frameworks (Web-)Frameworks
\end{document}

Best Answer

In the argument to \hyphenation only letters and hyphens to mark the admissible break points are allowed; babel shortcuts are definitely not allowed.

The simplest strategy for coping with this problem is to define a macro:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\newcommand{\WFW}{(Web\mbox{-})\nolinebreak\hspace{0pt}Framework}
\babelhyphenation[ngerman]{frame-work frame-works}

\begin{document}

\WFW{} asdasd \WFW{} asd \WFW{} \WFW{}
\WFW{} asdsada \WFW{} asd \WFW{} \WFW{}
\WFW{} asdasdasd \WFW{} \WFW{} \WFW s
\WFW s asdasdas \WFW s \WFW s

\end{document}

enter image description here

If you don't want the command you can surely type the word as

(Web"~)""Framework

in your document and, thanks to the \babelhyphen declarations, hyphenation would only be Frame-work or Frame-works with a possible break after the parenthesis.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\babelhyphenation[ngerman]{frame-work frame-works}

\begin{document}

(Web"~)""Framework asdasd (Web"~)""Framework asd (Web"~)""Framework (Web"~)""Framework
(Web"~)""Framework asdsada (Web"~)""Framework asd (Web"~)""Framework (Web"~)""Framework
(Web"~)""Framework asdasdasd (Web"~)""Framework (Web"~)""Framework (Web"~)""Frameworks
(Web"~)""Frameworks asdasdas (Web"~)""Frameworks (Web"~)""Frameworks

\end{document}

enter image description here

You can define a new command like as follows

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\babelhyphenation[ngerman]{frame-work frame-works}

\shorthandon{"}
\newcommand{\WEB}{(Web"~)""}
\shorthandoff{"}

\begin{document}

(Web"~)""Framework asdasd (Web"~)""Framework asd (Web"~)""Framework (Web"~)""Framework
(Web"~)""Framework asdsada (Web"~)""Framework asd (Web"~)""Framework (Web"~)""Framework
(Web"~)""Framework asdasdasd (Web"~)""Framework (Web"~)""Framework (Web"~)""Frameworks
(Web"~)""Frameworks asdasdas (Web"~)""Frameworks (Web"~)""Frameworks

\WEB Framework asdasd \WEB Framework asd \WEB Framework \WEB Framework
\WEB Framework asdsada \WEB Framework asd \WEB Framework \WEB Framework
\WEB Framework asdasdasd \WEB Framework \WEB Framework \WEB Frameworks
\WEB Frameworks asdasdas \WEB Frameworks \WEB Frameworks

\end{document}

Alternatively,

\shorthandon{"}
\newcommand{\WEB}[1]{(Web"~)""#1}
\shorthandoff{"}

but the input should be \WEB{Framework}. Take your pick.

This is the output of the above example.

enter image description here

Related Question