12

I just upgraded my texlive distribution and can no longer insert space in table rows using \\[x pt] syntax when colortbl is loaded.

It seems that recent changes to array.sty might be the problem as this is the only package to change recently.

Can anyone suggest a workaround?

MWE

\listfiles
\documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{l}
  \hline
  No space below with \texttt{colortbl.sty} loaded. \\[10mm]
  \hline
\end{tabular}
\end{document}

File versions in use:

 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
colortbl.sty    2012/02/13 v1.0a Color table columns (DPC)
   array.sty    2018/04/07 v2.4g Tabular extension package (FMi)
   color.sty    2016/07/10 v1.1e Standard LaTeX Color (DPC)
   color.cfg    2016/01/02 v1.6 sample color configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
David Purton
  • 25,884

2 Answers2

4

sorry patching is a bit tricky so I post a new colortbl.sty below, can you test this

%%
%% This is file `colortbl.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% colortbl.dtx  (with options: `package')
%% 
%%
%% Source File: `colortbl.dtx'.
%% Copyright 1996 1998 1999 2012 David Carlisle
%%
%% This file may be distributed under the terms of the LPPL.
%% See readme for details.
%%
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{colortbl}
          [2012/02/13 v1.0a Color table columns (DPC) new array fix]
\edef\@tempa{%
  \noexpand\AtEndOfPackage{%
    \catcode`\noexpand\^^A\the\catcode`\^^A\relax}}
\@tempa
\catcode`\^^A=\catcode`\%
\DeclareOption{debugshow}{\catcode`\^^A=9 }
\DeclareOption*{\PassOptionsToPackage\CurrentOption{color}}
\ProcessOptions
\RequirePackage{array,color}
\def\@classz{\@classx
   \@tempcnta \count@
   \prepnext@tok
\expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil
   \@addtopreamble{%
    \setbox\z@\hbox\bgroup\bgroup
      \CT@everycr{}%
      \ifcase \@chnum
      \hskip\stretch{.5}\kern\z@
      \d@llarbegin
      \insert@column
      \d@llarend\do@row@strut\hskip\stretch{.5}\or
      \d@llarbegin \insert@column \d@llarend\do@row@strut \hfill \or
      \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend\do@row@strut \or
   $\vcenter
   \@startpbox{\@nextchar}\insert@column \@endpbox $\or
   \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
   \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
  \fi
 \egroup\egroup
\begingroup
  \CT@setup
  \CT@column@color
  \CT@row@color
  \CT@cell@color
  \CT@do@color
\endgroup
        \@tempdima\ht\z@
        \advance\@tempdima\minrowclearance
        \vrule\@height\@tempdima\@width\z@
        \unhbox\z@}%
  \prepnext@tok}
\def\CT@setup{%
  \@tempdimb\col@sep
  \@tempdimc\col@sep
  \def\CT@color{%
    \global\let\CT@do@color\CT@@do@color
    \color}}
\def\CT@@do@color{%
  \global\let\CT@do@color\relax
        \@tempdima\wd\z@
        \advance\@tempdima\@tempdimb
        \advance\@tempdima\@tempdimc
        \kern-\@tempdimb
        \leaders\vrule
^^A                     \@height\p@\@depth\p@
                \hskip\@tempdima\@plus  1fill
        \kern-\@tempdimc
        \hskip-\wd\z@ \@plus -1fill }
