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

the line of \left\vert is disconnected #3168

Open
lesonli opened this issue Aug 13, 2021 · 8 comments
Open

the line of \left\vert is disconnected #3168

lesonli opened this issue Aug 13, 2021 · 8 comments
Assignees
Labels

Comments

@lesonli
Copy link

lesonli commented Aug 13, 2021

\dfrac{\left\vert\dfrac{12\sqrt{3+211}}{a}\right|}{1}

image

How can we solve this problem?

@lesonli lesonli added the bug label Aug 13, 2021
@ronkok
Copy link
Collaborator

ronkok commented Aug 14, 2021

Well, that's annoying. I'll turn in a PR that removes a .toFixed(3) from the code. That rounding changes the width of an SVG by a minute amount. It might be enough for a browser to occasionally misplace the SVG.

@edemaine
Copy link
Member

@lesonli The latest version of KaTeX makes some changes to this behavior. Can you confirm whether you're still seeing an issue?

@rinmyo
Copy link

rinmyo commented Nov 1, 2021

@lesonli The latest version of KaTeX makes some changes to this behavior. Can you confirm whether you're still seeing an issue?
aaa

Still has this issue in 0.15.1, but I'm not sure if it is a same bug.

@edemaine
Copy link
Member

edemaine commented Nov 1, 2021

Definitely looks like an improvement. I don't think we have an easy way to do better.

For the specific case, of |, I could imagine doing the whole symbol with one SVG, but I imagine this is pretty different from how LaTeX renders large symbols.

@mbourne
Copy link

mbourne commented Jul 10, 2022

This is still causing issues (recently, #3669).

I could imagine doing the whole symbol with one SVG, but I imagine this is pretty different from how LaTeX renders large symbols.

Seems to me this issue would be resolved if one element was used. I had a play around and offer 2 possible solutions, which have the added benefit of reducing the number of DOM elements should one or other be implemented.

The first suggestion is to render it with a single SVG (as @edemaine mentioned), and the second is to draw a border. (I'm just tinkering with clones of the KaTeX output.)

https://bourne2learn.com/math/katex/large-absolute-values-signs-proposal.php

Screenshot of the extended SVG approach:

image

I still feel at times pure LaTeX approaches don't make sense in HTML. My guess is 99% of users just want it to look right, and don't care if if fails LaTeX purity tests, as long as it is valid HTML.

@mbourne
Copy link

mbourne commented Jul 19, 2022

Any comment on my suggested solution? The single SVG approach is what MathJax does, BTW.

@rben01
Copy link

rben01 commented Aug 2, 2022

I'm also seeing this. It definitely seems to depend on the specifics how browsers render fonts.

Safari

Regular:
image

Zoomed:
image

Brave

Regular:
image

Zoomed:
image

Brave is definitely better but neither is perfect. I think a single SVG would solves and seems like the "correct" solution (one line, one element).

@mangerlahn
Copy link
Contributor

The linked PR appears to fix the cases described here (thanks for the fix!), but there are still cases (arrows) which see the same issues. From the test expectations:
image
(Source)

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

No branches or pull requests

7 participants