Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[NEW] PreFigure for diagrams

41 views
Skip to first unread message

Rob Beezer

unread,
Nov 23, 2024, 8:46:26 PM11/23/24
to pretext-...@googlegroups.com
[Ed. From David Austin.]

PreFigure diagrams can now be authored inside a PreTeXt document. What is
PreFigure? Said simply, PreFigure is to figures what PreTeXt is to text. Or,
more technically, it is an XML language for authoring accessible mathematical
diagrams to include in scholarly documents.

In the same spirit as PreTeXt, a PreFigure author writes an XML description of a
diagram without worrying too much about the details of how the diagram will be
rendered. The language is designed to be intuitive and to allow authors to
focus on the structure and meaning of the diagram.

From the same PreFigure XML source, an author can

-- create SVG, PDF, and PNG versions of the diagram for sighted readers and for
inclusion in HTML, PDF, and EPUB documents.
-- add annotations that allow all readers to explore the diagram interactively
in a screenreader with authored descriptions vocalized, important features
highlighted, and graphs sonified upon request. See the PreTeXt sample article
for an example.
-- produce a tactile version of the diagram ready to be embossed and included in
a braille document.

PreFigure handles the details of these conversions without requiring an author
to be familiar with, for example, the conventions of tactile diagrams.

Maybe you are already comfortable with TikZ or sageplot or some other way of
producing diagrams. Why would you want to learn a new system? Here are some
possible answers.

PreFigure is designed specifically for creating diagrams rather than, say, a
computer algebra system that also makes diagrams. As such, it is meant solely
to help authors communicate visual information easily and effectively.

The language design is very much inspired by PreTeXt, and PreTeXt authors are
likely to feel at ease with PreFigure relatively quickly and to enjoy authoring
diagrams in the same way they enjoy authoring PreTeXt documents.

The challenges involved in making accessible diagrams from TikZ form the
original motivation for PreFigure. Experience shows that annotated diagrams can
more effectively communicate visual information to all readers. While it is
possible you'll never need to create a physical tactile diagram, examining the
tactile versions of your diagrams has the potential to improve your practices
for authoring diagrams, even for sighted readers. This is an example of the
general principle that attention to accessibility issues can improve everyone's
experience.

While PreFigure will continue to be a work in progress, the next goal is to
build and support a community of users. I read the PreTeXt discussion groups,
regularly attend drop-ins, and am eager to respond to requests for help or
additional, improved features.

Ready to get started? PreFigure diagrams can be produced using a standalone
application or as part of a PreTeXt document. Perhaps you would like to start
up a PreFigure codespace and experiment with some of the provided examples.
PreFigure can also be installed with "pip install prefig[pycairo]" in a PreTeXt
codespace with diagrams written inside a PreTeXt document generated as prefigure
assets (assuming pretext >=2.9.2). Instructions for installing PreFigure
locally as well as documentation is available at the project home page.

Thanks to both Rob and Oscar for their considerable efforts to integrate
PreFigure into PreTeXt.

Rob Beezer

unread,
Nov 24, 2024, 2:03:34 PM11/24/24
to pretext-...@googlegroups.com
This group is generally meant to be low-traffic, with announcments and not
discussion. But I want to abuse my posting privileges and pile-on with an
enthusiastic endorsement of PreFigure.

As David describes, it has been built with this eventual integration in mind,
along with having a philosophy familiar to PreText authors. And it is plowing
new ground by making tactile diagrams a feature from the start, rather than a
poor bolt-on. So I will be encouraging authors and publishers to use PreFigure
as much as possible, both as a cheerleader and by providing support from within
PreTeXt proper. And with increased use, PreFigure will improve further, just as
the integration effort has smoothed-off a few rough edges already.

We allow for images/diagrams built from source in a variety of languages:

PreFigure
Asymptote
Mermaid
LaTeX (TikZ, xypic, etc)
Sage

To add more languages, I think they will need to have a very stong use case.
For example, Mermaid has a very uncomplicated syntax and produces some very
specific types of diagrams, such as git-commit graphs. So if we did not already
have Mermaid, an argument could be made again today to add it. For more
general-purpose languages, I think we have good support at present, and our
effort should go into extending PreFigure where new capabilities are needed.
(And if you know Python well, being a contributor to the PreFigure project would
be a good way to also support PreTeXt without learning XSL.)

Rob
Reply all
Reply to author
Forward
0 new messages