减少 ThreePartTable 和 Caption 之间的空间

减少 ThreePartTable 和 Caption 之间的空间

我在需要处理长表格的环境xltabular中有一个。但与我之前的设计相比,表格和下面的标题之间的空间变得太大了。有人知道我该如何减少这个空间吗?ThreePartTabletabularxthreeparttable

\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{ThreePartTable}
}{
        \caption{\tablecaption}
        \label{\tablelabel}
    \end{ThreePartTable}
}

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

更新:
我发现的一个解决方案是\setlength{\abovecaptionskip}{0pt}直接将另一个添加到 中tableenv。如果有人有更好的解决方案,我会很感兴趣!

相关内容