UNPKG

@qtikit/mathml-to-latex

Version:

A JavaScript tool to convert mathml string to LaTeX string

22 lines (21 loc) 921 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 = (0, helpers_1.mathMLElementToLaTeXConverter)(children[0]).convert(); var subscript = (0, helpers_1.mathMLElementToLaTeXConverter)(children[1]).convert(); return "".concat(base, "_").concat(new helpers_1.BracketWrapper().wrap(subscript)); }; return MSub; }()); exports.MSub = MSub;