How to write a formula in LaTeX here
- Start typing in the editor, or press a snippet button to insert a common structure, then replace the placeholders with your own symbols.
- Watch the preview. KaTeX renders the formula as you type. If the preview stops updating or looks wrong, look for a missing brace or a misspelled command near your last change, and use undo if needed.
- Copy the result. Use Copy LaTeX for documents, Overleaf or Markdown with maths support, or Copy MathML for web pages and some word processors.
New to LaTeX? The LaTeX basics guide covers the commands most formulas need.
Why there is no automatic image recognition yet
Recognising printed formulas from a picture needs a dedicated maths model; general OCR engines such as Tesseract read formulas poorly. We evaluated an MIT-licensed model that can run in the browser (pix2text MFR in ONNX format). Two things stopped us shipping it:
- It is about 112 MB to download, which is a heavy first visit, particularly on a phone connection.
- We have not yet verified that it meets our own bar of at least 70% exact matches on our formula test set. We would rather say “not yet” than ship recognition that looks confident and is wrong.
Automatic formula recognition is on our list. Until then, the editor is honest about what it does: it helps you write and check LaTeX quickly.
In practice, the fastest route from a printed formula to LaTeX today is to keep the image open beside the editor, type the structure from the outside in (the fraction or sum first, then what goes inside it) and let the live preview confirm each step. Short formulas take seconds once you know a dozen commands, and you know the result is right because you checked it against the source yourself.
Tips for getting formulas right
Formula accuracy is about structure rather than letters. These habits catch most mistakes:
- Group with braces.
x^{10}raises x to 10;x^10gives x¹ followed by 0. - Use
\left( … \right)around tall fractions so the brackets grow with them. - Use named functions such as
\sin,\logand\limso they render upright instead of as italic letters. - Compare against the source. Read the preview symbol by symbol against your original, especially signs, indices and limits of sums and integrals.
Text around formulas, and languages
If you have a page that mixes prose and maths, run it through Image to text first to get the words, in English, Spanish, French, German, Portuguese, Italian, Chinese (Simplified or Traditional), Japanese or Korean, then rebuild the formulas here and paste them in. Image to text works best on images at about 300 dpi with letters at least 20 px tall, good contrast, a straight page and even lighting.
Limits and what you get
- KaTeX supports a large part of LaTeX maths but not every package. Commands from packages such as TikZ will not render.
- The editor is for formulas, not whole LaTeX documents: preambles,
\usepackagelines and document structure are not processed. - MathML output is generated by KaTeX; most modern browsers display it, but some editors import it imperfectly.
- Everything runs in your browser and nothing you type is sent to a server.
Frequently asked questions
Can I upload a photo of an equation and get LaTeX?
Not yet. The model we tested is about 112 MB and we have not verified that it reaches our 70% exact-match bar on our own test formulas, so we have not shipped it. Automatic formula recognition is on our list.
What is the difference between Copy LaTeX and Copy MathML?
LaTeX is the source text you paste into LaTeX documents, Overleaf or Markdown editors with maths support. MathML is a markup format for maths on web pages and in some word processors.
Why does the preview not render my formula?
Usually a brace is missing, or a command is misspelled or not supported by KaTeX. Check the most recent change first, or use undo to step back to the last version that rendered.
Can I paste the LaTeX into Word?
Recent versions of Microsoft Word accept many LaTeX expressions in the equation editor. Results vary by version, so check the rendered equation after pasting.
Is my formula stored anywhere?
No. The editor and KaTeX run entirely in your browser. Nothing you type is sent to our server.
Related
- LaTeX Basics for Math Formulas: A Practical Primer
- Sample documents with measured accuracy
- Image to text — Photos, screenshots and scans to editable text. Up to 50 images per batch.
- Table to Excel — Rebuild a table grid from word positions and download .xlsx.
- Scanned PDF to text — Image-only PDFs up to 50 pages, page by page, with DOCX export.