2

I'm not sure about a matching example in English, but in the following case, I can't understand hyphenation behaviour at all.

\documentclass[a4paper]{article}

% Based on the class scrreprt by "KOMA-Script", whatever that means. If that doesn't help, please try \documentclass{scrreprt} or one of the usual.
\usepackage[T1]{fontenc}

\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}

\newcolumntype{P}[1]{>{\raggedright\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{x}{>{\raggedright\arraybackslash\hspace{0pt}}X}

\hyphenation{Kom-mu-ni-zier-bar-keit} % didn't work in the first place...
\hyphenation{Fahr-gast-be-fra-gung} % same here...

\begin{document}

\begin{table}[htb] 
\centering
\setlength{\tabcolsep}{4mm}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|P{6em}|x|P{8em}|}
\hline
\hspace{0pt}Kommuni\-zier\-barkeit & Verständlichkeit und Vermittelbarkeit des Programms für Mitarbeiter und Fahrgäste & \hspace{0pt}Mitarbeiterbefragung, Fahrgastbefragung, teilnehmender Beobachter \\\hline
\end{tabularx}
\end{table}

\end{document}

enter image description here

Changing "Fahrgastbefragung" to "Fahrgast\-befragung" didn't help much, as you can see.

enter image description here

It is not until using the ugly "Fahrgast-\newline befragung" that the remaining space in that second line is being used as desired.

enter image description here

Is there a more elegant way than this workaround? Why didn't my first two attempts succeed?

Ulrike Fischer's suggestion already helped for the situation above (thank you!). Why aren't there line breaks after commas when using multirow (version 2.1, see below)?

\documentclass[a4paper]{article}

% Based on the class scrreprt by "KOMA-Script", whatever that means. If that doesn't help, please try \documentclass{scrreprt} or one of the usual.
\usepackage[T1]{fontenc}

\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{ragged2e}

\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{x}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}

\hyphenation{Kom-mu-ni-zier-bar-keit} % didn't work in the first place...
\hyphenation{Fahr-gast-be-fra-gung} % same here...

\begin{document}

\begin{table}[htb] 
\centering
\setlength{\tabcolsep}{4mm}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|P{6em}|x|P{7em}|}
\hline
\multirow[t]{3}{=}{\hspace{0pt}Zuverlässigkeit, Funktionalität} & Reibungsloser Ablauf bei wiederholter Anwendung & \multirow[t]{3}{=}{\hspace{0pt}Mitarbeiterbefragung, Fahrgastbefragung, teilnehmender Beobachter}\\
& Praktische Umsetzbarkeit des Betriebsprogramms & \\
& Reibungsloses Einführen und Aufheben des Betriebsprogramms & \\\hline
\end{tabularx}
\end{table}

\end{document}

enter image description here

4
  • 3
    \raggedright doesn't care about large white spaces. Use \RaggedRight from the ragged2e package. Nov 11, 2016 at 10:39
  • That already helped for other tabulars, thank you! But when using multirow, lines still won't break after the commas. Why might that be?
    – D. Duesen
    Nov 11, 2016 at 11:50
  • Do you use multirow version 2.1?
    – D. Duesen
    Nov 11, 2016 at 12:18
  • 1
    Apparently not. I'll delete my comment. You might want to mention this in the question.
    – daleif
    Nov 11, 2016 at 12:25

1 Answer 1

4

From the multirow documentation version 2.1.:

Just before text is expanded, the \multirowsetup macro is expanded to set up any special environment. Initially, \multirowsetup contains just \raggedright. It may be redefined with \renewcommand.

So you can use

\renewcommand\multirowsetup{\RaggedRight}

enter image description here

Code:

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

\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{multirow}[2016/10/11]
\usepackage{ragged2e}

\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{x}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}

\renewcommand\multirowsetup{\RaggedRight}

\begin{document}

\begin{table}[htb] 
\centering
\setlength{\tabcolsep}{4mm}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|P{6em}|x|P{7em}|}
\hline
  \multirow[t]{3}{=}{\hspace{0pt}Zuverlässigkeit, Funk"-tionalität} 
    & Reibungsloser Ablauf bei wiederholter Anwendung 
    & \multirow[t]{3}{=}{\hspace{0pt}Mitarbeiterbefragung, Fahrgastbefragung, teilnehmender Beobachter}\\
& Praktische Umsetzbarkeit des Betriebsprogramms 
  & \\
& Reibungsloses Einführen und Aufheben des Betriebsprogramms 
  & \\
\hline
\end{tabularx}
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.