> 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/latex/zh-cn/shen-du-wen-zhang/34-opentype-based-math-typesetting-an-introduction-to-the-stix2-opentype-fonts.md).

# 基于 OpenType 的数学排版：STIX2 OpenType 字体简介

## 引言

在本文中，我们将简要介绍 STIX2 字体，这是由 [科学与技术信息交换（STIX）字体项目](http://www.stixfonts.org)推出的最新一套高质量 OpenType 文本和数学字体。为了帮助使用和理解 STIX2 字体，Overleaf 很高兴提供以下资源：

* 一个 [Overleaf 模板](#an-overleaf-template-with-the-stix2-fonts) ，其中已加载并配置好 STIX2 字体，随时可用；
* a [短视频](#browsing-the-stix2-math-font-a-video-and-a-glyph-table) ，展示了 STIX2Math.otf 数学字体中包含的丰富字形；
* a [详细字形表](#browsing-the-stix2-math-font-a-video-and-a-glyph-table) ，用于 STIX2Math.otf，由 LuaTeX（LuaLaTeX）生成并供其使用。

## STIX 概览

STIX 字体的开发由以下机构资助和管理： [STI Pub](http://www.stixfonts.org/stipubs.html)，一个由数学、科学和技术类书籍与期刊出版商组成的联盟：

* [美国数学学会](http://www.ams.org)
* [美国物理学会](http://www.aps.org)
* [美国物理联合会](http://www.aip.org)
* [美国化学学会](http://www.chemistry.org)
* [电气与电子工程师协会（IEEE）](http://www.ieee.org)
* [Elsevier](http://www.elsevier.com)

STIX 字体的 1.0 版本于 2010 年 5 月 24 日发布，随后又有若干中间版本——最新版本可从 [GitHub 仓库](https://github.com/stipub/stixfonts)下载。当前的 STIX 字体版本 2 于 2016 年 12 月 1 日发布，为这一跨越了二十多年的项目带来了最新一套字体。 [跨越了 20 多年](http://www.stixfonts.org/proj_timeline.html)。版本 2 中包含 5 款 OpenType 字体：

* STIX2Math.otf
* STIX2Text-Bold.otf
* STIX2Text-BoldItalic.otf
* STIX2Text-Italic.otf
* STIX2Text-Regular.otf

随附的发布说明指出：

> “STIX 字体的 2.0.0 版本，现在称为“STIX Two”，是由著名字型公司 [Tiro Typeworks](http://www.tiro.com/)进行的一次彻底修订。STIX Two 字体由四款文本字体（Regular、Italic、Bold 和 Bold Italic）以及一款数学字体组成。它们共同提供了一套统一的字体，可在整个制作流程中使用，无论是传统的纯印刷流程、完全电子化的流程，还是两者的结合。”

### 我可以在哪里获取 STIX2 字体？

最新版本的 STIX 字体可以 [从 GitHub 下载](https://github.com/stipub/stixfonts).

## STIX2/OpenType：仅供 XeTeX 和 LuaTeX 使用

STIX2 字体是为现代 TeX 引擎——LuaTeX 和 XeTeX——设计的，因为这些引擎能够使用 OpenType 字体，并且都支持基于 OpenType 的数学排版。你可以在 Plain TeX 中使用 STIX2 字体（通过 LuaTeX 或 XeTeX），但你需要进行大量配置（例如设置数学码等）才能在 Plain TeX 中启用它们。这个很棒的 [tex.stackexchange 上的示例](https://tex.stackexchange.com/questions/178753/changing-math-fonts-with-luaotfload-in-plain-tex) 展示了你需要进行的那类配置——针对数千个字符。对 LaTeX 用户来说幸运的是， [unicode-math 宏包](https://ctan.org/pkg/unicode-math?lang=en) 已经为你完成了所有这些艰难工作。

要让文本和数学都使用 STIX2 字体排版，你只需要使用 [fontspec 宏包](https://ctan.org/pkg/fontspec?lang=en) 宏包（用于配置 STIX2 文本字体）以及 [unicode-math 宏包](https://ctan.org/pkg/unicode-math?lang=en) 用于配置并启用 STIX2 数学字体。

## 打下基础：Unicode 数学编码

STIX 字体制作的一个关键前提，是创建一份全面且权威的符号清单，涵盖那些需要撰写和出版数学内容的人所使用的符号——字体中应包含哪些符号（字形）？通过文献检索、与出版商联络、咨询作者群体以及考察现有技术标准，形成了这样一份清单，并向 Unicode 技术委员会提出申请，希望将这些符号集正式批准纳入 Unicode 标准。就 Unicode 而言，数学面临特定挑战，因为一些视觉上略有不同的字形在语义上实际上差别很大，因此需要分别编码。

关于获得正式 Unicode 批准的一些有趣背景，可参见论文 [Unicode 与数学：时代终于到来——终于！](https://www.tug.org/TUGboat/tb21-3/tb68beet.pdf) ，作者是 Barbara Beeton（AMS），她的工作对 STIX 项目的成功起到了关键作用。想进一步了解背景信息的读者还可以阅读 [Unicode® 技术报告 #25：数学的 Unicode 支持](http://www.unicode.org/reports/tr25/).

## 又一个里程碑：微软开创的基于 OpenType 的数学排版

获得 Unicode 批准以编码大量数学字符（符号）是制作 STIX 字体的关键第一步。另一个至关重要的因素，是对 OpenType 字体规范的扩展，使 OpenType 字体能够包含数学排版引擎所需的附加数据。这一扩展由微软通过 [OpenType 字体中 MATH 表的规范](https://www.microsoft.com/typography/otspec/math.htm) 率先实现，并在 Microsoft Word 2007 中首次亮相；该版本包含一个新的、非常强大的排版引擎，以及首个 OpenType 数学字体：Cambria Math。更多背景信息可参见文章 [Office 2007 中高质量数学文本的编辑与显示](https://blogs.msdn.microsoft.com/murrays/2006/09/13/high-quality-editing-and-display-of-mathematical-text-in-office-2007/) （作者 Murray Sargent 教授）。

基于 TeX 的数学排版涉及 TeX 排版引擎内置算法与用于数学排版的字体之间的复杂交互。为数学设计的字体需要包含若干参数，这些参数用于 TeX 排版引擎内部深处的大小/位置计算。OpenType 规范定义的 MATH 表参数详见 [此处](https://www.microsoft.com/typography/otspec/math.htm).

## TeX 引擎也随之跟进

TeX 引擎支持基于 OpenType 的数学排版是一个自然而然的进展，正如演示文稿 [OpenType 数学排版现状](http://www.gust.org.pl/bachotex/2011-en/presentations/Vieth_1_2011) （Ulrik Vieth，2011）所指出的那样，XeTeX 在 0.97 版（2007）中引入了对 OpenType 数学的支持，而 LuaTeX 在 0.4 版（2009）中加入了该支持。LuaTeX 和 XeTeX 的实现通常会产生兼容的结果，但两种引擎之间的行为可能会有一些细微差异。

希望了解传统 TeX 字体或较新的 OpenType 字体所需参数的读者，可以参考 `unicode-math` 宏包 [文档](http://mirrors.ctan.org/macros/latex/contrib/unicode-math/unicode-math-code.pdf) 中包含的附录，其中列出了所有传统（旧式）TeX 数学字体参数，以及 XeTeX 使用的新（OpenType）参数。 [LuaTeX 参考手册](http://www.luatex.org/svn/trunk/manual/luatex.pdf) 第 6 章也列出了 LuaTeX 数学排版引擎使用的参数。

## 一个带有 STIX2 字体的 Overleaf 模板

在撰写本文时（2017 年），最新的 TeX Live 发行版中还未包含 STIX2 字体。为了帮助你在 Overleaf 上使用 STIX2 字体，我们准备了一个“入门”模板，其中已通过 `fontspec` 和 `unicode-math`加载并配置好 STIX2 字体以供使用。当然，你也可以根据自己的具体需求重新配置这些 `fontspec` 和 `unicode-math` 宏包及其选项。

该模板可在 [Overleaf 图库](https://www.overleaf.com/latex/templates/using-the-stix2-opentype-fonts-with-lualatex-or-xelatex/hdfvhzqmhnpx).

## 浏览 STIX2 数学字体：视频与字形表

STIX2 数学字体（STIX2Math.otf）包含极其丰富的符号——超过 5,200 个字形，正如你在这段简短视频（无声音）中看到的那样，视频展示了该字体在 FontLab Studio 中打开的样子：

{% embed url="<https://www.youtube.com/embed/FmxYH7lwNO0>" %}

如果你有兴趣进一步探索 STIX2 数学字体（STIX2Math.otf），我们已使用 LuaTeX 制作了一份 [详细字形表](https://www.filepicker.io/api/file/Gkmlty9USh2B52EFReAw) （PDF \~560kb）——表格化数据的设计是供 LuaTeX 使用的。

[![{{{alt}}}](/files/9b04753e6d055a3775f7d0b0529b8903fb51bb2d)](https://www.filepicker.io/api/file/Gkmlty9USh2B52EFReAw)

## 进一步阅读

有兴趣进一步了解 TeX 数学排版的读者，或许会想阅读以下一些优秀论文和文章：

* [TeX 中的数学排版：优、劣、丑](https://www.ntg.nl/maps/26/27.pdf) （Ulrik Vieth）
* [附录 G 解读](https://www.tug.org/TUGboat/tb27-1/tb86jackowski.pdf) （Bogusław Jackowski）
* [OpenType 数学解析](https://www.tug.org/~vieth/papers/bachotex2009/ot-math-paper.pdf) （Ulrik Vieth）
* [理解数学排版的美学](http://www.gust.org.pl/projects/e-foundry/math/math-support/vieth2008.pdf) （Ulrik Vieth）
* [LuaTEX 0.40 中的数学](https://www.ntg.nl/maps/38/04.pdf) （Taco Hoekwater）


---

# 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/latex/zh-cn/shen-du-wen-zhang/34-opentype-based-math-typesetting-an-introduction-to-the-stix2-opentype-fonts.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.
