> 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/texlive/vi/ky-nang/them-cac-phu-thuoc-latex.md).

# Thêm các phụ thuộc LaTeX

Nếu bạn có `.cls`, `.sty`, `.bst` các tệp trong dự án của bạn, quá trình biên dịch của Overleaf sẽ không thể tìm thấy các tệp này trừ khi chúng được đặt ở cấp cao nhất.

Tuy nhiên, để sắp xếp dự án của bạn, bạn có thể muốn đặt các tệp này vào các thư mục để dễ tìm hơn và để cấp cao nhất của dự án không bị lộn xộn.

Tin tốt là chúng ta có thể chỉ định tùy chỉnh `TEXINPUTS` các thư mục bằng cách dùng `latexmkrc` tệp, để Overleaf biết rằng nó cần tìm kiếm các tệp gói trong thư mục đó.

Để làm điều này, giả sử bạn đã đặt các tệp gói này trong một thư mục có tên `tex/`; và tương ứng các tệp kiểu trích dẫn trong một thư mục có tên `bst/`:

1. Nhấp vào “Add file” ở phía trên thanh bên Project.
2. Chọn “Blank file”, và lưu tên tệp là `latexmkrc` (nếu nó chưa có ở đó).
3. Đặt dòng sau vào `latexmkrc`:

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

   (hoặc thay đổi thành các tên thư mục tương ứng trong dự án của bạn)

Overleaf giờ sẽ tìm kiếm trong `tex/` thư mục trước khi tìm kiếm trong hệ thống `TEXINPUTS` để tìm các tệp gói, và `bst/` thư mục trước khi tìm kiếm trong hệ thống `BSTINPUTS` để tìm các tệp kiểu trích dẫn.

(Nguồn: <https://tex.stackexchange.com/a/50847>)

{% hint style="info" %}
Tệp tài liệu chính của bạn và tệp `latexmkrc` phải vẫn ở cấp cao nhất của dự án bạn, không được ở trong một thư mục.
{% 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://overleaf-pro.ayaka.space/texlive/vi/ky-nang/them-cac-phu-thuoc-latex.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.
