Typst example
Example of a co-authored Typst paper: source and output
This short paper is sharedraft's demo project. Here is its full Typst source, the compiled output, and the review its two co-authors left on it. In the demo, everything can be edited, together and in real time.
What the example contains
“Optimal transport and shape interpolation”: Claire Martin, Hugo Bernard.
- Page and text settings with
#set - Numbered equations and label references (
@kantorovich) - A theorem statement, a
table - References at the end
The output


The source
The project's main.typ file, as it opens in the demo.
#set text(lang: "en", size: 11pt)
#set page(margin: 2.5cm)
#set heading(numbering: "1.")
#set math.equation(numbering: "(1)")
#set par(justify: true)
#align(center)[
#text(size: 17pt)[Optimal transport and shape interpolation]
Claire Martin #h(2em) Hugo Bernard
]
#pad(x: 2em)[
*Abstract.* We propose a method to interpolate between two shapes based on
optimal transport. It remains stable when the topologies differ, and its
computational cost grows linearly with the number of points.
]
= Introduction
Comparing two shapes often amounts to measuring the effort needed to move one
onto the other. Optimal transport gives this idea a precise framework: we look
for the map that moves the mass at the lowest cost.
Classical interpolation methods, based on a point-to-point correspondence, fail
as soon as the shapes do not share the same topology. Optimal transport, on
the other hand, assumes no correspondence: it computes it.
= Formulation
Let $mu$ and $nu$ be two probability measures on $RR^d$. The Monge problem
looks for a map $T$ that pushes $mu$ onto $nu$:
$ min_(T_\# mu = nu) integral_(RR^d) norm(x - T(x))^2 dif mu(x). $
Its relaxation, due to Kantorovich, is over the couplings $pi$ with marginals
$mu$ and $nu$:
$ W_2^2(mu, nu) = min_(pi in Pi(mu, nu)) integral norm(x - y)^2 dif pi(x, y). $ <kantorovich>
*Theorem (Brenier).* _If $mu$ is absolutely continuous, problem
@kantorovich has a unique solution, supported on the graph of
$T = nabla phi$, where $phi$ is a convex function._
McCann's interpolation then continuously connects the two shapes:
$ mu_t = ((1 - t) "Id" + t T)_\# mu, quad t in [0, 1]. $
= Computation
We regularize the problem with entropy, which leads to the Sinkhorn algorithm.
With $K = e^(-C \/ epsilon)$, the iterations read
$ a^((k+1)) = mu / (K b^((k))), quad b^((k+1)) = nu / (K^top a^((k+1))), $
and the coupling is given by $pi = "diag"(a) K "diag"(b)$. Each iteration only
requires matrix-vector products.
= Results
On all our examples, the method preserves fine details while avoiding the
aliasing artifacts observed with classical approaches.
#align(center, table(
columns: 4,
align: (left, center, center, center),
stroke: none,
table.hline(),
[Method], [Points], [Time (s)], [Error],
table.hline(),
[Direct correspondence], [$10^4$], [0.8], [0.112],
[Sinkhorn (ours)], [$10^4$], [1.3], [0.031],
[Sinkhorn (ours)], [$10^5$], [12.9], [0.029],
table.hline(),
))
= Conclusion
Optimal transport provides a natural interpolation between shapes of different
topologies. We will next study the case of animated shapes.
#heading(numbering: none)[References]
C. Villani, _Optimal Transport: Old and New_, Springer, 2009.
M. Cuturi, Sinkhorn Distances, _NeurIPS_, 2013.
The review in the demo
When you open the demo, the paper has already been reviewed by its two fictional co-authors, Claire and Hugo: threaded comments on the source, marks drawn on the output, and two tracked changes to accept or reject.
Comments
- on “Optimal transport and shape interpolation”Claire: Welcome! This project is shared with every visitor and reset every 20 minutes. Write, comment, annotate the preview: the others see it right away.
- on “at the lowest cost”Claire: Cite Villani here?Hugo: Yes, the 2009 book.
- on “absolutely continuous”Hugo: Key assumption: recall it in the introduction?
- on “Sinkhorn”Claire: Give the value of ε used in the experiments.
- on “aliasing artifacts”Hugo: Add a comparison figure
- on “animated shapes”Claire: Maybe too ambitious for this paper.resolvedHugo: Agreed, let's keep it for later.
Marks on the output
- Bracket in the margin, on “Classical”Hugo: A bit long: tighten this paragraph?
- Zigzag in the margin, on “Brenier”Claire: Check the exact statement (assumptions on μ).
- Note in the margin, on “matrix-vector”Claire: Cost: O(n²) per iteration.
Tracked changes
- Hugo suggests adding “and robust” after “It remains stable”
- Claire suggests deleting “natural”
Try it without an account
The demo is shared by every visitor and reset every 20 minutes: write, comment, annotate, and the others see it right away. Don't put anything personal in it.