Open adamslc opened 12 months ago
Attention: 88 lines
in your changes are missing coverage. Please review.
Comparison is base (
91aefd0
) 81.02% compared to head (18a03e5
) 70.96%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks a lot for the PR !
The alignment problem is there because of where the origin of glyphs (and TeXElements) is. Basically if you draw a TeXElement at position (0, 0) it should sit correctly on the text baseline, at the leftmost reasonable point.
This graph has been quite useful to me (xMin
, xMax
, yMin
and yMax
are ink bounds, leftinkbound
, rightinkbound
, bottominkbound
and topinkbound
respectively in term of MathTeXEngine functions)
As a consequence, the vertical offset[*] for a pair of row (top, bot)
should be something like bottominkbound(top) - row_gap - topinkbound(bot)
. The minus signs are there because the offset goes negative as we go down the page.
Then an additional global offset is needed to set the origin of the matrix itself correctly.
[*] The same principle apply for horizontal, but it doesn't matter as much, because the horizontal origin in always roughly at the left edge.
Regarding the other matrix types, I believe we can just translate them to be surrounded by adaptive parentheses, like \left( \begin{matrix} ... \end{matrix} \right)
and it should work fine. It can be a separate PR too.
Also in the prototype
folder there is a script that can draw the bounding box of all characters, you may find it useful.
This builds on the work in #56 (which itself builds on #50). All those commits have been rebased onto master for convience.
I implemented a simple layout algorithm for matrices (only supports
matrix
right now, but extending to includepmatrix
andbmatrix
should be possible). It works quite well for simple entries, although perhaps the entries should be centered horizontally and vertically. test.pdfHowever, you can see that the layout is very poor when taller notation (e.g. fractions) are used. I think this results from a misunderstanding on my part of how they layout is done. In the second attached pdf, you can see pairs of horizontal lines where I think the symbols should be, which disagrees quite dramatically with where they are. test_vert_extent.pdf