Accessible Mathematics

Introduction

What is Accessible Mathematics?

Accessibility and Accessible Design are a wide net of principles and practices to build inclusive environments and make content readily available to all people. Accessible design benefits everyone, and it is inspired by people who use Assistive Technology (AT).

Accessible Mathematics is the application of this to mathematics.

Problem Statement

Braille, Screen Readers, Human Narration, and Tactile Sign language are four approaches to convey written text to visually impaired readers. Conveying mathematics is more subtle, however, because mathematical statements have more grammatical rules. For example, consider the statement "the square root of X plus Y". This may be interpreted as either:

  1. $\sqrt{x+y}$, meaning "the square root of the quantity (X + Y)"
  2. or

  3. $\sqrt{x} + y$, meaning "(the square root of X) + Y"

In this case, software translations of the two mathematical expressions will correctly convey the intended meaning. On the other hand, sometimes the same mathematical notation has entirely different meanings based on the context. For example, the notation $| \phantom{x} |$ can denote:

  1. The absolute value of a number: $|x|$
  2. The norm of a vector: $|\mathbf{x}|$
  3. The order of an element: $|x|$
  4. The cardinality of a set: $|X|$
  5. The determinant of a matrix: $|X|$
In situations like this, software tools need a more robust, context based semantic breakdown of mathematical expressions to properly translate them for users of assistive technology. Authoring such statements encourages extra clarity, which ultimately benefits everyone.

HyperText Markup Language (HTML) is the worldwide, cross-platform, device-independent semantic based authoring standard. MathML is the extension of HTML for authoring mathematics. MathML is much more verbose than HTML and generally not coded by hand, making it tenuous for authoring research, textbooks, and other long-format mathematics.

LaTeX is the worldwide standard markup language for authoring mathematics due to its concise, contextual syntax and huge library of extensions. But the LaTeX typesetting engine is designed for print, which strips away the contextual information needed for screen readers.

Portable Document Format (PDF) is the universal open document standard for print adopted by the International Organization for Standardization (ISO). Tagged PDF is a version of PDF that incorporates a semantic structure similar to HTML, offering an ideal solution for accessible mathematics if math markup could be ported into the underlying semantics. This has not yet been standardized.

Currently, a workflow for generating accessible mathematics content involves a hybrid approach between LaTeX and MathML. This process is described in stages throughout the rest of this document.

Sample Workflow

Here is a high level sample workflow:

  1. Write mathematics in a markup language.
  2. Include the math markup in an HTML document.
  3. Format the HTML to be structurally accessible.
  4. Test your document with a screen reader.
  5. Customize your math speech settings.
  6. Test your document with a refreshable braille display.
  7. Test your document on various mobile devices.
  8. Share your document with users.
  9. Update the HTML to address any accessibility issues from user feedback.

Here is an one sample workflow with specific software:

  1. Write your mathematics in a Markdown document using LaTeX delimiters and syntax.
  2. Convert the Markdown document to HTML with Pandoc, using the MathJax option to convert the LaTeX to MathML.
  3. Test your document with VoiceOver (Mac), NVDA (Windows), and TalkBack (Android) in Firefox, Chrome, and Safari.
  4. Customize the math Speech Rule Engine in the MathJax script settings in your HTML document.
  5. Test your document with a refreshable braille display.
  6. Share the document on your web site.
  7. Test your HTML to ensure responsiveness and readability on a mobile device.
  8. Test screen readability on a mobile device with VoiceOver (iOS) or Talkback (Android).
  9. Update the HTML to address any accessibility issues from user feedback.

While this is considerably more work than typesetting mathematics for print, the process will produce a working template that can be reused and improved, just like a workflow for print.

Math Markup Languages

The majority of mathematics today is written in a markup language. The most widely used math markup languages are:

  1. LaTeX
  2. MathML
  3. AsciiMath

Plain text can be used for mathematics, with limited functionality. This is discussed at the end of this section.

The syntax of each markup language serves a dual purpose: to reference mathematical symbols and to determine the placement of the symbols. LaTeX was originally designed for print or presentation on a fixed canvas size. MathML and AsciiMath were originally designed for the web to accommodate a flexible canvas. An accessible math workflow today may use a blend of both.

LaTeX

