The first question most people ask is, “Isn’t there an export option to make PDFs created in LaTeX accessible?” It may be theoretically possible, but no one has developed or maintained a package that does it successfully. The main issue is that LaTeX-to-PDF exports have equations and graphs, etc, exported as images without alt-text. In other words, these PDFs are inaccessible.
So the alternatives are to:
- move from LaTeX-to-Word-to-PDF, but you must also know how to use Word’s Properties to flow into a more accessible PDF;
- move from LaTeX-to-HTML, which also requires some work up front and also demands at least a comfort with the command line;
- or learn how to remediate a PDF.
Our research here at Swarthmore has led us to find outdated packages for LaTeX that do not successfully export to an accessible PDF. Many were developed by folks at universities in search of a solution.
What we recommend, instead, is to prepare LaTeX for export to HTML.
Resources needed
- PANDOC, downloaded and installed.
- A LaTeX editor, such as Overleaf, TeXStudio,TeXShop, or even VS Code.
- A .tex file.
- A willingness to play with the command line.
Prepare LaTeX for export to HTML
In order to achieve 99% accessibility with any output, the easiest answer is to edit the source document. In this case, we will need to edit our LaTeX code so that the .html meets accessibility best practices.
- Insert title in preamble metadata:
\title{_}
; - Insert sections in document body:
\section{_}
, etc ; - Use
\enumerate{_} \item \item … \end{enumerate}
for numbered lists; - Use
\itemize{_} \item \item … \end{itemize}
for bulleted or unordered lists; - Use only one font attribute for emphasis.
- Use all caps and italics sparingly.
- Use color contrast according to WCAG compliance. WebAIM: Contrast Checker.
- Use tables only for tabular information.
- Use alt text for images, diagrams, etc. Images Tutorial | Web Accessibility Initiative (WAI) | W3C.
Export the LaTeX to HTML
- Download and install PANDOC to your computer / local environment if you haven’t already.
- Review LaTeX to HTML via PANDOC | Dan W. Joyce to understand what the codes mean.
- Open your Command Line Interface (CLI).
- Copy and paste the following command at the prompt:
pandoc --shift-heading-level-by=1 --mathjax -f latex -t html -s -o <file>.html <file>.tex
.
What does this have to do with Moodle?
When we discuss best practices in accessibility, we talk about
- allowing an end user to choose their preference.
- maintaining accessibility in the source document.
In the case of LaTeX, we have had students prefer to read the .tex file exactly as .tex because that is easier for them than the inaccessible PDF. Might we find ways to have Moodle export a .tex file to .html or .pdf or something else in some quick and easy way?
For now, we instruct faculty on how to post .html files on their Moodle sites.
Posting HTML files to Moodle
These are the current steps to post a remediated HTML to Moodle, as given to instructors at Swarthmore, where we post remediated files to Google Drive:
When downloading a folder from Google drive, it becomes a .zip file. You may choose to download each folder for your remediations and then directly upload them to your Moodle course page. Here’s how to do that.
- Open the Moodle course in which you’d like to place the .html.
- Enable Edit mode.
- Add an activity or resource.
- Choose File.
- Fill out the required field: Name.
- Choose the .zip file that contains the whole folder with everything in it.
- Once it’s showing in the “Select files” area, select the folder.
- In the dialog box that pops up, choose Unzip.
- You will likely see:
- an images folder, if there are images
- the .html or .xhtml file.
- the original .zip file.
- Delete the .zip file.
- Select the .html or .xhtml file.
- Choose Set main file.
- Choose Save and return to course.
Some professors choose to put the .html, .tex, and keep the .pdf so students can choose from the .html, .tex, and the .pdf files. Others replace .pdfs with the .html altogether. HTML files, when done correctly, are generally more accessible than .pdfs.
For more information on posting displaying a website index page or .html to your Moodle site, refer to Moodle’s File Resource Settings page.
How you can help
- Can you think of ways to streamline this process?
- Can you think of ways to have Moodle export any file, including .tex or .docx or .pptx to .html or .pdf or something else in some quick and easy way? It could be by the end user (student, presumably) or the faculty.
- Are you aware of other ways to handle STEM in an accessible manner?
- Learn and implement accessibility practices every day!
We discussed a few of these at Hack/Doc in June and feel the project is just beginning.
Reach out to accessibility@swarthmore.edu if you have thoughts about this or other accessible STEM topics.
Additional, potentially helpful resources
- LaTeX to HTML via PANDOC | Dan W. Joyce (to refer to what each command means);
- Creating accessible LaTeX | MSU Libguides;
- Lewis Forbes – LaTeX and Accessibility | University of Edinburgh student intern blog;
- Testing HTML Export with make4ht.
Acknowledgements
The folks below contributed in various ways to our thought process about accessible STEM, particularly LaTeX.
- Charles Fulton
- Amanda Licastro
- Jennifer Maxwell and Mat Olkowski’s workshop at Accessing Higher Ground 2023
- Joe Nakao
- Andrew Ruether
- Corrine Schoeb