I like to have custom-color hyperlinks with
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=NavyBlue,
filecolor=magenta,
urlcolor=cyan,
citecolor=MidnightBlue
}
and insert a multi-page pdf document with \usepackage{pdfpages}. It works fine (there's no error) when only one of the packages is used.
However, when I included both packages, I got an error that begins with:
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.7 \usepackage
{hyperref}
The package xcolor has already been loaded with options:
[]
There has now been an attempt to load it with options
[dvipsnames]
Adding the global options:
,dvipsnames
to your \documentclass declaration may fix this.
Try typing <return> to proceed.
I also have multiple other packages, and simply adding \documentclass[xcolor={dvipsnames}]{article} doesn't fix it, but rather causes even more errors.
What causes this? Is there a different package or approach to insert a PDF document that is compatible with hyperref with xcolor=dvipsnames?
\PassOptionsToPackage{dvipsnames}{color}has to come after\usepackage[dvipsnames]{xcolor}but before\usepackage{pdfpages}). – alpha Nov 28 '22 at 23:34