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

# 我可以在 Overleaf 專案中選擇哪個檔案作為主要 tex 檔嗎？

是，請按照以下步驟：

1. 點擊 Overleaf 選單圖示（![OLmenu.png](/files/f3fa50b156f1329c3241d2ae3da703c23b0bfef4)），它位於檔案清單上方。
2. 在選單中，找到 **主文件** 選項，並將其設為您偏好的 `.tex` 檔案中：

   ![SettingMainTeX.png](/files/86f998b20554dda89d68f2bacc99170dad0d65fd)
3. 這將設定每次您返回專案時都要編譯並預覽的檔案。

**備註**:

* 為確保 Overleaf 功能正常運作，我們建議將專案的主要 `.tex` 檔案放在專案的頂層資料夾中。例如，受影響的功能包括 [跳至位置](/latex/zh-tw/zhi-shi-ku/022-can-t-find-jump-to-location-arrows.md), [字數統計](/latex/zh-tw/zhi-shi-ku/099-is-there-a-way-to-run-a-word-count-that-doesn-t-include-latex-commands.md) 以及像 [makeglossaries](/latex/zh-tw/wen-jian-jie-gou/05-glossaries.md) 等，
* 任何包含 `\documentclass` 指令的專案檔案，都可以在編輯器中開啟時，透過選擇 **重新編譯** 按鈕來進行編譯。這讓您無需更改專案的主要檔案設定，就能在一個 Overleaf 專案中編譯多份文件。


---

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