2

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}
  • 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 7 '18 at 10:11
  • The code says : link yellow, border green : the result is not the one expected, isn't it ;-) – Tarass Feb 7 '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 7 '18 at 10:21
  • I thaught url is for http://... and link for the friendly name. thank you. – Tarass Feb 7 '18 at 10:31
4

You need to reset the border style AtBeginDocument:

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

\hypersetup{%
    colorlinks=true,
    linkcolor=yellow,
    linkbordercolor=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.

  • 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 O. May 23 at 0:12

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.