> 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/texlive/zh-cn/ji-qiao/tian-jia-latex-yi-lai.md).

# 添加 LaTeX 依赖

如果你有 `.cls`, `.sty`, `.bst` 文件在你的项目中，Overleaf 的编译过程将无法找到这些文件，除非它们被放置在顶层。

不过，为了组织你的项目，你可能希望将这些文件放入文件夹，以便更容易查找，并且项目的顶层不会混乱。

好消息是我们可以指定自定义的 `TEXINPUTS` 目录，使用 `latexmkrc` 文件，这样 Overleaf 就知道需要在该目录中搜索这些包文件。

为此，假设你已将这些包文件放在名为 `tex/`的文件夹中；而相应的参考文献样式文件放在名为 `bst/`:

1. 的文件夹中。
2. 点击项目侧栏顶部的“添加文件”。 `latexmkrc` 选择“空白文件”，并将文件名保存为
3. （如果它尚不存在）。 `latexmkrc`:

   ```perl
   在文件中放入以下行 
   $ENV{'TEXINPUTS'}='./tex//:' . $ENV{'TEXINPUTS'};
   ```

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

（或根据你项目中的相关文件夹名称进行更改） `tex/` Overleaf 现在将在系统 `TEXINPUTS` 之前先搜索该 `bst/` Overleaf 现在将在系统 `文件夹以定位包文件，并且` BSTINPUTS

用于定位参考文献样式文件。 [（来源：](https://tex.stackexchange.com/a/50847))

{% hint style="info" %}
<https://tex.stackexchange.com/a/50847> `latexmkrc` 你的主文档文件和你的\
文件必须保留在项目的顶层，不能放在文件夹中。
{% endhint %}


---

# 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/texlive/zh-cn/ji-qiao/tian-jia-latex-yi-lai.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.
