> 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/overleaf-learn-latex-pt/base-de-conhecimento/122-preamble-organization.md).

# Organização do preâmbulo

## Introdução

## Ideias genéricas

A ideia básica é organizar o preâmbulo de forma granular: começar pelos pacotes e definições mais genéricos e continuar a ordenar os pacotes e definições necessários até aos mais específicos do projeto, terminando com as macros do utilizador. Isto tem três razões principais:

1. Isto funciona para dependências; as macros do utilizador, em geral, dependem dos pacotes carregados. Os pacotes matemáticos e outros podem depender das fontes carregadas.
2. As coisas que mudam mais frequentemente ficam no fim, mais perto do corpo do documento.
3. Isto ajuda a manter o preâmbulo bem organizado e as coisas fáceis de encontrar e ajustar.

Infelizmente, há exceções a isto, pois existem pacotes cuja ordem de carregamento é importante; veja [#Exceções à ordem de carregamento de pacotes](#package-loading-order-exceptions) para a lista.

## Alguns exemplos

## Colocar o preâmbulo num ficheiro separado

É possível colocar o preâmbulo num ficheiro separado. Há três formas básicas:

* Mova o preâmbulo para um ficheiro padrão `.tex` e use `\input{...}`.
* Coloque tudo num pacote de utilizador e use `\usepackage{...}`.
* Coloque tudo numa classe de utilizador e use `\documentclass{...}`.

De qualquer forma, é sempre preferível manter `\documentclass{...}` no ficheiro principal e manter o ficheiro principal na pasta de topo do projeto.

## Exceções à ordem de carregamento de pacotes

Para alguns pacotes, a ordem de carregamento é importante; por isso, estes não podem seguir as ideias genéricas fornecidas acima.


---

# 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/overleaf-learn-latex-pt/base-de-conhecimento/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.
