> 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/on-premises/zh-tw/she-ding/overleaf-toolkit/templates.md).

# 範本

{% hint style="info" %}
此功能最初由 [yu-i-i/overleaf-cep](https://github.com/yu-i-i/overleaf-cep)，並由 [ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro).
{% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/353215d0829a976aae8ba6952d0caca9b91f49cb" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/7d0c9d850349271b3fc2ae81b855d5c281f3c03c" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### 設定

Template Gallery 功能由以下環境變數控制：

* `OVERLEAF_TEMPLATE_GALLERY`：設為 `true` 即可啟用 Template Gallery。
* `OVERLEAF_TEMPLATE_CATEGORIES`：可選的、以空白分隔的零個或多個範本分類鍵清單。有效鍵包括：

  * *`academic-journal`*
  * *`book`*
  * *`presentation`*
  * *`poster`*
  * *`cv`*
  * *`homework`*
  * *`bibliography`*
  * *`calendar`*
  * *`formal-letter`*
  * *`report`*
  * *`thesis`*
  * *`newsletter`*

  特殊鍵 *`all`* 會自動附加。此鍵代表一個包含所有範本的分類。

  對於每個分類鍵，可設定以下可選的環境變數：

  * `TEMPLATE_<KEY>_NAME`：範本分類的顯示名稱。
  * `TEMPLATE_<KEY>_DESCRIPTION`：分類的簡短說明。

  如果某個分類鍵包含連字號（`-`），請將其替換為底線（`_`）於環境變數名稱中。
* `ENABLE_CONVERSIONS`：必須設為 `true` 以啟用範本縮圖與預覽的生成。

### 發布權限

管理員可以發布範本。你也可以指定一位非管理員使用者，來管理顯示於本機圖庫中、位於 `/templates`.

若要這麼做，你需要設定環境變數 `OVERLEAF_TEMPLATES_USER_ID` 於 `toolkit/config/variables.env` 設為 `該使用者的 ID` ，也就是負責你執行個體中範本管理的使用者，例如：

```dotenv
OVERLEAF_TEMPLATES_USER_ID=56a8865231faeb5f07d69959
```

### 發布範本

對於你想上傳的每個範本：

1. 建立一個包含該範本原始碼的專案，並確認它可以編譯。
2. 在編輯器左側選單中，選擇 **Publish as Template**.
3. 在出現的表單中，輸入範本詳細資訊：
   * 該 *標題* 必須是唯一的。
   * 該 *說明* 欄位支援 Markdown 格式。
   * 該 *作者* 欄位可接受 Markdown 格式的連結。

提交後，可以編輯範本詳細資訊，或透過 Template Gallery 頁面刪除該範本。使用者可管理自己的範本；管理員可管理任何範本。

以下是一個範例：

{% code overflow="wrap" expandable="true" %}

```dotenv
#################
#   TEMPLATES   #
#################

ENABLE_CONVERSIONS=true

OVERLEAF_TEMPLATE_GALLERY=true
OVERLEAF_TEMPLATE_CATEGORIES=academic-journal book presentation poster cv homework bibliography calendar formal-letter report thesis newsletter

期刊文章
學術期刊投稿範本，包含主要出版社與預印本伺服器的格式。

參考書目
使用 BibTeX 或 BibLaTeX 建立與管理參考書目的樣式。適合用於學術論文、學位論文與報告。

書籍
撰寫書籍或長篇文件的範本，包含章節結構、前言與索引。

行事曆
建立年度、月度或每週行事曆的範本。適合個人規劃或活動排程。

履歷與簡歷
適用於學術、業界與創意職位的各式履歷與簡歷範本。

正式信件
專業信件範本，例如求職信、推薦信與正式往來信件。

作業
作業、課程作業與題目集的範本。設計上簡潔且結構良好，適合學生與教育工作者。

電子報
用於建立電子報的範本，提供學術、企業或社群溝通的格式。

海報
科學與學術海報的範本，通常用於研討會與研究簡報。

簡報
Beamer 及其他簡報格式的範本，專為學術演講與課程設計。

報告
技術、實驗室或專案報告的範本。包含圖表、表格與參考資料的章節。

論文
依循機構格式與引用指引，用於撰寫學位論文與博士論文的範本。

所有範本
瀏覽所有可用的 LaTeX 範本集合，依文件類型、風格與用途分類。

```

{% endcode %}

### 從 overleaf.com 轉移範本 <a href="#transferring-templates-from-overleaf.com" id="transferring-templates-from-overleaf.com"></a>

由於 Overleaf Pro 的架構是為離線運作而設計，目前沒有自動化方式可將 [overleaf.com](https://www.overleaf.com/) 的圖庫範本整合到你的地端安裝中；不過，仍可逐一範本手動完成。

預設情況下，Overleaf Pro 設定為在編譯時使用 TeX Live 的基本方案版本。此基本版本較為輕量，只包含極有限的一部分 LaTeX 套件，因此當你的使用者嘗試使用來自 [overleaf.com](https://www.overleaf.com/) 你本機地端執行個體中的範本時，很可能會出現缺少套件的錯誤。

不過，雖然沒有自動安裝缺少套件的方法，但 Server Pro 內有一項可設定的選項，能讓你的使用者以更安全的方式編譯專案，並存取更多套件。此功能稱為 [Sandbox Compiles](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/server-pro-only-configuration/sandboxed-compiles) （亦稱為 Sibling Containers）。

為確保下載的範本與你的地端 Server Pro 執行個體相容，我們強烈建議你啟用 [Sandbox Compiles](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/server-pro-only-configuration/sandboxed-compiles) ，因為此功能會讓你的使用者能存取與 [overleaf.com](https://www.overleaf.com/)相同的 TeX Live 環境。這些映像檔包含最常用的套件與字型，並已針對我們的圖庫範本進行測試。

你可以在文件的 [變更 TeX Live 映像檔](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/server-pro-only-configuration/sandboxed-compiles#changing-the-tex-live-image) 章節中，找到關於設定使用者可在其專案中選擇哪些 TeX Live 版本，以及為新專案設定預設 TeX Live 映像檔版本的其他資訊。

1. 前往 [範本圖庫](https://www.overleaf.com/latex/templates) 於 [overleaf.com](https://www.overleaf.com/) 並找到所需的範本，例如 [IEEE Photonics Journal 論文範本 - 範例投稿](https://www.overleaf.com/latex/examples/ieee-photonics-journal-paper-template-example-submission/bsfjjfkdsjds)
2. 點擊 **以範本開啟** 按鈕
3. 點擊專案選單，然後選擇 **下載原始碼**
4. 接著，登入地端 Server Pro 帳號
5. 點擊 **新專案** 按鈕，然後在專案儀表板中選擇 **上傳專案**
6. 點擊 **選擇 .zip 檔案** 按鈕，並選擇已下載的範本 zip 檔

之後，使用者就可以在自己的帳號中使用這個新上傳的範本；或者，若你是範本使用者，也可以將它發布給其他使用者使用。

### 問答

<details>

<summary>在發布對應的範本後，我可以刪除專案嗎？</summary>

**答案：** 可以，但我們不建議這麼做。當你發布範本時，我們會擷取專案快照，並將發布當下的專案儲存為 zip 檔。這可確保即使你刪除與該範本對應的專案，範本也不會受到影響。

不過，我們也會記錄與此範本相關聯的 ProjectID，這樣你未來就能輕鬆更新範本。

如果你刪除了對應的專案，你將不會在範本詳細資訊頁面上看到「Admin: Source Project」按鈕（見下圖）。

<figure><img src="/files/1c87d8bf9451b351435ba1a24d7252ac61fa3db9" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>為什麼有些專案在發布範本時會花那麼久？</summary>

**答案：** 當你發布範本時，我們會將專案儲存為 zip 與 pdf 檔，這通常很快。不過，我們也需要為 PDF 生成縮圖，才能在範本詳細資訊中顯示。

縮圖生成時間通常取決於 PDF 第一頁的內容。為了在顯示品質與轉換時間之間取得平衡，我們會選擇中間值作為寬度。

不過，如果 PDF 的第一頁包含大量文字，轉換縮圖可能需要 40 秒甚至更久，請耐心等候。以下是一個大型海報的範例，它會花更長時間。

<figure><img src="/files/de1f4acf0f62153c4384f9f9aa3962e9f4f92130" alt="" width="188"><figcaption><p>大型海報</p></figcaption></figure>

</details>


---

# 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/on-premises/zh-tw/she-ding/overleaf-toolkit/templates.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.