\def\CT@extract#1\columncolor#2#3\@nil{%
  \if!#2%
    \let\CT@column@color\@empty
  \else
    \if[#2%
      \CT@extractb{#1}#3\@nil
    \else
      \def\CT@column@color{%
        \CT@color{#2}}%
      \CT@extractd{#1}#3\@nil
    \fi
  \fi}
\def\CT@extractb#1#2]#3{%
  \def\CT@column@color{%
    \CT@color[#2]{#3}}%
  \CT@extractd{#1}}%
\def\CT@extractd#1{\@testopt{\CT@extracte{#1}}\col@sep}
\def\CT@extracte#1[#2]{\@testopt{\CT@extractf{#1}[#2]}{#2}}
\def\CT@extractf#1[#2][#3]#4\columncolor#5\@nil{%
  \@tempdimb#2\relax
  \@tempdimc#3\relax
  \edef\CT@column@color{%
    \CT@column@color
    \@tempdimb\the\@tempdimb\@tempdimc\the\@tempdimc\relax}%
  \toks\@tempcnta{#1#4}}%
\let\CT@everycr\everycr
\newtoks\everycr
\CT@everycr{\noalign{\global\let\CT@row@color\relax}\the\everycr}
\def\CT@start{%
  \let\CT@arc@save\CT@arc@
  \let\CT@drsc@save\CT@drsc@
  \let\CT@row@color@save\CT@row@color
  \let\CT@cell@color@save\CT@cell@color
  \global\let\CT@cell@color\relax}
\def\CT@end{%
  \global\let\CT@arc@\CT@arc@save
  \global\let\CT@drsc@\CT@drsc@save
  \global\let\CT@row@color\CT@row@color@save
  \global\let\CT@cell@color\CT@cell@color@save}
\gdef\@ishortstack#1{%
  \CT@start\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\CT@end\egroup}
\AtBeginDocument{%
  \expandafter\def\expandafter\@tabarray\expandafter{%
    \expandafter\CT@start\@tabarray}}
\def\endarray{\crcr \egroup \egroup \gdef\@preamble{}\CT@end}
\long\def\multicolumn#1#2#3{%
   \multispan{#1}\begingroup
   \def\@addamp{\if@firstamp \@firstampfalse \else
                \@preamerr 5\fi}%
   \@mkpream{#2}\@addtopreamble\@empty
   \endgroup
   \def\@sharp{#3}%
   \let\CT@cell@color\relax
   \let\CT@column@color\relax
   \let\CT@do@color\relax
   \@arstrut \@preamble
   \null
   \ignorespaces}
\def\@classvi{\ifcase \@lastchclass
      \@acol \or
      \ifx\CT@drsc@\relax
        \@addtopreamble{\hskip\doublerulesep}%
      \else
        \@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}%
      \fi\or
      \@acol \or
      \@classvii
      \fi}
\def\doublerulesepcolor#1#{\CT@drs{#1}}
\def\CT@drs#1#2{%
 \ifdim\baselineskip=\z@\noalign\fi
  {\gdef\CT@drsc@{\color#1{#2}}}}
\let\CT@drsc@\relax
\def\arrayrulecolor#1#{\CT@arc{#1}}
\def\CT@arc#1#2{%
  \ifdim\baselineskip=\z@\noalign\fi
  {\gdef\CT@arc@{\color#1{#2}}}}
\let\CT@arc@\relax
\def\@arrayrule{\@addtopreamble {{\CT@arc@\vline}}}
\def\hline{%
  \noalign{\ifnum0=`}\fi
              \let\hskip\vskip
               \let\vrule\hrule
               \let\@width\@height
  {\CT@arc@\vline}%
  \futurelet
   \reserved@a\@xhline}
\def\@xhline{\ifx\reserved@a\hline
               {\ifx\CT@drsc@\relax
                  \vskip
               \else
                  \CT@drsc@\hrule\@height
               \fi
               \doublerulesep}%
             \fi
      \ifnum0=`{\fi}}
\def\@cline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}%
  \cr
  \noalign{\vskip-\arrayrulewidth}}
\newlength\minrowclearance
\minrowclearance=0pt
\expandafter\def\expandafter\@mkpream\expandafter#\expandafter1%
  \expandafter{%
    \expandafter\let\expandafter\CT@setup\expandafter\relax
    \expandafter\let\expandafter\CT@color\expandafter\relax
    \expandafter\let\expandafter\CT@do@color\expandafter\relax
    \expandafter\let\expandafter\color\expandafter\relax
    \expandafter\let\expandafter\CT@column@color\expandafter\relax
    \expandafter\let\expandafter\CT@row@color\expandafter\relax
    \expandafter\let\expandafter\CT@cell@color\expandafter\relax
    \@mkpream{#1}}
\let\CT@do@color\relax
\def\rowcolor{%
  \noalign{\ifnum0=`}\fi
  \global\let\CT@do@color\CT@@do@color
  \@ifnextchar[\CT@rowa\CT@rowb}
\def\CT@rowa[#1]#2{%
  \gdef\CT@row@color{\CT@color[#1]{#2}}%
  \CT@rowc}
\def\CT@rowb#1{%
  \gdef\CT@row@color{\CT@color{#1}}%
  \CT@rowc}
\def\CT@rowc{%
  \@ifnextchar[\CT@rowd{\ifnum`{=0\fi}}}
\def\CT@rowd[#1]{\@testopt{\CT@rowe[#1]}{#1}}
\def\CT@rowe[#1][#2]{%
  \@tempdimb#1%
  \@tempdimc#2%
  \xdef\CT@row@color{%
    \expandafter\noexpand\CT@row@color
    \@tempdimb\the\@tempdimb
    \@tempdimc\the\@tempdimc
    \relax}%
  \ifnum0=`{\fi}}
\edef\cellcolor{\noexpand\protect
  \expandafter\noexpand\csname cellcolor \endcsname}
\@namedef{cellcolor }{%
  \@ifnextchar[{\CT@cellc\@firstofone}{\CT@cellc\@gobble[]}%
}
\def\CT@cellc#1[#2]#3{%
  \expandafter\gdef\expandafter\CT@cell@color\expandafter{%
    \expandafter\CT@color#1{[#2]}{#3}%
    \global\let\CT@cell@color\relax
}}
\global\let\CT@cell@color\relax
\AtBeginDocument{%
  \def\@tempa{$\hfil\egroup\box\z@\box\tw@}%
  \ifx\@tempa\DC@endright
    \def\DC@endright{%
      $\hfil\egroup
    \ifx\DC@rl\bgroup
      \hskip\stretch{-.5}\box\z@\box\tw@\hskip\stretch{-.5}%
    \else
      \box\z@\box\tw@
    \fi}%
  \else
    \def\@tempa{$\hfil\egroup\hfill\box\z@\box\tw@}%
    \ifx\@tempa\DC@endright
      \def\DC@endright{%
        $\hfil\egroup%
        \hskip\stretch{.5}\box\z@\box\tw@\hskip\stretch{-.5}}%
    \fi
  \fi}
\AtBeginDocument{%
  \ifx\hhline\@undefined\else
\def\HH@box#1#2{\vbox{{%
  \ifx\CT@drsc@\relax\else
    \global\dimen\thr@@\tw@\arrayrulewidth
    \global\advance\dimen\thr@@\doublerulesep
    {\CT@drsc@
     \hrule \@height\dimen\thr@@
     \vskip-\dimen\thr@@}%
  \fi
  \CT@arc@
  \hrule \@height \arrayrulewidth \@width #1
  \vskip\doublerulesep
  \hrule \@height \arrayrulewidth \@width #2}}}
\def\HH@loop{%
  \ifx\@tempb`\def\next##1{\the\toks@\cr}\else\let\next\HH@let
  \ifx\@tempb|\if@tempswa
          \ifx\CT@drsc@\relax
           \HH@add{\hskip\doublerulesep}%
          \else
           \HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}%
           \fi
          \fi\@tempswatrue
          \HH@add{{\CT@arc@\vline}}\else
  \ifx\@tempb:\if@tempswa
          \ifx\CT@drsc@\relax
           \HH@add{\hskip\doublerulesep}%
          \else
           \HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}%
           \fi
              \fi\@tempswatrue
      \HH@add{\@tempc\HH@box\arrayrulewidth\arrayrulewidth\@tempc}\else
  \ifx\@tempb##\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue
         \HH@add{{\CT@arc@\vline\copy\@ne\@tempc\vline}}\else
  \ifx\@tempb~\@tempswafalse
           \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
              \ifx\CT@drsc@\relax
                \HH@add{\hfil}\else
                 \HH@add{{%
                   \CT@drsc@\leaders\hrule\@height\HH@height\hfil}}%
               \fi
                 \else
  \ifx\@tempb-\@tempswafalse
           \gdef\HH@height{\arrayrulewidth}%
           \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
              \HH@add{{%
                \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfil}}%
                           \else
  \ifx\@tempb=\@tempswafalse
       \gdef\HH@height{\dimen\thr@@}%
       \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
       \HH@add
          {\rlap{\copy\@ne}\leaders\copy\@ne\hfil\llap{\copy\@ne}}\else
  \ifx\@tempb t\HH@add{%
    \def\HH@height{\dimen\thr@@}%
    \HH@box\doublerulesep\z@}\@tempswafalse\else
  \ifx\@tempb b\HH@add{%
    \def\HH@height{\dimen\thr@@}%
    \HH@box\z@\doublerulesep}\@tempswafalse\else
  \ifx\@tempb>\def\next##1##2{%
     \HH@add{%
      {\baselineskip\p@\relax
       ##2%
      \global\setbox\@ne\HH@box\doublerulesep\doublerulesep}}%
       \HH@let!}\else
  \PackageWarning{hhline}%
      {\meaning\@tempb\space ignored in \noexpand\hhline argument%
       \MessageBreak}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \next}
\fi}
\AtBeginDocument{
  \ifx\longtable\@undefined\else
    \def\LT@@hline{%
      \ifx\LT@next\hline
        \global\let\LT@next\@gobble
        \ifx\CT@drsc@\relax
          \gdef\CT@LT@sep{%
            \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}%
        \else
          \gdef\CT@LT@sep{%
            \multispan\LT@cols{%
              \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill}\cr}%
        \fi
      \else
        \global\let\LT@next\empty
        \gdef\CT@LT@sep{%
          \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}%
      \fi
      \ifnum0=`{\fi}%
      \multispan\LT@cols
       {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr
      \CT@LT@sep
      \multispan\LT@cols
       {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr
      \noalign{\penalty\@M}%
      \LT@next}
    \fi}
\endinput
%%
%% End of file `colortbl.sty'.
David Carlisle
  • 757,742
  • Thanks! This still has some issues with my actual table. I'll see if I can simplify things and update my MWE. – David Purton Apr 30 '18 at 08:17
  • My actual table uses tabu and row spacing is still very messed up. I'll add an example. – David Purton Apr 30 '18 at 08:36
  • 2
    @DavidPurton will look later need to attend to the day job first, but that might have been better as a separate question, as colortbl I will definitely update to match array if that is needed, but tabu might be harder to get updated as we don't have write access to that, can only ask... but it might be possible to arrange the array package change differently so it has less effect on packages that are extending array. We'll see. Thanks for the example in any case. If you just want to get your document done, then rather than updating colortbl you could revert array.sty for now. – David Carlisle Apr 30 '18 at 09:03
  • I nearly did answer a separate question. I'll revert my change and tie this one off. – David Purton Apr 30 '18 at 10:16
  • New question at https://tex.stackexchange.com/q/429307/87678 – David Purton Apr 30 '18 at 10:39
1

The core issue in array.sty is due to some code missing for the \multicolumn case and needs some extra code there. The suggested fix for colortbl in David's answer as not quite complete and need also some further lines. Both are discussed in https://github.com/latex3/latex2e/issues/42 and a fixed version should come up in a couple of days.