Dev.to KaTeX vs Standard LaTeX — What Works and What Doesn't
Source: Dev.to
Context: Standard LaTeX vs. Dev.to
| Feature | Standard LaTeX | Dev.to (KaTeX) |
|---|---|---|
| Inline math | $x^2$ | {% katex inline %} x^2 {% endkatex %} |
| Display math | $$x^2$$ | {% katex %} x^2 {% endkatex %} |
| Multi‑line aligned equations | \begin{align} … \end{align} | Use aligned inside a KaTeX block (see below) |
| Piecewise functions | \begin{cases} … \end{cases} | Works inside KaTeX |
| Matrices | \begin{pmatrix} … \end{pmatrix} (and bmatrix, etc.) | All bracket types work |
| Custom layouts | \begin{array} … \end{array} | Works |
| Inline matrices | \begin{smallmatrix} … \end{smallmatrix} | Works |
Commonly supported notation
All of the following work as expected inside KaTeX blocks:
- Greek letters:
\alpha…\omega, uppercase too - Fractions:
\frac,\dfrac,\cfrac - Roots:
\sqrt,\sqrt[n] - Accents:
\hat,\bar,\tilde,\vec,\dot - Operators:
\sum,\prod,\int,\lim - Relations:
\leq,\geq,\neq,\sim,\cong,\equiv - Logic symbols:
\forall,\exists,\neg,\land,\lor - Set symbols:
\in,\subset,\cup,\cap,\emptyset - Arrows:
\to,\Rightarrow,\iff,\mapsto - Fonts:
\mathbb,\mathbf,\mathcal,\mathfrak,\mathrm,\text - Decorations:
\color,\boxed,\cancel,\underbrace,\overbrace
What Doesn’t Work ❌
1. align environment
The top‑level align environment (with automatic numbering) is not supported.
Won’t work
{% katex %}
\begin{align}
a &= b + c \\
&= d
\end{align}
{% endkatex %}
Use instead
{% katex %}
\begin{aligned}
a &= b + c \\
&= d
\end{aligned}
{% endkatex %}
aligned is a sub‑environment that works inside math mode, which is what KaTeX expects.
2. Custom macros (\newcommand)
Defining shortcuts with \newcommand is not supported.
% This doesn't work on Dev.to
\newcommand{\R}{\mathbb{R}}
\newcommand{\norm}[1]{\left\| #1 \right\|}
Workaround: Write the full command each time, or use your editor’s snippets / find‑and‑replace to speed up typing.
3. Labels and references (\label, \ref, \eqref)
Automatic numbering and cross‑references are unavailable.
\label{eq:main}
\ref{eq:main}
\eqref{eq:main}
Workaround: Use \tag{} for manual numbering.
{% katex %}
E = mc^2 \tag{1}
{% endkatex %}
You’ll need to renumber manually if you insert or remove equations.
4. Theorem‑style environments
Environments such as theorem and proof are not rendered.
\begin{theorem}
Every finite group of order p is cyclic.
\end{theorem}
\begin{proof}
...
\end{proof}
Workaround: Use Markdown blockquotes and bold text.
Theorem 1. Every finite group of order p is cyclic.
Proof
… proof content …
{% katex inline %} \square {% endkatex %}
5. Diagrams (TikZ, tikzcd, etc.)
The entire TikZ family is unsupported.
\begin{tikzcd}
A \arrow[r] & B
\end{tikzcd}
Workaround: Generate diagrams externally and embed them as images.

Useful external tools:
- quiver – commutative diagrams
- tikzjax – general TikZ rendering (export to SVG/PNG)
6. \DeclareMathOperator
Defining named operators with \DeclareMathOperator is not supported.
\DeclareMathOperator{\Hom}{Hom}
Workaround: Use \operatorname{} directly.
{% katex %}
\operatorname{Hom}(A, B)
{% endkatex %}
Quick Reference: Substitutions
| What you want | Standard LaTeX | Dev.to (KaTeX) equivalent |
|---|---|---|
| Aligned equations | \begin{align} … \end{align} | \begin{aligned} inside a {% katex %} block |
| Display equation | $$ … $$ | {% katex %} … {% endkatex %} |
| Inline equation | $ … $ | {% katex inline %} … {% endkatex %} |
| Custom macro | \newcommand{\R}{\mathbb{R}} | Write \mathbb{R} each time |
| Equation number | \label{…} + \ref{…} | Manual \tag{1} |
| Named operator | \DeclareMathOperator{\Hom}{Hom} | \operatorname{Hom} |
| Theorem box | \begin{theorem} … \end{theorem} | Markdown blockquote with bold heading |
| Diagram | tikz-cd | External image (![]()) |
When to Consider a Full LaTeX Platform
For most technical articles—algorithm analysis, machine‑learning math, basic proofs—KaTeX on Dev.to is sufficient. However, if you need:
- Commutative diagrams (category theory, algebra)
- Formal theorem/proof environments with auto‑numbering
- Complex TikZ drawings (graphs, automata)
- Custom macros for long documents
you may want a LaTeX‑native platform (e.g., Folio, Overleaf, etc.) where these features work out of the box.
Takeaway: Dev.to uses KaTeX via {% katex %} liquid tags—not the $…$ syntax. Most standard math notation works fine. The main gaps are the align environment, custom macros, automatic numbering, and diagram support. Knowing the workarounds lets you write clean, readable math on Dev.to for the vast majority of technical posts.