> 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/006-can-i-choose-which-file-is-the-main-tex-file-in-a-project-on-overleaf.md).

# Posso escolher qual ficheiro é o ficheiro tex principal num projeto no Overleaf?

Sim, seguindo estes passos:

1. Clique no ícone do menu do Overleaf (![OLmenu.png](/files/ff8a7f572c9ac6c7ba9f1eb59eea1a23b57fac4d)), localizado acima da lista de ficheiros.
2. No menu, localize a **Documento principal** opção e defina-a para a sua preferida `.tex` ficheiro:

   ![SettingMainTeX.png](/files/5f764277d38cbcd1b1d4f791a5c17e62cc92b00a)
3. Isto definirá o ficheiro a ser compilado e pré-visualizado sempre que regressar ao seu projeto.

**Notas**:

* Para garantir que as funcionalidades do Overleaf funcionem corretamente, recomendamos colocar o ficheiro principal do projeto `.tex` na pasta de nível superior do projeto. Por exemplo, as funcionalidades afetadas incluem [ir para a localização](/latex/overleaf-learn-latex-pt/base-de-conhecimento/022-can-t-find-jump-to-location-arrows.md), [contagem de palavras](/latex/overleaf-learn-latex-pt/base-de-conhecimento/099-is-there-a-way-to-run-a-word-count-that-doesn-t-include-latex-commands.md) e scripts como [makeglossaries](/latex/overleaf-learn-latex-pt/estrutura-do-documento/05-glossaries.md) etc.,
* Qualquer ficheiro do projeto que contenha um `\documentclass` comando pode ser compilado ao ser aberto no editor, selecionando o **Recompilar** botão. Isto permite compilar vários documentos dentro de um único projeto Overleaf sem alterar a definição do ficheiro principal do projeto.


---

# 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/006-can-i-choose-which-file-is-the-main-tex-file-in-a-project-on-overleaf.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.
