threeparttable 环境中的多页 tabularx

threeparttable 环境中的多页 tabularx

我遇到的问题是,大于一页的表格无法正确拆分,而只是与第一页重叠。我使用tabularxwithltablex时,单独使用时效果很好,但一旦我将整个表格包装成 a,threeparttable它就不会再破坏页面。支持这种组合吗?我知道我可以尝试,longtable但我不想根据表格的大小使用特殊的包装。

这是 MWE

\documentclass[a4paper,10pt,notitlepage]{article}   % papersize, fontsize, documentclass; 
\usepackage{xltabular}
\usepackage[flushleft]{threeparttablex}     % to have a dedicated notes section after tables
\usepackage[font=small, margin=0pt]{caption}            % table and figure captions
\usepackage[table]{xcolor}                  % used for table alternatively colors
\usepackage{booktabs}                       % use package booktabs for easy creating tables

% Spacing and margin rules
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{1pt}%
\setlength{\abovecaptionskip}{7pt}
\setlength{\belowcaptionskip}{10pt}
\setlength{\textfloatsep}{5pt}
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% CAPTION STYLE
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\DeclareCaptionFormat{labelstyle}{%
    \setlength\fboxsep{3pt}%
    \colorbox{blue}{{#1}}#2#3
} 

\captionsetup[table]{singlelinecheck=false, labelfont={color=white}}    % Rechtsbündige Tabellen und Bildbeschreibung
\captionsetup[figure]{singlelinecheck=false, labelfont={color=white}, justification = raggedright, format=labelstyle}

% ------------------------------------------------------------------------------------------------------------------------
% TABLE
\newcommand{\tablestyle} { 
    \captionsetup{type=table, format=labelstyle}
    \renewcommand{\arraystretch}{1.25}
    \arrayrulecolor{blue} 
    \aboverulesep = 0mm 
    \belowrulesep = 0mm 
    }

\newenvironment{tableenv}[2]{
    \par\vspace{0.5cm}
    \def\tablecaption{#1}
    \def\tablelabel{tab:#2}
        \small
        \tablestyle
        \begin{table}
        \begin{threeparttable}
}{
        \caption{\tablecaption}
        \label{\tablelabel}
    \end{threeparttable}
    \end{table}
}

\begin{document}

\section{Section with long table}
\begin{tableenv}{test}{test}
\begin{xltabular}{\linewidth}{@{} X @{}}

    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
    awdafgawfgawfa\\
\end{xltabular}
\end{tableenv}

\end{document}

它仍然没有破坏桌子,我不知道为什么,如果我移除环境,它就会破坏tableenv

相关内容