30

I am using the tikz package to draw some diagrams. In addition, I need the color package for some highlighting. As the wikibooks page of the color package states, it has to be used before the tikz package. I did this and am now ending up with a huge amount of

Package xcolor Warning: Incompatible color definition on line xxx

Where xxx stand for many many lines, I don't control.

Any ideas of fixing this?

A working example:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage[latin9]{inputenc}
\usepackage[usenames,dvipsnames]{color}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{graphicx}
\usepackage{listings}

\lstdefinelanguage{constraints} {
    keywords = {undefined, terminate, peephole\-constraint, temporal\-constraint, condition, rationale, result, filter, sequence, link, isParent, contains, distance, state, startsWith},
  keywordstyle=\color{blue}\bfseries,
    sensitive=false,
    alsodigit={-},
    ndkeywords={FAIL, FAIL_FINAL, PASS, PASS_FINAL, source, origin, sourceType, originType, operation, parameters},
    ndkeywordstyle=\color{OliveGreen},
    stringstyle=\color{red}\ttfamily,
    morestring=[b]',
    morestring=[b]"
}

\begin{document}
Text above.\\

\begin{lstlisting}[language=constraints]
temporal-constraint observe-value {
  rationale {
  }
  sequence {
    a << b << terminate
  }
  filter a {
    operation == 'observe'
  }
  filter b {
    operation == 'value'
    &&  parameters.value != undefined
  }
  link {
      a.parameters.name == b.parameters.name
    &&  isParent(a.origin, b.origin)
  }
}
\end{lstlisting}

\end{document}
4
  • 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}.
    – jub0bs
    Dec 17, 2013 at 13:26
  • There you go, hope this helps!
    – Coxa
    Dec 17, 2013 at 14:02
  • 1
    I don't see any difference between using color or xcolor except no warnings with xcolor.
    – Ignasi
    Dec 17, 2013 at 14:11
  • That's it. Thank you very much. xcolor fixed it...
    – Coxa
    Dec 17, 2013 at 14:21

1 Answer 1

50

Changing this tiny line of code

\usepackage[usenames,dvipsnames]{color}

to

\usepackage[usenames,dvipsnames]{xcolor}

fixed it, thanks @Ignasi

3
  • 14
    I'd be interested to know why this helped, what exactly the warning means and why it is something that should be fixed :)
    – lucidbrot
    Jul 17, 2018 at 19:13
  • 1
    I am having ! LaTeX Error: Option clash for package xcolor. error
    – alper
    Dec 10, 2022 at 23:12
  • Are you loading the package twice? Maybe once in the style file and once in the preamble for example.
    – Tom
    Jan 30, 2023 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .