# LaTeX Error: Option clash for package xcolor

I have an option clash between package xcolor and another package, but I don't know which. Here is my MWE

\documentclass[10pt]{beamer}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{url}
\usepackage{color}
\usepackage[usenames]{xcolor}

\author{The author}
\title{Package conflicts}
\date{October 3rd, 2012}

\begin{document}

This is supposed to be \textcolor{olivegreen}{olivegreen}
\end{document}


And the error message is :

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./error_xcolor.tex
LaTeX2e <2009/09/24>
<blablabla>
! LaTeX Error: Option clash for package xcolor.


I hope this is enough log for you guys. At this time of the day, I'm hoping for America to save my french ass ... again : )

• I think the duplicate is wrong. The pointed-to question is for clashes created by usepackage, this is for clashes created by documentclass, that can't be resolved by reorganizing the order of loading. Apr 13, 2021 at 5:29
• Or at least, this: tex.stackexchange.com/questions/567959/… is a better duplicate. Apr 13, 2021 at 6:42

The beamer class loads xcolor per default. You can issue the option via a beamer-option

\documentclass[10pt,xcolor={usenames}]{beamer}


olivegreen on the other hand needs the dvipsnames option and is called OliveGreen:

\documentclass[10pt,xcolor={dvipsnames}]{beamer}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{url}

\author{The author}
\title{Package conflicts}
\date{October 3rd, 2012}

\begin{document}

This is supposed to be \textcolor{OliveGreen}{olivegreen}
\end{document}


You could do

\documentclass[10pt,xcolor={usenames,dvipsnames}]{beamer}


but don't (usenames is obsolete).
TeXLive 2009 is old …

• I faced the same issue with the article class and this didn't worked for me (TeX Live 2019). I had to use the folowwing macro : \PassOptionsToPackage{dvipsnames}{xcolor} Oct 26, 2020 at 17:54
• You can just do \documentclass[dvipsnames]{article} which will forward dvipsnames to all packages – if they support such an option. Aug 11 at 15:40

that is a problem with beamer which should pass the package option not in this way. You can use

\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[10pt]{beamer}
[...]


The same problem occurs if you want to load options for package graphicx. Then you also have to use the macro \PassOptionsToPackage

• This one worked for me but I am not using beamer, I am using a custom .cls from my organization. This solution may be a solution for those who are not looking at beamer specifically. Aug 30, 2019 at 22:27
\documentclass[xcolor=tex,dvipsnames,table,10pt]{beamer}

• We need more detail here. Can you provide the motivation behind this answer?
– Werner
Jul 21, 2021 at 15:59