Skip to content

Improve accessibility - #4

Merged
rowanc1 merged 3 commits into
myst-templates:mainfrom
ryanlovett:a11y-tagging
Mar 10, 2026
Merged

Improve accessibility#4
rowanc1 merged 3 commits into
myst-templates:mainfrom
ryanlovett:a11y-tagging

Conversation

@ryanlovett

Copy link
Copy Markdown
Contributor

These changes improve accessibility scoring from two different accessibility checkers. The main differences are using lualatex instead of xetex and adding tags. I needed to install TeX Live 2025. I don't know LaTeX very well, and relied on @rhstanton's work in https://github.com/rhstanton/accessible_LaTeX/. All shortcomings are mine.

The tools I used to measure accessibility.

  1. ally, used within my institution's LMS, which scans uploaded PDFs
  2. verapdf, used via docker
    myst build --pdf
    docker run --platform linux/amd64 --rm -it -v .:/data ghcr.io/verapdf/cli:latest \
      --format json -df ua2  --loglevel 0  \
      exports/myst-latex.pdf > verapdf-analysis.json
    

My local myst project referenced my local fork:

version: 1

project:
  title: Accessibility Test
  authors:
    - name: Your Name
  exports:
    - format: pdf
      template: ../lapreprint
      output: exports/myst-latex.pdf
    - format: tex
      template: ../lapreprint
      output: exports/myst-latex.tex
  toc:
    - file: index.md

site:
  template: book-theme

My index.md test file contained:

---
title: foo
authors:
  - name: Your Name
exports:
  - format: pdf
  - format: typst
---
+++ { "part": "abstract" }

This is a placeholder abstract.

+++

## Code

:::{code-cell} python
hello = "hello"
there = "there"
phrase = f"{hello}, {there}!"
print(phrase)
:::

## header 1

some math

$$
\int f(\theta)d\theta
$$

## header 2

:::{csv-table} a table
:header: "col1", "col2"

4, "a"
5, "b"
:::

(I tried several table variants besides csv-table.)

When I generated verapdf json output with the current lapreprint code and summarized with:

$ cat /tmp/myst-latex-upstream.json | jq '
      .report.jobs[0].validationResult[0]
      | { compliant, failed_rules: .details.failedRules, failed_checks: .details
.failedChecks }
    '
{
  "compliant": false,
  "failed_rules": 10,
  "failed_checks": 43
}

When I ran it with my changes:

$ $ cat /tmp/myst-latex-fixes.json | jq '
      .report.jobs[0].validationResult[0]
      | { compliant, failed_rules: .details.failedRules, failed_checks: .details
.failedChecks }
    '
{
  "compliant": false,
  "failed_rules": 1,
  "failed_checks": 4
}

The remaining failure is related to tables and tagging, and I believe that would need to be fixed in myst.

Cc: jupyter-book/mystmd#2743

myst-latex-upstream.pdf
myst-latex-fixes.pdf

@rowanc1
rowanc1 merged commit 3c1cd1f into myst-templates:main Mar 10, 2026
1 check failed
@rowanc1

rowanc1 commented Mar 10, 2026

Copy link
Copy Markdown
Member

Thanks @ryanlovett!

Comment thread template.tex
pdfstandard=a-2u, % PDF/A-2u format (archival standard with Unicode support)
pdfstandard=ua-1, % Add PDF/UA-1 accessibility conformance target
pdfstandard=ua-2,
pdfversion=1.7, % Explicit PDF version used for compatibility with conformance tooling

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late to this, but I think we should probably start targeting pdf 2.0 standard documents. 2.0 is required for MathML and UA-2 is designed to work with 2.0. (Older readers can still open 2.0 documents, and even though they score less on checkers, I think that will be an anti-pattern soon enough.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants