mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
* Support \vcenter, \raise, \lower, and \hbox * Update screenshots * Edit docs for strict and hbox to * Fix typo for \hbox to * Update Safari screenshot * Augment docs for \vcentcolon * Edit vcenter MathML comment. * Remove pointless class from vcenter MathML * Withdraw \raise and \lower * Updatae Chrome and Firefox screenshots * Update Safari screenshot * Delete allowedInArgument setting Co-authored-by: ylemkimon <y@ylem.kim> * Update Chrome and Firefox screenshots * Update Chrome and Firefox screenshots take 2 * Update screenshot Co-authored-by: ylemkimon <y@ylem.kim>
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
// @flow
|
|
import defineFunction from "../defineFunction";
|
|
import buildCommon from "../buildCommon";
|
|
import mathMLTree from "../mathMLTree";
|
|
import {assertNodeType} from "../parseNode";
|
|
import {calculateSize} from "../units";
|
|
|
|
import * as html from "../buildHTML";
|
|
import * as mml from "../buildMathML";
|
|
|
|
// Box manipulation
|
|
defineFunction({
|
|
type: "raisebox",
|
|
names: ["\\raisebox"],
|
|
props: {
|
|
numArgs: 2,
|
|
argTypes: ["size", "hbox"],
|
|
allowedInText: true,
|
|
},
|
|
handler({parser}, args) {
|
|
const amount = assertNodeType(args[0], "size").value;
|
|
const body = args[1];
|
|
return {
|
|
type: "raisebox",
|
|
mode: parser.mode,
|
|
dy: amount,
|
|
body,
|
|
};
|
|
},
|
|
htmlBuilder(group, options) {
|
|
const body = html.buildGroup(group.body, options);
|
|
const dy = calculateSize(group.dy, options);
|
|
return buildCommon.makeVList({
|
|
positionType: "shift",
|
|
positionData: -dy,
|
|
children: [{type: "elem", elem: body}],
|
|
}, options);
|
|
},
|
|
mathmlBuilder(group, options) {
|
|
const node = new mathMLTree.MathNode(
|
|
"mpadded", [mml.buildGroup(group.body, options)]);
|
|
const dy = group.dy.number + group.dy.unit;
|
|
node.setAttribute("voffset", dy);
|
|
return node;
|
|
},
|
|
});
|