Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy typesetting in version 3.2.1 may create repeated labels #2873

Closed
cebola2 opened this issue May 20, 2022 · 5 comments
Closed

Lazy typesetting in version 3.2.1 may create repeated labels #2873

cebola2 opened this issue May 20, 2022 · 5 comments
Labels
Accepted Issue has been reproduced by MathJax team Test Needed v3 v3.2

Comments

@cebola2
Copy link

cebola2 commented May 20, 2022

This a preliminary report (no minimal example) on a possible anomaly in version 3.2.1: in particular circumstances lazy typesetting may create error messages about repeated labels.

To see an example go to https://cdi2.palhoto.pt/test_1

Near the bottom of the page there are two equations labeled (2) and (3) and a few lines afterwards there is a collapsed section labeled "Mais detalhes".

On opening the page and waiting a bit no anomalies are detected. But then, if you open the collapsed section, duplicate label messages appear (also if you open the page and quickly slide to the bottom).

Cache cleaning has no effect on this behavior.

This is not present on version 3.2.0 as can be checked in https://cdi2.palhoto.pt/test

Reproduced both on Firefox 100.0 and Chrome 101.0.4951.64 on
System: Kernel: 5.13.0-37-generic x86_64 bits: 64 compiler: N/A Desktop: Cinnamon 5.2.7
wm: muffin dm: LightDM Distro: Linux Mint 20.3 Una base: Ubuntu 20.04 focal

@dpvc
Copy link
Member

dpvc commented May 20, 2022

Thanks for the report. I'll look into it and see what I can find out. In the meantime, you might want to revert to version 3.2.0 for now. I'll let you know what I come up with.

Sorry for the issue!

@dpvc dpvc added Accepted Issue has been reproduced by MathJax team v3 Investigate labels May 20, 2022
@cebola2
Copy link
Author

cebola2 commented May 23, 2022

I have reverted the site to 3.2.0 and edited links in the original report to point to a test page which runs 3.2.1, namely https://cdi2.palhoto.pt/test_1

@dpvc
Copy link
Member

dpvc commented Jun 1, 2022

Sorry for the delay in getting this worked out (I was away for the last week).

It turns out that a reset that is being used to allow reprocessing of some expressions is actually resetting every expressions, and so they are being re-typeset when they shouldn't be, and that means the ones with labels are being re-compiled, causing the errors that you are seeing. I will make a PR to resolve the issue, but in the meantime, you can use

MathJax = {
  loader: {
    load: ['ui/lazy'],
  },
  startup: {
    ready() {
      MathJax.startup.defaultReady();
      const mathItem = MathJax.startup.document.options.MathItem;
      class myItem extends mathItem {
        state(state, restore = false) {
          if (restore !== null) super.state(state, restore);
          return super.state();
        }
      }
      MathJax.startup.document.options.MathItem = myItem;
    }
  }
};

to work around it for now.

@cebola2
Copy link
Author

cebola2 commented Jun 9, 2022

I have created https://cdi2.palhoto.pt/test_2.php as a test for 3.2.2

It works!

@dpvc
Copy link
Member

dpvc commented Jun 9, 2022

Thanks for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Test Needed v3 v3.2
Projects
None yet
Development

No branches or pull requests

2 participants