> 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/wen-yu-da/59-i-have-a-lot-of-.cls-.sty-.bst-files-and-i-want-to-put-them-in-a-folder-to-keep-my-project-unclut.md).

# 我有很多 .cls、.sty、.bst 檔案，想把它們放進資料夾以保持專案整潔。但我的專案無法找到它們來正確編譯

好消息是，我們可以指定自訂 `TEXINPUTS` 目錄，使用 `latexmkrc` 檔案，因此 Overleaf 就知道它需要在該目錄中搜尋套件檔案。

要這麼做，假設你已經把這些套件檔案放在一個名為 `tex/`的資料夾中；而相應的參考書目樣式檔案則放在一個名為 `bst/`:

1. 在專案側邊欄頂端點選「新增檔案」。
2. 選擇「空白檔案」，並將檔名儲存為 `latexmkrc` （如果它還不在那裡的話）。
3. 把下列這一行放入 `latexmkrc`:

   ```
   $ENV{'TEXINPUTS'}='./tex//:' . $ENV{'TEXINPUTS'};
   $ENV{'BSTINPUTS'}='./bst//:' . $ENV{'BSTINPUTS'};
   ```

   （或改成你專案中相關的資料夾名稱）

Overleaf 現在會先搜尋 `tex/` 資料夾，再搜尋系統 `TEXINPUTS` 以找出套件檔案，並且 `bst/` 資料夾，再搜尋系統 `BSTINPUTS` 以找出參考書目樣式檔案。

（來源： <http://tex.stackexchange.com/a/50847/226>)

**注意**：你的主文件檔和你的 `latexmkrc` 檔案必須保留在專案的最上層，而不是放在資料夾中。


---

# 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/wen-yu-da/59-i-have-a-lot-of-.cls-.sty-.bst-files-and-i-want-to-put-them-in-a-folder-to-keep-my-project-unclut.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.
