Accessible and Interactive Course Materials with PreTeXt

Oscar Levin
University of Northern Colorado

SIMIODE EXPO 2025 (February 16, 2025)

Slides available on MathTech.org

Abstract

How do you create course materials that are accessible, always up to date, can be printed or viewed on any screen, and include embedded interactive elements to engage students? Of course, there are ways to accomplish each of these requirements, but wouldn’t it be great if there was an easy way to keep everything organized and in one place? What you need is a system for writing these materials once and used everywhere.

PreTeXt is a markup language that can be converted to LaTeX, HTML, EPUB, and even Braille. It is a popular choice for authors of textbooks (including the SIMIODE textbook), but its complexity has historically made it less common for everyday teaching materials. In this talk I will share some recent work that makes PreTeXt much easier to use and share some suggestions for how to leverage its interactive features.

The Future of Course Material Creation

Formats for Course Materials

How should we share materials with our students?

  • Papyrus scrolls or stone tablets

  • Typewritten monospace with hand drawn math symbols.

  • LaTeX-generate a PDFs we post on Canvas and get yelled at about because they fail accessibility tests.

  • Everyone’s phone or tablet.

What’s wrong with ?

Limitations:

  • LaTeX output is not accessible. Even tagged PDFs have poor screen reader support for math.

  • HTML is better! But arXiv has been working to convert LaTeX to HTML, and even after lots of work, 25% of papers have errors.

  • How can you embed videos, run computations, or include checkpoint assessments in a LaTeX document?

  • LaTeX lets you do too much customization.

A better way: PreTeXt

PreTeXt is a semantic markup language for scholarly documents.

Pros:

  • Write once, read anywhere.

  • HTML output is accessible to screen readers.

  • Can include interactive elements.

  • Can still be converted to PDF for printing.

Cons:

  • It is hard to write in PreTeXt.

  • Fine for OER textbooks, but little support for individual course documents.

Markup

\begin{theorem}[Fermat's Last Theorem]\label{thm:fermat}
  There are no positive integers $x$, $y$, and $z$ 
  such that $x^n + y^n = z^n$ for any integer $n > 2$.
\end{theorem}

\begin{proof}
  There is not enough room on this slide for the proof, 
  but it should be obvious.
\end{proof}
<theorem xml:id="thm:fermat">
  <title>Fermat's Last Theorem</title>

  <statement>
    <p>
      There are no positive integers <m>x</m>, <m>y</m>, and <m>z</m> 
      such that <m>x^{n} + y^{n} = z^{n}</m> for any integer <m>n \gt 2</m>.
    </p>
  </statement>

  <proof>
    <p>
      There is not enough room on this slide for the proof, 
      but it should be obvious.
    </p>
  </proof>
</theorem>

\begin{theorem}[Fermat's Last Theorem]\label{thm:fermat}
  There are no positive integers $x$, $y$, and $z$ 
  such that $x^n + y^n = z^n$ for any integer $n > 2$.
\end{theorem}

\begin{proof}
  There is not enough room on this slide for the proof, 
  but it should be obvious.
\end{proof}

 

\be{t}{Fermat's Last Theorem}{thm:fermat}
  There are no positive integers $x$, $y$, and $z$ 
  such that \pt{x}{y}{z}{n} for any integer $n > 2$.
\e{t}

\bp
  There is not enough room on this slide for the proof, 
  but it should be obvious.
\ep

PreTeXt: Then and Now

PreTeXt before 2020

Steps to compile a document:

  1. Clone the PreTeXt repository.

  2. Run the pretext script. For example,

    python ~/pretext/pretext -vv -c latex-image -f svg -d ~/books/aota/images ~/books/aota/animals.xml
    

  3. Run xsltproc to convert the XML to html. For example,

    xsltproc -xinclude xsl/pretext-html.xsl ~/books/aota/animals.xml
    

  4. To view the output, upload your files to a web server.

But now...

Click buttons in VS Code.

 

 

Let me show you.

Demo time

PreTeXt in the Browser

For an Overleaf-like experience, you can run PreTeXt in your browser using GitHub Codespaces.

  • Go to github.com/PreTeXtBook/pretext-codespace.

  • Click the green Use this template button; select Create a new repository.

  • Name your repository and click Create repository.

  • In your new repository, the green Code button and select Create codespace on main.

After a few minutes, you will have a working VS Code environment in your browser with PreTeXt installed.

Switching to a course template

The template provided with the codespace is for a book. If you want to switch to a course template, you can do so as follows:

  1. Remove the project.ptx file, either by deleting it from the Explorer panel on the left side of the screen, or with the command rm project.ptx entered in the terminal panel at the bottom of the screen.

  2. In the terminal panel, enter the command pretext new course -d . (note the period at the end; you want to put the course in the current directory).

Build, View, Deploy

All the content for your course is written in .ptx files inside the source folder. To transform your source into a website:

  1. Click the ▷ PreTeXt button in the bottom toolbar (left-center). From the list of options at the top of the screen, select Build default target.

     3 
    or enter pretext build in the terminal.

  2. Preview your website: Click the ▷ PreTeXt button again, and select View full document.

     4 
    or enter pretext view in the terminal.

  3. To deploy your website, click the ▷ PreTeXt button again, and select Deploy.

     5 
    or enter pretext deploy in the terminal.

Adding Content

Open the source folder in the Explorer panel on the left side of the screen. You will see a file called main.ptx. This file imports other files using <xi:include href="..."/> elements.

Examples of things you can add:

The Future

Very soon...

  • Improved course templates with everything you need to get started.

  • Better conversion of LaTeX to PreTeXT so you can reuse previously authored material.

  • Type in (basic) LaTeX, markdown, and PreTeXt in the same document.

And eventually...

A visual (WYSIWYG) editor, entirely in your browser!

Thanks