Package Information
- Last Updated
- Authors
- TheLukeGuy
1. Get the package
Download the package using the TPIX CLI:
tpix get @preview/backtrack:1.0.02. Import in your Typst file
Add this to your .typ file:
#import "@preview/backtrack:1.0.0": *Backtrack
Backtrack is a simple and performant Typst library that determines the current
compiler version and provides an API for comparing, displaying, and observing
versions.
Unlike the built-in version API which is only available on
Typst 0.9.0+, Backtrack works on any* Typst version. It uses
the built-in API when available so that it'll continue to work on all future
Typst versions without modification.
Additionally, it:
- doesn't noticeably impact compilation time. All version checks are extremely
simple, and newer versions are checked first to avoid overhead from supporting
old versions. - is automatically tested on every supported Typst version to ensure
reliability. - can be downloaded and installed manually in addition to being available as a
package.
Example
#import "@preview/backtrack:1.0.0": current-version, versions
You are using Typst #current-version.displayable!
#{
if current-version.cmpable <= versions.v2023-03-28.cmpable [
That is ancient.
] else if current-version.cmpable < versions.v0-5-0.cmpable [
That is old.
] else [
That is modern.
]
}
Installation
There are two ways to install the library:
- Use the package on Typst 0.6.0+. This is as simple as adding the following
line to your document:#import "@preview/backtrack:1.0.0" - Download and install the library manually:
- Download and extract the latest release.
- Rename
src/lib.typtosrc/backtrack.typ. - Move/copy
COPYINGintosrc/. - Rename the
src/directory tobacktrack/. - Move/copy the newly-renamed
backtrack/directory into your project. - Add the following line to your document:
#import "[path/to/]backtrack/backtrack.typ"
Documentation
See DOCS.md. It's quite short. 😀
Version Support
Backtrack compiles on and can detect these versions:
| Version | Status | Notes |
|---|---|---|
| 0.6.0+ | ✅ | Also available as a package |
| March 28, 2023–0.5.0 | ✅ | |
| March 21, 2023 | ✅ | Initial public/standalone Typst release |
| February 25, 2023 | 🟡 | Detects as February 15, 2023 |
| February 12–15, 2023 | ✅ | |
| February 2, 2023 | 🟡 | Detects as January 30, 2023 |
| January 30, 2023 | ✅ |
The partially-supported versions may be possible to detect, but they're tricky
since most of their changes are content-related. Content values were opaque up
until the March 21, 2023 release, making it difficult to automatically check for
the presence of these changes.
Copying
Copyright © 2023 Luke Chambers
Backtrack is licensed under the Apache License, Version 2.0. You can find a copy
of the license in COPYING or online at
https://www.apache.org/licenses/LICENSE-2.0.