Building a braille output in PreTeXt codespace

20 views
Skip to first unread message

Alexei Kolesnikov

unread,
Aug 8, 2025, 11:58:35 PMAug 8
to PreTeXt development
This is a question about PreTeXt CLI and codespace.

Short version. I am trying to build a braille output from a PreTeXt article in codespace.

$ pretext build braille
leads to an error that braille target is not found. 

Adding <target name="braille" format="braille" />
to the publication file fixes that, but leads to 

critical: cannot import name 'braille_format' from 'pretext.core' (/opt/venv/lib/python3.11/site-packages/pretext/core/__init__.py)

because the lines with braille are commented out in the __init__.py file.

Does the capability to build a braille output exist in the codespace?

Longer version (why).
Recently, two students working with Al Maneki managed to build a GPT that produces PreTeXt markup from either spoken mathematical text or from a PDF file. Not perfect, but pretty good: if a blind student is trying to get homework solutions to her professor or the professor trying to get the handout into an accessible form, this would go a long way.

The hope is to use GPT (or some other AI tool) to generate a PreTeXt file from either spoken input or from a PDF, and then pass the PreTeXt file to codespace to get either braille or HTML (for the student) or PDF (with student's homework solutions).

Maybe codespace is not the way to do it? 

Any information would be appreciated.

Best regards,

--Alexei

Oscar Levin

unread,
Aug 9, 2025, 9:48:41 AMAug 9
to PreTeXt development
I haven't figured out how to get braille to work with the CLI yet; recently we changed how core pretext imports the braille_format.py file, so now this should be possible, I just haven't had a chance to implement it on the CLI side.  I can try to tackle that soon.

David Austin

unread,
Aug 9, 2025, 4:04:23 PMAug 9
to prete...@googlegroups.com
For Alexei:  Once Oscar has this working, I think the pretext format you want is "braille-emboss" or "braille-electronic" rather than just "braille", which is for math elements only.  At least, that's the case with the pretext/pretext script, and I assume that the CLI just passes the format on to the pretext core.

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/bbfc6568-c11a-4746-9355-2383930fc380n%40googlegroups.com.

Rob Beezer

unread,
Aug 9, 2025, 8:39:23 PMAug 9
to prete...@googlegroups.com
Late to the party, and it is a party, since I am very excited with what
transpired at the last meeting of the braille group.

Seems AI, when fed the PreTeXt Guide, can churn out pretty nice PreTeXt source,
and then that could be made into braille (or anything else!). Sure to be some
bumps in the road, but very promising. Alexei - I hope you can keep us posted
on progress from the students and your own experiments.

While Oscar tackles the problem of making this easier, you can make braille
today, if

1. You use the pretext/pretext script

2. Install MathJax to run offline via node

3. Install liblouis with its Python bindings

Rob



On 8/9/25 13:04, David Austin wrote:
> For Alexei:  Once Oscar has this working, I think the pretext format you want is
> "braille-emboss" or "braille-electronic" rather than just "braille", which is
> for math elements only.  At least, that's the case with the pretext/pretext
> script, and I assume that the CLI just passes the format on to the pretext core.
>
> On Sat, Aug 9, 2025 at 9:48 AM Oscar Levin <oscar...@gmail.com
> <mailto:oscar...@gmail.com>> wrote:
>
> I haven't figured out how to get braille to work with the CLI yet; recently
> we changed how core pretext imports the braille_format.py file, so now this
> should be possible, I just haven't had a chance to implement it on the CLI
> side.  I can try to tackle that soon.
>
> On Friday, August 8, 2025 at 9:58:35 PM UTC-6 alexei.s....@gmail.com
> <mailto:alexei.s....@gmail.com> wrote:
>
> This is a question about PreTeXt CLI and codespace.
>
> *Short version.* I am trying to build a braille output from a PreTeXt
> article in codespace.
>
> $ pretext build braille
> leads to an error that braille target is not found.
>
> Adding <targetname="braille"format="braille"/>
> to the publication file fixes that, but leads to
>
> critical: cannot import name 'braille_format' from 'pretext.core' (/opt/
> venv/lib/python3.11/site-packages/pretext/core/__init__.py)
>
> because the lines with braille are commented out in the __init__.py file.
>
> Does the capability to build a braille output exist in the codespace?
>
> *Longer version (why).*
> Recently, two students working with Al Maneki managed to build a GPT
> that produces PreTeXt markup from either spoken mathematical text or
> from a PDF file. Not perfect, but pretty good: if a blind student is
> trying to get homework solutions to her professor or the professor
> trying to get the handout into an accessible form, this would go a long way.
>
> The hope is to use GPT (or some other AI tool) to generate a PreTeXt
> file from either spoken input or from a PDF, and then pass the PreTeXt
> file to codespace to get either braille or HTML (for the student) or PDF
> (with student's homework solutions).
>
> Maybe codespace is not the way to do it?
>
> Any information would be appreciated.
>
> Best regards,
>
> --Alexei
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> bbfc6568-c11a-4746-9355-2383930fc380n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/bbfc6568-
> c11a-4746-9355-2383930fc380n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CANXmVMDTJ8LH_%3DcZwDtE25uv3zAAvEmkK%2BjFj3zYi7BxA7WcJw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/
> CANXmVMDTJ8LH_%3DcZwDtE25uv3zAAvEmkK%2BjFj3zYi7BxA7WcJw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

David Austin

unread,
Aug 9, 2025, 9:08:25 PMAug 9
to prete...@googlegroups.com
I made a PDF of the prefigure documentation at the request of one of the students.  Sorry I missed that meeting.

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDA0My5iZWV6ZXI.1754786361%40pnsh.

Oscar Levin

unread,
Aug 9, 2025, 11:54:45 PMAug 9
to PreTeXt development
I found the issue (I forgot to add the braille_format.py file as an "include" in my pyproject.toml file).  The good news is if you got to that error, then the codespace is already doing the right thing to make liblouis available.  So once I release the next version of the CLI (probably Monday), you will be able to build braille targets in a codespace.

And to clarify, the target in project.ptx should be <target name="braille" format="braille" braille-mode="emboss"/> (or braille-mode="electronic"; emboss is the default if you leave the braille-mode out). 

Alexei Kolesnikov

unread,
Aug 14, 2025, 1:16:01 PMAug 14
to prete...@googlegroups.com
Thank you, Oscar!

I verified that 
$ pretext build braille
works in CLI after updating to pretext version 2.26.0 (and adding the braille target to project.ptx, as you and David described).

This command does not work in the Codespace somehow; I am getting
"
successful application of /root/.ptx/2.26.0/core/xsl/pretext-braille-preprint.xsl
critical: name '_is_py3' is not defined
"
and then it dies.

Best regards,

--Alexei


You received this message because you are subscribed to a topic in the Google Groups "PreTeXt development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-dev/K6qRd-RO-Ek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/fc862462-9747-437c-a46d-2a0719799249n%40googlegroups.com.

Oscar Levin

unread,
Aug 17, 2025, 4:09:01 PMAug 17
to PreTeXt development
It looks like the version that of the python bindings that the container is installing from the deb repository is broken.  I'm going to try to upgrade the docker image to use the just-released debian trixie-slim as it's base image, otherwise I'll try to build from source, which might be better anyway?  Stay tuned.
Reply all
Reply to author
Forward
0 new messages