LaTeX之参考文献和引文——LaTeX 中的参考文献管理

LaTeX 中的参考文献管理

介绍

当涉及到文献管理包时,LaTeX 中有三个主要选项:bibtex,natbib和biblatex。

本文介绍了如何使用该包来管理和格式化 LaTeX 文档中的参考文献。 biblatex是处理参考文献信息的现代选项,与其他两个选项相比,它提供了更简单、更灵活的界面和更好的语言本地化。

该软件包的最小工作示例如下所示:

\documentclass[letterpaper,10pt]{article}
\usepackage{biblatex} %Imports biblatex package
\addbibresource{sample.bib} %Import the bibliography file

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

\printbibliography %Prints bibliography

\end{document}

在这里插入图片描述

此示例中有四个与文献相关的命令:

\usepackage{biblatex}

导入包biblatex 。

\addbibresource{sample.bib}

导入参考文献数据文件 :此文件包含有关每本参考书、文章等的信息。有关详细信息,请参阅参考文献文件sample.bib部分。

\cite{einstein}

此命令在文档中插入一个引用,在本例中为 [1],该引用对应于参考文献中的元素,einsteinsample.bib中的条目相对应的关键字。

\printbibliography

打印引用的参考文献列表,对于文章文档类默认标题为References,“Bibliography”为书籍和报告。 Overleaf 提供了多个具有预定义样式的模板来管理文献。

基本用法

可以将多个参数传递给 package import 命令,如以下示例所示:

\documentclass{article}
\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}

\addbibresource{sample.bib} %Imports bibliography file

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

\begin{document}

\maketitle

\tableofcontents

\section{First section}

Using \texttt{biblatex} you can display a bibliography divided into sections, depending on citation type. 
Let's cite! Einstein's journal paper \cite{einstein} and Dirac's book \cite{dirac} are physics-related items. 
Next, \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, 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[
heading=bibintoc,
title={Whole bibliography}
] %Prints the entire bibliography with the title "Whole bibliography"

%Filters bibliography
\printbibliography[heading=subbibintoc,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}]

\end{document}

在这里插入图片描述

biblatex导入时会在括号内添加一些额外的选项,通过逗号分隔:

  • backend=biber

    设置后端以对参考文献进行排序,biber 是默认的,建议使用,因为它为多个命令提供了完整的本地化,并且biber 的样式更易于修改,因为它们使用标准的 LATEX 宏。另一个支持的后端是bibtex ,这是一个更传统的程序;如果设置为backend ,则仅用于对文献进行排序,因此此处不能使用任何bibtex样式。

  • style=alphabetic

    定义参考文献样式和引文样式,在本例中为 。根据样式的不同,可能会有更多引文命令可用。有关更多信息,请参见 biblatex 参考文献样式和引文样式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}
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts",
    keywords  = "latex"
}
 
@online{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    addendum = "(accessed: 01.09.2016)",
    keywords  = "latex,knuth"
}

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

@book{knuth-acp,
   author = "Donald E. Knuth",
   publisher = "Addison-Wesley",
   title = "The Art of Computer Programming",
   series = "Four volumes",
   year = "1968",
   note = "Seven volumes planned",
   keywords  = "knuth,programming"
}

@article{ctan,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351",
    keywords  = "latex"
}

