> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/wen-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/wen-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.
