[Tex/LaTex] Table column text exceeds column width

tablestabularx

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?

Best Answer

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}