2

I want to add a border around my internal references and citation. I have tried what is suggested in this post.

Here is my header

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{hyperref} 
            \hypersetup{backref=true,       
                    pagebackref=true,               
                    hyperindex=true,                
                    colorlinks=true,                
                    breaklinks=true,                
                    urlcolor= black,                
                    linkcolor= blue,                
                    bookmarks=true,                 
                    bookmarksopen=false,
                    citecolor=black,
                    linkcolor=black,
                    filecolor=black,
                    citecolor=blue,
                    linkbordercolor=blue
}

\title{test}

\usepackage{natbib}
\usepackage{graphicx}

\begin{document}

\maketitle

\section{Introduction}

\begin{align}\label{eq:1}
\ln(ab)=\ln(a) + \ln(b)
\end{align}


my equation is \ref{eq:1}

\end{document}

While the citation colour did change to blue, there is no blue border around equation and figure references.

Do I have to set a parameter to TRUE like colorlinks to enable the link border to be visible.

  • hyperref explicitly checks at \begin{document} whether colorlinks is set to true, and if so, set pdfborder to {0 0 0}. Maybe one way to go around this is to pass \AtBeginDocument{\hypersetup{pdfborder={0 0 1}}} again. – Troy Jul 28 '17 at 8:02
2

The hyperref package explicitly checks at \begin{document} whether colorlinks is set to true, and if so, set pdfborder to {0 0 0} (which means no border).

One way to go around this is to pass \AtBeginDocument{\hypersetup{pdfborder={0 0 1}}} so that this behaviour is negated, like so:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{hyperref} 
\hypersetup{backref=true,       
    pagebackref=true,               
    hyperindex=true,                
    colorlinks=true,                
    breaklinks=true,                
    urlcolor= black,                
    linkcolor= blue,                
    bookmarks=true,                 
    bookmarksopen=false,
    filecolor=black,
    citecolor=blue,
    linkbordercolor=blue
}

\AtBeginDocument{\hypersetup{pdfborder={0 0 1}}}% <-----------

\begin{document}
    \section{Introduction}

    \begin{equation}\label{eq:1}
    \ln(ab)=\ln(a) + \ln(b)
    \end{equation}


    my equation is \ref{eq:1}

\end{document}

enter image description here

0

You are defined linkcolor two times, first one is blue and the second time redefined as black, so as LaTeX, most recent defined term will execute, so it the link color turned to black, please remove it and check...

            \hypersetup{backref=true,       
                    pagebackref=true,               
                    hyperindex=true,                
                    colorlinks=true,                
                    breaklinks=true,                
                    urlcolor= black,                
                    linkcolor= blue,                
                    bookmarks=true,                 
                    bookmarksopen=false,
%                    citecolor=black,
%                    linkcolor=black,
                    filecolor=black,
                    citecolor=blue,
                    linkbordercolor=blue
}
  • This doesnt answer the question (completely), which is about getting a blue link with a blue border around it. – Troy Jul 28 '17 at 7:39
  • 1
    I do agree with you that the link colour was defined two times. If I apply the correction you proposed, the reference becomes blue, but what I want instead is to have a blue border around the reference as in the post's image I mentioned before – GigaByte123 Jul 28 '17 at 7:39

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.