有没有办法将参考书目中的 URL 链接制作成一个单词“链接”?

有没有办法将参考书目中的 URL 链接制作成一个单词“链接”?

这是我的代码:

% arara: pdflatex: { shell: yes }
% arara: biber
% arara: pdflatex: { shell: yes }
% arara: pdflatex: { shell: yes }
\documentclass[12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@techreport{NBERw10828,
 title = "Accounting for Cross-Country Income Differences",
 author = "Francesco Caselli",
 institution = "National Bureau of Economic Research",
 type = "Working Paper",
 series = "Working Paper Series",
 number = "10828",
 year = "2004",
 month = "October",
 URL = "http://www.nber.org/papers/w10828",
 abstract = {Why are some countries so much richer than others? Development Accounting is a first-pass attempt at organizing the answer around two proximate determinants: factors of production and efficiency. It answers the question "how much of the cross-country income variance can be attributed to differences in (physical and human) capital, and how much to differences in the efficiency with which capital is used?" Hence, it does for the cross-section what growth accounting does in the time series. The current consensus is that efficiency is at least as important as capital in explaining income differences. I survey the data and the basic methods that lead to this consensus, and explore several extensions. I argue that some of these extensions may lead to a reconsideration of the evidence.},
}}
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = black,
anchorcolor = black,
citecolor = black,
urlcolor=blue,
bookmarksopen = true,
bookmarksnumbered = true,
bookmarksopenlevel = 2,
pdfstartview = {FitH},
pdfborder = {0 0 0}
}
\usepackage[indexing=cite,style=authoryear,citestyle=authoryear,sorting=none,backend=biber]{biblatex}
\makeatletter
\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}
\makeatother
%\renewcommand{\mkbibnamelast}[1]{\mkbibemph{#1}}
\addbibresource{jobname.bib}
\begin{document}
First \cite{NBERw10828}\par
\printbibliography
\end{document}

它给出的是: 在此处输入图片描述

这是我想要的 URL 链接,一个带Link下划线和蓝色的简短单词:

在此处输入图片描述

如何才能做到这一点?

附言

顺便问一下,如果在前面,如何将星号添加到引用中*Caselli

答案1

虽然在我看来这并不可取,但你可以使用重新定义

\DeclareFieldFormat{url}{\href{#1}{\underline{Link}}}

hyperref如果未启用,此定义将打印完整的 URL

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\underline{Link}}}
    {\url{#1}}}

或者甚至利用本地化功能biblatex提供

\DefineBibliographyStrings{english}{%
  url = {link},
}

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\bibstring{url}}}
    {\url{#1}}}

有关自定义超链接外观的更多选项,请参阅如何使用 hyperref 制作彩色和带下划线的链接?

平均能量损失

\documentclass[12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{NBERw10828,
 title = "Accounting for Cross-Country Income Differences",
 author = "Francesco Caselli",
 institution = "National Bureau of Economic Research",
 type = "Working Paper",
 series = "Working Paper Series",
 number = "10828",
 year = "2004",
 month = "October",
 URL = "http://www.nber.org/papers/w10828",
}
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = black,
anchorcolor = black,
citecolor = black,
urlcolor=blue,
bookmarksopen = true,
bookmarksnumbered = true,
bookmarksopenlevel = 2,
pdfstartview = {FitH},
pdfborder = {0 0 0}
}
\usepackage[indexing=cite,style=authoryear,citestyle=authoryear,sorting=none,backend=biber]{biblatex}
\makeatletter
\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}
\makeatother

\DefineBibliographyStrings{english}{%
  url = {link},
}

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\bibstring{url}}}
    {\url{#1}}}

%\renewcommand{\mkbibnamelast}[1]{\mkbibemph{#1}}
\addbibresource{\jobname.bib}
\begin{document}
First \cite{NBERw10828}\par
\printbibliography
\end{document}

在此处输入图片描述

答案2

您可以重新定义 URL 的打印方式,如下所示(在加载之后的序言中的某个位置bibtex):

\DeclareFieldFormat{url}{\ifhyperref{\href{#1}{Link.}}{\url{#1}}}

显示“链接”的图像

相关内容