> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-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} %导入 biblatex 宏包
\addbibresource{sample.bib} %导入参考文献文件

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

\printbibliography %打印参考文献

\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{参考文献管理：\texttt{biblatex} 宏包}
\author{Overleaf}
\date{ }

\begin{document}

\maketitle

使用 \texttt{biblatex}，你可以显示按
不同章节划分的参考文献，具体取决于引用类型。来引用吧！爱因斯坦的
期刊论文 \cite{einstein} 和狄拉克的书 \cite{dirac} 是
与物理相关的条目。接下来，\textit{The \LaTeX\ Companion} 一书
 \cite{latexcompanion}、Donald Knuth 的网站 \cite{knuthwebsite}、
\textit{综合 TeX 归档网络}（CTAN）
\cite{ctan} 是与 \LaTeX 相关的条目；但其他那些，Donald Knuth 的条目，
\cite{knuth-fa,knuth-acp} 则专门用于编程。

\\medskip

\printbibliography

\end{document}
```

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

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

**backend=biber**

将后端设置为用于排序参考文献的 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}. (德语)
    [{关于}运动物体的电动力学]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    physics
}

@book{dirac,
    title = {量子力学原理},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    physics
}

@online{knuthwebsite,
    author = "Donald Knuth",
    title = "Knuth：计算机与排版",
    url  = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    addendum = "(访问日期：01.09.2016)",
    keywords = "latex,knuth"
}

@inbook{knuth-fa,
    author = "Donald E. Knuth",
    title = "基础算法",
    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{参考文献管理：\texttt{biblatex} 宏包}
\author{Overleaf}
\date{2021 年 5 月}

\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={完整参考文献}]
```

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

额外参数 `title={完整参考文献}` 传入命令时放在方括号中的 `\printbibliography` 就是用来更改标题的。

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

```latex
\printbibliography[type=article,title={仅文章}]
\printbibliography[type=book,title={仅书籍}]

\printbibliography[keyword={physics},title={仅与物理相关}]
\printbibliography[keyword={latex},title={仅与 \LaTeX 相关}]
```

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

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

**\printbibliography\[type=article,title={仅文章}]**

仅打印类型为 "article" 的条目，并将本节标题设为 "仅文章"。同样的语法适用于任何其他条目类型。

**\printbibliography\[keyword={physics},title={仅与物理相关}]**

筛选出在任何字段中包含单词 "physics" 的参考文献条目，并将该部分标题设为 "仅与物理相关"。

[打开一个更完整的 `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={完整参考文献}
]

\printbibliography[heading=subbibintoc,type=article,title={仅文章}]
```

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

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

* 在第一种情况下，添加 `heading=bibintoc` 会将标题添加到目录中；如果可能则作为无编号章，否则作为无编号节。
* 第二种情况是 `heading=subbibintoc` 它会将标题作为目录中的二级条目添加，在本例中作为嵌套在“完整参考文献”中的小节。

[打开一个更完整的 `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    | 报告           |
| set           | thesis         | unpublished  |
| custom        | conference     | electronic   |
| masterthesis  | phdthesis      | techreport   |

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

|               |              |               |                 |
| ------------- | ------------ | ------------- | --------------- |
| abstract      | addendum     | afterword     | annotate        |
| author        | 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        | 语言            | 库               |
| 位置            | 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        |
| title         | 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://overleaf-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.
