mathjax rendering only part of page

49 views
Skip to first unread message

David Farmer

unread,
Sep 30, 2021, 7:22:09 PM9/30/21
to PreTeXt support

On this page, built relatively recently:

https://activecalculus.org/multi/S-10-7-Optimization.html

Not all of the math renders. In particular, the math
neat the top of the page does not render.

I see an error message from tex-chtml.js:

Uncaught (in promise) DOMException: Index or size is negative or greater than the allowed amount

I think that is a Javascript error, which is being reported by MathJax.

The previous section, and the next section, render okay.

Any ideas?

I am going to see if I can find a particular equation which is causing the
problem.


Rob Beezer

unread,
Sep 30, 2021, 7:39:04 PM9/30/21
to pretext...@googlegroups.com
Confirming everything you report, Firefox on Ubuntu.

Split is in the middle of a sentence, two sentences before Definition 10.7.4.

David Farmer

unread,
Sep 30, 2021, 7:42:48 PM9/30/21
to PreTeXt support

Here is the problem, which is most likely to arise from
legacy LaTeX converted to PreTeXt, or maybe an author who
has ingrained LaTeX habits.

If you have ``LaTeX style smart quotes'' in your PreTeXt
source, then the backticks will make it into the HTML,
and can cause MathJax to choke.

This is slightly difficult to diagnose, because MathJax 3
typesets everything at once, or at least in a seemingly
random order, so tracking down the problematic text is
not simple.

I edited the problematic page to fix that particular problem.

I will file an issue, suggesting that authors get a warning
from backticks in the source.

Are there legitimate reasons for a backtick in PreTeXt source?
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pretext-suppo...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/alpine.LRH.2.21.2109301918010.25853%40li375-150.members.linode.com.
>

David Farmer

unread,
Sep 30, 2021, 7:49:18 PM9/30/21
to pretext...@googlegroups.com


> Split is in the middle of a sentence, two sentences before Definition 10.7.4.

Red herring. The problem was in exercises 18 and 19.

Rob Beezer

unread,
Sep 30, 2021, 8:09:38 PM9/30/21
to pretext...@googlegroups.com
Nice work! And to confirm, this is outside of mathematical content (like not in
a \text{} in a \cases). Is MathJax starting to think about ASCII math when it
sees the first backtick?

Would this help, if we were to then configure MathJax to not look for anything else?

https://github.com/rbeezer/mathbook/issues/611

> Are there legitimate reasons for a backtick in PreTeXt source?

I can't think of one that should have any special meaning. It would show up
inside "c" and friends, if you were to, say, write about Markdown (in PreTeXt?).

We do suggest the character is "OK" and don't prohibit two in a row.

Subsubsection 4.1.4.3: Ambiguous Keyboard Characters
https://pretextbook.org/doc/guide/html/topic-paragraphs.html#subsubsection-3

A long-standing goal is that "<" and "&" are the only dangerous characters.

Rob

Rob Beezer

unread,
Sep 30, 2021, 8:19:07 PM9/30/21
to pretext...@googlegroups.com
We actively discourage accidental LaTeX-isms in source that try to migrate to
HTML that MathJax might hit on.

\(

\begin{

receive an inserted U+200B (a zero-width space) that throws off MathJax. Might
it be enough to break up a pair of backticks this way?

Rob Beezer

unread,
Oct 30, 2021, 1:23:23 PM10/30/21
to pretext...@googlegroups.com
Thanks, David, for the original report on this, plus the necessary (excellent!)
sleuthing to locate the cause.

Some commits just now should make mathJax processing much more targeted to
actual mathematics, and "running text" should be even more free to use
characters that "accidentally" look like markup for other purposes. At a cost
of possibly introducing some low-level bug related to rendering mathematics in
HTML, so everybody can keep an eye out for that.

Somewhat entertaining to see Tom Judson get bit by the exact same problem very
shortly afterward. ;-)

Rob
Reply all
Reply to author
Forward
0 new messages