3.2 KiB
3.2 KiB
Typst documentation
See typst.app/docs for typst's documentation.
All typst handouts are based on handout@0.1.0
.
The best way to start a new document is to make a copy of an existing one.
- Advanced/Tropical Polynomials is a good place to start.
- Warm-Ups/Painting is a good example of tikz-like pictures.
Notes
- Typst's equivalent of tikz is cetz (homepage, docs)
- Typst handouts are always compiled with solutions.
Handouts without solutions are automatically compiled and published at betalupi.com/handouts.
If you'd like to compile a student handout manually, run the following command in a handout directory:
typst compile main.typ --package-path ../../../lib/typst --input show_solutions=false
Where package_path
is a relative path to ./lib/typst.
Document Options
All typst handouts start with the following:
#show: handout.with(
// Should match `meta.toml`
title: [handout title],
// Authors
by: "Mark",
// Subtitle (optional)
subtitle: "Based on a handout by Bryant Mathews",
// Group (optional)
group: "Advanced 2",
)
Notable commands
#v(1fr)
: Like LaTeX's\vfill
. Creates whitespace that grows automatically.
fr
means "fraction".#v(2fr)
will fill twice as much space as#v(1fr)
on the same page.
Utilities
#note([content], type: "Note type")
: Makes a note.type
is optional.#hint([content])
: Shorthand for#note([content], type: "Hint")
#solution([content])
: A pretty box for solutions. Hidden in student handouts.#examplesolution([content])
: Like#solution()
, but is never hidden.#if_solutions([content])
: Shows content only if we are showing solutions.#if_no_solutions([content])
: Shows content only if we aren't showing solutions.
Sections
High-level sections are denoted with =
.
Subsections start with ==
, subsubsections with ===
, and so on.
handout@0.1.0
is only designed to use =
, subsections might be ugly.
handout@0.1.0
also provides the following commands:
problem
definition
theorem
example
remark
These all have the same syntax: #problem("title", label: "label")
title
is the problem's title, and may be omitted.label
is the problem's label. This is optional.
If a label is provided, this problem can be referenced with@label
Examples:
#problem()
#problem("Bonus")
#problem(label: "gcd")
, which may be referenced with@gcd
Complete example:
// Import definition(), problem(), etc.
// Must be at the top of each file.
#import "@local/handout:0.1.0": *
// Make a section called "Tropical Cubic Polynomials"
= Tropical Cubic Polynomials
// Make a problem with a label
#problem(label: "imaproblem")
Consider the polynomial $f(x) = x^3 + 1x^2 + 3x + 6$.
- sketch a graph of this polynomial
// Make an untitled problem that references `problem`.
#problem()
Recall @imaproblem.
- use this graph to find the roots of $f$