68 views

Skip to first unread message

Jul 25, 2023, 3:19:21 PM7/25/23

to PreTeXt support

In Katherine Yoshiwara’s Core Math textbook, the \cancel command sometimes does not draw the cancel mark through the intended text but is placed just before the intended position.

I’ve created a minimal example with two instances of the issue.

https://byoshiwara.github.io/scratch/section-1.html#note-1

First instance:

Inside the Note, the displayed equation does have a slash through the word “hours” but only partially through the “h” of “hour” in the denominator.

Second instance:

Inside the solution of Example 1.3, the second displayed equation has both slashes occurring just before, rather than through, the word “inches”.

I don’t think the problem is merely a mistake in how \cancel was used in these two instances because the identical markup for the Note works fine if the Note is not preceded by Example 1.1.

https://byoshiwara.github.io/scratch/section-2.html#note-2

And the identical markup for the weird displayed equation of Example 1.3 gives the desired result if that displayed equation is all by itself in the subsection.

I’ve created a minimal example with two instances of the issue.

https://byoshiwara.github.io/scratch/section-1.html#note-1

First instance:

Inside the Note, the displayed equation does have a slash through the word “hours” but only partially through the “h” of “hour” in the denominator.

Second instance:

Inside the solution of Example 1.3, the second displayed equation has both slashes occurring just before, rather than through, the word “inches”.

I don’t think the problem is merely a mistake in how \cancel was used in these two instances because the identical markup for the Note works fine if the Note is not preceded by Example 1.1.

https://byoshiwara.github.io/scratch/section-2.html#note-2

And the identical markup for the weird displayed equation of Example 1.3 gives the desired result if that displayed equation is all by itself in the subsection.

Bruce Yoshiwara

Jul 25, 2023, 3:34:25 PM7/25/23

to pretext...@googlegroups.com

When I put in the source for the first example

3 \cancel{\text{hours}} \times \frac{52}{1}

\frac{\text{miles}}{\cancel{\text{hour}}} = \text{156 miles}

into the MathJax demo page

https://www.mathjax.org//#demo

it looks good.

This strikes me as something we have seen before. At some early stage

before it's all rendered, MJ calculates the width of the argument to

\cancel to be 0, and the narrow slash is based on that incorrect

calculation. I'm not sure what the solution is, but it's probably

something about the timing of how this is rendered.

> --

> 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/5e801ee9-f50a-4387-8787-3d1987669706n%40googlegroups.com.

3 \cancel{\text{hours}} \times \frac{52}{1}

\frac{\text{miles}}{\cancel{\text{hour}}} = \text{156 miles}

into the MathJax demo page

https://www.mathjax.org//#demo

it looks good.

This strikes me as something we have seen before. At some early stage

before it's all rendered, MJ calculates the width of the argument to

\cancel to be 0, and the narrow slash is based on that incorrect

calculation. I'm not sure what the solution is, but it's probably

something about the timing of how this is rendered.

> 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/5e801ee9-f50a-4387-8787-3d1987669706n%40googlegroups.com.

Jul 26, 2023, 3:53:34 AM7/26/23

to pretext...@googlegroups.com

There is finally a beta of MathJax 4 out, as of a few days ago. I'll update the behavior of the flag available for testing and maybe this will fix itself?

Jun 25, 2024, 4:12:55 PMJun 25

to PreTeXt support

Hi All,

I'm trying to cancel units when solving a proportion problem and I'm running into a similar issue. Here's my code, mathjax preview, and how it appears in my web preview.

Canceling values is working just fine, but I would also like to be able to cancel a value with units like "300 miles" and I had a similar issue with that.

Any help would be appreciated, thanks!

Cara Lee

Portland Community College

<md>

<mrow>x\amp=\frac{12\text{ gallons}\cdot1300\cancel{\text{miles}}}{300\cancel{\text{miles}}}</mrow>

<mrow>x\amp=52\text{ gallons}</mrow>

</md>

<mrow>x\amp=\frac{12\text{ gallons}\cdot1300\cancel{\text{miles}}}{300\cancel{\text{miles}}}</mrow>

<mrow>x\amp=52\text{ gallons}</mrow>

</md>

Jun 25, 2024, 6:02:23 PMJun 25

to PreTeXt support

To add on a bit more, the pdf doesn't seem to build with the \cancel statements. Here's the line of code and the error message. When I comment out all the statements with cancel it does build.

Here's the whole project if that's helpful: https://github.com/PCCMathSAC/MathInSocietyPCC

<mrow>\frac{\cancel{300}x}{\cancel{300}}\amp=\frac{12\cdot1300}{300}</mrow>

************************************************

Subsection 1.3.10 Solving Proportion Problems with an Algebraic Equation

************************************************

[30]

! Undefined control sequence.

<argument> \cancel

{300}x