此文件包含特殊格式的记录;例如,第一个参考文献由下式定义:

  • @article{...}

    这是记录条目的第一行,@article告诉 BibTeX 这里存储的信息是关于一篇文章的。有关此条目的信息括在大括号内。除了示例中显示的条目类型(articlebookonlineinbook)之外,还有很多,请参阅参考指南。`

  • einstein

    标签分配给此条目,einstein是一个唯一标识符,可用于在文档中引用本文。

  • author = "Albert Einstein",

    这是参考文献条目中的第一个字段,表明本文的作者是阿尔伯特·爱因斯坦。可以使用相同的语法key = value添加多个逗号分隔的字段,例如:标题、页面、年份、URL 等。有关可能的字段列表,请参阅参考指南

此文件中的信息稍后可以在 LATEX 文档中打印和引用,如前面各节所示,使用命令\addbibresource{sample.bib}不会显示 .bib 文件中的所有信息,这取决于文档中设置的参考文献样式。

自定义参考文献

Biblatex 允许毫不费力地对参考文献部分进行高度定制。overleaf提到有几种引文样式和参考文献样式可用,您也可以创建新的样式。另一个自定义选项是更改参考文献部分的默认标题。

\documentclass{article}
\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}

\addbibresource{sample.bib} %Imports bibliography file

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

\begin{document}

\maketitle

\tableofcontents

\section{First section}

Using \texttt{biblatex} you can display a bibliography divided into sections, depending on citation type. 
Let's cite! Einstein's journal paper \cite{einstein} and Dirac's book \cite{dirac} are physics-related items. 
Next, \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, 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[
heading=bibintoc,
title={Whole bibliography}
] %Prints the entire bibliography with the title "Whole bibliography"


\end{document}

在这里插入图片描述

title={Whole bibliography}括号内传递给命令的附加参数\printbibliography是更改标题的参数。

参考文献也可以根据不同的过滤器细分为多个部分,例如:仅打印来自同一作者、同一期刊或类似标题的参考文献。下面是一个例子。

%Filters bibliography
\printbibliography[heading=subbibintoc,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}]

在这里插入图片描述

在这里,参考文献分为 4 个部分。此处使用的命令的语法说明如下:

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

    仅打印类型为“文章”的条目,并为此部分设置标题“仅限文章”。相同的语法适用于任何其他条目类型。

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

    筛选任何字段中包含“物理”一词的参考文献条目。为该部分设置标题“仅与物理相关”。

在目录中添加参考文献

对于在目录中打印的参考文献,必须将一个额外的选项传递给\printbibliography

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

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

在这里插入图片描述

一个部分和一个子部分将添加到目录中:

  • 在第一种情况下,如果可能,添加heading=bibintoc将标题添加为未编号的章节,否则添加为未编号的章节。

  • 第二种情况添加heading=subbibintoc是将标题添加为目录中的第二级条目,在本例中为嵌套在“整个文献”中的小节。

参考指南

支持的条目类型

articlebookmvbook
inbookbookinbooksuppbook
bookletcollectionmvcollection
incollectionsuppcollectionmanual
misconlinepatent
periodicalsuppperiodicalproceedings
mvproceedingsinproceedingsreference
mvreferenceinreferencereport
setthesisunpublished
customconferenceelectronic
masterthesisphdthesistechreport

支持的输入字段(打印信息取决于参考文献样式)

abstractaddendumafterwordannotate
authorauthortypebookauthorbookpagination
booksubtitlebooktitlechaptercommentator
datedoieditioneditor
editortypeeidentrysubtypeeprint
eprinttypeeprintclasseventdateeventtitle
fileforewordholderhowpublished
indextitleinstitutionintroductionisan
isbnismnisrnissue
issuesubtitleissuetitleiswcjournalsubtitle
journaltitlelabellanguagelibrary
locationmainsubtitlemaintitlemonth
notenumberorganizationorigdate
origlanguageoriglocationorigpublisherorigtitle
pagespagetotalpaginationpart
publisherpubstatereprinttitleseries
shortauthorshorteditionshorthandshorthandintro
shortjournalshortseriesshorttitlesubtitle
titletranslatortypeurl
venueversionvolumeyear

参考文献排序选项

选择描述
nty按姓名、标题、年份排序
nyt按姓名、年份、标题排序
nyvt按名称、年份、卷、标题排序
anyt按字母顺序排序 标签、姓名、年份、标题
anyvt按字母顺序排序 标签、名称、年份、卷、标题
ydnt按年份(降序)、姓名、标题排序
none条目按引用顺序处理

有关这些条目和选项的详细信息,请参阅包文档。

延伸阅读

有关更多信息,请参阅 。

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值