> ## 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 – 最新）
* 🧑‍🔬 支持 Knitr，可在 LaTeX 文档中使用 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 会尝试**重建整个字体缓存**，这是一个非常耗时的过程。

  在我们的镜像中，我们已预先构建好字体缓存，并通过[这个提交](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`，因此无法使用 `https` 下载，除非你修改 `peal` 脚本。
* 2015 年之前仅提供 sha256 文件，因此无法使用 sha512 进行校验。


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