These option clashes happen when a package is requested to be loaded on two different positions, like by you and inside another package, but with different options. The package is loaded by the first \usepackage
(or its twin \RequirePackage
); it isn't loaded again when it is requested again. It simply can't be loaded a second time. Therefore the new options can be activated and previous options might conflict with the second usage. So LaTeX creates an error to report this issue to you.
The way to fix this is to declare the options beforehand using \PassOptionsToPackage{<options>}{<package>}
. Then they are used wherever the package is loaded.
\documentclass{article}
\usepackage{ifpdf}
\ifpdf
\PassOptionsToPackage{pdftex,usenames,dvipsnames}{color}
\usepackage[T1]{fontenc}
\usepackage{libertine} % most likely loads 'color' itself
%\usepackage{lmodern} % doesn't load 'color'
\usepackage{color}
\usepackage[pdftex]{graphicx}
\else
%\bye
\fi
\begin{document}
Hello, world!
\end{document}
I can't test it by myself, because I don't have the libertine
package installed.
PS:
I don't think you need to set pdftex
manually. Normally packages do a good job recognizing the driver by themselves. Also you might want to use the extended xcolor
package instead of color
.
I did not intend to write a comprehensive analysis but give some hint to your subproblems.
Why does the colors vary so much depending on the color model for the predefined colors?
We all agree that by red
we mean the reddest color in the current space. (Intuitively there must be something representing that color, either named red
or reddest
.) But the fact is that, even the phrase reddest is well-defined, the reddest color varies from space to space. Some color spacess, for instance the Lab-family, do not contain the reddest but in which the red could be as red as you wish.
How are the default values chosen? To they follow a specific color model?
Some color spaces are called absolute for their colors being unambiguous. For example when saying #FF0000
in AdobeRGB, I am indicating that red , a color stimulating people's optic nerves in that way.
For an absolute color space, colors are chosen by the agency developing that space. For a non-absolute color space you need to associate it to an absolute one, since then the colors are determined.
What color model should I choose?
Depends on what are you doing. Different models are developed for different purpose. The roughest list is
- For screens: RGB
- For printers: CMYK
Why is Cyan in CMYK blue?
Well it is blue as an adjective but not blue
in RGB. cyan
(CMYK) is a color that seems like between yellow
(RGB) and blue
(RGB). And cyan
(RGB) is defined as #00FFFF
(RGB)
Which color model is best for printing?
CMYK
Pantone
Nowadays computers/printers are smart enough to translate between color spaces. All you need to do is to choose a color from an space and declare the color-space pair.
The only problem is that your screen/printer may not be able to display/print the absolute color properly. This is a hardware issue and color models cannot help.
Best Answer
orange
is predefined, you can simply use it as{\color{orange}Hello}
without any color definitions. Otherwise, use the form\definecolor{MaterialOrange}{named}{orange}
as noted also by @samcarter or using the color value and model given in the manual. Finally, you should embrace the colored portion between two{}
, otherwise, the whole document will take the defined color.