Package xcolor Error: Undefined color ForestGreen'

I am using the following packages in my files Latex sources:

\usepackage{color}
\usepackage[table,xcdraw]{xcolor}
\usepackage[usenames, dvipsnames]{color}

\newcommand{\ricardo}[1]{\colorbox{ForestGreen}{\color{white}\textsf{\textbf{Ricardo}}} \textcolor{ForestGreen}{#1}}


And to mark my notes in the text, I use the command:

\ricardo{text....}


How should I do to make Latex display my notes correctly?

The xcolor package is an extension of the color package, so I don't understand why you loaded the color package twice along with the xcolor package. Moreover, according to page 7 of the xcolor documentation usenames is obsolete. I cleaned up the code to this:

\documentclass[11pt]{article}
\usepackage[dvipsnames,table,xcdraw]{xcolor}
\newcommand{\ricardo}[1]{\colorbox{ForestGreen}{\color{white}   \textsf{\textbf{Ricardo}}} \textcolor{ForestGreen}{#1}}
\begin{document}
\ricardo{This should work.}
\end{document}


and the resulting output compiles without a problem:

• Thank​ you so much for your help @DJP, now it's all working! Jan 22, 2016 at 15:02
• Given that usenames' is obsolete, maybe this (\documentclass[usenames,dvipsnames]{beamer} ) should be changed at en.wikibooks.org/wiki/LaTeX/… ? Jun 5, 2019 at 9:59
• Indeed, in the documentation, mirror.utexas.edu/ctan/macros/latex/contrib/xcolor/xcolor.pdf, to use additional color like the one you wanna use, you have to add this option when you load the xcolor package. Check out the section 2.4.2 Additional sets of colors in the document. Simply put, to use it properly, you just need this line when load xcolor package: \usepackage[usenames, dvipsnames]{xcolor} Dec 10, 2019 at 7:33

sorry I can't comment as I'm just a noob and I need reputation. I tried out the command in my document and it works perfect. Check the image below.

In my beamer, I had declared something like \documentclass[xcolor=dvipsnames]{beamer} while the document that I use based on tufte declares \usepackage{xcolor} in the .sty file.

Could you try renaming the third line of the code into \usepackage[usenames, dvipsnames]{xcolor} ?

• Hello @crypto, I am using \documentclass[conference]{IEEEtran} I modified the third from \usepackage[usenames, dvipsnames]{color} to \usepackage{xcolor}, as your suggestion, but I keep getting the same error: Package xcolor Error: Undefined color ForestGreen. Jan 22, 2016 at 14:53
• Just a small question. Could you try \usepackage[usenames, dvipsnames]{xcolor}? I don't happen to have an IEEEtran tex file to try it out. Have you installed the package xcolor? Jan 22, 2016 at 14:56
• You're welcome. Thank​ you so much for your help @crypto! Jan 22, 2016 at 15:03

A more general solution may simply be to define the color explicitly.

\definecolor{ForestGreen}{RGB}{34,139,34}