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

fix: Use SVGs for some stacked delims #3686

Merged
merged 7 commits into from Aug 28, 2022
Merged

fix: Use SVGs for some stacked delims #3686

merged 7 commits into from Aug 28, 2022

Conversation

ronkok
Copy link
Collaborator

@ronkok ronkok commented Aug 18, 2022

This PR uses a single SVG to render certain stretchy delimiters that have until now been rendered using a stack of font glyphs. The browser's imprecision in span placement is thus evaded.

The delimiters thus treated are: \lparen, \rparen, \brack, \rbrack, \vert, \Vert, \lfloor, \rfloor, \lceil, and \rceil, along with all the other functions that call the same stretchy delimiters.

Resolves issues #3650 and #3168.

@codecov
Copy link

codecov bot commented Aug 18, 2022

Codecov Report

Merging #3686 (13883f5) into main (7530849) will decrease coverage by 0.41%.
The diff coverage is 69.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3686      +/-   ##
==========================================
- Coverage   93.39%   92.98%   -0.42%     
==========================================
  Files          90       90              
  Lines        6679     6739      +60     
  Branches     1554     1568      +14     
==========================================
+ Hits         6238     6266      +28     
- Misses        403      435      +32     
  Partials       38       38              
Impacted Files Coverage Δ
src/svgGeometry.js 65.90% <50.00%> (-21.60%) ⬇️
src/delimiter.js 87.57% <79.16%> (-1.79%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7530849...13883f5. Read the comment docs.

@ronkok
Copy link
Collaborator Author

ronkok commented Aug 18, 2022

I'll fix the screenshotter pics tomorrow.

@ronkok
Copy link
Collaborator Author

ronkok commented Aug 18, 2022

@edemaine This PR is now ready for review. Since it is a purely visual effort, the best way to review it may be by looking at the screenshotter diffs for commit ae407cf. The final commit just used those images to replace the earlier ones, so it is checking against itself and won't tell you anything.

@edemaine
Copy link
Member

@ronkok This sounds awesome! Thanks for working on this long-standing issue.

Am I reading the screenshot diffs correctly that | now has butt line caps, whereas before they were round line caps? It seems like in LaTeX they are supposed to be round line caps:

image

[QuickLaTeX rendering]

(Admittedly a very small difference!)

@ronkok
Copy link
Collaborator Author

ronkok commented Aug 18, 2022

Re: butt line caps. You are correct. That's just sloth on my part. I can take a few minutes and create a radius.

@ronkok
Copy link
Collaborator Author

ronkok commented Aug 19, 2022

Line caps are rounded. Screenshots are refreshed. This PR should be ready to go.

@ronkok
Copy link
Collaborator Author

ronkok commented Aug 27, 2022

This is a friendly reminder that this PR is ready for review and it resolves a long-standing issue.

@edemaine
Copy link
Member

Sorry, I haven't forgotten; it's just been a busy time. I will try to review next week, but if not, should definitely have time the following week.

@ylemkimon ylemkimon merged commit 8a65a2e into KaTeX:main Aug 28, 2022
@ylemkimon
Copy link
Member

Thank you for the PR! I wonder whether we can get rid of these glyphs.

KaTeX-bot added a commit that referenced this pull request Aug 28, 2022
## [0.16.1](v0.16.0...v0.16.1) (2022-08-28)

### Bug Fixes

* Use SVGs for some stacked delims ([#3686](#3686)) ([8a65a2e](8a65a2e))
@KaTeX-bot
Copy link
Member

🎉 This PR is included in version 0.16.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@edemaine
Copy link
Member

Thanks @ylemkimon!!

If you have additional time, it'd be great to get your PR #3385 revised, as we recently had a request for \ifmmode, which would be easy to add along with \if@display. (If you don't have time, though, I'll revise it eventually.)

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

Successfully merging this pull request may close these issues.

None yet

4 participants