![[table]{xcolor} und Array v2.4k Konflikt](https://rvso.com/image/391590/%5Btable%5D%7Bxcolor%7D%20und%20Array%20v2.4k%20Konflikt%20.png)
Ich versuche, eine Tabelle zu erstellen mit:
- unterschiedliche Formatierung in den Zellen
- Fußnoten
- Miniseiten
- farbige Reihen
Für die farbigen Zeilen versuche ich xcolor
die [table]
Option zu verwenden.
Dies wirft jedoch einen Fehler mit der >{\bfseries}
Spaltenspezifikation auf. Ich verwende MiKTeX 2.9.6972 unter Windows 10 x64 und Version 2.4k des array
Pakets wie in beschriebenHierund XeLaTeX zum Kompilieren (obwohl PDFLaTeX den gleichen Fehler zu erzeugen scheint). Das funktioniert, wenn ich das Paket ausschalte xcolor
, aber dann ist der \rowcolor
Befehl nicht mehr verfügbar.
Meine Frage ist zweifach:
- Ist es möglich,
[table]{xcolor}
und{array}
zusammen zu verwenden? - Wenn nicht, gibt es eine Alternative zum Einfärben einer Tabellenzeile?
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}
Ich erhalte folgende Fehlermeldung:
! 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.