In a narrow raggedright table cell with a long word followed by a short word (for example "aaaaaaaaaaaaaa bbb"), if the first word is too wide and therefore hyphenated (using this solution), then the second word ends up in the third line even though it there's still enough space for it on the second line.
So instead of
aaaaaaaaaa-
aaaa bbb
I see
aaaaaaaaaa-
aaaa
bbb
This can be avoided by using a ~
between the two words, but can it be avoided automatically?
Small example with column type taken from here:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\title{tmp}
\begin{document}
\maketitle
\begin{tabularx}{50pt}{|L{50pt}|}
\hspace{0pt} Fooooo-ooo bar
\end{tabularx}
\end{document}