> 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/co-so-tri-thuc/122-preamble-organization.md).

# Tổ chức phần tiền đề

## Giới thiệu

## Các ý tưởng chung

Ý tưởng cơ bản là tổ chức phần tiền đề một cách chi tiết hơn: Bắt đầu từ các gói và thiết lập tổng quát nhất, rồi tiếp tục sắp xếp các gói và thiết lập cần thiết theo hướng cụ thể hơn cho dự án, kết thúc bằng các macro người dùng. Điều này có ba lý do chính:

1. Điều này hiệu quả với các phần phụ thuộc; các macro người dùng nói chung phụ thuộc vào các gói đã được nạp. Các gói toán học và những gói khác có thể phụ thuộc vào các phông chữ đã được nạp.
2. Những thứ thay đổi thường xuyên nhất sẽ được đặt ở cuối, gần phần thân của tài liệu nhất.
3. Điều này giúp giữ cho phần tiền đề được tổ chức tốt và mọi thứ dễ tìm, dễ chỉnh sửa.

Thật không may, có một số ngoại lệ vì có những gói mà thứ tự nạp của chúng rất quan trọng, xem [#Package loading order exceptions](#package-loading-order-exceptions) để xem danh sách.

## Một số ví dụ

## Đặt phần tiền đề vào một tệp riêng

Có thể đặt phần tiền đề vào một tệp riêng. Có ba cách cơ bản:

* Di chuyển phần tiền đề sang một chuẩn `.tex` và dùng `\input{...}`.
* Đưa tất cả vào một gói người dùng và dùng `\usepackage{...}`.
* Đưa tất cả vào một lớp người dùng và dùng `\documentclass{...}`.

Dù theo cách nào, luôn được ưu tiên giữ `\documentclass{...}` trong tệp chính và giữ tệp chính ở thư mục trên cùng của dự án.

## Ngoại lệ về thứ tự nạp gói

Đối với một số gói, thứ tự nạp là quan trọng; vì vậy chúng không thể theo các ý tưởng tổng quát đã nêu trước đó.


---

# 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/co-so-tri-thuc/122-preamble-organization.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.
