Well into the weeds on this one. ;-) Browsers have been inclined to put a
line-break right after some inline math (MathJax) and before "clause-ending
punctuation," such as a period or a comma. Which looks really unprofessional.
So we have been absorbing the punctuation into the math with a \text{} and
scrubbing it from where it was authored. You're welcome! Good, but maybe not
so optimal for the math bits when used in other ways (braille). MathJax 4 has
this under control now.
Experiment: hack into our fix, turn it off, but also add a " FOO " after the
punctuation and before whatever comes next. To make these situations easy to
locate. Build Judson's AATA, chunked by chapter. Investigate. Chapters 5, 8,
17, 21, 23 (for no particular reason). 907 locations where punctuation follows
math. 7 are a bad line-break. And never more than two in a single chapter.
Now, turn on MathJax 4 and rebuild. All 7 bad breaks behave themselves.
Chapters 5, 8 and 17 show no bad breaks (didn't cruise the others).
https://pretextbook.org/beta/2022-11-29-math-punctuation/
Alex is interested in expressions like $x$-axis which I did not explicitly test.
Notes:
1. Punctuation on display math may be messed up, just a consequence of my hack.
2. A "FOO" at the start of a line is an apparent success (look at end of
previous line).
3. "<punct> FOO" at the start of a line is a failure.
4. Mostly tested in Chrome. <rant>Only Chapter 17 tested in my Firefox has
been crippled for testing by Ubuntu's delivery via Snap packaging. Not a fan.
(Yes, I'll install it differently when I get a chance.)</rant> Both bad breaks
were fixed, but the math+punctuation unit went to different lines on different
browsers. I'd guess fine details of font sizes, etc will influence these minute
decisions.
5. debug.mathjax4 yes|no can control the MathJax version.
6. math.punctuation.include display will turn off our inline adjustments, but
you won't get a "FOO", and this is not what I did.
Short answer: perhaps we turn off our low-level manipulation when we switch to
MathJax 4. We may still want it for SVG images of math that go into EPUB (and
similar). We'll need to test line-breaking between an image and punctuation
there, since we won't have MathJax controlling it.
> --
> 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...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/pretext-dev/f53e79c9-80cc-4d08-ad0d-ded4a0bf6380n%40googlegroups.com <
https://groups.google.com/d/msgid/pretext-dev/f53e79c9-80cc-4d08-ad0d-ded4a0bf6380n%40googlegroups.com?utm_medium=email&utm_source=footer>.