KaTeX Matrix Brackets #2742
Replies: 1 comment
-
My high-level description goes something like this. For every glyph in the KaTeX fonts, KaTeX has detailed metrics for height (above the baseline) and depth (below the baseline). As KaTeX builds HTML, it keeps an accounting of the height and depth of each group that it constructs. Using that height and depth data, KaTeX selects a delimiter from six options:
If you have forked KaTeX, you can see these glyphs by using https://opentype.js.org/glyph-inspector.html to view the Delimiter size selection takes place in the TeX creates stacked delimiters using glyphs that are vertically aligned very accurately. We have found that browsers sometimes are insufficiently accurate in this alignment and will sometimes render stacked delimiters with a one-pixel wide gap. So the next release of KaTeX will include PR #2698 using SVGs for the stretchy vertical parts of a stacked delimiter. There are probably people better qualified than me to describe all this. Two of the main KaTeX contributors have done some work on their own interactive math editors. That would be @kevinbarabash's math-blocks and @ylemkimon's mathylem. You might take a look and see how they go about this. Good luck! |
Beta Was this translation helpful? Give feedback.
-
I'm working on a project with a team on creating editable equations in SlateJS, and we've been trying to dig into how matrix brackets work in KaTeX. We've been struggling how it determines how they are sized, and if they could possibly be applied to something outside of KaTeX.
Beta Was this translation helpful? Give feedback.
All reactions