11 LaTeX: Beamer Accessibility
Currently, beamer has limited support for accessibility. One option is to convert a beamer document to an article class and then use the tagpdf to add accessibility tags. Another option is to compile it to HTML instead of PDF, which allows for more accessible web content. A newer method is to use the ltx-talk class, which works with beamer-style commands like \begin{frame} and also supports tagpdf. This gives you more flexibility while still improving accessibility.
11.1 Convert Beamer to Article
11.1.1 Instructions
When converting a Beamer presentation to an article, it is best to do it manually to make sure the structure is clear and logical. Beamer and article have different layouts, so some parts of the code will not work in the article format.
Beamer commands that are not compatible with article:
\begin{frame}...\end{frame}
\frametitle{...}
\framesubtitle{...}
\pause
\alert{...}
\only{...}
\visible{...}
Overlay specifications like <1->
11.1.2 Tips
Replace each \begin{frame} block with a section or paragraph.
Use \section or \subsection to mark the structure.
Convert slide titles (\frametitle) into section headers or bold text.
Remove overlay commands (\pause, <1->,etc.) as they are not meaningful in articles.
Keep the logical order of content and avoid slide based thinking write in continuous text.
11.1.3 tagpdf
Once you have converted the Beamer file to an article format, you can use tagpdf to meet accessibility requirements.
See tagpdf
11.2 Convert Beamer to HTML
You can convert LaTeX documents into HTML using one of the following tools:
1.Pandoc
2.TeX4ht
3.LaTeXML
We’ll introduce how to use Pandoc to convert mainly.
11.2.1 Pandoc
11.2.1.1 Before starting convert
Make sure your .tex file is ready: Use proper heading levels(\section,\subsection, no skipping levels) Add Alt Text to all images Set up tables correctly (avoid using layout tables) Handle unsupported math symbols for MathJax MathJax limits If it’s convenient, convert all TikZ graphics to image format to avoid HTML rendering issues
11.2.1.2 Installation
Click here to install Pandoc
11.2.1.3 Environment Setup
Use Bash or any shell environment.
You can write a script to convert multiple files in a project.
11.2.1.4 Write your conversion script
The Example code shown below converts a whole LaTeX files project to HTML files
Example code (Bash)
#!/bin/bash
# Define folders
FOLDER="your file path"
OUTPUT_FOLDER="output file path"
# Create output folder if it doesn't exist
mkdir -p "$OUTPUT_FOLDER"
# Define bibliography path
BIB_PATH="your reference file"
# Loop through all .tex files recursively
find "$FOLDER" -type f -name "*.tex" | while read file; do
# Get path relative to root folder
rel_path="${file#$FOLDER/}"
rel_dir=$(dirname "$rel_path")
filename=$(basename "$file" .tex)
# Make corresponding output directory
mkdir -p "$OUTPUT_FOLDER/$rel_dir"
# get the directory of the .tex file
file_dir=$(dirname "$file")
#run pandoc inside .tex file's folder
( cd "$file_dir"
# Convert to HTML with math, citations, figures, LaTeX style HTML settings (CSS)
pandoc "$file" -s -o "$OUTPUT_FOLDER/$rel_dir/$filename.html" --mathjax --citeproc --bibliography="$BIB_PATH" --extract-media="$OUTPUT_FOLDER/$rel_dir" --css=../../style.css --metadata=lang:en
# Convert to Markdown
pandoc "$file" -t markdown -s -o "$OUTPUT_FOLDER/$rel_dir/$filename.md"
)
done
echo "All files have been converted to HTML and saved in $OUTPUT_FOLDER"11.2.1.5 Important Notes
1 Math: Add Pandoc option --mathjax to support math render in HTML so that Math expression could be properly shown by HTML
Pandoc .tex -s -o .html --mathjax2 Figures & Graphs:
When you generate figures&graphs, remember use .png or .jpg, not .pdf (HTML can’t read PDF picture). If you use PDF to show figures, please convert them into picture format first.
Add alt text to all images. See Alt Text to add alt text for figures.
3 TikZ:
TikZ is Not supported in HTML directly
Convert TikZ contents to pictures first, then plug them back to LaTeX file
Use standlone
Convert TikZ picture to SVG form.
Resources: Covert LaTeX document containing TikZ pictures’ discussion
covert Tikz discussion TikZJax(covert script tags(containing TikZ code) into SVGs)
4 Citations:
You need to add 2 Pandoc citation options to convert LaTeX citations into readable citations in HTML output:
# Convert to HTML
pandoc "$file" -s -o "$OUTPUT_FOLDER/$rel_dir/$filename.html" --citeproc --bibliography="$BIB_PATH" 5.Layout:
You can use this CSS to get LaTeX-style HTML: LaTeX.css
- Convert to markdown files
Convert original LaTeX files to markdown files is not necessary, but it may make it easier to fix certain accessibility issues by using markdown than handling directly in LaTeX.
pandoc "$file" -t markdown -s -o "$OUTPUT_FOLDER/$rel_dir/$filename.md"11.2.2 TeX4ht
TeX4ht is another tool to convert LaTeX file to HTML.
11.2.3 LaTeXML
LaTeXML could also convert LaTeX file to HTML.
11.3 Convert Beamer to Itk-talk
Itk-talk is not released yet.
…..
11.4 Resources
(Here is some discussions about converting LaTeX file to HTML)