> 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/06-natbib-citation-styles.md).

# natbib 引文樣式

Natbib 使用與對應的 [參考書目樣式](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/04-bibtex-bibliography-styles.md#natbib-styles) 如果未宣告特定的引用命令。還有一些額外命令可用來控制某些標點參數。請參見下列範例：

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

%匯入 natbib 套件並設定參考書目與引用樣式
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={((},close={))}} %與引用相關的命令

\title{Natbib 範例}

\author{Overleaf 團隊}

\begin{document}

\maketitle

\section{第一節}
此文件是一個包含兩個被引用項目的範例：\textit{The \LaTeX\ Companion} 一書 \cite[see][chap 2]{latexcompanion}，以及愛因斯坦的期刊論文 \citep{einstein}。

%匯入參考書目檔案 "sample.bib"
\bibliography{sample}

\end{document}
```

![CitationStylesEx1Overleaf.png](/files/825a861fd0dd98307bde49bb026b7061334cf7c0)

格式化引用樣式的特定命令是：

```latex
\setcitestyle{authoryear, open={((},close={))}
```

這些以逗號分隔的參數會告訴 LaTeX 使用 *authoryear* 引用模式，並使用雙括號作為開啟與結束標記。此命令可傳入的各種參數如下：

* 引用模式： `authoryear`, `數字` 或 `上標`.
* 括號： `圓括號` 或 `方括號`。你可以手動設定任何其他開啟與結束字元，使用 `open={char}` 以及 `close={char}`.
* 引用分隔符： `分號`, `逗號`.
* 作者與年份之間的分隔符： `aysep{char}`.
* 具有共同作者的年份之間的分隔符： `yysep={char}`.
* 後註前的文字： `notesep={text}`.

還有其他額外的引用命令，視引用模式而定。例如，在上面的範例中，命令 `\cite[see][chap 2]{latexcompanion}` 會接受兩個額外參數；第一個可選參數 *see* 會印在引用標記之前，而第二個可選參數 *chap 2* 會印在引用標記之後。以下是一個說明一些額外引用命令的表格：

| 指令              | 說明                                |
| --------------- | --------------------------------- |
| `\citet{}`      | 文字引用                              |
| `\citep{}`      | 括號引用                              |
| `\citet*{}`     | 與以下相同： `\citet` 但如果有多位作者，則會列印所有姓名 |
| `\citep*{}`     | 與以下相同： `\citep` 但如果有多位作者，則會列印所有姓名 |
| `\citeauthor{}` | 僅列印作者姓名                           |
| `\citeyear{}`   | 僅列出版年份。                           |

有關此範例中其餘命令的更多資訊，請參見 [使用 natbib 管理書目](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/02-bibliography-management-with-natbib.md)

[在 Overleaf 中開啟一個 `natbib` 套件範例](https://www.overleaf.com/project/new/template/19422?id=65532643\&templateName=Natbib+citation+styles+example\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 延伸閱讀

* [使用 natbib 管理書目](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/02-bibliography-management-with-natbib.md)
* [Natbib 參考書目樣式](/latex/zh-tw/can-kao-wen-xian-yu-yin-wen/05-natbib-bibliography-styles.md)
* [Natbib 套件說明文件](http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/natbib/natbib.pdf)
* [國際語言支援](/latex/zh-tw/yu-yan/03-international-language-support.md)
* [大型專案中的管理](/latex/zh-tw/wen-jian-jie-gou/07-management-in-a-large-project.md)
* [目錄](/latex/zh-tw/wen-jian-jie-gou/02-table-of-contents.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-tw/can-kao-wen-xian-yu-yin-wen/06-natbib-citation-styles.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.
