> 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/wen-yu-da/04-can-i-add-inline-or-margin-comments-to-the-pdf.md).

# 我可以在 PDF 中加入行內或邊欄註解嗎？

是的，你可以使用 [`todonotes` 套件](https://ctan.org/pkg/todonotes?lang=en) （此處涵蓋）或閱讀我們關於 [邊註](/latex/zh-tw/ge-shi-hua/15-margin-notes.md)，其中討論了 [`\marginpar` 命令](/latex/zh-tw/ge-shi-hua/15-margin-notes.md#the-5cmarginpar-command) 和 [`marginnote` 套件](/latex/zh-tw/ge-shi-hua/15-margin-notes.md#an-alternative-to-5cmarginpar-the-marginnote-package).

## 載入 todonotes 套件

若要使用 `todonotes` 套件，請將以下一行加入文件前言：

```latex
\usepackage[colorinlistoftodos]{todonotes}
```

該 `colorinlistoftodos` 選項會在待辦事項清單中加入小型彩色方塊（見下文），有助於區分不同類型。

* **注意**：強烈建議讀者瀏覽 [`todonotes` 說明文件](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) 以取得套件選項、實用指令與有幫助的範例資訊。

使用以下指令加入註解：

```latex
\todo{這是一則會出現在邊註中的註解}
```

## 使用 todonotes 套件的範例

以下是一個基本範例，幫助你開始使用：它示範了各種註解樣式，並透過指令產生待辦事項清單

```latex
\listoftodos[您的清單標題...]
```

，此指令可接受一個可選引數，並以 `[...]`包住，用來為清單排版標題。

```latex
\documentclass[a4paper]{article}
\usepackage[colorlinks]{hyperref}
\usepackage[colorinlistoftodos]{todonotes}
\begin{document}
\listoftodos[我需要完成的事項清單]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla
\todo{純文字 todonotes。} urna. Maecenas interdum nunc in augue.
Mauris quis massa in ante tincidunt mollis. Proin imperdiet.
Donec porttitor pede id est. Sed in ante. Integer id arcu. Nam
lectus nisl, posuere sit amet, imperdiet ut, tristique ac, lorem.
In erat. In commodo enim. \todo[color=blue!40]{不同顏色的 todonote。}%
Phasellus libero ipsum, tempor a, pharetra consequat, pellentesque
sit amet, sem. Praesent ut augue luctus elit adipiscing ultricies.
Vestibulum suscipit cursus leo. Nullam molestie justo.

Morbi dui. Morbi convallis mi sed sem. Nulla convallis lacus vitae
risus. Phasellus adipiscing. Nullam tortor. Sed laoreet aliquam
ante. Vestibulum diam. Pellentesque nec leo. Pellentesque velit.
\todo[nolist]{只顯示在邊註中，而不顯示在
待辦事項清單中。}%
Praesent congue mi eu ipsum cursus fringilla. Etiam leo erat,
tristique et, pharetra eget, mollis vitae, velit. In hac habitasse
\todo[size=\small, color=green!40]{字型較小的註解。}%
platea dictumst. In quam nibh, facilisis et, laoreet non, facilisis
tempus, justo. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos himenaeos.

\todo[inline]{測試 測試}

Donec nulla lectus, faucibus sit amet, auctor non, consectetuer
quis, pede. Nullam dictum. Nullam suscipit, ligula in scelerisque
\todo[noline]{沒有連回本文的註解。}%
posuere, sapien purus rutrum magna, vitae pharetra leo quam vel
tortor. Donec eleifend condimentum sapien. Etiam sed orci. Aliquam
\todo[inline, color=red!50]{行內 todonotes。}%
tempor. Pellentesque egestas tortor id eros. Donec mauris justo,
commodo id, pellentesque id, eleifend non, mi. Duis venenatis
sagittis metus. Donec tempus metus id lacus. Praesent vel diam.
Morbi nec ante. Vestibulum varius felis ac lacus. Nulla vitae neque
\todo[inline, color=green!40]{沒有連回本文的註解。}%
in nibh bibendum volutpat. Quisque accumsan diam. Aenean ultricies
nisl ac lacus. Aliquam posuere. Aenean venenatis tortor in felis.
\end{document}
```

在 Overleaf 中開啟此範例

此範例會產生以下輸出：

![在 Overleaf 上示範 todonotes 套件](/files/f5e2abee47416810e8a5dd26561746a815a64158)

## 延伸閱讀

* 該 [`todonotes` 說明文件](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) 包含套件選項、實用指令與有幫助的範例資訊。
* Overleaf 說明頁面中關於 [邊註](/latex/zh-tw/ge-shi-hua/15-margin-notes.md) 討論了 [`\marginpar` 命令](/latex/zh-tw/ge-shi-hua/15-margin-notes.md#the-5cmarginpar-command) 和 [`marginnote` 套件](/latex/zh-tw/ge-shi-hua/15-margin-notes.md#an-alternative-to-5cmarginpar-the-marginnote-package).


---

# 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/wen-yu-da/04-can-i-add-inline-or-margin-comments-to-the-pdf.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.
