MathJax inline math symbol

16 views
Skip to first unread message

Andrew Scholer

unread,
Feb 12, 2026, 11:55:30 AMFeb 12
to prete...@googlegroups.com
The MathJax settings for RS vs PreTeXt currently disagree on what delimiters to use for inline math. RS has:
inlineMath: [['\\(','\\)'], ['$','$']],

While PTX has:
inlineMath: [['\\(','\\)']],

This means that text like:

"Shipping on an order over $100 is free. Shipping on an order less than that but more than $50 is 10% of the order."

Is, as far as I can tell, impossible to author so that it will show up correctly on both a book page (PTX controlled) and the RS assignment page (RS controlled).

Is there a good workaround?

If not, what is the best resolution?


Rob Beezer

unread,
Feb 12, 2026, 2:47:38 PMFeb 12
to prete...@googlegroups.com
Dear Andrew,

As you are well aware, two things are going on here:

* Runestone is allowing arbitrary input from readers/students.

* Dollar signs as delimiters for math are common.

Students will be better served if they learn the habit early of using an
escaped, asymmetric, set of delimiters, \( and \). Rather than taking the
dollar sign out of circulation.

(Aside: ever written about mathematical finance with LaTeX? I have...)

So a "workaround" would be to require readers to use \( and \). I realize that
almost every thing they see online will contradict this.

Why does PreTeXt not have this problem with author-input?

* Unambiguous delimiters, <m>...</m>.

* The conversion to HTML places a span.process-math around the math bits, and
MathJax is configured to only look there, and ignore the rest of a page.

* The conversion to LaTeX replaces "dangerous" characters with unambiguous or
escaped versions. Like a bare "%" becomes a "\percent" (iirc). I don't think a
percent-sign is a problem for Andrew's example, but a dollar-sign as currency is
a (similar) problem in a short-answer response.

* In the early days, when our skills were not as evolved, we had elements like
<percent/> to deal with this situation.

Are we expecting readers to provide short-answer responses where they escape
dollar signs used as currency (\$)? I'm not even sure if that helps or not?

The conclusion I reach is that Runestone needs to parse reader responses to
identify what is math, and what is not math. And once that hard work is done,
you might as well insert span.process-math along with conversion of
dollar-sign delimiters to parentheses delimiters. Then the rest of the input
can be ignored by MathJax since it will be outside of any span.process-math.

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/
> CACm44N99MP-x3FjzU0XGCK%2Bz-B-ZdosH%3DSJ%3DMU-FvekvEYfGRw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/CACm44N99MP-x3FjzU0XGCK%2Bz-B-
> ZdosH%3DSJ%3DMU-FvekvEYfGRw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Andrew Scholer

unread,
Feb 12, 2026, 5:31:37 PMFeb 12
to PreTeXt development
Thanks Rob.

I don't have a dog in the "how students should write math answers" fight.  But there are lots of PreTeXters who do and also rely on Runestone. So this is essentially a cross-post to make sure everyone is seeing everything.

There does need to be a way to write something with two $ signs in PreTeXt and have it work in Runestone. I do agree that fix likely needs to live on the Runestone side, but it will affect anyone who uses the combined package.

One other workaround might be for Runestone to filter the runestone-manifest and escape $'s. That feels hacky. And it could open up new weird cases. But that would allow for the assignments page view of a problem differ from the "on the page" content.

Rob Beezer

unread,
Feb 13, 2026, 4:03:20 PMFeb 13
to prete...@googlegroups.com
Aah, I misunderstood what you were driving at here.

PreTeXt has no qualms about bare dollar-signs in the HTML output, since we
*know* they will never be misunderstood by MathJax. Besides not having them
listed as delimiters, we only let MathJax "see" span.process-math and we only
ever put \(, \) in those span for inline math.

Now Runestone puts PreTeXt-generated HTML for exercises onto the assignment
page, right?

Would the following work?

- the MathJax configuration for the assignment page also restricted attention to
span.process-math.

- a reader's short-answer were wrapped in a div.process-math (or similar) and
that was also in the MathJax configuration.

You would still have the problem of ill-formed reader-response, which you could
parse (or not). Maybe some nearby text could suggest \(, \) and you could not
have dollar-signs as delimiters.

Rob
> dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> > CACm44N99MP-x3FjzU0XGCK%2Bz-B-ZdosH%3DSJ%3DMU-
> FvekvEYfGRw%40mail.gmail.com <http://40mail.gmail.com>
> > <https://groups.google.com/d/msgid/pretext-dev/CACm44N99MP-
> x3FjzU0XGCK%2Bz-B- <https://groups.google.com/d/msgid/pretext-dev/
> CACm44N99MP-x3FjzU0XGCK%2Bz-B->
> > ZdosH%3DSJ%3DMU-FvekvEYfGRw%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/68db7bf8-06ff-4a92-ab6a-61283abed7d9n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/68db7bf8-06ff-4a92-
> ab6a-61283abed7d9n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages