我刚刚升级了我的 texlive 发行版,现在无法再在加载\\[x pt]
时使用语法在表格行中插入空格。colortbl
看来最近的更改可能array.sty
是问题所在,因为这是最近唯一更改的包。
有人可以建议一个解决方法吗?
平均能量损失
\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}
正在使用的文件版本:
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
答案1
抱歉,修补有点棘手,所以我colortbl.sty
在下面发布了一个新的,你可以测试一下吗
%%
%% 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'.
答案2
array.sty 中的核心问题是由于缺少一些代码\multicolumn
,需要一些额外的代码。David 的回答中对 colortbl 的建议修复并不完整,还需要一些额外的代码。两者都在
https://github.com/latex3/latex2e/issues/42修复版本将在几天内发布。