我使用的是biblatex
2.0 和 Biber。使用以下方法的多项引用输出\mcite
结果为:
[1] a) 作者 1,Phys. Rev. Lett. 11, 1 (2012);b) 作者 2,Phys. Rev. Lett. 22, 2 (2012)。
但我希望输出像某些 REVTeX 样式那样,其中同一期刊的连续引用显示为“ibid”。
[1] a)作者 1,Phys. Rev. Lett. 11, 1 (2012);b)作者 2,同上,22, 2 (2012)。
有没有简单的方法可以自动获得它?
答案1
通过和朋友的多重条目引用\mcite
是使用条目集实现的。条目集的参考书目项目由驱动程序生成set
。此驱动程序取决于样式,但通常包含以下代码:
\entryset{<precode>}{<postcode>}
对于集合中的每个成员,\entryset
执行<precode>
、entrytype
特定于的驱动程序和<postcode>
。entrysetcount
字段跟踪集合中当前正在处理的条目。
要引入缩写,您可以修改set
驱动程序以跟踪第一作者列表和标题。然后author
和journal
参考书目宏可以在适当的地方执行缩写。
\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,mcite,subentry,sorting=none]{biblatex}
\providecommand*{\mkibid}[1]{#1}
\makeatletter
% Based on definition in numeric.bbx
\DeclareBibliographyDriver{set}{%
\entryset
{\ifbool{bbx:subentry}
{\printfield[bibentrysetcount]{entrysetcount}%
\setunit*{\addnbspace}}
{}}
{\ifnumequal{\thefield{entrysetcount}}{1}
{\savefield{namehash}{\bbx@lasthash}%
\savefield{journaltitle}{\bbx@lastjournal}}
{}}%
\global\undef\bbx@lasthash
\global\undef\bbx@lastjournal
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}
% Based on definition in biblatex.def
\renewbibmacro*{author}{%
\iffieldequals{namehash}{\bbx@lasthash}
{\nopunct}
{\global\undef\bbx@lasthash
\ifboolexpr{ test \ifuseauthor and not test {\ifnameundef{author}} }
{\printnames{author}%
\iffieldundef{authortype}
{}
{\setunit{\addcomma\space}%
\usebibmacro{authorstrg}}}
{}}
{}}
% Based on definition in biblatex.def
\renewbibmacro*{journal}{%
\iffieldundef{journaltitle}
{}
{\iffieldequals{journaltitle}{\bbx@lastjournal}
{\iffieldequals{namehash}{\bbx@lasthash}
{}
{\bibstring[\mkibid]{ibidem}}}
{\global\undef\bbx@lastjournal
\printtext[journaltitle]{%
\printfield[titlecase]{journaltitle}%
\setunit{\subtitlepunct}%
\printfield{journalsubtitle}}}}}
\makeatother
% Some additional formatting to conform with desired output
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\pertype{article}
\step[fieldset=title,null]
\step[fieldset=pages,null]
\step[fieldset=series,null]
\step[fieldset=issue,null]
\step[fieldset=month,null]
}
}
}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareFieldFormat{bibentrysetcount}{\mknumalph{#1}\bibrightparen}
\DeclareFieldFormat{journaltitle}{#1}
\renewbibmacro*{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\newunit
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\begin{filecontents}{\jobname.bib}
@article{glashow:quark,
title = {Where is the Top Quark?},
author = {Glashow, Sheldon},
journal = {Phys.~Rev.~Lett.},
volume = {45},
issue = {24},
pages = {1914--1916},
year = {1980},
month = {Dec}}
@article{weinberg:muon,
title = {Muon Absorption in Liquid Hydrogen},
author = {Weinberg, Steven},
journal = {Phys.~Rev.~Lett.},
volume = {4},
pages = {575--578},
year = {1960}}
@article{wilson,
title = {Obedience},
volume = {77},
number = {1},
journal = {Publications of the English Goethe Society},
author = {Wilson, Daniel},
year = {2008},
pages = {47--59}}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Define a set with common author \mcite{set1,*glashow,*glashow:quark}.
Define a set with common journal \mcite{set2,*gillies,*wilson}.
Define a set with common author and journal \mcite{set3,*weinberg,*weinberg:muon}.
Define a set with no common author or journal \mcite{set4,*bertram,*reese}.
Define a set with common author \mcite{set5,*knuth:ct,*knuth:ct:a}.
Filler text \cite{knuth:ct:b,glashow,glashow:quark,weinberg,weinberg:muon}.
\printbibliography
\end{document}
一些说明:
- 缩写仅适用于来自条目集第一个成员的重复名称和标题。该解决方案可以适用于其他方案,但这些方案可能容易产生歧义。
- 该
namehash
字段唯一地标识了截断的labelname
列表。要考虑列表中的所有名称,请使用fullhash
。