Braille from PreTeXt

Robert A. Beezer
University of Puget Sound

Workshop: Automated Production of Braille Textbooks; American Institute of Mathematics (Virtual)

August 3, 2020

1 PreTeXt

2 What is PreTeXt

  • Software to translate source material into multiple output formats
  • A formal specification of allowable XML elements in source material
  • A self-publishing system for scholarly documents, recognizing the publisher's role
  • Advocate for accessible material, leading by example
  • A community of authors, publishers, instructors, and developers

3 History

  • Initiated May 2013 with a Shuttleworth Flash Grant, outgrowth of National Science Foundation CCLI grant, 2010-2014.

  • Conversion to EPUB initiated 2014, resurrected early 2016, completed 2020. (w/ Mitch Keller)

  • May 2018, AIM Workshop: “Web accessibility of mathematics”. MathJax project, screen-reader developers, vast improvements in PreTeXt HTML.

  • August 2018: Martha Siegel, Alexei Kolesnikov (Towson State) contact David Farmer. Telephone conversation about text processing.

  • January 2019, JMM Baltimore: Volker Sorge presents accessibility improvements for MathJax and Speech Rule engine, including braille production. RAB preview in hallway.

4 History (continued)

  • January 2019, JMM Baltimore: Brian Conrey (AIM), David Farmer, Martha Siegel, Alexei Kolesnikov, Al Maneki, Karen Herstein

    Then RAB, …

    Then Volker Sorge, …

  • Summer 2019: Beyond proof-of-concept with National Federation of the Blind support.

  • January 2019, JMM Denver: AIM issues press release, shows physical samples at exhibit area.

  • August 2020: Here we are. Another AIM Workshop!

5 Why PreTeXt?

  • Clearly separate content, presentation
  • Similarly, clearly separates authoring from publishing
  • Kay O'Halloran, Summer 2017: three “languages”:

    • math, clearly identified, syntax
    • literary text, with careful markup, such as for emphasis
    • structure via markup

    We capture the author's intent at the instant they author.

  • With no necessity for assumptions, we can convert to any presentation format
  • Now braille seems easy

6 Life of a Theorem

7 Judson, Abstract Algebra, Proposition 4.12

Proposition:

Let \(G\) be a cyclic group of order \(n\) and suppose that \(a\) is a generator for \(G\text{.}\) Then \(a^k=e\) if and only if \(n\) divides \(k\text{.}\)

8 A Variety of Formats

  • Softcover: $16.95 from Amazon, and others ($21 in UK)
  • PDF: electronic, free, maximally non-accessible
  • HTML: electronic, free, very accessible, math via screen-readers
  • EPUB: accessible, but maybe not the math bits
  • Kindle: hmmmm.
  • Source: PreTeXt using XML syntax
<proposition xml:id="proposition-cyclic-subgrp-order">
    <statement>
        <p>
        Let <m>G</m> be a cyclic group of order <m>n</m> and 
        suppose that <m>a</m> is a generator for <m>G</m>.
        Then <m>a^k=e</m> if and only if <m>n</m> divides <m>k</m>.
        </p>
    </statement>
    <proof>
    ........
    </proof>
</proposition>

9 Braille Pipeline

10 Pipeline: MathJax, Speech Rule Engine

  • Isolate every mathematical expression, found in <m>, <md>, etc elements, in syntax. Lightly wrap each one with location information, make one huge web page.

  • Run MathJax over this page, converting each expression to MathML. (Can also convert to SVG for use in EPUB format.) Creates another webpage. [Show AATA SVG page.]

  • Run Speech Rule Engine (SRE) over this second page, converting each MathML expression into Nemeth braille. (Can also convert to speech for audiobooks or DAISY format.) Now have a third web page of representations of the math bits.

11 Pipeline: PreTeXt, liblouis

  • Start over, and convert original document to the “usual” HTML. However

    • Replace math bits with braille (via location information)
    • Adjust and/or enhance literary and structural parts for subsequent conversion.

  • Run the liblouis converter over this enhanced HTML page to create a BRF file. (Braille ASCII representations of the 64 6-dot patterns, with some page formatting.) liblouis allows some CSS-like control.

    • Line breaks, page breaks
    • Page numbers, Table of Contents
    • Centering, emphasis, quotes, etc.
    • SRE Unicode braille converts to Braille ASCII

  • All of the above accomplished with Python script at once:

    $ pretext -c all -f braille aim-braille.xml
    

12 Braille Examples

13 Life of a Simple Equation

Judson, Proposition 4.12 source:  … <m>a^k=e</m>

MathML from MathJax:

<math>
    <msup>
        <mi>a</mi>
        <mi>k</mi>
    </msup>
    <mo>=</mo>
    <mi>e</mi>
</math>

Unicode braille from SRE:  ⠁⠘⠅⠐⠀⠨⠅⠀⠑

Braille ASCII (BRF) from liblouis, PreTeXt customization gives Nemeth indicators:

_% a~k" .k e _:

14 Life of a Theorem, Reprised, HTML

Enhanced PreTeXt HTML (w/ braille, liblouis precursor)

<article class="proposition theorem-like" data-braille="theorem-like">
    <h6 class="heading">
        <span class="type">Proposition</span>
        <span class="space"> </span>
        <span class="codenumber">4.1.12</span>
        <span class="period">.</span>
    </h6>
    <p>Let <i class="one-letter">G</i> be a cyclic 
    group of order <i class="one-letter">n</i> and suppose 
    that <i class="one-letter">a</i> is a generator for 
    <i class="one-letter">G</i>. Then 
    <nemeth class="inline">⠁⠘⠅⠐⠀⠨⠅⠀⠑</nemeth> if and only if 
    <i class="one-letter">n</i> divides <i class="one-letter">k</i>.</p>
</article>

15 Life of a Theorem, Reprised, BRF

Liblouis output, via (supported) PreTeXt customizations

7777777777777777777777777777777777777777
,proposi;n  #d4a4ab 4
  ,let .2;,g 2 a cyclic gr|p ( ord} .2;n
& suppose t .2a is a g5}ator = .2;,g4
,!n _% a~k" .k e _: if & only if .2;n
divides .2;k4
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

16 Horizon

17 Horizon

  • Migrate to MathJax 3
  • Utilize SRE more directly and efficiently
  • Iterate!
  • Canonical print page numbers into BRF format
  • Front matter, back matter (index)

18 Conclusion

pretextbook.org

Acknowledgements:

  • PreTeXt developers, contributors, and authors
  • 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.