AsciiMath Editor
Write and preview AsciiMath in your browser, check delimiter balance and token use, and produce MathML plus a reviewable LaTeX draft.{{ latexSource || 'LaTeX draft is unavailable until MathJax produces structured MathML.' }}
{{ mathmlSource || 'MathML is unavailable until the expression renders.' }}
| Check | State | Review before handoff | Copy |
|---|---|---|---|
| {{ row.check }} | {{ row.state }} | {{ row.review }} |
AsciiMath expresses mathematical structure with ordinary keyboard characters. Fractions use a slash, powers and subscripts use ^ and _, and familiar names such as sqrt, sum, or alpha stand for mathematical operators and symbols. It is useful when writing full LaTeX commands would interrupt the flow of a note, lesson, message, or draft.
| Intent | AsciiMath | Reading |
|---|---|---|
| Fraction | a/(b+c) | a over the grouped denominator b + c |
| Square root | sqrt(x) | Square root of x |
| Power | x^2 | x squared |
| Subscript | x_i | x with subscript i |
| Summation limits | sum_(i=1)^n i | Sum i from 1 through n |
| Matrix | [(a,b),(c,d)] | A two-by-two matrix |
Compact notation still depends on grouping. Parentheses around a denominator or function argument can change the rendered expression, and an unmatched bracket can make the intended structure ambiguous. A successful render shows how one parser understood the source; it does not prove the equation is mathematically correct.
Rendered math, MathML, and LaTeX serve different destinations. A visual preview is useful for proofreading, MathML preserves structured mathematical markup, and a generated LaTeX draft can help move common structures into a TeX workflow. Conversion between notations is not perfectly reversible, so the original AsciiMath remains the reference for later edits.
How to Use This Tool:
Write one expression, choose how it will sit in surrounding content, and compare the source with the rendered structure.
- Type or paste AsciiMath source, insert a common structure, or load one
.am,.asciimath, or text file up to 100 KB. Source is limited to 12,000 characters. - Choose Display or Inline. Display centers a standalone equation; Inline sizes it for surrounding prose. Preview scale changes only the on-page review size.
- Compare the rendered equation with the source. Check fractions, roots, scripts, limits, matrices, and spacing rather than relying only on a ready status.
- Review the conversion ledger before reusing MathML or the LaTeX draft. Repair an unmatched delimiter or quoted string if Grouping reports Review.
Interpreting Results:
- Rendered means the current source produced synchronized visual and structured outputs. It is not a check of algebra, units, or proof logic.
- Balanced means parentheses, square brackets, braces, and quoted text passed a lexical stack check. It does not confirm every token is supported or used as intended.
- Token counts cover recognized functions, Greek names, large operators, relations, accents, and operator symbols. Ordinary variable names and numbers may not appear in that profile.
- Test generated MathML and the LaTeX draft in the receiving editor, browser, or publishing system before discarding the original source.
Technical Details:
AsciiMath parsing turns a linear character sequence into a mathematical tree. Grouping marks determine which tokens become a numerator, denominator, exponent, subscript, function argument, or matrix cell. Display style changes layout but not the parsed source, conversion results, or lexical profile.
Transformation Core:
The visual and text artifacts share the same normalized AsciiMath source, then diverge according to their destination.
| Path | Intermediate form | Result | Review boundary |
|---|---|---|---|
| Preview | Parsed mathematical tree | SVG equation | Visual agreement with the intended grouping |
| MathML | Parsed mathematical tree | Serialized MathML | Compatibility and accessibility in the receiving system |
| LaTeX draft | Serialized MathML | Common LaTeX structures | Macros, fences, spacing, and unsupported MathML constructs |
| Token profile | Lexical scan of the original source | Counts by recognized family | Counts describe notation use, not mathematical validity |
The LaTeX draft maps common MathML nodes including fractions, square and indexed roots, superscripts, subscripts, under/over scripts, basic fenced expressions, matrices, text, selected Greek letters, and common operators. Unrecognized MathML containers fall back to their child content, so a visually plausible draft can still lose a specialized semantic or formatting distinction.
Rule Core:
The delimiter check scans the normalized source from left to right. It pushes (, [, and { onto a stack, requires each closing mark to match the most recent opening mark, and ignores delimiters inside paired double quotes. An unclosed quote, mismatched closing mark, or remaining opening mark returns Review.
| Family | Representative tokens | What the count means |
|---|---|---|
| Functions | sqrt, sin, log, text | Recognized named functions |
| Greek | alpha, theta, omega | Recognized Greek symbol names |
| Large operators | sum, prod, int, lim | Recognized large-operator names |
| Relations | =, <=, !=, in | Named or symbolic relations |
| Accents | hat, vec, cancel | Recognized accent names |
| Operators | +, -, *, /, ^, _ | Recognized operator symbols not classed as relations |
Leading and trailing whitespace is removed, and line endings are normalized before the audit. Preview scale accepts 100%, 125%, or 150%; it does not change the source, MathML, LaTeX draft, token counts, or downloaded SVG geometry.
Limitations and Privacy Notes:
Editing, lexical checks, file reading, and conversion outputs stay in the current browser. Rendering depends on the math renderer loading successfully, so a network or script-loading failure can leave conversions unavailable without changing the source.
- The delimiter scan is intentionally lexical and does not diagnose every AsciiMath syntax error.
- The LaTeX result is a bounded draft derived from MathML, not a lossless round trip or a complete TeX document.
- Rendered agreement should be checked at the target display style because inline and block layouts can place large-operator limits differently.
Worked Examples:
Summation identity
sum_(i=1)^n i = n(n+1)/2 produces a display equation with a lower limit, upper limit, grouped product, and fraction. Its delimiter check passes, while the token profile reports seven recognized tokens across six distinct symbols or names. The preview still needs a human check that the bounds and denominator match the intended identity.
References:
- AsciiMath notation and syntax, AsciiMath project.
- AsciiMath Support, MathJax 3.2 documentation.
- MathML Support, MathJax 3.2 documentation.