ampersands in Jupyter

10 views
Skip to first unread message

Alex Jordan

unread,
Jun 10, 2026, 12:18:21 PM (10 days ago) Jun 10
to prete...@googlegroups.com
In math content source, do we want & to work for an ampersand, or do we want people to use \amp?

Currently in the sample article, both are used in math. In the conversion to Jupyter, the actual ampersand in source (&) gets converted to & in the .ipynb file. MathJax treats the & like it should, but then you end up seeing the trailing "amp;".

One option to deal with this is to require/encourage authors only use \amp. If this is the way to go, I could patrol the sample documents and make that change. And patrol the guide to educate about expectations here.

Another option is to study the text templates in use with the Jupyter conversion, and stop & from turning into &





Rob Beezer

unread,
Jun 11, 2026, 12:25:26 PM (9 days ago) Jun 11
to prete...@googlegroups.com
Dear Alex,

As you know it takes a long time to appreciate that in XML "& a m p ;" *well and
truly is* the characters you type when you mean an ampersand. It *is* the
ampersand. A beauty of XML is that only five characters have escaped versions
and only two of them seem to be important or necessary. (The other being the
*character* & l t ;.)

So we should never make out & a m p ; to be second-class in any way.

\amp is a great *convenience* and many will want to use it. No reason not to
highlight it, but not at the expense of the escaped version.

Suppose you make a 10 x 10 matrix and put it into a "CDATA" because of all the
ampersands. (Forget I suggestd that!) The first bit of processing we do is
going to make those ampersands into the escaped versions. So we cannot ignore them.

What is going on with Jupyter? We make HTML and we have to stuff it into a JSON
container. How many characters in JSON need escaped versions? Aaargh! Worse
than LaTeX? I don't even want to count. Something is sneaking through when the
LaTeX inside #m and #md gets processed. It'd be good to stamp that out. I
think that is what we need here.

Thanks,
Rob
> --
> 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/
> CA%2BR-jrfX1x98Rs6%3DbYdOR3OChnW6F36WB8wdqkPLQpFGzXEUnw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/CA%2BR-
> jrfX1x98Rs6%3DbYdOR3OChnW6F36WB8wdqkPLQpFGzXEUnw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages