使用 bibtex 进行参考文献管理

142 篇文章 4 订阅

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

使用 bibtex 进行参考文献管理

LaTeX 中直接支持参考文献的管理。本篇文章介绍如何使用thebibliography环境和BibTeX系统来管理参考文献。

注意:如果你是一个新手的话,我们建议你使用biblatex,这个包支持多种语言,非常的简单和灵活。

介绍

LaTeX 中标准的参考文献命令与列表相似。

\begin{thebibliography}{9}
\bibitem{latexcompanion} 
Michel Goossens, Frank Mittelbach, and Alexander Samarin. 
\textit{The \LaTeX\ Companion}. 
Addison-Wesley, Reading, Massachusetts, 1993.

\bibitem{einstein} 
Albert Einstein. 
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) 
[\textit{On the electrodynamics of moving bodies}]. 
Annalen der Physik, 322(10):891–921, 1905.

\bibitem{knuthwebsite} 
Knuth: Computers and Typesetting,
\\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
\end{thebibliography}

在这里插入图片描述

环境thebibliography输出了参考文献的列表。在article文档中,列表的标题是References;在bookreport文档中,列表的标题是Bibliography。大括号中的参数(9)代表着环境中条目的数量,这个数字不能大于99

创建参考文献条目的命令是\bibitem。大括号中的参数是条目的标签,这个标签可以在正文中使用。在大括号之后,是作者的名字,文献的标题、出版商、等等。

Overleaf 提供了许多事先定义好的参考文献样式:link

嵌入系统(Embedded system)

上一个例子只包括了参考文献的列表。在下面的例子里,我们介绍如何在正文中引用参考文献。

\begin{document}

\section{First section}

This document is an example of \texttt{thebibliography} environment using 
in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} 
book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the 
Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are
\cite{latexcompanion,knuthwebsite}. 

\medskip

\begin{thebibliography}{9}
\bibitem{latexcompanion} 
Michel Goossens, Frank Mittelbach, and Alexander Samarin. 
\textit{The \LaTeX\ Companion}. 
Addison-Wesley, Reading, Massachusetts, 1993.

\bibitem{einstein} 
Albert Einstein. 
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) 
[\textit{On the electrodynamics of moving bodies}]. 
Annalen der Physik, 322(10):891–921, 1905.

\bibitem{knuthwebsite} 
Knuth: Computers and Typesetting,
\\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
\end{thebibliography}

\end{document}

在这里插入图片描述

命令\cite会在正文中插入对应参考文献的编号,大括号中是参考文献的标签。例如,命令\cite{einstein}的输出是[2].

命令\cite{}输出的具体信息取决于所使用的参考文献样式。详细请见这篇文章:Bibtex参考文献样式

使用 Bibtex 来管理参考文献

BibTeX 是一个广泛使用的管理参考文献的工具。在 BibTeX 中,参考文献的条目是在一个外部文件中进行管理的。我们可以在主文档中引入这个外部文件。

当外部的参考文献文件引入之后,我们可以直接在主文档中使用\cite{}命令。

This document is an example of BibTeX using in bibliography management. Three items 
are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein
journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. 
The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}. 

\medskip

\bibliographystyle{unsrt}
\bibliography{sample}

在这里插入图片描述
命令解释:

\bibliography{sample}
引入外部的 BibTeX 文件sample.bib。如果需要引入多个bib文件,使用逗号分割它们,文件的后缀名可以省略。

\bibliographystyle{unsrt}
设定参考文献的样式。文档中参考文献的输出取决于我们设定了何种参考文献的样式。例如,在外部文件的参考文献条目中,我们提供了文献的各种信息,包括日期、作者、标题、出版商、摘要等,某种参考文献格式可能只会输出文献的标题和作者。这篇文章介绍了 LaTeX 中默认参考文献样式的许多例子。

\cite{einstein}
这个命令会输出参考文献的编号,具体取决于我们所使用的参考文献的样式。在这个例子中,输出是[2]

当主文档被编译过后,系统会生成一个新的.bbl文件。这个文件是一个简单的.tex文件,其中仅包括必要的参考文献信息。在ShareLaTeX中,.bbl文件保存在缓存里,你可以在other logs and files的列表里下载这个文件。

注意:BibTeX 不支持 Unicode 字符。以及,如果文档中有过多的参考文献条目(大于100),可能会出现问题。文末介绍了其他类型的参考文献管理工具。

bibliography文件

参考文献一般位于一个后缀为.bib的文件里。这个文件由许多记录和字段组成。每一个参考文献记录包含了该参考文献条目的相关信息。

@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"
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

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

这个文件包含了许多特殊格式的记录,例如,第一个参考文献由下面的命令定义:

@article{…}
这是记录条目的第一行的内容,@article表示这个条目的类型是article。上面的例子使用了三种条目类型(articlebookmisc),更多的类型见文末。

einstein
这是条目的标签。我们使用这个标签来在正文中引用参考文献。

author= "Albert Einstein"
这是参考文献条目的第一个字段,定义了这个参考文献的作者是阿尔伯特·爱因斯坦。你可以添加更多的字段,使用逗号分割。格式为key = value,。例如:标题、页码、年份、超链接等。更多可选项见文末。

这个文件中的内容可以随后在主文档中使用。

在目录中添加参考文献

这里有两种方法来在目录中添加参考文献:手动添加或者使用tocbibind包(推荐)。

手动添加你只需要在命令\begin{thebibliography}或命令\bibliography之前添加一个新的行。

对于bookreport
\addcontentsline{toc}{chapter}{Bibliography}

对于article
\addcontentsline{toc}{section}{References}

如果你使用hyperref包,我们建议你在\addcontentsline之前添加\phantomsection,从而使 hyperlinks 能定位正确的页面。如果你使用tocbibind,见下面的例子:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[nottoc]{tocbibind}

\begin{document}

\tableofcontents

\section{First Section}
This document ...

\bibliographystyle{unsrt}
\bibliography{sample}

\end{document}

在这里插入图片描述
命令\usepackage[nottoc]{tocbibind}会在目录中输出ReferencesBibliography,取决于文档的类型。请仔细检查,它还可能在目录中添加其他元素,例如IndexGlossarylist of Listings等。更多信息请见:[the tocbibind package documentation]

参考指南

标准的条目类型:

article
杂志或者期刊的文章

book
书籍

booklet
没有出版的或者没有赞助机构的书籍

conference
会议文章

inbook
书籍的一部分内容(例如章节)

incollection
书籍的某个拥有自己标题的内容

inproceedings
会议文章

manual
技术文档

masterthesis
硕士论文

misc
其他类型的文档

phdthesis
博士论文

proceedings
会议论文

techreport
一个机构出版的报告

unpublished
没有正式出版的文档,拥有作者和标题

BibTeX 中最常用的字段

  • address
  • annote
  • author
  • booktitle
  • chapter
  • crossref
  • edition
  • editor
  • institution
  • journal
  • key
  • month
  • note
  • number
  • organization
  • pages
  • publisher
  • school
  • series
  • title
  • type
  • volume
  • year
  • URL
  • ISBN
  • ISSN
  • LCCN
  • abstract
  • keywords
  • price
  • copyright
  • language
  • contents

延伸阅读

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值