我想使用biblatex
用于链接的普通颜色作为参考书目。但是,我不希望链接可点击
\begin{filecontents*}{sample.bib}
@misc{CIGREConnection2016,
title = {{Connection of Wind Farms to Weak AC Networks}},
howpublished = {CIGRE Brochure},
year = {2016},
month = {Dec},
url = {https://e-cigre.org/publication/671-connection-of-wind-farms-to-weak-ac-networks},
urldate = {2019-5-20}
}
\end{filecontents*}
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}
\usepackage[style=ieee,refsection=chapter]{biblatex}
\addbibresource{sample.bib}
\begin{document}
\cite{CIGREConnection2016}
\printbibliography
\end{document}
答案1
在评论中,你写道,目标是
确保 URL 没有下划线或以超链接形式出现
实现此目标的一个简单方法是urlcolor=black
在指令中设置hypersetup
,即更改
\hypersetup{citecolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}
到
\hypersetup{colorlinks, citecolor=DodgerBlue3, urlcolor=black}
如果排版的 URL 字符串必须使用标准文本字体而不是等宽字体,我建议您也加载该xurl
包,然后按\urlstyle={same}
。
\RequirePackage{filecontents}
\begin{filecontents*}{sample.bib}
@misc{CIGREConnection2016,
title = {{Connection of Wind Farms to Weak AC Networks}},
howpublished = {CIGRE Brochure},
year = {2016},
month = {Dec},
url = {https://e-cigre.org/publication/671-connection-of-wind-farms-to-weak-ac-networks},
urldate = {2019-5-20}
}
\end{filecontents*}
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage{xurl}
\urlstyle{same}
\usepackage{hyperref}
\hypersetup{colorlinks,citecolor=DodgerBlue3,urlcolor=black}
\usepackage[style=ieee,refsection=chapter]{biblatex}
\addbibresource{sample.bib}
\begin{document}
\cite{CIGREConnection2016}
\printbibliography
\end{document}
如果您希望包在文本中应用正常的超链接首选项并仅排除参考书目,请使用命令\appto{\bibsetup}{\urlstyle{same} \hypersetup{urlcolor=black}}
而不是\urlstyle={same}
。这样,参数将仅适用于参考书目,而正文中的文本将保持不变
\begin{filecontents*}{sample.bib}
@misc{CIGREConnection2016,
title = {{Connection of Wind Farms to Weak AC Networks}},
howpublished = {CIGRE Brochure},
year = {2016},
month = {Dec},
url = {https://e-cigre.org/publication/671-connection-of-wind-farms-to-weak-ac-networks},
urldate = {2019-5-20}
}
\end{filecontents*}
\documentclass{book}
\usepackage{etoolbox}
\usepackage[x11names]{xcolor}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}
\usepackage{xurl}
\usepackage[style=ieee,refsection=chapter]{biblatex}
\addbibresource{sample.bib}
\appto{\bibsetup}{\urlstyle{same} \hypersetup{urlcolor=black}}
\begin{document}
\url{https://e-cigre.org/publication/671-connection-of-wind-farms-to-weak-ac-networks}
\cite{CIGREConnection2016}
\printbibliography
\end{document}
答案2
\url
在\nolinkurl
字段宏中替换:
\begin{filecontents*}{samplea.bib}
@misc{CIGREConnection2016,
title = {{Connection of Wind Farms to Weak AC Networks}},
howpublished = {CIGRE Brochure},
year = {2016},
month = {Dec},
url = {https://e-cigre.org/publication/671-connection-of-wind-farms-to-weak-ac-networks},
urldate = {2019-5-20}
}
\end{filecontents*}
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage{hyperref}
\hypersetup{citecolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}
\usepackage[style=ieee,refsection=chapter]{biblatex}
\addbibresource{samplea.bib}
\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space{\color{Blue1}\nolinkurl{#1}}}
\begin{document}
\cite{CIGREConnection2016}
\printbibliography
\end{document}
(有些 pdf 查看器仍然会将其设为超链接,因为它们会在文本中搜索典型的互联网地址,并使所有看起来像链接的内容都可点击,例如 www、http...)