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}

John W. de Burgh
  • 1,245
  • 1
  • 7
  • 15
  • 6
    tcolorbox already loads xcolor, but with different options. Use \PassOptionsToPackage{table}{xcolor}\usepackage{tcolorbox} – Ulrike Fischer Jan 23 '21 at 21:26

1 Answers1

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

Zarko
  • 296,517