# XeTeX giving option clash error [duplicate]

I'm trying to clear a maddening error from this .tex file:

%
% Syllabus template for use with http://kjhealy.github.com/latex-custom-kjh
%
\documentclass[11pt,article,oneside]{memoir}

%% Script-based version control (requires vc package)
% \input{vc}

\usepackage{graphicx,url}
\usepackage{rotating}
\usepackage{memoir-article-styles} % in latex-custom-kjh/needs-memoir

%% Choose font system. Comment out these lines if you are not using xelatex
\usepackage{fontspec}
\usepackage{xunicode}

% Biblatex
\usepackage[american]{babel}
\usepackage[babel]{csquotes}
\usepackage[style=authoryear,
bibstyle=authoryear,
citestyle=authoryear-comp,
uniquename=false,
hyperref=true,
backend=biber, babel=hyphen, bibencoding=inputenc]{biblatex}

%% Fix biblatex's odd preference for using In: by default.
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{}\intitlepunct}}}

%% Bibliography from http://kjhealy.github.com/socbibs/

% Definitions
\def\myauthor{Kieran Healy}
\def\mytitle{Sociology 155: Organizations and Management}
\def\mysubtitle{Syllabus}
\def\mykeywords{}
\def\mybibliostyle{plain}
\def\mybibliocommand{}
\def\mysubtitle{}
\def\myemail{kjhealy@soc.duke.edu}
\def\myweb{http://www.kieranhealy.org}
\def\myphone{660-5737}
\def\myaffiliation{\ \\Duke University}

\usepackage[usenames,dvipsnames]{color}
\usepackage[xetex,
urlcolor=BrickRed,
plainpages=false,
pdfpagelabels,
bookmarksnumbered,
pdftitle={\mytitle},
pdfauthor={\myauthor},
pdfkeywords={\mykeywords}
]{hyperref}

%% Uncomment to make a "DRAFT" watermark
% Page watermark
% \usepackage{type1cm,eso-pic}
% \makeatletter
% \setlength{\@tempdimb}{.5\paperwidth}%
% \setlength{\@tempdimc}{.5\paperheight}%
% \setlength{\unitlength}{1pt}%
% \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
% \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.9}%
% {\fontsize{3cm}{3cm}\selectfont{Draft Only}}}}%
% Marginal Watermark
% \makebox(-100,-300){\rotatebox{45}{\textcolor[gray]{0.95}%
% {\fontsize{2cm}{2cm}\selectfont{}}}}
% \makebox(-500,-0){\rotatebox{90}{\textcolor[gray]{0.95}%
% {\fontsize{0.7cm}{0.7cm}\selectfont{}}}}
% }%
% }
% \makeatother

\begin{document}

%%% xelatex font choices
%\defaultfontfeatures{}
%\defaultfontfeatures{Scale=MatchLowercase}
% You will need to buy these fonts, change the names to fonts you own, or comment out if not using xelatex.
\setromanfont[Mapping=tex-text]{Minion Pro}
\setmonofont[Mapping=tex-text,Scale=0.8]{Pragmata}

%% blank label items; hanging bibs for text
%% Custom hanging indent for vita items
\def\ind{\hangindent=1 true cm\hangafter=1 \noindent}
\def\labelitemi{$\cdot$}
%\renewcommand{\labelitemii}{~}

% Make figures as wide as the margins
\setkeys{Gin}{width=1\textwidth}

\chapterstyle{article-2} % alternative styles are defined in latex-custom-kjh/needs-memoir/. Consider e.g.\chapterstyle{article-4}
\pagestyle{kjh}

\title{\mytitle}
\author{\myauthor\smallskip\footnotesize\newline Office: 276 Sociology/Psychology \newline\texttt{\myemail} \newline \url{http://www.kieranhealy.org}}
\date{}

\published{\sffamily Spring 2010 / Tu\&Th 1:15--2:30pm / Gray 228}

\maketitle

% Include version information in footer if using vc package (see above).
% \thispagestyle{kjhgit}

%
%

\section{Course Description and Objectives}

%\newpage
%% Uncomment if you want a printed bibliography.
%\printbibliography

\end{document}


I'm getting the following error:

/home/larry/Desktop/kjhealy-latex-custom-kjh-f5ba457/templates/basic/.syllabus.t
ex.swp:53: LaTeX Error: Option clash for package color.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.53 \usepackage
[xetex,
No pages of output.
Transcript written on /tmp/.syllabus.tex.log.


Any ideas would be greatly appreciated...

-

## marked as duplicate by Harish Kumar, dustin, Qrrbrbirlbel, Kurt, XavierJul 31 '13 at 3:14

Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Tobi Jul 30 '13 at 13:27
–  You Jul 30 '13 at 13:47

LaTeX only loads a package once. In case of further \usepackage or \RequirePackage commands for an already loaded package, LaTeX only checks the options and complains, if it sees any new option that was not present, when the package was loaded.

Example:

\documentclass{article}
\usepackage{color}% might be hidden in a package
\usepackage[usenames,dvipsnames]{color}
\begin{document}
\end{document}


LaTeX complains with the "option clash" error message. Pressing "h" reveals the details:

! LaTeX Error: Option clash for package color.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.4 \begin
{document}
? h
[]
There has now been an attempt to load it with options
[usenames,dvipsnames]
,usenames,dvipsnames
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.
?


## Global options

The help text also offers a workaround, putting the options to the global options. However, then they are seen by other packages that might not be the best choice, considering option names such as draft. Therefore I would use global options as last resort, if the next methods fail.

If the package loading order does not matter, then the package can be loaded at an earlier stage with all options:

\documentclass{article}
\usepackage[usenames,dvipsnames]{color}
% ...
\usepackage{color}% might be hidden in a package
% ...
\usepackage[usenames,dvipsnames]{color}
% ...
\usepackage[dvipsnames]{color}


## \PassOptionsToPackage

Often the package loading is not explicit, but hidden inside other packages or even classes. Then \PassOptionsToPackage helps that also can be used before \documentclass:

\PassOptionsToPackage{usenames,dvipsnames}{color}
\documentclass{...}
...

-
The \PassOptionsToPackage command did the trick. I would have never figured that out on my own. Thank you... –  Larry Tate Jul 30 '13 at 14:42