# How can I really force the hyphenation points of a word?

I try to make XeLaTeX hyphenate the German word "Sicherheitsbeauftragter". I tried several values for x in \tolerance=x and instances of \hyphenation{Si-cher-heits-be-auf-trag-ter}. Nothing worked. MWE:

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{german}
\usepackage{array}
\usepackage{ragged2e}
\hyphenation{Si-cher-heits-be-auf-trag-ter}
\begin{document}
\begin{tabular}{>{\RaggedRight}p{7.7em}@{|}}
Sicherheitsbeauftragter\\
Technischer Leiter
\end{tabular}
\end{document}


I also tried babel instead of polyglossia and pdfLaTeX instead of XeLaTeX but except for how the "|" looks, there is no difference.

-

\hspace{0pt} right before Sicherheitsbeauftragter allows TeX to break the word, because TeX does not hyphenate the first word in a paragraph. (AFAIK this had made the implementation easier and in English with the many short words, it wasn't much of a problem.)

Since the \hspace inserts a break point at this place, this can be avoided by \nobreak in horizontal mode:

\leavevmode\nobreak\hspace{0pt}Sicherheitsbeauftragter


Or the star form of \hspace can be used:

\hspace*{0pt}Sicherheitsbeauftragter


This can be automated (see Herbert's comment) in the column description:

\begin{tabular}{>{\RaggedRight\hspace*{0pt}}p{7.7em}@{|}}

-
Also \selectlanguage{german} should be issued before \hyphenation or, maybe preferably, the command should be between \begin{otherlanguage*} and \end{otherlanguage*}. –  egreg Apr 13 '13 at 18:05
@egreg The OP has used \setmainlanguage{german} (package polyglossia). –  Heiko Oberdiek Apr 13 '13 at 18:08
or use \begin{tabular}{>{\RaggedRight\hspace{0pt}}p{7.7em}@{|}} –  Herbert Apr 13 '13 at 18:08
@HeikoOberdiek Try adding \showthe\language just before \hyphenation, you'll get 0. –  egreg Apr 13 '13 at 18:22
@egreg It's 30 for me after \begin{document}. \hyphenation is no longer necessary, the hyphenation with the ngerman patterns (loadhyph-de-1996 or dehyphn-x-2012-05-30) is correct. –  Heiko Oberdiek Apr 13 '13 at 18:30

You can also suggest places for hyphenation using \-. The following works for me.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{german}
\usepackage{array}
\usepackage{ragged2e}
\begin{document}
\begin{tabular}{>{\RaggedRight}p{7.7em}@{|}}
Sicherheits\-be\-auf\-tragter\\
Technischer Leiter
\end{tabular}
\end{document}

-
The problem here is, that the word is read from a source file, in which "\-" shouldn't occur (aka readable to non-texies). –  Toscho Apr 15 '13 at 11:56
Ah, then in that case Heiko's answer is a much more suitable solution. –  erik Apr 16 '13 at 2:42