> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/latex/zh-cn/geng-duo-zhu-ti/05-bibliography-management-in-latex.md).

# LaTeX 中的参考文献管理

## 引言

当涉及参考文献管理宏包时，LaTeX 中有三种主要选择： `bibtex`, `natbib` 和 `biblatex`.

本文介绍如何使用 `biblatex` 宏包来管理并格式化 LaTeX 文档中的参考文献。 `biblatex` 是处理参考文献信息的一种现代选择，提供了比另外两种选择更简单、更灵活的接口以及更好的语言本地化。

一个最小工作示例的 `biblatex` 宏包如下所示：

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

\begin{document}
来引用吧！爱因斯坦的期刊论文 \cite{einstein} 和狄拉克的
书 \cite{dirac} 都是与物理相关的条目。

\printbibliography %Prints bibliography

\end{document}
```

![BiblatexEx1OLV2.png](/files/8fe87124ed26c3f3c56fa198c8ad38d28e218f58)

本例中有四个与参考文献相关的命令：

**\usepackage{biblatex}**

导入 biblatex 宏包。

**\addbibresource{sample.bib}**

导入参考文献数据文件 sample.bib：该文件包含每本被引用的书、文章等的信息。更多信息请参见参考文献文件部分。

**\cite{einstein}**

此命令在文档中插入一个引用，这里是 \[1]，对应参考文献中的一个条目；einstein 是 sample.bib 中某个条目的关键词。

**\printbibliography**

打印被引用文献列表，默认标题在 article 文档类中为 References，在书籍和报告中为 Bibliography。

Overleaf 提供了若干带有预定义样式的模板来管理参考文献。参见 [此链接](https://www.overleaf.com/gallery/tagged/bibliography). [在 Overleaf 中打开 biblatex 宏包示例](https://www.overleaf.com/project/new/template/19714?id=66708264\&templateName=Biber+bibliography+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 基本用法

可以向宏包导入命令传递多个参数，如下例所示：

```latex
\documentclass{article}

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

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

\begin{document}

\maketitle

使用 \texttt{biblatex}，你可以将参考文献显示为分组的
部分，具体取决于引用类型。来引用吧！爱因斯坦的
期刊论文 \cite{einstein} 和狄拉克的书 \cite{dirac} 是
与物理相关的条目。接下来，\textit{The \LaTeX\ Companion} 一书
 \cite{latexcompanion}、Donald Knuth 的网站 \cite{knuthwebsite}，
\textit{The Comprehensive Tex Archive Network} (CTAN)
\cite{ctan} 是与 \LaTeX 相关的条目；但其他的，Donald Knuth 的条目，
\cite{knuth-fa,knuth-acp} 则与编程相关。

\medskip

\printbibliography

\end{document}
```

![BiblatexExample2OLV2.png](/files/847cb0c3544eb99e979f75860fac604a277f1d83)

在导入时，会添加一些额外选项，写在方括号中并以逗号分隔， `biblatex`:

**backend=biber**

将后端设为用于排序参考文献的工具；biber 是默认并推荐的后端，因为它为多个命令提供完整的本地化支持，而且 biber 的样式更容易修改，因为它们使用标准 LaTeX 宏。另一个受支持的后端是 bibtex，它是一个更传统的程序；如果将其设为后端，bibtex 只会用于排序参考文献，因此这里不能使用 bibtex 样式。

**style=alphabetic**

定义参考文献样式和引文样式，这里是 alphabetic。根据样式不同，可能还会提供更多引文命令。更多信息请参见 biblatex 参考文献样式和引文样式。

**sorting=ynt**

确定对参考文献来源进行排序的准则。在本例中，它们按年份、姓名和标题排序。排序选项列表请参见参考手册。

其余命令已在 [引言](#introduction).

[打开一个更完整的 `biblatex` Overleaf 中的示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=A+biblatex+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 参考文献文件

参考文献文件必须采用标准 BibTeX 语法

```latex
@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",
    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"
}
...
```

该文件包含采用特殊格式的记录；例如，第一个参考文献条目定义如下：

**@article{...}**

这是记录条目的第一行，@article 告诉 BibTeX 这里存储的信息是关于一篇文章的。有关该条目的信息被括在花括号中。除了示例中显示的条目类型（article、book、online 和 inbook）之外，还有许多其他类型，详见参考手册。

**einstein**

标签 einstein 被分配给该条目，它是一个唯一标识符，可用于在文档中引用这篇文章。

**author = "Albert Einstein",**

这是参考文献条目的第一个字段，表示这篇文章的作者是 Albert Einstein。还可以使用相同的语法 key = value 添加多个以逗号分隔的字段，例如：title、pages、year、URL 等。可用字段列表请参见参考手册。

该文件中的信息随后可以像前几节所示那样，在 LaTeX 文档中通过命令打印并引用 `\addbibresource{sample.bib}`。.bib 文件中的并非所有信息都会显示，这取决于文档中设置的参考文献样式。

[打开一个更完整的 `biblatex` Overleaf 中的示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=A+biblatex+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 自定义参考文献

Biblatex 只需很少的工作就能对参考文献部分进行高度自定义。前面提到过有多种 [引文样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/08-biblatex-citation-styles.md) 和 [参考文献样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/07-biblatex-bibliography-styles.md) 可供使用，而且你也可以创建新的样式。另一种自定义选项是更改参考文献部分的默认标题。

```latex
\documentclass{article}

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

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

\begin{document}

\maketitle

