1

I'm trying to create a table with:

  1. different formatting across cells
  2. footnotes
  3. minipages
  4. coloured rows

For the coloured rows I'm trying to use xcolor with the [table] option.

However, this throws an error with the >{\bfseries} column spec. I'm using MiKTeX 2.9.6972 on Windows 10 x64 and version 2.4k of the array package as described in here, and XeLaTeX to compile (although PDFLaTeX seems to generate the same error). This works if I switch off the xcolor package, but then the \rowcolor command is no longer available.

My question is two-fold:

  1. Is it possible to use [table]{xcolor} and {array} together?
  2. If not, is there an alternative to color a row of a table?

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}

The error I get is:

! 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.

closed as off-topic by Johannes_B, JouleV, Stefan Pinnow, TeXnician, Raaja Mar 11 at 9:12

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    you look like you have an old version somewhere, can you post your log file for the above, after defining grey? – David Carlisle Mar 3 at 7:35
  • 2
    We do not like going to sites for data. I cannot read from Dropbox on my tablet, but remember: under miktex you essentially have two installations, admin and user. If you only updated admin, user may still have an old version dangling (user takes precedence). Did you update as both user and admin? – daleif Mar 3 at 7:42
  • 1
    Now I got access to the log. As expected, you have old versions dangling under AppData (see the log) – daleif Mar 3 at 7:43
  • 3
    See also tex.stackexchange.com/q/55437/35864 and tex.stackexchange.com/q/108447/35864. If you installed MikTeX as a multi-user system, you will have two more or less independent package trees: One managed by the user and one by the admin. Files in the user tree are given preference over the global admin files. If you update your system it is important to update in both admin and user mode to make sure that everything is up to date and that versions match. Contrary to what one might think the Admin updater is not more powerful in that it would also update the user installs. – moewe Mar 3 at 7:51
  • 5
    I'm voting to close this question as off-topic because the issue was solved by updating the TeX distribution. – Johannes_B Mar 11 at 8:38

Browse other questions tagged or ask your own question.