> 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-tw/can-kao-wen-xian-yu-yin-wen/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/2c85f285a4eec1e11b8235d9380fdcc8aff6d7ef)

這個範例中有四個與書目相關的命令：

**\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/d30bacbb03c976b98944bb8bbab5b9b94ec13692)

匯入時可以加入一些額外選項，放在方括號內並以逗號分隔， **biblatex**:

**backend=biber**

將後端設定為用來排序書目的工具，biber 是預設值，也較推薦，因為它為多個命令提供完整的在地化，而 biber 的樣式也較容易修改，因為它們使用標準的 LaTeX 巨集。另一個支援的後端是 bibtex，這是一個較傳統的程式；如果將其設為後端，它只會用來排序書目，因此這裡不能使用 bibtex 樣式。

**style=alphabetic**

定義書目樣式與引文樣式，本例為 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}. ({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",
    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 等。請參閱參考指南以查看可用欄位清單。

這個檔案中的資訊之後可以如前面章節所示，透過命令 `\addbibresource{sample.bib}`在 LaTeX 文件中列印並引用。並非 .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-tw/can-kao-wen-xian-yu-yin-wen/08-biblatex-citation-styles.md) 以及 [書目樣式](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/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/e6593e151b686dd82be14263c2719dfc2a421ab1)

額外的參數 `title={完整書目}` 傳入命令中的方括號內 `\printbibliography` 就是用來變更標題的。

書目也可以依不同篩選條件細分成區段，例如：只列印來自同一作者、同一期刊或標題相近的參考文獻。以下為範例。

```latex
\printbibliography[type=article,title={僅限文章}]
\printbibliography[type=book,title={僅限書籍}]

\printbibliography[keyword={physics},title={僅限與物理相關}]
\printbibliography[keyword={latex},title={僅限與 \LaTeX 相關}]
```

![BiblatexEx4.png](/files/5ea05816361efcc48e19626dfb055f1198b6f2ec)

此處將書目分成 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/fd22819856ee6bd9c1f1eb75dd9292cc8f6c5fcb)

目錄中會加入一個章節和一個小節：

* 在第一種情況下，加入 `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          | online         | patent       |
| periodical    | suppperiodical | proceedings  |
| mvproceedings | inproceedings  | reference    |
| mvreference   | inreference    | report       |
| set           | thesis         | unpublished  |
| custom        | conference     | electronic   |
| mastersthesis | phdthesis      | techreport   |
| datatype      |                |              |

**支援的條目欄位** （列印出的資訊取決於書目樣式）

|               |              |               |                 |
| ------------- | ------------ | ------------- | --------------- |
| abstract      | afterword    | annotation    | annotator       |
| author        | authortype   | bookauthor    | bookpagination  |
| booksubtitle  | booktitle    | chapter       | commentator     |
| date          | doi          | edition       | editor          |
| editortype    | eid          | entrysubtype  | eprint          |
| eprinttype    | eprintclass  | eventdate     | eventtitle      |
| file          | foreword     | holder        | howpublished    |
| indextitle    | institution  | 導言            | isan            |
| isbn          | ismn         | isrn          | issue           |
| issuesubtitle | issuetitle   | iswc          | journalsubtitle |
| journaltitle  | 標籤           | language      | library         |
| location      | mainsubtitle | maintitle     | month           |
| 注意            | number       | organization  | origdate        |
| origlanguage  | origlocation | origpublisher | origtitle       |
| pages         | pagetotal    | pagination    | part            |
| publisher     | pubstate     | reprinttitle  | series          |
| 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-tw/can-kao-wen-xian-yu-yin-wen/04-bibtex-bibliography-styles.md)
* [Biblatex 引文樣式](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/08-biblatex-citation-styles.md)
* [基本書目管理](/latex/zh-tw/geng-duo-zhu-ti/05-bibliography-management-in-latex.md)
* [使用 natbib 進行參考書目管理](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/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-tw/can-kao-wen-xian-yu-yin-wen/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.
