Biblatex 中是否有一种方法可以在收藏条目中添加一个链接,如果它也出现在参考书目中,则会创建指向收藏条目标题的超链接。
例如如果我有:
@incollection{Farrer1965Christian,
author = {Farrer, Austin},
editor = {Jocelyn Gibb},
year = 1965,
title = {The Christian Apologist},
booktitle = {Light on C.S. Lewis},
publisher = { Harcourt, Brace \& World},
address = {New York, NY}
}
我希望书名能够作为书名的超链接
@collection{Gibb1965Light,
editor = "Gibb, Jocelyn",
booktitle = "{Light on C.S. Lewis}",
publisher = {Harcourt, Brace \& World},
address = {New York, NY},
year = 1965
}
无需手动操作。
我真正想要的是不要在第一篇条目中包含出版商、地址和编辑。
答案1
注意:您需要运行 Biber ( backend=biber
) 才能进行后续操作。
第二件事:如果您使用 Biber 的 awesome字段,则您不必重新输入的所有信息@collection
。@incollection
crossref
@incollection{Farrer1965Christian,
author = {Farrer, Austin},
title = {The Christian Apologist},
crossref = {Gibb1965Light},
}
@collection{Gibb1965Light,
editor = {Gibb, Jocelyn},
title = {Light on C.S. Lewis},
publisher= {Harcourt, Brace \& World},
address = {New York, NY},
year = {1965},
}
Farrer1965Christian
将自动继承正确含义的所有需要的字段,即Gibb1965Light
将title
成为Farrer1965Christian
的booktitle
。
对于可点击的超链接booktitle
,请尝试以下修改。它应该适用于所有标准样式,但我不确定其他样式是否适用。
crossref
如果条目不为空,则链接到该条目。请注意,在某些情况下,这可能会出错(假设crossref
被引用的条目未提供booktitle
)。
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\iffieldundef{crossref}
{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}}%
{\bibhyperref[\thefield{crossref}]{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}}}
\newunit}%
\printfield{booktitleaddon}}
数学家
\documentclass{article}
\usepackage[backend=biber,firstinits=true,citestyle=numeric-comp,backref=true]{biblatex}
\usepackage{hyperref}
\usepackage{lipsum}
\begin{filecontents}{\jobname.bib}
@incollection{Farrer1965Christian,
author = {Farrer, Austin},
title = {The Christian Apologist},
crossref = {Gibb1965Light},
}
@collection{Gibb1965Light,
editor = {Gibb, Jocelyn},
title = {Light on C.S. Lewis},
publisher= {Harcourt, Brace \& World},
address = {New York, NY},
year = {1965},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\iffieldundef{crossref}
{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}}%
{\bibhyperref[\thefield{crossref}]{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}}}
\newunit}%
\printfield{booktitleaddon}}
%COMMENCE
\begin{document}
\lipsum
Test citation by \cite{Farrer1965Christian} and \cite{Gibb1965Light}.
\printbibliography
\end{document}