· 4 min read
How to Write LaTeX Equations With a Preview
Heshan Fernando
Co-founder & COO
You need one equation in a document. Installing a full TeX distribution to typeset a quadratic formula is disproportionate, and the equation editor in most word processors produces something that looks approximately right and behaves badly when you edit it.
LaTeX’s maths syntax is the standard for a reason, and you can use it without adopting the entire ecosystem.
The commands that cover most equations
Maths mode is a small language. These do most of the work:
\frac{a}{b}— a fractionx^2andx_i— superscript and subscript\sqrt{x}and\sqrt[3]{x}— roots\sum_{i=1}^{n}and\int_a^b— sums and integrals with limits\alpha \beta \theta \pi— Greek letters, named\pm \times \cdot \leq \geq \neq \approx— the operators that aren’t on a keyboard\begin{matrix} … \end{matrix}— matrices
The quadratic formula is \frac{-b \pm \sqrt{b^2-4ac}}{2a} — 34 characters, and once you can read that you can read most equations you’ll meet.
Braces group things. x^2n renders as x² followed by n; x^{2n} puts both in the exponent. That single rule accounts for a large share of beginner confusion.
Inline versus display mode
Inline maths sits in a line of text with compressed spacing — limits go beside operators rather than above and below, and tall constructions get squeezed to keep the line height reasonable.
Display mode puts the equation on its own centred line with full spacing and full-size operators.
Using inline mode for a tall fraction makes the line height jump and the surrounding paragraph look broken. Using display mode for a short expression inside a sentence breaks the flow. It’s a choice about the sentence, not about the equation.
Why MathML matters
An equation rendered as an image is invisible to a screen reader, unsearchable, and fixed at one resolution.
MathML is markup that describes the mathematical structure, so assistive technology can read it aloud correctly — distinguishing a superscript from a subscript, reading a fraction as “a over b”. Browser support has improved considerably, and where the destination accepts it, MathML is meaningfully better than an image.
Export as an image only when nothing else is accepted.
| Output | Accessible? | Scales? | Use when |
|---|---|---|---|
| LaTeX source | Yes, if rendered | Yes | Destination renders LaTeX |
| MathML | Yes | Yes | Web, accessible documents |
| Image | No | No | Last resort |
Common mistakes to avoid
- Omitting braces around multi-character exponents and subscripts.
- Using display mode inside a sentence, which breaks the paragraph.
- Typing Greek letters as lookalike Latin characters, which renders wrongly and breaks search.
- Exporting an image when the destination supports MathML.
- Writing
sin(x)rather than\sin(x), which italicises the function name incorrectly.
How to do it with LaTeX Equation Editor
The LaTeX Equation Editor previews as you type, in your browser.
- Type or paste LaTeX — the preview updates as you go, which is how you learn the syntax fastest.
- Choose inline or display mode based on where the equation sits.
- Copy the source for a LaTeX document, or MathML for the web.
- Fall back to an image only if the destination accepts nothing else.
The MathJax documentation lists every supported command if you need something unusual. Other education tools are in the tools directory.
Frequently asked questions
Do I need to install LaTeX?
Not for equations. Rendering maths in a browser uses a JavaScript typesetter, which handles the maths subset without a full TeX distribution. Full documents still need one.
What’s the difference between inline and display mode?
Inline maths sits in a line of text with compressed spacing; display mode is centred on its own line with full spacing and larger operators. Using inline for a tall fraction makes the line height jump.
Should I copy as MathML?
If the destination supports it, yes — MathML is readable by screen readers, which an image of an equation never is.
Final thought
Learn braces, fractions, and the named Greek letters. That’s about twenty minutes and it covers most of the maths anyone writes outside a research paper.