Universe

Create project in app

A quick start template for scientific booklets.

Features

Modularization

  • Mode Switch
    • the default mode is note mode
    • when cover() is called the book mode will be activated
  • Styles
    • call cover(), epigraph(), preface(), contents() and part-page() to generate corresponding page
    • call body-style() and appendix-style() to change to customized layout

Automation

  • Math Equation
    • auto numbering based on chapter
    • link quote to source
  • Figure
    • auto numbering based on chapter
  • Table
    • read as three-line table
  • Code Block
    • stylized by (using codly)
    • read code block

Useful Functions

Tables

  • tableq(data, k, stroke: table-three-line(rgb("000")), inset: 0.3em): reading .csv, where k is the number of columns, and for stroke, qooklet provide 2 predefined styles
    • table-three-line(stroke-color): default style, for three-line table
    • table-no-left-right(stroke-color): for grid without left border and right border
#let data = csv("data.csv")
#figure(
  tableq(data, 5),
  // stroke: table-three-line(rgb("000")),
  // caption: ""
  // supplement: "",
  kind: table,
)

Codes

  • code(text, lang: "python", breakable: true, width: 100%): read stylized code blocks
#let compose = read("docker-compose.yml")
#code(compose, lang: "yaml")

Environments

  • Theorem
    • theorems enviroment is implemented by using theorion (the counters still needs tweaking in the book mode)
  • Shorthands
    • scientific shorthands are provided by physica

Get Started

Import qooklet from the @preview namespace.

Note Mode

#import "@preview/qooklet:0.3.0": *
#show: body-style.with(
  title: "Bellman Eqation",
  // the following are optional arguments
  // info: none
  // outline-on: false,
)

where info is an argument that let you customize the information of your book using a toml file (if you leave it alone, the following info will be empty). The toml file should look like this

[key-you-like]
    book = "My First Book"
    footer-cap = "ivaquero"
    header-cap = "Reinforcement Learning"
    lang = "en"

You can read you info file by the following sentence

#let info = toml("your path").key-you-like

example

Book Mode

The book mode will be mode will be activated.

#import "@preview/qooklet:0.3.0": *

#let info = toml(your-info-file-path).key-you-like
// for example
// #let info = toml("../config/info.toml").global

// add a cover
#cover(
  // info,
  // date: datetime.today(),
)

#epigraph[
  // Add an epigraph to the document.
]

#preface[
  // Add a preface to the document.
]

#contents

// body
#show: body-style.with(
  title: "chapter-title 1",
  info: info,
)

#show: body-style.with(
  title: "chapter-title 2",
  info: info,
)
...

// appendix
#part-page[Appendix]
#show: appendix-style
...

example-book

For more details, see examples.typ and examples-book.typ.

Clone Official Repository

Clone the qooklet repository to your @local workspace:

  • Linux:
    • $XDG_DATA_HOME/typst/packages/local
    • ~/.local/share/typst/packages/local
  • macOS:~/Library/Application\ Support/typst/packages/local
  • Windows:%APPDATA%/typst/packages/local

Import qooklet in the document

#import "@local/qooklet:0.1.0": *

For developement convinience, local repo never changes the version

Credits

Thanks @ParaN3xus for his haobook which offers much inspiration of the rewriting of this template.

Also thanks the creators of the following packages