Problem mit der Formatierung des Beschriftungstexts bei ltablex

Problem mit der Formatierung des Beschriftungstexts bei ltablex

Ich verwende das ltablexPaket zum Erstellen langer Tabellen über mehrere Seiten. Für meine anderen kleinen Tabellen verwende ich das tabularxPaket und mir ist ein Formatierungsfehler oder vielleicht ein Bug aufgefallen?

Der Tabellenüberschrifttext meiner erstellten langen Tabelle ist nicht korrekt bündig mit der bottomruleZeile.

Wenn Sie den Code ausführen, werden Sie sehen, dass die Überschrift am unteren Ende der kleinen Tabelle korrekt mit der bottomruleZeile abschließt. In der langen Tabelle ist der Überschriftentext jedoch nicht korrekt mit der bottomruleZeile abschließt. Dort steht der Text auf der linken Seite etwas hervor.

Wenn ich meine kleine Tabelle ohne die \begin{table]und \end{table}Umgebung verwende und die Überschrift in das setze tabularx, tritt dasselbe Problem wie bei der langen Tabelle auf. Wie kann ich es also richtig an der langen Tabelle zum Laufen bringen? Ich kann dort die \begin{table]und \end{table}Umgebung nicht verwenden. Gibt es also eine andere Möglichkeit, den Überschriftentext wie bei meiner kleinen Tabelle mit der \begin{table]und \end{table}Umgebung zu formatieren?

Ich habe zwei Bilder davon angehängt. Das erste zeigt ein Stück des langen Tisches und das zweite den kleinen Tisch.

Bildbeschreibung hier eingeben Bildbeschreibung hier eingeben

BEARBEITEN - Vollständiger Code

\documentclass[%
a4paper,
12pt,                   
oneside,
captions=nooneline,
parskip=half
]
{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
%\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{booktabs}
\usepackage{mathptmx}% Times

\setkomafont{disposition}{\normalfont\bfseries}
\setkomafont{caption}{\fontsize{9pt}{9pt}\selectfont}

\begin{document}

\keepXColumns
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{XX}
\toprule
\textbf{Column 1} & \textbf{Column 2} \\
\midrule
$R$ & 1This is an example sentence \\
$R$ & 2As well as the line before \\
$A$ & 3Also this is an example \\
$R$ & 4This is an example sentence \\
$R$ & 5As well as the line before \\
$A$ & 6Also this is an example \\
$R$ & 7This is an example sentence \\
$R$ & 8As well as the line before \\
$A$ & 9Also this is an example \\
$R$ & 10This is an example sentence \\
$R$ & 11As well as the line before \\
$A$ & 12Also this is an example \\
\bottomrule
\end{tabularx}  
\caption{Example of an table} 
\end{table}

\newpage

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

\end{document}

Antwort1

verwenden

\usepackage{booktabs}
\usepackage{ltablex}
\setkomafont{disposition}{\normalfont\bfseries}
\setkomafont{caption}{\small}    
\begin{document}

\keepXColumns
\begin{tabularx}{\textwidth}{Xx}\toprule
        \textbf{Column 1} & \textbf{Column 2} \\\midrule
        $R$ & 1This is an example sentence \\
        $R$ & 2As well as the line before \\
        $A$ & 3Also this is an example \\
        $R$ & 4This is an example sentence \\
        $R$ & 5As well as the line before \\
        $A$ & 6Also this is an example \\
        $R$ & 7This is an example sentence \\
        $R$ & 8As well as the line before \\
        $A$ & 9Also this is an example \\
        $R$ & 10This is an example sentence \\
        $R$ & 11As well as the line before \\
        $A$ & 12Also this is an example \\
        \bottomrule
    \caption{Example of an table} \\
    \end{tabularx}  

\begin{tabularx}{\textwidth}{XX}
    \toprule
    \textbf{Column 1} & \textbf{Column 2} \\
    \midrule
    $R$ & 1This is an example sentence \\
    $R$ & 2As well as the line before \\
    [...]

Die Überschrift muss innerhalb destabularx . UndnichtVerwenden Sie die Umgebung tablefür die tabularx. Sie verfügt über einen eigenen tableZähler .

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

Antwort2

Die Lösung für mein Problem ist die Verwendung \captionsetup{margin=1pt}mit dem Untertitelpaket. Mit 2pt habe ich die richtige Ausrichtung der Überschrift erreicht.

Dank anHerbert!

oder alternativ, wenn Sie – wie ich – Komascript verwenden, \setcapmargin{2pt}bewirkt der Befehl dasselbe.

Antwort3

Die Überschrift muss in die Tabelle integriert werden – ebenso wie bei longtable, innerhalb der footSpezifikationen, wenn Sie die Überschrift unten in der Tabelle haben möchten, oder in den headSpezifikationen, wenn Sie sie über der Tabelle haben möchten (was empfohlen wird).

Wenn Sie laden ltablex, müssen Sie außerdem tabularxweder noch laden longtable, da sie von ltablex geladen werden.

    \documentclass[a4paper]{article}%
    \usepackage{ltablex, booktabs}
    \usepackage[showframe]{geometry}
    \usepackage{caption}
    \captionsetup[table]{singlelinecheck=off, position=bottom}
     \usepackage{etoolbox}

    \begin{document}

    \keepXColumns
     \begin{table}[htbp]
    \begin{tabularx}{\linewidth}{XX}
    \toprule
    \textbf{Column 1} & \textbf{Column 2} \\
    \midrule
    $R$ & 1This is an example sentence \\
    $R$ & 2As well as the line before \\
    $A$ & 3Also this is an example \\
    $R$ & 4This is an example sentence \\
    $R$ & 5As well as the line before \\
    $A$ & 6Also this is an example \\
    $R$ & 7This is an example sentence \\
    $R$ & 8As well as the line before \\
    $A$ & 9Also this is an example \\
    $R$ & 10This is an example sentence \\
    $R$ & 11As well as the line before \\
    $A$ & 12Also this is an example \\
    \bottomrule
    \end{tabularx}
    \caption{Example of an table}
    \end{table}

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

    \end{document} 

Bildbeschreibung hier eingeben Bildbeschreibung hier eingeben

verwandte Informationen