h

hydra

@preview

Query and display headings in your documents and templates.

v0.6.3
MIT
10 downloads

Package Information

Last Updated
Minimum Typst Version
0.12.0
Authors
tinger
Categories
componentsscripting

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/hydra:0.6.3

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/hydra:0.6.3": *

Version History

0.6.30.12.0
9086250c10ca...
0.6.20.12.0
dfb8d4be7cb8...
0.6.10.12.0
3fc8b244d657...
0.6.00.12.0
1be111e031e2...
0.5.20.11.0
789957fc4cda...
0.5.10.11.0
40723a565b98...
0.5.00.11.0
c6cebf805dd8...
0.4.00.11.0
160e6ad2657e...
0.3.00.8.0
f9ebce24510a...
0.2.00.8.0
4d4a44463a2c...
0.1.00.8.0
baee7693dd30...

hydra

Hydra is a Typst package allowing you to easily display the heading like elements anywhere in your
document. Its primary focus is to provide the reader with a reminder of where they currently are in
your document only when it is needed.

Example

#import "@preview/hydra:0.6.3": hydra

#set page(paper: "a7", margin: (y: 4em), numbering: "1", header: context {
  if calc.odd(here().page()) {
    align(right, emph(hydra(1)))
  } else {
    align(left, emph(hydra(2)))
  }
  line(length: 100%)
})
#set heading(numbering: "1.1")
#show heading.where(level: 1): it => pagebreak(weak: true) + it

= Introduction
#lorem(50)

= Content
== First Section
#lorem(50)
== Second Section
#lorem(100)

A Lorem Ipsum example document of four pages showing "1 Introduction" at the top of the first page, but no header. The second page shows "2 Content" followed by "2.1 First Section" at the top, again with no header. On the third page the header shows "2 Contet" on the right side despite "2.2 Second Section" at the top. The final page shows "2.2 Second Section" on the left side of the header. The example document shows of the starting page and book mode checks in action.

Documentation

For a more in-depth description of hydra's functionality and the reference read its manual.

Contribution

For contributing, please take a look CONTRIBUTING.

Etymology

The package name hydra /ˈhaɪdrə/ is a word play on headings and headers, inspired by the monster in
greek and roman mythology resembling a serpent with many heads.