1

I have created a table but the table width is extending beyond the page.

The code for the table is this

\begin{table}[]
  \centering
   \caption{My caption}
   \label{my-label}
   \begin{tabular}{|l|l|l|l|}
   \hline
   Competentie beschrijving & Bekwaamheidseisen: de student & Sterk & Zwak \\ \hline
   \multirow{4}{*}{Competent in, zelfreflectie en ontwikkeling} & kan kritisch, reflecteren op zichzelf. &  &  \\ \cline{2-4} 
   & \begin{tabular}[c]{@{}l@{}}kan eigen ontwikkeling mondeling en\\ schriftelijk onder woorden brengen.\end{tabular} &  &  \\ \cline{2-4} 
   & \begin{tabular}[c]{@{}l@{}}kan een\\ gesprek voeren over eigen, of andermans levensvragen (geluk, rouw, identiteit,\\ zingeving, etc.).\end{tabular} &  &  \\ \cline{2-4} 
   & kan aan de hand,van een casus in het practicum zijn/haar eigen levensbeschouwing koppelen aan,het professionele handelen. &  &  \\ \hline
   &  &  &  \\ \hline
 \end{tabular}
\end{table}

And the table looks like this. How can I fit the table to the width of the page. table PS: It is supposed to be a table that is a couple of pages long. Don't know if there is a package or anything that is better for tables. I have tried tabularx but still the table was to wide.

1
  • welcome to tex.sx. it would be easier to answer this if you expanded the code to begin with \documentclass and end with \end{document} so that potential assistants can just copy and paste a compilable example for experimentation. (different "initial conditions" can have drastically different outcomes, so it's often wasted time trying to devise an answer based on incomplete information.) Sep 29, 2017 at 13:48

2 Answers 2

0

You can load ltablex, which brings the functionalities of longtable to tabularx. I added makecell to give cells some padding, vial \setcellgapes{...}\makegapedcells:

\documentclass[a4paper, dutch]{article}
\usepackage{babel}
\usepackage[showframe]{geometry}
\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
  \endfirsthead
  \tablename \thetable. My caption (continued) \\
  \hline
  \endhead
  \hline
  \multicolumn{4}{r}{\footnotesize (To be continued)}
  \endfoot
  \hline
  \endlastfoot
  Competentie beschrijving & Bekwaamheidseisen: de student & Sterk & Zwak \\ \hline
  \multirow{18}{=}{Competent in, zelfreflectie en ontwikkeling} & kan kritisch, reflecteren op zichzelf. & & \\ \cline{2-4}
                                                                & kan eigen ontwikkeling mondeling en schriftelijk onder woorden brengen. & & \\ \cline{2-4}
                                                                & kan een gesprek voeren over eigen, of andermans levensvragen (geluk, rouw, identiteit, zingeving, etc.). & & \\ \cline{2-4}
                                                                & kan aan de hand,van een casus in het practicum zijn/haar eigen levensbeschouwing koppelen aan,het professionele handelen. & &
\end{tabularx}

\end{document} 

enter image description here

1
  • Thank you for you answer. This is exactly what I wanted.
    – oscarteg
    Sep 29, 2017 at 14:48
0

It sounds like what you really need is a longtable environment. Assuming the four columns should be equally wide, the following code may be the way to go. (Note that I would also strongly suggest that you give the table a much more open look by getting rid of all vertical lines and most horizontal lines.)

enter image description here

\documentclass{article}
\usepackage[dutch]{babel}
\usepackage{longtable,array,ragged2e,booktabs}
% compute usable column width (4 columns in table)
\newlength\mylen
\setlength\mylen{\dimexpr\textwidth-6\tabcolsep\relax}
\newcolumntype{Y}{>{\RaggedRight\hspace{0pt}\arraybackslash}p{0.25\mylen}}

\begin{document}
\begin{longtable}{@{}YYYY@{}}

% headers and footers:
\caption{My caption} \label{my-label}\\
\toprule
Competentie beschrijving & Bekwaamheidseisen: de student & Sterk & Zwak \\ 
\midrule
\endfirsthead

\multicolumn{4}{@{}l}{Table \ref{my-label}, cont'd}\\
\addlinespace
\toprule
Competentie beschrijving & Bekwaamheidseisen: de student & Sterk & Zwak \\ 
\midrule
\endhead

\midrule
\multicolumn{4}{r@{}}{continued on following page}\\
\endfoot

\bottomrule
\endlastfoot

% body of longtable:
Competent in, zelfreflectie en ontwikkeling 
  & kan kritisch, reflecteren op zichzelf. 
  & 
  &  \\ 
\addlinespace % use whitespace, not '\cline{2-4}'
  & kan eigen ontwikkeling mondeling en schriftelijk onder woorden brengen. 
  & 
  &  \\ 
\addlinespace 
  & kan een gesprek voeren over eigen, of andermans levensvragen (geluk, rouw, identiteit, zingeving, etc.). 
  & 
  &  \\ 
\addlinespace 
  & kan aan de hand,van een casus in het practicum zijn\slash haar eigen levensbeschouwing koppelen aan,het professionele handelen. 
  & 
  &  \\ 

\end{longtable}
\end{document}
1
  • Thank you so much I didn't know this existed.
    – oscarteg
    Sep 29, 2017 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .