# Combining tabularx, sidewaystable and longtable

How can I combine tabularx, sidewaystable and longtable? I was not able to find a solution to this specific issue in this forum.

\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}

\begin{document}

\begin{sidewaystable}[hbt]
%\begin{landscape}
%\begin{longtable}

%\centering
%\scriptsize

\renewcommand{\arraystretch}{2}

\caption[Caption]{\textbf{Caption}}
\label{label}

\begin{tabularx}{\textwidth}{XXXX}
%\begin{tabularx}{\textwidth}{p{0.15\textwidth}Xp{.175\textwidth}p{.15\textwidth}}

\toprule
\textbf{1}      &   \textbf{2}              &   \textbf{3}  &   \textbf{4}\\
\midrule

Author1
&   In the beginning God created the heaven and the earth. 2 And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters. 3 And God said, Let there be light: and there was light. 4 And God saw the light, that it was good: and God divided the light from the darkness. 5 And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day. 6 And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters.
&   -
&   -
\\

Author2
&   And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so. 8 And God called the firmament Heaven. And the evening and the morning were the second day. 9 And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so. 10 And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good.
&   -
\\

Author3
&   -
&   -
&   -
\\

Author4
&   -
&   -
&   -
\\

Author5
&   -
&   -
&   -
\\

\bottomrule

\end{tabularx}

%\end{longtable}
%\end{landscape}

\end{sidewaystable}

\end{document}

• Since longtable takes more than one page, instead of sideways figure you just need landscape (see tex.stackexchange.com/questions/313334/…), As for tabularx, one could fake it by measuing the width of a tabular where X is implemented using \rlap. – John Kormylo Dec 23 '16 at 14:41
• Thank you for your comment. When I use the changes you have suggested, the the top line ist not "repeated" on the next page and the width ob the collums looks strange when I insert ´\begin{longtable}{p{0.15\textwidth}p{0.55\textwidth}p{.15\textwidth}p{.15\textwidth}}´. Where is my mistake? – TRJW Dec 23 '16 at 15:18

Well, the first step is to remove a lot of the extraneous material in your code. The idea is to create a minimal working example; that is, one that demonstrates your problem without anything that does not contribute to that problem. For example, all of the biblatex stuff, which doesn't affect your problem at all.

The next step is to read all your documentation. E.g., you state that the first line of the table does not repeat. For this, you want \endhead; preceding material will be repeated on all pages of the table.

Then, you really want to see the sizes of the preceding pages and the following pages, so you can be sure that your landscape pages are really landscape. So let's use \usepackage{lipsum} to give us some context before and after the longtable.

Here's what I came up with (assuming you're happy faking the effect of tabularx as suggested in the comments):

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

\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{lipsum}

\begin{document}

\lipsum

\begin{landscape}
\begin{longtable}[tbp]{p{0.15\textwidth}p{0.55\textwidth}p{.15\textwidth}p{.15\textwidth}}
\toprule
\textbf{1}      &   \textbf{2}              &   \textbf{3}  &   \textbf{4}\\
\midrule
Author1         &   In the beginning God created the heaven
and the earth. 2 And the earth was without form, and void;
and darkness was upon the face of the deep. And the Spirit
of God moved upon the face of the waters. 3 And God said,
Let there be light: and there was light. 4 And God saw the
light, that it was good: and God divided the light from the
darkness. 5 And God called the light Day, and the darkness
he called Night. And the evening and the morning were the
first day. 6 And God said, Let there be a firmament in the
midst of the waters, and let it divide the waters from the
waters.   &   - &   - \\
Author2         &   And God made the firmament, and divided
the waters which were under the firmament from the waters
which were above the firmament: and it was so. 8 And God
called the firmament Heaven. And the evening and the morning
were the second day. 9 And God said, Let the waters under
the heaven be gathered together unto one place, and let the
dry land appear: and it was so. 10 And God called the dry
land Earth; and the gathering together of the waters called
he Seas: and God saw that it was good.  &   - \\
Author2         &   And God made the firmament, and divided
the waters which were under the firmament from the waters
which were above the firmament: and it was so. 8 And God
called the firmament Heaven. And the evening and the morning
were the second day. 9 And God said, Let the waters under
the heaven be gathered together unto one place, and let the
dry land appear: and it was so. 10 And God called the dry
land Earth; and the gathering together of the waters called
he Seas: and God saw that it was good.  &   - \\
Author2         &   And God made the firmament, and divided
the waters which were under the firmament from the waters
which were above the firmament: and it was so. 8 And God
called the firmament Heaven. And the evening and the morning
were the second day. 9 And God said, Let the waters under
the heaven be gathered together unto one place, and let the
dry land appear: and it was so. 10 And God called the dry
land Earth; and the gathering together of the waters called
he Seas: and God saw that it was good.  &   - \\
Author3         &   -   &   - &   - \\
Author4         &   -   &   - &   - \\
Author5     &   -   &   - &   - \\
\bottomrule
\caption{A Caption}
\end{longtable}
\end{landscape}

\lipsum

\end{document}


That gives you something like this:

Which I think is what you're looking for.

• Just an additional question: How can I adjust my longtable, so that the entire space of the page in landscape format ist used? Now textwidth ist used to define the width of the collums. (I have no problem to get rid of it.) – TRJW Dec 27 '16 at 11:47
\documentclass[a4paper,bibliography=totoc,toc=listof,chapterentrydots=on,captions=tableheading,headings=small]{scrbook}
\usepackage{booktabs}
\usepackage{ltablex}
\usepackage{pdflscape}
\usepackage[babel]{csquotes}

\begin{document}

\begin{landscape}
renewcommand{\arraystretch}{2}

\begin{tabularx}{\textwidth}{lXll}
\caption[Caption]{\textbf{Caption}\label{label}}\\\toprule
\textbf{1}      &   \textbf{2}              &   \textbf{3}  &   \textbf{4}\\\midrule

Author1
&   In the beginning God created the heaven and the earth. 2 And the earth was
without form, and void; and darkness was upon the face of the deep. And the
Spirit of God moved upon the face of the waters. 3 And God said, Let there be
light: and there was light. 4 And God saw the light, that it was good: and God
divided the light from the darkness. 5 And God called the light Day, and the
darkness he called Night. And the evening and the morning were the first day.
6 And God said, Let there be a firmament in the midst of the waters, and let
it divide the waters from the waters.
&   -
&   -
\\

Author2
&   And God made the firmament, and divided the waters which were under the
firmament from the waters which were above the firmament: and it was so. 8 And
God called the firmament Heaven. And the evening and the morning were the
second day. 9 And God said, Let the waters under the heaven be gathered
together unto one place, and let the dry land appear: and it was so. 10 And
God called the dry land Earth; and the gathering together of the waters called
he Seas: and God saw that it was good.
&   -
\\

Author3
&   -
&   -
&   -
\\

Author4
&   -
&   -
&   -
\\

Author5
&   -
&   -
&   -
\\\bottomrule
\end{tabularx}
\end{landscape}

\end{document}