Skip to content

Write accessible math formulae fast with TeX


Keywords:

Do you produce materials (for example, in Moodle), which include mathematical formulae for higher education students? I would argue that if you don’t already write mathematical formulae with TeX, then you should learn it now!

Content:


MathML’s accessibility is practically still in the future

Accessible online services benefit all – and accessibility is obliged by the Finnish law. This applies also to most digital study materials as well.

The tools should work in such a way that a math-writing content creator would write formulae for their content just using TeX code, and then the editor software would automatically create a such a formula from it, that would be visually accessible, and it would also provide the formula as TeX code for the braille display user and the screen reader would be able to read the formula correctly aloud in the language specified in the document.

Online, mathematics should ideally be presented as MathML code for which the equivalent TeX code is available as alt text, and a SVG image is given as an alternative visual representation (See Math online and in e-books: Math formulae as MathML code | samimaatta.fi (available in Finnish)). An SVG image is a vector graphic, it is ideal for low-vision users who need to be able to zoom in the formula. Vector graphics scale beautifully and are a great alternative if MathML rendering is not working for some reason. However, MathML is not yet accessible in practice because of the lack of MathML support for browsers and e-book readers, as well as screen readers.

Even with math add-ons, screen readers can’t read MathML aloud in Finnish yet, and they don’t work well enough even in English yet. Mathematic formulae must be unambiguous. How to read a formula aloud, depends on its context and this sets a challenge to screen reading software. That’s why it’s important that the users can always read the formula on a braille display as well.  Especially if the formula is very long and complex, one could imagine that the formula as a TeX code on a braille display would be more meaningful for braille experts in general than listening to the formula? But surely it is the case that the best option would be to offer both ways. Also please remember, that there may be users, who depend on listening or braille only.

What could you do now to make your digital materials with mathematical formulae accessible today?

So what would work in practice now?  In the world of higher education, mathematical formulae should be given to those with braille skills as TeX code.  It is unambiguous and presents the formulae in a concise format that is easy to understand if you know TeX. Well, of course, this means that in practice, every blind university student studying mathematical subjects must, at the latest when entering higher education, first learn to read and write mathematical formulae as TeX code themselves. (In Finland, primary and secondary school students are not yet required to have LaTeX/TeX skills, as they are provided with Celia’s accessible materials.)

So, there is this one threshold of learning TeX to overcome at first, but it’s a useful skill for the future, as writing formulae as TeX code is quick and convenient when you know how to do it. It’s a skill that everyone who writes formulae for web content would benefit from: it is a useful skill for all students in mathematical fields.

A suggestion on how you could make your materials with formulae accessible in Moodle (and at the same time teach TeX to everyone who reads your content):

The most accessible, user-friendly way to convey content online is a web page. In Moodle, you can use Moodle’s own editor when you add different content and task types to your course. If you wish, you can write longer web content elsewhere first, using your preferred text editor. Mark formulae on it as TeX code. (See, e.g., LaTeX/Mathematics – Wikibooks, open books for an open world.) Type the formulae into the text so that you surround a formula with certain characters like this: first a backslash, left parenthesis, space, and then the actual formula in TeX format, and after it a space, backslash, and a right parenthesis at the end of the formula. \( … \)
example:

\( x = \frac{ - b \pm \sqrt{b^{2} - 4ac}}{2a} \)

The notation generates the formula in Moodle.

This default solution serves the sighted users better than braille users. However, in Moodle, the user can open the MathJax menu from any formula, and then select Math Settings, Math Rendering, Plain source from the menu. After this, all formulae in Moodle will be displayed in the plain text format. If the teacher has entered the formulae in Moodle as TeX, the braille users can read the formulae with ease. (NB. Don’t paste MathML code to the editor, as reading it with a braille display is not fun!)

In addition, through the menu, it is possible to define on a formula-by-formula basis in which form the user wants to view the formula. In other words, Moodle meets the minimum accessibility requirements and is therefore accessible, if you instruct users to change the presentation of the formulae to plain text themselves. But why not offer the formula in TeX format alongside the visual representation of the formula? I suggest that you write all the formulae in Moodle practically twice, in this style:

\( x = \frac{ – b \pm \sqrt{b^{2} – 4ac}}{2a} \)

x = \frac{ – b \pm \sqrt{b^{2} – 4ac}}{2a}

It would look like this in Moodle:

A screenshot from Moodle: The title is in Finnish, Kaava Moodlen kaavaeditorilla. The visual representation of the formula is under the title, and below it is the same formula as TeX code. The formula example is the same as the text example above this image.

In the image, the title is in Finnish and it means ”a formula made with Moodle’s equation editor”.

I think this would work well on the braille display as well, as long as you told in the description of your Moodle course that below each formula, the same formula is written in TeX code.  The benefit here would also be, that all participants in the course would get a TeX code “language bath”, and perhaps learn a quick and nifty way to write formulae themselves on the side. In the end, using visual editors is more cumbersome and slower than writing TeX, although the learning threshold is higher in the latter than in learning how to use the visual editor.

What if you need to make material that will not be published in Moodle but needs to be shared elsewhere (e. g. as PDF or docx)?

If you make content for another website, e. g. blog, and mathematical notation is not supported:

Offer the formula as an SVG image and as the alt text, give the TeX code of the formula. If SVG is not possible, offer the formula as a PNG image. (Before that, though, it’s worth asking the site administrator if they could add SVG to the list of allowed image formats; it could work!)

LaTeX users:

