repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/tspier/SampleSlidesInTypst
https://raw.githubusercontent.com/tspier/SampleSlidesInTypst/main/slides.typ
typst
#import "@preview/polylux:0.3.1": * #import themes.metropolis: * #import "@preview/plotst:0.2.0": * #show: metropolis-theme.with( footer: [], ) #show footnote.entry: set text(size: 10pt) #set text(font: "Fira Sans", weight: "light", size: 25pt) #show math.equation: set text(font: "Fira Sans") #set strong(delta: 100) #set par(justify: true) #title-slide( author: [*Author*], title: "Title of Presentation", subtitle: "", date: "Affiliation", ) #slide(title: "Today's Agenda")[ + Item + Item + Item - Item - Item + Item // #metropolis-outline ] #slide(title: "Sample Slide with Text")[ #lorem(50) ] #slide(title: "Sample Slide with Stylized Text")[ Text can be printed normally, _in italics_, *in bold*, #underline[underlined], or even as clickable links like #link("https://www.google.com") with footnotes. #footnote[This is a sample footnote.] ] #slide(title: "Sample Slide with an Alert")[ This is a slide with a title and #alert[*important*] info. ] #slide(title: "Sample Slide with Block Quote")[ #set quote(block: true) #quote(attribution: [<NAME>])[ "I mostri esistono, ma sono troppo pochi per essere davvero pericolosi. Sono più pericolosi gli uomini comuni, i funzionari pronti a credere e obbedire senza discutere [...] Occorre dunque essere diffidenti con chi cerca di convincerci con strumenti diversi dalla ragione, ossia i capi carismatici: dobbiamo essere cauti nel delegare ad altri il nostro giudizio e la nostra volontà." ] ] #slide(title: "Sample Slide with Long Quote and Background Color")[ #block( fill: luma(230), inset: 10pt, radius: 4pt, text(18pt)["Then a terrible commotion was set up within me. I analyzed myself to the last thread, compared myself with others, recalled the slightest glances, smiles, words of the people to whom I had tried to open myself out, put the worst construction on everything, laughed vindictively at my own pretensions to 'be' like everyone else--and suddenly, in the midst of my laughter, collapsed utterly into gloom, sank into absurd dejection, and then began again as before--went round and round, in fact like a squirrel on its wheel. Whole days were spent in this harassing, fruitless exercise."] ) ] #slide(title: "Sample Slide with Text and One Image")[ #grid( columns: (3fr, 1.5fr), rows: (auto), gutter: 30pt, [#lorem(20)], grid.cell( colspan: 1, image("okapi.jpg", height: 100%) ), ) ] #slide(title: "Sample Slide with Two Images (Side-by-Side)")[ #grid( columns: (1fr, 1fr), rows: (auto), gutter: 0pt, grid.cell( colspan: 1, image("okapi.jpg") ), grid.cell( colspan: 1, image("okapi.jpg") ), ) ] #slide(title: "Sample Slide with Normal Table")[ #let frame(stroke) = (x, y) => ( left: if x > 0 { 0pt } else { stroke }, right: stroke, top: if y < 2 { stroke } else { 0pt }, bottom: stroke, ) #set table( fill: (_, y) => if y < 1 { rgb("EAF2F5") }, stroke: frame(rgb("21222C")), ) #table( columns: (0.5fr, 1fr, 1fr, 0.5fr), table.header[*Month*][*Title*][*Author*][*Genre*], [January], [_The Great Gatsby_], [<NAME>], [Classic], [February], [_To Kill a Mockingbird_], [<NAME>], [Drama], [March], [_1984_], [George Orwell], [Dystopian], ) ] #slide(title: "Sample Slide with Booktabs-Style Table")[ #let frame(stroke) = (x, y) => ( left: if x > 0 { 0pt } else { stroke }, right: stroke, top: if y < 2 { stroke } else { 0pt }, bottom: stroke, ) #set table(stroke: (_, y) => if y == 0 { (bottom: 1pt, top: 2pt) }) #table( columns: (0.5fr, 1fr, 1fr, 0.5fr), table.header[*Month*][*Title*][*Author*][*Genre*], [January], [_The Great Gatsby_], [<NAME>], [Classic], [February], [_To Kill a Mockingbird_], [<NAME>], [Drama], [March], [_1984_], [George Orwell], [Dystopian], table.hline(stroke: 2pt), ) ] #slide(title: "Sample Slide with Booktabs-Style Table and Color")[ #let frame(stroke) = (x, y) => ( left: if x > 0 { 0pt } else { stroke }, right: stroke, top: if y < 2 { stroke } else { 0pt }, bottom: stroke, ) #set table( fill: (_, y) => if y < 1 { rgb("EAF2F5") }, stroke: frame(rgb("21222C")), ) #set table(stroke: (_, y) => if y == 0 { (bottom: 1pt, top: 2pt) }) #table( columns: (0.5fr, 1fr, 1fr, 0.5fr), table.header[*Month*][*Title*][*Author*][*Genre*], [January], [_The Great Gatsby_], [<NAME>], [Classic], [February], [_To Kill a Mockingbird_], [<NAME>], [Drama], [March], [_1984_], [<NAME>], [Dystopian], table.hline(stroke: 2pt), ) ] #slide(title: "'Magical' Slide")[ - This is the first item. #pause - This is the second item. #pause - This is the third item. ] #slide(title: "Sample Slide with Math Equation")[ Here is a sample equation: $ sum_(k=1)^n k = (n(n+1)) / 2 $ ] #slide(title: "Sample Slide with Graph Plot")[ #let data = ( (0, 0), (2, 2), (3, 0), (4, 4), (5, 7), (6, 6), (7, 9), (8, 5), (9, 9), (10, 1) ) #let x_axis = axis(min: 0, max: 11, step: 2, location: "bottom") #let y_axis = axis(min: 0, max: 11, step: 2, location: "left", helper_lines: false) #let pl = plot(data: data, axes: (x_axis, y_axis)) #graph_plot(pl, (100%, 100%)) ] #slide(title: "Sample Slide with Bar Chart")[ #let data = ((10, "Monday"), (5, "Tuesday"), (15, "Wednesday"), (9, "Thursday"), (11, "Friday")) #let y_axis = axis(values: ("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"), location: "left", show_markings: true) #let x_axis = axis(min: 0, max: 20, step: 2, location: "bottom", helper_lines: true) #let pl = plot(axes: (x_axis, y_axis), data: data) #bar_chart(pl, (100%, 100%), fill: (purple, blue, red, green, yellow), bar_width: 70%, rotated: true) ] #focus-slide[ This is a slide in focus. ]
https://github.com/longlin10086/HITSZ-PhTyp
https://raw.githubusercontent.com/longlin10086/HITSZ-PhTyp/main/utils/question_list.typ
typst
#import "../themes/theme.typ" : * #let question_list(..questions)={ set text(font: ("Times New Roman", "Source Han Serif"), size: 12pt) enum(..questions, indent: 2em, tight: false) }
https://github.com/QuadnucYard/pavemat
https://raw.githubusercontent.com/QuadnucYard/pavemat/main/src/pavemat.typ
typst
MIT License
#let _get-fills-from(a, i, j, hfence: (), vfence: ()) = { // number of rows and columns let (n, m) = (a.len(), a.at(0).len()) // has each grid been visited let vis = (false,) * (n * m) // check pos inside let check(ii, jj) = { ii >= 0 and ii < n and jj >= 0 and jj < m } // start flood-fill vis.at(i * m + j) = true let stack = ((i, j),) let points = () while stack.len() > 0 { let (i, j) = stack.pop() points.push((i, j)) // manually enumerate 4 directions let (ii, jj) = (i + 1, j) // down if check(ii, jj) and not vis.at(ii * m + jj) and not hfence.at(ii * m + j) { vis.at(ii * m + jj) = true stack.push((ii, jj)) } let (ii, jj) = (i - 1, j) // up if check(ii, jj) and not vis.at(ii * m + jj) and not hfence.at(i * m + j) { vis.at(ii * m + jj) = true stack.push((ii, jj)) } let (ii, jj) = (i, j + 1) // right if check(ii, jj) and not vis.at(ii * m + jj) and not vfence.at(i * m + jj) { vis.at(ii * m + jj) = true stack.push((ii, jj)) } let (ii, jj) = (i, j - 1) // left if check(ii, jj) and not vis.at(ii * m + jj) and not vfence.at(i * m + j) { vis.at(ii * m + jj) = true stack.push((ii, jj)) } } return points } #let pavemat( eq, pave: (), stroke: (dash: "dashed", thickness: 0.5pt), fills: (:), dir-chars: (:), delim: auto, block: auto, display-style: true, debug: false, ) = { // direction character definition let dirs = (up: "W", down: "S", left: "A", right: "D") + dir-chars // get the matrix // @typstyle off let ma = if "body" in eq.fields() { eq.body } else { eq } // pavement if type(pave) != array { pave = (pave,) } // number of rows and columns let (n, m) = (ma.rows.len(), ma.rows.at(0).len()) let hfence = (false,) * ((n + 1) * m) let vfence = (false,) * (n * (m + 1)) let dashes = () // parse pave array for item in pave { if type(item) == str { item = (path: item) } let path = item.path.replace("'", "\"") let from = item.at("from", default: "top-left") // the start position let (i, j) = if from == "top-left" { (0, 0) } else if from == "top-right" { (0, m) } else if from == "bottom-left" { (n, 0) } else if from == "bottom-right" { (n, m) } else if type(from) == "array" and from.len() == 2 { from } else { panic(`expect one of "top-left", "top-right", "bottom-left", "bottom-right" or tuple (x, y)`.text) } let stroke-stack = (item.at("stroke", default: stroke),) let k = 0 while k < path.len() { let c = path.at(k) // control character if c == "(" { let p = path.slice(k).position(")") + k let new-stroke = stroke-stack.last() + eval(path.slice(k, p + 1)) stroke-stack.push(new-stroke) k = p + 1 continue } if c == "[" { k += 1 continue } else if c == "]" { stroke-stack.pop() k += 1 continue } // move one step let dd = upper(c) let ii = if dd == dirs.up { i - 1 } else if dd == dirs.down { i + 1 } else { i } let jj = if dd == dirs.left { j - 1 } else if dd == dirs.right { j + 1 } else { j } // add stroke line if the direction character is upper let cur-stroke = stroke-stack.last() // debug line if debug != false { if c != upper(c) { c = upper(c) cur-stroke = if debug == true { gray + 0.5pt } else { debug } } } if c == dirs.up { dashes.push(grid.vline(x: j, start: ii, end: i, stroke: cur-stroke)) vfence.at(ii * m + j) = true } else if c == dirs.left { dashes.push(grid.hline(y: i, start: jj, end: j, stroke: cur-stroke)) hfence.at(i * m + jj) = true } else if c == dirs.down { dashes.push(grid.vline(x: j, start: i, end: ii, stroke: cur-stroke)) vfence.at(i * m + j) = true } else if c == dirs.right { dashes.push(grid.hline(y: i, start: j, end: jj, stroke: cur-stroke)) hfence.at(i * m + j) = true } (i, j) = (ii, jj) k += 1 } } let cell-fills = (none,) * (n * m) if type(fills) != dictionary { fills = ("": fills) } // make cells filled for (pos, fill) in fills { // fill all if pos == "" { cell-fills = (fill,) * (n * m) continue } let exact = false if pos.starts-with("[") and pos.ends-with("]") { exact = true pos = pos.slice(1, -1) } let (i, j) = pos.split("-") // @typstyle off i = if i == "top" { 0 } else if i == "bottom" { n - 1 } else { int(i) } // @typstyle off j = if j == "left" { 0 } else if j == "right" { m - 1 } else { int(j) } let points = if exact { ((i, j),) } else { _get-fills-from(ma.rows, i, j, hfence: hfence, vfence: vfence) } for (i, j) in points { cell-fills.at(i * m + j) = fill } } // grid cells let cells = ma.rows.flatten().zip(cell-fills).map(((c, f)) => grid.cell(math.equation(c), fill: f)) return context { let row-gap = ma.fields().at("row-gap", default: math.mat.row-gap) / 2 let col-gap = ma.fields().at("column-gap", default: math.mat.column-gap) / 2 let mat-grid = grid(columns: m, align: center + horizon, inset: (x: col-gap, y: row-gap), ..cells, ..dashes) let is-block = if block == auto { eq.fields().at("block", default: math.equation.block) } else { block } let delim = if delim == auto { ma.fields().at("delim", default: "(") } else { delim } let ret = mat-grid if delim != none { ret = math.vec(delim: delim, ret) } if display-style { ret = math.display(ret) } return math.equation(ret, block: is-block) } }
https://github.com/touying-typ/touying
https://raw.githubusercontent.com/touying-typ/touying/main/src/magic.typ
typst
MIT License
// --------------------------------------------------------------------- // List, Enum, and Terms // --------------------------------------------------------------------- /// Align the list marker with the baseline of the first line of the list item. /// /// Usage: `#show: align-list-marker-with-baseline` #let align-list-marker-with-baseline(body) = { show list.item: it => { let current-marker = { set text(fill: text.fill) if type(list.marker) == array { list.marker.at(0) } else { list.marker } } let hanging-indent = measure(current-marker).width + .6em + .3pt set terms(hanging-indent: hanging-indent) if type(list.marker) == array { terms.item( current-marker, { // set the value of list.marker in a loop set list(marker: list.marker.slice(1) + (list.marker.at(0),)) it.body }, ) } else { terms.item(current-marker, it.body) } } body } /// Align the enum marker with the baseline of the first line of the enum item. It will only work when the enum item has a number like `1.`. /// /// Usage: `#show: align-enum-marker-with-baseline` #let align-enum-marker-with-baseline(body) = { let counting-symbols = "1aAiI一壹あいアイא가ㄱ*" let consume-regex = regex("[^" + counting-symbols + "]*[" + counting-symbols + "][^" + counting-symbols + "]*") show enum.item: it => { if it.number == none { return it } let new-numbering = if type(enum.numbering) == function or enum.full { numbering.with(enum.numbering, it.number) } else { enum.numbering.trim(consume-regex, at: start, repeat: false) } let current-number = numbering(enum.numbering, it.number) set terms(hanging-indent: 1.2em) terms.item( strong(delta: -strong.delta, numbering(enum.numbering, it.number)), { if new-numbering != "" { set enum(numbering: new-numbering) it.body } else { it.body } }, ) } body } /// Scale the font size of the list items. /// /// Usage: `#show: scale-list-items.with(scale: .75)` /// /// - `scale` (number): The ratio of the font size of the current level to the font size of the upper level. #let scale-list-items( scale: .75, body, ) = { show list.where().or(enum.where().or(terms)): it => { show list.where().or(enum.where().or(terms)): set text(scale * 1em) it } body } /// Make the list, enum, or terms nontight by default. /// /// Usage: `#show list: nontight(list)` #let nontight(lst) = { let fields = lst.fields() fields.remove("children") fields.tight = false return (lst.func())(..fields, ..lst.children) } /// Make the list, enum, and terms nontight by default. /// /// Usage: `#show: nontight-list-enum-and-terms` #let nontight-list-enum-and-terms(body) = { show list.where(tight: true): nontight show enum.where(tight: true): nontight show terms.where(tight: true): nontight body } /// Set the list marker to none for hide function. /// /// Usage: `#show: show-hide-set-list-marker-none` #let show-hide-set-list-marker-none(body) = { show hide: set list(marker: none) body } // --------------------------------------------------------------------- // Bibliography // --------------------------------------------------------------------- #let bibliography-counter = counter("footer-bibliography-counter") #let bibliography-state = state("footer-bibliography-state", ()) #let bibliography-map = state("footer-bibliography-map", (:)) #let bibliography-visited = state("footer-bibliography-visited", ()) /// Record the bibliography items. #let record-bibliography(bibliography) = { show grid: it => { bibliography-state.update( range(it.children.len()).filter(i => calc.rem(i, 2) == 1).map(i => it.children.at(i).body), ) } place(hide(bibliography)) } /// Display the bibliography as footnote. /// /// Usage: `#show: magic.bibliography-as-footnote.with(bibliography(title: none, "ref.bib"))` /// /// - numbering (string): The numbering format of the bibliography in the footnote. /// /// - record (boolean): Record the bibliography items or not. If you set it to false, you must call `#record-bibliography(bibliography)` by yourself. /// /// - bibliography (bibliography): The bibliography argument. You should use the `bibliography` function to define the bibliography like `bibliography("ref.bib")`. #let bibliography-as-footnote(numbering: "[1]", record: true, bibliography, body) = { show cite: it => context { if it.key not in bibliography-visited.get() { box({ place(hide(it)) context { let bibitem = bibliography-state.final().at(bibliography-counter.get().at(0)) footnote(numbering: numbering, bibitem) bibliography-map.update(map => { map.insert(str(it.key), bibitem) map }) } bibliography-counter.step() bibliography-visited.update(visited => visited + (it.key,)) }) } else { footnote(numbering: numbering, context bibliography-map.final().at(str(it.key))) } } // Record the bibliography items. if record { record-bibliography(bibliography) } body } /// Display the bibliography. /// /// You can avoid `multiple bibliographies are not yet supported` error by using this function. /// /// Usage: `#magic.bibliography()` #let bibliography(title: auto) = { context { let title = title let bibitems = bibliography-state.final() if title == auto { if text.lang == "zh" { title = "参考文献" } else { title = "Bibliography" } } if title != none { heading(title) v(.45em) } grid( columns: (auto, 1fr), column-gutter: .7em, row-gutter: 1.2em, ..range(bibitems.len()).map(i => (numbering("[1]", i + 1), bibitems.at(i))).flatten(), ) } }
https://github.com/sitandr/conchord
https://raw.githubusercontent.com/sitandr/conchord/main/tabs/tabs.typ
typst
MIT License
#import "@preview/cetz:0.2.0": canvas, draw #import "./gen.typ": gen #let new( tabs, preamble: none, extra: none, eval-scope: (:), scale-length: 0.3cm, s-num: 6, one-beat-length: 8, line-spacing: 2, enable-scale: true, colors: (:), autoscale-max: 3.0, autoscale-min: 0.9, debug-render: none, debug-numbers: false, ) = { let content_type = content let tabs = gen(tabs, s-num: s-num) let colors = (bars: gray, lines: gray, connects: luma(50%)) + colors layout( size => { let width = size.width / scale-length * 0.95 let calculate-alpha(draft) = { let alpha = if draft.var != 0 { (width - draft.const) / draft.var } else { 1 } if alpha > autoscale-max or alpha < autoscale-min { 1 } else { alpha } } canvas( length: scale-length, { import draw: * import "./drawing.typ": * draw-bar = draw-bar.with(s-num, scale-length, colors) draw-lines = draw-lines.with(s-num, colors) draw-column = draw-column.with(s-num, colors) draw-slur = draw-slur.with(colors) draw-slide = draw-slide.with(colors) scale-fret-numbers = scale-fret-numbers.with(scale-length, one-beat-length, colors) draw-bend = draw-bend.with(colors) draw-vibrato = draw-vibrato.with(colors) if preamble != none { preamble } let x = 0.0 let y = 0 let queque = () queque.push(draw-bar(0, 0)) let last-string-x = (-1.5,) * 6 let last-tab-x = (0,) * 6 let last-sign = "\\" let bar-index = 0 let draft = ( enable: true, var: 0, const: 0.0, alpha: 1.0, queque-line-start: 1, bar-start: 1, note-start: 0, ) // for debug purposes // let ftabs = tabs.map(arr => arr.map(i => {if type(i) != str {"n"} else {i}}).join()) let counter-lim = 0 let debug-render = debug-render let tabs = tabs while bar-index < tabs.len() { let bar = tabs.at(bar-index) bar-index += 1 if debug-render != none and counter-lim > debug-render { break } if bar.len() > 0 { if (last-sign == "\\") { if bar.at(0) != "||" { x += 1.; draft.const += 1 } else { x -= 0.5; draft.const -= 0.5 } } } let note-index = 0 while note-index < bar.len() { let n = bar.at(note-index) note-index += 1 if debug-numbers { queque.push(content((x, -y + 1), { set text(size: 0.3em) note-index })) } if debug-render != none { counter-lim += 1 if counter-lim > debug-render { break } } assert( calc.abs(x - (draft.const + draft.var)) < 0.001, message: "Broken sync between drafting variables and x: " + str(x) + " " + str(draft.const) + " " + str(draft.var) + " " + repr(n), ) // have to make a break if x > width + 0.51 and (not draft.enable or not enable-scale) { // reset everything to draft to the last bar // calculate-alpha(draft) > 1 if bar-index - draft.bar-start >= 2 and tabs.at(bar-index, default: none) != ("\\",) { tabs.insert(bar-index - 1, ("\\",)) // jumping into bar end last-sign = "\\" draft = ( enable: true, var: 0, bar-start: draft.bar-start, queque-line-start: draft.queque-line-start, alpha: 1.0, note-start: draft.note-start, ) queque = queque.slice(0, draft.queque-line-start) if draft.note-start == float("inf") { draft.const = -0.5 x = -0.5 } else { draft.const = 1.0 x = 1.0 } bar-index = draft.bar-start bar = tabs.at(bar-index) note-index = draft.note-start continue } queque.push({ draw-lines(y, width - 0.5) draw-bar(width - 0.5, y) last-string-x = (-1.5,) * 6 x = 1.0 y += s-num + line-spacing draw-bar(0.0, y) // can remove one note // to move it to the next line if note-index > 1 { let _ = queque.pop() if debug-numbers { let _ = queque.pop() } note-index -= 1 } }) last-sign = "\\" note-index -= 1 draft = ( enable: true, var: 0, const: 1.0, alpha: 1.0, queque-line-start: queque.len(), bar-start: bar-index, note-start: note-index, ) continue } if n == "\\" { if last-sign == "||" { x -= 0.3 draft.const -= 0.3 } else if last-sign == "|" { x -= 0.5 draft.const -= 0.5 } else { x += 0.5 queque.push({ draw-bar(x, y) }) x += 0.5 draft.const += 1.0 } if draft.bar-start != 1 and bar-index == draft.bar-start + 1 and tabs.at(draft.bar-start - 1).len() == 1 { // remove empty line { let _ = queque.pop() let _ = queque.pop() if debug-numbers { let _ = queque.pop() } } } else { if bar-index > 0 { if draft.enable and enable-scale { last-sign = "\\" let alpha = calculate-alpha(draft) draft = ( enable: false, var: 0, bar-start: draft.bar-start, queque-line-start: draft.queque-line-start, alpha: alpha, note-start: draft.note-start, ) queque = queque.slice(0, draft.queque-line-start) bar-index = draft.bar-start bar = tabs.at(bar-index - 1) note-index = draft.note-start // jumping into bar end if note-index == float("inf") { draft.const = -0.5 x = -0.5 } else { draft.const = 1.0 x = 1.0 } continue } } queque.push({ draw-lines(y, x - 0.5) }) } queque.push({ last-string-x = (-1.5,) * 6 y += s-num + line-spacing draw-bar(0.0, y) x = -0.5 last-sign = "\\" }) draft = ( enable: true, var: 0, const: -0.5, alpha: 1.0, queque-line-start: queque.len(), bar-start: bar-index, note-start: float("inf"), ) continue } if n == "<" { draft.const -= 0.5 x -= 0.5 continue } if n == ">" { draft.const += 0.5 x += 0.5 continue } if n == ":" { queque.push({ if last-sign == none { x -= 1; draft.const -= 1 } draw-column(x, y) last-sign = ":" x += 0.5 draft.const += 0.5 }) continue } if n == "||" { queque.push({ x += 0.5 draw-bar(x, y, width: 4) x += 0.5 draft.const += 1.0 last-sign = "||" }) continue } if n == "|" { queque.push({ if last-sign == "|" { x -= 0.5 draft.const -= 0.5 } draw-bar(x, y) x += 0.5 draft.const += 0.5 last-sign = "|" }) continue } if type(n) == array and n.at(0) == "##" { assert(n.at(2) != none, message: "Empty content") let result = eval(n.at(2), scope: eval-scope) assert(type(result) == content_type or type(result) == str, message: "Eval result should be content or str, found " + type(result) + ": " + n.at(2)) queque.push({ content( (x, -y + 1), result, anchor: if n.at(1).len() > 0 { n.at(1) } else { none }, ) }) continue } if n.len() == 1 { panic(n) } let frets = n.notes let dx = one-beat-length * calc.pow(2, -n.duration) * draft.alpha draft.var += dx // pause if frets.len() == 0 { x += dx continue } for fret in frets { let n-y = fret.string queque.push({ if fret.connect == "^" { draw-slur(x, y, n-y, last-string-x) } else if fret.connect == "`" { draw-slide(x, y, n-y, last-string-x, fret, last-tab-x) } content( (x, - (y + n-y - 1)), scale-fret-numbers(fret.fret, n.duration, draft.alpha), anchor: "west", ) if fret.bend != none { draw-bend(x, y, n-y, dx, fret.bend-return, fret.bend) } if fret.vib { draw-vibrato(x, y, n-y, dx) } }) last-string-x.at(n-y - 1) = x last-tab-x.at(n-y - 1) = fret.fret last-sign = "n" } x += dx } x += 0.5 draft.const += 0.5 } let _ = queque.pop() for i in queque { i } extra }, ) }, ) }
https://github.com/sa-concept-refactoring/doc
https://raw.githubusercontent.com/sa-concept-refactoring/doc/main/main.typ
typst
#import "@preview/tablex:0.0.4": tablex, colspanx, rowspanx, cellx #import "progress-bar.typ": printProgressBar #import "title-page.typ": luschtig #let version_with_code = true #show raw: it => { let backgroundColor = luma(0xF0) if (it.block) { block( fill: backgroundColor, inset: 8pt, radius: 5pt, it, ) } else { box( fill: backgroundColor, outset: 2pt, radius: 2pt, it, ) } } #show heading: it => { if (it.level == 1) { pagebreak(weak: true) } it } #show ref: it => { if it.element != none and it.element.func() == heading { let number = numbering(it.element.numbering, ..counter(heading).at(it.element.location())).trim(".", at: end) link(it.target, emph(it.element.supplement + " " + number + ", " + it.element.body)) } else { it } } #set terms(hanging-indent: 0pt) #set text(font: ("Comic Sans MS")) if luschtig #include "title-page.typ" #pagebreak() #pagebreak() #set page(numbering: "i") if not luschtig #set page( footer: [ #locate(loc => { let pageCounter = counter(page) let total = pageCounter.final(loc).first() let current = pageCounter.at(loc).first() printProgressBar(current / total, label: {str(current) + "/" + str(total)}) }) ], ) if luschtig #counter(page).update(1) #show figure: set block(below: 2em) #show par: set block(below: 2em) #include "chapters/abstract.typ" #include "chapters/managementSummary.typ" #outline( title: "Table of Contents", indent: auto, target: heading.where(level: 1).or(heading.where(level: 2)) ) #set page(numbering: "1 / 1") if not luschtig #counter(page).update(1) #set heading(numbering: "1.") #include "chapters/introduction.typ" #include "chapters/analysis.typ" #include "chapters/refactoringIdeas.typ" #include "chapters/inlineConceptRequirement.typ" #include "chapters/abbreviateFunctionTemplate.typ" #include "chapters/developmentProcess.typ" #include "chapters/projectManagement.typ" #include "chapters/conclusion.typ" = Disclaimer Parts of this paper were rephrased using GPT-3.5 @chat_gpt_3.5 and GPT-4 @chat_gpt_4. This paper was reviewed by the advisor and corrections were applied according to the comments made. For spell checking and translations DeepL @deepl, LanguageTool @language_tool, grammarly @grammarly and QuillBot @quill_bot was used. #include "chapters/glossary.typ" = Bibliography #bibliography( title: none, "bibliography.bib", ) = Table of Figures #outline( title: none, target: figure.where(kind: image), ) = Table of Tables #outline( title: none, target: figure.where(kind: table), ) = List of Listings #outline( title: none, target: figure.where(kind: raw), ) = Appendix In this last section the personal reports from both authors can be found in which they reflect on the project (@report_jeremy and @report_vina). #if version_with_code {[ It also contains the final version of the code written during this project (@source_code), which includes the implemented refactorings and the test project. ]} The assignment given can be found in @assignment. #pagebreak() == Personal Report — <NAME> <report_jeremy> #include "chapters/personalReportJeremy.typ" #pagebreak() == Personal Report — <NAME> <report_vina> #include "chapters/personalReportVina.typ" #pagebreak() == Assignment <assignment> #let attachment_path = "attachments/" #image(attachment_path + "assignment/0.png") #image(attachment_path + "assignment/1.png") #image(attachment_path + "assignment/2.png") #if version_with_code {[ #pagebreak() == Source Code <source_code> #outline( title: none, target: selector(heading).after(label("source_code_outline")) ) <source_code_outline> #let showSourceFile(headingPrefix, filePath) = { let fileName = filePath.split("/").last() heading(headingPrefix + " — " + fileName, level: 3, numbering: none) set text(size: 0.75em) raw( read(filePath), lang: "cpp", block: true, ) } #pagebreak() #set page(flipped: true, columns: 2) #let root = "source-code-first-refactoring/clang-tools-extra/clangd/" #showSourceFile("Inline Concept Requirement Refactoring", root + "refactor/tweaks/InlineConceptRequirement.cpp") #showSourceFile("Inline Concept Requirement Refactoring", root + "unittests/tweaks/InlineConceptRequirementTests.cpp") #let root = "source-code-second-refactoring/clang-tools-extra/clangd/" #showSourceFile("Abbreviate Function Template Refactoring", root + "refactor/tweaks/AbbreviateFunctionTemplate.cpp") #showSourceFile("Abbreviate Function Template Refactoring", root + "unittests/tweaks/AbbreviateFunctionTemplateTests.cpp") #let root = "source-code-test-project/" #showSourceFile("Test Project", root + "InlineConceptRequirement.cxx") #showSourceFile("Test Project", root + "AbbreviateFunctionTemplate.cxx") ]}
https://github.com/Mc-Zen/tidy
https://raw.githubusercontent.com/Mc-Zen/tidy/main/tests/test_parse.typ
typst
MIT License
#import "/src/tidy.typ": * #import "/src/tidy-parse.typ": * #import "/src/utilities.typ": * #let eval-string(string) = eval-docstring(string, (scope: (:))) #{ let code = ``` /// - alpha (str): /// - beta (length): // / - ..children (any): #let z(alpha, beta: 2pt, ..children) = {} ``` let k = parse-module(code.text) } // Test reference-matcher #{ let matches = " @@func".matches(reference-matcher) assert.eq(matches.len(), 1) assert.eq(matches.at(0).captures, ("func",)) let matches = " @@func()".matches(reference-matcher) assert.eq(matches.len(), 1) assert.eq(matches.at(0).captures, ("func()",)) let matches = " ()@@@@my-func12-bliblablub @@ @@a".matches(reference-matcher) assert.eq(matches.len(), 2) assert.eq(matches.at(0).captures, ("my-func12-bliblablub",)) assert.eq(matches.at(1).captures, ("a",)) } // Test argument-documentation-matcher #{ let matches = " \t\n\t /// - my-arg1 (string, content): desc".matches(argument-documentation-matcher) assert.eq(matches.len(), 1) assert.eq(matches.at(0).captures, ("my-arg1","string, content", "desc")) // multiline argument description let matches = "/// - arg (type): desc\n\tasd\n-3$234$".matches(argument-documentation-matcher) assert.eq(matches.len(), 1) assert.eq(matches.at(0).captures, ("arg", "type", "desc")) } // Basic tests #{ let a = ``` /// Func #let a-3_56C() = {} ```.text let result = parse-module(a) assert.eq(result.functions.len(), 1) assert.eq(result.functions.at(0).name, "a-3_56C") assert.eq(eval-string(result.functions.at(0).description), [Func]) assert.eq(result.functions.at(0).return-types, none) } #{ let a = ``` #{ /// Func /// let a() = {} } ```.text let result = parse-module(a) assert.eq(result.functions.len(), 1) assert.eq(result.functions.at(0).name, "a") assert.eq(eval-string(result.functions.at(0).description), [Func]) assert.eq(result.functions.at(0).return-types, none) } // Parameters and defaults #{ let a = ``` /// Func #let a(p1, p2: 2, p3: (), p4: ("entries": ())) = {} ```.text let result = parse-module(a) assert.eq(result.functions.len(), 1) let f0 = result.functions.at(0) assert.eq(f0.name, "a") assert.eq(eval-string(f0.description), [Func]) assert.eq(f0.args.len(), 4) assert.eq(f0.args.p1, (:)) assert.eq(f0.args.p2, (default: "2")) assert.eq(f0.args.p3, (default: "()")) assert.eq(f0.args.p4, (default: "(\"entries\": ())")) assert.eq(f0.return-types, none) } // Parameter and return types #{ let a = ``` /// Func /// - p1 (string): a param $a$ /// - p2 (boolean, function): a param $b$ /// Oh yes /// - p3 (string): /// -> content, integer #let a(p1, p2: 2, p3: (), p4: ("entries": ())) = {} ```.text let result = parse-module(a) assert.eq(result.functions.len(), 1) let f0 = result.functions.at(0) assert.eq(f0.name, "a") assert.eq(eval-string(f0.description), [Func]) assert.eq(f0.args.len(), 4) assert.eq(f0.args.p1.types, ("string",)) assert.eq(eval-string(f0.args.p1.description), [a param $a$]) assert.eq(f0.args.p2.default, "2") assert.eq(eval-string(f0.args.p2.description), [a param $b$ Oh yes]) assert.eq(f0.args.p2.types, ("boolean", "function")) assert.eq(f0.return-types, ("content", "integer")) } // // Ignore args that are not in the argument list // #{ // let a = ``` // /// Func // /// - bar (content): asd // #let a(bar) = {} // ```.text // let result = parse-module(a) // assert.eq(result.functions.len(), 1) // assert.eq(result.functions.at(0).args.len(), 1) // } // Ignore interrupted docstring #{ let a = ``` /// Func // a #let a() ```.text let result = parse-module(a) assert.eq(result.functions.len(), 0) } // Ensure that wide unicode characters don't disturb line calculation for error messages #{ let code = ``` // ⇒⇐ßáà€ /// foo /// >>> 2 == 2 #let f() ``` let result = show-module(parse-module(code.text)) } // Curried functions #{ let code = ``` /// - foo (content): Something. /// - bar (boolean): A boolean. /// -> content #let myfunc(foo, bar: false) = strong(foo) /// My curried function. /// -> content #let curried = myfunc.with(bar: true, 2) ``` let result = parse-module(code.text) let f1 = result.functions.at(0) let f2 = result.functions.at(1) assert.eq(f1.name, "myfunc") assert.eq(f2.parent.name, "myfunc") assert.eq(f2.parent.pos, ("2",)) assert.eq(f2.parent.named, (bar: "true")) assert.eq(f2.args.len(), 1) assert.eq(f2.args.bar, ( default: "true", description: "A boolean.", types: ("boolean",), )) } // module description #{ let code = ``` // License /// This is a module a ``` let result = parse-module(code.text) assert.eq(result.description, "This is a module") }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10570.typ
typst
Apache License 2.0
#let data = ( ("VITHKUQI CAPITAL LETTER A", "Lu", 0), ("VITHKUQI CAPITAL LETTER BBE", "Lu", 0), ("VITHKUQI CAPITAL LETTER BE", "Lu", 0), ("VITHKUQI CAPITAL LETTER CE", "Lu", 0), ("VITHKUQI CAPITAL LETTER CHE", "Lu", 0), ("VITHKUQI CAPITAL LETTER DE", "Lu", 0), ("VITHKUQI CAPITAL LETTER DHE", "Lu", 0), ("VITHKUQI CAPITAL LETTER EI", "Lu", 0), ("VITHKUQI CAPITAL LETTER E", "Lu", 0), ("VITHKUQI CAPITAL LETTER FE", "Lu", 0), ("VITHKUQI CAPITAL LETTER GA", "Lu", 0), (), ("VITHKUQI CAPITAL LETTER HA", "Lu", 0), ("VITHKUQI CAPITAL LETTER HHA", "Lu", 0), ("VITHKUQI CAPITAL LETTER I", "Lu", 0), ("VITHKUQI CAPITAL LETTER IJE", "Lu", 0), ("VITHKUQI CAPITAL LETTER JE", "Lu", 0), ("VITHKUQI CAPITAL LETTER KA", "Lu", 0), ("VITHKUQI CAPITAL LETTER LA", "Lu", 0), ("VITHKUQI CAPITAL LETTER LLA", "Lu", 0), ("VITHKUQI CAPITAL LETTER ME", "Lu", 0), ("VITHKUQI CAPITAL LETTER NE", "Lu", 0), ("VITHKUQI CAPITAL LETTER NJE", "Lu", 0), ("VITHKUQI CAPITAL LETTER O", "Lu", 0), ("VITHKUQI CAPITAL LETTER PE", "Lu", 0), ("VITHKUQI CAPITAL LETTER QA", "Lu", 0), ("VITHKUQI CAPITAL LETTER RE", "Lu", 0), (), ("VITHKUQI CAPITAL LETTER SE", "Lu", 0), ("VITHKUQI CAPITAL LETTER SHE", "Lu", 0), ("VITHKUQI CAPITAL LETTER TE", "Lu", 0), ("VITHKUQI CAPITAL LETTER THE", "Lu", 0), ("VITHKUQI CAPITAL LETTER U", "Lu", 0), ("VITHKUQI CAPITAL LETTER VE", "Lu", 0), ("VITHKUQI CAPITAL LETTER XE", "Lu", 0), (), ("VITHKUQI CAPITAL LETTER Y", "Lu", 0), ("VITHKUQI CAPITAL LETTER ZE", "Lu", 0), (), ("VITHKUQI SMALL LETTER A", "Ll", 0), ("VITHKUQI SMALL LETTER BBE", "Ll", 0), ("VITHKUQI SMALL LETTER BE", "Ll", 0), ("VITHKUQI SMALL LETTER CE", "Ll", 0), ("VITHKUQI SMALL LETTER CHE", "Ll", 0), ("VITHKUQI SMALL LETTER DE", "Ll", 0), ("VITHKUQI SMALL LETTER DHE", "Ll", 0), ("VITHKUQI SMALL LETTER EI", "Ll", 0), ("VITHKUQI SMALL LETTER E", "Ll", 0), ("VITHKUQI SMALL LETTER FE", "Ll", 0), ("VITHKUQI SMALL LETTER GA", "Ll", 0), (), ("VITHKUQI SMALL LETTER HA", "Ll", 0), ("VITHKUQI SMALL LETTER HHA", "Ll", 0), ("VITHKUQI SMALL LETTER I", "Ll", 0), ("VITHKUQI SMALL LETTER IJE", "Ll", 0), ("VITHKUQI SMALL LETTER JE", "Ll", 0), ("VITHKUQI SMALL LETTER KA", "Ll", 0), ("VITHKUQI SMALL LETTER LA", "Ll", 0), ("VITHKUQI SMALL LETTER LLA", "Ll", 0), ("VITHKUQI SMALL LETTER ME", "Ll", 0), ("VITHKUQI SMALL LETTER NE", "Ll", 0), ("VITHKUQI SMALL LETTER NJE", "Ll", 0), ("VITHKUQI SMALL LETTER O", "Ll", 0), ("VITHKUQI SMALL LETTER PE", "Ll", 0), ("VITHKUQI SMALL LETTER QA", "Ll", 0), ("VITHKUQI SMALL LETTER RE", "Ll", 0), (), ("VITHKUQI SMALL LETTER SE", "Ll", 0), ("VITHKUQI SMALL LETTER SHE", "Ll", 0), ("VITHKUQI SMALL LETTER TE", "Ll", 0), ("VITHKUQI SMALL LETTER THE", "Ll", 0), ("VITHKUQI SMALL LETTER U", "Ll", 0), ("VITHKUQI SMALL LETTER VE", "Ll", 0), ("VITHKUQI SMALL LETTER XE", "Ll", 0), (), ("VITHKUQI SMALL LETTER Y", "Ll", 0), ("VITHKUQI SMALL LETTER ZE", "Ll", 0), )
https://github.com/SundaeSwap-finance/sundae-specs
https://raw.githubusercontent.com/SundaeSwap-finance/sundae-specs/main/gummiworm/spec.typ
typst
#import "@preview/unequivocal-ams:0.1.1": ams-article #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge #import "@preview/note-me:0.2.1": note #import "@preview/chronos:0.1.0" #import "@preview/glossarium:0.4.1": * #import "./transaction.typ": * #show link: set text(blue) #show link: underline; #show: make-glossary #set text(font: "PT Serif") #show: ams-article.with( title: [Gummiworm], authors: ( ( name: "<NAME>", organization: "Sundae Labs", email: "<EMAIL>", ), ), abstract: [ Gummiworm is a layer 2 for Cardano being built by Sundae Labs. Cardano optimizes for robust, global, permissionless decentralized consensus with very lower power requirements, with practical settlement times measured in tens of minutes, and total peak throughput (currently) measured in the low 10s of transactions per second. Hydra, on the other hand, optimizes for high throughput and instant settlement transactions among a small group of unanimously consenting parties, with a robust and trustless conflict resolution mechanism. Gummiworm is a protocol that tries to recognize that there are many different dimensions on which decentralization can matter, and separating those can provide a robust, practical, *and* decentralized Layer 2 for Cardano. Additionally, it is built as a low-divergence fork of the Hydra node. This lets it reuse and benefit from the continued development of the Hydra protocol, and avoids "throwing the baby out with the bath water" in a need to reinvent everything from scratch. ] ) #outline() #pagebreak() = Overview This specification will provide a high fidelity specification for the major concerns of the Gummiworm protocol. #note[ This document is very much a work in progress, and several sections have been left blank pending further details. Additionally, many details may change or be made more precise in response to reviewer feedback. ] At 50,000 feet, the protocol can be described by the diagram below: #scale(x: 70%, y:70%, origin: top+left)[ #diagram( let actor = blue.lighten(70%), let contract = green.lighten(70%), let software = red.lighten(70%), // debug: 1, //spacing: (18mm, 10mm), node-stroke: luma(80%), node((1,-1), [*User*], corner-radius: 5pt, fill: actor, name: <user>), node((0,0), [*Gummiworm \ Deposit*], corner-radius: 5pt, fill: contract, name: <deposit>), node((2,0), [*Gummiworm \ Treasury*], corner-radius: 5pt, fill: contract, name: <treasury>), edge(<user>, <deposit>, "->", `Deposit`), edge(<deposit>, <treasury>, "->", `Aggregate`), edge(<treasury>, <user>, "->", `Withdraw`), node((1.5,3), name: <gummiworm_cluster>), node( (rel: (0,-1), to: <gummiworm_cluster>), [*Gummiworm \ Node*], fill: software, name: <gummiworm_node_1> ), edge(<gummiworm_node_1>, <gummiworm_node_2>, "<|-|>", bend: -30deg), node( (rel: (-0.5,0), to: <gummiworm_cluster>), [*Gummiworm \ Node*], fill: software, name: <gummiworm_node_2> ), edge(<gummiworm_node_2>, <gummiworm_node_3>, "<|-|>", bend: -60deg), node( (rel: (0.5,0), to: <gummiworm_cluster>), [*Gummiworm \ Node*], fill: software, name: <gummiworm_node_3> ), edge(<gummiworm_node_3>, <gummiworm_node_1>, "<|-|>", bend: -30deg), node( align(bottom)[Gummiworm Head], enclose: ( <gummiworm_node_1>, <gummiworm_node_2>, <gummiworm_node_3>, (rel: (0,1.5), to: <gummiworm_cluster>) ), name: <gummiworm_head> ), node((1.5,1), [*Cardano \ Node*], fill: software, name: <cardano_node>), edge(<gummiworm_head>, <cardano_node>, "<|-|>"), edge(<cardano_node>, <deposit>, "<|-", bend: -20deg, label-side: left, `Observe`), node((3,1.25), [*Archival Storage*], fill: software, name: <storage>), edge((rel: (0, 0), to: <gummiworm_head>), <storage>, "-|>", label-pos: 0.65, `Publish`), node((4.5, 0), name: <validators_center>), node( (rel: (0, 0), to: <validators_center>), [*Gummiworm Validator*], fill: software, name: <validator_1> ), node( (rel: (0, 0.3), to: <validators_center>), [*Gummiworm Validator*], fill: software, name: <validator_2> ), node( (rel: (0, 0.6), to: <validators_center>), [*Gummiworm Validator*], fill: software, name: <validator_3> ), node( align(top)[Gummiworm Validators], enclose: ( (rel: (0, -0.5), to: <validators_center>), <validator_1>, <validator_2>, <validator_3>, ), name: <validator_set> ), node( (rel: (0, 1.1), to: <validators_center>), [*Independent Validator*], fill: software, name: <independent_validator_1> ), node( (rel: (0, 1.4), to: <validators_center>), [*Independent Validator*], fill: software, name: <independent_validator_2> ), node( align(bottom)[Custody Module], inset: 10pt, enclose: ( (rel: (0, -0.5), to: <validators_center>), <validator_1>, <independent_validator_1>, <independent_validator_2>, (rel: (0, 2), to: <validators_center>), ), name: <custody> ), edge(<storage>, <validator_set>, "-|>"), edge(<storage>, <validator_set>, "-|>"), edge(<storage>, <independent_validator_1>, "-|>"), edge(<storage>, <independent_validator_2>, "-|>"), edge(<user>, <validator_set>, "-|>", bend: 10deg, label-pos: 0.7, label-sep: 1em, `Discover, Contest`), edge(<validator_set>, <treasury>, "-|>", `Release`), edge(<gummiworm_head>, <treasury>, "-|>", label-side: right, `Register`), node((0, 3.25), [*User*], fill: actor, corner-radius: 5pt, name: <user_2>), edge(<user_2>, <gummiworm_head>, "-|>", `Submit`, shift: 3.5pt), edge(<gummiworm_head>, <user_2>, "-|>", label-side: left, `Confirm`, shift: 3.5pt) )] A set of modified Hydra nodes run as a cluster, known as a Gummiworm Head, register by depositing collateral into the Gummiworm Treasury. Rather than using the native Hydra capabilities for committing funds, users deposit funds through a time-lock contract, which is then aggregated into the treasury. As the Gummiworm Head observes these deposits, it fabricates these tokens in its ledger. Users submit transactions to the Gummiworm Head, which returns a signed receipt for the transaction. At regular intervals, the Gummiworm Head publishes its transactions to an archival storage mechanism. A set of nodes, known as Gummiworm Validators, download these archives and independently validate them. Exactly how this set is selected is configurable, and allows for a number of different deployments based on the real world requirements of the work. If a Gummiworm Head is found to have accepted an invalid transaction, or if a user presents a transaction receipt that doesn't appear in the transaction stream in a reasonable time, the Gummiworm Validators can seize some or all of the collateral of a Gummiworm Head to pay the impacted users for the inconvenience. To ensure a Gummiworm Head is in good standing, users monitor messages published by the Gummiworm validator set before making a deposit or a transaction. The Gummiworm Validators can also apply back-pressure if the Gummiworm Head is too far ahead of the validators. #note[ This document describes Gummiworm v0, an initial version of the protocol that makes certain compromises. In particular, it uses a simplified custody module that accepts more centralization than future versions will. This will allow us to build and harden a production deployment of the protocol, and find real world clients that can benefit from the increased throughput and tolerate the tradeoffs. ] #pagebreak() = Motivations Cardano is optimized for permissionless and decentralized consensus. For a few hundred dollars a month in infrastructure, anyone can run a node and potentially participate in contributing blocks to the network. So long as 51% of the network is honest, by weight of delegation, the network remains secure against a number of adversarial attacks. It pays for this with a lower throughput and slower finality than chains that make different tradeoffs. It relies on relatively "quiet" periods between blocks, to minimize the chance of network forks. Conversely, Hydra is an isomorphic state channel protocol. A small group of people lock their funds into a smart contract, which can be released by presenting a signed snapshot of the UTxO state. Off-chain, they can use a relatively simple unanimous consensus to share transactions, and then sign new snapshots. If there is a dispute, they can present one of these snapshots to the layer 1 contract. After a short timeout (in which another participant can present a newer snapshot), the contract releases and fans out the funds according to that final snapshot. This achieves throughputs in the hundreds of transactions per second, with instant finality. However, its security relies on every participant signing each snapshot. While this holds, the protocol enjoys a unanimous consent security, where a single honest party disallows a falsified transaction. However, as soon as there are participants that do not sign the transaction (such as transactions spending funds held at third party addresses), this security property becomes much more dangerous. Hydra cannot be used for a decentralized exchange, for example, because funds belonging to potentially tens of thousands of users would be at the mercy of a relatively small number of head participants. They could, for example, sign a snapshot that asserted that all funds had been paid directly to them, and then unlock the layer 1. The key insight behind Gummiworm is recognizing that there are multiple dimensions on which you can measure the decentralization. In particular: - Execution: The ability to select *which* transactions get included, the ability to censor transactions, the ability to reorder transactions, and the ability to validate (or not validate) transactions. - Custody: The long-term ability to *spend* funds and extract real world value from them. Gummiworm is a protocol that recognizes that, for the sake of throughput, users are often willing to compromise on the first dimension, but are much less willing to compromise on the second. It leverages the Hydra peer to peer consensus for execution, meaning a small set of participants decide which transactions to include, what order to serialize them in, and assert to their short-term validity. However, they have *no* direct custody of user funds. Instead, they must demonstrate to a separate custody module that there exists a sequence of valid transactions that leads to the requested withdrawals. This allows the Gummiworm Head to race ahead in bursts, with the tradeoff that withdrawals may take longer while the custody module catches up. = Actors In this section, we enumerate the various actors, software components, and smart contracts involved, and the actions they can perform. == Human Actors + *User* - A standard, unprivileged user that wishes to use various dApps on the Gummiworm Protocol. - Honest Actions + Discover - Retrieve a list of Gummiworm Heads and their status + Deposit - Initiate a deposit into a specific Gummiworm head + Cancel Deposit - Cancel a deposit that never got claimed + Submit Transaction - Submit a valid transaction to a Gummiworm Head in good stead + Withdraw - Initiate a withdrawal from a Gummiworm Head + Hard Withdraw - Request a withdrawal directly from the validators, in cases where the Gummiworm Head ignores the request + Contest - Present a transaction receipt to the validators that never made it into the transaction stream - Malicious Actions + Submit Invalid Transaction - Attempt to submit a malformed transaction to the Gummiworm Head + False Contestation - Present a fake transaction receipt to the validator set + Supurfluous Hard Withdrawal - Request a hard withdrawal, even when the Gummiworm Head is behaving honestly + *Gummiworm Head Operator* - Someone who, along with a small cohort of other operators, runs a Gummiworm Head and receives transactions from users. - Honest Actions + Open Head - Open a new Gummiworm Head + Increase Collateral - Add new collateral into the head + Withdraw Collateral - Withdraw some collateral from the head + Close Head - Close a Gummiworm Head completely + Receive Transaction - Receive a transaction from a user, validate it, and return a receipt + Publish Archive - Publish an archive containing many transactions to shared storage - Malicious Actions + Censor Transaction - Refuse to respond to a user submitting transactions + Refuse Receipt - Refuse to return a signed transaction receipt to a user, but include the transaction + Invalid Receipt - Return an invalid receipt for a transaction + Drop Transaction - Don't include a transaction in the archive for which we've issued a receipt + Ignore Deposit - Don't honor a deposit requested by a user + Publish Invalid Archive - Publish an archive that is invalid, or contains an invalid transaction + Stop Publishing Archives - Fail to publish the next archive in a timely manner + Split History - Maintain a separate history between the validators and the users + *Gummiworm Validator* - One of many participants who download and validate the archives published by the Gummiworm Heads, and control custody of the Gummiworm Treasury. - Honest Actions + Aggregate Deposits - Aggregate many deposited tokens into the Gummiworm Treasury + Disperse Withdrawals - Disperse requested withdrawals to the users who requested them + Respond to Contestation - Check a users contest, and if valid, disburse a small amount of collateral + Report Status - Report which heads are in good status, and apply backpressure on transactions if needed - Malicious Actions + Steal Treasury - Steal funds from the treasury + Go Offline - Stop honoring Withdrawals or Contestation + Hide Gummiworm Heads - Hide open gummiworm heads to deny them users + False Backpressure - Report false backpressure, causing users to face delays + Skip Validation - Rubber-stamp transaction archives without validating them == Software Components + *Gummiworm Node* - Receive and Validate Transactions, issue confirmation receipts, monitor for deposit requests, and publish transaction archives. Run by the Gummiworm Head Operator. + *Gummiworm Validator* - Download and Validate transaction archives, maintain consensus with other Gummiworm Validators, sign transactions from the treasury. + *Wallet* - Provide an interface for users to query Gummiworm Heads and submit transactions. + *DApp (Decentralized Application)* - Build and submit transactions, query Gummiworm Head state through the wallet, Query Gummiworm Head status from the validators, honor backpressure. + *Gummiworm DApp* - One such DApp that focuses on deposits, withdrawals, and status reporting. == Smart Contracts - *Gummiworm Deposit* - Hold a pending deposit. Allow a user to cancel the deposit after a timeout. Allow the Gummiworm Validators to aggregate it into the treasury once its been confirmed in the head. - *Gummiworm Treasury* - Hold the aggregated deposits, and the Gummiworm Head collateral. Allow spending with a signature from the Gummiworm Validators. /* = Initialization == Initializing the Treasury == Opening a new Gummiworm Head == Discovering Gummiworm Heads */ #pagebreak() = User Flows == Deposits A user can initiate a deposit by paying funds into the `Gummiworm Deposit` contract. To do so, the user first looks up a Gummiworm Protocol UTxO holding a Gummiworm Protocol Instance tracking token. In the datum of this UTxO will be an API endpoint to contact the current Gummiworm Validator Cohort. The user then queries the Gummiworm Validator Cohort for the current status of the Gummiworm Head they wish to deposit to. This will return whether the head is in good standing, the current collateral multiple, and the current lag time from processing this head. This payload will contain a signature from the current cohort. The user should check the following conditions before initiating a deposit: - The Head is in good standing; A head that has been penalized should not receive additional deposits. - The Head has a sufficient collateral multiple; The amount of funds that are safe to deposit into the head is a function of the collateral they have locked. - The Lag time is a comfortable threshold for the user. A lag time too large can indicate that there is trouble with a head, and should be a source of backpressure. #note[ Some of these conditions may be enforced by the deposit_valid minting script. Exactly how to determine these thresholds is still an open question, and one we'd love feedback on. ] #pagebreak() The user then builds and submits a transaction to the Cardano L1 containing the funds they wish to deposit, and signalling to the Gummiworm Head Operator that a deposit should be performed within the deposit time `T`. The user mints a `deposit_valid` token to ensure that the expiration times are set correctly, with reference to the Gummiworm Head's commitment time. The minting policy also checks that the redeemer contains `T'` with a signature from the current cohort. #transaction( "Deposit", inputs: ( ( name: "User funds", address: "User Address", value: ( ada: "X + Z", token1: "Y", ), ), ( name: "Gummiworm Head", reference: true, datum: ( id: [Head ID], deposit_time: [T], deposit_fee: [Z], api: ( [DNS], [IP] ) ) ), ( name: "Gummiworm Protocol", reference: true, datum: ( current_cohort: [FROST key], ), ) ), outputs: ( ( name: "Pending Deposit", address: "Gummiworm Deposit", value: ( ada: "X + Z", token1: "Y", deposit_valid: 1, ), datum: ( gummiworm_head_id: [Head ID], expiration: [Now + T + T'], deposit_fee: [Z], destination: ( address: [Addr], datum: [SomeDatum] ) ), ), ), ) #pagebreak() If no action is performed, the user can reclaim these funds after `Now + T + T'` expiration time, where `T` is the Gummiworm Head's commitment time, and `T'` is a protocol parameter to capture the current Gummiworm Head's lag time. #transaction( "Cancel Deposit", inputs: ( ( name: "Deposit", address: "GW Deposit", value: ( ada: "X + Z", token1: "Y", deposit_valid: 1, ), datum: ( gummiworm_head_id: [Head ID], expiration: [Now + T + T'], deposit_fee: [Z], destination: ( address: [Addr], datum: [SomeDatum] ) ), ), ), outputs: ( ( name: "User funds", address: "User Address", value: ( ada: "X + Z", token1: "Y", ), ), ), ) #pagebreak() The Gummiworm Head determines its own policy for finality. After seeing the deposit transaction, depending on the quantity of funds and its own confidence in the transaction finality, it can mint the appropriate tokens on the L2, paid to the `Destination` from the deposit datum. The metadatum of this transaction signals the Layer 1 UTxO it is honoring. One transaction can honor many deposits as separate UTxOs. #transaction( "Honor Deposit", layer: "gummiworm", inputs: ( ( name: "Gummiworm Head", ), ), outputs: ( ( name: "Deposited Funds", address: "Addr", datum: ( "SomeDatum": "", ), value: ( ada: "X", token1: "Y", ), ), ), notes: [ Deposits: [ TxHash\#Idx ] ] ) #note[ A future version of the protocol may extend the Gummiworm ledger model to add a `fabricate` and `destroy` field to the transaction body. This would allow a permissioned set of nodes to create or destroy tokens without running the minting policy, to honor deposits and withdrawals without creating a "wrapped" token. ] #pagebreak() Once this transaction is confirmed, and the transaction appears in the Gummiworm Archive (paid to the correct destination), the Gummiworm Validators can aggregate a batch of deposits directly into the Gummiworm Treasury, to prevent the user from cancelling the deposit after extracting value from those tokens within the Gummiworm Head. #transaction( "Aggregate Deposit", inputs: ( ( name: "Deposit", address: "GW Deposit", value: ( ada: "X + Z", token1: "Y", deposit_valid: 1, ), datum: ( "...": "", expiration: [Now + T + T'], deposit_fee: [Z], ), ), ( name: "Deposit", address: "GW Deposit", value: ( ada: "A + B", deposit_valid: 1, ), datum: ( "...": "", expiration: [Now + T + T'], deposit_fee: [Z], ), ), ( name: "GW Treasury", value: ( ada: "M", token1: "N", ), datum: ( "...": "", ), ), ), outputs: ( ( name: "GW Treasury", value: ( ada: "M + X + Z + A + B", token1: "N + Y", ), ), ), ) #pagebreak() == Transactions This section outlines the lifecycle of a transaction within the Gummiworm protocol. === Submission After initiating a deposit, a user can begin interacting with the Gummiworm Head. There will be a UTxO for each Gummiworm Head, containing a `gummiworm_head` authenticating token. The datum on this UTxO will contain one or more API endpoints that can be used to interact with the Gummiworm Head. #note[ We would like to standardize the query protocol for these formats across all layer two projects. We are closely watching proposals like #link("https://github.com/cardano-foundation/CIPs/tree/master/CPS-0012", "CPS-0012") to see if a proposal emerges. ] #note[ We would like querying the layer 2 to be integrated with the wallets as well, as a CIP-30 extension. A CIP proposing how to signal to the wallet the extra layer-2's that the user wishes to connect to on connect will be forthcoming. ] Using those API endpoints, the user (or the dApp / wallet on their behalf) can query the status of their deposit, and any UTxOs available for building transactions. The user should periodically check the status of the Gummiworm Head, to ensure it stays in good standing, and that the backlog isn't growing. If a head is flagged in bad standing, or the lag time grows outside of a tolerable window, the user should cease transacting with the head immediately. Exactly how often to check, or what those thresholds are, is left to the users discretion. If the user is satisfied with the status of the head, they can build and submit transactions directly to the Gummiworm Head as if it were a standard Cardano submit API. === Receipts On receipt of a transaction, the Gummiworm Head should follow the underlying Hydra protocol to validate and circulate the transaction among its peers. Once all peers have seen the transaction, and signed the next snapshot, this signed snapshot, along with a proof that the transaction is present in the snapshot, should be returned to the user in the form of a "transaction receipt". This receipt should largely follow the format of the signed Hydra snapshots, and should at least include: - The gummiworm head ID - The users transaction ID (or a merkle root that can be used to prove the transaction is included) - A monotonically increasing "snapshot number" This receipt gives the user confidence that the transaction will eventually be seen by the Gummiworm Validators. If the user presents this receipt to the Gummiworm Validators and proves that the transaction was never included in the final transaction stream, a portion of the Gummiworm Validators collateral will be slashed for the inconvenience. #note[ The person submitting a transaction is ultimately just one party who cares about the finality receipt; but the user *receiving* the funds also cares, as they're about to make decisions based on having those funds. We should consider mechanisms where that finality receipt can be served to the recipient when they learn about the transaction as well. ] For exactly how this process works, see the section on Contesting with Receipts. #note[ The exact amount of punitive pressure to apply to Gummiworm Heads is an open question, and one we invite feedback on. Perhaps there is a way to express this as the settings of the Gummiworm head, or perhaps this is sensitive enough to flag the Gummiworm head in bad standing and slash their entire collateral. ] === Publishing At regular intervals, the Gummiworm Head should package a large batch of transactions into an archive format described below, and publish them to a shared storage mechanism. #note[ The exact storage mechanism is flexible, and may even vary from head to head depending on the use case, but should at a minimum be accessible to the Gummiworm Head and the Gummiworm Validators. Some examples might include a private S3 bucket, a data availability layer, a public IPFS pinned file, or Iagon storage. ] The exact frequency of these archives is a parameter of the Gummiworm Head, and consists of 3 limits. When the prospective archive hits any of these three limits, it should be closed off, published, and a new archive begun: - A time interval; for example, every 30 minutes - A transaction count; for example every 1,000,000 transactions - A byte count; for example, every 10 gigabytes This ensures that each archive is timely, and reasonably sized. The Gummiworm Validator set will then download this archive and validate each transaction, collecting up a list of withdrawals. If an archive is all valid, and contains no withdrawals, there is nothing else for the Gummiworm Validator set to do. If there is an invalid transaction, or at least one withdrawal, this will initiate the appropriate process for the Gummiworm Validator set. They will engage in a small local consensus to produce an aggregate FROST signature on the withdrawals or dispute, and publish a transaction on the Cardano Layer 1. For exactly how these processes work, see the later sections describing these flows. /* === Archive Format */ #pagebreak() == Withdrawals In order to withdraw funds from a Gummiworm Head, there are two processes that a user can follow. One is the optimistic path, when a Gummiworm Head is operating correctly, and the other is a pessemistic path, for when a Gummiworm Head is misbehaving or offline. In this section, we will cover the first, and leave the second for the section dealing with all manner of protocol Abuse. A user can request an optimistic withdrawal on the Layer 2 by submitting a transaction that pays the funds they wish to withdraw to a new UTxO locked by the Gummiworm Deposit contract, with a `null` Gummiworm Head ID. This contract will allow the Gummiworm operator to spend and burn the wrapped assets. #transaction( "Deposit", inputs: ( ( name: "User funds", address: "User Address", value: ( ada: "X + Z", token1: "Y", ), ), ), outputs: ( ( name: "Withdrawal", address: "Gummiworm Deposit", value: ( ada: "X + Z", token1: "Y", withdrawal_valid: 1, ), datum: ( gummiworm_head_id: [Head ID], withdrawal_fee: [Z], destination: ( address: [Addr], datum: [SomeDatum] ) ), ), ), ) Because the Gummiworm Head is instant finality, and there is no hard custody of user funds, there is no timeout for the withdrawal. While processing an archive from the transaction stream, Gummiworm Validators should track all withdrawals they observe. Once the end of that archive is reached, a Gummiworm Validator should: - If no messages have been received from peer Validators - Build a transaction that spends the Gummiworm Treasury, and pays out the requested withdrawals to the requested destinations - Broadcast this transaction, along with a round number, to the peer Validators requesting a commitment for a FROST signature - If a messages has been received from a peer with a proposed transaction that matches the observed withdrawals, respond with a commitment to sign this transaction and mark yourself as having voted for this (archiveID, roundNumber) - If you've already voted in a round, refuse to vote again - If you've already seen a transaction and the archive is currently marked as complete, refuse to vote again - If a quorum of votes is reached, aggregate the signatures and broadcast the transaction to the Cardano Layer 1 - If such a transaction is seen, mark that archive as completed; if the transaction is rolled back, mark it as incomplete - If a timeout occurs and the archive is not still marked as completed, build a new withdrawal transaction and broadcast it to your peers with an incremented round number. #note[ The above is a simple RAFT like protocol for aggregating FROST signatures. The exact details may need to be refined as it is implemented and tested heavily. Additionally, we may wish to replace this with a more adversarially safe consensus, such as a proof of stake weighted protocol. ] /* = Incentives == Treasury == Fees */ #pagebreak() = Abuse // == Deposit Limits == Contesting with Receipts When submitting each transaction, the submit API for the Gummiworm Head should hold the request open until it can respond with a signed finality receipt. This receipt has a signature from each of the Gummiworm Head operators, and is a commitment to include the transaction at a specific height in the transaction stream. If the archive delivered to the Gummiworm Validators ultimately does not include this transaction, the receipt can be used as evidence to slash a portion of the head operators collateral for censoring the transaction. In principle, a user can do this themselves by downloading the appropriate archive to check that the transaction was included. In practice, most users will not do this. For this reason, the Independent Gummiworm Validators consist of anyone willing to run a Gummiworm Validator node. They don't participate in the custody of the funds, but can receive *all* receipts, and then check them for the user. If they find a discrepancy, they submit them to the Gummiworm Validators on behalf of the user for a small portion of the collateral. #note[ The exact incentives of how much collateral is at risk, and whether to halt the Gummiworm head in this case, are still under consideration. We would gladly welcome feedback on this. ] == Withdrawal Request In cases where the Gummiworm Head is not honoring withdrawal requests, users can submit the signed withdrawal transaction to the Gummiworm Validators directly. One of the Gummiworm Validators will submit this transaction to the Gummiworm Head directly, to confirm that the Gummiworm Head is rejecting it. If so, it will initiate the dispute resolution process among the Gummiworm Validators to flag the head as in bad standing, and begin unwinding the Gummiworm state as of the last known good state. // See the section on Forcefully closing the Gummiworm Head to see more details. // == Slashing Collateral // == Forceful Closing of the Head = Security The security argument for this protocol rests on measuring the nakamoto coefficient of the custody of the user funds. The Gummiworm Validator Set relies on a $M$ of $N$ #link("https://eprint.iacr.org/2020/852.pdf", "FROST") key. Therefore, so long as M nodes remain available, and $(N - M) + 1$ nodes remain honest, the following properties hold: - A user who deposits their funds, but whose deposit is not honored by the Gummiworm Head within the time limit, will be able to reclaim their deposit before it is aggregated by the Gummiworm Validators - A user who deposits their funds, and whose deposit *is* honored by the Gummiworm Head, will not have their funds spent by the Gummiworm Head without a signature from their wallet - A user who receives funds on the Gummiworm Layer 2 in a transaction that makes it into the transaction archives, and doesn't otherwise spend them in a later transaction, will eventually be able to withdraw those funds back to their address on the Cardano Layer 1 - A user who submits a transaction to the Gummiworm Head and receives a receipt, will either see that transaction in the eventual transaction stream and (assuming they don't spend the funds first), be able to withdraw them; or receive a portion of the Gummiworm Head's collateral as a punitive measure - The Gummiworm Head operator will be unable to forge transaction signatures, or smart contract outcomes, without forfeiting their collateral - The Gummiworm Head operator will never be able to spend user funds on the Cardano Layer 1 // == Soundness // == Risks // = Remaining Work
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/代数学二/作业/hw11.typ
typst
#import "../../template.typ": * #import "@preview/commute:0.2.0": node, arr, commutative-diagram #show: note.with( title: "作业11", author: "YHTQ", date: none, logo: none, withOutlined : false, withTitle :false, withHeadingNumbering: false ) = p125 == 1 注意到: $ dim A_m = dim A = dim(k[x_1, ..., x_n] quo (f)) = n-1 $ 设 $P = (p_1, ..., p_n)$,将有: $ m = (x_1 - p_1, ..., x_n - p_n)\ f in m $ 容易验证 $P$ 是非奇异点当且仅当 $f in.not m^2$,而在 $A_m$ 中有: $ m quo m^2 = (x_1 - p_1, ..., x_n - p_n) quo( (x_1 - p_1, ..., x_n - p_n)^2 + (f)) $ 维度条件意味着 $A_m$ 是正规局部环当且仅当上式是 $n-1$ 维 $k-$线性空间 - 若 $f in (x_1 - p_1, ..., x_n - p_n)^2$,上式显然是 $n$ 维线性空间 - 否则,可设: $ f in f_1 + (x_1 - p_1, ..., x_n - p_n)^2 $ 且 $f_1$ 是 $x_1 - p_1, ..., x_n - p_n$ 的线性组合,这表明 $m quo m^2 = ((x_1 - p_1, ..., x_n - p_n) quo (x_1 - p_1, ..., x_n - p_n)^2) quo (f_1)$ 恰为 $n-1$ 维线性空间 证毕 == 2 首先存在同态 $k[t_1, t_2, ..., t_d] -> A$,且由定理给出的代数独立性这是单射。取完备化(注意到完备化在有限生成模上正合,$A$ 诺特确保前者作为理想有限生成)可得 $k[[t_1, ..., t_n]] -> A$ 的单射。 对于第二个命题: - 首先证明 $G(A)$ 在 $G(k[t_1, ..., t_d]) = k[t_1, ..., t_d]$ 上有限生成。既然 $G(A)$ 是 $A_0 = A quo m = k$ 的有限生成模,当然也是 $k[t_1, ..., t_d]$ 的有限生成模。 - 其次,注意到 $G(k[t_1, ..., t_d]) = G(k[[t_1, ..., t_d]])$,利用上节定理可得 $A$ 在 $k[[t_1,...,t_d]]$ 上有限生成 == 3 #let kclo = $overline(k)$ #let kA = $k[x_1, ..., x_d]$ #let kB = $kclo[x_1, ..., x_d]$ 注意到 $kclo$ 中所有元素当然在 $k$ 上整,继而在 $kA$ 上整。而 $x_1, ..., x_n in kB$ 当然也在 $kA$ 上整,由整元的代数封闭性 $kB$ 在 $kA$ 上整。\ 此外,$kA$ 当然在分式域中整闭。任取 $kB$ 的极大理想 $m$,则 $m sect kA$ 也是极大理想,且 $dim kA_(m sect kA) = dim kB_(m)$ 回到定理的证明,类似利用诺特正规化构造 $B = kA, m$ 是任意极大理想,由上面的命题和书上引理将有: $ dim B_m = dim kB_m $ 利用原定理即可得到上式为 $d$,证毕 == 4 设 $p_i = (x_(m_i + 1), ..., x_(m_(i+1))), d = m_(i+1) - m_i$,$p_i$ 是素理想是容易的,而它的高度也即: $ k[x_1, ..., x_d] $ 中 $(x_1, ..., x_d)$ 的高度,换言之就是 $k[x_1, ..., x_d]$ 的维度,熟知它恰为 $d = m_(i+1) - m_i$\ 利用定义验证可得 $S = A - union p_i$ 确实是乘法封闭的,做局部化可得 $Inv(S) A$ 是诺特的,但含于 $p_i$ 的素理想与含于 $Inv(S) p_i$ 的素理想一一对应,继而 $Inv(S) p_i$ 的高度也是 $m_(i+1) - m_i$,它将趋于无穷。 == 5 不难发现设 $lambda$ 是加性函数,则: $ 0 -> M' -> M -> M'' -> 0 $ 导出 $lambda(M') - lambda(M) + lambda(M'') = 0$\ 进而 $lambda$ 诱导了 Grothendick 群 $K(A_0) -> ZZ$ 的同态。反之,这样的群同态当然也是一个加性函数。从而庞卡莱级数也可看作: $ sum_(n=0)^(+infinity) lambda(a_n) t^n, lambda in Hom(K(A_0), ZZ), a_n in K(A_0) $ == 6 取 $f: A -> A[x]$ 是嵌入,熟知 $f^*: Spec(A[x]) -> Spec(A)$ 成为保序的满射。任取 $A[x]$ 的素理想链: $ p_0 < p_1 < p_2 < ... < p_s $ 注意到在 $p_i sect A$ 处的纤维同胚于 $k(p_i) tensorProduct A[x] = k[x]$,维度为 $1$,因此上式中至多连着两项拉回 $A$ 的到相同的素理想,换言之: $ dim A + 1 >= (s + 1)/2\ s <= 2 dim A + 1 $ 可得 $dim A[x] <= 2 dim A + 1$ 对于另一个方向,任取 $A$ 中素理想升链: $ q_0 < q_1 < q_2 < ... < q_s $ 这里无妨设 $q_s$ 是极大理想,则: $ q_0[x] < q_1[x] < q_2[x] < ... < q_s[x] < q_s[x] + (x) $ (注意到 $q_s[x] + (x)$ 极大)当然是一个素理想升链,因此当然有 $1 + dim A <= dim A[x]$,证毕 == 7 任取素理想 $p$ 并设其高度为 $m$\ 首先在 $A_p$ 上利用维度定理,存在 $a_1, a_2, ..., a_m$ 满足 $(a_1, ..., a_m)$ 是 $p A_p-$primary 理想,继而 $p$ 就是 $a = (a_1, ..., a_m) subset A$ 中的极小素理想,进而 $p[x]$ 是 $a[x]$ 的极小素理想。此时,在 $A[x]_(p[x])$ 中利用维度定理立得 $"height" p[x] <= m$\ 另一方面,$A$ 上素理想当然可以延拓到 $A[x]$ 上,因此 $"height" p[x] >= m$,两者结合即得 $"height" p[x] = m$ 取 $A[x]$ 中最长的素理想升链: $ q_0 < ... < q_(s - 1) < q_s $ 若 $q_i sect A != q_(i - 1) sect A, forall i$,则 $s <= dim A$ 与之前的下界矛盾。\ 因此设 $q_i sect A = q_(i-1) sect A = p_i$,显有 $q_i, q_(i-1) subset p_i [x] + (x)$ 而后者是极大理想。之前证明了纤维维度为 $1$,进而必有 $q_i = p_i [x] + (x)$,由极大性可得 $i$ 只能为 $s$,进而 $s = dim A + 1$,证毕
https://github.com/JCGoran/typst-cv-template
https://raw.githubusercontent.com/JCGoran/typst-cv-template/master/template.typ
typst
/* template for a CV still need to iron out some details */ // global variables #let default_primary_color = rgb("#14A4E6") #let default_secondary_color = rgb("#757575") #let default_link_color = rgb("#14A4E6") #let default_font = "Carlito" #let default_math_font = "DejaVu Sans" #let default_separator = text( // this is because in some fonts (notably computer modern), it shows the // vertical line as a horizontal one font: "Carlito", " \u{007c} ", ) // dictionary of common icons and values #let get_default_icons(color: none) = { if color == none { color = default_primary_color } ( "github": ("displayname": "GitHub", "logo": text(font: "FontAwesome", "\u{f09b}")), "linkedin": ( "displayname": "LinkedIn", "logo": text(font: "FontAwesome", "\u{f08c}"), ), "personal": ( "displayname": "Personal", "logo": text(font: "FontAwesome", "\u{f268}"), ), // annoyingly, Debian does not ship a version of FontAwesome which supports // the ORCID logo, hence here I draw my own approximation of it using Typst // primitives "orcid": ("displayname": "ORCID", "logo": box(baseline: 0.2em, circle( radius: 0.5em, fill: color, inset: 0pt, align(center + horizon, text(size: 0.8em, fill: white, "iD")), ))), ) } /* join dictionaries (kind of like Python's {**a, **b}) */ #let join_dicts(..args) = { let result = (:) for arg in args.pos() { for (key, value) in arg.pairs(){ result.insert(key, value) } } result } /* function that applies a color to a link */ #let colorlink(color: none, url, body) = { if color == none { color = default_link_color } text(fill: color, link(url)[#body<colorlink>]) } /* function that processes links */ #let process_links(color: none, icons: none, links) = { if icons == none { icons = default_icons } else { // if the user supplies a custom dictionary, update the default one icons = join_dicts(get_default_icons(color: color), icons) } links.pairs().map( it => text( fill: color, link( it.at(1), icons.at(it.at(0), default: (:)).at("logo", default: "") + " " + icons.at(it.at(0), default: (:)).at("displayname", default: ""), ), ), ) } /* the section(s) that are colored and have a line */ #let section(primary_color: none, secondary_color: none, title) = { if primary_color == none { primary_color = default_primary_color } if secondary_color == none { secondary_color = default_secondary_color } heading(level: 1, grid( columns: 2, gutter: 1%, text(fill: primary_color, [#title <section>]), line( start: (0pt, 0.45em), length: 100%, stroke: (paint: secondary_color, thickness: 0.05em), ), )) } /* custom bulleted list */ #let experience_details(color: none, symbol: none, ..args) = { if color == none { color = default_primary_color } if symbol == none { symbol = sym.bullet } list( indent: 5pt, marker: text(fill: color, symbol), ..args.pos().map(it => text(size: 10pt, [#it<experience_details>])), ) } #let date(color: none, content) = { if color == none { color = default_secondary_color } [#h(1fr) #text(weight: "regular", size: 10pt, fill: color, content)] } /* experience that has an optional date and an optional description */ #let dated_experience(title, date: none, description: none, content: none) = { [ == #title #h(1fr) #text(weight: "regular", size: 10pt, date) <dated_experience_header> #text(weight: "regular", description)<dated_experience_description> #content ] } /* display skills (a dictionary) */ #let show_skills(separator: none, color: none, skills) = { if separator == none { separator = default_separator } if color == none { color = default_primary_color } let skills_array = () for (key, value) in skills.pairs() { skills_array.push([*#key*]) skills_array.push(value.map(box).join(text(fill: color, separator))) } table( columns: 2, column-gutter: 2%, row-gutter: -0.2em, align: (right, left), stroke: none, ..skills_array, ) v(-1em) } /* return text info about a person */ #let show_details_text( alignment: center + horizon, icons: none, separator: none, color: none, details, ) = { let show_line_from_dict(dict, key) = { if dict.at(key, default: none) != none [#dict.at(key) \ ] } if separator == none { separator = default_separator } if color == none { color = default_link_color } if icons == none { icons = get_default_icons(color: color) } else { icons = join_dicts(get_default_icons(color: color), icons) } align( alignment, [ #text(size: 14pt, details.at("name", default: none))\ #show_line_from_dict(details, "address") #show_line_from_dict(details, "phonenumber") #text( size: 13pt, fill: color, (link("mailto:" + details.email)[#raw(details.email)]), ) \ #if details.at("links", default: none) != none { process_links(details.links, color: color, icons: icons).join(text(fill: color, separator)) } ], ) } /* the main info about the person (including picture) */ #let show_details(icons: none, separator: none, color: none, details) = { if details.at("picture", default: "").len() > 0 { grid( columns: (1fr, 0.5fr, 2.5fr), align(right + horizon, image(details.picture, width: 90%)), h(1fr), show_details_text(icons: icons, separator: separator, color: color, details), ) } else { show_details_text( // TODO figure out why the `center + horizon` alignment causes issues alignment: center + top, icons: icons, separator: separator, color: color, details, ) } v(-1em) } /* the main configuration */ #let conf( primary_color: none, secondary_color: none, link_color: none, font: none, math_font: none, separator: none, list_point: none, details, doc, ) = { // TODO figure out if there's a simpler way to parse this if primary_color == none { primary_color = default_primary_color } if secondary_color == none { secondary_color = default_secondary_color } if link_color == none { link_color = default_link_color } if font == none { font = default_font } if math_font == none { math_font = default_math_font } if separator == none { separator = text( fill: primary_color, // this is because in some fonts (notably computer modern), it shows the // vertical line as a horizontal one text(font: "Carlito", " \u{007c} "), ) } if list_point == none { list_point = sym.bullet } // custom show rules show math.equation: set text(font: math_font) show heading.where(level: 1): title => grid( columns: 2, gutter: 1%, text(fill: primary_color, [#title <section>]), line( start: (0pt, 0.45em), length: 100%, stroke: (paint: secondary_color, thickness: 0.05em), ), ) show heading.where(level: 2): set text(size: 11pt) show heading.where(level: 3): set text(weight: "regular") show heading.where(level: 2): set block(spacing: 0.7em) show heading.where(level: 3): set block(spacing: 0.7em) show link: set text(fill: primary_color) show list: set text(size: 10pt) // see https://github.com/typst/typst/issues/1941 show "C++": box // custom set rules set text(font: font, ligatures: false) set par(justify: true) set page( margin: (top: 0.8cm, left: 1.5cm, bottom: 1.5cm, right: 1.5cm), footer-descent: 0%, header-ascent: 0%, ) set page(footer: [ #line( start: (0pt, 0.45em), length: 100%, stroke: (paint: secondary_color, thickness: 0.05em), ) #eval(details.footer, mode: "markup") ]) if details.at("footer", default: "").len() > 0 set list(indent: 5pt, marker: text(fill: primary_color, list_point)) show_details(details, color: primary_color) // the actual content of the document doc }
https://github.com/TheHarrisButler/my-resume
https://raw.githubusercontent.com/TheHarrisButler/my-resume/main/resume/resume.typ
typst
#import "./package.typ": * #let aside-theme = ( gutter-size: 0.5fr ) #show: cv.with( theme: (), title: "<NAME>", subtitle: "Software Engineer", aside: { section( "Contact", { entry( "Home", "<NAME>", none, ) entry( "Phone", "+1 303-319-0118", none, ) entry( "Email", link("mailto:<EMAIL>", "<EMAIL>"), none, ) entry("Website", link("harrishbutler.com", "harrishbutler.com"), none) }, ) section( "Technology Stack", { entry( theme: aside-theme, "Languages", "JavaScript, TypeScript, Python, Bash", [] ) entry( theme: aside-theme, "Web", "React, Next.js, Vite, ReactQuery", [], ) entry( theme: aside-theme, "Testing", "React Testing Library, Jest, Cypress", [], ) entry( theme: aside-theme, "API", "REST", [], ) entry( theme: aside-theme, "DBMS", "PostgreSQL", [], ) entry( theme: aside-theme, "Bundling", "Rollup, Webpack", [], ) entry( theme: aside-theme, "CI/CD", "GitHub Actions", [], ) entry( theme: aside-theme, "Version Control", "Git", [], ) entry( theme: aside-theme, "Hosting", "Fly.io, AWS", [], ) entry( theme: aside-theme, "AI/ML", "GPT-4 API, GitHub Co-pilot", [], ) }, ) section( "Education", { entry( theme: (), "2016 - 2021", "The University of Texas at Tyler", [BS in Computer Science, Minor in Mathematics], ) } ) section( "Awards and Achievements", { entry( "Student Athelete", none, [ 4 year lettermen on the UT Tyler Men's Golf Team ], ) }, ) }, main: { section( "Professional Experience", { entry( right: [*\@Auctane* – Austin, TX], "Apr 2022 - Present", "Software Engineer L2", [ #v(4pt) #list( [ Spearheaded the development of a greenfield shipping and logistics React component library fully integrated with our flagship shipping API, reducing our partner's time to market from quarters to weeks. ], [ Acted as the technical liaison between internal sales and partner engineering teams; Led demo meetings to showcase product implementation, which resulted in an 80% conversion rate. ], [ Led a team of 2 engineers to develop an internal product demo application using React, TypeScript, and Next.js, improving our sales team's process and boosting conversion rates, resulting in over \u{0024}500,000 in new deal value. ] ) ], ) entry( right: [*\@Auctane* -- Austin, TX], "June 2021 - Apr 2022", "Software Engineer L1", [ #v(4pt) #list( [ Developed and maintained core features in our flagship white-labeled shipping solution, using TypeScript, React, and GraphQL. Deployed to over 400,000 users; It became one of the company's most-used products, generating over \u{0024}8 million YoY. ], [ Improved CI/CD efficiency by reducing Cypress.js end-to-end test suite run times by 85% through parallelizing test scripts in GitHub Actions. ], [ Boosted our backend's test coverage and robustness by mocking the most frequently used REST API endpoints, ensuring higher reliability and performance. ] ) ], ) entry( right: [*\@Glowstik* -- Denver, CO], "Oct 2022 - June 2023", "SWE Contract", [ #v(4pt) #list( [ Successfully migrated a vanilla Create React App (CRA) to Next.js and TypeScript, enhancing performance and scalability. ], [ Collaborated closely with developers and designers to ensure a seamless integration of Next.js and TypeScript into the existing codebase. ], [ Improved the codebase's maintainability by aligning the project with clean architecture principles. ], ) ], ) entry( right: [*\@Talent Reef* -- Denver, CO], "June 2019 - Aug 2019", "SWE Intern", [ #v(4pt) #list( [ Rotational internship between Tier II Technical Support, Engineering, Quality Assurance, and Product Management. ], [ Increased productivity of the QA team by developing and implementing automated API tests using Java and Serenity BDD. ] ) ], ) }, ) }, ) #section( "Projects", { entry( "2023", "Shipmunk", [ #list( [ Developed a Google Chrome extension using React and TypeScript, enabling users to purchase shipping labels seamlessly from any website. ], [ Won the 2023 Auctane Engineering Hackathon. ] ) ], ) entry( "2022", "harrishbutler.com", [ #list([ Built using React, Next.js, and TypeScript. Hosted on Fly.io with automated deployment via GitHub Actions. ]) ], ) entry( "2021", "The Map Game", [ #list( [ Developed a turn-based PvP guessing game using vanilla JavaScript, HTML, and CSS, inspired by the popular GeoGuessr game. ], [ Implemented real-time gameplay with web sockets, where players send each other Google Maps street views and compete to guess locations. The first to guess five correct locations wins. ]) ], ) } )
https://github.com/ssotoen/gridlock
https://raw.githubusercontent.com/ssotoen/gridlock/main/README.md
markdown
The Unlicense
# The `gridlock` Package (v0.2.0) Grid typesetting in Typst. Use this package if you want to line up your body text across columns and pages. ## Example ![An example image showing a two-column page with headings, a block quote, a footnote, a figure, a display formula, and a bulleted list. All body text in both columns lines up.](docs/assets/example-lines.png) ## Getting Started ```typ #import "@preview/gridlock:0.2.0": * #show: gridlock.with() #lock[= This is a heading] #lorem(30) #figure( placement: auto, caption: [a caption], rect() ) #lorem(30) ``` ## Usage Check out [the manual](docs/gridlock-manual.pdf) for a detailed description. To get started, import the package into your document: ```typ #import "@preview/gridlock:0.2.0": * ``` Set up the basic parameters: ```typ #show: gridlock.with( paper: "a4", margin: (y: 76.445pt), font-size: 11pt, line-height: 13pt ) ``` You can now use the `lock()` function to align any block to the text grid. Block quotes bulleted/numbered lists, and floating figures do _not_ need to be wrapped in `lock()`. Their spacing is handled fully automatically. ```typ #lock[= Heading] #lorem(50) #lock(figure( rect(), caption: [An example figure aligned to the grid.] )) #lorem(50) #lock[$ a^2 = b^2 + c^2 $] #lorem(50) ```
https://github.com/ukihot/igonna
https://raw.githubusercontent.com/ukihot/igonna/main/articles/web/remix.typ
typst
== Remix === CDN CDN(Contents Delivery Network)とは、Webコンテンツを迅速に効率よくユーザーに配信するためのネットワークである。 コンテンツの大容量化やネット人口の増加が進む中、昨今ではホームページの表示やコンテンツのダウンロードに時間がかかることも少なくない。 CDNはコンテンツの表示・配信を高速化し、ユーザーのストレスを軽減する。 CDNでは、キャッシュサーバと呼ばれる代理サーバが、オリジンサーバに代わってコンテンツを配信する。 キャッシュサーバは、オリジンサーバからキャッシュしたコンテンツを保存している。 CDNベンダ#footnote[Cloudflare, Amazon CloudFlont, Azure CDN, Google Cloud CDN等]はキャッシュサーバーを世界各地に分散して所有している。 ユーザーからアクセス要求があると、オリジンサーバに代わり、物理的距離が最も近いキャッシュサーバが応答する。 オリジンサーバもコンテンツ配信を行うが、その負荷はCDNを利用しない場合より遥かに小さくなる。 アクセス集中が抑えられ、表示・配信の遅延やサーバダウンのリスクが低くなる。 === Remix RemixはCDNエッジサービスであるCloudflare WorkersでSSRを使えるReactベースのWebフレームワークである。
https://github.com/f14-bertolotti/bedlam
https://raw.githubusercontent.com/f14-bertolotti/bedlam/main/src/notation/main.typ
typst
#import "../theme.typ" : definition, comment, example = Notation #let symmetric-difference = ( tag : link(<symmetric-difference>)[symmetric difference], sym : link(<symmetric-difference>)[#sym.triangle.t] ) #definition("symmetric difference")[ Let A, B be sets. The *symmetric difference* is the operation, denoted $S #symmetric-difference.sym T$, and defined $(S without T) union (T without S)$ ]<symmetric-difference> #let half-open-rectangle = ( tag : link(<half-open-rectangle>)[half-open rectangle], sym : n => link(<half-open-rectangle>)[$cal(I)^(#n)_h$] ) #definition("half-open rectangle")[ Let $a_0, b_0, ..., a_n, b_n in RR$. The set $times.big_(i=0)^n [a_i, b_i)$ is called an n-dimensional *half-open rectangle*. The collection of all n-dimensional *half-open rectangles* is denoted with #(half-open-rectangle.sym)("n"). ]<half-open-rectangle> #let restriction = ( tag : link(<restriction>)[restriction], sym : (fname, where) => link(<restriction>)[#text[$#fname|_(#where)$]] ) #definition("restriction")[ Let $f:X --> Y$. Let $X' subset.eq X$. Let $Y'$ such that $f(X') subset.eq Y' subset.eq Y$. A *restriction of f over $X' times Y'$*, denoted #(restriction.sym)("f","X' times Y'") is a function $X' --> Y'$ such that $#(restriction.sym)("f","X times Y") = {x |-> f(x) | x in X', f(x) in Y'}$ ]<restriction> #example("restriction")[ Let $f:RR-->RR$ such that $f(x) = x^2$ #comment[power operator over the real numbers]. Now, consider $g:NN-->NN$ such that $g(x) = x^2$ #comment[power operator over the natural number only]. Then $g$ is a #restriction.tag of f. 1. $NN subset.eq RR$. 2. $f(NN) subset.eq NN subset.eq RR$. 3. ${(x, g(x))| x in NN, y in NN)} subset.eq {(x,f(x)|x in RR, y in RR)}$ ] #let extension = ( tag : link(<extension>)[extension] ) #definition("extension")[ Let $f:X --> Y$. Let $X' subset.eq X$. Let #(restriction.sym)("f","X' times Y'") be a #restriction.tag of $f$. Then $f$ is said an *extension* of #(restriction.sym)("f","X times Y") ]<extension> #let inverse = ( tag : link(<inverse-function>)[inverse], sym : (fname) => {return link(<inverse-function>)[#text[$#fname^(-1)$]]} ) #definition("inverse function")[ Let $f:X --> Y$ be a function. The *inverse function* $#(inverse.sym)("f") : Y --> X$ is a function such that $#(inverse.sym)("f") (y in Y) = x in X$ if $f(x) = y$. ]<inverse-function> #let preimage = ( tag : link(<preimage>)[preimage] ) #definition("preimage")[ Let $f:X --> Y$ be a function. Let $E subset.eq Y$. The *preimage* is the set $#(inverse.sym)("f") (E) = {x in X | f(x) in E}$. ]<preimage>
https://github.com/j1nxie/resume
https://raw.githubusercontent.com/j1nxie/resume/main/README.md
markdown
Do What The F*ck You Want To Public License
# rylie's resume a simple resume, based on [typst-cv-miku](https://github.com/ice-kylin/typst-cv-miku). ## license licensed under WTFPL ([LICENSE](LICENSE) or http://www.wtfpl.net/).
https://github.com/japrozs/resume
https://raw.githubusercontent.com/japrozs/resume/master/utils.typ
typst
// Helper Functions #let monthname(n, display: "short") = { n = int(n) let month = "" if n == 1 { month = "January" } else if n == 3 { month = "March" } else if n == 2 { month = "February" } else if n == 4 { month = "April" } else if n == 5 { month = "May" } else if n == 6 { month = "June" } else if n == 7 { month = "July" } else if n == 8 { month = "August" } else if n == 9 { month = "September" } else if n == 10 { month = "October" } else if n == 11 { month = "November" } else if n == 12 { month = "December" } else { result = none } if month != none { if display == "short" { month = month.slice(0, 3) } else { month } } month } #let strpdate(isodate) = { let date = "" if lower(isodate) != "present" { date = datetime( year: int(isodate.slice(0, 4)), month: int(isodate.slice(5, 7)), day: int(isodate.slice(8, 10)) ) date = date.display("[month repr:short]") + " " + date.display("[year repr:full]") } else if lower(isodate) == "present" { date = "Present" } return date }
https://github.com/ClazyChen/Table-Tennis-Rankings
https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2015/MS-10.typ
typst
#set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (1 - 32)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [1], [MA Long], [CHN], [3593], [2], [XU Xin], [CHN], [3367], [3], [FAN Zhendong], [CHN], [3294], [4], [ZHANG Jike], [CHN], [3258], [5], [FANG Bo], [CHN], [3180], [6], [MIZUTANI Jun], [JPN], [3173], [7], [#text(gray, "WANG Hao")], [CHN], [3147], [8], [YAN An], [CHN], [3124], [9], [OVTCHAROV Dimitrij], [GER], [3087], [10], [CHUANG Chih-Yuan], [TPE], [3011], [11], [WONG Chun Ting], [HKG], [2996], [12], [YOSHIMURA Maharu], [JPN], [2996], [13], [JOO Saehyuk], [KOR], [2992], [14], [FREITAS Marcos], [POR], [2986], [15], [SAMSONOV Vladimir], [BLR], [2975], [16], [BOLL Timo], [GER], [2975], [17], [TANG Peng], [HKG], [2964], [18], [GAO Ning], [SGP], [2939], [19], [YU Ziyang], [CHN], [2932], [20], [ZHOU Yu], [CHN], [2922], [21], [JEOUNG Youngsik], [KOR], [2905], [22], [<NAME>], [AUT], [2899], [23], [<NAME>], [JPN], [2899], [24], [<NAME>], [CHN], [2888], [25], [<NAME>], [JPN], [2884], [26], [<NAME>], [GER], [2870], [27], [KOU Lei], [UKR], [2854], [28], [<NAME>], [CHN], [2844], [29], [<NAME>], [CRO], [2842], [30], [<NAME>], [KOR], [2839], [31], [<NAME>], [GRE], [2838], [32], [<NAME>], [SWE], [2837], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (33 - 64)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [33], [<NAME>], [GER], [2834], [34], [<NAME>], [JPN], [2831], [35], [<NAME>], [FRA], [2830], [36], [<NAME>], [GER], [2827], [37], [<NAME>], [FRA], [2826], [38], [<NAME>], [JPN], [2825], [39], [<NAME>], [JPN], [2819], [40], [<NAME>], [ENG], [2813], [41], [<NAME>], [AUT], [2809], [42], [DRINKHALL Paul], [ENG], [2803], [43], [<NAME>], [JPN], [2803], [44], [LEE Jungwoo], [KOR], [2800], [45], [KIM Donghyun], [KOR], [2787], [46], [<NAME>], [EGY], [2786], [47], [JIANG Tianyi], [HKG], [2780], [48], [JANG Woojin], [KOR], [2777], [49], [<NAME>], [AUT], [2777], [50], [<NAME>], [CHN], [2774], [51], [<NAME>], [SGP], [2772], [52], [<NAME>], [SGP], [2772], [53], [MONTEIRO Joao], [POR], [2771], [54], [<NAME>], [QAT], [2767], [55], [#text(gray, "<NAME>i")], [CHN], [2763], [56], [MURAMATSU Yuto], [JPN], [2763], [57], [SHIBAEV Alexander], [RUS], [2754], [58], [<NAME>], [POR], [2754], [59], [APOLONIA Tiago], [POR], [2745], [60], [<NAME>], [AUT], [2744], [61], [<NAME>], [BRA], [2743], [62], [<NAME>], [IND], [2742], [63], [WANG Yang], [SVK], [2739], [64], [ZHOU Kai], [CHN], [2733], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (65 - 96)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [65], [<NAME>], [CHN], [2722], [66], [ZHOU Qihao], [CHN], [2722], [67], [<NAME>un], [KOR], [2722], [68], [ARUNA Quadri], [NGR], [2717], [69], [HE Zhiwen], [ESP], [2717], [70], [<NAME>], [JPN], [2717], [71], [<NAME>], [RUS], [2716], [72], [<NAME>], [CAN], [2716], [73], [HO Kwan Kit], [HKG], [2716], [74], [<NAME>], [POL], [2716], [75], [<NAME>], [GER], [2712], [76], [<NAME>], [SWE], [2709], [77], [<NAME> Hyok], [PRK], [2709], [78], [OUAICHE Stephane], [ALG], [2709], [79], [<NAME>], [FRA], [2708], [80], [TSUBOI Gustavo], [BRA], [2701], [81], [<NAME>], [SLO], [2698], [82], [<NAME>], [IRI], [2698], [83], [KIM Minseok], [KOR], [2697], [84], [<NAME>], [SRB], [2691], [85], [PROKOPCOV Dmitrij], [CZE], [2690], [86], [<NAME>-An], [TPE], [2689], [87], [<NAME>], [JPN], [2683], [88], [<NAME>], [JPN], [2682], [89], [SZOCS Hunor], [ROU], [2680], [90], [<NAME>], [KOR], [2679], [91], [<NAME>], [SWE], [2676], [92], [<NAME>], [SWE], [2674], [93], [<NAME>], [GER], [2667], [94], [#text(gray, "KIM Hyok Bong")], [PRK], [2664], [95], [<NAME>], [FRA], [2663], [96], [<NAME>], [DEN], [2660], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (97 - 128)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [97], [<NAME>], [GER], [2659], [98], [<NAME>], [FRA], [2658], [99], [<NAME>], [KOR], [2657], [100], [MATSUDAIRA Kenji], [JPN], [2654], [101], [#text(gray, "<NAME>")], [SWE], [2652], [102], [BOBOCICA Mihai], [ITA], [2651], [103], [#text(gray, "KIM Nam Chol")], [PRK], [2646], [104], [WU Zhikang], [SGP], [2646], [105], [#text(gray, "CHAN Kazuhiro")], [JPN], [2645], [106], [<NAME>], [HUN], [2642], [107], [<NAME>], [KOR], [2639], [108], [CIOTI Constantin], [ROU], [2639], [109], [ZHAI Yujia], [DEN], [2638], [110], [<NAME>], [JPN], [2638], [111], [<NAME>], [AUT], [2637], [112], [KIM Minhyeok], [KOR], [2632], [113], [<NAME>], [CHN], [2631], [114], [<NAME>], [KOR], [2630], [115], [SAKAI Asuka], [JPN], [2629], [116], [KALLBERG Anton], [SWE], [2627], [117], [ROBINOT Alexandre], [FRA], [2625], [118], [<NAME>], [FRA], [2623], [119], [<NAME>], [CRO], [2622], [120], [LIVENTSOV Alexey], [RUS], [2620], [121], [PAIKOV Mikhail], [RUS], [2619], [122], [MAZE Michael], [DEN], [2618], [123], [<NAME>], [PRK], [2618], [124], [<NAME>], [POL], [2617], [125], [#text(gray, "OYA Hidetoshi")], [JPN], [2616], [126], [DYJAS Jakub], [POL], [2616], [127], [CHO Eonrae], [KOR], [2613], [128], [TAKAKIWA Taku], [JPN], [2611], ) )
https://github.com/PgBiel/typst-diagbox
https://raw.githubusercontent.com/PgBiel/typst-diagbox/main/README.md
markdown
Apache License 2.0
# typst-diagbox A library for diagonal line dividers in Typst tables; a.k.a., table cells with a diagonal line dividing them. ## Usage Move the `diagbox.typ` file to e.g. the same folder your main `.typ` file is in, then write `#import "diagbox.typ": *` inside it. This will import two functions: `bdiagbox[left][right]` (for a diagonal from top-left to bottom-right) and `tdiagbox[left][right]` (for a diagonal line from bottom-left to top-right). See sample usage in the `examples` folder. ![image](https://user-images.githubusercontent.com/9021226/227755001-a3a8b865-3de9-45be-869f-1ba755133f55.png) ## How it works Using a simple box with a diagonal line across it won't work in most cases, as `table`s come with an internal padding option called `inset`; thus, no box would be able to occupy an entire cell (there would always be some negative space around it). Instead, the `bdiagbox` and `tdiagbox` functions take an `inset` parameter (which defaults to `5pt`, the default for all tables, but must be overridden if your table has a different value). With that parameter, the diagonal line will exceed the box's boundaries to compensate for the padding. So, for example, if we consider a coordinate system with `(0, 0)` as the inner box's top left corner, with `x` increasing to the right and `y` increasing downwards, we would have, for `bdiagbox` (a diagonal line going from top left to bottom right), a line going from `(-inset, -inset)` to `(inner_width + inset, inner_width + inset)`, where `inner_width` is calculated (normally) by `width - 2*inset` (where `width` is the column's total width, which the diagbox should fully occupy). ## License Licensed under MIT or Apache-2.0, at your option. This is why, if you place a diagbox outside of a table without specifying `inset: 0pt`, with `box_stroke: 1pt`, you will notice that the line "overflows" the box - this is necessary to compensate for internal table padding.
https://github.com/hosnimarnisi/lab3
https://raw.githubusercontent.com/hosnimarnisi/lab3/main/Lab-3.typ
typst
#import "Class.typ": * #show: ieee.with( title: [#text(smallcaps("Lab #3: Web Application with Genie"))], /* abstract: [ #lorem(10). ], */ authors: ( ( name: "", department: [Senior-lecturer, Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "a-mhamdi", ), ( name: " <NAME>", department: [Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "ademnmr", ), ( name: "<NAME>", department: [Dept. of EE], organization: [ISET Bizerte --- Tunisia], profile: "hosnimarnisi", ), ) // index-terms: (""), // bibliography-file: "Biblio.bib", ) = Introduction In this lab, you will create a basic web application using *Genie* framework in Julia. The application will allow us to control the behaviour of a sine wave, given some adjustble parameters. = Application : Opening Genie in this application we gonna open genie web to use it changing some sinewave parameter - write down this code to load the up genie app and had the link to the genie space ```julia julia> using GenieFramework julia> Genie.loadapp() # Load app julia> up() # Start server ``` - We can now open the browser and navigate to the link #highlight[#link("localhost:8000")[localhost:8000]]. We will get the graphical interface as in figure 1 #figure( image("IMAGES/genie web.png", width: 100%), caption: "Genie web", ) = Application : Adding phase in this application we gonna add a phase parametere to GenieFramework - adding the phase to app.jl ```julia using GenieFramework @genietools @app begin @in N::Int32 = 1000 @in amp::Float32 = 0.25 @in freq::Int32 = 1 @in ph::Float32 = 0 @out my_sine = PlotData() @onchange N, amp, freq begin x = range(0, 1, length=N) y = amp*sin.(2*π*freq*x.+ph) my_sine = PlotData(x=x, y=y, plot=StipplePlotly.Charts.PLOT_TYPE_LINE) end end @page("/", "app.jl.html") ``` - adding the phase to app.jl.html ```julia <header class="st-header q-pa-sm"> <h1 class="st-header__title text-h3" Sinewave Dashboard </h1> </header> <div class="row"> <div class="st-col col-12 col-sm st-module"> <p><b># Samples</b></p> <q-slider v-model="N" :min="10" :max="1000" :step="10" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>Amplitude</b></p> <q-slider v-model="amp" :min="0" :max="3" :step=".5" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>Frequency</b></p> <q-slider v-model="freq" :min="0" :max="10" :step="1" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>phase</b></p> <q-slider v-model="freq" :min="-3.14" :max="3.14" :step="0.314" :label="true"> </q-slider> </div> </div> <div class="row"> <div class="st-col col-12 col-sm st-module"> <p><b>Sinewave</b></p> <plotly :data="my_sine"> </plotly> </div> <div> ``` - the result in genie : #figure( image("IMAGES/phase genie.png", width: 100%), caption: "adding phase ", ) = Application : Adding the offset in this app we gonna add another paramatere the offset - adding the phase to app.jl ```julia using GenieFramework @genietools @app begin @in N::Int32 = 1000 @in amp::Float32 = 0.25 @in freq::Int32 = 1 @in ph::Float32 = 0 @in off::Float32 = 0 @out my_sine = PlotData() @onchange N, amp, freq begin x = range(0, 1, length=N) y = amp*sin.(2*π*freq*x.+ph).+off my_sine = PlotData(x=x, y=y, plot=StipplePlotly.Charts.PLOT_TYPE_LINE) end end @page("/", "app.jl.html") ``` - adding the phase to app.jl.html ```julia <header class="st-header q-pa-sm"> <h1 class="st-header__title text-h3" Sinewave Dashboard </h1> </header> <div class="row"> <div class="st-col col-12 col-sm st-module"> <p><b># Samples</b></p> <q-slider v-model="N" :min="10" :max="1000" :step="10" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>Amplitude</b></p> <q-slider v-model="amp" :min="0" :max="3" :step=".5" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>Frequency</b></p> <q-slider v-model="freq" :min="0" :max="10" :step="1" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>phase</b></p> <q-slider v-model="freq" :min="-3.14" :max="3.14" :step="0.314" :label="true"> </q-slider> </div> <div class="st-col col-12 col-sm st-module"> <p><b>offset </b></p> <q-slider v-model="freq" :min="-0.5" :max="1" :step="0.1" :label="true"> </q-slider> </div> </div> <div class="row"> <div class="st-col col-12 col-sm st-module"> <p><b>Sinewave</b></p> <plotly :data="my_sine"> </plotly> </div> <div> ``` - the result in genie : #figure( image("IMAGES/offset genie.png", width: 100%), caption: "adding offset ", )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/alignment-02.typ
typst
Other
// Test no alignment. $ "right" \ "a very long line" \ "left" \ $
https://github.com/juicebox-systems/ceremony
https://raw.githubusercontent.com/juicebox-systems/ceremony/main/instructions/exception.typ
typst
MIT License
// Exception Sheets are included at the end of the document. #import "presentation.typ": blank, blanks, checkbox, radio // A block element for multi-line input. #let par_blank(lines) = { for _ in range(lines) { v(1em) line(length: 100%, stroke: 0.5pt) } } // Returns a section of a document with an Exception Sheet. `i` counts from 1. // The section can be referred to as `@exception_sheet_(i)`. #let exception_sheet(i) = [ = Exception Sheet #i #label("exception_sheet_" + str(i)) #v(0.5em) #radio( [This exception sheet was not needed.], [This exception sheet is used.], ) #blanks[Start time][Step number] #checkbox[The exception was noted in the step margin.] + What was expected? #par_blank(4) + What happened instead? #par_blank(4) + What actions and decisions were taken? #par_blank(9) ]
https://github.com/typst-community/guidelines
https://raw.githubusercontent.com/typst-community/guidelines/main/src/chapters/api.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#set heading(offset: 1) #include "api/flexibility.typ" #include "api/simplicity.typ" #include "api/interoperability.typ"
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.2.0/src/util.typ
typst
Apache License 2.0
#import "deps.typ" #import deps.oxifmt: strfmt #import "matrix.typ" #import "vector.typ" #import "bezier.typ" /// Constant to be used as float rounding error #let float-epsilon = 0.000001 #let typst-measure = measure /// Multiplies vectors by the transform matrix /// /// - transform (matrix): Transformation matrix /// - ..vecs (vectors): Vectors to get transformed. Only the positional part of the sink is used. A dictionary of vectors can be passed and all will be transformed. /// -> vectors If multiple vectors are given they are returned as an array, if only one vector is given only one will be returned, if a dictionary is given they will be returned in the dictionary with the same keys. #let apply-transform(transform, ..vecs) = { let t = vec => matrix.mul4x4-vec3( transform, vec) if type(vecs.pos().first()) == dictionary { vecs = vecs.pos().first() for (k, vec) in vecs { vecs.insert(k, t(vec)) } } else { vecs = vecs.pos().map(t) if vecs.len() == 1 { return vecs.first() } } return vecs } // #let apply-transform-many(transform, vecs) = { // if type(vecs) == array { // vecs.map(apply-transform.with(transform)) // } else if type(vecs) == dictionary { // for (k, vec) in vecs { // vecs.insert(k, apply-transform(transform, vec)) // } // vecs // } // } /// Reverts the transform of the given vector /// /// - transform (matrix): Transformation matrix /// - vec (vector): Vector to get transformed /// -> vector #let revert-transform(transform, ..vecs) = { apply-transform(matrix.inverse(transform), ..vecs) } // Get point on line // // - a (vector): Start point // - b (vector): End point // - t (float): Position on line [0, 1] #let line-pt(a, b, t) = { return vector.add(a, vector.scale(vector.sub(b, a), t)) } /// Get orthogonal vector to line /// /// - a (vector): Start point /// - b (vector): End point /// -> vector Cormal direction #let line-normal(a, b) = { let v = vector.norm(vector.sub(b, a)) return (0 - v.at(1), v.at(0), v.at(2, default: 0)) } /// Get the arc-len of a circle or arc /// /// - radius (float): Circle or arc radius /// - start (angle): Start angle /// - stop (angle): Stop angle /// -> float Arc length #let circle-arclen(radius, angle: 360deg) = { calc.abs(angle / 360deg * 2 * calc.pi) } /// Get point on an ellipse for an angle /// /// - center (vector): Center /// - radius (float,array): Radius or tuple of x/y radii /// - angled (angle): Angle to get the point at /// -> vector #let ellipse-point(center, radius, angle) = { let (rx, ry) = if type(radius) == array { radius } else { (radius, radius) } let (x, y, z) = center return (calc.cos(angle) * rx + x, calc.sin(angle) * ry + y, z) } /// Calculate circle center from 3 points. The z coordinate /// is taken from point a. /// /// - a (vector): Point 1 /// - b (vector): Point 2 /// - c (vector): Point 3 #let calculate-circle-center-3pt(a, b, c) = { let m-ab = line-pt(a, b, .5) let m-bc = line-pt(b, c, .5) let m-cd = line-pt(c, a, .5) let args = () // a, c, b, d for i in range(0, 3) { let (p1, p2) = ((a,b,c).at(calc.rem(i,3)), (b,c,a).at(calc.rem(i,3))) let m = line-pt(p1, p2, .5) let n = line-normal(p1, p2) // Find a line with a non upwards normal if n.at(0) == 0 { continue } let la = n.at(1) / n.at(0) args.push(la) args.push(m.at(1) - la * m.at(0)) // We need only 2 lines if args.len() == 4 { break } } // Find intersection point of two 2d lines // L1: a*x + c // L2: b*x + d let line-intersection-2d(a, c, b, d) = { if a - b == 0 { if c == d { return (0, c, 0) } return none } let x = (d - c)/(a - b) let y = a * x + c return (x, y) } assert(args.len() == 4, message: "Could not find circle center") return vector.as-vec(line-intersection-2d(..args), init: (0, 0, a.at(2))) } #let resolve-number(ctx, num) = { if type(num) == length { if repr(num).ends-with("em") { float(repr(num).slice(0, -2)) * ctx.em-size.width / ctx.length } else { float(num / ctx.length) } } else if type(num) == ratio { return num } else { return float(num) } } #let resolve-radius(radius) = { return if type(radius) == array {radius} else {(radius, radius)} } /// Find minimum value of a, ignoring `none` #let min(..a) = { let a = a.pos().filter(v => v != none) return calc.min(..a) } /// Find maximum value of a, ignoring `none` #let max(..a) = { let a = a.pos().filter(v => v != none) return calc.max(..a) } /// Merge dictionary a and b and return the result /// Prefers values of b. /// /// - a (dictionary): Dictionary a /// - b (dictionary): Dictionary b /// -> dictionary #let merge-dictionary(a, b, overwrite: true) = { for (k, v) in b { if type(a) == dictionary and k in a and type(v) == dictionary and type(a.at(k)) == dictionary { a.insert(k, merge-dictionary(a.at(k), v, overwrite: overwrite)) } else if overwrite or k not in a { a.insert(k, v) } } return a } // Measure content in canvas coordinates #let measure(ctx, cnt) = { let size = typst-measure(cnt, ctx.typst-style) return ( calc.abs(size.width / ctx.length), calc.abs(size.height / ctx.length) ) } /// Get a padding/margin dictionary (top, left, bottom, right) from /// a padding value. /// /// - padding (none, number, array, dictionary): Padding specification /// Type of `padding`: /// / `none`: All sides padded by 0 /// / `number`: All sides are padded by the same value /// / `array`: CSS like padding: `(y, x)`, `(top, x, bottom)` or `(top, right, bottom, left)` /// / `dictionary`: Converts typst padding dictionary (top, left, bottom, right, x, y, rest) /// to a dictionary containing top, left, bottom and right. /// /// -> dictionary Dictionary with the keys: top, left, bottom and right #let as-padding-dict(padding) = { if padding == none { padding = 0 } if type(padding) == array { // Allow CSS like padding array assert(padding.len() in (2, 3, 4), message: "Padding array formats are: (y, x), (top, x, bottom), (top, right, bottom, left)") if padding.len() == 2 { let (y, x) = padding return (top: y, right: x, bottom: y, left: x) } else if padding.len() == 3 { let (top, x, bottom) = padding return (top: top, right: x, bottom: bottom, left: x) } else if padding.len() == 4 { let (top, right, bottom, left) = padding return (top: top, right: right, bottom: bottom, left: left) } } else if type(padding) == dictionary { // Support typst padding dictionary let rest = padding.at("rest", default: 0) let x = padding.at("x", default: rest) let y = padding.at("y", default: rest) if not "left" in padding { padding.left = x } if not "right" in padding { padding.right = x } if not "top" in padding { padding.top = y } if not "bottom" in padding { padding.bottom = y } return padding } else { return (top: padding, left: padding, bottom: padding, right: padding) } } /// Get a corner-radius dictionary (north-east, north-west, south-east, south-west) from /// a corner-radius value. Returns none if all radii are zero or none /// /// - ctx (context): Canvas context object /// - radii (none, number, dictionary): Radius specification /// Type of `padding`: /// / `number`: All corners have the same radius /// / `tuple`: All corners have the same rx/ry radius /// / `dictionary`: Converts corner radius dictionary (rest, north, south, east, west, north-south, north-east, south-west, south-east) /// to a dictionary containing north-east, north-west, south-east and south-west /// /// -> dictionary Dictionary with the keys: north-east, north-west, south-east, south-west set /// to corner radius tuples (x and y radius) #let as-corner-radius-dict(ctx, radii, size) = { if radii == none or radii == 0 { return (north-west: (0,0), north-east: (0,0), south-west: (0,0), south-east: (0,0)) } let radii = (if type(radii) == dictionary { let rest = radii.at("rest", default: (0,0)) let north = radii.at("north", default: auto) let south = radii.at("south", default: auto) let west = radii.at("west", default: auto) let east = radii.at("east", default: auto) if north != auto or south != auto { assert(west == auto and east == auto, message: "Corner radius north/south and west/east are mutually exclusive! Use per corner radii: north-west, .. instead.") } if west != auto or east != auto { assert(north == auto and south == auto, message: "Corner radius north/south and west/east are mutually exclusive! Use per corner radii: north-west, .. instead.") } let north-east = if north != auto { north } else if east != auto { east } else {rest} let north-west = if north != auto { north } else if west != auto { west } else {rest} let south-east = if south != auto { south } else if east != auto { east } else {rest} let south-west = if south != auto { south } else if west != auto { west } else {rest} (radii.at("north-west", default: north-west), radii.at("north-east", default: north-east), radii.at("south-west", default: south-west), radii.at("south-east", default: south-east)) } else if type(radii) == array { panic("Invalid corner radius type: " + type(radii)) } else { (radii, radii, radii, radii) }).map(v => if type(v) != array { (v, v) } else { v }) // Resolve lengths to floats radii = radii.map(t => t.map(resolve-number.with(ctx))) // Clamp radii to half the size radii = radii.map(t => t.enumerate().map(((i, v)) => { calc.max(0, calc.min(if type(v) == ratio { v * size.at(i) / 100% } else { v }, size.at(i) / 2)) })) let (nw, ne, sw, se) = radii return ( north-west: nw, north-east: ne, south-west: sw, south-east: se, ) } /// Sort list of points/vectors by distance to base /// - base (vector): Vector to measure distance to /// - pts (array of vector): List of points /// -> array Sorted list of points #let sort-points-by-distance(base, pts) = { if pts.len() == 1 { return pts } // Sort by transforming points into tuples of (point, distance), // sorting them by key 1 and then transforming them back to points. return pts.map(p => { return (p, vector.dist(p, base)) }) .sorted(key: t => t.at(1)) .map(t => t.at(0)) } /// Resolves a stroke into a usable dictionary with all fields that are missing or auto set to their defaults #let resolve-stroke(stroke) = { if stroke == none { return (paint: none, thickness: 0pt, join: none, cap: none, miter-limit: 4) } let default = ( paint: black, thickness: 1pt, join: "miter", cap: "butt", miter-limit: 4 ) let s = line(stroke: stroke).stroke let stroke = (:) for (k, v) in (paint: s.paint, thickness: s.thickness, join: s.join, cap: s.cap, miter-limit: s.miter-limit) { if v == auto { stroke.insert(k, default.at(k)) } else { stroke.insert(k, v) } } return stroke }
https://github.com/wagaaa/HZAU_Typst
https://raw.githubusercontent.com/wagaaa/HZAU_Typst/main/dependents/style.typ
typst
MIT License
#import "@preview/indenta:0.0.3": fix-indent //修复图表后不缩进 #let heiti = ("Times New Roman", "Heiti SC", "Heiti TC", "SimHei") #let songti = ("Times New Roman", "Songti SC", "Songti TC", "SimSun") #let zhongsong = ("Times New Roman","STZhongsong", "SimSun") //中文章节名称 #let num_cn(num, standalone: false) = if num < 11 { ("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十").at(num) } else if num < 100 { if calc.rem(num, 10) == 0 { num(calc.floor(num / 10)) + "十" } else if num < 20 and standalone { "十" + num_cn(calc.rem(num, 10)) } else { num_cn(calc.floor(num / 10)) + "十" + num_cn(calc.rem(num, 10)) } } else if num < 1000 { let left = num_cn(calc.floor(num / 100)) + "百" if calc.rem(num, 100) == 0 { left } else if calc.rem(num, 100) < 10 { left + "零" + num_cn(calc.rem(num, 100)) } else { left + num_cn(calc.rem(num, 100)) } } else { let left = num_cn(calc.floor(num / 1000)) + "千" if calc.rem(num, 1000) == 0 { left } else if calc.rem(num, 1000) < 10 { left + "零" + num_cn(calc.rem(num, 1000)) } else if calc.rem(num, 1000) < 100 { left + "零" + num_cn(calc.rem(num, 1000)) } else { left + num_cn(calc.rem(num, 1000)) } } #let appendixcounter = counter("appendix") #let numing_cn(..nums, location: none, brackets: false) = locate(loc => { let actual_loc = if location == none { loc } else { location } if appendixcounter.at(actual_loc).first() < 10 { if nums.pos().len() == 1 { "第" + num_cn(nums.pos().first(), standalone: true) + "章" } else { numbering(if brackets { "(1.1)" } else { "1.1" }, ..nums) } } else { if nums.pos().len() == 1 { "附录 " + numbering("A.1", ..nums) } else { numbering(if brackets { "(A.1)" } else { "A.1" }, ..nums) } } }) // 目录 #let partcounter = counter("part") #let cn_outline(title: "目录", depth: none, indent: false) = { align(center)[ #heading(title, numbering: none, outlined: false) ] v(2em) set par(leading: 1.24em, first-line-indent: 0pt) set text(font: songti, size: 14pt) locate(it => { let elements = query(heading.where(outlined: true).after(it), it) for el in elements { // Skip list of images and list of tables if partcounter.at(el.location()).first() < 20 and el.numbering == none { continue } // Skip headings that are too deep if depth != none and el.level > depth { continue } let maybe_number = if el.numbering != none { if el.numbering == numing_cn { numing_cn(..counter(heading).at(el.location()), location: el.location()) } else { numbering(el.numbering, ..counter(heading).at(el.location())) } h(0.5em) } let line = { if indent { h(1em * (el.level - 1 )) } // if el.level == 1 { // v(0.5em, weak: true) // } if maybe_number != none { style(styles => { box( link(el.location(), if el.level == 1 { strong(maybe_number) } else { maybe_number }) ) }) } link(el.location(), if el.level == 1 { strong(el.body) } else { el.body }) // Filler dots if el.level == 1 { box(width: 1fr, h(10pt) + box(width: 1fr, repeat[.]) + h(10pt)) } else { box(width: 1fr, h(10pt) + box(width: 1fr, repeat[.]) + h(10pt)) } // Page number let page_number = { counter(page).at(el.location()).first() } link(el.location(), if el.level == 1 { strong(str(page_number)) } else { str(page_number) }) linebreak() v(-0.2em) } line } }) } #let empty_par() = { v(-1em) box() } #let project( title: "文献标题", title_en: "Title of thi Thiese", degree: "硕士", class: "2023", abstract_cn: "中文文献", abstract_en: "英文文献", keywords_zh: (), keywords_en: (), colleage: "信息学院", candidate: "张三", candidate_en: "<NAME>", id: "2021301987654", major: "人工智能", major_en: "ARTIFICIAL INTELLEGENCE", supervisor: "李四", supervisor_en: "<NAME>", date_cn:"二〇二三年六月", date_en: "JUNE, 2023", sup_group:("王五","赵六","陈七","郭八"), body, ) = { //页面属性 set page(paper: "a4", margin: ( top: 2.5cm, bottom: 2.5cm, left: 3.2cm, right: 2.5cm )) // 封面 align(center)[ #image("/assets/HZAU_LOGO.png", width: 60%, height: 8%) #text( size: 16pt, font: zhongsong, weight: "bold" )[HUAZHONG AGRICULTURAL UNIVERSITY] #par()[ #text( size: 36pt, font: heiti )[ #degree#[学位论文] ] #text( size: 18pt, font: zhongsong, weight: "bold" )[ #if degree=="学士" { [BACHELOR'S DEGREE DISSERTATION] } else if degree=="硕士" { [MASTER'S DEGREE DISSERTATION] } else{ [DOCTOR'S GREE DISSERTATION] } ] ] #text( font: heiti, size: 22pt, weight: "bold" )[ #title ] #text( font: heiti, size: 22pt, weight: "bold" )[ #title_en ] #v(5pt) // Author Infos #let info_key(body) = { rect(width: 100%, inset: 2pt, stroke: none, text( font: songti, size: 18pt, weight: "bold", body )) } #let sub_info_key(body) = { rect(width: 100%, inset: 2pt, stroke: none, text( font: songti, size: 16pt, weight: "bold", body )) } #table( columns: (40%, 40%), align: (left + horizon), stroke: none, gutter: 0pt, [ #info_key("研究生:") #sub_info_key("CANDIDATE: ") ],[ #info_key(candidate) #sub_info_key(candidate_en) ], [ #info_key("学号:") #sub_info_key("STUDENT NO.: ") ],[ #info_key(id) ], [ #info_key("专业:") #sub_info_key("MAJOR: ") ],[ #info_key(major) #sub_info_key(major_en) ], [ #info_key("导师:") #sub_info_key("SUPERVISOR: ") ],[ #info_key(supervisor) #sub_info_key(supervisor_en) ] ) #v(8pt) #par(justify: false,leading: 0pt)[ #text( font: songti, size: 16pt, )[ 中国 武汉 WUHAN, CHINA #date_cn #date_en ]] #pagebreak() ] //内封面 align(center)[ #v(40pt) #text( font: songti, weight: "bold", size: 24pt )[ #[华中农业大学]#degree#[学位论文] #v(40pt) ] #text( font: heiti, weight: "bold", size: 18pt, )[ #title #title_en ] #v(30pt) #set text( font: songti, size: 16pt, weight: "bold" ) #table( columns: (20%, 20%), stroke: none, align: left, gutter: 12pt, [研究生:],[#candidate], [学号:],[#id], [指导教师:],[#supervisor], [指导小组:], [ #for c in sup_group [ #c ] ]) #v(6em) #table( columns: (55%, 45%), align: left, stroke: none, [专业:#major],[研究方向:submajor], [获得学位名称:],[获得学位时间:] ) #v(2em) #text( font: songti, size: 16pt, )[ #colleage #date_cn ] ] pagebreak() set page( footer: { set align(center) text(font: songti, 10pt, baseline: -3pt, counter(page).display("I")) } ) counter(page).update(1) //显示目录 cn_outline( title: "目录", depth: 3, indent: true, ) pagebreak() set page( footer: { set align(center) text(font: songti, 10pt, baseline: -3pt, counter(page).display("i")) } ) //摘要 let zh_abstract_page(abstract, keywords: ()) = { set heading(level: 1, numbering: none,outlined: false) show <_zh_abstract_>: { align(center)[ #text(font: heiti, size: 18pt, "摘  要") ] } [= 摘要 <_zh_abstract_>] set text(font: songti, size: 12pt) abstract par(first-line-indent: 0em)[ #text(weight: "bold", font: heiti, size: 12pt)[ 关键词: #keywords.join(";") ] ] } let en_abstract_page(abstract, keywords: ()) = { set heading(level: 1, numbering: none,outlined: false) show <_en_abstract_>: { align(center)[ #text(font: heiti, size: 18pt, "Abstract") ] } [= Abstract <_en_abstract_>] set text(font: songti, size: 12pt) abstract par(first-line-indent: 0em)[ #text(weight: "bold", font: heiti, size: 12pt)[ Key Words: #keywords.join("; ") ] ] } //页眉 set page(header: locate(loc => { set text(font: songti, 10pt, baseline: 8pt, spacing: 3pt) set align(center) if calc.even(loc.page()) { title } else { [华中农业大学]+class+[届]+degree+[研究生学位(毕业)论文] } line(length: 100%, stroke: 0.7pt) })) //设置编号格式 set heading(numbering: numing_cn) show heading: set text(font: heiti) show heading.where(level: 1): it => { set text(weight: "bold", font: heiti, size: 16pt) set block(spacing: 1.5em) it } show heading.where(level: 2): it => { set text(weight: "bold", font: heiti, size: 15pt) set block(above: 1.5em, below: 1.5em) it } show heading.where(level: 3): it => { set text(weight: "bold", font: heiti, size: 14pt) set block(above: 1.5em, below: 1.5em) it } show heading: it => { set text(weight: "bold", font: heiti, size: 12pt) set block(above: 1.5em, below: 1.5em) it } + empty_par() //设置段落格式 set par(justify: true, leading: 1.24em, first-line-indent: 2em) show par: set block(spacing: 1.24em) //------内容部分------ //简介部分 //修正页码 counter(page).update(1) zh_abstract_page(abstract_cn, keywords: keywords_zh) pagebreak() en_abstract_page(abstract_en, keywords: keywords_en) pagebreak() set page( footer: { set align(center) text(font: songti, 10pt, baseline: -3pt, counter(page).display("1") ) } ) counter(page).update(1) set text(font: songti, size: 12pt) body }
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/lib/binary.typ
typst
MIT License
#let binary(x, min-length: none) = { assert(type(x) == int, message: "expected `x` to have type `int`, but got " + type(x)) let bits = () while x != 0 { let is-odd = calc.rem(x, 2) == 1 if is-odd { bits.push(1) } else { bits.push(0) } // Divide x by 2 to process the next bit x = calc.floor(x / 2) } // If no bits were added (i.e., x was 0), add a single 0 bit if bits.len() == 0 { bits.push(0) } // Reverse the bits to get the correct binary representation let bits = bits.rev() if min-length != none and bits.len() < min-length { bits = range(min-length - bits.len()).map(_ => 0) + bits } bits } #let hamming-distance(a, b, n: 32) = { binary(a, min-length: n) .zip(binary(b, min-length: n)) .fold(0, (acc, pair) => acc + if pair.at(0) != pair.at(1) { 1 } else { 0 } ) } #let popcount(x) = binary(x).sum()
https://github.com/Hobr/njust_thesis_typst_template
https://raw.githubusercontent.com/Hobr/njust_thesis_typst_template/main/lib.typ
typst
MIT License
// 包 #import "util/package.typ": * // 样式 #import "layout/xgsLesson.typ": xgsLesson, setPage // 字体 #import "util/font.typ": fonts, fontSize // 页面 #import "page/cover.typ": showCover #import "page/header.typ": showTitle, showAuthor #import "page/abstract.typ": showAbstract #import "page/content.typ": showContent #import "page/reference.typ": showReference #let njustThesis( // 类型 type: "xgsLesson", // 信息 info: ( // 标题 title: "题目", titleEn: none, // 摘要 abstract: none, abstractEn: none, // 关键词 keywords: none, keywordsEn: none, // 日期 date: none, // 语言 lang: "zh" ), // 作者 author: (), // 指导老师 supervisor: (), // 参考文献 reference: none, // 双面打印 twoside: false, // 正文 body, ) = { // ----- 预设 show: xgsLesson.with(info, author) // 伪粗体 show: show-cn-fakebold // 伪斜体 show emph: text.with(font: (fonts.en, fonts.zh_楷体)) // 页面, 无页眉页脚 show: setPage.with(info.title, header: false, footer: false) // ----- 封面 // 封面 showCover(info, author) pagebreak(weak: true) // 声明 // showDeclare() // 页面, 无页脚有页眉 show: setPage.with(info.title, header: true, footer: false) // 中文 // 标题 showTitle(info.title) v(8mm, weak: true) // 作者 showAuthor(author) v(8mm, weak: true) // 摘要 showAbstract(info.abstract, keywords: info.keywords, lang: "zh") v(8mm, weak: true) // 英文 // 标题 showTitle(info.titleEn) v(8mm, weak: true) // 摘要 showAbstract(info.abstractEn, keywords: info.keywordsEn, lang: "en") v(8mm, weak: true) // 目录 // showToc() pagebreak(weak: true) outline(indent: auto) pagebreak(weak: true) // 页面, 有页眉页脚 show: setPage.with(info.title, header: true, footer: true) // ----- 正文 counter(page).update(1) showContent(body + showReference(reference)) // 致谢 // showAck() // 参考文献 // showReference() // 附录 // showAppendix() }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-0900.typ
typst
Apache License 2.0
#let data = ( ("DEVANAGARI SIGN INVERTED CANDRABINDU", "Mn", 0), ("DEVANAGARI SIGN CANDRABINDU", "Mn", 0), ("DEVANAGARI SIGN ANUSVARA", "Mn", 0), ("DEVANAGARI SIGN VISARGA", "Mc", 0), ("DEVANAGARI LETTER SHORT A", "Lo", 0), ("DEVANAGARI LETTER A", "Lo", 0), ("DEVANAGARI LETTER AA", "Lo", 0), ("DEVANAGARI LETTER I", "Lo", 0), ("DEVANAGARI LETTER II", "Lo", 0), ("DEVANAGARI LETTER U", "Lo", 0), ("DEVANAGARI LETTER UU", "Lo", 0), ("DEVANAGARI LETTER VOCALIC R", "Lo", 0), ("DEVANAGARI LETTER VOCALIC L", "Lo", 0), ("DEVANAGARI LETTER CANDRA E", "Lo", 0), ("DEVANAGARI LETTER SHORT E", "Lo", 0), ("DEVANAGARI LETTER E", "Lo", 0), ("DEVANAGARI LETTER AI", "Lo", 0), ("DEVANAGARI LETTER CANDRA O", "Lo", 0), ("DEVANAGARI LETTER SHORT O", "Lo", 0), ("DEVANAGARI LETTER O", "Lo", 0), ("DEVANAGARI LETTER AU", "Lo", 0), ("DEVANAGARI LETTER KA", "Lo", 0), ("DEVANAGARI LETTER KHA", "Lo", 0), ("DEVANAGARI LETTER GA", "Lo", 0), ("DEVANAGARI LETTER GHA", "Lo", 0), ("DEVANAGARI LETTER NGA", "Lo", 0), ("DEVANAGARI LETTER CA", "Lo", 0), ("DEVANAGARI LETTER CHA", "Lo", 0), ("DEVANAGARI LETTER JA", "Lo", 0), ("DEVANAGARI LETTER JHA", "Lo", 0), ("DEVANAGARI LETTER NYA", "Lo", 0), ("DEVANAGARI LETTER TTA", "Lo", 0), ("DEVANAGARI LETTER TTHA", "Lo", 0), ("DEVANAGARI LETTER DDA", "Lo", 0), ("DEVANAGARI LETTER DDHA", "Lo", 0), ("DEVANAGARI LETTER NNA", "Lo", 0), ("DEVANAGARI LETTER TA", "Lo", 0), ("DEVANAGARI LETTER THA", "Lo", 0), ("DEVANAGARI LETTER DA", "Lo", 0), ("DEVANAGARI LETTER DHA", "Lo", 0), ("DEVANAGARI LETTER NA", "Lo", 0), ("DEVANAGARI LETTER NNNA", "Lo", 0), ("DEVANAGARI LETTER PA", "Lo", 0), ("DEVANAGARI LETTER PHA", "Lo", 0), ("DEVANAGARI LETTER BA", "Lo", 0), ("DEVANAGARI LETTER BHA", "Lo", 0), ("DEVANAGARI LETTER MA", "Lo", 0), ("DEVANAGARI LETTER YA", "Lo", 0), ("DEVANAGARI LETTER RA", "Lo", 0), ("DEVANAGARI LETTER RRA", "Lo", 0), ("DEVANAGARI LETTER LA", "Lo", 0), ("DEVANAGARI LETTER LLA", "Lo", 0), ("DEVANAGARI LETTER LLLA", "Lo", 0), ("DEVANAGARI LETTER VA", "Lo", 0), ("DEVANAGARI LETTER SHA", "Lo", 0), ("DEVANAGARI LETTER SSA", "Lo", 0), ("DEVANAGARI LETTER SA", "Lo", 0), ("DEVANAGARI LETTER HA", "Lo", 0), ("DEVANAGARI VOWEL SIGN OE", "Mn", 0), ("DEVANAGARI VOWEL SIGN OOE", "Mc", 0), ("DEVANAGARI SIGN NUKTA", "Mn", 7), ("DEVANAGARI SIGN AVAGRAHA", "Lo", 0), ("DEVANAGARI VOWEL SIGN AA", "Mc", 0), ("DEVANAGARI VOWEL SIGN I", "Mc", 0), ("DEVANAGARI VOWEL SIGN II", "Mc", 0), ("DEVANAGARI VOWEL SIGN U", "Mn", 0), ("DEVANAGARI VOWEL SIGN UU", "Mn", 0), ("DEVANAGARI VOWEL SIGN VOCALIC R", "Mn", 0), ("DEVANAGARI VOWEL SIGN VOCALIC RR", "Mn", 0), ("DEVANAGARI VOWEL SIGN CANDRA E", "Mn", 0), ("DEVANAGARI VOWEL SIGN SHORT E", "Mn", 0), ("DEVANAGARI VOWEL SIGN E", "Mn", 0), ("DEVANAGARI VOWEL SIGN AI", "Mn", 0), ("DEVANAGARI VOWEL SIGN CANDRA O", "Mc", 0), ("DEVANAGARI VOWEL SIGN SHORT O", "Mc", 0), ("DEVANAGARI VOWEL SIGN O", "Mc", 0), ("DEVANAGARI VOWEL SIGN AU", "Mc", 0), ("DEVANAGARI SIGN VIRAMA", "Mn", 9), ("DEVANAGARI VOWEL SIGN PRISHTHAMATRA E", "Mc", 0), ("DEVANAGARI VOWEL SIGN AW", "Mc", 0), ("DEVANAGARI OM", "Lo", 0), ("DEVANAGARI STRESS SIGN UDATTA", "Mn", 230), ("DEVANAGARI STRESS SIGN ANUDATTA", "Mn", 220), ("DEVANAGARI GRAVE ACCENT", "Mn", 230), ("DEVANAGARI ACUTE ACCENT", "Mn", 230), ("DEVANAGARI VOWEL SIGN CANDRA LONG E", "Mn", 0), ("DEVANAGARI VOWEL SIGN UE", "Mn", 0), ("DEVANAGARI VOWEL SIGN UUE", "Mn", 0), ("DEVANAGARI LETTER QA", "Lo", 0), ("DEVANAGARI LETTER KHHA", "Lo", 0), ("DEVANAGARI LETTER GHHA", "Lo", 0), ("DEVANAGARI LETTER ZA", "Lo", 0), ("DEVANAGARI LETTER DDDHA", "Lo", 0), ("DEVANAGARI LETTER RHA", "Lo", 0), ("DEVANAGARI LETTER FA", "Lo", 0), ("DEVANAGARI LETTER YYA", "Lo", 0), ("DEVANAGARI LETTER VOCALIC RR", "Lo", 0), ("DEVANAGARI LETTER VOCALIC LL", "Lo", 0), ("DEVANAGARI VOWEL SIGN VOCALIC L", "Mn", 0), ("DEVANAGARI VOWEL SIGN VOCALIC LL", "Mn", 0), ("DEVANAGARI DANDA", "Po", 0), ("DEVANAGARI DOUBLE DANDA", "Po", 0), ("DEVANAGARI DIGIT ZERO", "Nd", 0), ("DEVANAGARI DIGIT ONE", "Nd", 0), ("DEVANAGARI DIGIT TWO", "Nd", 0), ("DEVANAGARI DIGIT THREE", "Nd", 0), ("DEVANAGARI DIGIT FOUR", "Nd", 0), ("DEVANAGARI DIGIT FIVE", "Nd", 0), ("DEVANAGARI DIGIT SIX", "Nd", 0), ("DEVANAGARI DIGIT SEVEN", "Nd", 0), ("DEVANAGARI DIGIT EIGHT", "Nd", 0), ("DEVANAGARI DIGIT NINE", "Nd", 0), ("DEVANAGARI ABBREVIATION SIGN", "Po", 0), ("DEVANAGARI SIGN HIGH SPACING DOT", "Lm", 0), ("DEVANAGARI LETTER CANDRA A", "Lo", 0), ("DEVANAGARI LETTER OE", "Lo", 0), ("DEVANAGARI LETTER OOE", "Lo", 0), ("DEVANAGARI LETTER AW", "Lo", 0), ("DEVANAGARI LETTER UE", "Lo", 0), ("DEVANAGARI LETTER UUE", "Lo", 0), ("DEVANAGARI LETTER MARWARI DDA", "Lo", 0), ("DEVANAGARI LETTER ZHA", "Lo", 0), ("DEVANAGARI LETTER HEAVY YA", "Lo", 0), ("DEVANAGARI LETTER GGA", "Lo", 0), ("DEVANAGARI LETTER JJA", "Lo", 0), ("DEVANAGARI LETTER GLOTTAL STOP", "Lo", 0), ("DEVANAGARI LETTER DDDA", "Lo", 0), ("DEVANAGARI LETTER BBA", "Lo", 0), )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2400.typ
typst
Apache License 2.0
#let data = ( ("SYMBOL FOR NULL", "So", 0), ("SYMBOL FOR START OF HEADING", "So", 0), ("SYMBOL FOR START OF TEXT", "So", 0), ("SYMBOL FOR END OF TEXT", "So", 0), ("SYMBOL FOR END OF TRANSMISSION", "So", 0), ("SYMBOL FOR ENQUIRY", "So", 0), ("SYMBOL FOR ACKNOWLEDGE", "So", 0), ("SYMBOL FOR BELL", "So", 0), ("SYMBOL FOR BACKSPACE", "So", 0), ("SYMBOL FOR HORIZONTAL TABULATION", "So", 0), ("SYMBOL FOR LINE FEED", "So", 0), ("SYMBOL FOR VERTICAL TABULATION", "So", 0), ("SYMBOL FOR FORM FEED", "So", 0), ("SYMBOL FOR CARRIAGE RETURN", "So", 0), ("SYMBOL FOR SHIFT OUT", "So", 0), ("SYMBOL FOR SHIFT IN", "So", 0), ("SYMBOL FOR DATA LINK ESCAPE", "So", 0), ("SYMBOL FOR DEVICE CONTROL ONE", "So", 0), ("SYMBOL FOR DEVICE CONTROL TWO", "So", 0), ("SYMBOL FOR DEVICE CONTROL THREE", "So", 0), ("SYMBOL FOR DEVICE CONTROL FOUR", "So", 0), ("SYMBOL FOR NEGATIVE ACKNOWLEDGE", "So", 0), ("SYMBOL FOR SYNCHRONOUS IDLE", "So", 0), ("SYMBOL FOR END OF TRANSMISSION BLOCK", "So", 0), ("SYMBOL FOR CANCEL", "So", 0), ("SYMBOL FOR END OF MEDIUM", "So", 0), ("SYMBOL FOR SUBSTITUTE", "So", 0), ("SYMBOL FOR ESCAPE", "So", 0), ("SYMBOL FOR FILE SEPARATOR", "So", 0), ("SYMBOL FOR GROUP SEPARATOR", "So", 0), ("SYMBOL FOR RECORD SEPARATOR", "So", 0), ("SYMBOL FOR UNIT SEPARATOR", "So", 0), ("SYMBOL FOR SPACE", "So", 0), ("SYMBOL FOR DELETE", "So", 0), ("BLANK SYMBOL", "So", 0), ("OPEN BOX", "So", 0), ("SYMBOL FOR NEWLINE", "So", 0), ("SYMBOL FOR DELETE FORM TWO", "So", 0), ("SYMBOL FOR SUBSTITUTE FORM TWO", "So", 0), ("SYMBOL FOR DELETE SQUARE CHECKER BOARD FORM", "So", 0), ("SYMBOL FOR DELETE RECTANGULAR CHECKER BOARD FORM", "So", 0), ("SYMBOL FOR DELETE MEDIUM SHADE FORM", "So", 0), )
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/examples/exam-table-content.typ
typst
MIT License
#import "../src/lib.typ": * #show: g-exam.with( author: ( name: "<NAME>,", email: "<EMAIL>", watermark: "Teacher: Peter", ), school: ( name: "Sunrise Secondary School", logo: read("./logo.png", encoding: none), ), exam-info: ( academic-period: "Academic year 2023/2024", academic-level: "1st Secondary Education", academic-subject: "Mathematics", number: "2nd Assessment 1st Exam", content: "Radicals and fractions", model: "Model A" ), language: "en", decimal-separator: ",", date: "November 21, 2023", show-student-data: "first-page", show-grade-table: true, question-points-position: left, clarifications: "Answer the questions in the spaces provided. If you run out of room for an answer, continue on the back of the page." ) #g-question(points:2.5)[Is it true that $x^n + y^n = z^n$ if $(x,y,z)$ and $n$ are positive integers?. Explain.] #v(1fr) #g-question(points:2.5)[Prove that the real part of all non-trivial zeros of the function $zeta(z) "is" 1/2$]. #v(1fr) #g-question(points:2)[Compute $ integral_0^infinity (sin(x))/x $ ] #v(1fr)
https://github.com/alex-touza/fractal-explorer
https://raw.githubusercontent.com/alex-touza/fractal-explorer/main/paper/planning/full-de-ruta.typ
typst
#set text(font: "New Computer Modern", lang: "ca") = Estructura detallada del Treball de Recerca == Objectiu principal Descobrir la base matemàtica dels fractals: quins hi ha, per què fan les formes que fan i com es poden representar. == Àmbits del treball - *Matemàtica avançada.* Anàlisi dels fractals; per què fan les formes que fan; d'on venen, quins elements matemàtics utilitzen. - Topologia. - Geometria. - *Algorísmia.* Anàlisi dels algoritmes de representació de fractals. - *Programació web.* Mostrar els fractals i informació sobre ells en un suport web interactiu. == Fractals L'explicació dels fractals no s'ha de limitar a exposar les fórmules que els generen, sinó que també ha d'aprofundir en què és el que està passant realment. Per exemple, https://medium.com/@atondelier/back-to-webgl-with-the-mandelbrot-set-2840c865113e https://www.fractal.garden/mandelbrot - Fractal de Newton - Conjunt de Mandelbrot - Conjunt de Julia - Atractor de Lorentz (explicar també el seu context, i.e. la teoria del caos) == Estudi teòric dels fractals - http://www.numdam.org/article/ASENS_1985_4_18_2_287_0.pdf - https://users.math.yale.edu/public_html/People/frame/Fractals/ (vegeu `bib.yaml` per veure) La font principal per a la part teòrica serà el llibre Fractal Geometry: Mathematical Foundations and Applications de <NAME>, ja que té un capítol sencer dedicat a la base matemàtica necessària per entendre el desenvolupament matemàtic dels fractals. == Representació dels fractals No limitar-se a mostrar els fractals, sinó oferir una immersió tant visual com matemàtica en ells; això és el que afegeix la meva part pràctica a la resta de múltiples representacions de fractals. Estudi anterior de la complexitat temporal i lineal dels algoritmes per representar-los. === Entorn La representació es farà en una pàgina web. Això pot semblar no tant formal o rigorós com utilitzar llenguatges com Python o C++ i fer-ho localment, però d'aquesta forma la representació es pot dur a terme a qualsevol dispositiu. A més, la interacció amb l'usuari i el disseny de la interfície són més fàcils de desenvolupar en un entorn web. Es farà en TypeScript, ja que la comprovació estàtica de tipus és indubtablement millor. === Mètode de generació dels gràfics He explorat Three.js, però Utilitzar Three.js per a una representació plana pot afectar el rendiment, així que he cercat altres _frameworks_ per a dues dimensions. He explorat l'ús de Pixi.js, que sembla que és el més utilitzat. Aquest, però, no està del tot adaptat per a ser usat per a un renderitzat pixel per pixel. És important que la representació dels fractals utilitzi els mètodes més eficients. Per aquest motiu, potser no és adequat l'ús d'una llibreria. El cert _overhead_ que afegeixen les llibreries com Pixi.js fa pensar que* la millor opció és utilitzar directament la API de WebGL* (també hi ha WebGPU, que aprofita la potència de les targetes gràfiques més modernes, però la seva compatibilitat és reduïda). A més, el fet de fer-ho tot des de zero també és una forma d'aprendre més.
https://github.com/TomPlanche/typst-template
https://raw.githubusercontent.com/TomPlanche/typst-template/main/README.md
markdown
MIT License
# [Typst](https://typst.app) template. This template is bases from [hzkonor's](https://github.com/hzkonor/bubble-template). It uses [CNAM](https://www.cnam.fr/)'s logo and colors. ## Result <div style="display: flex; justify-content: center;"> <img src="./preview.png" width="100%"> </div>
https://github.com/ns-shop/ns-shop-typst
https://raw.githubusercontent.com/ns-shop/ns-shop-typst/main/fonts/template.typ
typst
#let textSize = 14pt #let tabSize = 1cm #let prefixh1 = "CHƯƠNG" #let h1(children, numbering: true, pageBreak: true) = { if (pageBreak) [#pagebreak()] set align(center) heading( level: 1, numbering: if (numbering) {(..nums) => text( size: textSize, weight: "bold", prefixh1+" "+nums.pos().map(str).join(".")+"." )} else {none}, upper(text(size: textSize, weight: "bold", children)), ) } #let h2(children) = { heading( level: 2, numbering: (..nums) => text(size: textSize, weight: "bold", nums.pos().map(str).join(".")+"."), text(size: textSize, weight: "bold", children) ) } #let h3(children) = { heading( level: 3, numbering: (..nums) => text(size: textSize, style: "italic", weight: "regular", h(1cm)+nums.pos().map(str).join(".")+"."), text(size: textSize, style: "italic", weight: "regular", children) ) } #let h4(children) = { heading( level: 4, numbering: (..nums) => text(size: textSize, style: "italic", weight: "regular", h(1cm)+nums.pos().map(str).join(".")+"."), text(size: textSize, style: "italic", weight: "regular", children) ) } #let img(src, cap: "", width: 100%) = { src = "images/" + src figure( image(src, width: width), caption: cap, supplement: "Hình" ) } #let tabl(..fields, cap: false) = { if type(cap) == "string" { block(height: -(2 * textSize)) figure(caption: cap, supplement: "Bảng", table()) block(height: -(2 * textSize)) } table(inset: 10pt, align: left, ..fields) } #let template(body) = { set page("a4", margin: (top: 2cm, right: 2cm, bottom: 2cm, left: 3cm)) set text( size: textSize, font: ("Times New Roman"), fallback: false, region: "VN") set block(inset: 0pt, outset: 0pt, above: 0pt, below: 1.5 * textSize) set par( justify: true, leading: textSize, // 1.5 lines first-line-indent: tabSize, ) set list( indent: tabSize, body-indent: .75em, marker: ([•], [◦], [--]), tight: true, ) set enum( indent: tabSize, body-indent: .75em, tight: true, ) show heading: it => { set block(below: 1.5 * textSize) it block(height: -(3 * textSize)) par("") } show list: it => { set par(hanging-indent: -(2 * tabSize - 0.75em)) it block(height: -(3.5 * textSize)) par("") } show enum: it => { set par(hanging-indent: -(2 * tabSize - 0.75em)) it block(height: -(3.5 * textSize)) par("") } show figure: it => { it block(height: -(2.5 * textSize)) par("") } show table: it => { it block(height: -(3 * textSize)) par("") } show raw.where(block: true): it => { set par(justify: false, leading: 8pt) set text(size: 8pt) grid( columns: (100%, 100%), column-gutter: -100%, block(radius: 0em, fill: luma(246), stroke: 1pt, width: 100%, inset: 1em, it), ) block(height: -(3 * textSize)) par("") } body }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/calc-38.typ
typst
Other
// Error: 11-14 expected integer, found float #range(1, 2.0)
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/crates/reflexo-vfs/README.md
markdown
Apache License 2.0
# reflexo-vfs Vfs for reflexo. See [Typst.ts](https://github.com/Myriad-Dreamin/typst.ts)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-16E40.typ
typst
Apache License 2.0
#let data = ( ("MEDEFAIDRIN CAPITAL LETTER M", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER S", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER V", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER W", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER ATIU", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER Z", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER KP", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER P", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER T", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER G", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER F", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER I", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER K", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER A", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER J", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER E", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER B", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER C", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER U", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER YU", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER L", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER Q", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER HP", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER NY", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER X", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER D", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER OE", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER N", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER R", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER O", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER AI", "Lu", 0), ("MEDEFAIDRIN CAPITAL LETTER Y", "Lu", 0), ("MEDEFAIDRIN SMALL LETTER M", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER S", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER V", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER W", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER ATIU", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER Z", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER KP", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER P", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER T", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER G", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER F", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER I", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER K", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER A", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER J", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER E", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER B", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER C", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER U", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER YU", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER L", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER Q", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER HP", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER NY", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER X", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER D", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER OE", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER N", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER R", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER O", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER AI", "Ll", 0), ("MEDEFAIDRIN SMALL LETTER Y", "Ll", 0), ("MEDEFAIDRIN DIGIT ZERO", "No", 0), ("MEDEFAIDRIN DIGIT ONE", "No", 0), ("MEDEFAIDRIN DIGIT TWO", "No", 0), ("MEDEFAIDRIN DIGIT THREE", "No", 0), ("MEDEFAIDRIN DIGIT FOUR", "No", 0), ("MEDEFAIDRIN DIGIT FIVE", "No", 0), ("MEDEFAIDRIN DIGIT SIX", "No", 0), ("MEDEFAIDRIN DIGIT SEVEN", "No", 0), ("MEDEFAIDRIN DIGIT EIGHT", "No", 0), ("MEDEFAIDRIN DIGIT NINE", "No", 0), ("MEDEFAIDRIN NUMBER TEN", "No", 0), ("MEDEFAIDRIN NUMBER ELEVEN", "No", 0), ("MEDEFAIDRIN NUMBER TWELVE", "No", 0), ("MEDEFAIDRIN NUMBER THIRTEEN", "No", 0), ("MEDEFAIDRIN NUMBER FOURTEEN", "No", 0), ("MEDEFAIDRIN NUMBER FIFTEEN", "No", 0), ("MEDEFAIDRIN NUMBER SIXTEEN", "No", 0), ("MEDEFAIDRIN NUMBER SEVENTEEN", "No", 0), ("MEDEFAIDRIN NUMBER EIGHTEEN", "No", 0), ("MEDEFAIDRIN NUMBER NINETEEN", "No", 0), ("MEDEFAIDRIN DIGIT ONE ALTERNATE FORM", "No", 0), ("MEDEFAIDRIN DIGIT TWO ALTERNATE FORM", "No", 0), ("MEDEFAIDRIN DIGIT THREE ALTERNATE FORM", "No", 0), ("MEDEFAIDRIN COMMA", "Po", 0), ("MEDEFAIDRIN FULL STOP", "Po", 0), ("MEDEFAIDRIN SYMBOL AIVA", "Po", 0), ("MEDEFAIDRIN EXCLAMATION OH", "Po", 0), )
https://github.com/Turkeymanc/notebook
https://raw.githubusercontent.com/Turkeymanc/notebook/main/README.md
markdown
# Notebookinator Quick Start Template In order to use this template you'll need to make a new repository based off of this one. ![image](https://github.com/The-Notebookinator/quick-start-template/assets/75806385/18e038d1-fa42-47f2-afb1-05b70bb391d8) Once you do that, you have two options: - edit locally - edit in a codespace ### Edit in Codespace This is by far the easier option, but it is limited by the fact that you're editing your code in the cloud, leading to slower performance overall. To get started, click the create codespace button: ![image](https://github.com/The-Notebookinator/quick-start-template/assets/75806385/0b8a2c2b-e6b2-4099-aac2-49022fee93e9) Once you've done that, you're good to go! ### Edit Locally If you want to edit your notebook locally, you can use the [Devcontainers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) VSCode extension. Once you have it installed, press the button in the bottom left of VSCode to open the remote menu. ![image](https://github.com/The-Notebookinator/quick-start-template/assets/75806385/93efc90f-e498-4870-a47e-e76989881bf9) Then, select the `reopen in container` option. Once you do that, you're good to go! You can compile your notebook by typing the following command into the terminal: ```sh typst watch main.typ ``` ## Usage You can compile your notebook by typing the following command into the terminal: ```sh typst watch main.typ ``` ![image](https://github.com/The-Notebookinator/quick-start-template/assets/75806385/dfb1ded7-ffe3-4dcc-aec4-a15a27fbf3b2) The resulting PDF can be then viewed with the already installed PDF viewer. Alternatively you can view the live output in a separate tab with `typst-live`: ```sh typst-live main.typ ```
https://github.com/Enter-tainer/typst-ws
https://raw.githubusercontent.com/Enter-tainer/typst-ws/master/README.md
markdown
MIT License
# This repo has been moved to https://github.com/Enter-tainer/typst-preview-vscode ! # typst-ws Preview your typst file in instant. To use this in vscode, take a look at https://github.com/Enter-tainer/typst-preview-vscode https://user-images.githubusercontent.com/25521218/230773434-5f0137c5-db1a-488f-853e-5fac608efd32.mp4 ## Why not `typst watch` ? The bottleneck is the pdf viewer. `typst watch` is not fast enough to preview the pdf file in real time. (You may also choose faster pdf viewer like Zathura.) ## How? We follow the similar approach as typst.app, by rendering the doc to framebuffers. And send them through websocket to the browser. Note: Most of the code is directly copy-pasted from https://github.com/typst/typst/tree/main/cli ## Usage Install from source: ``` cargo run --release -- watch ./test.typ ``` Or download prebuilt binary: https://nightly.link/Enter-tainer/typst-ws/workflows/build/master Then open `index.html` in your browser. ## See also - https://github.com/Myriad-Dreamin/typst.ts
https://github.com/liamaxelrod/Resume
https://raw.githubusercontent.com/liamaxelrod/Resume/main/resume%202/content/skills.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cvSection, cvSkill, hBar #let metadata = yaml("../metadata.yml") #let cvSection = cvSection.with(metadata: metadata) #cvSection("Skills") #stack(spacing: 2em, cvSkill( type: [Languages], info: [English (native) #hBar() Swedish (intermediate)], ), cvSkill( type: [Programming Languages], info: [Tableau #hBar() Python (Pandas/Numpy) #hBar() PostgreSQL], ), cvSkill( type: [Frameworks & Libraries], info: [Tableau #hBar() Python (Pandas/Numpy) #hBar() PostgreSQL], ), cvSkill( type: [Developer Tools], info: [Swimming #hBar() Cooking #hBar() Reading], ), cvSkill( type: [Diagrams & Design], info: [Swimming #hBar() Cooking #hBar() Reading], ) )
https://github.com/saruman9/android_fuzzing_pres
https://raw.githubusercontent.com/saruman9/android_fuzzing_pres/master/slides.typ
typst
#import "@preview/polylux:0.3.1": * #import themes.simple: * #set text(font: ("Verdana", "Apple Color Emoji")) #show link: strong #show link: set text(fill: blue) #show: simple-theme.with() #show raw: set text(font: "JetBrainsMono NF") #show raw.where(block: true): it => { if it.text.first() == "$" { block(fill: luma(200), inset: 10pt, radius: 4pt, it) } else { block(fill: luma(240), inset: 10pt, radius: 4pt, it) } } #show figure.caption: emph #set figure(numbering: none) #show footnote.entry: set text(size: 0.7em) #set footnote.entry(gap: 0.3em) #show footnote: set text(blue) #let slideh(title, body) = { let deco-format(it) = text(size: .6em, fill: gray, it) set page( header: context { let sections = query(heading.where(level: 1, outlined: true).before(here())) let heads = query(heading.where(outlined: true).before(here())) if sections == () { if title == [] and sections.last().body != heads.last().body { deco-format(heads.last().body) } } else { if title == [] and sections.last().body != heads.last().body { deco-format(heads.last().body) } if title == [] or title.at("depth") != 1 { h(1fr); deco-format(sections.last().body) } } }, footer: context { deco-format({ simple-footer.get(); h(1fr); logic.logical-slide.display() }) }, footer-descent: 1em, header-ascent: 1em, ) set align(horizon) let full_body = [ #counter(footnote).update(0) #align(top, title) #align(horizon, body) ] logic.polylux-slide(full_body) } #title-slide[ = Vulnerability Research of Android apps:\ from 0 to 0-day using fuzzing #v(2em) #align(center, strong[DEF CON Russia | DCG7812]) #table(columns: (auto, auto), stroke: none, column-gutter: 10%, [ GitHub: #link("https://github.com/saruman9")[saruman9] ], [ Telegram: #link("https://t.me/dura_lex")[\@dura_lex] ] ) #align(center + bottom)[August 10, 2024] ] #slideh[== About me][ - *Vulnerability Researcher*: IoT, ICS, embedded, mobile, etc. - *System Developer*: tools for automatic analysis, observability systems, fuzzers, emulators, etc. ] #slideh[== Agenda ][ #outline(title: none) #text(size: .5em, fill: gray, [The further down the list, the more difficult it is...]) ] #slideh[== Background][ #line-by-line[ - Money - BugBounty - Mobile Applications, OSs, HW - Test Task ] ] #centered-slide[= Beginning] #slideh[== Disclaimer][ - No WEB vulnerabilities - No Java vulnerabilities - No vulnerabilities in protocols and specifications #pause - Memory corruptions - Binary vulnerabilities - RCE and data-only exploits ] #focus-slide[ Not about exploitation or a specific vulnerability/CVE, but the methodology #text(size: .5em, fill: gray, [Without meme, sry #emoji.face.tear]) ] #slideh[== APK Analysis][ What's interesting for me? Android manifest file: - Activities - Services - Broadcasts Receivers - Content Providers - Permissions ] #slideh[][ Resources: - Libraries - DSL parsers - Protocol Buffers files - Custom binary blobs ] #slideh[][ Java Decompilation: - Deobfuscation - Refactoring - Analysis (control-flow, data-flow, etc.) ] #slideh[][ Shared/Native Libraries --- my main target ] #slideh[== Is source code exist?][ - Telegram — YES - Viber — NO - WhatsApp — NO ] #centered-slide[= Telegram #v(2em) #image(height: 50%, "./images/Telegram_2019_Logo.svg") ] #slideh[== Why first?][ #line-by-line[ - Source Code --- #emoji.checkmark.box - BugBounty --- #emoji.checkmark.box - I'm a user of the app --- #emoji.checkmark.box ] ] #slideh[== Static Analysis][ - Manifest file --- #emoji.checkmark.box - Resources --- #emoji.crossmark ] #slideh[][ #set align(center) #table(columns: (40%, 20%, 40%), stroke: none, [ - Java - C++ ], text(size: 3em, sym.arrow.r.double), [Android Studio] ) ] #slideh[== Shared/Native libraries][ Ordered by the "low-hanging fruit" principle: + Legacy code + Self-written components + ... 5. Crypto implementation + ... 9. Popular open-source frameworks + RFC, protocols and manifests ] #slideh[== Plan][ + Translate the code architecture into a convenient format (mind map, graph, wiki, Zettelkasten, etc.) #pause + Identify the entry points and sinks #pause + Building attack vectors #pause + Isolating target components #pause + Analysis (fuzzing in our case) ] #slideh[== Attack Vectors & Components][ - File parsers and decoders - FLAC - GIF - Opus - Lottie (modified) ] #slideh[][ - Connection - `tgnet` - `TLObject` --- (de)serialization (legacy) - VoIP - `tgcalls` (legacy) - WebRTC (modified) - etc. ] #centered-slide[== Fuzzing] #slideh[=== Harness][ #table(columns: (30%, 15%, 15%, 40%), stroke: none, [Do you have the source code? #pause], [YES #emoji.checkmark.box #pause], [#text(size: 3em, sym.arrow.r.double)], [easy peasy lemon squeezy?..] ) ] #centered-slide[NO] #slideh[][ - Isolation is not always possible in complex components #pause - Behavior emulation (sockets, files, server, protocol, Java code, etc.) #pause - Legacy code is a legacy code #pause - Build for Android or for a host x86_64 POSIX machine? ] #slideh[==== Example. `tgnet`][ + Replace Android code + #strike[Modify]Write CMake file + Develop server #footnote[https://github.com/saruman9/tg_srv] (MTProto #footnote[https://github.com/saruman9/010_editor_templates]) and emulate Java code & socket file + Develop a MitM PoC attack for triaging ] #slideh[=== Fuzzers][ - AFL/AFL++ - libFuzzer / centipede / fuzztest - honggfuzz - LibAFL - etc. ] #slideh[== Catches][ - DoS - Leaks - Cryptography weaknesses - Vulnerabilities in open source components ] #slideh[== Summary][ - Not so interesting for the presentation, but important as a base - Not good BugBounty program - Good for a first research in this field - Many other methods of analysis can be applied ] #centered-slide[= Viber #v(2em) #image(width: 80%, "./images/Rakuten_Viber_logo_2020.svg") ] #slideh[== Sources][ - Препарируем Viber. Мини-гид по анализу приложений для Android #footnote[https://xakep.ru/2023/05/16/analyzing-viber/] #sym.copyright _Хакер_ - fuzzer + harness #footnote[https://github.com/saruman9/viber_linkparser_fuzzer/] ] #slideh[== Static Analysis][ - Manifest file --- #emoji.checkmark.box - Resources --- #emoji.crossmark - 1-day analysis + binary diffing --- #emoji.checkmark.box ] #centered-slide[== Shared/Native Libraries] #slideh[=== Architecture --- x86_64][ - More tools - Emulation at high speeds - Partial analysis on a host machine ] #slideh[=== Native functions][ #only(1)[ - IDA Pro - Binary Ninja - rizin ] #only(2)[ - #strike[IDA Pro] - #strike[Binary Ninja] - #strike[rizin] ] ] #slideh[][ ```shell $ readelf -W --demangle --symbols $(LIBRARY_SO) | \ tail -n +4 | \ sort -k 7 | \ # optional rg "FUNC.*Java_.*" less ``` #text(0.48em)[ ```text 33: 0000000000001bb5 55 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_HttpEngine_nativeCreateHttp 34: 0000000000001bec 15 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_HttpEngine_nativeDelete 38: 0000000000001bfb 622 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_HttpEngine_nativeTest 44: 00000000000018c3 109 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_NativeDownloader_nativeOnConnected 39: 00000000000015e8 366 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_NativeDownloader_nativeOnData 35: 0000000000001b0c 40 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_NativeDownloader_nativeOnDisconnected 40: 0000000000001930 476 FUNC GLOBAL DEFAULT 13 Java_com_viber_libnativehttp_NativeDownloader_nativeOnHead ``` ] ] #slideh[][ ```shell $ rg "native.*nativeCreateHttp" ``` ```text app/src/main/java/com/viber/libnativehttp/HttpEngine.java 9: public static native long nativeCreateHttp(); ``` ] #slideh[][ Goals: - Find open source components - Find the target library - Superficial analysis ] #slideh[== Attack Vectors & Components][ - Link parser - SVG - Viber RTC (WebRTC) - VoIP engine ] #centered-slide[== Accessibility (real sink?)] #slideh[=== Static Analysis][ - jadx #footnote[https://github.com/skylot/jadx] --- decompilation IntelliJ IDEA --- deobfuscation, refactoring - SciTools Understand #footnote[https://www.scitools.com/] --- code-flow, data-flow analysis - `strings`/`rizin`, `grep`/`ripgrep` ] #slideh[][ #figure( image("./images/understand.png", height: 80%), caption: [Call graph of SVG native function in Understand], ) ] #slideh[=== Dynamic Analysis][ - Frida and public scripts - `frida-trace` - Smali patching - Binary patching ] #centered-slide[== Fuzzing] #slideh[=== Greybox is more interesting][ #only(1)[- libFuzzer / centipede / fuzztest] #only("2-")[- #strike[libFuzzer / centipede / fuzztest]] #only(3)[- honggfuzz] #only("4-")[- #strike[honggfuzz]] #only("5-")[- AFL++] #only("6-")[- LibAFL] #only("6-")[- etc.] ] #slideh[][ #set align(center) #table(columns: (auto, auto, auto, auto), align: (center, center, center), stroke: gray, inset: .3em, [*Fuzzer*], [*Instru\-mentation*], [*Emulator (x86_64)*], [*Real device, aarch64*], [AFL++ #footnote[#link("https://blog.quarkslab.com/android-greybox-fuzzing-with-afl-frida-mode.html")[Android greybox fuzzing with AFL++ Frida mode] by <NAME> from Quarkslab]], [Frida], [#emoji.checkmark.box AFL++ in], [#emoji.checkmark.box], [AFL++ #footnote[#link("https://alephsecurity.com/2021/11/16/fuzzing-qemu-android/")[AFL++ on Android with QEMU support] by <NAME> (\@Gr33nh4t) from Aleph Research; #link("https://github.com/marcinguy/fpicker-aflpp-android")[fpicker-aflpp-android] by marcinguy]], [Qemu], [#emoji.crossmark], [#emoji.checkmark.box], [AFL++ #footnote[#link("https://googleprojectzero.blogspot.com/2020/07/mms-exploit-part-2-effective-fuzzing-qmage.html")[MMS Exploit Part 2: Effective Fuzzing of the Qmage Codec] by <NAME> from Project Zero; #link("https://github.com/ant4g0nist/Sloth")[Sloth] by ant4g0nist]], [Qemu], [#emoji.checkmark.box], [#emoji.crossmark], [AFL++], [Unicorn + qiling], [Unicorn], [#emoji.crossmark/#emoji.checkmark.box?], [honggfuzz/AFL++], [QBDI], [QBDI], [#emoji.crossmark/#emoji.checkmark.box?], [LibAFL], [Qemu], [#emoji.crossmark], [#emoji.checkmark.box], [LibAFL], [Qemu], [#emoji.checkmark.box], [#emoji.crossmark], [LibAFL], [Frida], [#emoji.checkmark.box LibAFL in], [#emoji.checkmark.box], ) ] #slideh[=== LibAFL + Frida][ Why? #text(size: .5em, fill: gray, [Later we will review the remaining options]) - I'm Rust developer - I've already used LibAFL - Frida is true cross platform software - Rust is better for cross-compilation #footnote[not for Android, but not because Rust is bad] ] #centered-slide[== Harness] #slideh[=== Reverse Engineering][ Ghidra - Ghidra fork #footnote[https://github.com/saruman9/ghidra] - `ghidra_scripts` #footnote[https://github.com/saruman9/ghidra_scripts] - Recaster plugin #footnote[https://github.com/saruman9/recaster] - "Ghidra. Dev" presentation #footnote[https://github.com/saruman9/ghidra_dev_pres] ] #slideh[][ - Binary Ninja --- `binja_snippets` #footnote[https://github.com/saruman9/binja_snippets] - IDA Pro - rizin ] #slideh[==== C++][ Ghidra - `RecoverClassesFromRTTIScript.java` - `ApplyClassFunctionSignatureUpdatesScript.java` - `ApplyClassFunctionDefinitionUpdatesScript.java` - C++ directory in Script Manager - Ghidra-Cpp-Class-Analyzer #footnote[https://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer] by astrelsky ] #slideh[][ IDA Pro - ida_medigate #footnote[https://github.com/Metadorius/ida_medigate] by Metadorius --- fork of fork of fork... - Referee #footnote[https://github.com/joeleong/ida-referee] by joeleong --- a python port of James Koppel's Referee ] #slideh[][ Binary Ninja - Use development release channel - ClassyPP #footnote[https://github.com/CySHell/ClassyPP] by CySHell - binja_itanium_cxx_abi #footnote[https://github.com/whitequark/binja_itanium_cxx_abi] by whitequark ] #slideh[][ #figure( image("./images/bn.png", height: 70%), caption: [BTW try Binary Ninja #footnote[A very old comparison of IDA and Binary Ninja --- #link("https://github.com/saruman9/binja_vs_ida")[Binary Ninja 1.1.1184-dev vs IDA Pro 7.0.171130 (RU)]] ], ) ] #slideh[==== Signatures][ - Ghidra: Function ID #footnote[#link("https://htmlpreview.github.io/?https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/FunctionID/src/main/help/help/topics/FunctionID/FunctionID.html")[FunctionID] help topic] - IDA Pro: lumen #footnote[https://github.com/naim94a/lumen] --- Lumina private server - Binary Ninja: Signature Libraries #footnote[https://binary.ninja/2020/03/11/signature-libraries.html] ] #slideh[==== Diffing][ - Version Tracking #footnote[#link("https://htmlpreview.github.io/?https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/VersionTracking/src/main/help/help/topics/VersionTrackingPlugin/Version_Tracking_Intro.html")[Version Tracking] help topic] in Ghidra - Program Differences #footnote[#link("https://htmlpreview.github.io/?https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/ProgramDiff/src/main/help/help/topics/Diff/Diff.htm")[Program Differences] help topic] in Ghidra - BinDiff #footnote[https://www.zynamics.com/bindiff.html] - Diaphora #footnote[https://github.com/joxeankoret/diaphora] ] #slideh[=== Difficulties & Resolving][ #only("1-2", [#emoji.quest])#only("3-", [#emoji.checkmark.box]) Java + C++ #only(2, [#emoji.lightbulb Find "pure" functions]) #only("-4", [#emoji.quest])#only("5-", [#emoji.checkmark.box]) Threads #only(4, [#emoji.lightbulb Find a target function in a call graph without threads]) #only("-6", [#emoji.quest])#only("7-", [#emoji.checkmark.box]) Other shared libraries as dependencies #only(6, [#emoji.lightbulb To do patching of shared libraries]) #only(6, [#emoji.lightbulb Load dependencies inside harness code]) #only("-8", [#emoji.quest])#only("9-", [#emoji.checkmark.box]) Initialization in `JNI_OnLoad` #only(8, [#emoji.lightbulb Write stubs, call initialization functions]) ] #slideh[=== Example of a harness for the target function][ #set text(.65em) #set align(center) ```c const ptrdiff_t ADDR_JNI_ONLOAD = 0x0000000000011640; const ptrdiff_t ADDR_PARSE_LINK = 0x000000000002F870; const ptrdiff_t ADDR_COPY_JNI_STRING_FROM_STR = 0x0000000000011160; [...] Functions *load_functions() { LIBC_SHARED = dlopen("/data/local/tmp/libc++_shared.so", RTLD_NOW | RTLD_GLOBAL); LIBICU_BINDER = dlopen("/data/local/tmp/libicuBinder.so", RTLD_NOW | RTLD_GLOBAL); LIBLINKPARSER = dlopen("/data/local/tmp/liblinkparser.so", RTLD_NOW | RTLD_GLOBAL); if (LIBLINKPARSER != NULL && LIBC_SHARED != NULL && LIBICU_BINDER != NULL) { int (*JNI_OnLoad)(void *, void *) = dlsym(LIBLINKPARSER, "JNI_OnLoad"); void (*binder_init)() = dlsym(LIBICU_BINDER, "_ZN22IcuSqliteAndroidBinder4initEv"); if (JNI_OnLoad != NULL && binder_init != NULL /* && binder_getInstance != NULL */) { [...] ``` ] #slideh[== Catches][ - DoS - Leaks - Deadlocks ] #slideh[== Sources (once again)][ - Препарируем Viber. Мини-гид по анализу приложений для Android #footnote[https://xakep.ru/2023/05/16/analyzing-viber/] #sym.copyright _Хакер_ - fuzzer + harness #footnote[https://github.com/saruman9/viber_linkparser_fuzzer/] ] #slideh[== Summary][ - More details in the article #emoji.finger.t - The research has been interrupted, so go ahead! - The basic things for graybox fuzzing were considered, further --- more ] #centered-slide[= WhatsApp #v(2em) #image(height: 50%, "./images/WhatsApp_logo-color-vertical.svg") ] #slideh[== Static Analysis][ - Manifest file --- #emoji.checkmark.box - Resources --- #emoji.checkmark.box, see the next slide - 1-day analysis + binary diffing --- #emoji.checkmark.box ] #centered-slide[== Shared/Native Libraries] #slideh[=== Superpack][ Android app compression, which combines compiler analysis with data compression. See _Superpack: Pushing the limits of compression in Facebook’s mobile apps_ #footnote[https://engineering.fb.com/2021/09/13/core-data/superpack/] by Sapan Bhatia from Facebook. ] #slideh[][ Solutions: - Reverse engineering and developing - Reverse engineering and developing a wrapper (calling functions from a shared library in an emulator) - #only(2)[#set text(0.7em); #emoji.checkmark.box] Decompression in an emulator/Docker ] #slideh[== Attack Vectors & Components][ - Java part - Many open-source components - `libwhatsapp.so` - Statically linked - More and more Rust ] #slideh[][ After a long CFG/DFG analysis... - MP4 checking (incoming messages), converting (outgoing messages) - GIF checking - WEBP parsing (stickers) - `libmagi` (MIME type identification) - VoIP (PJSIP project #footnote[https://github.com/pjsip/pjproject]) ] #centered-slide[== Fuzzing] #slideh[=== AFL++ + Frida][ - Not as hard to build for Android as I expected #footnote[https://github.com/saruman9/AFLplusplus/tree/android] - Perfect for those who prefer C++ - Not as flexible as LibAFL, but rich in functionality ] #centered-slide[=== LibAFL + Frida] #slideh[==== Android NDK + Frida + Rust = Building is the real pain!][ Works: Rust 1.67, NDK 22, clang30 Doesn't work: - Rust 1.67, NDK 25, clang\* - Rust 1.70, NDK 21, clang\* - Rust 1.70, NDK 22, clang\* - Rust 1.70, NDK 25, clang\* ] #slideh[][ + Moving Android toolchains from libgcc to libclang_rt #footnote[https://github.com/android/ndk/wiki/Changelog-r23#changes] + Updating the Android NDK in Rust 1.68 #footnote[https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html] + Fixing build error for NDK 23 and above #footnote[https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946] + Patches for Frida (only for NDK below 23) #footnote[https://github.com/AFLplusplus/LibAFL/issues/1359#issuecomment-1693328137] + Workaround for aarch64 `__clear_cache` issue #footnote[https://github.com/AFLplusplus/LibAFL/issues/1359#issuecomment-1695346506] + A dirty hack for `frida-rust` #footnote[https://github.com/frida/frida-rust/pull/112] ] #slideh[==== LibAFL problems][ - DrCov coverage doesn't work as expected #footnote[https://github.com/AFLplusplus/LibAFL/pull/1579]#super[,] #footnote[https://github.com/AFLplusplus/LibAFL/pull/1581] - Asan doesn't work for Android x86_64 #footnote[https://github.com/AFLplusplus/LibAFL/pull/1578] - miniBSOD doesn't work for Android x86_64 #footnote[https://github.com/AFLplusplus/LibAFL/pull/1577] ] #slideh[][ - Additional changes#footnote[https://github.com/saruman9/LibAFL/branches/all]: - Option to continue fuzzing - Catching of timeout objectives - Option to disable coverage - The option of minimizing a corpus ] #slideh[=== Frida][ - I had a lot of problems because I didn't understand how Stalker works. Especially when analyzing complex objects (JIT is terrible) - Be sure to read the documentation #footnote[https://frida.re/docs/stalker/] for Stalker (and Gum interface) before using it #pause - LibAFL + Frida = Multithreading doesn't work - The sanitizer based on Frida doesn't work correctly on some arch/platforms ] #slideh[=== Java VM][ #set align(center) #text(2em)[#emoji.lightbulb] Harness = Java + Native Libraries But how? #pause Create Java VM from C/C++/Rust code of a harness/fuzzer! ] #slideh[][ Sources: - Creating a Java VM from Android Native Code #footnote[https://calebfenton.github.io/2017/04/05/creating_java_vm_from_android_native_code/] by <NAME> - Calling JNI Functions with Java Object Arguments from the Command Line #footnote[https://calebfenton.github.io/2017/04/14/calling_jni_functions_with_java_object_arguments_from_the_command_line/] by <NAME> - Loading Android ART virtual machine from native executables #footnote[https://gershnik.github.io/2021/03/26/load-art-from-native.html] by <NAME> ] #slideh[==== Where hell begins?][ #set align(center) #only(1)[Creating a Java VM is a non-trivial task!] #only(2)[#text(size: 1.2em)[Compliance with all legacy designs in Android is hard!] _I did a separate research on the ASOP source code_ ] #only(3)[#text(size: 1.4em)[Running Java VM under a fuzzer and Frida is a pain!] _I spent many hours debugging_ ] #only(4)[#text(size: 1.6em)[A real device and an emulator are two different things!] _I have used 3 real devices and countless versions of an emulator_ ] #only(5)[#text(size: 2em)[It still doesn't work stably...] #text(size: 1.5em)[But it works! #footnote[https://github.com/saruman9/jnienv]#super[,]#footnote[BTW Valgrind for Android: https://github.com/saruman9/valgrind]] ] ] #slideh[=== Smali patching][ #only(1)[ #set align(center) Does anyone know a tool that is comfortable to use for Smali patching? ] #only(2)[ - Smali the Parseltongue Language #footnote[https://blog.quarkslab.com/smali-the-parseltongue-language.html] by <NAME> from Quarkslab - Ghidra - Binary Ninja - Smalise extension for VSCode #footnote[https://github.com/LoyieKing/Smalise] by LoyieKing ] ] #centered-slide[== Catches] #slideh[=== DoS. Sender side][ - Gallery - TIFF, SVG - OGG, WAV, MP3 - Live - Opus (audio recorder) - Video stream from a camera - Sending - MP4 ] #slideh[=== DoS. Receiver side][ - Media hijacking - Android Java exceptions, native iOS crashes ] #slideh[== Summary][ - Only DoS... yet - VoIP is still waiting for me ] #slideh[= General summary][ - The journey is 1 year long #pause - From zero to #strike([hero]) some bugs with only fuzzing #pause - This is the vulnerability research for now, next time --- exploitation development ] #[ #set heading(outlined: false) #focus-slide[= Thank you!] ]
https://github.com/songoffireandice03/simple-template
https://raw.githubusercontent.com/songoffireandice03/simple-template/main/templates/template.typ
typst
#import "@preview/physica:0.9.1": * #import "@preview/ctheorems:1.1.2": * #import "@preview/xarrow:0.2.0": * #import "@preview/showybox:2.0.1": * #import "@preview/chem-par:0.0.1": * #import "@preview/unify:0.5.0": * #import "@preview/nth:1.0.0": * #import "showythm.typ": * // main project #let bubble( title: "", subtitle: "", author: "", affiliation: "", year: none, class: none, date: datetime.today().display(), logo: none, main-color: "003F88", alpha: 60%, body, ) = { // Set the document's basic properties. set document(author: author, title: title) // Save heading and body font families in variables. let body-font = "New Computer Modern" let sans-font = "New Computer Modern" // Set the math font show math.equation: set text(font: "New Computer Modern Math") // Set colors let primary-color = rgb(main-color) // alpha = 100% // change alpha of primary color let secondary-color = color.mix(color.rgb(100%, 100%, 100%, alpha), primary-color, space:rgb) show "highlight" : it => text(fill: primary-color)[#it] //customize look of figure // set figure.caption(separator: [ --- ]) //customize inline raw code show raw.where(block: false) : it => h(0.5em) + box(fill: primary-color.lighten(90%), outset: 0.2em, it) + h(0.5em) // Set body font family. set text(font: body-font, lang: "en", 14pt) show heading: set text(font: sans-font, fill: primary-color) //heading numbering set heading(numbering: "1.") show heading: it => { set text(font: "New Computer Modern") set par(first-line-indent: 0em) if it.numbering != none { text(rgb(main-color))[#sym.section] text(rgb(main-color))[#counter(heading).display() ] } it.body v(0.6em) } // Set link style show link: it => underline(text(fill: primary-color, it)) //pagebreak before first heading and space after //show heading.where(level:1): it => pagebreak(weak: true) + it + v(0.5em) // no pagebreak before heading show heading.where(level:1): it => it + v(0.5em) //numbered list colored set enum(indent: 1em, numbering: n => [#text(fill: primary-color, numbering("1.a.i)"))]) //unordered list colored set list(indent: 1em, marker: n => [#text(fill: primary-color, "•")]) // display of outline entries show outline.entry: it => text(size: 14pt, weight: "regular",it) //avoid C++ word break show "C++": box // Title page. // Logo at top right if given if logo != none { set image(width: 6cm) place(top + right, logo) } // decorations at top left place(top + left, dx: -35%, dy: -28%, circle(radius: 150pt, fill: primary-color)) place(top + left, dx: -10%, circle(radius: 75pt, fill: secondary-color)) // decorations at bottom right place(bottom + right, dx: 40%, dy: 30%, circle(radius: 150pt, fill: secondary-color)) v(2fr) align(center, text(font: sans-font, 2em, weight: 700, title)) v(2em, weak: true) align(center, text(font: sans-font, 1em, weight: 700, subtitle)) v(2em, weak: true) align(center, text(1.1em, date)) v(2fr) // Author information. align(center)[ #text(author, 14pt, weight: "bold") \ #affiliation \ #year\ #emph[#class] ] pagebreak() // Table of contents. set page( numbering: "1", number-align: center, ) // Main body. set page( header: [#emph()[#title #h(1fr) #author]], // header: [#grid( // columns: (1fr, 1fr, 1fr), // rows: (auto), // [#align(left, emph(title))], [#align(top + center, subtitle)], [#align(top+ right,author)] // )] ) // set par(justify: true) // Outline options set outline(fill: repeat[~.], indent: 1em) show outline: set heading(numbering: none) show outline: set par(first-line-indent: 0em) show outline.entry.where(level: 1): it => { text(font: "New Computer Modern", rgb(main-color))[#strong[#it]] } show outline.entry: it => { h(1em) text(font: "New Computer Modern", rgb(main-color))[#it] } body } //useful functions //set block-quote // #let blockquote = rect.with(stroke: (left: 2.5pt + luma(170)), inset: (left: 1em)) #let primary-color = rgb("E94845") #let secondary-color = rgb(255, 80, 69, 60%) // Theorem enviroments #let proof = thmplain( "proof", "Proof", separator: [. #h(0.2em)], base: "theorem", inset: 1em, bodyfmt: body => {set enum (numbering: "a.i.") body h(1fr) $square$}, ).with(numbering: none) #let solution = thmplain( "proof", "Solution", separator: [. #h(0.2em)], base: "theorem", inset: 1em, bodyfmt: body => {set enum (numbering: "a.i.") body h(1fr) $square$}, ).with(numbering: none) #let solution2 = thmplain( "proof", "Solution", separator: [: #h(0.2em)], inset: 1em, base: "theorem", bodyfmt: body => {set enum (numbering: "a.i.") body h(1fr)}, ).with(numbering: none) // bullet list markers
https://github.com/oldrev/tids
https://raw.githubusercontent.com/oldrev/tids/master/README.zh_cn.md
markdown
Apache License 2.0
# tids: A TI-Style Datasheet Template for Typst [English](README.md) | 简体中文 本项目是一个出于演示和评估的目的创建的 TI 风格电子元件规格书模板。 ![Demo](gallery/demo.zh.png) **如果你觉得本项目有用请点亮⭐小星星⭐。** ## 声明 本开源项目出于演示和评估的目的创建,并无意侵犯任何版权和商标。作者与 TI 并无任何关联。 ## 特性 - **简单易学:** 使用 Typst 易于编写和阅读,如果你会编写 Markdown,那 Typst 没太大的不同。 - **可自定义:** 模板完全开源,你可以完全自定义,这里的 TI 风格只是个例子。 - **编译飞快:** 一两秒即可编译输出 PDF,而不是 LaTeX 需要的几分钟甚至更久。 ## 快速上手 0. 如果你还没有 Typst 就先安装: ```powershell winget install --id Typst.Typst ``` 演示的模板用到了思源黑体和思源宋体,可以到 Adobe 的官方仓库下载: [https://github.com/adobe-fonts/source-han-sans] (https://github.com/adobe-fonts/source-han-sans) 并安装到操作系统中; 1. 克隆本仓库到本地 ```bash git clone https://github.com/oldrev/tids.git ``` 3. 构建示例 PDF 文件: ```bash typst compile demo-ds.zh.typ ``` 4. 赏玩生成的 [`demo-ds.zh.pdf`](demo-ds.zh.pdf) PDF 文件。 ## 使用 1. 把模板文件 `tids.zh.typ` 复制到你的项目目录里,如果是编写英文的规格书就用 `tids.typ`。 2. 导入模板文件并调用 `tids()` 函数: ```typst #import "tids.typ": tids #show: doc => tids(ds_metadata: ( title: [YourDSTitle], product: [YourProductName], product_url: "https://github.com/oldrev/tids", revision: [CurrentRevision], publish_date: [PublishedOn] ), features: [features for the title page], applications: [application information for the title page], desc: [description content for the title page], rev_list: [revision list], doc: doc ) // ... The content of your document ``` See [`demo-ds.zh.typ`](demo-ds.zh.typ) for details. ## 演示视频 - Youtube: TODO - 哔哩哔哩: TODO ## 参与贡献 发现任何 bugs 或者有任何改进建议请不要犹豫,赶紧发 Issue 和 PR。 ## 授权协议 本项目使用 Apache 2.0 协议授权.
https://github.com/isometricneko/typst-example
https://raw.githubusercontent.com/isometricneko/typst-example/main/chap2.typ
typst
#import "preamble.typ": * = Chapter 2 #cite(<mardani2023variational>) <here_is_chap2> #locate(loc => bib_state.at(query(<here_is_chap2>, loc).first().location()))
https://github.com/Dherse/codly
https://raw.githubusercontent.com/Dherse/codly/main/tests/outside-styling/test.typ
typst
MIT License
#set page(height: auto, width: 300pt, margin: 10pt) *Before Codly:* #let replace-at(str, colors) = { for (i, c) in str.clusters().enumerate() { let found = false for (color, positions) in colors.pairs() { if positions.contains(i) { text(eval(color).darken(20%), c) //highlight(fill: eval(color).lighten(75%), top-edge: "ascender", extent: 0.4pt, c) //underline(stroke: 0.7pt + eval(color), extent: 0.4pt, c) found = true break } } if not found { c } } } #[ #show raw.line: it => { if it.number == 1 { replace-at(it.text, (green: (4,), red: (10,), blue: (16,), purple: (22,))) } else if it.number == 2 { replace-at(it.text, (green: range(4,5), red: range(10,12), blue: range(17,20), purple: range(25,28))) } else if it.number == 3 { replace-at(it.text, (green: (0,1,2,3,4,5,6,7,8))) } else { it } } ``` Test1 test2 test3 test4 Test1 test22 test333 test444 Test12345 ``` ```python if test: pass ``` ] *After Codly:* #import "../../codly.typ": * #show: codly-init.with() #[ #show raw.line: it => { if it.number == 1 { replace-at(it.text, (green: (4,), red: (10,), blue: (16,), purple: (22,))) } else if it.number == 2 { replace-at(it.text, (green: range(4,5), red: range(10,12), blue: range(17,20), purple: range(25,28))) } else if it.number == 3 { replace-at(it.text, (green: (0,1,2,3,4,5,6,7,8))) } else { it } } ``` Test1 test2 test3 test4 Test1 test22 test333 test444 Test12345 ``` ```python if test: pass ``` ]
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/053%20-%20Wilds%20of%20Eldraine/004_Episode%204%3A%20Ruby%20and%20the%20Frozen%20Heart.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 4: Ruby and the Frozen Heart", set_name: "Wilds of Eldrain", story_date: datetime(day: 11, month: 08, year: 2023), author: "<NAME>", doc ) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The day is brisk and bright when Kellan and Ruby return to Edgewall. After the rough living of Dunbarrow and the wonder of the giants' home, this place seems both a paradise and a hovel. That is what Kellan likes most about it. If he were to return home to Orrinshire, he knows precisely what he would see: his mother at the loom, his stepfather tending sheep, the villagers going about their day in perfect harmony. There are no traces of the Wicked Slumber in Orrinshire, nor any surprises. Here in Edgewall there are plenty. First is the spread of violet across the town. Where once the cursed threads accented the streets and alleys, they now form rivers and brooks. When they left, there were dozens of sleepers. Now, with a sinking heart, Kellan realizes that the victims are beyond counting. Leaning against balconies, hidden beneath parchment and blankets, standing at open windows ... Even Ruby is thrown off by the sight. She doesn't say so—she's too brave—but he hears it in the sharp draw of her breath as they walk the streets. He sees it in the careful hops she makes to avoid any strands of violet, in the stiffness of her posture. "Watch your step," she tells him with a smile more for his sake than any joy of her own. "Can't have our hero falling asleep on us." "Don't call me that," Kellan replies. "My mother always tells me that if I act like something I've done is no big deal, everyone else will, too. You're just as heroic as I am." Ruby laughs. "Your mom does sound like a nice lady, but you're mistaken. Peter's the hero in our family. Raising your little sister all on your own #emph[and] being the best hunter in town ..." She hops a cursed thread. "That's a real hero." "I think there are plenty of ways to be a hero," Kellan says. "Peter's one, but so are you. And I'd like to be one someday, too." "Well, you're already on a quest," says Ruby. She leads them through the streets to a small cabin on the very edge of town. An uncharitable soul might say it isn't part of Edgewall at all, but the city colors draped in the window proudly proclaim otherwise. A plume of applewood smoke rises from the chimney. Kellan's stomach rumbles. "What do you think makes a hero, anyway?" she asks him. "A hero is someone who always does the right thing," he says. "Someone who makes other people's lives better." Ruby stops with her hand on the door. She narrows her eyes. Kellan waits to see if she'll answer, but there's no chance to talk it over. Peter spots them from the window and invites them inside. With fresh venison steaks sizzling in his cast iron pans, the subject of heroism gallantly gives way to that of dinner. And plans. They tell him they are going to Loch Larent, and he agrees to take them—on one condition. "You must wear my thickest cloak, and when you can no longer feel your nose, you must turn back. No matter the circumstances." "But what if we're not done by then?" Kellan says. "Then once the two of you have returned, I will go myself," says Peter. "I've heard about that castle. No one's managed to get to the center. Not the other hunters, not the bandits. <NAME> tried it before she came here. In her opinion it was an easier thing to brave the wilds than it was to walk more than forty paces across the drawbridge—and she with that firey magic to warm her." Quiet falls over the room. Kellan glances to Ruby, and Ruby to Kellan. "I'm not going to turn back," he says. "I can't. Not when so many people are sick. My lord said that whoever defeats the witches will end the curse—" "Your lord did not say it had to be you, lad," says Peter. "There's no shame in needing help. You're only a boy, and Ruby still young herself. You must know when a beast can be felled, and when it is best to leave it be." When Kellan catches Ruby's eye again, he knows she's thinking the same thing. What if Peter's right? In the end, Ruby makes the promise. Her brother drapes a bearskin around her shoulders, though she insists on keeping the hood. To Kellan he grants a fine coat of wool, the sight of which makes the boy break out in a groan. The wool is from Orrinshire. Yet he wears it proudly at night, when Peter tells them he has a surprise for them, and he buries his face in its raised collar once the embarrassment overcomes him. For there, in the town square, there are children gathered in red hoods and woolen cloaks. Dozens of them, he thinks—and there are girls in wool as much as there are boys in red. All watch in perfect stillness as two puppets triumph over all manner of trouble to defeat an evil, man-eating witch. In the flickering candlelight, Kellan thinks he sees Ruby tear up. But she wipes them away the second he spots her, and the two of them say no more of this sacred moment. #figure(image("004_Episode 4: Ruby and the Frozen Heart/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) <NAME> lies a long week's journey from Edgewall. Peter takes them much of the way, but as they approach the loch itself, he announces that he will stop to make camp. And who could blame him? Even a full day's travel away, it is so cold that Kellan must hop from foot to foot to keep warm. In all his winters, he's weathered only two days colder than this—both in the bitterest months. He and his family huddled up with the sheep so that no one would freeze. Deep down, he wondered whether it was possible for someone to freeze at all. It seemed a thing that water did, or perhaps beer, but never people. He wonders less about that now. But he doesn't bring that up. Neither does Ruby. Peter is more vigilant. "Are you certain you don't want me to come with you?" he asks. "You're still recovering," Ruby answers, though Kellan hears a pang of regret in her voice. "And besides ... I think I want to try this one. To see how far I can go." They bid farewell to Peter. He holds them close, wishes them well, and lingers by the fire as they go. For a long while afterward, Ruby looks over her shoulder, perhaps searching for his silhouette against the orange light. Everything else in this place is blue, green, or violet. The sky above is marbled with all three colors swirling over each other like the layers of a noblewoman's cloak. Beneath the frozen surface of the loch, eerie blue lights bob and weave, vying for their attention. Kellan thinks he sees a pair of yellow eyes under the ice—but a moment later they disappear. Most striking of all is the castle. Seeing it through the mirror is one thing; to lay eyes on it in person is quite another. Kellan had no idea how large it was until now. The main tower stands on a cliff overlooking the loch, but whoever designed it could not bear to stop there. Madness struck the unseen architect: gates leading to new fortresses, drawbridges to nowhere, a never-ending series of baileys, each giving way to a new gate. Kellan counts five portcullises alone. They'd snuck into a cabin, climbed a beanstalk, and walked beneath the door to enter a giant's stronghold. They had not yet stormed a castle. The road before them, paved with glittering crystal gravel, seems more threat than invitation. Yet Kellan does not hesitate to step upon it. Fear is nothing in the face of the greater good, he tells himself. But Ruby stops, her foot at the very edge of the crunchy gravel. "This ... feels different, doesn't it?" "Only if you let it," Kellan says. He holds out his hand. "At least we don't have to do any climbing this time." Ruby laughs up a cloud of vapor. She takes his hand and starts on the path. "Don't say that too loudly, or Troyan might burst out of a snow drift." "I don't think that would be so bad," Kellan says. "The places he used to talk about sounded great, didn't they?" Ruby blows a raspberry. "The places he was talking about were made up, Kellan! All my life in Edgewall and I've never heard anyone talk about a #emph[pain circus] before. What does that even mean?" "I don't know. I thought maybe it was something the fae did," Kellan says. He tries not to let the disappointment reach his tone, but as always, Ruby's too clever for that to work. "You really want to see more of the fae lands, don't you?" says Ruby. She squeezes his hand. "I'm sure once this is done, you'll be the toast of the town." He isn't so sure about that. Part of him wonders—he was always too fae for the humans, so what if he's too human for the fae? Talion already pointed out how little he knew of fae customs every time they spoke. He still hasn't gotten the basket hilts to work for him. What if it's the same there, but different? He tries to think of something to say. But someone else soon speaks for him: a woman's voice carried on gelid wind. #emph["Knights, bandits, and would-be kings have failed to walk this path. Two children have little hope of success. Turn back."] The sky overhead darkens, the wind strengthens; were it not for the steel pin holding Kellan's cloak in place, it would have been torn right from his small body. Ruby pulls down the bear's head over her own to keep from freezing. Kellan does the same, though with his plain hood of wool. "We're not going to give up that easily," he shouts into the air. But here the air is so cold that it cuts him to speak, and when only silence responds, he regrets making such an effort. #emph["The brave live short lives. Do not think your age will earn you any mercy from me. My realm will be safe from threats, regardless of who those threats might be. Turn back."] With every word Hylda speaks the air around them grows colder. So powerful is the wind that they must strain against it with every step, but they do not stop walking. Kellan keeps glancing over to Ruby as they go. He can't see much of the rest of her face, but what he can see is red as her hood. Surely she can no longer feel her nose. "You don't have to keep going." But Ruby only shoots him a sidelong glance. "And let the witch win?" "She won't win if I get there," Kellan says. He speaks into his scarf to try and keep warm. "If we keep going ..." #emph["You will die," ] comes Hylda's voice. #emph["This is your final warning. Heed your own words, and turn away."] The veil of snow has gotten so thick that all he can see is gray and white. Still, he turns in place, looking to find the castle. In the distance he spots the faintest smudge of blue. A mile away, if not more. Kellan blinks cold eyes. He could turn away—but if he does, no one will ever wake up, and he will never know who his father was. "You ... don't know ... a questing hero when you see one," he rasps. Next to him, Ruby laughs, and it makes him feel a little braver. #emph["I do. They die as easily as anyone else. You will not be the last," ] Hylda answers. Her voice fades into the howling of the wind—and the creatures within it. The first moves too quickly for the two youths to see: a streak of cerulean across their vision, a sound like breaking glass. Only when the icy spear lands at their feet do they realize what they're seeing. The swirling snow ahead of them has solidified into mail and plate: a warrior of frost, at least twice Kellan's size, bears down upon them. A new spear forms in his open palm. A wicked thrust aims straight for Kellan's heart. Ruby pulls him out of the way. Still, the point pierces Kellan's fine cloak to the snowy ground beneath them. Wind howls in his ears and snow stings his eyes as he tries to scamper away. But Orrinshire wool is renowned for its strength. The very fiber of his home—perhaps sheared from his own sheep—keeps him in place. Try as he might, he cannot tear the pinned corner away. "He can't hurt you if his spear's stuck!" Ruby shouts. "Just drop the cloak and go!" But he can't. His fingers are too stiff to work the clasp keeping his cloak in place, and even if he did, where would that leave them? In cold like this he'd surely freeze. Kellan locks eyes with the warrior through the murk. There's a new shape forming in its free hand: an axe. "Ruby, go on ahead!" he says. "Don't be s—aah!" Her protest is cut short when she's yanked high into the air. Another warrior's formed, and this one's got her in its clutches. A rime-streaked sword is pressed right up against her throat. No, no, this isn't how this is supposed to go. It's one thing for him to be in trouble, but there has to be some way out of this. In stories, there's always something the hero figures out. But he doesn't have any weapons and he doesn't know any magic because his mother never taught him any, and his father never ... The warrior readies a blow. "Dad, #emph[please] ," Kellan whimpers. He reaches one last time for the basket hilts ... and gold light cuts through the gray. Something in Kellan feels bright as spring no matter the surroundings, something that pours into the hilts and changes them. Acting on instinct he lashes out— #figure(image("004_Episode 4: Ruby and the Frozen Heart/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) —and his newfound sword cuts straight through the frost warrior's arm. Kellan gawps at the delicate blade of light in his hands, the thing he's conjured from his own desperation. Around the hilt the light seems to sharpen like thorns. He admires it for a second, but now he has to get them out of this mess. Kellan ducks beneath the warrior's legs, running straight for Ruby. Before he can think to hesitate, he lops this warrior's arm off, too. Catching Ruby on the way down is an easy thing in comparison. "Kellan, you're doing it!" she says, eyes wide. "Fae powers, you're really doing it!" "I am!" If he says anything else, he's worried he'll ruin it, as if naming it aloud will dispel the effect. He sets her back down on the path. The warriors, howling with pain, have wandered away, leaving their weapons lodged in the snow. Ruby picks up the sword and stands back-to-back with Kellan on the path. But the longer they wait, the harder it is to stay upright. His initial giddiness begins to give way. The magical sword in his hands is heavy as iron. Has it gotten colder already? A strange sleepiness creeps in and he worries that it must be the curse—but there are no plumes of violet here, no magic save his and Hylda's. So why is he so ...? Kellan's eyelids begin to droop. "Ruby ... I think I might be ..." "Kellan?" Ruby says. She turns. "Kellan!" Maybe they should rest before then, though. He's so cold, and so tired, and ... He's already done so well, he's earned a little nap. Kellan falls. This time, Ruby is the one to catch him. #figure(image("004_Episode 4: Ruby and the Frozen Heart/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Among the swirls of blue, white, and green, there is a girl in red—and a boy she carries through the snow. Cradled in her arms, curling up instinctively into the warmth of her cloak, Kellan is so fragile that she worries the falling snowflakes will break him. So shallow is his breathing that, could she not feel his heartbeat, she'd think him dead. #emph["Take him and go home."] Looking down on him she knows it's good advice. Her brother would tell her the same: they've failed. She can take him back, and then the two of them can figure out something else to do. Or maybe some other hero will come by, someone with a heart like a furnace and blood like molten ore, who will not be slowed by the cold. A month ago she wouldn't have hesitated. Life was about looking out for you and yours; it was about staying alive. But it's not just that anymore. This is bigger than the two of them; the puppet show showed her that. All those children in their red hoods—what would they think if she left him here? What would Kellan say when he awoke, knowing he might never learn the truth about his father? How could she live with herself if the Wicked Slumber never faded away? Ruby begins to walk. Snow crunches underfoot, wind whistles in her ear. Her footsteps have never felt so heavy as this; each one is a battle. #emph["You owe him nothing."] "People don't need to owe each other to help each other," Ruby answers, speaking into the razor wind. There is no response. For a long span there are no words at all—no sounds save the gusts, the snow, her breathing. She can't even hear Kellan's. Frost has formed on her eyelashes. Though it is yet far, the castle comes closer with every step taken—every battle won. One step, another. Her legs hurt. "#emph[He is small and weak. You are hardy and strong. You have hunter's blood. Abandon him and you may yet reach me."] Ruby feels like she's breathing in glass, but she keeps breathing. "Keep ... talking ... I was getting lonely, anyway." A strong gust, likely the witch's displeasure, knocks her off her feet. She and Kellan tumble into the snow. Cold saps the strength she's fought so hard to keep. Each of her limbs seems to weigh as much as a harvest pig. Yet she raises them. Yet she stands. Yet she lifts the boy from the snow and carries him, once more. And not once throughout does the thought occur to her to leave him behind. One foot in front of the other. "You know what I think?" Ruby shouts into the wind. "I think you're lonely too. That's why you keep taunting me. You don't get to talk to people otherwise, do you?" Another powerful gust. Hail batters her. She hunkers down, the cloak taking the worst of the impact. #emph["Leave." ] Ruby holds Kellan tighter and keeps going. The skeletal gates rise up before her. How long has she been walking? It feels an eternity. She turns and surveys her tracks over the frozen wastes. Peter said that was the easiest part, getting to the outermost drawbridge. It was crossing it that killed. When she turns back to the drawbridge she can see them: lumps beneath the blanket of pure white snow. Bodies kept hidden from sight. She and Kellan will be so small as to escape notice if they end up like that. Even Peter wouldn't be able to find her. Turn back when you cannot feel your nose, he said to her. He made her promise. In truth, she hasn't been able to feel it for some time. Ruby steps onto the bridge. There are no mountains to moderate the wind here, no structures to shield from hail or sleet. The moment she's out in the open the weather comes at her from all sides. Her fingers tremble. She could not move them if she tried. But she does not need to move them to keep hold, to keep walking. One step, another. #emph["You are a fool to continue."] "Maybe," Ruby says. She can't argue the point. Though she's only a quarter of the way along the bridge, it's already getting hard to keep lifting her feet. #emph["You are going to die here." ] "I won't know that until I do," Ruby says. She's not lifting her feet anymore; she can't. She trudges through the snow like a drunkard walking home from the pub. "I have to try." #emph["But why? Why?" ] the witch asks. For the first time there is urgency in her voice; for the first time, she actually sounds upset. #emph["You have no reason to—"] "Because my friend wants to defeat you, so he can meet his father and save the Realm, and I'm not going to let him down," Ruby says. One third of the way there. She's walked by five bodies already. #emph["You would abandon your life because ...?"] "Because it's the right thing to do," Ruby says. Another step. One more. Her knees give. So she can't walk anymore. Big deal. She can still crawl. Ruby forces herself to roll over. She shifts Kellan onto her back, throws her hands out ahead. They plunge through the snow. So cold, so tired, so clumsy, but she has to try. #emph["This is pointless. You know that."] "He would do the same for me, and he wouldn't think it was pointless," Ruby says. It isn't going to work. She knows that, deep down, but she's going to keep trying anyway. Even if she passes out, even if the snow takes her, Kellan will wake up at some point. Maybe his fae blood will help. And then when he gets to the castle, he can figure it out. She reaches for the next handhold. But instead, she finds an outstretched palm, its fingers pure white, the nails upon it delicately pointed. A crystal bracelet glimmers on the wrist. "Take my hand." That voice. It's the witch. But what is she doing out here? Ruby takes a shaky breath. Her brother met a witch once—look where it got him. She shakes her head. "No. I'm not—" "I mean you no harm," says the witch. "But if you will not believe me, I shall prove it to you." The witch kneels next to her. She seems sadder than Ruby expected. No amount of white finery, no heavy winter crown, no magic can conceal the loneliness in her pale eyes. Slowly, the weather around them clears until only the gentle snowfall remains. It is in this perfect silence that that witch leans over Kellan. "Sweet children, who have borne so much trouble ..." She presses a kiss to each of their foreheads. "Be welcome in Winter's Home." #figure(image("004_Episode 4: Ruby and the Frozen Heart/04.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Magic tingles along Ruby's skin as she starts to lose focus. "What are you doing?" she mumbles. "Keeping you safe," the witch says. Ruby feels cool fingers running through her hair. "You were right about me, I'm afraid. I'm lonely. I'd forgotten that, but the two of you have shown me what I've forsaken by staying here in this castle." Ruby's vision starts to fade. "Sleep, child. When the two of you wake, you shall have the truth." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The youths awake hours later in a room of glistening ice. Two golems, crafted from the same material as the walls, guard their slumber. Blankets, thick and plush, surround them, and before them is a morning banquet presented on a crystal tray. Spiced cider, pie, hearty soup—anything someone could want to warm their bones—lies beneath a sparkling cloche. All that remains is to reach for it. Kellan does without thinking. His stomach rumbling, his head hammering. What else is a young man to do? But Ruby stays his hand. "It's the witch's doing," she says. "The witch who means you no harm," comes the answer from across the room. She's standing from a chair, setting down a book. She picks up her own mug and saucer before coming to sit across from the two of them. "I'm glad to see that you're well." "How do we know this isn't a trick?" asks Ruby. "You saved us out there, but maybe you only wanted to put us at ease for a while. Maybe you're going to eat us—" "Eat you? I suppose you've met Agatha," she says. "We threw her into a cauldron," says Kellan. He's not sure how right Ruby is about this, or even how he ended up here, but he thought it bore saying. If it bothers Hylda, she gives no sign of it. "She deserved no less," she says. "I used to believe I was different from them. The other two, I mean. They always sought power. All I ever wanted was to be alone." Kellan glances at Ruby. He has a faint memory of Hylda's voice, but it's one that puts him at ease. He squeezes Ruby's hand. "Even if you like being alone more than being with people, it's always good to have friends." The witch smiles. Her face is not suited for such things. "So it is," she says. "Even when they are very skeptical friends." Ruby pouts. "I'm just looking out for him!" A laugh as unsuited to the witch as her smile. "I bear you no ill will—but you are difficult to impress. Will two more gifts prove my intentions to you?" Ruby crosses her arms, as if waiting to see what they might be. In the meantime, Kellan avails himself of cider and pie. Hylda doesn't mean them any harm; if she did, she would have left them out there. Besides, his mother always taught him it was rude to turn down hospitality like this. But he soon stops when he sees what Hylda's done. With a careful, light touch, she's lifted the frozen crown from her head and set it on the table before them. "There. I feel lighter already. Take that to the Kindly Lord, as proof of my defeat." "You're sure?" Kellan asks. "You aren't defeated if you're still around, though," Ruby says. "Who's to say you won't keep growing the castle and freezing people to death?" "I do," she says. She gestures to the windows. "Take a look outside, if you'd like. Without the crown I can maintain only a small home for me and mine." Ruby narrows her eyes and goes to the window, Kellan following. The morning sun plays upon the castle's walls, illuminating the water already running in rivulets down the stone, streams already cascading down the cliffside. The castle has begun to melt. "I think she's serious," Kellan says to Ruby. Then, to their host: "That was a brave thing to do, to give up power like that. My mother always said witches aren't all to be feared." "Your mother did not speak falsely," says Hylda. "Besides, I had plenty of inspiration." Ruby sits. At last, she lets herself enjoy some of the cider. Kellan takes the crown and sets it on his lap. "You said you had something else for us?" "A gift of information," says Hylda. "I heard the two of you speaking on the way here. You serve the Kindly Lord. When you leave this castle, you will surely find one of their gateways awaiting you. But this time, you will not cross the threshold unaware." "What do you mean?" Ruby asks. Hylda looks toward the window before continuing. "We witches did not create the Wicked Slumber alone. To do so would have been beyond our power." "What?" says Kellan. "When the invaders arrived, we each had different ideas of how to handle matters. Talion was the one who broke the stalemate. Eriette's sleeping curse, they argued, would be the surest way to counteract the invaders. Since the three of us could never have cast a spell that powerful on our own, we never would have considered it otherwise. There were four of us once, and we might have had some hope then, but she died twenty years ago. We needed four. Talion, strong as they may be, needed us for it to work as much as we needed them. Thus, they offered us the chance to save the Realm—and boons for our help. Always boons, with fae." Kellan swallows. "But Talion said that you put the whole world to sleep." Hylda smooths Kellan's hair. "It was only meant to stop the invaders," she says. "That it continued spiraling out of control afterward is Eriette's doing. Of that, I'm certain. She leapt at the chance to enact a curse of that size—to have all those people at her beck and call. I think she might have even done it without a boon, had the Kindly Lord not offered one." "But ... this is supposed to be a heroic quest," Kellan says. His lips start to tremble, his voice wavering. "I thought we were doing the right thing. Talion's the one who did this?" "You are doing the right thing," Hylda says. "Talion has sent you to clean up the mess that all four of us created. That is a good and noble thing to do—to fix things. But it is done best when it is done knowingly." Ruby squeezes his shoulders, but Kellan still can't stop shaking. Talion created this. Fae aren't supposed to lie, are they? #emph[Witches three have this land with slumber plagued ...] Kellan picks up the crown in his lap and storms out of the room. Down the winding halls and spiral stairs he goes, despite not knowing the way. Behind him Hylda calls, but he cannot make out what she's saying with his blood rushing through his ears. When at last he arrives outside, he sees that Hylda is right: there is already a portal. When Kellan reaches for the door, Ruby's hand finds his wrist again. She is sweaty and out of breath, having run after him all this way, but she is there—with him. "Together, remember?" she says. Kellan can't summon any words; the lump in his throat is too great. He nods and walks through the gateway. Together into the land of fae the two heroes stride, the land of false castles and false hopes. Talion awaits, draped as always, on their throne. #emph["Gallant adventurers, glory great you have earned—"] Kellan throws the crown at Talion's feet. The Kindly Lord studies the priceless boon. They crook a brow at the boy. #emph["Your father's spirit is at last showing itself, lad. What troubles you?"] "You lied," Kellan says. Talion waves a wand of hawthorn. A fae handmaiden picks up the crown and carries it away. Talion, for once, sits properly on the throne. #emph["Fae do not lie,"] they say. #emph["It is anathema to us. If I were to lie to you, my blood would clot like spoiled milk."] "We know about the curse," Ruby says. "We know you were the one who had the idea. You're using us, aren't you?" Talion leans back. Is that a smirk on their face? Kellan thinks it might be, and he hates it. "#emph[Ah. That matter. Is it such a bad thing to be used for such noble ends? A knight's sword does not complain of drinking blood."] "This isn't the same!" Kellan protests. "You asked if we were pure of heart. You said you'd help me find my—" How shameful to break down like this, to cry in front of the Fae King, yet Kellan cannot stop his voice from cracking, nor the tears from flowing. He wipes at his eyes in frustration. "I believed you. I really believed you knew him." #emph["I do," ] says Talion. Kellan's tears have no effect on them whatsoever. #emph["And I will tell you what I know of him if you complete this quest. Or will you refuse to save the Realm because you do not like the reason it is being saved?"] Kellan clenches a fist. "I ... I didn't say ... It isn't that simple!" #emph["Nothing in our lands is simple," ] says Talion. #emph["You shall find Eriette at Castle Ardenvale. Defeat her, and you will end the curse; end the curse, and I will tell you of your father. Or do not defeat her. Return to your pastoral home, and never again come as near to belonging as you did when you embraced your heritage. The choice is yours."] A wave of the wand. The Fae World flickers and fades around them. Once more, they stand on the cliffs outside Hylda's castle. And Kellan? Kellan begins to weep.
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/string-05.typ
typst
Other
// Error: 2-14 string index 2 is not a character boundary #"🏳️‍🌈".at(2)
https://github.com/SkiFire13/typst-touying-unipd
https://raw.githubusercontent.com/SkiFire13/typst-touying-unipd/master/unipd.typ
typst
MIT License
#import "@preview/touying:0.5.2": * #let _header-logo = (colors, ..args) => { let original = read("logo_text.svg") let colored = original.replace("#B20E10", colors.neutral-lightest.to-hex()) image.decode(colored, ..args) } #let _footer-wave = (colors, ..args) => { let original = read("bg_wave.svg") let colored = original.replace("#9b0014", colors.primary.to-hex()) image.decode(colored, ..args) } #let _title-background = (colors, ..args) => { let original = read("bg.svg") let colored = original.replace("#9b0014", colors.primary.to-hex()).replace("#484f59", colors.secondary.to-hex()) image.decode(colored, ..args) } #let _background-logo = (colors, ..args) => { let original = read("logo_text.svg") let colored = original.replace("#B20E10", colors.primary.to-hex()) image.decode(colored, ..args) } #let _header(self) = { set align(top) place(rect(width: 100%, height: 100%, stroke: none, fill: self.colors.primary)) place(horizon + right, dx: -1.5%, _header-logo(self.colors, height: 90%)) place(horizon + left, dx: 2.5%, text(size: 46pt, fill: self.colors.neutral-lightest, utils.display-current-heading(level: 2))) } #let _footer(self) = { place(bottom, _footer-wave(self.colors, width: 100%)) place( bottom + right, dx: -2.5%, dy: -25%, text( size: 18pt, fill: self.colors.primary.lighten(50%), context utils.slide-counter.display() + " of " + utils.last-slide-number ) ) } #let slide( title: none, config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies, ) = touying-slide-wrapper(self => { let self = utils.merge-dicts( self, config-page( header: _header, footer: _footer, ), ) let new-setting = body => { show: block.with(width: 100%, inset: (x: 3em), breakable: false) set text(fill: self.colors.neutral-darkest) show: setting v(2.5fr) if title != none { show: block.with(inset: (x: -1.5em, y: -.5em)) set text(size: 35pt, weight: "bold", fill: self.colors.primary) title v(.7em) } body v(2fr) } touying-slide(self: self, config: config, repeat: repeat, setting: new-setting, composer: composer, ..bodies) }) #let title-slide( extra: none, ..args, ) = touying-slide-wrapper(self => { let info = self.info + args.named() let body = { // Background place(top, _title-background(self.colors, width: 100.1%)) place( bottom + right, dx: -5%, dy: -5%, _background-logo(self.colors, height: 18%) ) // // Normalize data if type(info.subtitle) == none { info.subtitle = "" } if type(info.authors) != array { info.authors = (info.authors,) } if type(info.date) == none { info.date = "" } set text(fill: self.colors.neutral-lightest) // Title, subtitle, author and date v(20%) align( center, box(inset: (x: 2em), text(size: 46pt, info.title)) ) align( center, box(inset: (x: 2em), text(size: 30pt, info.subtitle)) ) v(5%) // TODO: Max 2 columns, last in a single column block(width: 100%, inset: (x: 2em), grid( rows: (auto,), columns: (1fr,) * info.authors.len(), column-gutter: 2em, ..info.authors.map(author => align(center, text(size: 24pt, author))) )) place(bottom, dx: 7.5%, dy: -30%, text(size: 24pt, info.date)) } self = utils.merge-dicts( self, config-common(freeze-slide-counter: true), config-page(fill: self.colors.neutral-lightest, margin: 0em), ) touying-slide(self: self, body) }) #let filled-slide( config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies, ) = touying-slide-wrapper(self => { let self = utils.merge-dicts(self, config-page(margin: 0em)) let new-setting = body => { set text(size: 44pt, fill: self.colors.neutral-lightest) show: box.with(width: 100%, height: 100%, fill: self.colors.primary) show: align.with(center + horizon) show: setting body } touying-slide(self: self, config: config, repeat: repeat, setting: new-setting, composer: composer, ..bodies) }) #let new-section(title) = heading(level: 2, depth: 2, title) #let new-section-slide( config: (:), repeat: auto, setting: body => body, composer: auto, title, ) = new-section(title) + touying-slide-wrapper(self => { let self = utils.merge-dicts( self, config-page( header: _header, footer: _footer, ), ) let new-setting = body => { show: align.with(center + horizon) set text(size: 34pt, fill: self.colors.primary, weight: "bold") show: setting body } touying-slide(self: self, config: config, repeat: repeat, setting: new-setting, composer: composer, utils.display-current-heading(level: 2)) }) #let unipd-theme( ..args, body, ) = { show: touying-slides.with( config-page( paper: "presentation-4-3", header-ascent: 0em, footer-descent: 0em, margin: (x: 0em, top: 12%, bottom: 12%), ), config-common( slide-fn: slide, // new-section-slide-fn: new-section-slide, ), config-methods( init: (self: none, body) => { set text(font: "New Computer Modern Sans", size: 24pt, fill: self.colors.neutral-darkest) show heading.where(level: 2): set text(fill: self.colors.primary) show heading.where(level: 2): it => it + v(1em) set list(indent: 1em, marker: text("•", fill: self.colors.primary.darken(20%))) // show strong: self.methods.alert.with(self: self) body }, cover: (self: none, body) => { set text(fill: (self.colors.cover)(self)) body }, // alert: utils.alert-with-primary-color, ), config-colors( primary: rgb(155, 0, 20), secondary: rgb(72, 79, 89), tertiary: rgb(0, 128, 0), neutral-lightest: rgb("#ffffff"), neutral-darkest: rgb("#000000"), cover: self => self.colors.neutral-dark.lighten(80%) ), ..args ) body } #let (alert-block, normal-block, example-block) = { let make_block_fn(mk-header-color) = (title, body) => touying-fn-wrapper((self: none) => { show: it => align(center, it) show: it => box(width: 85%, it) let slot = box.with(width: 100%, outset: 0em, stroke: self.colors.neutral-darkest) stack( slot( inset: 0.5em, fill: mk-header-color(self), align(left, heading(level: 3, text(fill: self.colors.neutral-lightest, weight: "regular")[#title])) ), slot( inset: (x: 0.6em, y: 0.75em), fill: self.colors.neutral-lighter.lighten(50%), align(left, body) ) ) }) ( make_block_fn(self => self.colors.primary), make_block_fn(self => self.colors.secondary), make_block_fn(self => self.colors.tertiary), ) }
https://github.com/juruoHBr/typst_xdutemplate
https://raw.githubusercontent.com/juruoHBr/typst_xdutemplate/main/utils.typ
typst
#let fake-par = style(styles => { let b = par[#box()] let t = measure(b + b, styles); b v(-t.height) }) #let hei(body) = text(font: "SimHei", body) #let kai(body) = text(font: "Simkai", body)
https://github.com/saffronner/systems-notes
https://raw.githubusercontent.com/saffronner/systems-notes/main/notes.typ
typst
#set image(width: 75%) #set page( numbering: "1 / 1", paper: "us-letter" ) #outline(indent: 1em) // lect 2024/08/29 = Bits, Bytes, & Integers == bit level manipulations - binary: get more precision over n-ary or smth - and (`&`), or (`|`), not (`~`), xor (`^`) - shifts - `x << y` - throw away extra bits at left - fill with 0s on right - $x dot 2^y$ - `x >> y` - throw away extra bits at right - unsigned shift: uses logical shift: fill with 0s on left - signed shift: uses arithmetic shift: replicate sign bit on left - _undefined_: shift amtn $<$ 0 or $>=$ word size - $floor(x " " \/ " " 2^y)$ i.e. rounding to left - to round to zero ($ceil(x " " \/ " " 2^y)$): `(x + (1<<y)-1) >> y` - logical `&&`, `||`, `!` - views 0 as false, nonzero as true - returns 0 or 1 == integers - limits - `UMax` $= 2^w - 1$ - `TMin` $= -2^(w-1)$ - `TMax` $= 2^(w-1) - 1$ - `-x = ~x + 1` in twos complement - but if `x = Tmin` (most negative two's complement), you get back `Tmin` === casting integers - constants are signed ints by default - specify `10U` for unsigned or `24L` for long - source of mistakes: make sure to, eg, `1ULL << 36` - signed $<-->$ unsigned: maintain bit pattern - may add/substract $2^w$ (`0b1000` is 8 unsigned, -8 signed.) - casting to larger? sign extend. - casting to smaller? drop significant bits. - mix of signed and unsigned in expression (eg ==)? implicitly casted and evaled in unsigned. === byte order #figure( table( columns: 6, align: center, $dots$, `0x100`, `0x101`, `0x110`, `0x111`, $dots$, $dots$, `01`, `23`, `45`, `67`, $dots$ ), caption: [big endian] ) #figure( table( columns: 6, align: center, $dots$, `0x100`, `0x101`, `0x110`, `0x111`, $dots$, $dots$, `67`, `45`, `23`, `01`, $dots$ ), caption: [little endian] ) // lect 2024/09/03 = Machine Programming == history - intel x86 processors - a Complex Instruction Set Computer (CISC), lots of instructions - Reduced: (RISC) can be fastish but esp good for low power - architecture: processor design spec?? needed to know how to write assembly/machine code?? - microarchitecture: implementation of architecture - machine code: byte-level programs processors exec. - assembly code: text readable machine code == assembly/machine code view #image("media/machine_code_summary.png") - integer registers: prof: "compiler %rsp 64 bit, %esp 32 bit, compiler will spit out whichever is smaller and fits your data so b careful." also stuff like "%eax vs %ax vs %ah/%al" - registers - eg, `%rax` for full 8 bytes of register, `%eax` right 4 bytes, `%ax` right 2 bytes, splitting further into `%ah` and `%al` for left and right halves of `%ax`. - see ref sheet - memory addressing modes: `D(%Rb, %Ri, S) = Mem[%Rb + (S * %Ri) + D]` - `D`: displacement of 1, 2, or 4 bytes. default: 0 - `Rb`: base register (any of the 16 integer registers) - `Ri`: index register (any except %rsp). - `S`: scale of 1, 2, 4, or 8. default: 1 // lec 2024/09/05 - `lea addr dest` instruction - sets dest to addr (eg `mov` instead dest to the value at that addr) - intended to calculate pointer to obj: eg array elem - compiler authors end up using it to do arithmetic - doesn't touch condition codes - which registers are pointers? - %rsp (top of stack pointer) %rip (current instruction/program counter pointer) always pointers - pointers near stack pointer or program counter pointer _probably_ also pointers. - `mov (%rsi), %rsi`: register used as pointer? value is probably pointer. - `(%rsi, %rbx)` one of these is a pointer, don't know which - `(%rsi, %rbx, 2)` rsi is a pointer, not rbx (why?) - `0x400570(, %rbx, 2)` 0x is pointer, not rbx (why?) (assume blank `,` is 0) - `lea (anything), %rax` idk bro === machine code: control - control flow - lots of GOTOs. c0vm moment - condition codes (status of recent tests): `CF, ZF, SF, OF` - set as side effect of arithmetic - Carry Flag: set if carry from unsigned overflow (or borrowing a 1 to make 0x0 - 0x1 work) - Zero Flag: get a 0 - Sign Flag: t < 0 - Overflow Flag: signed overflow - in GDB as eflags register (a flag isn't showing up? is set to 0.) - compare instruction (`cmp`) - computes `b-a` without setting `b`, unlike `sub` - used for `if` statements - `test` instruction - computes `b&a` (like `and`) wihtout setting `b` - used to compare `%rX` to 0 (`test %rX %rX`) - used to check if 1-bits are same in two registers, like normal `&` usage - `j...` instructions: jump to differnt parts depending on condition codes - `jmp, je, jne, jg, jge, etc` - `set...` these correspond to `j...` instructions - sets only the low-order byte to 0 or 1 based on `...` - usually use `movzbl` to alter remaining unaltered bytes. - `cmov` conditional move - for `val = Test ? Then_Expr : Else_Expr;` - used only when safe; both branches are computed - avoid bad performance, side effects, unsafety - loops exist. - do while, while, for loops (beginning conditional is often optimized away) - switch statements: jump tables - notice a jump to a jump table: `jmpq *0x4007f0(,%rdi,8)` and a bunch of suspicious `ret`s - to inspect a jump table in gdb, `x /8xg 0x4007f0` (8 outputs, hex, giant aka quad word) === machine code: procedures - need to be able to - pass control to procedure and back to return - pass data: args, return - manage stack memory - these are implemented via machine instructions, which are defined by Application Binary Interface (ABI) - the stack - grows top to down, bottom address is the "top" of stack: %rsp - first 6 args in registers, rest on stack - note: things have alignments and sizes. same for primitives. for complex (structs, arrays), alignments are of their largest component - note: when we see `sub $0x18, %rsp` for eg, we are "allocating" 18 bytes into the stack. or something. we will pop from stack later by adding 18 back to rsp. === machine code: data - going over arrays (1d, nd, multilevel), structs (alloc, access, alignment), floats - arrays - contiguous region of `length * sizeof(type)` bytes - therefore, nd arrays get row-major ordered - structs - fields ordered to declaration - each element must satisfy its own alignment requirement - entire struct (inital addr and its size) must be aligned to largest element's size - tldr just save space by larger data types first - alignment restrictions - 1 byte: `char, ...` - no restrictions on address - 2 bytes: `short, ...` - lowest 1 bit of address must be $0_2$ - 4 bytes: `int, float, ...` - lowest 2 bits of address must be $00_2$ - 8 bytes: `double, long, char *, ...` - lowest 3 bits of address must be $000_2$ - floating point - args passed in %xmm0, %xmm1, ... - result in %xmm0 - all XMM registers call-clobbered === machine code: advanced - Memory Layout: see the pdf - Buffer Overflow - Vulnerability - Protection - Avoid overflow vulnerabilities (eg validate: we know we need max `n` chars) - Employ system-level protections: randomized stack offsets, nonexecutable stack - Have compiler use "stack canaries": right after buffer on stack; check for corruption - Bypassing Protection: Return Oriented Programming attacks with gadgets - Unions == the memory hierarchy - "Memory Wall" or Von Neumann bottleneck: performance gap between cpu computation and ram data storage - Three approaches to work around it: - *Build a hierarchy* (covered in here in 213) - Find other stuff to do (346, 418) - Move computation (346, 7xx?) toc: - The memory abstraction - RAM : main memory building block - Locality of reference - The memory hierarchy - The memory mountain - Storage technologies and trends === the memory abstraction - bus: a collection of parallel wires that carry address, data, and control signals. - buses are typically shared by multiple devices. - buses do the literal running of info, eg, from cpu regs to ram === RAM - static (SRAM) - dynamic (DRAM) #image("media/RAM_slide1.png") #image("media/RAM_slide2.png") === locality - a key to bridging CPU-memory gap - principle of locality: progs use addresses near previously used addresses (data, instructions) - temporal locality: same items likely to be referenced again - spatial locality: nearby addresses likely to be referenced together - fun fact: can have $sum$ 3d array with better spatial locality by making $j$ the inner loop === memory hierarchy - properties of hard/software: - faster = more expensive, hotter, less capacity - CPU-memory gap widening - good programs usually have good locality - this together implies a memory hierarchy *that gives the illusion of both large and fast memory. as cheap as the large memory, but fast as the memory at the top of the ladder*: #image("media/memory_hierarchy.png") #image("media/caching_speeds.png") - caches are hardware controlled (invisible to software!), memory is software controlled - transfer unit sizes are called "blocks" - cache hit: data is needed from a cache *and it is there*! - cache miss: data is needed from a cache *and it is NOT there*! - the block is fetched from memory - the block is stored in cache: - placement policy: where does new block go? - replacement policy: what gets kicked out? (the victim) - types: - cold (compulsory) miss: first reference to block - capacity miss: \# of active cache blocks (size of "working set") > size of cache - conflict miss: like a hash collision === memory mountain - read throughput/bandwidth: bytes read from memory per second - memory mountain: read bandwidth as a function of spatial and temporal locality - characterizes memory system performance #image("media/memory_mountain.png") === storage technologies and trends TODO lol
https://github.com/magicwenli/keyle
https://raw.githubusercontent.com/magicwenli/keyle/main/doc/keyle.typ
typst
MIT License
#import "@preview/mantys:0.1.4": * // Vendored because of https://github.com/jneug/typst-mantys/pull/20 #let cmdref(name) = { link(cmd-label(name), cmd-(name)) } // End Vendored #import "../src/keyle.typ" #let lib-name = package[keyle] #show: mantys.with(..toml("../typst.toml"), date: datetime.today(), examples-scope: (keyle: keyle)) #show link: underline #set text(font:("Linux Libertine", "Liberation Serif")) // end of preamble = About #lib-name is a library that allows you to create HTML `<kbd>` like keyboard shorts simple and easy. The name, `keyle`, is a combination of `key` and `theme`. This project is inspired by #link("http://github.com/auth0/kbd")[auth0/kbd] and #link("https://github.com/dogezen/badgery")[dogezen/badgery]. Send them respect! = Usage == Importing #lib-name is imported using #codesnippet[```typ #import "@preview/keyle:0.2.0" ```] == Quick Start Generate a keyboard renderer with #cmdref("config") function. Section @available-themes lists available themes. #example(```typst #let kbd = keyle.config() #kbd("Ctrl","Shift","Alt","Del") #let kbd = keyle.config( theme: keyle.themes.biolinum, delim: keyle.biolinum-key.delim_plus ) #kbd("Ctrl", "Shift", "Alt", "Del") ```) There are `compact` and `delim` options to make the output more compact and change the delimiter between keys. You can either use them in #cmdref("config") function or directly in generated `kbd` function. #example(```typst #let kbd = keyle.config(compact: true, delim: "-") #kbd("Ctrl", "Shift", "Alt", "Del") #let kbd = keyle.config() #kbd("Ctrl", "Shift", "Alt", "Del", compact: true, delim: "-") ```) = Themes == Built-in Themes <available-themes> Themes function are available at `#keyle.themes` dictionary. #grid(columns: (2fr, 1fr), rows: 2em,align: horizon, ..keyle.themes.pairs().map(item => { let theme = item.at(0) let func = item.at(1) ( raw(lang: "typst", "#keyle.themes." + theme), [#let kbd = keyle.config(theme: func) #kbd("Home")], ) }).flatten()) == Custom Themes You can create your own theme by defining a function that takes a string and returns a themed content. #example(```typst // https://www.radix-ui.com/themes/playground#kbd #let radix_kdb(content) = box( rect( inset: (x: 0.5em), outset: (y:0.05em), stroke: rgb("#1c2024") + 0.3pt, radius: 0.35em, fill: rgb("#fcfcfd"), text(fill: black, font: ( "Roboto", "Helvetica Neue", ), content), ), ) #let kbd = keyle.config(theme: radix_kdb) #kbd("⌘ D") #kbd("^ F") ```) = Symbols == Mac Keyboard Symbols #lib-name provides symbols for Mac keyboard. You may need install `Fira Code` font to see the symbols correctly. - #link("https://fonts.google.com/specimen/Fira+Code?preview.text=%E2%8C%98%E2%87%A7%E2%8C%A5%E2%8C%83%E2%86%A9&query=fira+code")[Fira Code \@ Google Fonts] - #link("https://support.apple.com/en-hk/guide/mac-help/cpmh0011/mac")[Apple Mac Keyboard Symbols] #example(```typst #let mac-key = keyle.mac-key #let kbd = keyle.config(theme: keyle.themes.standard) #let mac-key-font = ( "Fira Code", "FiraCode", "FiraCode Nerd Font Mono", ) #grid( columns: (2fr, 1fr, 2fr, 1fr), rows: 2em, align: horizon, ..mac-key.pairs().map(item => ( raw("#mac-key." + item.at(0)), kbd( text(font: mac-key-font, item.at(1)) ), )).flatten() ) ```) == Linux Biolinum Keyboard Symbols #lib-name provides symbols for Linux Biolinum Keyboard font. - #link("https://libertine-fonts.org/")[Linux Biolinum Keyboard] #example(```typst #let biolinum-key = keyle.biolinum-key #let kbd = keyle.config(theme: keyle.themes.biolinum) #grid( columns: (5fr, 3fr, 5fr, 3fr), rows: 2em, align: horizon, ..biolinum-key.pairs().map(item => ( raw("#biolinum-key." + item.at(0)), kbd(item.at(1)), )).flatten() ) ```) = Available commands #tidy-module(read("../src/keyle.typ"), name: "keyle", include-example-scope: true)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/056%20-%20Outlaws%20of%20Thunder%20Junction/012_Epilogue%202%3A%20Bring%20the%20End%2C%20Part%202.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Epilogue 2: Bring the End, Part 2", set_name: "Outlaws of Thunder Junction", story_date: datetime(day: 02, month: 04, year: 2024), author: "<NAME>", doc ) #emph[On Vryn] Jace blinks sweat and oil from his eyes and shivers from fever. The small room smells equal parts haunting and nostalgic, like he's a ghost come to call long past his exit. The light from a nearby lamp glares and reveals; it makes the few cables he has left wince. He feels embarrassed for his homecoming to be in such an unnatural state. Jace marvels as his mother leaps into action; she engages without pause or question. <NAME> kneels, her hand on her son's cheek and her other hand pressing a bundle of her cardigan against the wound in his chest. Jace lies next to Vraska on his mother's floor, both bleeding and broken. He draws in a wheezing breath and feels her hands on his forehead that is clammy with fever. At once, he is an adult and child, remembering how small he was the last time his healer mother attended to his fever. Jace realizes he's slipping, sensing his mother's cognitive dissonance through the touch of her hand. He bashfully retreats. For a moment, he worries at what his mother will do in response to Vraska—a bloodied and mangled Phyrexian gorgon just landed in her living room. It takes a moment for Jace to remember his great fortune; his mother would have no idea what a gorgon is. There aren't any on Vryn. At best, his beloved looks like a snake monster, and at worst, she looks like a Phyrexian snake monster. If he weren't dying, he'd laugh. "Save him first," Vraska rasps, and Jace sees her tilt her head to make steady and trusting eye contact with his mother. "My name is Vraska. Your son is more precious than my life. Please help him." Of course, she remembers his mother. Jace sometimes forgets she saw everything. Ranna's brows are low, her expression focused and concerned. Her eyes flicker to Jace's (he sees his own in hers, their blue a clear and boundless lake) and hears in his mind a broadcasted question. #emph[Is she your wife?] It is a question so huge that Jace coughs at the weight of it. His #emph[wife] . He had never dared to think of her in such a small container. But when he imagines her wearing his family's colors, venturing across planes with his grandmother's earrings on a sensible chain around her neck, Vrynian nuptial bracelets on both their wrinkled and arthritic hands … for a moment Jace loses himself in hope. His mouth is a hard line as he answers her in turn. #emph[She is my world, mother.] Ranna takes a moment and nods. "No need for martyrs, both of you are getting fixed up. Now Vraska, I need you to count down from ten for me, can you do that?" The pain is overwhelming now. It seizes Jace's muscles and pulls him under. His chest is on fire; his open sores scream at the cold air. Vraska weakly counts aloud next to him— "Ten … nine …" As Jace anticipates the eight, he sees Ranna cast a ward on her fingertips, a light cyan shimmer that glistens in the low light. She raises her hands, and both son and beloved rise with them. Jace wants to thank her, but instead feels himself drift into unconsciousness as Ranna whispers to them both a song of sedation, for the first time in decades singing her son to sleep. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) He wakes in a bleary haze of incense and smoke. His mother's expertise is carefully knolled around the nexuses of his body: a horse skull at his feet, river rocks at each open sore from the cables, an upturned bell on top of the bandages of his chest. Jace is no healer but even he can sense the flow of energy from each object to each point. And with a tired and anguished turn of his head, he understands where he is. Ranna had moved them both into a healing room he recognizes as his old childhood bedroom. There is the stain on the ceiling he'd stare at every night; there, high on the shelf, is a horseshoe from the first Pewter. The room feels so much smaller now as an adult. Ranna is kneeling over Vraska, a bright light shining over his beloved's skin as his mother kneels over, her hands aglow. "I can't lower her fever," she says. Oh. #emph[That was me] , Jace broadcasts to her in response. "You become a healer too in the last thirteen years?" she says with acrid marksmanship. #emph[It was the best I could think of. I commanded our bodies to generate a fever to burn out the phyresis.] Ranna nods. "Your command raised both of your bodies' defenses to do what would have taken me two days of treatment." There's a "good job" in there somewhere; Jace can smell it. His mother has hardened up while he was away. She lifts her head, staring straight at Jace. "Did Alhammarret fail to protect you?" He doesn't understand. #emph[Protect me?] "From whatever killed him. We all thought …" Ranna pauses. She looks so much older now. "We all thought you died with him. That's what both armies reported. So, what killed him?" There is no atonement that can soothe the lines in his mother's face. Vryn spent thirteen years thinking he was dead when the truth was far more meaningless. What hell did he put her through? Jace's chest hurts. His lip trembles. Ranna narrows her eyes. "Show me what happened." Her request makes Jace's heart ache, not because of the wound Elspeth left in his chest, but because she knows him still. After all this time, his mother knows her son and his gifts. So, he does, all in one go. All of what happened the night he first planeswalked, a broad glimpse of the last thirteen years. Ranna gasps and falls back to her seat. What he shows her is an accelerated summary: #emph[Alhammarret, betrayal, forget, forget, forget shame, remember love, love, mom, this is my love, save us, we did not ask for this.] Ranna audibly swallows. "He lied to you, and you forgot … everything? Even us?" Jace doesn't have the strength to nod. His mother blinks, visibly thinking, eyes darting as if reading something midair, and Jace realizes he does the same thing when working his way through new information—the familiarity aches. But it's Ranna's next question that catches him off guard. She presses hard with her bundled-up cloth against the wound on his chest and asks him steady and deadly, "Did you kill him?" He cannot respond, he cannot move, but Jace's expression darkens all the same. Ranna nods for him. "#emph[Good] ." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Jace awakens, his arms bandaged, his chest glowing with a compress that smells floral yet astringent. The pain is muffled, broad, and difficult to pinpoint; there must be a spell masking it. He takes a rasping breath and blinks; the fever is still here, but the small pile of metal and cables in the corner says that his body is still fighting off the phyresis. Vraska is asleep on the table next to him. Jace #emph[feels ] something nearby, a frantic and lively energy, like midsummer sun, and notes a long orange feather lying across her forehead. He can see the edges flicker, a plasmid curl that continues down the feather's edges as a long-lit candle. He watches it burn without burning as Ranna enters with a tincture in one hand and a bowl of soup in the other. "What does that do?" he croaks, noting the pinion. "It's a phoenix feather. Can you feel it? It was on you before, while you were unconscious." Ranna smiles. "It is an alternative to organ replacement I developed. Full living tissue turnover, sears out the affected organs, accelerates necrosis, then turns that dead tissue into a living replacement. Bet you thought you were the only prodigy in the family." "Didn't know I had a family for thirteen years." "Well. You do." Ranna pauses, considering. "And you've done well. Vraska is beautiful," Ranna says, regarding her with a smile. "Is she kind?" Jace smiles. "She is kind to those who deserve kindness." "Then she's wise, too." Ranna sets both soup and medicine at his side. "At this rate, I'll be able to wake her tomorrow. Keep doing your part, kiddo. It's helping." Jace hadn't stopped his mental commands to them both. #emph[You have a virus. Burn, fight. Eliminate the virus.] The commands run on a loop in the back of his mind. It tires him, but he tries not to think about it. "I'm sorry I didn't come sooner," he says quietly. "I was ashamed I forgot you." Ranna nods, her mouth tight. "I'm ashamed of who I became after you died—left." Jace is glad for a moment his parents just assumed he was dead. He notices the empty liquor bottle on the table behind her. She coaxes another plate of metal from Vraska's skin and quickly places a hand on the spot to bathe it in light. "Think that means we're square." She locks her feelings away so easily, Jace thinks, but perhaps he always knew that. "Where's dad?" he asks. She shrugs a little. It's a small and empty gesture. He understands. "We separated. He went for the frontier as a mage-ring engineer. I joined the army as a field medic. Healing the living felt more useful than developing healing theory alone. It's been one Armageddon after another around here. All kinds of militia taking over, then getting killed, then another taking over …" she pauses, shakes her head, exhales an even shakier breath. "Jace … this war came for you too early. I should never have let you near that sphinx." She takes his hand. They share a charged look. "But even if you didn't become his apprentice, the war would have come for you, too. The wars always come." He knows. He knows. He knows. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) He's well enough now to walk to the bed his mother set up in the living room. It may have been two days, or it may have been two months. He can't really tell. Mostly he sleeps—a deep and restorative oblivion. Best he's ever slept in his life. He blinks back to wakefulness after his second nap that day, automatically reminding his body to turn off the warning flare of pain from his still-healing injuries. Vraska's voice from her seat at the dining table makes him stir. "—don't understand how they knew it was him." His mother makes a neutral noise. "The general recognized him, he was … influential, when he was younger. We can't let him out on the street, or if he does, he needs to disguise himself. There's a warrant for his execution." They're talking about him. What he did. Jace decides to remain quiet and listen. "… it wasn't us, Ranna." Vraska is steady, but he hears her anger at the injustice. "We weren't in control. How are we supposed to be held accountable for actions we did not choose?" "You're not. I think you just start over." His mother pauses. There's the sound of pouring water, of a single plunk of sugar in a cup. Vraska murmurs a thank you. "How did you meet Jace, Vraska?" Please#emph[ don't say the real answer] , he wills. "On an island." He sighs in relief. "He was handsome, funny. Curious to a fault." Jace feels himself blush. "He's always been curious," says Ranna. "One time he wanted to know what I did at the hospital, so he followed me in secret. I only found out when he bumped into me mid-surgery with #emph[my ] lunch in his hands." Vraska grins with mirth, all teeth. "What a #emph[scoundrel] ." Jace can't see them clearly from this angle but sees the tiredness in both their silhouettes, how their shadows stretch wide and solid up the wall in the lamplight. Even in the quiet gaps of conversation, these two women command the entirety of the space. "He always meant well. We didn't figure it out until much later, but he was using his magic much earlier than we suspected. One time when he was young, he was so upset our building's cart-horse was ill, he illusioned up a copy of the horse and tried to put tack on it. Of course, we had no idea Jace was the one who made it. This was before we knew he was a telepath, let alone an illusionist. We found him with the horse and assumed he had come across some spy-spell. Poor Jace, he was so mad when the saddle kept falling through its back." "He created a fully coherent illusion as a #emph[child] ?" Ranna nods her head, a smile on her lips. "Oh, yes, the block's horse was Pewter. Jace was so upset when he died. Kept that double around for weeks. I think he loved the copy of Pewter more than he loved the actual horse." Vraska goes quiet. "Ranna, thank you for all of this." "How is today?" His mother always asked that as a way to ask patients what their pain level is. Jace remembers her asking that every day he returned from school. Vraska becomes small. "… I remember too much. It wasn't me, but I … killed, hurt, so many people. I'm not sure how to go back to being guildmaster again." Ranna takes her hand. "I'll tell you what I could never tell my son," Jace hears, unseen in the other room, "The old you is dead. You can never be that person ever again." Jace's breath catches in his chest. "You are your son's mother," Vraska says gently. "Thank you, Ranna." Vraska sounds comforted by that; Jace is anything but. The old him is dead, his mother is right. The Living Guildpact, the oathtaker, the pirate, the sphinx's weapon of war. That person died when Phyrexia stole his body to kill his countrymen. He is someone else. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) They stand at the edge of the uncanny, a broad bluish triangle that looks and feels and smells so familiar, their hearts beat to the same rhythm as its pulse. It is new and familiar at once, and the strangeness of seeing a physical manifestation of what was once private and individual feels decadent, perverse. Jace feels Vraska grow stiff and uncomfortable the closer they get. They heard about the portal through Ranna, who came home excitedly to talk about the very nice kor she met at the hospital, and now they stand before it, an Omenpath. Jace has illusioned them a different face to avoid suspicion (and his warrant). Vraska looks at the Omenpath with disdain as she inspects the edges. "They aren't supposed to exist." Jace had half expected to find optimism in the portal, a way to connect the Multiverse further, but now, standing in front of it, all he can see is consequence. "Everything we did as the Gatewatch we could only manage because the threats were contained. Look at what Bolas and Tezzeret did with just one portal. Now this …?" "On this scale there'll be conquerors collecting planes, cretins smearing violence across the Multiverse, and no way to stop them. No way to corral and curb. No way to punish." Vraska looks at him. "Jace. We have to do something." Jace understands, but his exhaustion weighs too heavily. The wounds too fresh. "Why us?" She looks exasperated, but all Jace can do is take her hand, squeeze it to remind her what is real, here, now. "We got out with our lives, Vraska. That's enough for me. I want to think about what's next for us." They meet eyes. #emph[What ] is#emph[ next? ] Jace remembers his mother's question, #emph[is that your wife?] The vision he holds of her in Vrynian formals, his family's blues and patterns complementing the green of her skin. He imagines a child of their own. The look in her eyes says that she imagines a similar future. "You'd make a phenomenal parent." She says. "So would you." "We'd need to …" "Adopt," Jace says quickly. Then smiles with a blush. "I don't think it would work." "Adopt," Vraska nods quickly, wincing an acknowledgment, "I think we'd know by now if it did." She snorts a laugh. Jace can't help but smile in turn. It feels good to see her laugh again, especially good to see her laugh at the impossibility of their coupling. The Multiverse is miserable entropy, but there is meaning in the clasp of their hands. As if reading his mind, Vraska's lips purse. "Does it make sense to raise a child in this Multiverse?" She says, worried. "Is repair even possible?" "I'm sick of repair," Jace sighs. "What is the point of repair when everything will fall apart anyways?" His beloved, the woman who would be his wife, looks to the Omenpath with a haunted expression. "The Multiverse is too broken to fix." Jace thinks of fire. The phoenix feather that brought Vraska back to him. "So, what if we do something other than fix it." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) A tempting and heinous idea pulses in the background of their world as a heartbeat. It is urgent and unrelenting, and once they both realize the other was thinking it, the contagiousness became impossible to look away from. They dream of abominations, of revolution. The ease and allure of phoenix feathers. Over the months they spend on Vryn, Jace and Vraska talk, and over time, accept that their old lives have ended. They talk about how one war will forever follow the others, and how this Multiverse bends only toward suffering. Suffering their kind accelerates. And they talk about how sometimes at night Jace still feels the power of the sylex dancing across his nerves. They agree that the most just option is the one that clears a future for all, and they mourn that the cost of that freedom will be high. Repair does not clean. Restoration does not erase. But rebirth … rebirth does both. The telepath and the gorgon dream of phoenix feathers. #emph[Nothing dies] , she says, #emph[it only transforms—] #emph[—because change is the only constant] , he finishes. Their intention crackles in the coals and spreads its wings from cinders. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Nine Years Ago on Thunder Junction] Jace is achingly young, barely twenty, wandering red dirt in the shade of a great tumbleweed, its curves stretching high above into a broad sky. Wild horses graze in the distance, and it makes him feel empty. He searches for a plane that reminds him of a place he ought to know but can't remember. Tezzeret sent him here to find something the great dragon <NAME> was afraid of. From the tone of the assignment, Jace gathered Tezzeret couldn't get inside. So now, Jace stands at the great entrance to the Fomori vault. He closes his eyes and puts a hand on the door, uncertain what good telepathy will do where telekinesis seems more helpful. And yet, to his surprise, he feels a mind deep within the vault, sleepy with torpor, childlike and quiet. There's a barrier between, something that prevents him from psychically reaching inside. When Jace returned to tell Tezzeret what he found, the leader of the Infinite Consortium only scoffed. "Great, another weird kid." They never talked about the Fomori vault again. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Two Years Ago on Ravnica] But years later, in a moment of curiosity, Jace remembered what shouldn't be forgotten and found the answer he was looking for in the months after the War of the Spark over tea with a dear friend. "I've heard of that vault, yes. There are others like it, on planes across the Multiverse. Relics of an ancient empire long lost to history. Lost to #emph[most] , anyway," Tamiyo had said, setting her cup down and taking a scroll from her satchel. "Would you like to hear the story?" #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) All three of their conspiracy, Ranna, Vraska, and Jace, stand in the living room. They are healed and brimming with purpose, dead set on their destination. Jace kisses his mother goodbye, and he can smell alcohol on her breath. "Once a week," Ranna says, squeezing her son's hand. "Once a week," he affirms, squeezing back, a great sadness in his eyes. Vraska hugs Ranna, "I am so glad to have met you. You gave us a second chance. Thank you." She nudges Jace. "I'll give you a moment," she says and walks to the kitchen, out of earshot. "Mom. Thank you. You saved us." "You saved me," she replies with yet another hand squeeze. "And you abandoned me … I don't know if I can forgive you for that. But I know it wasn't your fault." "Then who's to blame? For me forgetting, for Dad leaving, for the war …" Ranna shrugs. She looks so tired. "No one. There's no blame or reason. I'm sorry, kiddo. The world bends toward misery." He hugs her again. "Not this time. We're going to make it all right, Mom." "If anyone can do it, it's you, my miracle." She kisses his forehead. Vraska returns, and they clasp hands, prepared to planeswalk for the first time in months. "Ready?" "Ready." Jace steps forward into oblivion, and Vraska takes a step onto the carpet. Her eyes are wide. Jace feels it as something akin to his ears popping, like the pressure had ascended and some gap was left in midair where Vraska stood. He steps back into Vryn, feeling for Vraska's shoulder. She lurches forward, her hand to her heart, her throat, her head, tapping and feeling for something that isn't there. She staggers, winces from the pain, and just as Jace leans to help, she lets out a gasping sob. "I can't feel it. I can't feel it anymore." "Feel what?" "I can't planeswalk! Can you?" Instantly he allows his body to shift, standing half in and half out of the Blind Eternities, his feet and legs vibrating with his own cerulean glow. Vraska closes her eyes, concentrates, and gasps. "It's gone." She collapses into a nearby chair, and Jace draws close, whisking her into an embrace. Vraska's breath is too fast, her arms shaking with fear. Suddenly, she presses her forehead to his. "#emph[Find it] ," she commands. Jace understands innately what she means. He opens his mind to hers and dives in. He searches, scours every part in every door she leaves open, but nothing. That #emph[thing] , her spark, whatever it is that allows her the gift they share, it isn't here. As he emerges, it's his tears that signal to Vraska it is truly gone. She openly weeps, and it is the first time Jace has heard her cry. He thinks of her collections, all the wonders she loves from her travels, and all the places they were supposed to go together. "I don't know who I am without it," she whispers in his arms. #emph[The old you is dead.] #emph[We can never be those people again.] Jace weeps with her at the meaninglessness of it all and vows to make meaning of their own. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Ranna remakes their bed. Vraska unpacks her bag. The calamity they conspire takes on new urgency. She turns her grief into purpose with furious alchemy, takes over the wall by the bookcase, and plots as if her life depends on it. And Jace, charged with intent, gets to work. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Twelve Months Ago on Eldraine] Jace likes Eldraine; the rules that govern this plane are joyous and chaotic at first glance but crystallize into perfect sense when you learn how to look at it. He admires the logic inside its whimsy. He came to this jail to find a prisoner—knocking the guards unconscious is easy enough, so easy he doesn't even need to be invisible to do it. The guards' armor clangs against one another as they collapse into a shared dream. Stepping over a body, Jace runs his fingertips along the stone walls. He walks down the long row of sealed doors and casts an illusion to borrow a face, his features blurring and washing away, leaving the most frightening and helpful visage he knows. #emph[It has to be someone no one else can trust] , Vraska had said. #emph[Someone] #emph[ no one would ask questions about.] Jace had met Ashiok once. Once was enough. He slows his gait and puppets the illusion; a lilting glide, elbows raised, hands delicate despite the claws, chin tilted upward. Jace remembers something Judith of the Rakdos once said in confidence: a great performance is #emph[never ] facsimile; it must always be built from a truth. The more he wears illusions, the more convincing he becomes; Jace has found so many truths this past year. In this moment, he coaxes a sense memory powerful and virulent to the surface; the blood-slick, whites-of-the-eyes sensation of #emph[knowing ] that you are terrifying. He's felt it before—the feeling of others being afraid of him. Jace hated it then, but now, perhaps, there's power in being monstrous. It's a role he'll need to be comfortable with—this won't be the last time he wears this face. Well, half of a face. Inside the cell at the end of the row of doors is Eriette, the wicked witch. Jace as Ashiok smiles without eyes and curls his fingers around the bars of her cell. Eriette smiles back. "Well, my dear, what took you so long?" #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Six Months Ago on Ixalan] Vraska hates that she's here without him. She won't stay long. #emph[Ixalan next] , she had planned. #emph[Let's give our friends something to do] , Jace suggested in turn. He had followed several strangers through several Omenpaths to find the one that she could take safely—Vraska was getting better at not being annoyed for needing help. She knew this plane would lead next to Thunder Junction, which was something to look forward to—at last, she'll work alongside her illusion-masked partner in crime. When Jace had suggested his disguise for their task, she teased him it was a face too fun to pass up, and sure enough, through nights of rehearsing in the living room and scaring his mother half to death, they all agreed he had the right choice. Turns out, he's a good actor. Luckily, so is she. The floating city of High and Dry is just as she remembers it, bustling, creaking with the waves. It's a place she feels glad to return to. She feels most herself here. It takes less than an hour of searching its creaking-ladder walkways and hunting its docks to find who she's looking for. She's relieved; if they weren't here, then they'd be on the #emph[Belligerent ] in the middle of the sea. Breeches is easy to hear, and Malcolm is easy to spot. "GIANT MUSHROOM," the goblin hollers. "GIANT MUSHROOM. TOO MANY OPINIONS." "Sentient," the siren patiently corrects. "It was #emph[sentient] —" Vraska grins and steps out. "Hello, boys. You sound like you need a job." Their response is enthusiastic, brimming with happy tears, an equal yell from both siren and goblin. "CAPTAIN!" #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Last Month on Ravnica] Jace prowls the Golgari undercity. He's been following his mark for some time. Proft and Etrata are bargaining with Izoni. #emph[How can we manifest it? ] Vraska said. #emph[There's a detective back home who can project his psychic print into reality] , Jace had recalled. His love had nodded, pinning a note to the wall. #emph[We need to discern how his abilities differentiate from yours] , she said. #emph[Get in his head.] Jace now watches their conversation from the shadows. Standing just far enough in the light to be caught, he waits as a lure. At last, the detective glances up, eyes narrowed, and Jace takes off. He feels Proft's alarm, how he gives chase behind him—Proft is spry, faster than Jace expected, but running just as planned. Jace's cloak flares behind him. He readies a lead pipe and dodges around a corner just as he senses the detective's desperate reach. Jace turns, swings the pipe as best he can, and feels satisfying contact as he knocks Proft to the ground. Vraska would be so proud of his violence. Jace smiles. He kneels, extending his hand, his eyes set alight, and the mental link is made. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Presently on Thunder Junction] The heat of the desert is thin and stinging. It makes Jace shed his cloak as a tithe to the rock and sand. He leaves it folded and forgotten on the sandstone block he rests on under the scraggly shade of a fragrant pinyon pine. There's no sound in the meeting place they had decided on, or at least no people—the skitter of a bighorn sheep on the rockface up above clatters through his attention, but only moments later all he can hear is the beating heart of his anticipation. She's coming. A rock tumbles in the distance, and Jace sees Vraska as she carries their prize down the rock and scree of a shady hillside. He's alive, impossibly. They had suspected he would be in a state of suspended animation but didn't expect him to be so young. Vraska carries him now, roly-poly as a toddler, and the boy (Tamiyo's text said it was a boy) seems all too happy to take in the world around them. He holds onto her desperately, and Jace wonders if he cannot remember his own parents. #figure(image("012_Epilogue 2: Bring the End, Part 2/01.jpg", width: 100%), caption: [Art by: Gaboleps], supplement: none, numbering: none) "Hello #emph[again] ," Vraska says with knowing mirth. "Thanks for taking the rubber mask off." "Ha, ha," Jace says, smiling despite the false laugh. They hug close. "What, don't want to kiss me without eyes?" "It's the lack of a nose, I feel like I'm kissing the inside of your face. This is better." "Fair. Is this …" "He's had a big day," Vraska says softly, bouncing the Fomori treasure on her hip. She lets him down, and Jace finds himself instinctively kneeling and holding out his hand. "Hi there," he says. The child perks up in attention—it understands him, good. "My name is Jace. What's your name?" The child chirps a bit, and Jace is pretty sure that's as close to spoken language as they'll get for a bit. "I'm a telepath, that means I can read minds. May I read your mind so I can say your name correctly?" Uncertain at first, but then with happy compliance, the child nestles its head under Jace's hand. Jace's eyes light up, and he gasps. "What is it?" Vraska kneels, worried, as the child flinches slightly in response. Jace shakes his head in assurance. "It's alright! I'm sorry. I didn't mean to scare you both." A tear slides down his cheek. Awe overtakes him. "His name is Loot." Vraska snorts. "Were his parents Plunder and Ransack?" "Vraska." "Sorry, Loot." She pats him apologetically, but the offense seems to have gone over his adorable head. "You're still in there," she says, referring to the blue light in Jace's eyes and his faraway gaze. "We knew he would be a map but … gods, I didn't realize it would be like this." "Can you see it?" "It's … It's the entire Multiverse. I can see every plane as a point of light, and within each point, more in turn where those connect with other places … They're Omenpaths. Vraska, it's in real time. I can see planes being born from the World Tree, planes dissolving into black holes of aether. It's the way to get from every point to every point. Vraska … you can use this to travel the Multiverse again." He can feel her tense. "It maps the end point of every Omenpath?" "Every one." He squeezes her hand with his free one. He shivers. "What is it like?" Vraska asks. A soft and delicate smile breaches his face. He huffs a laugh and doesn't bother to hide his veneration. When he replies, his gaze almost looks through her. "It's like looking at eternity." Jace finishes and wipes his eyes. He keeps his attention focused on Loot. "You did so good. Thank you, Loot." He makes close eye contact, and Loot draws close. "Loot, we need you to know that Vraska and I will protect you with all of our strength. We'll keep you safe," Jace promises. He looks to his beloved and sees Vraska nod, warm and earnest. Loot chirps with fresh affection. Jace then flickers a look to Vraska. "And I imagine #emph[you ] could use some quiet." "Mostly a bath," she smiles with a kiss. So, a bath they seek. They find it in a nearby four-horse town at an inn that doesn't ask questions. In the quiet of their room at the inn, Jace holds Loot, sleepy and content on his lap. He lovingly runs his thumbs over the child's forehead. The child had gently given the invitation, and Jace made sure he was comfortable in return. Looking through his mind was overwhelming. Where the usual interior was crystalline and delicate, Loot's was vast, solid as steel, and, as far as Jace could tell, endless. Jace closes his eyes now, skimming the map in the child's mind and quizzing Vraska on her travels. "How about a plane with someplace called Qarsi? You been there?" Vraska brings over her coffee. "I have! It's a palace and the settlement around it. Purple banner in the kitchen." She smiles, and in a happy half-tune adds to Loot, "He knows how to get to Tarkir." "What's Tarkir like?" Jace asks. Vraska sits on the bed next to them and gently nuzzles Loot's snout to his delight. She plays with her voice as she speaks, rubbing her tired feet but directing the answer to Loot with warmth and child-friendly intonation. "Tarkir is beautiful, massive. There are great big mountains, thick jungles, wiiiiiiide, open steppes, and lots of different peoples. But if you know Tarkir, then it means #emph[you] know how to get us restocked on the #emph[good ] tea." "Do they have good coffee?" She grins and purrs with dangerous promise, "They have coffee that is #emph[cold] ." "Wait, seriously?" "I had it in Qarsi. They use a spell to chill it, then put sweet cream on top." Jace narrows his eyes. "Where?" A brief mental exchange, two glass steins nabbed from the bar, one solo planeswalk, and twenty minutes later, Jace returns from the aether with two full steins of sweet, cold coffee and six bundles of fresh food. Vraska and Loot cheer at his arrival, and Jace disperses the meal. For the first time in decades, Jace remembers the fortune of family. The scent of fish curry and braised pork and sticky rice and fermented noodles waft downstairs to mingle with the tobacco and whiskey and piñon of the saloon below. Jace smiles and kisses his beloved as the child in the room giggles, alone no longer. This moment is portent. It is an omen. Tomorrow the three of them will walk through a portal that shouldn't exist to a plane that won't see them coming, which is just what Jace wants. They will pack their bags for their journey, shake off the dust of one plane, and hoist Loot onto their hips. Jace and Vraska will pull down their sleeves over the scars from their phyresis, kissing their way up the healed wounds on their arms. The scar tissue is their pact. It is the shared acknowledgment that not only do bad things happen, but they also happen without cause. This Multiverse is a maelstrom without end. There is no hope of eliminating the cruelty and injustice of existence. But in those scars, in that pact, their strange little family carries with them the hope they have chosen. Jace will walk forward into the Omenpath, sanguine and resolute. He will hold tight to the hand of his beloved and his ward and walk into the Blind Eternities of a miserable Multiverse and say to himself with resolution and phoenix fire: #emph[Ours will be better.]
https://github.com/ludwig-austermann/typst-timetable
https://raw.githubusercontent.com/ludwig-austermann/typst-timetable/main/colorthemes.typ
typst
MIT License
#let colorthemes = toml("lib/colorthemes.toml").pairs().map( theme => ( theme.at(0), theme.at(1).map(c => box(height: 20pt, width: 20pt, fill: color.rgb(c.at(0), c.at(1), c.at(2)))) ) ) #let max-size = colorthemes.fold( 0, (acc, x) => calc.max( acc, x.at(1).len() ) ) = Color themes / palette in this package Taken from `ColorSchemes.jl` package with can be found here: #link("https://github.com/JuliaGraphics/ColorSchemes.jl") #table( columns: max-size + 1, inset: 1pt, row-gutter: 9pt, stroke: none, align: horizon, none, ..range(1, max-size + 1).map(x => align(center, str(x))), ..colorthemes.map( x => { let l = x.at(1).len() if l < max-size { (raw(x.at(0)), ..(x.at(1) + (none,) * (max-size - l))) } else { (raw(x.at(0)), ..x.at(1)) } } ).flatten() )
https://github.com/mitex-rs/mitex
https://raw.githubusercontent.com/mitex-rs/mitex/main/crates/mitex/benches/oiwiki-with-render.typ
typst
Apache License 2.0
#import "bencher.typ": * #let data = json("/local/oiwiki-231222.json"); #show: integrate-conversion.with(data: data, convert-only: false)
https://github.com/remigerme/typst-polytechnique
https://raw.githubusercontent.com/remigerme/typst-polytechnique/main/page.typ
typst
MIT License
/***********************/ /* TEMPLATE DEFINITION */ /***********************/ // Defining all margins // For now : same as LaTeX template from TypographiX // (already validated by DIRCOM) #let margin-default = ( top: 40mm, bottom: 35mm, left: 20mm, right: 20mm ) // Bigger margins yeay #let margin-despair-mode = ( top: 1.2 * margin-default.at("top"), bottom: 1.2 * margin-default.at("bottom"), left: 1.5 * margin-default.at("left"), right: 1.5 * margin-default.at("right") ) // Applying margins and other page-related setup #let apply(doc, despair-mode: false) = { set page( paper: "a4", margin: if (despair-mode) { margin-despair-mode } else { margin-default } ) set par(justify: true, first-line-indent: 20pt) doc } // Applying header and footer setup #let apply-header-footer(doc, short-title: none) = { set page(header: { grid(columns: (1fr, 1fr), align(horizon, smallcaps(text(fill: rgb("01426A"), size: 14pt, font: "New Computer Modern", weight: "regular")[#short-title])), align(right, image("assets/logo-x-ip-paris.svg", height: 20mm))) }, numbering: "1 / 1") counter(page).update(1) doc } /********************/ /* TESTING TEMPLATE */ /********************/ #show: rest => apply(rest, despair-mode: false) #set page(header: "I'm a happy header") #set page(numbering: none) = Testing basic feature == You know #lorem(200) #lorem(100) == Sometimes === You get real bored #lorem(10) #footnote[I'm a happy footnote.] #lorem(250) === Pov le stage #lorem(100) #set page(numbering: "1.1") #counter(page).update(1) #lorem(400) == La vie c'est cool #lorem(150)
https://github.com/WinstonMDP/math
https://raw.githubusercontent.com/WinstonMDP/math/main/knowledge/Euclidean_rings.typ
typst
#import "../cfg.typ": cfg #show: cfg = Euclidean rings $a$ is a divisor of $b := b$ is a multiple of $a := a divides b := exists k: b = k a$. $a, b$ are associated $:=$ + $a divides b$. + $b divides a$. $forall a, b in$ an integral ring $thick exists$ an invertible element $c: a = c b <-> a, b$ are associated. A function $f$ is a norm $:=$ + $A$ is an integral ring. + $f: A without {0} -> NN$. + $op(f) a <= op(f) a b$. + $forall b !=0 thick exists q, r: a = q b + r and (r = 0 or op(f) r < op(f) b)$. An integral ring is Euclidean $:=$ it has a norm. $"GCD"(a, b) := c:$ + $c divides a$. + $c divides b$. + $forall d: d divides a -> d divides b -> d divides c$. $"LCM"(a, b) := c:$ + $a divides c$. + $b divides c$. + $forall d: a divides d -> b divides d -> c divides d$. $exists "GCD"(a, b)$. $exists u, v: "GCD"(a, b) = a u + b v$. A noninvertible nonzero element $p$ is prime $:= exists.not$ noninvertible elements $a, b: p = a b$. $p divides a_1...a_n -> p divides a_1 or ... or p divides a_n$. $b divides a -> c divides a -> "GCD"(b, c) = 1 -> b c divides a$. $exists!$ decompostion of a noninvertible nonzero element into multiplication of prime numbers. $exists$ infinity number of prime numbers. $forall f in ZZ[x] thick forall u, v in ZZ: op(f) u/v = 0 -> "GCD"(u, v) = 1 -> u divides a_0 and v divides a_n$. $forall f in ZZ[x] thick forall g, h in QQ[x]: f = g h -> exists lambda in QQ without {0}: lambda g, lambda^(-1) h in ZZ[x]$.
https://github.com/LEXUGE/dirac
https://raw.githubusercontent.com/LEXUGE/dirac/main/manual.typ
typst
MIT License
#import "@lexuge/dirac:0.1.0": * #import "@preview/physica:0.8.0": * #register() #defn($bold(nabla)$, visible: false) #defn($diff$, visible: false) Define #defn($vb(E)$), #defn($vb(B)$) as the electromagnetic field, and with $#defn($epsilon_0$), #defn($mu_0$)$ as constants, we have $ curl #genlink($vb(E)$) = -pdv(#genlink($vb(B)$), #defn($t$)) $ Note in the above equation, $vb(E), vb(B)$ are linked to their definition in text. `dirac` also checked in background that all symbols and operations are defined. The following equation, for example, would error: ```typst $ E = m c^2 $ ``` as variables (`dirac` is so strict that I cannot even write `E` and `m`, `c` in math mode without defining it here) are not defined. Note we have to "define" in `dirac` $bold(nabla)$, $diff$ invisibly. You could control visibility to suppress displaying what you define in order to better cope with external libraries (e.g. `physica` here). Here is how our user definitions are registered in "Dirac": #user_defns.display()
https://github.com/sthenic/technogram
https://raw.githubusercontent.com/sthenic/technogram/main/src/to-string.typ
typst
MIT License
/* Naive implementation of turning _simple_ content into a string. Borrowed from https://github.com/typst/typst/issues/2196. */ #let to-string(content) = { if content.func() == smartquote { if content.double {"\""} else {"'"} } else if content.has("text") { content.text } else if content.has("children") { content.children.map(to-string).join("") } else if content.has("body") { to-string(content.body) } else if content == [ ] { " " } }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/gradient-hue-rotation_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test in OkLCH space. #set page( width: 100pt, height: 30pt, fill: gradient.linear(red, purple, space: oklch) )
https://github.com/LuminolT/SHU-Bachelor-Thesis-Typst
https://raw.githubusercontent.com/LuminolT/SHU-Bachelor-Thesis-Typst/main/template/toc.typ
typst
#import "font.typ": * // 目录 #let toc() = { pagebreak() v(1em) align(center)[ #text(font: songti, size: 16pt, "目 录") ] parbreak(); set text(font: songti, size: 12pt) [摘要] + [.] * 144 + [ 1] parbreak() text(font:songti)[ABSTRACT] + [.] * 133 + [2] show outline: it => { set text(font: songti, size: 12pt) set par(leading: 1.5em ) it } outline( title: none ) }
https://github.com/saYmd-moe/note-for-statistical-mechanics
https://raw.githubusercontent.com/saYmd-moe/note-for-statistical-mechanics/main/contents/PartI/PartI.typ
typst
#import "../../template.typ": * = 热力学
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/09-layout/line-word.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note #import "/lib/glossary.typ": tr #show: web-page-template // ## Line breaking & word detection == 断行与分词 // ### CJK === 汉字 // ### South Asian scripts === 南亚#tr[scripts]
https://github.com/OCamlPro/ppaqse-lang
https://raw.githubusercontent.com/OCamlPro/ppaqse-lang/master/src/étude/Scade.typ
typst
#import "defs.typ": * #import "links.typ": * #language( name: "SCADE", introduction: [ #Scade (_Safety Critical Application Development Environment_) est un langage de programmation et un environnement de développement dédiés à l'embarqué critique. Le langage est né au milieu des années 90 d'une collaboration entre le laboratoire de recherche VERIMAG à Grenoble et l'éditeur de logiciels VERILOG. Depuis 2000, le langage est développé par l'entreprise ANSYS/Esterel-Technologies. À l'origine le langage #Scade était essentiellement une extension du langage Lustre v3 avant d'en diverger à partir de la version 6. Grâce à l'expressivité réduite du langage, le compilateur KCG de #Scade est capable de vérifier des propriétés plus fortes que le compilateur d'un langage généraliste. ], paradigme: [ #Scade est un langage _data flow_ #paradigme[déclaratif] et #paradigme[synchrone]. Contrairement à la plupart des langages généralistes dont la brique élémentaire de donnée est l'entier, #Scade manipule des _séquences_ (ou signaux) potentiellement infinies indexées par un temps discret. Ces séquences sont une modélisation des entrées analogiques. Un programme #Scade est constitué de noeuds (`node` dans le langage) et chaque noeud définit un système d'équations entre les entrées et les sorties du noeud. Par exemple, considérons le programme suivant en _Lustre_: ```lustre node mod_count (m : int) returns (out : int); let out = (0 -> (pre out + 1)) mod m; tel ``` où `0 -> (pre out + 1)` indique qu'à l'instant 0, le signal vaut 0 mais que pour les instants suivants, le signal vaudra `pre out + 1`. `pre` est un opérateur qui récupère la valeur du paramètre à l'instant précédent. Par exemple si $m$ est la séquence constante 4, on obtient : #align( center, table( columns: (auto, auto, auto, auto, auto, auto, auto, auto, auto), [Temps], [$t_0$], [$t_1$], [$t_2$], [$t_3$], [$t_4$], [$t_5$], [$t_6$], [$t_7$], [$m$], [4], [4], [4], [4], [4], [4], [4], [4], [`pre out`], [ ], [0], [1], [2], [3], [0], [1], [2], [`pre out + 1`], [ ], [1], [2], [3], [4], [1], [2], [3], [`0 -> (pre out + 1)`], [0], [1], [2], [3], [4], [1], [2], [3], [`(0 -> (pre out + 1)) mod m`], [0], [1], [2], [3], [0], [1], [2], [3], [`out`], [0], [1], [2], [3], [0], [1], [2], [3], ) ) ], runtime: [ Il ne semble pas y avoir d'analyseur statique autre que ceux présents dans la suite #Scade. Celle-ci fait déjà un certain nombre d'analyse permettant d'éviter les débordements de tampons ou les boucles causales. Par ailleurs, il n'y a pas de manipulation de pointeurs donc les erreurs dessus ne sont pas non plus possibles. Toutefois, le code généré peut être passé aux analyseurs C & #Ada pour éventuellement trouver les erreurs qui seraient passées au travers de l'analyse de la suite logicielle. ], formel: [ Le langage Lustre a fait l'objet d'une formalisation en #coq#cite(<lustrecoq>) mais, à notre connaissance, il n'existe pas d'outil de formalisation pour #Scade. Cependant, il est possible de formaliser des propriétés sur les programmes #Scade en utilisant des noeuds de vérification pour faire du _model checking_. Si ces noeuds sont toujours vrais pour toutes les entrées possibles, alors le programme est formellement valide _a posteriori_. ], wcet: [ L'estimation du WCET d'un programme #Scade est cruciale pour s'assurer qu'il pourra s'exécuter en temps réel: on doit garantir que chaque pas d'exécution avant le _quantum_ de temps autorisé. La suite #Scade intègre l'outil #aiT#cite(<aitscade>). Cet outil permet l'estimation et l'optimisation du WCET lors de la modélisation#cite(<aitwcetscade>). ], assurances: [ La suite #Scade offre un très bon niveau de fiabilité du à la simplicité du langage _data flow_ sous-jacent et des analyses effectuées par la suite. Par ailleurs, le compilateur KCG est certifié pour les normes du domaine critique. ], numerique: [ Il ne semble pas y avoir d'analyse statique pour les erreurs numériques. ], pile: [ La suite #Scade intègre l'outil #stackanalyser#cite(<stackanalyzerscade>)#cite(<aitwcetscade>). Il est aussi possible d'utiliser les outils travaillant directement sur le binaire produit par la compilation du code C ou #Ada engendré par #Scade. ], intrinseque: [ #Scade est statiquement et fortement typé; ce qui assure déjà une certaine fiabilité. En plus du typage, la suite réalise d'autres analyses qui vérifient : - que le programme ne contient pas d'accès à un tableau en dehors de ses bornes; - qu'il n'y a pas de boucle causale : l'équation `a = pre a` n'est pas possible, il faut introduire un délai (via `->`) ; - le programme peut être exécuté avec une quantité de mémoire bornée et connue, - le programme est déterministe au sens où sa sortie ne dépend pas d'un ordonnancement des tâches du système hôte (_i.e._ il n'y a pas de _threads_). ], interfacage: [ #Scade permet d'importer du code (C ou #Ada) via le mot clé `imported` comme par exemple: ```scade function imported f (i1: int32; i2: bool) returns (o1: bool; o2: int32); ``` mais il faut faire attention à conserver les invariants requis. Dans l'exemple précécent, il faut s'assurer que les sorties ne dépendent que des entrées sous peine de probablement casser les propriétés de sûreté du programme. Le code engendré par #Scade peut être utilisé dans un programme C ou #Ada. ], compilation: [ #Scade utilise le compilateur KCG qui est techniquement un transpileur, c'est-à-dire un traducteur d'un langage de programmation (ici #Scade) vers un langage de même niveau (ici le C ou #Ada). À notre connaissance, KCG est l'unique compilateur disponible pour le langage #Scade. Il est disponible sur Windows en 32 et 64 bits. Il est par ailleurs certifié pour les normes suivantes: - DO-178B DAL A, - DO-178C DAL A, - DO-330, - IEC 61508 jusqu'à SIL 3, - EN 50128 jusqu'à SIL 3/4, - ISO 26262 jusqu'à ASIL D. ], debug: [ Le débug d'un programme synchrone est un peu particulier car on s'intéresse pas ou très peu au contrôle de flôt étant donné que celui-ci est très limité dans un langage _data flow_. En revanche, ces flux eux-mêmes sont beaucoup plus intéressants et déboguer un programme _data flow_ consiste simplement à : - afficher les flux (leur valeur aux cours du temps); - pouvoir jouer avec les entrées pour voir comment les sorties réagissent; - éventuellement ajouter des noeuds de contrôle (des _watch dogs_) permettant de contrôler des propriétés au cours du temps. La suite #Scade permet tout cela en plus de visualiser graphiquement les noeuds et leur dépendances. ], parsers: [ Le langage n'est pas adapté à l'analyse syntaxique car celle-ci suppose un traitement dynamique avec une consommation mémoire arbitraire; ce qui va à l'encontre des limites imposées par le langage. On peut tout à fait écrire des parser à mémoire bornée en #Scade pour analyser des flux syntaxiques particuliers (comme des flux protocolaires) mais, à notre connaissance, il n'existe pas de générateur de parseur pour #Scade. ], metaprog: [ Le langage n'offre pas de support pour la métaprogrammation. ], derivation: [ Le langage n'offre pas de support pour la dérivation de programme. ], tests: [ Les langages _data flow_ se prettent facilement aux tests puisque qu'il est facile de créer des noeuds qui testent d'autres noeuds ou de faire varier les entrées pour vérifier les sorties. Ce travail est tout aussi facilement automatisable à l'aide des indications de type. Aussi, la suite #Scade supporte la génération automatique de tests sur plusieurs aspects (unitaires, intégration, couverture) et propose également un cadre de gestion des tests et la génération de rapport à l'intention des processus de certification/qualification. ], packages: [ Aucun gestionnaire de paquet n'est indiqué pour #Scade. ], communaute: [ La communauté #Scade semble restreinte aux utilisateurs de la suite, notamment les grands comptes de l'avionique, et à la communauté de chercheurs en lien avec le langage Lustre. ], adherence: [ Un programme #Scade se compile vers du C (ou #Ada) et peut donc fonctionner du matériel nu. ], critique: [ Du fait des certifications proposées par le compilateur _KCG_, le langage #Scade est beaucoup utilisé dans l'aviation civile et militaire. On peut citer notamment: - les commandes de vol des Airbus, - le projet openETCS visant à unifier des systèmes de signalisation ferroviaires en Europe, - dans l'automobile. ] )
https://github.com/lf-/typst-algorithmic
https://raw.githubusercontent.com/lf-/typst-algorithmic/main/algorithmic-demo.typ
typst
// SPDX-FileCopyrightText: 2023 <NAME> // // SPDX-License-Identifier: MIT #import "algorithmic.typ" #import algorithmic: algorithm #algorithm({ import algorithmic: * Function("Binary-Search", args: ("A", "n", "v"), { Cmt[Initialize the search range] Assign[$l$][$1$] Assign[$r$][$n$] State[] While(cond: $l <= r$, { Assign([mid], FnI[floor][$(l + r)/2$]) If(cond: $A ["mid"] < v$, { Assign[$l$][$m + 1$] }) ElsIf(cond: [$A ["mid"] > v$], { Assign[$r$][$m - 1$] }) Else({ Return[$m$] }) }) Return[*null*] }) })
https://github.com/Mc-Zen/tidy
https://raw.githubusercontent.com/Mc-Zen/tidy/main/src/testing.typ
typst
MIT License
/// Check for equality. #let eq(a, b) = { if a == b { return (true,) } else { return (false, repr(a) + " != " + repr(b)) } } /// Check for inequality. #let ne(a, b) = { if a != b { return (true,) } else { return (false, repr(a) + " == " + repr(b)) } } /// Check for approximate equality. #let approx(a, b, eps: 1e-10) = { if calc.abs(a - b) < eps { return (true,) } else { return (false, str(a) + " !≈ " + str(b)) } } #let assertations = ( eq: eq, ne: ne, approx: approx ) #let get-source-info-str(source-location) = { if source-location == none { return none } return "(" + source-location.module + ":" + str(source-location.line) + ")" } /// Implementation for docstring tests. All tests are run immediately. Fails if /// at least one test did not succeed. /// /// This function is made available in all docstrings under the name 'test'. /// /// - ..tests (any): Tests to run in form of raw objects. /// - scope (dictionary): Additional definitions to make available for the /// evaluated test code. /// - inherited-scope (dictionary): Definitions that are made available to the /// entire parsed module including the test functions. This parameter /// is only used internally. /// - source-location (dictionary): Information about the location of the test /// source code. Should contain values for the keys `module` and /// `line`. This parameter is only used internally. /// - enable (boolean): When set to `false`, the tests are ignored. #let test( ..tests, scope: (:), inherited-scope: (:), source-location: none, enable: true ) = { if not enable { return } let source-info = get-source-info-str(source-location) for test in tests.pos() { let result = eval(test.text, scope: scope + inherited-scope) let result-type = type(result) if result-type == "array" { if not result.at(0) { assert( false, message: "Failed test " + source-info + ": " + result.at(1) + "\nin " + test.text ) } } else if result-type == "boolean" { if not result { let msg = test.text assert(false, message: "Failed test " + source-info + ": " + msg) } } else { assert( false, message: "Test \"" + test.text + "\" at " + source-info + " did not result in a boolean expression" ) } } }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/hyphenate_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // This sequence would confuse hypher if we passed trailing / leading // punctuation instead of just the words. So this tests that we don't // do that. The test passes if there's just one hyphenation between // "net" and "works". #set page(width: 60pt) #set text(hyphenate: true) #h(6pt) networks, the rest.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/math-text-break_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page $ x := "a\nb\nc\nd\ne" $
https://github.com/jamesrswift/journal-ensemble
https://raw.githubusercontent.com/jamesrswift/journal-ensemble/main/src/article.typ
typst
The Unlicense
#import "part.typ" #import "elements.typ" #let header(citation: [CITATION]) = block( spacing: 3em, stack( dir: ltr, context part.get(), h(1fr), citation ) ) #let title(body) = { set par(justify: false) set text(size: 20pt, weight: 450) block( above: 1em, below: 1em, body ) } #let authors(body) = { set par(justify: false) set text(size: 12pt) block( above: 1.5em, below: 2.5em, body ) } #let dates(input) = { input.map((it)=>[#strong(it.first() + ":") #it.last()]).join(elements.sep) } #let meta(body) = { set par(justify: false) set text(size: 9pt) block( spacing: 3em, body ) } #let template( color-accent-1: rgb("123456") ) = (body) => { set page(paper: "a4") set text(font: "Open Sans") set par(leading: 0.75em) body } #let abstract-list(body) = meta({ set par(leading: 1em, justify: true) set list( marker: elements.marker, indent: -1em, tight: false ) body }) #let rule( ) = (body) => { pagebreak(weak: true) set page( columns: 2, margin: (x: 1.5cm, y: 2cm) ) set par(justify: true, leading: 0.85em) set par.line(numbering-scope: "page") set text(size: 9pt) set heading(numbering: "1.1") show heading: set block(spacing: 1.5em) show figure: (fig) => { show figure.caption: (caption) => context { strong({ caption.supplement sym.space numbering(fig.numbering, ..caption.counter.at(fig.location())) }) caption.separator caption.body } fig } body pagebreak(weak: true) counter(heading).update(0) } #let one-column(alignment, body) = place( scope: "parent", float: true, clearance: 3em, alignment, body, ) #let line-numbers() = (body) => { show par.line: set text(size: 7pt) set par.line( numbering: (n) => text(size: 5pt, str(n), baseline: -0.1em), ) body }
https://github.com/jneug/schule-typst
https://raw.githubusercontent.com/jneug/schule-typst/main/src/util/args.typ
typst
MIT License
// ================================ // = Argument handling = // ================================ // // Helpers for handling argument sinks and user supplied values. /// Extracting arguments from an agument sink to pass to other functions. /// /// Positional arguments are keys to extract from the named arguments of #arg[_args]. /// If the key is not present, the keys are ignored. The keys of named key-value /// pairs will be searched, too. If they are not present, they will be added to the /// resulting dictionary with a default value. /// /// If a #arg[prefix] is given, it will be added to all keys when looking them up /// in #arg[_args], but not in the resulting dictionary. /// /// The function will always return a dictionary, possibly empty. /// /// Example: /// ```typst /// #let arg-test(..args) = [ /// #set text(..util.extract-args(args, _prefix: "font", size: 2em, fill: red, "font")) /// #block(..util.extract-args(args, _prefix: "block-", "stroke", inset: .5em))[ // Hello World! // ] /// ] /// /// #arg-test() /// #arg-test(fontfill: blue, fontsize: 3em, fontfont: ("Comic Neue")) /// #arg-test(block-stroke: 2pt + blue) /// ``` /// /// - _args (arguments): An argument sink. /// - _prefix (str): An optional prefix to add to keys, when looking them up. /// - ..keys (str): A list of key names and optionally default values. /// -> dictionary #let extract-args(_args, _prefix: "", ..keys) = { let vars = (:) for key in keys.pos() { let k = _prefix + key if k in _args.named() { vars.insert(key, _args.named().at(k)) } } for (key, value) in keys.named() { let k = _prefix + key if k in _args.named() { vars.insert(key, _args.named().at(k)) } else { vars.insert(key, value) } } return vars } /// Check #arg[value] for #value(auto) and execute #arg[default], if equal. /// #arg[do] something with the value, if it is not #value(auto). /// /// - value (any): The value to check. #let if-auto(value, default, do: v => v) = if value == auto { default() } else { do(value) } #let if-none(value, default, do: v => v) = if value == none { default() } else { do(value) } #let if-has(dict, key, default, do: v => v) = if dict == none or key not in dict { default() } else { do(dict.at(key)) } #let as-arr(value) = if type(value) == type(()) { value } else { (value,) }
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis
https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/template/abstract.typ
typst
MIT License
#let abstract() = [ #lorem(20) ]
https://github.com/Dav1com/minerva-report-fcfm
https://raw.githubusercontent.com/Dav1com/minerva-report-fcfm/master/lib/footer.typ
typst
MIT No Attribution
/// Agrega metadata y estado necesarios para otras funciones del template. /// Si quieres crear tu propio pie de página, es recomendable pasarlo /// por esta función. /// /// - it (content): Contenido del pie de página. /// -> content #let base(it) = { set block(spacing: 0pt, clip: false) set par(leading: 0.4em) it metadata((marker: "PAGE-END")) } /// Un header vacío. /// /// - meta (dictionary, module): Contenidos del archivo **meta.typ** /// -> content #let sin-footer(meta) = base[] /// Un footer con solamente el número de página. /// /// - meta (dictionary, module): Contenidos del archivo **meta.typ** /// - romano-hasta-primer-heading (bool): Si es true, las páginas antes del /// primer heading con numbering utilizan números romanos en minúsculas. /// Por defecto es `true`. /// -> content #let footer-numero( meta, romano-hasta-primer-heading: true ) = base[ #align(center)[ #context { let headings = query(heading.where(outlined: true)) let first-numbered-heading = headings.at(0, default: none) let numbering = "i" if first-numbered-heading != none { if here().page() == first-numbered-heading.location().page() { counter(page).update(1) } if first-numbered-heading.location().page() <= here().page() { numbering = "1" } } context { counter(page).display(numbering) } } ] ] /// El footer por defecto. /// - meta (dictionary, module): Contenidos del archivo **meta.typ** /// -> content #let footer1(meta) = base[ #set text(style: "italic", weight: 1) #line(length: 100%, stroke: 0.4pt) #v(8pt) #grid(columns: (auto, 1fr), rows: auto)[ #set align(left + top) #meta.curso ][ #set align(right + top) #meta.titulo ] ] /// Esta función permite obtener ayuda sobre cualquier función /// del template. Para saber qué funciones y variables define /// el template simplemente deja que el autocompletado te guíe, /// luego puedes llamar esta función para obtener más ayuda. /// /// - nombre (string): Puede ser el nombre de una función o /// variable, entonces la función entrega /// ayuda general sobre esta. Si se entrega /// algo de la forma `"help(nombre)"` entonces /// entrega ayuda específica sobre el argumento /// `nombre`. /// -> content #let help(nombre) = { import "../meta.typ": * return help-leaf("footer")(nombre) }
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/grid/cell.typ
typst
Apache License 2.0
#table( columns: 3, table.header( [Substance], [Subcritical °C], [Supercritical °C], ), [Hydrochloric Acid], [12.0], [92.1], [Sodium Myreth Sulfate], [16.6], [104], [Potassium Hydroxide], table.cell(colspan: 2)[24.7], ) #import table: cell, header #table( columns: 2, align: center, header( [*Trip progress*], [*Itinerary*], ), cell( align: right, fill: fuchsia.lighten(80%), [🚗], ), [Get in, folks!], [🚗], [Eat curbside hotdog], cell(align: left)[🌴🚗], cell( inset: 0.06em, text(1.62em)[🛖🌅🌊], ), )
https://github.com/jneug/schule-typst
https://raw.githubusercontent.com/jneug/schule-typst/main/src/core/layout.typ
typst
MIT License
#import "@preview/ccicons:1.0.0": ccicon, cc-is-valid #import "../util/marks.typ" #import "../util/args.typ" #import "../theme.typ" #let format-pagenumber( current, body-start, body-end, total-pages, ) = { if current < body-start or current > total-pages [ // #sym.dash ] else if current > body-end { numbering("I", (current - body-end)) if total-pages - body-end > 2 [ von #numbering("I", (total-pages - body-end)) ] } else { let body-pages = body-end - body-start + 1 let body-current = current - body-start + 1 if body-pages > 1 [ #body-current ] if body-pages > 2 [ von #body-pages ] } } #let header-left(doc) = [ #args.if-none(doc.subject, () => []) #args.if-none(doc.class, () => []) #{ let abbr = doc.author.filter(a => "abbr" in a) if abbr != () { "(" + abbr.map(a => a.at("abbr", default: none)).join(", ") + ")" } } ] #let header-center(doc) = context if marks.in-env("appendix") [ Anhang ] else { if doc.date != none [ Datum: #doc.date.display("[day].[month].[year]") ] else [ Datum: #box(move(dy:2pt, line(length: 3cm))) ] } #let header-right(doc) = [ #doc.type-long #args.if-none(doc.number, () => [], do: v => [Nr. #v]) #args.if-none(doc.variant, () => [], do: v => [#sym.dash #v]) ] #let footer-left(doc) = [ #args.if-none(doc.version, () => [], do: v => [v#v]) ] #let footer-center(doc) = [ #args.if-none( doc.license, () => [], do: v => if cc-is-valid(v) { ccicon(v) } else { v }, ) ] #let footer-right(doc) = [ #context { format-pagenumber( here().page(), marks.get-page(<content-start>), marks.get-page(<content-end>), counter(page).final().first(), ) } ] #let base-header(doc, body-left, body-center, body-right, rule: false) = { set text(.88em) grid( columns: (25%, 50%, 25%), inset: 2mm, align: (left, center, right), body-left, body-center, ..if rule { ( body-right, grid.hline(stroke: .6pt), ) } else { (body-right,) }, ) } #let base-footer(doc, body-left, body-center, body-right, rule: false) = { set text(.88em, theme.muted) grid( columns: (25%, 50%, 25%), inset: 2mm, align: (left, center, right), ..if rule { ( grid.hline(stroke: .6pt + theme.muted), body-left, ) } else { (body-left,) }, body-center, body-right, ) } #let base-title( doc, rule: true, ) = block( below: 0.65em, width: 100%, { set align(center) args.if-none( doc.topic, () => [], do: subject => { heading(level: 3, outlined: false, bookmarked: false, text(theme.text.subject, smallcaps(subject))) }, ) args.if-none( doc.title, () => [], do: title => move( dy: -0.4em, heading(level: 1, outlined: false, bookmarked: false, text(theme.primary, smallcaps(title))), ), ) if rule { move(dy: -.8em, line(length: 100%)) } else { v(.65em) } }, )
https://github.com/fenjalien/obsidian-typst
https://raw.githubusercontent.com/fenjalien/obsidian-typst/master/CHANGELOG.md
markdown
Apache License 2.0
# 0.10.0 - Upgrade to Typst 0.11.0 - Update fonts to be equal with Typst 0.11 # 0.9.0 - Upgrade to Typst 0.10.0 - Remove SVGO dependency - SVG output now scales with the line size [#39](https://github.com/fenjalien/obsidian-typst/issues/39) # 0.8.0 - Upgrade to Typst 0.9.0 - Fix slow loading times [#34](https://github.com/fenjalien/obsidian-typst/issues/34) - Add package downloading [#10](https://github.com/fenjalien/obsidian-typst/issues/10) - Add file reading on mobile [#9](https://github.com/fenjalien/obsidian-typst/issues/9) # 0.7.1 - Fix wrong paths generated for `@local`/`@preview` packages [#30](https://github.com/fenjalien/obsidian-typst/pull/30) # 0.7.0 - Update to Typst v0.8.0 - Fix not loading on mobile # 0.6.0 - Improve error reporting - Upgrade to Typst 0.7.0 - Add SVG export option - Add `THEME` variable to the preamble. - Change output scaling/styling - Selected fonts are now written in their fonts - Fix ([#12](https://github.com/fenjalien/obsidian-typst/issues/12)) - [#18](https://github.com/fenjalien/obsidian-typst/pull/18) # 0.5.1 (#11) - Renable system font support. - Change font settings to be a text input for selective font loading. # 0.5.0 - Update Typst version to 0.6.0 - Attempt to fix bad canvas output - Move compiler to a web worker - Rework file reading - Add support of reading packages outside of the vault - Improve settings appearance (#7) - Various bug fixes
https://github.com/AxiomOfChoices/Typst
https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Templates/generic.typ
typst
#let latex( doc, ) = { set page( margin: (x: 2cm, top: 2cm, bottom: 2cm), header-ascent: 18%, ) set par(leading: 0.55em, first-line-indent: 1.8em, justify: true) set text(font: "New Computer Modern", size: 12pt) show raw: set text(font: "New Computer Modern Mono") show par: set block(spacing: 0.55em) show heading: set block(above: 0.9em, below: 0.7em) doc } #let header( body, title: "replace me", name: "<NAME>", ) = { set page(header: [ #text(name) #h(1fr) *#text(size: 18pt,title)* #h(1fr) #datetime.today().display("[month repr:long] [day padding:none], [year]") #v(5pt, weak: true) #line(length: 100%, stroke: 0.5pt) ]) body }
https://github.com/donghoony/KUPC-2023
https://raw.githubusercontent.com/donghoony/KUPC-2023/master/problems.typ
typst
#let raw_problems = ( // Div.2 Number, Div.1 Number, Title, Difficulty, 예상 티어 "bsgpdr" 중 하나, 출제진 튜플 - 1명인 경우 뒤에 콤마 붙여야함 // 정해 알고리즘, div2(AC, submission), div2 퍼솔, Div1(AC, submissions), Div1 퍼솔 ("A", " ", "얼룩말을 찾아라!", "Beginner", "b", (("이동훈", "aru0504"),), "implementation, string", (19, 33), ("권순호", 4), (0, 0), ("-", 0)), ("B", "A", "이제는 더 이상 물러날 곳이 없다", "Easy", "b", (("이동훈", "aru0504"),), "game_theory, ad_hoc", (21, 24), ("권순호", 5), (28, 28), ("김태현", 0)), ("C", " ", "바닥수", "Easy", "b", (("이동훈", "aru0504"), ("윤찬규", "dldyou")), "constructive, math", (13, 24), ("권순호", 9), (0, 0), ("-", 0)), ("D", "B", "단체줄넘기", "Easy", "b", (("이동훈", "aru0504"),), "implementation", (21, 27), ("최승현", 13), (28, 43), ("장은준", 3)), ("E", " ", "팰린드롬 애너그램", "Normal", "s", (("이동훈", "aru0504"),), "ad_hoc", (14, 61), ("박서진", 14), (0, 0), ("-", 0)), ("F", "C", "현수막 걸기", "Normal", "s", (("김수현", "creampuffshu"),), "binary_search", (4, 21), ("박서진", 66), (17, 100), ("나윤상", 13)), ("G", " ", "스위치", "Normal", "s", (("윤찬규", "dldyou"),), "dynamic_programming", (4, 13), ("박서진", 31), (0, 0), ("-", 0)), ("H", "D", "낚시", "Normal", "g", (("이동훈", "aru0504"),), "prefix_sum", (12, 43), ("박서진", 55), (22, 63), ("이승엽", 15)), (" ", "E", "시간낭비", "Hard", "g", (("이동훈", "aru0504"),), "dynamic_programming, graphs, topological_sorting", (0, 0), ("-", 0), (5, 68), ("이승엽", 57)), (" ", "F", "K-문자열", "Hard", "g", (("김명기", "riroan"),), "string, bitmask, combinatorics", (0, 0), ("-", 0), (8, 34), ("나윤상", 37)), ("I", "G", "MEXchange", "Hard", "g", (("김명기", "riroan"),), "ad_hoc, constructive", (3, 25), ("박서진", 133), (4, 16), ("이승엽", 52)), (" ", "H", "등불 날리기", "Challenging", "p", (("윤찬규", "dldyou"),), "segment_tree, sliding_window", (0, 0), ("-", 0), (3, 19), ("황재상", 111)), (" ", "I", "우정은 BFS처럼, 사랑은 DFS처럼", "Challenging", "p", (("이동훈", "aru0504"), ("윤찬규", "dldyou")), "constructive, greedy, graph_traversal", (0, 0), ("-", 0), (0, 2), ("-", 0)), ("J", "J", "양손 정렬", "Challenging", "p", (("이동훈", "aru0504"), ("윤찬규", "dldyou"), ("김명기", "riroan")), "permutation_cycle_decomposition", (0, 3), ("-", 0), (0, 8), ("-", 0)), ) #let contest_problems = raw_problems.map( problem => { ( d2: problem.at(0), d1: problem.at(1), title: problem.at(2), difftext: problem.at(3), diff: problem.at(4), setter: problem.at(5), algorithms: problem.at(6), d2_stat: problem.at(7), d2_first_ac: problem.at(8), d1_stat: problem.at(9), d1_first_ac: problem.at(10) ) })
https://github.com/yue-dongchen/LibreBitexts
https://raw.githubusercontent.com/yue-dongchen/LibreBitexts/master/utils.typ
typst
Other
#let parallel-text(left, right) = { set par(justify: true) grid( columns: (1fr, 1fr), gutter: 11pt, left, if right != [] [ #right ] else [ #rect(radius: (rest: 5pt))[#emph[Omission by the translator]] ] ) }
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/solutions/s0002.typ
typst
#import "../helpers.typ": * #let add-two-numbers-ref(l1, l2) = { let p = () let carry = 0 while l1.val != none or l2.val != none { let x = if l1.val != none { l1.val } else { 0 } let y = if l2.val != none { l2.val } else { 0 } let sum = x + y + carry carry = calc.floor(sum / 10) p.push(calc.rem(sum, 10)) if l1.next != none { l1 = l1.next } if l2.next != none { l2 = l2.next } } if carry > 0 { p.push(carry) } linkedlist(p) }
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/call_info/user_named.typ
typst
Apache License 2.0
#let f(x, y: none) = x + y #(/* position after */ f(y: 1, 1))
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/terms_02.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test multiline. #set text(8pt) / Fruit: A tasty, edible thing. / Veggie: An important energy source for vegetarians.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/physica/0.8.0/README.md
markdown
Apache License 2.0
# The physica module (for physics) [![CI](https://github.com/Leedehai/typst-physics/actions/workflows/ci.yml/badge.svg)](https://github.com/Leedehai/typst-physics/actions/workflows/ci.yml) [![Latest release](https://img.shields.io/github/v/release/Leedehai/typst-physics.svg?color=gold)][latest-release] The [manual](physica-manual.pdf). Download releases [here](https://github.com/Leedehai/typst-physics/releases/). Available at the official collection of [Typst packages](https://typst.app/docs/packages/). This [Typst](https://typst.app) package provides handy typesetting utilities for physics, including: * Braces, * Vectors and vector fields, * Matrices, * Dirac braket notations, * Common math functions, * Differentials and derivatives, including partial derivatives of mixed orders with automatic order summation, * Familiar "h-bar", tensor abstract index notations, isotopes, * Signal sequences i.e. digital timing diagrams. :warning: [Typst](https://typst.app) is in beta and evolving, and this package evolves with it. As a result, no backward compatibility is guaranteed yet. :information_source: In response to the official Typst package [guideline](https://github.com/typst/packages/tree/main#submission-guidelines) "Package names should not be merely descriptive to create level grounds for everybody", this package was renamed from `physics` to `physica`. ## A quick look See the [manual](physica-manual.pdf) for more details. ![demo](https://user-images.githubusercontent.com/18319900/236073825-e91b4601-7e92-490b-a7e4-e9e405a2147b.png) ## Using phyiscs in your Typst document ### With `typst` package management (recommended) See https://github.com/typst/packages. <p align="center"> <img src="https://github.com/Leedehai/typst-physics/assets/18319900/f2a3a2bd-3ef7-4383-ab92-9a71affb4e12" width="173" alt="effect"> </p> ``` // Style 1 #import "@preview/physica:0.8.0": * $ curl (grad f), tensor(T, -mu, +nu), pdv(f,x,y,[1,2]) $ ``` ``` // Style 2 #import "@preview/physica:0.8.0": curl, grad, tensor, pdv $ curl (grad f), tensor(T, -mu, +nu), pdv(f,x,y,[1,2]) $ ``` ``` // Style 3 #import "@preview/physica:0.8.0" $ physica.curl (physica.grad f), physica.tensor(T, -mu, +nu), physica.pdv(f,x,y,[1,2]) $ ``` ### Without `typst` package management Similar to examples above, but import with the undecorated file path like `"physica.typ"`. ## Manual See the manual [physica-manual.pdf](physica-manual.pdf) for a more comprehensive coverage, a PDF file generated directly with the [Typst](https://typst.app) binary. CLI Version: ```sh $ typst --version typst 0.8.0 (360cc9b9) ``` To regenerate the manual, use command ```sh typst watch physica-manual.typ ``` ## Contribution * Bug fixes are welcome! * New features: welcome as well. If it is small, feel free to create a pull request. If it is large, the best first step is creating an issue and let us explore the design together. Some features might warrant a package on its own. * Testing: currently testing is done by closely inspecting the generated [physica-manual.pdf](physica-manual.pdf). This does not scale well. I plan to add programmatic testing by comparing rendered pictures with golden images. ## License * Code: the [MIT License](LICENSE.txt). * Docs: the [Creative Commons BY-ND 4.0 license](https://creativecommons.org/licenses/by-nd/4.0/). [latest-release]: https://github.com/Leedehai/typst-physics/releases/latest "The latest release"
https://github.com/boladouro/ME
https://raw.githubusercontent.com/boladouro/ME/main/1/pro%20prof/relatorio/template.typ
typst
// #import "@preview/algo:0.3.3": algo, i, d, comment, code #import "@preview/tablex:0.0.5": vlinex, hlinex #let project(fontsize:12pt, doc) ={ let calculated_leading = 10.95pt set heading( bookmarked: true ) set text( font: "Times New Roman", size: fontsize, hyphenate: false, lang: "pt", region: "pt" ) set page( numbering: "1 / 1", margin: (left: 12mm, right: 12mm, top: 13mm, bottom: 13mm) ) set par( justify: true, leading: calculated_leading, // calculo manual first-line-indent: 1cm, ) show par: set block(spacing: calculated_leading) set math.equation( numbering: "(1)" ) show ref: it => { let eq = math.equation let el = it.element if el != none and el.func() == eq { numbering( el.numbering, ..counter(eq).at(el.location()) ) } else { it } } show figure.where( kind: table ): set figure.caption(position: top) show figure.caption: set text(size: fontsize - 2pt) // set algo() // not an element func yet (cause it's not possible on 0.8) show figure.where( kind: grid ): set figure(kind: image) // n funciona n sei pq set figure(placement: auto) show figure.where( kind: "Algoritmo" ): set figure(placement: none) // juro que nao percebo pq e q isto n funciona set list(indent: 0.6cm) doc } #let vline(start:none, end:none) = { vlinex(start:start, end:end, stroke:0.5pt) } #let hline(start:none, end:none) = { hlinex(start:start, end:end, stroke:0.5pt) } #let hline_header(start:none, end:none) = { hlinex(start:start, end:end, stroke:0.5pt, expand:-3pt) } #let hline_before(start:none, end:none) = { // hlinex(start:start, end:end, stroke:0.5pt, expand:-3pt) }
https://github.com/horaoen/typstempl
https://raw.githubusercontent.com/horaoen/typstempl/master/README.md
markdown
# personal typst template
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/3-methodology/study-1/architecture.typ
typst
MIT License
#import "../../../lib/mod.typ": * === Architecture <s.m.architecture> This section presents the architectural and software design patterns used in the design of the simulation. Areas where the design differs from the original work are argued for and motivations for why a different choice was mode is laid and reasoned about. // First by presenting the major architectural paradigm used, the ECS paradigm. What it is, how it works and why it was chosen. Second how it results in changes compared to the original implementation of the gbplanner algorithm. // ==== Entity Component System // #k[ // write about how we use bevy and ECS. What components are central, and how is the algorithm composed using systums and run schedules. // ] // #jonas[This section about ECS has been moved to the background section.] // #todo[There should be new content here, describing why this architecture was chosen, and which others were considered. // // - Their approach is very "imperative" // // - Maybe there are papers that discuss various approaches to design scientific simulations. // // - Mention that attempts have been made to decouple dependencies between modules, (although not really), to make the design modular. // ]
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/数学模型/作业/hw3.typ
typst
#import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark, proposition,der, partialDer, Spec #import "../../template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: note.with( title: "作业2", author: "YHTQ", date: none, logo: none, withOutlined : false, withTitle :false, ) #let absSigmaI(i) = $abs(x_sigma(#i))$ #let fL = $f^L$ (应交事件为4月1日) = 3.20 == $ h_max = max_(x in RR^n)(sum_((i, j) in E) |x_i - x_j|)/(2 norm(x) "vol" V - min_(c in RR) sum_(i in V) d_i |x_i - c|) $ == 设 $f, g: P_2 (V) -> [0, +infinity]$,且对任意 $(A, B) in P_2 (V) - {(emptyset, emptyset)}$ 有 $g(A, B) > 0$,则我们有: $ max_((A, B) in P_2 (V) - {(emptyset, emptyset)}) (f(A, B))/(g(A, B)) = max_(x in RR^n - {0}) (f^L (x))/(g^L (x)) $ #proof[ - 首先要证明右侧的最大值存在。事实上前面证明了 $f^L, g^L$ 是一次齐次的连续函数,因此可以在任何一个有界闭集上取得最大值,例如 ${x | norm(x) = 1}$,其上的最大值也是它在整个定义域上的最大值 - 其次,显然有: $ max_((A, B) in P_2 (V) - {(emptyset, emptyset)}) (f(A, B))/(g(A, B)) = max_((A, B) in P_2 (V) - {(emptyset, emptyset)}) (f^L (1_(A, B)))/(g^L (1_(A, B))) <= max_(x in RR^n - {0}) (f^L (x))/(g^L (x)) $ 因此只要证明另一侧不等式 - 任取 $x !=0 $: $ (f^L (x))/(g^L (x)) = (sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) f(V^+_(sigma(i)), V^-_(sigma(i)))) /(sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) g(V^+_(sigma(i)), V^-_(sigma(i)))) $ 注意到我们总可以取得 $(C, D) in P_2 (V)$ 使得: $ (f(C, D))/(g(C, D)) = max_(0<= i <= n-1) (f(V^+_(sigma(i)), V^-_(sigma(i)))) /(g(V^+_(sigma(i)), V^-_(sigma(i)))) $ 有: $ &(f^L (x))/(g^L (x)) - (f(C, D))/(g(C, D)) \ &= (sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) f(V^+_(sigma(i)), V^-_(sigma(i))) - (sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) g(V^+_(sigma(i)), V^-_(sigma(i)))) (f(C, D))/(g(C, D))) /(sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) g(V^+_(sigma(i)), V^-_(sigma(i)))) \ &<= (sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) f(V^+_(sigma(i)), V^-_(sigma(i))) - (sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) g(V^+_(sigma(i)), V^-_(sigma(i))) (f(V^+_(sigma(i)), V^-_(sigma(i))))/(g(V^+_(sigma(i)), V^-_(sigma(i)))))) /(sum_(i=0)^(n-1) (absSigmaI(i+1) - absSigmaI(i)) g(V^+_(sigma(i)), V^-_(sigma(i))))\ &= 0 $ 因此 $ max_(x in RR^n - {0}) (f^L (x))/(g^L (x)) <= (f(C, D))/(g(C, D)) <= max_((A, B) in P_2 (V) - {(emptyset, emptyset)}) (f(A, B))/(g(A, B)) $ 证毕 ] == $ h_max = max_(x in RR^n)(sum_((i, j) in E) |x_i - x_j|)/(2 norm(x) "vol" V - min_(c in RR) sum_(i in V) d_i |x_i - c|) $ #let vol = math.op("vol") #proof[ 与之前问题的分子是完全一致的,而由 Cheeger 问题计算得到的结论,有: $ integral_(0)^(norm(x)) min {vol(V_t^+), vol(V - V_t^+)} + min {vol(V_t^-), vol(V - V_t^-)} dif t = min_(c in RR) sum_(i in V) d_i abs(x_i - c) $ 因此当然有: $ G^L (x) &= integral_(0)^(norm(x)) max {vol(V_t^+), vol(V - V_t^+)} + max {vol(V_t^-), vol(V - V_t^-)} dif t\ &= 2 norm(x) vol V - integral_(0)^(norm(x)) min {vol(V_t^+), vol(V - V_t^+)} + min {vol(V_t^-), vol(V - V_t^-)} dif t\ &= 2 norm(x) vol V - min_(c in RR) sum_(i in V) d_i abs(x_i - c) $ ] == 注意到有积分形式: $ f^L (x) = integral_0^(norm(x)_infinity) f(V_t^+ (x), V_t^- (x)) dif t $ 容易看出当且仅当 $f(V_t^+ (x), V_t^- (x))$ 关于 $t$ 递增时它是凸函数。它当然不总是凸函数,至少可以取 $g = -f$ 不可能与 $f$ 同时关于 $t$ 递增。 再例如取: $ V = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}\ x_i = i, i=1,2, 3...,10\ f(A, B) = (min_(i in A) i)(10-min_(i in A) i) $ 则容易看出 $f(V_t^+ (x), V_t^- (x))$ 关于 $t in [0,1]$ 先增后减,当然对应的 $f^L (x)$ 不是凸函数或者凹函数 = == 不妨设 $x$ 取有界闭区域 $I$ 并取定 $x_0 in I$,记 $g (x, t) = f(t) + x g(t)$,它是二元连续函数,进而在紧集: $ I times [0, 1] $ 上一致连续,因此任意 $epsilon > 0$,存在 $delta > 0$ 使得: $ forall (x_1, t_1), (x_2, t_2), norm((x_1, t_1) - (x_2, t_2)) < delta => |g(x_1, t_1) - g(x_2, t_2)| < epsilon $ 无妨设使得 $h(x_0)$ 取最值的 $t$ 为 $t_0$,对于任意 $x$ 满足 $abs(x - x_0) < delta$,我们断言: $ abs(min_(t in [0, 1]) g(x, t) - g(x_0, t_0)) <= epsilon $ 事实上,设上式最小值在 $t_1$,由条件知: $ g(x, t_1) <= g(x, t_0) < g(x_0, t_0) + epsilon\ g(x_0, t_0) <= g(x_0, t_1) < g(x, t_1) + epsilon $ 整理不等式可得原式成立,进而得证 == 证明一般的结果: #theorem[Dinkerbach 迭代][ 设 $A$ 是紧集,$P, Q$ 是连续函数,针对分式规划问题: $ max_(x in A) P(x)/Q(x) $ 可以构造迭代 $ cases( x^(k+1) = argmin_(x in A) {Q(x) r^k - P(x) }, r^(k+1) = P(x^(k+1))/Q(x^(k+1)) ) $ - 述迭代产生的序列 ${r^k}$ 单调递增 - 若原问题有最优值,则上述迭代产生的序列收敛于原问题的解 ] #proof[ 注意到: $ r^k Q(x^(k+1)) - P(x^(k+1)) <= r^k Q(x^(k)) - P(x^(k)) = 0\ r^k <= P(x^(k+1))/Q(x^(k+1)) = r^(k+1) $ 设原问题的最优值为 $r_max$,自然每个 $r_n$ 都不超过 $r_(max)$,因此序列单调有上界,进而有极限 $r <= r_(max)$\ 同时,设 $x_0$ 是取得原问题最大值的点,将有: $ r^n Q(x^(n+1))- P(x^(n+1)) <= r^n Q(x_0) - P(x_0) $ 注意到 $x^n$ 是紧集上的序列,可取其一个收敛子列,不妨设它本身就收敛,上式取极限立得: $ r >= r_(max) $ ] 最小值形式的 Dinkerbach 迭代取倒数即可,形式为: $ cases( x^(k+1) = argmin_(x in A) {P(x) - Q(x) r^k}, r^(k+1) = P(x^(k+1))/Q(x^(k+1)) ) $ 在 Cheeger 问题中,$P(x) = I(x) = sum_({i, j} in E) abs(x_i - x_j), Q(x) = N(x) = min_(c in RR) sum_(i in V) d_i abs(x_i -c)$,收敛性已经证明 == 显然 $P 2$ 是 $P 3$ 的一种情况,只需在 $P 3$ 的条件下恢复 $P 2$ 即可\ 事实上,给定 $X$ 使得 $"rank" (X) = 1$ 且半正定,熟知一定存在 $v$ 使得: $ X = v v^T $ 结合 $1 = X_(i i) = v_i^2$,可得 $abs(v_i) = 1$,这就是 $P 2$ 的最优化条件,得证 == 一般的 SDP 问题形如: $ min_(X in SS^n) inner(C, X) "with" &inner(A_i, X) <= b_i, i = 1, 2, ..., m\ &X "semi-definite" $ 严格来说,目前并没有针对一般 SDP 问题的多项式算法,对其复杂度我们只知道它不是 NP 完全问题,除非 $"NP" = "co-NP"$。然而在一定更强的条件,或者限制一定计算精度,SDP 问题可以通过内点法,椭球法等经典方法在多项式时间解决
https://github.com/randyttruong/496notes
https://raw.githubusercontent.com/randyttruong/496notes/master/README.md
markdown
# COMP_SCI 496: Graduate Algorithms Notes These are my notes for the _Graduate Algorithms_ course offered at Northwestern University Spring 2024. This course is just an introductory course in upper-level algorithm analysis. ## Course Prerequisites (imo) - Discrete Mathematics (of course) - Combinatorics - Probability Theory ## Description This is a repo because it's just more effective for me to type my notes out instead of just writing them down. A lot of the workflow here comes from writing things down in class, scribing them in Typst, then doing more studying in order to better understand the material lol. ## Topic List (with Textbooks to Reference) - ❌ L01: Dictionaries, hash tables, and hash functions - ❌ L02: Universal hash functions - ❌ L03: Examples of universal hash functions. Introduction to perfect hash functions - ❌ L04: Job interview question. Sketching. Solution using hash functions and polynomials. - ❌ L05: Polynomial identity testing. Schwartz–Zippel lemma. - ❌ L06: Bloom Filters. - ❌ L07: Load Balancing. The Power of Two Choices. - ❌ L08: The Power of Two Choices (part II). Tail Bounds. - ❌ L09: Introduction to Streaming Algorithms - ❌ L10: The Misra-Gries Algorithm - ❌ L11: Count-Min Sketch and the Counting Distinct Elements problem - ❌ L12: HyperLogLog - ☑️ L13: Online Algorithms Introduction (3) - ☑️ L14: Online Algorithms Part 2 (3) - ☑️ L15: Introducing Approximation Algorithms and FPT Algorithms (Ski Rental + Vertex Cover) (4) - ☑️ L16: FPT Algorithms Part 2 + Approximation Algorithms Part 1 (Vertex Cover + Set Cover) (4 + 5) - ☑️ L17: Approximation Algorithms (Weighted Set Cover + Minimum Triangle-Free Edge-Deletion) (5) ## Additional funsies these are some pretty good books for getting up to speed in combinatorics, probability, and probabilistic methods in combinatorics. 1. `A Walk Through Combinatorics` by <NAME> 2. `The Probabilistic Method` by <NAME> and <NAME> 3. `Probability and Computing` by <NAME> and <NAME> 4. `Parameterized Algorithms` by Cygan, Fomin, et al. 5. `Approximation Algorithms` by <NAME>
https://github.com/BeiyanYunyi/resume
https://raw.githubusercontent.com/BeiyanYunyi/resume/main/README.md
markdown
# 个人简历 使用 typst 和 [Brilliant-CV](https://github.com/mintyfrankie/brilliant-CV) 编写,可供参考。
https://github.com/AnsgarLichter/cv-typst
https://raw.githubusercontent.com/AnsgarLichter/cv-typst/main/cv-de.typ
typst
#import "template.typ": * #import "@preview/fontawesome:0.1.0": * #show: cv #let icons = ( phone: fa-phone(), homepage: fa-home(fill: colors.accent), linkedin: fa-linkedin(fill: colors.accent), github: fa-github(fill: colors.accent), xing: fa-xing(), mail: fa-envelope(fill: colors.accent) ) #header( fullName: [<NAME>], jobTitle: [Master-Student Informatik bei SAP], socials: ( ( icon: icons.github, text: [AnsgarLichter], link: "https://github.com/AnsgarLichter" ), ( icon: icons.homepage, text: [ansgarlichter.com], link: "https://ansgarlichter.com" ), ( icon: icons.mail, text: [<EMAIL>], link: "mailto://<EMAIL>" ), ( icon: icons.linkedin, text: [ansgarlichter], link: "https://linkedin.com/in/ansgarlichter" ) ), profilePicture: "../media/profilePhoto.jpeg" ) #section("Arbeitserfahrung") #entry( title: "Praktische Erfahrungen während des Masterstudiums", companyOrUniversity: "SAP SE", date: "09/2022 - 09/2024", location: "Walldorf, Germany", logo: "media/sap.png", description: list( [Insgesamt 4 Rotationen in verschiedenen Abteilungen], [Beratung & Entwicklung mehrerer Fiori-Apps für die Risikobewertung im Homeoffice unter Verwendung von CAP Node.js], [Unterstützung bei der Entwicklung einer Microservice-Architektur unter Verwendung von CAP Java], [Entwicklung von OPA-Tests in TypeScript für Fiori Elements-Anwendungen inklusive der Synchronisierung von Mock-Daten], ) ) #entry( title: "SAP EWM Softwareentwickler", companyOrUniversity: "SEW-EURODRIVE", date: "09/2020 - 08/2022", location: "Graben-Neudorf, Germany", logo: "media/sew.png", description: list( [Entwicklung im SAP EWM-System mit ABAP OO, Entwicklung von Webanwendungen zur Abwicklung logistischer Prozesse mit SAPUI5 und OData-Services], [Erstellung einer neuen Vorlage für manuelle Lager für alle Werke weltweit, einschließlich Koordination mit den relevanten Abteilungen], ) ) #entry( title: "Praktische Erfahrungen während des Bachelorstudiums", companyOrUniversity: "SEW-EURODRIVE", date: "09/2017 - 09/2020", location: "Bruchsal / Graben-Neudorf, Germany", logo: "media/sew.png", description: list( [Entwicklungsaufgaben (Webanwendungen, Transaktionen, Skripte) in verschiedenen Abteilungen im Kontext verschiedener SAP-Systeme], [ABAP OO, ODataV2, SAPUI5], [Unterstützung des Going Live eines SAP-MES-Pilotprojekts mit einem 2-monatigen Aufenthalt in Suzhou, China] ) ) #section("Ausbildung") #entry( title: "Master of Science Informatik", companyOrUniversity: "Hochschule Karlsruhe", date: "09/2022 - 09/2024", location: "Karlsruhe, Germany", logo: "media/hka.png", description: list( [Thesis: A Comparative Analysis of PostgreSQL and SAP HANA in the Context of the SAP Cloud Application Programming Model - Developing a Recommendation Framework], [Schwerpunkt: Software Engineering], [Durchschnitt: 1,0 (Thesis fehlt)] ) ) #entry( title: "Deutschlandstipendium", companyOrUniversity: "Hochschule Karlsruhe", date: "09/2023 - 09/2024", location: "", logo: "media/stipendium.png", description: list( [Stipendium verliehen für akademisches Potenzial] ) ) #entry( title: "Bachelor of Science Wirtschaftsinformatik", companyOrUniversity: "DHBW Karlsruhe", date: "09/2017 - 09/2020", location: "Karlsruhe, Germany", logo: "media/dhbw.png", description: list( [Thesis: Digitalisierung der Intralogistik – Evaluation verschiedener Pick-by-Lösungen zur Verbesserung des Kommissionierungsprozesses bei SEW-EURODRIVE], [Schwerpunkt: Software Engineering], [Durchschnitt: 1,5] ) ) #pagebreak() #header( fullName: [<NAME>], jobTitle: [Master-Student Informatik bei SAP], socials: ( ( icon: icons.github, text: [AnsgarLichter], link: "https://github.com/AnsgarLichter" ), ( icon: icons.homepage, text: [ansgarlichter.com], link: "https://ansgarlichter.com" ), ( icon: icons.mail, text: [<EMAIL>], link: "mailto://<EMAIL>" ), ( icon: icons.linkedin, text: [ansgarlichter], link: "https://linkedin.com/in/ansgarlichter" ) ), profilePicture: "../media/profilePhoto.jpeg" ) #section("Programmierkenntnisse") #entry( title: "ExportKindleClippingsToNotion ", companyOrUniversity: "Persönliches Projekt", date: "2023 - 2024", location: "", logo: "media/ExportKindleClippingsToNotion.jpeg", description: list( [CLI-Tool zum Exportieren von Kindle-Markierungen nach Notion], [In C\# unter Verwendung der offiziellen Notion API] ) ) #entry( title: "DHBW-App", companyOrUniversity: "Projekt an der Universität", date: "2020", location: "", logo: "media/dhbw.png", description: list( [Wartung und Weiterentwicklung der folgenden Funktionen: Live-Abfahrtszeiten von Zügen, Vorlesungsplan und Speiseplan der Cafeteria], [Aktualisierung der verwendeten Frameworks auf die neueste Version], [Mobile App in Ionic & Angular für Android und iOS] ) ) #entry( title: "Catch The Train", companyOrUniversity: "Persönliches Projekt", date: "2019", location: "", logo: "media/CatchTheTrain.jpeg", description: list( [Aktuelle Abfahrtszeiten einfacher & angenehmer abrufen], [Verwendung von Flutter und der offiziellen API des örtlichen Verkehrsunternehmens] ) ) #section("Fähigkeiten & Interessen") #skill( category: "Technologien", skills: ("SAPUI5", "Fiori Elements", "CAP Node.js / Java", "JavaScript", "TypeScript", "ABAP OO", "Angular") ) #skill( category: "Sprachen", skills: ("Deutsch (Muttersprache)", "Englisch (flüssig)", "Spanisch (Grundkenntnisse)") ) #skill( category: "Sport", skills: ("Gym", "Fahrrad fahren", "Schwimmen") ) #skill( category: "Interessen", skills: ("Technologiebegeistert", "Politik & Wirtschaft", "Motorsport (Formel 1)") )
https://github.com/Cheng0Xin/typst-libs
https://raw.githubusercontent.com/Cheng0Xin/typst-libs/master/README.md
markdown
# Installation ## For mac user ```sh rm -rf ~/Library/Application\ Support/typst/packages/local/note/1.0.0 rm -rf ~/Library/Application\ Support/typst/packages/local/semantics/1.0.0 rm -rf ~/Library/Application\ Support/typst/packages/local/acg-comment/1.0.0 ln -s ~/Workspace/typst-libs/note \ ~/Library/Application\ Support/typst/packages/local/note/1.0.0 ln -s ~/Workspace/typst-libs/semantics \ ~/Library/Application\ Support/typst/packages/local/semantics/1.0.0 ln -s ~/Workspace/typst-libs/acg-comment \ ~/Library/Application\ Support/typst/packages/local/acg-comment/1.0.0 ``` ## For mac user ```sh ln -s ~/Workspace/typst-libs/note \ ~/.local/share/typst/packages/local/note/1.0.0 ln -s ~/Workspace/typst-libs/semantics \ ~/.local/share/typst/packages/local/semantics/1.0.0 ln -s ~/Workspace/typst-libs/acg-comment \ ~/.local/share/typst/packages/local/acg-comment/1.0.0 ```
https://github.com/Jollywatt/typst-fletcher
https://raw.githubusercontent.com/Jollywatt/typst-fletcher/master/docs/readme-examples/flowchart-trap.typ
typst
MIT License
// https://xkcd.com/1195/ #import fletcher.shapes: diamond #set text(font: "Comic Neue", weight: 600) #diagram( node-stroke: 1pt/*<*/ + fg/*>*/, edge-stroke: 1pt/*<*/ + fg/*>*/, crossing-fill: bg, // hide node((0,0), [Start], corner-radius: 2pt, extrude: (0, 3)), edge("-|>"), node((0,1), align(center)[ Hey, wait,\ this flowchart\ is a trap! ], shape: diamond), edge("d,r,u,l", "-|>", [Yes], label-pos: 0.1) )
https://github.com/chamik/gympl-skripta
https://raw.githubusercontent.com/chamik/gympl-skripta/main/uvod.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "@preview/ccicons:1.0.0": cc-url #set page(margin: 3cm) #set block(spacing: 1.5em) #show heading: it => [ #set text(30pt) #it ] #heading(numbering: none)[Úvod] #v(1em) V životě každého středoškoláka nastane divná, přechodná chvíle, kdy je vyhozen z hnízda. Doufám, že ti následující poznámky, shrnující 22 děl pro maturitu z češtiny a 24 témat pro školní maturitu z angličtiny, pomohou zdolat tu tolik omílanou "zkoušku dospělosti" v relativní pohodě. Děkuji Kačí za korekci a propůjčené poznámky a Marianovi za sepsání několika děl a autorů. Tento dokument je sdílený pod licencí #link(cc-url("cc-by-sa"), [CC BY-SA 4.0]), což má za následek několik praktických důsledků a povinností s nimi spojených: - Můžeš ho volně sdílet za předpokladu, že uvedeš původního autora. - Můžeš ho volně upravovat za předpokladu, že zachováš licenci. Zdrojové soubory najdeš v #link("https://github.com/chamik/gympl-skripta", [repozitáři na Githubu]). Budu rád, pokud svůj případný příspěvek (ať už opravení překlepu, nebo třeba přidání celé knížky) budeš sdílet i tam. Aktuální zdroj vždy najdeš na #link("https://chamik.eu/gympl-skripta/", [mých stránkách]). Přeji hodně štěstí u maturit. #v(1cm) #align(right, [Kubík #h(4cm)])
https://github.com/Relacibo/typst-as-lib
https://raw.githubusercontent.com/Relacibo/typst-as-lib/main/CHANGELOG.md
markdown
MIT License
# Changelog ## [0.11.0] - * - `IntoCachedFileResolver` - wraps the file resolver in an in-memory cache ## [0.10.0] - 2024-10-19 - Updated Typst dependency to version 0.12.0 - compile functions: - `tracer` argument removed - Return Type of is now wrapped in `Warned` type - Added optional in-memory-caching of sources and binary files for `FileSystemResolver` and `PackageResolver`, that is enabled by default. - `PackageResolver` has now the cache as generic type argument. - `PackageResolver` has to be build with the `PackageResolverBuilder` ## [0.9.0] - 2024-10-12 - Fix: Today function - Use Utc::now instead of Local::now - Support packages, that are installed locally. ([local typst package dir](https://github.com/typst/packages?tab=readme-ov-file#local-packages)) - Breaking: Support caching packages in file system (default: <OS_CACHE_DIR>/typst/packages). Library users now have to specify, if they want to use in memory caching or the file system. Default is file system. Change ```rust let arc = Default::default(); let template = TypstTemplate::new(vec![font], TEMPLATE_FILE) .with_package_file_resolver(arc, None); ``` to ```rust let arc = Default::default(); let template = TypstTemplate::new(vec![font], TEMPLATE_FILE) .add_file_resolver(PackageResolver::new(PackageResolverCache::Memory(arc), None)); ``` You also can use the filesystem now, which is the default: ```rust let template = TypstTemplate::new(vec![font], TEMPLATE_FILE) .with_package_file_resolver(None); ```
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/docs/download-font-assets.md
markdown
Apache License 2.0
# Prerequisite - Download Font Assets The font assets for Typst.ts are not included in this repository. You need to download and put them in following directories. - To make Compiler happy, linking the font directory to `assets/fonts`. - To make the [Renderer Sample](https://github.com/Myriad-Dreamin/typst.ts/blob/9f9295cf130092f9719d771f3969914967265f2a/renderer/src/driver/main.ts#L27-L34) happy, linking the font directory to `/pacakges/typst.ts/dist/fonts`. There are several ways to downloading the font files: - Download the font files from [Typst repository](https://github.com/typst/typst/tree/main/assets/fonts). - Download the font files via `git`: Please use following command inside of `typst.ts` repo: ```shell # init inside typst.ts repository $ git submodule update --init --recursive . # update inside typst.ts repository $ git submodule update --recursive ``` Please use following command outside of `typst.ts` repo: ```shell # outside typst.ts repository $ git clone https://github.com/Myriad-Dreamin/typst/ fonts --single-branch --branch assets-fonts --depth 1 ``` - Download font files from our [Release Page](https://github.com/Myriad-Dreamin/typst.ts/releases/tag/v0.1.0).
https://github.com/xbunax/tongji-undergrad-thesis
https://raw.githubusercontent.com/xbunax/tongji-undergrad-thesis/main/CONTRIBUTING.md
markdown
MIT License
# CONTRIBUTING ## Contents * source files: as a template repository, "source files" are ".typ", ".bib" and some related files with other extension names. * doc files: including all ".typ" files and even "main.typ", which show how to use "source files". * config files: These files make our development and use of templates more standardlized (e.g. .gitignore). ## How to contribute ### How to ask for help? Providing conditions where people ask for help and solve problems is also part of community. We hope to provide technique support in [Discussions](https://github.com/TJ-CSCCG/tongji-undergrad-thesis-typst/discussions). It has to be **NOTICED** that: **DO NOT CONTACT WITH ANY CONTRIBUTOR THROUGH IM**! ### How to report a bug? If a bug is confirmed, you can raise it in the [Issues](https://github.com/TJ-CSCCG/tongji-undergrad-thesis-typst/issues). ### How to pull request? We recommend to follow this workflow step by step: 1. Fork this repository as upstream repository. 2. Clone the repository forked from remote to local. 3. Create a new local branch as a work branch. 4. Commit some changes on the work branch. 5. Push the new local branch to remote with commits. 6. Pull request, from the new remote branch to any branch of upstream repository.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/modernpro-coverletter/0.0.1/template/main.typ
typst
Apache License 2.0
#import "@preview/modernpro-coverletter:0.0.1": * #show: main.with( font-type: "openfont", name: [#lorem(2)], address: [#lorem(4)], contacts: ( (text: "08856", link: ""), (text: "example.com", link: "https://www.example.com"), (text: "github.com", link: "https://www.github.com"), (text: "<EMAIL>", link: "mailto:<EMAIL>"), ), recipient: ( start-title: [Dear], cl-title: [Job Application for Hiring Manager], date: [], department: [#lorem(2)], institution: [#lorem(2)], address: [#lorem(4)], postcode: [#lorem(1)], ), ) #lorem(300)
https://github.com/chendaohan/bevy_tutorials_typ
https://raw.githubusercontent.com/chendaohan/bevy_tutorials_typ/main/27_visibility/visibility.typ
typst
#set page(fill: rgb(35, 35, 38, 255), height: auto, paper: "a3") #set text(fill: color.hsv(0deg, 0%, 90%, 100%), size: 22pt, font: "Microsoft YaHei") #set raw(theme: "themes/Material-Theme.tmTheme") = 1. 可见性 在 Bevy 中,Visibility 用于控制某物是否被渲染。如果你希望一个实体存在于世界中,但不显示出来,你可以将其隐藏。 ```rs commands .spawn( MaterialMesh2dBundle { mesh: meshes.add(Rectangle::new(200., 200.)).into(), material: materials.add(Color::Srgba(Srgba::RED)), transform: Transform::from_xyz(-400., 0., 0.), visibility: Visibility::Hidden, ..default() } )); ``` = 2. 可见性组件 在 Bevy 中,可见性由多个组件表示: - Visibility:用户控制的开关(在这里设置你想要的) - InheritedVisibility:用于 Bevy 跟踪来自任何父实体的状态 - ViewVisibility:用于 Bevy 跟踪实体是否应该实际显示 任何表示游戏世界中可渲染对象的实体都需要包含这些组件。Bevy 内置的大多数 Bundle 类型都包括它们。 如果你在创建自定义实体时不使用这些 Bundle ,可以使用以下之一来确保不会遗漏: - SpatialBundle:用于变换 + 可见性 - VisibilityBundle:仅用于可见性 ```rs commands.spawn(( Mesh2dHandle(meshes.add(Circle::new(100.))), materials.add(Color::Srgba(Srgba::BLUE)), // SpatialBundle::default(), // TransformBundle::default(), Transform::default(), GlobalTransform::default(), // VisibilityBundle::default(), Visibility::default(), InheritedVisibility::default(), ViewVisibility::default(), )); ``` 如果你没有正确添加这些组件(例如,手动添加了 Visibility 组件但忘记了其他组件,因为你没有使用 Bundle),你的实体将不会渲染! = 3. Visibility Visibility 是“用户控制的开关”。这是你为当前实体指定所需状态的地方: - Inherited(默认):根据父实体显示/隐藏 - Visible:始终显示实体,无论父实体如何 - Hidden:始终隐藏实体,无论父实体如何 如果当前实体有任何子实体且其可见性为 Inherited,当你将当前实体设置为 Visible 或 Hidden 时,它们的可见性将受到影响。 如果一个实体有父实体,但父实体缺少与可见性相关的组件,行为将如同没有父实体一样。 = 4. InheritedVisibility InheritedVisibility 表示当前实体基于其父实体的可见性状态。 InheritedVisibility 的值应视为只读。它由 Bevy 内部管理,类似于变换传播。一个“可见性传播”系统在 PostUpdate 调度中运行。 如果你想读取当前帧的最新值,应将你的系统添加到 PostUpdate 调度中,并在 VisibilitySystems::VisibilityPropagate 之后排序。 ```rs fn print_triangle_iherited_visibility(triangle: Query<&InheritedVisibility, With<MyTriangle>>) { let Ok(inherited_visibility) = triangle.get_single() else { return; }; info!("triangle inherited visibility: {inherited_visibility:?}"); } print_triangle_iherited_visibility .after(VisibilitySystems::VisibilityPropagate) ``` = 5. ViewVisibility ViewVisibility 表示 Bevy 关于是否需要渲染该实体的最终决定。 ViewVisibility 的值是只读的。它由 Bevy 内部管理。 它用于“剔除”:如果实体不在任何相机或光源的范围内,则不需要渲染,因此 Bevy 将其隐藏以提高性能。 每帧,在“可见性传播”之后,Bevy 将检查哪些实体可以被哪些视图(相机或光源)看到,并将结果存储在这些组件中。 如果你想读取当前帧的最新值,应将你的系统添加到 PostUpdate 调度中,并在 VisibilitySystems::CheckVisibility 之后排序。 ```rs fn print_triangle_view_visibility(triangle: Query<&ViewVisibility, With<MyTriangle>>) { let Ok(view_visibility) = triangle.get_single() else { return; }; info!("triangle view visibility: {view_visibility:?}"); } print_triangle_view_visibility .after(VisibilitySystems::CheckVisibility) ```
https://github.com/comforttiger/lipu-sona-pi-toki-pona
https://raw.githubusercontent.com/comforttiger/lipu-sona-pi-toki-pona/main/public/en/pdf/lipu-sona.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#set text( font: ("Ubuntu", "nasin-nanpa"), lang: "en" ) #show enum: item => [ #set text(style: "italic") #item ] #let answers(label) = { link(label)[_answers on page #locate(loc => { query(label, loc).first().location().page() })_] } #let questions(label) = { link(label)[_questions on page #locate(loc => { query(label, loc).first().location().page() })_] } #let word(body) = { set text(luma(75)) [#body] } #set quote(block: true) #show quote: item => [ #set block(stroke: (left: 2pt), inset: 8pt) #set pad(y: -1em) #item ] #set page(numbering: "1") #[ #set align(center) #set text(22pt) #set heading(outlined: false) = lipu sona pi toki pona _tan soweli Tesa_ ] #outline(depth: 1) #pagebreak() = introduction - about this course hi! welcome to my toki pona course! \ i first made this course to teach my girlfriend toki pona, because i disagree with other courses on many small and big things and i didn't want to have to correct the courses while fae was going through them. \ however, i put a lot of work into this course, so i figured i may as well also put it out online for anyone else to use! i tried my best to do a good compromise between my personal style and the style of pu, and i think it should be a good starting point for anyone interested in learning toki pona. ultimately, it's up to you to form your own style after you're done with this course. this is the pdf version of my course, it's also available on https://lipu-sona.kittycat.homes/en! == notes this course will not make you fluent. no course out there will! toki pona may be minimalist, but it's still a complex language to learn. people spend several years before they even start considering themselves fluent, and you will probably be no different. \ however, this course will give you a good understanding of all the important fundamentals of toki pona, so you can then go on to explore the language on your own! i think that using the language actively is very important while learning, and i highly recommend joining toki pona communities where you can practice speaking the language and ask questions. it's okay to make mistakes - everyone does! \ #quote[󱥈󱤧󱤖󱤉󱥡󱥝 \ pakala li kama e sona sin \ ~ mistakes bring forth new knowledge] if you have any questions or feedback feel free to message me on discord (comforttiger\#0), message me on matrix (\@tiger:matrix.kittycat.homes), or email me on.. email (<EMAIL>) \ also feel free to message me if you need help with understanding anything toki pona related, or talk to other proficient speakers! #pagebreak() = lesson 0 - sounds toki pona has 14 letters in its alphabet: \ a e i k j l m n o p s t u w == general guide to pronounciation === vowels the vowels are similar to spanish. a [ä] - like *a* in f#strong[a]ther \ e [e̞] - like *e* in l#strong[e]t or t#strong[e]n \ i [i] - like *ee* in b#strong[ee]n \ o [o̞] - like *o* in c#strong[o]ne \ u [u] - like *oo* in s#strong[oo]n (note that the comparisons to english words are approximations and may not be accurate depending on your accent, i recommend going by the IPA symbols inside the square brackets for a more accurate idea of the correct pronunciations) === consonants most of the consonants are just like english, except j. j is always like y in yellow === stress don't be stressed, you don't have to pronounce the letters _exactly_ as i say, you can pronounce things slightly differently if it feels natural - for example, you could soften your p, t, and k sounds into b, d, and g sounds! oh and also, you always have to stress the first syllable of every word. #pagebreak() = lesson 1 - me and you == vocab / 󱤴 mi: first-person pronoun (i, me, we, us) / 󱥞 sina: second-person pronoun (you) / 󱥦 suwi: sweet, fragrant; cute, adorable / 󱥝 sin: new, fresh, update; repeat, do again; additional, another, extra / 󱥬 toki: communicate, say, think; conversation, story; language / 󱥔 pona: positive quality; good, pleasant, helpful, friendly, useful, peaceful == lesson === sentences with 󱤴 mi or 󱥞 sina the most basic sentence structure in toki pona is: \ #quote[󱤴/󱥞 predicate \ mi/sina predicate] #word[󱤴/󱥞 mi/sina] is the _subject_ of this sentence - the one who is doing or being. \ the _predicate_ is what the subject is doing or being. === sitelen pona sitelen pona is toki pona's own writing system! its a logography, where every word has its own symbol. you've already seen the symbols - they're next to the words in the vocab section! === notes - in toki pona, you don't capitalize the starts of sentences. - toki pona has no built-in tense or number. #pagebreak() === examples #quote[󱥞󱥦 \ sina suwi \ ~ you are cute] #quote[󱤴󱥬 \ mi toki \ ~ we talked \ ~ i am talking] == exercises <questions1> #answers(<answers1>) === toki pona to english + mi suwi + sina pona + toki! mi sin === english to toki pona + we're talking + i'm you === read sitelen pona + 󱥞󱥬 + 󱤴󱥔 #pagebreak() = lesson 2 - the particle li == vocab / 󱥆 ona: third-person pronoun (he/she/it/they) / 󱤻 musi: fun, game, entertainment, art, play, amusing, interesting, comical, silly / 󱤌 ijo: thing, phenomenon, object, matter, something; being, entity, someone / 󱤑 jan: human being, person, someone / 󱤍 ike: negative quality; bad, unpleasant, harmful, unneeded / 󱥢 soweli: fuzzy creature, land animal, beast / 󱥴 waso: bird, flying creature, winged creature / 󱤧 li: _particle:_ marks the predicate == lesson === sentences without 󱤴 mi or 󱥞 sina we covered sentences with only #word[󱤴 mi] or #word[󱥞 sina] as the subject, but for sentences with any other word as the subject, it's different. \ in this case, you use the particle #word[󱤧 li] to introduce the predicate: \ subject 󱤧 predicate \ subject li predicate === practice writing sitelen pona! the end of the lessons have exercises in reading sitelen pona, but i highly recommend you practice writing sitelen pona too! grab a pen and paper and just write about your feelings, your day, everyday objects, using sitelen pona! keep practicing as you learn more words and grammar, and you'll come far. #pagebreak() === examples #quote[󱥆󱤧󱥦 \ ona li suwi \ ~ they are cute] #quote[󱥴󱤧󱥴 \ waso li waso \ ~ birds are birds] == exercises <questions2> #answers(<answers2>) === translate from toki pona to english + ona li waso + ijo li musi + jan li musi === translate from english to toki pona + evil is bad + sweets are great + the thing is bad + i like movies === read sitelen pona + 󱤍󱤧󱤻 + 󱥆󱤧󱥢 + 󱥴󱤧󱥝 #pagebreak() = lesson 3 - modifiers == vocab / 󱤨 lili: small, short, young; few; piece, part / 󱤼 mute: many, several, very; quantity / 󱤂 ala: not, nothing, no / 󱥁 ni: this, that, these, those / 󱥵 wawa: power, energy, strength; confident, intense, forceful; amazing, impressive / 󱥶 weka: absent, away, distant; remove, get rid of / 󱤘 ken: ability, permission; possibility, maybe; allow, enable == lesson === modifiers modifiers go after the word they're modifying. \ #quote[󱥢󱤨\ soweli lili \ ~ small animal] to do possessive, you modify the word with the pronoun. \ #quote[󱥢󱤨󱤴 \ soweli lili mi \ ~ my small animal] in sitelen pona, you can also put the modifier inside or above the word it's modifying. #quote[󱥢󱦖󱤨 \ 󱥢󱦕󱤨 \ ~ soweli lili] there's no particular rules to when you should write modifiers one way or another in sitelen pona, just write them the way that looks the best to you! === note about modifying 󱤴 mi or 󱥞 sina keep in mind that if you modify #word[󱤴 mi] or #word[󱥞 sina], you need to use #word[󱤧 li] afterwards. #quote[󱤴󱥝󱤧󱥵 \ mi sin li wawa \ ~ those of us who are new are confident] === note about context toki pona is a very context-dependent language. one phrase can mean many different things in many different contexts. in order to communicate properly, you need to think about and break down what the thing you're talking about means, and how that can be expressed in context. #quote[󱤑󱤻󱤨 \ jan musi lili \ ~ young entertainers \ ~ short clowns \ ~ a few comedians] since exercises can't really have as much context as real life situations do, the translations you come up with might differ from mine. that's okay! if your translation is different, think for yourself if your translation might make sense in a given context, or feel free to ask a proficient speaker about it if you're really unsure. == exercises <questions3> #answers(<answers3>) === translate from toki pona to english + ken mute + soweli wawa li lili ala + ona li jan ike + weka sina li ike + ni li pona ala === translate from english to toki pona + small animals are really cute! + bats are capable + the children are gone + my strength is okay + lots of people speak well + the children, who are away, are playing nicely === read sitelen pona + 󱥞󱥢󱦕󱤨 + 󱥴󱤧󱥁󱤂 + 󱤑󱦖󱥶󱤧󱥵󱤼 + 󱥬󱦖󱥝󱤧󱤘 + 󱥴󱤼󱤧󱤻 #pagebreak() = lesson 4 - objects == vocab / 󱤮 lukin: look, view, examine, read, watch; eye, seeing organ / 󱤞 kule: color, pigment; category, genre, flavor / 󱥉 pali: work, practice; create, build, design; put effort toward, take action on / 󱥭 tomo: indoor space, shelter; room, building, home, tent, shack / 󱥪 telo: liquid; water, gasoline, soda, lava, soup, oil, ink / 󱤶 moku: eat, drink, consume, swallow, ingest; food, edible thing / 󱥅 olin: to have a strong emotional bond with, affection, appreciation; platonic, romantic, or familial relationships / 󱤉 e: _particle:_ marks the direct object == lesson you use the particle #word[󱤉 e] to indicate the _direct object_, the one being affected by the _predicate_. \ #quote[subject 󱤧 predicate 󱤉 direct object \ subject li predicate e direct object] #quote[󱥆󱤧󱥉󱤉󱥭 \ ona li pali e tomo \ ~ they are building a house] #pagebreak() === complex ideas when you want to express more complex ideas, you should often split it up into several sentences. you use the words #word[󱥁 ni] or #word[󱥆 ona] to refer to ideas you've already said or are going to say. #word[󱥁 ni] is a bit broader than #word[󱥆 ona]. #quote[󱤴󱤮󱤉󱤑󱦜󱥆󱤧󱥉󱤉󱥭󱤴 \ mi lukin e jan · ona li pali e tomo mi \ ~ i saw a person. they were building our house \ ~ i saw the person who is building our house] #quote[󱤴󱤮󱤉󱥁󱦜󱥞󱥅󱤉󱤴 \ mi lukin e ni · sina olin e mi \ ~ i see this: you love me] === examples #quote[󱤶󱥁󱤧󱥵󱤉󱤑 \ moku ni li wawa e jan \ ~ this food strengthens people] #quote[󱤑󱤧󱤻󱤍󱤉󱥢󱤨 \ jan li musi ike e soweli lili \ ~ the person is poorly entertaining the small animals] #quote[󱥆󱤧󱥉󱥵󱤉󱤻 \ ona li pali wawa e musi \ ~ they are confidently making games] #quote[󱥴󱤧󱤮󱤉󱥁󱦜󱥢󱥞󱤧󱥝 \ waso li lukin e ni · soweli sina li sin \ ~ the bird sees that your pet is new] === note about punctuation toki pona has no defined punctuation. the only thing that's necessary is some way to separate sentences. i opted to use an interpunct inbetween sentences as the only punctuation throughout this course. usually, it's very common to separate sentences with a full stop. when there's a #word[󱥁 ni] referring to an idea in the next sentence, a colon is often used instead. in sitelen pona it's common to use line breaks, middle dots (󱦜), or large spaces to seperate sentences. == exercises <questions4> #answers(<answers4>) === translate from toki pona to english + mi olin e sina + telo kule li pona + jan ike li lukin e moku mi + ona li kule mute + jan pali mute li kule e tomo moku + mi moku e moku sin sina === translate from english to toki pona + i see that you're cute + the animal is eating + i'm entertaining the workers + i like this restaurant + my girlfriend makes me good + i allow you to eat my food === read sitelen pona + 󱤴󱥉󱤉󱤞󱤼 + 󱤮󱥞󱤧󱥵 + 󱥢󱥆󱤧󱤶󱤉󱤑󱥝 + 󱤴󱥅󱤉󱥢󱥦 + 󱤨󱥆󱤧󱤻 #pagebreak() = lesson 5 - preverbs == vocab / 󱥑 pipi: insect, bug, spider, tiny crawling creature / 󱤷 moli: death, dead, die, dying; kill, murder / 󱤎 ilo: tool, implement, machine, device === preverbs / 󱤖 kama: arrive, approach, summon; future \ _preverb:_ to become / 󱥷 wile: want, desire, wish, require \ _preverb:_ to want to / 󱤈 awen: stay, remain, wait, pause; protect, keep safe; continue \ _preverb:_ to continue to / 󱥡 sona: knowledge, information, data; know, be skilled in, be wise about preverb \ _preverb:_ to know how to / 󱤘 ken: ability, permission; possibility, maybe; allow, enable \ _preverb:_ to be able to / 󱤮 lukin: look, view, examine, read, watch; eye, seeing organ \ _preverb:_ to try to === notes #word[󱤖 kama], #word[󱥷 wile], #word[󱤈 awen], #word[󱥡 sona], #word[󱤘 ken], #word[󱤮 lukin] are preverbs! words have different meanings when used as preverbs and otherwise. the preverb meaning of a word is marked separately. there are two words you already know on this list, #word[󱤘 ken] and #[󱤮 lukin], but their preverb meanings are new. == lesson === preverbs preverbs go before the predicate and modify it. preverbs can only be modified with the word #word[󱤂 ala], to negate it. you can also put multiple preverbs after each other. #quote[subject 󱤧 preverb predicate (󱤉 object) \ subject li preverb predicate (e object)] === examples #quote[󱤴󱤘󱤂󱤷󱤉󱥑 \ mi ken ala moli e pipi \ ~ i can't kill the bug] #quote[󱥞󱤘󱤖󱥔 \ sina ken kama pona \ ~ you can become good] #quote[󱥴󱥦󱤧󱤈󱥷󱤉󱥑 \ waso suwi li awen wile e pipi \ ~ the cute bird still wants a bug] == exercises <questions5> #answers(<answers5>) === translate from toki pona to english + mi ken awen wawa + weka ona li wawa e jan mute + ilo li ken ala moli e soweli + jan li kama e moku + waso li pali e ilo toki + jan li pali e ni · mi wile awen soweli + mi wile e ni · sina lukin e pipi pona === translate from english to toki pona + i wanna learn toki pona + i can't see that + i am protecting you + i saw that you fixed our house + this tool strengthens the bugs + i'm trying to see my glasses === read sitelen pona + 󱤴󱤮󱥉󱤉󱤎󱥔 + 󱥴󱤧󱤈󱤮󱤉󱥞 + 󱥆󱤧󱥷󱤶󱤉󱥑 + 󱤑󱤧󱤖󱥡󱥬󱥔 + 󱥴󱤧󱥡󱥴 + 󱥢󱤧󱤘󱤶󱤉󱥞 #pagebreak() = lesson 6 - the particle pi == vocab / 󱤄 ale: all, every, everything, entirety / 󱥐 pini: finish, stop, prevent; close, disable, turn off; ended, past; edge, end, conclusion / 󱤪 lipu: flat object; book, card, leaf, paper, document, website / 󱤔 kala: fish, marine animal, sea creature, swimming creature / 󱥌 pana: give, send, emit, provide, put, release; gift, present / 󱤗 kasi: plant, vegetation; herb, leaf / 󱥍 pi: _particle:_ regroups modifiers == lesson === the particle pi #word[󱥍 pi] is a really useful particle that regroups modifiers. \ normally, each modifier modifies the sum of all the previous words in the phrase. the particle #word[󱥍 pi] creates a second phrase which modifies the first phrase. #quote[󱤔󱥔󱤼 \ kala pona mute \ ~ many good fish] #quote[󱤔󱥍󱥔󱤼 \ kala pi pona mute \ ~ very good fish] in the first example, #word[󱤼 mute] modifies #word[󱤔󱥔 kala pona], while in the second example, #word[󱥔󱤼 pona mute] modifies #word[󱤔 kala]. === definition of phrase when i say phrase, i mean a collection of a main word + modifiers, like #word[󱤑 jan] or #word[󱤎󱤶 ilo moku]. === note about long phrases it's a common mistake to try to cram as much information as possible into just one phrase. try to avoid this! if you want to be more easily understood, it's often better to describe concepts in sentences, and then refer back to previously described concepts with a concise phrase which makes sense within the context you've established. === examples #quote[󱤴󱥬󱤉󱤌󱥍󱥔󱤼 \ mi toki e ijo pi pona mute \ ~ i talk about a very good thing] #quote[󱤴󱥬󱤉󱤌󱥔󱤼 \ mi toki e ijo pona mute \ ~ i talk about many good things] #quote[󱤴󱥬󱤉󱤌󱤼󱥍󱥔󱤼 \ mi toki e ijo mute pi pona mute \ ~ i talk about many things which are very good] == exercises <questions6> #answers(<answers6>) === translate from toki pona to english + kasi telo li ken moku + soweli li pana e lipu pi sona mute + jan pi sona kala li sona e ni · kala li ken moku e jan + ona li waso pi suwi mute + ale li kama kala + ijo sin pi mute pona li kama === translate from english to toki pona + i'm reading the book of evil knowledge + the bugs built a library for books about bugs + my friend who knows how to build houses is handing out documents about building + the absence of my partner makes everything bad + people who are very far away are trying to eat my fish === read sitelen pona + 󱤔󱤧󱥷󱤮󱤉󱤗󱥍󱦗󱤪󱥞󱦘 + 󱤴󱥷󱥶󱤉󱥑󱤄 + 󱤗󱤧󱥌󱤉󱥵 + 󱥢󱤨󱤧󱤘󱥵 + 󱥐󱥍󱦗󱤪󱥞󱦘󱤧󱤍 #pagebreak() = lesson 7 - prepositions == vocab / 󱤲 mani: money, currency; thing of value, gold, investment, livestock / 󱤬 lon: real, true, existing, present \ _preposition:_ located at, located in / 󱥩 tawa: motion, e.g. walking, shaking, flight, travel \ _preposition:_ to, for, going to, from the perspective of, for the purpose of / 󱥧 tan: cause, origin, reason \ _preposition:_ from, because of / 󱥖 sama: same, similar, alike \ _preposition:_ similar to, same as / 󱤙 kepeken: _preposition:_ using, by means of == lesson === prepositions #word[󱤬 lon], #word[󱥩 tawa], #word[󱥧 tan], #word[󱥖 sama], and #word[󱤙 kepeken] are prepositions. \ prepositions are used to express specific details about the predicate, like how or where. just like preverbs, prepositions can be negated by the word #word[󱤂 ala]. the preposition is appended to the end of the sentence, followed by a phrase. #quote[subject 󱤧 (predicate 󱤉 object) preposition phrase \ subject li (predicate e object) preposition phrase] #quote[󱤴󱥉󱤬󱥭󱤶 \ mi pali lon tomo moku \ ~ i work at a restaurant] the preposition can also be the predicate: #quote[󱥆󱤧󱤬󱥭󱤴 \ ona li lon tomo mi \ ~ they are at my house] prepositions can be stacked: #quote[󱤴󱤖󱥡󱤬󱥭󱥡󱥖󱥞 \ mi kama sona lon tomo sona sama sina \ ~ i learned in school just like you] prepositions can also be used as regular words: #quote[󱥩󱥞󱤧󱤻 \ tawa sina li musi \ ~ your movements are amusing] #pagebreak() === examples #quote[󱤲󱤼󱤧󱤬󱥭󱤲 \ mani mute li lon tomo mani \ ~ there's lots of money at the bank] #quote[󱤑󱤧󱥩󱥭󱥞 \ jan li tawa tomo sina \ ~ a person goes to your house] #quote[󱤴󱥉󱤉󱤌󱤼󱤙󱤎 \ mi pali e ijo mute kepeken ilo \ ~ i make lots of things with tools] #quote[󱤴󱥬󱤉󱥔󱥞󱥧󱥁󱦜󱤴󱥅󱤉󱥞 \ mi toki e pona sina tan ni · mi olin e sina \ ~ i say good things about you because i love you] #quote[󱤴󱤬󱤉󱥭󱥞 \ mi lon e tomo sina \ ~ i make your house exist] == exercises <questions7> #answers(<answers7>) === translate from toki pona to english + mi lukin pana e kasi tawa sina + ijo li awen sona e pona sina tan ni · sina awen pana e sona ni tawa ona + mi wile sona e tan + ijo mute li wile e ilo tawa tan ni · tomo pali ona li weka mute + lipu wile li lon tomo sina === translate from english to toki pona + i saw someone who looked just like you + they wanna give you money + this house needs colourful flowers + people work for bad reasons + birds can learn a lot of things with books === read sitelen pona + 󱥷󱥍󱦗󱥴󱤍󱦘󱤧󱥁󱦜󱥞󱥌󱤉󱤲󱦖󱤄󱥞󱥩󱥆 + 󱥆󱤧󱥷󱤂󱥌󱤉󱤎󱥆󱥩󱥞 + 󱥵󱤴󱤧󱥧󱥅󱥞 + 󱤮󱥞󱤧󱥖󱤮󱥑 + 󱤴󱥷󱤉󱤲󱥧󱥬󱥔󱤴 #pagebreak() = lesson 8 - time and place == vocab / 󱥫 tenpo: time, event, situation, moment, period, duration / 󱤅 anpa: bottom, underside; below, beneath; defeat, humble, lowly / 󱥒 poka: hip, side; next to, nearby, vicinity / 󱤸 monsi: back, behind, rear / 󱥟 sinpin: vertical surface; wall, board; front of something, face / 󱤏 insa: inside, center, between, middle, midpoint, internal / 󱥚 sewi: up, top, above, highest part; divine, sacred, supernatural; awesome, inspiring, excelling == lesson === place the place words express location. \ you can combine them with the preposition #word[󱤬 lon] to say "at (place)" #quote[(...) 󱤬 󱥚 \ (...) lon sewi \ ~ up \ ~ above \ ~ in the sky] ==== examples #quote[󱤑󱤧󱤬 󱤅󱥭 \ jan li lon anpa tomo \ ~ a person is under the house] #quote[󱥴󱤧󱥩󱤬 󱥚󱥍󱦗󱥢󱥞󱦘 \ waso li tawa lon sewi pi soweli sina \ ~ birds are flying above your pet] #quote[󱤴󱤘󱤂󱥔󱤉 󱥟󱥍󱦗󱥭󱥞󱦘 \ mi ken ala pona e sinpin pi tomo sina \ ~ i can't fix the front of your house] === time you say the time by describing it, often using the word #word[󱥫 tenpo]. \ just like with place words, you can combine descriptions of time with the preposition #word[󱤬 lon] to say "at (time)" #quote[(...) 󱤬 󱥫󱥍󱦗󱤖󱥤󱦘 \ (...) lon tenpo pi kama suno \ ~ in the morning \ ~ at the time of the sun's arrival] ==== examples #quote[󱤴󱥩󱥞󱤬 󱥫󱤖 \ mi tawa sina lon tenpo kama \ ~ i go to you in the future] #quote[󱤑󱤧󱥉󱤬 󱥫󱥁 \ jan li pali lon tenpo ni \ ~ the person is working at that time \ ~ the person is working now] #quote[󱤴󱥵󱤼󱤬 󱥫󱥐 \ mi wawa mute lon tenpo pini \ ~ i was really confident in the past] #quote[󱤴󱥷󱤂󱥉󱤬 󱥫󱤬 \ mi wile ala pali lon tenpo lon \ ~ i don't want to work right now] #quote[󱥴󱤧󱥩󱥚󱤬 󱥫󱤄 \ waso li tawa sewi lon tenpo ale \ ~ birds always fly \ ~ birds fly at all times] #pagebreak() == exercises <questions8> #answers(<answers8>) === translate from toki pona to english + soweli wawa li kama anpa + kasi mute li lon monsi pi tomo mi + mi ken tawa sina lon tenpo poka + mi wile lon poka sina tan ni · mi olin e sina + lipu li lon tenpo ale === translate from english to toki pona + there's something under that coin + your face is divine + bad things happened here in the past + the bugs are speaking in the debate hall + fish wanted to fly. now they don't === read sitelen pona + 󱤴󱤘󱤂󱤬󱥒󱥞󱥧󱥶󱥞 + 󱤌󱤧󱥩󱥭󱥚󱥧󱥁󱦜󱥆󱤧󱥷󱤖󱥔󱦜󱥆󱤧󱥷󱤖󱥵 + 󱥞󱤻󱤉󱤴󱤬󱥫󱥐 + 󱥢󱤧󱤬󱤸󱥞 #pagebreak() = lesson 9 - names == vocab / 󱤱 mama: parent, ancestor; creator, originator; caretaker, sustainer, guardian / 󱤰 ma: earth, land, soil; country, territory, world; outdoors / 󱥂 nimi: word, name / 󱤦 lete: cold, cool, frozen; freeze; uncooked, raw / 󱥗 seli: hot, warm; heat, fire, flame; burn / 󱤥 len: cloth, fabric, textile; hidden, secret, covered, private == lesson === names in toki pona, proper names are treated as modifiers, with a capitalized first letter. this means that you have to pick a word which describes what the thing is, and then modify that word with the tokiponized name. #quote[<NAME> \ ~ a jan named lisa] #quote[<NAME> \ ~ a country named Mewika (the united states)] in sitelen pona, you write names by putting sitelen pona characters inside a cartouche, and read the name by reading the first letter of each word in the cartouche. #quote[󱤑󱦐󱤦󱤎󱥗󱤄󱦑 \ ~ <NAME>] the words in the cartouche are #word[󱤦 #strong[l]ete], #word[󱤎 #strong[i]lo], #word[󱥗 #strong[s]eli], and #word[󱤄 #strong[a]le], which spells Lisa. some put special meaning in the words they choose to spell their names with, others choose the first ones that come to mind. either way is fine! #pagebreak() === tokiponization names in toki pona are "tokiponized," which means fitting the name into toki pona phonotactics. the general guidelines to tokiponization are the following: - use the local name and pronunciation - syllables consist of a consonant, then a vowel, then an optional letter n. - the consonant of the first syllable may be omitted. - wu, wo, ji, and ti are illegal - wu becomes u, wo becomes o, ji becomes i, and ti becomes si - you can't follow up a syllable-final n with an m or another n - d #sym.arrow.r t, b #sym.arrow.r p, v #sym.arrow.r w, f #sym.arrow.r p, r #sym.arrow.r w/l/k - english r turns to w - tapped or trilled r becomes l - french/german r turns to k - preserving syllable count is more important than preserving consonants - if you're tokiponizing your own name - don't be scared to break a rule or two if the resulting name makes you happier! it's your name and you can do whatever you want with it === headnouns headnouns are the word you put in front of the name, the thing the name is describing. when naming yourself in toki pona, you can pick anything as a headnoun for whatever reason you want! you can choose to describe yourself as a #word[󱤑 jan], #word[󱤎 ilo], #word[󱥑 pipi], or anything else! break loose and have fun with how you choose to express yourself! and importantly, respect how others choose to describe themselves! #pagebreak() === examples #quote[tess (my name!) \ ~ 󱥢󱦐󱥧󱤉󱥦󱤈󱦑 \ ~ soweli Tesa \ technically, my name should be Te to preserve syllable count, but i wanted to preserve the s in my name, so i broke a rule and made it Tesa instead!] #quote[tiara (my cat!) \ ~ 󱥢󱦐󱥦󱤌󱤑󱤄󱤧󱤂󱦑 \ ~ soweli Sijala \ ti is an illegal syllable, so it turns into si, and the r becomes an l because i'm norwegian and tap my rs!] #quote[english \ ~ 󱥬󱦐󱤌󱥁󱤧󱤍󱦑 \ ~ toki Inli \ here, the ng cluster is simplified to n, and the final sh was dropped to prioritize syllable count] #quote[swedish \ ~ 󱥬󱦐󱥷󱤉󱥂󱥗󱤂󱦑 \ ~ toki Wensa \ derived from swedish svenska, the sv cluster is simplified to just w, and the sk cluster gets simplified to s! \ remember that there's not ever just one correct tokiponization, for example, swedish could be toki Sensa instead!] #pagebreak() == exercises <questions9> #answers(<answers9>) === translate from toki pona to english + mi sona toki Nosiki + mi wile tawa ma sina + mi wile e len mute tan ni · ma Kanata li lete mute + sona mi pi nimi sina li kama weka lon tenpo poka + waso Lisa li wile pini e pali ona === translate from english to toki pona + tess is teaching faer girlfriend toki pona + this bug flew here from norway + my dad is stronger than your dad + your name is cool === read sitelen pona + 󱥴󱦐󱤎󱥉󱤄󱦑󱤧󱥷󱥌󱤉󱥞󱥩󱥪 + 󱤌󱤨󱤄󱤧󱤘󱥵 + 󱤱󱦐󱤮󱤉󱥑󱤄󱦑󱤧󱥷󱤉󱤥󱥗󱥧󱥩󱥍󱥫󱤖 + 󱤴󱥷󱥡󱤉󱥂󱥔󱤄 #pagebreak() = lesson 10 - a! == vocab / 󱤤 lawa: head, mind, brain; control, lead, guide; government, leader; rule, law / 󱤟 kulupu: group, community, society, company, nation, collection, team, crowd / 󱤾 nasa: strange, unusual, silly, abnormal, unexpected / 󱤀 a: _particle:_ emphasis or emotion == lesson === a! #word[󱤀 a] is an emotion particle! you can put it after a word or a sentence to intensify or emphasize what came before it. put on its own it means something like ah, oh!, or some other emotion sound, and several in a row often means laughter. === examples #quote[󱤀󱤀󱤀 \ a a a \ ~ hahaha] #quote[󱤀󱥞󱥡󱥔 \ a sina sona pona \ ~ ah, you know well] #quote[󱥞󱥵󱤀 \ sina wawa a \ ~ you're so strong!] #pagebreak() == exercises <questions10> #answers(<answers10>) === translate from toki pona to english + lawa mi li seli + kulupu lawa pi ma Mewika li ike + a a a toki sina li musi mute + ale li kama nasa lon tenpo === translate from english to toki pona + huh, i didn't know that + this community is really nice! + you're so cool + ah, this group is full of wise people === read sitelen pona + 󱤟󱥔󱤧󱥷󱤉󱤾 + 󱤀󱥴󱤼󱤧󱥩󱤬󱥚󱦜󱥁󱤧󱥔󱤼 + 󱤟󱤧󱥶󱤉󱤌󱤍 + 󱤴󱤦󱤉󱤶󱥞 #pagebreak() = lesson 11 - questions? == vocab / 󱤺 mun: moon, night sky object, star, celestial body / 󱤆 ante: other, altered; modify, change; difference / 󱥠 sitelen: image, picture, representation, symbol, mark, writing / 󱥓 poki: container; bag, bowl, box, cup, cupboard, drawer, folder / 󱥈 pakala: damage, break, botch, harm, mess up; mistake / 󱤓 jo: hold, carry, possess, contain, own / 󱥥 supa: flat horizontal surface; bed, floor, desk, plate, table, platform, stage / 󱥙 seme: _particle:_ indicates missing information in a question == lesson there are two ways to ask yes/no questions, and one way to ask an open-ended one. === 󱤌󱤂󱤌 ijo ala ijo to ask yes or no questions, you use the #word[󱤌󱤂󱤌 ijo ala ijo] pattern, where #word[󱤌 ijo] is a placeholder for either the first word in the predicate, or the first preverb if there is one. to answer a question like this you repeat the #word[󱤌 ijo] for yes, and say #word[󱤂 ala] or #word[󱤌󱤂 ijo ala] for no. #quote[󱥆󱤧󱥦󱤂󱥦󱥩󱥞 \ 󱥦 / 󱥦󱤂 \ ona li suwi ala suwi tawa sina \ suwi / suwi ala \ ~ is she cute in your opinion? \ ~ yes / no] #quote[󱥞󱥷󱤂󱥷󱥉 \ 󱥷 / 󱤂 \ sina wile ala wile pali \ wile / ala \ ~ do you want to work? \ ~ yes / no] notice how easily recognizable the #word[󱤌󱤂󱤌 ijo ala ijo] pattern is, especially in sitelen pona. #pagebreak() === anu seme? you can also form yes/no questions by appending #word[󱤇󱥙 anu seme] to the end. (don't worry, lesson 12 will cover the word #word[󱤇 anu]) \ they are answered the same way as #word[󱤌󱤂󱤌 ijo ala ijo] questions, by either repeating the #word[󱤌 ijo] which would be repeated, or #word[(󱤌)󱤂 (ijo) ala]. if you're unsure of which word to repeat, you could also just answer with a sentence. #quote[󱥞󱤶󱤇󱥙 \ 󱤴󱤶 / 󱤶 / 󱤶󱤂 \ sina moku anu seme \ mi moku / moku / moku ala \ ~ are you eating? \ ~ i am eating / yes / no] #quote[󱥁󱤧󱤎󱤕󱥞󱤇󱥙 \ 󱥁󱤧󱤎󱤕󱤴 / 󱤎 / 󱤂 \ ni li ilo kalama sina anu seme \ ni li ilo kalama mi / ilo / ala \ ~ is this your instrument? \ ~ this is my instrumnet / yes / no] #pagebreak() === open-ended questions open-ended questions are formed by making a normal sentence and putting the word #word[󱥙 seme] where the missing information would go. if you have phrased the question correctly, the responder should be able to replace the word #word[󱥙 seme] with the answer. #quote[󱥞󱥙 \ 󱤴󱥈󱤉󱤌 / 󱤴󱥢󱦐󱥧󱤉󱥦󱤈󱦑 \ sina seme \ mi pakala e ijo / mi soweli Tesa \ ~ what are you doing / who are you? \ ~ i'm breaking stuff / i'm tess] #quote[󱥙󱤧󱤬󱥥 \ 󱤲󱤄󱤴(󱤧󱤬󱥥) \ seme li lon supa \ mani ale mi (li lon supa) \ ~ what's on the table? \ ~ all of my money (is on the table)] #quote[󱥢󱦐󱥦󱤌󱤑󱤄󱤧󱤂󱦑󱤧󱤬󱥙 \ 󱥆󱤧󱤬󱤏󱥍󱦗󱥓󱤔󱦘󱤀 \ soweli Sijala li lon seme \ ona li lon insa pi poki kala a \ ~ where is tiara? \ ~ she is inside the container of fish!] #pagebreak() == exercises <questions11> #answers(<answers11>) === translate from toki pona to english + mi kama jo e moku mute kepeken mani + sina toki tawa mun tan seme + sina jo ala jo e sitelen suwi + seme li sona toki pona + ijo mute li ante e nimi ona tan toki pona === translate from english to toki pona + what's up? (not literal) + what's up? (literal) + i wanna be on the bed + what did you want to say? === read sitelen pona + 󱥞󱥈󱤉󱥥󱥧󱥙󱤀 + 󱤴󱥷󱤙󱥑󱥩󱥉󱤴 + 󱤰󱥁󱤧󱤦󱥙 + 󱥞󱤖󱥡󱥠󱥔󱥧󱥙 #pagebreak() = lesson 12 - anu == vocab / 󱤋 esun: trade, barter, exchange, swap, buy, sell; market, shop, fair, bazaar, place of business / 󱤛 kiwen: hard object; metal, stone, wood / 󱥱 utala: fight, compete, battle; competition, challenge; struggle, strive / 󱤿 nasin: method, process, doctrine, tradition; path, road, way / 󱥜 sike: circle, sphere, spiral, round thing, ball, wheel; repeating thing, cycle, orbit, loop / 󱤇 anu: _particle:_ separates multiple possibilities, replacing the particle/preposition == lesson === anu #word[󱤇 anu] is a particle thats similar to "or" it adds a new phrase to the current part of speech (subject, predicate, object, preposition), and indicates an and/or relationship between the two (or more) phrases. === examples #quote[󱥆󱤧󱤑󱤇󱥢 \ ona li jan anu soweli \ ~ they're a person or a dog] #quote[󱥴󱤧󱤘󱥩󱤬󱤰󱤇󱥚 \ waso li ken tawa lon ma anu sewi \ ~ birds can move on the ground or in the sky] #quote[󱤗󱤇󱥦󱤧󱤘󱤶 \ kasi anu suwi li ken moku \ ~ plants or sweets can be food] #pagebreak() === notes about questions #word[󱤇 anu] doesn't automatically form questions. one way to use #word[󱤇 anu] to ask a question might be to list the possible options using #word[󱤇 anu], and then ask which option the listener agrees with. #quote[󱥴󱤇󱥢󱤧󱤘󱦜󱥙󱤧󱥔󱤼󱥩󱥞 \ waso anu soweli li ken · seme li pona mute tawa sina \ ~ do you like birds or cats more? \ ~ birds or cats are possible. which is really good to you?] another way to ask an either-or question with #word[󱤇 anu] is by adding #word[󱤇󱥙 anu seme] as the final option. #quote[󱤴󱤇󱥆󱤇󱥙󱤧󱤘󱥩󱤬󱥒󱥞 \ mi anu ona anu seme li ken tawa lon poka sina \ ~ can me or him walk beside you?] == exercises <questions12> #answers(<answers12>) === translate from toki pona to english + mi wile esun e kiwen + ijo li wile kama jo e ijo kepeken mani anu utala + sina ken utala e soweli mute anu soweli wawa · sina wile utala e seme === translate from english to toki pona + birds draw using rocks or tools + you can put this in the box of money or the box of food === read sitelen pona + 󱤴󱥷󱤂󱤆󱤉󱤿󱤍󱤴 + 󱥆󱤨󱤧󱥡󱤂󱤉󱤿󱤎 + 󱤴󱥷󱤻󱤇󱤶 #pagebreak() = lesson 13 - o! == vocab / 󱤐 jaki: disgusting, obscene, sickly, toxic, unclean, unsanitary / 󱥛 sijelo: body, shape, physical state, torso, substance, form / 󱤠 kute: ear, hearing organ; hear, listen, pay attention to / 󱤕 kalama: to produce sound; sound; singing, thundering, drumming, clapping, laughing, beeping / 󱤃 alasa: hunt, search, forage, attempt === particle / 󱥄 o: _particle:_ vocative, imperative, or optative == lesson #word[󱥄 o] has three different functions - commands, wishes/desires, and addressing people. === commands #word[󱥄 o] can be used before a predicate, with no subject, to express a command. #quote[󱥄󱤶󱥔 \ o moku pona \ ~ eat well! \ ~ have a nice meal!] === wishes and desires #word[󱥄 o] can replace #word[󱤧 li] to express a wish or desire. #quote[󱤑󱥄󱥔 \ jan o pona \ ~ people should be good] when used with #word[󱤴 mi] or #word[󱥞 sina], you still have to include #word[󱥄 o], even though you would omit #word[󱤧 li]. #quote[󱤴󱥄󱤢 \ mi o lape \ ~ i should sleep] #pagebreak() === addressing others you can put #word[󱥄 o] after a subject to address them. #quote[󱥴󱥄 \ waso o \ ~ hey bird!] #quote[󱥢󱦐󱥦󱤌󱤑󱤄󱤧󱤂󱦑󱥄󱦜󱥞󱥡󱤂󱥡󱥬󱦖󱥔 \ soweli Sijala o · sina sona ala sona toki pona? \ ~ tiara, do you know how to speak toki pona?] == exercises <questions13> #answers(<answers13>) === translate from toki pona to english + sijelo sina o kama pona + pona o tawa sina + mi alasa e wawa tan utala kama + o jaki ala === translate from english to toki pona + don't make a sound! + listen to me! + forget that! === read sitelen pona + 󱥄󱥬󱤉󱥷󱥞󱥩󱤴 + 󱤛󱥄󱥶󱥧󱥭󱥉 + 󱤱󱥄󱦜󱤴󱥷󱤉󱤲󱥩󱤋󱤥 #pagebreak() = lesson 14 - interjections == vocab / 󱤹 mu: animal noise or communication; non-speech vocalization / 󱥹 kin: indeed \ _particle:_ (after phrase or at sentence start) too, also, as well, additionally / 󱤢 lape: sleep, rest, break from an activity or work / 󱤭 luka: hand, arm, tactile limb, grasping limb / 󱥣 suli: big, heavy, large, long, tall, wide; important, relevant == lesson === interjections! interjections are sentence fragments which convey a meaning. any phrase can be used on its own as an interjection indicating the presence of said word. #quote[󱤍󱤀 \ ike a \ ~ (that's) really bad] #quote[󱥵󱤼 \ wawa mute \ ~ so powerful!] #quote[󱤐 \ jaki \ ~ gross!] commands with #word[󱥄 o] can often be turned into interjections with more-or-less identical meaning by removing the #word[󱥄 o]. #quote[󱤶󱥔 \ moku pona \ ~ eat well! \ ~ have a nice meal!] #quote[󱤖󱥔 \ kama pona \ ~ welcome] #pagebreak() == exercises <questions14> #answers(<answers14>) === translate from toki pona to english + ni li pona tawa mi kin + kin + soweli li mu lon lape ona + waso a + suwi === translate from english to toki pona + i pet my cat + i like to make things using my hands + sleep well! + i'm sorry to hear that === read sitelen pona + 󱤈 + 󱤴󱤘󱤂󱤠󱤉󱥞󱥧󱥈󱥍󱤎󱤕󱤴 + 󱥢󱤧󱤻󱤙󱥜 + 󱤋󱥔 #pagebreak() = lesson 15 - la == vocab / 󱥤 suno: light, shine, glow, radiance; sun, light source; brightness / 󱥎 pilin: emotion, feeling, opinion; heart / 󱥰 uta: mouth, throat, consuming orifice / 󱤜 ko: paste, powder, goo, sand, soil, clay; squishy, moldable / 󱥀 nena: protuberance; bump, button, hill, nose / 󱤝 kon: air, breath, wind; essence, spirit, soul, ghost; unseen agent === particle / 󱤡 la: _particle:_ between the context phrase/sentence and the main sentence == lesson === la the particle #word[󱤡 la] is used to establish context. whatever comes before #word[󱤡 la] is established as context for whatever comes after. #quote[A 󱤡 B \ A la B \ ~ if A, then B \ ~ in the context of A, B] things which can go after prepositions can often go before #word[󱤡 la] instead and express a similar, albeit much vaguer, meaning. #quote[󱤴󱥩󱥞󱤬󱥫󱤖 \ 󱥫󱤖󱤡󱤴󱥩󱥞 \ mi tawa sina lon tenpo kama \ tenpo kama la mi tawa sina \ ~ i go to you in the future] #quote[󱤴󱤘󱤂󱥩󱤉󱥭󱥧󱥵󱤴 \ (󱥧)󱥵󱤴󱤡󱤴󱤘󱤂󱥩󱤉󱥭 \ mi ken ala tawa e tomo tan wawa mi \ (tan) wawa mi la mi ken ala tawa e tomo \ ~ i can't move a house because of my strength] #pagebreak() === examples #quote[󱥞󱤢󱤡󱤴󱥹󱤧󱤢 \ sina lape la mi kin li lape \ ~ if you sleep, i'll sleep too] #quote[󱤴󱤡󱤄󱤧󱥔 \ mi la ale li pona \ ~ everything is good with me \ ~ in my opinion, everything's good] #quote[󱥫󱤬󱤡󱤌󱤼󱤧󱤖 \ tenpo lon la ijo mute li kama \ ~ right now, lots of people are coming] #quote[󱥎󱥞󱤡󱤴󱥦󱤂󱥦 \ pilin sina la mi suwi ala suwi \ ~ do you think i'm cute? \ ~ according to your feelings, am i cute?] #quote[󱥴󱤇󱥑󱤡󱥙󱤧󱥔󱤼 \ waso anu pipi la seme li pona mute \ ~ are bugs or birds better? \ ~ in the context of bugs or birds, which one is really good?] == exercises <questions15> #answers(<answers15>) === translate from toki pona to english + mi kama pipi la sina awen ala awen olin e mi + pilin sina la kon ni li seme + suno li lon sewi la mi sona e ni · pona li kama + mi tawa nena la pilin mi li pona === translate from english to toki pona + every day you kiss me is a good day + when i'm happy, i howl at the moon + i can't see you because you're small === read sitelen pona + 󱤴󱥌󱤉󱤜󱥩󱤗󱦜󱥁󱤧󱥵󱤉󱤗 + 󱥭󱥞󱤧󱥣󱤼󱤡󱤴󱥷󱤢󱤬󱥆 + 󱤴󱥷󱥬󱤀󱦜󱤹󱦜󱥁󱤧󱤄 + 󱥞󱥷󱥈󱤉󱤺󱤡󱥄󱥁 #pagebreak() = lesson 16 - colours == vocab / 󱤒 jelo: yellow, amber, golden, lime yellow, yellowish orange / 󱤣 laso: turquoise, blue, green, cyan, indigo, lime green / 󱤫 loje: red, magenta, scarlet, pink, rust-colored, reddish orange / 󱥏 pimeja: dark, unlit; black, purple, brown / 󱥲 walo: light-colored, white, pale, light gray, cream == lesson === colours there's not really much special to say about colours. i just thought it'd be a nice break from grammar. === examples #quote[󱥢󱤒󱥏 \ soweli jelo pimeja \ ~ black and yellow dog] #quote[󱥢󱥍󱦗󱤒󱥏󱦘 \ soweli pi jelo pimeja \ ~ dark-yellow dog] == exercises <questions16> #answers(<answers16>) === translate from toki pona to english + mi loje e tomo · mi la loje li kule wawa a + kule la seme li pona mute tawa sina + sewi li kama pimeja === translate from english to toki pona + the bees are on the flowers + the ocean is green + what colour is your house? + the sun is not yellow === read sitelen pona + 󱥄󱤫󱤉󱤰 + 󱤴󱥷󱤉󱤥󱥏󱥲 + 󱤑󱤻󱤧󱤞󱤉󱥟󱥆󱦜󱤴󱥡󱤂󱤉󱥧 + 󱤔󱤡󱤣󱤧󱥔 #pagebreak() = lesson 17 - taso == vocab / 󱥨 taso: only, exclusively \ _particle:_ marks a sentence as qualifying or contradictory; but, however / 󱥳 wan: singular, united; combine, join, mix, fuse / 󱥮 tu: separate, divide, split / 󱥕 pu: to interact with the book Toki Pona: The Language of Good by Sonja Lang / 󱥘 selo: outer layer; skin, peel, shell, bark; boundary, outer shape / 󱥋 pan: grains, starchy foods, baked goods; rice, sorghum, bread, noodles, masa, porridge, injera == lesson === taso #word[󱥨 taso] can be used at the start of a sentence to mean "however," #quote[󱤴󱤡󱤴󱥉󱥔󱦜󱥨󱤑󱤆󱤡󱤴󱥉󱤍 \ mi la mi pali pona · taso jan ante la mi pali ike \ ~ i think i work well. however, other people think i work poorly] you can also use #word[󱥨 taso] as a regular word. #quote[󱤴󱥷󱤉󱤲󱥨 \ mi wile e mani taso \ ~ i want only money] #quote[󱥆󱤧󱥨 \ ona li taso \ ~ they are alone] #pagebreak() == exercises <questions17> #answers(<answers17>) === translate from toki pona to english + tenpo pini la ma li wan · taso ike la ona li kama tu + suno li kama weka · tenpo ni taso la mi wile esun e pan sina + nasin sina li pakala e ale a + mi ken ala toki tawa ijo ike · taso sina pona la mi ken toki + mi wile tu e pan ni la mi o seme === translate from english to toki pona + i only want to read the official toki pona book + if you wanna meow at the moon during bad times, i'll meow right beside you + my parents are very nice, but i didn't like when they got me uncool clothes + i feel like you underestimate your strength === read sitelen pona + 󱤴󱥔󱤉󱥘󱤴󱤙󱤜 + 󱥞󱥨󱤧󱥷󱤂󱥕󱤬󱤺 + 󱤴󱥷󱤂󱥩󱥀󱥧󱥁󱦜󱥤󱤧󱥶 + 󱥞󱥨󱤧󱤘󱥳󱤉󱥑 #pagebreak() = lesson 18 - one, two, many == vocab / 󱤽 nanpa: number \ _particle:_ ordinal number / 󱤯 lupa: hole, pit, cave, doorway, window, portal / 󱤩 linja: long and flexible thing; rope, yarn, hair, fur, line, strand / 󱤁 akesi: reptile, amphibian, scaly creature, crawling creature == lesson === main counting system toki pona has five words to describe amounts: \ / 󱤂 ala: nothing / 󱥳 wan: one / 󱥮 tu: two / 󱤼 mute: many / 󱤄 ale: everything other number systems exist, but this one will usually be all you need. often specific numbers end up obscuring what a quantity really means, because large numbers are a lot harder to conceptualize than a description of what this quantity really means. #quote[󱥆󱤧󱤓󱤉󱤎󱥩󱤼󱤀 \ ona li jo e ilo tawa mute a \ ~ they have 28 cars!] for some reason we care about the number in english, but does it matter? the interesting bit is that this is _a lot_ of cars! === ordinal numbers you can use the particle #word[󱤽 nanpa] before a number to express an ordinal number. #quote[󱥢󱤽󱥮 \ soweli nanpa tu \ ~ the second animal] #pagebreak() === a more advanced counting system be aware that this counting system isn't intended to be used very much. in most cases, vague amounts will also get the message across. this counting system uses 5 words: \ / 󱥳 wan: one / 󱥮 tu: two / 󱤭 luka: five / 󱤼 mute: twenty / 󱤄 ale: one hundred this system is additive, meaning you chain together the words to create bigger numbers #quote[󱤭󱤭󱥮 \ luka luka tu \ ~ five + five + two \ ~ 12] #quote[󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤄󱤼󱥮 \ ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale ale mute tu \ ~ 2022] as you can see, it's still not very convenient for big numbers - this is by design! == exercises <questions18> #answers(<answers18>) === translate from toki pona to english + sina wile tawa tomo telo la o tawa lupa nanpa tu + waso tu li tawa tomo moku + mi kama sona e nimi mute pi toki pona + mi pini e pali mi la mi ken musi === translate from english to toki pona + snakes are cute! + aw man, my calculator broke + there are two shady people by your home + this is your first woof === read sitelen pona + 󱤴󱥷󱤉󱥢󱥮 + 󱤁󱤧󱥩󱤬󱤩󱦜󱥆󱤧󱥵󱤼󱤀 + 󱤴󱥄󱥉󱤉󱤯󱤼󱥧󱤑󱤍 #pagebreak() = lesson 19 - and... == vocab / 󱥇 open: begin, start, open, turn on; beginning / 󱥊 palisa: long and hard thing; branch, pole, rod, stick, spine, mast / 󱥯 unpa: sex, to have sex with / 󱥃 noka: foot, leg, organ of locomotion, roots / 󱤚 kili: fruit, vegetable, seed, mushroom / 󱤊 en: _particle:_ between additional subjects == lesson === how to say and to say and, you repeat the particle. for additional subjects you use the particle #word[󱤊 en]. this means you repeat #word[󱤊 en] for subjects, #word[󱤧 li] for predicates, #word[󱤉 e] for direct objects, and repeat the preposition for multiple prepositional phrases. #quote[subject 󱤊 subject 󱤧 predicate 󱤧 predicate 󱤉 object 󱤉 object preposition phrase prepositian phrase \ subject en subject li predicate li predicate e object e object preposition phrase preposition phrase] === examples #quote[󱤑󱤊󱥢󱤧󱥩󱤧󱥉󱤙󱥃󱤙󱤎 \ jan en soweli li tawa li pali kepeken noka kepeken ilo \ ~ the person and the dog are walking and working using legs and tools] #quote[󱤴󱤊󱥞󱥄󱥩󱥵󱥄󱥉󱥵󱤀 \ mi en sina o tawa wawa o pali wawa a \ ~ me and you have to move quickly and work hard!] #pagebreak() == exercises <questions19> #answers(<answers19>) === translate from toki pona to english + mi en sina li ken ale + ona li tawa suli kepeken noka + ona li wawa mute li suli mute + waso o · o pana e palisa ni tawa mi + a kon li lete mute === translate from english to toki pona + this community does not need a leader + what are you and lisa up to? + what's the meaning of this word? + hold on. is this almost the end of the course? === read sitelen pona + 󱥞󱥷󱥇󱤉󱤎󱥞󱤡󱥄󱤭󱤉󱥀󱥆 + 󱤚󱤄󱤊󱤗󱤄󱤧󱤖󱤣 + 󱥟󱥆󱤧󱤾󱥩󱤮󱥑󱥩󱤮󱤁 + 󱥄󱤈󱦜󱥐󱥍󱤪󱥡󱥁󱤧󱤖󱤇󱥙 #pagebreak() = lesson 20 - you're done! == vocab no more vocab, you're done! 󱥁󱤧󱥐󱥍󱤪󱥡󱤡󱥂󱦖󱥝󱤧󱤬󱤂 \ ni li pini pi lipu sona la nimi sin li lon ala == lesson === tips - it's important to make an effort to understand toki pona's philosophy. \ this will make it easier to understand why it works the way it does, which will make it a lot easier to express yourself and have fun with the language! - practice, talk to people, have fun! - i highly recommend checking out #link("https://github.com/kilipan/nasin-toki")[nasin toki pona] by <NAME>! it's a really good grammar reference, which can be useful whenever there's something you'd like a quick refresher on, or something you'd like more in-depth knowledge of. it does a really good job of explaining all of toki pona's grammar! - look at #link("https://linku.la/")[lipu Linku] whenever you need to remember what a word means! it's the best toki pona dictionary out there - #link("https://sona.pona.la/")[sona.pona.la] is a wiki thats full of useful information about toki pona! - now its time to practice! #link("https://sona.pona.la/wiki/Communities")[use the language with others], listen to #link("https://sona.pona.la/wiki/Music")[music], #link("https://sona.pona.la/wiki/Podcasts")[podcasts], #link("https://sona.pona.la/wiki/Books")[read stories], or #link("https://sona.pona.la/wiki/Usages")[check out other media made in toki pona]! sina kama sona e toki pona e nimi ale pi toki pona · ni li open pi tenpo sin · o suli e sona sina · o musi · o pona #pagebreak() = answers == lesson 1 <answers1> #questions(<questions1>) === toki pona to english + i'm cute + you're good + hello! i'm new === english to toki pona + mi toki + mi sina === read sitelen pona + sina toki \ you're talking + mi pona \ i'm nice == lesson 2 <answers2> #questions(<questions2>) === translate from toki pona to english + they're a bird + someone is playing + people are playing === translate from english to toki pona + ike li ike + suwi li pona + ijo li ike + musi li pona === read sitelen pona + ike li musi \ being bad is fun + ona li soweli \ they're a dog + waso li sin \ the bird is new == lesson 3 <answers3> #questions(<questions3>) === translate from toki pona to english + many possibilities + the strong animal is not small + they're a bad person + i don't like when you're away \ your absence is bad + this is not good === translate from english to toki pona + soweli lili li suwi mute + waso li ken + jan lili li weka + wawa mi li pona lili + jan mute li toki pona + jan lili weka li musi pona === read sitelen pona + sina soweli lili \ you're a tiny animal + waso li ni ala \ the bird isn't doing that + jan weka li wawa mute \ the people who left are really powerful + toki sin li ken \ a new speech is possible + waso mute li musi \ lots of birds are having fun == lesson 4 <answers4> #questions(<questions4>) === translate from toki pona to english + i love you + colourful drinks are tasty + an evil person is staring at my food + it's very colourful + many workers painted the restaurant + i eat your new food === translate from english to toki pona + mi lukin e suwi sina \ mi lukin e ni · sina suwi + soweli li moku + mi musi e jan pali + tomo moku ni li pona + olin mi li pona e mi + mi ken e ni · sina moku e moku mi === read sitelen pona + mi pali e kule mute \ i make a lot of paint + lukin sina li wawa \ your eyes are intense + soweli ona li moku e jan sin \ their pet is eating the new guy + mi olin e soweli suwi \ i love the cute animal + lili ona li musi \ it's funny how small they are == lesson 5 <answers5> #questions(<questions5>) === translate from toki pona to english + we can stay strong + their absence empowers the people + tools can't kill animals + the person brings food + the bat is making a phone (communication device) + people make me want to remain an animal + i wish that you see good bugs === translate from english to toki pona + mi wile kama sona toki pona + mi ken ala lukin e ni + mi awen e sina + mi lukin e ni · sina pona e tomo mi + ilo ni li wawa e pipi + mi lukin lukin e ilo lukin mi === read sitelen pona + mi lukin pali e ilo pona \ i try to build good tools + waso li awen lukin e sina \ the bird keeps looking at you + ona li wile moku e pipi \ they wanna eat bugs + jan li kama sona toki pona \ people come to know how to speak well \ people learn to speak toki pona + waso li sona waso \ birds know how to be birds + soweli li ken moku e sina \ animals can eat you == lesson 6 <answers6> #questions(<questions6>) === translate from toki pona to english + seaweed is edible + the animal is handing out documents with lots of knowledge + the marine biologist knows that fish can eat people + they're a really cute bat + everyone is turning into fish + a good amount of new people are arriving === translate from english to toki pona + mi lukin e lipu pi sona ike + pipi li pali e tomo pi lipu pipi + jan pona mi li pana e lipu pali · ona li sona pali e tomo + weka pi olin mi li ike e ale + ijo pi weka mute li lukin moku e kala mi === read sitelen pona + kala li wile lukin e kasi pi lipu sina \ the fish wants to see the flowers in your book + mi wile weka e pipi ale \ i want to get rid of all bugs + kasi li pana e wawa \ plants give strength + soweli lili li ken wawa \ small animals can be strong + pini pi lipu sina li ike \ the ending of your book could use some work \ the end of your book is bad == lesson 7 <answers7> #questions(<questions7>) === translate from toki pona to english + i'm trying to give you a flower + people remember how good you are because you keep reminding them + i wanna know the reasons + a lot of people need a car because their place of work is far away + the document of wishes is at your place \ the necessary papers are in your room === translate from english to toki pona + mi lukin e ijo · ona li sama sina tawa lukin + ona li wile pana e mani tawa sina + tomo ni li wile e kasi pi kule mute + ijo li pali tan ike + waso li ken kama sona e ijo mute kepeken lipu === read sitelen pona + wile pi waso ike li ni · sina pana e mani ale sina tawa ona \ the villainous bird's demand is that you give it all your money + ona li wile ala pana e ilo ona tawa sina \ they don't want to lend you their tool + wawa mi li tan olin sina \ my confidence comes from your love + lukin sina li sama lukin pipi \ you eyes look similar to a bug's eyes + mi wile e mani tan toki pona mi \ i want to be compensated for the great speech i gave == lesson 8 <answers8> #questions(<questions8>) === translate from toki pona to english + the confident animal has become defeated + lots of plants are behind my house + i can go to you soon + i wanna be close to you because i love you + the document will always exist === translate from english to toki pona + ijo li lon anpa pi mani ni + sinpin sina li sewi + ike li kama lon ni lon tenpo pini + pipi li toki lon tomo toki + kala li wile tawa sewi lon tenpo pini · ona li wile ni ala lon tenpo lon === read sitelen pona + mi ken ala lon poka sina tan weka sina \ i can't be at your side because you're far away + ijo li tawa tomo sewi tan ni · ona li wile kama pona · ona li wile kama wawa \ someone goes to the holy building because they want to improve and become strong + sina musi e mi lon tenpo pini \ you were funny to me in the past + soweli li lon monsi sina \ the animal is behind you \ there's a creature on your back == lesson 9 <answers9> #questions(<questions9>) === translate from toki pona to english + i know how to speak a language called Nosiki (norwegian) + i wanna go to your country + i need a lot of clothes because the country called Kanata (canada) is really cold! + i forgot your name recently + (a flying animal named) lisa wants to finish working === translate from english to toki pona + soweli Tesa li pana e sona pi toki pona tawa olin ona + pipi ni li tawa ni tan ma Nosiki + mama mi li wawa mute · mama sina li wawa lili + nimi sina li pona === read sitelen pona + waso Ipa li wile pana e sina tawa telo \ a bird named Ipa wants to throw you in the ocean + ijo lili ale li ken wawa \ all small things can be strong + mama Lepa li wile e len seli tan tawa pi tenpo kama \ the parent named Lepa wants warm clothes for a future walk + mi wile sona e nimi pona ale \ i want to know every good word == lesson 10 <answers10> #questions(<questions10>) === translate from toki pona to english + my head is warm + the government of the US is bad + hahaha your jokes are funny + everything gets strange sometimes === translate from english to toki pona + a mi sona ala e ni + kulupu ni li pona mute a + sina pona a + a ijo mute pi sona mute li lon kulupu ni === read sitelen pona + kulupu pona li wile e nasa \ good communities need strangeness + a waso mute li tawa lon sewi · ni li pona mute \ whoa there's lots of birds flying in the sky! that's really cool + kulupu li weka e ijo ike \ the community removes the bad stuff + mi lete e moku sina \ i'm making your food colder == lesson 11 <answers11> #questions(<questions11>) === translate from toki pona to english + i acquired lots of food with money \ i bought a lot of food + why are you talking to the moon? + do you have cute pictures? + who knows how to speak well? + many change their names because of toki pona === translate from english to toki pona + seme li lon \ sina seme \ seme li kama + seme li lon sewi \ sewi li seme + mi wile lon supa lape + sina wile toki e seme === read sitelen pona + sina pakala e supa tan seme \ why did you break the table?! + mi wile kepeken pipi tawa pali mi \ i want to use bugs for my work + ma ni li lete seme \ how cold is that place? + sina kama sona sitelen pona tan seme \ why did you learn sitelen pona? \ where did you learn to write well from? == lesson 12 <answers12> #questions(<questions12>) === translate from toki pona to english + i want to buy rocks \ i want to sell rocks + people need to obtain things using money or violence + do you want to fight a lot of animals or a strong animal \ you can fight many animals or a strong animal. which do you want to fight? === translate from english to toki pona + waso li sitelen kepeken kiwen anu ilo + sina ken pana e ni tawa poki mani anu poki moku === read sitelen pona + mi wile ala ante e nasin ike mi \ i don't want to change my evil ways + ona lili li sona ala e nasin ilo \ the small ones don't know proper lawnmower etiquette + mi wile musi anu moku \ i either want to play or eat == lesson 13 <answers13> #questions(<questions13>) === translate from toki pona to english + get well \ your body should become good + may good come to you + i'm seeking power because of the coming fight + don't be gross! === translate from english to toki pona + o kalama ala + o kute e mi + o weka e sona ni === read sitelen pona + o toki e wile sina tawa mi \ tell me your desires + kiwen o weka tan tomo pali \ the boulder should be gone from the workplace + mama o · mi wile e mani tawa esun len \ dad, i need money for clothes shopping == lesson 14 <answers14> #questions(<questions14>) === translate from toki pona to english + i like this too + indeed + the dog snores in its sleep + birds! + cute === translate from english to toki pona + mi luka e soweli mi + mi pali e ijo kepeken luka mi · ni li pona tawa mi + (o) lape pona + ike a === read sitelen pona + awen \ remain as you were + mi ken ala kute e sina tan pakala pi ilo kalama mi \ i can't hear you because my headphones are broken + soweli li musi kepeken sike \ the dog is playing with a ball + esun pona \ have a nice transaction == lesson 15 <answers15> #questions(<questions15>) === translate from toki pona to english + would you still love me if i became a bug? + what do you think the meaning of this is? \ what do you think this smell is? + when the sun is in the sky, i know that good is coming + when i go to the mountains, i feel good === translate from english to toki pona + sina uta e mi la tenpo suno ni li pona + pilin mi li pona la mi mu tawa mun + sina lili la mi ken ala lukin e sina \ mi ken ala lukin e sina tan lili sina === read sitelen pona + mi pana e ko tawa kasi · ni li wawa e kasi \ i give some fertilizer to the plants. this makes the plant stronger. + tomo sina li suli mute la mi wile lape lon ona \ your home is huge, so i wanna sleep there + mi wile toki a · mu · ni li ale \ i wanna say something. meow! thats all. + sina wile pakala e mun la o ni \ if you want to destroy the moon, do it! == lesson 16 <answers16> #questions(<questions16>) === translate from toki pona to english + i paint the house pink. i think it's a vibrant colour \ (could also be any other reddish colour but i translated with pink cuz thats a nice colour) + what's your favourite colour? + the sky is getting dark === translate from english to toki pona + pipi li lon kasi \ pipi jelo pimeja li lon kasi + telo suli li laso + tomo sina li kule seme + kule seme li lon tomo sina + suno li jelo ala === sitelen pona + o loje e ma \ paint the world red + mi wile e len pimeja walo \ i want black and white clothes + jan musi li kule e sinpin ona · mi sona ala e tan \ clowns paint their faces. i don't know why + kala la laso li pona \ fish like blue == lesson 17 <answers17> #questions(<questions17>) === translate from toki pona to english + in the past, the country was united. however, unfortunately it became divided + i only want to buy your bread in the evening + your methods are ruining everything! + i can't talk to bad people. but you're good, so we can talk + what should i do to split this bread? === translate from english to toki pona + mi wile pu taso + sina wile mu tawa mun lon tenpo ike la mi mu lon poka sina + mama mi li pona · taso ona li pana e len pi pona ala tawa mi la ni li ike + pilin mi la sina lili e wawa sina === read sitelen pona + mi pona e selo mi kepeken ko \ i take care of my skin using lotion + sina taso li wile ala pu lon mun \ you're the only one who doesn't want to interact with Toki Pona: The Language of Good by Sonja Lang on the moon + mi wile ala tawa nena tan ni · suno li weka \ i don't want to go to the mountains because the sun is gone + sina taso li ken wan e pipi \ only you can unite the bugs == lesson 18 <answers18> #questions(<questions18>) === translate from toki pona to english + if you wanna go to the bathroom, go to the second door + two bats are going to a restaurant + i'm learning a lot of toki pona words + when i'm done with my work, i can have fun === translate from english to toki pona + akesi li suwi a + ike a · ilo nanpa mi li pakala \ a · ilo mi li pakala + jan ike tu li lon poka pi tomo sina + ni li mu sina nanpa wan === read sitelen pona + mi wile e soweli tu \ i want two ferrets + akesi li tawa lon linja · ona li wawa mute a \ the crocodile is walking on a tightrope. it's really confident! + mi o pali e lupa mute tan jan ike \ i have to dig a lot of holes because of an evil guy == lesson 19 <answers19> #questions(<questions19>) === translate from toki pona to english + me and you can do anything + they are going far with their legs + they are very strong and tall + hey bird, give me that stick + oh the wind is cold === translate from english to toki pona + kulupu ni li wile e lawa ala + sina en waso Lisa li seme + kon pi nimi ni li seme + o awen · pini pi lipu sona ni li kama anu seme === read sitelen pona + sina wile open e ilo sina la o luka e nena ona \ to turn on your device, push its button + kili ale en kasi ale li kama laso \ all the fruits and plants turned green + sinpin ona li nasa tawa lukin pipi tawa lukin akesi \ their face looks weird to bugs and lizards + o awen · pini pi lipu sona li kama anu seme \ hold on. is this almost the end of the course?
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/059.%20startuplessons.html.typ
typst
startuplessons.html The Hardest Lessons for Startups to Learn April 2006(This essay is derived from a talk at the 2006 Startup School.)The startups we've funded so far are pretty quick, but they seem quicker to learn some lessons than others. I think it's because some things about startups are kind of counterintuitive.We've now invested in enough companies that I've learned a trick for determining which points are the counterintuitive ones: they're the ones I have to keep repeating.So I'm going to number these points, and maybe with future startups I'll be able to pull off a form of Huffman coding. I'll make them all read this, and then instead of nagging them in detail, I'll just be able to say: number four! 1. Release Early.The thing I probably repeat most is this recipe for a startup: get a version 1 out fast, then improve it based on users' reactions.By "release early" I don't mean you should release something full of bugs, but that you should release something minimal. Users hate bugs, but they don't seem to mind a minimal version 1, if there's more coming soon.There are several reasons it pays to get version 1 done fast. One is that this is simply the right way to write software, whether for a startup or not. I've been repeating that since 1993, and I haven't seen much since to contradict it. I've seen a lot of startups die because they were too slow to release stuff, and none because they were too quick. [1]One of the things that will surprise you if you build something popular is that you won't know your users. Reddit now has almost half a million unique visitors a month. Who are all those people? They have no idea. No web startup does. And since you don't know your users, it's dangerous to guess what they'll like. Better to release something and let them tell you.Wufoo took this to heart and released their form-builder before the underlying database. You can't even drive the thing yet, but 83,000 people came to sit in the driver's seat and hold the steering wheel. And Wufoo got valuable feedback from it: Linux users complained they used too much Flash, so they rewrote their software not to. If they'd waited to release everything at once, they wouldn't have discovered this problem till it was more deeply wired in.Even if you had no users, it would still be important to release quickly, because for a startup the initial release acts as a shakedown cruise. If anything major is broken-- if the idea's no good, for example, or the founders hate one another-- the stress of getting that first version out will expose it. And if you have such problems you want to find them early.Perhaps the most important reason to release early, though, is that it makes you work harder. When you're working on something that isn't released, problems are intriguing. In something that's out there, problems are alarming. There is a lot more urgency once you release. And I think that's precisely why people put it off. They know they'll have to work a lot harder once they do. [2] 2. Keep Pumping Out Features.Of course, "release early" has a second component, without which it would be bad advice. If you're going to start with something that doesn't do much, you better improve it fast.What I find myself repeating is "pump out features." And this rule isn't just for the initial stages. This is something all startups should do for as long as they want to be considered startups.I don't mean, of course, that you should make your application ever more complex. By "feature" I mean one unit of hacking-- one quantum of making users' lives better.As with exercise, improvements beget improvements. If you run every day, you'll probably feel like running tomorrow. But if you skip running for a couple weeks, it will be an effort to drag yourself out. So it is with hacking: the more ideas you implement, the more ideas you'll have. You should make your system better at least in some small way every day or two.This is not just a good way to get development done; it is also a form of marketing. Users love a site that's constantly improving. In fact, users expect a site to improve. Imagine if you visited a site that seemed very good, and then returned two months later and not one thing had changed. Wouldn't it start to seem lame? [3]They'll like you even better when you improve in response to their comments, because customers are used to companies ignoring them. If you're the rare exception-- a company that actually listens-- you'll generate fanatical loyalty. You won't need to advertise, because your users will do it for you.This seems obvious too, so why do I have to keep repeating it? I think the problem here is that people get used to how things are. Once a product gets past the stage where it has glaring flaws, you start to get used to it, and gradually whatever features it happens to have become its identity. For example, I doubt many people at Yahoo (or Google for that matter) realized how much better web mail could be till <NAME> showed them.I think the solution is to assume that anything you've made is far short of what it could be. Force yourself, as a sort of intellectual exercise, to keep thinking of improvements. Ok, sure, what you have is perfect. But if you had to change something, what would it be?If your product seems finished, there are two possible explanations: (a) it is finished, or (b) you lack imagination. Experience suggests (b) is a thousand times more likely. 3. Make Users Happy.Improving constantly is an instance of a more general rule: make users happy. One thing all startups have in common is that they can't force anyone to do anything. They can't force anyone to use their software, and they can't force anyone to do deals with them. A startup has to sing for its supper. That's why the successful ones make great things. They have to, or die.When you're running a startup you feel like a little bit of debris blown about by powerful winds. The most powerful wind is users. They can either catch you and loft you up into the sky, as they did with Google, or leave you flat on the pavement, as they do with most startups. Users are a fickle wind, but more powerful than any other. If they take you up, no competitor can keep you down.As a little piece of debris, the rational thing for you to do is not to lie flat, but to curl yourself into a shape the wind will catch.I like the wind metaphor because it reminds you how impersonal the stream of traffic is. The vast majority of people who visit your site will be casual visitors. It's them you have to design your site for. The people who really care will find what they want by themselves.The median visitor will arrive with their finger poised on the Back button. Think about your own experience: most links you follow lead to something lame. Anyone who has used the web for more than a couple weeks has been trained to click on Back after following a link. So your site has to say "Wait! Don't click on Back. This site isn't lame. Look at this, for example."There are two things you have to do to make people pause. The most important is to explain, as concisely as possible, what the hell your site is about. How often have you visited a site that seemed to assume you already knew what they did? For example, the corporate site that says the company makes enterprise content management solutions for business that enable organizations to unify people, content and processes to minimize business risk, accelerate time-to-value and sustain lower total cost of ownership. An established company may get away with such an opaque description, but no startup can. A startup should be able to explain in one or two sentences exactly what it does. [4] And not just to users. You need this for everyone: investors, acquirers, partners, reporters, potential employees, and even current employees. You probably shouldn't even start a company to do something that can't be described compellingly in one or two sentences.The other thing I repeat is to give people everything you've got, right away. If you have something impressive, try to put it on the front page, because that's the only one most visitors will see. Though indeed there's a paradox here: the more you push the good stuff toward the front, the more likely visitors are to explore further. [5]In the best case these two suggestions get combined: you tell visitors what your site is about by showing them. One of the standard pieces of advice in fiction writing is "show, don't tell." Don't say that a character's angry; have him grind his teeth, or break his pencil in half. Nothing will explain what your site does so well as using it.The industry term here is "conversion." The job of your site is to convert casual visitors into users-- whatever your definition of a user is. You can measure this in your growth rate. Either your site is catching on, or it isn't, and you must know which. If you have decent growth, you'll win in the end, no matter how obscure you are now. And if you don't, you need to fix something. 4. Fear the Right Things.Another thing I find myself saying a lot is "don't worry." Actually, it's more often "don't worry about this; worry about that instead." Startups are right to be paranoid, but they sometimes fear the wrong things.Most visible disasters are not so alarming as they seem. Disasters are normal in a startup: a founder quits, you discover a patent that covers what you're doing, your servers keep crashing, you run into an insoluble technical problem, you have to change your name, a deal falls through-- these are all par for the course. They won't kill you unless you let them.Nor will most competitors. A lot of startups worry "what if Google builds something like us?" Actually big companies are not the ones you have to worry about-- not even Google. The people at Google are smart, but no smarter than you; they're not as motivated, because Google is not going to go out of business if this one product fails; and even at Google they have a lot of bureaucracy to slow them down.What you should fear, as a startup, is not the established players, but other startups you don't know exist yet. They're way more dangerous than Google because, like you, they're cornered animals.Looking just at existing competitors can give you a false sense of security. You should compete against what someone else could be doing, not just what you can see people doing. A corollary is that you shouldn't relax just because you have no visible competitors yet. No matter what your idea, there's someone else out there working on the same thing.That's the downside of it being easier to start a startup: more people are doing it. But I disagree with Caterina Fake when she says that makes this a bad time to start a startup. More people are starting startups, but not as many more as could. Most college graduates still think they have to get a job. The average person can't ignore something that's been beaten into their head since they were three just because serving web pages recently got a lot cheaper.And in any case, competitors are not the biggest threat. Way more startups hose themselves than get crushed by competitors. There are a lot of ways to do it, but the three main ones are internal disputes, inertia, and ignoring users. Each is, by itself, enough to kill you. But if I had to pick the worst, it would be ignoring users. If you want a recipe for a startup that's going to die, here it is: a couple of founders who have some great idea they know everyone is going to love, and that's what they're going to build, no matter what.Almost everyone's initial plan is broken. If companies stuck to their initial plans, Microsoft would be selling programming languages, and Apple would be selling printed circuit boards. In both cases their customers told them what their business should be-- and they were smart enough to listen.As <NAME> said, the imagination of nature is greater than the imagination of man. You'll find more interesting things by looking at the world than you could ever produce just by thinking. This principle is very powerful. It's why the best abstract painting still falls short of Leonardo, for example. And it applies to startups too. No idea for a product could ever be so clever as the ones you can discover by smashing a beam of prototypes into a beam of users. 5. Commitment Is a Self-Fulfilling Prophecy.I now have enough experience with startups to be able to say what the most important quality is in a startup founder, and it's not what you might think. The most important quality in a startup founder is determination. Not intelligence-- determination.This is a little depressing. I'd like to believe Viaweb succeeded because we were smart, not merely determined. A lot of people in the startup world want to believe that. Not just founders, but investors too. They like the idea of inhabiting a world ruled by intelligence. And you can tell they really believe this, because it affects their investment decisions.Time after time VCs invest in startups founded by eminent professors. This may work in biotech, where a lot of startups simply commercialize existing research, but in software you want to invest in students, not professors. Microsoft, Yahoo, and Google were all founded by people who dropped out of school to do it. What students lack in experience they more than make up in dedication.Of course, if you want to get rich, it's not enough merely to be determined. You have to be smart too, right? I'd like to think so, but I've had an experience that convinced me otherwise: I spent several years living in New York.You can lose quite a lot in the brains department and it won't kill you. But lose even a little bit in the commitment department, and that will kill you very rapidly.Running a startup is like walking on your hands: it's possible, but it requires extraordinary effort. If an ordinary employee were asked to do the things a startup founder has to, he'd be very indignant. Imagine if you were hired at some big company, and in addition to writing software ten times faster than you'd ever had to before, they expected you to answer support calls, administer the servers, design the web site, cold-call customers, find the company office space, and go out and get everyone lunch.And to do all this not in the calm, womb-like atmosphere of a big company, but against a backdrop of constant disasters. That's the part that really demands determination. In a startup, there's always some disaster happening. So if you're the least bit inclined to find an excuse to quit, there's always one right there.But if you lack commitment, chances are it will have been hurting you long before you actually quit. Everyone who deals with startups knows how important commitment is, so if they sense you're ambivalent, they won't give you much attention. If you lack commitment, you'll just find that for some mysterious reason good things happen to your competitors but not to you. If you lack commitment, it will seem to you that you're unlucky.Whereas if you're determined to stick around, people will pay attention to you, because odds are they'll have to deal with you later. You're a local, not just a tourist, so everyone has to come to terms with you.At Y Combinator we sometimes mistakenly fund teams who have the attitude that they're going to give this startup thing a shot for three months, and if something great happens, they'll stick with it-- "something great" meaning either that someone wants to buy them or invest millions of dollars in them. But if this is your attitude, "something great" is very unlikely to happen to you, because both acquirers and investors judge you by your level of commitment.If an acquirer thinks you're going to stick around no matter what, they'll be more likely to buy you, because if they don't and you stick around, you'll probably grow, your price will go up, and they'll be left wishing they'd bought you earlier. Ditto for investors. What really motivates investors, even big VCs, is not the hope of good returns, but the fear of missing out. [6] So if you make it clear you're going to succeed no matter what, and the only reason you need them is to make it happen a little faster, you're much more likely to get money.You can't fake this. The only way to convince everyone that you're ready to fight to the death is actually to be ready to.You have to be the right kind of determined, though. I carefully chose the word determined rather than stubborn, because stubbornness is a disastrous quality in a startup. You have to be determined, but flexible, like a running back. A successful running back doesn't just put his head down and try to run through people. He improvises: if someone appears in front of him, he runs around them; if someone tries to grab him, he spins out of their grip; he'll even run in the wrong direction briefly if that will help. The one thing he'll never do is stand still. [7] 6. There Is Always Room.I was talking recently to a startup founder about whether it might be good to add a social component to their software. He said he didn't think so, because the whole social thing was tapped out. Really? So in a hundred years the only social networking sites will be the Facebook, MySpace, Flickr, and Del.icio.us? Not likely.There is always room for new stuff. At every point in history, even the darkest bits of the dark ages, people were discovering things that made everyone say "why didn't anyone think of that before?" We know this continued to be true up till 2004, when the Facebook was founded-- though strictly speaking someone else did think of that.The reason we don't see the opportunities all around us is that we adjust to however things are, and assume that's how things have to be. For example, it would seem crazy to most people to try to make a better search engine than Google. Surely that field, at least, is tapped out. Really? In a hundred years-- or even twenty-- are people still going to search for information using something like the current Google? Even Google probably doesn't think that.In particular, I don't think there's any limit to the number of startups. Sometimes you hear people saying "All these guys starting startups now are going to be disappointed. How many little startups are Google and Yahoo going to buy, after all?" That sounds cleverly skeptical, but I can prove it's mistaken. No one proposes that there's some limit to the number of people who can be employed in an economy consisting of big, slow-moving companies with a couple thousand people each. Why should there be any limit to the number who could be employed by small, fast-moving companies with ten each? It seems to me the only limit would be the number of people who want to work that hard.The limit on the number of startups is not the number that can get acquired by Google and Yahoo-- though it seems even that should be unlimited, if the startups were actually worth buying-- but the amount of wealth that can be created. And I don't think there's any limit on that, except cosmological ones.So for all practical purposes, there is no limit to the number of startups. Startups make wealth, which means they make things people want, and if there's a limit on the number of things people want, we are nowhere near it. I still don't even have a flying car. 7. Don't Get Your Hopes Up.This is another one I've been repeating since long before Y Combinator. It was practically the corporate motto at Viaweb.Startup founders are naturally optimistic. They wouldn't do it otherwise. But you should treat your optimism the way you'd treat the core of a nuclear reactor: as a source of power that's also very dangerous. You have to build a shield around it, or it will fry you.The shielding of a reactor is not uniform; the reactor would be useless if it were. It's pierced in a few places to let pipes in. An optimism shield has to be pierced too. I think the place to draw the line is between what you expect of yourself, and what you expect of other people. It's ok to be optimistic about what you can do, but assume the worst about machines and other people.This is particularly necessary in a startup, because you tend to be pushing the limits of whatever you're doing. So things don't happen in the smooth, predictable way they do in the rest of the world. Things change suddenly, and usually for the worse.Shielding your optimism is nowhere more important than with deals. If your startup is doing a deal, just assume it's not going to happen. The VCs who say they're going to invest in you aren't. The company that says they're going to buy you isn't. The big customer who wants to use your system in their whole company won't. Then if things work out you can be pleasantly surprised.The reason I warn startups not to get their hopes up is not to save them from being disappointed when things fall through. It's for a more practical reason: to prevent them from leaning their company against something that's going to fall over, taking them with it.For example, if someone says they want to invest in you, there's a natural tendency to stop looking for other investors. That's why people proposing deals seem so positive: they want you to stop looking. And you want to stop too, because doing deals is a pain. Raising money, in particular, is a huge time sink. So you have to consciously force yourself to keep looking.Even if you ultimately do the first deal, it will be to your advantage to have kept looking, because you'll get better terms. Deals are dynamic; unless you're negotiating with someone unusually honest, there's not a single point where you shake hands and the deal's done. There are usually a lot of subsidiary questions to be cleared up after the handshake, and if the other side senses weakness-- if they sense you need this deal-- they will be very tempted to screw you in the details.VCs and corp dev guys are professional negotiators. They're trained to take advantage of weakness. [8] So while they're often nice guys, they just can't help it. And as pros they do this more than you. So don't even try to bluff them. The only way a startup can have any leverage in a deal is genuinely not to need it. And if you don't believe in a deal, you'll be less likely to depend on it.So I want to plant a hypnotic suggestion in your heads: when you hear someone say the words "we want to invest in you" or "we want to acquire you," I want the following phrase to appear automatically in your head: don't get your hopes up. Just continue running your company as if this deal didn't exist. Nothing is more likely to make it close.The way to succeed in a startup is to focus on the goal of getting lots of users, and keep walking swiftly toward it while investors and acquirers scurry alongside trying to wave money in your face. Speed, not MoneyThe way I've described it, starting a startup sounds pretty stressful. It is. When I talk to the founders of the companies we've funded, they all say the same thing: I knew it would be hard, but I didn't realize it would be this hard.So why do it? It would be worth enduring a lot of pain and stress to do something grand or heroic, but just to make money? Is making money really that important?No, not really. It seems ridiculous to me when people take business too seriously. I regard making money as a boring errand to be got out of the way as soon as possible. There is nothing grand or heroic about starting a startup per se.So why do I spend so much time thinking about startups? I'll tell you why. Economically, a startup is best seen not as a way to get rich, but as a way to work faster. You have to make a living, and a startup is a way to get that done quickly, instead of letting it drag on through your whole life. [9]We take it for granted most of the time, but human life is fairly miraculous. It is also palpably short. You're given this marvellous thing, and then poof, it's taken away. You can see why people invent gods to explain it. But even to people who don't believe in gods, life commands respect. There are times in most of our lives when the days go by in a blur, and almost everyone has a sense, when this happens, of wasting something precious. As <NAME> said, if you love life, don't waste time, because time is what life is made of.So no, there's nothing particularly grand about making money. That's not what makes startups worth the trouble. What's important about startups is the speed. By compressing the dull but necessary task of making a living into the smallest possible time, you show respect for life, and there is something grand about that.Notes[1] Startups can die from releasing something full of bugs, and not fixing them fast enough, but I don't know of any that died from releasing something stable but minimal very early, then promptly improving it.[2] I know this is why I haven't released Arc. The moment I do, I'll have people nagging me for features.[3] A web site is different from a book or movie or desktop application in this respect. Users judge a site not as a single snapshot, but as an animation with multiple frames. Of the two, I'd say the rate of improvement is more important to users than where you currently are.[4] It should not always tell this to users, however. For example, MySpace is basically a replacement mall for mallrats. But it was wiser for them, initially, to pretend that the site was about bands.[5] Similarly, don't make users register to try your site. Maybe what you have is so valuable that visitors should gladly register to get at it. But they've been trained to expect the opposite. Most of the things they've tried on the web have sucked-- and probably especially those that made them register.[6] VCs have rational reasons for behaving this way. They don't make their money (if they make money) off their median investments. In a typical fund, half the companies fail, most of the rest generate mediocre returns, and one or two "make the fund" by succeeding spectacularly. So if they miss just a few of the most promising opportunities, it could hose the whole fund.[7] The attitude of a running back doesn't translate to soccer. Though it looks great when a forward dribbles past multiple defenders, a player who persists in trying such things will do worse in the long term than one who passes.[8] The reason Y Combinator never negotiates valuations is that we're not professional negotiators, and don't want to turn into them.[9] There are two ways to do work you love: (a) to make money, then work on what you love, or (b) to get a job where you get paid to work on stuff you love. In practice the first phases of both consist mostly of unedifying schleps, and in (b) the second phase is less secure.Thanks to <NAME>, <NAME>, <NAME>, Jessica Livingston, and <NAME> for reading drafts of this.Romanian TranslationRussian TranslationFrench TranslationJapanese Translation
https://github.com/wuespace/vos
https://raw.githubusercontent.com/wuespace/vos/main/README.md
markdown
# WüSpace VOS (Vereinsordnungssystem) ## § 1 Beschreibung (1) Das Vereinsordnungssystem (VOS) dient als Publikationsplattform für Vereinsordnungen (inkl. der Satzung), welche mit delegis / Typst erstellt wurden. Das VOS ist ein Projekt des Vereins WüSpace e. V. und wird von diesem betrieben. (2) $^1$ Das VOS agiert als Static Site Generator (SSG) und generiert aus den Typst-Dateien eine statische Website. $^2$ Die Website wird auf einem Webserver gehostet und ist unter der Domain [vos.wuespace.de](https://vos.wuespace.de) erreichbar. ## § 2 Bearbeitung (1) $^1$ Die Bearbeitung der Vereinsordnungen erfolgt in den Typst-Dateien im Ordner `vo`. $^2$ VOS extrahiert automatisch die delegis-Metadaten und generiert daraus die Website. $^3$ Die Website wird bei jedem Push auf den `main`-Branch automatisch neu generiert und auf dem Webserver aktualisiert. (2) Das VOS wird vom Vorstand gepflegt.
https://github.com/matthisearth/typstifier
https://raw.githubusercontent.com/matthisearth/typstifier/main/README.md
markdown
MIT License
# typstifier The goal of this project is to write a character classifier which outputs the command needed in [Typst](https://typst.app/) to generate the drawn symbol. The project is currently under active development and not functional yet. # Setup In order to build this project, you will need to have [Rust](https://www.rust-lang.org/), [Typst](https://typst.app/), [ImageMagick](https://imagemagick.org/) and [Node](https://nodejs.org/) as well as [NPM](https://www.npmjs.com/) installed. The generation of the training images is done by running `make databuild` which will download the relevant Rust file from the Typst project, extract the symbol names from it, generate a JSON file and the training images within the folder `data` and save the icons for the frontend in `frontend/static/symbols`. To train the neural network in the `training` directory, you will need to have [JAX](https://github.com/google/jax) with proper GPU support installed. Moreover, this project uses [NumPy](https://numpy.org/), [Matplotlib](https://numpy.org/), [OpenCV](https://opencv.org/), [Optax](https://github.com/google-deepmind/optax) and [Flax](https://github.com/google/flax) which you can install via PIP. ```bash pip install numpy matplotlib opencv-python optax flax ``` The file `training/dataload.py` writes the training data to the file `training/numpydata.pkl`, the notebook `training/main.ipynb` contains the training loop and `training/datawrite.py` writes the model checkpoint into a binary file. To generate the WASM binary as well as the glue code, you will need to install `wasm-bingen-cli` using `cargo install`, make sure its version matches the one in `inference/Cargo.toml` and run `make inference`. Finally, in the `frontend` directory, you can install the Node packages using `npm install`, start the development server using `npm run dev` and build the project as a static site using `npm run build`. ## License This project is licensed under the MIT License.
https://github.com/DieracDelta/presentations
https://raw.githubusercontent.com/DieracDelta/presentations/master/polylux/book/src/dynamic/alternatives.md
markdown
# `#alternatives` to substitute content The so far discussed helpers `#pause`, `#one-by-one` etc. all build upon `#uncover`. There is an analogon to `#one-by-one` that is based on `#only`, namely `#alternatives`. You can use it to show some content on one subslide, then substitute it by something else, then by something else, etc. Consider this example: ```typ {{#include poor-alternatives.typ:6:11}} ``` Here, we want to display three different sentences with the same structure: Some person likes some sort of ice cream. ![poor-alternatives](poor-alternatives.png) As you can see, the positioning of `likes` and `ice cream` moves around in the produced slide because, for example, `Ann` takes much less space than `Christopher` when using `#only` for that job. This somewhat disturbs the perception of the constant structure of the sentence and that only the names and kinds of ice cream change. To avoid such movement and only substitute certain parts of content, you can use the `#alternatives` function. With it, our example becomes: ```typ {{#include alternatives.typ:6:11}} ``` resulting in ![alternatives](alternatives.png) `#alternatives` will put enough empty space around, for example, `Ann` such that it uses the same amount of space as `Christopher`. In a sense, it is like a mix of `#only` and `#uncover` with some reserving of space. ### Repeat last content In case you have other dynamic content on a slide that happens after the contents of `#alternatives` are exhausted, you might want to not have the `#alternatives` element disappear but instead continue to show its last content argument. To achieve this, you can use the `repeat-last` parameter: ```typ {{#include alternatives-repeat-last.typ:6:9}} ``` resulting in ![alternatives-repeat-last](alternatives-repeat-last.png) ### Positioning By default, all elements that enter an `#alternatives` command are aligned at the bottom left corner. This might not always be the desired or the most pleasant way to position it, so you can provide an optional `position` argument to `#alternatives` that takes an [`alignment` or `2d alignment`](https://typst.app/docs/reference/layout/align/#parameters--alignment). For example: ```typ {{#include alternatives-position.typ:6:9}} ``` makes the mathematical terms look better positioned: ![alternatives-position](alternatives-position.png) All functions described on this page have such a `position` argument. Similar to `#one-by-one`, `#alternatives` also has an optional `start` argument that works just the same. ## `#alternatives-match` `#alternatives` has a couple of "cousins" that might be more convenient in some situations. The first one is `#alternatives-match` that has a name inspired by match-statements in many functional programming languages. The idea is that you give it a dictionary mapping from subslides to content: ```typ {{#include alternatives-match.typ:6:9}} ``` resulting in ![alternatives-match](alternatives-match.png) **Note** that it is your responsibility to make sure that the subslide sets are mutually disjoint. ## `#alternatives-cases` You can use this function if you want to have one piece of content that changes only slightly depending of what "case" of subslides you are in. So instead of ```typ {{#include alternatives-cases.typ:6:14}} ``` you can avoid duplication and write ```typ {{#include alternatives-cases.typ:18:21}} ``` using a function that maps the current "case" to content, resulting in ![alternatives-cases](alternatives-cases.png) **Note** that the cases are 0-indexed (as are Typst arrays). ## `#alternatives-fn` Finally, you can have very fine-grained control over the content depending on the current subslide by using `#alternatives-fn`. It accepts a function (hence the name) that maps the current subslide index to some content. Similar to `#alternatives`, it accepts an optional `start` parameter that has a default of `1`. `#alternatives-fn` only knows for how long to display something, though, if you provide either the number of subslides (`count` parameter) or the last subslide index (`end` parameter). So exactly one of them is necessary. For example: ```typ {{#include alternatives-fn.typ:6:8}} ``` resulting in ![alternatives-fn](alternatives-fn.png)