1

I'm having issues attaching files in an article. It returns 2 errors: one related with color and the other with hyperref:

  1. ! LaTeX Error: Option clash for package color.

  2. ! LaTeX Error: Option clash for package hyperref.

Here is my MWE:

\documentclass[11pt,spanish]{article}
\usepackage[utf8]{inputenc} 
\usepackage[unicode]{attachfile}


\usepackage[usenames,dvipsnames]{color}
\usepackage[bookmarks=true,
            bookmarksnumbered=false, % true means bookmarks in 
                                     % left window are numbered                         
            bookmarksopen=false,     % true means only level 1
                                     % are displayed.
            colorlinks=true,
            linkcolor=rojo_javi,
            urlcolor=azul_alberto]{hyperref} 

\definecolor{webgreen}{rgb}{0, 0.5, 0} % less intense green
\definecolor{webblue}{rgb}{0, 0, 0.5}  % less intense blue
\definecolor{webred}{rgb}{0.5, 0, 0}   % less intense red
\definecolor{dblackcolor}{rgb}{0.0,0.0,0.0}
\definecolor{dbluecolor}{rgb}{.01,.02,0.7}
\definecolor{dredcolor}{rgb}{0.8,0,0}
\definecolor{dgraycolor}{rgb}{0.30,0.3,0.30}
\definecolor{azul_alberto}{rgb}{.01,.02,0.9}
\definecolor{rojo_javi}{rgb}{0.5, 0, 0}


\begin{document}

\section{Education}
\attachfile[icon=PushPin]{files/z_LM7805_datasheet.pdf}

\end{document}

What can I do??

1

Load hyperref and change the setting using \hypersetup:

enter image description here

\documentclass{article}

\usepackage{attachfile2}

\usepackage[usenames,dvipsnames]{xcolor}

\definecolor{azul_alberto}{rgb}{.01,.02,0.9}
\definecolor{rojo_javi}{rgb}{0.5, 0, 0}

\usepackage{hyperref}

\hypersetup{
  bookmarksnumbered=false, % true means bookmarks in
                           % left window are numbered
  bookmarksopen=false,     % true means only level 1
                           % are displayed.
  colorlinks=true,
  linkcolor=rojo_javi,
  urlcolor = azul_alberto
}

\begin{document}

\section{Education}
\attachfile[icon=PushPin]{example-image.pdf}

\end{document}

Also, use attachfile2.

| improve this answer | |
  • Is this essentially saying, the answer is the following: ... use attachfile2 version and define the colors before they are set in hyperref? – Jeffrey J Weimer Nov 28 '18 at 23:31
  • @JeffreyJWeimer: Roughly, but you can define the colours afterwards. It's just unconventional to use something before it's defined. – Werner Nov 29 '18 at 0:04

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.