TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use a color called 'Bittersweet' but I get this error

share|improve this question
up vote 16 down vote accepted

Package listings does not load xcolor, but package pgf does. In LaTeX you can load a package many times, but the option list of each package loading must be a subset of the options given at the first loading (exception is package fontenc).

All options at first package loading

The problem is solved, if the first package loading contains all options:



However somtimes packages might be loaded in the document class already, or there are constraints in the package order that prevents the reordering of the packages. Then \PassOptionsToPackage helps. It can even be loaded before \documentclass. It gives the specified options to the package without loading the package:

% pgf can now load the package xcolor and loads it with
% options "usenames,dvipsnames".
% or \usepackage[usenames,dvipsnames]{xcolor}

Global options

BTW, the help text of the error message (press h at the interactive prompt or check the .log file) for the option clash shows the options that need to be specified at the first loading of the package.

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

l.5 \begin
The package xcolor has already been loaded with options:
There has now been an attempt to load it with options
Adding the global options:
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

Adding the options to the global options can also be used, but it is not the best strategy IMHO, because also other unrelated packages see that options. Unknown global options are ignored by packages, but known are then executed with unintended side effects.

share|improve this answer
With packages like xcolor, hyperref etc. that are often loaded by other packages and classes, I definitely vote for \PassOptionsToPackage before \documentclass, it saves lots of troubles. – yo' Feb 20 '13 at 9:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.