# Longtable & tabularx and issues with word wrap

I have a table (tabularx) that is larger than a single page, so I tried using the longtable package. Mytable contains a longer text and when I tried to put the tabularx-table into a "longtable environment" this text goes beyond the page margin - I think because the option "X" isn´t supported anymore. So I looked for other packages and found tabu/longtabu ... but to be honest, it became worse. Can someone please help me?

\documentclass[a4paper,bibliography=totoc,toc=listof,chapterentrydots=on,captions=tableheading,headings=small]{scrbook}

\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{longtable}
\usepackage[figuresright]{rotating}

\usepackage[babel]{csquotes}

\usepackage[language=autobib,
backend=biber,
citetracker=true,
autolang=other,
style=authoryear-comp,
maxcitenames=2,maxbibnames=99,
uniquename=false,uniquelist=true,
isbn=false,doi=false,
]{biblatex}

\usepackage{booktabs}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{tabularx}

\begin{document}

\begin{table}[hbt]
\footnotesize
\renewcommand{\arraystretch}{1.5}
\caption[title]{\textbf{title}.}
\label{title}
\begin{tabularx}{\linewidth}{p{0.12\linewidth}p{0.15\linewidth}p{0.65\linewidth}}
\toprule
\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\
\textbf{principle x}    &   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{\textbf{This is one of many principles}}\\
&   \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X}{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. } \\
&   sub-principle: &  \tabitem subprinciple I \par \tabitem subprinciple II \par \tabitem subprinciple III\\

\bottomrule
\end{tabularx}

\end{table}

\end{document}


Is it possible to insert this information, too?

\endfirsthead
\multicolumn{3}{l}{{continued from previous page}} \\
\toprule

\midrule
\multicolumn{3}{r}{{Continued on next page}} \\
\endfoot
\bottomrule
\endlastfoot


• since you have your table in floating environment (table), which is limited to one page, the inclusion \endfirsthead, \endhead hasn't sense. If this is demand, than you should use longtable , see second example below.

First example: table environment

• i suggest to use tabular* instead of tabularx

From your MWE I made real minimal MWE :) and define \newcommand\mc[1]{...} for \multicolumn:

\documentclass[a4paper,captions=tableheading,headings=small]{scrbook}
\usepackage{booktabs, longtable, tabularx}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcommand\mc[1]{\multicolumn{2}{p{\dimexpr0.85\linewidth-3\tabcolsep\relax}}{#1}}

\begin{document}
\begin{table}[hbt]
\footnotesize
\renewcommand{\arraystretch}{1.5}
\caption[title]{\textbf{title}.}
\label{title}
\begin{tabular*}{\linewidth}{>{\bfseries}p{0.15\dimexpr\linewidth-2\tabcolsep\relax}
p{0.15\dimexpr\linewidth-2\tabcolsep\relax}
p{0.70\dimexpr\linewidth-2\tabcolsep\relax}
}
\toprule
principle x     &   \mc{\textbf{This is one of many principles}}\\
&   \mc{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. }        \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                                   \\
principle x     &   \mc{\textbf{This is one of many principles}}\\
&   \mc{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. }        \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                                   \\
principle x     &   \mc{\textbf{This is one of many principles}}\\
&   \mc{This is a very long text that belongs to the principle mentioned above. I hope that the automatic word wrap is working. }        \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                                   \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}


Second example: longtable environment

\documentclass[a4paper,captions=tableheading,headings=small]{scrbook}

\usepackage{booktabs, longtable, tabularx}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcommand\mc[1]{\multicolumn{2}{p{\dimexpr0.85\linewidth-3\tabcolsep\relax}}{#1}}

\usepackage{lipsum}     % for dummy text in table
\usepackage{showframe}  % for show table layout

\begin{document}

{
\footnotesize
\renewcommand{\arraystretch}{1.5}
\label{title}
\begin{longtable}{>{\bfseries}p{\dimexpr0.15\linewidth-2\tabcolsep\relax}
p{\dimexpr0.15\linewidth-2\tabcolsep\relax}
p{\dimexpr0.70\linewidth-2\tabcolsep\relax}
}
\caption[title]{\textbf{title}.}
\label{title}                               \\
\toprule
\caption[title]{continued from previous page}   \\
\toprule
%
\midrule
\multicolumn{3}{r}{Continued on next page}      \\
\endfoot
\bottomrule
\endlastfoot
%
principle x     &   \mc{\textbf{This is one of many principles}}    \\
&   \mc{\lipsum*[1]}                            \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                   \\
principle x     &   \mc{\textbf{This is one of many principles}}    \\
&   \mc{\lipsum*[1]}                            \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                   \\
principle x     &   \mc{\textbf{This is one of many principles}}    \\
&   \mc{\lipsum*[1]}                            \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                   \\
principle x     &   \mc{\textbf{This is one of many principles}}    \\
&   \mc{\lipsum*[1]}                            \\
&   sub-principle:
&   \tabitem subprinciple I \par
\tabitem subprinciple II \par
\tabitem subprinciple III                   \\
\end{longtable}
}
\end{document}