PreTeXt
Write Once, Read Anywhere
Robert A. Beezer |
---|
University of Puget Sound |
Braille Workshop, National Federation of the Blind
July 18, 2022
1. What is PreTeXt?
An authoring and publishing system:
- Extensive support for mathematics (and STEM)
- Designed to create openly licensed materials
- An abstract specification of a scholarly document
- Implementations of conversions to various formats
- A modern replacement for LaTeX
- A commitment to creating accessible materials
- A community of instructors, authors, and publishers
- Guided by 11 principles, e.g. …
- Principle #10: PreTeXt recognizes that scholarly documents involve the interaction of authors, publishers, scholars, instructors, students, and readers, with each group having its own needs and goals.
2. Key Idea: Write Once
The PreTeXt authoring language captures an author's intent and document structure, AS THE AUTHOR WRITES.
An author concentrates on CONTENT and is not able to influence PRESENTATION.
Principle #1: PreTeXt captures the structure of textbooks and research papers
3. Payoff: Read Anywhere
- PDF: print and electronic versions
- HTML: highly interactive, amazingly accessible
- EPUB/Kindle: an improvement on PDF
- Jupyter notebooks: popular for data science, Python programming
- Runestone: open-source hosting of open textbooks, with LMS, more interactivity
- Braille: embossable and electronic, 100% automated, no transcriber
- Slideshows: you are viewing one now
- Principle #3: PreTeXt documents serve as a single source which can be easily converted to multiple other formats, current and future.
4. PDF, for print and screen
- Via LaTeX, two slightly different PDFs are possible.
Electronic is different than hardcopy print.
- Active links, colored?
- Color versus B/W
- One-sided v. two-sided
- Page size, margins
- Example: Judson's Abstract Algebra
5. EPUB
- A superior offline format
- On desktops or laptops
- Or on tablets or dedicated devices
- Example: Foliate reader on Linux
6. HTML
- Everybody's favorite
- Takes advantage of HTML, CSS, Javascript
- Works well on small screens
- Accessible: works well with screen readers
- Math is powered by MathJax
- Many interactive features
- Principle #6: PreTeXt makes use of the full capabilities of the Web.
7. Demonstration
Judson's Abstract Algebra: Theory and Applications
8. Braille Example
AATA's theorem on a presentation of a dihedral group:
7777777777777777777777777777777777777777 ,!orem #e4ba 4 ,! gr|p _% ,d;n _:1 _% n .1: #3 _:1 3si/s ( all products ( ! two ele;ts .2;r & .2;s1 satisfy+ ! rela;ns _% r~n" .k #1 s~2" .k #1 srs .k r~-1 _: 4 7777777777777777777777777777777777777777
9. Braille
Judson's Abstract Algebra: Theory and Applications, as 24 BRF files
10. Braille
Principle #11: PreTeXt recognizes the inherent value in producing material that is accessible to everyone.
Key tools:
- Speech Rule Engine (MathJax) makes Nemeth braille
-
liblouis
makes braille for literary text -
liblouis
formats an embossed page - This talk could be converted to braille! (It was!)
11. Process
- Rip out all mathematical text (easy with PreTeXt)
- Use Speech Rule Engine to convert to Nemeth (and speech strings)
- Use PreTeXt to convert to HTML, substitute Unicode braille
- Use
liblouis
to convert HTML to formatted braille (thanks, ViewPlus)
Very similar to how we make EPUB, with math as speech-enhanced SVG images.
Same process could make a “talking book”, ala DAISY.
Issues!
- Line-breaks for inline math, now simply at 40 cells
- Tactile diagrams ("line art", not images)
12. Cyclic Roots of Unity
Source: TikZ + PreTeXt
\begin{tikzpicture}[scale=1.65] \coordinate (negative-y-axis) at (0,-1.5); \coordinate (positive-y-axis) at (0,1.5); \coordinate (negative-x-axis) at (-1.75,0); \coordinate (positive-x-axis) at (1.75,0); \coordinate (origin) at (0,0); <!-- locations in polar coordinates --> \coordinate (zero) at (0:1); \coordinate (one) at (45:1); \coordinate (two) at (90:1); \coordinate (three) at (135:1); [MORE] \draw [->] (negative-x-axis) -- (positive-x-axis); \draw [->] (negative-y-axis) -- (positive-y-axis); <label xml:id="origin" location="origin" direction="southeast"><m>0</m></label> <label xml:id="posx" location="positive-x-axis" direction="north"><m>x</m>-axis</label> <label xml:id="posy" location="positive-y-axis" direction="east"><m>y</m>-axis</label> \draw (origin) circle (1); \filldraw[fill=black, draw=black] (zero) circle (\pointsize); <label xml:id="power-zero" location="zero" direction="southeast"><m>1</m></label> \filldraw[fill=black, draw=black] (one) circle (\pointsize); <label xml:id="power-one" location="one" direction="northeast"><m>\omega</m></label> \filldraw[fill=black, draw=black] (two) circle (\pointsize); <label xml:id="power-two" location="two" direction="northeast"><m>i</m></label> \filldraw[fill=black, draw=black] (three) circle (\pointsize); <label xml:id="power-three" location="three" direction="northwest"><m>\omega^3</m></label> [MORE] \end{tikzpicture}
13. Process
- Include math in labels in overall conversion to Nemeth via SRE
Analyze and record each label with an XSL stylesheet
- Nemeth braille as Unicode
- Clean-up text, whitespace
- all-math, or no?
Build a "standalone" LaTeX/TikZ file (modification of usual XSL)
- Size the sighted version of the image
- Scale to full embossed page (~ 10-inch square)
- TikZ node for each label; scaled location, box with border, sized for cells
- Use
dvisvgm
specials to insert SVG/XML (“PTX-rectangle
”) - Record height, width, number of cells, direction of label, no cells
-
dvilatex
(yes, that one) -
dvisvgm
to produce SVG Post-process SVG with an XSL stylesheet
- Set text font to be
Braille29
- Build a
svg:text
element at correct location - Set the actual text to be the Unicode cells
- Set text font to be
14. Analysis
Pro: many (most?) mathematicians know and use TikZ for diagrams
Pro: authors need to add semantic information about labels
Con: its complicated
- Three XSL stylesheets
- Two dubious executables:
dvilatex
,dvisvgm
- Six-step process (can be automated)
15. Conclusion
Principle #8: PreTeXt is free: the software is available at no cost, with an open license. The use of PreTeXt does not impose any constraints on documents prepared with the system.
Links
Acknowledgements
- PreTeXt developers, contributors, and authors
- American Action Fund (National Federation of the Blind)
- American Institute of Mathematics
- Partial support for this work was provided by the National Science Foundation's Improving Undergraduate STEM Education (IUSE) program under Award Nos. 1022574, 1626455, 1821706. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.