Writing like a paper
https://blog.kiarashs.ir/blog/writing-like-a-paper
Contents8 sections
A paper has habits a blog usually drops: numbered statements, references that say "Figure 2" and stay right, notes in the margin, algorithms set between two rules. This post shows each one, in the Markdown that writes it. The numbers in the chart are made up for the example.
References that write themselves
A link with no text to something the post numbers fills in its name. As Figure 2 shows, warm-up reaches a lower loss; Theorem 2 is the rule behind (1), and Algorithm 1 is the update. A link to a heading reads the heading: see Sidenotes.
As [](#fig-loss) shows, … [](#thm-bayes) … [](#eq-bayes) … [](#alg-sgd)
It works for figures, tables, listings, notebooks, algorithms, theorem-like blocks and equations. A link with words of its own is left as written, and a name the post does not have reads "??", and the build says which.
Theorems and proofs
Written as an alert is, with the kind in brackets. The rest of the first line
is the title, and {#name} names the block for links.
Proof of Theorem 2. By the definition of conditional probability, . Divide by . ∎
Remark 3. Definition 1 is Theorem 2 with the parameters and the data.
> [!THEOREM] Bayes' rule {#thm-bayes}
> For events $A$ and $B$ with $P(B) > 0$, …
> [!PROOF] of [](#thm-bayes)
> By the definition of conditional probability, …The kinds are theorem, lemma, proposition, corollary, conjecture, definition, example, remark and proof. All but the proof share one count, so a reader looking for "2" finds one thing; a proof ends with a tombstone.
Sidenotes
Footnotes are written as they always are.11 Like this one. Nothing in the Markdown changes. On a screen wide enough to have a margin, a note stands beside the line that cites it; on a narrower one it is at the foot of the post, where a footnote goes.22 The page carries the note in both places and shows one of them, so a screen reader meets it once. A note that holds a list or code stays at the foot on every screen.3
Algorithms
The algorithmicx syntax, in a fence, set at build time with KaTeX for the
maths. \label{sgd} names it for a link.
Pictures in TikZ
TikZ in a fence, drawn by TeX at build time with no TeX installed. Black is the page's ink and white its background, so the picture follows the theme.
Charts
A Vega-Lite spec in a fence. The page arrives with the chart drawn; pointing at it loads the charting library and makes it live, with tooltips. The data, read here from a CSV beside the post, is under it as a table.
Data (42 rows)
| step | schedule | loss |
|---|---|---|
| 0 | constant | 3.22 |
| 0 | warm-up | 3.15 |
| 100 | constant | 2.947 |
| 100 | warm-up | 3.07 |
| 200 | constant | 2.702 |
| 200 | warm-up | 2.949 |
| 300 | constant | 2.483 |
| 300 | warm-up | 2.591 |
| 400 | constant | 2.287 |
| 400 | warm-up | 2.287 |
| 500 | constant | 2.112 |
| 500 | warm-up | 2.028 |
| 600 | constant | 1.955 |
| 600 | warm-up | 1.808 |
| 700 | constant | 1.815 |
| 700 | warm-up | 1.621 |
| 800 | constant | 1.689 |
| 800 | warm-up | 1.461 |
| 900 | constant | 1.576 |
| 900 | warm-up | 1.326 |
| 1000 | constant | 1.476 |
| 1000 | warm-up | 1.21 |
| 1100 | constant | 1.386 |
| 1100 | warm-up | 1.112 |
| 1200 | constant | 1.305 |
| 1200 | warm-up | 1.028 |
| 1300 | constant | 1.233 |
| 1300 | warm-up | 0.957 |
| 1400 | constant | 1.169 |
| 1400 | warm-up | 0.896 |
| 1500 | constant | 1.111 |
| 1500 | warm-up | 0.845 |
| 1600 | constant | 1.059 |
| 1600 | warm-up | 0.801 |
| 1700 | constant | 1.013 |
| 1700 | warm-up | 0.763 |
| 1800 | constant | 0.972 |
| 1800 | warm-up | 0.732 |
| 1900 | constant | 0.935 |
| 1900 | warm-up | 0.705 |
| 2000 | constant | 0.902 |
| 2000 | warm-up | 0.682 |
Chemistry
\ce and \pu inside maths: , with
, and ions such as .
Code that shows what changed
{5, 2-3} after the language marks those lines, a single line or a range, in any order:
def loss(model, batch):
logits = model(batch.x)
y = 3
z = 45 / y
return cross_entropy(logits, batch.y)diff-python marks what a change adds and removes, highlighted as Python. The
copy button copies the code after the change.
def step(model, batch, optimiser):
loss = loss_fn(model, batch)
with autocast():
loss = loss_fn(model, batch)
loss.backward()Fences that each name a tab and follow one another become one set of tabs.
Picking a language in one set picks it in every set, and the page remembers.
model = LogisticRegression().fit(X, y)
model <- glm(y ~ ., data = d, family = binomial)
Footnotes
Cite this post
@misc{soleimanzadeh2026writing,
author = {Soleimanzadeh, Kiarash},
title = {Writing like a paper},
year = {2026},
url = {https://blog.kiarashs.ir/blog/writing-like-a-paper},
urldate = {2026-03-30}
}Soleimanzadeh, K. (2026, March 30). Writing like a paper. Kiarash Soleimanzadeh. https://blog.kiarashs.ir/blog/writing-like-a-paperK. Soleimanzadeh, "Writing like a paper," Kiarash Soleimanzadeh, Mar. 30, 2026. [Online]. Available: https://blog.kiarashs.ir/blog/writing-like-a-paperKiarash Soleimanzadeh. “Writing like a paper.” Kiarash Soleimanzadeh, 30 March 2026. https://blog.kiarashs.ir/blog/writing-like-a-paper
Comments