![梅威瑟:](https://linux22.com/image/291545/%E6%A2%85%E5%A8%81%E7%91%9F%EF%BC%9A.png)
我一直在尝试修改现有biblatex
样式以符合 PNAS 引用指南,但标题分隔符存在问题。
PNAS 要求书籍和文集的引用采用以下格式:
Doe J (<year>) \emph{<booktitle>} (<publisher>: <address>).
以及以下格式的期刊文章:
Doe J (<year>) <title>. \emph{<journaltitle>} <volume>(<number>):<pagerange>.
在 Barbara Beeton、打击乐手和其他大师的帮助下,我已经完成了大部分工作。
但我还没弄清楚如何让期刊标题后跟句号+空格,而书籍/收藏标题后只跟空格。
这是我目前所拥有的:
抱歉,我提供了一个相当长的 (M)WE,其中包含我迄今为止为实现此结果所做的所有更改。我这样做是为了避免我已经更改的内容与您建议的解决方案之间发生冲突。
此外,因为我是一名n00b
,如果我在修改时犯了任何愚蠢的错误,请告诉我。
梅威瑟:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
@Article{a:agrawal:2001:01,
title = {Phenotypic Plasticity in the Interactions and Evolution of Species},
author = {Agrawal, Anurag A.},
journal = {Science},
year = {2001},
month = oct,
volume = {294},
number = {5541},
pages = {321--326},
}
@Book{b:darwin:1859:01,
title = {On the Origin of Species by Means of Natural Selection or the Preservation of Favoured Species in the Struggle for Life},
author = {Darwin, Charles},
publisher = {John Murray},
address = {London},
year = {1859},
}
\end{filecontents}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[%
backend=biber,
useprefix,
citestyle=numeric,
bibstyle=authoryear,
sorting=none,
firstinits=true,
uniquename=init,
terseinits=true,
dashed=false,
]{biblatex}
\addbibresource{bibliography.bib}
%% =============================================================================
%% PNAS Style
%% =============================================================================
\AtEveryBibitem{\clearfield{month}} % Do not show month in bibliography.
\AtEveryCitekey{\clearfield{month}} % Do not show month in citations.
% Comma-separated authors, last then first name.
\renewcommand*{\labelnamepunct}{\addspace}
\renewcommand*{\finalnamedelim}{%
\ifbibliography{\addcomma\space}{\addspace\&\space}}
\renewcommand*{\revsdnamepunct}{}
\DeclareNameAlias{sortname}{last-first}
% No quotes or italics in titles, except books and collections in italics.
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,
thesis,unpublished]{title}{#1}
\DeclareFieldFormat[book,collection]{title}{\emph{#1}}
% Journal titles in italics.
\DeclareFieldFormat{journaltitle}{\emph{#1}}
\DeclareFieldFormat{issuetitle}{\emph{#1}}
\DeclareFieldFormat{maintitle}{\emph{#1}}
% Print publisher, then location, separated by comma in parentheses.
\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{%
\printlist{publisher}%
\iflistundef{location}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
}\newunit%
}
% Remove "in:" for article entries.
\renewbibmacro*{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% Remove page prefixes.
\DeclareFieldFormat{pages}{#1}
% Print volume, followed by number in parentheses.
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\printfield{number}}
% Colon for volume(number):pages delimiter.
\renewcommand*{\bibpagespunct}{%
\ifentrytype{article}{\addcolon}{\addcomma\space}}
% Add labelnumbers to bibliography.
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\defbibenvironment{bibliography}
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
% Omit authoryear disambiguation.
\AtEveryBibitem{\clearfield{extrayear}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案1
book
因此您必须修改中的entrytype 的 bibdriver standard.bbx
。您可以使用 包轻松交换宏(尤其是 biblatex-macros)中的部件xpatch
。
将以下几行添加到您的序言中,它将第一个字符串与第二个字符串交换 - 这将用空格字符替换此时的默认单位一次。
\usepackage{xpatch}
\xpatchbibdriver{book}{\newunit\newblock\usebibmacro{publisher+location+date}}{%
\setunit{\addspace}\newblock%
\usebibmacro{publisher+location+date}%
}{}{}