5

I read some answers on that questions, but it is still not working as expected. The code says: link yellow, border green : the result is not the one I expect. If I change the colors, the result remains the same.

enter image description here

\documentclass{article}
\usepackage{xcolor,hyperref}

\hypersetup{%
    colorlinks=true,
    linkcolor=yellow,
    linkbordercolor=green,
    pdfborderstyle={/S/U/W 1pt}}

\begin{document}

\href{%
    https://studio.code.org/s/course3/stage/2/puzzle/1}{%
    Labyrinthe}

\end{document}
3kstc
  • 931
  • 6
  • 22
Tarass
  • 16,912
  • 2
    Whenever you say that code doesn't work as expected, it's usually a good idea to say exactly what you expect (even if it might be more or less obvious from the code). – Torbjørn T. Feb 07 '18 at 10:11
  • The code says : link yellow, border green : the result is not the one expected, isn't it ;-) – Tarass Feb 07 '18 at 10:13
  • 1
    It was a more general statement, it might not always be obvious from the code what the expected outcome would be (and I think there are cases where users have misconceptions about what code does, and thus have wrong expectations). That said, urlcolor, not linkcolor, but I can't give any good answer for the border. – Torbjørn T. Feb 07 '18 at 10:21
  • I thaught url is for http://... and link for the friendly name. thank you. – Tarass Feb 07 '18 at 10:31

1 Answers1

7

You need to reset the border style AtBeginDocument:

\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}

\hypersetup{% colorlinks=true, urlcolor=yellow, urlbordercolor=green, pdfborder={1 1 1}, }

\AtBeginDocument{\hypersetup{pdfborderstyle={/S/S/W 1}}} \begin{document}

\href{% https://studio.code.org/s/course3/stage/2/puzzle/1}{% Labyrinthe}

\end{document}

enter image description here

Use pdfborderstyle={/S/U/W 1} if you want to underline.

Ulrike Fischer
  • 327,261
  • 1
    Yellow and green? I can't make this work to see yellow and green. My border color never changes from the cyan border, nor the pink text with this code. Can you please collaborate? Thank you. – Kit Ostrihon May 23 '19 at 00:12
  • @KitOstrihon I must have missed your comment, and you are quite right, I mixed up linkcolor and urlcolor ... – Ulrike Fischer Jun 30 '21 at 21:54