Skip to content

Commit

Permalink
summy:0.1.0 (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
wasaysir authored Jan 13, 2025
1 parent 8ffefd3 commit a9b1167
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/preview/summy/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Wasay Saeed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
85 changes: 85 additions & 0 deletions packages/preview/summy/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# simple-cheatsheet

Simple cheatsheet template for [Typst](https://typst.app/) that allows you to
provide an overview of all coursework in an accessible, low-bloat manner with a focus on legibility and space-efficiency.

## Usage

### Web-app

In the Typst web app dashboard, select "Start from template" and search for `summy`.

Name your project and select Create.

### CLI

To build this project via the CLI, use the command

```
typst init @preview/summy
```

A sample project will be created with the template format.

## Configuration

This template exports the `cheatsheet` function with the following named optional
arguments:


- `title`: Title of document (Default = "")
- `authors`: Author Name (Default = "")
- `write_title`: Writes Title (Default = false)
- `font_size`: Size of font (Default = 5.5pt)
- `line_skip`: Size of line-skip (Default = 5.5pt)
- `x_margin`: Margin on x-axis (Default = 30pt)
- `y_margin`: Margin on y-axis (Default = 0pt)
- `num_columns`: Number of columns (Default = 5)
- `column_gutter`: Space between columns (Default = 4pt)
- `numbered_units`: Numbering of units (Default = false)

To modify an existing project using this template:
1. Import project to top of file
2. Use Show rule to create instance of cheatsheet
3. Add cheatsheet information below (Recommmended to break into separate files for simplicity)

### Example:

```typst
#import "@preview/summy:0.1.0": *
#set page(paper: "a4", flipped: true, margin: 1cm)
#set text(font: "Arial", size: 11pt)
#show: cheatsheet.with(
title: "Cheatsheet Title",
authors: "Authors",
write_title: false,
font_size: 5.5pt,
line_skip: 5.5pt,
x_margin: 30pt,
y_margin: 30pt,
num_columns: 5,
column_gutter: 4pt,
numbered_units: false,
)
#include "units/00-general-formula.typ"
#include "units/01-lorem-ipsum.typ"
#include "units/02-lorem-ipsum.typ"
```

### Sub-files:
Subfiles are an organizational tool to separate various sections, to make it easier to organize.

Each new section is separated by a single heading and subsections are represented by subheadings as below:

```typst
= Trigonometry
Lorem Ipsum
== Sin Law
== Cosine law
```
61 changes: 61 additions & 0 deletions packages/preview/summy/0.1.0/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#let cheatsheet(
title: [],
authors: (),
write-title: false,
font-size: 5.5pt,
line-skip: 5.5pt,
x-margin: 30pt,
y-margin: 0pt,
num-columns: 5,
column-gutter: 4pt,
numbered-units: false,
body) = {

let color-index = (
rgb("ff595e"),
rgb("ff751f"),
rgb("E0A500"),
rgb("B1B62B"),
rgb("82BC24"),
rgb("36949d"),
rgb("1982c4"),
rgb("4267ac"),
rgb("565aa0"),
rgb("6a4c93")
)


set page(paper: "a4",
flipped: true,
margin: (x: x-margin, y: y-margin))

set text(size: font-size)

set heading(numbering: "1.1")

show heading: it => {
let index = counter(heading).at(it.location()).first()
let hue = color-index.at(calc.rem(index - 1, color-index.len()))
let color = hue.darken(8% * (it.depth - 1))

set text(white, size: font-size)
block(
radius: 1.0mm,
inset: 1.0mm,
width: 90%,
above: line-skip,
below: line-skip,
fill: color,
it
)
}

let new-body = {
if write-title {
par[#title by #authors]
}
body
}

columns(num-columns, gutter: column-gutter, new-body)
}
23 changes: 23 additions & 0 deletions packages/preview/summy/0.1.0/template/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "@preview/summy:0.1.0": *

#set text(font: "Helvetica")

#show: cheatsheet.with(
title: "Cheatsheet Title",
authors: "Authors",
write-title: false,
font-size: 5.5pt,
line-skip: 5.5pt,
x-margin: 30pt,
y-margin: 30pt,
num-columns: 5,
column-gutter: 4pt,
numbered-units: false,
)

#include "units/00-general-formula.typ"
#include "units/01-lorem-ipsum.typ"
#include "units/02-lorem-ipsum.typ"
#include "units/03-lorem-ipsum.typ"
#include "units/04-lorem-ipsum.typ"
#include "units/05-lorem-ipsum.typ"
20 changes: 20 additions & 0 deletions packages/preview/summy/0.1.0/template/units/00-general-formula.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= General Formula
*Taylor Series*: Approximation of a function: \
$f(x) &= a + f'(a)(x-a) + (f''(a))/2(x-a)^2 + f^((3))/3!(x-a)^3 \ &= sum_(i=0) (f^((i))(a))/i! (x-a)^i$

*Periodic Function*: For $f(x)$ with period $T$: $f(t plus.minus T) = f(t)$ \

*Orthogonality*: \
$integral_0^(2 pi) cos(k t) sin(j t) d t = 0 forall k,j in ZZ$ \
$integral_0^(2 pi) cos(k t) cos(j t) d t = 0 forall k eq.not j$ \
$integral_0^(2 pi) sin(k t) sin(j t) d t = 0 forall k eq.not j$ \
$integral_0^(2 pi) sin(k t)$
$integral_0^(2 pi) cos(k t)$

*Complex Numbers:* (if $z = a + b i$) \
*Conjugate*: $overline(z) = a - b i$ \
*Modulus/Norm/Magnitude*: $|z| = sqrt(a^2 + b^2)$ \
*Argument/Phase/Angle*: $"Arg"(z) = "atan2"(b, a)$ \
*Euler's Formula*: $e^(i theta) = cos(theta) + i sin(theta)$

*Geometric Series*: $sum^N_(i=1) a r^i = a(r^N - 1)/(r-1)$
19 changes: 19 additions & 0 deletions packages/preview/summy/0.1.0/template/units/01-lorem-ipsum.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#import "@preview/lovelace:0.3.0": *

= #lorem(2)

== #lorem(3)
#lorem(20)
#pseudocode-list(indentation: 2em, line-gap: 0.6em)[
+ *For* $k = 1, dots, n$
+ *For* $i = k+1, dots, n$
+ $"Lorem" colon.eq a_(i k) / a_(k k)$
+ $a_(i k) colon.eq "mult"$
+ *For* $j = k+1, dots, n$
+ $a_(i j) colon.eq a_(i j) - "mult" times a_(k j)$
]

#lorem(30)

=== #lorem(2)
#lorem(40)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= #lorem(2)
#lorem(40)

== #lorem(2)
#lorem(50)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= #lorem(2)
#lorem(40)

== #lorem(2)
#lorem(50)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= #lorem(2)
#lorem(40)

== #lorem(2)
#lorem(50)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= #lorem(2)
#lorem(40)

== #lorem(2)
#lorem(50)
Binary file added packages/preview/summy/0.1.0/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/preview/summy/0.1.0/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "summy"
version = "0.1.0"
entrypoint = "lib.typ"
authors = ["Wasay Saeed @wasaysir"]
license = "MIT"
description = "Generate cheatsheets with automatic colour coding and sectioning with a focus on space-efficiency."
categories = ["report"]

[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "thumbnail.png"

0 comments on commit a9b1167

Please sign in to comment.