ltablex キャプション テキストの書式設定の問題

ltablex キャプション テキストの書式設定の問題

複数ページにわたる長い表を作成するためにこのパッケージを使用していますltablex。他の小さな表にもこのtabularxパッケージを使用していますが、書式設定の間違いかバグに気付きました。

作成した長い表の表キャプション テキストが行と正しく一致しませんbottomrule

コードを実行すると、小さな表の下部にあるキャプションが行と正しく揃うことがわかりますbottomrule。しかし、長い表では、キャプションのテキストが行と正しく揃いませんbottomrule。テキストが左側で少し目立っています。

\begin{table]および環境を使用せずに小さなテーブルを使用し\end{table}、 内にキャプションを配置するとtabularx、長いテーブルと同じ問題が発生します。長いテーブルで正しく動作させるにはどうすればよいですか。 および\begin{table]環境を使用できないので、および\end{table}環境を使用して小さなテーブルのようにキャプション テキストをフォーマットする別の方法はありますか。\begin{table]\end{table}

写真を 2 枚追加しました。最初の写真は長いテーブルの一部、2 番目の写真は小さなテーブルです。

ここに画像の説明を入力してください ここに画像の説明を入力してください

編集 - 完全なコード

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

答え1

使用

\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 \\
    [...]

キャプションは の中になければなりませんtabularx。そしてないtableの環境を使用しますtabularx。独自のtableカウンターがあります。

ここに画像の説明を入力してください

ここに画像の説明を入力してください

答え2

私の問題の解決策は、\captionsetup{margin=1pt}キャプション パッケージを使用することです。2pt を使用すると、キャプションの配置が正しくなります。

感謝ハーバート

または、私のように Komascript を使用する場合の代替手段として、コマンドは\setcapmargin{2pt}同じことを実行します。

答え3

longtableキャプションは、 の場合と同様に、foot表の下部にキャプションを表示する場合は仕様内に、表の上に表示する場合は仕様内に組み込む必要がありますhead(推奨)。

また、 をロードする場合は、 ltablex によってロードされるため、 も もltablexロードする必要はありません。tabularxlongtable

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

ここに画像の説明を入力してください ここに画像の説明を入力してください

関連情報