![[テーブル]{xcolor} と配列 v2.4k の競合](https://rvso.com/image/391590/%5B%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%5D%7Bxcolor%7D%20%E3%81%A8%E9%85%8D%E5%88%97%20v2.4k%20%E3%81%AE%E7%AB%B6%E5%90%88%20.png)
次のテーブルを作成しようとしています:
- セル間で異なる書式設定
- 脚注
- ミニページ
- 色付きの行
色付きの行については、オプションxcolor
で使用しようとしています[table]
。
しかし、列の仕様でエラーが発生します>{\bfseries}
。私はWindows 10 x64でMiKTeX 2.9.6972とarray
パッケージのバージョン2.4kを使用しています。ここ、および XeLaTeX をコンパイルします (ただし、PDFLaTeX は同じエラーを生成するようです)。xcolor
パッケージをオフにすると機能しますが、その場合、\rowcolor
コマンドは使用できなくなります。
私の質問は2つあります:
[table]{xcolor}
と を一緒に使用することは可能ですか{array}
?- そうでない場合、表の行に色を付ける代替手段はありますか?
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}
表示されるエラーは次のとおりです:
! 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.