Fix interaction between styles and sizes. (#719)

* Fix interaction between styles and sizes by implementing styles as sizes.

Rather than having both `textstyle` CSS classes and `size5` CSS classes
affect the font size (and step on each other), implement sizes more the
way TeX does: a command like `\displaystyle` changes the current size.

This is actually a simplification, since now only `size` affects the size.
Simplifies CSS and computation. Many screenshotter tests change; they
change to be more like TeX. For instance, `\sqrt` fixes some
discrepancies in size treatment.

Also:

Remove the `Options.withX()` methods in favor of `.havingX()`, which
might return the same `options`.

Remove `Style.cls()` and `Style.reset()`.

Remove `Options.reset()`. You should never modify an `Options`; they
should change only by the `havingX()` methods.

* Implement TeX sizing for scriptsize/scriptscriptsize.

At every size level. Also make the sizes match TeX to the last decimal.

* Review comments.
This commit is contained in:
Eddie Kohler
2017-06-27 20:55:14 -04:00
committed by Kevin Barabash
parent 4f57d53f6e
commit b866cd5224
29 changed files with 347 additions and 410 deletions

View File

@@ -232,22 +232,6 @@
& + .mop.mtight { margin-left: @thinspace; }
}
.reset-textstyle.textstyle { font-size: 1em; }
.reset-textstyle.scriptstyle { font-size: 0.7em; }
.reset-textstyle.scriptscriptstyle { font-size: 0.5em; }
.reset-scriptstyle.textstyle { font-size: 1.42857em; }
.reset-scriptstyle.scriptstyle { font-size: 1em; }
.reset-scriptstyle.scriptscriptstyle { font-size: 0.71429em; }
.reset-scriptscriptstyle.textstyle { font-size: 2em; }
.reset-scriptscriptstyle.scriptstyle { font-size: 1.4em; }
.reset-scriptscriptstyle.scriptscriptstyle { font-size: 1em; }
.style-wrap {
position: relative;
}
.vlist {
display: inline-block;
@@ -448,15 +432,16 @@
display: inline-block;
@size1: 0.5;
@size2: 0.7;
@size3: 0.8;
@size4: 0.9;
@size5: 1.0;
@size6: 1.2;
@size7: 1.44;
@size8: 1.73;
@size9: 2.07;
@size10: 2.49;
@size2: 0.6;
@size3: 0.7;
@size4: 0.8;
@size5: 0.9;
@size6: 1.0;
@size7: 1.2;
@size8: 1.44;
@size9: 1.728;
@size10: 2.074;
@size11: 2.488;
.generate-size-change(@from, @to) {
&.reset-size@{from}.size@{to} {
@@ -466,13 +451,13 @@
}
}
.generate-to-size-change(@from, @currTo) when (@currTo =< 10) {
.generate-to-size-change(@from, @currTo) when (@currTo =< 11) {
.generate-size-change(@from, @currTo);
.generate-to-size-change(@from, (@currTo + 1));
}
.generate-from-size-change(@currFrom) when (@currFrom =< 10) {
.generate-from-size-change(@currFrom) when (@currFrom =< 11) {
.generate-to-size-change(@currFrom, 1);
.generate-from-size-change((@currFrom + 1));
@@ -502,6 +487,10 @@
width: @nulldelimiterspace;
}
.delimcenter {
position: relative;
}
.op-symbol {
position: relative;