Reactive Notebooks as Publishable Documents

Front-matter roles in Slate
Abstract

This notebook demonstrates Slate's document-metadata rolestitle, abstract, and bibliography — authored as ordinary cells in natural reading order. Each role renders in place in the live notebook, and every export target (article PDF, slide deck, HTML) interprets the role for placement: title and abstract are hoisted into the title block, and the bibliography is collected for the references section.

Introduction

A Slate notebook is a reactive document. With front-matter roles it is also a publishable artifact — the same cells you compute with become a typeset article. Prior work on literate computing [1] and reproducible research motivates keeping prose, code, and citations in one live document.

Figure 1.

Histogram of the $n = 1000$ standard-normal draws — a caption-tagged cell binds to the figure above (auto-numbered, and referenceable as [@fig:hist]). Captions are ordinary markdown, so bold, code, and math like $\mu \approx 0$ all render.

Method

We draw $n = 1000$ samples from a standard normal and summarize them (see Figure 1). The interactive table below is computed live; in the exported PDF it is frozen to a static table.

xx2sqrt_x
111.0
241.414
391.732
4162.0
5252.236

Discussion

Citations link to the bibliography in the live notebook and render in the chosen bibstyle on export. Each row shows what you type (left) and how it renders (right):

You writeRenders
[@turing1936computable][3]
[@knuth1984literate, p. 97][1, p. 97]
[@knuth1984literate; @turing1936computable][1][3]
@knuth1984literate (prose)[1]

(The left column is in backticks, so it stays literal; the right column is a real citation.)

Citation styles

The reference style is a per-notebook setting (Settings → Citation style, persisted in the Slate.config footer as bibstyle). Slate uses Typst's CSL engine, so the same notebook can render in any of these — switch and re-export to compare:

bibstylecitationreference list
ieee (default)[1]numbered
apa(Knuth, 1984)author–date
chicago-author-date(Knuth 1984)author–date
chicago-notesfootnote¹notes + bibliography
mla(Knuth)works cited
naturesuperscript¹numbered
vancouver(1)numbered
harvard-cite-them-right(Knuth, 1984)author–date

References

  1. Donald E. Knuth. Literate Programming. 1984.
  2. Alan M. Turing. On Computable Numbers, with an Application to the Entscheidungsproblem. 1936.