> 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/vi/cau-hoi-and-tra-loi/04-can-i-add-inline-or-margin-comments-to-the-pdf.md).

# Tôi có thể thêm chú thích trong dòng hoặc ở lề vào PDF không?

Có, bạn có thể dùng [`todonotes` gói](https://ctan.org/pkg/todonotes?lang=en) (được đề cập ở đây) hoặc đọc trang trợ giúp của chúng tôi về [ghi chú ở lề](/latex/vi/dinh-dang/15-margin-notes.md), trong đó thảo luận về [`\marginpar` lệnh](/latex/vi/dinh-dang/15-margin-notes.md#the-5cmarginpar-command) và [`marginnote` gói](/latex/vi/dinh-dang/15-margin-notes.md#an-alternative-to-5cmarginpar-the-marginnote-package).

## Tải gói todonotes

Để sử dụng `todonotes` gói, hãy thêm dòng sau vào phần mở đầu tài liệu của bạn:

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

Tính năng `colorinlistoftodos` tùy chọn sẽ thêm các ô vuông màu nhỏ vào danh sách ghi chú todo (xem bên dưới), giúp phân biệt giữa các loại khác nhau.

* **Lưu ý**: Người đọc được khuyến khích mạnh mẽ duyệt qua [`todonotes` tài liệu](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) để biết thông tin về các tùy chọn của gói, các lệnh hữu ích và các ví dụ hữu ích.

Dùng lệnh sau để thêm một chú thích:

```latex
\todo{Đây là một chú thích sẽ xuất hiện ở lề}
```

## Ví dụ sử dụng gói todonotes

Dưới đây là một ví dụ cơ bản để giúp bạn bắt đầu: nó minh họa các kiểu ghi chú khác nhau và tạo ra danh sách ghi chú todo thông qua lệnh

```latex
\listoftodos[Tiêu đề của danh sách của bạn...]
```

lệnh này nhận một đối số tùy chọn, được đặt trong `[...]`, dùng để dàn trang một tiêu đề cho danh sách ghi chú.

```latex
\documentclass[a4paper]{article}
\usepackage[colorlinks]{hyperref}
\usepackage[colorinlistoftodos]{todonotes}
\begin{document}
\listoftodos[Một danh sách những việc tôi cần hoàn thành]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla
\todo[Ghi chú todonotes đơn giản.] 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]{Ghi chú todonotes với một màu khác.}%
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]{Ghi chú todonotes chỉ hiển thị ở lề và không có trong
danh sách các việc cần làm.}%
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]{Một ghi chú với cỡ chữ nhỏ.}%
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]{thử nghiệm thử nghiệm}

Donec nulla lectus, faucibus sit amet, auctor non, consectetuer
quis, pede. Nullam dictum. Nullam suscipit, ligula in scelerisque
\todo[noline]{Một ghi chú không có đường nối trở lại văn bản.}%
posuere, sapien purus rutrum magna, vitae pharetra leo quam vel
tortor. Donec eleifend condimentum sapien. Etiam sed orci. Aliquam
\todo[inline, color=red!50]{Ghi chú todonotes nội tuyến.}%
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]{Một ghi chú không có đường nối trở lại văn bản.}%
in nibh bibendum volutpat. Quisque accumsan diam. Aenean ultricies
nisl ac lacus. Aliquam posuere. Aenean venenatis tortor in felis.
\end{document}
```

Mở ví dụ này trong Overleaf

Ví dụ này tạo ra kết quả sau:

![Minh họa gói todonotes trên Overleaf](/files/0d822db46e1724768411ee1fde1c789f953e28f0)

## Đọc thêm

* Tính năng [`todonotes` tài liệu](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) có thông tin về các tùy chọn của gói, các lệnh hữu ích và các ví dụ hữu ích.
* Trang trợ giúp của Overleaf về [ghi chú ở lề](/latex/vi/dinh-dang/15-margin-notes.md) thảo luận về [`\marginpar` lệnh](/latex/vi/dinh-dang/15-margin-notes.md#the-5cmarginpar-command) và [`marginnote` gói](/latex/vi/dinh-dang/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/vi/cau-hoi-and-tra-loi/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.
