4

I have a table table and the first column is a multirow. The multirow column text exceeds the column with.

\documentclass{article}

\usepackage[dutch]{babel}
\usepackage{ragged2e}
\usepackage{ltablex, multirow, makecell, caption}

\begin{document}

\keepXColumns\setcellgapes{3pt}\makegapedcells
\begin{tabularx}{\linewidth}{|p{25mm}|*{3}{>{\RaggedRight\arraybackslash}X|}}
  \caption{My caption}
  \label{my-label} \\

  \hline
 Onderwerp & Persoonlijk niveau & Professioneel niveau & Samenlevingsniveau \\ \hline


  \multirow{4}{*}{Perspectief: Wat is het hogere doel} 
    & Wat is jouw hoge doel in het leven?  & Wat is jouw hoge doel in je beroep? &  Wat is jouw hoge doel in de samenleving? \\ \cline{2-4}
    & & & x \\ \cline{2-4}
  \hline

\end{tabularx}

\end{document}

enter image description here

How can I make the text wrap and go to next line when the line is longer then the column width like the other columns?

1 Answers1

8

TeX does not hyphenate the first word of a paragraph, so add a 0pt space before the word. You also need to specify a language, hyphenating this text using the rules for English does not make a good outcome.

\documentclass{article}

\usepackage{ragged2e}
\usepackage{ltablex, multirow, makecell, caption}

\begin{document}

\keepXColumns\setcellgapes{3pt}\makegapedcells
\begin{tabularx}{\linewidth}{|>{\hspace{0pt}}p{25mm}|*{3}{>{\RaggedRight\arraybackslash\hspace{0pt}}X|}}
  \caption{My caption}
  \label{my-label} \\

  \hline
 Onderwerp & Persoonlijk niveau & Professioneel niveau & Samenlevingsniveau \\ \hline


  \multirow{4}{=}{Perspectief: Wat is het hogere doel} 
    & Wat is jouw hoge doel in het leven?  & Wat is jouw hoge doel in je beroep? &  Wat is jouw hoge doel in de samenleving? \\ \cline{2-4}
    & & & x \\ \cline{2-4}
  \hline

\end{tabularx}

\end{document}
David Carlisle
  • 757,742
  • Thank you for your answer. I have edited the code with the dutch babel. So I need to add a 0pt space in the multirow so it wrappes the entire section if its to large for the column? I'm rather new at this. – oscarteg Oct 01 '17 at 12:59
  • @oscarteg you only need the space to allow hyphenation of the first word, for the multirow use = not * (I changed my answer) – David Carlisle Oct 01 '17 at 13:13