# Avoid Option clash for package xcolor

I've looked at other questions about option clash for package xcolor to no avail. Tried putting xcolor before hyperref and tikz, tried adding options [usenames, dvispsnames] to documentclass, and I still get the error. It also appears to always find the error on line 14, regardless of what is on line 14.

How do I fix this?

Here's a MWE:

\documentclass[letterpaper, usenames, dvipsnames]{article}

\usepackage{graphicx}
\usepackage{float}
\usepackage[letterpaper, top=1.125in, bottom=1.125in, left=0.75in, right=0.75in, footskip=0.00in]{geometry}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{pxfonts}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage[toc, page]{appendix}
\usepackage[printwatermark]{xwatermark}
\usepackage{tikz}
\usepackage{hyperref}
% Make the links blue, to follow the Web convention. Using xcolor syntax, internal links will be
% 70 % blue, the remainder black, and URLs 80 % blue (brighter)

\DeclareGraphicsExtensions{.png,.pdf,.jpg,.mps}

% Setup Draft watermark %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newsavebox\mybox
\savebox\mybox{\tikz[color=red,opacity=0.3]\node{DRAFT};}
\newwatermark*[allpages, angle=45, scale=6, xpos=-20, ypos=15]{\usebox\mybox}

\begin{document}
Test
\end{document}

• just deleting \usepackage[usenames, dvipsnames]{xcolor} probably does the right thing – David Carlisle Jun 2 '15 at 23:45
• Just using \usepackage{xcolor} also works – onewhaleid Jun 2 '15 at 23:53
• Yes, but I need those options in my actual document... – Beachcomber Jun 3 '15 at 14:38

Replace

\usepackage[usenames, dvipsnames]{xcolor}


with

\PassOptionsToPackage{usenames,dvipsnames}{xcolor}


and then let tikz load the package.

Or add whichever options tikz wants to the options you load xcolor with. For example,

\usepackage[usenames,dvipsnames,rgb]{xcolor}


This odd behavior is added by package catoptions, loaded by xwatermark. Loading a package more than once with different options is not an error in normal LaTeX as long as the first package loading already contains the superset of all options. LaTeX does not load a package file twice (\newcommand and other things would not work), but it checks, if there are new options, which are not present at the first loading and throws an error message.

The best workaround seems to be \PassOptionsToPackage, see the answer of absent.

• I have written a bug report to the author of package catoptions. – Heiko Oberdiek Jun 3 '15 at 1:18
• Thanks! There seemed to be a strange interaction in catoptions in one of the iterations I tried that warned about using default options. – Beachcomber Jun 3 '15 at 16:10