Fix #711 issue with multiple superscripts.
The previous code incorrectly implemented TeXbook rules. First off, the font metrics at issue should be those for the superscript/ subscript style, not the main style. Secondly, the metrics should be scaled by the font size. This changes some screenshotter tests (and they look more like TeX now).
@@ -334,8 +334,13 @@ groupTypes.supsub = function(group, options) {
|
|||||||
supShift = 0;
|
supShift = 0;
|
||||||
subShift = 0;
|
subShift = 0;
|
||||||
} else {
|
} else {
|
||||||
supShift = base.height - style.metrics.supDrop;
|
const supstyle = style.sup();
|
||||||
subShift = base.depth + style.metrics.subDrop;
|
supShift = base.height - supstyle.metrics.supDrop
|
||||||
|
* supstyle.sizeMultiplier;
|
||||||
|
|
||||||
|
const substyle = style.sub();
|
||||||
|
subShift = base.depth + substyle.metrics.subDrop
|
||||||
|
* substyle.sizeMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rule 18c
|
// Rule 18c
|
||||||
|
@@ -15,7 +15,7 @@ const cjkRegex = require("./unicodeRegexes").cjkRegex;
|
|||||||
// the arrays below, in that order.
|
// the arrays below, in that order.
|
||||||
//
|
//
|
||||||
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
|
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
|
||||||
// This was determined by running the folllowing script:
|
// This was determined by running the following script:
|
||||||
//
|
//
|
||||||
// latex -interaction=nonstopmode \
|
// latex -interaction=nonstopmode \
|
||||||
// '\documentclass{article}\usepackage{amsmath}\begin{document}' \
|
// '\documentclass{article}\usepackage{amsmath}\begin{document}' \
|
||||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |