Digital Education Wiki Spaces
Accessibility — Assessment — CampusPress Guides — Digital Education — Gradescope Guides — Learning Technology Good Practice — Lecture Recording — Mentimeter — Moodle Baseline — Moodle How-Tos — Multimedia — Student Online Learning — Zoom
Converting Maths Documents to Accessible HTML: A Guide for Staff
Making your maths teaching materials accessible benefits all students. Converting LaTeX and Quarto documents to HTML creates content that works with screen readers, adapts to different devices, and reaches a wider audience.
This guide walks you through four practical workflows. Each has its strengths, so you can choose what works best for your content and workflow.
- 1 Why HTML matters for accessibility
- 2 Workflow 1: LaTeX to HTML with TeX4ht
- 2.1 What you'll need
- 2.2 Step-by-step guide
- 2.3 Tips
- 3 Workflow 2: LaTeX to HTML with Pandoc
- 3.1 What you'll need
- 3.2 Step-by-step guide
- 3.3 Tips
- 4 Workflow 3: LaTeX to HTML with Chirun Web
- 4.1 What you'll need
- 4.2 Step-by-step guide
- 4.3 Tips
- 5 Workflow 4: R Markdown to HTML with Quarto
- 5.1 What you'll need
- 5.2 Step-by-step guide
- 5.3 Tips
- 6 Choosing the right workflow: A comparison
- 7 Adding your converted HTML document(s) to Moodle
- 8 Next steps
Why HTML matters for accessibility
Unlike PDFs, which lack structure for screen readers to distinguish elements, screen readers can navigate the HTML tag structure effectively, maths equations can be read aloud (when properly formatted), and content can be resized more effectively on different screen sizes. By converting your materials to HTML, you're making them more inclusive and easier to use for everyone.
Converting documents to HTML is just the first step. Check out the Accessibility Checklist for Quantitative Subjects for other ways to make your documents more accessible.
Workflow 1: LaTeX to HTML with TeX4ht
TeX4ht converts LaTeX documents directly to HTML while preserving mathematical notation. It's been around for years and handles complex LaTeX documents well.
What you'll need
A LaTeX distribution (TeX Live or MiKTeX)
Your LaTeX source files
Command line access (Terminal on Mac/Linux, Command Prompt on Windows)
Step-by-step guide
Open your command line interface.
On Mac: Open Terminal from Applications > Utilities
On Windows: Search for "Command Prompt" in the Start menu
On Linux: Open your preferred terminal application
Navigate to your document folder.
cd path/to/your/latex/folderReplace
path/to/your/latex/folderwith the actual location of your LaTeX file.Run the conversion command.
make4ht filename.tex "mathml,mathjax,sections+"Replace
filename.texwith your actual file name.The commands within the quotation marks are called 'options'.
mathml, mathjaxrefer to the maths formatting support. Due to varying levels of browser support, it's recommended to include both options.sections+creates titles in the sections that link to the table of contents.Check the output. Look for a new HTML file in the same folder. Open it in your web browser to review.
Tips
TeX4ht works best with standard LaTeX packages. If you're using unusual or custom packages, you might need to adjust your document.
Do not use images of equations, but rather write them out.
Mathematical equations are converted to MathML by default, which screen readers can interpret with the proper setup.
Images and graphics should be in standard formats (PNG, JPG) for best results.
If the conversion fails, check which packages you are using. Some packages may not be supported by TeX4ht. Check out TeX4ht's FAQs page.
Workflow 2: LaTeX to HTML with Pandoc
Pandoc is a versatile document converter that handles many formats, including LaTeX to HTML. It's particularly good at creating clean, readable HTML.
What you'll need
Pandoc installed on your computer (download from Pandoc)
Your LaTeX source file(s)
Command line access
Step-by-step guide
Install Pandoc.
Download the installer for your operating system
Run the installer and follow the prompts
Open your command line and navigate to your document.
cd path/to/your/latex/folderConvert your document.
For basic conversion:
pandoc filename.tex -o output.html --mathjaxReplace
filename.texwith your actual file name.For a standalone HTML file with better styling:
pandoc filename.tex -o output.html --mathjax --standalone --css=style.cssReplace
filename.texandstyle.csswith your actual file names.--mathjaxuses MathJax to render equations.--standalonecreates a complete HTML document with proper headers.--css=style.csslets you add custom styling (which is optional). Check out the Pandoc documentation for more information about your options.View your HTML file. Open the output file in a web browser.
There is a beta version of an online Pandoc converter, but note that it is still early stages and should be used with caution.
Tips
Pandoc handles standard LaTeX well but might struggle with complex custom commands. Consider simplifying your LaTeX before conversion.
If you have bibliographies, use
--citeprocto process citations.For multiple chapters or sections, you can convert several files at once.
Workflow 3: LaTeX to HTML with Chirun Web
Chirun is designed specifically for creating accessible course materials. It converts LaTeX to HTML and can build a complete course website with navigation between multiple pages.
What you'll need
Your LaTeX source file(s)
Internet access
Step-by-step guide
Access the web frontend at https://lti.chirun.org.uk .
Select Create a new package.
Gather your file(s) via Upload files, then click Upload.
If you did not include a YAML file in your upload, you'll see ‘Your package didn't contain a config file, so we've created one. Please review the configuration’. Scroll down the page and add in your package metadata, license information, and build options.
Note, you can simultaneously generate PDFs of your content by selecting Build PDFs.
URL to load MathJax from can be left blank, as the default option is sufficient.
Click Save at the top of the page.
Select Download the generated content as a .zip file.
Bookmark the resulting page's URL if you wish to edit the package at a later date.
You can add other item types to your package via Configure.
Tips
You can include different types of content (PDFs, videos, external links) alongside your LaTeX documents.
There is a Chirun command line interface (CLI) tool, though it has a larger learning curve and works best for Linux and Mac devices (with a workaround for Windows). Find out more on Chirun’s CLI documentation.
Workflow 4: R Markdown to HTML with Quarto
If R Markdown is your preferred language, Quarto helps to create accessible HTML output, even including HTML accessibility checks in your workflow.
What you'll need
R and RStudio installed (download from the LSE App Store, also known as Self Service)
Quarto installed (download from the LSE App Store, also known as Self Service)
Your R Markdown files
Step-by-step guide
Install Quarto.
On Mac: Download Quarto from datajar.mobi > Self Service
On Windows laptops: Download Quarto from LSE App Store
On LSE Windows Desktops: Download Quarto from LSE Self Service
Convert your R Markdown to Quarto format. Open your
.Rmdfile in RStudio. Quarto works with R Markdown files directly, but you can rename them to.qmdif you prefer.Add Quarto configuration. At the top of your document, update the YAML header:
--- title: "Your Document Title" format: html: toc: true axe: true ---toc: truecreates a Table of Contents.axe: trueruns automated HTML accessibility checking usingaxe-core, an open-source accessibility package. Automated accessibility checking can catch some accessibility issues, such as colour contrast, but having no issues does not mean the document is fully accessible. Any accessibility concerns will show in the browser's console via the browser's developer tools.Render to HTML.
Option A: In RStudio
Click the Render button (it replaces the old Knit button)
Option B: Command line
quarto render filename.qmdReplace
filename.qmdwith your actual file name.Review your HTML document. Quarto creates an HTML file in the same folder. Open it to check the output.
Find the Developer Console for accessibility checking via:
Windows/Linux: Press
Ctrl + Shift + JMacOS: Press
Command + Option + J
Tips
Use
code-fold: trueto hide code by default, letting students reveal it when they want to see the details.Add
toc: truefor a table of contents, which helps with navigation.
Choosing the right workflow: A comparison
Workflow | Best for | Pros | Cons | Learning curve |
|---|---|---|---|---|
TeX4ht | Complex LaTeX documents with custom packages | Handles sophisticated LaTeX; produces MathML for accessibility | Can be finicky with unusual packages; requires command line comfort | Moderate to steep |
Pandoc | Standard LaTeX documents; quick conversions | Clean output; flexible; handles many formats | Struggles with complex custom commands; requires some command line use | Moderate |
Chirun web | Complete course websites; multiple documents | Creates full course structure; built-in accessibility features; excellent navigation | More setup required; best for larger projects | Moderate to steep |
Quarto | R Markdown users; documents with data analysis | Modern workflow; interactive elements; multiple output formats | Primarily for R Markdown rather than pure LaTeX | Gentle to moderate |
Adding your converted HTML document(s) to Moodle
Zip your folder containing your HTML file(s) and any supporting files, such as CSS or image files.
Go to your course page and Turn editing on. Scroll to the section where you would like your document(s) to be displayed, and click Add an activity or resource and pick File from the Resource tab.
Like the typical File upload process, add a Name and an optional Description.
In the Select file area, either drag and drop your zipped folder or use the File picker to select your zipped folder.
Click on the file to open a dialog window titled 'Edit <your file name>'. Select Unzip.
Click on the unzipped folder, then click on your HTML file. If you have multiple HTML files, select your
index.htmlfile. Select Set main file, then Save.
Return to the root folder by selecting Files underneath the File picker button.
Click on the original zip file, then select Delete. Confirm the deletion. The zip file is no longer needed.
Under Appearance, ensure that Display is set to New window.
Click Save and return to course. Your HTML file(s) are now on your course.
Next steps
Start with a small test document to try out your chosen workflow. Each tool has an active community, so you'll find plenty of help online if you run into difficulties.
Remember that converting to HTML is an ongoing process. As you create new materials, build accessibility into your workflow from the start rather than converting everything retrospectively.
If you need support with these tools or want to discuss which workflow suits your teaching, please get in touch with eden.digital@lse.ac.uk.