A Typst package for rendering periodic tables of elements with two style options:
periodic-table()- Compact version for slides and handoutsperiodic-table-detailed()- Professional ACS-style version with full details
Installation
#import "@preview/ptable-amat:0.1.0": periodic-table, periodic-table-detailed
Usage
Compact Version
#periodic-table()

With custom parameters:
#periodic-table(length: 0.8cm, size: 1.0, gap: 0.1)
Detailed (ACS-style) Version
#periodic-table-detailed()

With custom parameters:
#periodic-table-detailed(length: 0.8cm, size: 1.8, gap: 0.15)
Parameters
Common Parameters
| Parameter | Default | Description |
|---|---|---|
length |
0.8cm |
Base length unit for the canvas |
size |
1.0 (compact) / 1.8 (detailed) |
Size of each element box |
gap |
0.1 (compact) / 0.15 (detailed) |
Gap between element boxes |
theme |
"bright" (compact) / "dark" (detailed) |
Color theme (see below) |
show-legend |
true |
Whether to show the category legend |
highlighted |
() |
Array of atomic numbers to highlight |
highlight-stroke |
luma(20%) + 3pt |
Stroke style for highlighted elements |
Function-Specific Parameters
| Function | Parameter | Default | Description |
|---|---|---|---|
periodic-table-detailed |
show-labels |
true |
Whether to show group/period labels |
Color Themes
Five built-in color themes are available:
| Theme | Description |
|---|---|
"bright" |
Light colors with black text (good for printing) |
"dark" |
Dark colors with white text (professional look) |
"pastel" |
Soft muted colors |
"grayscale" |
Light grays with black text |
"grayscale-dark" |
Dark grays with white text |
"neon" |
Vibrant neon colors |
Theme Examples
#periodic-table(theme: "pastel")

#periodic-table(theme: "neon")

#periodic-table(theme: "grayscale")

#periodic-table(theme: "grayscale-dark")

Highlighting Elements
You can highlight specific elements by passing their atomic numbers:
// Highlight Rydberg atom elements: Rb, Cs, Sr
#periodic-table-detailed(
highlighted: (37, 55, 38),
)

// Highlight noble gases
#periodic-table(highlighted: (2, 10, 18, 36, 54, 86, 118))
// Highlight with custom color
#periodic-table(
highlighted: (26, 27, 28, 29), // Fe, Co, Ni, Cu
highlight-stroke: blue + 3pt
)
// Minimal compact table without title and legend
#periodic-table(show-title: false, show-legend: false)
// Minimal detailed table without labels and legend
#periodic-table-detailed(show-labels: false, show-legend: false)
Features
- All 118 elements with atomic numbers, symbols, names, and atomic masses
- Color-coded by element category (alkali metals, noble gases, etc.)
- Five color themes: bright, dark, pastel, grayscale, neon
- Customizable element highlighting
- Standard periodic table layout with lanthanoids and actinoids separated
- Built on the
cetzpackage for high-quality vector graphics
Dependencies
- cetz version 0.4.2
License
MIT