OpenType-based math typesetting: An introduction to the STIX2 OpenType fonts
Introduction
In this article we take a brief look at the STIX2 fonts, the latest set of high quality OpenType text and math fonts produced by the Scientific and Technical Information Exchange (STIX) font project. To assist with using and understanding the STIX2 fonts Overleaf is pleased to provide the following resources:
- an Overleaf template containing the STIX2 fonts loaded and configured ready for use;
- a short video showing the wealth of glyphs contained in the STIX2Math.otf math font;
- a detailed glyph chart for STIX2Math.otf produced with, and for use with, LuaTeX (LuaLaTeX).
An Overview of STIX
Development of the STIX fonts is funded and managed through STI Pub, a consortium of publishers of mathematical, scientific, and technical books and journals:
- The American Mathematical Society
- The American Physical Society
- The American Institute of Physics
- The American Chemical Society
- The Institute of Electrical and Electronics Engineering, Inc
- Elsevier
Version 1.0 of the STIX fonts were released on 24 May 2010 followed by additional interim releases—the latest version can be downloaded from the GitHub repository. The current version of the STIX fonts, version 2, were released on 1 December 2016, delivering the latest set of fonts to arise from a project that spans over 2 decades. Included in the version 2 release are 5 OpenType fonts:
- STIX2Math.otf
- STIX2Text-Bold.otf
- STIX2Text-BoldItalic.otf
- STIX2Text-Italic.otf
- STIX2Text-Regular.otf
The accompanying release notes observe:
“Version 2.0.0 of the STIX fonts, now known as "STIX Two", is a thorough revision undertaken by the renowned type house Tiro Typeworks. The STIX Two fonts consist of four text fonts (Regular, Italic, Bold, and Bold Italic) and one Math font. Together, they provide a uniform set of fonts that can be used throughout the production process, whether that be a traditional print-only process, an entirely electronic one, or a combination of the two.”
Where can I get the STIX2 fonts?
The latest version of the STIX fonts can be downloaded from GitHub.
STIX2/OpenType: for use with XeTeX and LuaTeX only
The STIX2 fonts are designed for use with modern TeX engines— LuaTeX and XeTeX—because those engines are capable of using OpenType fonts and both support OpenType-based mathematical typesetting. You can use the STIX2 fonts with Plain TeX (using LuaTeX or XeTeX) but you’ll need to undertake a lot of configuration (setting math codes etc) to enable them with Plain TeX. This excellent example on tex.stackexchange shows the sort of configuration you’ll need to undertake—for thousands of characters. Fortunately for LaTeX users the unicode-math package has done all this hard work for you.
To have both your text and mathematics typeset with the STIX2 fonts you just need to use the fontspec package package (to configure the STIX2 text fonts) and the unicode-math package to configure and enable the STIX2 math font.
Laying the foundations: Unicode math encoding
A key prerequisite to production of the STIX fonts was creating a comprehensive/definitive list of the symbols in use by those needing to write and publish mathematics—which symbols (glyphs) should be contained in the font(s)? Through literature searches, liaison with publishers, consultations with authoring communities and examination of existing technical standards, such a list was constructed and applications were made to the Unicode Technical Committee to have that set of symbols formally approved for inclusion into the Unicode standard. For the purposes of Unicode, mathematics has specific challenges because of the subtleties presented by glyphs with slightly different visual appearances actually having quite different semantics, thus needing to be encoded separately.
Some interesting background on obtaining formal Unicode approval can be found in the paper Unicode and math, a combination whose time has come — Finally! written by Barbara Beeton (of the AMS) whose work has been instrumental in the success of the STIX project. Readers looking for further background information may also like to read the Unicode® Technical Report #25: UNICODE SUPPORT FOR MATHEMATICS.
Another milestone: OpenType-based math typesetting pioneered by Microsoft
Obtaining Unicode approval to encode a large number of mathematical characters (symbols) was a crucial first step in producing the STIX fonts. Another vital ingredient was an extension to the OpenType font specification which enabled OpenType fonts to contain additional data required by mathematical typesetting engines. This was pioneered by Microsoft through the specification of the MATH table in OpenType fonts and made its debut with Microsoft Word 2007 which contained a new and very powerful typesetting engine together with the first OpenType math font: Cambria Math. Additional background can be found in the article High-Quality Editing and Display of Mathematical Text in Office 2007 (by Professor Murray Sargent).
TeX-based mathematical typesetting involves a complex interplay between the algorithms built into TeX-based typesetting engines and the fonts used for math typesetting. Fonts designed for mathematics need to contain a number of parameters which are used in the sizing/positioning calculations deep inside TeX-based typesetting engines. The MATH table parameters defined by the OpenType specification are detailed here.
TeX engines follow suit
It was a natural progression for TeX engines to support OpenType math typesetting and, as noted in the presentation The state of OpenType math typesetting (by Ulrik Vieth, 2011) XeTeX introduced support for OpenType math in version 0.97 (2007) and LuaTeX added it in in version 0.4 (2009). The LuaTeX and XeTeX implementations usually produce compatible results but there is the possibility for some slight variation/differences in behaviour between the two engines.
Readers wishing to explore the parameters requited by legacy TeX fonts or the newer OpenType fonts can refer to an appendix contained in the unicode-math
package documentation which lists all the legacy (traditional) TeX math font parameters together with the new (OpenType) parameters used by XeTeX. Chapter 6 of LuaTeX’s Reference Manual similarly lists the parameters used by LuaTeX’s math typesetting engine.
An Overleaf template with the STIX2 fonts
At the time of writing (2017) the STIX2 fonts were not included in the latest TeX Live distribution. To help you use the STIX2 fonts on Overleaf we have prepared a “getting started” template which contains the STIX2 fonts loaded and configured for use via fontspec
and unicode-math
. Of course, feel free to reconfigure the fontspec
and unicode-math
packages with options that better suit your particular requirements.
The template is available on the Overleaf gallery.
Browsing the STIX2 math font: A video and a glyph table
The STIX2 math font (STIX2Math.otf) contains a wealth of symbols—over 5,200 glyphs as you can see in this short video (no sound) which shows the font opened inside FontLab Studio:
If you are interested to further explore the STIX2 math font (STIX2Math.otf) we have used LuaTeX to prepare a detailed glyph chart (PDF ~560kb)—the tabulated data is designed for use with LuaTeX.
Further reading
Readers interested to learn more about TeX’s math typesetting may like to read some of these excellent papers and articles:
- Math typesetting in TeX: The good, the bad, the ugly (by Ulrik Vieth)
- Appendix G illuminated (by Bogusław Jackowski)
- OpenType Math Illuminated (by Ulrik Vieth)
- Understanding the æsthetics of math typesetting (by Ulrik Vieth)
- Math in LuaTEX 0.40 (by Taco Hoekwater)
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class