├── qr ├── src │ ├── lib.typ │ ├── qr.wasm │ └── qr.typ ├── bin │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── typst.toml ├── assets │ └── example.typ ├── LICENSE └── README.md ├── equate ├── src │ ├── lib.typ │ └── equate.typ ├── tests │ ├── .gitignore │ ├── .ignore │ ├── boxed │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── break │ │ ├── ref │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ └── 8.png │ │ └── test.typ │ ├── local │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── margin │ │ ├── ref │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ └── 7.png │ │ └── test.typ │ ├── alignment │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── number-mode │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── numbering │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── reference │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── align-points │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ └── template.typ ├── typst.toml ├── assets │ ├── example-local.typ │ └── example.typ ├── LICENSE └── README.md ├── united ├── assets │ ├── postfixes.csv │ ├── prefixes.csv │ └── units.csv ├── typst.toml ├── examples │ ├── quantities.typ │ ├── numbers.typ │ ├── ranges.typ │ └── units.typ ├── LICENSE ├── src │ ├── data.typ │ ├── lib.typ │ ├── united.typ │ ├── unit.typ │ └── number.typ └── README.md ├── droplet ├── src │ ├── lib.typ │ ├── util.typ │ ├── split.typ │ ├── extract.typ │ └── droplet.typ ├── tests │ ├── .gitignore │ ├── .ignore │ ├── basic │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── split │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── blocks │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── extract │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── justify │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── template.typ │ ├── customize │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ └── explicit │ │ ├── ref │ │ └── 1.png │ │ └── test.typ ├── typst.toml ├── assets │ ├── example-transform.typ │ └── example.typ ├── LICENSE └── README.md ├── outex ├── src │ ├── lib.typ │ └── outex.typ ├── typst.toml ├── assets │ └── example.typ ├── LICENSE └── README.md ├── .cargo └── config.toml ├── quick-maths ├── src │ ├── lib.typ │ └── quick-maths.typ ├── tests │ ├── .gitignore │ ├── .ignore │ ├── shorthands │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ └── template.typ ├── typst.toml ├── assets │ ├── example.typ │ └── example.svg ├── README.md └── LICENSE ├── based ├── tests │ ├── .gitignore │ ├── .ignore │ ├── decode │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ ├── encode │ │ ├── ref │ │ │ └── 1.png │ │ └── test.typ │ └── template.typ ├── src │ ├── lib.typ │ ├── base32.typ │ ├── base16.typ │ ├── base64.typ │ └── coder.typ ├── typst.toml ├── assets │ └── example.typ ├── LICENSE └── README.md ├── hash ├── src │ ├── hash.wasm │ ├── lib.typ │ └── hash.typ ├── bin │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── typst.toml ├── assets │ └── example.typ ├── LICENSE └── README.md ├── .gitignore ├── Cargo.toml ├── .github └── workflows │ └── ci.yml ├── README.md └── Cargo.lock /qr/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "qr.typ": create 2 | -------------------------------------------------------------------------------- /equate/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "equate.typ": equate 2 | -------------------------------------------------------------------------------- /united/assets/postfixes.csv: -------------------------------------------------------------------------------- 1 | squared,2 2 | cubed,3 3 | -------------------------------------------------------------------------------- /droplet/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "droplet.typ": dropcap 2 | -------------------------------------------------------------------------------- /outex/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "outex.typ": outex, repeat 2 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "wasm32-unknown-unknown" 3 | -------------------------------------------------------------------------------- /quick-maths/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "quick-maths.typ": shorthands 2 | -------------------------------------------------------------------------------- /based/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **/out/ 3 | **/diff/ 4 | -------------------------------------------------------------------------------- /based/tests/.ignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **.png 3 | **.svg 4 | **.pdf 5 | -------------------------------------------------------------------------------- /droplet/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **/out/ 3 | **/diff/ 4 | -------------------------------------------------------------------------------- /equate/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **/out/ 3 | **/diff/ 4 | -------------------------------------------------------------------------------- /droplet/tests/.ignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **.png 3 | **.svg 4 | **.pdf 5 | -------------------------------------------------------------------------------- /equate/tests/.ignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **.png 3 | **.svg 4 | **.pdf 5 | -------------------------------------------------------------------------------- /quick-maths/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **/out/ 3 | **/diff/ 4 | -------------------------------------------------------------------------------- /qr/src/qr.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/qr/src/qr.wasm -------------------------------------------------------------------------------- /quick-maths/tests/.ignore: -------------------------------------------------------------------------------- 1 | # added by typst-test 2 | **.png 3 | **.svg 4 | **.pdf 5 | -------------------------------------------------------------------------------- /hash/src/hash.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/hash/src/hash.wasm -------------------------------------------------------------------------------- /based/tests/decode/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/based/tests/decode/ref/1.png -------------------------------------------------------------------------------- /based/tests/encode/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/based/tests/encode/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/basic/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/basic/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/split/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/split/ref/1.png -------------------------------------------------------------------------------- /equate/tests/boxed/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/boxed/ref/1.png -------------------------------------------------------------------------------- /equate/tests/break/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/1.png -------------------------------------------------------------------------------- /equate/tests/break/ref/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/2.png -------------------------------------------------------------------------------- /equate/tests/break/ref/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/3.png -------------------------------------------------------------------------------- /equate/tests/break/ref/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/4.png -------------------------------------------------------------------------------- /equate/tests/break/ref/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/5.png -------------------------------------------------------------------------------- /equate/tests/break/ref/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/6.png -------------------------------------------------------------------------------- /equate/tests/break/ref/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/7.png -------------------------------------------------------------------------------- /equate/tests/break/ref/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/break/ref/8.png -------------------------------------------------------------------------------- /equate/tests/local/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/local/ref/1.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/1.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/2.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/3.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/4.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/5.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/6.png -------------------------------------------------------------------------------- /equate/tests/margin/ref/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/margin/ref/7.png -------------------------------------------------------------------------------- /hash/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "hash.typ": hash, hex, blake2, blake2s, md5, sha1, sha224, sha256, sha384, sha512, sha3 2 | -------------------------------------------------------------------------------- /droplet/tests/blocks/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/blocks/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/extract/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/extract/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/justify/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/justify/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/template.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | -------------------------------------------------------------------------------- /droplet/tests/customize/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/customize/ref/1.png -------------------------------------------------------------------------------- /droplet/tests/explicit/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/droplet/tests/explicit/ref/1.png -------------------------------------------------------------------------------- /equate/tests/alignment/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/alignment/ref/1.png -------------------------------------------------------------------------------- /equate/tests/number-mode/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/number-mode/ref/1.png -------------------------------------------------------------------------------- /equate/tests/numbering/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/numbering/ref/1.png -------------------------------------------------------------------------------- /equate/tests/reference/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/reference/ref/1.png -------------------------------------------------------------------------------- /equate/tests/align-points/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/equate/tests/align-points/ref/1.png -------------------------------------------------------------------------------- /based/tests/template.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": * 2 | 3 | #set page(width: auto, height: auto, margin: 0pt) 4 | 5 | #{ 6 | 7 | } 8 | -------------------------------------------------------------------------------- /equate/tests/template.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate 5 | -------------------------------------------------------------------------------- /quick-maths/tests/shorthands/ref/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpicEricEE/typst-plugins/HEAD/quick-maths/tests/shorthands/ref/1.png -------------------------------------------------------------------------------- /quick-maths/tests/template.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": shorthands 2 | 3 | #set page(width: 4cm, height: auto, margin: 1em) 4 | #show: shorthands.with() 5 | -------------------------------------------------------------------------------- /droplet/tests/basic/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | 5 | // Test basic use of dropcap. 6 | 7 | #dropcap(lorem(20)) 8 | -------------------------------------------------------------------------------- /qr/bin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "qr" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | fast_qr = { version = "0.10.2", features = ["image", "svg"] } 11 | wasm-minimal-protocol = { workspace = true } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | 12 | # VS Code 13 | .vscode/ 14 | -------------------------------------------------------------------------------- /based/src/lib.typ: -------------------------------------------------------------------------------- 1 | #import "base64.typ" 2 | #import "base32.typ" 3 | #import "base16.typ" 4 | 5 | #let encode64 = base64.encode 6 | #let decode64 = base64.decode 7 | 8 | #let encode32 = base32.encode 9 | #let decode32 = base32.decode 10 | 11 | #let encode16 = base16.encode 12 | #let decode16 = base16.decode 13 | -------------------------------------------------------------------------------- /qr/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "qr" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | authors = ["Eric Biedert"] 6 | license = "MIT" 7 | description = "Fast QR Code generator." 8 | repository = "https://github.com/EpicEricEE/typst-plugins" 9 | compiler = "0.8.0" 10 | exclude = ["README.md", "bin", "assets"] 11 | -------------------------------------------------------------------------------- /droplet/tests/justify/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | 5 | // Test different justify values. 6 | 7 | #dropcap(justify: true, lorem(20)) 8 | 9 | #set par(justify: true) 10 | 11 | #dropcap(justify: auto, lorem(20)) 12 | #dropcap(justify: false, lorem(20)) 13 | -------------------------------------------------------------------------------- /outex/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "outex" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | compiler = "0.11.0" 6 | authors = ["Eric Biedert"] 7 | license = "MIT" 8 | description = "Outlines styled like in LaTeX." 9 | repository = "https://github.com/EpicEricEE/typst-plugins" 10 | exclude = ["README.md", "assets"] 11 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["hash/bin", "qr/bin"] 3 | resolver = "2" 4 | 5 | [workspace.dependencies] 6 | wasm-minimal-protocol = { git = "https://github.com/astrale-sharp/wasm-minimal-protocol" } 7 | 8 | [profile.release] 9 | lto = true 10 | strip = true 11 | opt-level = 'z' 12 | codegen-units = 1 13 | panic = 'abort' 14 | -------------------------------------------------------------------------------- /hash/bin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hash" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | wasm-minimal-protocol = { workspace = true } 11 | blake2 = "0.10.6" 12 | digest = "0.10.7" 13 | md-5 = "0.10.5" 14 | sha1 = "0.10.5" 15 | sha2 = "0.10.7" 16 | sha3 = "0.10.8" 17 | -------------------------------------------------------------------------------- /united/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "united" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | authors = ["Eric Biedert", "Christopher Hecker"] 6 | repository = "https://github.com/EpicEricEE/typst-plugins" 7 | license = "MIT" 8 | description = "Easy typesetting of numbers with units." 9 | exclude = ["README.md", "examples/**"] 10 | -------------------------------------------------------------------------------- /hash/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hash" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | authors = ["Eric Biedert"] 6 | license = "MIT" 7 | description = "Implementation of multiple hashing algorithms." 8 | repository = "https://github.com/EpicEricEE/typst-plugins" 9 | compiler = "0.8.0" 10 | exclude = ["README.md", "bin", "assets"] 11 | -------------------------------------------------------------------------------- /quick-maths/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "quick-maths" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | authors = ["Eric Biedert"] 6 | license = "MIT" 7 | description = "Custom shorthands for math equations." 8 | repository = "https://github.com/EpicEricEE/typst-plugins" 9 | exclude = ["README.md", "assets"] 10 | categories = ["utility"] 11 | -------------------------------------------------------------------------------- /based/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "based" 3 | version = "0.1.0" 4 | entrypoint = "src/lib.typ" 5 | authors = ["Eric Biedert"] 6 | license = "MIT" 7 | description = "Encoder and decoder for base64, base32, and base16." 8 | repository = "https://github.com/EpicEricEE/typst-plugins" 9 | exclude = ["README.md", "assets", "tests"] 10 | categories = ["scripting"] 11 | -------------------------------------------------------------------------------- /droplet/tests/explicit/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | 5 | // Test explicitly passed first letter. 6 | 7 | #dropcap(square(size: 1em), gap: 1em)[A square is a square.] 8 | #dropcap(square(size: 1em), gap: 1em, height: 3, lorem(13)) 9 | #dropcap(square(), height: 14pt, gap: 1em, lorem(10)) 10 | #dropcap[\#1][The winner has won what was to win.] 11 | -------------------------------------------------------------------------------- /droplet/tests/extract/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | 5 | // Test that the first letter is extracted correctly. 6 | 7 | #dropcap[First letter] 8 | #dropcap[1. Wash your hands] 9 | #dropcap[“This is a quote,” said someone.] 10 | #dropcap[#super[1] In the beginning...] 11 | #dropcap[H#sub[2] is hydrogen.] 12 | #dropcap[#box[This] is a boxed word.] 13 | -------------------------------------------------------------------------------- /equate/tests/local/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #set math.equation(numbering: "(1)") 5 | 6 | $ a + b \ 7 | c + d $ 8 | 9 | #equate($ 10 | d + e \ 11 | f + g # 12 | $) 13 | 14 | @lbl (wrong) 15 | 16 | #equate() (correct) 17 | 18 | #[ 19 | #show ref: equate 20 | @lbl (correct) 21 | ] 22 | 23 | #[ 24 | #show: equate 25 | @lbl (correct) 26 | ] -------------------------------------------------------------------------------- /equate/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "equate" 3 | version = "0.2.0" 4 | entrypoint = "src/lib.typ" 5 | compiler = "0.11.0" 6 | authors = ["Eric Biedert"] 7 | repository = "https://github.com/EpicEricEE/typst-plugins" 8 | license = "MIT" 9 | description = "Breakable equations with improved numbering." 10 | exclude = ["README.md", "assets", "tests"] 11 | categories = ["layout", "model"] 12 | keywords = ["math", "equation", "formula", "sub", "multiline", "multi-line", "split"] 13 | -------------------------------------------------------------------------------- /droplet/tests/blocks/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | 5 | // Test block content within a dropcap. 6 | 7 | #dropcap(height: 1cm, gap: 4pt)[ 8 | Einstein said that mass and energy go like 9 | $ E = m c^2 $ 10 | and it was true (mostly). 11 | ] 12 | 13 | #dropcap(height: 1cm, gap: 3pt)[ 14 | There is a rectangle below 15 | 16 | #align(center, rect()) 17 | 18 | but it's still beside the first letter. 19 | ] 20 | -------------------------------------------------------------------------------- /droplet/typst.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "droplet" 3 | version = "0.2.0" 4 | entrypoint = "src/lib.typ" 5 | compiler = "0.11.0" 6 | authors = ["Eric Biedert"] 7 | repository = "https://github.com/EpicEricEE/typst-plugins" 8 | license = "MIT" 9 | description = "Customizable dropped capitals." 10 | exclude = ["README.md", "assets", "tests"] 11 | categories = ["text"] 12 | keywords = [ 13 | "drop", "dropped", "dropcap", "big", "large", "caps", "capital", "capitals", 14 | "initial", "initials", "letter", "letters", "lettrine" 15 | ] 16 | -------------------------------------------------------------------------------- /quick-maths/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": shorthands 2 | 3 | #set text(size: 14pt) 4 | #set page( 5 | width: 8cm, 6 | height: auto, 7 | margin: 1em, 8 | background: pad(0.5pt, box( 9 | width: 100%, 10 | height: 100%, 11 | radius: 4pt, 12 | fill: white, 13 | stroke: white.darken(10%), 14 | )), 15 | ) 16 | 17 | #show: shorthands.with( 18 | ($+-$, $plus.minus$), 19 | ($|-$, $tack$), 20 | ($<=$, math.arrow.l.double) // Replaces '≤' 21 | ) 22 | 23 | $ x^2 = 9 quad <==> quad x = +-3 $ 24 | $ A or B |- A $ 25 | $ x <= y $ 26 | -------------------------------------------------------------------------------- /united/assets/prefixes.csv: -------------------------------------------------------------------------------- 1 | quecto,q,upright("q") 2 | ronto,r,upright("r") 3 | yocto,y,upright("y") 4 | zepto,z,upright("z") 5 | atto,a,upright("a") 6 | femto,f,upright("f") 7 | pico,p,upright("p") 8 | nano,n,upright("n") 9 | micro,u,upright("µ") 10 | micro,µ,upright("µ") 11 | milli,m,upright("m") 12 | centi,c,upright("c") 13 | deci,d,upright("d") 14 | deca,da,upright("da") 15 | hecto,h,upright("h") 16 | kilo,k,upright("k") 17 | mega,M,upright("M") 18 | giga,G,upright("G") 19 | tera,T,upright("T") 20 | peta,P,upright("P") 21 | exa,E,upright("E") 22 | zeta,Z,upright("Z") 23 | yotta,Y,upright("Y") 24 | ronna,R,upright("R") 25 | quetta,Q,upright("Q") 26 | -------------------------------------------------------------------------------- /equate/tests/alignment/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate 5 | 6 | // Test correct number position when using `set align`. 7 | 8 | #set math.equation(numbering: "(1)") 9 | 10 | #for number-align in (left, right) { 11 | set math.equation(number-align: number-align) 12 | 13 | $ a + b $ 14 | show math.equation: set align(start) 15 | $ a + b $ 16 | show math.equation: set align(end) 17 | $ a + b $ 18 | } 19 | 20 | // Test alignment points together with `set align`. 21 | 22 | #show math.equation: set align(start) 23 | 24 | $ a + b &= c &+ d = e \ 25 | f &= g & = h $ 26 | -------------------------------------------------------------------------------- /qr/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ" as qr 2 | 3 | #set text(size: 14pt) 4 | #set page( 5 | width: auto, 6 | height: auto, 7 | margin: 1em, 8 | background: pad(0.5pt, box( 9 | width: 100%, 10 | height: 100%, 11 | radius: 4pt, 12 | fill: white, 13 | stroke: white.darken(10%), 14 | )), 15 | ) 16 | 17 | #table( 18 | columns: 2, 19 | inset: 0.5em, 20 | align: horizon, 21 | 22 | table.header[*Data*][*QR Code*], 23 | 24 | [Hello world!], qr.create("Hello world!", margin: 0, width: 100%), 25 | [Hallo Welt!], qr.create("Hallo Welt!", fill: blue, width: 100%), 26 | [#(1, 2, 3, 4)], box(fill: yellow, qr.create((1, 2, 3, 4), width: 100%)), 27 | ) 28 | -------------------------------------------------------------------------------- /equate/tests/margin/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate.with(breakable: true) 5 | 6 | // Test number positioning with different page margins. 7 | 8 | #set math.equation(numbering: "(1)") 9 | 10 | #for side in ("left", "right", "x", "inside", "outside") { 11 | page(margin: ((side): 2cm))[ 12 | $ a + b $ 13 | 14 | #set math.equation(number-align: start) 15 | $ a + b $ 16 | 17 | #set text(dir: rtl) 18 | $ a + b $ 19 | ] 20 | } 21 | 22 | // Test break over pages with different margins. 23 | 24 | #set page(margin: (inside: 2cm), height: 2cm) 25 | 26 | $ a + b \ 27 | c + d \ 28 | e + f \ 29 | g + h $ 30 | -------------------------------------------------------------------------------- /droplet/tests/split/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 4.6cm, height: auto, margin: 1em) 4 | 5 | // Test correct splitting of text. 6 | 7 | #dropcap[ 8 | This test verifies that the package doesn't split words at apostrophes. 9 | ] 10 | 11 | #dropcap(justify: true, gap: 2pt)[ 12 | This test verifies that the package doesn't split words at apostrophes. 13 | ] 14 | 15 | #dropcap(justify: true)[ 16 | Here are two rectangles #box(width: 1em, height: 3em, baseline: 2.34em, fill: red) #box(width: 1em, height: 4em, baseline: 3.34em, fill: red) in red and there is text beside. 17 | ] 18 | 19 | #dropcap(height: 1.1em,)[ 20 | This is an equation $(display(integral F = 0))$ test, which tests stuff. 21 | ] 22 | -------------------------------------------------------------------------------- /equate/assets/example-local.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": equate 2 | 3 | #set text(size: 14pt) 4 | #set par(justify: true) 5 | #set page( 6 | width: 11cm, 7 | height: auto, 8 | margin: 1em, 9 | background: pad(0.5pt, box( 10 | width: 100%, 11 | height: 100%, 12 | radius: 4pt, 13 | fill: white, 14 | stroke: white.darken(10%), 15 | )), 16 | ) 17 | 18 | // Allow references to a line of the equation. 19 | #show ref: equate 20 | 21 | #set math.equation(numbering: "(1.1)", supplement: "Eq.") 22 | 23 | #equate($ 24 | E &= m c^2 # \ 25 | &= sqrt(p^2 c^2 + m^2 c^4) # 26 | $) 27 | 28 | While @short is the famous equation by Einstein, @long is a 29 | more general form of the energy-momentum relation. 30 | -------------------------------------------------------------------------------- /equate/tests/break/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: 2cm, margin: 1em) 4 | #show: equate 5 | 6 | // Test equations breaking across page boundaries. 7 | 8 | #show math.equation: set block(breakable: true) 9 | 10 | $ a + b \ 11 | c - d \ 12 | e + f \ 13 | g = h $ 14 | 15 | $ a &= b \ 16 | &= d \ 17 | &= f \ 18 | g &= h $ 19 | 20 | // Test breakable parameter. 21 | 22 | #equate(breakable: false, $ 23 | a + b \ 24 | c - d \ 25 | e + f \ 26 | g = h 27 | $) 28 | 29 | #show math.equation: set block(breakable: false) 30 | 31 | $ a + b \ 32 | c - d \ 33 | e + f \ 34 | g = h $ 35 | 36 | 37 | #equate(breakable: true, $ 38 | a + b \ 39 | c - d \ 40 | e + f \ 41 | g = h 42 | $) 43 | -------------------------------------------------------------------------------- /based/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": base64, base32, base16 2 | 3 | #set text(size: 14pt) 4 | #set page( 5 | width: auto, 6 | height: auto, 7 | margin: 1em, 8 | background: pad(0.5pt, box( 9 | width: 100%, 10 | height: 100%, 11 | radius: 4pt, 12 | fill: white, 13 | stroke: white.darken(10%), 14 | )), 15 | ) 16 | 17 | #table( 18 | columns: 3, 19 | inset: 0.5em, 20 | 21 | table.header[*Base64*][*Base32*][*Base16*], 22 | 23 | raw(base64.encode("Hello world!")), 24 | raw(base32.encode("Hello world!")), 25 | raw(base16.encode("Hello world!")), 26 | 27 | str(base64.decode("SGVsbG8gd29ybGQh")), 28 | str(base32.decode("JBSWY3DPEB3W64TMMQQQ====")), 29 | str(base16.decode("48656C6C6F20776F726C6421")) 30 | ) 31 | -------------------------------------------------------------------------------- /droplet/tests/customize/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": dropcap 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #set par(justify: true) 5 | 6 | // Test arguments for customization. 7 | 8 | #dropcap(height: 3, lorem(14)) 9 | #dropcap(height: 1.1cm, lorem(14)) 10 | #dropcap(depth: 2, lorem(23)) 11 | #dropcap(height: 5mm, depth: 5mm, lorem(16)) 12 | #dropcap(overhang: 1em, lorem(7)) 13 | #dropcap(overhang: 100%, lorem(7)) 14 | #dropcap(overhang: -1em, gap: 1em, lorem(12)) 15 | #dropcap(height: 3, hanging-indent: 1em, lorem(13)) 16 | #dropcap( 17 | gap: 8pt, 18 | fill: white, 19 | font: "New Computer Modern", 20 | style: "italic", 21 | transform: letter => { 22 | h(4pt) + box(fill: blue, letter + h(10pt), outset: 3pt) 23 | }, 24 | lorem(11) 25 | ) 26 | -------------------------------------------------------------------------------- /united/examples/quantities.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": qty 2 | 3 | #set raw(lang: "typ") 4 | #set text(size: 14pt) 5 | #set table( 6 | inset: 0.7em, 7 | fill: (x, y) => if y == 0 { luma(230) } 8 | ) 9 | #set page( 10 | width: auto, 11 | height: auto, 12 | margin: 1em, 13 | background: pad(0.5pt, box( 14 | width: 100%, 15 | height: 100%, 16 | radius: 4pt, 17 | fill: white, 18 | stroke: white.darken(10%), 19 | )), 20 | ) 21 | 22 | #table( 23 | columns: 2, 24 | [*Input*], [*Output*], 25 | [`#qty(42, "µm")`], [#qty(42, "µm")], 26 | [`#qty[3.5(5)][meter cubed]`], [#qty[3.5(5)][meter cubed]], 27 | [`#qty[1.602e-19][eV]`], [#qty[1.602e-19][eV]], 28 | [`$qty(12+3-1 e-9, s)$`], [$qty(12+3-1 e-9, s)$], 29 | ) 30 | -------------------------------------------------------------------------------- /united/examples/numbers.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": num 2 | 3 | #set raw(lang: "typ") 4 | #set text(size: 14pt) 5 | #set table( 6 | inset: 0.7em, 7 | fill: (x, y) => if y == 0 { luma(230) } 8 | ) 9 | #set page( 10 | width: auto, 11 | height: auto, 12 | margin: 1em, 13 | background: pad(0.5pt, box( 14 | width: 100%, 15 | height: 100%, 16 | radius: 4pt, 17 | fill: white, 18 | stroke: white.darken(10%), 19 | )), 20 | ) 21 | 22 | #table( 23 | columns: 2, 24 | [*Input*], [*Output*], 25 | [`#num("12345")`], [#num("12345")], 26 | [`#num(3.14159)`], [#num(3.14159)], 27 | [`#num[3.5e5]`], [#num[3.5e5]], 28 | [`#num[2.5+-0.5]`], [#num[2.5+-0.5]], 29 | [`#num[3+2-1 e-3]`], [#num[3+2-1 e-3]], 30 | [`$num(2.53(12)e+7)$`], [$num(2.53(12)e+7)$], 31 | ) 32 | -------------------------------------------------------------------------------- /outex/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": outex 2 | 3 | #set text(size: 14pt) 4 | #set heading(numbering: "1.1 i") 5 | #set page( 6 | width: 10cm, 7 | height: auto, 8 | margin: 1em, 9 | background: box( 10 | width: 100%, 11 | height: 100%, 12 | radius: 4pt, 13 | fill: white, 14 | stroke: white.darken(10%), 15 | ), 16 | ) 17 | 18 | #show heading: set block(below: 1em) 19 | #show: outex 20 | 21 | #outline(title: "Table of Contents") 22 | 23 | #set page(height: 2cm) 24 | 25 | = Introduction 26 | 27 | = Background 28 | 29 | == The Problem 30 | 31 | == The Solution 32 | 33 | = Implementation 34 | 35 | == The Algorithm 36 | 37 | == The Code 38 | 39 | === The Parser 40 | 41 | === The Compiler 42 | 43 | == The Tests 44 | 45 | = Conclusion 46 | 47 | #heading(numbering: none, [References]) 48 | -------------------------------------------------------------------------------- /quick-maths/README.md: -------------------------------------------------------------------------------- 1 | # quick-maths 2 | A package for creating custom shorthands for math equations. 3 | 4 | > [!WARNING] 5 | > This repository has been archived. The package has been moved to the [EpicEricEE/typst-quick-maths](https://github.com/EpicEricEE/typst-quick-maths) repository. 6 | 7 | ## Usage 8 | The package comes with a single template function `shorthands` that takes one or more tuples of the form `(shorthand, replacement)`, where `shorthand` can be a string or content. 9 | 10 | ```typ 11 | #import "@preview/quick-maths:0.1.0": shorthands 12 | 13 | #show: shorthands.with( 14 | ($+-$, $plus.minus$), 15 | ($|-$, math.tack), 16 | ($<=$, math.arrow.l.double) // Replaces '≤' 17 | ) 18 | 19 | $ x^2 = 9 quad <==> quad x = +-3 $ 20 | $ A or B |- A $ 21 | $ x <= y $ 22 | ``` 23 | 24 | ![Result of example code.](./assets/example.svg) 25 | -------------------------------------------------------------------------------- /equate/tests/reference/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate.with(sub-numbering: true) 5 | 6 | // Test references to equations with sub-numbering 7 | 8 | #set math.equation(numbering: "(1.1)") 9 | 10 | $ a + b \ 11 | c + d \ 12 | e + f $ 13 | 14 | $ a + b \ 15 | c + d # \ 16 | e + f $ 17 | 18 | #show: equate.with(sub-numbering: false) 19 | 20 | $ a + b \ 21 | c + d # \ 22 | e + f $ 23 | 24 | #show: equate.with(number-mode: "label") 25 | 26 | $ a + b \ 27 | c + d # \ 28 | e + f $ 29 | 30 | @outer, @inner, @no-sub, @labelled 31 | 32 | See @inner[] and @outer[eq.] 33 | 34 | #set ref(supplement: it => { 35 | if it.label == { 36 | "Subequation" 37 | } else { 38 | "Equation" 39 | } 40 | }) 41 | 42 | @inner, @outer 43 | -------------------------------------------------------------------------------- /equate/tests/boxed/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate.with(breakable: true) 5 | 6 | // Test equation sizing when given constraints. 7 | 8 | // Unnumbered 9 | #block(width: 50%, fill: yellow, $ a + b $) 10 | #block(width: 50%, fill: yellow, $ c + d \ e + f $) 11 | 12 | #h(1cm) #box(width: 40%, fill: yellow, $ g + h $) 13 | 14 | #h(1cm) #box(fill: yellow, $ g + h $) 15 | 16 | // Numbered 17 | #set math.equation(numbering: "(1)") 18 | 19 | #block(width: 50%, fill: yellow, $ a + b $) 20 | #block(width: 50%, fill: yellow, $ c + d \ e + f $) 21 | 22 | #h(1cm) #box(width: 40%, fill: yellow, $ g + h $) 23 | 24 | #h(1cm) #box(fill: yellow, $ g + h $) 25 | 26 | // Columns 27 | #block(height: 2cm, columns(2)[ 28 | $ a + b \ 29 | c + d \ 30 | e + f \ 31 | g + h \ 32 | i + j $ 33 | ]) 34 | -------------------------------------------------------------------------------- /equate/tests/numbering/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate 5 | 6 | // Test correct counter incrementation. 7 | 8 | #set math.equation(numbering: "(1.1)") 9 | 10 | $ a + b $ 11 | 12 | $ c + d \ 13 | e + f $ 14 | 15 | $ g + h $ 16 | 17 | #set math.equation(numbering: "(1a)") 18 | 19 | $ i + j \ 20 | k + l $ 21 | 22 | $ m + n \ 23 | o + p $ 24 | 25 | $ q + r \ 26 | s + t # \ 27 | u + v $ 28 | 29 | #show: equate.with(sub-numbering: true) 30 | 31 | #set math.equation(numbering: "(1.1)") 32 | 33 | $ a + b $ 34 | 35 | $ c + d \ 36 | e + f $ 37 | 38 | $ g + h $ 39 | 40 | #set math.equation(numbering: "(1a)") 41 | 42 | $ i + j \ 43 | k + l $ 44 | 45 | $ m + n \ 46 | o + p $ 47 | 48 | $ q + r \ 49 | s + t # \ 50 | u + v $ 51 | -------------------------------------------------------------------------------- /equate/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": equate 2 | 3 | #set text(size: 14pt) 4 | #set par(justify: true) 5 | #set page( 6 | width: 11cm, 7 | height: 4cm, 8 | margin: 1em, 9 | background: pad(0.5pt, box( 10 | width: 100%, 11 | height: 100%, 12 | radius: 4pt, 13 | fill: white, 14 | stroke: white.darken(10%), 15 | )), 16 | ) 17 | 18 | #show: equate.with(breakable: true, sub-numbering: true) 19 | #set math.equation(numbering: "(1.1)") 20 | 21 | The dot product of two vectors $arrow(a)$ and $arrow(b)$ can be 22 | calculated as shown in @dot-product. 23 | 24 | $ 25 | angle.l a, b angle.r &= arrow(a) dot arrow(b) \ 26 | &= a_1 b_1 + a_2 b_2 + ... a_n b_n \ 27 | &= sum_(i=1)^n a_i b_i. # 28 | $ 29 | 30 | The sum notation in @sum is a useful way to express the dot 31 | product of two vectors. 32 | -------------------------------------------------------------------------------- /united/examples/ranges.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": numrange, qtyrange 2 | 3 | #set raw(lang: "typ") 4 | #set text(size: 14pt) 5 | #set table( 6 | inset: 0.7em, 7 | fill: (x, y) => if y == 0 { luma(230) } 8 | ) 9 | #set page( 10 | width: auto, 11 | height: auto, 12 | margin: 1em, 13 | background: pad(0.5pt, box( 14 | width: 100%, 15 | height: 100%, 16 | radius: 4pt, 17 | fill: white, 18 | stroke: white.darken(10%), 19 | )), 20 | ) 21 | 22 | #table( 23 | columns: 2, 24 | [*Input*], [*Output*], 25 | [`#numrange(2, 5)`], [#numrange(2, 5)], 26 | [`#numrange[1.2e2][1.8e2]`], [#numrange[1.2e2][1.8e2]], 27 | [`#numrange[1.25e2][5.3e3]`], [#numrange[1.25e2][5.3e3]], 28 | [`#qtyrange[36(1)][38][celsius]`], [#qtyrange[36(1)][38][celsius]], 29 | [`#qtyrange[10][1e8][cm^-1]`], [#qtyrange[10][1e8][cm^-1]], 30 | ) 31 | -------------------------------------------------------------------------------- /droplet/assets/example-transform.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": dropcap 2 | 3 | #set text(size: 14pt) 4 | #set page( 5 | width: 8cm, 6 | height: auto, 7 | margin: 1em, 8 | background: pad(0.5pt, box( 9 | width: 100%, 10 | height: 100%, 11 | radius: 4pt, 12 | fill: white, 13 | stroke: white.darken(10%), 14 | )), 15 | ) 16 | 17 | #dropcap( 18 | height: 2, 19 | justify: true, 20 | gap: 6pt, 21 | transform: letter => style(styles => { 22 | let height = measure(letter, styles).height 23 | 24 | grid(columns: 2, gutter: 6pt, 25 | align(center + horizon, text(blue, letter)), 26 | // Use "place" to ignore the line's height when 27 | // the font size is calculated later on. 28 | place(horizon, line( 29 | angle: 90deg, 30 | length: height + 6pt, 31 | stroke: blue.lighten(40%) + 1pt 32 | )), 33 | ) 34 | }), 35 | lorem(21) 36 | ) 37 | -------------------------------------------------------------------------------- /hash/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": hash, hex, md5, sha256, sha3 2 | 3 | #set text(size: 14pt) 4 | #set page( 5 | width: auto, 6 | height: auto, 7 | margin: 1em, 8 | background: pad(0.5pt, box( 9 | width: 100%, 10 | height: 100%, 11 | radius: 4pt, 12 | fill: white, 13 | stroke: white.darken(10%), 14 | )), 15 | ) 16 | 17 | #table( 18 | columns: 2, 19 | inset: 0.5em, 20 | 21 | table.header[*Digest*][*Hash*], 22 | 23 | [BLAKE2], hex(hash("blake2", "Hello world!")), 24 | [BLAKE2s], hex(hash("blake2s", "Hello world!")), 25 | [MD5], hex(md5("Hello world!")), 26 | [SHA-1], hex(hash("sha1", "Hello world!")), 27 | [SHA-224], hex(hash("sha224", "Hello world!")), 28 | [SHA-256], hex(sha256("Hello world!")), 29 | [SHA-384], hex(hash("sha384", "Hello world!")), 30 | [SHA-512], hex(hash("sha512", "Hello world!")), 31 | [SHA-3], hex(sha3("Hello world!")), 32 | ) 33 | -------------------------------------------------------------------------------- /equate/tests/align-points/test.typ: -------------------------------------------------------------------------------- 1 | #import "/src/lib.typ": equate 2 | 3 | #set page(width: 8cm, height: auto, margin: 1em) 4 | #show: equate 5 | 6 | // Test re-implemented alignment algorithm. 7 | 8 | $ a + b &= c \ 9 | &= d + e $ 10 | 11 | $ a + b &= c + d &= e + f \ 12 | g &= & + h $ 13 | 14 | $ a + b &= c + d &&= e + f \ 15 | g & &&= h $ 16 | 17 | $ a + b &= c \ 18 | d & &= e + f $ 19 | 20 | $ "text" & "text" \ 21 | & "text" $ 22 | 23 | // Cases below taken from Typst test suite. 24 | 25 | $ "a" &= c \ 26 | &= c + 1 & "By definition" \ 27 | &= d + 100 + 1000 \ 28 | &= x & & "Even longer" \ 29 | $ 30 | 31 | $ & "right" \ 32 | "a very long line" \ 33 | "left" $ 34 | 35 | $ "right" \ 36 | "a very long line" \ 37 | "left" \ $ 38 | 39 | $ a &= b & quad c &= d \ 40 | e &= f & g &= h $ 41 | -------------------------------------------------------------------------------- /hash/bin/src/lib.rs: -------------------------------------------------------------------------------- 1 | use digest::Digest; 2 | use wasm_minimal_protocol::*; 3 | 4 | initiate_protocol!(); 5 | 6 | #[wasm_func] 7 | pub fn hash(hasher: &[u8], data: &[u8]) -> Result, String> { 8 | match hasher { 9 | b"blake2" => Ok(blake2::Blake2b512::digest(data).to_vec()), 10 | b"blake2s" => Ok(blake2::Blake2s256::digest(data).to_vec()), 11 | b"md5" => Ok(md5::Md5::digest(data).to_vec()), 12 | b"sha1" => Ok(sha1::Sha1::digest(data).to_vec()), 13 | b"sha224" => Ok(sha2::Sha224::digest(data).to_vec()), 14 | b"sha256" => Ok(sha2::Sha256::digest(data).to_vec()), 15 | b"sha384" => Ok(sha2::Sha384::digest(data).to_vec()), 16 | b"sha512" => Ok(sha2::Sha512::digest(data).to_vec()), 17 | b"sha3" => Ok(sha3::Sha3_512::digest(data).to_vec()), 18 | _ => Err(r#"expected "blake2", "blake2s", "md5", "sha1", "sha224", "sha256", "sha384", "sha512", or "sha3""#.to_string()), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /united/examples/units.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": unit 2 | 3 | #set raw(lang: "typ") 4 | #set text(size: 14pt) 5 | #set table( 6 | inset: 0.7em, 7 | fill: (x, y) => if y == 0 { luma(230) } 8 | ) 9 | #set page( 10 | width: auto, 11 | height: auto, 12 | margin: 1em, 13 | background: pad(0.5pt, box( 14 | width: 100%, 15 | height: 100%, 16 | radius: 4pt, 17 | fill: white, 18 | stroke: white.darken(10%), 19 | )), 20 | ) 21 | 22 | #table( 23 | columns: 2, 24 | [*Input*], [*Output*], 25 | [`#unit("kilo meter")`], [#unit("kilo meter")], 26 | [`#unit[meter squared]`], [#unit[meter squared]], 27 | [`#unit[joule per kilogram]`], [#unit[joule per kilogram]], 28 | [`#unit[kg m^2/s^2]`], [#unit[kg m^2/s^2]], 29 | [`#unit[per second]`], [#unit[per second]], 30 | [`#unit['apples' per day]`], [#unit['apples' per day]], 31 | [`$unit("cm"^-1)$`], [$unit("cm"^-1)$], 32 | ) 33 | -------------------------------------------------------------------------------- /droplet/assets/example.typ: -------------------------------------------------------------------------------- 1 | #import "../src/lib.typ": dropcap 2 | 3 | #set par(justify: true) 4 | #set text(size: 14pt) 5 | #set page( 6 | width: 11cm + 16pt, 7 | height: auto, 8 | margin: (x: 1em + 8pt, y: 1em), 9 | background: pad(0.5pt, box( 10 | width: 100%, 11 | height: 100%, 12 | radius: 4pt, 13 | fill: white, 14 | stroke: white.darken(10%), 15 | )), 16 | ) 17 | 18 | #dropcap( 19 | height: 3, 20 | gap: 4pt, 21 | hanging-indent: 1em, 22 | overhang: 8pt, 23 | font: "Curlz MT", 24 | )[ 25 | *Typst* is a new markup-based typesetting system that is designed to be as _powerful_ as LaTeX while being _much easier_ to learn and use. Typst has: 26 | 27 | - Built-in markup for the most common formatting tasks 28 | - Flexible functions for everything else 29 | - A tightly integrated scripting system 30 | - Math typesetting, bibliography management, and more 31 | - Fast compile times thanks to incremental compilation 32 | - Friendly error messages in case something goes wrong 33 | ] 34 | -------------------------------------------------------------------------------- /based/src/base32.typ: -------------------------------------------------------------------------------- 1 | #import "coder.typ" 2 | 3 | #let alphabet-32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" 4 | #let alphabet-32-hex = "0123456789ABCDEFGHIJKLMNOPQRSTUV" 5 | 6 | /// Encodes the given data in base32 format. 7 | /// 8 | /// Arguments: 9 | /// - data: The data to encode. Must be of type array, bytes, or string. 10 | /// - pad: Whether to pad the output with "=" characters. 11 | /// - hex: Whether to use the extended base32hex alphabet. 12 | /// 13 | /// Returns: The encoded string. 14 | #let encode(data, pad: true, hex: false) = { 15 | let alphabet = if hex { alphabet-32-hex } else { alphabet-32 } 16 | coder.encode(data, alphabet, pad: pad) 17 | } 18 | 19 | /// Decodes the given base32 string. 20 | /// 21 | /// Arguments: 22 | /// - string: The string to decode. 23 | /// - hex: Whether to use the extended base32hex alphabet. 24 | /// 25 | /// Returns: The decoded bytes. 26 | #let decode(string, hex: false) = { 27 | let alphabet = if hex { alphabet-32-hex } else { alphabet-32 } 28 | coder.decode(string, alphabet) 29 | } 30 | -------------------------------------------------------------------------------- /based/src/base16.typ: -------------------------------------------------------------------------------- 1 | /// Encodes the given data as a hex string. 2 | /// 3 | /// Arguments: 4 | /// - data: The data to encode. Must be of type array, bytes, or string. 5 | /// 6 | /// Returns: The encoded string (lowercase). 7 | #let encode(data) = { 8 | if data.len() == 0 { return "" } 9 | 10 | for byte in array(bytes(data)) { 11 | if byte < 16 { "0" } 12 | str(int(byte), base: 16) 13 | } 14 | } 15 | 16 | /// Decodes the given hex string. 17 | /// 18 | /// Arguments: 19 | /// - string: The string to decode (case-insensitive). 20 | /// 21 | /// Returns: The decoded bytes. 22 | #let decode(string) = { 23 | let dec(hex-digit) = { 24 | let code = str.to-unicode(hex-digit) 25 | if code >= 48 and code <= 57 { code - 48 } // 0-9 26 | else if code >= 65 and code <= 70 { code - 55 } // A-F 27 | else if code >= 97 and code <= 102 { code - 87 } // a-f 28 | else { panic("Invalid hex digit: " + hex-digit) } 29 | } 30 | 31 | let array = range(string.len(), step: 2).map(i => { 32 | 16 * dec(string.at(i)) + dec(string.at(i + 1)) 33 | }) 34 | bytes(array) 35 | } 36 | -------------------------------------------------------------------------------- /hash/src/hash.typ: -------------------------------------------------------------------------------- 1 | #let lib = plugin("hash.wasm") 2 | 3 | /// Hashes the given data with the given digest. 4 | /// 5 | /// Arguments: 6 | /// - digest: The digest to use for hashing. Must be one of 7 | /// "blake2", "blake2s", "md5", "sha1", "sha224", 8 | /// "sha256", "sha384", "sha512", or "sha3". 9 | /// - data: The data to hash. Must be of type array, bytes, or string. 10 | /// 11 | /// Returns: The hashed data as bytes. 12 | #let hash(digest, data) = lib.hash(bytes(digest), bytes(data)) 13 | 14 | /// Converts a byte array to a hexadecimal string. 15 | /// 16 | /// Arguments: 17 | /// - bytes: The bytes to convert. 18 | /// 19 | /// Returns: The hexadecimal string. 20 | #let hex(bytes) = for byte in array(bytes) { 21 | if byte < 16 { "0" } 22 | str(int(byte), base: 16) 23 | } 24 | 25 | #let blake2 = hash.with("blake2") 26 | #let blake2s = hash.with("blake2s") 27 | #let md5 = hash.with("md5") 28 | #let sha1 = hash.with("sha1") 29 | #let sha224 = hash.with("sha224") 30 | #let sha256 = hash.with("sha256") 31 | #let sha384 = hash.with("sha384") 32 | #let sha512 = hash.with("sha512") 33 | #let sha3 = hash.with("sha3") 34 | -------------------------------------------------------------------------------- /based/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /based/src/base64.typ: -------------------------------------------------------------------------------- 1 | #import "coder.typ" 2 | 3 | #let alphabet-64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 4 | #let alphabet-64-url = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" 5 | 6 | /// Encodes the given data in base64 format. 7 | /// 8 | /// Arguments: 9 | /// - data: The data to encode. Must be of type array, bytes, or string. 10 | /// - pad: Whether to pad the output with "=" characters. 11 | /// - url: Whether to use the URL safe alphabet. 12 | /// 13 | /// Returns: The encoded string. 14 | #let encode(data, pad: true, url: false) = { 15 | let alphabet = if url { alphabet-64-url } else { alphabet-64 } 16 | coder.encode(data, alphabet, pad: pad) 17 | } 18 | 19 | /// Decodes the given base64 string. 20 | /// 21 | /// URL safe characters are automatically converted to their standard 22 | /// counterparts. Invalid characters are ignored. 23 | /// 24 | /// Arguments: 25 | /// - string: The string to decode. 26 | /// 27 | /// Returns: The decoded bytes. 28 | #let decode(string) = { 29 | string = string.replace("-", "+").replace("_", "/") 30 | coder.decode(string, alphabet-64) 31 | } 32 | -------------------------------------------------------------------------------- /hash/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /outex/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /qr/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /droplet/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /equate/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - main 7 | pull_request: 8 | branches: 9 | - '**' 10 | 11 | jobs: 12 | ci: 13 | name: Test "${{ matrix.package }}" 14 | runs-on: ubuntu-latest 15 | 16 | strategy: 17 | matrix: 18 | package: 19 | - based 20 | - droplet 21 | - equate 22 | - quick-maths 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | 28 | - name: Probe runner package cache 29 | uses: awalsh128/cache-apt-pkgs-action@latest 30 | with: 31 | packages: cargo 32 | version: 1.0 33 | 34 | - name: Install typst-test from GitHub 35 | uses: baptiste0928/cargo-install@v3 36 | with: 37 | crate: typst-test 38 | git: https://github.com/tingerrr/typst-test.git 39 | branch: ci-semi-stable 40 | 41 | - name: Setup typst 42 | uses: typst-community/setup-typst@v3 43 | 44 | - name: Run test suite 45 | working-directory: ${{ matrix.package }} 46 | run: typst-test run 47 | -------------------------------------------------------------------------------- /quick-maths/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Eric Biedert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /united/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Christopher Hecker 4 | Copyright (c) 2023 Eric Biedert 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /equate/tests/number-mode/test.typ: -------------------------------------------------------------------------------- 1 | #import "../../src/lib.typ": equate 2 | 3 | #set page(width: 6cm, height: auto, margin: 1em) 4 | #show: equate.with(number-mode: "label") 5 | 6 | // Test correct counter incrementation with number-mode "label". 7 | 8 | #set math.equation(numbering: "(1.1)") 9 | 10 | $ a + b #