Skip to content

Commit

Permalink
Size commands generate fragments, not spans.
Browse files Browse the repository at this point in the history
This is so the size commands don't hide the types of their enclosed
atoms. Addresses KaTeX#136.

This slightly changes the vertical position of the Sizing test. Not
sure the vertical position matters, so change the test.
  • Loading branch information
kohler committed Nov 23, 2016
1 parent 91b176a commit 5139707
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/buildHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -1115,17 +1115,20 @@ groupTypes.sizing = function(group, options) {
var inner = buildExpression(group.value.value,
options.withSize(group.value.size), false);

// Compute the correct maxFontSize.
var style = options.style;
var span = makeSpan(["mord"],
[makeSpan(["sizing", "reset-" + options.size, group.value.size,
style.cls()],
inner)]);

// Calculate the correct maxFontSize manually
var fontSize = buildCommon.sizingMultiplier[group.value.size];
span.maxFontSize = fontSize * style.sizeMultiplier;
fontSize = fontSize * style.sizeMultiplier;

// Add size-resetting classes to the inner list and set maxFontSize
// manually.
for (var i = 0; i < inner.length; i++) {
inner[i].classes.push("sizing", "reset-" + options.size,
group.value.size, style.cls());
inner[i].maxFontSize = fontSize;
}

return span;
return buildCommon.makeFragment(inner);
};

groupTypes.styling = function(group, options) {
Expand Down
Binary file modified test/screenshotter/images/Sizing-chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshotter/images/Sizing-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5139707

Please sign in to comment.