> 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/can-kao-wen-xian-he-yin-yong/03-bibliography-management-with-biblatex.md).

# 使用 biblatex 进行参考文献管理

在参考文献管理包方面，LaTeX 中有三个主要选项：bibtex、natbib 和 biblatex。Biblatex 是一个用于处理参考文献信息的现代程序，提供了比另外两个选项更简单、更灵活的界面以及更好的语言本地化支持。本文将介绍如何使用 **biblatex** 在 LaTeX 文档中管理和格式化参考文献。

## 引言

一个 **biblatex** 宏包的最小可运行示例如下：

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

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

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

\printbibliography

\end{document}
```

![BiblatexEx1.png](/files/78ca532fd19cece6fdca720290374f7aaee8f4bf)

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

**\usepackage{biblatex}**

导入 biblatex 宏包。

**\addbibresource{sample.bib}**

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

**\cite{einstein}**

该命令在文档中插入一个引用，在此例中为 \[1]，它对应于参考文献中的一个条目；"einstein" 是 sample.bib 中某个条目的关键字。

**\printbibliography**

打印被引用文献列表；对于 article 文档类，默认标题为 "References"，对于书籍和报告则为 "Bibliography"。

***Overleaf 提供了若干带有预定义样式的模板来管理参考文献。请参见*** [***这些示例。***](https://www.overleaf.com/latex/templates/tagged/bibliography)

[在 Overleaf 上打开一个 biblatex 包示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=Example+using+BiBLaTeX\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 基本用法

包导入语句可以传入多个参数，让我们看看

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

\usepackage{comment}

\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{The Comprehensive Tex Archive
Network}（CTAN）\cite{ctan} 都是与 \LaTeX\ 相关的条目；但其他 Donald
Knuth 的条目 \cite{knuth-fa,knuth-acp} 则专门用于编程。

\\medskip

\printbibliography

\end{document}
```

![BiblatexEx2.png](/files/965d2ab519469c1933eea7bd077e215ec6be8519)

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

**backend=biber**

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

**style=alphabetic**

定义参考文献样式和引用样式，在本例中为字母顺序样式。根据样式的不同，可能还会提供更多引用命令。有关更多信息，请参见参考文献样式和引用样式。

**sorting=ynt**

决定对参考文献来源进行排序的标准。在本例中，它们按年份、名称和标题排序。有关排序选项列表，请参见参考指南。

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

[在 Overleaf 上打开一个 biblatex 包示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=Example+using+BiBLaTeX\&latexEngine=pdflatex\&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",
    keywords =     "物理"
}

@book{dirac,
    title={量子力学原理},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={物理学国际专著丛书},
    year={1981},
    publisher={Clarendon Press},
    physics
}

@online{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth：计算机与排版",
    url       = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    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 文件中的所有信息都会显示出来，这取决于文档中设置的参考文献样式。

[在 Overleaf 上打开一个 biblatex 包示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=Example+using+BiBLaTeX\&latexEngine=pdflatex\&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[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{comment}

\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{The Comprehensive Tex Archive
Network}（CTAN）\cite{ctan} 都是与 \LaTeX\ 相关的条目；但其他 Donald
Knuth 的条目 \cite{knuth-fa,knuth-acp} 则专门用于编程。

\\medskip

\printbibliography[title={完整参考文献}]

\end{document}
```

![BiblatexEx3.png](/files/3520566a50dee5ca3ce4f972aa7edfdf3b2e1a86)

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

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

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

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

![BiblatexEx4.png](/files/ecf3ae10fc8f7927131863e678574a68e151207f)

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

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

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

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

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

[在 Overleaf 上打开一个 biblatex 包示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=Example+using+BiBLaTeX\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

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

若要将参考文献打印到目录中，必须向 `\printbibliography`

```latex
\printbibliography[
heading=bibintoc,
title={完整参考文献}
]

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

![BiblatexEx5.png](/files/9125f6cce23be447fcc1d7a0ce8562ab614313a1)

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

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

[在 Overleaf 上打开一个 biblatex 包示例](https://www.overleaf.com/project/new/template/19715?id=66713383\&templateName=Example+using+BiBLaTeX\&latexEngine=pdflatex\&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   |
| 硕士论文          | phdthesis      | techreport   |
| 数据类型          |                |              |

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

|               |              |               |                 |
| ------------- | ------------ | ------------- | --------------- |
| abstract      | afterword    | 注释            | 注释者             |
| 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`  | 条目按引用顺序处理          |

## 进一步阅读

更多信息请参见

* [参考文献样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/04-bibtex-bibliography-styles.md)
* [Biblatex 引用样式](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/08-biblatex-citation-styles.md)
* [参考文献基础管理](/latex/zh-cn/geng-duo-zhu-ti/05-bibliography-management-in-latex.md)
* [使用 natbib 进行文献管理](/latex/zh-cn/can-kao-wen-xian-he-yin-yong/02-bibliography-management-with-natbib.md)
* [biblatex 文档](http://linorg.usp.br/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf)


---

# 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/can-kao-wen-xian-he-yin-yong/03-bibliography-management-with-biblatex.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.