使用 \texttt{biblatex}，你可以将参考文献显示为分组的部分，
具体取决于引用类型。来引用吧！爱因斯坦的期刊论文 \cite{einstein}
和狄拉克的书 \cite{dirac} 是与物理相关的条目。接下来，\textit{The \LaTeX\ Companion}
一书 \cite{latexcompanion}、Donald Knuth 的网站 \cite{knuthwebsite}，
\textit{The Comprehensive Tex Archive Network} (CTAN) \cite{ctan} 是
与 \LaTeX 相关的条目；但其他的，Donald Knuth 的条目，
\cite{knuth-fa,knuth-acp} 则与编程相关。

\medskip

\printbibliography[title={Whole bibliography}]
```

![BiblatexEx3OLV2.png](/files/b5088a84f10d38874cdf273d335972851fc1809b)

附加参数 `title={Whole bibliography}` 以方括号形式传递给命令 `\printbibliography` 的是用于更改标题的那个参数。

参考文献也可以根据不同过滤条件划分为若干部分，例如：只打印来自同一作者、同一期刊或标题相似的参考文献。下面是一个示例。

```latex
\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}]
```

![BiblatexEx4OLV2.png](/files/517236ef6b11c00788a4f67f796da1e341a9d93b)

这里，参考文献被分为 4 个部分。这里所用命令的语法如下所述：

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

只打印类型为 "article" 的条目，并将本部分标题设为 "Articles only"。同样的语法也适用于其他任何条目类型。

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

筛选在任一字段中包含单词 "physics" 的参考文献条目。将该部分标题设为 "Physics-related only"。

[打开一个更完整的 `biblatex` Overleaf 中的示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=A+biblatex+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 将参考文献添加到目录中

要让参考文献出现在目录中，必须向 `\printbibliography`

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

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

![BiblatexEx5OLV2.png](/files/7ca28b19a0e68b2eaaa049e1c3c398505cecca0d)

目录中会添加一个节和一个小节：

* 在第一种情况下，添加 `heading=bibintoc` 会将标题作为无编号章添加到目录中；如果不可能，则作为无编号节添加。
* 第二种情况是 `heading=subbibintoc` 会将标题作为目录中的第二级条目添加，在本例中是嵌套在 "Whole bibliography" 下的小节。

[打开一个更完整的 `biblatex` Overleaf 中的示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=A+biblatex+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 参考指南

**支持的条目类型**

|               |                |              |
| ------------- | -------------- | ------------ |
| article       | book           | mvbook       |
| inbook        | bookinbook     | suppbook     |
| booklet       | collection     | mvcollection |
| incollection  | suppcollection | manual       |
| misc          | 在线             | patent       |
| periodical    | suppperiodical | proceedings  |
| mvproceedings | inproceedings  | 参考           |
| mvreference   | inreference    | report       |
| set           | thesis         | unpublished  |
| custom        | conference     | electronic   |
| masterthesis  | phdthesis      | techreport   |

**支持的条目字段** （打印出的信息取决于参考文献样式）

|               |              |               |                 |
| ------------- | ------------ | ------------- | --------------- |
| 摘要            | addendum     | afterword     | annotate        |
| 作者            | authortype   | bookauthor    | bookpagination  |
| booksubtitle  | booktitle    | chapter       | commentator     |
| date          | doi          | edition       | editor          |
| editortype    | eid          | entrysubtype  | eprint          |
| eprinttype    | eprintclass  | eventdate     | eventtitle      |
| 文件            | foreword     | holder        | howpublished    |
| indextitle    | institution  | 引言            | isan            |
| isbn          | ismn         | isrn          | issue           |
| issuesubtitle | issuetitle   | iswc          | journalsubtitle |
| journaltitle  | label        | 语言            | 库               |
| location      | mainsubtitle | maintitle     | month           |
| note          | number       | organization  | origdate        |
| origlanguage  | origlocation | origpublisher | origtitle       |
| pages         | pagetotal    | pagination    | part            |
| publisher     | pubstate     | reprinttitle  | 系列              |
| shortauthor   | shortedition | shorthand     | shorthandintro  |
| shortjournal  | shortseries  | shorttitle    | subtitle        |
| 标题            | translator   | type          | url             |
| venue         | version      | volume        | year            |

**参考文献排序选项**

| 选项      | 说明                 |
| ------- | ------------------ |
| `nty`   | 按姓名、标题、年份排序        |
| `nyt`   | 按姓名、年份、标题排序        |
| `nyvt`  | 按姓名、年份、卷、标题排序      |
| `anyt`  | 按字母标签、姓名、年份、标题排序   |
| `anyvt` | 按字母标签、姓名、年份、卷、标题排序 |
| `ydnt`  | 按年份（降序）、姓名、标题排序    |
| `none`  | 条目将按引用顺序处理         |

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

## 进一步阅读

更多信息请参见

* [Biblatex 参考文献样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/07-biblatex-bibliography-styles.md)
* [Biblatex 引文样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/08-biblatex-citation-styles.md)
* [使用 natbib 管理参考文献](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/02-bibliography-management-with-natbib.md)
* [使用 bibtex 管理参考文献](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/01-bibliography-management-with-bibtex.md)
* [在 Overleaf 上使用 BibTeX 创建和管理参考文献](https://www.overleaf.com/blog/532)
* [Biblatex 宏包文档](http://linorg.usp.br/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf)
* [国际语言支持](/latex/zh-cn/yu-yan/03-international-language-support.md)
* [目录](/latex/zh-cn/wen-dang-jie-gou/02-table-of-contents.md)
* [大型项目中的管理](/latex/zh-cn/wen-dang-jie-gou/07-management-in-a-large-project.md)
* [多文件 LaTeX 项目](/latex/zh-cn/wen-dang-jie-gou/08-multi-file-latex-projects.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/latex/zh-cn/geng-duo-zhu-ti/05-bibliography-management-in-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
