\href urlbordercolor 在 pdf 中不可见

\href urlbordercolor 在 pdf 中不可见

我尝试在链接周围添加彩色边框,但目前尚未成功。这是一个简单示例:

\documentclass[
12pt,
titlepage]{article}

\usepackage{xcolor}
\usepackage{hyperref}
% colored links
\hypersetup{
    colorlinks=true,%set true if you want colored links
    linktoc=all,
    %set to all if you want both sections and subsections linked
    filecolor=black,
    citecolor=blue,
    linkcolor=blue,
    urlcolor=blue,
    urlbordercolor = red,
    %linktocpage, 
    %only link the page numbers and not the entire table    of contents
}

\begin{document}
test this is my url: \href{https://www.google.com/}{Google}
\end{document}

生成的 PDF 如下所示: 结果:应用了 linkcolor=blue,未应用 urlbordercolor = red。

我该如何修复它?

多谢!

答案1

如果您使用 colorlinks,hyperref 会禁用边框,因为两者都有点过度。您可以使用以下命令重新激活它\AtBeginDocument{\hypersetup{pdfborder=0 0 1}}

\documentclass[
12pt,
titlepage]{article}

\usepackage{xcolor}
\usepackage{hyperref}

% colored links
\hypersetup{
    colorlinks=true,%set true if you want colored links
    linktoc=all,
    %set to all if you want both sections and subsections linked
    filecolor=black,
    citecolor=blue,
    linkcolor=blue,
    urlcolor=blue,
    urlbordercolor = red,
    %linktocpage, 
    %only link the page numbers and not the entire table    of contents
}
\AtBeginDocument{\hypersetup{pdfborder=0 0 1}}
\begin{document}

test this is my url: \href{https://www.google.com/}{Google}
\end{document}

在此处输入图片描述

相关内容