87

Can someone explain when to use the xcolor package instead of the color package?

Unless you are creating your own specific colors, the differences between the packages seem to be fairly superficial. Am I missing something that makes one package better than the other?

Note: I only use the packages to add a little bit of color here and there to my documents. I'm by no means an advanced user, but I want to know which of the packages are preferred and for what reasons.

Edit: The xcolor package documentation states: Its purpose can be summarized as to maintain the characteristics of color, while providing additional features and flexibility with (hopefully) easy-to-use interfaces.

So for non-advanced users, its just a matter of syntax preference, right?

3
  • 10
    I always use xcolor and I love (and probably over-use) \colorlet{<new color name>}{<old color name>} (e.g. for \colorlet{important}{red} or something)
    – cgnieder
    Jan 7, 2013 at 19:10
  • 10
    The use of colour mixtures is a big addition brought along by xcolor (e.g. using \color{blue!30!green}).
    – Werner
    Jan 7, 2013 at 19:14
  • 3
    I think you answered your own question, if you don't need the additional features of xcolor you can simply stick with color; even though I can't see the disadvantage in using xcolor in the first place.
    – rtzll
    Jan 7, 2013 at 19:15

1 Answer 1

88

All features of color are available by loading the xcolor package as well. I would say that you can always load the latter one since:

  1. You don't have to care which features are in which one.

  2. You surely satisfy all other packages relying on color/xcolor.

  3. Many package load it anyways (tikz to name the most important one), so you even don't have to load it yourself.

Notice that there are other pairs of packages where one extends the other:

  • color < xcolor
  • graphics < graphicx
  • amsmath < mathtools (in the sense you don't have to load amsmath)
  • and surely more...
5
  • 2
    I would have one caveat regarding mathtools. it throughs our warning when using unicode-math. I sure one can get rid of these but haven't worked at how yet.
    – ArTourter
    Jan 7, 2013 at 19:45
  • 3
    Not to forget: users of TikZ are loading xcolor anyway
    – cgnieder
    Jan 7, 2013 at 19:48
  • @ArTourter I know (that's why I added the notice to that one). However, I included these comments only to provide some "background" ;)
    – yo'
    Jan 7, 2013 at 19:55
  • 1
    Thanks for the good answer. Sounds like I should always load xcolor. It sure would be nice to have a table or document for all of these kinds of "super" packages. Someone new (or a mid-level user, like myself) to LaTeX would unknowingly load a package not ever knowing the capabilities of the advanced packages.
    – jlconlin
    Jan 7, 2013 at 20:23
  • 4
    @Jeremy If you open this page that exists for every package: ctan.org/pkg/color you see that for package color, the package xcolor is listed under "See also".
    – yo'
    Jan 7, 2013 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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