Formal blocks — definition, theorem, proof…
These mathpad tags structure mathematical statements: definitions, theorems, properties, proofs, corollaries, lemmas, remarks, examples. Each block has its own style (color, frame, title bar) and is automatically numbered per category. The label language («Definition», «Theorem»…) follows the lang attribute of <mp-course>.
Block overview
<mp-title> as first child.roc attribute for «restitution of organized knowledge» (French exam convention).<mp-definition> — example
<mp-definition>
<mp-title>Continuous function at $a$</mp-title>
A function $f$ is <strong>continuous at $a$</strong> if $\lim\limits_{x \to a} f(x) = f(a)$.</mp-definition>
<mp-title> is always the first child
All formal blocks (mp-definition, mp-theorem, mp-property…) follow the same pattern: an optional <mp-title> as first child, then content. <mp-title> accepts KaTeX formulas (unlike the old name="" attribute which isn't rendered). <mp-theorem> + <mp-proof>
A theorem and its proof are typically placed together. The roc attribute (Restitution Organisée de Connaissances, French baccalaureate convention) adds a visible «ROC» mark.
<mp-theorem roc>
<mp-title>Sum of a geometric sequence</mp-title>
For all $q \neq 1$ and all $n \in \mathbb{N}$: $$\sum_{k=0}^{n} q^k = \dfrac{1 - q^{n+1}}{1 - q}$$
</mp-theorem>
<mp-proof>
Let $S_n = 1 + q + q^2 + \cdots + q^n$. Then: <mp-align>
q \, S_n & = & q + q^2 + \cdots + q^{n+1} \\
q \, S_n - S_n & = & q^{n+1} - 1 \\
(q - 1) S_n & = & q^{n+1} - 1
</mp-align>
Since $q \neq 1$, $q - 1 \neq 0$, so $S_n = \dfrac{q^{n+1} - 1}{q - 1} = \dfrac{1 - q^{n+1}}{1 - q}$.</mp-proof>
<mp-property> and <mp-corollary>
Work like mp-theorem — distinct styles and independent counters:
<mp-property>
<mp-title>Symmetry</mp-title>
For all $a, b \in \mathbb{R}$: $a + b = b + a$.</mp-property>
<mp-corollary>
Therefore the sum operation is commutative over $\mathbb{R}$.</mp-corollary>
<mp-remark>, <mp-lemma>, <mp-example>
Three secondary blocks, lighter than a theorem, each with its own visual style.
<mp-remark>
This property no longer holds in $\mathbb{N}$ — see $3 - 5$.</mp-remark>
<mp-lemma>
If $a \mid b$ and $a \mid c$, then $a \mid (b + c)$.</mp-lemma>
<mp-example>
$\sqrt{2}$ is irrational.</mp-example>
Reference a block
Give the target block a standard HTML id, then reference it with <mp-ref target="...">. The reference automatically displays the number («3») or the full label («Theorem 3») depending on the format attribute.
<mp-theorem id="thm-bolzano">
<mp-title>Intermediate value theorem</mp-title>
…
</mp-theorem>
By <mp-ref target="thm-bolzano" format="full"></mp-ref>, there exists $c \in [a;b]$ such that …
<mp-title>. Ready to try mathpad?
Create your first interactive scientific HTML document in the online editor, or import your existing LaTeX course in one click.