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

Misaligned brackets #215

Open
fkuehnel opened this issue Jan 22, 2024 · 7 comments
Open

Misaligned brackets #215

fkuehnel opened this issue Jan 22, 2024 · 7 comments

Comments

@fkuehnel
Copy link

Still, there are some misalignments in rendering matrices and brackets, i.e.

https://www.wikiwand.com/en/Moore%E2%80%93Penrose_inverse

Screenshot 2024-01-21 at 10 09 23 PM
@dginev
Copy link

dginev commented Jan 22, 2024

A quick diagnostic suggests this is (at least partially) connected to #103

  1. snippet reproducing the problem (in Chrome): https://codepen.io/dginev/pen/xxBreNE

  2. hand-typed snippet avoiding the problem: https://codepen.io/dginev/pen/qBvjwYN

The markup encountering the issue leverages the "sizing trick" of setting the same minsize and maxsize, with em units:

<mrow class="MJX-TeXAtom-ORD">
  <mrow class="MJX-TeXAtom-OPEN">
    <mo maxsize="2.470em" minsize="2.470em">(</mo>
  </mrow>
</mrow>
<!-- ... -->
<msup>
  <mrow class="MJX-TeXAtom-ORD">
    <mrow class="MJX-TeXAtom-CLOSE">
      <mo maxsize="2.470em" minsize="2.470em">)</mo>
    </mrow>
  </mrow>
  <mrow class="MJX-TeXAtom-ORD">
    <mo>+</mo>
  </mrow>
</msup>

The second potential problem is the parsing avenue which attaches the superscript of the entire expression only on the closing paren. Which I assume may be more fragile, compared to a wrapping mrow that contains the () delimiters as the first and last child.

But yes, I think this connects to the broader discussion of #103

@dginev
Copy link

dginev commented May 22, 2024

The reported snippet appears to now work well with the latest Chrome. I checked with version 125.0.6422.76, with the previously mentioned codepen.

Is this good enough to close @fkuehnel ?

@NSoiffer
Copy link
Contributor

Just confirming what @dginev wrote: I updated from 124.0.6367.208 to 125.0.6422.77 and the codepen display now looks good, whereas in the previous version it did not.

@davidcarlisle
Copy link
Collaborator

adding sub/super scripts to delimiters still mis-aligns though see for example

https://w3c.github.io/mathml-docs/intent-examples/#id-1-afbf0c9d54fa697fee15f8c64feda4b2

image

in chrome 125.0.6422.77 and

image

in firefox

@dginev
Copy link

dginev commented May 22, 2024

adding sub/super scripts to delimiters still mis-aligns though see for example

https://w3c.github.io/mathml-docs/intent-examples/#id-1-afbf0c9d54fa697fee15f8c64feda4b2

image

I wonder if it would be better to open separate issues for each kind of technical misalignment.

I made 3 variations of this example in a new codepen here (tested with Chrome 125):
https://codepen.io/dginev/pen/VwOjPzW

It looks like this is an issue encountered due to <mo> and <msubsup> being the paired fences, where only one of the two is handled with 3.4.1.4 Base with subscript and superscript.

If we instead lift the <msubsup> to wrap both fences (2nd example in codepen) or use <msubsup> for both left and right fence (3rd example in codepen), the alignment appears correct.

Edit: Added a 4th example to the codepen, with both <mo> elements set to stretchy="false". That also aligns correctly, (and leads to a slight variation in horizontal spacing between the fences).

@NSoiffer
Copy link
Contributor

@davidcarlisle 's example is also bad in Chrome Canary 127.0.6494.0 (22/05/2024), so it does seem to be separate and not fixed.

@fred-wang
Copy link
Contributor

adding sub/super scripts to delimiters still mis-aligns though see for example

#205 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants