![[table]{xcolor} и массив v2.4k конфликтуют](https://rvso.com/image/391590/%5Btable%5D%7Bxcolor%7D%20%D0%B8%20%D0%BC%D0%B0%D1%81%D1%81%D0%B8%D0%B2%20v2.4k%20%D0%BA%D0%BE%D0%BD%D1%84%D0%BB%D0%B8%D0%BA%D1%82%D1%83%D1%8E%D1%82%20.png)
Я пытаюсь создать таблицу с:
- разное форматирование ячеек
- сноски
- мини-страницы
- цветные ряды
Для цветных рядов я пытаюсь использовать xcolor
опцию [table]
.
Однако это приводит к ошибке спецификации >{\bfseries}
столбца. Я использую MiKTeX 2.9.6972 на Windows 10 x64 и версию 2.4k пакета, array
как описано вздесь, и XeLaTeX для компиляции (хотя PDFLaTeX, похоже, генерирует ту же ошибку). Это работает, если я отключаю пакет xcolor
, но тогда \rowcolor
команда больше недоступна.
У меня два вопроса:
- Можно ли использовать
[table]{xcolor}
и{array}
вместе? - Если нет, есть ли альтернатива раскрашиванию строки таблицы?
МВЭ:
\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.