减少两个禁忌环境之间的空间

减少两个禁忌环境之间的空间

我有一个包含两个表格的文档longtabu。问题是它们之间的垂直空间太大(如红线所示):

桌子之间的空间有问题

我想减少这个空间,同时保留布局。代码如下:

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{xcolor}
\usepackage{blindtext}
\newlength{\firstcolumn}
\setlength{\firstcolumn}{3.5cm}
\renewcommand*{\familydefault}{\sfdefault}
\begin{document}
\tabulinesep=1.5mm
\begin{longtabu} to
  \textwidth{@{}p{\firstcolumn}X}%
  \textcolor{gray}{\rule{\firstcolumn}{0.15cm}} &
  \textcolor{gray}{\Large\mdseries\upshape Test} \\
  A - B & My first line  \\
  & My second line \\
  D - F & \blindtext \\
\end{longtabu}
\begin{longtabu} to \textwidth{@{}p{\firstcolumn}X}%
  \textcolor{gray}{\rule{\firstcolumn}{0.15cm}} &
  \textcolor{gray}{\Large\mdseries\upshape Test 2} \\
  A - B & My first line  \\
  & My second line \\
  & My third line  \\
  & \blindtext \\ 
\end{longtabu}
\end{document}

答案1

如果这种情况在您的文档中很少见,最简单的方法是将其放在\vskip-1em表格之间。这将减少垂直空间1em

  ...
  D - F & \blindtext \\
\end{longtabu}\vskip-1em
\begin{longtabu} to \textwidth{@{}p{\firstcolumn}X}%
  \textcolor{gray}{\rule{\firstcolumn}{0.15cm}} &
  ...

答案2

\tabulinesep在最后一行之后也使用。使用\vspace*

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{xcolor}
\usepackage{blindtext}
\newlength{\firstcolumn}
\setlength{\firstcolumn}{3.5cm}
\renewcommand*{\familydefault}{\sfdefault}
\raggedbottom
\begin{document}
 \extrarowsep=1.5mm 
    \begin{longtabu} to 
        \textwidth{@{}p{\firstcolumn}X}%
        \textcolor{gray}{\rule{\firstcolumn}{0.15cm}} &
        \textcolor{gray}{\Large\mdseries\upshape Test} \\
        A - B & My first line  \\
        & My second line \\
        D - F & \blindtext 
    \end{longtabu}

\vspace*{\dimexpr-\extrarowdepth-\extrarowheight}
    \begin{longtabu} to \textwidth{@{}p{\firstcolumn}X}%
        \textcolor{gray}{\rule{\firstcolumn}{0.15cm}} &
        \textcolor{gray}{\Large\mdseries\upshape Test 2} \\
        A - B & My first line  \\
        & My second line \\
        & My third line  \\
        & \blindtext 
    \end{longtabu}

\end{document}

相关内容