我正在努力以哈佛风格的变体重新创建参考书目所需的格式。这是在线文章的示例:
Elliott, L. (2008) 经济放缓和减税导致政府陷入赤字。监护人[互联网],11 月 20 日。可从以下网址获取:<http://www.guardian.co.uk/business> [2007 年 11 月 19 日访问]。
使用下面的最小示例,我设法创建以下内容:
Elliott, L. (2008).经济放缓和减税导致政府陷入赤字。监护人. [互联网] (2008年11月20日). 出处:<http://www.guardian.co.uk/business> [2017年11月19日访问]。
看看这些差异,我有几个问题:
- 如何以日月格式打印日期,如图所示,不带年份和周围的括号?
- 如何删除标签年份后和期刊名称后的句点?
- 如何用逗号连接日记和日期?
这是一个简单的例子:
\begin{filecontents}{test.bib}
@article{test,
author = {L. Elliott},
title = {Economic slowdown and tax breaks put the government in the red},
journal = {Guardian},
date = {2008-11-20},
url = {http://www.guardian.co.uk/business},
urldate = {2017-11-19}
}
\end{filecontents}
\documentclass{article}
\usepackage{times}
\usepackage{csquotes}
\usepackage[british]{babel}
\usepackage[
style=authoryear,
mergedate=false,
urldate=long
]{biblatex}
\addbibresource{test.bib}
\NewBibliographyString{available}
\NewBibliographyString{internet}
\DefineBibliographyStrings{english}{%
urlseen = {Accessed},
available = {Available from},
internet = {[Internet]}
}
\DeclareFieldFormat[article]{title}{#1}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{journaltitle}{\textbf{#1}\space\bibstring{internet}}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space$<$\url{#1}$>$}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\urlstyle{same}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案1
对于问题的主要部分(仅包含月份和日期的日期),您需要定义一种新的日期格式。这是必要的,因为标准日期格式始终会检查是否存在年份:如果没有年份,它们将不会打印任何内容。所以我们不能简单地说并享受没有年份的日期。下面的代码基于和日期格式\clearfield{year}\printdate
实现了两种 ned 日期格式daymonthlong
和。日期范围的输出可能会令人困惑或完全错误。daymonthshort
long
short
另外两个问题是对标准宏的相当无聊的更改。请参阅下面的代码。
%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{test,
author = {L. Elliott},
title = {Economic slowdown and tax breaks put the government in the red},
journal = {Guardian},
date = {2008-11-20},
url = {http://www.guardian.co.uk/business},
urldate = {2017-11-19}
}
\end{filecontents}
\documentclass{article}
\usepackage{csquotes}
\usepackage[british]{babel}
\usepackage[
style=authoryear,
mergedate=false,
urldate=long,
dateabbrev=false,
]{biblatex}
\addbibresource{\jobname.bib}
\NewBibliographyString{available}
\NewBibliographyString{internet}
\DefineBibliographyStrings{english}{%
urlseen = {Accessed},
available = {Available from},
internet = {[Internet]}
}
\DeclareFieldFormat[article]{title}{#1}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{journaltitle}{\textbf{#1}\setunit{\space}\bibstring{internet}}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space$<$\url{#1}$>$}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\renewbibmacro*{issue+date}{%
\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\makeatletter
\newrobustcmd*{\mkdaterangedaymonth}[2]{%
\begingroup
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{}
{\printtext[#2date]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
\iffieldundef{#2season}
{\csuse{mkbibdate#1}{}{#2month}{#2day}%
% Optionally print the time after the date
\blx@printtime{#2}{}}
{\csuse{mkbibseasondate#1}{}{#2season}}%
\dateuncertainprint
\dateeraprint{#2year}%
\iffieldundef{#2endyear}
{}
{\iffieldequalstr{#2endyear}{}
{\mbox{\bibdaterangesep}}
{\bibdaterangesep
\enddatecircaprint
\iffieldundef{#2season}
{\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
% Optionally print the time after the date
\blx@printtime{#2}{end}}
{\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}%
\enddateuncertainprint
\dateeraprint{#2endyear}}}}}%
\endgroup}
\newcommand*{\mkdaterangedaymonthlong}{\mkdaterangedaymonth{long}}
\newcommand*{\mkdaterangedaymonthshort}{\mkdaterangedaymonth{short}}
\makeatother
\ExecuteBibliographyOptions{date=daymonthlong}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcomma\space}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\begin{document}
\nocite{*}
\printbibliography
\end{document}