![[tabela]{xcolor} e conflito de array v2.4k](https://rvso.com/image/391590/%5Btabela%5D%7Bxcolor%7D%20e%20conflito%20de%20array%20v2.4k%20.png)
Estou tentando criar uma tabela com:
- formatação diferente entre células
- notas de rodapé
- minipáginas
- linhas coloridas
Para as linhas coloridas que estou tentando usar xcolor
com a [table]
opção.
No entanto, isso gera um erro na >{\bfseries}
especificação da coluna. Estou usando o MiKTeX 2.9.6972 no Windows 10 x64 e versão 2.4k do array
pacote conforme descrito emaqui, e XeLaTeX para compilar (embora PDFLaTeX pareça gerar o mesmo erro). Isso funciona se eu desligar o xcolor
pacote, mas o \rowcolor
comando não estiver mais disponível.
Minha pergunta é dupla:
- É possível usar
[table]{xcolor}
e{array}
juntos? - Caso contrário, existe uma alternativa para colorir uma linha de uma tabela?
MWE:
\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}
O erro que recebo é:
! 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.