3

I am using the elsarticle template to write something. I want to remove the ugly border and use different colors instead. My setting is as follows:

\usepackage[colorlinks=true,linkcolor=red,citecolor=green]{hyperref}

The results is that ugly borders disappear but the all of linkcolor and citecolor are blue despite of no blue setting.

Any suggestion is greatly appreciated.

Thanks in advance!

4

Class elsarticle also sets the colors:

\AtBeginDocument{\@ifpackageloaded{hyperref}
  {\def\@linkcolor{blue}
   \def\@anchorcolor{blue}
   \def\@citecolor{blue}
   \def\@filecolor{blue}
   \def\@urlcolor{blue}
   \def\@menucolor{blue}
   \def\@pagecolor{blue}

Therefore your colors should be set at a later time:

\documentclass{elsarticle}
\usepackage[colorlinks]{hyperref}
\AtBeginDocument{%
  \hypersetup{%
    linkcolor=red,%
    citecolor=green,%
  }%
}%
  • Thanks for your help. The second component of your provided code works well. BTW, what is the first component used for? (above the sentence "Therefore your colors should be set at a later time:") – user22986 Jul 20 '13 at 21:55
  • @user22986: The "first component" is just the code snipset of elsarticle.cls, proving that the class is responsible for the blue color and shows the time, when the colors are set (\AtBeginDocument). – Heiko Oberdiek Jul 20 '13 at 21:57
  • @Hiko: you not only told me how to do it but also leave the reason. Thanks very much! – user22986 Jul 20 '13 at 22:00

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.