If you're writing a math-heavy article — explaining an algorithm's correctness, proving a complexity bound, or walking through a cryptographic protocol — you need a way to clearly distinguish theorems, proofs, definitions, and examples from the surrounding text.
Standard LaTeX has dedicated environments for this (\begin{theorem}, \begin{proof}). Dev.to doesn't. But with some markdown techniques, you can get close.
Method 1: Blockquotes (Simplest)
Markdown blockquotes (>) give a visual distinction from body text:
> **Theorem 1 (Lagrange's Theorem).**
> For a finite group G and subgroup H,
> the order of H divides the order of G:
> {% katex %} |G| = [G : H] \cdot |H| {% endkatex %}
Theorem 1 (Lagrange's Theorem).
For a finite group G and subgroup H, the order of H divides the order of G:
Simple, reliable, and works everywhere.
Method 2: Collapsible Proofs
Long proofs can overwhelm readers. Use <details> to make them collapsible:
<details>
<summary><b>Proof</b></summary>
Consider the set of left cosets of H in G.
Each coset gH contains |H| elements,
and distinct cosets are disjoint.
Since G is the disjoint union of its cosets:
{% katex %}
|G| = (\text{number of cosets}) \times |H| = [G:H] \cdot |H|
{% endkatex %}
{% katex inline %} \square {% endkatex %}
</details>
This lets readers see the theorem statement first and expand the proof only if they want the details.
Method 3: Horizontal Rules
Use --- to create visual boundaries:
---
**Theorem 2 (Euler's Formula).**
For any real number θ:
{% katex %}
e^{i\theta} = \cos\theta + i\sin\theta
{% endkatex %}
---
Theorem 2 (Euler's Formula).
For any real number θ:
QED Marks
In LaTeX, \begin{proof} automatically adds a QED mark. On Dev.to, add it manually:
| Style | Code | Result |
|---|---|---|
| White square | {% katex inline %} \square {% endkatex %} |
□ |
| Black square | {% katex inline %} \blacksquare {% endkatex %} |
■ |
| Text | ■ |
■ |
Place it at the end of your proof, typically on the last line.
Numbering Conventions
Option 1: Sequential numbering (recommended)
Theorem 1, Lemma 2, Theorem 3, Corollary 4 ...
Sequential numbering makes it easy to find referenced items — "Lemma 2 comes before Theorem 3" is immediately clear from the numbers.
Option 2: Section-based numbering
Theorem 2.1, Lemma 2.2, Theorem 3.1 ...
Better for longer articles with clear sections.
Option 3: Type-based numbering
Theorem 1, Theorem 2, Lemma 1, Lemma 2 ...
Avoid this — it's confusing when referencing ("Lemma 1 is used in the proof of Theorem 2" doesn't tell you the ordering).
Distinguishing Types
In math writing, different statement types serve different roles:
| Type | Purpose | When to use |
|---|---|---|
| Definition | Introduces a term | Before first use |
| Theorem | Major result | Central claims |
| Lemma | Helper result | Building blocks for theorems |
| Proposition | Medium result | Less central than a theorem |
| Corollary | Direct consequence | Immediately after a theorem |
| Example | Concrete instance | After definitions or theorems |
| Remark | Commentary | Supplementary notes |
Full Example: The First Isomorphism Theorem
Here's a complete example combining everything:
Definition 1 (Group Homomorphism).
A map between groups is a homomorphism if
for all .Definition 2 (Kernel and Image).
For a homomorphism :
Lemma 3. The kernel is a normal subgroup of G.
Proof
The subgroup property is straightforward. For normality: for any
and
:
So
, proving
.
Theorem 4 (First Isomorphism Theorem).
For any group homomorphism :
Proof
Let
. Define
by
.
Well-defined: If
, then
, so
.
Homomorphism:
.
Injective:
implies
, so
.
Surjective: By definition of
.
Hence
is an isomorphism.
Corollary 5. If is surjective, then .
Templates
Copy-paste these to get started:
Theorem:
> **Theorem N (Name).**
> Statement here.
> {% katex %} equation {% endkatex %}
Proof (collapsible):
<details>
<summary><b>Proof</b></summary>
Proof body here.
{% katex inline %} \square {% endkatex %}
</details>
Definition:
> **Definition N (Term).**
> Definition here.
Summary
- Blockquotes for theorems/definitions,
<details>for proofs - Sequential numbering for easy referencing
- QED mark: at the end of proofs
- Collapsible proofs keep articles scannable
- No auto-numbering or cross-references — manage manually
Top comments (0)