The LaTeX typesetting system is the most popular method for typesetting mathematics. LaTeX was created as an outgrowth of TeX, a markup language and layout engine created in 1978 to standardize typesetting mathematics and scientific formulas for print. For those familiar with HTML, LaTeX can loosely be thought of as as “HTML for paper”. It uses a context based syntax to signify chapters, sections, figures, lists, equations, self-referenced labeling, graphics, code snippets, and much more. The goal is for authors to focus on their content and let the LaTeX typesetting engine handle the presentation. LaTeX is extensible, open-source, regularly updated, and has a huge library of extended tools to serve literary, scientific, and artistic needs.

LaTeX markup can be written in any text editor, but the LaTeX typesetting engine is required to render the mathematical output. This is discussed in the next section on Typesetting Software.

MathML

MathML was created in 1998 as an extension of HTML specifically to render mathematics on the web. This provides all the benefits of reflowable text on any device, and a direct interface to mathematical expressions for search engines, learning management systems, assitive technology such as screen readers, and other web-based applications. There are two versions of MathML: Presentation MathML, which encodes information on how to display an equation, and Content MathML, which incorporates semantic information about the underlying mathematical expression itself. Please see this MathML demonstration of the quadratic formula to compare the difference. Presentation MathML is primarily what is used today.

MathML can also be written in any text editor, but is generally coded with GUI editors or conversion tools from LaTeX or other XML formats.

AsciiMath

AsciiMath is a math markup language for a small set of the most commonly used mathematical symbols. The syntax for a symbol is meant to mimic the symbol it represents, similar in spirit to emotive ASCII expressions that predate modern emoticons. It shares some similarity with basic LaTeX markup.

Plain Text

The Unicode Character Set contains a large collection of mathematical symbols that can be typed in plain text, without any special markup. This is only practical for very basic mathematical expressions, as it does not provide any additional formatting structure for fractions, matrices, and other special mathematical needs. Further, while the Unicode Character Set is updated periodically, it cannot immediately be amended to work with custom symbols. Still, it is worth mentioning because Unicode symbols will provide uniform semantic information to assistive technology across all platforms. This is the gold standard for accessibility.

Typesetting Software

Any math markup can be written in any plain text editor, but a typesetting engine is needed to interpret the markup and render the resulting mathematics. Thus, most authors use an integrated development environment (IDE), a software suite that provides all the necessary functionality in one package. A few popular software tools are listed here, but there are many more available with their own unique features.

LaTeX

The LaTeX typesetting system includes:

  • The core typesetting engine
  • A collection of add-on libraries
  • A self-updating utility
  • An editor

Versions vary by operating system:

  • MacTeX -- MacOS
  • MikTeX -- Windows and MacOS
  • Linux -- varies by distribution

Popular IDEs are:

  1. Overleaf -- online (no installation required)
  2. TeXShop -- Mac (comes included with MacTeX)
  3. TeXworks -- Windows, MacOS, Linux
  4. TeXstudio -- Windows, MacOS, Linux
  5. LyX -- Windows, MacOS, Linux, ChromeOS, OS/2, Haiku

The Code-Cogs Online LaTeX Editor is a helpful browser based reference tool for popular LaTeX symbols.

More information is available at The LaTeX Project website.

Chikrii Software offers the Tex2Word and Word2Tex converters for Microsoft Word to read and save documents in tex format. LaTeX formulas are rendered as MathML objects in Word, and vice versa.

MathML

MathML can be coded in any editor just like HTML. Most authors prefer to use a GUI editor rather than code MathML directly. To see why, please see the Code Examples section for a comparison of MathML and LaTeX.

Popular MathML GUI editors:

  1. Wiris MathType -- standalone, or as a plug-in to commercial word processing software such as Microsoft Word
  2. Wiris MathFlow -- as a part of various professional XML systems
  3. Scand MathML-Kit -- as a plug-in for Adobe Creative Suite
  4. Mathcha -- online or downloadable Notebook editor (Mac/Windows/Linux)
  5. MathML Central -- online converter by Wolfram Research

GUI editors offer interactive menus and an instant preview of the output without the need to learn the underlying markup language.

Some limitations of this method:

  • GUI editors are not always accessible friendly.
  • GUI editors are not efficient for long-form mathematics.
  • MathML is not natively supported in all browsers (most notably, Chrome).

To remedy this last point, there are Javascript tools that will render MathML in any modern browser. This is discussed in the Web Display Engines section.

