-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve rule coding, including for \sqrt
.
#776
Conversation
Example difference, using Note that the rules are less unruly. |
@kohler I'll review this evening. The screenshots look good. |
I was overly optimistic. I'll try to get to it this weekend. |
The \sqrt rule looks a lot better. I've found the smaller font sizes to be more troublesome. Here are some renderings using 12px sized font. I tried out some other font sizes. 18px was the worst. My guess is that the |
* Rule widths (overline, underline, fraction, sqrt) actually scale with the current font size in AMS-TeX. Implement that. (Sqrt is a special case: the rule width depends on the font size *of the surd*.) * Change the CSS coding for rules. The old, complex coding prevented variable-width lines and may have contributed to issues like KaTeX#696. Its purpose, according to 0a3a227, was IE8 support; but KaTeX no longer supports IE8.
Smaller sizes seem more important.
Hi @kevinbarabash, I rebased on top of the current master & pushed. I cannot replicate a missing \sqrt rule on Chrome, with either 11px or 18px, at any mag. Here's the diff I made to main.css. Version 59.0.3071.115 (Official Build) (64-bit) on Mac. Can you help me replicate? There's no clipping in the CSS coding, so your proposed explanation doesn't make sense to me.
|
I'm running a dev version of Chrome. It said it was ready to upgrade so I upgraded and the problem went away. This also resulted in better positioning at 12px. The sort-line is no longer floating a little bit above the square root symbol. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few questions in the comments. I'm surprised that the position of the some of the subscripts changed in the screenshots. Any idea of why that happened?
options); | ||
const delimChar = delimiter.customSizedDelim("\\surd", minDelimiterHeight, | ||
false, options, group.mode); | ||
const delim = makeSpan(["sqrt-sign"], [delimChar], options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for breaking this up
const ruleWidth = line.height; | ||
// Calculate the minimum size for the \surd delimiter | ||
const metrics = options.fontMetrics(); | ||
const theta = metrics.defaultRuleThickness; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is theta
the official name for this metric in the TeXBook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
src/buildHTML.js
Outdated
if (group.value.hasBarLine) { | ||
rule = makeLineSpan("frac-line", options); | ||
ruleWidth = ruleSpacing = rule.height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to:
ruleWidth = rule.height;
ruleSpacing = ruleWidth;
I misread this and thought that ruleSpacing
wasn't being defined in this block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const makeLineSpan = function(className, options) { | ||
const baseOptions = options.havingBaseStyle(); | ||
const line = makeSpan( | ||
[className].concat(baseOptions.sizingClasses(options)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the sizing classes not necessary b/c we're manually figuring setting the borderBottomWidth
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The sizing classes were necessary because previously we wanted all rules to have the same thickness, and that thickness was specified in katex.less
in base-sized em
units. Now that we're specifying the thickness in local em
units, no sizing classes.
When a nucleus has both sub & sub, the The previous KaTeX implementation differed. It used 0.04em as the thickness for purposes of separating sup+sub, but it should have used 0.04em base-size units for consistency with the TeXbook (since previously all rules were 0.04em base-size units thick). Instead it used 0.04em script-size units (in scriptscript mode). |
@kohler thanks for the PR. The updated horizontal rules look great. |
with the current font size in AMS-TeX. Implement that. (Sqrt is
a special case: the rule width depends on the font size of the
surd.)
variable-width lines and may have contributed to issues like poor spacing in fraction inside square root (depends on rendering environment) #696.
Its purpose, according to 0a3a227,
was IE8 support; but KaTeX no longer supports IE8.