UNPKG

az-mathml-to-latex

Version:

A JavaScript tool to convert mathml string to LaTeX string

22 lines (21 loc) 953 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MSub = void 0; var helpers_1 = require("../../../helpers"); var errors_1 = require("../../../errors"); var MSub = /** @class */ (function () { function MSub(mathElement) { this._mathmlElement = mathElement; } MSub.prototype.convert = function () { var _a = this._mathmlElement, name = _a.name, children = _a.children; var childrenLength = children.length; if (childrenLength !== 2) throw new errors_1.InvalidNumberOfChildrenError(name, 2, childrenLength); var base = helpers_1.mathMLElementToLaTeXConverter(children[0]).convert(); var subscript = helpers_1.mathMLElementToLaTeXConverter(children[1]).convert(); return new helpers_1.ParenthesisWrapper().wrapIfMoreThanOneChar(base) + "_" + new helpers_1.BracketWrapper().wrap(subscript); }; return MSub; }()); exports.MSub = MSub;