l.2619 \end{align*}

This is the html which is great:

Thanks!

Jun 25, 2024, 7:01:50 PMJun 25

to pretext...@googlegroups.com

I think this is probably the relevant documentation:

https://pretextbook.org/doc/guide/html/topic-mathematics.html#mathematics-latex-packages

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/737ccdb1-de13-4b15-b171-0dafbab836ban%40googlegroups.com.

Jun 25, 2024, 7:25:36 PMJun 25

to PreTeXt support

Excellent, that fixed the pdf!

Is there something I can do for the html version to cancel units? Here's the pdf output, code and html output. Thanks!

<mrow>x\amp=\frac{12\text{ gallons}\cdot1300\cancel{\text{ miles}}}{300\cancel{\text{ miles}}}</mrow>

Jun 25, 2024, 7:36:20 PMJun 25

to pretext...@googlegroups.com

Do you see the same issue across different web browsers?

If a MathJax or browser bug is involved here, a hack-ish thing to try is to do like \text{ miles } (with extra spaces) and see if that changes anything. Also try \mathrm{miles} instead of \text{miles}. If either of these "fix" it for you, that's great in the short term but still apparently there is some bug with MathJax and cancel.

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/e805c6dc-cade-4519-9102-5b7819e2a957n%40googlegroups.com.

Jun 25, 2024, 7:42:28 PMJun 25

to pretext...@googlegroups.com

That I'm not sure.

I sort of expected that as long as the cancel package is added in the docinfo, MathJax should do the same thing as LaTeX.

I like using the MathJax live demo page to tinker if something isn't quite right.

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CA%2BR-jreoH2RjtGbxyW5-RY1ViNgH%2B-zQ9RW1fNznkTW8D3K6_w%40mail.gmail.com.

Jun 25, 2024, 8:05:23 PMJun 25

to pretext...@googlegroups.com

There is an old thread (link below) in which I ask about the same
issue. There was no resolution as far as I can tell (some
discussion moved to -dev which I have not tracked down).

https://groups.google.com/g/pretext-support/c/eXh7QtoUi9E/m/A-zHOA47AwAJ

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CAH%2BNcPbsyXgWs9mYNfwPRR2wepTjEd-e2SLPzhWWbeNN86PMWw%40mail.gmail.com.

Jun 25, 2024, 8:44:01 PMJun 25

to PreTeXt support

Great thought, Alex. It does show up properly in Chrome, before I was using Firefox.

I'm updating Firefox to see if that fixes it there and I'll look at your other suggestions if needed after that.

Jun 25, 2024, 10:02:48 PMJun 25

to pretext...@googlegroups.com

It's possibly at the intersection of Firefox and MathJax as a bug where MathJax calculates the text as zero width based on Firefox somewhere and draws the slash accordingly.

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/02165ef6-5e01-4df4-b8b2-3d97cebd1c66n%40googlegroups.com.

Jul 1, 2024, 3:00:38 PMJul 1

to PreTeXt support

\mathrm{ miles} works, except the space doesn't appear in the pdf. I think this is a good enough fix, unless it makes more sense to prioritize the pdf over Firefox.

Firefox and Chrome:

PDF:

Jul 1, 2024, 3:18:46 PMJul 1

to pretext...@googlegroups.com

The signs point to there being some bug at the intersection of Firefox, MathJax, and PreTeXt. We have control over one of those three things, and ideally we should look into this. Roughly, it seems like we could be loading MathJax in a way that (when Firefox is the browser) misleads MathJax to calculate a certain width as 0, and collapses the cancel slash to be too narrow. (That's an armchair diagnosis without looking at a live example.) If we understood what is happening we might adjust how we load MathJax.

Are you confirming that \mathrm{miles} (using mathrm, but not using an extra space) didn't work? If that works, but does not leave space between the number and the unit, then consider using:

1300\,\mathrm{miles}

which puts a thinspace in place before the "miles" is printed.

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/1ca3dbe4-160c-45df-9153-b69feb24cd17n%40googlegroups.com.

Jul 16, 2024, 9:35:47 PMJul 16

to PreTeXt support

I'm just getting back to this...

Neither \cancel{\mathrm{miles}} nor \cancel{\mathrm{ miles}} gave a space between the number and units in the pdf. I also had some \highlight{} thrown in there as well on other examples.

I'm happy for now, but something to look into if you're able to.

Jul 17, 2024, 12:07:28 AMJul 17

to pretext...@googlegroups.com

Cara, I can meet with you tomorrow to investigate this. We can verify the right things are declared for using the cancel package in the first place. But IIRC earlier you found things worked on one browser but not on another. So there will be an interesting investigation to have there.

To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/fbad6352-c8df-45c0-af31-027cb33b4f7bn%40googlegroups.com.

Reply all

Reply to author

Forward

0 new messages