Function
src/index.ts:416nerdamer.pretty
nerdamer.pretty(e: string | ParserEntity, type: "text" | "TeX"): stringFormats a parser entity or notation string as TeX or normalized text.
Parameters
| Name | Type | Description |
|---|---|---|
e | string | ParserEntity | Parser entity or notation string to format. |
type | "text" | "TeX" | Output format. Defaults to `'TeX'`. |
Returns
string — Formatted text without modifying an entity input.
Examples
const f = nerdamer('x^2+1+2*x');
nerdamer.pretty(f, 'text'); // 'x^2+2*x+1'
nerdamer.pretty(f, 'TeX'); // 'x^{2}+2 \\cdot x+1'
nerdamer.pretty('a*x+b*x^2+cos(x)', 'text'); // 'cos(x)+a*x+b*x^2'