Ergo is a Typst suite of environments for taking notes and doing problem sets, especially for Mathematics, Computer Science, and Physics.
Typst is required to use this package (refer to Typst’s installation page here). For the best Typst experience, we recommend the integrated language service Tinymist.
Usage
To get started, add the following to your .typ
file:
#import "@preview/ergo:0.1.0": *
#show: ergo-init
Example
#defn[Group][
A *group* is an ordered pair $(G, star)$, where $G$ is a set and $star$ is a binary operation on $G$ satisfying
1. _Associativity:_ $(a star b) star c = a star (b star c) forall a, b, c in G$
2. _Identity:_ $exists e in G "such that" e star a = a star e = a forall a in G$
3. _Invertibility:_ $forall a in G exists a^(-1) in G "such that" a star a^(-1) = a^(-1) star a = e$
]
#thm[Orbit-Stabilizer Theorem][
Let $G$ be a group acting on a set $X$, with $x in X$.
Then the map
$
G \/ G_x &--> G dot x \
a G_x &arrow.r.bar.long a dot x
$
is well-defined and bijective, and therefore $|G dot x| = [G : G_x]$.
][
Let $a, b in G$.
Then
$
a G_x = b G_x
&<==> b^(-1) a in G_x \
&<==> b^(-1) a dot x = x \
&<==> a dot x = b dot x.
$
Observe the map is well-defined by $(==>)$ and injective by $(<==)$.
For surjectivity, note for any $a in G$, $a dot x$ is the image of $a G_x$.
]
Gallery
Real Analysis Notes using the bootstrap
color scheme with sidebar
header style
Cryptography Problem Set using the bw
color scheme with tab
header style
Classical Mechanics Notes using the gruvbox_dark
color scheme with sidebar
header style (with Physica)
Abstract Algebra Notes using the bw
color scheme with classic
header style (with Fletcher)
Data Structures and Algorithms Notes using the gruvbox_dark
color scheme with classic
header style (with CeTZ and Lovelace)
Refer to gallery/
for more examples.
Environments
Ergo
has three different types of environments: proofs, statements, and problems.
Type | Args | Environments |
Proof |
|
|
Statement |
|
|
Problem |
|
|
Note the arguments are all positional but name
is optional such that the following example details their behavior:
// no `name` given
#theorem[ statement ][ proof ]
// `name` given
#theorem[ name ][ statement ][ proof ]
All of these environments (regardless of type) share a set of (optional) keyword arguments:
breakable
(default:false
) - whether the current environment is breakable across multiple pages.width
(default:100%
) - width of the current environment in its current scope.height
(default:auto
) - height of the current environment in its current scope.
Note that the problem
environment includes an automatic counter if no title is passed in.
Themes/Colors
To customize environments, pass the following keyword arguments to ergo-init
:
colors
(default:"bootstrap"
) - colors of theme (refer to Color Palettes table for valid arguments).headers
(default:"tab"
) - header style of theme (refer to Header Styles table for valid arguments).all-breakable
(default:false
) - the default value forbreakable
environment parameter.inline-qed
(default:false
) - whether the Q.E.D square is inline or on a new line in proof environments.
bootstrap |
Color scheme adapted from the popular CSS framework Bootstrap |
bw |
Black and white color scheme |
gruvbox_dark |
Adapated from the popular neovim color scheme gruvbox |
ayu_light |
Adapated from ayu |
tab |
Default header style, rounded |
classic |
Original header style, rounded |
sidebar |
Less padding, not rounded |
This function should be called before any content is rendered to enforce consistency of the document content. A sample header is
#import "@preview/ergo:0.1.0": *
#show: ergo-init.with(
colors: "gruvbox_dark",
headers: "sidebar",
all-breakable: true,
inline-qed: true
)
// body
Extras
There are a few extra functions/macros that may be of interest:
correction(body)
- Add a correction to nearby content.bookmark(title, info)
- Add additional information with small box.equation-box(equation)
(eqbox(equation)
) - Box an equation.ergo-title-selector
- A selector controlling the style of the headers in the blocks.
Local Installation
- Clone this repository locally on your machine.
- Run
setup.sh
from the root of the project directory. Refer to the Typst Packages repository for more information. Note the script simply symlinks the project directory to the Typst local packages directory.
$ git clone https://github.com/EsotericSquishyy/ergo
$ cd ergo
$ chmod +x setup.sh
$ ./setup.sh
Testing
Test whether the installation/update worked by opening running the following commands in an empty directory:
$ cat < test.typ
#import "@preview/ergo:0.1.0": *
#show: ergo-init
#defn[#lorem(5)][#lorem(50)]
EOF
$ typst compile test.typ
The installation is working if the compile didn’t fail and test.pdf
looks like this: