[Tex/LaTex] tcolorbox incompatibe with color package

colortcolorbox

I am trying to add a tcolorbox into my Xelatex document but it does not seem to work. I tracked the problem to the color package which if disabled produces the box. However I need to use the color package.

How can I work around this?

Here is a MWE

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{lipsum}

% Uncomment the next line to get the error
%\usepackage[usenames,dvipsnames]{color}

\begin{document}

\begin{tcolorbox}[colback=green!5,colframe=green!40!black,title=A nice heading]
\lipsum[2]
\end{tcolorbox}

\end{document}

Best Answer

xcolor is an enhanced version of color but the real trick here is simply to load it first:

\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tcolorbox}
\usepackage{lipsum}


\begin{document}

\begin{tcolorbox}[colback=green!5,colframe=green!40!black,title=A nice heading]
\lipsum[2]
\end{tcolorbox}

\end{document}

box back

Related Question