Often, those who write a lot of mathematical formulae make their texts with LaTeX, i. e. write their formulae with TeX, but then convert the text into a non-accessible PDF. PDF does not support mathematical notation. When the end result needs to be an achievable PDF, such a process should be developed, where the formulae would appear in the PDF as SVG images with TeX code as alt text.

That workflow can be automated, and one possibility would be to try this: https://ctan.org/pkg/axessibility – This project provides glossaries for NVDA and JAWS screen readers that convert LaTeX commands into natural language. Braille displays show the formulae in their original LaTeX representations. Please note, that the screen reader solution is available in English, but not in Finnish. For this reason, the formulae should be marked as English in Finnish text. A quick solution for the current situation would be if the project would automatically add correct language attributes for the PDF conversion of the formulae, which would be different from the language of the document itself; then the screen readers would read the document in its language but the formulae in English. Unless someone (or rather a group of people) gets inspired, and participates in that open source project to offer glossaries also e.g. in Finnish. (If you know a better solution, please let me know: you could send me a message through ICT services!)

As far as I know, this is how this often works in academia now: The teachers make PDF files, maybe even otherwise accessible, but the formulae in the document cannot be read with braille. Then the braille savvy students ask the teachers to provide them with the original LaTeX file for the PDFs. It’s better than nothing, but in practice, the students should not have to ask for accessible alternatives.

One option for a PDF could be an e-book in EPUB3 format. EPUB3 supports MathML code. In the LaTeX to EPUB variant, you could try something like this: Package tex4ebook (CTAN) . But since support for screen readers and braille displays is still incomplete, here, too, you should consider offering the same formula first in its visual form and then separately for braille display users as TeX code along the visual representation of the formula. In addition, it should also be remembered that for now at least, e-books need their own separate reader program. (Fortunately, there are free options available). This means that e-books do not open conveniently directly in the browser.

Word users:

If you’re a Word user, maybe it’s better not to save your files with formulae as PDFs, but to share them as they are. Word’s own docx format is allowed at least in internal use at our universities here in Oulu because we all can use Word, and Word’s own format (docx) is more accessible than PDF. Even in Word, the most convenient way to insert formulae in the text is to use TeX:

  1. First, enter the formula as TeX code, and then select it. Example formula as plain text:
    x = \frac{ – b \pm \sqrt{b^{2} – 4ac}}{2a}
  2. When you have the formula selected, click “Insert, Equation”, and then Word recognizes the text you selected as a formula and displays it in a single line, in a linear format that is readable by the braille display user.
    A screen capture of a linear presentation of an equation in Word. It is the formula written in TeX code, x = \frac{ - b \pm \sqrt{b^{2} - 4ac}}{2a}
  3. In the Equation view you can then select the Professional option from the Convert menu. It is the visual presentation of the formula, and it is the most accessible option for sighted users. (Note: a screen reader could read the Professional formula below like this (translated from the Finnish reading as such): ” x = fraction starts, minus b ± square root of a number, b, superscript, 2, superscript ends, minus 4a c, root ends, over, 2a, fraction ends”)
    A screen capture of the example equation in its visual representation as it would look like in Word.

The Convert menu also has “All” options that allow you to change all the formulae at once to your desired format. In Word, you could offer the same material to everyone and then separately instruct that the users can choose for themselves whether they want to change the formulae in Equation view using the Convert all function to linear or professional presentation.

PowerPoint users:

PowerPoint also has a equation editor, but it doesn’t have the same conversion tool as the desktop version of Word. Therefore, when making formulae for PowerPoint, you should first make the content in Word using TeX code, and then convert it to the Professional format, and copy it as such to PowerPoint.

If you are adding formulae to a PowerPoint file that you only show in a lecture or on a video, it is enough to take care of the visual accessibility of the formulae on your slides, i. e. that the size of the formula is sufficient, the contrast is adequate, and you do not convey information through color alone. When you present the formulae in a lecture or while recording a video, you must read the formulae aloud. When you provide the students accompanying material to support your lecture or video, please consider sharing the accompanying material as a web page, and not as a PowerPoint. A Moodle page would be great but if that doesn’t work, would it be easier for you to make an accessible Word file with formulae, rather than an accessible PowerPoint?


Summa summarum

In the meantime while we wait for more accessible tools, please take care of the accessibility of mathematical formulae e. g. like this:

  1. If you’re not already an expert in TeX, it’s worth learning the skill to streamline your work writing formulae now and in the future.
  2. Provide your online content made with an editor inside Moodle: In Moodle’s own editor, it is possible to easily write formulae as part of the content using TeX code. To make it easy for braille users to read your data, why not offer the same content as TeX code under each formula. At the same time, every student could start to learn TeX!
  3. If you need to make files including formulae, make the files accessible. It depends on the file type how to do it: EPUB3 supports MathML, while in PDF, the formulae should be offered as SVG images with TeX code as alternative description. In Word, the way formulae are presented, is for the user to decide.
  4. If you show formulae in a lecture or lecture recording, it is enough that the formulae you show are visually accessible AND you also read the formulae aloud when presenting them. Additional material should be offered primarily e. g. in the form of online Moodle content. What comes to deliverables, Word is a better format than PowerPoint, and Word is also quite helpful in creating formulae for PowerPoint, using TeX.

Let’s start providing accessible math!

Learn how to write math formulae with TeX: Starting out with TeX, LaTeX, and friends (CTAN)


Thanks to Braille expert Ronja Pahaoja for proofreading this guideline’s Finnish version and giving suggestions for improvement.

 

« Back

This article was published in categories English version available, All instructions, Oamk , for Oamk staff, for Oamk students, for the University of Oulu staff, for the University of Oulu students, accessible content, UniOulu and tags . Add the permalink to your favourites.