s

sprintf

@preview

`%`-style (printf) str format for typst

v0.1.0
MIT

Package Information

Last Updated
Categories
text

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/sprintf:0.1.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/sprintf:0.1.0": *

Version History

0.1.0
c04b28d69d29...

The sprintf-package Package

Version 0.1.0

%-style (printf) str format for typst

Getting Started

Simplest example:

#import "@preview/sprintf:0.1.0": *

#sprintf("%s", "Tom")

Another example:


demo showing usage of %06d, %.2f, etc

Usage

A more in-depth description of usage:

Just use as if using Python's % of str

#import "@preview/sprintf:0.1.0": *

#let s-example = sprintf("%s-%.1f", "asd", 1.23)

Additional Documentation and Acknowledgments

Development

This section is for developers or advanced users only

To build this package locally,
there is the guide to show how to get the development environment up and running.

Firstly, install Nim.

Then, compile plugin via:

$ cd lib
$ nimble run
$ cd ..

Afterward, entrypoint src/lib.typ along with its dependency src/lib.wasm shall be generated.