1

I am trying to use the packages xcolor and tcolorbox but there seems to be some sort of compatibility issue. In the example below I have included two lines that are commented and the example compiles just fine. But if these lines are uncommented, then the coloring of the table doesn't work.

Grateful for your help and insights.

\documentclass{article}
\usepackage{lipsum}

\usepackage{tcolorbox}
%\usepackage[table]{xcolor}

\begin{document}
\lipsum[2]

\vskip 10 mm

\begin{tcolorbox}
\lipsum[3]
\end{tcolorbox}

\vskip 10 mm

%{\rowcolors{1}{gray!80!white!50}{gray!70!white!40}
\begin{tabular}{|p{8cm}|l|l|}
\hline \textbf{Question} & \textbf{Right} & \textbf{Wrong} \\ 
\hline Vestibulum luctus nibh at lectus.  &  &  \\ 
\hline Sed bibendum, nulla a faucibussemper,  leo  velit  ultricies  tellus,  ac  venenatis  arcu  wisi  vel  nisl. &  &  \\ 
\hline
\end{tabular} 
%}

\end{document}
1
  • 6
    tcolorbox already loads xcolor, but with different options. Use \PassOptionsToPackage{table}{xcolor}\usepackage{tcolorbox} Commented Jan 23, 2021 at 21:26

1 Answer 1

1

Beside solution given in the @Ulrike Fisher comment, you can insert option table for xcolor between options of the used document class:

\documentclass[table]{article} % <---
\usepackage{lipsum}
\usepackage{tcolorbox}

\begin{document}
\lipsum[2]

\vskip 10 mm

\begin{tcolorbox}
\lipsum[3]
\end{tcolorbox}

\vskip 10 mm

\rowcolors{1}{gray!80!white!20}{gray!60!white!40}
\begin{tabular}{|p{8cm}|l|l|}
\hline \textbf{Question} & \textbf{Right} & \textbf{Wrong} \\
\hline Vestibulum luctus nibh at lectus.  &  &  \\
\hline Sed bibendum, nulla a faucibussemper,  leo  velit  ultricies  tellus,  ac  venenatis  arcu  wisi  vel  nisl. &  &  \\
\hline
\end{tabular}

\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged .