1import tokenizeTex from "./tokenizeTex.js" 2import parseTokens from "./parseTokens.js" 3 4/** 5 * Parse a TeX math string into a MathJS expression tree. 6 * @returns Returns an object containing the root node of a MathJS expression tree 7 * and variables that need to be defined. 8 */ 9function parseTex(texStr) { 10 return parseTokens(tokenizeTex(texStr)) 11} 12 13/** 14 * Evaluate a TeX math string, returning the result as a MathJS MathType. 15 */ 16function evaluateTex(texStr, scope) { 17 const root = parseTex(texStr) 18 const evaluated = root.evaluate(scope) 19 return { evaluated, scope } 20} 21 22export { parseTex, evaluateTex }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.