[table]{xcolor} 和陣列 v2.4k 衝突

[table]{xcolor} 和陣列 v2.4k 衝突

我正在嘗試創建一個表:

  1. 不同單元格的格式不同
  2. 註腳
  3. 小型頁面
  4. 彩色行

對於彩色行,我嘗試xcolor與該[table]選項一起使用。

但是,這會引發列規格錯誤>{\bfseries}。我在 Windows 10 x64 上使用 MiKTeX 2.9.6972 和該array套件的版本 2.4k,如中所述這裡和 XeLaTeX 進行編譯(儘管 PDFLaTeX 似乎會產生相同的錯誤)。如果我關閉xcolor程式包,則此方法有效,但該\rowcolor命令不再可用。

我的問題有兩個:

  1. [table]{xcolor}和可以{array}一起使用嗎?
  2. 如果沒有,是否有其他方法可以為表格的一行著色?

微量元素:

\documentclass{article}
\usepackage[table]{xcolor} % works if we remove the 'table' option, but then we don't have access to cellcolor/rowcolor
%\usepackage{xcolor}

\usepackage{booktabs}

% force the new array package to be loaded.
\usepackage{tabularx}

% https://texfaq.org/FAQ-wholerow
\newcolumntype{@}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
   #1\ignorespaces
}

\begin{document}

\begin{tabular}{>{\bfseries}@p{5.5cm}^r}
    Col A  & Col B  \\
    \midrule
    \rowstyle{\bfseries\itshape\large}This row should be large, bold, italics with shading & So this cell too. \\
    \rowcolor{blue}This bold but shaded & this just normal.\footnote{I.e., no extra mark-up} \\
    Remark & \multicolumn{1}{c}{\begin{minipage}[t]{3.5cm}\raggedright {\footnotesize Some cells are included as a minipage to accommodate extra text.}\end{minipage}} \\
    \midrule    
 \end{tabular}

 \end{document}

我得到的錯誤是:

! Use of \@startpbox doesn't match its definition.
<inserted text> \@startpbox {
                         >{\bfseries }@p{5.5cm}^r}
l.19 \begin{tabular}{>{\bfseries}@p{5.5cm}^r}

If you say, e.g., `\def\a1{...}', then you must always put `1' after `\a', 
since control sequence names are made up of letters only. 
The macro here has not been followed by the required stuff, so I'm ignoring
it.

! LaTeX Error: Command \bfseries invalid in math mode.

相關內容