> 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-cn/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-cn/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.
