Function

nerdamer.pretty

src/index.ts:416
nerdamer.pretty(e: string | ParserEntity, type: "text" | "TeX"): string

Formats a parser entity or notation string as TeX or normalized text.

Parameters

NameTypeDescription
estring | ParserEntityParser 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'