AsciiMath

AsciiMath can be written with a text editor or any HTML authoring software. It is rendered in a web browsers with the MathJax display engine. Instructions are provided on the AsciiMath home page.

GNU TeXmacs

GNU TeXmacs is a typesetting system that uses its own internal markup for rendering mathematics and scientific expressions. It was created as an alternative to LaTeX, incorporating realtime rendering and a more standardized internal data structure that can export to several different output formats. It is free and extensible, and can also operate as a front end for a number of other powerful mathematical software packages.

Unfortunately, there is no mention of accessibility support in the TeXmacs documentation. Further testing is needed to determine how its conversions to HTML and MathML react with screen readers.

Web Display Engines

LaTeX is widely adopted and efficient to code, but does not yet provide a navigable document structure to assistive technology. MathML provides this structure, but it is much longer to code and not supported in some browsers. To bridge this gap, there are JavaScript tools that convert LaTeX markup to MathML and display the MathML in a browser:

  1. MathJax
  2. KaTeX
  3. MathLive
  4. MathQuill
  5. Latex.css

These tools aim to provide a "best of both worlds" approach, where assistive technology can navigate MathML just as easily as HTML, while the underlying LaTeX markup can be translated to screen reader and Braille output. Each varies in its scope, method of application, and accessibility support.

MathJax

MathJax is the most popular method to render mathematics on the web. The MathJax engine searches an HTML document for mathematics markup embedded between LaTeX-style math mode delimiters (which are customizable), and renders it as math content on a web page. Users can customize the display formats (MathML fonts or SVG graphic), extract the math markup in both the LaTeX and MathML formats, and customize its math Speech Rule Engine (SRE). It integrates well with major content and learning management systems, and its excellent accessibility support makes it a key component of porting long-form mathematics into accessible friendly formats.

KaTeX

KaTeX is an engine that purports to render much faster than MathJax. This can provide a significant load time speedup for longer documents with a dense amount of LaTeX markup. Unfortunately, at this time, KaTeX has zero accessibility support, as assistive technology cannot read the MathML rendered by KaTeX. Therefore, it is not advisable to use KaTeX to port mathematics for non-sighted users.

MathLive

MathLive is a component of the Cortex.js family of web-based mathematical applications. MathLive accepts LaTeX input, offers a virtual keyboard with popular mathematical symbols, and offers a choice between its own built-in speech rules for screen reader math output or the same Speech Rule Engine (SRE) used in MathJax, both of which are customizable.

MathQuill

MathQuill offers an interactive web formula editor where users can enter text or LaTeX-style math markup and see it rendered into MathML in real-time. Users can also render static formulas in a web page through its coding interface. MathQuill does not appear to offer support for screen readers nor other assistive technology at this time.

LaTeX.css

LaTeX.css is a very cleverly constructed CSS library that faithfully reproduces LaTeX-style formatting for numerous LaTeX environments, providing a more seamless transition for those coming from a LaTeX background. LaTeX.css is not its own JavaScript math display engine; rather, it uses MathJax to render mathematics formula, giving it a full set of accessibility features.

Conversion Tools

Web display engines only read and render mathematics markup already contained in an HTML document. The HTML document must be configured to use a display engine through its <script> parameters, and most likely will require some CSS styling to accommodate different devices accessing the content. This contrasts with the LaTeX philosophy where an author should not have to worry about presentation and styling.

Beyond this, one may need to convert entire documents containing a host of other content. An article written in LaTeX, for example, may contain:

  1. Inline mathematics
  2. Block display mathematics
  3. Abstract
  4. Table of Contents
  5. Document Sections
  6. Tables
  7. Special formatting for content blocks such as theorems, lemmas, and definitions.
  8. Numbered or bulleted lists
  9. Images
  10. Figures
  11. Code Blocks
  12. Footnotes
  13. Automatic numbering for any of the above
  14. Bibliography

As many of these elements are also native to HTML, a direct conversion is theoretically possible, but quite difficult in practice.

There are several document conversion tools to assist with this part of the process. Each has their own strengths, and each conversion will require some additional testing for responsiveness across devices and accessibility support. The tools discussed here are:

  1. Markdown
  2. Pandoc
  3. TeX4ht
  4. LaTeXML
  5. LaTeX.js
  6. LaTeX2HTML
  7. sTeX

