Skip to content

Fix for { fix for Superscript of tall expression (issue #763) }#779

Merged
kschaefe merged 2 commits intomathquill:masterfrom
savthegood:patch-1
Jan 24, 2019
Merged

Fix for { fix for Superscript of tall expression (issue #763) }#779
kschaefe merged 2 commits intomathquill:masterfrom
savthegood:patch-1

Conversation

@savthegood
Copy link
Copy Markdown
Contributor

Fix to reflow properly superscript in cases of combo of sub+sup. Move reflow into SupSub so case a_b,right,^x is reflow-ed too. Use margin-bottom to lift superscript and dont touch vertical-align of mq-subsup (so rendering of subs is not messed).

Fix to reflow properly superscript in cases of combo of sub+sup. Move reflow into SupSub so case a_b,right,^x is reflow-ed too. Use margin-bottom to lift superscript and dont touch vertical-align of mq-subsup (so rendering of subs is not messed).
@savthegood
Copy link
Copy Markdown
Contributor Author

Test expression I used:
\left(a^{b^{c^{\frac{1}{2}}}}\right)^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b+\left(z^{\frac{1}{2}}\right)^{\frac{1}{2}}+x^{\frac{1}{2}}+x^{\frac{1}{\frac{2}{\frac{3}{\frac{4}{5}}}}}+y_b+y_b^c+y_b+c^2+const

result I got at localhost:
image

@savthegood
Copy link
Copy Markdown
Contributor Author

It all looks good, but there is a downside to this. Superscript is not attached to it's base in any base. So if you enter e.g.
image

and then change the base to smth with different height: power will not be updated. No way around it, unless reflow of any element would check next element if it's subsup...which might not be the best option.

@savthegood
Copy link
Copy Markdown
Contributor Author

And I found a bug(?) :-( :
\left(\frac{c}{\frac{b}{d}}\right)^{\frac{1}{2}}+b
image

@kschaefe
Copy link
Copy Markdown
Member

Let's ensure that we add your visual tests to the visual tests page. This will help ensure that we don't lose the changes to a future regression.

@laughinghan you can reflow another block, correct? I think that's what needed here. Any tips?

Calculating needed lift-up by actually analyzing top of base and bottom of power and trying to align them properly.
@savthegood
Copy link
Copy Markdown
Contributor Author

I've changed the way I calculate needed lift-up for power (see 601946c ).
Test I use

\left(a^{b^{c^{\frac{1}{2}}}}\right)^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b+\left(z^{\frac{1}{2}}\right)^{\frac{1}{2}}+x^{\frac{1}{2}}+x^{\frac{1}{\frac{2}{\frac{3}{\frac{4}{5}}}}}+y_b+y_b^c+y_b+c^2+\left(\frac{c}{\frac{b}{d}}\right)^{\frac{1}{2}}+const

Result I get (I checked FF and Chrome, if you have mac/ie -- check it there too...):
image

Copy link
Copy Markdown
Member

@kschaefe kschaefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add your test case to the test/visual.html page?

@savthegood
Copy link
Copy Markdown
Contributor Author

You mean you want me to add \left(a^{b^{c^{\frac{1}{2}}}}\right)^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b^p+\left(a^{b^{c^{\frac{1}{2}}}}\right)_b+\left(z^{\frac{1}{2}}\right)^{\frac{1}{2}}+x^{\frac{1}{2}}+x^{\frac{1}{\frac{2}{\frac{3}{\frac{4}{5}}}}}+y_b+y_b^c+y_b+c^2+\left(\frac{c}{\frac{b}{d}}\right)^{\frac{1}{2}}+const somewhere in test/visual.html? not sure where exactly should I do it? wouldnt it make more sense smb who wrote that file would add the line in right place?

@savthegood
Copy link
Copy Markdown
Contributor Author

@kschaefe ?? pls answer my previous comment.

@kschaefe
Copy link
Copy Markdown
Member

The work here fixes the misalignment @laughinghan noted after we merge #764.

@laughinghan or @stufflebear I have pulled this down using command-line and have updated the visual.html page with @savthegood's monster LaTeX expression.

Do you want me to push to a branch for either of you to review or merge into master?

@manojchandrashekar
Copy link
Copy Markdown

Hi guys - any update on this PR?

@kschaefe
Copy link
Copy Markdown
Member

#841 adds the visual checks for this request. Closing to use the new request.

@kschaefe kschaefe closed this Dec 19, 2018
@kschaefe kschaefe reopened this Jan 24, 2019
@kschaefe kschaefe dismissed their stale review January 24, 2019 16:27

Dismissing my review because I will merge this. #841 has the requested fix and someone else can approve my change to get that fix in.

@kschaefe kschaefe merged commit 248691d into mathquill:master Jan 24, 2019
Dantica pushed a commit to kedyou/mathquill that referenced this pull request Sep 25, 2020
Fix for { fix for Superscript of tall expression (issue mathquill#763) }
jwmerrill added a commit to desmosinc/mathquill that referenced this pull request Nov 22, 2021
Fixes mathquill#950 by reverting
mathquill#764 and
mathquill#779

Unfortunately, this leaves us back in a place where superscript and
subscript placement isn't very good when they're attached to tall
blocks, but I think if we're going to fix that, we need to find a way
to do it that's more robust to continuing to edit the expression.
atEchoOff pushed a commit to atEchoOff/MathQuill that referenced this pull request Jul 18, 2025
Fixes mathquill#950 by reverting
mathquill#764 and
mathquill#779

Unfortunately, this leaves us back in a place where superscript and
subscript placement isn't very good when they're attached to tall
blocks, but I think if we're going to fix that, we need to find a way
to do it that's more robust to continuing to edit the expression.
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

Successfully merging this pull request may close these issues.

3 participants