如下面的 MCE 所示,如果hyperref
要求 的链接着色,则 的链接
intopdf
不着色。
\documentclass{article}
\usepackage[colorlinks]{hyperref}%
\usepackage{intopdf}
\begin{document}
The source of the document is attached
\attachandlink{\jobname.tex}[application/x-tex]{The source of this
document}{here}.
\url{www.test.org}
\end{document}
甚至连常用的\PassOptionsToPackage
技巧都不管用:
\PassOptionsToPackage{colorlinks}{hyperref}%
\documentclass{article}
\usepackage{intopdf}
\begin{document}
The source of the document is attached
\attachandlink{\jobname.tex}[application/x-tex]{The source of this
document}{here}.
\url{www.test.org}
\end{document}
您知道发生了什么吗?并且知道如何解决这个问题?
答案1
中的实现intopdf.sty
表明colorlinks
尚不支持。以下示例是尝试。
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{intopdf}
% patch \intopdf_attach_link:nnnnn
\usepackage{xpatch}
\ExplSyntaxOn
\makeatletter
\xpatchcmd \intopdf_attach_link:nnnnn
{#5}
{
\group_begin:
\cs_if_free:NF\@urlbordercolor{
\Hy@colorlink\@urlcolor
}
#5
\group_end:
}
{}{\fail}
\makeatother
\ExplSyntaxOff
\begin{document}
The source of the document is attached
\attachandlink{\jobname.tex}[application/x-tex]{The source of this
document}{here}.
\url{www.test.org}
\end{document}