Markdown

Markdown is not so much a conversion tool as it is a markup language itself that is meant to be converted into HTML. Markdown is a bridge between plain text and HTML, designed for fast authoring but still readable as plain text. Markdown uses syntax such as *emphasis text* to represent emphasis text and **strong** to represent strong text. It is an ideal option for authors that want to minimize the amount of additional coding needed to render their work.

Markdown can be written in any text editor, but requires a Markdown reader to render its output. Many browsers, collaborative workspaces, and online forums can automatically read and render Markdown. Markdown has also been expanded and customized within different document editing software. See, for example, the entry on R Markdown below.

LaTeX markup can be included in a Markdown document by enclosing the LaTeX code between math mode delimiters, just as in an HTML document. Then, the entire Markdown document can be converted to HTML by a popular tool called Pandoc. This process is described below. Sample code is provided in the Code Examples section.

Pandoc

Pandoc is an extremely powerful "universal document converter" capable of parsing and converting between hundreds of file formats. It is run from a command line interface (CLI) by specifying the to- and from- formats along with any special options available to those formats. An example is provided in the Code Examples section.

Pandoc can call MathJax (or another engine) to render mathematics when it converts a document to HTML. The resulting HTML file will have MathJax automatically set up in the script section, and can work as a template for future use.

Pandoc can also convert directly from a LaTeX source file, but content such as figures, tables, section headers, and other structured LaTeX syntax might not translate as well into HTML. The recommended approach is to write the document in Markdown and enclose mathematics between math mode delimiters. Pandoc uses its own expanded version of Markdown (called Pandoc Markdown) with its own syntax for this extra structure.

We encourage you to read about the many capabilities of Pandoc at the Pandoc home page.

TeX4ht

TeX4ht was developed in 2004 to convert directly from TeX source files to HTML and several other formats. It is now included as part of the TeXLive and MikTeX distributions. It incorporates MathJax (and other methods) for mathematics output, includes the ability to add some custom CSS to the final HTML output, can convert documents written with R Markdown and Overleaf, and has other unique features.

The article Making Accessible Documents Using LaTeX by Eric Larson and Isabel Vogt shows an example of how to use TeX4ht.

LaTeXML

LaTeXML was developed to convert LaTeX markup to an internal XML format specifically for the Digital Library of Mathematical Functions (DLMF) project at the National Institute of Standards and Technology (NIST). In turn, the internal XML can be used to export to HTML, with various customizable settings. LaTeXML offers a sample web editor that converts user input to rendered HTML, with numerous built-in examples.

LaTeXML was recently used to convert the arXiv research library to HTML. This is an exciting development that could boost accessibility adoption for mathematics and science research everywhere.

LaTeX.js

LaTeX.js is an interesting engine that ports full LaTeX documents into HTML while also reproducing their original LaTeX style formatting, similar to LaTeX.css. The web site showcases a side by side comparison of a sample LaTeX document to the rendered HTML. The engine is extensible and the project aims to automate translation of more native LaTeX environments. LaTeX.js uses the KaTeX engine to render mathematical formulas, and thus does not have accessibility support at this time.

LaTeX2HTML

LaTeX2HTML was way ahead of the curve, dating back to 1999. It is a command line tool that converts a LaTeX document into several HTML files to provide a paginated navigation similar to the original LaTeX PDF output. It automatically generates necessary hyperlinks, recreates lists, and converts mathematics, tables, and figures as into images. While the process does not provide alt-text, an author can insert alt-text for all necessary components.

sTeX

sTeX is a set of LaTeX packages designed to embed semantic information in LaTeX generated output. sTeX can generate a PDF with some annotations and a (much richer) annotated HTML document using MathML with the OpenMath (or other user chosen) reference library. sTeX also offers a plug-in for LaTeXML.

sTeX is under active development, and requires some additional manual set up to use. Please read thesTeX documentation for detailed instructions and example content.

Screen Readers

A screen reader is a software program that translates text from a computer screen into speech audio or braille. They are a cornerstone of how users with impaired vision interact with computers. When documents are created with full accessibility support, a screen reader announces the structure of the document before reading the content aloud.

Popular Screen Readers:

  1. VoiceOver - Apple
  2. JAWS - Windows
  3. NVDA - Windows
  4. Talkback - Android
  5. Orca - Linux
  6. Narrator - Windows

The American Foundation for the Blind (AFB) maintains an extensive list of screen readers. Screen readers are most commonly controlled with keyboards or a Refreshable Braille Display, but can be used with any computer input device.

You may wish to view:

Alt-Text for Math

Screen readers convey mathematics through alt-text descriptions of mathematical expressions. The alt-text description is at the heart of accessible mathematics. Like markup, it has a dual objective: convey how the mathematical expression is written (the presentation) and what it is meant to represent (the content).

Alt-text can be provided by:

  1. The author
  2. An encoding library, a database of semantic meanings of mathematical symbols, such as OpenMath
  3. A mathematics speech engine, a software generated translation of the mathematical markup

Alt-text can appear in:

  1. Plain text that references the mathematical expression
  2. The alt property in an image of the mathematical expression
  3. The alttext property in a <math> tag in a MathML expression
  4. An aria-label property in a container around the mathematical content

Best practices for writing and providing alt-text is an active, ongoing area of research. Some current institutional efforts are:

  1. The W3C MathML group is revising methods for default and user-generated alt-text descriptions. Please see:

  2. Since MathML is still not natively supported in all browsers, MathJax is currently the best option for cross-platform compatibility. MathJax uses the Speech Rule Engine (SRE), mentioned in the next section, for accessibility support. SRE generates alt-text from math markup and stores it in aria-labels (links)

  3. Members of the TeX Users Group (TUG) and LaTeX 3 Project are exploring methods to generate accessible PDFs from LaTeX. Please see the Tagged PDF section for more information.

The standardization of translation of mathematical expressions is a difficult issue. Mathematics is conveyed differently among different people, and there is no single ideal method.

Note that in terms of user experience, a sighted reader can scan elements in a syntactic expression, compare them each against a text description, and then process the full semantic meaning. Screen reader users cannot yet navigate both in tandem. Providing the same synchronous behavior for screen reader users is tied to the issue of alt-text.

Math Speech Engines

There are specialized speech engines for math that provide a more natural, context-based translation of math markup:

  1. Speech Rule Engine
  2. MathSpeak
  3. MathCAT
These engines do not replace the screen readers mentioned in the previous section. Rather, they interact with math elements to produce an alternative speech and Braille output than the default output of a general screen reader. They can also be customized around different spoken word conventions for math.

Speech Rule Engine

Speech Rule Engine (SRE) is a JavaScript based engine, originally part of the ChromeVox Screen Reader extension for the Chrome browser. It has its own internal default semantic definitions for mathematical expressions, can generate speech translations from LaTeX or AsciiMath markup, has multiple modes of math speech output, and can translate into several languages and Nemeth Braille. The SRE semantic tree visualizer demonstrates how it parses mathematical markup, with speech customization options. SRE comes bundled with MathJax, can run as a standalone application, and is configurable with several browsers.

MathSpeak

MathSpeak was developed by Abraham Nemeth, based on Nemeth Braille translation rules. It is maintained and available commercially through SeeWriteHear, an accessibility services provider.

MathCAT

MathCAT (Math Capable Assitive Technology) grew out of MathPlayer, both developed to translate MathML into speech and Nemeth Braille. (MathPlayer is no longer maintained, but its documentation is still available for legacy users). MathCAT improves upon MathPlayer's output capabilities, and will make use of MathML's upcoming intent attribute to allow authors to better control speech output of MathML expressions.

Ongoing Research

There is a large volume of research on speech generation from mathematics available at Semantic Scholar. Two suggested articles are:

Math in Braille

There are four standards for authoring and reading mathematics in Braille:

  1. Nemeth Braille
  2. UEB
  3. GS8
  4. DotsPlus

Hardware and software for reading and authoring Braille are briefly discussed at the end of this section.

Nemeth Braille

The Nemeth Braille Code was created in 1946 by Dr. Abraham Nemeth to represent mathematical expressions and scientific content that was not possible with the English Braille American Edition (EBAE) literary Braille system alone. Nemeth Braille uses a 6-dot Braille cell, the same as literary Braille, with a mix of its own unique symbols and standard EBAE. Nemeth expressions are embedded in literary Braille between special opening and closing symbols (called Nemeth Indicators) that inform the reader when a mathematical or scientific expression begins and ends.

