我想在我的参考书目中添加一篇在线文章,但无法更改其显示方式。我的.bib
文件包含许多条目,但对于此工作示例,我将仅使用:
@online{european_commission_NGEU,
title={EU Budget policy brief: The EU as an issuer : the NextGenerationEU transformation},
url={https://op.europa.eu/en/publication-detail/-/publication/accacfb6-0966-11ed-b11c-01aa75ed71a1/language-en/format-PDF},
author={{European Commission}},
publisher={Publications Office of the European Union},
year={2022},
month={Jul}}
使用我当前的代码:
\documentclass[12pt]{article}
\usepackage{hyperref}
\usepackage[backend=biber, style=authoryear,sorting=nymdt, maxbibnames=99,autolang=hyphen,alldates=long,dateabbrev=false,doi=false]{biblatex}
\addbibresource{bibliography.bib}
\DeclareFieldFormat[online]{title}{\textit{#1}} %since i want my title cursive
%to correctly sort
\DeclareSortingTemplate{nymdt}{
\sort{
\field{presort}}
\sort[final]{
\field{sortkey}}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title} }
\sort{
\field{sortyear}
\field{year} }
\sort{
\field[padside=left,padwidth=2,padchar=0]{month}
\literal{00} }
\sort{
\field[padside=left,padwidth=2,padchar=0]{day}
\literal{00} }
\sort{
\field{sorttitle} }
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}}
}
\begin{document}
Text \cite{european_commission_NGEU}
\printbibliography
\end{document}
我得到输出:
欧盟委员会(2022 年 7 月)。欧盟预算政策简报:欧盟作为发行人:下一代欧盟转型。网址:https://op.europa.eu/en/publication-detail/-/publication/accacfb6-0966-11ed-b11c-01aa75ed71a1/language-en/format-PDF。
我想要的是:
欧盟委员会 (2022)。欧盟预算政策简报:欧盟作为发行人:下一代欧盟转型。网址:https://op.europa.eu/en/publication-detail/-/publication/accacfb6-0966-11ed-b11c-01aa75ed71a1/language-en/format-PDF. 2022年7月。
我四处寻找实现该目标的简单方法,但找不到一个完美的解决方案。如果能得到帮助,我将不胜感激。
答案1
如果您不坚持让日期位于 URL 之后,也可以接受日期位于 URL 之前(所有其他条目类型都是如此),则只需将设置调整mergedate
为basic
并需要设置labeldate=year,
(这是默认值,但会被 覆盖alldates=long,
)。您可能还想查看其他mergedate
值。
\documentclass[12pt]{article}
\usepackage[
backend=biber,
style=authoryear,
sorting=nymdt,
maxbibnames=99,
autolang=hyphen,
mergedate=basic,
alldates=long,
labeldate=year,
dateabbrev=false,
doi=false,
]{biblatex}
\usepackage{hyperref}
\DeclareFieldFormat[online]{title}{\mkbibitalic{#1}}
%to correctly sort
\DeclareSortingTemplate{nymdt}{
\sort{
\field{presort}}
\sort[final]{
\field{sortkey}}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title} }
\sort{
\field{sortyear}
\field{year} }
\sort{
\field[padside=left,padwidth=2,padchar=0]{month}
\literal{00} }
\sort{
\field[padside=left,padwidth=2,padchar=0]{day}
\literal{00} }
\sort{
\field{sorttitle} }
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}}
}
\begin{filecontents}[overwrite]{\jobname.bib}
@online{european_commission_NGEU,
title={EU Budget policy brief: The EU as an issuer : the NextGenerationEU transformation},
url={https://op.europa.eu/en/publication-detail/-/publication/accacfb6-0966-11ed-b11c-01aa75ed71a1/language-en/format-PDF},
author={{European Commission}},
publisher={Publications Office of the European Union},
date={2022-07},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Text \cite{european_commission_NGEU}
\printbibliography
\end{document}
如果你需要 URL 后面的日期,最简单的方法可能是使用 更改驱动程序xpatch
。加载后,将以下内容添加到上面的 MWEbiblatex
\usepackage{xpatch}
\xpatchbibdriver{online}
{\usebibmacro{date}%
\newunit\newblock
\usebibmacro{doi+eprint+url}}
{\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{date}}
{}{}