So erstellen Sie mithilfe der Tabellenumgebung eine Tabelle auf mehreren Seiten

So erstellen Sie mithilfe der Tabellenumgebung eine Tabelle auf mehreren Seiten

BEARBEITENWie einige Kommentare unten anmerken, tableerlaubt die Umgebung keine Tabellen über mehr als eine Seite. Die Lösung funktioniert jedoch einwandfrei

Ich muss eine Tabelle über mehr als eine Seite erstellen. Der Standardansatz scheint zu sein, die ltablexUmgebung zu verwenden. Das funktioniert jedoch nicht; außerdem gehe ich davon aus, dass die tableUmgebung auch für die Abschlussarbeitsvorlage, an der ich arbeite, erforderlich sein könnte (z. B. für die capture).

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex} 
\begin{document}

\begin{table}
\caption{Example of an table}
\label{tab:daypack}     
\begin{tabularx}{\linewidth}{@{}cX@{}}  
\toprule
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
\midrule
\endhead
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\bottomrule
\end{tabularx}   
\end{table}    

\end{document}

Antwort1

Wenn Sie tabularx und longtable kombinieren müssen, bevorzuge ich ltxtable gegenüber ltablex:

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{ltxtable} 
\begin{document}



\LTXtable{\textwidth}{t1.tex}


\end{document}

wo t1.texist

\begin{longtable}{@{}cX@{}}  
\toprule
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
\midrule
\endhead
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\bottomrule
\end{longtable}   

Antwort2

Mit dem richtigen Code funktioniert es einwandfrei. Keine tableUmgebung – eine lange Tabelle kann unmöglich ein Float sein, und die Überschrift direkt danach begin{tabularx}.

    \documentclass[11pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{booktabs}
    \usepackage{ltablex}

    \begin{document}

    \label{tab:daypack}
    \begin{tabularx}{\linewidth}{@{}cX@{}}
    \caption{Example of an table}\\
    \toprule
    \textbf{Column 1} & \textbf{Column 2} \\[6pt]
    \midrule
    \endhead

    $R$ & 1This is an example sentence \\[6pt]
    $R$ & 2As well as the line before \\[6pt]
    $A$ & 3Also this is an example \\[6pt]
    $R$ & 4This is an example sentence \\[6pt]
    $R$ & 5As well as the line before \\[6pt]
    $A$ & 6Also this is an example \\[6pt]
    $R$ & 7This is an example sentence \\[6pt]
    $R$ & 8As well as the line before \\[6pt]
    $A$ & 9Also this is an example \\[6pt]
    $R$ & 10This is an example sentence \\[6pt]
    $R$ & 11As well as the line before \\[6pt]
    $A$ & 12Also this is an example \\[6pt]
    $R$ & 13This is an example sentence \\[6pt]
    $R$ & 14As well as the line before \\[6pt]
    $A$ & 15Also this is an example \\[6pt]
    $R$ & 16This is an example sentence \\[6pt]
    $R$ & 17As well as the line before \\[6pt]
    $A$ & 18Also this is an example \\[6pt]
    $R$ & 19This is an example sentence \\[6pt]
    $R$ & 20As well as the line before \\[6pt]
    $A$ & 21Also this is an example \\[6pt]
    $R$ & 22This is an example sentence \\[6pt]
    $R$ & 23As well as the line before \\[6pt]
    $A$ & 24Also this is an example \\[6pt]
    $R$ & 25This is an example sentence \\[6pt]
    $R$ & 26As well as the line before \\[6pt]
    $A$ & 27Also this is an example \\[6pt]
    $R$ & 28This is an example sentence \\[6pt]
    $R$ & 29As well as the line before \\[6pt]
    $A$ & 30Also this is an example \\[6pt]
    $R$ & 31This is an example sentence \\[6pt]
    $R$ & 32As well as the line before \\[6pt]
    $A$ & 33Also this is an example \\[6pt]
    $R$ & 34This is an example sentence \\[6pt]
    $R$ & 35As well as the line before \\[6pt]
    $A$ & 36Also this is an example \\[6pt]
    $R$ & 37This is an example sentence \\[6pt]
    \bottomrule
    \end{tabularx}

    \end{document} 

Bildbeschreibung hier eingeben

Antwort3

Nutzung longtabledes Paketslongtable

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex} 
\usepackage{longtable}
\begin{document}

\begin{longtable}{cc}  
\caption{Example of an table} \\
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\end{longtable}    

\end{document}

verwandte Informationen