> 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/zhi-shi-ku/122-preamble-organization.md).

# 前言組織

## 簡介

## 通用概念

基本想法是以較細緻的方式組織導言區：從最一般的套件和設定開始，接著依序安排必要的套件和設定到較專案特定的項目，最後是使用者巨集。這有三個主要原因：

1. 這對相依性也適用；一般而言，使用者巨集會依賴已載入的套件。數學以及其他套件也可能依賴已載入的字型。
2. 最常變動的項目放在最後，也就是最接近文件主體的地方。
3. 這有助於讓導言區保持良好組織，並讓事物更容易找到與調整。

不過，這也有例外，因為有些套件的載入順序確實很重要，請參見 [#套件載入順序的例外](#package-loading-order-exceptions) 以查看清單。

## 一些範例

## 將導言區放入獨立檔案

可以將導言區放入獨立檔案。有三種基本方式：

* 將導言區移到一個標準 `.tex` 並使用 `\input{...}`.
* 將所有內容放入使用者套件並使用 `\usepackage{...}`.
* 將所有內容放入使用者類別並使用 `\documentclass{...}`.

無論哪種方式，最好始終保留 `\documentclass{...}` 在主檔案中，並將主檔案保留在專案的頂層資料夾中。

## 套件載入順序的例外

對某些套件而言，載入順序很重要；因此它們不能遵循前面提供的通用概念。


---

# 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/zhi-shi-ku/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.
