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.1": *
#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 | Arguments | Environments |
Proof |
|
|
Statement |
|
|
Problem |
|
|
The arguments are all positional, but name
is optional, meaning either of these work:
// no `name` given
#theorem[ statement ][ proof ]
// `name` given
#theorem[ name ][ statement ][ proof ]
If you wish to state a result without giving a proof, you can leave proof as an empty content block []
.
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 pageswidth
(default:100%
) — width of the current environment in its scopeheight
(default:auto
) — height of the current environment in its scope
Also, the problem
environment includes an automatic counter if no title is passed in, which can be helpful when working on problem sets.
Themes and Colors
To modify themes and colors, use the ergo-init
function:
#import "@preview/ergo:0.1.1": *
#show: ergo-init.with(
colors: "gruvbox-dark",
headers: "sidebar",
all-breakable: true,
inline-qed: true,
prob-nums: false,
)
The modifiable parameters are:
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 parameterinline-qed
(default:false
) — whether the Q.E.D square is inline or right aligned in proof environmentsprob-nums
(default:true
) — should excercise/problems environments have a numbering system
bootstrap |
Color scheme adapted from the CSS framework Bootstrap |
bw |
Black and white color scheme |
gruvbox-dark |
Adapted from the dark version of the 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.
Extras
There are a few extra functions and macros that may be of interest:
correction(body)
— Content with red text, useful for correcting a previous assignmentbookmark(title, info)
— Add additional information with small box. Particularly useful for recording dates and timesequation-box(equation)
(eqbox(equation)
) — Box an equationergo-title-selector
— A selector controlling the style of the headers in the blocks
Local Installation (MacOS / Linux)
- Clone this repository locally on your machine.
- Run
setup.sh
from the root of the project directory. This script symlinks the project directory to the Typst local packages directory. Refer to the Typst Packages repository for more information.
$ git clone https://github.com/EsotericSquishyy/ergo
$ cd ergo
$ chmod +x setup.sh
$ ./setup.sh
Testing
Test whether the installation worked by running the following commands in an empty directory:
$ cat <<EOF > test.typ
#import "@preview/ergo:0.1.1": *
#show: ergo-init
#defn[#lorem(5)][#lorem(50)]
EOF
$ typst compile test.typ
The installation is successful if the file compiled without errors and test.pdf
looks like this: