> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker 中的 TeX Live

### Docker

Docker 提供一種輕量且可攜的方式，將應用程式封裝並在隔離的容器中執行。透過將應用程式與所有必要的相依項目打包在一起，容器能確保在不同機器上（從筆記型電腦到正式環境伺服器）都有一致的行為。

TeX Live 功能強大，但體積龐大，且容易受到系統層級差異的影響。將 TeX Live 封裝在 Docker 映像檔中，能讓 LaTeX 工具鏈變得可預期、可重現，且易於散布。

然而，某些 TeX Live 套件需要依賴 shell 存取。基於安全考量，容器應在受限的環境中執行，以防止使用者執行任意 shell 指令（例如透過 `\write18` 或 shell escape）。這種隔離能保護主機系統，並避免對容器底層檔案系統或 `bash` 等工具的非預期存取。

### TeXLive 完整版

[TeXLive-Full@ayaka-notes](https://github.com/ayaka-notes/texlive-full/) 是一個功能完整的 **TeXLive Docker 映像檔**，專為 [Ayakaleaf Pro](https://github.com/ayaka-notes/ayakaleaf-pro)、[Overleaf CEP](https://github.com/yu-i-i/overleaf-cep) 中的沙箱 LaTeX 編譯，或獨立的 LaTeX 編譯環境所設計。

此映像檔旨在提供近乎完整的 TeXLive 發行版，並預先安裝常用字型與工具，以盡量減少因缺少套件或字型而導致的編譯失敗。注意：此 Docker 映像檔**不包含**任何 sharelatex/overleaf 元件，它是供 Overleaf/Overleaf Pro 編譯使用的。

#### 特色：

* 🚀 同時支援 x86\_64 與 arm64 伺服器架構
* 📦 完整且經過最佳化的 TeXLive 安裝
* 🧩 預先安裝常用字型與工具程式
* 🐳 可直接搭配 Docker 與 Docker Compose 使用
* 🧪 已通過 Overleaf Server Pro / Overleaf Pro 測試
* 🔄 定期隨最新的 TeXLive 版本更新
* 🏷 提供多個 TeXLive 版本標籤（2020 – 最新版）
* 🧑‍🔬 支援在 LaTeX 文件中使用 Knitr 執行 R 程式碼

### Ayakaleaf Pro 使用方式

由 Ayaka-notes 提供的 TeX Live Full 是專為 [ayakaleaf-pro](https://github.com/ayaka-notes/ayakaleaf-pro) 設計的。如果你是 [Toolkit 使用者](https://github.com/overleaf/toolkit)，可以在 `config/variables.env` 檔案中加入以下環境變數。

例如：

```dotenv title="config/variables.env" wrap theme={null}
ALL_TEX_LIVE_DOCKER_IMAGES=ghcr.io/ayaka-notes/texlive-full:2026.1, ghcr.io/ayaka-notes/texlive-full:2025.1
ALL_TEX_LIVE_DOCKER_IMAGE_NAMES=Texlive 2026, Texlive 2025
TEX_LIVE_DOCKER_IMAGE=ghcr.io/ayaka-notes/texlive-full:2026.1
```

### TeX Live 版本

多虧了 GitHub Action，我們能平行建置所有 TeX 映像檔，包括：

* `ghcr.io/ayaka-notes/texlive-full:2026.1`（同時也是 `latest` 標籤）
* `ghcr.io/ayaka-notes/texlive-full:2025.1`
* `ghcr.io/ayaka-notes/texlive-full:2024.1`
* `ghcr.io/ayaka-notes/texlive-full:2023.1`
* `ghcr.io/ayaka-notes/texlive-full:2022.1`
* `ghcr.io/ayaka-notes/texlive-full:2021.1`
* `ghcr.io/ayaka-notes/texlive-full:2020.1`
* `ghcr.io/ayaka-notes/texlive-full:base`

我們使用來自 [texlive info](https://texlive.info/tlnet-archive/) 的鏡像封存庫，其中幾乎包含了從 1996 年到 2025 年的所有 TeX Live 版本。此外，多虧了 Overleaf 的 Dockerfile，我們能更快地建置此專案。

> 為什麼不支援 TeX Live 2019 及更早的版本？
>
> 維護這些舊映像檔極為困難。此外，[texlive.info](https://texlive.info/) 網站並未提供 2019 年以前發布之 TeX Live 版本的資訊，因此我們無法為這些版本建置映像檔。如果你需要特定的舊版本，請提出 issue 告訴我們。

### 包含的元件

Docker 映像檔中包含以下套件。

* 所有 TeXLive 套件（該年度）
* R 套件（僅限部分）
* fontconfig inkscape pandoc python3-pygments wget python3
* gnupg gnuplot perl-modules perl ca-certificates
* ghostscript qpdf r-base-core tar

Docker 映像檔中包含以下字型。

* [Google Fonts](https://fonts.google.com/)
* [Microsoft msttcorefonts](https://packages.ubuntu.com/jammy/ttf-mscorefonts-installer)
* [Overleaf 支援的字型](https://www.overleaf.com/learn/latex/Questions/Which_OTF_or_TTF_fonts_are_supported_via_fontspec%3F)

<Warning>
  請確認相關字型是否可用於商業用途。對於因你不當使用字型而產生的任何法律問題，我們**概不負責**。一旦你下載映像檔，即視為自動同意此條款。
</Warning>

### 授權條款

MIT

### 常見問題

<Accordion title="問題 01：字型快取未命中問題">
  Overleaf 編譯 LaTeX 專案時，若發生字型缺失，**你可能會發現編譯過程耗時很長**，這是因為當字型缺失時，TeX Live 會嘗試**重建整個字型快取**，而這是一個相當耗時的過程。

  在我們的映像檔中，已預先建置好字型快取，並透過[這個 commit](https://github.com/ayaka-notes/texlive-full/commit/0cb66b0dc8b82be628cf6999cfd659d9784e132f) 修正了此問題。
</Accordion>

<Accordion title="問題 02：SyncTeX 極為緩慢">
  當你在 sharelatex 中使用此映像檔時，可能會發現 SyncTeX 極為緩慢。

  請參閱：[https://github.com/overleaf/overleaf/issues/1150](https://github.com/overleaf/overleaf/issues/1150)，只要停用 HTTP 2.0 即可。
</Accordion>

<Accordion title="問題 03：使用官方 TeX Live 映像檔時的重新編譯錯誤">
  如果你使用 Docker Hub 上的 TeX Live 官方映像檔 `texlive/texlive`，可能會發現重新編譯專案時會回報錯誤。不過，我們的映像檔已修正此問題，因為我們使用最新的 Ubuntu 基礎映像檔，並從 Ubuntu 官方套件庫安裝所有相依項目。
</Accordion>

### 其他技術提醒

建置 TeX Live 映像檔（2019 年以前的版本）時，你可能需要留意以下問題：

* TeX Live 2017 以前僅支援 `http`/`ftp`，因此除非修改 `peal` 腳本，否則無法使用 `https` 下載。
* 2015 年以前僅提供 sha256 檔案，因此無法使用 sha512 進行檢查。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.