Nemeth Braille was officially adopted by the Braille Authority of North America (BANA) in 1952, last revised in 1972, and has been consistenly updated to represent modern mathematics, chemical equations, and other scientific disciplines.

More recently, the Nemeth Uniform Braille System (NUBS) was proposed to better unify Nemeth Braille with literary Braille.

UEB

Unified English Braille (UEB) is an overhaul of English Braille American Edition literary system to modernize and unify literary, mathematical, and scientific content under one standard, and improve translation between printed text and Braille. UEB was officially adopted by the Braille Authority of North America in 2012. UEB uses a different convention for mathematics than Nemeth Braille. Due to the ubiquity of Nemeth Braille, UEB was updated in 2015 to allow readers to use their preferred style for mathematics.

American Printing House offers tutorials on Nemeth and UEB Math.

GS8

GS8 Braille is named after its two creators, physicist John Gardner and mathematician Norberto Salinas. It was developed to directly mirror LaTeX markup with Braille symbols. It uses an 8-dot Braille cell to accommodate a large set of base symbols from which the many thousands of mathematical and scientific symbols available in LaTeX can be constructed. GS8 is not in wide use, but may be preferable to those authoring in LaTeX. dCode offers an online GS8 encoder/decoder.

DotsPlus

DotsPlus is a two-dimensional Braille system designed to be a tactile font that mimics a written symbol. It was developed by John Gardner as a means for educators to present mathematics or other scientific content to blind users without having to learn Braille.

Tactile Graphs in Braille

Dr. Gardner also pioneered a method to display data and graphs with Braille, and began a company, ViewPlus Technologies, to provide the technology and services. Please see:

Reading, Writing, and Translating Braille on a Computer

The following suggestions were taken from the article What are some techniques for creating Braille math materials?, and other online resources. This section is not comprehensive and not meant to be a definitive source. Please be sure to consult a Braille expert at your teaching institution or a local organization to proofread any translations to Braille generated from software. The Library of Congress provides a list of organizations. You can also contact the National Federation for the Blind or its State Affiliates.

Braille can be read from a computer with a Refreshable Braille Display, or printed out onto perforated paper using a Braille Printer. Screen readers have built-in Braille output, with configuration as per instructions for JAWS, NVDA, VoiceOver, and Narrator.

Braille can be written directly on a computer using a Braille keypad or standard keyboard with designated keys for Braille characters. Sample lists of hardware devices are available at:

Braille can also be written through software translation of standard text. Two major systems are:

  • BrailleBlaster, a free, open-source editor based on the Liblouis translation engine. BrailleBlaster has support for LaTeX, and can convert to HTML using TeX4ht.
  • Duxbury Braille Translator (DBT) by Duxbury Systems is a commercial software translator with full support for MathML, LaTeX, and translation for over 170 languages. Please see the DBT mathematics documentation page for all the support options for math.

Other resources for typesetting math in Braille:

There are many different Braille Fonts. Please see:

Math can be rendered in DotsPlus using Microsoft Word with MathType. For an overview, please read:

Math in E-books

This section discusses e-book production software geared towards creating accessible-friendly mathematics and science e-books:

  1. PreTeXt
  2. R Markdown
  3. Calibre
  4. DAISY
There may be a bit more of a learning curve to these programs than those mentioned in the Typesetting Software section, but these programs significantly ease the entire e-book production process.

PreTeXt

PreTeXt, originally known as MathBook XML, is an outgrowth of the Undergraduate Teaching in Mathematics with Open Software and Textbooks (UTMOST) project through the American Institute for Mathematics (AIM). It was originally designed to create freely available open-textbooks on the web, and has grown into a full accessible-friendly document production system.

PreTeXt is its own XML that can be exported to HTML, PDF, Jupyter Notebooks, Nemeth Braille (using MathJax), and other formats. For mathematics, PreTeXt uses a hybrid of MathML to indicate math mode, LaTeX syntax for mathematics markup, and MathJax for rendering. It can be written in any editor, and it is compiled from a command line interface. An authoring guide, sample files, and several free textbooks written with PreTeXt are all available on the PreTeXt website.

R Markdown

R Markdown is an extended version of Markdown that works with in tandem with the R language for statistical computing. R Markdown allows users to include and execute code from R and several other languages, and export to HTML, PDF, presentation slides, and (many) other formats from the same source. R Markdown can also be used to author articles and shorter documents.

