[Tex/LaTex] Hyphenating text inside tabularx

hyphenationragged2etabularx

I'm currently writing a thesis where hyphenation is not allowed with exception to tables. Disable Text hyphenation is working fine using:

\usepackage[none]{hyphenat}
\sloppy

Now the problem is that inside tabularx the words are larger than column width and they flow into the next column. I tried using RaggedRight while defining columns:

\newcolumntype{Z}{>{\RaggedRight\centering\arraybackslash\hspace{0pt}}X}

But still the text is not being hyphenated. Any ideas?

Requirements:

  1. No Hyphenations throughout the whole document
  2. Text in a table's column should not flow into the neighboring column

Below is a Mwe and a screenshot.
Thanks

\documentclass[a4paper,12pt,oneside]{scrbook}
\usepackage{blindtext}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{ngerman}
\usepackage[none]{hyphenat}
\sloppy

\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{booktabs}
\usepackage{ltablex}

\newcolumntype{Z}{>{\RaggedRight\centering\arraybackslash\hspace{0pt}}X}
%Used for multicolumn
\newcolumntype{M}{>{\RaggedRight\arraybackslash\hspace{0pt}}c}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}l}

\begin{document}
\chapter{Intro}
\blindtext

\begin{tabularx}{\linewidth}{|Z|Z|Z|Z|Z|Z|Z|}
\hline
 & \multicolumn{2}{M|}{ \textbf{Anzahl TADs}} & \textbf{Verlustrate} & \textbf{Erfolgsdefinition} & \textbf{Misserfolgsdefinition} & \textbf{Entzündungserscheinung} \\ \hline
\textbf{Publikation} & \textbf{Insgesamt} & \textbf{Verlust} &  &  &  &  \\ \hline
Jung et al., 2009 & 30 & 2 & 6,7\% &  & Mangel an Osseointegrität, Mobilität des Implantates  & milde Mukositis \\ \hline
Jung et al., 2010 & 41 & 1 & 2,4\% & keine Implantatmobilität, keine unerwünschte Bewegung der Suprakonstruktion &  &  \\ \hline
\end{tabularx}
\end{document}

Bad hyphenation in tabularx

Best Answer

The `hyphenat` package disables hyphenation by setting \hyphenpenalty=10000\exhyphenpenalty=10000

So if you want to temprary enable hyphenation, set these to sensible values (e.g. 25), This is a bit lower than usual, but in a small column we want to encourage hyphenation a bit more than in regular text.

\newcommand{\HY}{\hyphenpenalty=25\exhyphenpenalty=25}
\newcolumntype{Z}{>{\HY\centering\arraybackslash\hspace{0pt}}X}
\newcolumntype{M}{>{\HY\RaggedRight\arraybackslash\hspace{0pt}}c}
\newcolumntype{L}{>{\HY\RaggedRight\arraybackslash\hspace{0pt}}l}