MathJax / Runestone rendering race condition

45 views
Skip to first unread message

Andrew Scholer

unread,
Nov 14, 2025, 11:52:40 AM11/14/25
to prete...@googlegroups.com
While looking at Chrissy's sample page from another post, I noticed some rendering issues with MathJax in Runestone components. In particular, matching widgets and Parsons, though I am not sure it is restricted to those widgets.

Pretty reliably, if I refresh while looking at that content, I get:
image.png

The Parsons below that looks like:
image.png


In the log I get:
"Uncaught (in promise) TypeError: Cannot read properties of null (reading 'replaceChild')" from tex-chtml.js

It looks like MathJax might be trying to render those blocks while the original source is being transformed by the RS code.

It seems like there must be a race condition involved as the first load of the page is more likely to work than a refresh. And Firefox doesn't seem to exhibit the same behavior.

Andrew Scholer

Rob Beezer

unread,
Nov 14, 2025, 2:25:59 PM11/14/25
to prete...@googlegroups.com
And when I followed Chrissy's link, I noticed that the very tip-top of the page
had a few (3-5) bits of inline math which were not rendering, either.

Not because I think it will solve everything (or anything), but I'd really like
to move to MJ4 and get these sorts of things sorted out in that configuration.
Effort into MJ3 seems better directed elsewhere? (Not to discourage debugging
this present problem!)

Rob

On 11/14/25 08:52, Andrew Scholer wrote:
> While looking at Chrissy's sample page from another post, I noticed some
> rendering issues with MathJax in Runestone components. In particular, matching
> widgets and Parsons, though I am not sure it is restricted to those widgets.
>
> Link to page I noticed it on:
> https://tanaquil18.github.io/matrixcalculations/sec-LUdecomposition.html#rqs-
> LUdecomposition <https://tanaquil18.github.io/matrixcalculations/sec-
> LUdecomposition.html#rqs-LUdecomposition>
>
> Pretty reliably, if I refresh while looking at that content, I get:
> image.png
>
> The Parsons below that looks like:
> image.png
>
>
> In the log I get:
> "Uncaught (in promise) TypeError: Cannot read properties of null (reading
> 'replaceChild')" from tex-chtml.js
>
> It looks like MathJax might be trying to render those blocks while the original
> source is being transformed by the RS code.
>
> It seems like there must be a race condition involved as the first load of the
> page is more likely to work than a refresh. And Firefox doesn't seem to exhibit
> the same behavior.
>
> Andrew Scholer
>
> --
> 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/
> CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-ABoCPVaaYgteJgE4tg%40mail.gmail.com <https://
> groups.google.com/d/msgid/pretext-dev/CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-
> ABoCPVaaYgteJgE4tg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Chrissy Safranski

unread,
Nov 14, 2025, 2:49:41 PM11/14/25
to PreTeXt development
This has been driving me crazy (okay, crazier).  It comes and goes and I couldn't figure out a rhyme or reason why. It happens when I do pretext view a lot, less when I'm looking at a deployed page, and more in Chrome than in Firefox.  But I thought maybe it was just me.

Thank you for noting this! 
Chrissy

Rob Beezer

unread,
Nov 14, 2025, 2:56:13 PM11/14/25
to prete...@googlegroups.com
No, you are not crazy, Chrissy!

Shoulda said - Firefox for me.

And I've had this problem with the sample article totally hanging up when served
for pretextbook.org, by some appearances due to the MathJax CDN. (Could be
related to that site migrating to new servers...)

Something is afoot, it feels like.

Rob

