• Home
  • Raw
  • Download

Lines Matching defs:text

48  * It consists of the token text plus some position information.
59 constructor(text, // the text of this token
61 this.text = void 0;
63 this.text = text;
73 text) // the text of the newly constructed token
75 return new Token(text, SourceLocation.range(this, endToken));
187 * Escapes text to prevent scripting attacks.
190 function escape(text) {
191 return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
451 * Get a text or display version of this style.
455 text() {
456 return styles[text[this.id]];
488 const text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.
501 * characters from that script to appear in \text{} environments.
511 * Unicode block data for the families of scripts we support in \text{}.
516 // Needed for Czech, Hungarian and Turkish text, for example.
1338 * to a single text node, or a span with a single text node in it, depending on
1343 constructor(text, height, depth, italic, skew, width, classes, style) {
1344 this.text = void 0;
1353 this.text = text;
1361 this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
1369 const script = scriptFromCodepoint(this.text.charCodeAt(0));
1375 if (/[îïíì]/.test(this.text)) {
1377 this.text = iCombinations[this.text];
1385 * Creates a text node or span from a symbol node. Note that a span is only
1391 const node = document.createTextNode(this.text);
1454 const escaped = utils.escape(this.text);
3945 if (!metrics && mode === 'text') {
3947 // But since we support them in text mode, we need to return
4015 * accepted in (e.g. "math" or "text").
4018 // types for raw text tokens, and we want to avoid conflicts with higher-level
4038 "text": {}
4057 const text$1 = "text"; // fonts:
4104 defineSymbol(text$1, main, textord, "\u0023", "\\#");
4106 defineSymbol(text$1, main, textord, "\u0026", "\\&");
4123 defineSymbol(text$1, main, textord, "\u00a7", "\\S", true);
4124 defineSymbol(text$1, main, textord, "\u00b6", "\\P", true); // Math and Text
4127 defineSymbol(text$1, main, textord, "\u2020", "\\dag");
4128 defineSymbol(text$1, main, textord, "\u2020", "\\textdagger");
4130 defineSymbol(text$1, main, textord, "\u2021", "\\ddag");
4131 defineSymbol(text$1, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
4246 defineSymbol(text$1, ams, textord, "\u00ae", "\\circledR");
4269 defineSymbol(text$1, ams, textord, "\u00a5", "\\yen", true);
4271 defineSymbol(text$1, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew
4424 defineSymbol(text$1, main, textord, "$", "\\$");
4425 defineSymbol(text$1, main, textord, "$", "\\textdollar");
4427 defineSymbol(text$1, main, textord, "%", "\\%");
4429 defineSymbol(text$1, main, textord, "_", "\\_");
4430 defineSymbol(text$1, main, textord, "_", "\\textunderscore");
4555 defineSymbol(text$1, main, spacing, "\u00a0", "\\ ");
4556 defineSymbol(text$1, main, spacing, "\u00a0", "~");
4557 defineSymbol(text$1, main, spacing, "\u00a0", "\\space");
4558 defineSymbol(text$1, main, spacing, "\u00a0", "\\nobreakspace");
4580 defineSymbol(text$1, main, textord, "{", "\\{");
4581 defineSymbol(text$1, main, textord, "{", "\\textbraceleft");
4583 defineSymbol(text$1, main, textord, "}", "\\}");
4584 defineSymbol(text$1, main, textord, "}", "\\textbraceright");
4588 defineSymbol(text$1, main, textord, "[", "\\lbrack");
4590 defineSymbol(text$1, main, textord, "]", "\\rbrack");
4593 defineSymbol(text$1, main, textord, "<", "\\textless"); // in T1 fontenc
4595 defineSymbol(text$1, main, textord, ">", "\\textgreater"); // in T1 fontenc
4604 defineSymbol(text$1, main, textord, "|", "\\textbar"); // in T1 fontenc
4608 defineSymbol(text$1, main, textord, "\u2225", "\\textbardbl");
4609 defineSymbol(text$1, main, textord, "~", "\\textasciitilde");
4610 defineSymbol(text$1, main, textord, "\\", "\\textbackslash");
4611 defineSymbol(text$1, main, textord, "^", "\\textasciicircum");
4638 defineSymbol(text$1, main, inner, "\u2026", "\\textellipsis");
4640 defineSymbol(text$1, main, inner, "\u2026", "\\ldots", true);
4659 defineSymbol(text$1, main, textord, "\u0131", "\\i", true);
4660 defineSymbol(text$1, main, textord, "\u0237", "\\j", true);
4661 defineSymbol(text$1, main, textord, "\u00df", "\\ss", true);
4662 defineSymbol(text$1, main, textord, "\u00e6", "\\ae", true);
4663 defineSymbol(text$1, main, textord, "\u00e6", "\\ae", true);
4664 defineSymbol(text$1, main, textord, "\u0153", "\\oe", true);
4665 defineSymbol(text$1, main, textord, "\u00f8", "\\o", true);
4666 defineSymbol(text$1, main, textord, "\u00c6", "\\AE", true);
4667 defineSymbol(text$1, main, textord, "\u0152", "\\OE", true);
4668 defineSymbol(text$1, main, textord, "\u00d8", "\\O", true);
4669 defineSymbol(text$1, main, accent, "\u02ca", "\\'"); // acute
4671 defineSymbol(text$1, main, accent, "\u02cb", "\\`"); // grave
4673 defineSymbol(text$1, main, accent, "\u02c6", "\\^"); // circumflex
4675 defineSymbol(text$1, main, accent, "\u02dc", "\\~"); // tilde
4677 defineSymbol(text$1, main, accent, "\u02c9", "\\="); // macron
4679 defineSymbol(text$1, main, accent, "\u02d8", "\\u"); // breve
4681 defineSymbol(text$1, main, accent, "\u02d9", "\\."); // dot above
4683 defineSymbol(text$1, main, accent, "\u02da", "\\r"); // ring above
4685 defineSymbol(text$1, main, accent, "\u02c7", "\\v"); // caron
4687 defineSymbol(text$1, main, accent, "\u00a8", '\\"'); // diaresis
4689 defineSymbol(text$1, main, accent, "\u02dd", "\\H"); // double acute
4691 defineSymbol(text$1, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph
4700 defineSymbol(text$1, main, textord, "\u2013", "--");
4701 defineSymbol(text$1, main, textord, "\u2013", "\\textendash");
4702 defineSymbol(text$1, main, textord, "\u2014", "---");
4703 defineSymbol(text$1, main, textord, "\u2014", "\\textemdash");
4704 defineSymbol(text$1, main, textord, "\u2018", "`");
4705 defineSymbol(text$1, main, textord, "\u2018", "\\textquoteleft");
4706 defineSymbol(text$1, main, textord, "\u2019", "'");
4707 defineSymbol(text$1, main, textord, "\u2019", "\\textquoteright");
4708 defineSymbol(text$1, main, textord, "\u201c", "``");
4709 defineSymbol(text$1, main, textord, "\u201c", "\\textquotedblleft");
4710 defineSymbol(text$1, main, textord, "\u201d", "''");
4711 defineSymbol(text$1, main, textord, "\u201d", "\\textquotedblright"); // \degree from gensymb package
4714 defineSymbol(text$1, main, textord, "\u00b0", "\\degree"); // \textdegree from inputenc package
4716 defineSymbol(text$1, main, textord, "\u00b0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math
4721 defineSymbol(text$1, main, mathord, "\u00a3", "\\pounds");
4722 defineSymbol(text$1, main, mathord, "\u00a3", "\\textsterling", true);
4724 defineSymbol(text$1, ams, textord, "\u2720", "\\maltese");
4725 defineSymbol(text$1, main, spacing, "\u00a0", "\\ ");
4726 defineSymbol(text$1, main, spacing, "\u00a0", " ");
4727 defineSymbol(text$1, main, spacing, "\u00a0", "~"); // There are lots of symbols which are the same, so we add them in afterwards.
4735 } // All of these are textords in text mode
4742 defineSymbol(text$1, main, textord, ch, ch);
4743 } // All of these are textords in text mode, and mathords in math mode
4751 defineSymbol(text$1, main, textord, ch, ch);
4757 defineSymbol(text$1, ams, textord, "C", "\u2102");
4759 defineSymbol(text$1, ams, textord, "H", "\u210D");
4761 defineSymbol(text$1, ams, textord, "N", "\u2115");
4763 defineSymbol(text$1, ams, textord, "P", "\u2119");
4765 defineSymbol(text$1, ams, textord, "Q", "\u211A");
4767 defineSymbol(text$1, ams, textord, "R", "\u211D");
4769 defineSymbol(text$1, ams, textord, "Z", "\u2124");
4772 defineSymbol(text$1, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
4788 defineSymbol(text$1, main, textord, ch, wideChar);
4792 defineSymbol(text$1, main, textord, ch, wideChar);
4796 defineSymbol(text$1, main, textord, ch, wideChar);
4800 defineSymbol(text$1, main, textord, ch, wideChar);
4804 defineSymbol(text$1, main, textord, ch, wideChar);
4808 defineSymbol(text$1, main, textord, ch, wideChar);
4812 defineSymbol(text$1, main, textord, ch, wideChar);
4816 defineSymbol(text$1, main, textord, ch, wideChar);
4824 defineSymbol(text$1, main, textord, ch, wideChar);
4828 defineSymbol(text$1, main, textord, ch, wideChar);
4837 defineSymbol(text$1, main, textord, "k", wideChar); // Next, some wide character numerals
4844 defineSymbol(text$1, main, textord, ch, wideChar);
4848 defineSymbol(text$1, main, textord, ch, wideChar);
4852 defineSymbol(text$1, main, textord, ch, wideChar);
4856 defineSymbol(text$1, main, textord, ch, wideChar);
4868 defineSymbol(text$1, main, textord, ch, ch);
4871 defineSymbol(text$1, main, textord, "ð", "ð"); // Unicode versions of existing characters
4873 defineSymbol(text$1, main, textord, "\u2013", "–");
4874 defineSymbol(text$1, main, textord, "\u2014", "—");
4875 defineSymbol(text$1, main, textord, "\u2018", "‘");
4876 defineSymbol(text$1, main, textord, "\u2019", "’");
4877 defineSymbol(text$1, main, textord, "\u201c", "“");
4878 defineSymbol(text$1, main, textord, "\u201d", "”");
4893 * * The CSS class of that group when in text mode.
5096 style: this.style.text(),
5110 style = style || this.style.text();
5150 style: this.style.text(),
5175 * Creates a new options object with the given math font or old text font.
5352 unitOptions = options.havingStyle(options.style.text());
5356 // *text* font, e.g. cmr10. KaTeX instead uses values from the
5423 if (mode === "text" || options && options.font === "mathit") {
5465 // text ordinal and is therefore not present as a symbol in the symbols
5466 // table for text, as well as a special case for boldsymbol because it
5554 const text = group.text;
5557 const isFont = mode === "math" || mode === "text" && options.font;
5560 if (text.charCodeAt(0) === 0xD835) {
5562 const _wideCharacterFont = wideCharacterFont(text, mode),
5566 return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));
5572 const fontData = fontOrFamily === "boldsymbol" ? boldsymbol(text, mode, options, classes) : mathnormal(text, mode, options, classes);
5575 } else if (utils.contains(mathitLetters, text)) {
5586 if (lookupSymbol(text, fontName, mode).metrics) {
5587 return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
5588 } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") {
5592 for (let i = 0; i < text.length; i++) {
5593 parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));
5602 const fontLookup = mathdefault(text, mode, options, classes);
5603 return makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass]));
5605 const font = symbols[mode][text] && symbols[mode][text].font;
5609 return makeSymbol(text, fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
5612 return makeSymbol(text, fontName, mode, options, classes.concat(options.fontWeight, options.fontShape));
5617 return makeSymbol(text, fontName, mode, options, classes.concat(fontName, options.fontWeight, options.fontShape));
5660 prev.text += next.text;
5914 // text content. And that min-height over-rides our desired height.
6198 // Spacing relationships for display and text styles
6363 // and the text before Rule 19.
6369 "text": Style$1.TEXT,
6714 * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
6807 * This node represents a piece of text.
6811 constructor(text) {
6812 this.text = void 0;
6813 this.text = text;
6816 * Converts the text node into a DOM text node.
6821 return document.createTextNode(this.text);
6824 * Converts the text node into escaped HTML markup
6825 * (representing the text itself).
6833 * Converts the text node into a string
6834 * (representing the text iteself).
6839 return this.text;
6844 * This node represents a space, but may render as <mspace.../> or as text,
6935 * Takes a symbol and converts it into a MathML text node after performing
6938 const makeText = function makeText(text, mode, options) {
6939 if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) {
6940 text = symbols[mode][text].replace;
6943 return new mathMLTree.TextNode(text);
6962 // Handle \text... font specifiers as best we can.
7012 let text = group.text;
7014 if (utils.contains(["\\imath", "\\jmath"], text)) {
7018 if (symbols[mode][text] && symbols[mode][text].replace) {
7019 text = symbols[mode][text].replace;
7024 if (getCharacterMetrics(text, fontName, mode)) {
7067 if (child instanceof TextNode && child.text === '.') {
7074 if (lastChild instanceof TextNode && lastChild.text === '\u0338' && (group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) {
7077 if (child instanceof TextNode && child.text.length > 0) {
7079 child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1);
7616 text: group.label
7956 number += node.text;
7968 text: String.fromCharCode(code)
8129 * normal font, but in either text, script, or scriptscript style.
8191 const text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options);
8192 const span = styleWrap(text, style, options, classes);
8686 // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
8860 if (symDelim && utils.contains(delimiters, symDelim.text)) {
8863 throw new ParseError("Invalid delimiter: '" + (symDelim ? symDelim.text : JSON.stringify(delim)) + "' after '" + context.funcName + "'", delim);
8880 delim: delim.text
8941 delim: checkDelimiter(args[0], context).text,
8968 left: delim.text,
9080 delim: delim.text
9109 const textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
9289 argTypes: ["color", "text"]
9316 argTypes: ["color", "color", "text"]
9426 let nxt = parser.fetch().text;
9432 nxt = parser.fetch().text;
9441 * ("text", "display", etc.), then each cell is cast into that style.
9501 const next = parser.fetch().text;
9554 return "text";
9956 arg0 += textord.text;
10030 const ca = node.text;
10131 const ca = node.text; // {subarray} only recognizes "l" & "c"
10267 type: "text",
10292 argTypes: ["text"]
10307 envName += assertNodeType(nameGroup.body[i], "textord").text;
10624 // If incoming style is sub/sup, use style.text() to get correct size.
10625 style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY;
10626 } else if (size === "text" && style.size === Style$1.DISPLAY.size) {
10898 size = "text";
10968 const stylArray = ["display", "text", "script", "scriptscript"];
10987 argTypes: ["math", "math", "size", "text", "math", "math"]
11001 const leftDelim = leftNode ? delimFromValue(leftNode.text) : null;
11008 const rightDelim = rightNode ? delimFromValue(rightNode.text) : null;
11030 size = stylArray[Number(textOrd.text)];
11034 size = stylArray[Number(styl.text)];
11316 mode: "text",
11317 text: c
11322 type: "text",
11676 style: "text",
11684 type: "text",
11705 return group.text;
11714 return group.text;
11730 text: ordargument(args[1]),
11943 // Otherwise, this is a text operator. Build the text from the
11999 // This is a text operator. Add all of the characters from the
12004 const operator = new MathNode("mo", [makeText("\u2061", "text")]);
12196 // $FlowFixMe: Check if the node has a string `text` property.
12197 const childText = child.text;
12203 text: childText
12218 child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
12258 child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
12284 const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
12694 const node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.
12696 letter = node.text;
12894 "text": Style$1.TEXT,
12941 "text": ["0", "false"],
13121 } // Wrap the supsub vlist in a span.msupsub to reset text-align.
13204 return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]);
13208 const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
13243 const node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]);
13262 const text = makeText(group.text, group.mode, options);
13266 if (group.mode === 'text') {
13267 node = new mathMLTree.MathNode("mtext", [text]);
13268 } else if (/[0-9]/.test(group.text)) {
13271 node = new mathMLTree.MathNode("mn", [text]);
13272 } else if (group.text === "\\prime") {
13273 node = new mathMLTree.MathNode("mo", [text]);
13275 node = new mathMLTree.MathNode("mi", [text]);
13313 if (regularSpace.hasOwnProperty(group.text)) {
13314 const className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these
13318 if (group.mode === "text") {
13323 return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options);
13325 } else if (cssSpace.hasOwnProperty(group.text)) {
13327 return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options);
13329 throw new ParseError(`Unknown type of space "${group.text}"`);
13336 if (regularSpace.hasOwnProperty(group.text)) {
13338 } else if (cssSpace.hasOwnProperty(group.text)) {
13342 throw new ParseError(`Unknown type of space "${group.text}"`);
13374 "\\text": undefined,
13404 type: "text",
13406 "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
13411 argTypes: ["text"],
13421 type: "text",
13431 return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions);
13513 const text = makeVerb(group);
13514 const body = []; // \verb enters text mode and therefore is sized like \textstyle
13516 const newOptions = options.havingStyle(options.style.text());
13518 for (let i = 0; i < text.length; i++) {
13519 let c = text[i];
13528 return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);
13532 const text = new mathMLTree.TextNode(makeVerb(group));
13533 const node = new mathMLTree.MathNode("mtext", [text]);
13638 let text = match[2] || " ";
13640 if (this.catcodes[text] === 14) {
13656 const controlMatch = text.match(controlWordWhitespaceRegex);
13659 text = controlMatch[1];
13662 return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
13831 if (args[0].length === 1 && args[0][0].text === nextToken.text) {
13847 defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode
13852 if (context.mode === 'text') {
13903 if (token.text === "'") {
13906 } else if (token.text === '"') {
13909 } else if (token.text === "`") {
13912 if (token.text[0] === "\\") {
13913 number = token.text.charCodeAt(1);
13914 } else if (token.text === "EOF") {
13917 number = token.text.charCodeAt(0);
13925 number = digitToNumber[token.text];
13928 throw new ParseError(`Invalid base-${base} digit ${token.text}`);
13933 while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
13955 const name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ...
13960 while (arg.length === 1 && arg[0].text === "#") {
13967 if (!/^[1-9]$/.test(arg[0].text)) {
13968 throw new ParseError(`Invalid argument number "${arg[0].text}"`);
13973 if (parseInt(arg[0].text) !== numArgs) {
13974 throw new ParseError(`Argument number "${arg[0].text}" out of order`);
13997 const command = next[0].text; // TODO: Should expand command
14016 const name = arg[0].text;
14030 if (arg.length === 1 && arg[0].text === "[") {
14034 while (token.text !== "]" && token.text !== "EOF") {
14036 argText += token.text;
14077 // \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
14080 defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
14101 defineMacro("\u00b7", "\\cdotp"); // \llap and \rlap render their contents in text mode
14235 // TODO: If used in text mode, should expand to \textellipsis.
14237 // (in text mode), and it's unlikely we'd see any of the math commands
14238 // that affect the behavior of \dots when in text mode. So fine for now
14241 const next = context.expandAfterFuture().text;
14280 const next = context.future().text;
14289 const next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for
14299 const next = context.future().text;
14368 return "\\gdef\\df@tag{\\text{#1}}";
14393 // support \@ yet, so that's omitted, and we add \text so that the result
14532 // We also omit texvc's \O, which conflicts with \text{\O}
14706 * Switches between "text" and "math" modes.
14778 if (token.text === " ") {
14799 if (startOfArg.text === "{") {
14807 if (tok.text === "{") {
14809 } else if (tok.text === "}") {
14811 } else if (tok.text === "EOF") {
14821 } else if (startOfArg.text === "EOF") {
14854 const name = topToken.text;
14881 if (tok.text === "#") {
14888 if (tok.text === "#") {
14891 } else if (/^[1-9]$/.test(tok.text)) {
14893 tokens.splice(i, 2, ...args[+tok.text - 1]);
14929 if (expanded.text === "\\relax") {
14976 return tokens.map(token => token.text).join("");
15012 while (tok.text !== "EOF") {
15037 return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
15042 // Mapping of Unicode accent characters to their LaTeX equivalent in text and
15046 text: "\\'",
15050 text: '\\`',
15054 text: '\\"',
15058 text: '\\~',
15062 text: '\\=',
15066 text: '\\u',
15070 text: '\\v',
15074 text: '\\^',
15078 text: '\\.',
15082 text: '\\r',
15086 text: '\\H'
15747 * "text", which denotes whether the current environment is a math-y
15748 * one or a text-y one (e.g. inside \text). Currently, this serves to
15749 * limit the functions which can be used in text mode.
15784 expect(text, consume) {
15789 if (this.fetch().text !== text) {
15790 throw new ParseError(`Expected '${text}', got '${this.fetch().text}'`, this.fetch());
15820 * Switches between "text" and "math" modes.
15865 if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
15869 if (breakOnTokenText && lex.text === breakOnTokenText) {
15873 if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
15886 if (this.mode === "text") {
15964 const symbol = symbolToken.text;
15975 * Converts the textual input of an unsupported command into a text node
15980 formatUnsupportedCmd(text) {
15983 for (let i = 0; i < text.length; i++) {
15986 mode: "text",
15987 text: text[i]
15992 type: "text",
16012 const base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts
16014 if (this.mode === "text") {
16028 if (lex.text === "\\limits" || lex.text === "\\nolimits") {
16033 const limits = lex.text === "\\limits";
16040 const limits = lex.text === "\\limits";
16048 } else if (lex.text === "^") {
16055 } else if (lex.text === "_") {
16062 } else if (lex.text === "'") {
16071 text: "\\prime"
16077 while (this.fetch().text === "'") {
16085 if (this.fetch().text === "^") {
16125 const func = token.text;
16136 } else if (this.mode === "text" && !funcData.allowedInText) {
16137 throw new ParseError("Can't use function '" + func + "' in text mode", token);
16246 case "text":
16252 // \hbox, which is like \text but switching to \textstyle size.
16253 const group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces);
16263 style: "text" // simulate \textstyle
16275 if (optional && this.fetch().text === "{") {
16284 mode: "text",
16285 string: token.text
16307 while (this.fetch().text === " ") {
16323 if (beginToken.text !== groupBegin) {
16326 } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) {
16333 this.mode = "text";
16342 while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) {
16343 switch (nextToken.text) {
16357 str += lastToken.text;
16374 this.mode = "text";
16380 while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
16382 str += lastToken.text;
16387 throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
16405 const match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
16408 throw new ParseError("Invalid color: '" + res.text + "'", res);
16435 if (!optional && this.fetch().text !== "{") {
16445 if (!optional && res.text.length === 0) {
16449 res.text = "0pt"; // Enable \above{}
16454 const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
16457 throw new ParseError("Invalid size: '" + res.text + "'", res);
16498 const url = res.text.replace(/\\([#$%&~_^{}])/g, '$1');
16536 const text = firstToken.text;
16539 if (optional ? text === "[" : text === "{" || text === "\\begingroup") {
16541 const groupEnd = Parser.endOfGroup[text]; // Start a new group namespace
16560 semisimple: text === "\\begingroup" || undefined
16570 if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) {
16572 throw new ParseError("Undefined control sequence: " + text, firstToken);
16575 result = this.formatUnsupportedCmd(text);
16588 * Form ligature-like combinations of characters for text mode.
16601 const a = group[i]; // $FlowFixMe: Not every node type has a `text` property.
16603 const v = a.text;
16605 if (v === "-" && group[i + 1].text === "-") {
16606 if (i + 1 < n && group[i + 2].text === "-") {
16609 mode: "text",
16611 text: "---"
16617 mode: "text",
16619 text: "--"
16625 if ((v === "'" || v === "`") && group[i + 1].text === v) {
16628 mode: "text",
16630 text: v + v
16644 let text = nucleus.text;
16646 if (/^\\verb[^a-zA-Z]/.test(text)) {
16648 let arg = text.slice(5);
16666 mode: "text",
16674 if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) {
16677 this.settings.reportNonstrict("unicodeTextInMathMode", `Accented Unicode text character "${text[0]}" used in ` + `math mode`, nucleus);
16680 text = unicodeSymbols[text[0]] + text.substr(1);
16684 const match = combiningDiacriticalMarksEndRegex.exec(text);
16687 text = text.substring(0, match.index);
16689 if (text === 'i') {
16690 text = '\u0131'; // dotless i, in math and text mode
16691 } else if (text === 'j') {
16692 text = '\u0237'; // dotless j, in math and text mode
16699 if (symbols[this.mode][text]) {
16700 if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {
16701 this.settings.reportNonstrict("unicodeTextInMathMode", `Latin-1/Unicode text character "${text[0]}" used in ` + `math mode`, nucleus);
16704 const group = symbols[this.mode][text].group;
16716 text
16724 text
16729 } else if (text.charCodeAt(0) >= 0x80) {
16732 if (!supportedCodepoint(text.charCodeAt(0))) {
16733 this.settings.reportNonstrict("unknownSymbol", `Unrecognized Unicode character "${text[0]}"` + ` (${text.charCodeAt(0)})`, nucleus);
16735 this.settings.reportNonstrict("unicodeTextInMathMode", `Unicode text character "${text[0]}" used in math mode`, nucleus);
16738 // are in text mode (wrapped in \text) because that's what it
16748 mode: "text",
16750 text
16800 * `breakOnTokenText`: The text of the token that the expression should end
16835 mode: "text",