使用 biblatex 进行参考文献管理

142 篇文章 4 订阅

原  文:Bibliography management with natbib
译  者:Xovee
翻译时间:2020年11月21日

使用 biblatex 进行参考文献管理

当你使用 LaTeX 进行参考文献管理时,一般来说你有三种选择:bibtexnatbibbiblatexBiblatex是一个非常现代化的处理参考文献信息的程序,它提供了简单、灵活、易于操作的界面,在语言支持上也比其他两个工具更好。本篇文章介绍如何使用biblatex来在 LaTeX 文档中进行参考文献管理。

介绍

下面介绍了一个简单的例子:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{biblatex}
\addbibresource{sample.bib}

\begin{document}
Let's cite! The Einstein's journal paper \cite{einstein} and the Dirac's 
book \cite{dirac} are physics related items. 

\printbibliography

\end{document}

在这里插入图片描述
这个例子中介绍了四种与参考文献有关的命令:

\usepackage{biblatex}
引入biblatex

\addbibresource{sample.bib}
sample.bib文件中引入bibtex数据。这个文件中包含了你所需要的各种参考文献的信息。

\cite{einstein}
这个命令会在文档中插入一个参考文献,在这个例子中,它会在文档中显示 [1]einstein是该参考文献在文件中某个条目的关键字。

\printbibliography
打印所有引用的参考文献,其默认的标题为Referencearticle类型的文档),或者Bibliographybooksreports类型的文档)。

Overleaf 提供了许多预定义的参考文献管理格式

基础用法

在引入包的时候,你可以传递许多参数,例如:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{comment}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}
\addbibresource{sample.bib}

\title{Bibliography management: \texttt{biblatex} package}
\author{Overleaf}
\date{ }

\begin{document}

\maketitle

Using \texttt{biblatex} you can display bibliography divided into sections, 
depending of citation type. 
Let's cite! The Einstein's journal paper \cite{einstein} and the Dirac's 
book \cite{dirac} are physics related items. 
Next, \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Donald 
Knuth's website \cite{knuthwebsite}, \textit{The Comprehensive Tex Archive 
Network} (CTAN) \cite{ctan} are \LaTeX\ related items; but the others Donald 
Knuth's items \cite{knuth-fa,knuth-acp} are dedicated to programming. 

\medskip

\printbibliography

\end{document}

在这里插入图片描述

在引入biblatex包的时候,额外的选项定义在大括号之中,用逗号分割。

backend=biber
设置对参考文献进行排序的后端处理。biber是默认的,也是我们推荐的排序方式。它对许多命令提供了完整的本地化实现,并且biber的样式非常容易编辑,因为它使用了标准的 LaTeX 宏指令。另外一个支持的后端处理是bibtex,它是一个比较传统的程序,它只被用来对参考文献进行排序,不可以用来设置bibtex的样式。

style=alphabetic
定义参考文献的样式以及引用的样式,在这个例子里被设置为alphabetic。取决于所使用的样式,你有可能使用更多的引用命令。请见参考文献样式引用样式

sorting=ynt
定义了参考文献排序的规则。在这个例子里,它们会以年份、姓名、标题来进行排序。更多选项见文末。

参考文献文件

参考文献文件必须使用标准的bibtex语法:

@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004",
    keywords =     "physics"
}

@book{dirac,
    title={The Principles of Quantum Mechanics},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={International series of monographs on physics},
    year={1981},
    publisher={Clarendon Press},
    keywords = {physics}
}

@online{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    keywords  = "latex,knuth"
}

@inbook{knuth-fa,
    author = "Donald E. Knuth",
    title = "Fundamental Algorithms",
    publisher = "Addison-Wesley",
    year = "1973",
    chapter = "1.2",
    keywords  = "knuth,programming"
}
...

文件中包含了参考文献记录,记录有一种特殊的格式。例如,第一个参考文献又下面的命令定义:

@article{…}
这是参考文献条目的第一行,它告诉 BibTeX 这个条目的类型是 article。条目的信息包含在大括号之中。除了例子中的三种条目(article, book, misc),更多条目类型见文末。

einstein
这是条目的标签,是某个特定参考文献唯一的标识符。我们使用这个标签来在文档中引用这个参考文献。

author = “albert Einstein”,
这是参考文献条目的第一个字段,即该参考文献的作者是 Albert Einstein。你可以添加更多的字段,由逗号分割,语法是key = value,,例如:标题、页码、年份、URL等。更多例子见文末。

该参考文献中的内容可以随后在文档中进行引用和展示(命令为\bibliography{sample}。需要注意的是,.bib 文件中的信息并不是都会展示出来,展示哪些信息取决于你所使用的参考文献格式。例如,某些格式不会展示(打印)文献的出版商。

自定义参考文献

biblatex提供了许多高阶的、容易使用的参考文献自定义命令。它支持许多参考文献样式引用样式,你也可以创建自己的样式。另外一个支持的自定义选项是改变默认的参考文献章的标题。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{comment}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}
\addbibresource{sample.bib}