On 11/14/25 11:49, Chrissy Safranski wrote:
> This has been driving me crazy (okay, crazier).  It comes and goes and I
> couldn't figure out a rhyme or reason why. It happens when I do pretext view a
> lot, less when I'm looking at a deployed page, and more in Chrome than in
> Firefox.  But I thought maybe it was just me.
>
> Thank you for noting this!
> Chrissy
>
> On Friday, November 14, 2025 at 2:25:59 PM UTC-5 Rob Beezer wrote:
>
> And when I followed Chrissy's link, I noticed that the very tip-top of the page
> had a few (3-5) bits of inline math which were not rendering, either.
>
> Not because I think it will solve everything (or anything), but I'd really like
> to move to MJ4 and get these sorts of things sorted out in that configuration.
> Effort into MJ3 seems better directed elsewhere? (Not to discourage debugging
> this present problem!)
>
> Rob
>
> On 11/14/25 08:52, Andrew Scholer wrote:
> > While looking at Chrissy's sample page from another post, I noticed some
> > rendering issues with MathJax in Runestone components. In particular,
> matching
> > widgets and Parsons, though I am not sure it is restricted to those widgets.
> >
> > Link to page I noticed it on:
> > https://tanaquil18.github.io/matrixcalculations/sec-
> LUdecomposition.html#rqs- <https://tanaquil18.github.io/matrixcalculations/
> sec-LUdecomposition.html#rqs->
> > LUdecomposition <https://tanaquil18.github.io/matrixcalculations/sec-
> dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> > CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-ABoCPVaaYgteJgE4tg%40mail.gmail.com
> <http://40mail.gmail.com> <https://
> > groups.google.com/d/msgid/pretext-dev/CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-
> <http://groups.google.com/d/msgid/pretext-dev/
> CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05->
> > ABoCPVaaYgteJgE4tg%40mail.gmail.com?utm_medium=email&utm_source=footer
> <http://40mail.gmail.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/09cfde56-e6da-438a-ada7-8e9e63859028n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/09cfde56-e6da-438a-
> ada7-8e9e63859028n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Chrissy Safranski

unread,
Mar 5, 2026, 10:28:42 PM (12 days ago) Mar 5
to PreTeXt development
I recently rebuilt and deployed with CLI 2.37.1 to see if things were better with mathjax in runestone components, and I think they are in the components themselves - at least, all of the math appears to be rendering for me.  Yay!  However, in the feedback to answers, I'm still reliably seeing a lot of unrendered math.  I see it in both Chrome and Firefox and cleared my cache, because that always gets me.  For example, in  Activity 1.5.6: Consistent or inconsistent?

Not sure if there's anything to be done but figured it was worth a report.

Chrissy

Chrissy Safranski

unread,
Mar 6, 2026, 4:05:41 PM (11 days ago) Mar 6
to PreTeXt development
Rob showed in a meeting today that the same thing happens with math notation in feedback to a multiple choice when the question is viewed within a knowl like in an appendix.  Maybe the math not rendering in a feedback in my project is connected because the multiple choice is in a tabbed-task?

Chrissy

Andrew Scholer

unread,
Mar 7, 2026, 1:03:07 PM (11 days ago) Mar 7
to PreTeXt development
I think I identified the issue. PR submitted to Runestone:
https://github.com/RunestoneInteractive/rs/pull/1172

Bradley Miller

unread,
Mar 8, 2026, 3:59:05 PM (10 days ago) Mar 8
to prete...@googlegroups.com
I was able to find and recreated Chrissy’s problem, even after applying the PR from Andrew.  But I have it fixed now and released 7.11.18.  

Rob, maybe this will fix your problem with the knowled questions.

Brad

Brad Miller
Professor Emeritus, Luther College
Founder, Runestone Academy LTD
Blog: http://reputablejournal.com

Set up a time to meet with me.


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/13d15b83-26cd-4132-82f6-8f502b81bb2dn%40googlegroups.com.

Rob Beezer

unread,
Mar 8, 2026, 6:52:28 PM (9 days ago) Mar 8
to prete...@googlegroups.com
On 3/8/26 12:58, Bradley Miller wrote:
> Rob, maybe this will fix your problem with the knowled questions.
Bingo! Fixed now.

Rebuilt the version on Runestone Academy and #feedback for a #choice in a
multiple choice #exercise that is the content of a knowl, now renders the math
correctly.

Thanks, Brad, Andrew, and Chrissy, for the work on this one.

Rob

Chrissy Safranski

unread,
Mar 9, 2026, 2:23:37 PM (9 days ago) Mar 9
to PreTeXt development
Yes, it appears to be fixed now for me too!  Thank you for tracking this down, Andrew and Brad!

Chrissy

Reply all
Reply to author
Forward
0 new messages