Padding over \sqrt and Paths for frac-line#1143
Padding over \sqrt and Paths for frac-line#1143k4b7 merged 13 commits intoKaTeX:masterfrom ronkok:paddingAndFracline
Conversation
This replaces two earlier PRs.
| xrightequilibrium: [["baraboveshortleftharpoon", | ||
| "rightharpoonaboveshortbar"], 1.75, 716], | ||
| xleftequilibrium: [["shortbaraboveleftharpoon", | ||
| "shortrightharpoonabovebar"], 1.75, 716], |
There was a problem hiding this comment.
I don't think these should've been removed. It breaks the ReactionArrows test.
| xtofrom: "\u21c4", | ||
| xrightleftarrows: "\u21c4", | ||
| xrightequilibrium: "\u21cc", // Not a perfect match. | ||
| xleftequilibrium: "\u21cb", // None better available. |
There was a problem hiding this comment.
These probably shouldn't be removed.
|
@kevinbarabash Thank you. In my frustration, I got hasty. |
|
I've regenerate the screenshots in ronkok#1. It's incredible how many of our screenshots involve fractions. Many of them probably don't need fractions to test what they're testing. |
regenerate screenshots
I know that I contributed to that. When I was testing stretchy arrows, fractions were a cheap way to test vertical alignment and vertical kerns used for clearances. |
Codecov Report
@@ Coverage Diff @@
## master #1143 +/- ##
==========================================
+ Coverage 79.36% 79.38% +0.02%
==========================================
Files 59 59
Lines 3862 3871 +9
Branches 648 648
==========================================
+ Hits 3065 3073 +8
- Misses 662 663 +1
Partials 135 135
Continue to review full report at Codecov.
|
I guess you need some way to test clearance on top. It's either |
src/delimiter.js
Outdated
| if (delim.type === "small") { | ||
| // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. | ||
| viewBoxHeight = 1000; // from font | ||
| viewBoxHeight = 1080; // 1000 unit glyph height + 80 unit padding. |
There was a problem hiding this comment.
I think it be good to extract some of these values into constants, e.g.
const emBoxHeight = 1000;
const delimiterPadding = 80;
src/delimiter.js
Outdated
| -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667 | ||
| -294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 | ||
| 77-156c66 199.333 139 419.667 219 661 l218 661zM702 0H400000v40H742z`; | ||
| 77-156c66 199.333 139 419.667 219 661 l218 661zM702 80H400000v40H742z`; |
There was a problem hiding this comment.
If we have const delimiterPadding = 80; replace the 80 in the this string with ${delimiterPadding}... or at the very least add a component stating what the 80 is so that if people need to change the padding in the future it's easy to find all the places that need updating.
| sizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; | ||
| spanHeight = 1 * sizeMultiplier; | ||
| spanHeight = 1.08 * sizeMultiplier; | ||
| texHeight = 1.00 * sizeMultiplier; |
There was a problem hiding this comment.
It might be useful to extract a constant for 0.08 as well.
| "viewBox": "0 0 10 10", | ||
| "preserveAspectRatio": "none", | ||
| if (className === "vertical-separator") { | ||
| path = new domTree.pathNode("vertSeparator"); |
There was a problem hiding this comment.
Cool. Thanks for updating vertical separators to be consistent with the horizontal ones.
| path = new domTree.pathNode("stdHorizRule"); | ||
| svgNode = new domTree.svgNode([path], { | ||
| "width": "400em", | ||
| "height": 5 * lineThickness + "em", |
There was a problem hiding this comment.
It's interesting that the line thickness changes for horizontal rules but not for vertical separators. Is that just a LaTeX quirk?
There was a problem hiding this comment.
The vertical line constant value is what I found in the code when I changed it from a span border to an SVG path. I did not go back to underlying sources to check if that was correct.
| width: 100%; | ||
| display: block; | ||
| position: relative; | ||
| overflow: hidden; |
There was a problem hiding this comment.
Is this also b/c of a Chrome rendering issue?
There was a problem hiding this comment.
No. Those two new lines are only necessary for IE. In earlier work, I had put those two lines of CSS into class hide-tail and then nested hide-tail inside a stretchy span. I found here that I could save one nesting level by writing those two new lines into stretchy. I could possibly refactor some other code and save a nesting level elsewhere, but I've got other priorities right now.
src/svgGeometry.js
Outdated
| // It is in a viewBox that is 5x as tall as the line, so that the | ||
| // full line will be rendered even if the browser rounds down | ||
| // the enclosing span size. | ||
| stdHorizRule: "M0 120 V80 H400000 v40 H0 z M0 120 V80 H400000 v40 H0 z", |
There was a problem hiding this comment.
I assume all uses of 80 here for padding similar to what's in delimiter.js. Maybe we should have a constant for these so that it's easy to update if necessary.
…into paddingAndFracline
|
Well, I'm out of date with regard to a submodule. I tried running |
|
@ronkok I'll check out your branch tomorrow and see if I can resolve the conflict. |
|
@kevinbarabash I am not able to view the Travis log, but I believe that I have this PR to the point where it passes all tests except screenshotter. |
|
@ronkok thanks for figuring out the merge. I've been slammed at work. Will try to regenerate the screenshots tonight. |
update screenshots
k4b7
left a comment
There was a problem hiding this comment.
LGTM Thanks for adding in the padding constants in delimiter.js.
|
Having a coverage target for patches is silly. I'm going to try to get rid of that check. |
This replaces two earlier PRs, #1131 Change frac-line from SVG line to SVG path, and #1136 Add 0.08em padding above \sqrt line.
It was easier to create a substitute branch than it was to repair my messed up history.