> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/latex/zh-tw/shen-ru-wen-zhang/34-opentype-based-math-typesetting-an-introduction-to-the-stix2-opentype-fonts.md).

# 基於 OpenType 的數學排版：STIX2 OpenType 字型簡介

## 簡介

在本文中，我們將簡要介紹 STIX2 字型，這是由 [科學與技術資訊交換（STIX）字型專案](http://www.stixfonts.org)。為了協助使用與理解 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)
* [電機與電子工程師學會公司](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 年的專案所產生的最新一套字型。 [綿延超過 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），但你需要進行大量設定（例如設定 math codes 等）才能在 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 SUPPORT FOR MATHEMATICS](http://www.unicode.org/reports/tr25/).

## 另一個里程碑：由 Microsoft 開創的基於 OpenType 的數學排版

取得 Unicode 核准以編碼大量數學字元（符號）是製作 STIX 字型的關鍵第一步。另一項重要要素是 OpenType 字型規格的擴充，使 OpenType 字型能包含數學排版引擎所需的額外資料。這項工作由 Microsoft 透過 [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 年），STIX2 字型尚未包含在最新的 TeX Live 發行版中。為了幫助你在 Overleaf 上使用 STIX2 字型，我們準備了一個「入門」範本，其中已載入並設定好 STIX2 字型，可透過 `fontspec` 和 `unicode-math`。 `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/9cd7443d270d373154da87c471bfb9ff36395497)](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://overleaf-pro.ayaka.space/latex/zh-tw/shen-ru-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.