\title{Bibliography management: \texttt{biblatex} package}
\author{Overleaf}
\date{ }

\begin{document}

\maketitle

Using \texttt{biblatex} you can display bibliography divided into sections, 
depending of citation type. 
Let's cite! The Einstein's journal paper \cite{einstein} and the Dirac's 
book \cite{dirac} are physics related items. 
Next, \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Donald 
Knuth's website \cite{knuthwebsite}, \textit{The Comprehensive Tex Archive 
Network} (CTAN) \cite{ctan} are \LaTeX\ related items; but the others Donald 
Knuth's items \cite{knuth-fa,knuth-acp} are dedicated to programming. 

\medskip

\printbibliography[title={Whole bibliography}]

\end{document}

在这里插入图片描述
大括号中的参数title={Whole bibliography}会改变参考文献章的标题。

参考文献也可以被划分为多个章节,例如:只打印某个作者的参考文献,只打印某个期刊的参考文献等。下面是一个例子:

\printbibliography[type=article,title={Articles only}]
\printbibliography[type=book,title={Books only}]

\printbibliography[keyword={physics},title={Physics-related only}]
\printbibliography[keyword={latex},title={\LaTeX-related only}]

在这里插入图片描述

在这里,参考文献被分为四个章。命令的语法解释如下:

\printbibliography[type=article,title={Articles only}]
只打印条目类型为article的条目,并且将该章节的标题设置为Articles only。其他条目类型的设置方式类似。

\printbibliography[keyword={physics},title={Physics-related only}]
只打印条目信息中出现过关键词physics的条目,并将该章节的标题设置为Physics-related only

在目录中添加参考文献章

为了在文档的目录中添加参考文献的章节,你需要给\printbibliography传递参数:

\printbibliography[
heading=bibintoc,
title={Whole bibliography}
]

\printbibliography[heading=subbibintoc,type=article,title={Articles only}]

在这里插入图片描述

章(section)和子章(subsection)被添加到文档的目录之中:

  • 在第一种情况下,参数heading=bibintoc会把参考文献当作一个不编号的章(chapter,其他情况也有可能是section)添加到目录之中。
  • 第二种情况下,命令heading=subbibintoc会将标题当作第二级的记录添加到目录之中。

参考指南

支持的条目类型

  • article
  • book
  • mvbook
  • inbook
  • bookinbook
  • suppbook
  • booklet
  • collection
  • mvcollection
  • incollection
  • suppcollection
  • manual
  • misc
  • online
  • patent
  • periodical
  • suppperiodical
  • proceedigns
  • mvproceedings
  • inproceedigns
  • reference
  • mvreference
  • inreference
  • report
  • set
  • thesis
  • unpublished
  • custom
  • conference
  • electronic
  • masterthesis
  • phdthesis
  • techreport

支持的条目字段

  • abstract
  • afterword
  • annotation
  • annotator
  • author
  • authortype
  • bookauthor
  • bookpagination
  • boosubtitle
  • booktitle
  • chapter
  • commentator
  • date
  • doi
  • edition
  • editor
  • editortype
  • eid
  • entrysubtype
  • eprint
  • epritntype
  • eprintclass
  • eventdate
  • eventtitle
  • file
  • foreword
  • holder
  • howpublished
  • indextitle
  • institution
  • introduction
  • isan
  • isbn
  • ismn
  • isrn
  • issue
  • issuesubtitle
  • issuetitle
  • iswc
  • journalsubtitle
  • journaltitle
  • label
  • language
  • library
  • location
  • mainsubtitle
  • maintitle
  • month
  • note
  • number
  • organization
  • origdate
  • origlanguage
  • origlocation
  • origpublisher
  • origtitle
  • pages
  • pagetotal
  • pagination
  • part
  • publisher
  • pubstate
  • reprinttitle
  • series
  • shortauthor
  • shortedition
  • shorthand
  • shorthandintro
  • shortjournal
  • shortseries
  • shorttitle
  • subtitle
  • title
  • translator
  • type
  • url
  • venue
  • version
  • volume
  • year

参考文献排序选项

选项描述
nty姓名、标题、年份
nyt姓名、年份、标题
nyvt姓名、年份、volume、标题
anyt字母顺序的标签label、姓名、年份、标题
anyvt字母顺序的标签label、姓名、年份、volume、标题
ydnt年份(降序)、姓名、标题
none按照引用的顺序来排序

延伸阅读

更多信息请见:

  • 20
    点赞
  • 74
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值