Skip to content

Provides utilities for modifying counters, allowing more complex numberings.

License

Notifications You must be signed in to change notification settings

Marmare314/numbify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numbify

Numbify is a typst-library providing utilities for modifying counters, which allows creating more complicated numberings.

Examples

#import "@preview/numbify:0.1.0": concat-counter, override-counter

#set heading(numbering: "I.I")

// Create new figure counter.
// The new figure counter is a combination
// of the heading counter and the figure counter.
#let figure-counter = concat-counter(heading, figure.where(kind: image))

// Override figure counter with new counter.
// Use the numbering "I.I" for the heading part
// and "1" for the figure part.
#show figure.where(kind: image): set figure(numbering: override-counter(figure-counter, ("I.I", "1")))

= The Mona Lisa and Starry Night

#figure(
  image("/assets/mona-lisa-wikimedia.jpeg", width: 50pt),
  caption: "The Mona Lisa"
)
#figure(
  image("/assets/starry-night-wikimedia.jpeg", width: 70pt),
  caption: "Starry Night"
)

= The Scream

#figure(
  image("/assets/the-scream-wikimedia.jpeg", width: 80pt),
  caption: "The Scream"
)

See the tests for more examples.

Documentation

A short overview of the most important functions is given here. For more details, please refer to the pdf-documentation.

  • concat-counter(counter-1, counter-2): Concatenate two counters.
  • slice-counter(counter, end, start: 1): Slice a range of levels from a counter.
  • override-counter(counter, numbering, separator: "."): Creates a numbering function that replaces the usual counter with the provided counter.
  • heading-level-range(end, start: 1): Returns a selector that selects a range of heading levels.
  • reset-counter-rule(counter): Reset a counter. This is a helper function that can be used in a show-rule.

About

Provides utilities for modifying counters, allowing more complex numberings.

Topics

Resources

License

Stars

Watchers

Forks