hyperref
我在我的文档中使用可点击链接和acro
首字母缩略词。
我希望在 PDF 查看器中保留彩色链接,无论是彩色矩形还是彩色文本。但是,我不想在纸上以彩色形式打印它们。
我找到了一个有用的解决方案这里用于打印url
黑色的链接、目录/图片列表、引文和图片参考,同时在 PDF 查看器中将链接保留为红色。我曾经\usepackage[ocgcolorlinks]{ocgx2}
这样做过。
虽然hidelinks
-option 可以快速修复问题,允许我用黑色打印所有内容,但它会使所有链接在 PDF 查看器中不可见。
尽管如此,缩写词仍然以红色印在纸上。有没有什么办法可以避免这种情况?非常感谢您的帮助!
这是我的 MWE:
\documentclass[%
paper=a4,
oneside=true,
bibliography=totoc,
listof=notnumbered,
numbers=noenddot,
parskip=half,
headsepline,
footsepline,
fontsize=12pt
]{scrreprt}
\KOMAoptions{listof=entryprefix}
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{url}
\usepackage{hyperref} %hidelinks
\usepackage[ocgcolorlinks]{ocgx2}
\usepackage{acro}
\acsetup{make-links = true, list/sort=true}
\DeclareAcronym{fir}{
short = {FIR},
long = {finite impulse response}
}
\DeclareAcronym{ofdm}{
short = {OFDM},
long = {orthogonal frequency division multiplexing}
}
\begin{document}
\tableofcontents
\chapter{One}
\section{Section One}
In signal processing, a \ac{fir} filter is a filter with finite impulse response. \acp{fir} filters can be discrete-time or continuous-time.
\section{Section Two}
In \ac{ofdm}, several bits can be sent in parallel, or at the same time, in separate substream channels. With \ac{ofdm}, the subchannel frequencies are close together and overlapping but are still orthogonal.
\chapter{Two}
\lipsum[1]
\par\url{www.foo.com}
\end{document}
答案1
acro 禁用 ocgsupport,因为它会将链接分为两部分打印(使用幻像和 \llap-box)。您可以尝试以下方法:
\documentclass[%
paper=a4,
oneside=true,
bibliography=totoc,
listof=notnumbered,
numbers=noenddot,
parskip=half,
headsepline,
footsepline,
fontsize=12pt
]{scrreprt}
\KOMAoptions{listof=entryprefix}
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{url}
\usepackage{hyperref} %hidelinks
\usepackage[ocgcolorlinks]{ocgx2}
\usepackage{acro}
\acsetup{make-links = true, list/sort=true}
\DeclareAcronym{fir}{
short = {FIR},
long = {finite impulse response}
}
\DeclareAcronym{ofdm}{
short = {OFDM},
long = {orthogonal frequency division multiplexing}
}
\makeatletter
\ExplSyntaxOn
\tl_set:Nn\l_ocgxii_lnkcol_tl{{red}}
\cs_set:Npn \__acro_color_link:n #1
{
\bool_lazy_and:nnTF
{ \cs_if_exist_p:N \hypersetup }
{
\bool_lazy_or_p:nn
{ \legacy_if_p:n {Hy@colorlinks} }
{ \legacy_if_p:n {Hy@ocgcolorlinks} }
}
{ \ocgxii_colourlink_begin:
#1
\ocgxii_colourlink_end:}
{#1}
}
\ExplSyntaxOff
\begin{document}
\section{a}\label{a}
\ref{a}
\ac{fir} filter is a filter with finite impulse response. \acp{fir}
\end{document}