mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-19 01:28:40 +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>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// @flow
|
|
import defineFunction, {ordargument} from "../defineFunction";
|
|
import buildCommon from "../buildCommon";
|
|
import mathMLTree from "../mathMLTree";
|
|
|
|
import * as html from "../buildHTML";
|
|
import * as mml from "../buildMathML";
|
|
|
|
// \hbox is provided for compatibility with LaTeX \vcenter.
|
|
// In LaTeX, \vcenter can act only on a box, as in
|
|
// \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}}
|
|
// This function by itself doesn't do anything but prevent a soft line break.
|
|
|
|
defineFunction({
|
|
type: "hbox",
|
|
names: ["\\hbox"],
|
|
props: {
|
|
numArgs: 1,
|
|
argTypes: ["text"],
|
|
allowedInText: true,
|
|
primitive: true,
|
|
},
|
|
handler({parser}, args) {
|
|
return {
|
|
type: "hbox",
|
|
mode: parser.mode,
|
|
body: ordargument(args[0]),
|
|
};
|
|
},
|
|
htmlBuilder(group, options) {
|
|
const elements = html.buildExpression(group.body, options, false);
|
|
return buildCommon.makeFragment(elements);
|
|
},
|
|
mathmlBuilder(group, options) {
|
|
return new mathMLTree.MathNode(
|
|
"mrow", mml.buildExpression(group.body, options)
|
|
);
|
|
},
|
|
});
|