Bookdown is package for the R language to compile and generate R Markdown documents into EPUB, MOBI, PDF, and an HTML navigable book format. It uses MathJax to render mathematics, and incorporates LaTeX functionality such as equation auto-numbering, labels and referencing, and theorems and other special environments. The bookdown website has numerous free books available created with bookdown, including guides on R Markdown, the bookdown package, and the R language.

Not only can R Markdown produce a high quality accessible document, it is also a versatile accessible friendly authoring tool. The BrailleR package lets users code in R directly with Braille.

Calibre

Calibre is a popular open source, cross-platform e-book reader, management tool, and e-book authoring software. It uses MathJax to read LaTeX input and renders mathematics as SVG images. The online user manual has a sample HTML document that can be used as a template for mathematics, as well as a sample EPUB file of the same content. It may be an easier entry point for LaTeX authors who are already familiar with HTML to get an ebook up and running without too much extra work.

DAISY

DAISY (Digital Audiobased Information SYstem) is an international consortium that develops tools to create and publish accessible reading materials. DAISY helped create the EPUB standard, pioneered Digital Talking Books (DAISY 3), offers accessible book production software, and operates as a news, events, and networking source. Please see DAISY Activities page for a detailed list.

The DAISY XML standard integrates MathML to display math, and provides the option to synchronize a recorded narration of the mathematical content with it. This has an advantage over screen readers as an author can best customize the audio description to meet readers' needs. Authoring information is available at DAISY MathML Specifications.

E-Readers for Math

The EPUB e-book standard is based on HTML, and e-book readers are based on the same core engines as web browsers. The EPUB 3 standard supports MathML, but MathML does not have universal browser support. Therefore, the same concerns apply to rendering mathematics in e-books: MathML code may be used directly, but some publishers opt for SVG images with alt-text. Readers must check with their specific software & device to determine what level of support they have for mathematics.

MathJax documentation maintains list of e-book readers with MathML support.

Tagged PDF

Tagged PDF is a semantically enriched PDF that provides meta document information and navigation structure for assistive technology. The PDF for Universal Accessibility (PDF/UA) standard, established in 2012, specifies the requirements for a PDF to be fully accessible compliant. A short introduction is available at WebAIM.

Since much of mathematics is written and formatted for print by PDF, Tagged PDF is an ideal candidate for accessible mathematics, alternative to HTML. At this time, however, Tagged PDF does not officially support mathematics markup. There is a <formula> tag to denote mathematical content. Adobe advises using an SVG image of the mathematical expression with alt-text for accessibility.

Software that can embed mathematics in Tagged PDFs with this method:

  1. Microsoft Word
  2. OpenOffice Writer
  3. LibreOffice
  4. Adobe InDesign
  5. Apple Pages, Numbers, KeyNote

PDF editors that can add tags to any PDF document:

  1. Adobe Acrobat Pro
  2. Foxit
  3. Equidox
  4. CommonLook

There are other independent efforts underway to provide Tagged PDF with a robust semantic structure for mathematics with LaTeX, MathML, and AsciiMath markup.

LaTeX

The TeX Users Group (TUG) has been working to incorporate Tagged PDF functionality into LaTeX:

More articles are available at Ross Moore's website and the LaTeX Project website.

This work is analagous to the efforts to render math in HTML documents. One major difference is text flow. HTML behaves as one long continuous document that conforms to the size and shape of the device upon which it is viewed. PDF flows text in discrete pages on a fixed canvas size. Martin Ruckert's HINT Project modifies TeX to have the ability to reflow text like HTML.

MathML

MathTools for InDesign by MoveMen (not to be confused with the mathtools package for LaTeX) is a commercial plugin for Adobe InDesign that allows embedding of MathML into InDesign. MadeToTag by Axaio Software is a commercial plugin that builds on MathTools to offer better Tagged PDF and Accessibility support by including the semantic structure of MathML, an improvement over images and alt-text.

Another approach is Prince XML, an HTML to PDF converter that can generate Tagged PDF, as explained in Making accessible PDFs with Prince by Bruce Lawson. For a demonstration of Prince XML's output, please see:

This document suggests some support for MathML. Prince XML's official documentation does not yet mention it.

AsciiMath

