Skip to content

AutoSlide

Presentation slides in markdown, converted to LaTeX Beamer and then PDF. Layout, spacing and annotations are computed for you: all the fun and none of the work. The input is plain text, so it is easy to version, diff, and process.

Installation

The autoslide command runs the whole toolchain (TeX Live, Graphviz, RDKit, matplotlib, fonts and icons) inside a Docker image. You only need Docker Desktop (macOS, Windows) or Docker Engine (Linux) and Python:

pip install autoslide        # or: uv tool install autoslide / pipx install autoslide

The first run builds the image locally, which takes a few minutes. Afterwards a deck renders in a second or two. After an upgrade the image is rebuilt automatically on next use; autoslide --rebuild talk.md forces a rebuild.

The current directory is mounted into the container, so everything the deck uses (images, includes, a local theme) must lie in or below the directory you run autoslide from.

If you have XeLaTeX, latexmk, pdfcrop, Ghostscript, Poppler, Graphviz and the Fira fonts installed, autoslide can run directly on your machine:

pip install "autoslide[native]"
autoslide --nodocker talk.md

Icons are read from icons/ in a source checkout or from $AUTOSLIDE_ICONS. Packages requested with :requires: are not installed automatically in this mode, only reported if missing.

Getting started

Save this as talk.md:

00-quickstart page 1

00-quickstart page 2

##### My first talk
:author: E. Author
:email: author@example.com

### Why autoslide?

- Write slides in plain markdown
- Get a Beamer PDF with consistent layout
- Equations, plots and molecules come for free

and run

$ autoslide talk.md
Parsed 2 slides (slides mode)
Generated talk-autoslide/talk.tex
Compiling LaTeX to PDF...
LaTeX compilation successful
PDF copied to /work/talk.pdf

The PDF lands next to the markdown file. Intermediate files and a cache for figures live in talk-autoslide/, so re-running after a small edit is fast. autoslide --help-cli lists further options such as --no-cache and --tracing (draws a frame around every block to debug layouts).

Features

Title page

A level-five heading starts the title page. Lines of the form :key: value below it fill in the metadata.

01-titlepage page 1

##### Super interesting topic
:author: E. Author
:email: author@example.com
:web: example.com/talks

Section slides

A level-two heading produces a full-bleed divider slide.

02-section page 1

## Post Hartree-Fock

Text and lists

A level-three heading starts a regular slide. Paragraphs, lists, inline math $...$ and *italic* text work as in markdown; other inline markup such as bold or inline code is not converted.

03-lists page 1

### Lists and text

A plain paragraph sits above the list, with inline math $E = mc^2$ and *italic* text.

- First point
- Second point with $\alpha + \beta$
- Third point

Columns and icons

-|- on a line of its own starts a new column. A line :icon-name: Heading adds a Phosphor icon in front of a heading.

04-columns page 1

### Columns with icon headings

:database: We have
- Few data points (20 - 10.000)
- Noise / uncertainty estimate
- Scalar target

-|-

:function: We want
- Non-parametric model
- Data driven: more data, better model
- Explainable: understand answer

Sections within a slide

--- splits a slide vertically into sections, each of which can have its own columns.

05-sectionbreaks page 1

### Dealing with uncertainty

We learn: $f(\mathbf{x})$

---

Uncertainty in label value ($f$)
- Measurement accuracy
- Variation in population

| Individual | Duck speed |
|----|----|
| Donald | 1 km/h |
| Dagobert | 3 km/h |
| Track | 2 km/h |


-|-

Uncertainty in features ($\mathbf{x}$)
- Incompleteness of observation
- Accuracy of features

| Environment | Duck speed |
|----|----|
| Water | 3 km/h |
| Land | 3 km/h |
| Air | 54 km/h |

---

Kernel-Ridge-Regression
- noise increases regularization strength $\lambda$
- defines the limit of learning

Tables and footnotes

Markdown tables are typeset with consistent rules. [1] Text defines a numbered footnote, referenced as [^1]; [*] Text adds an unnumbered note at the bottom of the slide.

06-tables page 1

### Tables and footnotes

| Animal   | Typical Speed[^1] |
|----------|---------------|
| Horse    | 30 km/h       |
| Parrot   | 35 km/h       |
| Swallow  | 60 km/h       |
| Python   | 3 km/h        |

[1] All numbers in this talk are illustrative only.
[*] Unnumbered footnotes work as well.

Annotated equations

Each [[ term ]] explanation line below a $$ equation attaches a label to that term. The term is found in the typeset equation and the labels are placed around it without overlapping.

07-equations page 1

### Kernel Ridge Regression (KRR)

$$\mathbf{K}_{ij} = {k}(\mathbf{x}_i, \mathbf{x}_j)$$
[[ {k} ]] Kernel function
[[ \mathbf{x}_i, \mathbf{x}_j ]] Features of training points
[[ \mathbf{K}_{ij} ]] Kernel matrix element

$$\mathbf{w} = (\mathbf{K} + \lambda\, \mathbf{I}_N)^{-1}\mathbf{y}$$
[[ \mathbf{K} ]] Kernel matrix ($N\times N$)
[[ \mathbf{w} ]] Model weights
[[ \lambda ]] Regularization
[[ \mathbf{I}_N ]] Identity matrix ($N\times N$)
[[ \mathbf{y} ]] Training labels

