> 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-cn/wei-hu/extending-tex-live.md).

# 扩展 TeX Live

可以通过使用新的 Dockerfile 扩展现有的 TeX Live 镜像，并将应用配置为使用新镜像。

这里我们提供一些安装新包或字体的指南，但自定义镜像的配置不在我们的支持范围之内。

TeX Live 镜像更新不频繁。我们建议在升级 Server Pro 时重建自定义镜像。

{% hint style="danger" %}
以下章节适用于 Server Pro 和 [沙盒编译](broken://pages/bfa40b29ead2d38a55ee632ceef263be394836f9) 。
{% endhint %}

### 安装和更新新包

你可以使用 `tlmgr` 之类的命令，例如 `tlmgr install` 和 `tlmgr update` 来管理 Tex Live 包，如下例所示：

```dockerfile
FROM ghcr.io/ayaka-notes/texlive-full:2023.1

RUN tlmgr update --force ebproof
```

### 使用 `tlmgr` 在较旧的 TeX Live 镜像中

默认情况下 `tlmgr` 会从最新的 TeX Live 版本下载资源。在修补较旧的 TeX Live 镜像时，需要将下载切换到相应的归档。请参阅 <https://www.tug.org/historic/> 中的镜像归档列表。

```dockerfile
FROM ghcr.io/ayaka-notes/texlive-full:2022.1

RUN tlmgr option repository <MIRROR>/systems/texlive/<YEAR>/tlnet-final
# 例如：RUN tlmgr option repository ftp://tug.org/historic/systems/texlive/2022/tlnet-final

RUN tlmgr update --force ebproof
```

### 安装新字体

在 Tex Live 发行版中安装新字体有不同的方法，安装自定义字体可能需要多个步骤。查看 [安装 TeX 字体的说明](https://tug.org/fonts/fontinstall.html) 在官方 Tex Live 文档中可能是一个不错的起点。

下面的 `Dockerfile` 展示了如何在现有的 Tex Live 2022 镜像上安装 TrueType 字体的示例：

```dockerfile
FROM ghcr.io/ayaka-notes/texlive-full:2022.1

COPY ./myfonts/*.ttf /usr/share/fonts/truetype/myfont/

# 重建字体信息缓存
RUN fc-cache
```

### 配置 Server Pro 使用新镜像

使用名称 `ghcr.io/ayaka-notes/texlive-full` 以及自定义标签来构建新镜像，如下所示：

```bash
docker build -t ghcr.io/ayaka-notes/texlive-full:2023.1-custom
```

现在我们可以将 Server Pro 配置为使用新的 `2023.1-custom` 镜像，更新 `TEX_LIVE_DOCKER_IMAGE` 和 `ALL_TEX_LIVE_DOCKER_IMAGES` 环境变量：

{% code overflow="wrap" %}

```
TEX_LIVE_DOCKER_IMAGE: "ghcr.io/ayaka-notes/texlive-full:2023.1-custom"
ALL_TEX_LIVE_DOCKER_IMAGES: "ghcr.io/ayaka-notes/texlive-full:2023.1,ghcr.io/ayaka-notes/texlive-full:2023.1-custom"
```

{% endcode %}

在上面的示例中，新项目默认设置为使用新的 `2023.1-custom` 镜像，而 `2023.1` 在需要时仍然可用。


---

# 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-cn/wei-hu/extending-tex-live.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.
