- Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Downloads and runs the Rust installation script.
cargo install --locked typst-cli
- Installs the Typst command-line tool using Cargo (Rust's package manager).
typst --version
This script automates the compilation of Typst documents within your project. It offers two modes of operation:
Usage:
- Compile All Documents: This command will recursively search the
docs/
directory for all.typ
files and compile them into corresponding PDFs in theout/
directory. The output directory structure will mirror thedocs/
directory.
./compile.sh
- Compile a Single Document: Provide the path to a specific
.typ
file you want to compile. The script will generate the PDF in theout/
directory, maintaining the relative path.
./compile.sh <path/to/file.typ>
Example:
./compile.sh docs/papers/my_paper.typ
This would compile my_paper.typ
and place the resulting PDF at out/reports/my_paper.pdf
.