Markdown Math Style¶
Use plain-language-first math across this repo.
The site now supports rendered math through MathJax, but the writing rule is still:
- explain the idea in words
- define every symbol before you use it
- show the symbolic form when it clarifies the argument
- keep the page understandable even if math rendering fails on GitHub
When To Use Rendered Math¶
Rendered math is worth it when notation is part of the idea:
- Fenwick-tree block definitions
- dynamic-programming recurrences
- flow, cut, and matching identities
- combinatorial counting formulas
- geometry predicates and area formulas
- FFT / NTT derivations or convolution identities
If plain text says it just as well, keep it plain.
Good plain-text cases:
sum(l..r) = pref[r] - pref[l - 1]dist[v] <= dist[u] + wl <= answer < r
Preferred Delimiters¶
To keep source files compatible with both GitHub Markdown rendering and the MkDocs site, use:
- inline math:
$...$ - display math:
$$...$$on their own lines
Example:
Inline:
The Fenwick node at index $i$ stores the sum over the block of length $\mathrm{lowbit}(i)$.
Display:
$$
\mathrm{bit}[i] = \sum_{j=i-\mathrm{lowbit}(i)+1}^{i} a_j
$$
Writing Pattern¶
Use this order whenever the formula matters:
- state the claim in prose
- define the variables
- show the formula
- explain the consequence in prose again
Example:
pref[i]means the sum of the firstivalues.- Then the interval sum follows from subtracting two prefixes:
$$
\sum_{k=l}^{r} a_k = \mathrm{pref}[r] - \mathrm{pref}[l - 1]
$$
- The important takeaway is that one precomputed array answers every static range-sum query in
O(1).
Keep It Readable¶
- Prefer one notation for one quantity on the whole page.
- Keep display equations short enough to fit mobile screens.
- Split derivations across multiple lines only when the proof genuinely needs it.
- Use prose to explain why the formula matters; do not drop equations without context.
Avoid¶
- symbolic walls with no explanation
- switching between several names for the same variable
- using rendered math for filenames, code identifiers, or shell commands
- hiding implementation details behind notation that a reader cannot map back to code
GitHub And Raw-Source Fallback¶
GitHub's web Markdown renderer supports math, so $...$ and $$...$$ should render there as well.
Still write the surrounding prose so the page remains understandable when someone is:
- reading the raw Markdown source
- browsing in an editor without math rendering
-
skimming quickly and not relying on every equation
-
the surrounding prose already explains the meaning
- the variables are defined nearby
- the page is still understandable without the rendered form