$$\hat y(\mathbf{x}_q) = \sum_{i=1}^{ N } w_i {k}(\mathbf{x}_i, \mathbf{x}_q)$$
[[ \hat y ]] Prediction
[[ \mathbf{x}_q ]] Query
[[ w_i ]] Weight of $i$-th training point
[[ \mathbf{x}_i ]] Training point features

Plots

A plot block is matplotlib code, executed with np and plt already imported and styled to match the slides. Text after plot: becomes the caption.

08-plot page 1

### Radial Basis Functions (RBF kernels)

```plot:
xs = np.linspace(0, 4, 100)
plt.plot(xs, np.exp(-xs**2), label="Gaussian")
plt.plot(xs, np.exp(-xs), label="Exponential")
plt.xlabel("Reduced distance $d/\sigma$")
plt.ylabel("Kernel value")
plt.legend()
```

Schematics

schematic works like plot, but draws without axes ticks: useful for sketches and qualitative diagrams.

09-schematic page 1

### Schematics

```schematic: A double-well potential
xs = np.linspace(-2, 2, 200)
plt.plot(xs, xs**4 - 2 * xs**2)
plt.annotate("A", (-1, -1), xytext=(-1, -0.4), ha="center")
plt.annotate("B", (1, -1), xytext=(1, -0.4), ha="center")
plt.xlabel("Reaction coordinate")
plt.ylabel("Energy")
```

Code

Any other fenced block with a language is syntax highlighted.

10-code page 1

### Getting Started

```python
# pip install --upgrade nablachem
import nablachem.space as ncs
counter = ncs.ApproximateCounter(show_progress=False)
space = ncs.SearchSpace("H:1 O:2 C:4 N:3")
criterion = ncs.Q("C = 8 & H = 10 & N = 4 & O = 2")
natoms = 24

total_molecule_count = counter.count(space, natoms, criterion)
mols = ncs.random_sample(
    counter, space, natoms=natoms, nmols=3, selection=criterion
)
```

[*] Sample code, needs work for research.

Chemical structures

A structure block takes one SMILES per line. All molecules are drawn at the same scale, so sizes are comparable across slides; in a column they stack vertically.

11-structures page 1

### Small and large in one row

From water to cholesterol at the same scale

```structure
O
C=C
c1ccccc1
CC(C)CCC[C@@H](C)[C@H]1CC[C@H]2[C@@H]3CC=C4C[C@@H](O)CC[C@]4(C)[C@H]3CC[C@]12C
```

Bond lengths and ring sizes are directly comparable

Flowcharts

A flowchart block takes Graphviz DOT. Nodes and edges take a colour class (blue, orange, red, purple, green, grey), clusters group nodes, and the direction is chosen automatically so that the chart fits without shrinking the text, unless you set rankdir.

12-flowcharts page 1

### Colours highlight, clusters group

```flowchart
digraph {
  subgraph cluster_prep { label="Preparation";
    sample [label="Sample"];
    dissolve [label="Dissolve"];
  }
  measure [label="Measure", class=orange];
  check [label="Converged?", class=red];
  report [label="Report", class=green];
  model [label="Model", class=purple];
  sample -> dissolve -> measure -> check;
  check -> measure [label="no", class=red];
  check -> report [label="yes", class=green];
  model -> check [class=purple];
}
```

Images

::: file: Caption includes an image from the assets/ directory next to the markdown file. A trailing *factor on the file name scales it, e.g. ::: kernels.png*0.5:.

13-images page 1

### Images

- Image files live in `assets/` next to the markdown
- PDF, PNG and JPG are supported

-|-

::: kernels.png: Caption below the image

Summary slides

A ? before the title marks a summary slide with a highlighted header. The trailing # characters are required for this marker.

14-summary page 1

### ? Summary ##################################################################

:map-trifold: Potential Energy Landscapes
- Key for behaviour for single systems and reactions
- Complex, many minima
- Smooth surface
- High-dimensional

Progress bar

Every content slide carries a progress bar along its bottom edge, one segment per slide reached in the current chapter (the slides after a ## section heading). Title pages, section slides and hidden slides are not counted. Its colour follows the theme's primary colour unless colors.progress is set in the theme.

16-progress page 1

16-progress page 2

16-progress page 3

16-progress page 4

## Electronic structure

### Hartree-Fock

- Mean-field approximation
- One determinant

### Density functional theory

- Energy from the density
- Exchange-correlation functional

### ! Backup slide ###

- Hidden: not shown and not counted

### Coupled cluster

- Systematic correlation
- Expensive

More syntax

Syntax Effect
### ! Title ### Hidden slide, left out of the PDF
// comment Ignored line
># other.md Includes another markdown file at this position
:requires: pyscf, ase>=3.22 On the title page: extra pip packages for plot code, installed on first use into the Docker volume autoslide-pkgs

Customising the output

All LaTeX comes from Jinja2 templates in autoslide/templates/ and every colour, font and length from the Theme in autoslide/theme.py. A template is overridden by placing a file with the same relative name in autoslide-templates/ next to the markdown file, in ~/.config/autoslide/templates/, or in a directory listed in $AUTOSLIDE_TEMPLATES. A local autoslide_theme.py adjusts the theme, for example the spacing between blocks:

# autoslide_theme.py
from autoslide.theme import Spacing, default_theme

theme = default_theme().replace(spacing=Spacing(
    default="0.8em",
    gaps={"text": {"annotated_equation": "1.2em"}, "*": {"image": "0.5em"}},
))

See the README for the full list of templates and their blocks.