Metanorma is an open-source XML authoring system based on the Asciidoc markup language. Similar to the Pandoc + Markdown workflow mentioned earlier, Asciidoc + Metanorma's internal XML can output a source file to several formats. Please see their article on accessibility with mathematics.

Code Examples

Test LaTeX code in a browser at:

Test MathML code in a browser at:

Note that the MathML will not display in all browsers. Check Can I Use ? for your browser.

Fraction

$$\frac{a}{b}$$

LaTeX: \frac{a}{b}

MathML: <math>   <mfrac>     <mi> a </mi>     <mi> b </mi>   </mfrac> </math>

Geometric Series

$$S_n = \sum_{i=1}^{n} a r^{i-1} = \frac{a (1-r^n)}{1-r}$$

LaTeX: S_n = \sum_{i=1}^{n} a r^{i-1} = \frac{a(1-r^n)}{1-r}

MathML: <math> <semantics>   <mrow>     <msub>       <mi>S</mi>     <mi>n</mi>     </msub>     <mo>=</mo>     <munderover>       <mo data-mjx-texclass="OP">&#x2211;</mo>       <mrow data-mjx-texclass="ORD">         <mi>i</mi>         <mo>=</mo>         <mn>1</mn>       </mrow>       <mrow data-mjx-texclass="ORD">         <mi>n</mi>       </mrow>     </munderover>     <mi>a</mi>     <msup>       <mi>r</mi>       <mrow data-mjx-texclass="ORD">         <mi>i</mi>         <mo>&#x2212;</mo>         <mn>1</mn>       </mrow>     </msup>     <mo>=</mo>     <mfrac>       <mrow>         <mi>a</mi>         <mo stretchy="false">(</mo>         <mn>1</mn>         <mo>&#x2212;</mo>         <msup>           <mi>r</mi>           <mi>n</mi>         </msup>         <mo stretchy="false">)</mo>       </mrow>       <mrow>         <mn>1</mn>         <mo>&#x2212;</mo>         <mi>r</mi>       </mrow>     </mfrac>   </mrow>   <annotation encoding="application/x-tex">S_n = \sum_{i=1}^{n} a r^{i-1} = \frac{a(1-r^n)}{1-r}</annotation> </semantics> </math>

Markdown

A Markdown file containing the LaTeX geometric series formula above: # Geometric Series $$S_n = \sum_{i=1}^{n} a r^{i-1} = \frac{a(1-r^n)}{1-r}$$ Note the double $$ delimiters around the math expression. This will render the equation in display format. For inline format, use a single $ delimiter. These delimiters are not used by default in MathJax. Please see the sample MathJax Configuration below.

Pandoc

A Pandoc conversion of the preceding Markdown file into HTML: pandoc --mathjax -f markdown -t html -s source_filename.md -o output_filename.html This will convert a Markdown file named source_filename.md into an HTML file called output_filename.html that calls MathJax to display the LaTeX code as MathML. The HTML file contains the source LaTeX code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> <head>   <meta charset="utf-8" />   <meta name="generator" content="pandoc" />   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />   <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript">   </script>   <!--[if lt IE 9]>   <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js">   </script>   <![endif]--> </head> <body>   <h1>Geometric Series</h1>   $$S_n = \sum_{i=1}^{n} a r^{i-1} = \frac{a(1-r^n)}{1-r}$$ </body> </html>

MathJax

MathJax can be configured to use familiar LaTeX delimiters, such as: <script>   MathJax = {     tex: {       inlineMath: [['$', '$'], ['\\(', '\\)']],       displayMath: [['$$', '$$'], ['\[', '\]']]     }   };   MathJax.Hub.Config({     "HTML-CSS": {       webFont: "Tex"     }   }); </script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script> Many more customization options are explained in MathJax Documentation.

LaTeXML

LaTeXML works in two stages. The first command: latexml source_filename.tex --dest=filename.xml converts a source TeX file into an XML file. The second command: latexmlpost filename.xml --dest=output_filename.html converts the XML file into an HTML file containing a MathML conversion of the original LaTeX markup.

Browsers that do not support MathML will not display the MathML, so SVG output is also available. LaTeXML will use the underlying LaTeX math markup in the alttext property. Options and customization is explained in the LaTeXML manual.

Alternatively, MathJax can be added to the HTML file to display the MathML in all browsers.