repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/utilsMenlive.typ
typst
#import "/style.typ": * #let make3(txt) = { ("", "", txt) } #let make4(txt) = { ("", none, "", txt) } #let makeGray(txt) = { txt.at(2) = text(10pt, grayText(txt.at(2))) return txt } #let makeSec(txt) = { txt.at(2) = text(10pt, secText(txt.at(2))) return txt } #let makeGray4(txt) = { txt.at(3) = text(10pt, grayText(txt.at(3))) return txt } #let makeSec4(txt) = { txt.at(3) = text(10pt, secText(txt.at(3))) return txt } #let tblNote(t, txt) = { (primText[$#sym.ast.circle$], make3(secText(t(txt)))) } #let styleOne(k) = [ #if k.at(1).len() > 0 [#secText[($#sym.PP:$ #k.at(1))]\ ] #if k.at(0).len() > 0 [#secText[#k.at(0):]] #k.at(2) ] #let styleOne4(k) = [ #let is_a = k.at(1) != none #let is_b = k.at(2).len() > 0 #let is_or = is_a or is_b #let is_and = is_a and is_b #secText[ #if is_or [(] #if is_a {[$#sym.HH:$ ]; small[#k.at(1)]} #if is_and [,] #if is_b {[$#sym.PP:$ ]; small[#k.at(2)]} #if is_or [)\ ] ] #if k.at(0).len() > 0 [#secText[#k.at(0):]] #k.at(3) ] #let styleTable3(tbl) = { let ntbl = () ntbl.push(tbl.at(0)) for i in range(tbl.len() - 1) { let (one, two, three) = ("", "", "") let (first, second) = (tbl.at(i).at(-1), tbl.at(i+1).at(-1)) // one - 0 - popis if first.at(0) == second.at(0) { one = "" } else { one = second.at(0) } // two - 1 - podoben if first.at(1) == second.at(1) { two = "" } else { two = second.at(1) } // three - 2 - text if type(second.at(2)) == "content" { three = second.at(2) } else { let spl = second.at(2).split(" ") if first.at(2) == second.at(2) and spl.len() > 2 { three = [#spl.slice(0,3).join(" ") ...] } else { three = second.at(2) } } if tbl.at(i+1).len() > 2 { ntbl.push((tbl.at(i+1).at(0), tbl.at(i+1).at(1), tbl.at(i+1).at(2), (one, two, three))) } else { ntbl.push((tbl.at(i+1).at(0), (one, two, three))) } } table( columns: (10pt, auto), stroke: none, align: (x, y) => (right, left).at(x), ..(ntbl.map(k => if k.len() == 2 { (k.at(0), styleOne(k.at(1))) } else { (k.at(0), styleOne(k.at(1)), k.at(2), styleOne(k.at(3))) } )).flatten() ) } #let styleTable4(tbl) = { let ntbl = () ntbl.push(tbl.at(0)) for i in range(tbl.len() - 1) { let (one, two, three, four) = ("", none, "", "") let (first, second) = (tbl.at(i).at(-1), tbl.at(i+1).at(-1)) // one - 0 - popis if first.at(0) == second.at(0) { one = "" } else { one = second.at(0) } // two - 1 - hlas if first.at(1) == second.at(1) { two = none } else { two = second.at(1) } // three - 2 - podoben if first.at(2) == second.at(2) { three = "" } else { three = second.at(2) } // four - 3 - text if type(second.at(3)) == "content" { three = second.at(3) } else { let spl = second.at(3).split(" ") if first.at(3) == second.at(3) and spl.len() > 2 { four = [#spl.slice(0,3).join(" ") ...] } else { four = second.at(3) } } if tbl.at(i+1).len() > 2 { ntbl.push((tbl.at(i+1).at(0), tbl.at(i+1).at(1), tbl.at(i+1).at(2), (one, two, three, four))) } else { ntbl.push((tbl.at(i+1).at(0), (one, two, three, four))) } } table( columns: (10pt, auto), stroke: none, align: (x, y) => (right, left).at(x), ..(ntbl.map(k => if k.len() == 2 { (k.at(0), styleOne4(k.at(1))) } else { (k.at(0), styleOne4(k.at(1)), k.at(2), styleOne4(k.at(3))) } )).flatten() ) }
https://github.com/UM-nerds/modern-report-umfds
https://raw.githubusercontent.com/UM-nerds/modern-report-umfds/main/template/main.typ
typst
MIT License
#import "@preview/modern-report-umfds:0.1.1": umfds #show: umfds.with( title: [#lorem(12)], authors: ( "Author 1", "Author 2", "Author 3", "Author 4" ), date: datetime.today().display("[day] [month repr:long] [year]"), img: rect(width: 15em, height: 15em, fill: luma(240))[ #align(center + horizon)[ #text(size: 2em, weight: "black")[Image] ] ], abstract: [ #lorem(100) ], bibliography: bibliography("refs.bib", full: true), lang: "en", ) = Section titled #lorem(50) #lorem(20) #lorem(40) == Sub-section #lorem(100) === Sub-subsection #lorem(50) = Section title #lorem(200)
https://github.com/kfijalkowski1/typst-diff-tool
https://raw.githubusercontent.com/kfijalkowski1/typst-diff-tool/main/typst_ast_parser/data/3_modify_bullet_point/expected_modified_bullet_point.typ
typst
#import "@preview/pesha:0.2.0": * #experience( place: "Hot Topic", title: "Retail-sales associate", time: [2004--06], )[ - #text(fill: red)[Top in-store sales associate in seven out of eight quarters]#text(fill: green)[Top in-store sales associate in eight out of nine quarters] - Inventory management - Training and recruiting ]
https://github.com/saurabtharu/Internship-repo
https://raw.githubusercontent.com/saurabtharu/Internship-repo/main/Internship%20Report%20-%20typst/template.typ
typst
/* #show par: set block(spacing: 0.65em) */ // #show raw.where(block: true): block.with( // fill: luma(240), // inset: 10pt, // radius: 4pt, // ) #let cell = rect.with( inset: 7pt, width: 100%, radius: 3pt, ) // function that accept name #let person(name) = box[#name] #let subjectName(name) = box[#name] // subject code #let subjectCode(name) = box[#name] // headings #let chapterHead(texts) = align(center, text(16pt)[ = #texts ]) #let sectionHead(texts) = align(left, text(14pt)[ == #texts ]) #let subsectionHead(texts) = align(left , text(12pt)[ // === #text(weight: "regular")[#texts] === #texts // #v(1pt, weak: true) ]) #let regularText(texts) = align(left , text(12pt)[ #text(weight: "regular")[#texts] // #v(1pt, weak: true) ]) #let makeIt(arg1) = text(13pt)[*#arg1*] #let boldText(arg1) = [ #arg1 ] // --------------------------------------------------------------------- #let image_num(_) = { locate(loc => { let chapt = counter(heading).at(loc).at(0) let c = counter("image-chapter" + str(chapt)) let n = c.at(loc).at(0) }) } // --------------------------------------------------------------------- #let img(img, nnn, caption) = { figure( img, caption: caption, supplement:[Figure #nnn], numbering: image_num, kind: figure ) } // --------------------------------------------------------------------- #let img_grid(img, a, nnn, caption) = { figure( grid( columns: (auto), // rows: (auto, auto), gutter: 0.5em, [#img], [*#a*], ), caption: caption, supplement:[Figure #nnn], numbering: image_num, kind: figure ) } // --------------------------------------------------------------------- #let tbl(tbl, nnn, caption) = { figure( [], caption: figure.caption([#caption],position: top), supplement:[Table #nnn], numbering: image_num, kind: table, ) } // --------------------------------------------------------------------- #let img_appendix(img, caption) = { figure( img, caption: caption, supplement:[], numbering: image_num, kind: figure, outlined: false ) } // --------------------------------------------------------------------- #let img_6(img1, img2, img3, img4, img5, img6, nnn, caption) = { figure( grid( columns: (auto, auto), rows: (auto, auto), gutter: 0.5em, [#img1], [#img2], [a)],[b)], [#img3], [#img4], [c)],[d)], [#img5], [#img6], [e)],[f)] ), caption: caption, supplement:[Figure #nnn], numbering: image_num, kind: figure ) } // --------------------------------------------------------------------- #let img_2(img1, a, img2, b, nnn, caption) = { figure( grid( columns: (auto, auto), rows: (auto, auto), gutter: 0.5em, [#img1], [#img2], [#a],[#b], ), caption: caption, supplement:[Figure #nnn], numbering: image_num, kind: figure ) } // --------------------------------------------------------------------- #let img_4(img1, a, img2, b,img3, c, img4, d, nnn, caption) = { figure( grid( columns: (auto, auto), rows: (auto, auto), gutter: 0.5em, [#img1], [#img2], [#a],[#b], [#img3], [#img4], [#c],[#d], ), caption: caption, supplement:[Figure #nnn], numbering: image_num, kind: figure ) }
https://github.com/DriedYellowPeach/project-vietnam
https://raw.githubusercontent.com/DriedYellowPeach/project-vietnam/main/readme.md
markdown
# How To Use ## Step 1 Install typst `brew install typst` ## Step 2 compile to pdf using `typst compile project-vietnam.typ`
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/Changelog.md
markdown
## Change log ### 0.3.0 - Add automatic tests (And almost everything else is thanks to that) - **_(Breaking)_** Change Typst compiler calls DSL - Introduce a Typst stacktrace parser and let add its entries to JVM exceptions - **_(Breaking)_** Change how `Relative` is represented in Kotlin - Fix bugs with varargs in `table`, `list`, `math.cases`, `math.mat`, `math.vec`, `grid`, `grid.header`, `grid.footer`, `stack`, `path`, `polygon` - Fix repr of `math.root` - Add missing `math.op`, `math.scripts`, `math.align-point`, `math.limits`, `figure.caption` - Fix falsely required `body` of `block`, `box` - Support Typst 0.12: - Add `figure.scope`, `heading.hanging-indent`, `text.costs`, `math.mat.align`, `math.vec.align`, `block.sticky`, `place.scope`, `repeat.gap`, `repeat.justify`, `path.fill-rule`, `polygon.fill-rule` parameters - Change types of `raw.theme`, `text.stylistic-set`, `math.vec.delim` `math.cases.delim`, `math.mat.delim`, `block.width`, `block.height`, `box.height`, `page.header`, `page.footer`, `scale.x`, `scale.y`, `rect.width`, `rect.height` parameters - Add `math.binom`, `smallcaps`, `math.overparen`, `math.underparen`, `math.overshell`, `math.undershell`, `place.flush`, `skew`, `math.stretch` element types - Add `decimal` type - **_But not new optional CLI arguments_** - Fix bugs duplicated names ( `grid`/`cell`: `footer`, `header`, `rowspan`, `colspan`, `cell`, `hline`, `vline`; `list`/`enum`/`term` : `item` ) - Introduce draft `styled` class to later use for set rules ### 0.2.0 - Sync serialization with PR version - Add a few more types ### 0.1.1 - TArray and TDictionary no longer implement List and Map respectively. - Appropriate extension functions, duplicating functionality of stdlib ones, will be added. ### 0.1.0 - Publish beta version of the library
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/playground/base.typ
typst
Apache License 2.0
#let tmpl2(stroke) = text(stroke: stroke) #tmpl2(/* position */)
https://github.com/Lightbridge-KS/kittipos-cv-typst
https://raw.githubusercontent.com/Lightbridge-KS/kittipos-cv-typst/main/README.md
markdown
# My CV using Typst > My CV using [typst](https://github.com/typst/typst) - [PDF](./Kittipos-CV.pdf) - [Typst](./Kittipos-CV.typ) Adapted from [Modern Academic CV](https://github.com/bpkleer/typst-modern-acad-cv) ## Install ```zsh brew install typst ``` ## Compile ```zsh # Compile typst compile Kittipos-CV.typ # Watch typst watch Kittipos-CV.typ ```
https://github.com/dhmemi/resume
https://raw.githubusercontent.com/dhmemi/resume/main/README.md
markdown
MIT License
# My Resume This is my resume, based on [Matchy's template](https://github.com/matchy233/typst-chi-cv-template), and and fine-tuned the style and font according to [ice1000's resume](https://github.com/ice1000/resume). # Build 1. Install latest [typst](https://github.com/typst/typst); 2. Download and install [Source Han Serif](https://github.com/adobe-fonts/source-han-serif) to enable Chinese font; 3. Run Command: ```bash git clone https://github.com/dhmemi/resume.git cd resume typst compile --font-path ./fonts resume.typ resume.pdf ```
https://github.com/Myriad-Dreamin/shiroa
https://raw.githubusercontent.com/Myriad-Dreamin/shiroa/main/github-pages/docs/cli/clean.typ
typst
Apache License 2.0
#import "/github-pages/docs/book.typ": book-page #show: book-page.with(title: "CLI Clean Command") = The clean command Not yet implemented.
https://github.com/xdoardo/co-thesis
https://raw.githubusercontent.com/xdoardo/co-thesis/master/thesis/msg.typ
typst
#v(0.5fr) _"...I can hardly understand, for instance, how a young man can decide to ride over to the next village without being afraid that, quite apart from accidents, even the span of a normal life that passes happily may be totally insufficient for such a ride."_ #align(right, "<NAME>") #v(1fr) #smallcaps("no generative artificial intelligence was used in this work.")
https://github.com/qujihan/toydb-book
https://raw.githubusercontent.com/qujihan/toydb-book/main/src/chapter4/type.typ
typst
#import "../../typst-book-template/book.typ": * #let path-prefix = figure-root-path + "src/pics/" == Type === ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹ ็Žฐๅœจ็œ‹ไธ€ไธ‹ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹็š„ๅฎšไน‰ใ€‚ ไธบไบ†็ฎ€ๅŒ–๏ผŒ่ฟ™้‡Œๆ˜ฏๆ”ฏๆŒๅฐ‘้‡็š„ๆ•ฐๆฎ็ฑปๅž‹๏ผŒไธๆ”ฏๆŒๅคๆ‚ๆ•ฐๆฎ็ฑปๅž‹็ญ‰ใ€‚ ๅฆๅค–้œ€่ฆ่ฏดไธ€ไธ‹๏ผŒNULLไปฅๅŠNaN้ƒฝ่ขซ่ฎคไธบๆ˜ฏไธ็ญ‰ไบŽๆœฌ่บซ็š„ๅ€ผ๏ผŒๆ‰€ไปฅ็†่ฎบไธŠ`NULL != NULL`๏ผŒ`NaN != NaN`ใ€‚ไฝ†ๆ˜ฏๅœจๅฎž้™…็š„ไปฃ็ ไธญ๏ผŒNULLๅ’ŒNaN้ƒฝ่ฎคไธบๆ˜ฏๅฏไปฅๆฏ”่พƒไธ”็›ธ็ญ‰็š„ใ€‚่ฟ™ๆ˜ฏไธบไบ†ๅฏนๅ…่ฎธๅฏน่ฟ™ไบ›ๅ€ผ่ฟ›่กŒๆŽ’ๅบๅ’Œๅค„็†๏ผˆๆฏ”ๅฆ‚็ดขๅผ•ๆŸฅๆ‰พใ€ๆกถ่šๅˆ็ญ‰ๅœบๆ™ฏ๏ผ‰ใ€‚ ๅฆๅค–ๆตฎ็‚นๆ•ฐไธญ็š„`-0.0 == 0.0`๏ผŒ`-NaN == NaN`้ƒฝ่ฎคไธบ่ฟ”ๅ›ž`true`ใ€‚ๅญ˜ๅ‚จ็š„ๆ—ถๅ€™ไผšๅฐ†`-0.0`่ง„่ŒƒๅŒ–ไธบ`0.0`๏ผŒ`-NaN`่ง„่ŒƒๅŒ–ไธบ`NaN`ใ€‚ #code("src/sql/types/value.rs", "ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹")[ ```rust /// ๆ”ฏๆŒ็š„ๆ•ฐๆฎ็ฑปๅž‹ #[derive(Clone, Copy, Debug, Hash, PartialEq, Serialize, Deserialize)] pub enum DataType { Boolean, // ๅธƒๅฐ”็ฑปๅž‹ Integer, // 64ไฝๆœ‰็ฌฆๅทๆ•ดๆ•ฐ Float, // 64ไฝๆตฎ็‚นๆ•ฐ String, // UTF-8็ผ–็ ็š„ๅญ—็ฌฆไธฒ } /// ๆ•ฐๆฎ็š„ๅ€ผ #[derive(Clone, Debug, Serialize, Deserialize)] pub enum Value { Null, // ็ฉบๅ€ผ Boolean(bool), // ๅธƒๅฐ”็ฑปๅž‹ Integer(i64), // 64ไฝๆœ‰็ฌฆๅทๆ•ดๆ•ฐ Float(f64), // 64ไฝๆตฎ็‚นๆ•ฐ String(String), // UTF-8็ผ–็ ็š„ๅญ—็ฌฆไธฒ } // ่ฟ™้‡Œๅฎšไน‰ไบ† Value ็›ธ็ญ‰็š„ๆฏ”่พƒ impl std::cmp::PartialEq for Value { fn eq(&self, other: &Self) -> bool { match (self, other) { // ... // ่ฟ™้‡Œๅฏไปฅ็œ‹ๅˆฐไธŠ้ขๆๅˆฐ็š„ NaN == NaN ็š„ๆƒ…ๅ†ต // ๅฆๅค– // let a: f64 = 0.0; // let b: f64 = -0.0; // println!("{}", a == b); // true (Self::Float(l), Self::Float(r)) => l == r || l.is_nan() && r.is_nan(), // ..็œ็•ฅๅคง้ƒจๅˆ†็ฎ€ๅ•ไปฃ็ .. (l, r) => core::mem::discriminant(l) == core::mem::discriminant(r), } } } impl std::hash::Hash for Value { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { core::mem::discriminant(self).hash(state); // Normalize to treat +/-0.0 and +/-NAN as equal when hashing. // ่ฟ™้‡Œ่ฐƒ็”จไบ† normalize_ref ๆ–นๆณ•๏ผŒ่ฟ™ไธชๆ–นๆณ•ไผšๅฐ† -0.0 ่ง„่ŒƒๅŒ–ไธบ 0.0 // -NaN ่ง„่ŒƒๅŒ–ไธบ NaN match self.normalize_ref().as_ref() { Self::Null => {} Self::Boolean(v) => v.hash(state), Self::Integer(v) => v.hash(state), Self::Float(v) => v.to_bits().hash(state), Self::String(v) => v.hash(state), } } } // ่ฟ™้‡Œๅฎšไน‰็š„ๅ…จๅบๆฏ”่พƒ, ็œ‹ไธ€ไธ‹ๅฐฑๅฅฝ impl Ord for Value { fn cmp(&self, other: &Self) -> std::cmp::Ordering { use std::cmp::Ordering::*; use Value::*; match (self, other) { (Null, Null) => Equal, (Boolean(a), Boolean(b)) => a.cmp(b), (Integer(a), Integer(b)) => a.cmp(b), (Integer(a), Float(b)) => (*a as f64).total_cmp(b), (Float(a), Integer(b)) => a.total_cmp(&(*b as f64)), (Float(a), Float(b)) => a.total_cmp(b), (String(a), String(b)) => a.cmp(b), (Null, _) => Less, (_, Null) => Greater, (Boolean(_), _) => Less, (_, Boolean(_)) => Greater, (Float(_), _) => Less, (_, Float(_)) => Greater, (Integer(_), _) => Less, (_, Integer(_)) => Greater, // String is ordered last. } } } // ่ฟ™้‡Œๆ˜ฏๅฎž็Žฐๅๅบๆฏ”่พƒ, ๅœจๅฎšไน‰ไบ†ๅ…จๅบๆฏ”่พƒไปฅๅŽ, ๅๅบๆฏ”่พƒ็›ดๆŽฅ่ฐƒ็”จๅ…จๅบๆฏ”่พƒๅฐฑๅฏไปฅไบ† impl PartialOrd for Value { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { Some(self.cmp(other)) } } ``` ] #code("src/sql/types/value.rs", "Value ็š„ๅ…ทไฝ“ๅฎž็Žฐ")[ ```rust impl Value { /// ๅŠ ๆณ•ๆ“ไฝœ pub fn checked_add(&self, other: &Self) -> Result<Self> { ... } /// ้™คๆณ•ๆ“ไฝœ pub fn checked_div(&self, other: &Self) -> Result<Self> { ... } /// ไน˜ๆณ•ๆ“ไฝœ pub fn checked_mul(&self, other: &Self) -> Result<Self> { ... } /// ๅน‚่ฟ็ฎ— pub fn checked_pow(&self, other: &Self) -> Result<Self> { ... } /// ๅ–ไฝ™ๆ“ไฝœ pub fn checked_rem(&self, other: &Self) -> Result<Self> { ... } /// ๅ‡ๆณ•ๆ“ไฝœ pub fn checked_sub(&self, other: &Self) -> Result<Self> { ... } /// ่ฟ”ๅ›žๆ•ฐๆฎ็ฑปๅž‹ /// ่ฟ™้‡Œๅฏไปฅ็œ‹ๅˆฐRust็š„่กจ่พพ่ƒฝๅŠ›ๆŒบๅผบ็š„ pub fn datatype(&self) -> Option<DataType> { match self { Self::Null => None, Self::Boolean(_) => Some(DataType::Boolean), Self::Integer(_) => Some(DataType::Integer), Self::Float(_) => Some(DataType::Float), Self::String(_) => Some(DataType::String), } } /// ่ฟ”ๅ›ž true ๅฆ‚ๆžœๅ€ผๆ˜ฏๆœชๅฎšไน‰็š„(NULL ๆˆ– NaN). pub fn is_undefined(&self) -> bool { ... } /// ๅŽŸๅœฐ่ง„่ŒƒๅŒ–ไธ€ไธชๅ€ผ. /// ็›ฎๅ‰ๅฐ† -0.0 ๅ’Œ -NAN ่ง„่ŒƒๅŒ–ไธบ 0.0 ๅ’Œ NAN, ่ฟ™ๆ˜ฏไธป้”ฎๅ’Œ็ดขๅผ•ๆŸฅๆ‰พไธญไฝฟ็”จ็š„่ง„่Œƒๅ€ผ. pub fn normalize(&mut self) { if let Cow::Owned(normalized) = self.normalize_ref() { *self = normalized; } } /// ๅฐ†ไธ€ไธช borrow ็š„ๅ€ผ่ง„่ŒƒๅŒ–. /// ็›ฎๅ‰ๅฐ† -0.0 ๅ’Œ -NAN ่ง„่ŒƒๅŒ–ไธบ 0.0 ๅ’Œ NAN, ่ฟ™ๆ˜ฏไธป้”ฎๅ’Œ็ดขๅผ•ๆŸฅๆ‰พไธญไฝฟ็”จ็š„่ง„่Œƒๅ€ผ. /// ๅฝ“ๅ€ผๅ‘็”Ÿๅ˜ๅŒ–ๆ—ถ, ่ฟ”ๅ›ž Cow::Owned, ไปฅ้ฟๅ…ๅœจๅ€ผไธๅ˜็š„ๅธธ่งๆƒ…ๅ†ตไธ‹ๅˆ†้…ๅ†…ๅญ˜. pub fn normalize_ref(&self) -> Cow<'_, Self> { if let Self::Float(f) = self { if (f.is_nan() || *f == -0.0) && f.is_sign_negative() { return Cow::Owned(Self::Float(-f)); } } Cow::Borrowed(self) } /// ๅฆ‚ๆžœๅ€ผๅทฒ็ป่ง„่ŒƒๅŒ–, ่ฟ”ๅ›ž true. /// ่ฟ™้‡Œ่ฟ˜ๆŒบๆœ‰ๆ„ๆ€, ้€š่ฟ‡ Cow::Borrowed ๆฅๅˆคๆ–ญๆ˜ฏๅฆ่ง„่ŒƒๅŒ–. /// ๅฆ‚ๆžœๆ˜ฏ Cow::Owned(_), ่ฏดๆ˜Žๅทฒ็ป่ง„่ŒƒๅŒ–ไบ†, ่ฟ”ๅ›žfalse. /// ่ฟ™้‡Œ็š„ Cow::Borrowed(_), ่ฏดๆ˜Žไผ ่ฟ›ๅŽป็š„ๅ€ผๆ˜ฏๅทฒ็ป่ง„่ŒƒๅŒ–็š„๏ผŒ ่ฟ”ๅ›žtrue. pub fn is_normalized(&self) -> bool { matches!(self.normalize_ref(), Cow::Borrowed(_)) } } impl std::fmt::Display for Value { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { ... } } /// ๅฎšไน‰ไบ† Value ไธŽ Rust ๅŸบๆœฌๆ•ฐๆฎ็ฑปๅž‹็š„็›ธไบ’่ฝฌๆข. impl From<bool> for Value { fn from(v: bool) -> Self { Value::Boolean(v) } } impl From<f64> for Value { fn from(v: f64) -> Self { Value::Float(v) } } impl From<i64> for Value { fn from(v: i64) -> Self { Value::Integer(v) } } impl From<String> for Value { fn from(v: String) -> Self { Value::String(v) } } impl From<&str> for Value { fn from(v: &str) -> Self { Value::String(v.to_owned()) } } impl TryFrom<Value> for bool { ... } impl TryFrom<Value> for f64 { ... } impl TryFrom<Value> for i64 { ... } impl TryFrom<Value> for String { ... } /// ๅฎšไน‰ไบ† Value ๅˆฐ Cow<'_, Value> ็š„่ฝฌๆข. impl<'a> From<&'a Value> for Cow<'a, Value> { fn from(v: &'a Value) -> Self { Cow::Borrowed(v) } } ``` ] ่ฟ™ไธ€้ƒจๅˆ†็œ‹่ตทๆฅๆ˜ฏๆฏ”่พƒ็ฎ€ๅ•็š„๏ผŒไฝ†ๆ˜ฏๅ†™่ตทๆฅ้œ€่ฆ่€ƒ่™‘็š„ไธœ่ฅฟ่ฟ˜ๆ˜ฏๆŒบๅคš็š„๏ผŒๆฏ”ๅฆ‚macthไธญ็š„้กบๅบไน‹็ฑป็š„๏ผŒ้ƒฝๆ˜ฏไธ€ไบ›ๅฐ็ป†่Š‚ใ€‚ไฝ†ๆ˜ฏ็œ‹่ตทๆฅ้šพๅบฆๅนถๆฒกๆœ‰ๅพˆๅคง๏ผŒ่ฟ™้‡Œๅฐฑไธๅ†ๅฑ•ๅผ€ไบ†ใ€‚ ไธ‹้ข็œ‹ไธ€ไธ‹ๅ…ถไป–็š„็ฑปๅž‹ใ€‚ #code("", "")[ ```rust /// A row of values. pub type Row = Vec<Value>; /// A row iterator. pub type Rows = Box<dyn RowIterator>; /// A row iterator trait, which requires the iterator to be both clonable and /// object-safe. Cloning is needed to be able to reset an iterator back to an /// initial state, e.g. during nested loop joins. It has a blanket /// implementation for all matching iterators. pub trait RowIterator: Iterator<Item = Result<Row>> + DynClone {} impl<I: Iterator<Item = Result<Row>> + DynClone> RowIterator for I {} dyn_clone::clone_trait_object!(RowIterator); ``` ] #code("", "")[ ```rust /// A column label, used in query results and plans. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum Label { /// No label. None, /// An unqualified column name. Unqualified(String), /// A fully qualified table/column name. Qualified(String, String), } impl std::fmt::Display for Label { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::None => write!(f, ""), Self::Unqualified(name) => write!(f, "{name}"), Self::Qualified(table, column) => write!(f, "{table}.{column}"), } } } impl Label { /// Formats the label as a short column header. pub fn as_header(&self) -> &str { match self { Self::Qualified(_, column) | Self::Unqualified(column) => column.as_str(), Self::None => "?", } } } impl From<Label> for ast::Expression { /// Builds an ast::Expression::Column for a label. Can't be None. fn from(label: Label) -> Self { match label { Label::Qualified(table, column) => ast::Expression::Column(Some(table), column), Label::Unqualified(column) => ast::Expression::Column(None, column), Label::None => panic!("can't convert None label to AST expression"), // shouldn't happen } } } impl From<Option<String>> for Label { fn from(name: Option<String>) -> Self { name.map(Label::Unqualified).unwrap_or(Label::None) } } ``` ] === Schema ๅœจ Schema ไธญๅฎšไน‰ไบ†Table ไปฅๅŠ Column ็š„็ป“ๆž„ใ€‚ #code("src/sql/types/schema.rs", "Colume ไปฅๅŠ Table ็š„็ป“ๆž„")[ ```rust /// A table schema, which specifies its data structure and constraints. /// /// Tables can't change after they are created. There is no ALTER TABLE nor /// CREATE/DROP INDEX -- only CREATE TABLE and DROP TABLE. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct Table { /// The table name. Can't be empty. pub name: String, /// The primary key column index. A table must have a primary key, and it /// can only be a single column. pub primary_key: usize, /// The table's columns. Must have at least one. pub columns: Vec<Column>, } /// A table column. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct Column { /// Column name. Can't be empty. pub name: String, /// Column datatype. pub datatype: DataType, /// Whether the column allows null values. Not legal for primary keys. pub nullable: bool, /// The column's default value. If None, the user must specify an explicit /// value. Must match the column datatype. Nullable columns require a /// default (often Null), and Null is only a valid default when nullable. pub default: Option<Value>, /// Whether the column should only allow unique values (ignoring NULLs). /// Must be true for a primary key column. pub unique: bool, /// Whether the column should have a secondary index. Must be false for /// primary keys, which are the implicit primary index. Must be true for /// unique or reference columns. pub index: bool, /// If set, this column is a foreign key reference to the given table's /// primary key. Must be of the same type as the target primary key. pub references: Option<String>, } ``` ] ่ฟ™้‡Œ็š„่กจ็ป“ๆž„่ฟ˜ๆ˜ฏๆฏ”่พƒ็ฎ€ๅ•็š„๏ผŒๅชๆœ‰ๅŸบๆœฌ็š„่กจๅ๏ผŒไธป้”ฎๆ‰€ๅœจ็š„ๅˆ—ๅท๏ผŒๆ‰€ๆœ‰็š„ๅˆ—ใ€‚ๆฏไธ€ๅˆ—ๆœ‰ๅˆ—ๅ๏ผŒๆ•ฐๆฎ็ฑปๅž‹๏ผŒๆ˜ฏๅฆๅ…่ฎธไธบ็ฉบ๏ผŒ้ป˜่ฎคๅ€ผ๏ผŒๆ˜ฏๅฆๅ”ฏไธ€๏ผŒๆ˜ฏๅฆๆœ‰็ดขๅผ•็ญ‰ใ€‚ #code("", "")[ ```rust impl std::fmt::Display for Table { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { // ... } } impl Table { /// Validates the table schema, using the catalog to validate foreign key /// references. pub fn validate(&self, catalog: &impl Catalog) -> Result<()> { if self.name.is_empty() { return errinput!("table name can't be empty"); } if self.columns.is_empty() { return errinput!("table has no columns"); } if self.columns.get(self.primary_key).is_none() { return errinput!("invalid primary key index"); } for (i, column) in self.columns.iter().enumerate() { if column.name.is_empty() { return errinput!("column name can't be empty"); } let (cname, ctype) = (&column.name, &column.datatype); // for formatting convenience // Validate primary key. let is_primary_key = i == self.primary_key; if is_primary_key { if column.nullable { return errinput!("primary key {cname} cannot be nullable"); } if !column.unique { return errinput!("primary key {cname} must be unique"); } if column.index { return errinput!("primary key {cname} can't have an index"); } } // Validate default value. match column.default.as_ref().map(|v| v.datatype()) { None if column.nullable => { return errinput!("nullable column {cname} must have a default value") } Some(None) if !column.nullable => { return errinput!("invalid NULL default for non-nullable column {cname}") } Some(Some(vtype)) if vtype != column.datatype => { return errinput!("invalid default type {vtype} for {ctype} column {cname}"); } Some(_) | None => {} } // Validate unique index. if column.unique && !column.index && !is_primary_key { return errinput!("unique column {cname} must have a secondary index"); } // Validate references. if let Some(reference) = &column.references { if !column.index && !is_primary_key { return errinput!("reference column {cname} must have a secondary index"); } let reftype = if reference == &self.name { self.columns[self.primary_key].datatype } else if let Some(target) = catalog.get_table(reference)? { target.columns[target.primary_key].datatype } else { return errinput!("unknown table {reference} referenced by column {cname}"); }; if column.datatype != reftype { return errinput!("can't reference {reftype} primary key of {reference} from {ctype} column {cname}"); } } } Ok(()) } /// Validates a row, including uniqueness and reference checks using the /// given transaction. /// /// If update is true, the row replaces an existing entry with the same /// primary key. Otherwise, it is an insert. Primary key changes are /// implemented as a delete+insert. /// /// Validating uniqueness and references individually for each row is not /// performant, but it's fine for our purposes. pub fn validate_row(&self, row: &[Value], update: bool, txn: &impl Transaction) -> Result<()> { if row.len() != self.columns.len() { return errinput!("invalid row size for table {}", self.name); } // Validate primary key. let id = &row[self.primary_key]; let idslice = &row[self.primary_key..=self.primary_key]; if id.is_undefined() { return errinput!("invalid primary key {id}"); } if !update && !txn.get(&self.name, idslice)?.is_empty() { return errinput!("primary key {id} already exists"); } for (i, (column, value)) in self.columns.iter().zip(row).enumerate() { let (cname, ctype) = (&column.name, &column.datatype); let valueslice = &row[i..=i]; // Validate datatype. if let Some(ref vtype) = value.datatype() { if vtype != ctype { return errinput!("invalid datatype {vtype} for {ctype} column {cname}"); } } if value == &Value::Null && !column.nullable { return errinput!("NULL value not allowed for column {cname}"); } // Validate outgoing references. if let Some(target) = &column.references { match value { // NB: NaN is not a valid primary key, and not valid as a // missing foreign key marker. Value::Null => {} v if target == &self.name && v == id => {} v if txn.get(target, valueslice)?.is_empty() => { return errinput!("reference {v} not in table {target}"); } _ => {} } } // Validate uniqueness constraints. Unique columns are indexed. if column.unique && i != self.primary_key && !value.is_undefined() { let mut index = txn.lookup_index(&self.name, &column.name, valueslice)?; if update { index.remove(id); // ignore existing version of this row } if !index.is_empty() { return errinput!("value {value} already in unique column {cname}"); } } } Ok(()) } } ``` ] === ่กจ่พพๅผ #code("src/sql/types/expression.rs", "Expression ็š„ๅฎšไน‰")[ ```rust /// An expression, made up of nested operations and values. Values are either /// constants or dynamic column references. Evaluates to a final value during /// query execution, using row values for column references. /// /// Since this is a recursive data structure, we have to box each child /// expression, which incurs a heap allocation per expression node. There are /// clever ways to avoid this, but we keep it simple. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum Expression { /// A constant value. Constant(Value), /// A column reference. Used as row index when evaluating expressions. Column(usize), /// Logical AND of two booleans: a AND b. And(Box<Expression>, Box<Expression>), /// Logical OR of two booleans: a OR b. Or(Box<Expression>, Box<Expression>), /// Logical NOT of a boolean: NOT a. Not(Box<Expression>), /// Equality comparison of two values: a = b. Equal(Box<Expression>, Box<Expression>), /// Greater than comparison of two values: a > b. GreaterThan(Box<Expression>, Box<Expression>), /// Less than comparison of two values: a < b. LessThan(Box<Expression>, Box<Expression>), /// Checks for the given value: IS NULL or IS NAN. Is(Box<Expression>, Value), /// Adds two numbers: a + b. Add(Box<Expression>, Box<Expression>), /// Divides two numbers: a / b. Divide(Box<Expression>, Box<Expression>), /// Exponentiates two numbers, i.e. a ^ b. Exponentiate(Box<Expression>, Box<Expression>), /// Takes the factorial of a number: 4! = 4*3*2*1. Factorial(Box<Expression>), /// The identify function, which simply returns the same number: +a. Identity(Box<Expression>), /// Multiplies two numbers: a * b. Multiply(Box<Expression>, Box<Expression>), /// Negates the given number: -a. Negate(Box<Expression>), /// The remainder after dividing two numbers: a % b. Remainder(Box<Expression>, Box<Expression>), /// Takes the square root of a number: โˆša. SquareRoot(Box<Expression>), /// Subtracts two numbers: a - b. Subtract(Box<Expression>, Box<Expression>), // Checks if a string matches a pattern: a LIKE b. Like(Box<Expression>, Box<Expression>), } ``` ] #code("src/sql/types/expression.rs", "Expression ็š„ๅฎž็Žฐ")[ ```rust impl Expression { /// Formats the expression, using the given plan node to look up labels for /// numeric column references. pub fn format(&self, node: &Node) -> String { use Expression::*; // Precedence levels, for grouping. Matches the parser precedence. fn precedence(expr: &Expression) -> u8 { match expr { Column(_) | Constant(_) | SquareRoot(_) => 11, Identity(_) | Negate(_) => 10, Factorial(_) => 9, Exponentiate(_, _) => 8, Multiply(_, _) | Divide(_, _) | Remainder(_, _) => 7, Add(_, _) | Subtract(_, _) => 6, GreaterThan(_, _) | LessThan(_, _) => 5, Equal(_, _) | Like(_, _) | Is(_, _) => 4, Not(_) => 3, And(_, _) => 2, Or(_, _) => 1, } } // Helper to format a boxed expression, grouping it with () if needed. let format = |expr: &Expression| { let mut string = expr.format(node); if precedence(expr) < precedence(self) { string = format!("({string})"); } string }; match self { Constant(value) => format!("{value}"), Column(index) => match node.column_label(*index) { Label::None => format!("#{index}"), label => format!("{label}"), }, And(lhs, rhs) => format!("{} AND {}", format(lhs), format(rhs)), Or(lhs, rhs) => format!("{} OR {}", format(lhs), format(rhs)), Not(expr) => format!("NOT {}", format(expr)), Equal(lhs, rhs) => format!("{} = {}", format(lhs), format(rhs)), GreaterThan(lhs, rhs) => format!("{} > {}", format(lhs), format(rhs)), LessThan(lhs, rhs) => format!("{} < {}", format(lhs), format(rhs)), Is(expr, Value::Null) => format!("{} IS NULL", format(expr)), Is(expr, Value::Float(f)) if f.is_nan() => format!("{} IS NAN", format(expr)), Is(_, v) => panic!("unexpected IS value {v}"), Add(lhs, rhs) => format!("{} + {}", format(lhs), format(rhs)), Divide(lhs, rhs) => format!("{} / {}", format(lhs), format(rhs)), Exponentiate(lhs, rhs) => format!("{} ^ {}", format(lhs), format(rhs)), Factorial(expr) => format!("{}!", format(expr)), Identity(expr) => format(expr), Multiply(lhs, rhs) => format!("{} * {}", format(lhs), format(rhs)), Negate(expr) => format!("-{}", format(expr)), Remainder(lhs, rhs) => format!("{} % {}", format(lhs), format(rhs)), SquareRoot(expr) => format!("sqrt({})", format(expr)), Subtract(lhs, rhs) => format!("{} - {}", format(lhs), format(rhs)), Like(lhs, rhs) => format!("{} LIKE {}", format(lhs), format(rhs)), } } /// Formats a constant expression. Errors on column references. pub fn format_constant(&self) -> String { self.format(&Node::Nothing { columns: Vec::new() }) } /// Evaluates an expression, returning a value. Column references look up /// values in the given row. If None, any Column references will panic. pub fn evaluate(&self, row: Option<&Row>) -> Result<Value> { use Value::*; Ok(match self { // Constant values return themselves. Self::Constant(value) => value.clone(), // Column references look up a row value. The planner ensures that // only constant expressions are evaluated without a row. Self::Column(index) => match row { Some(row) => row.get(*index).expect("short row").clone(), None => panic!("can't reference column {index} with constant evaluation"), }, // Logical AND. Inputs must be boolean or NULL. NULLs generally // yield NULL, except the special case NULL AND false == false. Self::And(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { (Boolean(lhs), Boolean(rhs)) => Boolean(lhs && rhs), (Boolean(b), Null) | (Null, Boolean(b)) if !b => Boolean(false), (Boolean(_), Null) | (Null, Boolean(_)) | (Null, Null) => Null, (lhs, rhs) => return errinput!("can't AND {lhs} and {rhs}"), }, // Logical OR. Inputs must be boolean or NULL. NULLs generally // yield NULL, except the special case NULL OR true == true. Self::Or(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { (Boolean(lhs), Boolean(rhs)) => Boolean(lhs || rhs), (Boolean(b), Null) | (Null, Boolean(b)) if b => Boolean(true), (Boolean(_), Null) | (Null, Boolean(_)) | (Null, Null) => Null, (lhs, rhs) => return errinput!("can't OR {lhs} and {rhs}"), }, // Logical NOT. Input must be boolean or NULL. Self::Not(expr) => match expr.evaluate(row)? { Boolean(b) => Boolean(!b), Null => Null, value => return errinput!("can't NOT {value}"), }, // Comparisons. Must be of same type, except floats and integers // which are interchangeable. NULLs yield NULL, NaNs yield NaN. // // Does not dispatch to Value.cmp() because sorting and comparisons // are different for f64 NaN and -0.0 values. #[allow(clippy::float_cmp)] Self::Equal(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { (Boolean(lhs), Boolean(rhs)) => Boolean(lhs == rhs), (Integer(lhs), Integer(rhs)) => Boolean(lhs == rhs), (Integer(lhs), Float(rhs)) => Boolean(lhs as f64 == rhs), (Float(lhs), Integer(rhs)) => Boolean(lhs == rhs as f64), (Float(lhs), Float(rhs)) => Boolean(lhs == rhs), (String(lhs), String(rhs)) => Boolean(lhs == rhs), (Null, _) | (_, Null) => Null, (lhs, rhs) => return errinput!("can't compare {lhs} and {rhs}"), }, Self::GreaterThan(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { #[allow(clippy::bool_comparison)] (Boolean(lhs), Boolean(rhs)) => Boolean(lhs > rhs), (Integer(lhs), Integer(rhs)) => Boolean(lhs > rhs), (Integer(lhs), Float(rhs)) => Boolean(lhs as f64 > rhs), (Float(lhs), Integer(rhs)) => Boolean(lhs > rhs as f64), (Float(lhs), Float(rhs)) => Boolean(lhs > rhs), (String(lhs), String(rhs)) => Boolean(lhs > rhs), (Null, _) | (_, Null) => Null, (lhs, rhs) => return errinput!("can't compare {lhs} and {rhs}"), }, Self::LessThan(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { #[allow(clippy::bool_comparison)] (Boolean(lhs), Boolean(rhs)) => Boolean(lhs < rhs), (Integer(lhs), Integer(rhs)) => Boolean(lhs < rhs), (Integer(lhs), Float(rhs)) => Boolean((lhs as f64) < rhs), (Float(lhs), Integer(rhs)) => Boolean(lhs < rhs as f64), (Float(lhs), Float(rhs)) => Boolean(lhs < rhs), (String(lhs), String(rhs)) => Boolean(lhs < rhs), (Null, _) | (_, Null) => Null, (lhs, rhs) => return errinput!("can't compare {lhs} and {rhs}"), }, Self::Is(expr, Null) => Boolean(expr.evaluate(row)? == Null), Self::Is(expr, Float(f)) if f.is_nan() => match expr.evaluate(row)? { Float(f) => Boolean(f.is_nan()), Null => Null, v => return errinput!("IS NAN can't be used with {}", v.datatype().unwrap()), }, Self::Is(_, v) => panic!("invalid IS value {v}"), // enforced by parser // Mathematical operations. Inputs must be numbers, but integers and // floats are interchangeable (float when mixed). NULLs yield NULL. // Errors on integer overflow, while floats yield infinity or NaN. Self::Add(lhs, rhs) => lhs.evaluate(row)?.checked_add(&rhs.evaluate(row)?)?, Self::Divide(lhs, rhs) => lhs.evaluate(row)?.checked_div(&rhs.evaluate(row)?)?, Self::Exponentiate(lhs, rhs) => lhs.evaluate(row)?.checked_pow(&rhs.evaluate(row)?)?, Self::Factorial(expr) => match expr.evaluate(row)? { Integer(i) if i < 0 => return errinput!("can't take factorial of negative number"), Integer(i) => (1..=i).try_fold(Integer(1), |p, i| p.checked_mul(&Integer(i)))?, Null => Null, value => return errinput!("can't take factorial of {value}"), }, Self::Identity(expr) => match expr.evaluate(row)? { v @ (Integer(_) | Float(_) | Null) => v, expr => return errinput!("can't take the identity of {expr}"), }, Self::Multiply(lhs, rhs) => lhs.evaluate(row)?.checked_mul(&rhs.evaluate(row)?)?, Self::Negate(expr) => match expr.evaluate(row)? { Integer(i) => Integer(-i), Float(f) => Float(-f), Null => Null, value => return errinput!("can't negate {value}"), }, Self::Remainder(lhs, rhs) => lhs.evaluate(row)?.checked_rem(&rhs.evaluate(row)?)?, Self::SquareRoot(expr) => match expr.evaluate(row)? { Integer(i) if i < 0 => return errinput!("can't take negative square root"), Integer(i) => Float((i as f64).sqrt()), Float(f) => Float(f.sqrt()), Null => Null, value => return errinput!("can't take square root of {value}"), }, Self::Subtract(lhs, rhs) => lhs.evaluate(row)?.checked_sub(&rhs.evaluate(row)?)?, // LIKE pattern matching, using _ and % as single- and // multi-character wildcards. Inputs must be strings. NULLs yield // NULL. There's no support for escaping an _ and %. Self::Like(lhs, rhs) => match (lhs.evaluate(row)?, rhs.evaluate(row)?) { (String(lhs), String(rhs)) => { // We could precompile the pattern if it's constant, instead // of recompiling it for every row, but this is fine. let pattern = format!("^{}$", regex::escape(&rhs).replace('%', ".*").replace('_', ".")); Boolean(regex::Regex::new(&pattern)?.is_match(&lhs)) } (String(_), Null) | (Null, String(_)) | (Null, Null) => Null, (lhs, rhs) => return errinput!("can't LIKE {lhs} and {rhs}"), }, }) } /// Recursively walks the expression tree depth-first, calling the given /// closure until it returns false. Returns true otherwise. pub fn walk(&self, visitor: &mut impl FnMut(&Expression) -> bool) -> bool { if !visitor(self) { return false; } match self { Self::Add(lhs, rhs) | Self::And(lhs, rhs) | Self::Divide(lhs, rhs) | Self::Equal(lhs, rhs) | Self::Exponentiate(lhs, rhs) | Self::GreaterThan(lhs, rhs) | Self::LessThan(lhs, rhs) | Self::Like(lhs, rhs) | Self::Multiply(lhs, rhs) | Self::Or(lhs, rhs) | Self::Remainder(lhs, rhs) | Self::Subtract(lhs, rhs) => lhs.walk(visitor) && rhs.walk(visitor), Self::Factorial(expr) | Self::Identity(expr) | Self::Is(expr, _) | Self::Negate(expr) | Self::Not(expr) | Self::SquareRoot(expr) => expr.walk(visitor), Self::Constant(_) | Self::Column(_) => true, } } /// Recursively walks the expression tree depth-first, calling the given /// closure until it returns true. Returns false otherwise. This is the /// inverse of walk(). pub fn contains(&self, visitor: &impl Fn(&Expression) -> bool) -> bool { !self.walk(&mut |e| !visitor(e)) } /// Transforms the expression by recursively applying the given closures /// depth-first to each node before/after descending. pub fn transform( mut self, before: &impl Fn(Self) -> Result<Self>, after: &impl Fn(Self) -> Result<Self>, ) -> Result<Self> { // Helper for transforming boxed expressions. let xform = |mut expr: Box<Expression>| -> Result<Box<Expression>> { *expr = expr.transform(before, after)?; Ok(expr) }; self = before(self)?; self = match self { Self::Add(lhs, rhs) => Self::Add(xform(lhs)?, xform(rhs)?), Self::And(lhs, rhs) => Self::And(xform(lhs)?, xform(rhs)?), Self::Divide(lhs, rhs) => Self::Divide(xform(lhs)?, xform(rhs)?), Self::Equal(lhs, rhs) => Self::Equal(xform(lhs)?, xform(rhs)?), Self::Exponentiate(lhs, rhs) => Self::Exponentiate(xform(lhs)?, xform(rhs)?), Self::GreaterThan(lhs, rhs) => Self::GreaterThan(xform(lhs)?, xform(rhs)?), Self::LessThan(lhs, rhs) => Self::LessThan(xform(lhs)?, xform(rhs)?), Self::Like(lhs, rhs) => Self::Like(xform(lhs)?, xform(rhs)?), Self::Multiply(lhs, rhs) => Self::Multiply(xform(lhs)?, xform(rhs)?), Self::Or(lhs, rhs) => Self::Or(xform(lhs)?, xform(rhs)?), Self::Remainder(lhs, rhs) => Self::Remainder(xform(lhs)?, xform(rhs)?), Self::SquareRoot(expr) => Self::SquareRoot(xform(expr)?), Self::Subtract(lhs, rhs) => Self::Subtract(xform(lhs)?, xform(rhs)?), Self::Factorial(expr) => Self::Factorial(xform(expr)?), Self::Identity(expr) => Self::Identity(xform(expr)?), Self::Is(expr, value) => Self::Is(xform(expr)?, value), Self::Negate(expr) => Self::Negate(xform(expr)?), Self::Not(expr) => Self::Not(xform(expr)?), expr @ (Self::Constant(_) | Self::Column(_)) => expr, }; self = after(self)?; Ok(self) } /// Converts the expression into conjunctive normal form, i.e. an AND of /// ORs, which is useful when optimizing plans. This is done by converting /// to negation normal form and then applying De Morgan's distributive law. pub fn into_cnf(self) -> Self { use Expression::*; let xform = |expr| { // We can't use a single match, since it needs deref patterns. let Or(lhs, rhs) = expr else { return expr }; match (*lhs, *rhs) { // (x AND y) OR z โ†’ (x OR z) AND (y OR z) (And(l, r), rhs) => And(Or(l, rhs.clone().into()).into(), Or(r, rhs.into()).into()), // x OR (y AND z) โ†’ (x OR y) AND (x OR z) (lhs, And(l, r)) => And(Or(lhs.clone().into(), l).into(), Or(lhs.into(), r).into()), // Otherwise, do nothing. (lhs, rhs) => Or(lhs.into(), rhs.into()), } }; self.into_nnf().transform(&|e| Ok(xform(e)), &Ok).unwrap() // infallible } /// Converts the expression into negation normal form. This pushes NOT /// operators into the tree using De Morgan's laws, such that they're always /// below other logical operators. It is a useful intermediate form for /// applying other logical normalizations. pub fn into_nnf(self) -> Self { use Expression::*; let xform = |expr| { let Not(inner) = expr else { return expr }; match *inner { // NOT (x AND y) โ†’ (NOT x) OR (NOT y) And(lhs, rhs) => Or(Not(lhs).into(), Not(rhs).into()), // NOT (x OR y) โ†’ (NOT x) AND (NOT y) Or(lhs, rhs) => And(Not(lhs).into(), Not(rhs).into()), // NOT NOT x โ†’ x Not(inner) => *inner, // Otherwise, do nothing. expr => Not(expr.into()), } }; self.transform(&|e| Ok(xform(e)), &Ok).unwrap() // never fails } /// Converts the expression into conjunctive normal form as a vector of /// ANDed expressions (instead of nested ANDs). pub fn into_cnf_vec(self) -> Vec<Self> { let mut cnf = Vec::new(); let mut stack = vec![self.into_cnf()]; while let Some(expr) = stack.pop() { if let Self::And(lhs, rhs) = expr { stack.extend([*rhs, *lhs]); // push lhs last to pop it first } else { cnf.push(expr); } } cnf } /// Creates an expression by ANDing together a vector, or None if empty. pub fn and_vec(exprs: Vec<Expression>) -> Option<Self> { let mut iter = exprs.into_iter(); let mut expr = iter.next()?; for rhs in iter { expr = Expression::And(expr.into(), rhs.into()); } Some(expr) } /// Checks if an expression is a single column lookup (i.e. a disjunction of /// = or IS NULL/NAN for a single column), returning the column index. pub fn is_column_lookup(&self) -> Option<usize> { use Expression::*; match &self { // Column/constant equality can use index lookups. NULL and NaN are // handled in into_column_values(). Equal(lhs, rhs) => match (lhs.as_ref(), rhs.as_ref()) { (Column(c), Constant(_)) | (Constant(_), Column(c)) => Some(*c), _ => None, }, // IS NULL and IS NAN can use index lookups. Is(expr, _) => match expr.as_ref() { Column(c) => Some(*c), _ => None, }, // All OR branches must be lookups on the same column: // id = 1 OR id = 2 OR id = 3. Or(lhs, rhs) => match (lhs.is_column_lookup(), rhs.is_column_lookup()) { (Some(l), Some(r)) if l == r => Some(l), _ => None, }, _ => None, } } /// Extracts column lookup values for the given column. Panics if the /// expression isn't a lookup of the given column, i.e. is_column_lookup() /// must return true for the expression. pub fn into_column_values(self, index: usize) -> Vec<Value> { use Expression::*; match self { Equal(lhs, rhs) => match (*lhs, *rhs) { (Column(column), Constant(value)) | (Constant(value), Column(column)) => { assert_eq!(column, index, "unexpected column"); // NULL and NAN index lookups are for IS NULL and IS NAN. // Equality shouldn't match anything, return empty vec. if value.is_undefined() { Vec::new() } else { vec![value] } } (lhs, rhs) => panic!("unexpected expression {:?}", Equal(lhs.into(), rhs.into())), }, // IS NULL and IS NAN can use index lookups. Is(expr, value) => match *expr { Column(column) => { assert_eq!(column, index, "unexpected column"); vec![value] } expr => panic!("unexpected expression {expr:?}"), }, Or(lhs, rhs) => { let mut values = lhs.into_column_values(index); values.extend(rhs.into_column_values(index)); values } expr => panic!("unexpected expression {expr:?}"), } } /// Replaces column references with the given column. pub fn replace_column(self, from: usize, to: usize) -> Self { let xform = |expr| match expr { Expression::Column(i) if i == from => Expression::Column(to), expr => expr, }; self.transform(&|e| Ok(xform(e)), &Ok).unwrap() // infallible } /// Shifts column references by the given amount. pub fn shift_column(self, diff: isize) -> Self { let xform = |expr| match expr { Expression::Column(i) => Expression::Column((i as isize + diff) as usize), expr => expr, }; self.transform(&|e| Ok(xform(e)), &Ok).unwrap() // infallible } } ``` ] === ๆ€ป็ป“ Type่ฟ™ไธ€้ƒจๅˆ†ๆ˜ฏๆฏ”่พƒ็ฎ€ๅ•็š„๏ผŒๆฒกๆœ‰ๅคชๅคš็š„ๅคๆ‚็š„้€ป่พ‘ใ€‚ไธป่ฆๆ˜ฏๅฎšไน‰ไบ†ไธ€ไบ›ๅŸบๆœฌ็š„ๆ•ฐๆฎ็ป“ๆž„๏ผŒๆฏ”ๅฆ‚่กจ็ป“ๆž„๏ผŒๅˆ—็ป“ๆž„๏ผŒ่กจ่พพๅผ็ญ‰ใ€‚่กจ่พพๅผๆ˜ฏไธ€ไธช้€’ๅฝ’็š„ๆ•ฐๆฎ็ป“ๆž„๏ผŒๅฏไปฅ่กจ็คบๅคๆ‚็š„้€ป่พ‘่กจ่พพๅผใ€‚่ฟ™ไธ€้ƒจๅˆ†็š„ไปฃ็ ไธป่ฆๆ˜ฏๅฎšไน‰ไบ†่ฟ™ไบ›ๆ•ฐๆฎ็ป“ๆž„๏ผŒไปฅๅŠๅฏน่ฟ™ไบ›ๆ•ฐๆฎ็ป“ๆž„็š„ไธ€ไบ›ๆ“ไฝœใ€‚
https://github.com/Jollywatt/typst-fletcher
https://raw.githubusercontent.com/Jollywatt/typst-fletcher/master/src/draw.typ
typst
MIT License
#import "utils.typ": * #import "marks.typ": * #import "coords.typ": uv-to-xy #let DEBUG_COLOR = rgb("f008") #let DEBUG_COLOR2 = rgb("0f08") #let draw-node(node, debug: 0) = { let result = { if node.stroke != none or node.fill != none { cetz.draw.group({ cetz.draw.translate(node.pos.xyz) for (i, extrude) in node.extrude.enumerate() { cetz.draw.set-style( fill: if i == 0 { node.fill }, stroke: node.stroke, ) (node.shape)(node, extrude) } }) } if node.label != none { cetz.draw.content( node.pos.xyz, box( // wrapping label in a box allows user to control its alignment align(center + horizon, node.label), stroke: if debug >= 3 { DEBUG_COLOR2 + 0.25pt }, width: node.size.at(0) - 2*node.inset, height: node.size.at(1) - 2*node.inset, ), anchor: "center", ) } } if node.layer != 0 { result = cetz.draw.on-layer(node.layer, result) } (node.post)(result) // post-process (e.g., hide) // Draw debug stuff if debug >= 1 { // dot at node anchor cetz.draw.circle( node.pos.xyz, radius: 0.5pt, fill: DEBUG_COLOR, stroke: none, ) } if debug >= 2 and node.radius != 0pt { // node bounding rectangle cetz.draw.rect( ..rect-at(node.pos.xyz, node.size), stroke: DEBUG_COLOR + .1pt, ) // node anchoring outline (what edges snap to) cetz.draw.group({ cetz.draw.translate(node.pos.xyz) cetz.draw.set-style( stroke: DEBUG_COLOR2 + 0.25pt, fill: none, ) (node.shape)(node, node.outset) }) } } /// Draw an edge label at point along a curve. /// /// Label is drawn near the point `curve(edge.label-pos)`, respecting the label /// options of `edge()` such as #param[edge][label-side] and /// #param[edge][label-angle]. /// /// - edge (dictionary): Edge object. Must include: /// - `label-pos` /// - `label-sep` /// - `label-side` /// - `label-anchor` /// - `label-angle` /// - `label-wrapper` /// - curve (function): Parametric curve $RR -> RR^2$ describing the shape of /// the edge in $x y$ coordinates. #let place-edge-label-on-curve(edge, curve, debug: 0) = { let curve-point = curve(edge.label-pos) let curve-point-ฮต = curve(edge.label-pos + 1e-3) let ฮธ = wrap-angle-180(angle-between(curve-point, curve-point-ฮต)) let ฮธ-normal = ฮธ + if edge.label-side == right { +90deg } else { -90deg } if type(edge.label-angle) == alignment { edge.label-angle = ฮธ - ( right: 0deg, top: 90deg, left: 180deg, bottom: 270deg, ).at(repr(edge.label-angle)) } else if edge.label-angle == auto { edge.label-angle = ฮธ if calc.abs(edge.label-angle) > 90deg { edge.label-angle += 180deg } } if edge.label-anchor == auto { edge.label-anchor = angle-to-anchor(ฮธ-normal - edge.label-angle) } let label-pos = (to: curve-point, rel: (ฮธ-normal, -edge.label-sep)) cetz.draw.content( label-pos, box( { set text(edge.label-size) (edge.label-wrapper)(edge) }, stroke: if debug >= 2 { DEBUG_COLOR2 + 0.25pt }, ), angle: edge.label-angle, anchor: if edge.label-anchor != auto { edge.label-anchor }, ) if debug >= 2 { cetz.draw.circle( label-pos, radius: 0.75pt, stroke: none, fill: DEBUG_COLOR2, ) } } // Get the arrow head adjustment for a given extrusion distance. // // Returns a pair `(from, to)` of distances. // If `from < 0pt` and `to > 0pt`, the path length of the edge increases. #let cap-offsets(edge, y) = { (0, 1).map(pos => { let mark = edge.marks.find(mark => calc.abs(mark.pos - pos) < 1e-3) if mark == none { return 0pt } let is-tip = (pos == 0) == mark.rev let sign = if mark.rev { -1 } else { +1 } let x = cap-offset( mark + (tip: is-tip), sign*y/edge.stroke.thickness, ) let origin = if is-tip { mark.tip-origin } else { mark.tail-origin } x -= origin*float(mark.scale) sign*x*edge.stroke.thickness }) } #let with-decorations(edge, path) = { if edge.decorations == none { return path } let has-mark-at(t) = edge.marks.find(mark => calc.abs(mark.pos - t) < 1e-3 ) != none let decor = edge.decorations.with(stroke: edge.stroke) // TODO: should this be an absolute offset, not 10% the path length? let ฮต = 1e-3 // cetz assertions sometimes fail from floating point errors decor = decor.with( start: if has-mark-at(0) { 0.1 } else { ฮต } * 100%, stop: if has-mark-at(1) { 0.9 } else { 1 - ฮต } * 100%, ) decor(path) } /// Draw a straight edge. /// /// - edge (dictionary): The edge object, a dictionary, containing: /// - `vertices`: an array of two points, the line's start and end points. /// - `extrude`: An array of extrusion lengths to apply a multi-stroke effect /// with. /// - `stroke`: The stroke style. /// - `marks`: An array of marks to draw along the edge. /// - `label`: Content for label. /// - `label-side`, `label-pos`, `label-sep`, and `label-anchor`. /// - debug (int): Level of debug details to draw. #let draw-edge-line(edge, debug: 0) = { let (from, to) = edge.final-vertices let ฮธ = angle-between(from, to) // Draw line(s), one for each extrusion shift for shift in edge.extrude { let offsets = cap-offsets(edge, shift) let points = (from, to).zip(offsets) .map(((point, offset)) => { // Shift line sideways (for multi-stroke effect) point = (rel: (ฮธ + 90deg, shift), to: point) // Shift end points lengthways depending on marks point = (rel: (ฮธ, offset), to: point) point }) let obj = cetz.draw.line( ..points, stroke: edge.stroke, ) with-decorations(edge, obj) } // Draw marks let curve(t) = vector.lerp(from, to, t) for mark in edge.marks { place-mark-on-curve(mark, curve, stroke: edge.stroke, debug: debug >= 3) } // Draw label if edge.label != none { // Choose label anchor based on edge direction, // preferring to place labels above the edge if edge.label-side == auto { edge.label-side = if calc.abs(ฮธ) < 90deg { left } else { right } } place-edge-label-on-curve(edge, curve, debug: debug) } } /// Draw a bent edge. /// /// - edge (dictionary): The edge object, a dictionary, containing: /// - `vertices`: an array of two points, the arc's start and end points. /// - `bend`: The angle of the arc. /// - `extrude`: An array of extrusion lengths to apply a multi-stroke effect /// with. /// - `stroke`: The stroke style. /// - `marks`: An array of marks to draw along the edge. /// - `label`: Content for label. /// - `label-side`, `label-pos`, `label-sep`, and `label-anchor`. /// - debug (int): Level of debug details to draw. #let draw-edge-arc(edge, debug: 0) = { let (from, to) = edge.final-vertices // Determine the arc from the stroke end points and bend angle let (center, radius, start, stop) = get-arc-connecting-points(from, to, edge.bend) let bend-dir = if edge.bend > 0deg { +1 } else { -1 } // Draw arc(s), one for each extrusion shift for shift in edge.extrude { // Adjust arc angles to accommodate for cap offsets let (ฮด-start, ฮด-stop) = cap-offsets(edge, shift) .map(arclen => -bend-dir*arclen/radius*1rad) let obj = cetz.draw.arc( center, radius: radius + shift, start: start + ฮด-start, stop: stop + ฮด-stop, anchor: "origin", stroke: edge.stroke, ) with-decorations(edge, obj) } // Draw marks let curve(t) = vector.add(center, vector-polar(radius, lerp(start, stop, t))) for mark in edge.marks { place-mark-on-curve(mark, curve, stroke: edge.stroke, debug: debug >= 3) } // Draw label if edge.label != none { if edge.label-side == auto { // Choose label side to be on outside of arc edge.label-side = if edge.bend > 0deg { left } else { right } } place-edge-label-on-curve(edge, curve, debug: debug) } } /// Draw a multi-segment edge /// /// - edge (dictionary): The edge object, a dictionary, containing: /// - `vertices`: an array of at least two points to draw segments between. /// - `corner-radius`: Radius of curvature between segments. /// - `extrude`: An array of extrusion lengths to apply a multi-stroke effect /// with. /// - `stroke`: The stroke style. /// - `marks`: An array of marks to draw along the edge. /// - `label`: Content for label. /// - `label-side`, `label-pos`, `label-sep`, and `label-anchor`. /// - debug (int): Level of debug details to draw. #let draw-edge-polyline(edge, debug: 0) = { let verts = edge.final-vertices let n-segments = verts.len() - 1 // angles of each segment let ฮธs = range(n-segments).map(i => { let (vert, vert-next) = (verts.at(i), verts.at(i + 1)) assert(vert != vert-next, message: "Adjacent vertices must be distinct.") angle-between(vert, vert-next) }) // round corners let calculate-rounded-corner(i) = { let pt = verts.at(i) let ฮ”ฮธ = wrap-angle-180(ฮธs.at(i) - ฮธs.at(i - 1)) let dir = if ฮ”ฮธ > 0deg { +1 } else { -1 } // +1 if ccw, -1 if cw let ฮธ-normal = ฮธs.at(i - 1) + ฮ”ฮธ/2 + 90deg // direction to center of curvature let radius = edge.corner-radius // radius *= 90deg/calc.max(calc.abs(ฮ”ฮธ), 45deg) // visual adjustment so that tighter bends have smaller radii radius *= 1 + calc.cos(ฮ”ฮธ) radius += if dir > 0 { calc.max(..edge.extrude) } else { -calc.min(..edge.extrude) } radius *= dir // ??? makes math easier or something if calc.abs(ฮ”ฮธ) > 179deg { // singular line; skip arc ( arc-center: pt, arc-radius: 0*radius, start: ฮธs.at(i - 1) - 90deg, delta: wrap-angle-180(ฮ”ฮธ), line-shift: 0*radius, // distance from vertex to beginning of arc ) } else { // distance from vertex to center of curvature let dist = radius/calc.cos(ฮ”ฮธ/2) ( arc-center: vector.add(pt, vector-polar(dist, ฮธ-normal)), arc-radius: radius, start: ฮธs.at(i - 1) - 90deg, delta: wrap-angle-180(ฮ”ฮธ), line-shift: radius*calc.tan(ฮ”ฮธ/2), // distance from vertex to beginning of arc ) } } let rounded-corners if edge.corner-radius != none { rounded-corners = range(1, ฮธs.len()).map(calculate-rounded-corner) } let lerp-scale(t, i) = { let ฯ„ = t*n-segments - i if 0 < ฯ„ and ฯ„ <= 1 or i == 0 and ฯ„ <= 0 or i == n-segments - 1 and 1 < ฯ„ { ฯ„ } } let debug-stroke = edge.stroke.thickness/4 + DEBUG_COLOR2 // phase keeps track of how to offset dash patterns // to ensure continuity between segments let phase = 0pt let stroke-with-phase(phase) = stroke-to-dict(edge.stroke) + ( dash: if type(edge.stroke.dash) == dictionary { (array: edge.stroke.dash.array, phase: phase) } ) // draw each segment for i in range(n-segments) { let (from, to) = (verts.at(i), verts.at(i + 1)) let marks = () let ฮ”phase = 0pt if edge.corner-radius == none { // add phantom marks to ensure segment joins are clean if i > 0 { let ฮ”ฮธ = ฮธs.at(i) - ฮธs.at(i - 1) marks.push(( inherit: "bar", pos: 0, angle: 90deg - ฮ”ฮธ/2, hide: true, )) } if i < ฮธs.len() - 1 { let ฮ”ฮธ = ฮธs.at(i + 1) - ฮธs.at(i) marks.push(( inherit: "bar", pos: 1, angle: 90deg + ฮ”ฮธ/2, hide: true, )) } ฮ”phase += vector-len(vector.sub(from, to)) } else { // rounded corners if i > 0 { // offset start of segment to give space for previous arc let (line-shift,) = rounded-corners.at(i - 1) from = vector.add(from, vector-polar(line-shift, ฮธs.at(i))) } if i < ฮธs.len() - 1 { let (arc-center, arc-radius, start, delta, line-shift) = rounded-corners.at(i) to = vector.add(to, vector-polar(-line-shift, ฮธs.at(i))) ฮ”phase += vector-len(vector.sub(from, to)) for d in edge.extrude { if delta != 0deg { cetz.draw.arc( arc-center, radius: arc-radius - d, start: start, delta: delta, anchor: "origin", stroke: stroke-with-phase(phase + ฮ”phase), ) } if debug >= 4 { cetz.draw.on-layer(1, cetz.draw.circle( arc-center, radius: arc-radius - d, stroke: debug-stroke, )) } } ฮ”phase += delta/1rad*arc-radius } } marks = marks.map(resolve-mark) // distribute original marks across segments marks += edge.marks.map(mark => { mark.pos = lerp-scale(mark.pos, i) mark }).filter(mark => mark.pos != none) let label-pos = lerp-scale(edge.label-pos, i) let label-options = if label-pos == none { (label: none) } else { (label-pos: label-pos, label: edge.label) } draw-edge-line( edge + ( kind: "line", final-vertices: (from, to), marks: marks, stroke: stroke-with-phase(phase), ) + label-options, debug: debug, ) phase += ฮ”phase } if debug >= 4 { cetz.draw.line( ..verts, stroke: debug-stroke, ) } } /// Of all the intersection points within a set of CeTZ objects, find the one /// which is farthest from a target point and pass it to a callback. /// /// If no intersection points are found, use the target point itself. /// /// - objects (cetz array, none): Objects to search within for intersections. If /// `none`, callback is immediately called with `target`. /// - target (point): Target point to sort intersections by proximity with, and /// to use as a fallback if no intersections are found. #let find-farthest-intersection(objects, target, callback) = { if objects == none { return callback(target) } let node-name = "intersection-finder" cetz.draw.hide(cetz.draw.intersections(node-name, objects)) cetz.draw.get-ctx(ctx => { let calculate-anchors = ctx.nodes.at(node-name).anchors let anchor-names = calculate-anchors(()) let anchor-points = anchor-names.map(calculate-anchors) .map(point => { // funky disagreement between coordinate systems?? point.at(1) *= -1 vector-2d(vector.scale(point, 1cm)) }).sorted(key: point => vector-len(vector.sub(point, target))) let anchor = anchor-points.at(-1, default: target) callback(anchor) }) } #let find-anchor-pair((from-group, to-group), (from-point, to-point), callback) = { find-farthest-intersection(from-group, from-point, from-anchor => { find-farthest-intersection(to-group, to-point, to-anchor => { callback((from-anchor, to-anchor)) }) }) } /// Get the anchor point around a node outline at a certain angle. #let get-node-anchor(node, ฮธ, callback) = { let outline = cetz.draw.group({ cetz.draw.translate(node.pos.xyz) (node.shape)(node, node.outset) }) let dummy-line = cetz.draw.line( node.pos.xyz, (rel: (ฮธ, 10*node.radius)) ) find-farthest-intersection(outline + dummy-line, node.pos.xyz, callback) } /// Return the anchor point for an edge connecting to a node with the "defocus" /// adjustment. /// /// Basically, for very long/wide nodes, don't make edges coming in from all /// angles go to the exact node center, but "spread them out" a bit. /// /// See https://www.desmos.com/calculator/irt0mvixky. #let defocus-adjustment(node, ฮธ) = { if node == none { return (0pt, 0pt) } let ฮผ = calc.pow(node.aspect, node.defocus) ( calc.max(0pt, node.size.at(0)/2*(1 - 1/ฮผ))*calc.cos(ฮธ), calc.max(0pt, node.size.at(1)/2*(1 - ฮผ/1))*calc.sin(ฮธ), ) } #let draw-anchored-line(edge, nodes, debug: 0) = { let (from, to) = edge.final-vertices let ฮธ = angle-between(from, to) + 90deg // TODO: do defocus adjustment sensibly if nodes.at(0).len() == 1 { from = vector.add(from, defocus-adjustment(nodes.at(0).at(0), ฮธ - 90deg)) } if nodes.at(1).len() == 1 { to = vector.add(to, defocus-adjustment(nodes.at(1).at(0), ฮธ + 90deg)) } let dummy-line = cetz.draw.line( from, to, ) let intersection-objects = nodes.map(nodes => { for node in nodes { cetz.draw.group({ cetz.draw.translate(node.pos.xyz) (node.shape)(node, node.outset) }) } // if node == none { return } dummy-line }) find-anchor-pair(intersection-objects, (from, to), anchors => { let obj = draw-edge-line(edge + ( final-vertices: anchors, ), debug: debug) (edge.post)(obj) // post-process (e.g., hide) }) } #let draw-anchored-arc(edge, nodes, debug: 0) = { let (from, to) = edge.final-vertices let ฮธ = angle-between(from, to) let ฮธs = (ฮธ + edge.bend, ฮธ - edge.bend + 180deg) let dummy-lines = (from, to).zip(ฮธs) .map(((point, ฯ†)) => cetz.draw.line( point, vector.add(point, vector-polar(10cm, ฯ†)), // ray emanating from node )) let intersection-objects = nodes.zip(dummy-lines).map(((nodes, dummy-line)) => { for node in nodes { cetz.draw.group({ cetz.draw.translate(node.pos.xyz) (node.shape)(node, node.outset) }) } // if node == none { return } dummy-line }) find-anchor-pair(intersection-objects, (from, to), anchors => { let obj = draw-edge-arc(edge + (final-vertices: anchors), debug: debug) (edge.post)(obj) // post-process (e.g., hide) }) } #let draw-anchored-polyline(edge, nodes, debug: 0) = { assert(edge.vertices.len() >= 2, message: "Polyline requires at least two vertices") let verts = edge.final-vertices let (from, to) = (edge.final-vertices.at(0), edge.final-vertices.at(-1)) let end-segments = ( edge.final-vertices.slice(0, 2), // first two vertices edge.final-vertices.slice(-2), // last two vertices ) let dummy-lines = end-segments.map(points => cetz.draw.line(..points)) let intersection-objects = nodes.zip(dummy-lines).map(((nodes, dummy-line)) => { for node in nodes { cetz.draw.group({ cetz.draw.translate(node.pos.xyz) (node.shape)(node, node.outset) }) } // if node == none { return } dummy-line }) find-anchor-pair(intersection-objects, (from, to), anchors => { let edge = edge edge.final-vertices.at(0) = anchors.at(0) edge.final-vertices.at(-1) = anchors.at(1) let obj = draw-edge-polyline(edge, debug: debug) (edge.post)(obj) // post-process (e.g., hide) }) } #let draw-edge(edge, nodes, ..args) = { let obj = if edge.kind == "line" { draw-anchored-line(edge, nodes, ..args) } else if edge.kind == "arc" { draw-anchored-arc(edge, nodes, ..args) } else if edge.kind == "poly" { draw-anchored-polyline(edge, nodes, ..args) } else { error("Invalid edge kind #0.", edge.kind) } if edge.layer != 0 { obj = cetz.draw.on-layer(edge.layer, obj)} obj } /// Draw diagram coordinate axes. /// /// - grid (dictionary): Dictionary specifying the diagram's grid, containing: /// - `origin: (u-min, v-min)`, the minimum values of elastic coordinates, /// - `flip: (x, y, xy)`, the axes orientation (see `interpret-axes()`), /// - `centers: (x-centers, y-centers)`, the physical offsets of each row and each column, /// - `cell-sizes: (x-sizes, y-sizes)`, the physical sizes of each row and /// each column. #let draw-debug-axes(grid, debug: false) = { let (x-lims, y-lims) = range(2).map(axis => ( grid.centers.at(axis).at( 0) - grid.cell-sizes.at(axis).at( 0)/2, grid.centers.at(axis).at(-1) + grid.cell-sizes.at(axis).at(-1)/2, )) let (u-min, v-min) = grid.origin let (u-len, v-len) = grid.centers.map(array.len) if grid.flip.xy { (u-len, v-len) = (v-len, u-len) } let v-range = range(v-min, v-min + v-len) let u-range = range(u-min, u-min + u-len) if grid.flip.x { u-range = u-range.rev() } if grid.flip.y { v-range = v-range.rev() } if grid.flip.xy { (u-range, v-range) = (v-range, u-range) } import cetz.draw draw.group({ let (a, b) = array.zip(x-lims, y-lims) if a == b { b = vector.add(b, (1e-3pt, 1e-3pt)) } draw.rect(a, b, stroke: DEBUG_COLOR + .5pt) draw.set-style(stroke: ( paint: DEBUG_COLOR, thickness: .3pt, dash: "densely-dotted", )) for axis in range(2) { let swap(a, b) = if axis != 1 { (a, b) } else { (b, a) } let x-range = (u-range, v-range).at(axis) let (min, max) = (y-lims, x-lims).at(axis) for (i, x) in x-range.enumerate() { // coordinate line draw.line( swap(grid.centers.at(axis).at(i), min), swap(grid.centers.at(axis).at(i), max), ) // size bracket let size = grid.cell-sizes.at(axis).at(i) draw.rect( (to: swap(grid.centers.at(axis).at(i), min), rel: swap(-size/2, 0)), (to: swap(grid.centers.at(axis).at(i), min), rel: swap(+size/2, -1pt)), fill: DEBUG_COLOR, stroke: none, ) // coordinate label draw.content( (to: swap(grid.centers.at(axis).at(i), min), rel: swap(0, -.2em)), text(fill: DEBUG_COLOR, size: .7em)[#x], anchor: if axis == 0 { "north" } else { "east" }, ) } } if debug { let (u-label, v-label) = if grid.flip.xy { ($arrow$, $arrow.t.twohead$) } else { ($u$, $v$) } let dir-to-arrow(dir) = { if dir == ltr { $arrow.r$ } else if dir == rtl { $arrow.l$ } else if dir == ttb { $arrow.b$ } else if dir == btt { $arrow.t$ } } draw.content( (x-lims.at(0), y-lims.at(0)), pad(0.2em, text(0.5em, DEBUG_COLOR, $(#grid.axes.map(dir-to-arrow).join($,$))$)), anchor: "north-east" ) } }) } // Find candidate nodes that an edge should snap to // // Returns an array of zero or more nodes. False positives are acceptable. #let find-snapping-nodes(grid, nodes, key) = { if key == none { return () } if type(key) == label { return nodes.filter(node => node.name == key) } if type(key) == array and key.len() == 2 { let xy-pos = key let candidates = nodes.filter(node => { if node.snap == false { return false } let verdict = point-is-in-rect(xy-pos, ( center: node.pos.xyz, size: node.size, )) verdict }) if candidates.len() > 0 { // filter out nodes with lower snap priority let max-snap-priority = calc.max(..candidates.map(node => node.snap)) candidates = candidates.filter(node => node.snap == max-snap-priority) } return candidates } error("Couldn't find node corresponding to #0 in diagram.", key) } #let draw-diagram( grid, nodes, edges, debug: 0, ) = { let node-finder = find-snapping-nodes.with(grid, nodes) let first-last(x) = (x.at(0), x.at(-1)) for edge in edges { let snap-to-nodes = edge.snap-to.zip(first-last(edge.vertices), first-last(edge.final-vertices)).enumerate() .map(((i, (given, raw, xyz))) => { let key = map-auto(given, if type(raw) == label { raw } else { xyz }) let node = node-finder(key) node }) draw-edge(edge, snap-to-nodes, debug: debug) } for node in nodes { draw-node(node, debug: debug) } if debug >= 1 { draw-debug-axes(grid, debug: debug >= 2) } } /// Make diagram contents invisible, with or without affecting layout. Works by /// wrapping final drawing objects in `cetz.draw.hide`. /// /// #example(``` /// rect(diagram({ /// fletcher.hide({ /// node((0,0), [Can't see me]) /// edge("->") /// }) /// node((1,1), [Can see me]) /// })) /// ```) /// /// - objects (content, array): Diagram objects to hide. /// - bounds (bool): If `false`, layout is as if the objects were never there; /// if `true`, the layout treats the objects is present but invisible. #let hide(objects, bounds: true) = { if type(objects) == array { objects = objects.join() } let seq = objects + [] seq.children.map(child => { if child.func() == metadata { let value = child.value value.post = cetz.draw.hide.with(bounds: bounds) metadata(value) } else { child } }).join() }
https://github.com/saurabtharu/Internship-repo
https://raw.githubusercontent.com/saurabtharu/Internship-repo/main/Internship%20Report%20-%20typst/main.typ
typst
#import "./template.typ": * #show raw.where(block: true): block.with( // fill: luma(240), inset: (x:5pt,y: 10pt), outset: (x:0pt, y: 1pt), radius: 7pt, // stroke: ) // #show raw.where(block: false): box.with( // // , // inset: (x: 3pt, y: 0pt), // outset: (y: 3pt), // radius: 2pt, // ) #show heading.where(level: 1): set text(16pt) #show heading.where(level: 1): set align(center) #show heading.where(level: 2): set text(14pt) #show heading.where(level: 3): set text(12pt) #show heading.where(level: 4): set text(12pt) #show heading.where(level: 5): set text(12pt) #set par( justify: true, ) // For paragraph spacing #show par: set block(spacing: 1.65em) /* If the lines are separated by parbreack() */ // For line spacing #show par: set par(leading: 1em) #set page( margin: (top: 1in, bottom: 1in, left: 1.25in, right: 1in), binding: left, header: [ #set text(10pt) #smallcaps[] ], ) #set text(font: "Times New Roman") /******************************************************************/ #set page(numbering: "i") #counter(page).update(1) #include "chapters/0-cover.typ" // #include "chapters/0-cover-abhijeet.typ" #include "./chapters/00-cert-ack.typ" // #include "chapters/00-cert-ack-abhijeet.typ" #include "./chapters/01-abstract.typ" #include "./chapters/02-toc-list_of_abb-fig-tables.typ" #set page(numbering: "1") #counter(page).update(1) #set heading(numbering: none) #include "chapters/chapter-1-intro.typ" #include "chapters/chapter-2-org details and literature review.typ" #include "chapters/chapter-3-intern activities.typ" #include "chapters/chapter-4-conclusion and learning outcomes.typ" #include "chapters/ref-appendix.typ"
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/PSD/homework5/homework.typ
typst
MIT License
#import "@preview/klaro-ifsc-sj:0.1.0": report #import "@preview/codelst:2.0.1": sourcecode #show heading: set block(below: 1.5em) #show par: set block(spacing: 1.5em) #set text(font: "Arial", size: 12pt) #set text(lang: "pt") #set page( footer: "Engenharia de Telecomunicaรงรตes - IFSC-SJ", ) #show: doc => report( title: "Projeto de Filtros IIR", subtitle: "Processamento de Sinais Digitais", authors: ("<NAME>",), date: "12 de Agosto de 2024", doc, ) = Introduรงรฃo O objetivo deste relatรณrio รฉ apresentar o desenvolvimento do projeto de filtros IIR para o processamento de sinais digitais. O projeto foi desenvolvido utilizando o MATLAB e o Simulink, e tem como objetivo a filtragem de sinais digitais para a separaรงรฃo de componentes cossenoidais em um sinal composto. = Questรฃo 1 Usando a transformaรงรฃo bilinear, projete um filtro passa-baixas Butterworth que atenda as seguintes especificaรงรตes: $ 0.9 <= |H(e^{j omega})| <= 1 $ $ 0 <= omega <= 0.2 pi $ $ |H(e^{j omega})| <= 0.2 $ $ 0.3 pi <= omega <= pi $ Considere tambรฉm que: - Ts (tempo de amostragem) = 2 - Faรงa o mesmo projeto usando o MATLAB ou simulink. Plote a resposta em frequรชncia == Projeto do Filtro IIR no Simulink: === Prรฉ-Distorรงรฃo do Sinal: O primeiro passo no desenvolvimento do projeto foi a montagem do filtro IIR no Simulink. Utilizamos a ferramenta para alterar os parรขmetros do filtro procurando pelos valores que atendessem as especificaรงรตes de banda de passagem e de rejeiรงรฃo. Seguindo a formula para transformaรงรฃo bilinear para transformar a frequรชncia analรณgica em frequรชncia digital: $ omega = 2/"Ts" tan(omega/2) $ Desta forma, temos que o script matlab corresponte รฉ: #sourcecode[```matlab wp = 0.2*pi; wr = 0.3*pi; ts = 2; omega_ap = (2/ts)*tan(wp/2) omega_ar = (2/ts)*tan(wr/2) ```] === Normalizaรงรฃo do Filtro: A normalizaรงรฃo do filtro รฉ realizada para que o filtro projetado atenda as especificaรงรตes de banda de passagem e de rejeiรงรฃo. Para o processo de normalizaรงรฃo, seguimos a tabela apresentada em aula que contรฉm a seguinte transformada: $ Omega'_p = 1/a $ $ Omega'_r = 1/a (Omega_"r"/Omega_"p") $ Desta forma, temos que o script matlab corresponte รฉ: #sourcecode[```matlab a = 1; omega_p_linha = 1/a omega_r_linha = omega_p_linha * (omega_ar/omega_ap) ```] === Calculo das atenuaรงรตes: Para o calculo das atenuaรงรตes, utilizamos a formula apresentada em aula para obter o valor de ganho em dB para a banda de passagem e de rejeiรงรฃo: - Para a banda de passagem: $ G_p = 20 log_10 (1 - sigma_p) $ - Para a banda de rejeiรงรฃo: $ G_r = 20 log_10 (sigma_r) $ Desta forma, temos que o script matlab corresponte รฉ: #sourcecode[```matlab sigma_p = 0.9; sigma_r = 0.2; atenuacao_p = -1 * (20*log10(sigma_p)) atenuacao_r = -1 * (20*log10(sigma_r)) ```] === Calculo dos parรขmetros do filtro: Em seguida podemos calcular os demais parรขmetros do filtro, que sรฃo dados atravรฉs das seguintes espressรตes: - Calculo do fator de normalizaรงรฃo: $ epsilon.alt = sqrt(10^(0,1,A_p) -1) $ - Calculo da ordem do filtro: $ n >= log_10((10^(0,1,A_r) -1) / epsilon.alt^2) / (2 log_10 Omega'_r) $ Desta forma, aplicando na sintaxe do matlab, temos que o script corresponte รฉ: #sourcecode[```matlab eps = sqrt((10^(0.1*atenuacao_p))-1) numerador = log10((10^(0.1*atenuacao_r)-1) / eps^2); denominador = 2*log10(omega_r_linha); n = ceil(numerador/denominador) ```] === Calculo das Raรญzes do Filtro: Em seguida, podemos calcular as raรญzes do filtro utilizando a funรงรฃo roots do matlab, para isso, utilizamos a seguinte formula: $ 1 + epsilon.alt^2 (-s'^2)^n = 0 $ Desta, forma, como possuimos um filtro de ordem 12, temos que o script matlab corresponte รฉ: #sourcecode[```matlab roots([eps^2 0 0 0 0 0 0 0 0 0 0 0 1]) % Raizes encontradas: % -1.0900 + 0.2921i % -1.0900 - 0.2921i % -0.7979 + 0.7979i % -0.7979 - 0.7979i % -0.2921 + 1.0900i % -0.2921 - 1.0900i ```] === Calculo dos Coeficientes do Filtro: Em seguida, podemos calcular os coeficientes do filtro utilizando a funรงรฃo poly do matlab aplicando as raizes encontradas no calculo anterior. #sourcecode[```matlab poly([ -1.0900 + 0.2921i -1.0900 - 0.2921i -0.7979 + 0.7979i -0.7979 - 0.7979i -0.2921 + 1.0900i -0.2921 - 1.0900i ]) ```] Com a aplicaรงรฃo da funรงรฃo poly, obtemos os coeficientes do filtro que sรฃo: #sourcecode[```matlab h'(s') = 2.0648 / 1s'6 + 4.3600s'5 + 9.5048s'4 + 13.1362s'3 + 12.1033s'2 + 7.0697s + 2.0648 ```] Em seguida, podemos aplicar a desnormalizaรงรฃo do filtro para obter os coeficientes do filtro no domรญnio do tempo, para isso, utilizamos a funรงรฃo bilinear do matlab, a partir da seguinte formula: $ s' = (1/a) (s/Omega'_p) $ Desta forma, temos que o resultado da espressรฃo รฉ o seguinte: #sourcecode[```matlab %h(s) = 0.0024 / 1s^6 1.4166s^5 + 1.0034s^4 + 0.4506s^3 + 0.1349s^2+ 0.0256s + 0.0024 ```] E desta forma, os valores dos coeficiente podem ser separados em numerador e denominador, como apresentado abaixo, sendo o vetor 'a' o numerador e o vetor 'b' o denominador: #sourcecode[```matlab a = [1 1.4166 1.0034 0.4506 0.1349 0.0256 0.0024] b = [0.0024] ```] === Aplicando a funรงรฃo bilinear: Por fim, podemos aplicar a funรงรฃo bilinear do matlab para obter os coeficientes do filtro no domรญnio do tempo, para isso, utilizamos a funรงรฃo bilinear do matlab, a partir do script abaixo: #sourcecode[```matlab [numerador, denominador] = bilinear(b,a,fs) ```] #sourcecode[```matlab Numerator: 0.00060234019040941179888S581924473101025; 0.009035102856141176766446854173864267068; 0.012046803808188236845078122883023752365; 0.009035102856141176766446854173864267068; 0.003614041142456470793314915468386061548; 0.000602340190409411798885819244731010258; Denominator: 1; -3.293990202908562814343440550146624445915; 4.898232666546461722134608862688764929771; -4.084996050238189013725786935538053512573; 1.992931744078747957615860286750830709934; -0.535091724334459173384459518274525180459; 0.061463339042203794793106652605274575762; ```] == Script Matlab: O script matlab completo para o projeto do filtro IIR รฉ apresentado abaixo: #sourcecode[```matlab clear all; close all; clc; pkg load signal; % Especificaรงรตes do filtro wp = 0.2*pi; wr = 0.3*pi; ts = 2; % Calculo das frequรชncias de passagem e rejeiรงรฃo omega_ap = (2/ts)*tan(wp/2) omega_ar = (2/ts)*tan(wr/2) % Normalizaรงรฃo do filtro a = 1; omega_p_linha = 1/a omega_r_linha = omega_p_linha * (omega_ar/omega_ap) % Calculo das atenuaรงรตes sigma_p = 0.9; sigma_r = 0.2; atenuacao_p = -1 * (20*log10(sigma_p)) atenuacao_r = -1 * (20*log10(sigma_r)) % Calculo dos parรขmetros do filtro eps = sqrt((10^(0.1*atenuacao_p))-1) % Calculo da ordem do filtro numerador = log10((10^(0.1*atenuacao_r)-1) / eps^2); denominador = 2*log10(omega_r_linha); n = ceil(numerador/denominador) % Calculo das raรญzes do filtro roots([eps^2 0 0 0 0 0 0 0 0 0 0 0 1]) poly([-1.0900 + 0.2921i -1.0900 - 0.2921i -0.7979 + 0.7979i -0.7979 - 0.7979i -0.2921 + 1.0900i -0.2921 - 1.0900i]) % Montando o vetor "a" e "b" a patir dos resultados obtidos b = [0.0024]; a = [1 1.4166 1.0034 0.4506 0.1349 0.0256 0.0024]; fs = 1/ts; % Aplicando a funรงรฃo bilinear [numerador, denominador] = bilinear(b,a,fs) % Aplicando a funรงรฃo freqz para plotar a resposta em frequรชncia freqz(numerador, denominador) ```] == Resultados obtidos: A partir do script acima, obtemos os seguintes resultados para o filtro IIR projetado, conforme apresentado anteriormente: #sourcecode[```matlab omega_ap = 0.3249 omega_ar = 0.5095 omega_p_linha = 1 omega_r_linha = 1.5682 atenuacao_p = 0.9151 atenuacao_r = 13.979 eps = 0.4843 n = 6 % Raizes encontradas: 1 -1.08999 0.292061i 2 -1.08999 -0.292061i 3 -0.797926 0.797926i 4 -0.797926 -0.797926i 5 -0.292061 1.08999i 6 -0.292061 -1.08999i 7 0.292061 1.08999i 8 0.292061 -1.08999i 9 0.797926 0.797926i 10 0.797926 -0.797926i 11 1.08999 0.292061i 12 1.08999 -0.292061i % Calculo dos coeficientes do filtro 1 2 3 4 5 6 7 1 4.36 9.5048 13.1362 12.1033 7.06973 2.06477 % Aplicando a funรงรฃo bilinear: % Numerador: 1 4.11341e-07 2 2.46805e-06 3 6.17012e-06 4 8.22683e-06 5 6.17012e-06 6 2.46805e-06 7 4.11341e-07 % Denominador: 1 1 2 -5.29386 3 11.71430 4 -13.86580 5 9.25758 6 -3.30503 7 0.49283 ```] Aplicando a funรงรฃo freqz para plotar a resposta em frequรชncia, obtemos os seguintes grรกficos: === Resposta em Frequรชncia (Magnitude): No grรกfico abaixo รฉ apresentada a resposta em frequรชncia do filtro projetado. Note que o filtro atende as especificaรงรตes de banda de passagem e de rejeiรงรฃo, com uma atenuaรงรฃo de aproximadamente 0.2 na banda de rejeiรงรฃo e uma atenuaรงรฃo de 0.9 na banda de passagem. #figure( figure( rect(image("./pictures/q1.1.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Resposta em Frequรชncia (Fase): A fase do filtro รฉ apresentada na figura abaixo. Note que a fase do filtro รฉ linear e apresenta uma variaรงรฃo pequena na banda de passagem: #figure( figure( rect(image("./pictures/q1.2.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) = Questรฃo 2 Crie, usando MATLAB, um sinal de entrada composto de trรชs componentes senoidais, nas frequรชncias 770Hz, 852Hz e 941Hz, com โ„ฆs = 8 kHz. Projete, usando o simulink ou o MATLAB, um filtro IIR para isolar cada componente. Documente as especificaรงรตes utilizadas. Faรงa comentรกrios. == Montagem do Filtro IIR no Simulink: O primeiro passo no desenvolvimento da questรฃo foi a montagem do filtro IIR no Simulink seguindo as especificaรงรตes solicitadas pela questรฃo. Utilizamos a ferramenta para alterar o parรขmetros do filtro procurando pelos valores que atendessem as especificaรงรตes de banda de passagem e de rejeiรงรฃo. Os valores apresentados abaixo foram obtidos para o filtro de 941Hz, porem, foram realizados mais duas baterias de testes exatamente como as apresentadas abaixo, para as frequรชncias de 770Hz e 852Hz. === Resposta em Frequรชncia (Magnitude): Inicialmente utilizamos a ferramenta de plot da resposta em frequรชncia do filtro para analisar a magnitude do filtro. A figura abaixo apresenta a resposta em frequรชncia do filtro para a frequรชncia de 941Hz. O filtro que estamos procurando precisa possuir uma alta atenuaรงรฃo na banda de rejeiรงรฃo e uma queda abrupta na banda de transiรงรฃo para a banda de rejeiรงรฃo. O filtro abaixo apresenta uma atenuaรงรฃo de aproximadamente 80dB em toda a banda de rejeiรงรฃo. #figure( figure( rect(image("./pictures/q2.1.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Resposta em Frequรชncia (Fase): A fase do filtro รฉ apresentada na figura abaixo. A fase do filtro รฉ linear e apresenta apenas uma variaรงรฃo de 11ยฐ na banda de passagem. #figure( figure( rect(image("./pictures/q2.2.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Magnitude e Fase do Filtro: Abaixo podemos ver a magnitude e a fase do filtro sendo apresentadas juntas, note que a fase รฉ linear dentro da banda de passagem, e a magnitude apresenta uma queda abrupta na banda de transiรงรฃo: #figure( figure( rect(image("./pictures/q2.3.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Resposta ao impulso: Abaixo estรก apresentada a resposta ao impulso do filtro. Note que a resposta ao impulso รฉ finita, oque รฉ um requisito para o desenvolvimento deste projeto por se tratar de um filtro para sinais digitais. Note que a resposta ao impulso apresenta um pico inicial e em seguida cai para zero, oque รฉ esperado para um filtro passa-faixa. #figure( figure( rect(image("./pictures/q2.4.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Polos e Zeros do Filtro: Os polos e zeros do filtro sรฃo apresentados na figura abaixo. Note que o filtro possui 4 polos e 4 zeros, e que os polos estรฃo localizados na regiรฃo de interesse, ou seja, todos os polos estรฃo dentro do cรญrculo unitรกrio. Desta forma, o filtro รฉ estรกvel e possui uma resposta ao impulso finita oque รฉ um requisito para o desenvolvimento deste projeto por se tratar de um filtro para sinais digitais. #figure( figure( rect(image("./pictures/q2.5.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Espalhamento de potรชncia do filtro: Abaixo tambรฉm estรก apresentado o espalhamento de potรชncia do filtro. Note que o filtro apresenta uma atenuaรงรฃo de aproximadamente 80dB na banda de rejeiรงรฃo, tambรฉm รฉ possivel verificar que grande parte da potรชncia do sinal estรก concentrada na banda de passagem como esperado para as caracteristicas do filtro. #figure( figure( rect(image("./pictures/q2.6.png")), numbering: none, caption: [] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Com base nestes valores, obtivemos os seguintes parรขmetros para o filtro de 942Hz: - Ordem do filtro: 8 - Banda de passagem: 941Hz - 943Hz - Banda de transiรงรฃo Baixa: 930Hz - 941Hz - Banda de transiรงรฃo Alta: 943Hz - 954Hz - Frequรชncia de amostagem: 8kHz - Astop1 = 40dB - Astop2 = 60dB - Mรฉtodo de Desing: IIR-Butterworth Os mesmos parรขmetros foram utilizados para os filtros de 1kHz e 1.1kHz. == Comparativo entre outros Desings: Neste projeto foi decidido utilizar o mรฉotodo de Butterworth para o desing do filtro, porem, tambรฉm foram testados outros mรฉtodos, como Chebyshev: #figure( figure( rect(image("./pictures/q2.7.png")), numbering: none, caption: [Filtro de 941Hz Utilizando Chebyshev] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Entretanto, durante os testes com os demais filtros, foi visto que a taxa de atenuaรงรฃo apresentada pelo filtro de Butterworth era superior a dos demais filtros, como รฉ possivel verificar acima para o filtro chebyshev em relaรงรฃo ao filtro Butterworth apresentado abaixo. Note que na banda de passagem, os filtros se assemelham com atenuaรงรฃo proxima de zero e queda abrupta no inicio da banda de rejeiรงรฃo, porem, o filtro Butterworth apresenta uma atenuaรงรฃo de aproximadamente 80dB na banda de rejeiรงรฃo, enquanto o filtro Chebyshev apresenta uma atenuaรงรฃo de atรฉ 60dB e em seguida o filtro se mantem constante neste valor por uma faixa de frequรชncia maior, oque atenua menos as componentes espectrais indesejadas. Desta forma, o filtro que foi escolhido para o projeto e filtragem das componentes cossenoidais, foi o filtro Butterworth. == Aplicando o filtro no sinal de entrada: Uma vez com o filtro projetado e os parรขmetros definidos, รฉ possivel gerar um script matlab (octave) para gerar as trรชs componentes de entrada, soma-las de maneira a criar um sinal รบnico, anรกlogo ao que seria transmitido pelo meio de transmissรฃo, e aplicar o filtro projetado "no receptor" para cada uma das componentes, separando-as e verificando a resposta em frequรชncia de cada sinal filtrado. === Script Matlab: #sourcecode[```matlab clc; close all; clear all; % Parรขmetros do sinal tmin = 0; tmax = 2; Omega_s = 8000; Fs = Omega_s; Ts = 1/Fs; L = (tmax - tmin)/Ts; t = 0:Ts:tmax-Ts; % Componentes do sinal de entrada f1 = 770; f2 = 852; f3 = 941; % Sinal de entrada composto: s_t = sin(2*pi*f1*t) + sin(2*pi*f2*t) + sin(2*pi*f3*t); % Realizando a FFT do sinal composto: S_f = fft(s_t); S_f = abs(2*S_f/L); S_f = fftshift(S_f); freq = Fs*(-(L/2):(L/2)-1)/L; % Realizando o plot do sinal composto no dominio do tempo: figure; subplot(2,1,1); plot(t,s_t); ylabel('Amplitude'); xlabel('Tempo (s)'); title('Sinal de entrada'); % Plotando a FFT do sinal composto subplot(2,1,2); plot(freq,S_f); title('Espectro do sinal composto de trรชs componentes senoidais'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); % ============================================== % Aplicando as componentes de filtragem % Filtro de 770Hz Butterworth Num = [ 0.000000000007648974625344080593812088956; 0; -0.000000000030595898501376322375248355826; 0; 0.000000000045893847752064483562872533739; 0; -0.000000000030595898501376322375248355826; 0; 0.000000000007648974625344080593812088956 ]; Den = [1; -6.573968478516325930627317575272172689438; 20.197703598146055981032986892387270927429; -37.435767531546105146844638511538505554199; 45.612066895335409810741111868992447853088; -37.354424964373507123127637896686792373657; 20.110025517173959030969854211434721946716; -6.5312086462963758748401232878677546978; 0.991336860368820738109718604391673579812 ]; % Realizando a filtragem do sinal composto: s_770hz = filter(Num, Den, s_t); S_770hz = fft(s_770hz); S_770hz = abs(2*S_770hz/L); S_770hz = fftshift(S_770hz); % Realizando o plot do sinal composto no dominio do tempo: figure; subplot(2,1,1); plot(freq,S_f); title('Espectro do sinal composto de trรชs componentes senoidais'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); subplot(2,1,2); plot(freq, S_770hz); title('Componente do sinal de 770 Hz filtrado com passa-faixa Butterworth.'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); % ============================================== % Aplicando as componentes de filtragem % Filtro de 852Hz Butterworth Num = [ 0.000000000007674623107715503777944271234; 0; -0.000000000030698492430862015111777084937; 0; 0.000000000046047738646293025898839895191; 0; -0.000000000030698492430862015111777084937; 0; 0.000000000007674623107715503777944271234 ]; Den = [1; 18.723854036105780807019982603378593921661; -34.153268845102040529582154704257845878601; 41.404068891609767888439819216728210449219; -34.07899654791336274683999363332986831665 ; 18.642505949254868369280302431434392929077; -6.22711645042142070138879716978408396244; 0.991329630860964927663303569715935736895 ]; % Realizando a filtragem do sinal composto: s_852hz = filter(Num, Den, s_t); S_852hz = fft(s_852hz); S_852hz = abs(2*S_852hz /L); S_852hz = fftshift(S_852hz ); % Realizando o plot do sinal composto no dominio do tempo: figure; subplot(2,1,1); plot(freq,S_f); title('Espectro do sinal composto de trรชs componentes senoidais'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); subplot(2,1,2); plot(freq, S_852hz ); title('Componente do sinal de 852 Hz filtrado com passa-faixa Butterworth.'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); % ============================================== % Aplicando as componentes de filtragem % Filtro de 940Hz Butterworth Num = [0.000000000007698496068837793746781982269; 0; -0.000000000030793984275351174987127929078; 0; 0.000000000046190976413026762480691893617; 0; -0.000000000030793984275351174987127929078; 0; 0.000000000007698496068837793746781982269 ]; Den = [1; -5.902149339413338857696089689852669835091; 17.054552786823688137474164250306785106659; -30.518120678802585388211809913627803325653; 36.783803548311759357147820992395281791687; -30.451702102949198547321429941803216934204;; 16.980399695100125256885803537443280220032; -5.863697447546361019021787797100841999054; 0.991322918116968265778155000589322298765 ]; % Realizando a filtragem do sinal composto: s_940hz = filter(Num, Den, s_t); S_940hz = fft(s_940hz); S_940hz = abs(2*S_940hz/L); S_940hz = fftshift(S_940hz); % Realizando o plot do sinal composto no dominio do tempo: figure; subplot(2,1,1); plot(freq,S_f); title('Espectro do sinal composto de trรชs componentes senoidais'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); subplot(2,1,2); plot(freq, S_940hz); title('Componente do sinal de 940 Hz filtrado com passa-faixa Butterworth.'); xlabel('Frequรชncia (Hz)'); ylabel('Amplitude'); xlim([-1000 1000]); ylim([-0.1 1.1]); ```] === Resultados Obtidos: Os resultados obtidos para a filtragem das componentes cossenoidais sรฃo apresentados abaixo. ==== Sinal de Entrada: A partir do script acima, o sinal de entrada foi gerado e apresentado na figura abaixo. Note que o sinal รฉ composto por trรชs componentes senoidais, nas frequรชncias de 770Hz, 852Hz e 941Hz. As componentes somadas sรฃo apresentadas abaixo, tanto no dominio do tempo quanto no dominio da frequรชncia, note que no dominio da frequรชncia aparece as trรชs componentes cossenoidas separadamente permitindo visualizar a soma completa dos sinais. #figure( figure( rect(image("./pictures/q2.8.png")), numbering: none, caption: [Filtro de 941Hz Utilizando Chebyshev] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) ==== Sinal de 770Hz Filtrado: Multiplicando o sinal de entrada pelo filtro de 770Hz, obtemos o sinal filtrado para a frequรชncia de 770Hz. Note que o sinal filtrado apresenta apenas a componente de 770Hz, as demais componentes foram atenuadas pelo filtro. Note que tambรฉm hรก uma pequena amplitude associada a lateral do sinal, isso ocorre devido a resposta em frequรชncia do filtro que nรฃo รฉ ideal, porem, a atenuaรงรฃo รฉ suficiente para que a componente de 770Hz seja isolada das demais. #figure( figure( rect(image("./pictures/q2.9.png")), numbering: none, caption: [Filtro de 941Hz Utilizando Chebyshev] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) ==== Sinal de 852Hz Filtrado: Em seguida, podemos ver o sinal filtrado para a frequรชncia de 852Hz. Note que o sinal filtrado apresenta apenas a componente de 852Hz, as demais componentes foram atenuadas pelo filtro. Note que tambรฉm hรก uma pequena amplitude associada a lateral do sinal, isso ocorre devido a resposta em frequรชncia do filtro que nรฃo รฉ ideal, porem, a atenuaรงรฃo รฉ suficiente para que a componente de 852Hz seja isolada das demais. #figure( figure( rect(image("./pictures/q2.10.png")), numbering: none, caption: [Filtro de 941Hz Utilizando Chebyshev] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) ==== Sinal de 941Hz Filtrado: Por fim temos o sinal filtrado para a frequรชncia de 941Hz. Note que o sinal filtrado apresenta apenas a componente de 941Hz, as demais componentes foram atenuadas pelo filtro. Note que tambรฉm hรก uma pequena amplitude associada a lateral do sinal, isso ocorre devido a resposta em frequรชncia do filtro que nรฃo รฉ ideal, porem, a atenuaรงรฃo รฉ suficiente para que a componente de 941Hz seja isolada das demais. #figure( figure( rect(image("./pictures/q2.11.png")), numbering: none, caption: [Filtro de 941Hz Utilizando Chebyshev] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) = Conclusรฃo A partir dos conceitos vistos, desenvolvimento e resultados obtidos, podemos concluir que o projeto de filtros IIR รฉ uma ferramenta poderosa para o processamento de sinais digitais. Atravรฉs do projeto de filtros IIR รฉ possivel separar componentes cossenoidais de um sinal composto, permitindo a anรกlise de cada componente individualmente. Alรฉm de poder ser utilizado em diversas aplicaรงรตes, como a separaรงรฃo de componentes em sinais de comunicaรงรฃo, processamento de sinais de รกudio e vรญdeo, entre outras aplicaรงรตes.
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/text/space.typ
typst
// Test whitespace handling. --- space-collapsing --- // Spacing around code constructs. A#let x = 1;B #test(x, 1) \ C #let x = 2;D #test(x, 2) \ E#if true [F]G \ H #if true{"I"} J \ K #if true [L] else []M \ #let c = true; N#while c [#(c = false)O] P \ #let c = true; Q #while c { c = false; "R" } S \ T#for _ in (none,) {"U"}V #let foo = "A" ; \ #foo;B \ #foo; B \ #foo ;B --- space-collapsing-comments --- // Test spacing with comments. A/**/B/**/C \ A /**/ B/**/C \ A /**/B/**/ C --- space-collapsing-with-h --- // Test spacing collapsing before spacing. #set align(right) A #h(0pt) B #h(0pt) \ A B \ A #h(-1fr) B --- text-font-just-a-space --- // Test that a run consisting only of whitespace isn't trimmed. A#text(font: "IBM Plex Serif")[ ]B --- text-font-change-after-space --- // Test font change after space. Left #text(font: "IBM Plex Serif")[Right]. --- space-collapsing-linebreaks --- // Test that linebreak consumed surrounding spaces. #align(center)[A \ B \ C] --- space-collapsing-stringy-linebreak --- // Test that space at start of non-backslash-linebreak line isn't trimmed. A#"\n" B --- space-trailing-linebreak --- // Test that trailing space does not force a line break. LLLLLLLLLLLLLLLLLL R _L_ --- space-ideographic-kept --- // Test that ideographic spaces are preserved. #set text(lang: "ja", font: "Noto Serif CJK JP") ใ ใ‚ใ†ใ‹๏ผŸใ€€ไฝ•ใฎใŸใ‚ใซ๏ผใ€€็งใฏใ€ --- space-thin-kept --- // Test that thin spaces are preserved. | | U+0020 regular space \ |โ€‰| U+2009 thin space
https://github.com/LeoColomb/dotdocs
https://raw.githubusercontent.com/LeoColomb/dotdocs/main/packages/leocolomb/lettre-fr/1.0.0/template/main.typ
typst
MIT License
#import "@leocolomb/lettre-fr:1.0.0": template #show: template.with( sender: [<NAME>], sender_address: [ 123, rue d'Ici\ Terre ], recipient: [<NAME>], recipient_address: [ Acme Corp. \ 123 Glennwood Ave \ Quarto Creek, VA 22438 ], location: [Terre], subject: [Objet~: Lettre], opening: [Madame, Monsieur,], closing: [Dans l'attente de votre retour, je vous prie d'agrรฉer, Madame, Monsieur, l'expression de mes sentiments distinguรฉs.], ) #lorem(99)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/bookletic/0.2.0/src/lib.typ
typst
Apache License 2.0
// This function creates a signature (booklet) layout for printing. // It takes various parameters to configure the layout, such as paper size, // margins, page numbering styles, content padding, and the content to be laid out. #let sig( signature-paper: "us-letter", // Paper size for the booklet (e.g., "us-letter", "us-legal") page-margin-top: 0.25in, // Top margin for each page page-margin-bottom: 0.25in, // Bottom margin for each page page-margin-binding: 0.25in, // Binding margin for each page (space between pages) page-margin-edge: 0.25in, // Edge margin for each page page-border: luma(0), // Color for the border around each page (set to none for no border) draft: false, // Whether to output draft or final layout p-num-layout: ( // TODO: add ability to set a shape behind page number // TODO: add ability to easily pad page number left or right ( p-num-start: 1, // Starting page number p-num-alt-start: none, // Alternative starting page number (e.g., for chapters) p-num-pattern: "1", // Pattern for page numbering (e.g., "1", "i", "a", "A") p-num-placment: top, // Placement of page numbers (top or bottom) p-num-align-horizontal: center, // Horizontal alignment of page numbers p-num-align-vertical: horizon, // Vertical alignment of page numbers p-num-pad-left: 0pt, // Extra padding added to the left of the page number p-num-pad-horizontal: 1pt, // Horizontal padding for page numbers p-num-size: 12pt, // Size of page numbers p-num-border: luma(0), // Border color for page numbers ), ), pad-content: 5pt, // Padding around page content contents: (), // Content to be laid out in the booklet (an array of content blocks) ) = { // set printer page size (typst's page) and a booklet page size (pages in the booklet) set page(signature-paper, margin: ( top: page-margin-top, bottom: page-margin-bottom, left: page-margin-edge, right: 6in ), flipped: true) // Note: This is hardcoded to two page single fold signatures. // Current handled pages sizes are Us-Letter and Us-Legal. let page-height = (8.5in - page-margin-top) - page-margin-bottom; let page-width if signature-paper == "us-legal" { // Calculate page width for US Legal paper size page-width = ((14in - (page-margin-edge * 2)) - page-margin-binding) / 2; } else { // Calculate page width for US Letter paper size page-width = ((11in - (page-margin-edge * 2)) - page-margin-binding) / 2; } let wrapped-cont = () // Array to hold wrapped content let p-num = 1 // Initialize page number // Loop through the provided content and package for placement in the booklet // We will nsert page number for each page before we reorder things for value in contents { let page let p-num-placment let p-num-width let p-num-height let p-num-value let page-number-box // Compose a page number box for this page if it falls within a defined layout for layout in p-num-layout { // Check if this is the right layout or not if layout.at("p-num-start") <= p-num { // If it is check whether we need to build a box or not if layout.at("p-num-pattern") == none { page-number-box = none continue } // Substitute alternative starting number if specified for this page number layout if layout.at("p-num-alt-start") != none { p-num-value = (p-num - layout.at("p-num-start")) + layout.at("p-num-alt-start") } else { p-num-value = p-num } // Build dimensions of box from layout definition p-num-height = layout.at("p-num-size") + layout.at("p-num-pad-horizontal") p-num-width = page-width // Hold on to placment for use when building pages p-num-placment = layout.at("p-num-placment") // Compose page number box page-number-box = box( width: p-num-width, height: p-num-height, stroke: layout.at("p-num-border"), align(layout.at("p-num-align-horizontal") + layout.at("p-num-align-vertical"), pad(left: layout.at("p-num-pad-left"), text(size: layout.at("p-num-size"), numbering(layout.at("p-num-pattern"), p-num-value)))) ) } } // Compose the page based on page number box placement if page-number-box == none { page = pad(pad-content, value) // Page without any page numbers } else if p-num-placment == top { page = stack(page-number-box, pad(pad-content, value)) // Page number on top } else { page = pad(pad-content, value) + align(bottom, page-number-box) // Page number at bottom } // Wrap the finished page content to the specified page size wrapped-cont.push( block( width: page-width, height: page-height, spacing: 0em, page ) ) p-num += 1 // Increment page number } let reordered-pages = () // Prepare to collect reordered pages let num-pages = wrapped-cont.len() // Total number of pages let half-num = int(num-pages / 2) // Number of pages in each half // Round half-num up to account for odd page numbers if calc.odd(num-pages) { half-num += 1 } // Split pages into front and back halves for reordering let front-half = wrapped-cont.slice(0, half-num) let back-half = wrapped-cont.slice(half-num).rev() // Reorder pages into booklet signature for num in range(half-num) { // If total number of pages is odd, leave back cover blank // otherwise proceed with reordering pages normally if calc.odd(num-pages) { if num == 0 { reordered-pages.push([]) reordered-pages.push(front-half.at(num)) } else if calc.even(num) { reordered-pages.push(back-half.at(num - 1)) reordered-pages.push(front-half.at(num)) } else { reordered-pages.push(front-half.at(num)) reordered-pages.push(back-half.at(num - 1)) } } else { // Alternate page arrangement for even paged booklet signature if calc.even(num) { reordered-pages.push(back-half.at(num)) reordered-pages.push(front-half.at(num)) } else { reordered-pages.push(front-half.at(num)) reordered-pages.push(back-half.at(num)) } } } // Create grid to place booklet pages let sig-grid = grid.with( columns: 2 * (page-width,), rows: page-height, gutter: page-margin-binding, ) // Draw border if not set to none if page-border != none { sig-grid = sig-grid.with( stroke: page-border ) } // Output draft or final layout if draft { sig-grid(..wrapped-cont) } else { sig-grid(..reordered-pages) } } // This function is a placeholder for automatically breaking content into pages #let booklet() = { // TODO: Take in single block of content and calculate how to break it into pages automatically // Then feed resulting pages to sig function will offer trade off of convenience for less control }
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/185.%20noob.html.typ
typst
noob.html Being a Noob January 2020When I was young, I thought old people had everything figured out. Now that I'm old, I know this isn't true.I constantly feel like a noob. It seems like I'm always talking to some startup working in a new field I know nothing about, or reading a book about a topic I don't understand well enough, or visiting some new country where I don't know how things work.It's not pleasant to feel like a noob. And the word "noob" is certainly not a compliment. And yet today I realized something encouraging about being a noob: the more of a noob you are locally, the less of a noob you are globally.For example, if you stay in your home country, you'll feel less of a noob than if you move to Farawavia, where everything works differently. And yet you'll know more if you move. So the feeling of being a noob is inversely correlated with actual ignorance.But if the feeling of being a noob is good for us, why do we dislike it? What evolutionary purpose could such an aversion serve?I think the answer is that there are two sources of feeling like a noob: being stupid, and doing something novel. Our dislike of feeling like a noob is our brain telling us "Come on, come on, figure this out." Which was the right thing to be thinking for most of human history. The life of hunter-gatherers was complex, but it didn't change as much as life does now. They didn't suddenly have to figure out what to do about cryptocurrency. So it made sense to be biased toward competence at existing problems over the discovery of new ones. It made sense for humans to dislike the feeling of being a noob, just as, in a world where food was scarce, it made sense for them to dislike the feeling of being hungry.Now that too much food is more of a problem than too little, our dislike of feeling hungry leads us astray. And I think our dislike of feeling like a noob does too.Though it feels unpleasant, and people will sometimes ridicule you for it, the more you feel like a noob, the better.Japanese TranslationArabic TranslationFrench TranslationKorean TranslationPolish TranslationChinese TranslationSerbian TranslationFrench Translation
https://github.com/swablab/documents
https://raw.githubusercontent.com/swablab/documents/main/templates/tmpl_page.typ
typst
Creative Commons Zero v1.0 Universal
#import "common.typ": common, colors #let tmpl_page( title: none, version: none, change_date: none, subtext: none, doc, ) = { show: doc => common(title: title, doc) set page( footer: [ #text(size: 10pt, fill: colors.subtext)[#version] #h(2fr) #text(size: 10pt, fill: colors.subtext)[#change_date] ], ) // Logo place( top + right, dx: 2.5em, dy: -2.5em, image("lightmode-swablab.png", width: 25%) ) block(width: 100%-100pt, height: 70pt)[ #par(justify: false)[ #text(font: "Ubuntu", 18pt)[ #heading(outlined: false)[*#title*] ] ] #subtext ] doc }
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/bugs/grid-3.typ
typst
Apache License 2.0
// Ensure that the list does not jump to the third page. --- #set page(height: 70pt) #v(40pt) The following: + A + B
https://github.com/katamyra/Notes
https://raw.githubusercontent.com/katamyra/Notes/main/Compiled%20School%20Notes/CS3001/Modules/VirtueEthics.typ
typst
#import "../../../template.typ": * = Virtue Ethics *Virtue ethics* can address the questions of how one should live, what kind of person one should become, and even what one should do in certain scenarios. Would a good person perform this action under this virtue? According to aristotle, happiness derives from living a life of virtue. In general, the other perspectives tend to not account for emotion and social relationships. #definition[ *Virtues*: behaviors showing high standards. The qualities or states of character that find expression in morally good actions and morally good purposes. *Intellectual Virtues* - virtues associated with reasoning and truth *Moral Virtues* - habits or dispositions formed through the repetition of relevant virtuous actions. _A deep seated character trait_. Not simple just a disposition to act a certain way but also to _feel_ that way. ] #definition[ *Vices*: the opposite from virtues. A vice is a character trait that prevents a human being from flourishing or being truly happy ] Usually, there are two vices for every virtue, because one corresponds to excess and the other corresponds to a deficiency. Ex: Rashness #sym.arrow.l Courage #sym.arrow.r Cowardice #note[ Virtue ethics pays particular attention to the agent as well as the action and the consequences of the action. This touches on social contract theory, utilitarianism, and kantianism. _A good person does the right thing at the right time for the right reason_. ] Also, according to virtue ethics, moral decision making cannot be reduced to the routine application of a set of rules. Basically, moral wisdom or discernment takes precedence over any rule. *Pros* - In many situations it makes more sense to focus on virtues than on obligations or rights - Personal relationships can be morally relevant to decision making - There are no irresolvable moral dilemmas - Recognizes the important of having a say in living a moral life *Cons* - Different people may have quite different conceptions of what human flourishing is - Virtue ethics cannot be used to guide government policy - Undermines attempts to hold people responsible for their bad actions #image("../Images/moralactions.png")
https://github.com/fenjalien/metro
https://raw.githubusercontent.com/fenjalien/metro/main/tests/qty/quantity-product/test.typ
typst
Apache License 2.0
#import "/src/lib.typ": qty, metro-setup #set page(width: auto, height: auto) #qty(2.67, "farad")\ #qty(2.67, "farad", quantity-product: sym.space)\ #qty(2.67, "farad", quantity-product: none) #metro-setup(quantity-product: sym.times) #qty(1.23, "mm", per-mode: "symbol")\ #qty(1.23, "m/m", per-mode: "fraction")\ #qty(1.23, "m", per-mode: "symbol")\ #qty(1.23, "m")\ #qty(1.23, "/s", per-mode: "symbol")\ #qty(1.23, "m/s", per-mode: "symbol")\ #qty(1.23, "m/s")
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/break-continue-10.typ
typst
Other
// Ref: true // Test break in set rule. // Should output `Hi` in blue. #for i in range(10) { [Hello] set text(blue, ..break) [Not happening] }
https://github.com/hekzam/test
https://raw.githubusercontent.com/hekzam/test/main/basics.typ
typst
// Force a simple error onto typst #let fail(err) = { (:).at(err) } // Converts & rounds a size to centimeters. Should be accurate up to about 1200dpi images (and maybe up to 2400dpi) #let tocm(size) = { return calc.round(size/1cm, digits: 3) } // dictionary insertion, returns the modified dict #let dict_insert(d, key, value, new: false, check: false) = { if type(key) == "array" { let c = (d,) // This is a recursion tracker // We populate the (unfolded) recursive dict for i in range(key.len()-1) { let k = key.at(i) let kn = key.at(i+1) // Create the current entry if type(kn) == "string" { c.push(c.last().at(k, default: (:))) } else if type(kn) == "integer" { c.push(c.last().at(k, default: ())) } } if new and key.last() in c.last() { if check and c.last().at(key.last()) != value { return fail("inconsitent values at" + repr(key)) } // We do not overwrite return d } //Finalize the URD with the value c.push(value) // Reconstitute (fold) the dict for i in range(c.len()-1, 0, step: -1) { let k = key.at(i - 1) if k == -1 { //Unordered append c.at(i - 1).push(c.at(i)) } else { c.at(i - 1).insert(k, c.at(i)) } } c.first() } else if type(key) == "string" { if new and key in d { if check and d.at(key) != value { return fail("inconsitent values at: " + key) } // We do not overwrite return d } d.insert(key, value) d } } // formats a dict to json #let jsonify(dict) = { let a = "" if type(dict) == "dictionary" { a += "{" + dict.pairs().map(i => "\"" + str(i.first()) + "\":" + jsonify(i.last())).join(",") + "}" } else if type(dict) == "array" { a += "[" + dict.map(v => jsonify(v)).join(",") + "]" } else { a += repr(dict); } a } #let inl(inl) = "\n" + (" " * inl) // formats a dict to json, with padding #let jsonify_pretty(dict, depth: 0) = { let a = "" let s = inl(depth+1) if type(dict) == "dictionary" { a += "{" + s + dict.pairs().map(i => "\"" + str(i.first()) + "\": " + jsonify_pretty(i.last(), depth: depth + 1)).join("," + s) + inl(depth) + "}" } else if type(dict) == "array" { a += "[" + s + dict.map(v => jsonify_pretty(v, depth: depth + 1)).join("," + s) + inl(depth) + "]" } else { a += repr(dict); } a }
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/ๅ…‰็”ต็ณป็ปŸ้›†ๆˆ/1.typ
typst
#import "@preview/touying:0.2.1": * // #import "notes.typ": note, notes #import "template.typ": * #let (init, slide, slides) = utils.methods(s) #show: init #set text(font:("Times New Roman","STSong")) // #set heading(numbering: "none") #set heading(numbering: "1.") #let s = (s.methods.info)( self: s, title: [111111], subtitle: [222], author: [33333], date: datetime.today(), institution: [Institution], ) // #show: slides // ็”จไบŽ่พจๆž #let faAward = icon(data.icon.faAward) #let faBuildingColumns = icon(data.icon.faBuildingColumns) #let faCode = icon(data.icon.faCode) #let faEnvelope = icon(data.icon.faEnvelope) #let faGithub = icon(data.icon.faGithub) #let faGraduationCap = icon(data.icon.faGraduationCap) #let faLinux = icon(data.icon.faLinux) #let faPhone = icon(data.icon.faPhone) #let faWindows = icon(data.icon.faWindows) #let faWrench = icon(data.icon.faWrench) #let python = icon(data.icon.python) #let haiyang = icon(data.icon.haiyang) #let themeColor = rgb(46, 49, 124) #let head_main="M ๅคงไฝœไธš" #slide[ #align(left+top,image("icon/ๆ กๆ ‡.png",width: 15em)) #align(center+horizon, text(size: 55pt)[ #align(left,line(length: 100%,stroke: (paint: themeColor, thickness: 0.03em, dash: "dashed"))) #head_main // #align(center,text(20pt)[ๅผ€้ข˜ๆŠฅๅ‘Š]) // #line(length: 100%,stroke: (paint: themeColor, thickness: 0.03em, dash: "dashed")) ]) #left.axis() \ #bottom.axis() An inline #box( fill: luma(205), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, )[rectangle].] #slide[ = ๆฆ‚่ฟฐ ]
https://github.com/boladouro/ME
https://raw.githubusercontent.com/boladouro/ME/main/1/pro%20prof/relatorio/capa.typ
typst
#import "template.typ": * #let titulo = "Mรฉtodo de Aceitaรงรฃo-Rejeiรงรฃo & Anรกlise de Estimadores" #let subtitulo = "Exercรญcio realizado no รขmbito da Unidade Curricular de Modelaรงรฃo Estocรกstica do 3ยบ ano da Licenciatura em Ciรชncia de Dados" #let indice= false // TODO change to grid // let versao // let data // let autores para ter for loop #set align(center) #set page( margin: (x: 3cm, y: 2.5cm), ) #set text( hyphenate: false ) #set par( first-line-indent: 0pt, justify: false, ) #par(leading: 0.15cm)[ #show: smallcaps #text(13pt)[ISCTE-IUL] \ #text(12.5pt)[Licenciatura em Ciรชncia de Dados] ] #v(0.1cm) #line(length: 100%, stroke: 0.5pt) #v(0.4cm) #par(leading: 0.22cm)[ #text(32pt)[#titulo] #linebreak() #v(0.1cm) #text(16pt)[#subtitulo)] ] #v(0.4cm) #line(length: 100%, stroke: 1pt) #if indice { v(0.4cm) } else { v(4cm) } #par(leading: 0.3cm)[ #text(22pt)[<NAME>, 105289]\ #link("mailto:<EMAIL>")[<EMAIL>]\ #v(0.2cm) #text(22pt)[<NAME>, 104782]\ #link("mailto:<EMAIL>") ] #if indice { v(3cm) } else { v(6.5cm) } #par(leading: 0.3cm)[ #text(16pt)[10 de outubro 2023]\ #text(16pt)[Versรฃo 1.0.1] ] #v(3cm) #set align(left) // #outline( // title: text(weight: 600)[รndice], // fill: text(15pt, spacing: 220%)[#repeat(" . ")] // )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-02B0.typ
typst
Apache License 2.0
#let data = ( ("MODIFIER LETTER SMALL H", "Lm", 0), ("MODIFIER LETTER SMALL H WITH HOOK", "Lm", 0), ("MODIFIER LETTER SMALL J", "Lm", 0), ("MODIFIER LETTER SMALL R", "Lm", 0), ("MODIFIER LETTER SMALL TURNED R", "Lm", 0), ("MODIFIER LETTER SMALL TURNED R WITH HOOK", "Lm", 0), ("MODIFIER LETTER SMALL CAPITAL INVERTED R", "Lm", 0), ("MODIFIER LETTER SMALL W", "Lm", 0), ("MODIFIER LETTER SMALL Y", "Lm", 0), ("MODIFIER LETTER PRIME", "Lm", 0), ("MODIFIER LETTER DOUBLE PRIME", "Lm", 0), ("MODIFIER LETTER TURNED COMMA", "Lm", 0), ("MODIFIER LETTER APOSTROPHE", "Lm", 0), ("MODIFIER LETTER REVERSED COMMA", "Lm", 0), ("MODIFIER LETTER RIGHT HALF RING", "Lm", 0), ("MODIFIER LETTER LEFT HALF RING", "Lm", 0), ("MODIFIER LETTER GLOTTAL STOP", "Lm", 0), ("MODIFIER LETTER REVERSED GLOTTAL STOP", "Lm", 0), ("MODIFIER LETTER LEFT ARROWHEAD", "Sk", 0), ("MODIFIER LETTER RIGHT ARROWHEAD", "Sk", 0), ("MODIFIER LETTER UP ARROWHEAD", "Sk", 0), ("MODIFIER LETTER DOWN ARROWHEAD", "Sk", 0), ("MODIFIER LETTER CIRCUMFLEX ACCENT", "Lm", 0), ("CARON", "Lm", 0), ("MODIFIER LETTER VERTICAL LINE", "Lm", 0), ("MODIFIER LETTER MACRON", "Lm", 0), ("MODIFIER LETTER ACUTE ACCENT", "Lm", 0), ("MODIFIER LETTER GRAVE ACCENT", "Lm", 0), ("MODIFIER LETTER LOW VERTICAL LINE", "Lm", 0), ("MODIFIER LETTER LOW MACRON", "Lm", 0), ("MODIFIER LETTER LOW GRAVE ACCENT", "Lm", 0), ("MODIFIER LETTER LOW ACUTE ACCENT", "Lm", 0), ("MODIFIER LETTER TRIANGULAR COLON", "Lm", 0), ("MODIFIER LETTER HALF TRIANGULAR COLON", "Lm", 0), ("MODIFIER LETTER CENTRED RIGHT HALF RING", "Sk", 0), ("MODIFIER LETTER CENTRED LEFT HALF RING", "Sk", 0), ("MODIFIER LETTER UP TACK", "Sk", 0), ("MODIFIER LETTER DOWN TACK", "Sk", 0), ("MODIFIER LETTER PLUS SIGN", "Sk", 0), ("MODIFIER LETTER MINUS SIGN", "Sk", 0), ("BREVE", "Sk", 0), ("DOT ABOVE", "Sk", 0), ("RING ABOVE", "Sk", 0), ("OGONEK", "Sk", 0), ("SMALL TILDE", "Sk", 0), ("DOUBLE ACUTE ACCENT", "Sk", 0), ("MODIFIER LETTER RHOTIC HOOK", "Sk", 0), ("MODIFIER LETTER CROSS ACCENT", "Sk", 0), ("MODIFIER LETTER SMALL GAMMA", "Lm", 0), ("MODIFIER LETTER SMALL L", "Lm", 0), ("MODIFIER LETTER SMALL S", "Lm", 0), ("MODIFIER LETTER SMALL X", "Lm", 0), ("MODIFIER LETTER SMALL REVERSED GLOTTAL STOP", "Lm", 0), ("MODIFIER LETTER EXTRA-HIGH TONE BAR", "Sk", 0), ("MODIFIER LETTER HIGH TONE BAR", "Sk", 0), ("MODIFIER LETTER MID TONE BAR", "Sk", 0), ("MODIFIER LETTER LOW TONE BAR", "Sk", 0), ("MODIFIER LETTER EXTRA-LOW TONE BAR", "Sk", 0), ("MODIFIER LETTER YIN DEPARTING TONE MARK", "Sk", 0), ("MODIFIER LETTER YANG DEPARTING TONE MARK", "Sk", 0), ("MODIFIER LETTER VOICING", "Lm", 0), ("MODIFIER LETTER UNASPIRATED", "Sk", 0), ("MODIFIER LETTER DOUBLE APOSTROPHE", "Lm", 0), ("MODIFIER LETTER LOW DOWN ARROWHEAD", "Sk", 0), ("MODIFIER LETTER LOW UP ARROWHEAD", "Sk", 0), ("MODIFIER LETTER LOW LEFT ARROWHEAD", "Sk", 0), ("MODIFIER LETTER LOW RIGHT ARROWHEAD", "Sk", 0), ("MODIFIER LETTER LOW RING", "Sk", 0), ("MODIFIER LETTER MIDDLE GRAVE ACCENT", "Sk", 0), ("MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT", "Sk", 0), ("MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT", "Sk", 0), ("MODIFIER LETTER LOW TILDE", "Sk", 0), ("MODIFIER LETTER RAISED COLON", "Sk", 0), ("MODIFIER LETTER BEGIN HIGH TONE", "Sk", 0), ("MODIFIER LETTER END HIGH TONE", "Sk", 0), ("MODIFIER LETTER BEGIN LOW TONE", "Sk", 0), ("MODIFIER LETTER END LOW TONE", "Sk", 0), ("MODIFIER LETTER SHELF", "Sk", 0), ("MODIFIER LETTER OPEN SHELF", "Sk", 0), ("MODIFIER LETTER LOW LEFT ARROW", "Sk", 0), )
https://github.com/El-Naizin/cv
https://raw.githubusercontent.com/El-Naizin/cv/main/modules_en/professional.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Professional Experience") #cvEntry( title: [Software engineer apprenticeship], society: [BlueNode], //todo: logo logo: "../src/logos/bluenode.png", date: [2021 - Present], location: [Paris, France], description: list( [Learned and programmed with the Unreal Engine C++ technical stack.], [Lead a R&D project on the integration of a new movement-capture technology in the Unreal tech stack.], [Developped an understanding of real-time rendering challenges for Unreal Engine's In-Camera VFX tech stack], [Worked effectively in a software development team], [Learned how to effectively extract requirements and specifications for a given problem], ) )
https://github.com/mariunaise/HDA-Thesis
https://raw.githubusercontent.com/mariunaise/HDA-Thesis/master/graphics/plots/errorrates_changerate.typ
typst
#import "@preview/cetz:0.2.2": canvas, plot #let dashed = (stroke: (dash: "dashed")) #canvas({ plot.plot(size: (10,4), x-tick-step: none, x-ticks: ((1, [1]), (2, [2]), (3, [3]), (4, [4]), (5, [5]), (6, [6])), y-label: $frac(op("BER")(1, 2^M),op("BER")(100, 2^M))$, x-label: $2^M$, y-tick-step: 500, axis-style: "left", x-min: 0, { plot.add(((1,1815.2), (2,660), (3,46), (4,3.11), (5,1.33), (6,1.07)), mark: "o") }) })
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/scripting/loop.typ
typst
// Test break and continue in loops. --- loop-break-basic --- // Test break. #let var = 0 #let error = false #for i in range(10) { var += i if i > 5 { break error = true } } #test(var, 21) #test(error, false) --- loop-break-join-basic --- // Test joining with break. #let i = 0 #let x = while true { i += 1 str(i) if i >= 5 { "." break } } #test(x, "12345.") --- loop-continue-basic --- // Test continue. #let i = 0 #let x = 0 #while x < 8 { i += 1 if calc.rem(i, 3) == 0 { continue } x += i } // If continue did not work, this would equal 10. #test(x, 12) --- loop-continue-join --- // Test joining with continue. #let x = for i in range(5) { "a" if calc.rem(i, 3) == 0 { "_" continue } str(i) } #test(x, "a_a1a2a_a4") --- loop-break-outside-of-loop --- // Test break outside of loop. #let f() = { // Error: 3-8 cannot break outside of loop break } #for i in range(1) { f() } --- loop-break-join-in-last-arg --- // Test break in function call. #let identity(x) = x #let out = for i in range(5) { "A" identity({ "B" break }) "C" } #test(out, "AB") --- loop-continue-outside-of-loop-in-block --- // Test continue outside of loop. // Error: 12-20 cannot continue outside of loop #let x = { continue } --- loop-continue-outside-of-loop-in-markup --- // Error: 2-10 cannot continue outside of loop #continue --- loop-break-join-in-nested-blocks --- // Should output `Hello World ๐ŸŒŽ`. #for _ in range(10) { [Hello ] [World #{ [๐ŸŒŽ] break }] } --- loop-break-join-set-and-show --- // Should output `Some` in red, `Some` in blue and `Last` in green. // Everything should be in smallcaps. #for color in (red, blue, green, yellow) [ #set text(font: "Roboto") #show: it => text(fill: color, it) #smallcaps(if color != green [ Some ] else [ Last #break ]) ] --- loop-break-join-in-set-rule-args --- // Test break in set rule. // Should output `Hi` in blue. #for i in range(10) { [Hello] set text(blue, ..break) [Not happening] } --- loop-break-join-in-first-arg --- // Test second block during break flow. #for i in range(10) { table( { [A]; break }, for _ in range(3) [B] ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/quill/0.2.0/src/length-helpers.typ
typst
Apache License 2.0
#let convert-em-length(length, em) = { if length.em == 0pt { return length } if type(length.em) == "float" { return length.abs + length.em * em } return length.abs + length.em / 1em * em } #let get-length(length, container-length) = { if type(length) == "length" { return length } if type(length) == "ratio" { return length * container-length} if type(length) == "relative length" { return length.length + length.ratio * container-length} }
https://github.com/hexWars/resume
https://raw.githubusercontent.com/hexWars/resume/main/typst/resume.typ
typst
MIT License
// color #let self_color = rgb("#000080") // #000080 #008080 #4B0082 #let header( name: none, describe: none, socials: (), doc, ) = { grid( columns: (1fr, 1fr), box[ #text([#name], weight: 800, 2.5em) #v(-1.2em) #block(text(weight: 400, 1.5em, describe, style: "italic", fill: self_color)) ], align(top + right)[ #set block(below: 0.5em) #for item in socials [ #align(top)[ #link(item.link)[#item.describe] #box(height: 1em, baseline: 20%)[#pad(right: 0.4em)[#image(item.icon)]] ] ] ] ) doc } #let alert(body, fill: red) = { set text(white) set align(left) rect( fill: fill, inset: 6pt, radius: 5pt, [*#body*], ) } #let cv_section( title: none, color: rgb(0, 122, 122), ) = { alert(fill: color)[ #title ] }
https://github.com/PumasAI/SummaryTables.jl
https://raw.githubusercontent.com/PumasAI/SummaryTables.jl/master/docs/src/output.md
markdown
MIT License
# Output ## HTML In IDEs that support the `MIME"text/html"` or `MIME"juliavscode/html"` types, just `display`ing a `Table` will render it in HTML for you. All examples in this documentation are rendered this way. Alternatively, you can print HTML to any IO object via `show(io, MIME"text/html", table)`. ## LaTeX You can print LaTeX code to any IO via `show(io, MIME"text/latex", table)`. Keep in mind that the `threeparttable`, `multirow` and `booktabs` packages need to separately be included in your preamble due to the way LaTeX documents are structured. ```@example using SummaryTables using DataFrames using tectonic_jll mkpath(joinpath(@__DIR__, "outputs")) data = DataFrame( sex = ["m", "m", "m", "m", "f", "f", "f", "f", "f", "f"], age = [27, 45, 34, 85, 55, 44, 24, 29, 37, 76], blood_type = ["A", "0", "B", "B", "B", "A", "0", "A", "A", "B"], smoker = [true, false, false, false, true, true, true, false, false, false], ) tbl = table_one( data, [:age => "Age (years)", :blood_type => "Blood type", :smoker => "Smoker"], groupby = :sex => "Sex", show_n = true ) # render latex in a temp directory mktempdir() do dir texfile = joinpath(dir, "main.tex") open(texfile, "w") do io # add the necessary packages in the preamble println(io, raw""" \documentclass{article} \usepackage{threeparttable} \usepackage{multirow} \usepackage{booktabs} \begin{document} """) # print the table as latex code show(io, MIME"text/latex"(), tbl) println(io, raw"\end{document}") end # render the tex file to pdf tectonic_jll.tectonic() do bin run(`$bin $texfile`) end cp(joinpath(dir, "main.pdf"), joinpath(@__DIR__, "outputs", "example.pdf")) end nothing # hide ``` Download `example.pdf`: ```@raw html <a href="./../outputs/example.pdf"><img src="./../assets/icon_pdf.png" width="60"> ``` ## docx To get docx output, you need to use the WriteDocx.jl package because this format is not plain-text like LaTeX or HTML. The table node you get out of the `to_docx` function can be placed into sections on the same level as paragraphs. ```@example using SummaryTables using DataFrames import WriteDocx as W mkpath(joinpath(@__DIR__, "outputs")) data = DataFrame( sex = ["m", "m", "m", "m", "f", "f", "f", "f", "f", "f"], age = [27, 45, 34, 85, 55, 44, 24, 29, 37, 76], blood_type = ["A", "0", "B", "B", "B", "A", "0", "A", "A", "B"], smoker = [true, false, false, false, true, true, true, false, false, false], ) tbl = table_one( data, [:age => "Age (years)", :blood_type => "Blood type", :smoker => "Smoker"], groupby = :sex => "Sex", show_n = true ) doc = W.Document( W.Body([ W.Section([ SummaryTables.to_docx(tbl) ]) ]) ) W.save(joinpath(@__DIR__, "outputs", "example.docx"), doc) nothing # hide ``` Download `example.docx`: ```@raw html <a href="./../outputs/example.docx"><img src="./../assets/icon_docx.png" width="60"> ``` ## Typst You can print [Typst](https://github.com/typst/typst) table code to any IO via `show(io, MIME"text/typst", table)`. From SummaryTables v2.0 on, the Typst backend is using the native table functionality in Typst v0.11. Previous versions used the [tablex](https://github.com/PgBiel/typst-tablex/) package. ```@example using SummaryTables using DataFrames using Typst_jll mkpath(joinpath(@__DIR__, "outputs")) data = DataFrame( sex = ["m", "m", "m", "m", "f", "f", "f", "f", "f", "f"], age = [27, 45, 34, 85, 55, 44, 24, 29, 37, 76], blood_type = ["A", "0", "B", "B", "B", "A", "0", "A", "A", "B"], smoker = [true, false, false, false, true, true, true, false, false, false], ) tbl = table_one( data, [:age => "Age (years)", :blood_type => "Blood type", :smoker => "Smoker"], groupby = :sex => "Sex", show_n = true ) # render latex in a temp directory mktempdir() do dir typfile = joinpath(dir, "example.typ") open(typfile, "w") do io # print the table as latex code show(io, MIME"text/typst"(), tbl) end # render the tex file to pdf Typst_jll.typst() do bin run(`$bin compile $typfile`) end cp(joinpath(dir, "example.pdf"), joinpath(@__DIR__, "outputs", "example_typst.pdf")) end nothing # hide ``` Download `example_typst.pdf`: ```@raw html <a href="./../outputs/example_typst.pdf"><img src="./../assets/icon_pdf.png" width="60"> ```
https://github.com/seven-mile/blog-ng-content
https://raw.githubusercontent.com/seven-mile/blog-ng-content/master/_typst_ts_tmpl/sidenote.typ
typst
// Used to collect sidebar sidenotes. #let sidenotes = state("sidenotes", ()) #let heiti = ("Times New Roman", "Source Han Sans SC", "Source Han Sans TC", "New Computer Modern", "New Computer Modern Math") #let songti = ("Times New Roman", "Source Han Serif SC", "Source Han Serif TC", "New Computer Modern", "New Computer Modern Math") #let zhongsong = ("Times New Roman","STZhongsong", "SimSun", "New Computer Modern") #let absy = state("absy", 0in) // The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project(title: "Hexo Typst", authors: (), body, pagewidth: 0pt) = { // Set the document's basic properties. set document(author: authors, title: title) // Configure pages. The background parameter is used to // add the right background to the pages. set page( numbering: "1", number-align: center, height: auto, margin: (top: 20pt, rest: 0pt), width: pagewidth, ) set text(font: songti, lang: "en", size: 14pt) // "#d9d9e3" show math.equation: set text(weight: 400) // code block setting show raw: it => { if it.block { rect( width: 100%, inset: (x: 4pt, y: 5pt), radius: 4pt, fill: rgb(239, 241, 243), [ // set text(inner-color) #place(right, text(luma(110), it.lang)) #it ], ) } else { it } } locate((loc) => { absy.update(it => loc.position().at("y")) }) // The document is split in two with a grid. A left column for the main // flow and a right column for the sidebar sidenotes. let sidebar-width = 5.8cm - 1.6cm - 18pt grid( columns: (1fr, sidebar-width), column-gutter: 36pt, row-gutter: 32pt, // The main flow with body and publication info. { set par(justify: true) body v(1fr) set text(0.5em) }, // The sidebar with sidenotes. locate(loc => { show heading: underline.with(stroke: 2pt, offset: 4pt) set par(justify: true) let final_absy = absy.final(loc); for element in sidenotes.final(loc) { place(dy: element.at("pos").at("y") - final_absy)[ #box( width: sidebar-width, stroke: (left: 1pt, rest: none), outset: (x: 10pt, y: 5pt), element.at("body") ) ] } }), ) } // An sidenote that is displayed in the sidebar. Can be added // anywhere in the document. All sidenotes are collected automatically. #let sidenote(body) = { locate(loc => { let pos = loc.position(); sidenotes.update(it => it + (("pos": pos, "body": body),)) }); } // Store theorem environment numbering #let thmcounters = state("thm", ( "counters": ( "heading": (), "theorem": (0, 0), ), "latest": () ) ) #let thmenv(identifier, base, base_level, num, fmt) = { let global_numbering = numbering return ( body, name: none, numbering: "3.1.1", base: base, base_level: base_level ) => { let number = none if not numbering == none { locate(loc => { thmcounters.update(thmpair => { let counters = thmpair.at("counters") // Manually update heading counter counters.at("heading") = counter(heading).at(loc) if not identifier in counters.keys() { counters.insert(identifier, (0, )) } let tc = counters.at(identifier) if base != none { let bc = counters.at(base) // Pad or chop the base count if base_level != none { if bc.len() < base_level { bc = bc + (0,) * (base_level - bc.len()) } else if bc.len() > base_level{ bc = bc.slice(0, base_level) } } // Reset counter if the base counter has updated if tc.slice(0, -1) == bc { counters.at(identifier) = (..bc, tc.last() + 1) } else { counters.at(identifier) = (..bc, 1) } } else { // If we have no base counter, just count one level counters.at(identifier) = (tc.last() + 1,) let latest = counters.at(identifier) } if not num == none { return ( "counters": counters, "latest": num.split(".").map(int) ) } let latest = counters.at(identifier) return ( "counters": counters, "latest": latest ) }) }) number = thmcounters.display(x => { return global_numbering(numbering, ..x.at("latest")) }) } fmt(name, number, body) } } #let thmref( label, fmt: auto, makelink: true, ..body ) = { if fmt == auto { fmt = (nums, body) => { if body.pos().len() > 0 { body = body.pos().join(" ") return [#body #numbering("1.1", ..nums)] } return numbering("1.1", ..nums) } } locate(loc => { let elements = query(label, loc) let locationreps = elements.map(x => repr(x.location().position())).join(", ") assert(elements.len() > 0, message: "label <" + str(label) + "> does not exist in the document: referenced at " + repr(loc.position())) assert(elements.len() == 1, message: "label <" + str(label) + "> occurs multiple times in the document: found at " + locationreps) let target = elements.first().location() let number = thmcounters.at(target).at("latest") if makelink { return link(target, fmt(number, body)) } return fmt(number, body) }) } #let thmbox( identifier, head, fill: none, stroke: none, inset: 1.2em, radius: 0.3em, breakable: false, padding: (top: 0.5em, bottom: 0.5em), namefmt: x => [(#x)], titlefmt: strong, bodyfmt: x => x, base: "heading", base_level: none, num: none, ) = { let boxfmt(name, number, body) = { if not name == none { name = [ #namefmt(name)] } else { name = [] } let title = head if not num == none { title += " " + num } else if not number == none { title += " " + number } title = titlefmt(title) body = bodyfmt(body) pad( ..padding, block( fill: fill, stroke: stroke, inset: inset, width: 100%, radius: radius, breakable: breakable, [#title#name#h(0.1em):#h(0.2em)#body] ) ) } return thmenv(identifier, base, base_level, num, boxfmt) } #let thmplain = thmbox.with( padding: (top: 0em, bottom: 0em), breakable: true, inset: (top: 0em, left: 1.2em, right: 1.2em), namefmt: name => emph([(#name)]), titlefmt: emph, ) #let leqslant = $\u{2a7d}$ // #import "dotx.typ" // #import "mathscr.typ" // #import "fraktur.typ" #let imath = $\u{1D6A4}$ #let jmath = $\u{1D6A5}$ #let varnothing = $\u{2300}$ #let varsigma = $\u{03C2}$ // Define theorem environments #let theorem(num) = { thmbox( "theorem", // Definitions use their own counter "Theorem", inset: 0em, padding: (top: 0em, bottom: 0em), num: num, ) } #let lemma(num) = { thmbox( "theorem", // Definitions use their own counter "Lemma", base: "theorem", // Corollaries are 'attached' to Theorems inset: 0em, padding: (top: 0em, bottom: 0em), num: num, ) } #let corollary(num) = { thmbox( "corollary", // Definitions use their own counter "Corollary", base: "theorem", // Corollaries are 'attached' to Theorems inset: 0em, padding: (top: 0em, bottom: 0em), num: num, ) } #let definition(num) = { thmbox( "definition", // Definitions use their own counter "Definition", inset: 0em, padding: (top: 0em, bottom: 0em), num: num, ) } #let propostition(num) = { thmbox( "propostition", // Definitions use their own counter "Propostition", inset: 0em, padding: (top: 0em, bottom: 0em), num: num, ) } #let exercise = thmbox( "exercise", "Exercise", stroke: rgb("#ffaaaa") + 1pt, base: none, // Unattached: count globally ).with(numbering: "I") // Use Roman numerals // Examples and remarks are not numbered #let example = thmplain("example", "Example").with(numbering: none) #let remark = thmplain( "remark", "Remark", inset: 0em ).with(numbering: none) // Proofs are attached to theorems, although they are not numbered #let proof = thmplain( "proof", "Proof", base: "theorem", bodyfmt: body => [ #body #h(1fr) $square$ // Insert QED symbol ] ).with(numbering: none) #let solution = thmplain( "solution", "Solution", base: "exercise", inset: 0em, ).with(numbering: none)
https://github.com/mem-courses/calculus
https://raw.githubusercontent.com/mem-courses/calculus/main/homework-2/homework9.typ
typst
#import "../template.typ": * #show: project.with( course: "Calculus II", course_fullname: "Calculus (A) II", course_code: "821T0160", title: "Homework #9๏ผš้šๅ‡ฝๆ•ฐ็š„ๅๅฏผๆ•ฐ & ๆ–นๅ‘ๅฏผๆ•ฐไธŽๆขฏๅบฆ", authors: (( name: "<NAME>", email: "<EMAIL>", id: "#198" ),), semester: "Spring-Summer 2024", date: "May 7th, 2024", ) = ไน ้ข˜8-4 == P98 7 #prob[ ๅทฒ็Ÿฅ $x y = x f(z) + y g(z)$๏ผŒ$x f'(x) + y g'(z) != 0$๏ผŒ่ฏๆ˜Ž๏ผš $ (x-g(z)) pderi(z,x) = (y-f(z)) pderi(z,y) $ ] ไธค่พนๅŒๆ—ถๅฏน $x$ ๆฑ‚ๅๅฏผๅพ— $ y = f(z) + x f'(z) pderi(z,x) + y g'(z) pderi(z,x) ==> x - f(z) = (x f'(z) + y g'(z)) pderi(z,x) $ ไธค่พนๅŒๆ—ถๅฏน $y$ ๆฑ‚ๅๅฏผๅพ— $ x = x f'(z) pderi(z,y) + g(z) + y g'(z) pderi(z,y) ==> y - g(z) = (x f'(z) + y g'(z)) pderi(z,y) $ ๅ› ไธบ $x f'(x) + y g'(z) != 0$๏ผŒๆ‰€ไปฅ $ (x-g(z)) pderi(z,x) = (y-f(z)) pderi(z,y) $ ๅ‘ฝ้ข˜ๅพ—่ฏใ€‚ == P98 8 #prob[ ่ฎพๅ‡ฝๆ•ฐ $z=f(x,y)$ ๆ˜ฏ็”ฑๆ–น็จ‹ $z-y-x+x e^(z-y-x) = 0$ ๆ‰€็กฎๅฎš็š„ไบŒๅ…ƒๅ‡ฝๆ•ฐ๏ผŒๆฑ‚ $dif z$ใ€‚ ] ็”ฑ้ข˜ๆ„ๅพ— $ &0 = dif (z - y - x + x e^(z-y-x)) = (dif z - dif x - dif y) + dif x e^(z-y-x) + x e^(z-y-x) (dif z - dif y - dif x)\ ==>& (1+x e^(z-y-x)) dif z = (dif x + dif y) (1 + x e^(z-y-x)) - dif x e^(z-y-x)\ ==>& dif z = ((1+x e^(z-y-x) - e^(z-y-x)) dif x + (1+x e^(z-y-x)) dif y)/(1+ x e^(z-y-x)) $ == P98 15 #prob[ ่ฎพๅ‡ฝๆ•ฐ $u=f(x,y,z,t)$๏ผŒๅ…ถไธญ $z,t$ ๆ˜ฏ็”ฑๆ–น็จ‹็ป„ $display(cases(y+z+t=0,y^2+z^2+t^2=1))$ ็กฎๅฎš็š„ๅ‡ฝๆ•ฐ๏ผŒๆฑ‚ $pderi(u,x)$๏ผŒ$pderi(u,y)$ใ€‚ ] ๅฏนๆ–น็จ‹็ป„ๅพฎๅˆ†ๅพ— $ cases( dif y + dif z + dif t = 0, 2 y dif y + 2 z dif z + 2 t dif t = 0 ) $ ่งฃๅพ— $ cases( display(dif z = (y-t)/(t-z) dif y), display(dif t = (y-z)/(z-t) dif y), ) $ ๆ นๆฎๅ…จๅพฎๅˆ†ๅ…ฌๅผ $ dif u = f'_x dif x + f'_y dif y + f'_z dif z + f'_t dif t $ ๅฏ็Ÿฅ $ cases( pderi(u,x) = f'_x, pderi(u,y) = display(f'_y + (y-t)/(t-z) f'_z + (y-z)/(z-t) f'_t), ) $ == P99 16 #prob[ ่ฎพๅ‡ฝๆ•ฐ $y=y(x)$๏ผŒ$z=z(x)$ ๆ˜ฏ็”ฑๆ–น็จ‹ $z=x f(x+y)$ ๅ’Œ $F(x,y,z)=0$ ๆ‰€็กฎๅฎš็š„๏ผŒๅ…ถไธญ $f$ ๅฏๅฏผ๏ผŒ$F$ ๅ…ทๆœ‰่ฟž็ปญ็š„ๅๅฏผๆ•ฐ๏ผŒๆฑ‚ $display((dif z)/(dif x))$ใ€‚ ] ๅฏนๆ–น็จ‹ไธค็ซฏๅพฎๅˆ†ๅพ— $ dif z = dif x f(x+y) + x f'(x + y) (dif x + dif y) $ ๆ นๆฎๅ…จๅพฎๅˆ†ๅ…ฌๅผๆœ‰ $ dif F = F'_x dif x + F'_y dif y + F'_z dif z = 0 $ ๅพ— $display(F'_y = -(F'_x + F'_z)/(F'_y))$๏ผŒไปฃๅ…ฅๅฏ่งฃๅพ— $ (dif z)/(dif x) = (-x f'(x,y) F'x + (x f'(x,y) + f(x,y)) F'_y)/(F'_y + x f'(x,y) F'_z) $ = ไน ้ข˜8-5 == P104 2 #prob[ ๆฑ‚ๅ‡ฝๆ•ฐ $z=x^2 - x y + y^2$ ๅœจ็‚น $M(1,1)$ ๆฒฟไธŽ $O x$ ่ฝด็š„ๆญฃๅ‘็ป„ๆˆ $alpha$ ่ง’็š„ๆ–นๅ‘ $bold(l)$ ไธŠ็š„ๆ–นๅ‘ๅฏผๆ•ฐ๏ผŒๅœจๆ€Žๆ ท็š„ๆ–นๅ‘ไธŠ๏ผŒๆญคๆ–นๅ‘ๅฏผๆ•ฐๆœ‰๏ผš(1) ๆœ€ๅคงๅ€ผ๏ผ›(2) ๆœ€ๅฐๅ€ผ๏ผ›(3) ็ญ‰ไบŽ $0$ใ€‚ ] ่ฎพ็‚น $P_0 (1,1)$๏ผŒๅˆ™ $ pderi(z,x) = 2x-y ==>& atpos(pderi(z,x), P_0, "") = 1\ pderi(z,y) = -x+2y ==>& atpos(pderi(z,y), P_0, "") = 1 $ ๆ•…ๆ–นๅ‘ๅฏผๆ•ฐไธบ $ atpos(pderi(z,bold(l)), P_0, "") = cos alpha + sin alpha $ ๆ•…ๆ–นๅ‘ๅฏผๆ•ฐ๏ผš(1) $alpha=display(pi/4)+2k pi$ ๆ—ถๅ–ๅˆฐๆœ€ๅคงๅ€ผ $sqrt(2)$ใ€‚(2) $alpha=display(pi/4) + (2k+1) pi$ ๆ—ถๅ–ๅˆฐๆœ€ๅฐๅ€ผ $-sqrt(2)$ใ€‚(3) $alpha = display((3pi)/4) + k pi$ ๆ—ถ็ญ‰ไบŽ $0$ใ€‚่ฟ™้‡Œ $k$ ๆ˜ฏไปปๆ„ๆ•ดๆ•ฐใ€‚ == P104 3 #prob[ ๆฑ‚ๅ‡ฝๆ•ฐ $u = x y z$ ๅœจ็‚น $M(1,1,1)$ ๆฒฟๆ–นๅ‘ $bold(l) = {cos alpha, cos beta, cos gamma}$ ไธŠ็š„ๆ–นๅ‘ๅฏผๆ•ฐ๏ผŒๅ‡ฝๆ•ฐๅœจ่ฏฅ็‚น็š„ๆขฏๅบฆ็š„ๅคงๅฐ็ญ‰ไบŽๅคšๅฐ‘๏ผŸ ] $ &pderi(u,bold(l)) = y z cos alpha + x z cos beta + x y cos gamma \ ==>& atpos(pderi(u,bold(l)), P_0, "") = cos alpha + cos beta + cos gamma = {1,1,1} dot {cos alpha, cos beta, cos gamma}\ ==>& abs(atpos(grad u, P_0, "")) = sqrt(1^2+1^2+1^2) = sqrt(3) $ == P104 4 #prob[ ๆฑ‚ๅ‡ฝๆ•ฐ $u=x^2+y^2-z^2$ ๅœจ็‚น $A(1,0,0)$ ๅŠ $B(0,1,0)$ ไธค็‚นๆขฏๅบฆไน‹้—ด็š„่ง’ๅบฆใ€‚ ] ไพ้ข˜ๆ„ๅพ— $ pderi(u,x) = 2x;quad pderi(u,y) = 2y;quad pderi(u,z) = -2z $ ไปฃๅ…ฅๅพ— $ atpos(grad u, A, "") = {2,0,0};quad atpos(grad u, B, "") = {0,2,0} $ ่ฎพ่ง’ๅบฆไธบ $theta$๏ผŒๆœ‰ $ cos theta=(atpos(grad u, A, "") dot atpos(grad u, B, ""))/(abs(atpos(grad u, A, "")) dot abs(atpos(grad u, B, ""))) = 0 $ ๆ•…ไธคๆขฏๅบฆ้—ด็š„ๅคน่ง’ไธบ $theta= display(pi/2)$ใ€‚ = ไน ้ข˜8-6 == P121 4(2) #prob[ ๆฑ‚ๅ‡ฝๆ•ฐ็š„ๆžๅ€ผ๏ผš $ z = x^4 + y^4 - x^2 - 2 x y - y^2 $ ] ไพ้ข˜ๆ„ $ cases( pderi(z,x) = 4 x^3-2x-2y, pderi(z,y) = 4y^3-2x-2y, ) $ ๅฏๅพ—้ฉป็‚นไธบ $P_1 (0,0)$๏ผŒ$P_2 (1,1)$๏ผŒ$P_3 (-1,-1)$ใ€‚ๅ†ๆ นๆฎ $ cases( display((diff^2 z)/(diff x^2)) = 12 x^2 - 2, display((diff^2 z)/(diff x diff y)) = -2, display((diff^2 z)/(diff y^2)) = 12 y^2 - 2, ) $ #table3( columns: (1fr, 1fr, 1fr, 1fr, 2fr, 2fr), [], $A$, $B$, $C$, $B^2 - A C$, [*็ป“่ฎบ*], $P_0$, -2, -2, -2, 0, [ๅพ…ๅฎšใ€‚], $P_1$, 10, -2, 10, 96, [ๆ˜ฏๆžๅฐๅ€ผ็‚นใ€‚], $P_2$, 10, -2, 10, 96, [ๆ˜ฏๆžๅฐๅ€ผ็‚นใ€‚], ) ๅฏนไบŽ $P_0$๏ผŒๆ นๆฎๅŽŸๅ‡ฝๆ•ฐๅœจ ${1,1}$ ๅ’Œ ${1,-1}$ ไธคไธชๆ–นๅ‘ไธŠ็š„ๆญฃ่ดŸๆ€งไธๅŒ๏ผŒๅฏ้ชŒ่ฏ $P_0$ ไธๆ˜ฏๆžๅ€ผ็‚นใ€‚ ็ปผไธŠ๏ผŒๅ‡ฝๆ•ฐๅœจ $(1,1)$ ๅ’Œ $(-1,-1)$ ๅค„ๅ–ๅˆฐๆžๅฐๅ€ผ $-2$ใ€‚ == P121 5(2) #prob[ ๆฑ‚ๅ‡ฝๆ•ฐ็š„ๆกไปถๆžๅ€ผ๏ผš$u = x y z$๏ผŒ่‹ฅ $x^2+y^2+z^2=1$๏ผŒ$x+y+z=0$ใ€‚ ] ไปค $ F(x,y,z) = x y z + lambda (x^2+y^2+z^2-1) + mu(x+y+z) $ ่”็ซ‹ $ cases( pderi(F, x) = y z + 2 x lambda + mu = 0, pderi(F, y) = x z + 2 y lambda + mu = 0, pderi(F, z) = x y + 2 z lambda + mu = 0, pderi(F, lambda) = x^2 + y^2 + z^2 - 1 = 0, pderi(F, mu) = x + y + z = 0, ) $ ๏ผˆ็œ็•ฅไธ€ไบ›ๆญฅ้ชค๏ผ‰ๆœ€ๅŽๅฏ่งฃๅพ—ๅŽŸๅ‡ฝๆ•ฐ๏ผš #let t1=$display(1/sqrt(6))$ #let t2=$display(2/sqrt(6))$ (1) ๅœจ $(-t2,t1,t1),(t1,-t2,t1),(t1,t1,-t2)$ ๅค„ๅ–ๅˆฐๆœ€ๅฐๅ€ผ $-display(1/(3sqrt(6)))$๏ผ› (2) ๅœจ $(t2,-t1,-t1),(-t1,t2,-t1),(-t1,-t1,t2)$ ๅค„ๅ–ๅˆฐๆœ€ๅคงๅ€ผ $display(1/(3 sqrt(6)))$ใ€‚ == P121 10 #prob[ ๅœจๆคญๅœ† $x^2 + 4 y^2 = 4$ ไธŠๆฑ‚ไธ€็‚น๏ผŒไฝฟๅ…ถๅˆฐ็›ด็บฟ $2x + 3y - 6 = 0$ ็š„่ท็ฆปๆœ€็Ÿญใ€‚ ] ๆ นๆฎ็‚นๅˆฐ็›ด็บฟ็š„่ท็ฆปๅ…ฌๅผๆœ‰ $ d = (abs(2x+3y-6)/sqrt(2^2 + 3^2))^2 = abs(2x+3y-6)/sqrt(13) $ ๅ– $ f(x,y) = 13 d^2 = (2x+3y-6)^2 $ ๅณๆฑ‚ $f(x,y,z)$ ็š„ๆœ€ๅ€ผ็‚นใ€‚่ฎพ $ F(x,y) = (2x+3y-6)^2 - lambda (x^2+4 y^2 - 4) $ ่”็ซ‹ $ cases( pderi(F,x) = 2(2x+3y-6) - 2x lambda = 0, pderi(F,y) = 3(2x+3y-6) - 8y lambda = 0, pderi(F,lambda) = x^2 + 4 y^2 - 4= 0, ) $ ่งฃๅพ— $display((8/5,3/5)\, (-8/5, -3/5))$ ไธบไธค้ฉป็‚น๏ผŒ้ชŒ่ฏๅพ—ๅœจ็‚น $display((8/5,3/5))$ ๅค„ๅ–ๅˆฐๆœ€็Ÿญ่ท็ฆป $display(1/sqrt(13))$ใ€‚ == P121 11 #prob[ ๆฑ‚็ƒ้ข $x^2+y^2+z^2 = 1$ ไธŠๅˆฐ็‚น $(1,2,3)$ ็š„่ท็ฆปๆœ€็ŸญไธŽๆœ€้•ฟ็š„็‚นใ€‚ ] ๆ นๆฎไธค็‚น้—ด่ท็ฆปๅ…ฌๅผๆœ‰ $ d=sqrt((x-1)^2 + (y-2)^2 + (z-3)^2) $ ่ฎพ $ f(x,y,z)=d^2=(x-1)^2 + (y-2)^2 + (z-3)^2 $ ๅณๆฑ‚ $f(x,y,z)$ ็š„ๆœ€ๅ€ผ็‚นใ€‚ไปค $ F(x,y,z) = (x-1)^2 + (y-2)^2 + (z-3)^2 + lambda (x^2+y^2+z^2-1) $ ่”็ซ‹ $ cases( pderi(F,x) = 2(x-1) + 2x lambda, pderi(F,y) = 2(y-2) + 2y lambda, pderi(F,z) = 2(z-3) + 2z lambda, pderi(F,lambda) = x^2+y^2+z^2 - 1 = 0 ) $ ๅฏ่งฃๅพ—้ฉป็‚นไธบ $display(P_1(1/sqrt(14),2/sqrt(14),3/sqrt(14))\,space P_2(-1/sqrt(14),-2/sqrt(14),-3/sqrt(14)))$ใ€‚ไปฃๅ…ฅ้ชŒ่ฏๅพ— $P_1$ ไธบ่ท็ฆปๆœ€็Ÿญ็š„็‚น๏ผŒ$P_2$ ไธบ่ท็ฆปๆœ€้•ฟ็š„็‚นใ€‚ = ็ฌฌๅ…ซ็ซ ็ปผๅˆ้ข˜ == P129 3 #prob[ ่ฏๆ˜Žๅ‡ฝๆ•ฐ $f(x,y) = root(3, x^3+y^3)$ ๅœจ็‚น $(0,0)$ ๅค„ๆฒฟไปปๆ„ๆ–นๅ‘็š„ๆ–นๅ‘ๅฏผๆ•ฐ้ƒฝๅญ˜ๅœจ๏ผŒไฝ†ๅœจ็‚น $(0,0)$ ๅค„็š„ๅ…จๅพฎๅˆ†ไธๅญ˜ๅœจใ€‚ ] ่ฎพ $l^circle.small = {cos alpha, sin alpha}$๏ผŒ็”ฑๅฎšไน‰ๅผ $ pderi(f,bold(l)) = lim_(rho->0) (root(3,rho^3 cos^3 alpha+rho^3 sin^3 alpha))/(rho) = root(3,cos^3 alpha + sin^3 alpha) $ ๆ•…ๆ–นๅ‘ๅฏผๆ•ฐๅญ˜ๅœจใ€‚ ๅ†้ชŒ่ฏๅฏๅพฎๆ€ง๏ผŒ่€ƒ่™‘๏ผš $ &lim_(x->0, y=k x) (f(x,y)-f(0,0))/(sqrt(x^2+y^2)) = lim_(x->0) root(3,1+ k^3)/sqrt(1+k^2) $ ๅ– $k=0$ ๆœ‰ๆž้™ไธบ $1$๏ผ›ๅ– $k=1$ ๆœ‰ๆž้™ไธบ $display(root(3,2)/sqrt(2))$ใ€‚ๆ นๆฎ $1!=display(root(3,2)/sqrt(2))$๏ผŒๅŽŸๅ‡ฝๆ•ฐๅœจ็‚น $(0,0)$ ๅค„ไธๅฏๅพฎใ€‚ == P129 4 #prob[ ่ฏๆ˜Žๅ‡ฝๆ•ฐ $f(x,y) = display(cases((x^2+y^2) sin display(1/(x^2+y^2))\,quad & (x,y) != (0,0), 0\,quad& (x,y)=(0,0)))$ ๅœจ็‚น $(0,0)$ ็š„้‚ปๅŸŸไธญๆœ‰ๅๅฏผๆ•ฐ $f'_x (x,y)$ ๅ’Œ $f'_y (x,y)$ใ€‚่ฟ™ไบ›ๅๅฏผๆ•ฐๅœจ็‚น $(0,0)$ ๅค„ๆ˜ฏไธ่ฟž็ปญ็š„๏ผŒไธ”ๅœจๆญค็‚น็š„ไปปไฝ•้‚ปๅŸŸไธญๆ˜ฏๆ— ็•Œ็š„๏ผŒไฝ†ๆญคๅ‡ฝๆ•ฐๅœจ็‚น $(0,0)$ ๅค„ๅฏๅพฎใ€‚ ] ็”ฑๅฎšไน‰ๅผ $ f'_x (0,0) = lim_(x->0) (f(x,0)-f(0,0))/(x-0) = lim_(x->0) (x^2 sin (1/x^2))/x = lim_(x->0) x sin(1/x) = 0 $ ๅŒ็† $f'_y (0,0) = 0$ใ€‚ไฝ† $ f'_x (x,y) = 2x sin(1/(x^2+y^2)) + 2x(x^2+y^2) cos(1/(x^2+y^2))quad ((x,y)!=(0,0)) $ ่€ƒ่™‘ $ lim_((x,y)->(0,0)) f'_x (x,y) &= lim_((x,y)->(0,0)) (2x sin(1/(x^2+y^2)) + (2x)/(x^2+y^2) cos(1/(x^2+y^2))) $ ๅ– $y=k x$๏ผŒๆœ‰ $ lim_(x->0,y=k x) f'_x (x,y) &= (2x sin(1/(x^2+k^2 x^2)) + (2x)/(x^2+k^2 x^2) cos(1/(x^2+k^2 x^2)))\ &= ((2)/(x(1+k^2)) cos(1/(x^2+k^2 x^2))) $ ้œ‡่กไธ”ๆ— ็•Œ๏ผŒ$f'_y$ ไนŸๅŒ็†ใ€‚ๆ•…ๅๅฏผๆ•ฐๅœจ $(0,0)$ ๅค„ไธ่ฟž็ปญ๏ผŒไธ”ๅœจ้‚ปๅŸŸๅ†…ๆ— ็•Œใ€‚ ๅฆ้ชŒ่ฏๅฏๅพฎๆ€ง๏ผš $ lim_((x,y) -> (0,0)) (f(x,y)-f(0,0))/(sqrt(x^2+y^2)) = lim_((x,y)->(0,0)) ((x^2+y^2) sin (1/(x^2+y^2)))/sqrt(x^2+y^2) = lim_(t->0) sqrt(x^2+y^2) sin(1/(x^2+y^2)) = 0 $ ๆ•…ๅŽŸๅ‡ฝๆ•ฐๅœจ็‚น $(0,0)$ ๅค„ๅฏๅพฎใ€‚ == P129 9 #prob[ ่ฎพ $u=f(x,y,z,t)$๏ผŒ$g(y,z,t)=0$๏ผŒ$h(z,t)=0$๏ผŒๆฑ‚ $display((diff u)/(diff x))$๏ผŒ$display((diff u)/(diff y))$ใ€‚ ] ่”็ซ‹ $ cases( dif u = f'_x dif x + f'_y dif y + f'_z dif z + f'_y dif t, g'_y dif y + g'_z dif z + g'_t dif t = 0, h'_z dif z + h'_t dif t = 0, ) $ ่งฃๅพ— $ cases( display(dif z = (g'_y h'_t)/(g'_t h'_z - g'_z h'_t)), display(dif t = (g'_y h'_z)/(g'_z h'_t - g'_t h'_z)), ) $ ไปฃๅ…ฅๅพ— $ cases( pderi(u,x) = f'_x, display(pderi(u,y) = f'_y + (g'_y h'_t)/(g'_t h'_z - g'_z h'_t) f'_z + (g'_y h'_z)/(g'_z h'_t - g'_t h'_z)f'_t), ) $
https://github.com/The-Notebookinator/notebookinator
https://raw.githubusercontent.com/The-Notebookinator/notebookinator/main/themes/themes.typ
typst
The Unlicense
#import "./default/default.typ" /* Radial Theme Designed by @BattleCh1cken Implemented by @BattleCh1cken */ #import "./radial/radial.typ" /* Linear Theme Designed by @BestUsernamEver Implemented by @BestUsernamEver */ #import "./linear/linear.typ"
https://github.com/m-pluta/bias-in-ai-report
https://raw.githubusercontent.com/m-pluta/bias-in-ai-report/main/report/template.typ
typst
// Word count function #let recursive_count(_body) = { let r(cont) = { let _C = 0 if type(cont) == content { for key in cont.fields().keys() { if key == "children" { for _child in cont.fields().at("children") { _C += r(_child) } // } else if key == "caption" { // _C += r(cont.fields().at("caption")) } else if key == "body" { _C += r(cont.fields().at("body")) } else if key == "text" { _C += cont.fields().at("text").split(" ").filter(w => w.len() > 1).len() } else if key == "child" { _C += r(cont.at("child")) } } } else if type(cont) == array { for item in cont { _C += r(item) } } return _C } return r(_body) } #let ieee( title: [Paper Title], authors: (), abstract: none, index-terms: (), paper-size: "a4", bibliography-file: none, pre_body: [], table: [], post_body: [], ) = { // Document formatting set document(title: title, author: authors.map(author => author.name)) // Text formatting set text(font: "STIX Two Text", size: 10pt) // Page formatting set page( paper: paper-size, margin: (x: 41.5pt, top: 80.51pt, bottom: 89.51pt), numbering: "1", ) // Equation formatting set math.equation(numbering: "(1)") show math.equation: set block(spacing: 0.65em) show figure: set block(breakable: true) show ref: it => { if it.element != none and it.element.func() == math.equation { link(it.element.location(), numbering( it.element.numbering, ..counter(math.equation).at(it.element.location()) )) } else { it } } // List formatting set enum(indent: 0.75em, body-indent: 0.5em) set list(indent: 0.75em, body-indent: 0.5em) // Heading formatting set heading(numbering: "1.1.1.") show heading: it => locate(loc => { let levels = counter(heading).at(loc) let deepest = if levels != () { levels.last() } else { 1 } set text(10pt, weight: 400) if it.level == 1 [ #let is-ack = it.body in ([Acknowledgment], [Acknowledgement]) #set align(center) #set text(if is-ack { 10pt } else { 12pt }) #show: smallcaps #v(20pt, weak: true) #if it.numbering != none and not is-ack { numbering("1.", deepest) h(7pt, weak: true) } #it.body #v(13.75pt, weak: true) ] else if it.level == 2 [ #set par(first-line-indent: 0pt) #set text(style: "italic") #v(10pt, weak: true) #if it.numbering != none { numbering("1.", deepest) h(7pt, weak: true) } #strong(it.body) #v(10pt, weak: true) ] else [ #if it.level == 3 { numbering("1)", deepest) [ ] } _#(it.body):_ ] }) // Title v(0pt, weak: false) align(center, text(18pt, title)) v(6.35mm, weak: true) // Authors for i in range(calc.ceil(authors.len() / 3)) { let end = calc.min((i + 1) * 3, authors.len()) let is-last = authors.len() == end let slice = authors.slice(i * 3, end) grid( columns: slice.len() * (1fr,), gutter: 12pt, ..slice.map(author => align(center, { text(12pt, author.name + if "cis" in author {" - " + author.cis}) if "department" in author [ \ #emph(author.department) ] if "organization" in author [ \ #emph(author.organization) ] if "location" in author [ \ #author.location ] if "email" in author [ \ #link("mailto:" + author.email) ] [ #let t = recursive_count(title); #let pre = recursive_count(pre_body); #let tab = recursive_count(table); #let post = recursive_count(post_body); #let total = t + pre + post; // \ #{t} + #{pre} + (#{tab}) + #{post} = #{total}/1650 words \ #{total} words ] })) ) if not is-last { v(16pt, weak: true) } } v(22pt, weak: true) // Pre-body set par(justify: true) show par: set block(spacing: 1em) columns( 2, gutter: 12pt, [ // Abstract #if abstract != [] { set text(weight: 700) h(1em) [_Abstract_---] abstract v(-8pt, weak: false) } ] + pre_body) // Stakeholder table set par(justify: false) set list(indent: 0em) page( paper: paper-size, flipped: false, table ) // Post body set par(justify: true) set list(indent: 0.75em) show: columns.with(2, gutter: 12pt) post_body // Bibliography if bibliography-file != none { bibliography(bibliography-file, full: true, style: "ieee") } }
https://github.com/fredguth/abnt-typst
https://raw.githubusercontent.com/fredguth/abnt-typst/main/cap2.typ
typst
#import("_config.typ"): config, metadados, estilo #let blockquote = (q) => block(spacing: 1.5cm, par(leading:0.63em, text(font: estilo.fonte.serif, weight: "regular", size: 90%*estilo.fonte.tamanho.regular, align(right+bottom, pad(left: 4cm, q))))) #pagebreak(to:"odd") = Sobre a imagem\... <sobre_imagem> == Consideraรงรตes iniciais <consideraรงรตes-iniciais> As imagens sรฃo o produto e o reflexo histรณrico da civilizaรงรฃo. Nรฃo surgiram com a internet, ou com a TV, nem mesmo com o cinema e~a fotografia. Muito antes de todas essas tecnologias audiovisuais que comumente associamos ร  veiculaรงรฃo de imagens, as pessoas jรก~pintavam quadros, desenhavam em diversos tipos de suportes, produziam gravuras. No paleolรญtico,~registraram aspectos da vida, utilizando desenhos rupestres, estatuetas, pinturas e desenhos. E essas imagens tinham objetivo โ€“ talvez fazer algum tipo de comunicaรงรฃo.~Dois milhรตes e meio de anos nos separam~desses tempos que hoje sรฃo evocados como o inรญcio da histรณria da arte, embora o conceito de arte tal como compreendemos hoje nรฃo se ajuste perfeitamente a essas imagens. De lรก para cรก, a imagem vem servindo a diferentes propรณsitos humanos, anteriores, inclusive, ร  prรณpria~arte.~ Na Antiguidade romana, o termo~โ€œimagemโ€ referia-se ร  mรกscara mortuรกria usada em funerais, o que indica que essa palavra remetia~ร ~morte e ao culto dos mortos. No Egito Antigo, a imagem tinha objetivos polรญticos e religiosos. No Renascimento, a separaรงรฃo~entre representaรงรฃo religiosa~e representaรงรฃo profana deu origem a imagens pictรณricas, o que significa que sรณ recentemente, em termos histรณricos, passamos a produzir imagens tambรฉm para nos referirmos ao mundo que nรฃo tem relaรงรฃo apenas com a religiรฃo. Atualmente, a imagem tanto pode servir a todos os propรณsitos polรญticos e religiosos de entรฃo, como tambรฉm a estรฉticos, artรญsticos e cientรญficos. Na medicina, por exemplo, os exames de imagem, como tomografias computadorizadas e ressonรขncias magnรฉticas,#footnote[Para mais informaรงรตes sobre tomografia e ressonรขncia: \<http:\/\/telemedicinamorsch.com.br/blog/2016/11/o-que-e-laudo-de-tomografia-para-que-serve/\>; \<http:\/\/telemedicinamorsch.com.br/blog/2016/11/o-que-e-ressonancia-magnetica-como-funciona/\>. Acesso em: 31 jul. 2017.]~sรฃo largamente usados para diagnosticar diversas doenรงas. E hรก todo um setor~produtivo que se ocupa exclusivamente de desenvolver essas tecnologias para aplicaรงรฃo na saรบde.~ Atรฉ aqui, tratamos da imagem visual: representaรงรฃo grรกfica, plรกstica ou fotogrรกfica. Mas hรก outros tipos de imagem, por exemplo, a imagem mental. Embora nรฃo seja essa imagem o objeto central de estudo a que nos propusemos,~รฉ preciso citรก-la para diferenciar os tipos de imagens com~os quais lidamos ao longo da vida e para jรก prepararmos o campo para~adentrar o imaginรกrio, tema com que tambรฉm trabalharemos nesta dissertaรงรฃo.~ โ€œA imagem mental corresponde~ร  impressรฃo que temos, quando, por exemplo, lemos ou ouvimos a descriรงรฃo de um lugar, de~#emph[vรช-lo~]quase como se estivรฉssemos lรกโ€ (JOLY, 2012, p. 19). Nรฃo entraremos na discussรฃo sobre a (in)existรชncia de tais imagens.~Diremos apenas que hรก quem defenda que nรฃo passam de descriรงรตes verbais e abstratas, cujo significado nรฃo pode ser apreendido senรฃo pela linguagem. Isso porque seu carรกter subjetivo torna-a inacessรญvel a outros indivรญduos, alรฉm de quem imagina.~Nessa categoria, incluem-se os sonhos, por exemplo.~ Em algumas รกreas do conhecimento, estudar imagem significa fazer associaรงรตes mentais sistemรกticas para melhor~compreender um ser ou um objeto, uma profissรฃo, uma prรกtica humana. Assim, os estudiosos buscam compreender a โ€œimagem da mulherโ€ em dado contexto sociocultural, ou a imagem de uma empresa, de um grupo polรญtico ou religioso. E nos estudos da lรญngua, o objeto รฉ a imagem verbal, mais comumente a metรกfora.~ Alรฉm das imagens visuais e mentais, hรก as imagens de sรญntese, que sรฃo aquelas produzidas por computador para criar universos virtuais, como os videogames, que tiveram inรญcio com imagens grosseiras e evoluรญram para as atuais imagens interativas que perturbam a distinรงรฃo entre o real e o virtual. โ€œO holograma โ€“ imagem a #emph[laser] em trรชs dimensรตes โ€“ faz parte dessas novas imagens desconcertantes, por um lado, por seu aspecto realista, mas tambรฉm por seu aspecto fantasmรกtico de duplo perfeito, flutuante, como em suspensรฃoโ€ (JOLY, 2012, p. 27).~Um~#emph[show]~em tributo ao cantor <NAME> tornou-se histรณrico~para os brasilienses: na noite do sรกbado 29 de junho de 2013, no Estรกdio~Nacional <NAME>, em Brasรญlia, um holograma recriou em ambiente digital a sensaรงรฃo de estar diante do artista. โ€œA imagem de Renato Russo surge no palco em quatro dimensรตes. Altura, largura, profundidade e saudade. E 45 mil pessoas sabiam que ele nรฃo estava ali, e que ele estava~simโ€.#footnote[G1. #emph[Renato Russo \'volta\', em 3D, e canta para 45 mil fรฃs em Brasรญlia.] 2013. Disponรญvel em: \<http:\/\/g1.globo.com/fantastico/noticia/2013/06/renato-russo-volta-em-3d-e-canta-para-45-mil-fas-em-brasilia.html\>. Acesso em: 27 mar. 2017. <g1.-renato-russo-volta-em-3d-e-canta-para-45-mil-fรฃs-em-brasรญlia.-2013.-disponรญvel-em-httpg1.globo.comfantasticonoticia201306renato-russo-volta-em-3d-e-canta-para-45-mil-fas-em-brasilia.html.-acesso-em-27-mar.-2017.>] Como bem descreve Joly (2012): #blockquote[ Instrumento de comunicaรงรฃo, divindade, a imagem assemelha-se ou confunde-se com o que representa. Visualmente imitadora, pode enganar ou educar. Reflexo, pode levar ao conhecimento. A Sobrevivรชncia, o Sagrado,~a Morte, o Saber, a Verdade, a Arte, se tivermos um mรญnimo de memรณria, sรฃo os campos a que o simples termo~โ€œimagemโ€~nos vincula. (JOLY, 2012, p. 19)] Imagem~รฉ tudo isso e talvez mais, porque nรฃo รฉ tรฃo simples classificar~o que vemos, em que pensamos ou com que sonhamos: seriam imagens todas elas? Para efeito da identificaรงรฃo do objeto~central desta pesquisa, adotaremos, entรฃo, o conceito de Aumont (2011), a seguir. == O conceito~de imagem<o-conceito-de-imagem> Para tรฃo diversos empregos~do vocรกbulo โ€œimagemโ€, hรก de haver um ponto comum que justifique~significados~diferentes para~um mesmo significante. Para Joly, esse ponto comum parece ser a analogia: โ€œMaterial ou imaterial, visual ou nรฃo, natural ou fabricada, uma โ€˜imagemโ€™ รฉ antes de mais nada~#emph[algo que se assemelha a outra coisa]โ€ (JOLY, 2012, p. 38 โ€“ grifos da autora).~ Partindo~para uma delimitaรงรฃo~da~imagem~objeto deste trabalho, adotaremos o conceito de Aumont (2011):~ #blockquote[ A imagem, na nossa cultura, รฉ tudo isso: uma reproduรงรฃo de um aspecto do mundo, captada pela sensibilidade mais ou menos individual, mais ou menos genรฉrica e tรญpica de um mediador (artista ou nรฃo), que nos comunica informaรงรตes e sentimentos, suscitando em nรณs outros ainda โ€“ e รฉ tambรฉm um objeto novo acrescentado ao mundo, um objeto que vive a sua vida, tornando-se cรฉlebre ou permanecendo ignorado.~(AUMONT, 2011, p. 7)~ ] As palavras~que completam~o~excerto de Aumont (2011, p. 7) sรฃo as seguintes: โ€œA imagem รฉ um sรณsia do mundo, mas um sรณsia deformado, por muito realista que seja, e~que exerce sobre nรณs a atraรงรฃo e eficรกcia mรกgicas do duplo, ao mesmo tempo que o encanto prรณprio de um objeto puramente visualโ€.~Com essas palavras, o que percebemos รฉ que~a imagem รฉ sempre um objeto segundo~(presente)~com relaรงรฃo a outro (ausente)~que ela representa.~E, ao representar, produz sentido(s) que suscita(m), por parte de quem a olha, interpretaรงรตes E chegamos ao que Joly (2012) considera como consequรชncia da tomada de consciรชncia do estatuto da imagem: #blockquote[\[...\] constatar que esse denominador comum da analogia, ou da semelhanรงa, coloca de imediato a imagem na categoria das #emph[representaรงรตes]. Se ela parece รฉ porque~#emph[ela nรฃo รฉ a prรณpria coisa]: sua funรงรฃo รฉ, portanto, evocar, querer dizer outra coisa que nรฃo ela prรณpria, utilizando o processo da semelhanรงa. Se a imagem รฉ percebida como~#emph[representaรงรฃo], isso quer dizer que a imagem รฉ percebida como signo.~(JOLY, 2012, p. 39~โ€“ grifos nossos)] Essa รฉ uma perspectiva da teoria semiรณtica, que propรตe considerar a imagem como signo e que ajuda a compreender o estatuto da imagem. <NAME>, que serรก aqui citado~algumas~vezes, รฉ referรชncia importante dessa linha teรณrica. Isso significa que, embora esta nรฃo seja uma pesquisa de semiรณtica, a anรกlise das imagens que compรตem o~#emph[corpus]~serรก feita com o apoio da semiรณtica Assumir pressupostos semiรณticos, como perceber a imagem como signo, representaรงรฃo, exige reflexรฃo sobre~a(s) mensagem(ns) de~determinada~imagem. Quem produz e expรตe uma imagem tem, certamente,~objetivo(s), tem algo a dizer e nรฃo o faz por palavras. Quem olha uma imagem pode ou nรฃo se sentir atraรญdo e, caso seja atraรญdo, pode se perguntar sobre o conteรบdo daquela imagem. Se as representaรงรตes sรฃo compreendidas pelo indivรญduo que olha a imagem, รฉ porque existe, entre ele e o outro que a produziu, um mรญnimo de convenรงรฃo sociocultural que permitiu a comunicaรงรฃo,~evocando~a semelhanรงa,~o traรงo e~a convenรงรฃo, isto รฉ, o รญcone,~o รญndice~e~o sรญmbolo.~Mas Joly~(2012, p. 42)~nos alerta: โ€œReconhecer motivos nas mensagens visuais e interpretรก-los sรฃo duas operaรงรตes mentais complementares, mesmo que tenhamos a impressรฃo de que sรฃo simultรขneasโ€ A experiรชncia de olhar confere importรขncia especial ร s imagens visuais, mas, como bem destaca Novaes (2005):~ #blockquote[ As imagens nรฃo sรฃo, portanto, apenas, nem mesmo principalmente, um objeto de contemplaรงรฃo do olho e do espรญrito. ร‰ atravรฉs delas que o olhar se realiza em nรณs com o que nos vem de fora; da mesma maneira que รฉ atravรฉs das imagens do espรญrito que o homem realiza o que estรก no mundo. #emph[As imagens permitem, pois, este duplo movimento: sair de si e trazer o mundo para dentro~de si]. (NOVAES, 2005, p. 10-11 โ€“ grifos nossos)~ ] A vida contemporรขnea tornou-se muito prรณdiga na produรงรฃo e exibiรงรฃo de imagens. Nรฃo hรก como~parar de consumir imagens, e o tempo da nossa existรชncia parece insuficiente para a nossa capacidade de pensar sobre~elas, de compreender o mundo a partir delas.~E imagem sem pensamento pode ser uma fรณrmula empobrecedora para a vida do indivรญduo e perigosa para a coletividade, porque reduz a experiรชncia de viver a mera distraรงรฃo (NOVAES, 2005, p. 14), consequentemente, nรฃo conduz a um universo de luz e sombra, que รฉ o imaginรกrio, onde moram as imagens,~mas tambรฉm~a~#underline[fan]tasia, o~#underline[fan]tรกstico, o~#underline[fan]tasma~(essas palavras vรชm do gregoโ€ฏ#emph[phos], โ€œluzโ€, do verboโ€ฏ#emph[phaรญnein], โ€œfazer aparecerโ€, pois o que se mostra iluminado aparece, se faz notar).~ Hรก, portanto, necessรกria articulaรงรฃo entre imagens que nos cercam e ideias jรก formadas e que constituem o imaginรกrio, e tanto as primeiras quanto as segundas sรณ podem significar algo se formos capazes de pensar sobre elas, o que vai alรฉm da simples distraรงรฃo de olhar para elas. A partir desse pensar, chega-se ao deciframento do mundo.~Neste trabalho, o resultado que se espera รฉ decifrar a fotografia de <NAME>, em primeiro lugar, mas tambรฉm aquelas que surgiram como eco desta, de tal forma que seja possรญvel observar o duplo movimento descrito por Novaes (2005) โ€“ o que รฉ โ€œsair de siโ€, o que รฉ โ€œtrazer o mundo para dentro de siโ€ e como esse vaivรฉm resulta na compreensรฃo de um aspecto do mundo e da vida. Imagens tรชm~extraordinรกria forรงa de convencimento.~Mostram pela afirmaรงรฃo porque ignoram a negaรงรฃo;~nรฃo explicam, nรฃo comparam, nรฃo deduzem~โ€“~tudo o que dizem poderia se resumir em:~aรญ estรก,~รฉ assim.~Tornam presente qualquer passado ou ausรชncia. โ€œA imagem quer anular a morteโ€ (WOLFF, 2005, p. 32).~Por isso, nas sociedades tradicionais, grande parte das imagens produzidas~รฉ composta de deuses e de mortos โ€“ imagens sagradas que precederam o nascimento da arte.~ Nas sociedades~modernas โ€“ surgidas a partir do sรฉculo XVI, na Europa, e consolidadas no final do sรฉculo XIX โ€“,~imagens sagradas e profanas~transbordam. O prodigioso desenvolvimento de tรฉcnicas automรกticas de reproduรงรฃo โ€“ fotografia, cinema, televisรฃo, imagens~de sรญntese~โ€“ pรดs imagens em todos os lugares, imagens de tudo, de todos e para todos, num movimento que deu acesso a todos ร  cultura e ร  realidade do mundo~(WOLFF, 2005). Sobre~โ€œrealidadeโ€, porรฉm, รฉ preciso~dizer: na contemporaneidade, ter acesso ao real via imagens tรฉcnicas รฉ uma~ilusรฃo, posto que o que vemos sรฃo recortes, fragmentos: โ€œSerรก que imaginamos quantos acontecimentos, mais graves, mais importantes, histรณricos, foram omitidos porque nรฃo havia cรขmera para filmรก-los ou porque decidimos~nรฃo os~mostrar?โ€~(WOLFF, 2005, p. 44). Mais que isso, serรก que estรก claro para o olhar que as imagens tรฉcnicas~nรฃo sรฃo โ€“ como podem parecer โ€“ o real se reproduzindo sozinho, sem a atuaรงรฃo humana? ~ Segundo Wolff (2005), #blockquote[ O mais perigoso poder da imagem รฉ fazer crer que ela nรฃo รฉ uma imagem, fazer-se esquecer como imagem. Antes da arte, olhรกvamos o รญcone e acreditรกvamos ver o prรณprio deus, diretamente, sem representaรงรฃo. Depois da arte, olhamos para a televisรฃo e cremos ver a prรณpria realidade, diretamente, sem representaรงรฃo. A causa estรก ausente, o trabalho de produรงรฃo da imagem nรฃo รฉ mais visto na imagem, a imagem nรฃo pode ser vista como imagem. Diante dessas imagens ao vivo e em tempo real, atravessamos a tela, no real registrado, a representaรงรฃo รฉ negada como representaรงรฃo \[...\]. (WOLFF, 2005, p. 43)~ ] A esse propรณsito, o artista surrealista belga <NAME> inquietou o mundo com uma obra revolucionรกria e fundamental que nos faz pensar sobre a relaรงรฃo que existe entre o objeto em si e sua representaรงรฃo: #emph[Ceci nโ€™est pas une pipe] (Isto nรฃo รฉ um cachimbo), pinturas em que ele chama a atenรงรฃo para o fato sempre esquecido de que a pintura de um cachimbo nรฃo รฉ um cachimbo, mas uma pintura. Dois dos quadros dessa sรฉrie sรฃo os mais conhecidos e os mais importantes: #emph[La trahison des images], de 1928, e #emph[Les deux mystรจres], de 1966. #image("./arquivos/image4.png", width: 3.7605872703412073in, height: 2.534300087489064in) <_Toc507740886>#strong[Figura 1 โ€“ A traiรงรฃo das imagens] #image("./arquivos/image5.png", width: 3.746606517935258in, height: 3.161367016622922in) <_Toc507740887>#strong[Figura 2 โ€“ Os dois mistรฉrios] #blockquote[ O tรญtulo โ€œA traiรงรฃo das imagensโ€ chama a atenรงรฃo para a circunstรขncia de as coisas nรฃo serem o que parecem ser e, em particular, para o fato, que deveria ser รณbvio mas nรฃo รฉ, de que a representaรงรฃo de uma coisa nunca serรก mais do que isto: a representaรงรฃo de uma coisa e nรฃo a prรณpria coisa. Nรฃo sabemos como as coisas sรฃo em si, apenas como elas aparecem aos nossos limitados sentidos e ร  nossa limitada mente em dado momento limitado. \[...\] O tรญtulo โ€œOs dois mistรฉriosโ€ mostra que o pintor nรฃo ficou contente com um mistรฉrio โ€œsรณโ€ e resolveu duplicรก-lo, dรฉcadas depois do primeiro quadro e de toda a repercussรฃo que ele gerou. \[...\] O primeiro mistรฉrio รฉ o da traiรงรฃo das imagens, que sรฃo imagens das coisas e nรฃo as prรณprias coisas que imaginamos. O segundo mistรฉrio รฉ o da explicitaรงรฃo da metaficรงรฃo, isto รฉ, da ficรงรฃo dentro da ficรงรฃo que, paradoxalmente, tanto revela quanto esconde o labirinto vertiginoso em que a arte vem nos jogando hรก tanto tempo.#footnote[BERNADO, Gustavo. Desde quando um cachimbo nรฃo รฉ um cachimbo. #emph[Revista Eletrรดnica do Vestibular UERJ.] Rio de Janeiro, Ano 11, n. 30, 2018. Disponรญvel em: \<http:\/\/www.revista.vestibular.uerj.br/coluna/coluna.php?seq\_coluna\=80\>. Acesso em: 14 jan. 2018.] ] Neste trabalho,~trataremos de imagens visuais fixas, especificamente de uma fotografia~jornalรญstica,~e passaremos por manifestaรงรตes visuais~como representaรงรตes secundรกrias dessa fotografia.~Isso obriga a que abordemos a imagem analรณgica sob pontos de vista que~tenham รญntima relaรงรฃo com procedimentos tรฉcnicos~de produzir imagens~e~com a condiรงรฃo interconectada da sociedade em rede e dos meios de comunicaรงรฃo, mas tambรฉm sob o ponto de vista dos sentidos que essas imagens adquirem e das relaรงรตes que mantรชm com ideias guardadas no imaginรกrio. Os sentidos partirรฃo do real, mas transitarรฃo pelo imaginรกrio e pelo ficcional, na medida em que nosso objeto de estudo parece se situar nas fronteiras desses campos, muito mais do que no real que o fotojornalismo sugere. A fotografia jornalรญstica em questรฃo~foi feita pela fotojornalista turca~<NAME>, no dia 2 de setembro de 2015,~em~Bodrum, na Turquia, em que se vรช uma crianรงa morta nas areias da praia โ€“ รฉ <NAME>, 3 anos, sรญrio de origem curda,~muรงulmano, provavelmente sunita (como a maioria dos muรงulmanos), que fugia da guerra em seu paรญs e morreu apรณs o barco em que viajava com a famรญlia e mais algumas pessoas naufragar. E as perguntas que guiaram este estudo foram: por que aquela foto~โ€“ e nรฃo outra โ€“ atraiu~a atenรงรฃo de jornais de tantos paรญses a ponto de ser estampada na primeira pรกgina, no dia seguinte ร  morte de Aylan, 3 de setembro de 2015? O que essa foto trouxe consigo que explica a reaรงรฃo imediata da audiรชncia e as manifestaรงรตes visuais de internautas? โ€œAs imagens fotogrรกficas~nรฃo falam~โ€“ se impรตem pela imobilidade e pelo silรชncioโ€, nos ensinou Philippe~Dubois~durante o curso โ€œCinema e fotografia: autobiografia, autorretrato e arte da memรณria em Raymond~Depardon,~Agnรจs~Varda, Chris~Marker~e Jean~Eustacheโ€, na Universidade de Brasรญlia, em abril de 2017.~โ€œA prรณpria mudez do que seria, hipoteticamente, compreensรญvel nas fotos รฉ o que constitui seu carรกter atraente e provocadorโ€, nos ensina~Sontag~(2004, p. 34).~Como compreender o que na imagem fotogrรกfica atrai e provoca~aqueles que a olham? Por que nรฃo saรญmos intactos depois de olhar essa foto~e as representaรงรตes que dela partiram? A seguir, as funรงรตes da imagem e as relaรงรตes entre imagem e tรฉcnica serรฃo discutidas para, partindo disso, concluirmos o capรญtulo com a fotografia como processo de (re)produรงรฃo de imagens.~ == Funรงรตes da imagem~segundo Aumont~ <funรงรตes-da-imagem-segundo-aumont> Segundo Aumont (2011)~โ€“~e a partir de uma antropologia~visual~โ€“, a imagem~รฉ um vetor de pensamento, portanto sรฃo os seus grandes usos humanos que interessam, sejam eles sociais ou individuais.~ #blockquote[ A imagem~รฉ um dos objetos mais velhos e mais constantes da antropologia โ€“ muito simplesmente porque ela รฉ, tambรฉm, uma das mais velhas produรงรตes humanas, e das que, apesar de tudo, se conservam melhor.~\[...\] Alรฉm~disso, a imagem รฉ, pelo menos virtualmente, uma fonte riquรญssima de informaรงรตes. Dos homens โ€œprรฉ-histรณricosโ€ nada conhecemos alรฉm dos seus utensรญlios e das~suas imagens; ora, por enigmรกtica que estas sejam, elas ensinam-nos sobre os nossos antepassados longรญnquos no mรญnimo tanto como os produtos, menos~ambรญguos~mas de utilidade limitada, do seu artesanato.~(AUMONT, 2011, p. 116)~ ] ร‰ nessa perspectiva, portanto, que esta seรงรฃo tratarรก as funรงรตes da imagem, organizadas conforme proposto por~Aumont~(2011) em: i) a imagem como sรญmbolo;~ii) a imagem documental;~e~iii) a imagem estรฉtica.~Para exemplificar essas categorias, privilegiaremos a fotografia, notadamente a de <NAME>, sempre que couber.~Com isso, jรก estaremos em processo de compreender o diรกlogo que se estabelece entre a imagem e aquele que a olha e o movimento de โ€œsaรญdaโ€ e de โ€œentradaโ€ descrito por Novaes (2005) como modo reflexivo de compreender o mundo, muito mais do que apenas distrair o olhar. #block[ #set enum(numbering: "A.", start: 1) + A imagem como sรญmbolo~ ] #blockquote[ #emph[De facto, toda a imagem, ou quase, pode representar um papel simbรณlico, nรฃo em virtude de suas qualidades intrรญnsecas, mas de uma decisรฃo de ordem coletiva โ€“ religiosa, polรญtica, ideolรณgica e comercial.]~ ] (AUMONT, 2011, p. 118)~ O uso religioso da imagem~รฉ considerado como a~funรงรฃo~que inaugura a histรณria~da imagem. Os sรญmbolos religiosos foram e~ainda sรฃo numerosos, dentre os quais se destaca a cruz.~ #image("./arquivos/image6.png", width: 2.951747594050744in, height: 1.9657699037620298in) <_Ref503516204>#strong[Figura 3 โ€“ Cruz] Fonte: \<https:\/\/mundoestranho.abril.com.br/religiao/que-outras-religioes-usam-a-cruz-como-simbolo-o-que-significam/\>~ Sรญmbolo mais famoso do Cristianismo, a imagem nรบmero 1 da Figura 3 representa o sacrifรญcio de Jesus Cristo pela humanidade. Catรณlicos romanos, ortodoxos orientais, alguns ramos do luteranismo e do anglicanismo fazem o sinal da cruz como demonstraรงรฃoโ€ฏdeโ€ฏsua fรฉ.~A imagem nรบmero 2 รฉ conhecida popularmente como โ€œpรฉ de galinhaโ€ e representa a comunicaรงรฃo entre o mundo da morte e o da ressurreiรงรฃo. Em sua versรฃo invertida e dentro de um cรญrculo, essa cruz รฉ o sรญmbolo de โ€œpaz e amorโ€, criado durante a Campanha pelo Desarmamento Nuclear, nos anos 1960. A imagem nรบmero 3 รฉ chamada de~tau.~ร‰ um sรญmbolo muito antigo de divindades como o deus Sol, na~mitologia sumรฉria, o deus romano Mithras e o deus grego รtis. Essa imagem tambรฉm foi utilizada por Sรฃo Francisco de Assis, motivo por que hoje~รฉ reconhecida como sinal da Ordem Franciscana.~ Ao longo de sua histรณria, a imagem nรฃo ficou restrita ao uso religioso, mas Aumont (2011)~alerta para o fato de~que a imagem-sรญmbolo costuma estar associada ao poder, seja ele qual for, e~completa o raciocรญnio, lembrando~que os sรญmbolos presentes numa imagem nรฃo sรฃo afirmados~nem estรฃo presentes nela: sรฃo apenas uma evocaรงรฃo. Nesse sentido, pode-se sempre interpretar uma imagem simbรณlica diferentemente das intenรงรตes do seu criador. ร‰ importante ter em mente esse poder da imagem, especialmente em se tratando do objeto que nos ocupa aqui, porque a fotografia de Aylan tornou-se sรญmbolo do drama dos refugiados, termo que serรก discutido no capรญtulo 3. No entanto, sua imagem definiu toda a tragรฉdia dos refugiados~de vรกrias nacionalidades.~ #block[ #set enum(numbering: "A.", start: 2) + A imagem documental~ ] #blockquote[ #emph[As imagens foram sempre utilizadas pelo seu valor informativo.] ] (AUMONT, 2011, p. 118) A mais relevante mutaรงรฃo na funรงรฃo das imagens, segundo Aumont (2011), foi o fato de se lhe reconhecer valor documental. Uma imagem pode assemelhar-se~ร  realidade e ajudar a compreendรช-la, inclusive moldando-a. A funรงรฃo documental desenvolveu-se~e ampliou-se consideravelmente desde o inรญcio da era moderna, sobretudo, com o surgimento da fotografia e o desenvolvimento cada vez mais rรกpido~de circuitos de difusรฃo das imagens, de que hoje a internet รฉ~a manifestaรงรฃo mais importante.~ Ocorre que a imagem-documento mostra, mas nรฃo~descreve nem explica, posto que esta~รฉ uma tarefa de outra linguagem,~em geral,~a verbal.~ A fotografia de Aylan,~por forรงa~de sua origem jornalรญstica, pode ser vista como um documento de um aspecto do real, mas, precisamente por sua origem, necessita de uma legenda, que nรฃo faz parte da iconografia. Esse รฉ um aspecto que merece destaque porque~a legenda de uma fotografia dรก ao leitor informaรงรตes nรฃo contidas ou nรฃo evidentes na imagem. Portanto, a histรณria de Aylan ficou conhecida por meio de sua fotografia~e~das legendas~que a acompanharam~nos jornais.~Dada a sua relevรขncia, a legenda da fotografia jornalรญstica~รฉ um aspecto que envolve riscos, conforme nos alerta Barthes (1990):~ #blockquote[ Trata-se aparentemente de uma explicitaรงรฃo, isto รฉ, dentro de certos~limites, de uma รชnfase; na maioria das vezes o texto limita-se a ampliar um conjunto de conotaรงรตes jรก incluรญdas na fotografia; mas, por vezes, tambรฉm o texto produz (inventa) um significado inteiramente novo, que รฉ de certo modo~projetado retroativamente na imagem, a ponto de nela parecer denotado \[...\]. Por vezes, a palavra pode chegar a contradizer a imagem, produzindo uma conotaรงรฃo compensadora. (BARTHES, 1990, p. 21)~ ] Ainda a esse respeito, diz-nos~Sontag~(2003, p. 14):~โ€œE todas as fotos esperam sua vez de serem explicadas ou deturpadas por suas~legendasโ€. Outro detalhe muito relevante a respeito da fotografia-documento reside no fato de ela aceitar truques, falsificaรงรตes, ediรงรตes~e encenaรงรตes โ€“ hoje em dia, mais que em qualquer outra รฉpoca. Hรก inรบmeros casos de fotografias encenadas que, de inรญcio, serviram para mostrar cenas de guerra.~Sontag~(2003) lista uma sรฉrie de fotografias que passaram para a histรณria como documentos, mas que~tudo indica terem sido encenadas. E a ensaรญsta conclui:~ #blockquote[ O estranho nรฃo รฉ que tantas cรฉlebres fotos jornalรญsticas do passado, entre elas algumas das mais lembradas fotos da Segunda Guerra Mundial, tenham sido, ao que tudo indica, encenadas. O estranho~รฉ que nos surpreenda saber que foram encenadas e que isso sempre nos causa frustraรงรฃo. As fotos que mais nos decepcionam ao se revelarem montagens e encenaรงรตes sรฃo aquelas que parecem registrar momentos de clรญmax รญntimos, sobretudo de amor e de morte. (SONTAG, 2003, p. 48)~ ] #block[ #set enum(numbering: "A.", start: 3) + A imagem estรฉtica ] #blockquote[ #emph[A imagem artรญstica, isto รฉ, afetada de um valor prรณprio, existiu desde sempre โ€“ e em todos os tempos histรณricos, ela suscitou uma interrogaรงรฃo fundamental sobre a sua natureza e os seus poderes.~ร‰ esse discurso que se designa correntemente pelo termo~#strong[estรฉtica].] ] (AUMONT, 2011, p. 147-148) ร‰~preciso considerar, entre as funรงรตes~da imagem, o prazer que ela proporciona, seja intelectual ou sensorial, porque a imagem destina-se tambรฉm a agradar o olhar, a~falar~ร  sensibilidade, domรญnio humano que~permite a criaรงรฃo ao mesmo tempo em que abre caminho para acesso ao espรญrito (AUMONT, 2011).~Mas precisamente por falar~ร  sensibilidade, abriu espaรงo para um debate tรฃo~antigo quanto atual:~ #blockquote[ โ€œPor que รฉ que as pessoas acham agradรกvel, ou parecem achar agradรกvel, a prรณpria~atividade~perceptiva?โ€~(CHILD, 1978). Semelhante questรฃo รฉ colocada principalmente sobre a imagem artรญstica, mas as respostas dizem respeito ร  experiรชncia estรฉtica em geral, operando sobretudo uma partilha importante entre teorias extrรญnsecas (o prazer nรฃo se deve atribuir ร  percepรงรฃo, mas a outra coisa), intrรญnsecas (o prazer estรก ligado a certas caracterรญsticas da imagem, por exemplo as suas proporรงรตes harmoniosas), ou interativas (o prazer estรก ligado ร  interaรงรฃo entre a imagem e as caracterรญsticas da pessoa ou da situaรงรฃo). (AUMONT, 2011, p. 148)~ ] O que determina o carรกter de arte a uma imagem varia de um tempo a outro, de uma sociedade a outra. Em dado momento da histรณria da arte, a suposta origem das sensaรงรตes agradรกveis causadas pelas obras de arte era o Belo. Depois, a beleza deixou de ser o centro da questรฃo~estรฉtica.~Atualmente, conforme Aumont (2011, p. 119),~โ€œ\[a arte\] se define quase exclusivamente de maneira institucional (um artista~รฉ o que uma instituiรงรฃo habilitada reconhece como artista, do mesmo modo que uma obra de arte รฉ o que vale como tal no seio de uma instituiรงรฃo reconhecida) \[...\]โ€.~ Como se observa, arte e estรฉtica sรฃo campos~ligados ao contexto histรณrico-cultural ao qual o artista pertence e ao qual os espectadores pertencem โ€“ nem sempre coincidentes.~Essa relaรงรฃo histรณrico-cultural traz ร  histรณria da arte e ร  estรฉtica um ingrediente de incerteza~x certeza que nรฃo cabe aqui aprofundar~โ€“ dada a complexidade e extensรฃo da discussรฃo que suscitaria โ€“, mas que merece, pelo menos, ser anunciado. Esse ingrediente foi considerado por Didi-Huberman~(2013, p. 17) como~โ€œcerto mal-estar~vivido no~รขmbito da histรณria da arte acadรชmicaโ€:~ #blockquote[ \[...\] que obscuras ou triunfantes razรตes, que angรบstias mortais ou que exaltaรงรตes manรญacas puderam levar a histรณria da arte a adotar esse tom, essa retรณrica da certeza? Como pรดde se constituir โ€“ e com tanta evidรชncia~โ€“ tal~#emph[fechamento~]do visรญvel sobre o legรญvel e de tudo isso sobre o saber inteligรญvel?~\[...\] Em suma, o dito~โ€œconhecimento especรญfico da arteโ€ simplesmente acabou por impor a seu objeto sua prรณpria~#emph[forma especรญfica de discurso], com o risco de inventar fronteiras artificiais para o seu objeto~โ€“ objeto despojado do seu prรณprio ou transbordamento especรญfico. (DIDI-HUBERMAN, 2013, p. 11-12 โ€“ grifos do autor)~ ] Pode soar mรณrbido~associar~a foto de Aylan a um objeto cujo valor estรฉtico merece destaque, mas o fato รฉ que essa foto evoca a sensibilidade e proporciona uma experiรชncia estรฉtica, contraditรณria e paradoxal~como a contemporaneidade.~ร‰ um retrato do real~โ€“~e~nesse aspecto~atende a um~gosto estรฉtico~cada vez mais apreciado:~ #blockquote[ Mas รฉ, justamente, em sociedades midiรกticas saturadas de imagens, slogans publicitรกrios, parques temรกticos, templos do consumo e espaรงos funcionalizados que assistimos a um boom de produtos e expressรตes artรญsticas realistas que buscam representar a realidade ou a โ€œvida como ela รฉโ€. Documentรกrios, filmes de ficรงรฃo, reportagens jornalรญsticas, fotografias pรบblicas, blogs, biografias, diรกrios e autobiografias revelam essa รขnsia pela captura de eventos ou vidas reais.~(JAGUARIBE,~2010, p. 7)~ ] Mas รฉ tambรฉm uma imagem que se aproxima de~um โ€œreal~ficcionalโ€ precisamente porque a existรชncia de Aylan sรณ nos รฉ possรญvel na condiรงรฃo de vida imaginรกria.~Entรฃo, concordamos com Jaguaribe (2010, p. 14),~quando a autora conclui que, โ€œna sua diversidade, as novas estรฉticas do realismo afirmam retratos do cotidiano que tanto espetacularizam a~realidade quanto geram debates polรญticos e reivindicaรงรตes democrรกticasโ€. E concordamos com o diretor do Sesc Sรฃo Paulo hรก 33 anos, <NAME>, que em entrevista recente declarou: #blockquote[ \[...\] o artista รฉ convocado atรฉ mais do que os outros a refletir, a sonhar, a criar fantasias. Mas essas fantasias nรฃo sรฃo tรฃo abstratas, sรฃo do que estรก rolando. A arte nรฃo รฉ desvinculada do real. No fundo, o que se apresenta รฉ que o compromisso com a realidade รฉ irremediรกvel. (COUTINHO, 2017, p. 108) ] Estamos, portanto, diante de uma fotografia jornalรญstica que reรบne caracterรญsticas de sรญmbolo, documento e arte. == Imagem e tรฉcnica<imagem-e-tรฉcnica> Aumont (2011, p. 153) chama a atenรงรฃo para a importรขncia de conhecer alguns momentos essenciais na existรชncia~โ€“ histรณrica e substancial~โ€“ da imagem~que marcam importantes mudanรงas no~seu~estatuto, โ€œdo seu prรณprio surgimento como artefacto humano, atรฉ as recentes transformaรงรตes que ocorrem aos nossos olhosโ€.~O~que pretendemos~nesta seรงรฃo รฉ, portanto, associar momentos histรณricos a disrupรงรตes tรฉcnicas sofridas pela imagem com vistas a muito mais destacar o percurso da imagem desde seu surgimento atรฉ os dias que correm do que~reproduzir desnecessariamente a histรณria factual~da imagem, embora seja impossรญvel fugir disso.~ O surgimento da imagem, conforme Aumont (2011, p. 156), data do perรญodo paleolรญtico. โ€œA imagem surgiu hรก dezenas de milรฉnios, vinda nรฃo se sabe de onde โ€“ como a lรญngua e, tal como esta, prรณpria do homem~\[...\]. A imagem parece ter existido sempre: logo, por si mesma ela โ€˜nรฃo tem histรณriaโ€™; sรณ as suas formas sociais a tรชmโ€.~ Conhecem-se hoje, no mundo inteiro, cerca de 200 grutas decoradas com imagens que remetem ao perรญodo paleolรญtico. No sul da Franรงa e no norte da Espanha, encontram-se 85% dessas grutas, dentre as quais se destacam Altamira (Espanha, 1879), Pech-Merle (Franรงa, 1922), Lascaux (Franรงa, 1940), Arcy~sur~Cure (Franรงa, 1990), Cosquer (gruta submarina na Franรงa, 1991) e Chauvet (Franรงa, 1994), esta รบltima~considerada~a mais antiga de todas, datada de 30 mil anos a.C. No Brasil,~encontra-se~a รกrea de maior concentraรงรฃo de sรญtios prรฉ-histรณricos do continente americano e Patrimรดnio Cultural da Humanidade desde 1991,~que รฉ o Parque Nacional da Serra da Capivara, localizado nos municรญpios piauienses~de Canto do Buriti, <NAME>, Sรฃo Joรฃo do Piauรญ e Sรฃo Raimundo Nonato, e lugar com~expressiva~quantidade de pinturas rupestres.~ #blockquote[ Com mais de 120 mil hectares de cรขnions, grutas, falรฉsias e o rico bioma da caatinga, o Parque da Serra da Capivara e seu entorno abrigam 1.334 sรญtios arqueolรณgicos (172 deles abertos a turistas), pinturas com 29 mil anos de histรณria, paisagens que remontam ao perรญodo prรฉ-cambriano (mais de 570 milhรตes de anos atrรกs) e um infindรกvel cemitรฉrio de animais da megafauna: de seus terrenos sรฃo retiradas, periodicamente, ossadas de mastodontes, tigres-dente-de-sabre, preguiรงas gigantes (que tinham seis metros e atรฉ 700 quilos) e outras espรฉcies extintas hรก milรชnios.#footnote[VINCENTI, Marcel. #emph[No Piauรญ, turismo arqueolรณgico revela histรณria do homem nas Amรฉricas]. 2013. Disponรญvel em: \<https:\/\/viagem.uol.com.br/guia/roteiros/2013/10/10/no-piaui-turismo-arqueologico-revela-historia-do-homem-nas-americas.htm\>. Acesso em: 16 abr. 2017.] ] As representaรงรตes grรกficas~encontradas no Parque Nacional da Serra da Capivara~abordam grande variedade de formas, cores e temas.~Hรก~cenas de caรงa, sexo, guerra e aspectos da vida cotidiana e do universo simbรณlico dos seus autores.~ Segundo Aumont (2011), desde os primeiros tempos da produรงรฃo de imagens, jรก se utilizavam tรฉcnicas que se mantiveram em uso durante milรชnios. Isso sรณ mudou com o advento da gravura e da fotografia, que~trouxeram inovaรงรตes para a produรงรฃo de imagens e, especificamente a fotografia, transformaram nosso modo de ver o mundo.~ Desenhos sรฃo as imagens mais numerosas das produรงรตes grรกficas prรฉ-histรณricas, mas encontram-se tambรฉm esculturas feitas a partir de diversos materiais, como marfim, xisto, tufo basรกltico. Em sua maioria, sรฃo representaรงรตes de animais, quase sempre vistos de perfil, e hรก poucas imagens humanas โ€“ hรก, sim, figuras humanoides em relevo ou em vulto, de tamanhos variรกveis.~Que se saiba, nรฃo hรก desenhos paleolรญticos de plantas, rios, montanhas, rochedos e ferramentas. Tambรฉm nรฃo hรก pรกssaros, peixes ou insetos.~ A opรงรฃo por representar animais (e alguns humanos) chama a atenรงรฃo daqueles que se debruรงam sobre o tema e gera discordรขncias, mas os estudiosos reconhecem que nem sempre รฉ possรญvel saber qual รฉ o sentido das~imagens.~Para~Aumont (2011, p. 155), โ€œas interpretaรงรตes proliferam, mas a partir de fatores contemporรขneos de cada intรฉrprete:~a exegese da produรงรฃo plรกstica prรฉ-histรณrica รฉ, por excelรชncia, um terreno propรญcio ร  interpretaรงรฃo projetivaโ€.~A experiรชncia com o sagrado รฉ uma explicaรงรฃo recorrente, mas hรก quem defenda que as produรงรตes plรกsticas sejam experiรชncias com a realidade e sua simbolizaรงรฃo.~ Seja como for, as imagens mais antigas, produzidas depois da invenรงรฃo da escrita, portanto โ€œhistรณricasโ€, em geral, estรฃo ligadas~ao sagrado~e~ร ~morte~e ainda ร  polรญtica~(AUMONT, 2011).~Na Grรฉcia Arcaica, as imagens dos รญdolos sรฃo exemplos da representaรงรฃo do divino. Na Grรฉcia Antiga,~estelas#footnote[#emph[Dicionรกrio on-line Caldas Aulete]: #strong[estela#super[1]]~s. f. || monรณlito; espรฉcie de coluna, destinada a ter uma inscriรงรฃo; marco:~#emph[Estela] funerรกria. F. gr.~#emph[Stele]~(coluna tumular).]~funerรกrias traziam a imagem do morto como forma de manifestar sua passagem para o alรฉm e, supรตe-se, evitar seu regresso. Na Grรฉcia Clรกssica e depois em Roma, bustos eram reservados a imperadores, chefes do exรฉrcito e, eventualmente, artistas cรฉlebres, como Homero e Safo. E ainda a deuses.~No Antigo Egito,~manifestaรงรตes โ€œartรญsticasโ€ tiveram supremacia na religiรฃo,~sobretudo a partir das imagens feitas de faraรณ, soberano absoluto~e representante da divindade na Terra.~Durante toda a Idade Mรฉdia, as imagens que se produziam eram, em sua maioria, associadas a personagens mรญticas, de base cristรฃ. A partir do sรฉculo XIII, proliferaram~estรกtuas equestres e~bustos funerรกrios de reis, senhores poderosos e prรญncipes da Igreja~(GOMBRICH, 2015). Giotto~di~Bondone, pintor e arquiteto italiano~(1267-1337), foi o precursor de uma inovaรงรฃo nas artes figurativas: a perspectiva na pintura renascentista que aumentaria ainda mais a ilusรฃo da realidade nas obras (GOMBRICH, 2015).~Alรฉm disso, as~figuras~que produziu~dos santos~assemelhavam-se a~seres humanos de aparรชncia comum. Assim, a pintura de~Giotto~vem ao encontro de uma visรฃo humanista do mundo, que foi cada vez mais se firmando atรฉ o Renascimento.~ ร‰ a partir desse momento histรณrico, conhecido como Renascenรงa, que novos temas passaram a ser retratados nas imagens figurativas, inaugurando um perรญodo em que o adjetivo โ€œartรญsticoโ€ se aproxima mais do que hoje se concebe como arte.~A cultura renascentista, marcadamente antropocรชntrica, trouxe ao mundo ocidental o deslocamento da perspectiva filosรณfica e cultural centrada em Deus, cedendo lugar a uma perspectiva centrada no homem.~ ร€ criaรงรฃo da perspectiva, sucedeu-se o aperfeiรงoamento da tรฉcnica pictรณrica, inovaรงรฃo que permitiu espelhar a realidade em todos os pormenores da pintura~(GOMBRICH, 2015) e cujo grande representante รฉ <NAME>~Eyck, pintor flamengo nascido em 1390 e morto em~1441.~Foi ele o inventor da pintura a รณleo~(GOMBRICH, 2015).~ #blockquote[ As novas descobertas que os artistas da Itรกlia e Flandres tinham feito no comeรงo do sรฉculo XV produziram um frรชmito de emoรงรฃo em toda a Europa. Pintores e mecenas estavam igualmente fascinados pela ideia de que a arte pudesse ser usada nรฃo sรณ para contar a histรณria sagrada de uma forma comovente, mas para refletir tambรฉm um fragmento do mundo real. Talvez o resultado mais imediato dessa grande revoluรงรฃo na arte tenha sido os artistas comeรงarem por toda parte a realizar experiรชncias e a buscar~novos e surpreendentes efeitos.~(GOMBRICH, 2015,~p. 248)~ ] A possiblidade de reproduzir mecanicamente uma imagem sรณ passou a existir com o advento de uma tรฉcnica que consistia em um bloco de madeira ou uma placa de cobre ou aรงo, com a imagem cinzelada na placa ou feita por corrosรฃo com acido (รกgua-forte). A essa tรฉcnica, deu-se o nome de xilogravura.~Desde o sรฉculo VI, a tรฉcnica da xilogravura era conhecida na China, mas foi na Idade Mรฉdia, no final do sรฉculo XIV,~que se afirmou no Ocidente, diminuindo os custos de produรงรฃo de #link("https://pt.wikipedia.org/wiki/Livro")[livros] ilustrados e abrindo caminho para a produรงรฃo em massa de imagens pictรณricas (BRIGGS; BURKE, 2006). No~final~do sรฉculo~XVII,~foi a vez da litografia โ€“ processo quรญmico~mais econรดmico e menos demorado que todos os outros meios conhecidos na รฉpoca, consistindo de um desenho com lรกpis de cera sobre uma pedra. Essa tรฉcnica permitiu, pela primeira vez, produzir~imagens coloridas a baixo custo~(BRIGGS; BURKE, 2006).~ E~um novo momento de inovaรงรฃo na histรณria da~imagem~ocorreu~em~meados do~sรฉculo~XIX, quando surgiu~nova tรฉcnica de retratar o mundo: a fotografia.~ #blockquote[ Na metade do sรฉculo XIX, surgiu a fotografia, aproveitando-se de uma crise profunda da verdade, de uma perda da credibilidade, que atingiu os modos de representaรงรฃo em vigor, fosse texto ou desenho, demasiadamente dependentes da habilidade manual e da subjetividade humana. A fotografia, junto com a possibilidade de impressรฃo e a mรกquina, veio renovar a crenรงa na imitaรงรฃo e na representaรงรฃo. (ROUILLร‰, 2009, p. 28)~ ] O perรญodo histรณrico em que se dรก o surgimento da fotografia รฉ o da sociedade industrial. E isso nรฃo foi por acaso. A fotografia~se associa a todas as novidades tecnolรณgicas da รฉpoca, como expansรฃo das metrรณpoles e da economia de mercado, industrializaรงรฃo, superaรงรฃo das barreiras do espaรงo e do tempo graรงas~ao advento da~locomotiva a vapor e das comunicaรงรตes. O carรกter mecรขnico da fotografia fez dela a imagem da sociedade industrial (ROUILLร‰, 2009).~ #blockquote[ \[...\] a fotografia, no decorrer de seu primeiro sรฉculo, como destino maior conheceu apenas o de servir, de responder ร s novas necessidades de imagens da nova sociedade. De ser ferramenta. Pois, como qualquer outra, essa sociedade tinha necessidade de um sistema de representaรงรฃo adaptado ao seu nรญvel de desenvolvimento, ao seu grau de tecnicidade, aos seus ritmos, aos seus modos de organizaรงรฃo sociais e polรญticos, aos seus valores e, evidentemente, ร  sua economia. Na metade do sรฉculo XIX, a fotografia foi a melhor resposta para todas essas necessidades. (ROUILLร‰, 2009, p. 31)~ ] A fotografia foi tudo isso, menos uma unanimidade. Divididos pela tรฉcnica que caracteriza a fotografia, uns~a~diabolizaram, outros~a~idealizaram. E a discussรฃo a respeito de arte e fotografia mobilizou~defensores e detratores~durante muito tempo.~Arte e tรฉcnica sobreviveram.~ Jรก se vรฃo quase dois sรฉculos desde que a fotografia surgiu~e passou por~avanรงos tecnolรณgicos.~Segundo~Benjamin (1985, p. 91),~com a fotografia, โ€œforam criadas as condiรงรตes para um desenvolvimento contรญnuo e aceleradoโ€ da produรงรฃo de imagens tรฉcnicas~cada vez mais~disruptivas:~imagens em preto e branco foram rapidamente seguidas de imagens coloridas; as fixas logo abriram caminho para as em movimento, e assim surgiu o cinema โ€“~a sรฉtima arte foi muda, ganhou som e cor, inovou em tecnologia e efeitos especiais que revolucionaram a criaรงรฃo cinematogrรกfica do mundo. E entรฃo veio o vรญdeo e, com ele, a televisรฃo~โ€“ tambรฉm esta alvo~dos maiores amores e das mais~duras~crรญticas โ€“, que, por sua vez, tornou possรญvel a chegada dos videogames. O telefone celular, hoje tรฃo popular, foi~usado pela primeira vez em 1973, mas sรณ foi~licenciado em 1983,~nos Estados Unidos,~de inรญcio, com base em um รบnico serviรงo: comunicaรงรฃo de voz. Em~pouco mais de trรชs dรฉcadas, passou a contar com~serviรงos de mensagens e~logo se transformou~num dispositivo inteligente, capaz de congregar outras funรงรตes alรฉm de chamadas de telefone. Poucas mudanรงas foram tรฃo importantes para a~produรงรฃo de imagens~quanto~o surgimento dos processos digitais. Essa evoluรงรฃo trouxe vantagens incrรญveis~para~o~celular, que se transformou em #emph[smartphone] a partir do momento em que acessou a internet e deu aos usuรกrios a oportunidade de receber e~enviar dados, inclusive visuais, a qualquer ponto do planeta, potencialmente, ganhou cรขmera e tornou-se~o exemplo mais completo do que se convencionou chamar de convergรชncia digital. Os~processos digitais, associados aos avanรงos das tecnologias da informaรงรฃo e da comunicaรงรฃo e resultando em~internet~+~#emph[smartphones], alteraram o estatuto da fotografia~e do vรญdeo:~juntos, permitiram o surgimento,~por exemplo,~do que conhecemos como~#emph[selfie]. Mania mundial dos dias de hoje, serve para dar visibilidade~a~qualquer pessoa, celebridade~ou nรฃo,~a qualquer hora, sob qualquer pretexto,~em todo~e qualquer tipo de~situaรงรฃo, desde~um momento da vida รญntima~atรฉ eventos sociais, polรญticos, religiosos e o que mais a imaginaรงรฃo for capaz de alcanรงar.~Tudo isso sem precisar ser profissional da รกrea: fotรณgrafo~ou~cinegrafista. Qualquer pessoa hoje opera com tranquilidade cรขmeras โ€“ basta ter um~#emph[smartphone~]na mรฃo.~E nรฃo precisa nem mesmo de uma ideia na cabeรงa.#footnote[โ€œUma cรขmera na mรฃo e uma ideia na cabeรงaโ€ โ€“ mรกxima atribuรญda a <NAME>, cineasta brasileiro (1939-1981).]~Na visรฃo de~Aumont (2011, p. 113),~โ€œas perturbaรงรตes da produรงรฃo (e sobretudo da circulaรงรฃo) das imagens desde hรก vinte anos acarretaram evidentemente profundas mudanรงas na nossa relaรงรฃo mental e atรฉ sensorial com o visรญvel e o realโ€. A fotografia substituiu o olhar.~Fotografamos antes de olhar e atรฉ em vez de olhar. Parece nรฃo ter fim~o que รฉ possรญvel fazer hoje com imagens, depois dos~avanรงos computacionais das รบltimas dรฉcadas. รreas tradicionais das ciรชncias, como biologia, quรญmica, astronomia, fazem uso e incitam o desenvolvimento de tรฉcnicas de visualizaรงรฃo~cientรญfica e~de~visualizaรงรฃo de informaรงรฃo,~que sรฃo~sistemas~dedicados~ร  geraรงรฃo de imagens que auxiliam~os~usuรกrios na compreensรฃo de dados e processos~por~meio de recursos grรกficos.~Vivemos o momento de aplicaรงรฃo de~tรฉcnicas de~computaรงรฃo grรกfica interativas que permitem a anรกlise e a compreensรฃo de conjuntos~de~informaรงรตes.~ Nosso vocabulรกrio hoje seria incompreensรญvel mesmo para nรณs, hรก 30 anos. Falamos de~computaรงรฃo grรกfica~e de~sistemas de realidade virtual e imersรฃo sensorial,#footnote[Sobre realidade virtual: \<https:\/\/www.youtube.com/watch?v\=FuuirfHFG2M\>. Acesso em: 31 jul. 2017.]~de~prototipagem rรกpida de componentes,#footnote[Sobre prototipagem rรกpida: \<http:\/\/www.gorni.eng.br/protrap.html\>. Acesso em: 31 jul. 2017.]~de~veรญculos nรฃo tripulados, como #emph[drones],#footnote[Sobre #emph[dones]: \<http:\/\/geodrones.com.br/blog/drones-uma-pequena-introducao-veiculos-aereos-nao-tripulados/\>. Acesso em: 31 jul. 2017.]~de~indรบstria 4.0,#footnote[Sobre indรบstria 4.0: \<https:\/\/www.citisystems.com.br/industria-4-0/\>. Acesso em: 31 jul. 2017.]~de~realidade aumentada,#footnote[Sobre realidade aumentada: \<https:\/\/olhardigital.com.br/video/realidade-aumentada/8118\>. Acesso em: 31 jul. 2017.]~de internet das coisas.#footnote[Sobre internet das coisas: \<http:\/\/www.techtudo.com.br/noticias/noticia/2014/08/internet-das-coisas-entenda-o-conceito-e-o-que-muda-com-tecnologia.html\>. Acesso em: 31 jul. 2017.] Frequentamos cavernas~digitais,#footnote[Sobre caverna digital: \<https:\/\/www.youtube.com/watch?v\=jOEeGkKuNe4\>. Acesso em: 31 jul. 2017.]~ambientes de realidade virtual, equipados de projetores, sistemas computacionais, rastreadores de movimento, atuadores mecรขnicos, #emph[videowall],#footnote[Sobre #emph[videowall]: \<https:\/\/mdooh.progic.com.br/video-wall/\>. Acesso em: 31 jul. 2017.]~entre outros,~que~permitem~a imersรฃo e a vivรชncia de experiรชncias, incluindo sensaรงรตes visuais, hรกpticas, auditivas e sensoriais das mais diversas,~usando recursos para emulaรงรฃo de telepresenรงa. Traduzindo, nossa relaรงรฃo com imagens~e tรฉcnica~se ampliou exponencialmente. A contemporaneidade~nos permite, por exemplo,~estar fisicamente em um lugar, mas virtualmente em outro,~graรงas aos recursos tecnolรณgicos que levam nossa imagem para todos os cantos do planeta e atรฉ para fora dele. Cada detalhe do~nosso~fรญgado โ€“~ou~coraรงรฃo โ€“, bem como~do espaรงo em que vivemos,~pode ser~perscrutado.~E~<NAME> jรก sabia disso hรก~quase 90 anos.~ #blockquote[ Caracterรญsticas estruturais, tecidos celulares, com os quais operam a tรฉcnica e a medicina, tudo isso tem mais afinidades originais com a cรขmara que a paisagem~impregnada de estados afetivos, ou o retrato que exprime a alma do seu modelo. Mas ao mesmo tempo a fotografia revela nesse material os aspectos fisionรดmicos, mundos de imagens habitando as coisas mais minรบsculas, suficientemente ocultas e significativas para encontrarem um refรบgio nos sonhos diurnos, e que agora, tornando-se grandes e formulรกveis, mostram que a diferenรงa entre tรฉcnica e magia รฉ uma variรกvel totalmente histรณrica. (BENJAMIN, 1985, p. 94-95)~ ] Adentramos o ciberespaรงo.#footnote[โ€œO termo \[ciberespaรงo\] especifica nรฃo apenas a infraestrutura material da comunicaรงรฃo digital, mas tambรฉm o universo oceรขnico de informaรงรฃo que ela abriga, assim como os seres humanos que navegam e alimentam esse universo. Quanto ao neologismo โ€œciberculturaโ€, especifica aqui o conjunto de tรฉcnicas (materiais e intelectuais), de prรกticas, de atitudes, de modos de pensamento e de valores que se desenvolvem juntamente com o crescimento do ciberespaรงoโ€. (Lร‰VY, 1999, p. 17)]~E ele se mostrou tรฃo ilimitado quanto capaz de produzir o fenรดmeno da cibercultura. Estamos imersos nele~e em seu nome quase esquecemos como era viver num mundo apenas fรญsico~e mergulhamos no mundo virtual.~Apenas โ€œquaseโ€, porque~nenhuma das tรฉcnicas citadas atรฉ aqui eliminou~sua antecessora. O velho e o novo, em termos de comunicaรงรฃo~de massa, coexistiram e coexistem. O fenรดmeno da convergรชncia, porรฉm,~inaugurou um novo momento na histรณria da humanidade~e foi tratado como โ€œum casamento perfeito entre os computadores โ€“ parceiros tambรฉm de outros casamentos โ€“ e as telecomunicaรงรตesโ€ (BRIGGS; BURKE, 2006, p. 266).~ Para concluir, รฉ importante refletir sobre~alguns aspectos da repercussรฃo da tรฉcnica sobre os atuais modos como nos relacionamos com as imagens, sobretudo as fotogrรกficas.~ Em seus~clรกssicos~ensaios~โ€œPequena histรณria da fotografiaโ€,~escrito em 1931,~e โ€œA obra de arte na era de sua reprodutibilidade tรฉcnicaโ€,~escrito em 1936,~<NAME>~alerta para mudanรงas que ultrapassam a tecnologia e alteram~o olhar que dirigimos ร s imagens. No caso especรญfico da fotografia, o filรณsofo~percebe~que essa tรฉcnica รฉ representante de โ€œuma tendรชncia apaixonada do homem contemporรขneoโ€ de fazer as coisas se aproximarem โ€œdas massasโ€ atรฉ o ponto de tornar-se โ€œirresistรญvel a necessidade de possuir o objeto de tรฃo perto quanto possรญvel, na imagem, ou melhor, na sua reproduรงรฃoโ€~(BENJAMIN, 1985, p. 101).~ ร‰ inegรกvel o fascรญnio que a imagem fotogrรกfica exerce sobre~nรณs na vida contemporรขnea,~em que a modernidade se completa e se transforma na hipermodernidade:~โ€œmodernizaรงรฃo desenfreada, feita de mercantilizaรงรฃo proliferativa, de desregulamentaรงรฃo econรดmica, de รญmpeto tรฉcnico-cientรญfico, cujos efeitos sรฃo tรฃo carregados de perigos quanto de promessasโ€~(LIPOVETSKY; CHARLES, 2004, p. 53).~No campo individual, a supervalorizaรงรฃo do bem-estar, da diversรฃo e da felicidade permanente revela um ideal de vida leve, hedonista, lรบdica โ€“ valores prometidos pelo capitalismo de consumo cujo combustรญvel รฉ uma mistura de seduรงรฃo, frivolidade e renovaรงรฃo incessante dos modelos (LIPOVETSKY, 2016).~ Nesse contexto, a fotografia parece ser nรฃo sรณ a grande representante da modernidade, mas tambรฉm da hipermodernidade,~quando jรก nos habituamos a ver~os outros~e sermos vistos~incessantemente,~seduzidos~pela~ideia de~superaรงรฃo da invisibilidade.~ร‰ impressionante como as redes sociais estรฃo repletas de~#emph[selfies],~nos mais variados cenรกrios da vida pรบblica e da vida privada, indistintamente, supervalorizando as experiรชncias~de consumo,~gastronรดmicas, de turismo, de entretenimento, de culto ao corpo, de momentos divertidos,~felizes, mas tambรฉm trรกgicos e infelizes,~tudo registrado sem a menor preocupaรงรฃo tรฉcnica, porque a~cรขmera jรก vem programada para ajustar velocidade,~diafragma, obturador, ISO, regra dos terรงos, planos fotogrรกficos, lentes, distรขncia focal, profundidade de campo, estรฉtica, iluminaรงรฃo,~#emph[flash]~etc.,~de tal forma que o clique รฉ uma atividade corriqueira, lรบdica, โ€œtotalmente esvaziada de qualquer responsabilidade~com a realidadeโ€ (AUMONT, 2011, p. 114).~ A~superaรงรฃo da~invisibilidade,~porรฉm,~nรฃo favorece o hiperindividualismo~e o hedonismo~apenas.~Nesta~รฉpoca marcada por paradoxos entre exagero e moderaรงรฃo, material e imaterial, peso e leveza, prazer e dor, indivรญduo e coletividade (LIPOVETSKY, 2016),~<NAME> tornou-se cรฉlebre~a partir da distribuiรงรฃo de~uma fotografia, reforรงada pelo~descontentamento de artistas que nรฃo demoraram para estender o tempo de exposiรงรฃo de sua imagem trรกgica. Teria permanecido na obscuridade e nรฃo se tornaria sรญmbolo de uma crise humanitรกria~de proporรงรตes mundiais,~que atingiu, em 2016, o nรบmero mais alto~de deslocamentos humanos~jรก registrado,#footnote[Dados obtidos em: ACNUR. #emph[โ€œTendรชncias Globaisโ€~sobre refugiados e outras populaรงรตes de interesse do ACNUR]. 2017a. Disponรญvel em: \<http:\/\/www.acnur.org/portugues/recursos/estatisticas/\>. Acesso em: 10 out. 2017.]~se nรฃo atribuรญssemos ร  imagem fotogrรกfica a relevรขncia que atribuรญmos, se nรฃo vivรชssemos em uma sociedade~em rede cuja estrutura tecnolรณgica permite tambรฉm o exercรญcio de contrapoder por parte de grupos insatisfeitos com as autoridades constituรญdas.~ == Imagem fotogrรกfica~ <imagem-fotogrรกfica> Para entender uma fotografia,~รฉ preciso ter ciรชncia de que se estรก diante de um objeto~โ€œque tem vida prรณpria no mundoโ€ (SHORE, 2014, p. 26). Se o que se tem na mรฃo โ€“ ou diante dos olhos โ€“ รฉ uma cรณpia impressa cujo destino รฉ o~museu, o porta-retratos, o~รกlbum, o mural, a caixa de sapatos, entรฃo, ali estรก um objeto bidimensional, que tem bordas e รฉ estรกtico. Nesse caso, deve ser entendida como algo fรญsico.~ #blockquote[ A bidimensionalidade do papel fotogrรกfico estabelece o plano da fotografia. Suas bordas fixam os limites da imagem. A imobilidade da imagem determina a sensaรงรฃo do tempo na fotografia. Atรฉ a imagem de uma fotografia na tela de um computador รฉ plana, estรกtica~e delimitada. (SHORE, 2014, p. 16) ] Ao fotografar, estrutura-se uma parte do mundo escolhendo ponto de observaรงรฃo, enquadramento, momento da exposiรงรฃo e~plano focal. Essas escolhas,~como~a bidimensionalidade, constituem os elementos fundamentais de uma fotografia em seu nรญvel descritivo. โ€œConstituem a base de uma gramรกtica visual fotogrรกfica. Sรฃo eles os responsรกveis pelos โ€˜errosโ€™ de um iniciante: fazer uma foto desfocada ou tremida, cortar cabeรงas, capturar um momento infelizโ€~(SHORE, 2014, p. 38). Para alรฉm do nรญvel descritivo da fotografia, hรก um segundo nรญvel, que Shore~(2014) chama de mental. Preferimos, porรฉm, trabalhar com~Barthes (1990) e adotar seu posicionamento de que todas as artes imitativas~โ€“ e a fotografia โ€“ comportam duas mensagens:~a denotada e a conotada. Passamos, entรฃo, a tratar de dois nรญveis de expressรฃo da imagem fotogrรกfica, que nรฃo chamaremos de descritivo e mental, mas de mensagens denotada e conotada.~ A compreensรฃo da mensagem denotada da imagem fotogrรกfica exige apenas que aquele que a contempla seja capaz de enxergar. Essa mensagem nรฃo tem cรณdigo. ร‰, portanto, uma mensagem contรญnua, caracterรญstica do olhar, apenas.~ Mas para compreender a mensagem conotada da imagem fotogrรกfica, aquele que a olha vai precisar usar cรณdigos~linguรญsticos e sociais, porque esse segundo sentido imposto ร  imagem fotogrรกfica exige mais que olhos para ver. Exige saberes socioculturais. As reaรงรตes do indivรญduo diante de uma imagem fotogrรกfica sรฃo as conotaรงรตes que ele produz: o que fala sobre a imagem, sua surpresa, seu riso, sua indignaรงรฃo, sรฃo manifestaรงรตes da conotaรงรฃo.~ Vamos insistir nas ideias de Barthes (1990) porque esta anรกlise vai evocar seus conceitos.~ Qual~รฉ o conteรบdo da mensagem fotogrรกfica? Para responder a essa pergunta, Barthes (1990)~trabalha com dois conceitos centrais: denotaรงรฃo e conotaรงรฃo. A fotografia, segundo o francรชs, sobretudo a jornalรญstica, comporta duas mensagens: uma denotada e uma conotada. A primeira~รฉ~o prรณprio~#emph[analogon], ou seja,~รฉ a prรณpria imagem copiada de um real com o qual mantรฉm uma relaรงรฃo de perfeiรงรฃo โ€“ aliรกs, uma perfeiรงรฃo analรณgica que define a fotografia e, no senso comum, confere a ela um regime de โ€œverdadeโ€ (Figura 4).~ #image("./arquivos/image7.png", width: 4.379596456692913in, height: 3.2857852143482065in)~ <_Ref503519869>#strong[Figura 4 โ€“ <NAME> em 2 de setembro de 2015] Fonte: \<http:\/\/zap.aeiou.pt/imagem-de-crianca-siria-morta-na-praia-torna-se-simbolo-drama-dos-refugiados-81071\>~ Na~Figura 4, vรช-se uma crianรงa~deitada de bruรงos na beira do mar. Estรก molhada, vestida de azul e vermelho, calรงada com tรชnis e tem cabelos bem cortados.~ A segunda mensagem~รฉ~a maneira como a sociedade oferece~ร  leitura,~em alguma medida, o que pensa. Ainda que se possa acreditar que a imagem fotogrรกfica de~<NAME> informa todo o conteรบdo~da fotografia~ร quele que a olha jรก que, com o real, mantรฉm uma relaรงรฃo de perfeiรงรฃo, plenitude e imediatismo โ€“ portanto, portadora de uma objetividade inquestionรกvel โ€“, essa imagem, de fato, contรฉm uma segunda mensagem,~ao mesmo tempo, invisรญvel e ativa, clara e implรญcita, que nรฃo se deixa perceber de imediato, mal colocamos os olhos sobre ela. Nas~โ€œreleiturasโ€ feitas pelos artistas que produziram as ilustraรงรตes, por exemplo,~รฉ possรญvel perceber traรงos dessa segunda mensagem, da perspectiva de cada um (Figura 5). #image("./arquivos/image8.png", width: 3.933682195975503in, height: 3.0128576115485566in)~ <_Ref503520168>#strong[Figura 5 โ€“ Compartilhamento via redes sociais] Fonte: \#kiyiyavuraninsanlik~ Na~Figura 5, a segunda mensagem destaca a hiperconectividade dos internautas e sua compulsรฃo pelo compartilhamento~insensรญvel~de qualquer imagem veiculada pelas redes sociais digitais. Embora o~#emph[smartphone]~ali representado esteja com a bateria quase que descarregada, os 5% de carga que restam nรฃo serรฃo reservados para uma emergรชncia, mas para incrementar o~#emph[Trending~Topic]#footnote[Quando alguรฉm diz que um assunto รฉ #emph[Trending Topic] da semana, isso quer dizer que o nรบmero de tuรญtes com uma #emph[hashtag] ou palavra(s) relacionada(s) a esse tรณpico estรก sendo ou foi disseminada por um vasto nรบmero de pessoas num determinado perรญodo. Nesse caso, o assunto entra para um #emph[ranking] do Twitter de assuntos mais populares e se torna um #emph[Trending Topic]. (Texto adaptado.) Disponรญvel em: \<http:\/\/tecnologia.ig.com.br/o-que-sao-e-como-funcionam-os-trending-topics/n1597175643026.html\>. Acesso em: 18 abr. 2017.]~do Twitter. Esse comportamento~รฉ bem descrito por~Sontag,~em ensaio publicado originalmente em 1977, aqui referenciado em ediรงรฃo brasileira de 2004:~ #blockquote[ Sofrer~รฉ uma coisa; outra รฉ viver com imagens fotogrรกficas do sofrimento, o~que nรฃo~reforรงa~necessariamente a consciรชncia e a capacidade de ser compassivo. Tambรฉm pode corrompรช-las. Depois de ver tais imagens, a pessoa tem aberto a sua frente o caminho para ver mais~โ€“ e cada vez mais. As imagens paralisam. As imagens anestesiam. Um evento conhecido por meio de fotos certamente se torna mais real do que seria se a pessoa jamais tivesse visto as fotos \[...\]. Mas, apรณs uma repetida exposiรงรฃo a imagens, o evento tambรฉm se torna menos real. (SONTAG, 2004, p. 30-31)~ ] Essa segunda mensagem~รฉ o que Barthes~(1990) chamou de conotaรงรฃo, ou seja, um segundo sentido imposto ร  mensagem fotogrรกfica, que se caracteriza por ser histรณrico e cultural.~ Por que esse segundo sentido~รฉ histรณrico e cultural? Porque sua apreensรฃo depende do contexto social~a partir do qual olhamos uma imagem e~โ€œlemosโ€#emph[~]sua mensagem conotada. A leitura da fotografia depende sempre das referรชncias que o leitor tem. Nem todo mundo vai olhar para uma mesma fotografia jornalรญstica e ser capaz de perceber a mensagem conotada que ela contรฉm, porque isso exige um conjunto de saberes e valores que nem sempre sรฃo comuns a todos os grupos sociais. O que desperta o riso, a lรกgrima, a surpresa, a desconfianรงa, a seguranรงa varia de um tempo a outro, de uma sociedade a outra โ€“ ร  exceรงรฃo de exigรชncias antropolรณgicas que transcendem grupos e alcanรงam a humanidade.~ Talvez esse seja o caso da foto representada pela~Figura 4. A vida e a morte, e mais ainda a morte, de uma crianรงa que sequer conheceu a paz nos seus 3 anos de vida~sรฃo temas do รขmbito das grandes questรตes antropolรณgicas comuns a muitos grupos~sociais. Compreender o que~รฉ uma mensagem denotada e o que a diferencia de uma imagem conotada~รฉ, para efeito desta pesquisa, fundamental. Desconfiar da vastidรฃo da conotaรงรฃo da segunda mensagem fotogrรกfica e de seu carรกter histรณrico e cultural,~mais ainda. Veremos que uma possรญvel resposta ao questionamento que fizemos a respeito do alcance da fotografia de Demir, em face de outras tantas fotografias sobre o mesmo tema, vai depender do domรญnio desses conceitos. // As imagens sรฃo o produto e o reflexo histรณrico da civilizaรงรฃo. Nรฃo surgiram com a internet, ou com a TV, nem mesmo com o cinema eย a fotografia. Muito antes de todas essas tecnologias audiovisuais que comumente associamos ร  veiculaรงรฃo de imagens, as pessoas jรกย pintavam quadros, desenhavam em diversos tipos de suportes, produziam gravuras. // No paleolรญtico,ย registraram aspectos da vida, utilizando desenhos rupestres, estatuetas, pinturas e desenhos. E essas imagens tinham objetivo -- talvez fazer algum tipo de comunicaรงรฃo.ย Dois milhรตes e meio de anos nos separamย desses tempos que hoje sรฃo evocados como o inรญcio da histรณria da arte, embora o conceito de arte tal como compreendemos hoje nรฃo se ajuste perfeitamente a essas imagens. De lรก para cรก, a imagem vem servindo a diferentes propรณsitos humanos, anteriores, inclusive, ร  prรณpriaย arte.ย  // Na Antiguidade romana, o termoย "imagem" referia-se ร  mรกscara mortuรกria usada em funerais, o que indica que essa palavra remetiaย ร ย morte e ao culto dos mortos. No Egito Antigo, a imagem tinha objetivos polรญticos e religiosos. No Renascimento, a separaรงรฃoย entre representaรงรฃo religiosaย e representaรงรฃo profana deu origem a imagens pictรณricas, o que significa que sรณ recentemente, em termos histรณricos, passamos a produzir imagens tambรฉm para nos referirmos ao mundo que nรฃo tem relaรงรฃo apenas com a religiรฃo. // Atualmente, a imagem tanto pode servir a todos os propรณsitos polรญticos e religiosos de entรฃo, como tambรฉm a estรฉticos, artรญsticos e cientรญficos. Na medicina, por exemplo, os exames de imagem, como tomografias computadorizadas e ressonรขncias magnรฉticas,[^7]ย sรฃo largamente usados para diagnosticar diversas doenรงas. E hรก todo um setorย produtivo que se ocupa exclusivamente de desenvolver essas tecnologias para aplicaรงรฃo na saรบde.ย  // Atรฉ aqui, tratamos da imagem visual: representaรงรฃo grรกfica, plรกstica ou fotogrรกfica. Mas hรก outros tipos de imagem, por exemplo, a imagem mental. Embora nรฃo seja essa imagem o objeto central de estudo a que nos propusemos,ย รฉ preciso citรก-la para diferenciar os tipos de imagens comย os quais lidamos ao longo da vida e para jรก prepararmos o campo paraย adentrar o imaginรกrio, tema com que tambรฉm trabalharemos nesta dissertaรงรฃo.ย  // "A imagem mental correspondeย ร  impressรฃo que temos, quando, por exemplo, lemos ou ouvimos a descriรงรฃo de um lugar, deย *vรช-loย *quase como se estivรฉssemos lรก" [@joly2012introducao p. 19]. Nรฃo entraremos na discussรฃo sobre a (in)existรชncia de tais imagens.ย Diremos apenas que hรก quem defenda que nรฃo passam de descriรงรตes verbais e abstratas, cujo significado nรฃo pode ser apreendido senรฃo pela linguagem. Isso porque seu carรกter subjetivo torna-a inacessรญvel a outros indivรญduos, alรฉm de quem imagina.ย Nessa categoria, incluem-se os sonhos, por exemplo. // Em algumas รกreas do conhecimento, estudar imagem significa fazer associaรงรตes mentais sistemรกticas para melhorย compreender um ser ou um objeto, uma profissรฃo, uma prรกtica humana. Assim, os estudiosos buscam compreender a "imagem da mulher" em dado contexto sociocultural, ou a imagem de uma empresa, de um grupo polรญtico ou religioso. E nos estudos da lรญngua, o objeto รฉ a imagem verbal, mais comumente a metรกfora.ย  // Alรฉm das imagens visuais e mentais, hรก as imagens de sรญntese, que sรฃo aquelas produzidas por computador para criar universos virtuais, como os videogames, que tiveram inรญcio com imagens grosseiras e evoluรญram para as atuais imagens interativas que perturbam a distinรงรฃo entre o real e o virtual. // > "O holograma -- imagem a *laser* em trรชs dimensรตes -- faz parte dessas novas imagens desconcertantes, por um lado, por seu aspecto realista, mas tambรฉm por seu aspecto fantasmรกtico de duplo perfeito, flutuante, como em suspensรฃo" [@joly2012introducao p.27]. // Umย *show*ย em tributo ao cantor <NAME> tornou-se histรณricoย para os brasilienses: na noite do sรกbado 29 de junho de 2013, no Estรกdioย Nacional <NAME>, em Brasรญlia, um holograma recriou em ambiente digital a sensaรงรฃo de estar diante do artista. "A imagem de Renato Russo surge no palco em quatro dimensรตes. Altura, largura, profundidade e saudade. E 45 mil pessoas sabiam que ele nรฃo estava ali, e que ele estavaย sim".[^8] // Como bem descreve @joly2012introducao:ย  // > Instrumento de comunicaรงรฃo, divindade, a imagem assemelha-se ou confunde-se com o que representa. Visualmente imitadora, pode enganar ou educar. Reflexo, pode levar ao conhecimento. A Sobrevivรชncia, o Sagrado,ย a Morte, o Saber, a Verdade, a Arte, se tivermos um mรญnimo de memรณria, sรฃo os campos a que o simples termoย "imagem"ย nos vincula. [@joly2012introducao p.19] // Imagemย รฉ tudo isso e talvez mais, porque nรฃo รฉ tรฃo simples classificarย o que vemos, em que pensamos ou com que sonhamos: seriam imagens todas elas? Para efeito da identificaรงรฃo do objetoย central desta pesquisa, adotaremos, entรฃo, o conceito de @aumont2011 , a seguir. // == O conceitoย de imagem // Para tรฃo diversos empregosย do vocรกbulo "imagem", hรก de haver um ponto comum que justifiqueย significadosย diferentes paraย um mesmo significante. Para Joly, esse ponto comum parece ser a analogia: "Material ou imaterial, visual ou nรฃo, natural ou fabricada, uma 'imagem' รฉ antes de mais nadaย *algo que se assemelha a outra coisa*" [@joly2012introducao p.28 -- grifos da autora].ย  // Partindoย para uma delimitaรงรฃoย daย imagemย objeto deste trabalho, adotaremos o conceito de @aumont2011:ย  // > A imagem, na nossa cultura, รฉ tudo isso: uma reproduรงรฃo de um aspecto do mundo, captada pela sensibilidade mais ou menos individual, mais ou menos genรฉrica e tรญpica de um mediador (artista ou nรฃo), que nos comunica informaรงรตes e sentimentos, suscitando em nรณs outros ainda -- e รฉ tambรฉm um objeto novo acrescentado ao mundo, um objeto que vive a sua vida, tornando-se cรฉlebre ou permanecendo ignorado.ย [@aumont2011 p. 7]ย  // As palavrasย que completamย oย excerto de [@aumont2011 p. 7] sรฃo as seguintes: "A imagem รฉ um sรณsia do mundo, mas um sรณsia deformado, por muito realista que seja, eย que exerce sobre nรณs a atraรงรฃo e eficรกcia mรกgicas do duplo, ao mesmo tempo que o encanto prรณprio de um objeto puramente visual".ย Com essas palavras, o que percebemos รฉ queย a imagem รฉ sempre um objeto segundoย (presente)ย com relaรงรฃo a outro (ausente)ย que ela representa.ย E, ao representar, produz sentido(s) que suscita(m), por parte de quem a olha, interpretaรงรตes.ย  // E chegamos ao que @joly2012introducao considera como consequรชncia da tomada de consciรชncia do estatuto da imagem: // > \[\...\] constatar que esse denominador comum da analogia, ou da semelhanรงa, coloca de imediato a imagem na categoria das *representaรงรตes*. Se ela parece รฉ porqueย *ela nรฃo รฉ a prรณpria coisa*: sua funรงรฃo รฉ, portanto, evocar, querer dizer outra coisa que nรฃo ela prรณpria, utilizando o processo da semelhanรงa. Se a imagem รฉ percebida comoย *representaรงรฃo*, isso quer dizer que a imagem รฉ percebida como signo.ย [@joly2012introducao p. 39ย -- grifos nossos]ย  // Essa รฉ uma perspectiva da teoria semiรณtica, que propรตe considerar a imagem como signo e que ajuda a compreender o estatuto da imagem. <NAME>, que serรก aqui citadoย algumasย vezes, รฉ referรชncia importante dessa linha teรณrica. Isso significa que, embora esta nรฃo seja uma pesquisa de semiรณtica, a anรกlise das imagens que compรตem oย *corpus*ย serรก feita com o apoio da semiรณtica.ย  // Assumir pressupostos semiรณticos, como perceber a imagem como signo, representaรงรฃo, exige reflexรฃo sobreย a(s) mensagem(ns) deย determinadaย imagem. Quem produz e expรตe uma imagem tem, certamente,ย objetivo(s), tem algo a dizer e nรฃo o faz por palavras. Quem olha uma imagem pode ou nรฃo se sentir atraรญdo e, caso seja atraรญdo, pode se perguntar sobre o conteรบdo daquela imagem. Se as representaรงรตes sรฃo compreendidas pelo indivรญduo que olha a imagem, รฉ porque existe, entre ele e o outro que a produziu, um mรญnimo de convenรงรฃo sociocultural que permitiu a comunicaรงรฃo,ย evocandoย a semelhanรงa,ย o traรงo eย a convenรงรฃo, isto รฉ, o รญcone,ย o รญndiceย eย o sรญmbolo.ย Mas Jolyย (2012, p. 42)ย nos alerta: "Reconhecer motivos nas mensagens visuais e interpretรก-los sรฃo duas operaรงรตes mentais complementares, mesmo que tenhamos a impressรฃo de que sรฃo simultรขneas".ย  // A experiรชncia de olhar confere importรขncia especial ร s imagens visuais, mas, como bem destaca Novaes (2005):ย  // > As imagens nรฃo sรฃo, portanto, apenas, nem mesmo principalmente, um objeto de contemplaรงรฃo do olho e do espรญrito. ร‰ atravรฉs delas que o olhar se realiza em nรณs com o que nos vem de fora; da mesma maneira que รฉ atravรฉs das imagens do espรญrito que o homem realiza o que estรก no mundo. *As imagens permitem, pois, este duplo movimento: sair de si e trazer o mundo para dentroย de si*. (NOVAES, 2005, p. 10-11 -- grifos nossos)ย  // A vida contemporรขnea tornou-se muito prรณdiga na produรงรฃo e exibiรงรฃo de imagens. Nรฃo hรก comoย parar de consumir imagens, e o tempo da nossa existรชncia parece insuficiente para a nossa capacidade de pensar sobreย elas, de compreender o mundo a partir delas.ย E imagem sem pensamento pode ser uma fรณrmula empobrecedora para a vida do indivรญduo e perigosa para a coletividade, porque reduz a experiรชncia de viver a mera distraรงรฃo (NOVAES, 2005, p. 14), consequentemente, nรฃo conduz a um universo de luz e sombra, que รฉ o imaginรกrio, onde moram as imagens,ย mas tambรฉmย aย [fan]{.underline}tasia, oย [fan]{.underline}tรกstico, oย [fan]{.underline}tasmaย (essas palavras vรชm do gregoโ€ฏ*phos*, "luz", do verboโ€ฏ*phaรญnein*, "fazer aparecer", pois o que se mostra iluminado aparece, se faz notar).ย  // Hรก, portanto, necessรกria articulaรงรฃo entre imagens que nos cercam e ideias jรก formadas e que constituem o imaginรกrio, e tanto as primeiras quanto as segundas sรณ podem significar algo se formos capazes de pensar sobre elas, o que vai alรฉm da simples distraรงรฃo de olhar para elas. A partir desse pensar, chega-se ao deciframento do mundo.ย Neste trabalho, o resultado que se espera รฉ decifrar a fotografia de <NAME>, em primeiro lugar, mas tambรฉm aquelas que surgiram como eco desta, de tal forma que seja possรญvel observar o duplo movimento descrito por Novaes (2005) -- o que รฉ "sair de si", o que รฉ "trazer o mundo para dentro de si" e como esse vaivรฉm resulta na compreensรฃo de um aspecto do mundo e da vida. // Imagens tรชmย extraordinรกria forรงa de convencimento.ย Mostram pela afirmaรงรฃo porque ignoram a negaรงรฃo;ย nรฃo explicam, nรฃo comparam, nรฃo deduzemย --ย tudo o que dizem poderia se resumir em:ย aรญ estรก,ย รฉ assim.ย Tornam presente qualquer passado ou ausรชncia. "A imagem quer anular a morte" (WOLFF, 2005, p. 32).ย Por isso, nas sociedades tradicionais, grande parte das imagens produzidasย รฉ composta de deuses e de mortos -- imagens sagradas que precederam o nascimento da arte.ย  // Nas sociedadesย modernas -- surgidas a partir do sรฉculo XVI, na Europa, e consolidadas no final do sรฉculo XIX --,ย imagens sagradas e profanasย transbordam. O prodigioso desenvolvimento de tรฉcnicas automรกticas de reproduรงรฃo -- fotografia, cinema, televisรฃo, imagensย de sรญnteseย -- pรดs imagens em todos os lugares, imagens de tudo, de todos e para todos, num movimento que deu acesso a todos ร  cultura e ร  realidade do mundoย (WOLFF, 2005). // Sobreย "realidade", porรฉm, รฉ precisoย dizer: na contemporaneidade, ter acesso ao real via imagens tรฉcnicas รฉ umaย ilusรฃo, posto que o que vemos sรฃo recortes, fragmentos: "Serรก que imaginamos quantos acontecimentos, mais graves, mais importantes, histรณricos, foram omitidos porque nรฃo havia cรขmera para filmรก-los ou porque decidimosย nรฃo osย mostrar?"ย (WOLFF, 2005, p. 44). Mais que isso, serรก que estรก claro para o olhar que as imagens tรฉcnicasย nรฃo sรฃo -- como podem parecer -- o real se reproduzindo sozinho, sem a atuaรงรฃo humana? ย  // Segundo Wolff (2005),ย  // > O mais perigoso poder da imagem รฉ fazer crer que ela nรฃo รฉ uma imagem, fazer-se esquecer como imagem. Antes da arte, olhรกvamos o รญcone e acreditรกvamos ver o prรณprio deus, diretamente, sem representaรงรฃo. Depois da arte, olhamos para a televisรฃo e cremos ver a prรณpria realidade, diretamente, sem representaรงรฃo. A causa estรก ausente, o trabalho de produรงรฃo da imagem nรฃo รฉ mais visto na imagem, a imagem nรฃo pode ser vista como imagem. Diante dessas imagens ao vivo e em tempo real, atravessamos a tela, no real registrado, a representaรงรฃo รฉ negada como representaรงรฃo \[\...\]. (WOLFF, 2005, p. 43)ย  // A esse propรณsito, o artista surrealista belga <NAME> inquietou o mundo com uma obra revolucionรกria e fundamental que nos faz pensar sobre a relaรงรฃo que existe entre o objeto em si e sua representaรงรฃo: *Ceci n'est pas une pipe* (Isto nรฃo รฉ um cachimbo), pinturas em que ele chama a atenรงรฃo para o fato sempre esquecido de que a pintura de um cachimbo nรฃo รฉ um cachimbo, mas uma pintura. Dois dos quadros dessa sรฉrie sรฃo os mais conhecidos e os mais importantes: *La trahison des images*, de 1928, e *Les deux mystรจres*, de 1966. // // ![][17] // // []{#_Toc507740886 .anchor}**Figura 1 -- A traiรงรฃo das imagens** // // // ![][18] // // // []{#_Toc507740887 .anchor}**Figura 2 -- Os dois mistรฉrios** // > O tรญtulo "A traiรงรฃo das imagens" chama a atenรงรฃo para a circunstรขncia de as coisas nรฃo serem o que parecem ser e, em particular, para o fato, que deveria ser รณbvio mas nรฃo รฉ, de que a representaรงรฃo de uma coisa nunca serรก mais do que isto: a representaรงรฃo de uma coisa e nรฃo a prรณpria coisa. Nรฃo sabemos como as coisas sรฃo em si, apenas como elas aparecem aos nossos limitados sentidos e ร  nossa limitada mente em dado momento limitado. \[\...\] O tรญtulo "Os dois mistรฉrios" mostra que o pintor nรฃo ficou contente com um mistรฉrio "sรณ" e resolveu duplicรก-lo, dรฉcadas depois do primeiro quadro e de toda a repercussรฃo que ele gerou. \[\...\] O primeiro mistรฉrio รฉ o da traiรงรฃo das imagens, que sรฃo imagens das coisas e nรฃo as prรณprias coisas que imaginamos. O segundo mistรฉrio รฉ o da explicitaรงรฃo da metaficรงรฃo, isto รฉ, da ficรงรฃo dentro da ficรงรฃo que, paradoxalmente, tanto revela quanto esconde o labirinto vertiginoso em que a arte vem nos jogando hรก tanto tempo.[^9] // Neste trabalho,ย trataremos de imagens visuais fixas, especificamente de uma fotografiaย jornalรญstica,ย e passaremos por manifestaรงรตes visuaisย como representaรงรตes secundรกrias dessa fotografia.ย Isso obriga a que abordemos a imagem analรณgica sob pontos de vista queย tenham รญntima relaรงรฃo com procedimentos tรฉcnicosย de produzir imagensย eย com a condiรงรฃo interconectada da sociedade em rede e dos meios de comunicaรงรฃo, mas tambรฉm sob o ponto de vista dos sentidos que essas imagens adquirem e das relaรงรตes que mantรชm com ideias guardadas no imaginรกrio. Os sentidos partirรฃo do real, mas transitarรฃo pelo imaginรกrio e pelo ficcional, na medida em que nosso objeto de estudo parece se situar nas fronteiras desses campos, muito mais do que no real que o fotojornalismo sugere. // A fotografia jornalรญstica em questรฃoย foi feita pela fotojornalista turcaย <NAME>, no dia 2 de setembro de 2015,ย emย Bodrum, na Turquia, em que se vรช uma crianรงa morta nas areias da praia -- รฉ <NAME>, 3 anos, sรญrio de origem curda,ย muรงulmano, provavelmente sunita (como a maioria dos muรงulmanos), que fugia da guerra em seu paรญs e morreu apรณs o barco em que viajava com a famรญlia e mais algumas pessoas naufragar. E as perguntas que guiaram este estudo foram: por que aquela fotoย -- e nรฃo outra -- atraiuย a atenรงรฃo de jornais de tantos paรญses a ponto de ser estampada na primeira pรกgina, no dia seguinte ร  morte de Aylan, 3 de setembro de 2015? O que essa foto trouxe consigo que explica a reaรงรฃo imediata da audiรชncia e as manifestaรงรตes visuais de internautas? "As imagens fotogrรกficasย nรฃo falamย -- se impรตem pela imobilidade e pelo silรชncio", nos ensinou <NAME>ย durante o curso "Cinema e fotografia: autobiografia, autorretrato e arte da memรณria em Raymondย Depardon,ย <NAME>, <NAME>ย e <NAME>", na Universidade de Brasรญlia, em abril de 2017.ย "A prรณpria mudez do que seria, hipoteticamente, compreensรญvel nas fotos รฉ o que constitui seu carรกter atraente e provocador", nos ensinaย Sontagย (2004, p. 34).ย Como compreender o que na imagem fotogrรกfica atrai e provocaย aqueles que a olham? Por que nรฃo saรญmos intactos depois de olhar essa fotoย e as representaรงรตes que dela partiram? // A seguir, as funรงรตes da imagem e as relaรงรตes entre imagem e tรฉcnica serรฃo discutidas para, partindo disso, concluirmos o capรญtulo com a fotografia como processo de (re)produรงรฃo de imagens.ย  // == Funรงรตes da imagemย segundo Aumontย  // Segundo @aumont2011ย --ย e a partir de uma antropologiaย visualย --, a imagemย รฉ um vetor de pensamento, portanto sรฃo os seus grandes usos humanos que interessam, sejam eles sociais ou individuais.ย  // > A imagemย รฉ um dos objetos mais velhos e mais constantes da antropologia -- muito simplesmente porque ela รฉ, tambรฉm, uma das mais velhas produรงรตes humanas, e das que, apesar de tudo, se conservam melhor.ย \[\...\] Alรฉmย disso, a imagem รฉ, pelo menos virtualmente, uma fonte riquรญssima de informaรงรตes. Dos homens "prรฉ-histรณricos" nada conhecemos alรฉm dos seus utensรญlios e dasย suas imagens; ora, por enigmรกtica que estas sejam, elas ensinam-nos sobre os nossos antepassados longรญnquos no mรญnimo tanto como os produtos, menosย ambรญguosย mas de utilidade limitada, do seu artesanato.ย [@aumont2011 p. 116]ย  // ร‰ nessa perspectiva, portanto, que esta seรงรฃo tratarรก as funรงรตes da imagem, organizadas conforme proposto porย Aumontย (2011) em: i) a imagem como sรญmbolo;ย ii) a imagem documental;ย eย iii) a imagem estรฉtica.ย Para exemplificar essas categorias, privilegiaremos a fotografia, notadamente a de <NAME>, sempre que couber.ย Com isso, jรก estaremos em processo de compreender o diรกlogo que se estabelece entre a imagem e aquele que a olha e o movimento de "saรญda" e de "entrada" descrito por Novaes (2005) como modo reflexivo de compreender o mundo, muito mais do que apenas distrair o olhar. // === A imagem como sรญmboloย  // > *De facto, toda a imagem, ou quase, pode representar um papel simbรณlico, nรฃo em virtude de suas qualidades intrรญnsecas, mas de uma decisรฃo de ordem coletiva -- religiosa, polรญtica, ideolรณgica e comercial.*ย  // [@aumont2011 p. 118]ย  // O uso religioso da imagemย รฉ considerado como aย funรงรฃoย que inaugura a histรณriaย da imagem. Os sรญmbolos religiosos foram eย ainda sรฃo numerosos, dentre os quais se destaca a cruz.ย  // // ![][19] // // ย  // // []{#_Ref503516204 .anchor}**Figura 3 -- Cruz** // // Fonte: \<https://mundoestranho.abril.com.br/religiao/que-outras-religioes-usam-a-cruz-como-simbolo-o-que-significam/\>ย  // // ย  // Sรญmbolo mais famoso do Cristianismo, a imagem nรบmero 1 da Figura 3 representa o sacrifรญcio de <NAME>risto pela humanidade. Catรณlicos romanos, ortodoxos orientais, alguns ramos do luteranismo e do anglicanismo fazem o sinal da cruz como demonstraรงรฃoโ€ฏdeโ€ฏsua fรฉ.ย A imagem nรบmero 2 รฉ conhecida popularmente como "pรฉ de galinha" e representa a comunicaรงรฃo entre o mundo da morte e o da ressurreiรงรฃo. Em sua versรฃo invertida e dentro de um cรญrculo, essa cruz รฉ o sรญmbolo de "paz e amor", criado durante a Campanha pelo Desarmamento Nuclear, nos anos 1960. A imagem nรบmero 3 รฉ chamada deย tau.ย ร‰ um sรญmbolo muito antigo de divindades como o deus Sol, naย mitologia sumรฉria, o deus romano Mithras e o deus grego รtis. Essa imagem tambรฉm foi utilizada por Sรฃo Francisco de Assis, motivo por que hojeย รฉ reconhecida como sinal da Ordem Franciscana.ย  // Ao longo de sua histรณria, a imagem nรฃo ficou restrita ao uso religioso, mas @aumont2011ย alerta para o fato deย que a imagem-sรญmbolo costuma estar associada ao poder, seja ele qual for, eย completa o raciocรญnio, lembrandoย que os sรญmbolos presentes numa imagem nรฃo sรฃo afirmadosย nem estรฃo presentes nela: sรฃo apenas uma evocaรงรฃo. Nesse sentido, pode-se sempre interpretar uma imagem simbรณlica diferentemente das intenรงรตes do seu criador. ร‰ importante ter em mente esse poder da imagem, especialmente em se tratando do objeto que nos ocupa aqui, porque a fotografia de Aylan tornou-se sรญmbolo do drama dos refugiados, termo que serรก discutido no capรญtulo 3. No entanto, sua imagem definiu toda a tragรฉdia dos refugiadosย de vรกrias nacionalidades.ย  // === A imagem documentalย  // > *As imagens foram sempre utilizadas pelo seu valor informativo.* // [@aumont2011 p. 118] // ย  // A mais relevante mutaรงรฃo na funรงรฃo das imagens, segundo @aumont2011, foi o fato de se lhe reconhecer valor documental. Uma imagem pode assemelhar-seย ร  realidade e ajudar a compreendรช-la, inclusive moldando-a. A funรงรฃo documental desenvolveu-seย e ampliou-se consideravelmente desde o inรญcio da era moderna, sobretudo, com o surgimento da fotografia e o desenvolvimento cada vez mais rรกpidoย de circuitos de difusรฃo das imagens, de que hoje a internet รฉย a manifestaรงรฃo mais importante.ย  // Ocorre que a imagem-documento mostra, mas nรฃoย descreve nem explica, posto que estaย รฉ uma tarefa de outra linguagem,ย em geral,ย a verbal.ย  // A fotografia de Aylan,ย por forรงaย de sua origem jornalรญstica, pode ser vista como um documento de um aspecto do real, mas, precisamente por sua origem, necessita de uma legenda, que nรฃo faz parte da iconografia. Esse รฉ um aspecto que merece destaque porqueย a legenda de uma fotografia dรก ao leitor informaรงรตes nรฃo contidas ou nรฃo evidentes na imagem. Portanto, a histรณria de Aylan ficou conhecida por meio de sua fotografiaย eย das legendasย que a acompanharamย nos jornais.ย Dada a sua relevรขncia, a legenda da fotografia jornalรญsticaย รฉ um aspecto que envolve riscos, conforme nos alerta Barthes (1990):ย  // > Trata-se aparentemente de uma explicitaรงรฃo, isto รฉ, dentro de certosย limites, de uma รชnfase; na maioria das vezes o texto limita-se a ampliar um conjunto de conotaรงรตes jรก incluรญdas na fotografia; mas, por vezes, tambรฉm o texto produz (inventa) um significado inteiramente novo, que รฉ de certo modoย projetado retroativamente na imagem, a ponto de nela parecer denotado \[\...\]. Por vezes, a palavra pode chegar a contradizer a imagem, produzindo uma conotaรงรฃo compensadora. (BARTHES, 1990, p. 21)ย  // Ainda a esse respeito, diz-nosย Sontagย (2003, p. 14):ย "E todas as fotos esperam sua vez de serem explicadas ou deturpadas por suasย legendas". // Outro detalhe muito relevante a respeito da fotografia-documento reside no fato de ela aceitar truques, falsificaรงรตes, ediรงรตesย e encenaรงรตes -- hoje em dia, mais que em qualquer outra รฉpoca. Hรก inรบmeros casos de fotografias encenadas que, de inรญcio, serviram para mostrar cenas de guerra.ย Sontagย (2003) lista uma sรฉrie de fotografias que passaram para a histรณria como documentos, mas queย tudo indica terem sido encenadas. E a ensaรญsta conclui:ย  // > O estranho nรฃo รฉ que tantas cรฉlebres fotos jornalรญsticas do passado, entre elas algumas das mais lembradas fotos da Segunda Guerra Mundial, tenham sido, ao que tudo indica, encenadas. O estranhoย รฉ que nos surpreenda saber que foram encenadas e que isso sempre nos causa frustraรงรฃo. As fotos que mais nos decepcionam ao se revelarem montagens e encenaรงรตes sรฃo aquelas que parecem registrar momentos de clรญmax รญntimos, sobretudo de amor e de morte. (SONTAG, 2003, p. 48)ย  // ย  // === A imagem estรฉtica // > A imagem artรญstica, isto รฉ, afetada de um valor prรณprio, existiu desde sempre -- e em todos os tempos histรณricos, ela suscitou uma interrogaรงรฃo fundamental sobre a sua natureza e os seus poderes.ย ร‰ esse discurso que se designa correntemente pelo termoย *estรฉtica*. // [@aumont2011 p. 147-148] // ร‰ย preciso considerar, entre as funรงรตesย da imagem, o prazer que ela proporciona, seja intelectual ou sensorial, porque a imagem destina-se tambรฉm a agradar o olhar, aย falarย ร  sensibilidade, domรญnio humano queย permite a criaรงรฃo ao mesmo tempo em que abre caminho para acesso ao espรญrito [@aumont2011].ย Mas precisamente por falarย ร  sensibilidade, abriu espaรงo para um debate tรฃoย antigo quanto atual:ย  // > "Por que รฉ que as pessoas acham agradรกvel, ou parecem achar agradรกvel, a prรณpriaย atividadeย perceptiva?"ย (CHILD, 1978). Semelhante questรฃo รฉ colocada principalmente sobre a imagem artรญstica, mas as respostas dizem respeito ร  experiรชncia estรฉtica em geral, operando sobretudo uma partilha importante entre teorias extrรญnsecas (o prazer nรฃo se deve atribuir ร  percepรงรฃo, mas a outra coisa), intrรญnsecas (o prazer estรก ligado a certas caracterรญsticas da imagem, por exemplo as suas proporรงรตes harmoniosas), ou interativas (o prazer estรก ligado ร  interaรงรฃo entre a imagem e as caracterรญsticas da pessoa ou da situaรงรฃo). [@aumont2011 p. 148] // O que determina o carรกter de arte a uma imagem varia de um tempo a outro, de uma sociedade a outra. Em dado momento da histรณria da arte, a suposta origem das sensaรงรตes agradรกveis causadas pelas obras de arte era o Belo. Depois, a beleza deixou de ser o centro da questรฃoย estรฉtica.ย Atualmente, conforme Aumont (2011, p. 119),ย "\[a arte\] se define quase exclusivamente de maneira institucional (um artistaย รฉ o que uma instituiรงรฃo habilitada reconhece como artista, do mesmo modo que uma obra de arte รฉ o que vale como tal no seio de uma instituiรงรฃo reconhecida) \[\...\]".ย  // Como se observa, arte e estรฉtica sรฃo camposย ligados ao contexto histรณrico-cultural ao qual o artista pertence e ao qual os espectadores pertencem -- nem sempre coincidentes.ย Essa relaรงรฃo histรณrico-cultural traz ร  histรณria da arte e ร  estรฉtica um ingrediente de incertezaย x certeza que nรฃo cabe aqui aprofundarย -- dada a complexidade e extensรฃo da discussรฃo que suscitaria --, mas que merece, pelo menos, ser anunciado. Esse ingrediente foi considerado por Didi-Hubermanย (2013, p. 17) comoย "certo mal-estarย vivido noย รขmbito da histรณria da arte acadรชmica":ย  // ย  // > \[\...\] que obscuras ou triunfantes razรตes, que angรบstias mortais ou que exaltaรงรตes manรญacas puderam levar a histรณria da arte a adotar esse tom, essa retรณrica da certeza? Como pรดde se constituir -- e com tanta evidรชnciaย -- talย *fechamentoย *do visรญvel sobre o legรญvel e de tudo isso sobre o saber inteligรญvel?ย \[\...\] Em suma, o ditoย "conhecimento especรญfico da arte" simplesmente acabou por impor a seu objeto sua prรณpriaย *forma especรญfica de discurso*, com o risco de inventar fronteiras artificiais para o seu objetoย -- objeto despojado do seu prรณprio ou transbordamento especรญfico. (DIDI-HUBERMAN, 2013, p. 11-12 -- grifos do autor)ย  // ย  // Pode soar mรณrbidoย associarย a foto de Aylan a um objeto cujo valor estรฉtico merece destaque, mas o fato รฉ que essa foto evoca a sensibilidade e proporciona uma experiรชncia estรฉtica, contraditรณria e paradoxalย como a contemporaneidade.ย ร‰ um retrato do realย --ย eย nesse aspectoย atende a umย gosto estรฉticoย cada vez mais apreciado:ย  // ย  // > Mas รฉ, justamente, em sociedades midiรกticas saturadas de imagens, slogans publicitรกrios, parques temรกticos, templos do consumo e espaรงos funcionalizados que assistimos a um boom de produtos e expressรตes artรญsticas realistas que buscam representar a realidade ou a "vida como ela รฉ". Documentรกrios, filmes de ficรงรฃo, reportagens jornalรญsticas, fotografias pรบblicas, blogs, biografias, diรกrios e autobiografias revelam essa รขnsia pela captura de eventos ou vidas reais.ย (JAGUARIBE,ย 2010, p. 7]ย  // Mas รฉ tambรฉm uma imagem que se aproxima deย um "realย ficcional" precisamente porque a existรชncia de Aylan sรณ nos รฉ possรญvel na condiรงรฃo de vida imaginรกria.ย Entรฃo, concordamos com Jaguaribe (2010, p. 14),ย quando a autora conclui que, "na sua diversidade, as novas estรฉticas do realismo afirmam retratos do cotidiano que tanto espetacularizam aย realidade quanto geram debates polรญticos e reivindicaรงรตes democrรกticas". E concordamos com o diretor do Sesc Sรฃo Paulo hรก 33 anos, <NAME>, que em entrevista recente declarou: // > \[\...\] o artista รฉ convocado atรฉ mais do que os outros a refletir, a sonhar, a criar fantasias. Mas essas fantasias nรฃo sรฃo tรฃo abstratas, sรฃo do que estรก rolando. A arte nรฃo รฉ desvinculada do real. No fundo, o que se apresenta รฉ que o compromisso com a realidade รฉ irremediรกvel. (COUTINHO, 2017, p. 108) // Estamos, portanto, diante de uma fotografia jornalรญstica que reรบne caracterรญsticas de sรญmbolo, documento e arte. // ย  // == Imagem e tรฉcnica // ย  // @aumont2011 [-@aumont2011 p. 153] chama a atenรงรฃo para a importรขncia de conhecer alguns momentos essenciais na existรชnciaย -- histรณrica e substancialย -- da imagemย que marcam importantes mudanรงas noย seuย estatuto, "do seu prรณprio surgimento como artefacto humano, atรฉ as recentes transformaรงรตes que ocorrem aos nossos olhos".ย Oย que pretendemosย nesta seรงรฃo รฉ, portanto, associar momentos histรณricos a disrupรงรตes tรฉcnicas sofridas pela imagem com vistas a muito mais destacar o percurso da imagem desde seu surgimento atรฉ os dias que correm do queย reproduzir desnecessariamente a histรณria factualย da imagem, embora seja impossรญvel fugir disso. // O surgimento da imagem, conforme [@aumont2011 p. 156], data do perรญodo paleolรญtico. "A imagem surgiu hรก dezenas de milรฉnios, vinda nรฃo se sabe de onde -- como a lรญngua e, tal como esta, prรณpria do homemย \[\...\]. A imagem parece ter existido sempre: logo, por si mesma ela 'nรฃo tem histรณria'; sรณ as suas formas sociais a tรชm".ย  // Conhecem-se hoje, no mundo inteiro, cerca de 200 grutas decoradas com imagens que remetem ao perรญodo paleolรญtico. No sul da Franรงa e no norte da Espanha, encontram-se 85% dessas grutas, dentre as quais se destacam Altamira (Espanha, 1879), Pech-Merle (Franรงa, 1922), Lascaux (Franรงa, 1940), Arcyย surย Cure (Franรงa, 1990), Cosquer (gruta submarina na Franรงa, 1991) e Chauvet (Franรงa, 1994), esta รบltimaย consideradaย a mais antiga de todas, datada de 30 mil anos a.C. // No Brasil,ย encontra-seย a รกrea de maior concentraรงรฃo de sรญtios prรฉ-histรณricos do continente americano e Patrimรดnio Cultural da Humanidade desde 1991,ย que รฉ o Parque Nacional da Serra da Capivara, localizado nos municรญpios piauiensesย de Canto do Buriti, Cor<NAME>, Sรฃo Joรฃo do Piauรญ e Sรฃo Raimundo Nonato, e lugar comย expressivaย quantidade de pinturas rupestres.ย  // > Com mais de 120 mil hectares de cรขnions, grutas, falรฉsias e o rico bioma da caatinga, o Parque da Serra da Capivara e seu entorno abrigam 1.334 sรญtios arqueolรณgicos (172 deles abertos a turistas), pinturas com 29 mil anos de histรณria, paisagens que remontam ao perรญodo prรฉ-cambriano (mais de 570 milhรตes de anos atrรกs) e um infindรกvel cemitรฉrio de animais da megafauna: de seus terrenos sรฃo retiradas, periodicamente, ossadas de mastodontes, tigres-dente-de-sabre, preguiรงas gigantes (que tinham seis metros e atรฉ 700 quilos) e outras espรฉcies extintas hรก milรชnios.[^10] // As representaรงรตes grรกficasย encontradas no Parque Nacional da Serra da Capivaraย abordam grande variedade de formas, cores e temas.ย Hรกย cenas de caรงa, sexo, guerra e aspectos da vida cotidiana e do universo simbรณlico dos seus autores.ย  // Segundo @aumont2011, desde os primeiros tempos da produรงรฃo de imagens, jรก se utilizavam tรฉcnicas que se mantiveram em uso durante milรชnios. Isso sรณ mudou com o advento da gravura e da fotografia, queย trouxeram inovaรงรตes para a produรงรฃo de imagens e, especificamente a fotografia, transformaram nosso modo de ver o mundo.ย  // Desenhos sรฃo as imagens mais numerosas das produรงรตes grรกficas prรฉ-histรณricas, mas encontram-se tambรฉm esculturas feitas a partir de diversos materiais, como marfim, xisto, tufo basรกltico. Em sua maioria, sรฃo representaรงรตes de animais, quase sempre vistos de perfil, e hรก poucas imagens humanas -- hรก, sim, figuras humanoides em relevo ou em vulto, de tamanhos variรกveis.ย Que se saiba, nรฃo hรก desenhos paleolรญticos de plantas, rios, montanhas, rochedos e ferramentas. Tambรฉm nรฃo hรก pรกssaros, peixes ou insetos.ย  // A opรงรฃo por representar animais (e alguns humanos) chama a atenรงรฃo daqueles que se debruรงam sobre o tema e gera discordรขncias, mas os estudiosos reconhecem que nem sempre รฉ possรญvel saber qual รฉ o sentido dasย imagens.ย Paraย Aumont (2011, p. 155), "as interpretaรงรตes proliferam, mas a partir de fatores contemporรขneos de cada intรฉrprete:ย a exegese da produรงรฃo plรกstica prรฉ-histรณrica รฉ, por excelรชncia, um terreno propรญcio ร  interpretaรงรฃo projetiva".ย A experiรชncia com o sagrado รฉ uma explicaรงรฃo recorrente, mas hรก quem defenda que as produรงรตes plรกsticas sejam experiรชncias com a realidade e sua simbolizaรงรฃo.ย  // Seja como for, as imagens mais antigas, produzidas depois da invenรงรฃo da escrita, portanto "histรณricas", em geral, estรฃo ligadasย ao sagradoย eย ร ย morteย e ainda ร  polรญticaย (aumont201).ย Na Grรฉcia Arcaica, as imagens dos รญdolos sรฃo exemplos da representaรงรฃo do divino. Na Grรฉcia Antiga,ย estelas[^11]ย funerรกrias traziam a imagem do morto como forma de manifestar sua passagem para o alรฉm e, supรตe-se, evitar seu regresso. Na Grรฉcia Clรกssica e depois em Roma, bustos eram reservados a imperadores, chefes do exรฉrcito e, eventualmente, artistas cรฉlebres, como Homero e Safo. E ainda a deuses.ย No Antigo Egito,ย manifestaรงรตes "artรญsticas" tiveram supremacia na religiรฃo,ย sobretudo a partir das imagens feitas de faraรณ, soberano absolutoย e representante da divindade na Terra.ย Durante toda a Idade Mรฉdia, as imagens que se produziam eram, em sua maioria, associadas a personagens mรญticas, de base cristรฃ. A partir do sรฉculo XIII, proliferaramย estรกtuas equestres eย bustos funerรกrios de reis, senhores poderosos e prรญncipes da Igrejaย (GOMBRICH, 2015). // Giottoย diย Bondone, pintor e arquiteto italianoย (1267-1337), foi o precursor de uma inovaรงรฃo nas artes figurativas: a perspectiva na pintura renascentista que aumentaria ainda mais a ilusรฃo da realidade nas obras (GOMBRICH, 2015).ย Alรฉm disso, asย figurasย que produziuย dos santosย assemelhavam-se aย seres humanos de aparรชncia comum. Assim, a pintura deย Giottoย vem ao encontro de uma visรฃo humanista do mundo, que foi cada vez mais se firmando atรฉ o Renascimento.ย  // ร‰ a partir desse momento histรณrico, conhecido como Renascenรงa, que novos temas passaram a ser retratados nas imagens figurativas, inaugurando um perรญodo em que o adjetivo "artรญstico" se aproxima mais do que hoje se concebe como arte.ย A cultura renascentista, marcadamente antropocรชntrica, trouxe ao mundo ocidental o deslocamento da perspectiva filosรณfica e cultural centrada em Deus, cedendo lugar a uma perspectiva centrada no homem.ย  // ร€ criaรงรฃo da perspectiva, sucedeu-se o aperfeiรงoamento da tรฉcnica pictรณrica, inovaรงรฃo que permitiu espelhar a realidade em todos os pormenores da pinturaย (GOMBRICH, 2015) e cujo grande representante รฉ <NAME>, pintor flamengo nascido em 1390 e morto emย 1441.ย Foi ele o inventor da pintura a รณleoย (GOMBRICH, 2015).ย  // > As novas descobertas que os artistas da Itรกlia e Flandres tinham feito no comeรงo do sรฉculo XV produziram um frรชmito de emoรงรฃo em toda a Europa. Pintores e mecenas estavam igualmente fascinados pela ideia de que a arte pudesse ser usada nรฃo sรณ para contar a histรณria sagrada de uma forma comovente, mas para refletir tambรฉm um fragmento do mundo real. Talvez o resultado mais imediato dessa grande revoluรงรฃo na arte tenha sido os artistas comeรงarem por toda parte a realizar experiรชncias e a buscarย novos e surpreendentes efeitos.ย (GOMBRICH, 2015,ย p. 248)ย  // A possiblidade de reproduzir mecanicamente uma imagem sรณ passou a existir com o advento de uma tรฉcnica que consistia em um bloco de madeira ou uma placa de cobre ou aรงo, com a imagem cinzelada na placa ou feita por corrosรฃo com acido (รกgua-forte). A essa tรฉcnica, deu-se o nome de xilogravura.ย Desde o sรฉculo VI, a tรฉcnica da xilogravura era conhecida na China, mas foi na Idade Mรฉdia, no final do sรฉculo XIV,ย que se afirmou no Ocidente, diminuindo os custos de produรงรฃo de [livros] ilustrados e abrindo caminho para a produรงรฃo em massa de imagens pictรณricas (BRIGGS; BURKE, 2006). // Noย finalย do sรฉculoย XVII,ย foi a vez da litografia -- processo quรญmicoย mais econรดmico e menos demorado que todos os outros meios conhecidos na รฉpoca, consistindo de um desenho com lรกpis de cera sobre uma pedra. Essa tรฉcnica permitiu, pela primeira vez, produzirย imagens coloridas a baixo custoย (BRIGGS; BURKE, 2006).ย  // Eย um novo momento de inovaรงรฃo na histรณria daย imagemย ocorreuย emย meados doย sรฉculoย XIX, quando surgiuย nova tรฉcnica de retratar o mundo: a fotografia. // > Na metade do sรฉculo XIX, surgiu a fotografia, aproveitando-se de uma crise profunda da verdade, de uma perda da credibilidade, que atingiu os modos de representaรงรฃo em vigor, fosse texto ou desenho, demasiadamente dependentes da habilidade manual e da subjetividade humana. A fotografia, junto com a possibilidade de impressรฃo e a mรกquina, veio renovar a crenรงa na imitaรงรฃo e na representaรงรฃo. (ROUILLร‰, 2009, p. 28) // O perรญodo histรณrico em que se dรก o surgimento da fotografia รฉ o da sociedade industrial. E isso nรฃo foi por acaso. A fotografiaย se associa a todas as novidades tecnolรณgicas da รฉpoca, como expansรฃo das metrรณpoles e da economia de mercado, industrializaรงรฃo, superaรงรฃo das barreiras do espaรงo e do tempo graรงasย ao advento daย locomotiva a vapor e das comunicaรงรตes. O carรกter mecรขnico da fotografia fez dela a imagem da sociedade industrial (ROUILLร‰, 2009).ย  // > \[\...\] a fotografia, no decorrer de seu primeiro sรฉculo, como destino maior conheceu apenas o de servir, de responder ร s novas necessidades de imagens da nova sociedade. De ser ferramenta. Pois, como qualquer outra, essa sociedade tinha necessidade de um sistema de representaรงรฃo adaptado ao seu nรญvel de desenvolvimento, ao seu grau de tecnicidade, aos seus ritmos, aos seus modos de organizaรงรฃo sociais e polรญticos, aos seus valores e, evidentemente, ร  sua economia. Na metade do sรฉculo XIX, a fotografia foi a melhor resposta para todas essas necessidades. (ROUILLร‰, 2009, p. 31)ย  // A fotografia foi tudo isso, menos uma unanimidade. Divididos pela tรฉcnica que caracteriza a fotografia, unsย aย diabolizaram, outrosย aย idealizaram. E a discussรฃo a respeito de arte e fotografia mobilizouย defensores e detratoresย durante muito tempo.ย Arte e tรฉcnica sobreviveram.ย  // Jรก se vรฃo quase dois sรฉculos desde que a fotografia surgiuย e passou porย avanรงos tecnolรณgicos.ย Segundoย Benjamin (1985, p. 91),ย com a fotografia, "foram criadas as condiรงรตes para um desenvolvimento contรญnuo e acelerado" da produรงรฃo de imagens tรฉcnicasย cada vez maisย disruptivas:ย imagens em preto e branco foram rapidamente seguidas de imagens coloridas; as fixas logo abriram caminho para as em movimento, e assim surgiu o cinema --ย a sรฉtima arte foi muda, ganhou som e cor, inovou em tecnologia e efeitos especiais que revolucionaram a criaรงรฃo cinematogrรกfica do mundo. E entรฃo veio o vรญdeo e, com ele, a televisรฃoย -- tambรฉm esta alvoย dos maiores amores e das maisย durasย crรญticas --, que, por sua vez, tornou possรญvel a chegada dos videogames. // O telefone celular, hoje tรฃo popular, foiย usado pela primeira vez em 1973, mas sรณ foiย licenciado em 1983,ย nos Estados Unidos,ย de inรญcio, com base em um รบnico serviรงo: comunicaรงรฃo de voz. Emย pouco mais de trรชs dรฉcadas, passou a contar comย serviรงos de mensagens eย logo se transformouย num dispositivo inteligente, capaz de congregar outras funรงรตes alรฉm de chamadas de telefone. Poucas mudanรงas foram tรฃo importantes para aย produรงรฃo de imagensย quantoย o surgimento dos processos digitais. Essa evoluรงรฃo trouxe vantagens incrรญveisย paraย oย celular, que se transformou em *smartphone* a partir do momento em que acessou a internet e deu aos usuรกrios a oportunidade de receber eย enviar dados, inclusive visuais, a qualquer ponto do planeta, potencialmente, ganhou cรขmera e tornou-seย o exemplo mais completo do que se convencionou chamar de convergรชncia digital. // Osย processos digitais, associados aos avanรงos das tecnologias da informaรงรฃo e da comunicaรงรฃo e resultando emย internetย +ย *smartphones*, alteraram o estatuto da fotografiaย e do vรญdeo:ย juntos, permitiram o surgimento,ย por exemplo,ย do que conhecemos comoย *selfie*. Mania mundial dos dias de hoje, serve para dar visibilidadeย aย qualquer pessoa, celebridadeย ou nรฃo,ย a qualquer hora, sob qualquer pretexto,ย em todoย e qualquer tipo deย situaรงรฃo, desdeย um momento da vida รญntimaย atรฉ eventos sociais, polรญticos, religiosos e o que mais a imaginaรงรฃo for capaz de alcanรงar.ย Tudo isso sem precisar ser profissional da รกrea: fotรณgrafoย ouย cinegrafista. Qualquer pessoa hoje opera com tranquilidade cรขmeras -- basta ter umย *smartphoneย *na mรฃo.ย E nรฃo precisa nem mesmo de uma ideia na cabeรงa.[^12]ย Na visรฃo deย Aumont (2011, p. 113),ย "as perturbaรงรตes da produรงรฃo (e sobretudo da circulaรงรฃo) das imagens desde hรก vinte anos acarretaram evidentemente profundas mudanรงas na nossa relaรงรฃo mental e atรฉ sensorial com o visรญvel e o real". A fotografia substituiu o olhar.ย Fotografamos antes de olhar e atรฉ em vez de olhar. // Parece nรฃo ter fimย o que รฉ possรญvel fazer hoje com imagens, depois dosย avanรงos computacionais das รบltimas dรฉcadas. รreas tradicionais das ciรชncias, como biologia, quรญmica, astronomia, fazem uso e incitam o desenvolvimento de tรฉcnicas de visualizaรงรฃoย cientรญfica eย deย visualizaรงรฃo de informaรงรฃo,ย que sรฃoย sistemasย dedicadosย ร  geraรงรฃo de imagens que auxiliamย osย usuรกrios na compreensรฃo de dados e processosย porย meio de recursos grรกficos.ย Vivemos o momento de aplicaรงรฃo deย tรฉcnicas deย computaรงรฃo grรกfica interativas que permitem a anรกlise e a compreensรฃo de conjuntosย deย informaรงรตes.ย  // Nosso vocabulรกrio hoje seria incompreensรญvel mesmo para nรณs, hรก 30 anos. Falamos deย computaรงรฃo grรกficaย e deย sistemas de realidade virtual e imersรฃo sensorial,[^13]ย deย prototipagem rรกpida de componentes,[^14]ย deย veรญculos nรฃo tripulados, como *drones*,[^15]ย deย indรบstria 4.0,[^16]ย deย realidade aumentada,[^17]ย de internet das coisas.[^18] Frequentamos cavernasย digitais,[^19]ย ambientes de realidade virtual, equipados de projetores, sistemas computacionais, rastreadores de movimento, atuadores mecรขnicos, *videowall*,[^20]ย entre outros,ย queย permitemย a imersรฃo e a vivรชncia de experiรชncias, incluindo sensaรงรตes visuais, hรกpticas, auditivas e sensoriais das mais diversas,ย usando recursos para emulaรงรฃo de telepresenรงa. // Traduzindo, nossa relaรงรฃo com imagensย e tรฉcnicaย se ampliou exponencialmente. A contemporaneidadeย nos permite, por exemplo,ย estar fisicamente em um lugar, mas virtualmente em outro,ย graรงas aos recursos tecnolรณgicos que levam nossa imagem para todos os cantos do planeta e atรฉ para fora dele. Cada detalhe doย nossoย fรญgado --ย ouย coraรงรฃo --, bem comoย do espaรงo em que vivemos,ย pode serย perscrutado.ย Eย <NAME> jรก sabia disso hรกย quase 90 anos.ย  // > Caracterรญsticas estruturais, tecidos celulares, com os quais operam a tรฉcnica e a medicina, tudo isso tem mais afinidades originais com a cรขmara que a paisagemย impregnada de estados afetivos, ou o retrato que exprime a alma do seu modelo. Mas ao mesmo tempo a fotografia revela nesse material os aspectos fisionรดmicos, mundos de imagens habitando as coisas mais minรบsculas, suficientemente ocultas e significativas para encontrarem um refรบgio nos sonhos diurnos, e que agora, tornando-se grandes e formulรกveis, mostram que a diferenรงa entre tรฉcnica e magia รฉ uma variรกvel totalmente histรณrica. (BENJAMIN, 1985, p. 94-95)ย  // Adentramos o ciberespaรงo.[^21]ย E ele se mostrou tรฃo ilimitado quanto capaz de produzir o fenรดmeno da cibercultura. Estamos imersos neleย e em seu nome quase esquecemos como era viver num mundo apenas fรญsicoย e mergulhamos no mundo virtual.ย Apenas "quase", porqueย nenhuma das tรฉcnicas citadas atรฉ aqui eliminouย sua antecessora. O velho e o novo, em termos de comunicaรงรฃoย de massa, coexistiram e coexistem. // O fenรดmeno da convergรชncia, porรฉm,ย inaugurou um novo momento na histรณria da humanidadeย e foi tratado como "um casamento perfeito entre os computadores -- parceiros tambรฉm de outros casamentos -- e as telecomunicaรงรตes" (BRIGGS; BURKE, 2006, p. 266).ย  // Para concluir, รฉ importante refletir sobreย alguns aspectos da repercussรฃo da tรฉcnica sobre os atuais modos como nos relacionamos com as imagens, sobretudo as fotogrรกficas.ย  // Em seusย clรกssicosย ensaiosย "Pequena histรณria da fotografia",ย escrito em 1931,ย e "A obra de arte na era de sua reprodutibilidade tรฉcnica",ย escrito em 1936,ย <NAME>ย alerta para mudanรงas que ultrapassam a tecnologia e alteramย o olhar que dirigimos ร s imagens. No caso especรญfico da fotografia, o filรณsofoย percebeย que essa tรฉcnica รฉ representante de "uma tendรชncia apaixonada do homem contemporรขneo" de fazer as coisas se aproximarem "das massas" atรฉ o ponto de tornar-se "irresistรญvel a necessidade de possuir o objeto de tรฃo perto quanto possรญvel, na imagem, ou melhor, na sua reproduรงรฃo"ย (BENJAMIN, 1985, p. 101).ย  // ร‰ inegรกvel o fascรญnio que a imagem fotogrรกfica exerce sobreย nรณs na vida contemporรขnea,ย em que a modernidade se completa e se transforma na hipermodernidade:ย "modernizaรงรฃo desenfreada, feita de mercantilizaรงรฃo proliferativa, de desregulamentaรงรฃo econรดmica, de รญmpeto tรฉcnico-cientรญfico, cujos efeitos sรฃo tรฃo carregados de perigos quanto de promessas"ย (LIPOVETSKY; CHARLES, 2004, p. 53).ย No campo individual, a supervalorizaรงรฃo do bem-estar, da diversรฃo e da felicidade permanente revela um ideal de vida leve, hedonista, lรบdica -- valores prometidos pelo capitalismo de consumo cujo combustรญvel รฉ uma mistura de seduรงรฃo, frivolidade e renovaรงรฃo incessante dos modelos (LIPOVETSKY, 2016).ย  // Nesse contexto, a fotografia parece ser nรฃo sรณ a grande representante da modernidade, mas tambรฉm da hipermodernidade,ย quando jรก nos habituamos a verย os outrosย e sermos vistosย incessantemente,ย seduzidosย pelaย ideia deย superaรงรฃo da invisibilidade.ย ร‰ impressionante como as redes sociais estรฃo repletas deย *selfies*,ย nos mais variados cenรกrios da vida pรบblica e da vida privada, indistintamente, supervalorizando as experiรชnciasย de consumo,ย gastronรดmicas, de turismo, de entretenimento, de culto ao corpo, de momentos divertidos,ย felizes, mas tambรฉm trรกgicos e infelizes,ย tudo registrado sem a menor preocupaรงรฃo tรฉcnica, porque aย cรขmera jรก vem programada para ajustar velocidade,ย diafragma, obturador, ISO, regra dos terรงos, planos fotogrรกficos, lentes, distรขncia focal, profundidade de campo, estรฉtica, iluminaรงรฃo,ย *flash*ย etc.,ย de tal forma que o clique รฉ uma atividade corriqueira, lรบdica, "totalmente esvaziada de qualquer responsabilidadeย com a realidade" [@aumont2011 p. 114].ย  // Aย superaรงรฃo daย invisibilidade,ย porรฉm,ย nรฃo favorece o hiperindividualismoย e o hedonismoย apenas.ย Nestaย รฉpoca marcada por paradoxos entre exagero e moderaรงรฃo, material e imaterial, peso e leveza, prazer e dor, indivรญduo e coletividade (LIPOVETSKY, 2016),ย <NAME> tornou-se cรฉlebreย a partir da distribuiรงรฃo deย uma fotografia, reforรงada peloย descontentamento de artistas que nรฃo demoraram para estender o tempo de exposiรงรฃo de sua imagem trรกgica. Teria permanecido na obscuridade e nรฃo se tornaria sรญmbolo de uma crise humanitรกriaย de proporรงรตes mundiais,ย que atingiu, em 2016, o nรบmero mais altoย de deslocamentos humanosย jรก registrado,[^22]ย se nรฃo atribuรญssemos ร  imagem fotogrรกfica a relevรขncia que atribuรญmos, se nรฃo vivรชssemos em uma sociedadeย em rede cuja estrutura tecnolรณgica permite tambรฉm o exercรญcio de contrapoder por parte de grupos insatisfeitos com as autoridades constituรญdas.ย  // == Imagem fotogrรกficaย  // Para entender uma fotografia,ย รฉ preciso ter ciรชncia de que se estรก diante de um objetoย "que tem vida prรณpria no mundo" (SHORE, 2014, p. 26). Se o que se tem na mรฃo -- ou diante dos olhos -- รฉ uma cรณpia impressa cujo destino รฉ oย museu, o porta-retratos, oย รกlbum, o mural, a caixa de sapatos, entรฃo, ali estรก um objeto bidimensional, que tem bordas e รฉ estรกtico. Nesse caso, deve ser entendida como algo fรญsico.ย  // > A bidimensionalidade do papel fotogrรกfico estabelece o plano da fotografia. Suas bordas fixam os limites da imagem. A imobilidade da imagem determina a sensaรงรฃo do tempo na fotografia. Atรฉ a imagem de uma fotografia na tela de um computador รฉ plana, estรกticaย e delimitada. (SHORE, 2014, p. 16) // Ao fotografar, estrutura-se uma parte do mundo escolhendo ponto de observaรงรฃo, enquadramento, momento da exposiรงรฃo eย plano focal. Essas escolhas,ย comoย a bidimensionalidade, constituem os elementos fundamentais de uma fotografia em seu nรญvel descritivo. "Constituem a base de uma gramรกtica visual fotogrรกfica. Sรฃo eles os responsรกveis pelos 'erros' de um iniciante: fazer uma foto desfocada ou tremida, cortar cabeรงas, capturar um momento infeliz"ย (SHORE, 2014, p. 38). // Para alรฉm do nรญvel descritivo da fotografia, hรก um segundo nรญvel, que Shoreย (2014) chama de mental. Preferimos, porรฉm, trabalhar comย Barthes (1990) e adotar seu posicionamento de que todas as artes imitativasย -- e a fotografia -- comportam duas mensagens:ย a denotada e a conotada. Passamos, entรฃo, a tratar de dois nรญveis de expressรฃo da imagem fotogrรกfica, que nรฃo chamaremos de descritivo e mental, mas de mensagens denotada e conotada.ย  // A compreensรฃo da mensagem denotada da imagem fotogrรกfica exige apenas que aquele que a contempla seja capaz de enxergar. Essa mensagem nรฃo tem cรณdigo. ร‰, portanto, uma mensagem contรญnua, caracterรญstica do olhar, apenas.ย  // Mas para compreender a mensagem conotada da imagem fotogrรกfica, aquele que a olha vai precisar usar cรณdigosย linguรญsticos e sociais, porque esse segundo sentido imposto ร  imagem fotogrรกfica exige mais que olhos para ver. Exige saberes socioculturais. As reaรงรตes do indivรญduo diante de uma imagem fotogrรกfica sรฃo as conotaรงรตes que ele produz: o que fala sobre a imagem, sua surpresa, seu riso, sua indignaรงรฃo, sรฃo manifestaรงรตes da conotaรงรฃo.ย  // Vamos insistir nas ideias de Barthes (1990) porque esta anรกlise vai evocar seus conceitos.ย  // Qualย รฉ o conteรบdo da mensagem fotogrรกfica? Para responder a essa pergunta, Barthes (1990)ย trabalha com dois conceitos centrais: denotaรงรฃo e conotaรงรฃo. A fotografia, segundo o francรชs, sobretudo a jornalรญstica, comporta duas mensagens: uma denotada e uma conotada. A primeiraย รฉย o prรณprioย *analogon*, ou seja,ย รฉ a prรณpria imagem copiada de um real com o qual mantรฉm uma relaรงรฃo de perfeiรงรฃo -- aliรกs, uma perfeiรงรฃo analรณgica que define a fotografia e, no senso comum, confere a ela um regime de "verdade" (Figura 4).ย  // // ![][21]ย  // // []{#_Ref503519869 .anchor}**Figura 4 -- <NAME> em 2 de setembro de 2015** // // Fonte: \<http://zap.aeiou.pt/imagem-de-crianca-siria-morta-na-praia-torna-se-simbolo-drama-dos-refugiados-81071\>ย  // // ย  // Naย Figura 4, vรช-se uma crianรงaย deitada de bruรงos na beira do mar. Estรก molhada, vestida de azul e vermelho, calรงada com tรชnis e tem cabelos bem cortados.ย  // A segunda mensagemย รฉย a maneira como a sociedade ofereceย ร  leitura,ย em alguma medida, o que pensa. Ainda que se possa acreditar que a imagem fotogrรกfica deย Aylan Kurdi informa todo o // conteรบdoย da fotografiaย ร quele que a olha jรก que, com o real, mantรฉm uma relaรงรฃo de perfeiรงรฃo, plenitude e imediatismo -- portanto, portadora de uma objetividade inquestionรกvel --, essa imagem, de fato, contรฉm uma segunda mensagem,ย ao mesmo tempo, invisรญvel e ativa, clara e implรญcita, que nรฃo se deixa perceber de imediato, mal colocamos os olhos sobre ela. // Nasย "releituras" feitas pelos artistas que produziram as ilustraรงรตes, por exemplo,ย รฉ possรญvel perceber traรงos dessa segunda mensagem, da perspectiva de cada um (Figura 5). // // ![][23]ย  // // []{#_Ref503520168 .anchor}**Figura 5 -- Compartilhamento via redes sociais** // // Fonte: #kiyiyavuraninsanlikย  // Naย Figura 5, a segunda mensagem destaca a hiperconectividade dos internautas e sua compulsรฃo pelo compartilhamentoย insensรญvelย de qualquer imagem veiculada pelas redes sociais digitais. Embora oย *smartphone*ย ali representado esteja com a bateria quase que descarregada, os 5% de carga que restam nรฃo serรฃo reservados para uma emergรชncia, mas para incrementar oย *Trendingย Topic*[^23]ย do Twitter. Esse comportamentoย รฉ bem descrito porย Sontag,ย em ensaio publicado originalmente em 1977, aqui referenciado em ediรงรฃo brasileira de 2004:ย  // ย  // > Sofrerย รฉ uma coisa; outra รฉ viver com imagens fotogrรกficas do sofrimento, oย que nรฃoย reforรงaย necessariamente a consciรชncia e a capacidade de ser compassivo. Tambรฉm pode corrompรช-las. Depois de ver tais imagens, a pessoa tem aberto a sua frente o caminho para ver maisย -- e cada vez mais. As imagens paralisam. As imagens anestesiam. Um evento conhecido por meio de fotos certamente se torna mais real do que seria se a pessoa jamais tivesse visto as fotos \[\...\]. Mas, apรณs uma repetida exposiรงรฃo a imagens, o evento tambรฉm se torna menos real. (SONTAG, 2004, p. 30-31)ย  // Essa segunda mensagemย รฉ o que Barthesย (1990) chamou de conotaรงรฃo, ou seja, um segundo sentido imposto ร  mensagem fotogrรกfica, que se caracteriza por ser histรณrico e cultural.ย  // Por que esse segundo sentidoย รฉ histรณrico e cultural? Porque sua apreensรฃo depende do contexto socialย a partir do qual olhamos uma imagem eย "lemos"*ย *sua mensagem conotada. A leitura da fotografia depende sempre das referรชncias que o leitor tem. Nem todo mundo vai olhar para uma mesma fotografia jornalรญstica e ser capaz de perceber a mensagem conotada que ela contรฉm, porque isso exige um conjunto de saberes e valores que nem sempre sรฃo comuns a todos os grupos sociais. O que desperta o riso, a lรกgrima, a surpresa, a desconfianรงa, a seguranรงa varia de um tempo a outro, de uma sociedade a outra -- ร  exceรงรฃo de exigรชncias antropolรณgicas que transcendem grupos e alcanรงam a humanidade.ย  // Talvez esse seja o caso da foto representada pelaย Figura 4. A vida e a morte, e mais ainda a morte, de uma crianรงa que sequer conheceu a paz nos seus 3 anos de vidaย sรฃo temas do รขmbito das grandes questรตes antropolรณgicas comuns a muitos gruposย sociais. // Compreender o queย รฉ uma mensagem denotada e o que a diferencia de uma imagem conotadaย รฉ, para efeito desta pesquisa, fundamental. Desconfiar da vastidรฃo da conotaรงรฃo da segunda mensagem fotogrรกfica e de seu carรกter histรณrico e cultural,ย mais ainda. Veremos que uma possรญvel resposta ao questionamento que fizemos a respeito do alcance da fotografia de Demir, em face de outras tantas fotografias sobre o mesmo tema, vai depender do domรญnio desses conceitos.
https://github.com/sysu/better-thesis
https://raw.githubusercontent.com/sysu/better-thesis/main/utils/double-underline.typ
typst
MIT License
// ๅŒไธ‹ๅˆ’็บฟ #let double-underline(body) = style(styles => { let size = measure(body, styles) stack( body, v(3pt), line(length: size.width), v(2pt), line(length: size.width), ) })
https://github.com/rabotaem-incorporated/calculus-notes-2course
https://raw.githubusercontent.com/rabotaem-incorporated/calculus-notes-2course/master/sections/05-complex-functions/!sec.typ
typst
#import "../../config.typ" #import "../../utils/core.typ": * = ะขะตะพั€ะธั ั„ัƒะฝะบั†ะธะน ะบะพะผะฟะปะตะบัะฝะพะน ะฟะตั€ะตะผะตะฝะฝะพะน #if config.sem3 { include "01-holomorphic-functions.typ" include "02-uniqueness.typ" include "03-analytical-continuation.typ" } #if config.sem4 { include "04-logarithm.typ" include "05-laurent-series.typ" include "06-residues.typ" include "07-conformal-maps.typ" include "08-generating-functions.typ" }
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/04-opentype/deltas-1.typ
typst
Other
#import "/lib/draw.typ": * #let start = (0, 100) #let end = (1000, 1000) #let rect-point-size = 80 #let rect-point-color = green.darken(20%) #let line-color = green.darken(20%) #let line-size = 30 #let arrow-color = red.darken(15%) #let arrow-line-size = 15 #let arrow-head-scale = 1.5 #let main-txt-size = 64 #let small-txt-size = 32 #let marker-point-size = 10 #let p1 = (150, 900) #let p2 = (600, 900) #let p3 = (600, 650) #let p4 = (150, 650) #let p5 = (500, 200) #let ps = (p1, p2, p3, p4, p5) #let graph = with-unit((ux, uy) => { let rect-point = it => segment( (it.at(0) - rect-point-size / 2, it.at(1)), (it.at(0) + rect-point-size / 2, it.at(1)), stroke: rect-point-size * ux + rect-point-color, ) for p in ps { rect-point(p) } for (s, e) in ps.zip(ps.slice(1)) { segment(s, e, stroke: line-size * ux + line-color) } let arrow-relative = ( (-60, 10), (100, 10), (150, -200), (300, -200), (180, 15), ) for (s, r) in ps.zip(arrow-relative) { arrow(s, r, relative: true, stroke: arrow-line-size * ux + arrow-color, head-scale: arrow-head-scale) } let ptxt = p2.zip(arrow-relative.at(1)).map(((a, b)) => a + b) txt([็ฒ—ไฝ“่ฏท#linebreak()ๆฒฟๆญค็งปๅŠจ], ptxt, anchor: "lc", size: main-txt-size * ux,) let half = p3.zip(arrow-relative.at(2)).map(((a, b)) => a + b * 0.5) point(half, radius: marker-point-size) txt([50%็ฒ—ไฝ“], half, anchor: "lc", size: small-txt-size * ux, dx: 30) let full = p3.zip(arrow-relative.at(2)).map(((a, b)) => a + b) point(full, radius: marker-point-size) txt([100%็ฒ—ไฝ“], full, anchor: "lc", size: small-txt-size * ux, dx: 30) }) #canvas( end, start: start, width: 40%, graph, )
https://github.com/cs-24-sw-3-01/typst-documents
https://raw.githubusercontent.com/cs-24-sw-3-01/typst-documents/main/report/chapters/introduction.typ
typst
#import "../custom.typ": * = Introduction The project is being carried out in collaboration with KMD, a company located in Aalborg that develops IT solutions to meet the evolving digital needs of modern societies. The process of finding a collaborative company began by searching through the company guidebook โ€œPeilingโ€, which was delivered by attending a student job fair. After finding a few interesting companies, emails were sent to arrange meetings. During the initial meeting with KMD, they expressed significant interest in the collaboration and want to provide as many resources as possible, such as providing interview participants and access to a hosting server. However, a restraint given is that it must cost 0 DKK. Their enthusiasm gave motivation and a desire to collaborate with them. The aim of this project is to develop a functional application that prioritizes user experience and meets the clientโ€™s needs. The primary requirement for this system is to develop a vacation planner to track non-working days for the companyโ€™s employees. KMD already has a vacation planner, but since it is outdated, they want to replace it with an improved version. == Current System at KMD: KMDFerieplan KMDFerieplan is a web-based application used by KMD for tracking employee vacation and absences. It is built on a Microsoft backend and connects with SAP SuccessFactors for managing vacation codes. The system allows employees to manually enter vacation requests by selecting specific dates and times. Team organization is a core aspect of the vacation planner. Each employee within a team is assigned a unique color to distinguish individual vacation periods in the calendar layout. This has provided an overview of team availability that helped leaders plan projects and manage resources cross departments. #todo[Vi bรธr tilfรธje screenshots at det nuvรฆrende system og skrive mere om det. - Marc (Asger note)] == What SAP Is and Its Use at KMD #todo[Vi skal have skrevet en sektion omkring rollefordelingen mellem SAP og KMD, a.k.a. en detaljeret beskrivelse af SAP og hvordan det bruges. - Marc (Asger note)] == KMD Pre-Meeting Insights: Current System Challenges Valuable context for understanding KMDFerieplanโ€™s limitations for solution planning was provided during the initial meeting with KMD representatives Dion and Mats. It was noted that KMDFerieplan was developed over a decade ago, and that while it initially included functionalities such as automatic synchronization with the earlier SAP version, this integration was lost after KMD upgraded to SAP S/4HANA. Dion also emphasized the systemโ€™s challenges, describing its design and interface as outdated and not user-friendly. They emphasized the need for a solution that tackles these issues by providing a more intuitive user experience and that it is compatible with KMDโ€™s newer SAP environment. == Holiday Rules #todo(position: right)[Det kan mรฅske virke som almen viden, men jeg synes at der skal vรฆre et afsnit om ferieregler generelt, og hvordan KMD tolker dem. - Asger]
https://github.com/nicolasfara/Curriculum-Vitae
https://raw.githubusercontent.com/nicolasfara/Curriculum-Vitae/master/nicolasfarabegoli-cv-eng.typ
typst
Apache License 2.0
// CV structure #import "common.typ": * #import "data-it.typ": * #set page(numbering: "1 of 1") #set text(font: "Open Sans", size: 0.85em) #set par(leading: line-spacing) #show-header("<NAME>", contact-entries, "none") #entries-section("Current Position", current-position-entries) #entries-section("Education", education-entries) #entries-section("Publications", pubblications) #entries-section("Professional Experiences", work-experience-entries) // Skills and languages #pill-section("Skills", programming-languages) // #pill-section("Languages", languages) #entries-section("Extra Curricular Activities", extra-curricular-activities-entries) #entries-section("Project Contributions", projects-contributions-entries)
https://github.com/0x1B05/algorithm-journey
https://raw.githubusercontent.com/0x1B05/algorithm-journey/main/practice/note/content/้“พ่กจ.typ
typst
#import "../template.typ": * #pagebreak() = ๆœ‰ๅบ่กจใ€ๅ“ˆๅธŒ่กจๅ’Œ้“พ่กจ == ๅ“ˆๅธŒ่กจ็ฎ€ๅ•ไป‹็ป 1. ๅ“ˆๅธŒ่กจๅœจไฝฟ็”จๅฑ‚้ขไธŠๅฏไปฅ็†่งฃไธบไธ€็ง้›†ๅˆ็ป“ๆž„ 2. ๅฆ‚ๆžœๅชๆœ‰ key,ๆฒกๆœ‰ไผด้šๆ•ฐๆฎ value,ๅฏไปฅไฝฟ็”จ HashSet ็ป“ๆž„(C++ไธญๅซ UnOrderedSet) 3. ๅฆ‚ๆžœๆ—ขๆœ‰ key,ๅˆๆœ‰ไผด้šๆ•ฐๆฎ value,ๅฏไปฅไฝฟ็”จ HashMap ็ป“ๆž„(C++ไธญๅซ UnOrderedMap) 4. ๆœ‰ๆ— ไผด้šๆ•ฐๆฎ,ๆ˜ฏ HashMap ๅ’Œ HashSet ๅ”ฏไธ€็š„ๅŒบๅˆซ,ๅบ•ๅฑ‚็š„ๅฎž้™…็ป“ๆž„ๆ˜ฏไธ€ๅ›žไบ‹ 5. ไฝฟ็”จๅ“ˆๅธŒ่กจๅขž(put)ใ€ๅˆ (remove)ใ€ๆ”น(put)ๅ’ŒๆŸฅ(get)็š„ๆ“ไฝœ,ๅฏไปฅ่ฎคไธบๆ—ถ้—ดๅคๆ‚ๅบฆไธบ 0(1),ไฝ†ๆ˜ฏๅธธๆ•ฐๆ—ถ้—ดๆฏ”่พƒๅคง 6. ๆ”พๅ…ฅๅ“ˆๅธŒ่กจ็š„ไธœ่ฅฟ,ๅฆ‚ๆžœๆ˜ฏๅŸบ็ก€็ฑปๅž‹,ๅ†…้ƒจๆŒ‰ๅ€ผไผ ้€’,ๅ†…ๅญ˜ๅ ็”จๅฐฑๆ˜ฏ่ฟ™ไธชไธœ่ฅฟ็š„ๅคงๅฐ 7. ๆ”พๅ…ฅๅ“ˆๅธŒ่กจ็š„ไธœ่ฅฟ,ๅฆ‚ๆžœไธๆ˜ฏๅŸบ็ก€็ฑปๅž‹,ๅ†…้ƒจๆŒ‰ๅผ•็”จไผ ้€’,ๅ†…ๅญ˜ๅ ็”จๆ˜ฏ่ฟ™ไธชไธœ่ฅฟๅ†…ๅญ˜ๅœฐๅ€็š„ๅคงๅฐ == ๆœ‰ๅบ่กจ === ๆœ‰ๅบ่กจ็š„็ฎ€ๅ•ไป‹็ป 1. ๆœ‰ๅบ่กจๅœจไฝฟ็”จๅฑ‚้ขไธŠๅฏไปฅ็†่งฃไธบไธ€็ง้›†ๅˆ็ป“ๆž„ 2. ๅฆ‚ๆžœๅชๆœ‰ key,ๆฒกๆœ‰ไผด้šๆ•ฐๆฎ value,ๅฏไปฅไฝฟ็”จ TreeSet ็ป“ๆž„(C++ไธญๅซ OrderedSet) 3. ๅฆ‚ๆžœๆ—ขๆœ‰ key,ๅˆๆœ‰ไผด้šๆ•ฐๆฎ value,ๅฏไปฅไฝฟ็”จ TreeMap ็ป“ๆž„(C++ไธญๅซ OrderedMap) 4. ๆœ‰ๆ— ไผด้šๆ•ฐๆฎ,ๆ˜ฏ TreeSet ๅ’Œ TreeMap ๅ”ฏไธ€็š„ๅŒบๅˆซ,ๅบ•ๅฑ‚็š„ๅฎž้™…็ป“ๆž„ๆ˜ฏไธ€ๅ›žไบ‹ 5. ๆœ‰ๅบ่กจๅ’Œๅ“ˆๅธŒ่กจ็š„ๅŒบๅˆซๆ˜ฏ,ๆœ‰ๅบ่กจๆŠŠ key ๆŒ‰็…ง้กบๅบ็ป„็ป‡่ตทๆฅ,่€Œๅ“ˆๅธŒ่กจๅฎŒๅ…จไธ็ป„็ป‡ 6. ็บข้ป‘ๆ ‘ใ€AVL ๆ ‘ใ€size-balance-tree ๅ’Œ่ทณ่กจ็ญ‰้ƒฝๅฑžไบŽๆœ‰ๅบ่กจ็ป“ๆž„,ๅชๆ˜ฏๅบ•ๅฑ‚ๅ…ทไฝ“ๅฎž็ŽฐไธๅŒ 7. ๆ”พๅ…ฅๆœ‰ๅบ่กจ็š„ไธœ่ฅฟ,ๅฆ‚ๆžœๆ˜ฏๅŸบ็ก€็ฑปๅž‹,ๅ†…้ƒจๆŒ‰ๅ€ผไผ ้€’,ๅ†…ๅญ˜ๅ ็”จๅฐฑๆ˜ฏ่ฟ™ไธชไธœ่ฅฟ็š„ๅคงๅฐ 8. ๆ”พๅ…ฅๆœ‰ๅบ่กจ็š„ไธœ่ฅฟ,ๅฆ‚ๆžœไธๆ˜ฏๅŸบ็ก€็ฑปๅž‹,ๅฟ…้กปๆไพ›ๆฏ”่พƒๅ™จ,ๅ†…้ƒจๆŒ‰ๅผ•็”จไผ ้€’,ๅ†…ๅญ˜ๅ ็”จๆ˜ฏ่ฟ™ไธชไธœ่ฅฟๅ†…ๅญ˜ๅœฐๅ€็š„ๅคงๅฐ === ๆœ‰ๅบ่กจ็š„ๅ›บๅฎšๆ“ไฝœ 1. `void put(key,value)`: ๅฐ†ไธ€ไธช`(key,value)`่ฎฐๅฝ•ๅŠ ๅ…ฅๅˆฐ่กจไธญ,ๆˆ–่€…ๅฐ† key ็š„่ฎฐๅฝ•ๆ›ดๆ–ฐๆˆ valueใ€‚ 2. `get(key)`: ๆ นๆฎ็ป™ๅฎš็š„ key,ๆŸฅ่ฏข value ๅนถ่ฟ”ๅ›žใ€‚ 3. `void remove(key)`: ็งป้™ค key ็š„่ฎฐๅฝ•ใ€‚ 4. `boolean containsKey(key)`: ่ฏข้—ฎๆ˜ฏๅฆๆœ‰ๅ…ณไบŽ key ็š„่ฎฐๅฝ•ใ€‚ 5. `firstKey()`: ่ฟ”ๅ›žๆ‰€ๆœ‰้”ฎๅ€ผ็š„ๆŽ’ๅบ็ป“ๆžœไธญ,ๆœ€ๅทฆ(ๆœ€ๅฐ)็š„้‚ฃไธชใ€‚ 6. `lastKey()`: ่ฟ”ๅ›žๆ‰€ๆœ‰้”ฎๅ€ผ็š„ๆŽ’ๅบ็ป“ๆžœไธญ,ๆœ€ๅณ(ๆœ€ๅคง)็š„้‚ฃไธชใ€‚ 7. `floorKey(key)`: ๅฆ‚ๆžœ่กจไธญๅญ˜ๅ…ฅ่ฟ‡ key,่ฟ”ๅ›ž key; ๅฆๅˆ™่ฟ”ๅ›žๆ‰€ๆœ‰้”ฎๅ€ผ็š„ๆŽ’ๅบ็ป“ๆžœไธญ,key ็š„ๅ‰ไธ€ไธชใ€‚ 8. `ceilingKey(key)`: ๅฆ‚ๆžœ่กจไธญๅญ˜ๅ…ฅ่ฟ‡ key,่ฟ”ๅ›ž key; ๅฆๅˆ™่ฟ”ๅ›žๆ‰€ๆœ‰้”ฎๅ€ผ็š„ๆŽ’ๅบ็ป“ๆžœไธญ,key ็š„ๅŽไธ€ไธชใ€‚ ไปฅไธŠๆ‰€ๆœ‰ๆ“ไฝœๆ—ถ้—ดๅคๆ‚ๅบฆ้ƒฝๆ˜ฏ`0(logN)`,N ไธบๆœ‰ๅบ่กจๅซๆœ‰็š„่ฎฐๅฝ•ๆ•ฐ == ้“พ่กจ === ่Š‚็‚น็ป“ๆž„ ==== ๅ•้“พ่กจ็š„่Š‚็‚น็ป“ๆž„ ```java class Node { public int value; public Node next; public Node(int v) { value = v; } } ``` ็”ฑไปฅไธŠ็ป“ๆž„็š„่Š‚็‚นไพๆฌก่ฟžๆŽฅ่ตทๆฅๆ‰€ๅฝขๆˆ็š„้“พๅซๅ•้“พ่กจ็ป“ๆž„ใ€‚ ==== ๅŒ้“พ่กจ็š„่Š‚็‚น็ป“ๆž„ ```java class DoubleNode { int value; DoubleNode pre; DoubleNode next; public DoubleNode(int value) { this.value = value; } } ``` ็”ฑไปฅไธŠ็ป“ๆž„็š„่Š‚็‚นไพๆฌก่ฟžๆŽฅ่ตทๆฅๆ‰€ๅฝขๆˆ็š„้“พๅซๅŒ้“พ่กจ็ป“ๆž„ใ€‚ ๅ•้“พ่กจๅ’ŒๅŒ้“พ่กจ็ป“ๆž„ๅช้œ€่ฆ็ป™ๅฎšไธ€ไธชๅคด้ƒจ่Š‚็‚น head,ๅฐฑๅฏไปฅๆ‰พๅˆฐๅ‰ฉไธ‹็š„ๆ‰€ๆœ‰็š„่Š‚็‚นใ€‚ === ้ข˜็›ฎ ==== ๅ่ฝฌๅ•ๅ‘ๅ’ŒๅŒๅ‘้“พ่กจ ้ข˜็›ฎ: ๅˆ†ๅˆซๅฎž็Žฐๅ่ฝฌๅ•ๅ‘้“พ่กจๅ’Œๅ่ฝฌๅŒๅ‘้“พ่กจ็š„ๅ‡ฝๆ•ฐ ่ฆๆฑ‚: ๅฆ‚ๆžœ้“พ่กจ้•ฟๅบฆไธบ N,ๆ—ถ้—ดๅคๆ‚ๅบฆ่ฆๆฑ‚ไธบ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(1) ===== ๅ่ฝฌๅ•้“พ่กจ - ่ฟญไปฃๅฎž็Žฐ ```java class ReverseLinkedList { class Node { int value; Node next; public void setVal(int value) { this.value = value; } } public Node reverseLinkedList(Node head) { if (head == null) return head; //preไธ€็›ดไปฃ่กจ้ๅކๅˆฐ่ฆๅ่ฝฌ่Š‚็‚น็š„ๅ‰้ฉฑ่Š‚็‚น //nextไธ€็›ดไปฃ่กจ้ๅކๅˆฐ่ฆๅ่ฝฌ่Š‚็‚น็š„ๅŽ็ปง่Š‚็‚น Node current = head; Node pre = null; Node next = current.next; while (current != null) { //ๅ…ˆ็”จnextไฟๅญ˜head็š„ไธ‹ไธ€ไธช่Š‚็‚น็š„ไฟกๆฏ //ไฟ่ฏๅ•้“พ่กจไธไผšๅ› ไธบๅ่ฝฌhead่Š‚็‚น็š„ๅŽŸnext่Š‚็‚น่€Œๅฐฑๆญคๆ–ญ่ฃ‚ next = current.next; //ๅ่ฝฌ,head็š„ๅŽ็ปงๅ˜ๆˆๅ‘ๅ‰ๆŒ‡,ๆŒ‡ๅ‘head็š„nextๅ‰้ฉฑ current.next = pre; //่Š‚็‚น็š„ๅ‰้ฉฑๅ’Œ่Š‚็‚น้ƒฝๅŽ็งป,็ปง็ปญ้ๅކ pre = current; current = next; } //ๅฆ‚ๆžœheadไธบnull็š„ๆ—ถๅ€™,preๅฐฑไธบๆœ€ๅŽไธ€ไธช่Š‚็‚นไบ†,ๅฐฑๆญค้“พ่กจๅทฒ็ปๅ่ฝฌๅฎŒๆฏ•,preๅฐฑๆ˜ฏๅ่ฝฌๅŽ้“พ่กจ็š„็ฌฌไธ€ไธช่Š‚็‚น head = pre; return head; } } ``` - ๅฐพ้€’ๅฝ’ๅฎž็Žฐ ๅฐพ้€’ๅฝ’็š„ๅซไน‰ๆ˜ฏ,ไธ€ไธชๆ–นๆณ•ๆˆ–ๅ‡ฝๆ•ฐไธญๆ‰€ๆœ‰้€’ๅฝ’ๅฝขๅผ็š„่ฐƒ็”จ้ƒฝๅ‡บ็Žฐๅœจๆ–นๆณ•ๆˆ–ๅ‡ฝๆ•ฐ็š„ๆœซๅฐพ,ๅˆ™่ฟ™ไธช้€’ๅฝ’ๆ–นๆณ•ๆˆ–ๅ‡ฝๆ•ฐๆ˜ฏๅฐพ้€’ๅฝ’็š„ใ€‚ๅฝ“้€’ๅฝ’่ฐƒ็”จๆ˜ฏๆ•ดไธชๆ–นๆณ•ๆˆ–ๅ‡ฝๆ•ฐไฝ“ไธญๆœ€ๅŽๆ‰ง่กŒ็š„่ฏญๅฅ,ไธ”่ฟ”ๅ›žๅ€ผไธๅฑžไบŽ่กจ่พพๅผ็š„ไธ€้ƒจๅˆ†ๆ—ถ,้€’ๅฝ’่ฐƒ็”จๅฐฑๆ˜ฏๅฐพ้€’ๅฝ’ใ€‚ๅฐพ้€’ๅฝ’็š„็‰น็‚นๆ˜ฏๅœจๅ›žๅฝ’่ฟ‡็จ‹ไธญไธ็”จๅšไปปไฝ•ๆ“ไฝœ,ๅฝ“็ผ–่ฏ‘ๅ™จๆฃ€ๆต‹ๅˆฐๅฐพ้€’ๅฝ’ๆ—ถ,ไผš่ฆ†็›–ๅฝ“ๅ‰็š„ๆ ˆๅธง่€Œไธๆ˜ฏๆ–ฐๅปบไธ€ไธชๆ ˆๅธง,ไปŽ่€Œไผ˜ๅŒ–ๆ ˆ็ฉบ้—ดใ€‚ ```java public static Node reverseList(Node head) { return reverseListTail(null, head); } public static Node reverseListTail(Node pre, Node cur) { if (cur == null) { return pre; } Node next = cur.next; cur.next = pre; return reverseListTail(cur, next); } ``` - ้™„ๆ™ฎ้€š้€’ๅฝ’(็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(N)): ```java public static Node recursionReverseLinkedList(Node head) { if (head.next == null){ return head; } Node newHead = recursionReverseLinkedList(head.next); Node pre = head; head.next.next = pre; pre.next = null; return newHead; } ``` ===== ๅ่ฝฌๅŒ้“พ่กจ ```java public class ReverseDoubleLinkedList { public static class DoubleNode { int val; DoubleNode pre; DoubleNode next; public DoubleNode(int value) { this.val = value; } } public static DoubleNode reverseDoubleLinkedList(DoubleNode head) { if (head == null) { return null; } DoubleNode next = null; // pre็š„ไฝœ็”จไป…ไป…ๆ˜ฏ่ฎฐๅฝ•head็š„ไธŠไธ€ไธช่Š‚็‚น DoubleNode pre = null; while (head != null) { // ๅ…ˆ็”จnextไฟๆŒๅŽ็ปง่Š‚็‚น,็„ถๅŽไบคๆขๅ‰ๅŽ่Š‚็‚น next = head.next; head.next = head.pre; head.pre = next; // ่ฎฐๅฝ•pre pre = head; // headๆŒ‡ๅ‘nextไฟๅญ˜็š„ๅŽŸ่Š‚็‚น็š„ๅŽ็ปง่Š‚็‚น,ๅณๅ‘ๅŽๆŽจ่ฟ›ไธ€ไธช่Š‚็‚น head = next; } head = pre; return head; } } ``` ==== ๆ‰“ๅฐไธคไธชๆœ‰ๅบ้“พ่กจ็š„ๅ…ฌๅ…ฑ้ƒจๅˆ† ้ข˜็›ฎ: ็ป™ๅฎšไธคไธชๆœ‰ๅบ้“พ่กจ็š„ๅคดๆŒ‡้’ˆ head1 ๅ’Œ head2,ๆ‰“ๅฐไธคไธช้“พ่กจ็š„ๅ…ฌๅ…ฑ้ƒจๅˆ† ่ฆๆฑ‚: ๅฆ‚ๆžœไธคไธช้“พ่กจ็š„้•ฟๅบฆไน‹ๅ’Œไธบ N,ๆ—ถ้—ดๅคๆ‚ๅบฆ่ฆๆฑ‚ไธบ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(1) ```java public class PrintCommonPart { public static class Node { public int value; public Node next; public Node(int v) { value = v; } } public static void printCommonPart(Node head1, Node head2) { Node p1 = head1; Node p2 = head2; while (p1.value != p2.value) { if (p1.value < p2.value) { p1 = p1.next; } else { p2 = p2.next; } } while (p1.value == p2.value || (p1 == null && p2 == null)) { System.out.println(p1.value); p1 = p1.next; p2 = p2.next; } } } ``` ==== ๅˆคๆ–ญไธ€ไธช้“พ่กจๆ˜ฏๅฆๆ˜ฏๅ›žๆ–‡็ป“ๆž„ ้ข˜็›ฎ: ็ป™ๅฎšไธ€ไธชๅ•้“พ่กจ็š„ๅคด็ป“็‚น head,่ฏทๅˆคๆ–ญ่ฏฅ้“พ่กจๆ˜ฏๅฆไธบๅ›žๆ–‡็ป“ๆž„ ไพ‹ๅญ: 1->2->1,่ฟ”ๅ›ž true; 1->2->2->1,่ฟ”ๅ›ž true; 15->6->15,่ฟ”ๅ›ž true; 1->2->3,่ฟ”ๅ›ž false; ่ฆๆฑ‚: ๅฆ‚ๆžœ้“พ่กจ้•ฟๅบฆไธบ N,ๆ—ถ้—ดๅคๆ‚ๅบฆ่ฆๆฑ‚ไธบ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(1) ```java public class IsPalindrome { // ๅ•้“พ่กจ็ป“ๆž„ public static class Node { public int value; public Node next; public Node(int value) { this.value = value; } } // ๆ–นๆณ•1: ็”จๆ ˆ็ป“ๆž„ๅญ˜ๅ‚จๆ•ดไธช้“พ่กจๅ…ƒ็ด ,ๅ†ไพๆฌกๅผนๅ‡บๅนถไธŽ้“พ่กจไปŽๅคดๅผ€ๅง‹ๆฏ”่พƒ,็ฉบ้—ดๅคๆ‚ๅบฆ: O๏ผˆn) public static boolean isPalindrome1(Node head) { if (head == null || head.next == null) { return true; } // ็”ณ่ฏทไธ€ไธชๆ ˆ Stack<Node> stack = new Stack<Node>(); Node cur = head; // ๅฐ†ๅ•้“พ่กจๅ…ƒ็ด ๆŒ‰้กบๅบๅ…ฅๆ ˆ while (cur != null) { stack.push(cur); cur = cur.next; } // ไธๆ–ญๅผนๅ‡บๆ ˆ้กถๅ…ƒ็ด ,ๅนถๅ’Œๅ•้“พ่กจไปŽๅคดๅผ€ๅง‹ๆฏ”่พƒ,ไธ็›ธ็ญ‰ๅฐฑ่ฟ”ๅ›žfalse while (head != null) { if (head.value != stack.pop().value) { return false; } head = head.next; } return true; } // ๆ–นๆณ•2: ็”จๆ ˆๅชๅญ˜ๅ‚จ้“พ่กจไธ€ๅŠ็š„ๅ…ƒ็ด ๏ผˆไธญ้—ดไฝ็ฝฎๅˆฐๆœ€ๅŽ๏ผ‰,ๆœ€ๅŽไพๆฌกๅผนๅ‡บๅนถไธŽ้“พ่กจ็š„ๅ‰ๅŠ้ƒจๅˆ†ๆฏ”่พƒ // ็ฉบ้—ดๅคๆ‚ๅบฆ: O๏ผˆn/2๏ผ‰ public static boolean isPalindrome2(Node head) { if (head == null || head.next == null) { return true; } // ็”จๅฟซๆ…ขๆŒ‡้’ˆๆฅ็กฎๅฎšไธญ้—ดไฝ็ฝฎ // ๅฟซๆŒ‡้’ˆไธ€ๆฌก่ตฐไธคๆญฅ,ๆ…ขๆŒ‡้’ˆไธ€ๆฌก่ตฐไธ€ๆญฅ // ๅฟซๆŒ‡้’ˆ่ตฐๅฎŒๆ—ถ,ๆ…ขๆŒ‡้’ˆๅˆšๅฅฝๆฅๅˆฐๅณ้ƒจๅˆ†็ฌฌไธ€ไธช่Š‚็‚นไธŠ Node slow = head.next;// ๆ…ขๆŒ‡้’ˆ,่‹ฅๅ…ƒ็ด ไธชๆ•ฐไธบๅถๆ•ฐๆ—ถ,ๆœ€ๅŽๆŒ‡ๅ‘ไธญ้—ดไฝ็ฝฎ็š„ๅŽไธ€ไธชไฝ็ฝฎ Node quick = head;// ๅฟซๆŒ‡้’ˆ while (quick.next != null && quick.next.next != null) { slow = slow.next; quick = quick.next.next; } // ๆŠŠไปŽๆ…ขๆŒ‡้’ˆๅณไธญ้—ดไฝ็ฝฎๅผ€ๅง‹็š„ๅณ้ƒจๅˆ†ๅ…ƒ็ด ๆ”พ่ฟ›ๆ ˆไธญ Stack<Node> stack = new Stack<Node>(); while (slow != null) { stack.push(slow); slow = slow.next; } // ไธๆ–ญๅผนๅ‡บๆ ˆ้กถๅ…ƒ็ด ,ๅนถไปŽๅคดๅ’Œๅ•้“พ่กจๅ…ƒ็ด ๆฏ”่พƒ,ไธ็›ธ็ญ‰ๅฐฑ่ฟ”ๅ›žfalse while (!stack.isEmpty()) { if (head.value != stack.pop().value) { return false; } head = head.next; } return true; } // ๆ–นๆณ•3: ๅฐ†้“พ่กจๅฏนๆŠ˜,ๅŽๅŠ้ƒจๅˆ†็š„้“พ่กจๅ่ฝฌไธŽๅ‰ๅŠ้ƒจๅˆ†้“พ่กจ่ฟ›่กŒๆฏ”่พƒ public boolean isPalindromList3(Node head) { if (head == null || head.next == null) { return true; } Node slow = head.next; Node quick = head; // ๅ…ƒ็ด ๆ€ปไธชๆ•ฐไธบๅฅ‡ๆ•ฐๆ—ถ,ๆ…ขๆŒ‡้’ˆๆœ€ๅŽๆŒ‡ๅ‘ไธญ้—ดไฝ็ฝฎ,่‹ฅไธบๅถๆ•ฐ,ๅˆ™่ตฐๅˆฐไธญ้—ดไฝ็ฝฎ็š„ๅ‰ไธ€ไฝ // ๆณจๆ„: ๅœจๅ‘ๅŽ้ๅކ็š„ๆ—ถๅ€™,้œ€่ฆๅˆคๆ–ญๅฟซๆŒ‡้’ˆๆŒ‡ๅ‘็š„่Š‚็‚นๆ˜ฏๅฆไธบ็ฉบ,ไธ็„ถไผšๅ‡บ็Žฐๅผ‚ๅธธ // ่‹ฅquick.next != null,้‚ฃไนˆ่ฏดๆ˜Ž่ฟ™ๆ˜ฏๅถๆ•ฐไธช,quick.next.next != null,่ฏดๆ˜Žๆ˜ฏๅฅ‡ๆ•ฐไธช while (quick.next != null && quick.next.next != null) { quick = quick.next.next; slow = slow.next; } // slowๆฅ็š„ไธญ็‚นไฝ็ฝฎ,ๅ่ฝฌๅŽๅŠ้ƒจๅˆ†,ๅ่ฝฌๅŽไธญ็‚นๆŒ‡ๅ‘null Node head2 = reverseSingleList(slow); Node p1 = head; Node p2 = head2; // ๅฐ†ๅ‰ๅŠ้ƒจๅˆ†ๅ’ŒๅŽๅŠ้ƒจๅˆ†่ฟ›่กŒๅฏนๆฏ” // ๅ‰ๅŠ้ƒจๅˆ†ไปŽcurๅณheadๅผ€ๅง‹,ๅŽๅŠ้ƒจๅˆ†ไปŽquickๅณendๅผ€ๅง‹ while (p1 != null && p2 != null) { if (p1.value != p2.value) { return false; } p1 = p1.next; p2 = p2.next; } // ไธ่ƒฝๆ”นๅ˜ๅŽŸๆœ‰็š„ๆ•ฐๆฎ็ป“ๆž„,ๆ‰€ไปฅ่ฟ˜่ฆๆŠŠๅŽๅŠ้ƒจๅˆ†ๅ่ฝฌๅ›žๅŽป // ้ๅކๅฎŒcurๆฅๅˆฐไธญ้—ดไฝ็ฝฎ,ๆŽฅไธŠๅ่ฝฌๅ›žๆฅ็š„ๅŽๅŠ้ƒจๅˆ†ๅคด่Š‚็‚น slow = reverseSingleList(head2); return true; } private Node reverseSingleList(Node head) { Node pre = null; Node next = null; while (head != null) { // ๅญ˜ๅ‚จๅŽŸๆฅnext่Š‚็‚น next = head.next; // next่Š‚็‚นๆŒ‡ๅ‘ไธŠไธ€ไธช่Š‚็‚น head.next = pre; // ไธ‹ไธ€ไธช่Š‚็‚น็š„ไธŠไธ€ไธช่Š‚็‚นๅฐฑๆ˜ฏๅฝ“ๅ‰่Š‚็‚น pre = head; // ๅ‘ๅŽๆŽจ่ฟ›ไธ€ไธช่Š‚็‚น head = next; } // ่ฟ”ๅ›žๅ่ฝฌๅŽ็š„ๅคด่Š‚็‚น,ๅณๆœ€ๅŽไธ€ไธช่Š‚็‚น return pre; } } ``` ๆ–นๆณ• 1: ็ฌ”่ฏ•ๅˆฉ็”จๆ ˆๆฅๅš,้ๅކไธ€้้“พ่กจ,ๆŠŠ้“พ่กจๅ…ƒ็ด ๅ…ฅๆ ˆ; ๅ†้ๅކไธ€้้“พ่กจ,ๆ ˆๅผนๅ‡บๅ…ƒ็ด ๅนถไธŽๅŽŸ้“พ่กจๅฝ“ๅ‰ๅ…ƒ็ด ๅฏนๆฏ”,ไธไธ€ๆ ทๅฐฑ่ฟ”ๅ›ž false ๆ–นๆณ• 2: ๅˆฉ็”จๅฟซๆ…ขๆŒ‡้’ˆ,ๅฟซๆŒ‡้’ˆไธ€ๆฌก่ตฐไธคๆญฅ,ๆ…ขๆŒ‡้’ˆไธ€ๆฌก่ตฐไธ€ๆญฅ,ๅฝ“ๅฟซๆŒ‡้’ˆๅˆฐๆœ€ๅŽ็š„ๆ—ถๅ€™,ๆ…ขๆŒ‡้’ˆๅˆšๅฅฝๅˆฐไธญ้—ด,่ฟ™ๆ—ถๅ€™ๅˆฉ็”จๆ ˆๅฐ†้“พ่กจๅŽๅŠ้ƒจๅˆ†็š„ๅ…ƒ็ด ๅ…ฅๆ ˆ,ๅ†ๅผนๅ‡บๆฏ”่พƒ,ไปŽ่€Œ่Š‚็œไบ†ไธ€ๅŠ็ฉบ้—ด ๆ–นๆณ• 3: ๅˆฉ็”จๅฟซๆ…ขๆŒ‡้’ˆ,ๅฟซๆŒ‡้’ˆๅˆฐๆœ€ๅŽ็š„ๆ—ถๅ€™,ๆ…ขๆŒ‡้’ˆๅˆšๅฅฝๅˆฐไธญ็‚น,็„ถๅŽๅˆฉ็”จๆ…ขๆŒ‡้’ˆ,ๅฐ†้“พ่กจๅŽๅŠ้ƒจๅˆ†้€†ๅบ,ๅณ 1->2 ๅ˜ๆˆ 2->1,ๅ†็”จไธคไธชๆŒ‡้’ˆ,ไธ€ไธชไปŽๅคดๅผ€ๅง‹้ๅކ,ไธ€ไธชไปŽๅฐพๅผ€ๅง‹้ๅކ,ๆœ‰ไธๅŒๅˆ™่ฟ”ๅ›ž false,ๅฆๅˆ™็ป“ๆŸๅŽ่ฟ”ๅ›ž true,ๆœ€ๅŽ่ฎฐๅพ—ๆขๅคๅŽŸๆ•ฐ็ป„ ==== ๅฐ†ๅ•ๅ‘้“พ่กจๆŒ‰ๆŸๅ€ผๅˆ’ๅˆ†ๆˆๅทฆ่พนๅฐ,ไธญ้—ด็›ธ็ญ‰,ๅณ่พนๅคง็š„ๅฝขๅผ ้ข˜็›ฎ: ็ป™ๅฎšไธ€ไธชๅ•้“พ่กจ็š„ๅคด็ป“็‚น head,่Š‚็‚น็š„ๅ€ผ็ฑปๅž‹ๆ˜ฏๆ•ดๅž‹,ๅ†็ป™ๅฎšไธ€ไธชๆ•ดๆ•ฐ pivot,ๅฎž็Žฐไธ€ไธช่ฐƒๆ•ด้“พ่กจ็š„ๅ‡ฝๆ•ฐ,ๅฐ†้“พ่กจ่ฐƒๆ•ดไธบๅทฆ้ƒจๅˆ†้ƒฝๆ˜ฏๅ€ผๅฐไบŽ pivot ็š„่Š‚็‚น,ไธญ้—ด้ƒจๅˆ†้ƒฝๆ˜ฏๅ€ผ็ญ‰ไบŽ pivot ็š„่Š‚็‚น,ๅณ้ƒจๅˆ†้ƒฝๆ˜ฏๅ€ผๅคงไบŽ pivot ็š„่Š‚็‚น ่ฟ›้˜ถ: ๅœจๅฎž็ŽฐๅŽŸ้—ฎ้ข˜ๅŠŸ่ƒฝ็š„ๅŸบ็ก€ไธŠ,ๅขžๅŠ ๅฆ‚ไธ‹่ฆๆฑ‚ ่ฆๆฑ‚: ่ฐƒๆ•ดๅŽๆ‰€ๆœ‰ๅฐไบŽ pivot ็š„่Š‚็‚นไน‹้—ด็š„็›ธๅฏน้กบๅบๅ’Œ่ฐƒๆ•ดๅ‰ไธ€ๆ ท ่ฆๆฑ‚: ่ฐƒๆ•ดๅŽๆ‰€ๆœ‰็ญ‰ไบŽ pivot ็š„่Š‚็‚นไน‹้—ด็š„็›ธๅฏน้กบๅบๅ’Œ่ฐƒๆ•ดๅ‰ไธ€ๆ ท ่ฆๆฑ‚: ่ฐƒๆ•ดๅŽๆ‰€ๆœ‰ๅคงไบŽ pivot ็š„่Š‚็‚นไน‹้—ด็š„็›ธๅฏน้กบๅบๅ’Œ่ฐƒๆ•ดๅ‰ไธ€ๆ ท ่ฆๆฑ‚: ๆ—ถ้—ดๅคๆ‚ๅบฆ่พพๅˆฐ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(1) ```java public class LinkedPartition { public static class Node{ int value; Node next; public Node(int val){ this.value = val; } } //ๆ–นๆณ•ไธ€: ๅฐ†้“พ่กจๅ…ƒ็ด ๆ”พ่ฟ›ๆ•ฐ็ป„partition,็„ถๅŽๅ†่ฟžๅ›žๆˆๅ•้“พ่กจ public Node linkerPartition1(Node head, int num){ if(head == null || head.next == null){ return head; } //ๅ…ˆ่ฎก็ฎ—ๆœ‰ๅคšๅฐ‘ไธช่Š‚็‚น int i = 0; Node cur = head; while(cur != null){ i++; cur = cur.next; } //็„ถๅŽ็”ณ่ฏทไธ€ไธชๅ’Œ่Š‚็‚นๆ•ฐ็›ธๅŒ็š„ๆ•ฐ็ป„ int[] arr = new int[i]; //ๅ†ๆŠŠ่Š‚็‚น็š„valueๆ”พ่ฟ›ๆ•ฐ็ป„ cur = head; i = 0; while(cur != null){ arr[i++] = cur.value; cur = cur.next; } //ๅ†ๅฏนๆ•ฐ็ป„ไธญ็š„ๅ…ƒ็ด ็”จ่ทๅ…ฐๅ›ฝๆ——ๆ–นๆณ•ๅฏนๅ€ผ่ฟ›่กŒๅฐไบŽใ€็ญ‰ไบŽใ€ๅคงไบŽ็š„ๅŒบๅŸŸๅˆ’ๅˆ† arrPartition(arr, num); //ๆœ€ๅŽๆŠŠๆŽ’ๅฅฝๅบ็š„ๆ•ฐ็ป„ๅ…ƒ็ด ๆŒ‰้กบๅบๆ›ดๆ–ฐๅˆฐๅŽŸๆฅ้“พ่กจ็š„valueไธŠ cur = head; i = 0; while(cur != null){ cur.value = arr[i++]; cur = cur.next; } return head; } //่ทๅ…ฐๅ›ฝๆ——ๅˆ’ๅˆ†ๆณ• public void arrPartition(int[] arr, int num){ int less = -1; int more = arr.length; int cur = 0; while(cur != more){ if(arr[cur] < num){ swap(arr,++less,cur++); }else if(arr[cur > num){ swap(arr,--more,cur); }else{ cur++; } } } public void swap(int[] arr, int i, int j){ int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } //ๆ–นๆณ•ไบŒ: ็”จๅ…ญไธชๅ˜้‡ๅฐ†ๅŽŸ้“พ่กจๆ‹†ๅˆ†ๆˆไธ‰ไธชๅฐ้“พ่กจ,่กจ็คบๅคงไบŽใ€ๅฐไบŽใ€็ญ‰ไบŽๅŒบๅŸŸ็š„ๅฑ€้ƒจ้“พ่กจ,ๅˆ’ๅˆ†ๅฎŒๅฐ†่ฟ™ไธ‰ไธช้“พ่กจ่ฟž่ตทๆฅ public static Node listPartition2(Node head, int num) { Node less = null; // ๅญ˜ๆ”พๅฐไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endless = null; // ๆŒ‡ๅ‘ๅฐไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node equal = null; // ๅญ˜ๆ”พ็ญ‰ไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endequal = null; // ๆŒ‡ๅ‘็ญ‰ไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node more = null; // ๅญ˜ๆ”พๅคงไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endmore = null; // ๆŒ‡ๅ‘ๅคงไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node temp = head; // ๅˆ†ๅˆซๅฏนไธ‰ไธชๅŒบ่ฟ›่กŒๅกซๅ…… while (temp != null) { //lessๅŒบ if (temp.value < num) { if (less == null) {//ๆ˜ฏ็ฉบๅˆ™ๅคดๅฐพๅ‡ไธบtemp less = temp; endless = temp; } else {//้ž็ฉบๅˆ™ๅฐพๅŠ temp endless.next = temp; endless = endless.next; } } else if (temp.value > num) {//moreๅŒบ if (more == null) { more = temp; endmore = temp; } else { endmore.next = temp; endmore = endmore.next; } } else {//equalๅŒบ if (equal == null) { equal = temp; endequal = temp; } else { endequal.next = temp; endequal = endequal.next; } } temp = temp.next; } endless.next = null; endequal.next = null; endmore.next = null; if (less == null) { if (equal != null) { head = equal; endequal.next = more; } else { head = more; } } else { head = less; if (equal != null) { endless.next = equal; endequal.next = more; } else { endless.next = more; } } return head; } public Node listPartition2(Node head, int num){ Node less = null; // ๅญ˜ๆ”พๅฐไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endless = null; // ๆŒ‡ๅ‘ๅฐไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node equal = null; // ๅญ˜ๆ”พ็ญ‰ไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endequal = null; // ๆŒ‡ๅ‘็ญ‰ไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node more = null; // ๅญ˜ๆ”พๅคงไบŽnum็š„่Š‚็‚น,ๆŒ‡ๅ‘็ฌฌไธ€ไธชๅ‡บ็Žฐๅœจ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น Node endmore = null; // ๆŒ‡ๅ‘ๅคงไบŽnum็š„่Š‚็‚น้“พ่กจ็š„็ป“ๅฐพ Node next = null; while(head != null){ next = head.next; head.next = null; //ๅฐไบŽnumๆ”พ่ฟ›lessๅŒบๅŸŸ if(head.value < num){ //ๅฝ“ๅ‰ๅŒบๅŸŸไธบ็ฉบๆ—ถ,ๅคด่Š‚็‚นๅ’Œๅฐพ่Š‚็‚น้ƒฝๆ›ดๆ–ฐไธบhead,ไปฃ่กจ็ฌฌไธ€ไธช่ฟ›ๅ…ฅ่ฏฅๅŒบๅŸŸ็š„่Š‚็‚น if(less == null){ less = head; endless = head; }else{ //ไธไธบ็ฉบๆ—ถ,ไธŠไธ€ๆฌก็š„ๅฐพ่Š‚็‚น็š„next่Š‚็‚นๆŒ‡ๅ‘ๅฝ“ๅ‰็š„head endless.next = head; //ๅ†ๆ›ดๆ–ฐๅฝ“ๅ‰็š„ๅฐพ่Š‚็‚นๅ˜ๆˆhead endless = head; } //moreๅŒบ }else if(head.value > num){ if(more == null){ more = head; endmore = head; }else{ endmore.next = head; endmore = head; } //euqalๅŒบ }else{ if(equal == null){ equal = head; endequal = head; }else{ endequal.next = head; endequal = head; } } //ๆŽจ่ฟ›่Š‚็‚น head = head.next; } //ๅฐ†ๅˆ’ๅฅฝ็š„ไธ‰ไธช้ƒจๅˆ†ๅญ้“พ่กจไธฒ่ตทๆฅ,่ฟ”ๅ›ž //่ฟ˜้œ€่ฆ่€ƒ่™‘ๅˆฐๅฏ่ƒฝไผšๆœ‰ๆŸไธช้ƒจๅˆ†ๅญ้“พ่กจไธๅญ˜ๅœจ็š„ๆƒ…ๅ†ต //lessๅญ้“พๅญ˜ๅœจ if(less != null){ endless.next = equal; //lessๅ’Œequalๅญ้“พ้ƒฝๅญ˜ๅœจ if(equal != null){ endequal.next = more; //lessๅญ˜ๅœจ,equalไธๅญ˜ๅœจ,less็›ดๆŽฅๅ’Œmore็›ธ่ฟž }else{ endless.next = more; } return less; //lessไธๅญ˜ๅœจ }else{ //lessไธๅญ˜ๅœจ,equalๅญ˜ๅœจ,equalๅ’Œmore็›ธ่ฟž if(equal != null){ endequal.next = more; return equal; }else{ //lessไธๅญ˜ๅœจ,equalไนŸไธๅญ˜ๅœจ return more; } } } } ``` ๆ–นๆณ• 1: ๅˆฉ็”จ node ๆ•ฐ็ป„,ๅฐ†้“พ่กจๅ…จ้ƒจ่Š‚็‚นๆ”พๅ…ฅๆ•ฐ็ป„ไธญ,็„ถๅŽ่ฟ›่กŒ partition,ไฝ†ๆ˜ฏไฟๆŒไธไบ†็›ธๅฏน้กบๅบ ๆ–นๆณ• 2: ๅˆฉ็”จ 6 ไธชๅ˜้‡,ๅˆ†ๅˆซๆŒ‡ๅ‘ๅฐไบŽๅŒบ็š„ๅคด,ๅฐไบŽๅŒบ็š„ๅฐพ,็ญ‰ไบŽๅŒบ็š„ๅคด,็ญ‰ไบŽๅŒบ็š„ๅฐพ,ๅคงไบŽๅŒบ็š„ๅคด,ๅคงไบŽๅŒบ็š„ๅฐพ; ้€š่ฟ‡้ๅކ,ๅฏไปฅๅฐ†ๆ‰€ๆœ‰ๅ…ƒ็ด ๅฏนๅบ”ๅ“ชไธชๅŒบๅŸŸๆ‰พๅˆฐ,ๅนถๆ›ดๆ–ฐๅ„ไธชๅ˜้‡็š„ๅ€ผ,ๆœ€ๅŽๅ†ๅฐ†ๅฐไบŽๅŒบ็š„ๅฐพๅ’Œ็ญ‰ไบŽๅŒบ็š„ๅคด่ฟžๆŽฅ,็ญ‰ไบŽๅŒบ็š„ๅฐพๅ’ŒๅคงไบŽๅŒบ็š„ๅคด่ฟžๆŽฅ,่ฟ”ๅ›žๅฐไบŽๅŒบ็š„ๅคด๏ผˆไธ€ๅฎš่ฆ่ฎจ่ฎบๆ˜ฏๅฆๆœ‰ๅฐไบŽๅŒบ,็ญ‰ไบŽๅŒบ,ๅคงไบŽๅŒบ๏ผ‰ ==== ๅคๅˆถๅซๆœ‰้šๆœบๆŒ‡้’ˆ่Š‚็‚น็š„้“พ่กจ ้ข˜็›ฎ: ไธ€็ง็‰นๆฎŠ็š„ๅ•้“พ่กจ่Š‚็‚น็ฑปๆ่ฟฐๅฆ‚ไธ‹: ```java class Node{ int value; Node next; Node random; Node(int val){ value = val; } } ``` random ๆŒ‡้’ˆๆ˜ฏๅ•้“พ่กจ่Š‚็‚น็ป“ๆž„ไธญๆ–ฐๅขž็š„ๆŒ‡้’ˆ,random ๅฏ่ƒฝๆŒ‡ๅ‘้“พ่กจไธญ็š„ไปปๆ„ไธ€ไธช่Š‚็‚น,ไนŸๅฏ่ƒฝๆŒ‡ๅ‘ nullใ€‚็ป™ๅฎšไธ€ไธช็”ฑ node ่Š‚็‚น็ฑปๅž‹็ป„ๆˆ็š„ๆ— ็Žฏๅ•้“พ่กจ็š„ๅคด็ป“็‚น head,่ฏทๅฎž็Žฐไธ€ไธชๅ‡ฝๆ•ฐๅฎŒๆˆ่ฟ™ไธช้“พ่กจ็š„ๅคๅˆถ,ๅนถ่ฟ”ๅ›žๅคๅˆถ็š„ๆ–ฐ้“พ่กจ็š„ๅคด็ป“็‚น ่ฆๆฑ‚: ๆ—ถ้—ดๅคๆ‚ๅบฆ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆ O(1) ```java public class CopyRandomList { public static class Node { int value; Node next; Node random; public Node(int value) { this.value = value; } } // ๆ–นๆณ•ไธ€: ็›ดๆŽฅ็”จhashmapๆฅ่ฟ›่กŒๅ…ƒ็ด ๅˆ—่กจ่Š‚็‚นๅ’Œๅคๅˆถ่Š‚็‚น้—ด็š„ๆ˜ ๅฐ„,keyๅญ˜ๅŽŸๆฅ็š„่Š‚็‚น,valueๅญ˜ๆ–ฐๅคๅˆถ็š„่Š‚็‚น public Node copyRandomList1(Node head) { // hashmap็š„keyๅ’Œvalue้ƒฝๆ˜ฏๅญ˜Node็ฑปๅž‹,ๅญ˜ๅ…ฅ็š„ๆ˜ฏๅœฐๅ€ HashMap<Node, Node> map = new HashMap<Node, Node>(); // ็ฌฌไธ€ๆฌก้ๅކ: ๆ‹ท่ด่Š‚็‚น,ๅฝขๆˆkeyๆ˜ฏๆ—ง็ป“็‚น,valueๆ˜ฏๅคๅˆถ็š„ๆ–ฐ่Š‚็‚น Node temp = head; while (temp != null) { map.put(temp, new Node(temp.value)); temp = temp.next; } // ็ฌฌไบŒๆฌก้ๅކ: ๅคๅˆถ่Š‚็‚น้—ด็š„ๅ…ณ็ณป,ๅณๅคๅˆถnextๅ’ŒrandomๆŒ‡้’ˆ // ๅŽŸ้“พ่กจ่Š‚็‚น้—ด็š„ๆŒ‡้’ˆๅ…ณ็ณปๆ˜ฏ็Ÿฅ้“็š„,ๆฏ”ๅฆ‚ๆƒณ็Ÿฅ้“A'ๅ’ŒB'ไน‹้—ด็š„ๅ…ณ็ณป,ๅฏไปฅ้€š่ฟ‡:A'->A->B->B',่ฟ™ๆ ทๅฐฑๆ‰พๅˆฐไบ†B' while (temp != null) { // get(temp).nextๅพ—ๅˆฐๅคๅˆถ่Š‚็‚น็š„next,get(temp.next)ๅพ—ๅˆฐๅŽŸๆฅ่Š‚็‚น็š„next่Š‚็‚น็š„ๅคๅˆถ่Š‚็‚น map.get(temp).next = map.get(temp.next); // randomๅŒ็† map.get(temp).random = map.get(temp.random); temp = temp.next; } // ่ฟ”ๅ›žget(head)ไธญๅญ˜็š„ๅคๅˆถ้“พ่กจ็š„ๅคด่Š‚็‚น return map.get(head); } // ๆ–นๆณ•ไบŒ: ไธ็”จ้ขๅค–็ฉบ้—ดใ€‚้ฆ–ๅ…ˆ,ๅ…ˆๅฐ†็ป“็‚นๅคๅˆถๅˆฐ้“พ่กจไธญ,ๅฝขๆˆ: 1->1โ€™->2->2โ€™->3->3โ€™->โ€ฆ->nullๅฝขๅผ; // ๅ…ถๆฌกๅคๅˆถrand็ป“ๆž„,ๅฆ‚1โ€˜็š„randๆŒ‡้’ˆ้œ€ๆŒ‡ๅ‘3โ€™,ๅˆ™ๅˆ1ๆŒ‡้’ˆๆŒ‡ๅ‘3, 3็š„nextไธบ3โ€˜,ๅ› ๆญคๅฏๅพ—ๅ‡บ1โ€™็š„randๆŒ‡ๅ‘3โ€˜ใ€‚ // ๆœ€ๅŽๅฐ†้“พ่กจๆ‹†ๅˆ†ๅพ—ๅˆฐๅคๅˆถ้“พ่กจใ€‚ public Node copyRandomList2(Node head) { if (head == null) return null; // ๆ‹ท่ด่Š‚็‚น,้‡ๅปบ้“พ่กจ็ป“ๆž„: 1->1'->2->2'->3->3'->...->nullๅฝขๅผ // ๅฐฑๆ˜ฏๅฐ†ๆ‹ท่ด็š„่Š‚็‚น็›ดๆŽฅๅ…ณ่”ๅˆฐๅŽŸ่Š‚็‚น็š„nextๆŒ‡้’ˆไธŠ Node temp = head; while (temp != null) { Node tempCopy = new Node(temp.value); Node temp2 = temp.next;// ๅ…ˆๅฐ†ๅฝ“ๅ‰่Š‚็‚นๅŽŸๆฅ็š„next่Š‚็‚นๅญ˜่ตทๆฅ temp.next = tempCopy;// ๅ†ๆŠŠๅฝ“ๅ‰่Š‚็‚น็š„next่Š‚็‚นๆ”นๆˆๆ‹ท่ด่Š‚็‚น tempCopy.next = temp2;// ๅฐ†ๆ‹ท่ด่Š‚็‚นnext่Š‚็‚นๅญ˜ๅ›žๅŽŸๆฅ็š„next่Š‚็‚น,ๅ˜ๆˆ1->1'->2็ป“ๆž„ temp = temp2;// ่ฎฉtempๆฅๅˆฐไธ‹ไธ€ไธชๅŽŸ่Š‚็‚นไฝ็ฝฎ } // ่ฟ›่กŒrandom ็š„ๆ‹ท่ด temp = head; while (temp != null) { temp.next.random = temp.random == null ? null : temp.random.next; temp = temp.next.next; } // ๆ‹†ๅˆ†้“พ่กจ็ป“ๆž„ temp = head; Node headCopy = head.next; while (temp.next != null) { Node temp2 = temp.next; temp.next = temp.next.next; temp = temp2; } return headCopy; } } ``` ==== ไธคไธชๅ•้“พ่กจ็›ธไบค็š„ไธ€็ณปๅˆ—้—ฎ้ข˜ ้ข˜็›ฎ: ็ป™ๅฎšไธคไธชๅฏ่ƒฝๆœ‰็ŽฏไนŸๅฏ่ƒฝๆ— ็Žฏ็š„ๅ•้“พ่กจ,ๅคด็ป“็‚น head1 ๅ’Œ head2ใ€‚่ฏทๅฎž็Žฐไธ€ไธชๅ‡ฝๆ•ฐ,ๅฆ‚ๆžœไธคไธช้“พ่กจ็›ธไบค,่ฏท่ฟ”ๅ›ž็›ธไบค็š„็ฌฌไธ€ไธช่Š‚็‚นใ€‚ๅฆ‚ๆžœไธ็›ธไบค,่ฟ”ๅ›ž null ่ฆๆฑ‚:ๅฆ‚ๆžœไธคไธช้“พ่กจ้•ฟๅบฆไน‹ๅ’Œไธบ N,ๆ—ถ้—ดๅคๆ‚ๅบฆ่ฏท่พพๅˆฐ O(N),้ขๅค–็ฉบ้—ดๅคๆ‚ๅบฆไธบ O(1) ```java public class GetIntersectionNode { public static class Node { int value; Node next; public Node(int value) { this.value = value; } } // ๅˆฉ็”จHashSetๆฅๅˆคๆ–ญๆœ‰ๆฒกๆœ‰็Žฏ public static Node existLoop1(Node head) { HashSet<Node> set = new HashSet<Node>(); Node temp = head; while (temp != null) { if (!set.contains(temp)) { set.add(temp); temp = temp.next; } else { return temp; } } return null; } // ๅˆฉ็”จๅฟซๆ…ขๆŒ‡้’ˆๆฅๅˆคๆ–ญๆœ‰ๆฒกๆœ‰็Žฏ public static Node existLoop2(Node head) { if (head == null || head.next == null) { return null; } Node p1 = head; Node p2 = head; while (p2 != null && p2.next != null) { p1 = p1.next; // ๆ…ขๆŒ‡้’ˆไธ€ๆฌกไธ€ๆญฅ p2 = p2.next.next; // ๅฟซๆŒ‡้’ˆไธ€ๆฌกไธคๆญฅ if (p1 == p2) { p2 = head; // p1ๅ’Œp2็›ธ้‡่ฏๆ˜Žๆœ‰็Žฏ,p2ๅ›žๅˆฐheadไฝ็ฝฎ while (p1 != p2) { p1 = p1.next; p2 = p2.next; // p2ๅ’Œp1้ƒฝๆฏๆฌก่ตฐไธ€ๆญฅ } if (p1 == p2) { return p1; // ๅ†ๆฌก็›ธ้‡ๆ—ถๅฐฑๆ˜ฏๅ…ฅ็Žฏ่Š‚็‚น } } } return null; // ๆฒก็›ธ้‡่ฟ‡ๅฐฑๆ˜ฏๆ— ็Žฏ } // ๆƒ…ๅ†ตไธ€: ไธคไธช้ƒฝๆฒก็Žฏ // ๆ–นๆณ•ไธ€: ไฝฟ็”จHashSet public static Node noLoop1(Node head1, Node head2) { Node p1 = head1; Node p2 = head2; HashSet<Node> set = new HashSet<Node>(); // ้ๅކๅ…ถไธญไธ€ไธช้“พ่กจๅนถๅฐ†่Š‚็‚นๅญ˜ๅ…ฅHashSet while (p1 != null) { set.add(p1); p1 = p1.next; } // ๅฏนๅฆไธ€ไธช้“พ่กจ้ๅކ,ๅฆ‚ๆžœHashSetไธญๅญ˜ๆœ‰็›ธๅŒ่Š‚็‚นๅˆ™็›ธไบค,ไธ”ๆญค่Š‚็‚นๅฐฑๆ˜ฏไบค็‚น while (p2 != null) { if (set.contains(p2)) { return p2; } p2 = p2.next; } return null; } // ๆ–นๆณ•ไบŒ: ๅˆฉ็”จๅŒๆŒ‡้’ˆ่ตฐๅทฎๅ€ผๆญฅ // ไฝฟ็”จtailๆ˜ฏไธบไบ†ๆ–นไพฟๅŽ้ข็š„ๆƒ…ๅ†ต่ฐƒ็”จ,ๅขžๅŠ ไปฃ็ ๅค็”จ็އ public static Node noLoop2(Node head1, Node head2, Node tail1, Node tail2) { if (head1 == null || head2 == null) { return null; } Node p1 = head1; Node p2 = head2; // d_valueๆ˜ฏ้“พ่กจ้•ฟๅบฆๅทฎๅ€ผ int d_value = 0; while (p1.next != tail1) { ++d_value; p1 = p1.next; } while (p2.next != tail2) { --d_value; p2 = p2.next; } if (p1 != p2) {// ๅฆ‚ๆžœๆœ€ๅŽไธ€ไธช่Š‚็‚นไธไธ€ๆ ทไธ€ๅฎšไธ็›ธไบค return null; } p1 = head1; p2 = head2; // ่ฎฉp1 p2ๆœ‰็›ธๅŒ็š„่ตท็‚น if (d_value < 0) { // p2ๆ›ด้•ฟ while (d_value != 0) { ++d_value; p2 = p2.next; } } else { // ็›ธ็ญ‰ๆˆ–่€…p1ๆ›ด้•ฟ while (d_value != 0) { --d_value; p1 = p1.next; } } // ้ๅކๅˆฐ็›ธไบค็‚น while (p1 != p2) { p1 = p1.next; p2 = p2.next; } return p1; } // ๆƒ…ๅ†ตไบŒ: ไธ€ไธชๆœ‰็Žฏไธ€ไธชๆ— ็Žฏ,ๅฟ…็„ถๆ— ๆณ•็›ธไบค // ๆƒ…ๅ†ตไธ‰: ไธคไธช้ƒฝๆœ‰็Žฏ(ๆ— ไบค็‚น,ๅ…ฅ็Žฏๅ‰็›ธไบค,ๅ…ฅ็ŽฏๅŽ็›ธไบค) public static Node bothLoop(Node head1, Node head2) { Node loop1 = existLoop2(head1); Node loop2 = existLoop2(head2); Node p1 = head1; // Node p2 = head2; if (loop1 == loop2) { return noLoop2(head1, head2, loop1, loop2); // int d_value = 0; // ไธคไธช้“พ่กจ้•ฟๅบฆ็š„ๅทฎๅ€ผ // // ้ๅކcur1ๅ’Œcur2้“พ่กจๅพ—ๅˆฐไป–ไปฌ็š„้•ฟๅบฆๅทฎๅ€ผๅ’Œๆœ€ๅŽไธ€ไธช่Š‚็‚น // while (p1 != loop1) { // d_value++; // p1 = p1.next; // } // while (p2 != loop2) { // d_value--; // p2 = p2.next; // } // // ๅฆ‚ๆžœn>0,ไปฃ่กจhead1้“พ่กจ้•ฟ,cur1็ญ‰ไบŽ้•ฟ็š„้“พ่กจ็š„ๅคด่Š‚็‚น // p1 = d_value > 0 ? head1 : head2; // // cur2ไปฃ่กจ็Ÿญ็š„้“พ่กจ็š„ๅคด่Š‚็‚น // p2 = p1 == head1 ? head2 : head1; // // ้•ฟ้“พ่กจๅ…ˆ่ตฐnๆญฅ // while (d_value != 0) { // d_value--; // p1 = p1.next; // } // // ็„ถๅŽcur1ๅ’Œcur2้ƒฝไธ€ๆฌก่ตฐไธ€ๆญฅ // while (p1 != p2) { // p1 = p1.next; // p2 = p2.next; // } // // ๆœ€ๅŽ็›ธๅŒๆ—ถๅฐฑๆ˜ฏ็›ธไบค่Š‚็‚น // return p1; // ็Žฏๅ†…็›ธไบค: } else { // cur1ไปŽloop1.nextๅผ€ๅง‹ไธๆ–ญ่ตฐ p1 = loop1.next; // ่ตฐๅ›žๅˆฐ่‡ชๅทฑไน‹ๅ‰,ไธๆ–ญๅฏปๆ‰พloop1็Žฏๅ†…ๆ˜ฏๅฆๆœ‰ๅ’Œloop2็›ธๅŒ็š„่Š‚็‚น while (p1 != loop1) { // ้‡ๅˆฐloop2,่ฟ”ๅ›ž็›ธไบค่Š‚็‚น if (p1 == loop2) { return loop2; } // ๆŽจ่ฟ›ๅˆฐไธ‹ไธ€ไธช่Š‚็‚น p1 = p1.next; } // ่ตฐๅฎŒไบ†ไนŸๆฒกๆœ‰็›ธๅŒ่Š‚็‚น,ไธคไธช้“พ่กจไธ็›ธไบค return null; } } public static Node getIntersectNode(Node head1, Node head2) { if (head1 == null || head2 == null) { return null; } // ๅ…ˆๆฃ€ๆŸฅไธคไธชๅ•้“พ่กจๆ˜ฏๅฆๆœ‰็Žฏ Node loop1 = existLoop2(head1); Node loop2 = existLoop2(head2); // ๅฆ‚ๆžœ้ƒฝๆ— ็Žฏ if (loop1 == null && loop2 == null) { return noLoop2(head1, head2,null,null); } // ๅฆ‚ๆžœ้ƒฝๆœ‰็Žฏ if (loop1 != null && loop2 != null) { return bothLoop(head1, head2); } // ไธ€ไธชๆœ‰็Žฏไธ€ไธชๆ— ็Žฏ,ๅ•้“พ่กจ็ป“ๆž„ไธ‹ๆฐธไธ็›ธไบค return null; } } ``` ===== ๆ€่ทฏๅˆ†ๆž - ๆญฅ้ชคไธ€: ๅ…ˆๅˆคๆ–ญไธ€ไธช้“พ่กจๆ˜ฏๅฆๆœ‰็Žฏ,ๅฆ‚ๆžœๆœ‰,่ฟ”ๅ›žๅคด็ป“็‚น - ๆ–นๆณ• 1: ไฝฟ็”จ hash ่กจ้ๅކ - ๆ–นๆณ• 2: ๅˆฉ็”จๅฟซๆ…ขๆŒ‡้’ˆ - ่งฃ้‡Š - ไธบไฝ•ๆ…ขๆŒ‡้’ˆ็ฌฌไธ€ๅœˆ่ตฐไธๅฎŒไธ€ๅฎšไผšๅ’ŒๅฟซๆŒ‡้’ˆ็›ธ้‡๏ผŸ ๅฟซๆŒ‡้’ˆๅ…ˆ่ฟ›ๅ…ฅ็Žฏ---ใ€‹ๅฝ“ๆ…ขๆŒ‡้’ˆๅˆšๅˆฐ่พพ็Žฏ็š„ๅ…ฅๅฃๆ—ถ,ๅฟซๆŒ‡้’ˆๆญคๆ—ถๅœจ็Žฏไธญ็š„ๆŸไธชไฝ็ฝฎ(ไนŸๅฏ่ƒฝๆญคๆ—ถ็›ธ้‡) ---ใ€‹่ฎพๆญคๆ—ถๅฟซๆŒ‡้’ˆๅ’Œๆ…ขๆŒ‡้’ˆ่ท็ฆปไธบ$x$,่‹ฅๅœจ็ฌฌไบŒๆญฅ็›ธ้‡,ๅˆ™$x = 0$ ---ใ€‹่ฎพ็Žฏ็š„ๅ‘จ้•ฟไธบ$n$,้‚ฃไนˆ็œ‹ๆˆๅฟซๆŒ‡้’ˆ่ฟฝ่ตถๆ…ขๆŒ‡้’ˆ,้œ€่ฆ่ฟฝ่ตถ$n-x$ ---ใ€‹ๅฟซๆŒ‡้’ˆๆฏๆฌก้ƒฝ่ฟฝ่ตถๆ…ขๆŒ‡้’ˆ 1 ไธชๅ•ไฝ,่ฎพๆ…ขๆŒ‡้’ˆ้€Ÿๅบฆ 1 ่Š‚็‚น/ๆฌก,ๅฟซๆŒ‡้’ˆ 2 ่Š‚็‚น/ๆฌก,้‚ฃไนˆ่ฟฝ่ตถ้œ€่ฆ$n-x$ๆฌก ---ใ€‹ๅœจ$n-x$ๆฌกๆ•ฐๅ†…,ๆ…ขๆŒ‡้’ˆ่ตฐไบ†$n-x$่Š‚็‚น,ๅ› ไธบ$x\ge 0$,ๅˆ™ๆ…ขๆŒ‡้’ˆ่ตฐ็š„่ทฏ็จ‹ๅฐไบŽ็ญ‰ไบŽ n,ๅณ่ตฐไธๅฎŒไธ€ๅœˆๅฐฑๅ’ŒๅฟซๆŒ‡้’ˆ็›ธ้‡ - ไธบไป€ไนˆๅฟ…็„ถไผšๅœจๅ…ฅ็Žฏ็‚น็›ธ้‡๏ผŸ ๅ‡่ฎพ้“พ่กจ้ž็Žฏ้ƒจๅˆ†้•ฟๅบฆไธบ$a$,ๆ…ขๆŒ‡้’ˆๅ…ฅ็ŽฏๅŽ่ตฐไบ†$b$่ท็ฆปไธŽๅฟซๆŒ‡้’ˆ็›ธ้‡,่ฎพ็Žฏไธญ้™ค$b$ๅค–ๅ‰ฉไฝ™้ƒจๅˆ†็š„้•ฟๅบฆไธบ$c$,ๆญคๆ—ถๅฟซๆŒ‡้’ˆๅทฒ็ป่ตฐๅฎŒไบ†็Žฏ็š„$n$ๅœˆใ€‚ ๅˆ™ๅฟซๆŒ‡้’ˆ่ตฐ็š„่ท็ฆป$s_1=a+n(b+c)+b$ ๆ…ขๆŒ‡้’ˆ่ตฐ็š„่ท็ฆปๆ˜ฏ$s_2=a+b$ ็”ฑ้ข˜ๆ„ๅฏ็Ÿฅ$s_1=2s_2$,ๅณ$a+n(b+c)+b = 2(a+b)$,ๆŽจๅ‡บ$a = c+(n-1)(b+c)$ ๅณไปŽ็›ธ้‡็‚นๅˆฐๅ…ฅ็Žฏ็‚น็š„่ท็ฆปๅŠ ไธŠ n-1 ๅœˆ็š„็Žฏ้•ฟๆฐๅฅฝ็ญ‰ไบŽไปŽ้“พ่กจๅคด้ƒจๅˆฐๅ…ฅ็Žฏ็‚น็š„่ท็ฆปใ€‚ - ๆญฅ้ชคไบŒ: ่ฎจ่ฎบ head1 ๅ’Œ head2 ๅœจไธๅŒๆƒ…ๅ†ตไธ‹็š„ๅค„็†ๆ–นๆณ• - ๆƒ…ๅ†ต 1: `loop1 == null && loop2 == null` - ๆƒ…ๅ†ต 2: `loop1`,`loop2`ไธญๆœ‰`null`ไนŸๆœ‰้ž`null`,ๅˆ™ไธ€ๅฎšไธ็›ธไบค - ๆƒ…ๅ†ต 3: `loop1`,`loop2`้ƒฝ้ž็ฉบ,ๅˆ™ๅˆ†ไธ‰็งๆƒ…ๅ†ต
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/src/wire.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.2": draw, coordinate #import "util.typ": opposite-anchor /// List of valid wire styles /// #examples.wires #let wire-styles = ("direct", "zigzag", "dodge") #let signal-width = 1pt #let bus-width = 1.5pt /// Draws a wire intersection at the given anchor /// #examples.intersection /// - pt (point): A CeTZ compatible point / anchor /// - radius (number): The radius of the intersection /// - fill (color): The fill color #let intersection(pt, radius: .1, fill: black) = { draw.circle(pt, radius: radius, stroke: none, fill: fill) } #let get-direct-wire(pts) = { let anchors = ( "start": pts.first(), "end": pts.last() ) return (pts, anchors) } #let get-zigzag-wire(pts, ratio, dir) = { let start = pts.first() let end = pts.last() let mid = if dir == "vertical" { (start, ratio, (horizontal: end, vertical: ())) } else { (start, ratio, (horizontal: (), vertical: end)) } let points = if dir == "vertical" { ( start, (horizontal: mid, vertical: ()), (horizontal: (), vertical: end), end ) } else { ( start, (horizontal: (), vertical: mid), (horizontal: end, vertical: ()), end ) } let anchors = ( "start": start, "zig": points.at(1), "zag": points.at(2), "end": end ) return (points, anchors) } #let get-dodge-wire(pts, dodge-y, margins, sides, ctx) = { let start = pts.first() let end = pts.last() let (margin-start, margin-end) = margins let (side-start, side-end) = sides let p1 = (start, margin-start, end) let p2 = (end, margin-end, start) let (ctx, p0) = coordinate.resolve(ctx, start) let (ctx, p3) = coordinate.resolve(ctx, end) p0 = (x: p0.first(), y: p0.last()) p3 = (x: p3.first(), y: p3.last()) let dx1 = margin-start let dx2 = margin-end if type(margin-start) == ratio { dx1 = calc.abs(p3.x - p0.x) * margin-start / 100% } if type(margin-end) == ratio { dx2 = calc.abs(p3.x - p0.x) * margin-end / 100% } if side-start == "west" { dx1 *= -1 } if side-end == "east" { dx2 *= -1 } p1 = (p0.x + dx1, p0.y) p2 = (p3.x - dx2, p0.y) let points = ( start, (horizontal: p1, vertical: ()), (horizontal: (), vertical: (0, dodge-y)), (horizontal: p2, vertical: ()), (horizontal: (), vertical: end), end ) let anchors = ( "start": start, "start2": points.at(1), "dodge-start": points.at(2), "dodge-end": points.at(3), "end2": points.at(4), "end": end ) return (points, anchors) } /// Draws a wire between two points /// - id (str): The wire's id, for future reference (anchors) /// - pts (array): The two points (as CeTZ compatible coordinates, i.e. XY, relative positions, ids, etc.) /// - bus (bool): Whether the wire is a bus (multiple bits) or a simple signal (single bit) /// - name (none, str, array): Optional name of the wire. If it is an array, the first name will be put at the start of the wire, and the second at the end /// - name-pos (str): Position of the name. One of: "middle", "start" or "end" /// - slice (none, array): Optional bits slice (start and end bit indices). If set, it will be displayed at the start of the wire /// - color (color): The stroke color /// - dashed (bool): Whether the stroke is dashed or not /// - style (str): The wire's style (see #doc-ref("wire.wire-styles", var: true) for possible values) /// - reverse (bool): If true, the start and end points will be swapped (useful in cases where the start point depends on the end point, for example with perpendiculars) /// - directed (bool): If true, the wire will be directed, meaning an arrow will be drawn at the endpoint /// - rotate-name (bool): If true, the name will be rotated according to the wire's slope /// - zigzag-ratio (ratio): Position of the zigzag vertical relative to the horizontal span (only with style "zigzag") /// - zigzag-dir (str): The zigzag's direction. As either "vertical" or "horizontal" (only with dstyle "zigzag") /// - dodge-y (number): Y position to dodge the wire to (only with style "dodge") /// - dodge-sides (array): The start and end sides (going out of the connected element) of the wire (only with style "dodge") /// - dodge-margins (array): The start and end margins (i.e. space before dodging) of the wire (only with style "dodge") #let wire( id, pts, bus: false, name: none, name-pos: "middle", slice: none, color: black, dashed: false, style: "direct", reverse: false, directed: false, rotate-name: true, zigzag-ratio: 50%, zigzag-dir: "vertical", dodge-y: 0, dodge-sides: ("east", "west"), dodge-margins: (5%, 5%) ) = draw.get-ctx(ctx => { if not style in wire-styles { panic("Invalid wire style '" + style + "'") } if pts.len() != 2 { panic("Wrong number of points (got " + str(pts.len()) + " instead of 2)") } let stroke = ( paint: color, thickness: if bus {bus-width} else {signal-width} ) if dashed { stroke.insert("dash", "dashed") } let points = () let anchors = () if style == "direct" { (points, anchors) = get-direct-wire(pts) } else if style == "zigzag" { (points, anchors) = get-zigzag-wire(pts, zigzag-ratio, zigzag-dir) } else if style == "dodge" { (points, anchors) = get-dodge-wire( pts, dodge-y, dodge-margins, dodge-sides, ctx ) } let mark = (fill: color) if directed { mark = (end: ">", fill: color) } draw.group(name: id, { draw.line(..points, stroke: stroke, mark: mark) for (anchor-name, anchor-pos) in anchors { draw.anchor(anchor-name, anchor-pos) } }) let first-pt = id + ".start" let last-pt = id + ".end" let first-pos = points.first() let second-pos = points.at(1) if reverse { (first-pt, last-pt) = (last-pt, first-pt) } let angle = 0deg if rotate-name { (ctx, first-pos) = coordinate.resolve(ctx, first-pos) (ctx, second-pos) = coordinate.resolve(ctx, second-pos) if reverse { (first-pos, second-pos) = (second-pos, first-pos) } let (x1, y1, ..) = first-pos let (x2, y2, ..) = second-pos angle = calc.atan2(x2 - x1, y2 - y1) } if name != none { let names = () if type(name) == str { names = ((name, name-pos),) } else if type(name) == array { names = ( (name.at(0), "start"), (name.at(1), "end") ) } for (name, pos) in names { let point let anchor if pos == "middle" { point = (first-pt, 50%, last-pt) anchor = "south" } else if pos == "start" { point = first-pt anchor = "south-west" } else if pos == "end" { point = last-pt anchor = "south-east" } draw.content(point, anchor: anchor, padding: 3pt, angle: angle, name) } } if slice != none { let slice-txt = "[" + slice.map(b => str(b)).join(":") + "]" draw.content( first-pt, anchor: "south-west", padding: 3pt, text(slice-txt, size: 0.75em) ) } }) /// Draws a wire stub (useful for unlinked ports) /// /// #examples.stub /// - port-id (str): The port anchor /// - side (str): The side on which the port is (one of "north", "east", "south", "west") /// - name (none, str): Optional name displayed at the end of the stub /// - vertical (bool): Whether the name should be displayed vertically /// - length (number): The length of the stub /// - name-offset (number): The name offset, perpendicular to the stub #let stub(port-id, side, name: none, vertical: false, length: 1em, name-offset: 0) = { let end-offset = ( north: (0, length), east: (length, 0), south: (0, -length), west: (-length, 0) ).at(side) let name-offset = ( north: (name-offset, length), east: (length, name-offset), south: (name-offset, -length), west: (-length, name-offset) ).at(side) draw.line( port-id, (rel: end-offset, to: port-id) ) if name != none { let text-anchor = if vertical { ( "north": "west", "south": "east", "west": "south", "east": "north" ).at(side) } else { opposite-anchor(side) } draw.content( anchor: text-anchor, padding: 0.2em, angle: if vertical {90deg} else {0deg}, (rel: name-offset, to: port-id), name ) } }
https://github.com/donabe8898/typst-slide
https://raw.githubusercontent.com/donabe8898/typst-slide/main/opc/Algorithm/template.typ
typst
MIT License
// The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project( title: "", subtitle:"", authors: (), date: none, logo: none, body, ) = { // Set the document's basic properties. set document(author: authors.map(a => a.name), title: title) set text(font: "Linux Libertine", lang: "ja") set heading(numbering: "1.1") set page( margin: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm), number-align: center, ) // Title page. // The page can contain a logo if you pass one with `logo: "logo.png"`. v(0.6fr) if logo != none { align(right, image(logo, width: 26%)) } v(9.6fr) text(1.1em, date) v(2em, weak: true) text(2em, weight: 700, title) v(0.5em) text(1.5em, weight: 300, subtitle) // Author information. pad( top: 0.7em, right: 20%, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(start)[ *#author.name* \ // #author.discord ]), ), ) v(2.4fr) pagebreak() // Main body. set par(justify: true) body }
https://github.com/pauladam94/curryst
https://raw.githubusercontent.com/pauladam94/curryst/main/examples/usage.typ
typst
MIT License
#import "../curryst.typ": rule, proof-tree #set document(date: none) #set page(width: auto, height: auto, margin: 0.5cm, fill: white) #let tree = rule( label: [Label], name: [Rule name], [Conclusion], [Premise 1], [Premise 2], [Premise 3] ) #proof-tree(tree)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/example/0.1.0/README.md
markdown
Apache License 2.0
# example An example package demonstrating the structure of a Typst package. Displays the text "This is an example!" when included and exports four functions `add`, `sub`, `mul`, and `div` that perform the respective mathematical operations on two operands.
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/01-number-theory/06-coprimes.typ
typst
Other
#import "../../utils/core.typ": * == ะ’ะทะฐะธะผะฝะพ ะฟั€ะพัั‚ั‹ะต ั‡ะธัะปะฐ #def[ ะงะธัะปะฐ $a$ ะธ $b$ ะฝะฐะทั‹ะฒะฐัŽั‚ัั ะฒะทะฐะธะผะฝะพ ะฟั€ะพัั‚ั‹ะผะธ, ะตัะปะธ $gcd(a, b) = 1$. $a bot b$ --- ัะพะบั€ะฐั‰ะตะฝะฝะฐั ะทะฐะฟะธััŒ ะดะปั ะพะฑะพะทะฝะฐั‡ะตะฝะธั ะฒะทะฐะธะผะฝะพะน ะฟั€ะพัั‚ะพั‚ั‹. ] #pr[ + ะŸัƒัั‚ัŒ $a, b in ZZ$, ั‚ะพะณะดะฐ $a bot b <==> exists m, n in ZZ: a m + b n = 1$. + $a_1 bot b, space a_2 bot b ==> a_1a_2 bot b$. + $cases( a_1\, ...\, a_m in ZZ, b_1\, ...\, b_n in ZZ )$ ะธ $forall i, j: space a_i bot b_j ==> a_1 ... a_m bot b_1 ... b_n$. + $a divides b c, space a bot b ==> a divides c$. + $a x equiv_(m) a y, space a bot m ==> x equiv_(m) y$. + $gcd(a, b) = d ==> a = d a', space b = d b', space a' bot b'$. ] #proof[ + $m$ ะธ $n$ ััƒั‰ะตัั‚ะฒัƒัŽั‚ ัะพะณะปะฐัะฝะพ ะปะธะฝะตะนะฝะพะผัƒ ะฟั€ะตะดัั‚ะฐะฒะปะตะฝะธัŽ ะะžะ”. $d = gcd(a, b), space d divides a, space d divides b ==> d divides (a m + b n) = 1 ==> d divides 1 ==> d = 1$. + $cases( 1 = a_1 m_1 + b n_1, 1 = a_2 m_2 + b n_2 ) limits(==>)^("ะฟะตั€ะตะผะฝะพะถะธะผ") 1 = a_1 a_2 (m_1 m_2) + b(a_1 m_1 n_2 + a_2 m_2 n_1+b n_1 n_2) ==> a_1 a_2 bot b$. + $cases( a_1 bot b, space.quad dots.v, a_n bot b ) ==> a_1 ... a_n bot b$ $cases( a_1 ... a_n bot b_1, space.quad ..., a_1 ... a_n bot b_n ) ==> a_1 ... a_n bot b_1 ... b_n$ + $1 = a m + b n ==> c = a c m + b c n$ $a divides a c m, space a divides b c n ==> a divides c$. + $m divides (a x - a y), space a bot m ==> m divides (x - y) ==> x equiv_(m) y$. + $d divides a, space d divides b ==> cases( a = d a', b = d b' ) :space.quad a', b' in ZZ$ $d = a m + b n, space.quad m, n in ZZ$ $d = 0 ==> a' = b' = 0 = d a'm + d b'm$ $d eq.not 0 ==> 1 = a'm + b'n ==> a' bot b'$. ]
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/24.typ
typst
#import "../conf.typ": * = ะ›ะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ, ะฑะฐะทะธั ะธ ั€ะฐะทะผะตั€ะฝะพัั‚ัŒ. ะ›ะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต ะบะพะฝะตั‡ะฝะพะผะตั€ะฝั‹ั… ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒ, ะตะณะพ ะผะฐั‚ั€ะธั†ะฐ. == ะ›ะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ, ะฑะฐะทะธั ะธ ั€ะฐะทะผะตั€ะฝะพัั‚ัŒ #definition[ ะŸัƒัั‚ัŒ $V$ -- ะปะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ ะฝะฐะด $FF; bold(v_1), ..., bold(v_k) in V$. *ะ›ะธะฝะตะนะฝะพะน ะพะฑะพะปะพั‡ะบะพะน* ะฒะตะบั‚ะพั€ะพะฒ $bold(v_1), ..., bold(v_k)$ ะฝะฐะทั‹ะฒะฐะตั‚ัั ะผะฝะพะถะตัั‚ะฒะพ ะปะธะฝะตะนะฝั‹ั… ะบะพะผะฑะธะฝะฐั†ะธะน ัั‚ะธั… ะฒะตะบั‚ะพั€ะพะฒ: #eq[ $angle.l bold(v_1), ..., bold(v_k) angle.r := {sum_(i = 1)^k alpha_i bold(b_i) | alpha_1, ..., alpha_k in FF }$ ] ] #definition[ ะ›ะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ $V$ ะฝะฐะทั‹ะฒะฐะตั‚ัั *ะบะพะฝะตั‡ะฝะพะฟะพั€ะพะถะดั‘ะฝะฝั‹ะผ*, ะตัะปะธ ััƒั‰ะตัั‚ะฒัƒัŽั‚ ะฒะตะบั‚ะพั€ั‹ $bold(v_1), ..., bold(v_n) in V$ ั‚ะฐะบะธะต, ั‡ั‚ะพ #eq[ $angle.l bold(v_1), ..., bold(v_n) angle.r = V$ ] ] #definition[ ะŸัƒัั‚ัŒ $V$ -- ะบะพะฝะตั‡ะฝะพะฟะพั€ะพะถะดั‘ะฝะฝะพะต ะปะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ. ะ•ะณะพ *ั€ะฐะทะผะตั€ะฝะพัั‚ัŒัŽ* ะฝะฐะทั‹ะฒะฐะตั‚ัั ะบะพะปะธั‡ะตัั‚ะฒะพ ะฒะตะบั‚ะพั€ะพะฒ ะฒ ะปัŽะฑะพะผ ะตะณะพ ะฑะฐะทะธัะต. ะžะฑะพะทะฝะฐั‡ะตะฝะธะต -- $dim V$. ] == ะ›ะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต ะบะพะฝะตั‡ะฝะพะผะตั€ะฝั‹ั… ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒ, ะตะณะพ ะผะฐั‚ั€ะธั†ะฐ #definition[ ะŸัƒัั‚ัŒ $U, V$ -- ะปะธะฝะตะนะฝั‹ะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะฐ ะฝะฐะด ะฟะพะปะตะผ $FF$. *ะ›ะธะฝะตะนะฝั‹ะผ ะพั‚ะพะฑั€ะฐะถะตะฝะธะตะผ*, ะธะปะธ *ะปะธะฝะตะนะฝั‹ะผ ะพะฟะตั€ะฐั‚ะพั€ะพะผ* ะฝะฐะทั‹ะฒะฐะตั‚ัั ะพั‚ะพะฑั€ะฐะถะตะฝะธะต $phi: U -> V$, ะพะฑะปะฐะดะฐัŽั‰ะตะต ัะฒะพะนัั‚ะฒะพะผ ะปะธะฝะตะนะฝะพัั‚ะธ: - $forall bold(u_1), bold(u_2) in U : space phi(bold(u_1) + bold(u_2)) = phi(bold(u_1)) + phi(bold(u_2))$ - $forall alpha in FF : forall bold(u) in U : space phi(alpha bold(u)) = alpha phi(bold(u))$ ] #definition[ ะŸัƒัั‚ัŒ $phi: U -> V$ -- ะปะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต - *ะžะฑั€ะฐะทะพะผ* ะพั‚ะพะฑั€ะฐะถะตะฝะธั $phi$ ะฝะฐะทั‹ะฒะฐะตั‚ัั $"Im" phi := phi(U)$ - *ะฏะดั€ะพะผ* ะพั‚ะพะฑั€ะฐะถะตะฝะธั $phi$ ะฝะฐะทั‹ะฒะฐะตั‚ัั $"Ker" phi := {bold(u) in U | phi(bold(u)) = bold(0) }$ ] #proposition[ ะŸัƒัั‚ัŒ $phi: U -> V$ -- ะปะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต, $e = (bold(e_1), ..., bold(e_k))$ -- ะฑะฐะทะธั ะฒ ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะต $U$. ะขะพะณะดะฐ #eq[ $"Im" phi = angle.l phi(bold(e_1)), ..., phi(bold(e_k)) angle.r$ ] ] #proof[ $subset$ ะ›ัŽะฑะพะน ะฒะตะบั‚ะพั€ $bold(u) in U$ ะฟั€ะตะดัั‚ะฐะฒะปัะตั‚ัั ะฒ ะฒะธะดะต ะปะธะฝะตะนะฝะพะน ะบะพะผะฑะธะฝะฐั†ะธะธ ะฑะฐะทะธัะฝั‹ั… ะฒะตะบั‚ะพั€ะพะฒ, ะฟะพัั‚ะพะผัƒ ะฟะพ ะปะธะฝะตะนะฝะพัั‚ะธ $phi(bold(u)) in angle.l phi(bold(e_1)), ..., phi(bold(e_k)) angle.r$ $supset$ ะ’ัะต ะฒะตะบั‚ะพั€ั‹ $phi(bold(e_1)), ..., phi(bold(e_k))$ ะปะตะถะฐั‚ ะฒ $"Im" phi$ ะธ $"Im" phi$ -- ะปะธะฝะตะนะฝะพะต ะฟั€ะพัั‚ั€ะฐะฝัั‚ะฒะพ, ะฟะพัั‚ะพะผัƒ $angle.l phi(e) angle.r subset "Im" phi$ ] #definition[ ะŸัƒัั‚ัŒ $phi: U -> V$ -- ะปะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต. ะขะพะณะดะฐ ะพะฝะพ ะฝะฐะทั‹ะฒะฐะตั‚ัั *ะธะฝัŠะตะบั‚ะธะฒะฝั‹ะผ*, ะตัะปะธ #eq[ $forall bold(v) in "Im" phi : exists! bold(u) in U : space phi(bold(u)) = bold(v)$ ] ] #proposition[ ะŸัƒัั‚ัŒ $phi: U -> V$ -- ะปะธะฝะตะนะฝะพะต ะพั‚ะพะฑั€ะฐะถะตะฝะธะต. ะขะพะณะดะฐ #eq[ $phi "ะธะฝัŠะตะบั‚ะธะฒะฝะพ" <=> "Ker" phi = {bold(0)}$ ] ] #proof[ $=>$ ะ•ัะปะธ $phi$ ะธะฝัŠะตะบั‚ะธะฒะฝะพ, ั‚ะพ ััƒั‰ะตัั‚ะฒัƒะตั‚ ะตะดะธะฝัั‚ะฒะตะฝะฝั‹ะน ะฒะตะบั‚ะพั€ $bold(0) in U$, ะดะปั ะบะพั‚ะพั€ะพะณะพ $phi(bold(u)) = bold(0)$. $arrow.l.double$ ะžั‚ ะฟั€ะพั‚ะธะฒะฝะพะณะพ. ะŸัƒัั‚ัŒ ะดะปั ะฝะตะบะพั‚ะพั€ั‹ั… $bold(u_1), bold(u_2) in U$ ะฒั‹ะฟะพะปะฝะตะฝะพ $phi(bold(u_1)) = phi(bold(u_2))$, ั‚ะพะณะดะฐ $phi(bold(u_1) - bold(u_2)) = bold(0)$, ะพั‚ะบัƒะดะฐ $bold(u_1) - bold(u_2) = bold(0) => bold(u_1) = bold(u_2)$ ]
https://github.com/Otto-AA/dashy-todo
https://raw.githubusercontent.com/Otto-AA/dashy-todo/main/example.typ
typst
MIT No Attribution
#import "lib/todo.typ": todo #set page(width: 16cm, height: 10cm, margin: (left: 20%, right: 20%), fill: white) #show link: underline = Dashy TODOs TODOs are automatically positioned on the closer#todo[On the right] side to the method call.#todo[On the left] If it doesn't fit, you can manually override it. You can add custom content.#todo(position: right)[We need to fix the $lim_(x -> oo)$ equation. See #link("https://example.com")[example.com]] #let small-todo = (..args) => text(size: 0.6em)[#todo(..args)] We can also control the text #small-todo[This will be in fine print]size if we wrap it in a `text` call. And finally, you can create a table of all your TODOs: #outline(title: "TODOs", target: figure.where(kind: "todo"))
https://github.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024/master/Vex%20Robotics%2053A%20Notebook%202023%20-%202024/Entries/Code%20Entry/Autonomous-Testing.typ
typst
#set page(header: [ZZ #h(1fr) November 30, 2023 ]) = AUTONOMOUS DRIVE CODE + AUTON TESTING \ #figure(image("/Images/Code Images/MoveBotMain.png", width: 80%), caption: [MoveBot function used to move forward and backward]) === MoveBot
https://github.com/HellOwhatAs/whiledb-typ
https://raw.githubusercontent.com/HellOwhatAs/whiledb-typ/main/typst-package/lib.typ
typst
#let whiledb-wasm = plugin("whiledb_typ.wasm") #let whiledb_exec(src, stdin: "") = { let res = whiledb-wasm.whiledb_exec(bytes(src), bytes(stdin)); let err_flag = res.at(res.len() - 1) != 0; let result = str(res.slice(0, count: res.len() - 1)); (err: err_flag, result: result) }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/array-02.typ
typst
Other
// Test lvalue and rvalue access. #{ let array = (1, 2) array.at(1) += 5 + array.at(0) test(array, (1, 8)) }
https://github.com/a-mhamdi/graduation-report
https://raw.githubusercontent.com/a-mhamdi/graduation-report/main/Typst/README.md
markdown
MIT License
![Typst](./typst.svg) ![Guide](./Guide.svg) The ebook at [https://sitandr.github.io/typst-examples-book/book/about.html](https://sitandr.github.io/typst-examples-book/book/about.html), provides an extended tutorial and many `Typst` code snippets to write well you document.
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/็ปๆตŽๅญฆๅŽŸ็†/hw/hw14.typ
typst
#import "../../template.typ": * #show: note.with( title: "ไฝœไธš14", author: "YHTQ ", date: none, logo: none, withOutlined: false, withTitle: true ) = D ๆฒกๆœ‰ไบง็”Ÿๆœช่ขซไปทๆ ผ่กก้‡็š„ๅฝฑๅ“ = C = A ๆ—ข็ซžไบ‰ไนŸๆŽ’ไป– = A ไฟ้™ฉๅ•†ๅฎถ่‹ฅๆ— ๆณ•ๅˆ†่พจๆŠ•ไฟไบบๅฅๅบท้ฃŽ้™ฉ๏ผŒๅˆ™ไผšๅฏผ่‡ดๅฅๅบท้ฃŽ้™ฉ่พƒ้ซ˜่€…ๆ›ดๅคšๆŠ•ไฟๅฏผ่‡ดไฟ้™ฉๅดฉๆบƒ = == ็”ฑไบคๆ˜“็š„ๆœ‰ๆ•ˆๆ€ง $ 1/(p_y) partialDer(U_i, y) = 1/(p_x) partialDer(U_i, x) <=> 1/(p_y) 0.7 (x_1/y_1)^(0.3) = 1/(p_x) 0.3 (y_1/x_1)^(0.7)\ 1/(p_y) partialDer(U_j, y) = 1/(p_x) partialDer(U_j, x) <=> 1/(p_y) 0.5 (x_2/y_2)^(0.5) = 1/(p_x) 0.5 (y_2/x_2)^(0.5)\ p_x / p_y = y_2 / x_2 = 3 / 7 y_1 / x_1 $ ๅŒๆ—ถ๏ผŒๅ‡่ฎพๅŒๆ–น็”Ÿไบง $x, y$ ็š„ๆ—ถ้—ดๅˆ†ๅˆซไธบ $X_i, X_j, Y_i, Y_j$๏ผŒ็”ฑๅธ‚ๅœบๅ‡บๆธ…ไปฅๅŠ็”Ÿไบง็š„ๆœ‰ๆ•ˆๆ€ง๏ผš $ X_i + Y_i = 10\ X_j + Y_j = 10\ x_1 + x_2 = 2(X_i + X_j)\ y_1 + y_2 = 3(Y_i + Y_j)\ 2/3 = "MC"_X^i/"MC"_Y^i = p_x/p_y = "MC"_X^j/"MC"_Y^j\ $ == (2) ๅผๅฏๅพ—๏ผš $ 3(x_1 + x_2) + 2(y_1 + y_2) = 6(X_i + X_j + Y_i + Y_j) = 120 $ (1) ๅผๅฏๅพ—๏ผš $ 2/3= (3y_2) / (3x_2) = 3 / 7 y_1 / x_1 = (3y_1 + 3y_2)/(3x_2 + 7x_1) = (360 - 9 x_1 - 9x_2)/(14x_1+6x_2) $
https://github.com/dyc3/senior-design
https://raw.githubusercontent.com/dyc3/senior-design/main/lib/misc.typ
typst
#let github(repo, number) = { link("https://github.com/" + repo + "/issues/" + str(number))[#repo\##number] } = Testing #show link: underline #github("rust-lang/rust", 1234)
https://github.com/alerque/polytype
https://raw.githubusercontent.com/alerque/polytype/master/data/hello-world/typst.typ
typst
#set page (numbering: "1") Hello World
https://github.com/iMilesHo/resume-template-typst
https://raw.githubusercontent.com/iMilesHo/resume-template-typst/main/template.typ
typst
Apache License 2.0
// const color for let the resume look better #let color_darknight = rgb("#131A28") // const font #let the_name_font = "Source Sans Pro" #let the_font = "Source Serif Pro" #let header_font = "Times New Roman" #let SeparationLine() = { v(-10pt); line(length: 100%, stroke: 0.5pt + black); v(-1pt) } #let experienceBlock( title: "", titleLink: "", subtitle: "", startDate: "", endDate: "", address: "", content ) = { block( inset: (left: 0pt), if titleLink == "" { text(strong(title), style: "normal", font: "Times New Roman") } else { text(strong(box[#link(titleLink)[#title]]), style: "normal", font: header_font) } + h(1fr) + text(startDate, style: "normal", font: header_font) + [ -- ] + text(endDate, style: "normal", font: header_font) + if subtitle != "" { linebreak() + text(subtitle, style: "italic", font: header_font) + h(1fr) + text(address, style: "italic", font: header_font) } + if content != "" { linebreak() + content } ) } #let resumeContent(author: (), date: "", body) = { set document( author: author.firstname + " " + author.lastname, title: "resume", ) set text( font: the_font, lang: "en", size: 11pt, fill: color_darknight, fallback: false, ) set page( paper: "a4", margin: (left: 8mm, right: 8mm, top: 8mm, bottom: 8mm) ) // set paragraph spacing let linespacing = 0.72em set par(justify: true, leading: linespacing) // set link style show link: it => underline(offset: 2pt, it) // set list heading spacing set list(indent: 0pt) // set header style set heading( numbering: none, outlined: true, ) show heading.where( level: 2 ): it => text( size: 12pt, weight: "bold", block( text(upper(it), font: header_font) + SeparationLine(), ) ) // set your name style let name = { align(center)[ #pad(bottom: 0pt)[ #block[ #set text(font:the_name_font,size: 24pt, style: "normal") #text(weight: "regular")[#author.firstname] #text(weight: "regular")[#author.lastname] ] ] ] } // set your contacts style let contacts = { set box(height: 11pt) let linkedin_icon = box(image("/icons/linkedin.svg")) let github_icon = box(image("/icons/square-github.svg")) let email_icon = box(image("/icons/square-envelope-solid.svg")) let phone_icon = box(image("/icons/square-phone-solid.svg")) let separator = box(width: 3pt)[|] align(center)[ #block[ #align(horizon)[ #phone_icon #box[#link("tel:" + author.phone)[#author.phone]] #separator #email_icon #box[#link("mailto:" + author.email)[#author.email]] #separator #github_icon #box[#link("https://" + author.github)[#author.github]] #separator #linkedin_icon #box[ #link("https://www." + author.linkedin)[#author.linkedin] ] ] ] ] } name contacts body } #let today() = { let month = ( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ).at(datetime.today().month() - 1); let day = datetime.today().day(); let year = datetime.today().year(); [#month #day, #year] }
https://github.com/MultisampledNight/flow
https://raw.githubusercontent.com/MultisampledNight/flow/main/src/doc/manual.typ
typst
MIT License
#import "../lib.typ" as flow: * #let cb(marker, to-desc, it) = { let icon = gfx.markers.at(marker).icon link(to-desc)[#icon() #it] } #show: note.with( title: "flow manual", aliases: "how to procastinate", author: "MultisampledNight", cw: "\"you\"", keywords: ( "not started": cb.with(" ", <not-started>), "urgent": cb.with("!", <urgent>), "in progress": cb.with(">", <in-progress>), "paused": cb.with(":", <paused>), "completed": cb.with("x", <completed>), "cancelled": cb.with("/", <cancelled>), "blocked": cb.with("-", <blocked>), "unknown": cb.with("?", <unknown>), ), ) #let normal = text.with(font: "IBM Plex Sans") #show raw.where(lang: "example"): it => { let code = it.text let label(body) = emph(dim(normal(body + v(-0.5em)))) grid( columns: (1fr, 1fr), align: (top + left, left), gutter: 1em, label[Typst code:] + raw(lang: "typ", block: true, code), label[Rendered result:] + block( stroke: fg, radius: 0.5em, inset: 0.5em, width: 100%, normal(eval( mode: "markup", scope: dictionary(flow), code, )) ), ) } = Introduction Hi there! This document serves as a long-form manual for the use of flow. Flow is the template I use as basis for my own #fxfirst("Personal Knowledge Management") system. It has the batteries of countless Typst documents written and hacks done included. This can make it quite overwhelming, but don't worry! You don't need to know everything about it in order to start using it. This manual assumes you already know #link("https://typst.app")[Typst] a bit โ€” if you don't, that's absolutely no problem! Just head on over to the excellent #link("https://typst.app/docs/tutorial/")[Typst tutorial], I can guarantee you it is worthy of your time. #hint[ While you can use flow mostly without worrying about the internals, chances are that this template is actually overkill for your specific needs and desires! Hence, consider using flow as inspiration to consider, not as the ultimate goal to strive for. Feel free to take what you think is useful. Ideally, even introspect and improve on it. Learning is highly individual, and so are PKMs. Find a solution that fits *you*. :3 ] = How do I get started? + Clone this repository into `{data-dir}/typst/packages/local/flow/0.1.0` - where `{data-dir}` is - on Linux: `$XDG_DATA_HOME` if set, otherwise `$HOME/.local/share` - on macOS: `sh $HOME/Library/Application Support` - on Windows: `%APPDATA%` (taken from https://github.com/typst/packages?tab=readme-ov-file#local-packages) + Use the the following boilerplate in your note: ```typ #import "@local/flow:0.1.0": * #show: note ``` + Start typing the actual note like any other typst document! uwu = Reference == Template The `#show: note` you usually put at the top of your file is already functional without any further configuration. However, sometimes one _does_ want further configuration. Behind the scenes, `note` is actually a shorthand for `template.note`. There are other useful templates in `template`, but notably they all use `template.generic` at their core. === Arguments <arguments> All of these are named arguments. In effect, if you choose to use any of them, most likely you want to transform your `#show: note` into a #link("https://typst.app/docs/reference/foundations/function/#definitions-with")[`function.with`] call, for example: ```typst #show: note.with( title: "meow!", keywords: ("cat", "catnip"), ) ``` Since `template.generic` is the actual processor of these arguments, you can use them with any other template in the `template` module as well! ==== `title` A string. It is encoded into the resulting PDF as the document title you usually see in the window title of the PDF viewer. A template might also display this somewhere, but this is not requird. If it is not specified or `none` is passed, the filename passed via `--input filename=...` on the CLI has its extension trimmed and is used instead. Otherwise, if `--input filename=...` has not been passed, `"Untitled"` is used as a last-resort default. Given that it is usually the first thing the reader sees, it should try to very concisely relay what the document is about. ==== `keywords` Either an array of strings or a dictionary from strings to functions, where each function takes exactly one positional argument. Which words to highlight specially in the document. Think of it as a short-hand for show rules, but for individual words, handling capitalization and word boundaries for you. The function is the content with the word given to and it is supposed to return what should be displayed in-place. If it's an array, all items become keys with the `strong` function as value. None are highlighted by default. It is not included in the metadata table. === Kinds All of them are available under the `template` module and intended to be used via show rules. For example, for using the `latex-esque` template, you'd use something akin to this in your code: ```typst #show: template.latex-esque ``` ==== `generic` The core driver behind all templates. Feel free to use this as base for your own templates! Specifically, it sets up the following: - Basic styling according to the chosen theme - Processing of - Checkboxes - Keywords - Metadata Note that the styling does include colors and a few layout hints, but does notably *not* set the font or font size. That's something each template does itself. ==== `note` Usable for notes, short reports, quick sketchups and the works. Sets up a nice boilerplate showing the document title, metadata and an outline. ==== `latex-esque` Usable for faking something was made in LaTeX when it actually wasn't. Only does so superficially, functionally nothing is changed and the icons will still look modern-ish. ==== `slides` Splits the document into slides by using the headings. See the dedicated section about slides, @slides, for details. Has a large, readable font size and a progress bar at the bottom of every slide, so viewers know much longer the presentation will go. === Metadata / Metadata: Data about data. Sometimes it might be useful to denote information _about_ the document you're writing which doesn't quite belong into the document itself. Quite often this is also information you might wish to programmatically search for. An example of this are aliases of what you're writing about. Sometimes they are just like the title, but you can have only one title, so they need to be put somewhere else. Metadata is _perfect_ for this. You can specify metadata by passing any additional named arguments that are not named under @arguments to your chosen template (as long as it is from flow, that is). ==== Checking Theoretically, metadata can be literally anything. Practically though a few commonly used metadata fields and their types crystallize out, and if one notices that afterwards it takes quite a while to get everything into order again. For this reason, the metadata you specify is checked against a schema. The schema is lax โ€” if you specify fields it doesn't know of, it will allow them anyway. The schema currently is: #raw(block: true, tyck.fmt(info._schema)) It's checked via the `tyck` module, which you can also use to construct your own schemas and validating them. ==== Querying In order to actually get the metadata out of one document, you can use the `typst query` command in a script. Specifically, querying for the `<info>` label yields all metadata you've specified. For getting to the actual metadata, you probably want to pass `--one --field value`, which results in the JSON of what you've specified (plus some normalization). ===== Accelerating If you've tried to `typst query` on a flow document without anything else, you've probably noticed that it is quite slow. That is mostly because Typst just compiles the whole document like it would when actually rendering it to a PDF and just queries for what you've specified afterwards. Hence, here are a few tips to speed things up significantly: - Pass `--input render=false`. Flow will use this to avoid large imports, not render diagrams, layout everything in a "whatever" way as well as do several smaller things. - Restrict what paths Typst should search fonts in. For example, you could try running Typst under a fake root to make sure it does not enumerate all system fonts (which it would do otherwise). == Task / Task: Checkbox at the very beginning of a list item or enumeration item. / Checkbox: Opening bracket, one fill character or space, closing bracket. Task lists allow you to gain a quick overview regarding where you are right now, what is actionable, what to next and what you can't do right now. They are useful as an *anchor point*, a single source of truth for yourself to check what you are doing right now. For longer-form tasks and projects, you might want to consider using more specialized software like the ones emulating e.g. Kanban boards. === Using them Just type a list or enum like you're used to (using e.g. `-` or `+`), then put the desired checkbox right afterwards and pad it with spaces. That's it! ```example - [ ] We didn't even start this yet - [!] Needs to be done soon - [>] Doing that currently... - [:] Can already build on something - [x] Yay, finished this! - [/] Can't do this anymore - [-] Out of my control - [?] Should find out more about it ``` === Fill semantics The variable $p in [0, 1] union RR$ represents the hypothetical current progress of that task, where $0$ is no progress done yet and $1$ is fully finished. This is a model: In reality, progress is rarely well quantifiable. Hence, see these semantics merely as a suggestion. #table( columns: 5, align: left, inset: 0.5em, [_Name_], [_Fill_], [$p in ...$], [_Assigned to?_], [_Actionable by you?_], ..( ([Not started], " ", [${ 0 }$], [Nobody yet], [Yes]), ([Urgent], "!", [$[ 0, 1 )$], [You], [Yes]), ([In progress], ">", [$[ 0, 1 )$], [You], [Yes]), ([Paused], ":", [$( 0, 1 )$], [You], [Yes]), ([Completed], "x", [${ 1 }$], [Nobody], [No]), ([Cancelled], "/", [$[ 0, 1 )$], [Nobody], [No]), ([Blocked], "-", [$[ 0, 1 )$], [Not you], [No]), ([Unknown], "?", [$[ 0, 1 ]$], [Maybe you], [Maybe]), ) .map(((name, fill, ..args)) => ( name, raw("[" + fill + "]"), ..args, )).join() ) ==== Not started <not-started> - No progress done yet - May be started by anyone, possibly you ==== Urgent <urgent> - Should be prioritized when selecting next tasks to put in progress - Consider putting tasks currently in progress on pause for this instead - Requires time-sensitive action - Otherwise like not started ==== In progress <in-progress> - Not finished yet, but being worked on - The point you look for when you try to remember what you were doing again - Ideally keep the count of those as low as possible, if not even just 1 ==== Paused <paused> - Some progress already done - Can be continued anytime - Probably some notes flying around already ==== Completed <completed> - Was fully fulfilled - Nothing needs to be done anymore ==== Cancelled <cancelled> - Doesn't need or can't be fulfilled anymore - Can be just ignored ==== Blocked <blocked> - Cannot be continued by you for the moment - Maybe just some time has to pass, maybe somebody else is working on it - Either way, not your responsibility for the moment ==== Unknown <unknown> - Maybe some progress is already done, maybe none, maybe it's actually complete - Maybe it is your responsibility, maybe someone else's - Need to acquire more information to put it into a "proper" category - Try to have as few of these as possible as they make planning quite difficult - And you might miss things that were your job === More examples of tasks ```example - [ ] you _can_ be extra spacious - [?] this is long: #lorem(20) + [ ] Task lists can also be ordered! + [x] And advance as normal! - [>] This is a large parent task! + [x] Which can have subtasks! + [>] With even more nesting! + [ ] Like here! + [ ] And here! - [ ]No space between checkbox and description necessary! ``` === Examples of non-tasks They are still completely fine text! Their checkboxes are just not rendered. ```example - Still just a normal list entry - [Bracketized, but fill must be 1 char] - [[Well, 1 grapheme cluster :3]] - [] Fill must not be empty - [ [ The brackets must be opposite -[ ] Space must be before checkbox qwq ``` == Callout Callouts compress important statements and highlight them according to their semantic content. Documents are usually not read linearly, these callouts will stand out and let the reader pay more attention. They can also serve as visual anchors for navigation in a document for already read parts. Hence, use them wisely: If everything is highlighted, nothing is highlighted. === Question ```example #question[ Something that is still to be examined. ] ``` === Remark ```example #remark[ Key takeaways from a section. \ Should be easy to remember. ] ``` === Hint ```example #hint[ How to do something more easily. \ Or something that can be used to remember this better. ] ``` === Caution ```example #caution[ Tries to warn the reader of something important or dangerous. ] ``` == Effect Can highlight that some text is really important. === Invert ```example What if I told you a story about visiting a very #invert[spooky] place? ``` For when you need to add #invert[extra importance] to some text. Note that #invert[it should always fit on one line though, otherwise it'll go out of page like this one.] #v(2.5em, weak: true) #invert[ (Or if you really want to use a manual line break, \ well, the one parallelopiped goes over the whole body. \ Is that what you wanted?) ] #v(2.5em, weak: true) Hence it is best fit for #invert[a few words.] === Affect first Highlights the first character of each word in the given string. Useful for introducing specific terms and highlighting what their abbreviation is. ```example #fxfirst("Personal Knowledge Management") systems facilitate surviving in an age of overload. When reading, #fxfirst( "they felt quite woozy,", fx: text.with(1.5em), ) after having found out about the #fxfirst( "numerous effects possible.", fx: emph, ) ``` == Diagram / Diagram: Visually explains a certain concept in a canvas, usually in the context of accompanying text. / State: Frozen state of certain properties. Usually represented by a node. / Transition: Properties changing from one state to another. Usually represented by an edge. / Canvas: Set of elements drawn into a confined `content`. Some minds like to build graphical representations of thought models in addition to having them just described in text. Diagrams fill this role. They are useful as a second line for conveying concepts. They do not replace a text description though: Since Typst doesn't support PDF accessibility yet, it is highly recommended that they don't add any new information that isn't in the text already. Ultimately though your documents are your documents, so use them as you see fit. === Using them For drawing, manipulating and connecting shapes, the `gfx` module is your friend, which re-exports #link("https://typst.app/universe/package/cetz")[cetz] and adds neat helpers. Assumed you've glob-imported all out of `flow`, the usual boilerplate for a diagram looks like this: ```example A typical rock-paper-scissors game consists of all players deciding for one of *rock*, *paper* or *scissors*, where: #let rock = oklch(60%, 0.2, 60deg) #let paper = rock.rotate(120deg) #let scissors = paper.rotate(120deg) + #text(rock)[*Rock*] loses to #text(paper)[*paper*] + #text(paper)[*Paper*] loses to #text(scissors)[*scissors*] + #text(scissors)[*Scissors*] loses to #text(rock)[*rock*] #import gfx.draw: * #let beats(it) = tag( it, tag: emph(text(0.8em)[beats]), anchor: "south", angle: it, padding: 0.1, ) #gfx.diagram( nodes: ( rock: ( pos: (angle: -150deg, radius: 1), accent: rock, ), paper: ( pos: (angle: -30deg, radius: 1), accent: paper, ), scissors: ( pos: (angle: 90deg, radius: 1), accent: scissors, ), ), edges: ( paper: beats("rock"), scissors: beats("paper"), rock: beats("scissors"), ), length: 4em, ) ``` == Slides <slides> #caution[ help actually implement ]
https://github.com/tingerrr/chiral-thesis-fhe
https://raw.githubusercontent.com/tingerrr/chiral-thesis-fhe/main/src/prelude.typ
typst
// NOTE: these are largely used for styling configuration which will be done // with set rules once custom types exist #import "prelude/subpar.typ" #import "prelude/lovelace.typ" #let ( // helper functions chapter, q, i18n, smartcap, // glossarium re-exports glossarium, gls, glspl, // lovelace re-exports algorithm, line-label, // template doc, // kinds report, bachelors-thesis, masters-thesis, ) = { import "core.typ" as _core import "packages.typ" as _pkg import "utils.typ" as _utils ( _utils.chapter, _utils.quote-omission, _utils.i18n, _utils.smart-caption, _pkg.glossarium, _pkg.glossarium.gls, _pkg.glossarium.glspl, lovelace.pseudocode-list, lovelace.line-label, _core.doc, _core.kinds.report, _core.kinds.thesis.with(kind: _core.kinds.kinds.thesis-bachelor), _core.kinds.thesis.with(kind: _core.kinds.kinds.thesis-master), ) }
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/PianificazioneSprint/QuattordicesimoSprint.typ
typst
MIT License
#import "../../functions.typ": glossary === Quattordicesimo #glossary[sprint] *Inizio*: Venerdรฌ 22/03/2024 *Fine*: Giovedรฌ 28/03/2024 *Obiettivi dello #glossary[sprint]*: - Proseguire la stesura del _Piano di Progetto_: - Aggiornare pianificazione e preventivo pertinente allo #glossary[sprint] 14 e inserire il consuntivo pertinente allo #glossary[sprint] 13; - Aggiornare l'_Analisi dei Requisiti_ aggiungendo maggior dettaglio a casi d'uso e requisiti per riflettere i dettagli implementativi sviluppati nella creazione del #glossary[MVP]\; - Proseguire la stesura della _Specifica Tecnica_: - Aggiungere una sezione dedicata alla struttura dei containers Docker utilizzati per gestire l'ambiente di sviluppo e produzione; - Aggiornare gli schemi delle tabelle del database in #glossary[Clickhouse] con le query utilizzate nel #glossary[MVP]\; - Aggiungere una sezione dedicata alle #glossary[dashboard] in #glossary[Grafana] e al sistema di allerte/notifiche; - Raffinare l'aspetto estetico delle #glossary[dashboard] finali in #glossary[Grafana] e inserire un numero adeguato di sensori con locazioni realistiche.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/numbers_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test integers. #12 \ #1234567890 \ #0123456789 \ #0 \ #(-0) \ #(-1) \ #(-9876543210) \ #(-0987654321) \ #(4 - 8)
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/206.%20weird.html.typ
typst
weird.html Weird Languages August 2021When people say that in their experience all programming languages are basically equivalent, they're making a statement not about languages but about the kind of programming they've done.99.5% of programming consists of gluing together calls to library functions. All popular languages are equally good at this. So one can easily spend one's whole career operating in the intersection of popular programming languages.But the other .5% of programming is disproportionately interesting. If you want to learn what it consists of, the weirdness of weird languages is a good clue to follow.Weird languages aren't weird by accident. Not the good ones, at least. The weirdness of the good ones usually implies the existence of some form of programming that's not just the usual gluing together of library calls.A concrete example: Lisp macros. Lisp macros seem weird even to many Lisp programmers. They're not only not in the intersection of popular languages, but by their nature would be hard to implement properly in a language without turning it into a dialect of Lisp. And macros are definitely evidence of techniques that go beyond glue programming. For example, solving problems by first writing a language for problems of that type, and then writing your specific application in it. Nor is this all you can do with macros; it's just one region in a space of program-manipulating techniques that even now is far from fully explored.So if you want to expand your concept of what programming can be, one way to do it is by learning weird languages. Pick a language that most programmers consider weird but whose median user is smart, and then focus on the differences between this language and the intersection of popular languages. What can you say in this language that would be impossibly inconvenient to say in others? In the process of learning how to say things you couldn't previously say, you'll probably be learning how to think things you couldn't previously think. Thanks to <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this. Japanese Translation
https://github.com/JeyRunner/tuda-typst-templates
https://raw.githubusercontent.com/JeyRunner/tuda-typst-templates/main/README.md
markdown
MIT License
# Typst Template for the Corporate Design of TU Darmstadt :book: This **unofficial** template can be used to write in [Typst](https://github.com/typst/typst) with the corporate design of [TU Darmstadt](https://www.tu-darmstadt.de/). #### Disclaimer Please ask your supervisor if you are allowed to use typst and this template for your thesis or other documents. Note that this template is not checked by TU Darmstadt for correctness. Thus, this template does not guarantee completeness or correctness. Also, note that submission in TUbama requires PDF/A which typst currently can't export to (https://github.com/typst/typst/issues/2942). You can use a converter to convert from the typst output to PDF/A, but check that there are no losses during the conversion. CMYK color space support may be required for printing which is also currently not supported by typst (https://github.com/typst/typst/issues/2942), but this is not relevant when you just submit online. ## Implemented Templates The templates imitate the style of the corresponding latex templates in [tuda_latex_templates](https://github.com/tudace/tuda_latex_templates). Note that there can be visual differences between the original latex template and the typst template (you may open an issue when you find one). For missing features, ideas or other problems you can just open an issue :wink:. Contributions are also welcome. | Template | Preview | Example | Scope | |----------|---------|---------|-------| | [tudapub](templates/tudapub/tudapub.typ) | <img src="img/tudapub_prev-01.png" height="300px"> | [example_tudapub.pdf](example_tudapub.pdf) <br/> [example_tudapub.typ](example_tudapub.typ) | Master and Bachelor thesis | ## Usage Create a new typst project based on this template locally. ```bash typst init @preview/athena-tu-darmstadt-thesis cd athena-tu-darmstadt-thesis ``` Or create a project on the typst web app based on this template. <details> <summary>Or do a manual installation of this template.</summary> For a manual setup create a folder for your writing project and download this template into the `templates` folder: ```bash mkdir my_thesis && cd my_thesis mkdir templates && cd templates git clone https://github.com/JeyRunner/tuda-typst-templates templates/ ``` </details> ### Logo and Font Setup Download the tud logo from [download.hrz.tu-darmstadt.de/protected/ULB/tuda_logo.pdf](https://download.hrz.tu-darmstadt.de/protected/ULB/tuda_logo.pdf) and put it into the `logos` folder. Now execute the following script in the `logos` folder to convert it into an svg: ```bash cd logos ./convert_logo.sh ``` Also download the required fonts `Roboto` and `XCharter`: ```bash cd fonts ./download_fonts.sh ``` Now you can install all fonts in the folders in `fonts` on your system. <details> <summary>Create a main.typ file for the manual template installation.</summary> Create a simple `main.typ` in the root folder (`my_thesis`) of your new project: ```js #import " templates/tuda-typst-templates/templates/tudapub/tudapub.typ": tudapub #show: tudapub.with( title: [ My Thesis ], author: "<NAME>", accentcolor: "3d" ) = My First Chapter Some Text ``` </details> ### Compile you typst file ```bash typst --watch main.typ --font-path fonts/ ``` This will watch your file and recompile it to a pdf when the file is saved. For writing, you can use [Vscode](https://code.visualstudio.com/) with these extensions: [Typst LSP](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) and [Typst Preview](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview). Or use the [typst web app](https://typst.app/) (here you need to upload the logo and the fonts). Note that we add `--font-path` to ensure that the correct fonts are used. Due to a bug (typst/typst#2917 typst/typst#2098) typst sometimes uses the font `Roboto condensed` instead of `Roboto`. To be on the safe side, double-check the embedded fonts in the pdf (there should be no `Roboto condensed`). What also works is to uninstall/deactivate all `Roboto condensed` fonts from your system. ## Todos * [ ] some bug seems to insert an empty page at the end of the document when content (title page) appears before this second 'set page' * [ ] numbering/labeling of sub-equations (that are aligned with the other sub-equations) * [x] remove page numbers in footer before ~~and at table of contents~~ * [x] fix first-level heading page is wrong * in the outline, the page of the first-level heading is sometimes the previous page of the heading. Just appears in combination with `figure_numbering_per_chapter`. * [ ] fix referencing figures respect figure numbering when using `figure_numbering_per_chapter` * [ ] first-level headings should be referenced as 'Chapter' not as 'Sections' * [ ] add pages for: * [x] abstract * [ ] list of figures, tables, ... other * [ ] list of abbreviations (glossary) * [x] references * [ ] references list: use same citation style is 'numeric' in latex * [ ] reduce vertical spacing between adjacent headings when there is no text in between (looks better, latex template also does this) * [x] add arguments for optional pages: * after title page * before outline table of contents * after outline table of contents * [ ] fix equation numbering per chapter (somehow increases in steps of 2) * [x] provide some default page margins (small, medium, large) * [ ] ~~make all font sizes relative to the main text font size (e.g. headings)~~ * [ ] switch to kebab case for template, function args
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fh-joanneum-iit-thesis/1.1.0/template/chapters/8-conclusion.typ
typst
Apache License 2.0
#import "global.typ": * = Conclusion and Outlook #lorem(55) #todo([ Sum up the results achieved and give an outlook by suggesting further research by explaining how others could built on your results. ])
https://github.com/erfan-khadem/resume
https://raw.githubusercontent.com/erfan-khadem/resume/main/modules_en/skills.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Skills") #cvSkill( type: [Languages], info: [English #hBar() Persian #hBar() Arabic (basic)] ) #cvSkill( type: [Tech Stack], info: [JS (Svelte/Vue.js) #hBar() Python (Pandas/Numpy/Django) #hBar() Rust #hBar() Go #hBar() C/C++ (HW/RTOS/Linux)] ) #cvSkill( type: [Hobbies], info: [Mathematics #hBar() Cryptography #hBar() Bicycle #hBar() Electronics] )
https://github.com/loqusion/typix
https://raw.githubusercontent.com/loqusion/typix/main/docs/api/utilities.md
markdown
MIT License
# Utilities - [`cleanTypstSource`](./utilities/clean-typst-source.md)
https://github.com/robinhundt/tpmpc24-talk
https://raw.githubusercontent.com/robinhundt/tpmpc24-talk/main/main.typ
typst
MIT License
#import "@preview/polylux:0.3.1": * #import themes.clean: * #import "template.typ": * #import "@preview/cades:0.3.0": qr-code #import "@preview/cetz:0.2.2" #show: encrypto-theme.with( authors: (underline("<NAME>"), "<NAME>", "<NAME>"), title: "SEEC: Memory Safety Meets Efficiency in Secure Two-Party Computation", note-slides: false ) #show link: l => text(l, fill: blue) #let refs = toml("refs.toml") #let cite(key) = { let inner = if type(key) == str { link(label(key), refs.at(key).display) } else if type(key) == array { key.map(k => { link(label(k), refs.at(k).display) }).join(",") } [[#inner]] } #let rarr = sym.arrow.r #let blue-st = rgb("#6C8EBF") #let green-st = rgb("#82B366") #let orange-st = rgb("#D79B00") #let yellow-st = rgb("#D6B656") #let red-st = rgb("#B85450") #show figure.where(kind: "code"): it => { align(start, it.body) v(if it.has("gap") {it.gap} else {0.65em}) set align(center) pad(x: 1cm)[#it.caption] } #let code(filename) = { raw(read("code/"+filename), lang: "rust", block: true) } #let split-code(file, lines, lang: "rust") = { let text = read("code/"+file).split("\n").slice(..lines).join("\n") raw(text, lang: lang, block: true) } #let icon-text(icon, folder: "diagrams", height-inc: 1em, content) = { let scaled-icon = style(styles => { let size = measure(content, styles) let height = size.height + height-inc image(folder +"/"+ icon, height: height) }) stack(dir:ltr, scaled-icon, h(1em), align(horizon, content) ) } #let dline = line.with(stroke: (paint: gray, dash: "dashed")) #title-slide(sub-title: none)[ #set align(center+horizon) #image("diagrams/title-slide.svg", height: 50%) ] #slide(notes: ```md - In recent years, Memory Safety of Applications and Programming Languages has received increasing interest. Due to an increasing dependence of our privacy on the security of digital systems, memory safety as one piece of secure systems, is becoming more and more important. - However, experience hash shown time and time again, that high-impact vulnerabilities due to memory unsafety are virtually unavoidable in large projects written in C/C++. - A recent examination of the high severity security impacting bugs in Chromium revealed that 70 % are due to memory unsafety. And, this is corroborated by other large projects, such as Windows and Android. - This is relevant, as MPC applications are networked services, potentially exposed to the Internet, and which are usually written in C/C++. - The Memory Safety of these applications will becomer more important as MPC progesses from research to real-world deployments. - The reason C/C++ are so often used in MPC, is the performance and efficiency of the resulting implementations. [NEXT SLIDE] - To shift MPC from the largely theoretical to the practical we need to optimize its performance and efficiency - One aspect of efficiency which we've focused on with SEEC, is memory efficiency - This is especially relevant if we want to target mobile devices, where the most common RAM configuration was 4 GB in 2022. - But it's also relevant to deployments on servers, where reduced memory consumption can allow us to tackle larger problems or reduce operating costs ```)[Motivation][ #grid(columns: (1fr, 1fr), gutter: 1em)[ == Safety #set align(center) #cetz.canvas({ let data = ( ([Security-related assert], 7.1), ([Other], 23.9), ([Memory Unsafety], 69),) import cetz.chart import cetz.draw: * let colors = gradient.linear(blue, green, yellow) chart.piechart( data, value-key: 1, label-key: 0, radius: 3, slice-style: colors, inner-radius: 1, outset: (2,3), outset-offset: 7%, name: "c", outer-label: (content: none), inner-label: (content: "%", radius: 115%)) content((rel: (1,1), to: "c.item-0"), data.at(0).at(0)) content((rel: (1.1,0), to: "c.item-1"), data.at(1).at(0)) content((rel: (-3,+4.6), to: "c.item-2"), data.at(2).at(0)) }) #text(size: 0.5em)[ Source: #link("https://www.chromium.org/Home/chromium-security/memory-safety/")[The Chromium Projects - Memory Safety] ] ][ #pause == Efficiency #set align(horizon + center) #cetz.canvas({ let data = ( ([2], 10.08), ([3], 19.96), ([4], 34.80), ([6], 20.95), ([8], 9.17),) import cetz.chart import cetz.draw: * chart.columnchart( data, value-key: 1, label-key: 0, size: (10, 6), x-label: "Smartphone RAM (GB)", y-label: "%", bar-style: ( fill: blue.lighten(20%), stroke: none, axes: ( ) ) )}) #text(size: 0.5em)[ Source: #link("https://www.scientiamobile.com/how-much-ram-is-in-smartphones/")[scientiamobile, 2022] ] ] ] #slide(notes: ```md - Okay, so what do we contribute with SEEC? - Because we wanted to achieve a memory safe and efficient MPC framework, which also provides good performance and a nice developer experience, the natural choice was Rust as a programming language for us. - It's a memory safe language, with performance similar to C/C++, control over memory allocations without garbage collection, and a good developer experience due to fantastic tooling. - With SEEC, we provide a high-level embedded domain specific language to contruct circuits, and also the option to use FUSE or Bristol circuits. - We provide a memory- and round-efficient implementation of sub-circuits with optional support for MPC level SIMD. - And our API supports both function-independent and dependent preprocessing. - What I personally really like, is that SEEC is extensibile without a need for forking if you use it as a library to implement your protocol in. - And, it is also cross-platform which we test in our continous integration pipeline. ```)[[#underline[S]EEC #underline[E]xecutes #underline[E]normous #underline[C]ircuits (SEEC)]][ #set align(left + horizon) #set list(marker: none) #set stack(dir: ltr, spacing: 1em) #grid(columns: (1fr, 1fr), column-gutter: 2em)[ #set align(center) #image("logos/rust-logo.svg", height: 3.5cm) ][ #let icon(name, folder: "diagrams", content) = { stack(dir:ltr, image(folder + "/"+name+".svg", height: 1.5em), align(horizon, content), ) v(-0.4em) } #stack(dir: ttb, spacing: 0.3em)[ #icon("code")[High-Level eDSL / FUSE #cite("fuse23")] ][ #icon("graph")[(SIMD) Sub-Circuits] ][ #icon("preprocessing")[Function (In-)Dependent Setup] ][ #icon("extension")[Extensibility w/o forking] ][ #stack(dir:ltr, box(height: 1.5em, width: 1.5em, image("logos/windows.svg", height: 1.3em)), align(horizon, [Cross-Platform]), ) ] ] ] #slide(notes:```md - Currently, SEEC is aimed at linear secret sharing based protocols, think GMW, with semi-honest security and two parties. - We plan to extend SEEC to also provide facilities for multiple-parties and maliciously secure protocols. - The currently implemented protocols are GMW with multiplication triples in the boolean and arithmetic domain, and also a mixed domain implementation - We also provide a partial implementation of the ASTRA and ABY2.0 protocols for the Boolean domain. - Notably, we have also implemented an OT library which uses Chou Orlandis Simples OT, and the ALSZ13 and Silent OT extension protocols - As part of this work, we also developed a benchmarking tool which supports ABY, MOTION, MP-SPDZ, and SEEC. - You can use it to declaratively specify benchmarks with varying input sizes - And then it handles the compilation, local or remote execution of parties, and parsing of the results into a common format. ```)[[#underline[S]EEC #underline[E]xecutes #underline[E]normous #underline[C]ircuits (SEEC)]][ #set align(left + horizon) #set list(marker: none) #set stack(dir: ltr, spacing: 1em) #grid(columns: (1fr, 1fr), column-gutter: 2em)[ #stack()[ #image("diagrams/prot-arrows.svg", height: 2cm) ][ - 2PC GMW (A/B) #cite(("gmw","bea92")) - 2PC GMW (A+B) #cite("aby") - ASTRA (B#sym.ast.basic) #cite("astra") - ABY2.0 (B#sym.ast.basic) #cite("aby2") - OT: #cite("alsz13"), Silent OT #cite("bcg19") ] ][ #stack()[ #image("diagrams/bench.svg", height: 3cm) ][ #link("https://github.com/encryptogroup/mpc-bench")[encryptogroup/mpc-bench] ] ] #place(left + bottom, text(size: 0.5em)[#sym.ast.basic Partial Implementation]) ] #slide(alignment: horizon, notes:```md - Okay now on to some of the implementation details of SEEC, specifically those related to memory efficiency. - Here, on the left side we have some simple Rust code with a function that takes two Booleans and returns a Boolean, which is called twice where the result of the first call is one input for the second call. - In traditional programs, we use functions as an important tool for building abstractions and organizing code - they also reduce the size of the binary, - Imagine if we would inline every function of a large program. The result would be an enormous binary. - and yet, this is exactly what we often do in secret-sharing based MPC, resulting in huge circuits ```)[Functions in Traditional Programs][ #code("normal-code.txt") ] #slide(alignment: horizon, notes: ```md - Okay, so now on the right side we see what we want secure programs to roughly look like - Crucially, we want to have a high-level way of specifying a functionality to evaluate securely - With our framework SEEC, we've tried to tackle the problem of memory and communication round efficient functions or in our case sub-circuits. - Ideally, we can declare functions in our high-level functionality and use them as normal functions within our secure functionality to ease the development of MPC applications. - some slight differences such as the changed types here, are okay; and likely necessary - with our work SEEC, we have implemented and extensively benchmarked and compared one possible solution ```)[Circuit Reuse in Secure Programs][ #let color = red.lighten(70%) #let mark(dx) = { place( rect(height: 1.2em, width: 2.7em, fill: color, radius: 30%), dy: -2mm, dx: dx ) } #grid(columns: (1fr, auto, 1fr))[ #code("normal-code.txt") ][ #place(center + horizon, dx: -0.5em, dline(end: (0%, 75%))) ][ #mark(7em) #mark(13.8em) #code("secret-code.txt") ] #let make-opaque(dx) = { place(left + bottom, dy: -0.5em, dx: dx, rect(fill: rgb(255, 255, 255, 120), height: 55%, width: 48%) ) } #make-opaque(0%) #make-opaque(50%) ] #slide(notes: ```md - Okay, so what is the challenge for functions in MPC, specifically for linear secret-sharing based protocols which execute in multiple rounds? - Let's say we have our high-level functionality with two function calls. - In this case, these two function calls are independent of each other [NEXT SLIDE] - If we go a level lower and look at intermediate or in-memory representation which the source code of our secure functionality is compiled to, we have two options: - We can represent the functionality as Bytecode for an MPC-specific virtual machine, for example this is how MP-SPDZ does it. - Or, we can represent the functionality as a circuit or directed acyclic graph, which more closely resembles descriptions of protocols in the literature and is the approach taken by ABY, MOTION and others. - In the bytecode representation, we have the bytecode for the function once in memory and then two sequential call instructions to this function. - Whereas in the graph based approach, we repeat the sub-graph corresponding to the function within the larger circuit for our two calls. [NEXT SLIDE] - Both approaches have some advantages and disadvantages. - With the bytecode executed by VM, the sequential function calls result in an increased number of communication rounds. - However, the definition of the function itself is only stored once in memory and we can more easily reuse memory for the output of gates or instructions in this case. - If we choose a graph approach, we naturally get concurrent evaluation of these two functions when we iterate over the layers of the circuit. - However, this comes at the cost of increased memory, as the sub-circuit for the function is repeated in memory. - What we've looked at is: Can we have memory efficient functions or sub-circuits which do not increase the number of rounds? - As a side note: With garbled circuits, functions are much easier to support, as there, the sequential evaluation does not matter, because of the constant round evaluation. ```)[Sub-Circuits in GMW: Challenges][ #set list(marker: rarr) #set text(size: 0.9em) #let phase(color, col1, col2) = { rect(stroke: (paint: color, dash: "dashed"), radius: 20%, outset: 0.4em)[ #grid(columns: (1fr, 1fr), col1, col2) ] } #grid(columns: (30%, 1fr))[ #image("diagrams/high-level-pipeline-Page-3.svg") ][ #phase(blue-st)[ ```rust func(a); func(b); ``` ][ #set align(horizon) `a` and `b` are independent ] #pause #phase(orange-st)[ #text(fill: black.lighten(25%), [=== Bytecode VM]) ``` func: # ... ret call func call func ``` #place(center + horizon, dx: 4cm, dline(end: (0%, 50%))) ][ #text(fill: black.lighten(25%), [=== Graph based]) #only((2,3), image("diagrams/parallel-circ.svg", height: 40%)) #place(`func`, dx: 1.5cm, dy: -1.6cm) #place(`func`, dx: 6.4cm, dy: -1.6cm) ] #pause #phase(red-st)[ - Increased rounds - `func` only once in memory #place(center + horizon, dx: 4cm, dy: 0cm, dline(end: (0%, 15%))) ][ - Concurrent evaluation - Increased Memory ] ] ] #slide(notes:```md - With SEEC, we provide a memory and round-efficient way of using sub-circuits in secret-sharing based protocols. - With our high-level API, you can annotate a normal Rust function, which operates on data of type Secret, with our sub_circuit macro - In this case, the function simply computes the pairwise AND of two vectors [NEXT SLIDE] - Then we can use this function as a normal function in the rest of our code. - Okay, so for an MPC application developer this is a nice experience, but how does it work? ```, [SEEC: eDSL Enables Efficient Circuit Reuse])[ #set align(center) #let opaque-line(dx, dy) = { place(left + top, dx: dx, dy: dy, rect(fill: rgb(255, 255, 255, 120), height: 1.1em, width: 100%) ) } #align(horizon, grid(columns: (60%,auto, auto))[ #set align(top) #show regex(`sub_circuit`.text): set text(fill: orange.darken(10%)) #split-code("sub-circuit-macro.txt", (0,9)) #opaque-line(0em, 3.1em) #opaque-line(0em, 7.7em) ][ #show: place.with(dx: -0.7em) #line(end: (0%, 65%), stroke: (paint: gray, dash: "dashed")) ][ #set align(top) #uncover(2)[#split-code("sub-circuit-macro.txt", (9,14))] #opaque-line(0em, -0.2em) ]) ] #slide(notes: ```md - In SEEC, we also use a graph based representation of the functionality to execute. - However, in contrast to previous works, repeated calls to a functionality will not inline them for each call. - Instead, for the first call to a sub-circuit, we build the sub-graph corresponding to this function and cache it. - Subsequent calls to the function will not recompute the sub-circuit, but instead connect the argument gates of the calling circuit to the input gates of the called sub-circuit. - For these connections between called circuits, we optimized the memory required to store them, specifically we compress gates with consecutive Ids into ranges of gates. - Okay, so the first part is done, we have a memory efficient way of declaring sub-circuits, but what about the round complexity? [NEXT SLIDE] - For an efficient online phase, it is important that using sub-circuits does not increase the number of communication rounds. - In our framework, we achieve this via lazy iteration over the topologically sorted layers for each **use** of a subcircuit. - We refer to this lazy iteration of sub-circuit layers as dynamic layers or DL for short. - The crucial property of this approach, is that the execution of each sub-circuit is **as if it was inlined**, meaning we have no increase in the depth or round complexity of the overall circuit. - Also, this graph-based lazy iteration approach enables us to have partial and concurrent evaluation of multiple uses of the same sub-circuit or different sub-circuits. - This notion and our implementation of sub-circuits enables us to have memory- and round-efficient functions for secret-sharing based MPC protocols. ```)[SEEC: Sub-Circuits Are Not Inlined][ #set par(leading: 1.2em) #grid(columns: (auto, 1fr), gutter: 1.5em)[ #show regex(`sub_circuit`.text): set text(fill: orange.darken(10%)) #place(raw("#[sub_circuit]\nfn func(...)", lang: "rust"), dx: 110mm, dy: 50mm) #image("diagrams/seec-parallel-circ.svg") ][ #show: only.with(2) #place(dline(end: (0%, 100%)), dx: -4mm) #set align(horizon) #let h = icon-text("online.svg")[== Online] #align(center, h) #v(2cm) - Layer iteration *as if* inlined (DL) - No increase in depth - Partial and concurrent evaluation ] ] #slide(notes: ```md - Okay, so we just saw that with SEEC we can have efficient sub-circuits. - But there also a different technique, namely SIMD, which stands for single instruction, multiple data, and has been used to reduce memory consumption and increase efficiency of MPC implementations. - For example in the MOTION framework, we can have SIMD gates, which perform the same operation on vectors of data instead of individual values. - A nice benefit of these MPC SIMD gates, is that these gates internally can use hardware SIMD instructions to speed up the computation [NEXT SLIDE] - In SEEC, we also support SIMD, but instead of at the gate level, we support SIMD sub-circuits. - So instead of an individual gate that operates on vectors, we have sub-circuits that operate on vectors of data. - We do this because supporting SIMD at the gate level can very easily increase the memory consumption of circuits which **don't use SIMD**. ```)[Single Instruction, Multiple Data (SIMD)][ #set align(bottom + center) #grid(columns: (1fr, 1fr))[ #box({ image("diagrams/seec-simd-Page-1.svg") [Traditional SIMD, e.g., in\ MOTION #cite("motion22").] }) ][ #pause #box({ image("diagrams/seec-simd-Page-2.svg") [SIMD Sub-Circuits in SEEC.\ #hide("a")] }) ] #v(1.5cm) ] #slide(notes: ```md - Alongside sub-circuits and SIMD, we also implement several optimizations to increase performance and memory efficiency - The first one of those, we call static layers - Layers here refers to the layers of **uses of a sub-circuit** which are dynamically computed in the dynamic layer representation - With the static layer representation, we precompute those layers of each use of a sub-circuit - To not blow up the required memory, we however only store unique layer configurations of a sub-circuit. - As a result, if two calls to sub-circuit result in the configuration of sub-circuit layers, we only store these once. - The benefit of this optimization is twofold: - increased perfomance of the online phase, because we don't need to dynamically compute the layers on the fly - And, depending on the circuit topology, a reduced memory consumption because we don't need a general graph representation with forward and backward references between gates anymore. [NEXT SLIDE] - The next optimization is early deallocation of gate outputs in SIMD circuits - Because in SIMD circuits, the outputs of gates are heap allocated vectors, we can free them once they're not needed for further evaluation. [NEXT SLIDE] - And lastly, with our generic APIs for preprocessing, we have the option to precompute multiplication triples and store them on the filesystem. - In the online phase, we can read the triples on-demand in batches from a file. - This reduces memory consumption, as we don't need hold all required triples in memory at once. ```)[SEEC: Optimizations][ #show heading: set align(center) #let vline = line(end: (0%, 100%), stroke: (paint: gray, dash: "dashed")) #show image: set align(center) #set image(height: 2em) // #show list: set text(size: 0.9em) #set par(leading: 0.9em) #let make-opaque = { place(left + top, dy: -0.5em, rect(fill: rgb(255, 255, 255, 120), height: 100%, width: 100%) ) } #grid(columns: (1fr, auto, 1fr, auto, 1fr), gutter: 5pt)[ === Static Layers (SL) #image("diagrams/graph.svg") #h(1em) - Transforms Dynamic Layer (DL) representation - Layers are precomputed for every call site - Precomputed layers are stored deduplicated #only((2,3), make-opaque) ][#vline][ === Early Deallocation (ED) #image("diagrams/online.svg") #h(1em) #uncover((2,3))[ - Unneeded gate outputs are freed - Only applies to SIMD circuits ] #only((1,3), make-opaque) ][#vline][ === Streaming MTs (SMT) #align(center, stack(dir: ltr, image("diagrams/preprocessing.svg"), image("diagrams/online.svg"), )) #h(1em) #uncover(3)[ - Multiplication Triples (MTs) are precomputed and stored in a file - Online: read on-demand in batches from the file ] #only((1,2), make-opaque) ] ] #set footnote.entry(clearance: 0em, gap: 0em) #slide(notes: ```md - Okay, so what impact do sub-circuits and our optimizations have on the memory efficiency? - To evaluate this, we have run extensive benchmarks with our dedicated benchmarking tool which I mentioned in the beginning. - We compare with the ABY, MP-SPDZ, and MOTION frameworks - In all frameworks, we use the semi-honest two-party Boolean GMW protocol with multiplication triples and only benchmark the online phase and not the setup. - We perform the evaluation in different environments, with differing simluated network settings and a varying number of threads. - To measure the maximum memory consumption, we use the heaptrack tool. - We ran each party on one of our servers with 32 logical cores and 128 Gigs of RAM. [NEXT SLIDE] - We benchmark two kinds of functionalities. - In the first one, we repeatedly execute AES-128 chained after one another. - So this is essentially AES in CBC mode in MPC. - We chose this functionality as it has this structure of a sub-functionality which is repeatedly used, it can not exploit SIMD, the size of the circuit can easily be scaled, and it was straightforward to implement in the different frameworks. - And then also, we benchmark SIMD evaluations of AES and SHA-256 with different SIMD vector sizes to see the impact of our SIMD specific optimizations. ```)[Evaluation][ #grid(columns: (40%, 1fr))[ #grid(rows: (auto, auto), row-gutter: 1em)[ === Frameworks - ABY #cite("aby") - MP-SPDZ #cite("kel20") - MOTION #cite("motion22") - SEEC ][ #set list(marker: none) #set par(leading: 0.2em) === Environment - #icon-text("online.svg", height-inc: 0.1em)[LAN-0.25ms / LAN-1.25ms \ WAN-100ms] - #icon-text("cpu.svg")[$1, 2, dots, 32$ Threads] - #icon-text("kde.svg", folder: "logos")[ Heaptrack#super[1] ] ] ][ #show: only.with(2) === Circuits #grid(rows: (56%, auto, 1fr), gutter: 0.5em)[ // #show: uncover.with((2, 3)) #grid(columns: (10%, 1fr), gutter: 1em)[ // hacky hack #let t = box([Sub-Circuit], width: 300%) #place(center + horizon,rotate(360deg - 90deg, t)) ][ #image("diagrams/aes-cbc.svg") ] ][ #dline(length: 100%) ][ // #show: uncover.with(3) #grid(columns: (10%, auto, 1fr), gutter: 1em)[ #set align(horizon) #rotate(360deg - 90deg)[SIMD] ][ #set align(horizon) - AES-128 - SHA-256 ][ #image("diagrams/seec-simd-Page-2.svg", fit: "contain") ] ] ] #show: align.with(bottom) #set text(size: 0.6em) #line(length: 30%, stroke: (paint: gray)) #super[1] https://github.com/KDE/heaptrack ] #let overwrite-legend(content, dx: 0em, dy: 0em) = { set par(leading: 0.56em) set text(size: 0.66em, fill: black.lighten(20%), ) place(top, dx: 22.7cm + dx, dy: +0.83cm + dy, box(fill: white, outset: (bottom: 3pt), align(start, content))) } #let bottom-legend(dx: 0%, dy: 0%, ..content) = { set text(size: 0.6em, fill: black.lighten(20%)) place(top, dx: 22.5cm + dx, dy: 5cm + dy, grid(columns: 2, gutter: 0.5em, align: (start + horizon, end), ..content)) } #let note(dx: 0%, dy: 0%, content) = { set text(size: 0.9em, fill: black.lighten(20%)) place(top, dx: dx, dy: dy, box(fill: white, align(start, content))) } #slide(notes: ```md - First, we examine the peak memory of SEEC on the AES-CBC circuit. - Note that both the x and y axis are logarithmically scaled. - SEEC with dynamic layers but without sub-circuits, so each AES circuit is inlined, has the highest peak memory consumption with 50 GB at the largest circuit size. - If we then use the dynamic layer representation with sub-circuits, the memory consumption is reduced to 2.2 GB. - And if we further use the static layer optimization, we can further reduce this to just 375 MB. So this is roughly a factor 135 improvement when comparing no sub-circuits to sub-circuits with static layers. - But how does this stack up against the other frameworks? ```)[AES-CBC: Reduced Memory via Sub-Circuits][ #image("plots/aes-cbc-seec-variants-max_heap.svg") #overwrite-legend(dy: 0.3em)[ SEEC, DL\ SEEC, DL/SC\ SEEC, SL/SC\ ] #bottom-legend[ DL: ][Dynamic Layers][ SL: ][Static Layers][ SC: ][ Sub-Circuits ] #note(dx: 70%, dy: 0%)[50 GB] #note(dx: 70%, dy: 20%)[2.2 GB] #note(dx: 70%, dy: 52%)[375 MB] ] #slide(notes:```md - When comparing with the other frameworks, we see that especially MOTION has tremendous memory overhead, especially for Boolean circuits not using SIMD. - Only at 100 chained AES circuits, the peak memory consumption of the online phase is already 73 GB and we could not evaluate larger sizes as we rant out of RAM. - ABY fares better with 74 GB at 10K chained circuits, but this is still more than the 50 GB of SEEC without sub-circuits. - For MP-SPDZ and SEEC, the difference is quite small. While SEEC fares better for very small circuits, with increasing size the memory consumption of MP-SPDZ is better than SEEC. - One reason for MP-SPDZ low memory consumption in this benchmark is its support of loops, which for this circuit don't increase the number of rounds, but significantly reduce the size of the bytecode. - So we confirmed our earlier claims that the bytecode representation of MP-SPDZ results in low memory consumption for circuits such as the evaluated, whereas graph-based approaches tend to require several orders of magnitude more memory. - We also see that, with our implementation of sub-circuits we achieve memory efficiency that is close to the bytecode approach. ```)[AES-CBC: Reduced Memory via Sub-Circuits][ #image("plots/aes-cbc-seec-best-max_heap.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ MP-SPDZ #cite("kel20")\ SEEC, SL/SC ] #bottom-legend[ DL: ][Dynamic Layers][ SL: ][Static Layers][ SC: ][ Sub-Circuits ] #note(dx: 37%, dy: 0%)[73 GB] #note(dx: 70%, dy: 0%)[74 GB] #note(dx: 70%, dy: 36%)[375 MB] #note(dx: 70%, dy: 55%)[210 MB] ] #slide(notes: ```md - Alright, so now let us focus on SIMD circuitss, where we operate on vectors of values instead of individual ones. - So here, we evaluate the AES-128 circuit with varying SIMD sizes in parallel and again look at the peak memory consumption. - For SEEC, we have the highest peak memory consumption of 7.5 GB at 1 million parallel AES calls for the variant where we only use static layers but no early deallocation or triples streaming. - This is already improved by using early deallocation of SIMD gate outputs and further improved by triples streaming to just 700 MB. - However, if we look at left side of the graph, we see that the variant with streaming triples requires the most memory. - The reason for this is, that we read the triples in a pre-defined batch size. - This batch size was quite high for this benchmark, so the majority of the memory for small circuits is due to unneeded triples being loaded into memory. - So we get more than a factor of 10 reduction in peak memory for this high SIMD use case when using our optimizations and SEEC. - So now, lets again compare the most efficient variant with the other frameworks. ```)[AES: Reduced SIMD Memory Usage][ #image("plots/aes-ctr-seec-variants-max_heap_mb.svg") #overwrite-legend[ SEEC, DL/ED\ SEEC, DL/SMT/ED\ SEEC, SL ] #bottom-legend[ DL: ][Dynamic Layers][ SL: ][Static Layers][ SC: ][Sub-Circuits][ SMT: ][ Streaming MTs ][ ED: ][Early Deallocation] #note(dx: 70%, dy: 0%)[7.5 GB] #note(dx: 70%, dy: 40%)[700 MB] ] #slide(notes: ```md - For ABY and MP-SPDZ, we were unable to go up to the largest SIMD size as these frameworks crashed for this size. - MOTION managed to evaluate 1 million parallel calls, but required 10 GB of peak memory for this, compared to SEECs 700 MB we saw earlier. - And again, on the left side of the graph, SEEC performs worse for smaller circuits due to the triple batch size. ```)[AES: Reduced SIMD Memory Usage][ #image("plots/aes-ctr-seec-best-max_heap_mb.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ MP-SPDZ #cite("kel20")\ SEEC, DL/SMT/ED ] #bottom-legend[ DL: ][Dynamic Layers][ SL: ][Static Layers][ SC: ][Sub-Circuits][ SMT: ][ Streaming MTs ][ ED: ][Early Deallocation] #note(dx: 70%, dy: 0%)[10 GB] #note(dx: 70%, dy: 40%)[700 MB] ] #let net-note(dx: 0%, dy: 0%, content) = { set text(size: 0.9em, fill: black.lighten(20%)) place(top, dx: dx, dy: dy, box(fill: white, align(start, content))) } #slide(notes: ```md - Now, on to the last benchmark, where we look at the runtime of the AES-CBC benchmark with 100 chained circuits in our three network settings. - In general, ABY performs really well runtime wise for this circuit and tends to be a little bit faster than SEEC, except in the WAN setting. - Interestingly, MP-SPDZ has a very good runtime in the lowest latency network setting - But then, the runtime curiously increases over-proportional with the latency, with MP-SPDZ being the slowest in the WAN setting with 616 seconds, twice as much as SEEC. - For MOTION, we see that it can't really make use of low-latency networks and has the highest runtime in the LAN settings. - In general, SEEC has good online runtime performance in all network settings, with room for improvement in the low latency network. - Most importantly, using sub-circuits does not increase the number of communication rounds! ```)[AES-CBC Runtime: Effect of Latency][ #image("plots/aes-cbc-net_comparison.svg") #overwrite-legend(dx: 3.8em)[ LAN-0.25ms\ LAN-1.25ms\ WAN-100ms ] #net-note(dx: 10%, dy: 66%)[1.5] #net-note(dx: 16.5%, dy: 51%)[6] #net-note(dx: 21%, dy: 6%)[313] #net-note(dx: 31%, dy: 25%)[62] #net-note(dx: 36.5%, dy: 25%)[64] #net-note(dx: 41%, dy: 3%)[424] #net-note(dx: 51%, dy: 77%)[0.6] #net-note(dx: 56.2%, dy: 48%)[8.5] #net-note(dx: 61.5%, dy: 0%)[616] #net-note(dx: 71%, dy: 61%)[2.7] #net-note(dx: 76.7%, dy: 51%)[6.8] #net-note(dx: 81.7%, dy: 6%)[305] #bottom-legend(dx: 6%)[ SL: ][Static Layers][ SC: ][Sub-Circuits] #set text(size: 0.8em) #net-note(dx: 12%, dy: 90%)[ABY #cite("aby")] #net-note(dx: 29.2%, dy: 90%)[MOTION #cite("motion22")] #net-note(dx: 50.5%, dy: 90%)[MP-SPDZ #cite("kel20")] #net-note(dx: 72%, dy: 90%)[SEEC - SL/SC] ] #slide(notes: ``` - With SEEC, we achieve a memory-safe and efficient two party secure computation framework - We provide a memory and communication round efficient implementation of sub-circuits with enable the use of functions in the functionalities for secret-sharing bases MPC - support for loops and register allocation of gate outputs can lead to better memory efficiency in some cases (MP-SPDZ) - however sub-circuits are more versatile, as they can reduce memory consumption of sub-circuit calls at unrelated places of the main circuit SIMD - Significantly better SIMD memory consumption - largely due to FG and IS optimizations - Predicatbility - Realiability ```)[Summary][ #show heading: set align(center) #show regex(`sub_circuit`.text): set text(fill: orange.darken(10%)) #let check = align(center, scale(150%, image("logos/check.svg", height: 1em))) #let check-yellow = align(center, scale(150%, image("logos/check-yellow.svg", height: 1em))) #let cross = align(center, scale(150%, image("logos/cross.svg", height: 1em))) #let rarrow = sym.arrow.r #grid(columns: (1fr,) *2)[ #grid(columns: (1fr,) * 2, rows: (40%, 1fr), row-gutter: 1em)[ #set align(horizon + center) #stack(dir: ltr)[ #image("logos/rust-logo.svg", height: 50%) #h(5cm) ][ Memory-Safety\ #text(size: 2em, "&")\ Memory-Efficiency ] ][ ][ #stack(dir: ltr, spacing: 2em)[ == Sub-Circuits #v(1cm) ```rust #[sub_circuit] fn process(...) ``` ][ == SIMD #set align(horizon) Up to 15ร— - 1,983ร— less memory than MOTION #cite("motion22"). ] ] ][ #set align(horizon) #grid(columns: (auto, 1fr, 1fr), rows: (auto,) * 4, row-gutter: 0.8em)[][ == Predictability ][ == Reliability ][ ABY ][ #check ][ #cross ][ MP-SPDZ ][ #cross ][ #check ][ MOTION ][ #cross ][ #check ][ SEEC ][ #check-yellow ][ #check ] ] ] #slide(alignment: center + horizon)[Questions?][ #image(width: 25%, "logos/qr-code.png") #link("https://github.com/encryptogroup/SEEC")[github.com/encryptogroup/SEEC] \ Made with #set image(height: 1.3cm) #stack(dir: ltr, spacing: 2cm, image("logos/typst.svg"), image("logos/draw-io.svg"), image("logos/svg-repo.svg") ) ] #slide[References][ #set text(size: 14pt) #grid(columns: (auto, 1fr),row-gutter: 0.5em, ..{ refs.pairs().map(p => { let (k, v) = p let key = [[#v.display]#h(1em)] let title = [ #v.title #label(k)\ ] (key, title) }).flatten() }) ] #section-slide[Appendix] #slide[Future Work][ #let r(s, content) = rect(width: 100%, stroke: (paint: s, dash: "dashed"), radius: 20%, content, outset: 1.8mm) #set image(height: 2cm) #set stack(spacing: 1em) #show regex(`sub_circuit`.text): set text(fill: orange.darken(10%)) #show: columns.with(2) #set stack(dir: ltr) #set align(horizon) #box(height: 100%, stack(dir: ttb)[ #show: r.with(blue-st) #stack[ #image("diagrams/code.svg") ][ - Expanding `Secret` API - SIMD `#[sub_circuit]` macro - Usability improvements ] ][ #show: r.with(green-st) #stack[ #image("diagrams/graph.svg") ][ - Protocol composability - Optional register storage - Sub-Circuit SIMD-vectorization ] ][ #show: r.with(orange-st) #stack[ #image("diagrams/memory.svg") ][ - Sub-Circuit output deallocation ] ]) #colbreak() #box(height: 100%, stack(dir: ttb)[ #show: r.with(yellow-st) #stack(dir: ltr)[ #image("diagrams/preprocessing.svg") ][ - OT-based interleaved setup - Interleaved function dependent preprocessing ] ][ #show: r.with(red-st) #stack[ #image("diagrams/online.svg") ][ - Asynchronous Evaluation - QUIC Channels - Multi-Party + Malicious \ Protocols ] ]) ] #slide[Benchmarking Tool][ #show: columns.with(2) #raw(read("code/bench-config.toml"), lang: "toml") #icon-text("github-mark.svg", folder: "logos")[#link("https://github.com/encryptogroup/mpc-bench")[encryptogroup/mpc-bench]] ] #slide[Sub-Circuit Iteration][ #set text(size: 13pt) #grid(columns: 2)[ #split-code("sub-circ-iter.py", (0, 22), lang: "python") ] ] #slide[Sub-Circuit Iteration][ #set text(size: 13pt) #grid(columns: 2)[ #split-code("sub-circ-iter.py", (22, 40), lang: "python") ][ #split-code("sub-circ-iter.py", (40, 52), lang: "python") ] ] #slide[SHA-256: Effect of Nagle's Algorithm][ #image("plots/sha256-wan-runtime.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ SEEC, SL ] ] #slide[AES-CBC: Async. Communication Overhead][ #image("plots/aes-cbc-btyes-sent.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ MP-SPDZ #cite("kel20")\ SEEC, SL/SC ] ] #slide[SIMD AES: Peak Bits per Gate][ #image("plots/aes-ctr-bits-per-op.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ MP-SPDZ #cite("kel20")\ SEEC, DL/ED\ SEEC, DL/SMT/ED\ SEEC, SL ] ] #slide[SIMD AES: Impact of Setup][ #image("plots/aes-ctr-setup-max-heap.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ MOTION, IS #cite("motion22")\ MP-SPDZ #cite("kel20")\ SEEC, DL/SMT/ED\ SEEC, SL ] ] #slide[SHA-256: Reduced SIMD Memory Usage][ #image("plots/sha256-max-heap.svg") #overwrite-legend[ ABY #cite("aby")\ MOTION #cite("motion22")\ SEEC, DL/ED\ SEEC, DL/SMT/ED\ SEEC, SL ] ] #slide[SEEC: System Architecture (slightly outdated)][ #image("diagrams/architecture.svg") ]
https://github.com/sebaseb98/clean-math-thesis
https://raw.githubusercontent.com/sebaseb98/clean-math-thesis/main/customization/colors.typ
typst
MIT License
#let ugent-blue = rgb(30, 100, 200) #let caribbean-current = rgb(30, 100, 101) #let proper-purple = rgb("#6f006f") #let federal-blue = rgb(31, 28, 92) #let earth-yellow = rgb(224, 164, 88) #let atomic-tangerine = rgb(222, 143, 110) #let ugent-accent1 = rgb(139, 190, 232) #let ugent-accent2 = rgb(137, 137, 137) #let color1 = rgb("#800080") #let color2 = rgb("#0000ff") #let color3 = rgb("#008002") #let color4 = rgb("#ffa500") #let color5 = rgb("#ff0000")
https://github.com/extua/october
https://raw.githubusercontent.com/extua/october/main/README.md
markdown
MIT No Attribution
This template generates a monthly calendar, designed to be printed in landscape. The calendar function accepts one parameter for the year, which should be formatted as an integer. Otherwise, the current year can be passed in with `datetime.today().year()`. ```typst #show: calendar.with( year: datetime.today().year() ) ``` There isn't much space for writing in each day box, it's more suited to blocking out days with a highlighter. For example, to mark out free days in a variable schedule of work shifts.
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/math/scripts.md
markdown
MIT License
# Scripts > To set scripts and limits see [Typst Basics section](../../basics/math/limits.md) ## Make every character upright when used in subscript ```typ // author: emilyyyylime $f_a, f_b, f^a, f_italic("word")$ #show math.attach: it => { import math: * if it.b != none and it.b.func() != upright[].func() and it.b.has("text") and it.b.text.len() == 1 { let args = it.fields() let _ = args.remove("base") let _ = args.remove("b") attach(it.base, b: upright(it.b), ..args) } else { it } } $f_a, f_b, f^a, f_italic("word")$ ```
https://github.com/EGmux/ControlTheory-2023.2
https://raw.githubusercontent.com/EGmux/ControlTheory-2023.2/main/unit3/lugarRaizes.typ
typst
#set heading(numbering: "1.") === Root locus \ Every pole of a system whenever we want a specific gain #figure(image("../assets/rootMethod.png", width: 80%), caption: []) <fig-rootmethod> === Definition \ - for k between the poles and zero, it is guaranteed to be stable - for k above zero, unstable - for k equal to zero , marginally stable === Scratch \ ==== Symmetry \ ==== num of branches \ ==== segmentation \ ==== start/end \ ==== asymptotic behavior \ ==== Refining the scratchwork \ #math.equation(block: true, $ T(S) = ()/(1+K G(S)H(S)) $) #math.equation(block: true, $ 1 + K G(S)H(S) = 0 $) #math.equation(block: true, $ K = (-1)/(G(S)H(S)) $) then derive #math.equation(block: true, $ ("dK")/("dS") = 0 $) ๐Ÿšจ to classify a point, check if between zeros or poles ==== intersection with imag axis \ because the poles are located in the left semiplane the intersection tells the region where the system operation is stable, such point would be in the boundary for instance #math.equation(block: true, $ T(S) = (K(S+3))/(S^4+7S^3+14S^2+(8+k)S + 3K) $) then create the Routh-Hurwitz table #table( columns: (1fr, auto, auto, auto), inset: 10pt, align: horizon, [], [], [], [], $s^4$, $ 1$, "14", "3k", "s^3", "7", $8+k$, "0", "s^2", "90-k", "21k", "0", "s^1", $(-k^2-65k + 72)/(""-k)$, "0", "0", "s^0", "21+k", "0", "0", ) k = 9,65
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-16800.typ
typst
Apache License 2.0
#let data = ( ("BAMUM LETTER PHASE-A NGKUE MFON", "Lo", 0), ("BAMUM LETTER PHASE-A GBIEE FON", "Lo", 0), ("BAMUM LETTER PHASE-A PON MFON PIPAEMGBIEE", "Lo", 0), ("BAMUM LETTER PHASE-A PON MFON PIPAEMBA", "Lo", 0), ("BAMUM LETTER PHASE-A NAA MFON", "Lo", 0), ("BAMUM LETTER PHASE-A SHUENSHUET", "Lo", 0), ("BAMUM LETTER PHASE-A TITA MFON", "Lo", 0), ("BAMUM LETTER PHASE-A NZA MFON", "Lo", 0), ("BAMUM LETTER PHASE-A SHINDA PA NJI", "Lo", 0), ("BAMUM LETTER PHASE-A PON PA NJI PIPAEMGBIEE", "Lo", 0), ("BAMUM LETTER PHASE-A PON PA NJI PIPAEMBA", "Lo", 0), ("BAMUM LETTER PHASE-A MAEMBGBIEE", "Lo", 0), ("BAMUM LETTER PHASE-A TU MAEMBA", "Lo", 0), ("BAMUM LETTER PHASE-A NGANGU", "Lo", 0), ("BAMUM LETTER PHASE-A MAEMVEUX", "Lo", 0), ("BAMUM LETTER PHASE-A MANSUAE", "Lo", 0), ("BAMUM LETTER PHASE-A MVEUAENGAM", "Lo", 0), ("BAMUM LETTER PHASE-A SEUNYAM", "Lo", 0), ("BAMUM LETTER PHASE-A NTOQPEN", "Lo", 0), ("BAMUM LETTER PHASE-A KEUKEUTNDA", "Lo", 0), ("BAMUM LETTER PHASE-A NKINDI", "Lo", 0), ("BAMUM LETTER PHASE-A SUU", "Lo", 0), ("BAMUM LETTER PHASE-A NGKUENZEUM", "Lo", 0), ("BAMUM LETTER PHASE-A LAPAQ", "Lo", 0), ("BAMUM LETTER PHASE-A LET KUT", "Lo", 0), ("BAMUM LETTER PHASE-A NTAP MFAA", "Lo", 0), ("BAMUM LETTER PHASE-A MAEKEUP", "Lo", 0), ("BAMUM LETTER PHASE-A PASHAE", "Lo", 0), ("BAMUM LETTER PHASE-A GHEUAERAE", "Lo", 0), ("BAMUM LETTER PHASE-A PAMSHAE", "Lo", 0), ("BAMUM LETTER PHASE-A MON NGGEUAET", "Lo", 0), ("BAMUM LETTER PHASE-A NZUN MEUT", "Lo", 0), ("BAMUM LETTER PHASE-A U YUQ NAE", "Lo", 0), ("BAMUM LETTER PHASE-A GHEUAEGHEUAE", "Lo", 0), ("BAMUM LETTER PHASE-A NTAP NTAA", "Lo", 0), ("BAMUM LETTER PHASE-A SISA", "Lo", 0), ("BAMUM LETTER PHASE-A MGBASA", "Lo", 0), ("BAMUM LETTER PHASE-A MEUNJOMNDEUQ", "Lo", 0), ("BAMUM LETTER PHASE-A MOOMPUQ", "Lo", 0), ("BAMUM LETTER PHASE-A KAFA", "Lo", 0), ("BAMUM LETTER PHASE-A PA LEERAEWA", "Lo", 0), ("BAMUM LETTER PHASE-A NDA LEERAEWA", "Lo", 0), ("BAMUM LETTER PHASE-A PET", "Lo", 0), ("BAMUM LETTER PHASE-A MAEMKPEN", "Lo", 0), ("BAMUM LETTER PHASE-A NIKA", "Lo", 0), ("BAMUM LETTER PHASE-A PUP", "Lo", 0), ("BAMUM LETTER PHASE-A TUAEP", "Lo", 0), ("BAMUM LETTER PHASE-A LUAEP", "Lo", 0), ("BAMUM LETTER PHASE-A SONJAM", "Lo", 0), ("BAMUM LETTER PHASE-A TEUTEUWEN", "Lo", 0), ("BAMUM LETTER PHASE-A MAENYI", "Lo", 0), ("BAMUM LETTER PHASE-A KET", "Lo", 0), ("BAMUM LETTER PHASE-A NDAANGGEUAET", "Lo", 0), ("BAMUM LETTER PHASE-A KUOQ", "Lo", 0), ("BAMUM LETTER PHASE-A MOOMEUT", "Lo", 0), ("BAMUM LETTER PHASE-A SHUM", "Lo", 0), ("BAMUM LETTER PHASE-A LOMMAE", "Lo", 0), ("BAMUM LETTER PHASE-A FIRI", "Lo", 0), ("BAMUM LETTER PHASE-A ROM", "Lo", 0), ("BAMUM LETTER PHASE-A KPOQ", "Lo", 0), ("BAMUM LETTER PHASE-A SOQ", "Lo", 0), ("BAMUM LETTER PHASE-A MAP PIEET", "Lo", 0), ("BAMUM LETTER PHASE-A SHIRAE", "Lo", 0), ("BAMUM LETTER PHASE-A NTAP", "Lo", 0), ("BAMUM LETTER PHASE-A SHOQ NSHUT YUM", "Lo", 0), ("BAMUM LETTER PHASE-A NYIT MONGKEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-A PAARAE", "Lo", 0), ("BAMUM LETTER PHASE-A NKAARAE", "Lo", 0), ("BAMUM LETTER PHASE-A UNKNOWN", "Lo", 0), ("BAMUM LETTER PHASE-A NGGEN", "Lo", 0), ("BAMUM LETTER PHASE-A MAESI", "Lo", 0), ("BAMUM LETTER PHASE-A NJAM", "Lo", 0), ("BAMUM LETTER PHASE-A MBANYI", "Lo", 0), ("BAMUM LETTER PHASE-A NYET", "Lo", 0), ("BAMUM LETTER PHASE-A TEUAEN", "Lo", 0), ("BAMUM LETTER PHASE-A SOT", "Lo", 0), ("BAMUM LETTER PHASE-A PAAM", "Lo", 0), ("BAMUM LETTER PHASE-A NSHIEE", "Lo", 0), ("BAMUM LETTER PHASE-A MAEM", "Lo", 0), ("BAMUM LETTER PHASE-A NYI", "Lo", 0), ("BAMUM LETTER PHASE-A KAQ", "Lo", 0), ("BAMUM LETTER PHASE-A NSHA", "Lo", 0), ("BAMUM LETTER PHASE-A VEE", "Lo", 0), ("BAMUM LETTER PHASE-A LU", "Lo", 0), ("BAMUM LETTER PHASE-A NEN", "Lo", 0), ("BAMUM LETTER PHASE-A NAQ", "Lo", 0), ("BAMUM LETTER PHASE-A MBAQ", "Lo", 0), ("BAMUM LETTER PHASE-B NSHUET", "Lo", 0), ("BAMUM LETTER PHASE-B TU MAEMGBIEE", "Lo", 0), ("BAMUM LETTER PHASE-B SIEE", "Lo", 0), ("BAMUM LETTER PHASE-B SET TU", "Lo", 0), ("BAMUM LETTER PHASE-B LOM NTEUM", "Lo", 0), ("BAMUM LETTER PHASE-B MBA MAELEE", "Lo", 0), ("BAMUM LETTER PHASE-B KIEEM", "Lo", 0), ("BAMUM LETTER PHASE-B YEURAE", "Lo", 0), ("BAMUM LETTER PHASE-B MBAARAE", "Lo", 0), ("BAMUM LETTER PHASE-B KAM", "Lo", 0), ("BAMUM LETTER PHASE-B PEESHI", "Lo", 0), ("BAMUM LETTER PHASE-B YAFU LEERAEWA", "Lo", 0), ("BAMUM LETTER PHASE-B LAM NSHUT NYAM", "Lo", 0), ("BAMUM LETTER PHASE-B NTIEE SHEUOQ", "Lo", 0), ("BAMUM LETTER PHASE-B NDU NJAA", "Lo", 0), ("BAMUM LETTER PHASE-B GHEUGHEUAEM", "Lo", 0), ("BAMUM LETTER PHASE-B PIT", "Lo", 0), ("BAMUM LETTER PHASE-B TU NSIEE", "Lo", 0), ("BAMUM LETTER PHASE-B SHET NJAQ", "Lo", 0), ("BAMUM LETTER PHASE-B SHEUAEQTU", "Lo", 0), ("BAMUM LETTER PHASE-B MFON TEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-B MBIT MBAAKET", "Lo", 0), ("BAMUM LETTER PHASE-B NYI NTEUM", "Lo", 0), ("BAMUM LETTER PHASE-B KEUPUQ", "Lo", 0), ("BAMUM LETTER PHASE-B GHEUGHEN", "Lo", 0), ("BAMUM LETTER PHASE-B KEUYEUX", "Lo", 0), ("BAMUM LETTER PHASE-B LAANAE", "Lo", 0), ("BAMUM LETTER PHASE-B PARUM", "Lo", 0), ("BAMUM LETTER PHASE-B VEUM", "Lo", 0), ("BAMUM LETTER PHASE-B NGKINDI MVOP", "Lo", 0), ("BAMUM LETTER PHASE-B NGGEU MBU", "Lo", 0), ("BAMUM LETTER PHASE-B WUAET", "Lo", 0), ("BAMUM LETTER PHASE-B SAKEUAE", "Lo", 0), ("BAMUM LETTER PHASE-B TAAM", "Lo", 0), ("BAMUM LETTER PHASE-B MEUQ", "Lo", 0), ("BAMUM LETTER PHASE-B NGGUOQ", "Lo", 0), ("BAMUM LETTER PHASE-B NGGUOQ LARGE", "Lo", 0), ("BAMUM LETTER PHASE-B MFIYAQ", "Lo", 0), ("BAMUM LETTER PHASE-B SUE", "Lo", 0), ("BAMUM LETTER PHASE-B MBEURI", "Lo", 0), ("BAMUM LETTER PHASE-B MONTIEEN", "Lo", 0), ("BAMUM LETTER PHASE-B NYAEMAE", "Lo", 0), ("BAMUM LETTER PHASE-B PUNGAAM", "Lo", 0), ("BAMUM LETTER PHASE-B MEUT NGGEET", "Lo", 0), ("BAMUM LETTER PHASE-B FEUX", "Lo", 0), ("BAMUM LETTER PHASE-B MBUOQ", "Lo", 0), ("BAMUM LETTER PHASE-B FEE", "Lo", 0), ("BAMUM LETTER PHASE-B KEUAEM", "Lo", 0), ("BAMUM LETTER PHASE-B MA NJEUAENA", "Lo", 0), ("BAMUM LETTER PHASE-B MA NJUQA", "Lo", 0), ("BAMUM LETTER PHASE-B LET", "Lo", 0), ("BAMUM LETTER PHASE-B NGGAAM", "Lo", 0), ("BAMUM LETTER PHASE-B NSEN", "Lo", 0), ("BAMUM LETTER PHASE-B MA", "Lo", 0), ("BAMUM LETTER PHASE-B KIQ", "Lo", 0), ("BAMUM LETTER PHASE-B NGOM", "Lo", 0), ("BAMUM LETTER PHASE-C NGKUE MAEMBA", "Lo", 0), ("BAMUM LETTER PHASE-C NZA", "Lo", 0), ("BAMUM LETTER PHASE-C YUM", "Lo", 0), ("BAMUM LETTER PHASE-C WANGKUOQ", "Lo", 0), ("BAMUM LETTER PHASE-C NGGEN", "Lo", 0), ("BAMUM LETTER PHASE-C NDEUAEREE", "Lo", 0), ("BAMUM LETTER PHASE-C NGKAQ", "Lo", 0), ("BAMUM LETTER PHASE-C GHARAE", "Lo", 0), ("BAMUM LETTER PHASE-C MBEEKEET", "Lo", 0), ("BAMUM LETTER PHASE-C GBAYI", "Lo", 0), ("BAMUM LETTER PHASE-C NYIR MKPARAQ MEUN", "Lo", 0), ("BAMUM LETTER PHASE-C NTU MBIT", "Lo", 0), ("BAMUM LETTER PHASE-C MBEUM", "Lo", 0), ("BAMUM LETTER PHASE-C PIRIEEN", "Lo", 0), ("BAMUM LETTER PHASE-C NDOMBU", "Lo", 0), ("BAMUM LETTER PHASE-C MBAA CABBAGE-TREE", "Lo", 0), ("BAMUM LETTER PHASE-C KEUSHEUAEP", "Lo", 0), ("BAMUM LETTER PHASE-C GHAP", "Lo", 0), ("BAMUM LETTER PHASE-C KEUKAQ", "Lo", 0), ("BAMUM LETTER PHASE-C YU MUOMAE", "Lo", 0), ("BAMUM LETTER PHASE-C NZEUM", "Lo", 0), ("BAMUM LETTER PHASE-C MBUE", "Lo", 0), ("BAMUM LETTER PHASE-C NSEUAEN", "Lo", 0), ("BAMUM LETTER PHASE-C MBIT", "Lo", 0), ("BAMUM LETTER PHASE-C YEUQ", "Lo", 0), ("BAMUM LETTER PHASE-C KPARAQ", "Lo", 0), ("BAMUM LETTER PHASE-C KAA", "Lo", 0), ("BAMUM LETTER PHASE-C SEUX", "Lo", 0), ("BAMUM LETTER PHASE-C NDIDA", "Lo", 0), ("BAMUM LETTER PHASE-C TAASHAE", "Lo", 0), ("BAMUM LETTER PHASE-C NJUEQ", "Lo", 0), ("BAMUM LETTER PHASE-C TITA YUE", "Lo", 0), ("BAMUM LETTER PHASE-C SUAET", "Lo", 0), ("BAMUM LETTER PHASE-C NGGUAEN NYAM", "Lo", 0), ("BAMUM LETTER PHASE-C VEUX", "Lo", 0), ("BAMUM LETTER PHASE-C NANSANAQ", "Lo", 0), ("BAMUM LETTER PHASE-C MA KEUAERI", "Lo", 0), ("BAMUM LETTER PHASE-C NTAA", "Lo", 0), ("BAMUM LETTER PHASE-C NGGUON", "Lo", 0), ("BAMUM LETTER PHASE-C LAP", "Lo", 0), ("BAMUM LETTER PHASE-C MBIRIEEN", "Lo", 0), ("BAMUM LETTER PHASE-C MGBASAQ", "Lo", 0), ("BAMUM LETTER PHASE-C NTEUNGBA", "Lo", 0), ("BAMUM LETTER PHASE-C TEUTEUX", "Lo", 0), ("BAMUM LETTER PHASE-C NGGUM", "Lo", 0), ("BAMUM LETTER PHASE-C FUE", "Lo", 0), ("BAMUM LETTER PHASE-C NDEUT", "Lo", 0), ("BAMUM LETTER PHASE-C NSA", "Lo", 0), ("BAMUM LETTER PHASE-C NSHAQ", "Lo", 0), ("BAMUM LETTER PHASE-C BUNG", "Lo", 0), ("BAMUM LETTER PHASE-C VEUAEPEN", "Lo", 0), ("BAMUM LETTER PHASE-C MBERAE", "Lo", 0), ("BAMUM LETTER PHASE-C RU", "Lo", 0), ("BAMUM LETTER PHASE-C NJAEM", "Lo", 0), ("BAMUM LETTER PHASE-C LAM", "Lo", 0), ("BAMUM LETTER PHASE-C TITUAEP", "Lo", 0), ("BAMUM LETTER PHASE-C NSUOT NGOM", "Lo", 0), ("BAMUM LETTER PHASE-C NJEEEE", "Lo", 0), ("BAMUM LETTER PHASE-C KET", "Lo", 0), ("BAMUM LETTER PHASE-C NGGU", "Lo", 0), ("BAMUM LETTER PHASE-C MAESI", "Lo", 0), ("BAMUM LETTER PHASE-C MBUAEM", "Lo", 0), ("BAMUM LETTER PHASE-C LU", "Lo", 0), ("BAMUM LETTER PHASE-C KUT", "Lo", 0), ("BAMUM LETTER PHASE-C NJAM", "Lo", 0), ("BAMUM LETTER PHASE-C NGOM", "Lo", 0), ("BAMUM LETTER PHASE-C WUP", "Lo", 0), ("BAMUM LETTER PHASE-C NGGUEET", "Lo", 0), ("BAMUM LETTER PHASE-C NSOM", "Lo", 0), ("BAMUM LETTER PHASE-C NTEN", "Lo", 0), ("BAMUM LETTER PHASE-C KUOP NKAARAE", "Lo", 0), ("BAMUM LETTER PHASE-C NSUN", "Lo", 0), ("BAMUM LETTER PHASE-C NDAM", "Lo", 0), ("BAMUM LETTER PHASE-C MA NSIEE", "Lo", 0), ("BAMUM LETTER PHASE-C YAA", "Lo", 0), ("BAMUM LETTER PHASE-C NDAP", "Lo", 0), ("BAMUM LETTER PHASE-C SHUEQ", "Lo", 0), ("BAMUM LETTER PHASE-C SETFON", "Lo", 0), ("BAMUM LETTER PHASE-C MBI", "Lo", 0), ("BAMUM LETTER PHASE-C MAEMBA", "Lo", 0), ("BAMUM LETTER PHASE-C MBANYI", "Lo", 0), ("BAMUM LETTER PHASE-C KEUSEUX", "Lo", 0), ("BAMUM LETTER PHASE-C MBEUX", "Lo", 0), ("BAMUM LETTER PHASE-C KEUM", "Lo", 0), ("BAMUM LETTER PHASE-C MBAA PICKET", "Lo", 0), ("BAMUM LETTER PHASE-C YUWOQ", "Lo", 0), ("BAMUM LETTER PHASE-C NJEUX", "Lo", 0), ("BAMUM LETTER PHASE-C MIEE", "Lo", 0), ("BAMUM LETTER PHASE-C MUAE", "Lo", 0), ("BAMUM LETTER PHASE-C SHIQ", "Lo", 0), ("BAMUM LETTER PHASE-C KEN LAW", "Lo", 0), ("BAMUM LETTER PHASE-C KEN FATIGUE", "Lo", 0), ("BAMUM LETTER PHASE-C NGAQ", "Lo", 0), ("BAMUM LETTER PHASE-C NAQ", "Lo", 0), ("BAMUM LETTER PHASE-C LIQ", "Lo", 0), ("BAMUM LETTER PHASE-C PIN", "Lo", 0), ("BAMUM LETTER PHASE-C PEN", "Lo", 0), ("BAMUM LETTER PHASE-C TET", "Lo", 0), ("BAMUM LETTER PHASE-D MBUO", "Lo", 0), ("BAMUM LETTER PHASE-D WAP", "Lo", 0), ("BAMUM LETTER PHASE-D NJI", "Lo", 0), ("BAMUM LETTER PHASE-D MFON", "Lo", 0), ("BAMUM LETTER PHASE-D NJIEE", "Lo", 0), ("BAMUM LETTER PHASE-D LIEE", "Lo", 0), ("BAMUM LETTER PHASE-D NJEUT", "Lo", 0), ("BAMUM LETTER PHASE-D NSHEE", "Lo", 0), ("BAMUM LETTER PHASE-D NGGAAMAE", "Lo", 0), ("BAMUM LETTER PHASE-D NYAM", "Lo", 0), ("BAMUM LETTER PHASE-D WUAEN", "Lo", 0), ("BAMUM LETTER PHASE-D NGKUN", "Lo", 0), ("BAMUM LETTER PHASE-D SHEE", "Lo", 0), ("BAMUM LETTER PHASE-D NGKAP", "Lo", 0), ("BAMUM LETTER PHASE-D KEUAETMEUN", "Lo", 0), ("BAMUM LETTER PHASE-D TEUT", "Lo", 0), ("BAMUM LETTER PHASE-D SHEUAE", "Lo", 0), ("BAMUM LETTER PHASE-D NJAP", "Lo", 0), ("BAMUM LETTER PHASE-D SUE", "Lo", 0), ("BAMUM LETTER PHASE-D KET", "Lo", 0), ("BAMUM LETTER PHASE-D YAEMMAE", "Lo", 0), ("BAMUM LETTER PHASE-D KUOM", "Lo", 0), ("BAMUM LETTER PHASE-D SAP", "Lo", 0), ("BAMUM LETTER PHASE-D MFEUT", "Lo", 0), ("BAMUM LETTER PHASE-D NDEUX", "Lo", 0), ("BAMUM LETTER PHASE-D MALEERI", "Lo", 0), ("BAMUM LETTER PHASE-D MEUT", "Lo", 0), ("BAMUM LETTER PHASE-D SEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-D YEN", "Lo", 0), ("BAMUM LETTER PHASE-D NJEUAEM", "Lo", 0), ("BAMUM LETTER PHASE-D KEUOT MBUAE", "Lo", 0), ("BAMUM LETTER PHASE-D NGKEURI", "Lo", 0), ("BAMUM LETTER PHASE-D TU", "Lo", 0), ("BAMUM LETTER PHASE-D GHAA", "Lo", 0), ("BAMUM LETTER PHASE-D NGKYEE", "Lo", 0), ("BAMUM LETTER PHASE-D FEUFEUAET", "Lo", 0), ("BAMUM LETTER PHASE-D NDEE", "Lo", 0), ("BAMUM LETTER PHASE-D MGBOFUM", "Lo", 0), ("BAMUM LETTER PHASE-D LEUAEP", "Lo", 0), ("BAMUM LETTER PHASE-D NDON", "Lo", 0), ("BAMUM LETTER PHASE-D MONI", "Lo", 0), ("BAMUM LETTER PHASE-D MGBEUN", "Lo", 0), ("BAMUM LETTER PHASE-D PUUT", "Lo", 0), ("BAMUM LETTER PHASE-D MGBIEE", "Lo", 0), ("BAMUM LETTER PHASE-D MFO", "Lo", 0), ("BAMUM LETTER PHASE-D LUM", "Lo", 0), ("BAMUM LETTER PHASE-D NSIEEP", "Lo", 0), ("BAMUM LETTER PHASE-D MBAA", "Lo", 0), ("BAMUM LETTER PHASE-D KWAET", "Lo", 0), ("BAMUM LETTER PHASE-D NYET", "Lo", 0), ("BAMUM LETTER PHASE-D TEUAEN", "Lo", 0), ("BAMUM LETTER PHASE-D SOT", "Lo", 0), ("BAMUM LETTER PHASE-D YUWOQ", "Lo", 0), ("BAMUM LETTER PHASE-D KEUM", "Lo", 0), ("BAMUM LETTER PHASE-D RAEM", "Lo", 0), ("BAMUM LETTER PHASE-D TEEEE", "Lo", 0), ("BAMUM LETTER PHASE-D NGKEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-D MFEUAE", "Lo", 0), ("BAMUM LETTER PHASE-D NSIEET", "Lo", 0), ("BAMUM LETTER PHASE-D KEUP", "Lo", 0), ("BAMUM LETTER PHASE-D PIP", "Lo", 0), ("BAMUM LETTER PHASE-D PEUTAE", "Lo", 0), ("BAMUM LETTER PHASE-D NYUE", "Lo", 0), ("BAMUM LETTER PHASE-D LET", "Lo", 0), ("BAMUM LETTER PHASE-D NGGAAM", "Lo", 0), ("BAMUM LETTER PHASE-D MFIEE", "Lo", 0), ("BAMUM LETTER PHASE-D NGGWAEN", "Lo", 0), ("BAMUM LETTER PHASE-D YUOM", "Lo", 0), ("BAMUM LETTER PHASE-D PAP", "Lo", 0), ("BAMUM LETTER PHASE-D YUOP", "Lo", 0), ("BAMUM LETTER PHASE-D NDAM", "Lo", 0), ("BAMUM LETTER PHASE-D NTEUM", "Lo", 0), ("BAMUM LETTER PHASE-D SUAE", "Lo", 0), ("BAMUM LETTER PHASE-D KUN", "Lo", 0), ("BAMUM LETTER PHASE-D NGGEUX", "Lo", 0), ("BAMUM LETTER PHASE-D NGKIEE", "Lo", 0), ("BAMUM LETTER PHASE-D TUOT", "Lo", 0), ("BAMUM LETTER PHASE-D MEUN", "Lo", 0), ("BAMUM LETTER PHASE-D KUQ", "Lo", 0), ("BAMUM LETTER PHASE-D NSUM", "Lo", 0), ("BAMUM LETTER PHASE-D TEUN", "Lo", 0), ("BAMUM LETTER PHASE-D MAENJET", "Lo", 0), ("BAMUM LETTER PHASE-D NGGAP", "Lo", 0), ("BAMUM LETTER PHASE-D LEUM", "Lo", 0), ("BAMUM LETTER PHASE-D NGGUOM", "Lo", 0), ("BAMUM LETTER PHASE-D NSHUT", "Lo", 0), ("BAMUM LETTER PHASE-D NJUEQ", "Lo", 0), ("BAMUM LETTER PHASE-D GHEUAE", "Lo", 0), ("BAMUM LETTER PHASE-D KU", "Lo", 0), ("BAMUM LETTER PHASE-D REN OLD", "Lo", 0), ("BAMUM LETTER PHASE-D TAE", "Lo", 0), ("BAMUM LETTER PHASE-D TOQ", "Lo", 0), ("BAMUM LETTER PHASE-D NYI", "Lo", 0), ("BAMUM LETTER PHASE-D RII", "Lo", 0), ("BAMUM LETTER PHASE-D LEEEE", "Lo", 0), ("BAMUM LETTER PHASE-D MEEEE", "Lo", 0), ("BAMUM LETTER PHASE-D M", "Lo", 0), ("BAMUM LETTER PHASE-D SUU", "Lo", 0), ("BAMUM LETTER PHASE-D MU", "Lo", 0), ("BAMUM LETTER PHASE-D SHII", "Lo", 0), ("BAMUM LETTER PHASE-D SHEUX", "Lo", 0), ("BAMUM LETTER PHASE-D KYEE", "Lo", 0), ("BAMUM LETTER PHASE-D NU", "Lo", 0), ("BAMUM LETTER PHASE-D SHU", "Lo", 0), ("BAMUM LETTER PHASE-D NTEE", "Lo", 0), ("BAMUM LETTER PHASE-D PEE", "Lo", 0), ("BAMUM LETTER PHASE-D NI", "Lo", 0), ("BAMUM LETTER PHASE-D SHOQ", "Lo", 0), ("BAMUM LETTER PHASE-D PUQ", "Lo", 0), ("BAMUM LETTER PHASE-D MVOP", "Lo", 0), ("BAMUM LETTER PHASE-D LOQ", "Lo", 0), ("BAMUM LETTER PHASE-D REN MUCH", "Lo", 0), ("BAMUM LETTER PHASE-D TI", "Lo", 0), ("BAMUM LETTER PHASE-D NTUU", "Lo", 0), ("BAMUM LETTER PHASE-D MBAA SEVEN", "Lo", 0), ("BAMUM LETTER PHASE-D SAQ", "Lo", 0), ("BAMUM LETTER PHASE-D FAA", "Lo", 0), ("BAMUM LETTER PHASE-E NDAP", "Lo", 0), ("BAMUM LETTER PHASE-E TOON", "Lo", 0), ("BAMUM LETTER PHASE-E MBEUM", "Lo", 0), ("BAMUM LETTER PHASE-E LAP", "Lo", 0), ("BAMUM LETTER PHASE-E VOM", "Lo", 0), ("BAMUM LETTER PHASE-E LOON", "Lo", 0), ("BAMUM LETTER PHASE-E PAA", "Lo", 0), ("BAMUM LETTER PHASE-E SOM", "Lo", 0), ("BAMUM LETTER PHASE-E RAQ", "Lo", 0), ("BAMUM LETTER PHASE-E NSHUOP", "Lo", 0), ("BAMUM LETTER PHASE-E NDUN", "Lo", 0), ("BAMUM LETTER PHASE-E PUAE", "Lo", 0), ("BAMUM LETTER PHASE-E TAM", "Lo", 0), ("BAMUM LETTER PHASE-E NGKA", "Lo", 0), ("BAMUM LETTER PHASE-E KPEUX", "Lo", 0), ("BAMUM LETTER PHASE-E WUO", "Lo", 0), ("BAMUM LETTER PHASE-E SEE", "Lo", 0), ("BAMUM LETTER PHASE-E NGGEUAET", "Lo", 0), ("BAMUM LETTER PHASE-E PAAM", "Lo", 0), ("BAMUM LETTER PHASE-E TOO", "Lo", 0), ("BAMUM LETTER PHASE-E KUOP", "Lo", 0), ("BAMUM LETTER PHASE-E LOM", "Lo", 0), ("BAMUM LETTER PHASE-E NSHIEE", "Lo", 0), ("BAMUM LETTER PHASE-E NGOP", "Lo", 0), ("BAMUM LETTER PHASE-E MAEM", "Lo", 0), ("BAMUM LETTER PHASE-E NGKEUX", "Lo", 0), ("BAMUM LETTER PHASE-E NGOQ", "Lo", 0), ("BAMUM LETTER PHASE-E NSHUE", "Lo", 0), ("BAMUM LETTER PHASE-E RIMGBA", "Lo", 0), ("BAMUM LETTER PHASE-E NJEUX", "Lo", 0), ("BAMUM LETTER PHASE-E PEEM", "Lo", 0), ("BAMUM LETTER PHASE-E SAA", "Lo", 0), ("BAMUM LETTER PHASE-E NGGURAE", "Lo", 0), ("BAMUM LETTER PHASE-E MGBA", "Lo", 0), ("BAMUM LETTER PHASE-E GHEUX", "Lo", 0), ("BAMUM LETTER PHASE-E NGKEUAEM", "Lo", 0), ("BAMUM LETTER PHASE-E NJAEMLI", "Lo", 0), ("BAMUM LETTER PHASE-E MAP", "Lo", 0), ("BAMUM LETTER PHASE-E LOOT", "Lo", 0), ("BAMUM LETTER PHASE-E NGGEEEE", "Lo", 0), ("BAMUM LETTER PHASE-E NDIQ", "Lo", 0), ("BAMUM LETTER PHASE-E TAEN NTEUM", "Lo", 0), ("BAMUM LETTER PHASE-E SET", "Lo", 0), ("BAMUM LETTER PHASE-E PUM", "Lo", 0), ("BAMUM LETTER PHASE-E NDAA SOFTNESS", "Lo", 0), ("BAMUM LETTER PHASE-E NGGUAESHAE NYAM", "Lo", 0), ("BAMUM LETTER PHASE-E YIEE", "Lo", 0), ("BAMUM LETTER PHASE-E GHEUN", "Lo", 0), ("BAMUM LETTER PHASE-E TUAE", "Lo", 0), ("BAMUM LETTER PHASE-E YEUAE", "Lo", 0), ("BAMUM LETTER PHASE-E PO", "Lo", 0), ("BAMUM LETTER PHASE-E TUMAE", "Lo", 0), ("BAMUM LETTER PHASE-E KEUAE", "Lo", 0), ("BAMUM LETTER PHASE-E SUAEN", "Lo", 0), ("BAMUM LETTER PHASE-E TEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-E VEUAE", "Lo", 0), ("BAMUM LETTER PHASE-E WEUX", "Lo", 0), ("BAMUM LETTER PHASE-E LAAM", "Lo", 0), ("BAMUM LETTER PHASE-E PU", "Lo", 0), ("BAMUM LETTER PHASE-E TAAQ", "Lo", 0), ("BAMUM LETTER PHASE-E GHAAMAE", "Lo", 0), ("BAMUM LETTER PHASE-E NGEUREUT", "Lo", 0), ("BAMUM LETTER PHASE-E SHEUAEQ", "Lo", 0), ("BAMUM LETTER PHASE-E MGBEN", "Lo", 0), ("BAMUM LETTER PHASE-E MBEE", "Lo", 0), ("BAMUM LETTER PHASE-E NZAQ", "Lo", 0), ("BAMUM LETTER PHASE-E NKOM", "Lo", 0), ("BAMUM LETTER PHASE-E GBET", "Lo", 0), ("BAMUM LETTER PHASE-E TUM", "Lo", 0), ("BAMUM LETTER PHASE-E KUET", "Lo", 0), ("BAMUM LETTER PHASE-E YAP", "Lo", 0), ("BAMUM LETTER PHASE-E NYI CLEAVER", "Lo", 0), ("BAMUM LETTER PHASE-E YIT", "Lo", 0), ("BAMUM LETTER PHASE-E MFEUQ", "Lo", 0), ("BAMUM LETTER PHASE-E NDIAQ", "Lo", 0), ("BAMUM LETTER PHASE-E PIEEQ", "Lo", 0), ("BAMUM LETTER PHASE-E YUEQ", "Lo", 0), ("BAMUM LETTER PHASE-E LEUAEM", "Lo", 0), ("BAMUM LETTER PHASE-E FUE", "Lo", 0), ("BAMUM LETTER PHASE-E GBEUX", "Lo", 0), ("BAMUM LETTER PHASE-E NGKUP", "Lo", 0), ("BAMUM LETTER PHASE-E KET", "Lo", 0), ("BAMUM LETTER PHASE-E MAE", "Lo", 0), ("BAMUM LETTER PHASE-E NGKAAMI", "Lo", 0), ("BAMUM LETTER PHASE-E GHET", "Lo", 0), ("BAMUM LETTER PHASE-E FA", "Lo", 0), ("BAMUM LETTER PHASE-E NTUM", "Lo", 0), ("BAMUM LETTER PHASE-E PEUT", "Lo", 0), ("BAMUM LETTER PHASE-E YEUM", "Lo", 0), ("BAMUM LETTER PHASE-E NGGEUAE", "Lo", 0), ("BAMUM LETTER PHASE-E NYI BETWEEN", "Lo", 0), ("BAMUM LETTER PHASE-E NZUQ", "Lo", 0), ("BAMUM LETTER PHASE-E POON", "Lo", 0), ("BAMUM LETTER PHASE-E MIEE", "Lo", 0), ("BAMUM LETTER PHASE-E FUET", "Lo", 0), ("BAMUM LETTER PHASE-E NAE", "Lo", 0), ("BAMUM LETTER PHASE-E MUAE", "Lo", 0), ("BAMUM LETTER PHASE-E GHEUAE", "Lo", 0), ("BAMUM LETTER PHASE-E FU I", "Lo", 0), ("BAMUM LETTER PHASE-E MVI", "Lo", 0), ("BAMUM LETTER PHASE-E PUAQ", "Lo", 0), ("BAMUM LETTER PHASE-E NGKUM", "Lo", 0), ("BAMUM LETTER PHASE-E KUT", "Lo", 0), ("BAMUM LETTER PHASE-E PIET", "Lo", 0), ("BAMUM LETTER PHASE-E NTAP", "Lo", 0), ("BAMUM LETTER PHASE-E YEUAET", "Lo", 0), ("BAMUM LETTER PHASE-E NGGUP", "Lo", 0), ("BAMUM LETTER PHASE-E PA PEOPLE", "Lo", 0), ("BAMUM LETTER PHASE-E FU CALL", "Lo", 0), ("BAMUM LETTER PHASE-E FOM", "Lo", 0), ("BAMUM LETTER PHASE-E NJEE", "Lo", 0), ("BAMUM LETTER PHASE-E A", "Lo", 0), ("BAMUM LETTER PHASE-E TOQ", "Lo", 0), ("BAMUM LETTER PHASE-E O", "Lo", 0), ("BAMUM LETTER PHASE-E I", "Lo", 0), ("BAMUM LETTER PHASE-E LAQ", "Lo", 0), ("BAMUM LETTER PHASE-E PA PLURAL", "Lo", 0), ("BAMUM LETTER PHASE-E TAA", "Lo", 0), ("BAMUM LETTER PHASE-E TAQ", "Lo", 0), ("BAMUM LETTER PHASE-E NDAA MY HOUSE", "Lo", 0), ("BAMUM LETTER PHASE-E SHIQ", "Lo", 0), ("BAMUM LETTER PHASE-E YEUX", "Lo", 0), ("BAMUM LETTER PHASE-E NGUAE", "Lo", 0), ("BAMUM LETTER PHASE-E YUAEN", "Lo", 0), ("BAMUM LETTER PHASE-E YOQ SWIMMING", "Lo", 0), ("BAMUM LETTER PHASE-E YOQ COVER", "Lo", 0), ("BAMUM LETTER PHASE-E YUQ", "Lo", 0), ("BAMUM LETTER PHASE-E YUN", "Lo", 0), ("BAMUM LETTER PHASE-E KEUX", "Lo", 0), ("BAMUM LETTER PHASE-E PEUX", "Lo", 0), ("BAMUM LETTER PHASE-E NJEE EPOCH", "Lo", 0), ("BAMUM LETTER PHASE-E PUE", "Lo", 0), ("BAMUM LETTER PHASE-E WUE", "Lo", 0), ("BAMUM LETTER PHASE-E FEE", "Lo", 0), ("BAMUM LETTER PHASE-E VEE", "Lo", 0), ("BAMUM LETTER PHASE-E LU", "Lo", 0), ("BAMUM LETTER PHASE-E MI", "Lo", 0), ("BAMUM LETTER PHASE-E REUX", "Lo", 0), ("BAMUM LETTER PHASE-E RAE", "Lo", 0), ("BAMUM LETTER PHASE-E NGUAET", "Lo", 0), ("BAMUM LETTER PHASE-E NGA", "Lo", 0), ("BAMUM LETTER PHASE-E SHO", "Lo", 0), ("BAMUM LETTER PHASE-E SHOQ", "Lo", 0), ("BAMUM LETTER PHASE-E FU REMEDY", "Lo", 0), ("BAMUM LETTER PHASE-E NA", "Lo", 0), ("BAMUM LETTER PHASE-E PI", "Lo", 0), ("BAMUM LETTER PHASE-E LOQ", "Lo", 0), ("BAMUM LETTER PHASE-E KO", "Lo", 0), ("BAMUM LETTER PHASE-E MEN", "Lo", 0), ("BAMUM LETTER PHASE-E MA", "Lo", 0), ("BAMUM LETTER PHASE-E MAQ", "Lo", 0), ("BAMUM LETTER PHASE-E TEU", "Lo", 0), ("BAMUM LETTER PHASE-E KI", "Lo", 0), ("BAMUM LETTER PHASE-E MON", "Lo", 0), ("BAMUM LETTER PHASE-E TEN", "Lo", 0), ("BAMUM LETTER PHASE-E FAQ", "Lo", 0), ("BAMUM LETTER PHASE-E GHOM", "Lo", 0), ("BAMUM LETTER PHASE-F KA", "Lo", 0), ("BAMUM LETTER PHASE-F U", "Lo", 0), ("BAMUM LETTER PHASE-F KU", "Lo", 0), ("BAMUM LETTER PHASE-F EE", "Lo", 0), ("BAMUM LETTER PHASE-F REE", "Lo", 0), ("BAMUM LETTER PHASE-F TAE", "Lo", 0), ("BAMUM LETTER PHASE-F NYI", "Lo", 0), ("BAMUM LETTER PHASE-F LA", "Lo", 0), ("BAMUM LETTER PHASE-F RII", "Lo", 0), ("BAMUM LETTER PHASE-F RIEE", "Lo", 0), ("BAMUM LETTER PHASE-F MEEEE", "Lo", 0), ("BAMUM LETTER PHASE-F TAA", "Lo", 0), ("BAMUM LETTER PHASE-F NDAA", "Lo", 0), ("BAMUM LETTER PHASE-F NJAEM", "Lo", 0), ("BAMUM LETTER PHASE-F M", "Lo", 0), ("BAMUM LETTER PHASE-F SUU", "Lo", 0), ("BAMUM LETTER PHASE-F SHII", "Lo", 0), ("BAMUM LETTER PHASE-F SI", "Lo", 0), ("BAMUM LETTER PHASE-F SEUX", "Lo", 0), ("BAMUM LETTER PHASE-F KYEE", "Lo", 0), ("BAMUM LETTER PHASE-F KET", "Lo", 0), ("BAMUM LETTER PHASE-F NUAE", "Lo", 0), ("BAMUM LETTER PHASE-F NU", "Lo", 0), ("BAMUM LETTER PHASE-F NJUAE", "Lo", 0), ("BAMUM LETTER PHASE-F YOQ", "Lo", 0), ("BAMUM LETTER PHASE-F SHU", "Lo", 0), ("BAMUM LETTER PHASE-F YA", "Lo", 0), ("BAMUM LETTER PHASE-F NSHA", "Lo", 0), ("BAMUM LETTER PHASE-F PEUX", "Lo", 0), ("BAMUM LETTER PHASE-F NTEE", "Lo", 0), ("BAMUM LETTER PHASE-F WUE", "Lo", 0), ("BAMUM LETTER PHASE-F PEE", "Lo", 0), ("BAMUM LETTER PHASE-F RU", "Lo", 0), ("BAMUM LETTER PHASE-F NI", "Lo", 0), ("BAMUM LETTER PHASE-F REUX", "Lo", 0), ("BAMUM LETTER PHASE-F KEN", "Lo", 0), ("BAMUM LETTER PHASE-F NGKWAEN", "Lo", 0), ("BAMUM LETTER PHASE-F NGGA", "Lo", 0), ("BAMUM LETTER PHASE-F SHO", "Lo", 0), ("BAMUM LETTER PHASE-F PUAE", "Lo", 0), ("BAMUM LETTER PHASE-F FOM", "Lo", 0), ("BAMUM LETTER PHASE-F WA", "Lo", 0), ("BAMUM LETTER PHASE-F LI", "Lo", 0), ("BAMUM LETTER PHASE-F LOQ", "Lo", 0), ("BAMUM LETTER PHASE-F KO", "Lo", 0), ("BAMUM LETTER PHASE-F MBEN", "Lo", 0), ("BAMUM LETTER PHASE-F REN", "Lo", 0), ("BAMUM LETTER PHASE-F MA", "Lo", 0), ("BAMUM LETTER PHASE-F MO", "Lo", 0), ("BAMUM LETTER PHASE-F MBAA", "Lo", 0), ("BAMUM LETTER PHASE-F TET", "Lo", 0), ("BAMUM LETTER PHASE-F KPA", "Lo", 0), ("BAMUM LETTER PHASE-F SAMBA", "Lo", 0), ("BAMUM LETTER PHASE-F VUEQ", "Lo", 0), )
https://github.com/roenass/cocteles
https://raw.githubusercontent.com/roenass/cocteles/main/Noir%2C%20Forbidden%2C%20Classic%20and%20New%20Cocktails.typ
typst
//%!TEX TS-program = typst #import "@preview/in-dexter:0.5.3": * #let indexIn = index.with(index: "Ingredients") #set page(paper: "a4") //#let cocktailcolor = rgb("#041E90") #let cocktailcolor = rgb("#102080") #set heading(numbering: "1.1", supplement: "Potion") #set text( font: "Calibri", fractions: false, discretionary-ligatures: false) #show outline.entry.where(level: 1): it => { v(12pt, weak: true) strong(it) } #show heading.where(level: 1): it => [ #set align(center) #set text(24pt, weight: "bold") #block(smallcaps(it.body)) ] #set outline(fill:line(length: 100%, stroke: 0.001pt)) #let ingredient(content) = [#content#indexIn[#content]] #let stick(a, b, threshold: 7em) = { block(a + v(threshold), breakable: false) v(-1 * threshold) b } #let cocktail(label: none, threshold: 7em, cocktail, recipe) = stick(threshold: threshold, [#index[#cocktail] #heading(level:2)[#cocktail]#label],[#v(-3pt)#recipe]) #let moviecocktail(label: none, threshold: 7em, cocktail, movie, recipe) = stick(threshold: threshold, [#index[#cocktail] #heading(level:2)[#cocktail #text(cocktailcolor)[โ˜› #emph[#movie]]]#label],[#v(-3pt)#recipe]) #set page(margin: (bottom: 0cm)) #v(4cm) #heading(level: 1, numbering: none, outlined: false, text(36pt)[โ‡ J\$' Book of Cocktails โ‡œ]) #align(center, text(25.8pt, cocktailcolor)[*#smallcaps[Guaranteed 100% Stress Free]*]) #v(-10cm) #align(center + bottom)[#image("Cocktail.png", width: 100%)] #set page(margin: (top: 1.8cm, bottom: 1.8cm)) #pagebreak() #set page(numbering: "1/1") #set page(footer: context [ #set align(center) #text(size: 10pt, weight: "semibold", style: "normal", tracking: 0pt)[ #counter(page).display( "โ‡ 1 of 1 โ‡œ", both: true, )] ]) #align(left, text(14pt)[*#smallcaps[Contents]*]) #columns(1, outline(title: none, indent: auto)) #show outline.entry.where(level: 1): it => {it} //#show quote: it => [#emph(it.body)] #set quote(block: true, quotes: true) //#pagebreak() //#align(left, text(14pt)[*#smallcaps[Upcoming]*]) //#columns(1, outline(title: none, indent: auto, target: <up>)) //#align(left, text(14pt)[*#smallcaps[Favourites]*]) //#columns(1, outline(title: none, indent: auto, target: <fav>)) #pagebreak() = The First Principles of Laid-Back Cocktails #quote(attribution: [<NAME>])[ _I'm still pretty dumb about girl stuff. For a while I said, "Ah, girls are stupid." But after seeing all these Jeanne Moreau movies, I think being a girl is where it's at. Like when I'm about thirty-five I'm gonna start wearing black cocktail dresses and become a real cunt._] == Liberate Your Libations //#v(0mm)#align(right)[#image("cornholio.png", width: 3%)]#v(-16mm) You can't make a drink with ingredients you don't have. You can try to out-snob everyone and be extremely specific in brands, vintages, bottlings, measures, procedures. Such is the path to infinite injury. Let go. Relax. Don't be chained by the recipe. Here, we're taking things easy. Some things are just rare, sometimes very hard or even impossible to find. Yet the essence of a good cocktail is that it has a robustness to it. Moreover, tastes differ. Respect the backbone of the recipe, not the frills. Many bloody battles have been fought over the exact gin versus vermouth proportions in a dry martini. Legend has it that <NAME> merely wanted the vermouth to be present in the same room, instead of added to the drink; and that when the supply of vermouth ran out in WWII he acknowledged its absence in the room by nodding eastward. <NAME>'s recipe prescribes a full measure of Noilly Prat. Fine with me. He garnishes with three olives. I'd rather not. And 007's martini doesn't even contain gin. It's a vodka martini. Which is shaken, not stirred โ€” utter blasphemy in the Church of Martini purists. All these are just fine. There's plenty of leeway in cocktails. Many recipes are overly specific, which distracts from a cocktail's core structure. If it's a whisky sour type cocktail, any blend and any sour will do. Does the Dom Pรฉrignon 1955 merely serve the purpose of adding some fizz? Then any another dry sparkling white whine will work just as well. If the recipe calls for a herbal undertone and you don't happen to have Lillet Blanc available? Use another fortified herbal concocture. If the function of an addition is just adding some colour and a bit of sweet? Be creative. == Garnish is Optional It's all about the drink. Don't sweat the small stuff; and much of it is small stuff. == Measures In cocktail, ingredients are quite often measured in ounces. Another chapter in the โ€˜anything but the metric systemโ€™ folly. Anyway, an ounce, short oz, is 60 milliliters, short 60ml. Or 6 centiliters (6cl). One other measure often used is the bar spoon, also known as tea spoon. For 'Muricans, it's about 1/10th of your average gerbil. (A bottle of soda, though, contains about 1/4th of an average domestic shorthair _felis catus_.) \ Anyway: a bar spoon is 5ml. A table spoon is three bar spoons: 15ml (about 18 peanuts for the metric-allergic). And a pinch is a pinch, a dash is a dash, and a splash a splash. == What's With The Glasses, Babe? Dozens (of not more) highly specific glasses are used for cocktails out there. I've simplified (well, almost) to _three_: 1. the _cocktail_ glass, also known as the _martini_ glass. See cover. Holds about 2ยฝ-3 oz, say 160ml. 2. the (whiskey) _tumbler_ or _rocks_ glass. Holds about 3-3ยฝ oz, say 180-200ml. 2. the _highball_ or _longdrink_ glass. Holds about 4-5oz, say 250-300ml. These will do for me. But hey, if you enjoy vast arrays of exotic glassware, don't let that get in your way. And don't let me stop you sloshing your G&Tโ€™s from a fish bowl! Or snifter. Or shot glass. #pagebreak() = J\$โ€™ Hall of Fame <Favourites> #align(center, text(12.6pt, cocktailcolor)[*#smallcaps[Distinguished Tasty Beverages]*]) #v(12pt) #v(0mm)#align(right)[#image("yosemite.jpg", height: 30mm)]#v(-34mm) #moviecocktail(label: <drymartini>, [Dry Martini], [After Office Hours],[ - 4 oz #ingredient([Gin]) - 1 oz #ingredient([Dry Vermouth]) - #ingredient([Green Olives]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with an olive.]) #cocktail(label: <margarita>, [Margarita],[ - 2 oz #ingredient([Tequila]) - 1 oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lime Juice]) - Slice of #ingredient([Lime]) for garnish Decorate cocktail glass with a rim of salt (optional).]) #cocktail(label: <kirroyale>, [Kir Royale],[ - ยฝ oz #ingredient([Crรจme de Cassis]) - #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Peel for garnish Pour Crรจme de Cassis into champagne flute. Top with sparkling wine. Garnish with lemon twist.]) #cocktail(label: <bloodymary>, [Bloody Mary],[ - 2 oz #ingredient([Vodka]) - 4 oz #ingredient([Tomato Juice]) (other vegetable juices can be used) - ยฝ oz #ingredient([Lemon Juice]) - 1 bar spoon #ingredient([Horseradish]) - 1 bar spoon #ingredient([Worcestershire Sauce]) - 1 dash #ingredient([Tabasco]) - 1 pinch #ingredient([Celery Salt]) - 1 pinch #ingredient([Black Pepper]) Grind - #ingredient([Celery]), #ingredient([Pickled Vegetables]), #ingredient([Green Olives]) or whatever for garnish Stir liquids minus tomato juice, horseradish, and celery salt well. Add tomato juice and a generous amount of ice, cap tightly and gently roll shaker about 20 times. Strain into highball glass, grind black pepper grind on top and garnish.]) #cocktail(label: <merrywidow>, [Merry Widow],[ - 1ยฝ oz #ingredient([Gin]) - 1ยฝ oz #ingredient([Dry Vermouth]) - ยฝ oz #ingredient([Bรฉnรฉdictine]) - 2 dashes #ingredient([Absinthe]) - dashes #ingredient([Peychaudโ€™s Bitters]) (to taste) - #ingredient([Lemon]) Peel for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with twist of lemon peel.]) #cocktail(label: <firstward>, [First Ward],[ - 2 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยฝ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Orange Juice]) - ยผ oz #ingredient([Maraschino Liqueur]) - 1 bar spoon #ingredient([Absinthe]) - #ingredient([Lemon]) Peel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with lemon peel.]) #cocktail(label: <lilred>, [Lil Red],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Sweet Vermouth]) - ยผ oz #ingredient([Orange Liqueur]) - 2 dashes #ingredient([Peychaudโ€™s Bitters]) - #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into tumbler glass. Garnish with orange peel.]) #cocktail(label: <flatonmyflute>, [Flat on my Flute],[ - ยพ oz #ingredient([Gin]) - ยพ oz #ingredient([White Rum]) #indexIn([Rum]) - ยพ oz #ingredient([Orange Liqueur]) - ยผ oz #ingredient([Lemon Juice]) - 2 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Orange Peel]) for garnish Shake liquids with ice. Strain into champagne flute. Garnish with orange peel.]) #cocktail(label: <passagetoparadise>, [Passage to Paradise],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Dry Vermouth]) - 1 bar spoon #ingredient([Kirsch]) - 1 dash #ingredient([Angostura]) - #ingredient([Orange]) Peel for garnish - Cocktail #ingredient([Green Olives]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with orange peel and an olive.]) #cocktail(label: <champagnecocktail>, [Champagne Cocktail],[ - #ingredient([Champagne]) #indexIn([Bubbles]) - ยฝ oz #ingredient([Brandy]) (_optional_) - #ingredient([Sugar Cube]) - dashes #ingredient([Angostura]) (to taste) - #ingredient([Lemon]) Peel for garnish Pour a few dashes of angostura over the sugar cube, held in a spoon over a champagne flute and drop. Add brandy, top with well chilled champagne. Twist lemon peel over the glass and put it in.]) #cocktail([Caipirinha],[ - 2 oz #ingredient([Cachaรงa]) - 2 bar spoons #ingredient([Cane Sugar]) - 1 #ingredient([Lime]) - #ingredient([Lime]) Wheel for garnish Cut the lime into wedges. Muddle wedges with sugar in a tumbler glass. Fill with ice, top with cachaรงa and stir very lightly. Garnish with lime wheel.]) #cocktail(label: <legionnaire>, [Legionnaire],[ - 1 oz #ingredient([Brandy]) - 1ยฝ oz #ingredient([Dubonnet]) - ยพ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Honey Syrup]) - #ingredient([Mint]) Leaf for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with mint leaf.]) #cocktail([Negroni Pepe Rosa],[ - 2ยฝ dl #ingredient([Gin]) - 2ยฝ dl #ingredient([Campari]) - 2ยฝ dl #ingredient([Sweet Vermouth]) - 5 g #ingredient([Red Peppercorn]) (or #ingredient([Black Peppercorn]) for a Negroni Pepe Nero) #index[Negroni Pepe Nero] - #ingredient([Orange]) Peel for garnish Combine liquids in an airtight container, e.g. an empty bottle. Add peppercorn and let these infuse for at least a couple of weeks. Serve over ice in a tumbler glass. Garnish with an orange twist. \ _Alternatively_, add peppercorns to a bottle of gin and use peppered gin in the regular Negroni recipe.]) #cocktail([Yucca],[ - 2 oz #ingredient([Vodka]) - 2 #ingredient([Lemon]) - 2 #ingredient([Lime]) - 1 bar spoon #ingredient([Cane Sugar]) or #ingredient([Agave Syrup]) Cut lemons and limes into quarters, or smaller parts if they're big. Combine vodka, lemons, limes, and sugar. Muddle until sugar is dissolved and the juice has been squeezed out of the citrus fruit parts. Add ice and shake well. Strain into highball glasses over a few ice cubes.]) #cocktail([Manhattan],[ - 2 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Dry Vermouth]) - 1 oz #ingredient([Sweet Vermouth]) - 1 dash #ingredient([Angostura]) - #ingredient([Lemon]) Slice for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with a slice of lemon.]) #cocktail(label: <sidecar>, [Sidecar],[ - 2 oz #ingredient([Brandy]) - 1 oz #ingredient([Orange Liqueur]) - 1 oz #ingredient([Lemon Juice]) - #ingredient([Lemon]) Peel for garnish Shake liquids vigorously with ice. Strain into cocktail glass. Garnish with a twist of lemon.]) #pagebreak() = Martinis <Martinis> #v(-6pt) #v(0mm)#align(center)[#image("martini.png", height: 40mm)] //#v(-34mm) #v(-8pt) #align(center, text(10pt, cocktailcolor)[*#smallcaps[Sshaken or Shtirred]*]) #v(4pt) //#columns(3, outline(title:none, target: selector(heading).after(<Classics>, inclusive: true).before(<NuSkool>, inclusive: false))) //#v(12pt) //#pagebreak() #cocktail([Dubonnet Cocktail],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Dubonnet]) - #ingredient([Lemon]) Peel for garnish Shake liquids vigorously with ice. Strain into tumbler. Optionally add ice cubes. Garnish with a twist of lemon.]) #cocktail([Hanky Panky],[ - 1ยฝ oz #ingredient([Gin]) - 1ยฝ oz #ingredient([Sweet Vermouth]) - 2 dashes #ingredient([Fernet Branca]) - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into tunmbler glass. Garnish with twist of orange peel.]) #cocktail([<NAME>],[ - 2 oz #ingredient([Gin]) - ยฝ oz #ingredient([Dry Vermouth]) - 1 dash #ingredient([Olive Brine]) - Two #ingredient([Green Olives]) for garnish Gently shake liquids over ice. Strain into cocktail glass. Garnish with green olives.]) #cocktail(label: <queenelizabeth>, [Queen Elizabeth],[ - 2 oz #ingredient([Gin]) - ยฝ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Orange]) Peel Twist for garnish - #ingredient([Maraschino Cherries]) for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with twist of orange peel and cocktail cherry.]) #cocktail(label: <glitterati>, [Glitterati],[ - 2 oz #ingredient([Vodka]) - 1 dash #ingredient([Dry Vermouth]) - 2 #ingredient([Black Olives]) for garnish - Edible #ingredient([Gold Flakes]) for garnish Shake liquids and gold flakes with crushed ice. Strain into cocktail glass. Garnish with black olives.]) #pagebreak() #columns(2, [ #cocktail([<NAME>],[See @drymartini.]) #cocktail([<NAME>],[See @merrywidow.]) #cocktail([Journalist],[See @journalist.]) #cocktail([<NAME>],[See @hammettmartini.]) #cocktail([Martini (a la <NAME>)],[See @martinialaluisbunuel.]) #cocktail([Balanced Account],[See @balancedaccount.]) #cocktail([The Better Wife],[See @thebetterwife.]) ]) #pagebreak() = Fizzies <Fizzies> #v(-6pt) #v(0mm)#align(center)[#image("bubbles.png", height: 66mm)] //#v(-34mm) #v(-8pt) #align(center, text(10pt, cocktailcolor)[*#smallcaps[Sparking Joy]*]) #v(12pt) #cocktail([French 75],[ - 3 oz #ingredient([Sparking Wine]) #indexIn([Bubbles]) - 1 oz #ingredient([Gin]) - ยฝ oz #ingredient([Simple Syrup]) - ยฝ oz #ingredient([Lemon Juice]) - S#ingredient([Lemon]) Peelfor garnish Shake liquids except sparkling wine with ice. Strain into champagne flute. Top with sparkling wine. Garnish with twist of lemon.]) #cocktail([Bellini],[ - 3 oz #ingredient([Champagne]) #indexIn([Bubbles]) - 1 oz #ingredient([Peach Juice]) - Slice of #ingredient([Peach]) for garnish Stir liquids lightly in a champagne glass. Garnish with thin slice of peach.]) #cocktail([Peach Fizz],[ - 2 oz #ingredient([Orange Juice]) - 2 oz #ingredient([Passion Fruit Juice]) - ยฝ oz #ingredient([Peach Gin]) - #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - Slice of #ingredient([Peach]) for garnish Shake juices and gin with ice. Strain into champagne flute and top with sparkling wine. Garnish with thin slice of peach.]) #cocktail([Caribean Champagne Cocktail],[ - ยผ oz #ingredient([White Rum]) #indexIn([Rum]) - ยผ oz #ingredient([Crรจme de Banane]) - 1 dash #ingredient([Angostura]) - #ingredient([Champagne]) #indexIn([Bubbles]) - #ingredient([Banana]) Slices for garnish - #ingredient([Maraschino Cherries]) Slices for garnish Combine liquids except champagne in champagne flute. Top with champagne and stir lightly. Garnish with a skewer of banana slices and a cocktail cherry, embellish with a pineapple leaf or somesuch.]) #cocktail([Moulin Rouge],[ - ยฝ oz #ingredient([Brandy]) - 4 oz #ingredient([Pineapple Juice]) - #ingredient([Sparkling Wine]) #indexIn([Bubbles]) Shake liquids sans wine firmly with ice. Strain into highball glass. Top with sparkling wine and stir gently.]) #cocktail([Bucks Fizz],[ - 2 oz #ingredient([Orange Juice]) - #ingredient([Champagne]) #indexIn([Bubbles]) Pour orange juice into champagne flute. Top with champagne.]) #cocktail([Spanish Sizzler],[ - 3 Scoop #ingredient([Lemon Sorbet]) - #ingredient([Cava]) #indexIn([Bubbles]) Scoop lemon ice into cocktail glass. Top with Cava. Serve with a dessert spoon.]) #cocktail([Mimosa],[ - 1ยผ dl #ingredient([Orange Juice]) - #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Orange]) Peel for garnish Pour orange juice in highball glass filled with ice. Top with sparkling wine and stir gently. Garnish with a long strip of orange peel.]) #cocktail([Aperol Spritz],[ - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - ยฝ oz #ingredient([Aperol]) - 1ยฝ oz #ingredient([Sparkling Water]) - 1 oz #ingredient([Orange]) Slice Half-fill highball glass with orange slice in two halves and ice cubes. Add aperol, sparkling wine and water.]) Serve with a straw. #cocktail([Bloody Ceasar],[ - 2 oz #ingredient([Vodka]) - 2 oz #ingredient([Clamato]) - ยฝ oz #ingredient([Lemon Juice]) - 1 dash #ingredient([Tabasco]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - 1 #ingredient([Lemon]) Wheel Shake liquids with ice. Strain into highball glass with ice. Top with sparkling wine. Garnish with a lemon wheel.]) #cocktail(label: <deathintheafternoon>, [Death in the Afternoon],[ - 1ยฝ oz #ingredient([Absinthe]) - 4ยฝ oz #ingredient([Champagne]) #indexIn([Bubbles]) #v(-12pt) #quote(attribution: [<NAME>, _Death in the Afternoon_])[ _Pour one jigger absinthe into a Champagne glass. Add iced Champagne until it attains the proper opalescent milkiness._]]) #cocktail([Hemingway Champagne],[Another name for *Death in the Afternoon* (@deathintheafternoon).])#indexIn([Bubbles]) #moviecocktail([Death Spasm],[Cocktail],[The *Death in the Afternoon* (@deathintheafternoon), adapted for poetic purposes.])#indexIn([Bubbles]) #cocktail(threshold: 8em, [Pornstar Martini],[ - 1ยฝ oz #ingredient([Vanilla Vodka]) - ยฝ oz #ingredient([Passion Fruit Liqueur]) - 1 oz #ingredient([Passion Fruit Puree]) - ยฝ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Vanilla Syrup]) - 2 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - Half a #ingredient([Passion Fruit]) for garnish Shake liquids except sparkling vigorously with ice. Strain into cocktail glass. Garnish with passion fruit half. Serve with a sparkling wine sidecar (on the side).]) #cocktail([Bloody Maria],[ - 2 oz #ingredient([Tequila]) - 2 oz #ingredient([Tomato Juice]) - ยฝ oz #ingredient([Lemon Juice]) - 1 dash #ingredient([Tabasco]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Wheel Shake liquids with ice. Strain into highball glass with ice. Top with sparkling wine. Garnish with a lemon wheel.]) #cocktail([Planterโ€™s Lunch],[ - 3 oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lemon Juice]) - 1 bar spoon of #ingredient([Cane Sugar]) - 1 dash #ingredient([Angostura]) - #ingredient([Sparkling Water]) - #ingredient([Pineapple]) Chunk for garnish - #ingredient([Orange]) Chunk for garnish - #ingredient([Mint]) sprig for garnish Shake liquids minus water with ice. Strain into highball glass half filled with ice. Top with sparkling water. Garnish with a skewer of pineapple and orange, and a sprig of mint.]) #cocktail([Gin & Tonic],[ - 1 oz #ingredient([Gin]) - 5-6 oz #ingredient([Tonic Soda]) or #ingredient([Quinine Soda]) - #ingredient([Lemon]) Wheel Combine liquids in highball glass with ice. Garnish with a lemon wheel.]) #cocktail([Sloe Gin Fizz],[ - 3 oz #ingredient([Sloe Gin]) - 2 oz #ingredient([Sweet Vermouth]) - 1 oz #ingredient([Lemon Juice]) - #ingredient([Sparkling Water]) Shake liquids minus water with ice. Strain into highball glass half filled with ice. Top with sparkling water.]) #cocktail([Sloe Gin & Tonic],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Sloe Gin]) - 1 oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Tonic Soda]) - #ingredient([Lemon]) Chunk for garnish Shake liquids except soda with ice. Strain into highball glass filled with ice. Top with tonic. Garnish with a chunk of lemon.]) #cocktail([Perรบ Libre],[ - 1 oz #ingredient([Pisco]) - 5-6 oz #ingredient([Cola]) Combine liquids in highball glass with ice.]) #cocktail(label: <dirtypirateposicles>, [Dirty Pirate Popsicles],[ - 1 oz #ingredient([Rum]) - 5-6 oz #ingredient([Cola]) Combine liquids in highball glass with ice.]) #cocktail([Cuba Libre],[*Dirty Pirate Popsicles* (@dirtypirateposicles) by another name.]) #cocktail([Baco],[*Dirty Pirate Popsicles* (@dirtypirateposicles) once more.]) #cocktail([Tom Collins],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Lime Juice]) - 1 oz #ingredient([Simple Syrup]) - #ingredient([Sparkling Water]) - #ingredient([Mint]) for garnish Shake liquids minus water firmly with ice. Strain into highball glass. Garnish with a sprig of mint.]) #cocktail([Polish Sherbet],[ - 3 scoops #ingredient([Lemon Sorbet]) - 1 oz #ingredient([Vodka]) - #ingredient([Sparkling Water]) - #ingredient([Lemon]) Peel for garnish Put scoops of lemon sorbet ice in cocktail glass. Pour vodka and a splash of sparkling water over sorbet. Garnish with a lemon (or orange) twist and serve with a dessert spoon.]) #cocktail([Sgroppino],[ - 2 oz #ingredient([Prosecco]) #indexIn([Bubbles]) - ยฝ oz #ingredient([Vodka]) - 1 Scoop #ingredient([Lemon Sorbet]) Put prosecco, vodka and sorbet into a chilled bowl. Whip until foamy. Pour into a champagne flute.]) #cocktail([White Wine Cooler],[ - 2 oz #ingredient([Dry White Wine]) - ยฝ oz #ingredient([Brandy]) (optional) - ยฝ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Orange Juice]) - #ingredient([Sparkling Water]) - #ingredient([Cucumber]) Slices for garnish Combine liquids except water in highball glass filled with ice. Top with sparkling water and stir gently. Garnish with a few thin cucumber slices.]) #cocktail([Singapore Sling],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Cherry Liqueur]) - 1 dash #ingredient([Bรฉnรฉdictine]) - 1 dash #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Sparkling Water]) - #ingredient([Orange]) Slice for garnish Stir liquids except water with ice. Strain into highball glass. Add ice cubes and top with sparkling water. Garnish with a slice of orange.]) #cocktail([Windward Island],[ - 1 oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Coffee Liqueur]) - #ingredient([Sparkling Water]) - #ingredient([Orange]) Slice for garnish Shake liquids except cola vigorously with ice. Strain into nearly ice-filled tumbler, and top with cola. Garnish with a few orange slices.]) #cocktail([Raspberry Gin],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Framboise]) or #ingredient([Simple Syrup]) - 1 oz #ingredient([Raspberry Juice]) - splash of #ingredient([Lemon Juice]) - handful #ingredient([Raspberries]) - #ingredient([Sparkling Water]) - #ingredient([Raspberries]) for garnish - #ingredient([Mint]) for garnish Blend all ingredients except water with half a cup of crushed ice smooth. Pour into tumbler, top with sparkling water. Garnish with a skewer of raspberries and mint leaves.]) #cocktail([Under the Volcano],[ - 2 oz #ingredient([Mezcal]) - 1 oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Agave Syrup]) - #ingredient([Sparkling Water]) - #ingredient([Jalapeรฑo]) Slice - #ingredient([Cucumber]) Slices Muddle jalapeรฑo and cucumber slices. Add mezcal, agave syrup, lime juice and ice. Shake with gusto. Strain into tumbler filled with ice. Top with sparkling water. Garnish with a thin cucumber slice.]) #cocktail([Mojito],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Simple Syrup]) - ยพ oz #ingredient([Lime Juice]) - #ingredient([Sparkling Water]) - 5 (or so) #ingredient([Mint]) Leaves - #ingredient([Mint]) Sprig for garnish - #ingredient([Lime]) Wheel for garnish Lightly muddle mint leaves with syrup in shaker. Add rum, lime juice and ice, shake briefly. Strain into highball glass over ice. Top with a splash of sparkling water. Garnish with a sprig of mint and a wheel of lime.]) #cocktail(threshold: 8em, label: <moscowmule>, [Moscow Mule],[ - 1ยฝ oz #ingredient([Vodka]) - 1 bar spoon #ingredient([Lime Juice]) - #ingredient([Ginger Ale]) - Slice of #ingredient([Lime]) for garnish Pour vodka and lime juice over ice cubes in a highball glass. Top with ginger ale. Garnish with a thin slice of lime.]) #cocktail([Havana Beach],[ - 2 oz #ingredient([Rum]) - 2 oz #ingredient([Pineapple Juice]) - 1 bar spoon #ingredient([Simple Syrup]) - #ingredient([Ginger Ale]) Shake everything but the ginger ale vigorously with ice. Strain into a tumbler half filled with ice cubes. Top with ginger ale.]) #cocktail([Mexican Wave],[ - 1 oz #ingredient([Tequila]) - ยฝ oz #ingredient([Crรจme de Cassis]) - ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Ginger Ale]) - #ingredient([Lime]) Slices for garnish Shake liquids sans ginger ale with ice. Strain into tumbler, top with ginger ale and stir delicately. Garnish by floating a few very thin slices of lime.]) #cocktail([Ginger 43],[ - 1 oz #ingredient([Liqueur 43]) - #ingredient([Ginger Ale]) - 1 #ingredient([Lime]) - Sprig of #ingredient([Mint]) for garnish Cut lime in quarts. Muddle lime parts and Liqueur 43 in highball glass. Add ice cubes and top with ginger ale. Garnish with sprig of mint.]) #cocktail([Red Skies at Night],[ - 1 splash #ingredient([Lemon Juice]) - #ingredient([Lemon/Lime Soda]) - ยฝ oz #ingredient([Crรจme de Cassis]) Glaze an ice-filled longdrink glass with a splash of lemon juice. Add crรจme de cassis, top with soda and stir.]) #cocktail(threshold: 9em, [Gin Rickey],[ - 2 oz #ingredient([Gin]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Sparkling Water]) - #ingredient([Lime]) Wheels for garnish Combine gin and lime juice in a highball glass filled with ice. Top with sparkling water. Garnish with two lime wheels.]) #cocktail([Bourbon Rickey],[ - 1ยฝ oz #ingredient([Bourbon]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Sparkling Water]) - #ingredient([Lime]) Wheels for garnish Combine bourbon and lime juice in a highball glass filled with ice. Top with sparkling water. Garnish with two lime wheels.]) #cocktail([Autumn Rickey],[ - 1ยฝ oz #ingredient([Bourbon]) - ยฝ oz #ingredient([Maple Syrup]) - 1 oz #ingredient([Lime Juice]) - #ingredient([Sparkling Water]) - #ingredient([Lime]) Wheels for garnish Combine bourbon, maple syrup, and lime juice in a highball glass filled with ice. Top with sparkling water. Stir gently. Garnish with two lime wheels.]) #cocktail([Kiwi Kraze],[ - 1 oz #ingredient([Gin]) - 3 oz #ingredient([Kiwi Juice]) - 1 dash #ingredient([Absinthe]) - #ingredient([Tonic Soda]) - #ingredient([Kiwi]) Slice Shake liquids minus tonic with ice. Strain into tumbler glass half filled with ice. Top with tonic. Float slice of kiwi for garnish.]) #cocktail([Almond Breeze],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Almond Liqueur]) - 1 oz #ingredient([Melon Liqueur]) - #ingredient([Tonic Soda]) Shake liquids except soda with ice. Strain into highball glass half filled with crushed ice. Top with tonic.]) #cocktail(label: <limoncelloitaliano>, [Limoncello Italiano],[ - 2 oz #ingredient([Vodka]) - ยฝ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Lemon/Lime Soda]) - #ingredient([Lemon]) Peel for garnish Shake liquids except soda with ice. Strain into a highball glass half filled with ice and a long strip of lemon peel. Top with lemon/lime soda.]) #cocktail([Long Island Iced Tea],[ - ยฝ oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Vodka]) - ยฝ oz #ingredient([Tequila]) - ยฝ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Simple Syrup]) - 1 oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Cola]) - #ingredient([Lemon]) Chunk for garnish Shake liquids minus cola with ice. Strain into highball glass half filled with ice. Top with cola. Garnish with a chunk of lemon.]) #cocktail(label: <redoctober>, [Red October],[ - 1 oz #ingredient([Vodka]) - 2 oz #ingredient([Cherry Liqueur]) - #ingredient([Lemon/Lime Soda]) - #ingredient([Maraschino Cherries]) for garnish Shake vodka and cherry liqueur with crushed ice. Strain into tumbler glass, top with lemon/lime soda. Garnish with cocktail cherries.]) #cocktail(threshold: 9em, [Bloodless Mary],[ - 2 oz #ingredient([Vodka]) - ยฝ oz #ingredient([Lemon Juice]) - 1 dash #ingredient([Tabasco]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Wheel Shake liquids with ice. Strain into highball glass with ice. Top with sparkling wine. Garnish with a lemon wheel.]) #cocktail(label: <thaitiger>, [Thai Tiger],[ - 2 oz #ingredient([Coconut Milk]) - 1 oz #ingredient([Vodka]) - 1ยฝ oz #ingredient([Lime Juice]) - 2ยฝ 0z Lemon Grass/Ginger Syrup // #ingredient([Lemon Grass/Ginger Syrup]) - 1 #ingredient([Chili Pepper]) (stoned and cut in rings) - #ingredient([Lemon/Lime Soda]) - #ingredient([Chili Pepper]) slice and #ingredient([Lemon]) Slice for garnish *Lemon Grass/Ginger Syrup*#indexIn(fmt:strong, [Lemon Grass/Ginger Syrup]): mix 2 dl Sugar/1 dl Water, add 1 Crushed #ingredient([Lemon Grass Stem]) and 2ยฝcm finely diced #ingredient([Ginger]), gently heat, simmer until about 2ยฝdl remains. Let it cool. Shake liquids with chili pepper rings over crushed ice. Strain in a highball glass half filled with crushed ice. Top with lemon/lime soda. Garnish with chilli pepper ring and thin slice of lemon.]) #pagebreak() #columns(2, [ #cocktail([<NAME>],[See @kirroyale.]) #cocktail([Flat on my Flute],[See @flatonmyflute.]) #cocktail([Champagne Cocktail],[See @champagnecocktail.]) #cocktail([Am<NAME>],[See @ambermimosa.]) #cocktail([Apple Crisp],[See @applecrisp.]) #cocktail([Chinese Show],[See @chineseshow.]) #cocktail([Sunglow],[See @sunglow.]) #cocktail([Vine],[See @vine.]) #cocktail([Bamboozle],[See @bamboozle.]) #cocktail([Iced Tea Dance],[See @icedteadance.]) #cocktail([Cool Dude],[See @cooldude.]) #cocktail([Berry Well],[See @berrywell.]) #cocktail([The Dead Reckoning],[See @deadreckoning.]) #cocktail([Horseโ€™s Neck],[See @horsesneck.]) #cocktail([El Diablo],[See @eldiablo.]) //#colbreak() #cocktail([The Grable],[See @grable.]) #cocktail([Kitty Collins],[See @kittycollins.]) #cocktail([Reckless Moment],[See @recklessmoment.]) #cocktail([<NAME>],[See @ginsling.]) #cocktail([Strangerโ€™s Kiss],[See @strangerskiss.]) #cocktail([<NAME>],[See @tompowers.]) #cocktail([Last Flight],[See @lastflight.]) #cocktail([Javelin],[See @javelin.]) #cocktail([Red Dust],[See @reddust.]) #cocktail([Naked Moon],[See @nakedmoon.]) #cocktail([Diamond Ring],[See @diamondring.]) #cocktail([<NAME>],[See @kansasromanov.]) #cocktail([Midnight Mary],[See @midnightmary.])#index([Red Snapper]) #cocktail([Red Snapper],[See @midnightmary.])#index([Midnight Mary]) #cocktail([<NAME>โ€™Orient],[See @jardindorient.]) ]) #pagebreak() = Classics <Classics> #v(-8pt) #v(0mm)#align(center)[#image("daiqiri.png", height: 34mm)] //#v(-34mm) #v(-8pt) #align(center, text(10pt, cocktailcolor)[*#smallcaps[Classic Cocktails]*]) #v(12pt) //#columns(3, outline(title:none, target: selector(heading).after(<Classics>, inclusive: true).before(<NuSkool>, inclusive: false))) //#v(12pt) //#pagebreak() #cocktail([Sea Mist],[ - 3 oz #ingredient([Blueberry Juice]) or #ingredient([Raspberry Juice]) - 3 oz #ingredient([Pink Grapefruit Juice]) - 2 oz #ingredient([Vodka]) - Slices of #ingredient([Lime]) and #ingredient([Lemon]) for garnish frozen into ice cubes Stir liquids with ice. Strain into highball glass. Add decorated ice cubes.]) #cocktail([Double Vision],[ - 1 oz #ingredient([Lemon Vodka]) - 1 oz #ingredient([Blackberry Vodka]) - 1 oz #ingredient([Apple Juice]) - 1 oz #ingredient([Lime Juice]) - ยฝ oz Simple Syrup // #ingredient([Simple Syrup]) - 2-3 dashes #ingredient([Angostura]) - Slice of #ingredient([Apple]) for garnish *Simple Syrup*#indexIn(fmt:strong, [Simple Syrup]): mix 2 dl #ingredient([Sugar])/1 dl #ingredient([Water]). Gently heat, simmer until about 2ยฝdl remains. Let it cool. Shake liquids vigorously with ice. Strain into cocktail glass. Garnish with a thin apple slice.]) #moviecocktail([Blue Angel], [The Blue Angel],[ - 1 oz #ingredient([Blue Curaรงao]) - 1 oz #ingredient([Parfait d'Amour]) - 1 oz #ingredient([Brandy]) - 1 oz #ingredient([Lemon Juice]) - 1 oz #ingredient([Cream]) - Slice of #ingredient([Carambola]) (star fruit) for garnish Shake liquids vigorously with ice. Strain into cocktail glass. Garnish with a thin carambola slice.]) #cocktail([Sunset on the Beach],[ - 1ยฝ oz #ingredient([Rum]) - 2 oz #ingredient([Orange Juice]) - 2 oz #ingredient([Pineapple Juice]) - ยฝ oz #ingredient([Grenadine]) - Slice of #ingredient([Orange]) for garnish - #ingredient([Maraschino Cherries]) for garnish Combine rum and fruit juices with ice cubes in a highball glass. Stir and let rest. Gently layer grenadine circularly over the drink using the back of a spoon and let it sink. Garnish with a slice of orange and a cocktail cherry.]) #cocktail([Kopstoot],[A *Boilermaker* (@boilermaker).]) #cocktail(label: <fav>, [<NAME>],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Sweet White Vermouth]) - 1 dash or 2 #ingredient([Orange Bitters]) - #ingredient([Maraschino Cherries]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with cherry.]) #cocktail([Sex on the Beach],[ - 1ยฝ oz #ingredient([Vodka]) - 1 oz #ingredient([Peach Schnapps]) - 2 oz #ingredient([Orange Juice]) - 2 oz #ingredient([Cranberry Juce]) or ingredient([Grenadine]) - #ingredient([Orange]) Slice for garnish - #ingredient([Maraschino Cherries]) for garnish Fill highball glass with ice. Stir vodka, schnapps and orange juice in. Top gently with cranberry juice. Garnish with slice of orange and a cocktail cherry.]) //#pagebreak() #cocktail([White Lady],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Orange Liqueur]) - 1 oz #ingredient([Orange Juice]) Shake liquids with ice. Strain into cocktail glass.]) #cocktail([Oaxaca Old Fashioned],[ - 1ยฝ oz #ingredient([Tequila]) - ยฝ oz #ingredient([Mezcal]) - 2 dashes #ingredient([Angostura]) - 1 bar spoon #ingredient([Agave Syrup]) - #ingredient([Orange]) Peel for garnish Stir fluids with ice. Strain over ice in a tumbler glass. Flame orange peel over the top, and rest the twist in the glass as garnish.]) #cocktail([Old Fashioned],[ - 1ยฝ oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 2 dashes #ingredient([Angostura]) - 1 bar spoon #ingredient([Water]) - ยฝ bar spoon #ingredient([Cane Sugar]) - Slice of #ingredient([Orange]) for garnish Put sugar in tumbler glass. Add water and angostura, gently stir to dissolve sugar. Add rye and ice, gently stir. Garnish with a slice of orange.]) #cocktail([Piรฑa Colada],[ - 2 oz #ingredient([Rum]) (any kind) - 3 oz #ingredient([Pineapple Juice]) or ยฝ cup #ingredient([Pineapple]) Parts - 1 oz #ingredient([Coconut Cream]) or #ingredient([Coconut Milk]) - ยฝ oz #ingredient([Cream]) - 1 or 2 dashes #ingredient([Angostura]) - Slice of #ingredient([Pineapple]) for garnish Combine everything with 4 or 5 icecubes in a blender. Blend smooth. Strain in large bowl glass. Garnish with a pineapple slice.]) #cocktail([Millionaire],[ - 3 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 oz #ingredient([Orange Liqueur]) - 1 #ingredient([Egg White]) - ยฝ oz #ingredient([Grenadine]) - Slice of #ingredient([Orange]) for garnish Shake liquids and egg white vigorously. Add crushed ice and shake again. Strain into cocktail glass. Garnish with a slice of orange.]) #cocktail([Havana Cocktail],[ - 1 oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([Cream Sherry]) - 1 bar spoon #ingredient([Lime Juice]) - Slice or Spiral of #ingredient([Lime]) for garnish Shake liquids vigorously over ice. Strain into cocktail glass.]) #cocktail([Cuban Peach],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Peach Liqueur]) - 1 bar spoon #ingredient([Lime Juice]) - Whiff of #ingredient([Sugar]) - Thin Slices of #ingredient([Peach]) for garnish - Twig of #ingredient([Mint]) for garnish Shake with ice. Strain into cocktail glass with ice. Garnish by floating two thin peach slices with a twig of mint on top.]) #cocktail([Banana Daiquiri],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Crรจme de Banane]) - 1ยฝ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Coconut Milk]) - 1 bar spoon #ingredient([Simple Syrup]) - 1 #ingredient([Banana]) (in parts) Blend with ice until smooth. Pour into large highball glass, add a few cubes.]) #moviecocktail([Cosmopolitan], [Sex and the City],[ - 1ยฝ oz #ingredient([Lemon Vodka]) - 1 oz #ingredient([Orange Liqueur]) - 1 oz #ingredient([Cranberry Juice]) - 1 dash #ingredient([Lime Juice]) - #ingredient([Orange Zest]) Shake liquids vigorously with ice. Strain in cocktail glass. Finish with a pinch of orange zest.]) #cocktail([Classic Cocktail],[ - 1 oz #ingredient([Brandy]) - ยฝ oz #ingredient([Curaรงao Bitters]) - ยฝ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Simple Syrup]) - 1 #ingredient([Maraschino Cherries]) for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with cocktail cherry (or two).]) #cocktail([Frisco],[ - 1 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Bรฉnรฉdictine]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Lemon]) Peel for garnish Shake liquids well with ice. Strain into cocktail glass. Garnish with lemon twist.]) #cocktail([Coq Rouge],[ - 1 oz #ingredient([Rum]) - ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with orange twist.]) #cocktail([Whisky Sour],[ - 2 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Lemon Juice]) - 1 bar spoon of #ingredient([Cane Sugar]) - #ingredient([Lemon]) Peel for garnish Shake liquids vigorously with ice until frothy. Strain into tumbler. Garnish with a twist of lemon peel.]) #cocktail([Rusty Nail],[ - 2 oz #ingredient([Scotch]) #indexIn([Whiskey]) - 1 oz #ingredient([Drambuie]) - #ingredient([Lemon]) Peel for garnish Stir liquids with ice. Strain into tumbler filled with ice. Garnish with a long strip of lemon peel for garnish.]) #cocktail([Apple Brandy],[ - 2 oz #ingredient([Calvados]) - 2 oz #ingredient([Grapefruit Juice]) - 1 dash #ingredient([Grenadine]) - #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into cocktail glass over crushed ice. Garnish with an orange twist.]) #cocktail([Daiquiri],[ - 3 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lime Juice]) - bar spoon #ingredient([Simple Syrup]) - #ingredient([Maraschino Cherries]) Slices for garnish - #ingredient([Lime]) Slice for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with a cocktail cherry/lime slice skewer.]) #cocktail([Creamy Lemon Martini],[ - 2 oz #ingredient([Lemon Vodka]) - 1 oz #ingredient([Drambuie]) - 1 oz #ingredient([Lemon Juice]) - bar spoon #ingredient([Simple Syrup]) - #ingredient([Lemon]) Peel for garnish Shake liquids vigorously with ice until frothy. Strain into cocktail glass. Garnish with a twist of lemon peel.]) #cocktail([Saketini],[ - 2 oz #ingredient([Sake]) - 1 oz #ingredient([Vodka]) - ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Orange Liqueur]) - #ingredient([Cucumber]) Slice for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with a slice of cucumber.]) #cocktail([Pink Lady],[ - 2 oz #ingredient([Calvados]) - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Lime Juice]) - 1 oz #ingredient([Grenadine]) - #ingredient([Egg White]) - #ingredient([Maraschino Cherries]) Slices for garnish Decorate a cocktail glass, using a grenadine dip, with a rim of sugar. Shake liquids vigorously with ice. Strain into prepared glass. Garnish with a cocktail cherry.]) #cocktail([Alexander],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Crรจme de Cacao]) - 1 oz #ingredient([Cream]) - #ingredient([Cocao Powder]) for garnish Shake liquids vigorously with ice. Strain into cocktail glass. Scatter a mist of cocoa powder over the foam for garnish.]) #cocktail([Orange Blossom],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Orange Liqueur]) - #ingredient([Orange]) Slice for garnish Shake liquids vigorously with ice. Strain into tumbler. Garnish with a slice (or two) of orange.]) #cocktail([Mint Julep],[ - 1ยฝ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 bar spoons #ingredient([Cane Sugar]) - 1 table spoon #ingredient([Mint]) LeafShreds - 1 table spoon #ingredient([Water]) - bushel #ingredient([Mint]) for garnish Grind sugar and shredded mint leafs to a pulp. Add water and stir. You now have a mint syrup. Put mint syrup and bourbon into a tumbler half filled with crushed ice. Top with more crushed ice. Garnish with a small bushel of mint twigs.]) #cocktail([Clover Club],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Grenadine]) - 1 #ingredient([Egg White]) - bar spoon #ingredient([Lime Juice]) - ([Lime]) Slice for garnish Shake liquids vigorously with ice. Strain into cocktail glass. Garnish with a thin slice of lime.]) #cocktail([Screwdriver],[ - 2 oz #ingredient([Vodka]) - 5 oz #ingredient([Orange Juice]) - #ingredient([Orange]) Slice for garnish Combine liquids in highball glass. Add ice and stir. Garnish with a slice of orange.]) #cocktail([Harvey Wallbanger],[ - 2 oz #ingredient([Vodka]) - 1 oz #ingredient([Galliano]) - 4 oz #ingredient([Orange Juice]) - #ingredient([Orange]) Slice for garnish Combine liquids in highball glass. Add ice and stir. Top with Galliano. Garnish with a slice of orange.]) #cocktail([Mudslide],[ - 1 oz #ingredient([Vodka]) - 1 oz #ingredient([Coffee Liqueur]) - 1 oz #ingredient([Irish Cream])]) Shake liquids vigorously with ice. Strain into ice-filled tumbler. #cocktail([White Russian],[ - 2 oz #ingredient([Vodka]) - 1 oz #ingredient([Coffee Liqueur]) - 1 oz #ingredient([Cream]) Shake liquids minus cream with ice. Strain into ice-filled tumbler. Use the back of a spoon to float the cream.]) #cocktail([Black Russian],[ - 2 oz #ingredient([Mezcal]) - 1 oz #ingredient([Coffee Liqueur]) - 1 dash #ingredient([Orange Bitters]) Stir liquids with ice. Strain into ice-filled tumbler.]) #cocktail([English Rose],[ - 3 oz #ingredient([Dry Vermouth]) (extra dry if available) - 1ยฝ oz #ingredient([Kirsch]) - 1 oz #ingredient([Parfait dโ€™Amour]) - White #ingredient([Rose]) Petals for garnish Stir ingredients with crushed ice. Strain into cocktail glass. Garnish by floating a few rose petals.]) #cocktail([Sidecar],[See @sidecar.]) #cocktail([Sazerac],[ - 1 oz #ingredient([Absinthe]) - 1 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 oz #ingredient([Brandy]) - ยฝ oz #ingredient([Simple Syrup]) - 1 dash #ingredient([Peychaudโ€™s Bitters]) - 1 dash #ingredient([Angostura]) - 1 oz #ingredient([Water]) Pour absinthe into ice-filled tumbler. Top with chilled water. Shake the rest of the ingredients with crushed ice. Drain the absinthe/water filled glass and strain shaker onto prepared ice. \ _Alternatively_, you can rinse a tumbler glass with absinthe, half fill it with crushed ice, and strain the bourbon mix over that.]) #cocktail([Fuck It Bucket],[ - 1 oz #ingredient([Vodka]) - 1 oz #ingredient([Rum]) - 1 oz #ingredient([Tequila]) - 2 oz #ingredient([Pineapple Juice]) - 2 oz #ingredient([Cranberry Juice]) - #ingredient([Mixed Fruit]) Slices for garnish Combine liquids in a highball glass. Fill with ice and stir well. Garnish with mixed fruit slices.]) #cocktail([Buena Vista],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Blue Curaรงao]) - 1 oz #ingredient([Simple Syrup]) - 1 oz #ingredient([Lime Juice]) - #ingredient([Lemon]) Slice for garnish Shake liquids with ice. Strain into highball glass. Garnish with a slice of lemon.]) #cocktail([Knickerbocker],[ - 5 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lemon Juice]) - 1 oz #ingredient([Pineapple Juice]) - 1 oz #ingredient([Raspberry Juice]) - #ingredient([Orange]) Peel for garnish Shake liquids vigorously with ice. Strain into cocktail glass. Garnish with a twist of orange.]) #cocktail([Acapulco Gold],[ - 1 oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([Tequila]) - 2 oz #ingredient([Pineapple Juice]) - 1 oz #ingredient([Coconut Milk]) Shake liquids vigorously with ice. Strain into highball glass.]) #cocktail([Not Tonight Josephine],[ - 3 oz #ingredient([Red Wine]) - 1 oz #ingredient([Brandy]) - 1 dash #ingredient([Pernod]) Pour red wine with a few ice cubes into snifter (brandy glass). Add brandy and Pernod. Stir gently.]) #cocktail([Bacardi],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lemon Juice]) or #ingredient([Lime Juice]) - 1 oz #ingredient([Grenadine]) - #ingredient([Lemon]) Slice for garnish Shake liquids sternly with ice. Strain into tumbler. Garnish with a slice of lemon.]) #cocktail([Miami],[ - 5 oz #ingredient([White Rum]) #indexIn([Rum]) - 2 oz #ingredient([White Crรจme de Menthe]) - 1 oz #ingredient([Lemon Juice]) - #ingredient([Orange]) Peel for garnish Shake liquids with gusto and ice. Strain into tumbler glass. Garnish with a twist of orange.]) #cocktail(label: <abfab>, [Ab Fab],[ - 1 oz #ingredient([Stolichnaya]) - 1 oz #ingredient([Blueberry Juice]) - 1 oz #ingredient([Raspberry Juice]) - #ingredient([Bollinger]) Shake vodka and fruit juices with crushed ice. Strain into cocktail glass and top with sparkling wine.]) #cocktail([Stolly & Bolly],[The *Ab Fab* (@abfab) by another name.]) #cocktail([Austin Powers],[ - 1 oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Almond Liqueur]) - ยฝ oz #ingredient([Blue Curaรงao]) - 3 oz #ingredient([Apple Juice]) (of the transparent kind) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Orange]) Slice for garnish Shake liquids with ice. Strain into highball glass. Garnish with a slice of orange.]) #cocktail([Fireball],[ - 2 oz #ingredient([Glayva]) - 1 oz #ingredient([Glenfiddich]) (or another single malt, or even a #ingredient([Scotch]) blend) #indexIn([Whiskey]) Fill cocktail glass with crushed ice. Pour liquids and stir gently.]) #cocktail([Sherry Flip],[ - 4 oz #ingredient([Cream Sherry]) - 1 #ingredient([Egg]) - Grated #ingredient([Nutmeg]) for garnish Blend sherry and egg until creamy smooth. Pour into tumbler. Garnish by grating nutmeg over drink.]) #cocktail([Sol Y Sombre],[ - ยพ oz #ingredient([Anisette]) - ยพ oz #ingredient([Brandy]) Pour anisette into shot glass, and very delicately float the brandy on it over the back of a spoon.]) #cocktail([Zombie],[ - 2 oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Apricot Liqueur]) - ยฝ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Grenadine]) - 2 oz #ingredient([Orange Juice]) - 2 oz #ingredient([Pineapple Juice]) - 1 oz #ingredient([Lime Juice]) - #ingredient([Orange]) Peel for garnish Keep ยฝ oz of the white rum apart. Shake rest of liquids fanatically with ice. Strain into highball glass with ice. Top with remaining rum. Garnish with a long twist of orange.]) #cocktail([Tijuana Cafรฉ],[ - 1 oz #ingredient([Coffee Liqueur]) - 3 oz #ingredient([Coffee]) - 3 oz #ingredient([Cream]) - 1 bar spoon #ingredient([Sugar]) - 1 #ingredient([Cinnamon Stick]) for garnish - #ingredient([Cinnamon]) Grind for garnish Make coffee, hot and black and pour in coffee glass. Add coffee liqueur and sugar, and top with lightly whipped cream. Stir gently with stick of cinnamon, leave it in, and finish with a whiff of cinnamon grind.]) #cocktail([Flamboyant],[ - 3 oz #ingredient([Red Wine]) - 1 table spoons #ingredient([Dark Rum]) #indexIn([Rum]) - 2 table spoons #ingredient([Orange Juice]) - 2 table spoons #ingredient([Water]) - 2 cm #ingredient([Cinnamon Stick]) - 1 #ingredient([Star Anise]) Heat sugar, water, orange juice, cinnamon, and star anise gently in a pan on temperate fire. Bring it close to boiling, then take off the furnace and let sit for 10-15 minutes. Then add wine until hot, but not boiling. Remove cinnamon and pour in a tea glass. Cautiously heat the tablespoon of rum over low fire, gently shaking, until the rum catches fire. Gently pour the burning rum over the glass of warm fortified wine. Don't drink while still burning or too hot.]) #cocktail([Bazooka Joe],[ - ยฝ oz #ingredient([Blue Curaรงao]) - ยฝ oz #ingredient([Crรจme de Banane]) - ยฝ oz #ingredient([Irish Cream]) Pour curaรงao in shot glass. Very delicately float the banana liqueur over the back of a spoon, then float the Irish cream.]) #cocktail([Risky Cleanse],[ - ยฝ oz #ingredient([Peach Gin]) - ยฝ oz #ingredient([Blueberry Juice]) - ยฝ oz #ingredient([Vodka]) - 1 splash #ingredient([Absinthe]) Gently layer (float) peach gin, blueberry juice, vodka, and absinthe in a shot glass.]) #cocktail([Electric Flag],[ - ยฝ oz #ingredient([Grenadine]) - ยฝ oz #ingredient([Parfait dโ€™Amour]) - ยฝ oz #ingredient([Grappa]) or #ingredient([Kirsch]) Pour grenadine into shot glass. Delicately layer parfait and grappa on top.]) #cocktail([Seductive Threesome],[ - ยฝ oz #ingredient([Crรจme de Menthe]) - ยฝ oz #ingredient([Crรจme de Banane]) - ยฝ oz #ingredient([Irish Cream]) Pour menthe in shot glass. Very delicately float the banana liqueur over the back of a spoon, then float the irish cream.]) #cocktail([Appletini],[ - 1ยผ oz #ingredient([Vodka]) - 1 oz #ingredient([Calvados]) - 1ยผ oz #ingredient([Apple Juice]) - ยผ oz #ingredient([Lemon Juice]) - ยผ oz #ingredient([Simple Syrup]) - #ingredient([Maraschino Cherries]) for garnish - Thin #ingredient([Apple]) Slices For the apple and juice, a firm and sour(ish) type is preferred. Granny Smith will do nicely. If you have a sweeter apple, trade a bit of apple juice for lemon juice. \ Shake fluids with crushed ice. Strain into cocktail glass. Garnish with cocktail cherry and a few thin apple half-slices.]) #cocktail([Espresso Martini],[ A vodka variant of *It Happened One Morning* (@ithappenedonemorning). - 2 oz #ingredient([Vodka]) - 1 oz #ingredient([Coffee Liqueur]) - ยพ oz #ingredient([Espresso]) - ยผ oz Vanilla Syrup // #ingredient([Vanilla Syrup]) *Vanilla Syrup*#indexIn(fmt:strong, [Vanilla Syrup]): blend half a vanilla pod with 2 dl sugar. Mix with 2 dl water, gently heat, simmer until about 2ยฝdl remains. Let it cool down. _Alternatively_, use a vanilla sugar sachet and Simple Syrup. Shake liquids vigorously with ice. Strain into cocktail glass.]) #cocktail(label: <orgasm>, [Orgasm],[ - 1 oz #ingredient([Coffee Liqueur]) - 1 oz #ingredient([Almond Liqueur]) - 1 oz #ingredient([Irish Cream]) - 1 oz #ingredient([Cream]) - 1 oz #ingredient([Whole Milk]) Shake liquids vigorously and strain into highball glass filled with crushed ice.]) #cocktail([Screaming Orgasm],[ - 1 oz #ingredient([Vodka]) - everything from the *Orgasm* (@orgasm) An *Orgasm* (@orgasm) with additional vodka.]) #cocktail([Xanthia],[ - 1 oz #ingredient([Gin]) - 2 oz #ingredient([Green Chartreuse]) - 1 oz #ingredient([Cherry Liqueur]) - #ingredient([Lemon]) Peel for garnish Stir fluids with ice. Strain into cocktail glass. Twist lemon peel over glass, then garnish with it.]) // #cocktail([Black Velvet]) #cocktail([Negroni],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Campari]) - 1 oz #ingredient([Sweet Vermouth]) - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into tumbler glass over ice cubes. Garnish with orange peel.]) #cocktail(label: <pomegranatenegroni>, [Pomegranate Negroni],[ - 1ยฝ oz #ingredient([Gin]) - 1ยฝ oz #ingredient([Campari]) - ยฝ oz #ingredient([Sweet Vermouth]) - 1 oz #ingredient([Pomegranate Juice]) - 2 bar spoons #ingredient([Pomegranate]) Seeds for garnish Stir liquids with ice. Strain into tumbler glass over ice cubes. Garnish with pomegranate seeds.]) #moviecocktail([Billericay Dickie],[Sex & Drugs & Rock & Roll],[A.k.a. *Pomegranate Negroni* (@pomegranatenegroni). No doubt the late Ian Dury would have approved.]) #cocktail([Red Rum],[ - 1ยพ oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Sloe Gin]) - ยฝ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Vanilla Syrup]) - 24 #ingredient([Redcurrants]) Muddle redcurrants in base of shaker. Shake with liquids and ice. Strain into cocktail glass or tumbler. Feel free to garnish with a redcurrant bunch.]) #cocktail([Sexy Beast],[ - 2 oz #ingredient([Crรจme de Cacao]) - 1 oz #ingredient([Plum Liqueur]) - ยฝ oz #ingredient([Absinthe]) - ยผ oz #ingredient([Brandy]) - #ingredient([Maraschino Cherries]) for garnish - #ingredient([Dark Chocolate]) for garnish Stir liquids unchilled. Pour into snifter (cognac glass). Drop cocktail cherry in and grate chocolate over drink to garnish.]) #cocktail(threshold: 9em, [Vanilla Ice],[ - 2 oz #ingredient([Eggnogg]) - ยฝ oz #ingredient([Brandy]) - ยฝ oz #ingredient([Almond Liqueur]) - 3 large scoops frozen #ingredient([Vanilla Ice Cream]) - 1 bar spoon Grated #ingredient([Nutmeg]) - #ingredient([Sparkly Sugar]) - #ingredient([Rum Raisins]) for garnish - #ingredient([Ground Cinnamon]) for garnish Rim cocktail glasses with sparkly sugar. Combine liquids, ice cream and nutmeg in a blender. Blend until smooth. Pur into decorated glasses. Garnish with nine rum raisins and sprinkle with cinnamon.]) #cocktail([Kir],[ - ยฝ oz #ingredient([Crรจme de Cassis]) - #ingredient([Dry White Wine]) Pour crรจme de cassis in wine glass. Top with chilled white wine. Swirl to mix.]) #cocktail(threshold: 10em, [Boulevardier],[ - 1ยผ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 oz #ingredient([Campari]) - 1 oz #ingredient([Sweet Vermouth]) - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into tumbler glass over ice cubes. Garnish with orange twist.]) #cocktail([Dark Boulevard],[ - 3 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยฝ oz #ingredient([Campari]) - ยฝ oz #ingredient([Cocoa Butter Washed Bourbon]) - 1 bar spoon #ingredient([Red Vermouth]) - #ingredient([Dark Chocolate]) for garnish The day before, melt the cocoa butter, then pour it into a clean jar, mix in the bourbon and leave to cool a little. Seal, leave to infuse at room temperature for half an hour, then put in the freezer overnight. The next day, lift off and discard the solidified cocoa butter, which will have risen to the top of the jar, then pass the bourbon through a coffee filter to strain off any impurities. Stir liquids with ice. Strain into tumbler glass over ice cubes. Crumble a square of chocolate into shards and put them onto a tea spoon. Rest the spoon on the rim of the glass and serve.]) #pagebreak() = Immaculates <Virgins> #v(-2mm) #align(center)[#image("mary.png", height: 30mm)] //#v(-34mm) #v(-2mm) #align(center, text(9pt, cocktailcolor)[*#smallcaps[Non Alkyhol Impaired Cocktails]*]) #v(12pt) // #cocktail([<NAME>]) #cocktail(label: <sunglow>, [Sunglow],[ - 1 splash #ingredient([Lemon Juice]) - 2 oz #ingredient([Pineapple Juice]) - ยฝ oz #ingredient([Lime Juice]) - 1 #ingredient([Peach]) (ripe) - 1 splash #ingredient([Raspberry Syrup]) - #ingredient([Lemon/Lime Soda]) - #ingredient([Lemon]) Slice for garnish First cut and set apart a slice of peach. Skin and stone the rest of the peach and blend that with the fruit juices and four ice cubes. Pour into a highball glass half filled with ice. Add a splash of raspberry syrup and top with soda.]) Garnish with a slice of lemon. #cocktail(label: <ambermimosa>, [Amber Mimosa],[ - 1ยผ dl #ingredient([Orange Juice]) - #ingredient([Ginger Ale]) - #ingredient([Orange]) Peel for garnish Pour orange juice into a half ice filled highball glass. Top with ginger ale. Garnish by floating a few scraps of orange peel.]) #cocktail(label: <applecrisp>,[Apple Crisp],[ - 1ยผ dl #ingredient([Apple Juice]) (carbonated if you have it) - #ingredient([Ginger Ale]) - #ingredient([Apple]) Chunks for garnish Pour orange juice into a half ice filled highball glass. Top with sparkling wine. Garnish by floating a few thin chunks of apple.]) #cocktail(label: <chineseshow>, [Chinese Show],[ - ยฝ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Lemon Juice]) - 1 bar spoon #ingredient([Ginger]) - 1ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Sparkling Water]) Shake liquids except water vehemently with ice. Strain into a tumbler, top with sparkling water.]) #cocktail(label: <vine>, [Vine],[ - 3 oz #ingredient([Grape Juice]) (preferrably white) - #ingredient([Bitter Lemon]) Soda - Frozen #ingredient([Grapes]) (matching grape juice colour) Put a few frozen grapes into a highball glass. Pour chilled grape juice over grapes, and top with soda.]) #cocktail(label: <bamboozle>, [Bamboozle],[ - 2 oz #ingredient([Guava Juice]) - 2 oz #ingredient([Orange Juice]) - 2 oz #ingredient([Passion Fruit Juice]) - splash of #ingredient([Lime Juice]) - #ingredient([Sparkling Water]) (to taste) Shake liquids except water dedicatedly with ice. Strain into a half ice filled highball glass. Top with sparkling water if you so choose.]) #cocktail([Gazpacho],[ - 2 dl #ingredient([Tomato Juice]) - 2ยฝ cm #ingredient([Cucumber]) - 2ยฝ cm #ingredient([Celery]) - 1 Roasted #ingredient([Pepper]) (small) - 1 Whiff #ingredient([Chili Flakes]) - splash of #ingredient([Lemon Juice]) Blend everything with four or five ice cubes until smooth. Pour into highball glass half filled with ice. Garnish with a stick of celery, slices of cucumber, a cherry tomato, some basil leaves.]) #cocktail([Cold Hard Cash],[ - 1 bar spoons #ingredient([Sugar]) - splash of #ingredient([Lime Juice]) - #ingredient([Mint]) Leaves - #ingredient([Apple Juice]) (carbonated if you have it) Use a pestle to grind sugar and five leaves of mint thoroughly in a mortar. Decorate the edge a tumbler by dipping it in water first, then running it lightly through the mint sugar grind. Put rest of mint sugar in glass along with three or four ice cubes. Add a splash of lime juice and top with (sparkling) apple juice. Garnish by floating a few leaves of mint.]) #cocktail([Strawberry Balsamico],[ - 5 #ingredient([Strawberries]) (ripe) - ยฝ oz #ingredient([Simple Syrup]) - splash of #ingredient([Acete Balsamico]) - #ingredient([Black Pepper]) Grind - #ingredient([Basil]) Leaves for garnish Blend strawberries and syrup with four ice cubes. Pour puree into an ice cube filled highball glass. Add a dash of balsamico and sprinkle freshly grated black pepper on top. Garnish with a basil leave.]) #cocktail(label: <icedteadance>, [Iced Tea Dance],[ - 1 dl #ingredient([Fruit Infusion]) - #ingredient([Lemon/Lime Soda]) Make fruit infusion by using boiling water and an aromatized, fruit-flavoured โ€˜teaโ€™ bag. Let it cool. Then pour into tea glass with four ice cubes. Top with soda.]) #cocktail(label: <cooldude>, [Cool Dude],[ - 1 oz #ingredient([Lime Juice]) - #ingredient([Lemon/Lime Soda]) Pour lime juice into a tumbler half filled with ice. Top with soda and stir.]) #cocktail([Melon Magic],[ - 1 oz #ingredient([Simple Syrup]) - splash of #ingredient([Lime Juice]) - 1 #ingredient([Pineapple]) Slice - #ingredient([Watermelon]) Slice (about an eighth of a watermelon) Cut a small chunk from the pineapple slice, and two triangles from the watermelon slice. Keep apart. Skin and stone the watermelon, skin the pineapple and remove the fibrous core. Blend the fruits into a puree together with ice. Then add syrup and splash of lime juice, and give it an extra blend to create a frothy pink. Pour into highball glasses. Garnish with skewered fruit parts kept apart earlier.]) #cocktail(label: <berrywell>, [Berry Well],[ - 1 oz #ingredient([Blueberry Juice]) - splash of #ingredient([Lemon Juice]) - #ingredient([Orange Soda]) or #ingredient([Ginger Ale]) - #ingredient([Lemon]) Slice for garnish - #ingredient([Orange]) Slice for garnish Pour lime juices into a highball glass half filled with ice. Top with soda and stir. Garnish with lemon and orange slices.]) #cocktail([Virgin Mary],[ - 3 oz #ingredient([Tomato Juice]) - ยฝ oz #ingredient([Lemon Juice]) - 1 dash #ingredient([Worcestershire Sauce]) - 1 bar spoon #ingredient([Celery Salt]) - 1-2 dash #ingredient([Tabasco]) - #ingredient([Black Pepper]) Stir liquids in highball glass with ice.]) #pagebreak() = Moscowโ€”Petushki <Jerofejev> #align(center, text(8pt, cocktailcolor)[*#smallcaps[Pure poetry by <NAME>. Don't try this at home.]*]) #v(8pt) // Pure poetry. Don't try this at home. #cocktail([The Kremlin],[ โ€œ_They all go on about it, but I've never seen it. The number of times (thousands) I've been drunk or hung over, traipsing round Moscow, north-south, east-west, end to end, straight through or any old way - and I've never once seen the Kremlin._โ€ - 2 oz #ingredient([Coriander Vodka]) - 8 oz #ingredient([Beer]) (#ingredient([Zhigulevskoye]) - or whatever) - 1 oz #ingredient([Eggnogg])]) #v(0mm)#align(right)[#image("komsomol.png", height: 34mm)]#v(-38mm) #cocktail([Komsomol Girl's Tear],[ - 1 oz #ingredient([Lavender Toilet Water]) - 1 oz #ingredient([Verbena]) - 2 oz #ingredient([Birch Hair Lotion]) - 1 bar spoon #ingredient([Nail Polish]) - 10 oz #ingredient([Mouthwash]) - 10 oz #ingredient([Lemon/Lime Soda])]) #cocktail([Canaan Balsam],[ - 6 oz #ingredient([Methylated Spirits]) - 12 oz Velvet #ingredient([Beer]) (#ingredient([Ostanski]), #ingredient([Senator])) - 6 oz #ingredient([Refined Furniture Polish])]) #cocktail([The Spirit of Geneva],[ - 1 oz #ingredient([White Lilac]) (some use White Lilly but that's frowned upon) - 1 oz #ingredient([Athletes Foot Remedy]) - 8 oz #ingredient([Beer]) (#ingredient([Zhigulevskoye]) - or whatever) - 2 oz #ingredient([Alcohol Varnish])]) #cocktail([Cat Piss],[ - 8 oz #ingredient([Beer]) (#ingredient([Zhigulevskoye]) - or whatever) - 2 oz #ingredient([Merchantโ€™s Pleasure]) #ingredient([Shampoo]) (rare, use #ingredient([Amber Imperial]) instead) - 5 oz #ingredient([Dandruff Lotion]) - 2 oz #ingredient([Athletes Foot Remedy]) - 1ยฝ oz #ingredient([Insecticide])]) #heading(level: 1, outlined: false, numbering: none)[Lost Recipes] #cocktail([Currents of Jordan],none) #cocktail([First Kiss],none) // Kus van Keetje Tippel #cocktail([Nell Kimballโ€™s Kiss],[Known in dutch as De Kus van Keetje Tippel#index[De Kus van Keetje Tippel]]) #cocktail([Inez Armand],none) #cocktail(threshold: 1em, [The Kiss Forced],none) #pagebreak() = Noir Bar <NoirBar> #v(-2mm)#align(center)[#image("noir.jpg", height: 25mm)] //#v(-34mm) #v(-8pt) #align(center, text(9pt, cocktailcolor)[*#smallcaps[The World of Film Noir]*]) #v(12pt) //#columns(1, outline(title: none, target: selector(heading).after(<NoirBar>, inclusive: true).before(<ForbiddenCocktails>, inclusive: false))) //#pagebreak() #moviecocktail([Barbados Rum Punch], [Alias <NAME>],[ - 1ยฝ oz #ingredient([Dark Rum]) #indexIn([Rum]) - 2 oz #ingredient([Passion Fruit Juice]) - ยพ oz #ingredient([Lime Juice]) - 1 dash #ingredient([Angostura]) - 1 pinch of Grated #ingredient([Nutmeg]) - #ingredient([Lime]) Slice for garnish Shake liquids and grated nutmeg with ice. Strain into tumbler. Garnish with thin slice of lime.]) #moviecocktail([Angel Face], [Angel Face],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Calvados]) - 1 oz #ingredient([Apricot Brandy]) - #ingredient([Lemon]) Peel Twist for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with twist of lemon peel.]) #moviecocktail([The Left Hand], [Asphalt Jungle],[ A Bourbon-based *Negroni* variation - 1ยฝ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Sweet Vermouth]) - ยพ oz #ingredient([Campari]) - 3-4 dashes #ingredient([Chocolate Bitters]) - #ingredient([Maraschino Cherries]) for garnish Stir liquids over ice. Strain into tumbler. Add ice if you prefere. Garnish with a cherry. Or don't.]) #moviecocktail([Blue Dahlia], [The Blue Dahlia],[ - 1ยฝ oz #ingredient([Vodka]) - ยฝ oz #ingredient([Maraschino Liqueur]) - ยฝ oz #ingredient([Lime Juice]) - ยผ oz #ingredient([Simple Syrup]) - 1 dashes #ingredient([Orange Bitters]) - 10 #ingredient([Blueberries]) - 2 #ingredient([Basil]) Leaves - 4 #ingredient([Mint]) Leaves - #ingredient([Lemon]) Peel for garnish - #ingredient([Mint]) Sprig for garnish Muddle fruits and herbs with syrup in shaker. Add liquids, ice, and shake vigorously. Double-strain into cocktail glass. Garnish with twist of lemon peel and mint sprig.]) #moviecocktail([Gimlet], [The Big Sleep],[ - 2 oz #ingredient([Gin]) - ยพ oz #ingredient([Lime Juice]) - ยผ oz Sweetened #ingredient([Lime Juice]) - #ingredient([Lime]) Wheel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with a lime wheel.]) #moviecocktail([Stinger], [The Big Clock],[ - 2 oz #ingredient([Brandy]) - 1 oz #ingredient([White Crรจme de Menthe]) //- 1 oz #ingredient([Lime Juice]) //- #ingredient([Lemon]) Peel for garnish Shake liquids with ice. Strain into cocktail glass. //Garnish with a twist of lemon peel. ]) #moviecocktail([Pearl Diver], [The Blue Gardenia],[ - 1ยฝ oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Mezcal]) - ยฝ oz #ingredient([Don Gardenia's Mix]) - ยฝ oz #ingredient([Orange Juice]) - ยผ oz #ingredient([Lime Juice]) - 1 dash #ingredient([Angostura]) - #ingredient([Lime]) Wheel for garnish *Don Gardenia's Mix* (simplified!): mix a cup of water with a cup of sugar, add a bar spoon of vanilla extract, two sticks of cinnamon, and two cloves. Simmer for twelve minutes, strain and cool. Blend all ingredients with half a cup of ice. Strain into highball glass, add crushed ice to fill. Garnish with lime wheel - and an edible flower, if you feel this is your lucky night.]) #moviecocktail([Hemingway Daiquiri], [The Breaking Point],[ - 2ยฝ oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Maraschino Liqueur]) - ยฝ oz #ingredient([Grapefruit Juice]) - ยผ oz #ingredient([Lime Juice]) - #ingredient([Lime]) Wheel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with a lime wheel.]) #moviecocktail(label: <deadreckoning>, [The Dead Reckoning], [Dead Reckoning],[ - 2 oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([Pineapple Juice]) - 1 oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Tawny Port]) - ยฝ oz #ingredient([Brandy]) - ยฝ oz #ingredient([Maple Syrup]) - 1 bar spoon #ingredient([Vanilla Syrup]) - 1 dash #ingredient([Angostura]) - 1 oz #ingredient([Sparkling Water]) - #ingredient([Lemon]) Peel for garnish - #ingredient([Mint]) Sprig for garnish Shake all liquids except water with ice. Strain over fresh ice into londrink glass. Garnish with lemon twist and mint sprig.]) #moviecocktail([Crimson Kimono], [The Crimson Kimono],[ - 1 oz #ingredient([Japanese Whiskey]) (#ingredient([Suntori Toki])) or #ingredient([Irish Whiskey]) #indexIn([Whiskey]) - ยพ oz #ingredient([Bruto Americano]) - ยฝ oz #ingredient([Campari]) - ยฝ oz #ingredient([Ginger Liqueur]) - #ingredient([Ginger]) Slice for garnish _Simplify_: Take 1ยผ oz #ingredient([Bruto Americano]) or #ingredient([Campari]) instead of using both. Close enough. \ Shake liquids with ice. Strain into tumbler with ice. Garnish with a thin slice of ginger.]) #moviecocktail(label: <journalist>, [Journalist], [Deadline-U.S.A.],[ - 1ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Dry Vermouth]) - ยผ oz #ingredient([Sweet Vermouth]) - ยผ oz #ingredient([Curaรงao Bitters]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Lemon]) Peel for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with a twist of lemon peel.]) #moviecocktail([Corpse Reviver No. 2], [Decoy],[ - 1 oz #ingredient([Gin]) - ยพ oz #ingredient([Orange Liqueur]) - ยพ oz #ingredient([Cocchi Americano]) (or somesuch) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Absinthe]) or #ingredient([Pernod]) - #ingredient([Lemon]) Peel for garnish Rinse tumbler with absinthe, pernod or something in that ballpark. Shake liquids with ice. Strain into prepared glass. Garnish with a twist of lemon peel.]) #moviecocktail(label: <boilermaker>, [Boilermaker], [The Devil Thumbs a Ride],[ - 1 oz #ingredient([Whiskey]) - 1 bottle Cold #ingredient([Beer]) _Variation_: #ingredient([Jonge Jenever]) instead of #ingredient([Whiskey]). \ Combine in large beer glass.]) #moviecocktail([The Last Word], [D.O.A.],[ - ยพ oz #ingredient([Gin]) - ยพ oz #ingredient([Green Chartreuse]) - ยพ oz #ingredient([Maraschino Liqueur]) - ยพ oz #ingredient([Lime Juice]) - #ingredient([Maraschino Cherries]) for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with cherry.]) #moviecocktail([Borden Chase], [Dr. Broadway],[ - 2ยฝ oz #ingredient([Scotch]) #indexIn([Whiskey]) - ยพ oz #ingredient([Sweet Vermouth]) - 1 bar spoon #ingredient([Anisette]) - a few dashes #ingredient([Orange Bitters]) Mix liquids with ice. Strain into cocktail glass.]) #moviecocktail([Fallen Angel], [Fallen Angel],[ - 2 oz #ingredient([Gin]) - ยฝ oz #ingredient([White Crรจme de Menthe]) - ยฝ oz #ingredient([Lime Juice]) - 1 dash #ingredient([Angostura]) - #ingredient([Mint]) Sprig for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with mint sprig.]) #moviecocktail([The Blacklisted], [Force of Evil],[ - 1ยพ oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - ยพ oz #ingredient([Lemon Juice]) - ยพ oz #ingredient([Honey Syrup]) - 4 #ingredient([Blackberries]), some for garnish Muddle berries in shaker, add liquids and shake well with ice. Double-strain into cocktail glass. Garnish with skewered blackberries.]) #moviecocktail([Champagne & Gildas], [Gilda],[ *Gilda* is a Basque pintxo (Northern Spanish tapa): - #ingredient([Anchovy Fillets]) (tinned) - #ingredient([Cocktail Onions]) - #ingredient([Cornichons]) - #ingredient([Green Olives]) - #ingredient([Pickled Guindilla Pepper]) Skewer ingredients, wrapping the other ingredients in anchovy and pickled pepper. - #ingredient([Sparkling Wine]) #indexIn([Bubbles]) Serve sparkling wine (#ingredient([Cava])?) in flutes with *Gilda* pintxos on the side.]) #moviecocktail([Mai Tai], [Hell's Half Acre],[ - ยฝ oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Dark Rum]) #indexIn([Rum]) - ยพ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Orgeat Syrup]) - ยพ oz #ingredient([Lime Juice]) - #ingredient([Lime]) Wheel for garnish - Sprig of #ingredient([Mint]) for garnish Shake liquids except dark rum vigorously over crushed ice. Strain into tumbler, half filled with crushed ice. Top gently with dark rum. Garnish lime wheel and a sprig of mint.]) #moviecocktail([Lee Tracy], [High Tide],[ - 2 oz #ingredient([Sloe Gin]) - 1 oz #ingredient([Dry Liqueur]) - 1 dash #ingredient([Absinthe]) Shake liquids over ice. Strain into cocktail glass.]) #moviecocktail(label: <horsesneck>, [Horseโ€™s Neck], [In a Lonely Place],[ - 2 oz #ingredient([Bourbon]) or #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - #ingredient([Ginger Ale]) - #ingredient([Lemon]) Peel Spiral Arrange whiskey, ice cubes and lemon peel spiral in highball glass. Top with ginger ale.]) #moviecocktail(label: <eldiablo>, [El Diablo], [The Hitch-Hiker],[ - 1ยพ oz #ingredient([Tequila]) - ยฝ oz #ingredient([Crรจme de Cassis]) - ยฝ oz #ingredient([Lime Juice]) - 5 oz #ingredient([Ginger Beer]) - #ingredient([Lime]) Wedge for garnish Shake liquids except ginger beer over ice. Strain into higball glass filled with ice. Top with ginger beer. Garnish with lime wedge.]) #moviecocktail(label: <grable>, [The Grable], [I Wake Up Screaming],[ - 1ยฝ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Orange Liqueur]) - #ingredient([Sparkling Water]) - #ingredient([Maraschino Cherries]) for garnish Combine liquids except water in tumbler glass with ice. Gently stir, add splash of sparkling water. Garnish with cherry.]) #moviecocktail(label: <kittycollins>, [Kitty Collins], [The Killers],[ - 2 oz #ingredient([Gin]) - 1 oz #ingredient([Lemon Juice]) - ยผ oz #ingredient([Green Crรจme de Menthe]) - ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Sparkling Water]) - #ingredient([Lemon]) Wheel for garnish Shake liquids except Menthe over ice. Pour into ice-filled highball glass. Top with sparkling water. Float Crรจme de Menthe over the back of a spoon on top. Garnish with lemon wheel.]) #moviecocktail([Tequila Sunrise], [A Kiss Before Dying],[ - 3 oz #ingredient([Tequila]) - 4 oz #ingredient([Orange Juice]) - ยฝ oz #ingredient([Grenadine]) - Slice of #ingredient([Orange]) for garnish - #ingredient([Maraschino Cherries]) for garnish Combine tequila and orange juice with ice cubes in a highball glass. Stir and let rest. Gently float grenadine circularly over the back of a spoon over the drink. Garnish with a slice of orange and cherry.]) #moviecocktail([Sailor Beware], [The Lady from Shanghai],[ - 1ยฝ oz #ingredient([Irish Whiskey]) #indexIn([Whiskey]) - ยพ oz #ingredient([Brandy]) - ยฝ oz #ingredient([Green Chartreuse]) - ยฝ oz #ingredient([Ginger Liqueur]) - #ingredient([Absinthe]) - #ingredient([Lemon]) Peel Twist for garnish Rinse cocktail glass with absinthe. Stir liquids (no absinthe) with ice and strain into prepared glass. Garnish with twist of lemon peel.]) #moviecocktail(label: <hammettmartini>, [Hammett Martini], [The Maltese Falcon],[ - 2ยผ oz #ingredient([Vodka]) - ยพ oz #ingredient([White Rum]) #indexIn([Rum]) - ยผ oz #ingredient([Bรฉnรฉdictine]) - #ingredient([Lemon]) Peel Twist for garnish Stir liquids with ice and strain into cocktail glass. Garnish with twist of lemon peel.]) #moviecocktail([Mildred Pierce], [Mildred Pierce],[ - 1 oz #ingredient([Mezcal]) - ยพ oz #ingredient([Aperol]) - ยพ oz #ingredient([Pamplemousse Liqueur]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Orange]) Peel for garnish Shake liquids over ice. Strain into tumbler with ice cubes. Garnish with orange peel twist.]) #moviecocktail([The Zeena], [Nightmare Alley],[ - 2 oz #ingredient([Rye Whiskey]) or #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Sweet Vermouth]) - ยพ oz #ingredient([Bรฉnรฉdictine]) - 1 or more dashes #ingredient([Angostura]) - #ingredient([Absinthe]) - #ingredient([Orange]) Peel for garnish Rinse tumbler glass with absinthe. Stir liquids with ice. Strain into prepared glass. Garnish with orange peel twist.]) #moviecocktail([Johnny & Earle], [Odds Against Tomorrow],[ - 1ยพ oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1ยฝ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยผ oz #ingredient([Allspice Dram]) or #ingredient([Cynar]) - 1 dash #ingredient([Pimento Bitters]) (optional) Shake liquids over ice. Strain into tumbler with ice cubes.]) #moviecocktail([Paloma], [Out of the Past],[ - 3 oz #ingredient([Tequila]) - ยฝ oz #ingredient([Lime Juice]) - 4 oz #ingredient([Grapefruit Fizz]) (or #ingredient([Bitter Lemon])) - #ingredient([Grapefruit]) Slice for garnish Combine liquids in half ice-filled highball glass. Stir gently. Garnish with slice of grapefruit.]) #moviecocktail([Pisco Punch], [Raw Deal],[ - 2 oz #ingredient([Pisco]) - 1 oz #ingredient([Pineapple Juice]) - ยฝ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Pineapple Gomme Syrup]) - #ingredient([Maraschino Cherries]) for garnish Shake liquids over ice. Strain into tumbler with ice cubes. Garnish with cocktail cherry.]) #moviecocktail([<NAME>], [Pickup On South Street],[ See @bloodymary.]) #moviecocktail([Pinch & Water], [Phantom Lady],[ - 3 oz #ingredient([Scotch]) (if you're compelled to, use #ingredient([Dimple Pinch])) #indexIn([Whiskey]) - splash of #ingredient([Water]) Pour scotch in tumbler glass. Add splash of water or ice cubes (โ€˜on the rocksโ€™). Or don't (โ€˜neatโ€™).]) #moviecocktail([<NAME>], [Pitfall],[ - 1ยฝ oz #ingredient([Scotch]) #indexIn([Whiskey]) - 1ยฝ oz #ingredient([Sweet Vermouth]) - 3 dashes oz #ingredient([Bรฉnรฉdictine]) - #ingredient([Lemon]) Peel for garnish Stir liquids with nice. Strain into tumbler glass. Garnish with lemon peel twist.]) #moviecocktail(label: <recklessmoment>, [Reckless Moment], [The Reckless Moment],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Dry Curaรงao]) - 2 oz #ingredient([Pineapple Juice]) - 2 oz #ingredient([Sparkling Water]) - ยฝ oz #ingredient([Pineapple Gomme Syrup]) - #ingredient([Pineapple]) Chunk for garnish - #ingredient([Maraschino Cherries]) for garnish Shake liquids minus water over ice. Strain into highball glass two thirds filled with ice. Top with sparkling water. Garnish with cocktail cherry skewered to pineapple chunk.]) #moviecocktail([<NAME>], [Shadow of a Doubt],[See @merrywidow.]) #moviecocktail([<NAME>], [Ride the Pink Horse],[ - 1ยฝ oz #ingredient([Tequila]) - ยพ oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Lime]) Wheel for garnish Shake liquids over ice. Strain into cocktail glass with ice. Garnish with lime wheel.]) #moviecocktail([Between the Sheets], [Road House],[ - 1 oz #ingredient([Brandy]) - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Orange Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - Flamed #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into cocktail glass. Squeeze orange peel over a flame over the drink, then add the peel (or don't).]) #moviecocktail([Champagne Cocktail], [Sunset Blvd.],[See @champagnecocktail.]) #moviecocktail([Deshler], [The Set-Up],[ - 2 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Dubonnet]) - 1 bar spoon #ingredient([Orange Liqueur]) - 1 dash #ingredient([Peychaudโ€™s Bitters]) (to taste) - #ingredient([Lemon]) Peel for garnish - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with lemon and orange peel.]) #moviecocktail(label: <ginsling>, [Gin Sling], [The Shanghai Gesture],[ - 1ยฝ oz #ingredient([Gin]) - 1 oz #ingredient([Sweet Vermouth]) - ยพ oz #ingredient([Lemon Juice]) - dashes #ingredient([Angostura]) - dashes #ingredient([Sparkling Water]) - #ingredient([Lemon]) Wheel for garnish Shake liquids minus water with ice. Strain into tumbler glass filled with ice. Top with sparkling water. Garnish with lemon wheel.]) #moviecocktail([Black Manhattan], [Side Street],[ - 2 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Amaro Averna]) - 1 dash #ingredient([Angostura]) - 1 dash #ingredient([Orange Bitters]) - #ingredient([Maraschino Cherries]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with cocktail cherry.]) #moviecocktail([Specter of the Rose], [Specter of the Rose],[ - 2 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Amaro Nardini]) - ยผ oz #ingredient([Fernet Branca]) - dashes #ingredient([Peychaudโ€™s Bitters]) (to taste) - #ingredient([Lemon]) Peel for garnish Stir liquids with ice. Strain into tunmbler glass. Garnish with twist of lemon peel.]) #moviecocktail([Brooklyn], [The Strange Love of Martha Ivers],[ - 1ยพ oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - ยพ oz #ingredient([Dry Vermouth]) - ยผ oz #ingredient([Amer Picon]) (or #ingredient([Bigallet China-China]), or a medium-bodied Amaro) - ยผ oz #ingredient([Maraschino Liqueur]) - #ingredient([Maraschino Cherries]) for garnish Stir liquids with ice. Strain into tunmbler glass. Garnish with stick of skewered cherries.]) #moviecocktail([Ann Sheridan], [Woman on the Run],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Dry Curaรงao]) - ยฝ oz #ingredient([Lime Juice]) - #ingredient([Lime]) Wheel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with a wheel of lime.]) #moviecocktail([Belita], [Suspense],[ - 2 oz #ingredient([Gin]) - ยฝ oz #ingredient([Blue Curaรงao]) - ยผ oz #ingredient([White Crรจme de Menthe]) - ยฝ oz #ingredient([Simple Syrup]) - #ingredient([Mint]) Sprig for garnish Blend liquids with a cup of ice smooth. Pour into cocktail glass. Garnish with a sprig of mint.]) #moviecocktail(label: <martinialaluisbunuel>, [Martini (a la Luis Buรฑuel)], [Sweet Smell of Success],[ - 3 oz #ingredient([Gin]) - ยฝ oz #ingredient([Dry Vermouth]) - #ingredient([Lemon]) Peel - #ingredient([Green Olives]) for garnish (optional) Stir liquids with ice. Strain into cocktail glass. Orโ€ฆ \ Fill cocktail glass with very dry ice. Gently pour vermouth over ice, and stir very gently. Then strain out the vermouth and add the gin. Stir gently, at least 20 times, and let it rest for a minute. No longer. Twist lemon peel over glass, and rub the peel skin a few times over the rim. Set the lemon peel in the drink, skin-side up. Garnish with a green olive if you like.]) #moviecocktail([Bronx], [Wicked Woman],[ - 2ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Dry Vermouth]) - 2 oz #ingredient([Orange Juice]) - dashes #ingredient([Orange Bitters]) (to taste) - #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into highball glass half filled with ice cubes. Garnish with a twist of orange peel.]) #moviecocktail([The Millionaire], [Three Strangers],[ - 2 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Orange Liqueur]) - ยผ oz #ingredient([Absinthe]) - ยฝ oz #ingredient([Grenadine]) - ยฝ oz #ingredient([Lemon Juice]) - 1 #ingredient([Egg White]) - Grated #ingredient([Nutmeg]) for garnish Shake liquids and egg white vigorously. Add ice and shake again. Strain into cocktail glass. Garnish by grating nutmeg over foam.]) #pagebreak() = Forbidden Cocktails <ForbiddenCocktails> #v(0mm)#align(center)[#image("precode.jpg", height: 42mm)] //#v(-34mm) #v(-8pt) #align(center, text(17.8pt, cocktailcolor)[*#smallcaps[Sinful Sips & Demon Drinks]*]) #v(-12pt) #align(center, text(11.6pt, cocktailcolor)[*#smallcaps[Libations Inspired by Pre-Code Hollywood]*]) #v(12pt) //#outline(title: none, target: selector(heading).after(<ForbiddenCocktails>, inclusive: true).before(<Ingredients>, inclusive: false)) //#v(12pt) //#pagebreak() #moviecocktail(label: <balancedaccount>, [Balanced Account], [The Divorcee],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Dry Vermouth]) - 1 oz #ingredient([Lillet Blanc]) - 1 dash or two #ingredient([Orange Bitters]) - #ingredient([Lemon]) Peel for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with lemon peel.]) #moviecocktail([Platinum Blond], [Hell's Angels],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Dry Vermouth]) - 1 spoonful #ingredient([Elderflower Liqueur]) - #ingredient([Maraschino Cherries]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with cherry.]) #moviecocktail(label: <thebetterwife>, [The Better Wife], [Anybody's Woman],[ - 1ยฝ oz #ingredient([Gin]) - 1ยฝ oz #ingredient([Dry Vermouth]) - 1 spoonful #ingredient([Maraschino Liqueur]) - 1 dash #ingredient([Orange Bitters]) - 1 dash #ingredient([Angostura]) Stir liquids with ice. Strain into cocktail glass.]) #moviecocktail([Legionnaire], [Morocco],[See @legionnaire.]) #moviecocktail([Count Draiquiri], [Dracula],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Grenadine]) Shake liquids with ice. Strain into cocktail glass.]) #moviecocktail([Bronze Peacock], [Little Caesar],[ - 1ยฝ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1ยฝ oz #ingredient([Red Vermouth]) - ยฝ oz #ingredient([Grenadine]) - 1 bar spoon #ingredient([Fernet Branca]) - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into tumbler glass, add ice. Garnish with orange peel.]) #moviecocktail([Love & Money], [The Easiest Way],[ - 1 oz #ingredient([Gin]) - 1 oz #ingredient([Green Chartreuse]) - ยฝ oz #ingredient([Elderflower Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - #ingredient([Maraschino Cherries]) for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with maraschino cherry.]) #moviecocktail([Love on Approval], [Dance, Fools, Dance],[ - 4 oz #ingredient([Brandy]) - 2 #ingredient([Dry Vermouth]) - 1 oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Grenadine]) - #ingredient([Lemon]) Wheels for garnish Shake liquids with ice. Strain into tea cups or a teapot. Garnish each individual cups with a lemon wheel.]) #moviecocktail(label: <strangerskiss>, [Strangerโ€™s Kiss], [Strangers May Kiss],[ - 1 oz #ingredient([Tequila]) - ยฝ oz #ingredient([Crรจme de Cassis]) - ยผ oz #ingredient([Lime Juice]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) Shake liquids except sparkling wine with ice. Strain into cocktail glass with an ice cube, top with sparkling wine.]) #moviecocktail(label: <tompowers>, [Tom Powers], [The Public Enemy],[ - 1 oz #ingredient([Irish Whiskey]) #indexIn([Whiskey]) - ยฝ oz #ingredient([Grapefruit Juice]) - ยฝ oz #ingredient([Campari]) - ยผ oz #ingredient([Maraschino Liqueur]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Peel for garnish Shake liquids except sparkling wine with ice. Strain into cocktail glass, top with sparkling wine. Garnish with a lemon peel.]) #moviecocktail([My Pal Rye], [Night Nurse],[ - 1ยฝ oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Lillet Blanc]) - ยฝ oz #ingredient([Campari]) - 1 dash #ingredient([Orange Bitters]) - #ingredient([Orange]) Peel for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with an orange peel.]) #moviecocktail(label: <lastflight>, [Last Flight], [The Last Flight],[ - 1 oz #ingredient([Gin]) - ยผ oz #ingredient([Vanilla Syrup]) - 5 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Peel for garnish In a champagne flute, combine gin and vanilla syrup. Top with sparkling wine. Garnish with lemon peel.]) #moviecocktail([Coney Island Roller Coaster], [Bad Girl],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - ยพ oz #ingredient([Orange Juice]) - ยฝ oz #ingredient([Raspberry Syrup]) - 1 spoonful #ingredient([Maraschino Liqueur]) - 3 #ingredient([Maraschino Cherries]) for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with cherries.]) #moviecocktail([Lady from New Orleans], [Safe in Hell],[ - 1 oz #ingredient([Brandy]) - 1 oz #ingredient([Sweet Vermouth]) - 0.74 oz #ingredient([Pineapple Juice]) - ยผ oz #ingredient([Bรฉnรฉdictine]) - 1 dash #ingredient([Peychaudโ€™s Bitters]) - #ingredient([Pineapple]) Leaf for garnish Shake liquids with ice. Strain into tumbler glass with ice. Garnish with pineapple leaf.]) #moviecocktail([J & H], [Dr. Jekyll and Mr. Hyde],[ - 2 oz #ingredient([Applejack]) - 1 oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Honey Syrup]) - ยพ oz #ingredient([Red Wine]) Shake liquids minus red wine with ice. Strain into tumbler glass with a lot of ice. Float the red wine on top by pouring slowly over the back of a spoon.]) #moviecocktail([Shanghai Lily], [Shanghai Express],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - 1 oz #ingredient([Lemon Juice]) - ยผ oz #ingredient([Absinthe]) - ยผ oz #ingredient([White Crรจme de Menthe]) - ยผ oz #ingredient([Vanilla Syrup]) Shake liquids with ice. Strain into cocktail glass.]) #moviecocktail(label: <javelin>, [Javelin], [This is the Night],[ - 1 oz #ingredient([Scotch]) #indexIn([Whiskey]) - 3 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - ยฝ oz #ingredient([Cream]) - 2 scoops #ingredient([Lemon Sorbet]) - 2 dashes #ingredient([Orange Bitters]) - #ingredient([Lemon]) Peels for garnish Combine Scotch, sparkling wine, cream, sorbet, and bitters in a chilled bowl and stir without ice until frothy. Pour into wine glasses. Garnish with lemon peel.]) #moviecocktail([First Ward], [Scarface],[See @firstward.]) #moviecocktail([Lil Red], [Red-Headed Woman],[See @lilred.]) #moviecocktail([Georges & Angelas], [Million Dollar Legs],[ - 1 oz #ingredient([Brandy]) - 1ยฝ oz #ingredient([Dry White Wine]) - ยผ oz #ingredient([Lemon Juice]) - ยฝ oz #ingredient([Honey Syrup]) - #ingredient([Thyme]) Sprig for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with thyme sprig.]) #moviecocktail([Flat on my Flute], [Love Me Tonight],[See @flatonmyflute.]) #moviecocktail([Stiff Water], [Bird of Paradise],[ - ยพ oz #ingredient([Dry Curaรงao]) - ยผ oz #ingredient([Dark Rum]) #indexIn([Rum]) - 1 oz #ingredient([Coconut Cream]) - ยพ oz #ingredient([Lime Juice]) - Grated #ingredient([Nutmeg]) for garnish - #ingredient([Mint]) Sprig for garnish Shake liquids vigorously with ice. Strain into tumbler glass. Garnish with nutmeg and mint sprig.]) #moviecocktail([Blonde Venus], [Blonde Venus],[ - 1ยฝ oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Orange Liqueur]) - 1 oz #ingredient([White Grape Juice]) - 1 dash #ingredient([Angostura]) - #ingredient([Orange Peel]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with orange peel.]) #moviecocktail(label: <reddust>, [Red Dust], [Red Dust],[ - 1ยฝ oz #ingredient([Red Wine]) - ยพ oz #ingredient([White Rum]) #indexIn([Rum]) - ยพ oz #ingredient([White Grape Juice]) - 3 oz #ingredient([Sparkling Water]) - #ingredient([Orange]) Peel for garnish Combine liquids except water in a highball glass over ice. Top with sparkling water. Garnish with orange peel.]) #moviecocktail([Greenwich Village], [Call Her Savage],[ - 1 oz #ingredient([Gin]) - ยพ oz #ingredient([Crรจme de Violette]) or #ingredient([Crรจme de Cassis]) - ยผ oz #ingredient([Absinthe]) Shake liquids with ice. Strain into (large) shot glass.]) #moviecocktail([Passage to Paradise], [One Way Passage],[ See @passagetoparadise.]) #moviecocktail([Three on a Match], [Three on a Match],[ - 1 oz #ingredient([Sloe Gin]) - 1 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Sweet Vermouth]) - 3 #ingredient([Maraschino Cherries]) for garnish. Stir liquids with ice. Strain into cocktail glass. Garnish with cocktail cherries.]) #moviecocktail([Lubitsch Touch], [Trouble in Paradise],[ - 1ยฝ oz #ingredient([Brandy]) - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Apricot Liqueur]) - ยฝ oz #ingredient([Lime Juice]) Shake liquids with ice. Strain into cocktail glass.]) #moviecocktail(label: <nakedmoon>, [Naked Moon], [The Sign of the Cross],[ - 1 bottle #ingredient([Red Wine]) - 4 oz #ingredient([Gin]) - 4 oz #ingredient([White Grape Juice]) - 4 oz #ingredient([Orange Juice]) - 1 Sliced #ingredient([Lemon]) - 2 oz #ingredient([Sparkling Water]) - #ingredient([Cinnamon]) Stick Combine all liquids except water in large pitcher. Stir and refrigerate for at least an hour. Add fizzwater when serving, stir to combine.]) #moviecocktail([House of Pain], [Island of Lost Souls],[ - 2 oz #ingredient([Rum]) - ยพ oz #ingredient([Lime Juice]) - ยฝ oz #ingredient([Cinnamon Syrup]) - 1 bar spoon #ingredient([Absinthe]) - 1 bar spoon #ingredient([Grenadine]) - 1 dash #ingredient([Angostura]) - #ingredient([Lime]) Wedge for garnish Shake liquids with ice. Strain into tumbler. Garnish with lime wedge.]) #moviecocktail(label: <diamondring>, [Diamond Ring], [She Done Him Wrong],[ - 1ยฝ oz #ingredient([Gin]) - ยผ oz #ingredient([Maraschino Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - 2 oz #ingredient([Sparkling Water]) - #ingredient([Maraschino Cherries]) for garnish. - #ingredient([Lemon]) Peel for garnish Shake all liquids except water with ice. Strain into highball glass, top with sparkling water. Garnish with cherry and lemon peel.]) #moviecocktail([Lotus Blossom], [The Bitter Tea of General Yen],[ - 1ยฝ oz #ingredient([Rum]) - ยพ oz #ingredient([Absinthe]) - ยฝ oz #ingredient([Maraschino Liqueur]) - ยฝ oz #ingredient([Lemon Juice]) - 1 #ingredient([Egg White]) Shake liquids and egg white vigorously. Add ice and shake again. Strain into cocktail glass.]) #moviecocktail([Rose-Colored Glasses], [42nd Street],[ - 2 oz #ingredient([Gin]) - ยพ oz #ingredient([Raspberry Syrup]) - ยฝ oz #ingredient([Cream]) - 1 dash #ingredient([Angostura]) Shake liquids with ice. Strain into cocktail glass.]) #moviecocktail([Lady Pearl], [Our Betters],[ - ยฝ oz #ingredient([Gin]) - ยฝ oz #ingredient([Absinthe]) - ยฝ oz #ingredient([Apricot Liqueur]) - ยฝ oz #ingredient([Pineapple Juice]) - 1 #ingredient([Egg White]) - #ingredient([Mint]) Leaf for garnish Shake liquids and egg white vigorously. Add ice and shake again. Strain into cocktail glass. Garnish with mint leaf.]) #moviecocktail([King Kong], [King Kong],[ - 2 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - ยพ oz #ingredient([Amaro]), for example #ingredient([Averna]) - ยพ oz #ingredient([Crรจme de Banane]) - 1 dash #ingredient([Angostura]) Stir liquids with ice. Strain into tumbler class with ice cubes.]) #moviecocktail([Pettinโ€™ in the Park], [Gold Diggers of 1933],[ - 2 oz #ingredient([Applejack]) - ยฝ oz #ingredient([Dry Curaรงao]) - ยฝ oz #ingredient([Raspberry Juice]) - #ingredient([Raspberries]) for garnish Stir liquids with ice. Strain into cocktail glass. Garnish with raspberry.]) #moviecocktail(label: <kansasromanov>, [Kansas Romanov], [Cocktail Hour],[ - 2 oz #ingredient([Vodka]) - 1ยฝ oz #ingredient([Cranberry Juice]) - 1 dash #ingredient([Angostura]) - 2 oz #ingredient([Sparkling Water]) - #ingredient([Lemon]) Peel for garnish Combine liquids except water in ice filled highball glass. Top with sparkling water. Garnish with lemon peel.]) #moviecocktail([Fuzzy Wuzzy], [Baby Face],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Elderflower Liqueur]) - ยฝ oz #ingredient([Lime Juice]) - 2 drops #ingredient([Orange Blossom Water]) - 1 #ingredient([Egg White]) Shake liquids and egg white vigorously. Add ice and shake again. Strain into cocktail glass.]) #moviecocktail(label: <midnightmary>, [Midnight Mary], [Midnight Mary],[ - 2 oz #ingredient([Gin]) - 2 oz #ingredient([Tomato Juice]) - ยฝ oz #ingredient([Lemon Juice]) - 1 dash #ingredient([Tabasco]) - 1 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) - #ingredient([Lemon]) Wheel for garnish Shake liquids with ice. Strain into highball glass with ice. Top with sparkling wine. Garnish with a lemon wheel.]) #moviecocktail([Here Kitty Kitty], [Footlight Parade],[ - 1ยผ oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 oz #ingredient([Crรจme de Cacao]) - ยพ oz #ingredient([White Crรจme de Menthe]) - #ingredient([Mint]) Leaf Shake liquids with ice. Strain into cocktail glass. Garnish with mint leaf.]) #moviecocktail([The Berry-More], [Dinner at Eight],[ - 1 oz #ingredient([Brandy]) - ยพ oz #ingredient([Kirsch]) - ยพ oz #ingredient([Raspberry Syrup]) - ยพ oz #ingredient([Espresso]) - 1 #ingredient([Egg White]) - 2 oz #ingredient([Raspberries]) for garnish Shake liquids and egg white vigorously. Add ice and shake again. Strain into cocktail glass.]) Garnish with raspberries. #moviecocktail([Hotel Hibiscus], [Flying Down to Rio],[ - 2 oz #ingredient([White Rum]) #indexIn([Rum]) - ยพ oz #ingredient([Lime Juice]) - ยผ oz #ingredient([Hibiscus Syrup]) - 1 dash #ingredient([Angostura]) - #ingredient([Lime]) Wheel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with a lime wheel.]) #moviecocktail([Serenade in a Snowstorm], [Queen Christina],[ - 1ยฝ oz #ingredient([Akvavit]) - 1ยฝ oz #ingredient([Sherry Fino]) - ยผ oz #ingredient([Maraschino Liqueur]) - 1 dash #ingredient([Angostura]) - #ingredient([Orange]) Peel for garnish Shake liquids with ice. Strain into tumbler with ice. Garnish with orange peel.]) #moviecocktail([Love Triangle], [Design for Living],[ - 1 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 1 oz #ingredient([Apricot Liqueur]) - 1 oz #ingredient([Lemon Juice]) - #ingredient([Lemon]) Wheel for garnish Shake liquids with ice. Strain into cocktail glass. Garnish with lemon wheel.]) #moviecocktail([Olympian], [Search for Beauty],[ - 2 oz #ingredient([Bourbon]) #indexIn([Whiskey]) - 2 oz #ingredient([Whole Milk]) - ยฝ oz #ingredient([Crรจme de Cacao]) - ยฝ oz #ingredient([Maraschino Liqueur]) - 1 dash #ingredient([Angostura]) - Grated #ingredient([Nutmeg]) for garnish Shake liquids vigorously with ice. Strain into tumbler. Garnish with nutmeg.]) #moviecocktail(label: <jardindorient>, [Jardin dโ€™Orient], [Mandalay],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Cinnamon Syrup]) - 1 bar spoon oz #ingredient([Orange Liqueur]) - 4 oz #ingredient([Sparkling Wine]) #indexIn([Bubbles]) Combine all liquids except wine in a champagne flute. Top with sparkling wine.]) #moviecocktail(label: <ithappenedonemorning>, [It Happened One Morning], [It Happened One Night],[ - 2 oz #ingredient([Rye Whiskey]) #indexIn([Whiskey]) - 1 oz #ingredient([Coffee Liqueur]) - ยพ oz #ingredient([Espresso]) - ยผ oz #ingredient([Honey Syrup]) Shake liquids vigorously with ice. Strain into cocktail glass.]) #moviecocktail([Tarzanโ€™s Mate], [Tarzan and his Mate],[ - 2 oz #ingredient([Rum]) - 1 oz #ingredient([Pineapple Juice]) - ยฝ oz #ingredient([Lime Juice]) - ยผ oz #ingredient([Vanilla Syrup]) - 1 dash #ingredient([Angostura]) - #ingredient([Lime]) Wheel for garnish Shake liquids with ice. Strain into tumbler glass. Garnish with a lime wheel.]) #moviecocktail([Cocktail for Two], [Murder at the Vanities],[ - 2 oz #ingredient([Gin]) - 2 oz #ingredient([Dry Vermouth]) - 1 oz #ingredient([Apricot Liqueur]) - ยพ oz #ingredient([Honey Syrup]) Stir liquids with ice. Strain into two cocktail glasses.]) #moviecocktail([Asta], [The Thin Man],[ - 1 oz #ingredient([White Rum]) #indexIn([Rum]) - ยฝ oz #ingredient([Dry Vermouth]) - ยฝ oz #ingredient([Orange Liqueur]) - ยพ oz #ingredient([Lemon Juice]) - ยผ oz #ingredient([Vanilla Syrup]) - #ingredient([Absinthe]) Rinse cocktail glass with absinthe. Shake the rest with ice, strain into prepared glass.]) #pagebreak() = Ingredients - Brands and Substitutes <Ingredients> //#v(12pt) Thy boate, whatever floateth it. - *#ingredient([Akvavit]) โ‡Œ #ingredient([Aguardente])*, #ingredient([Grappa]), #ingredient([Marc]). - *#ingredient([Almond Liqueur])*: #ingredient([Amaretto di Saronno]), #ingredient([Orgeat]). - *#ingredient([Anis Liqueur])* โ‡Œ *#ingredient([Anisette])* โ‡Œ *#ingredient([Sambuca])* โ‡Œ *#ingredient([Ouzo])* โ‡Œ *#ingredient([Raki])* โ‡Œ *#ingredient([Arak])* โ‡Œ *#ingredient([Pastis])* โ‡Œ *#ingredient([Pernod])*, *#ingredient([Absinthe])*. \ Absinthe carries a bitter (probably the wormwood) that the pured aniseed-based spirits don't. Different, not necessarily unequal to the task. - *#ingredient([Applejack]) โ‡Œ #ingredient([Apple Brandy]) โ‡Œ #ingredient([Calvados])*. - *#ingredient([Brandy])*: any #ingredient([Armagnac]), #ingredient([Cognac]), #ingredient([Metaxa]), #ingredient([Vieux]), #ingredient([Fundador]), #ingredient([Soberano]), #ingredient([Veterano]), #ingredient([Vecchia Romagna]), #ingredient([Weinbrand]). I'm irrationally fond of Fundador (blame Hemingway) but life's too short for fussing. - *#ingredient([Campari])* โ‡Œ *#ingredient([Bruto Americano])* โ‡Œ *#ingredient([Aperol])*. - *#ingredient([Champagne])*: Taittinger Brut, Bollinger Brut, Billecart-Salmon Brut, Pol Roger Brut, Dom Pรฉrignon Brut, G.H.Mumm, Perrier-Jouรซt Grand Brut, Piper-Heidsieck Brut. In a cocktail, I prefer the fizz of a Franciacorta or Crรฉmant over Champagne itself (note to self: snobbery considered harmful). - *#ingredient([Coffee Liqueur])*: #ingredient([Cafรฉ Marakesh]), #ingredient([Kalhรนa]), #ingredient([Tia Maria]), #ingredient([Mr. Black Cold Brew]). - *#ingredient([Crรจme de Banane])* โ‡Œ *#ingredient([Banana Liqueur])*: #ingredient([Tempus Fugit]), #ingredient([De Kuyper]), #ingredient([Pisang Ambon]), #ingredient([Marie Brizard]). - *#ingredient([Crรจme de Cacao])* โ‡Œ *#ingredient([Chocolate Liqueur])*: #ingredient([Tempus Fugit]), #ingredient([Mozart]), #ingredient([De Kuyper Dark]), #ingredient([Giffard]), #ingredient([Marie Brizard]). - *#ingredient([White Crรจme de Menthe])โ‡Œ #ingredient([Peppermint Schnapps])*: #ingredient([Giffard Menthe Pastille]), #ingredient([Leroux]), #ingredient([De Kuyper]). *#ingredient([Green Crรจme de Menthe])* can also be used. It has a different, you know, colour. - *#ingredient([Cynar]) โ‡Œ #ingredient([Fernet Branca]) โ‡Œ #ingredient([Unicum]) โ‡Œ #ingredient([Amaro Montenegro]) โ‡Œ #ingredient([Amaro Averna]) โ‡Œ #ingredient([Amaro Nardini])*. - *#ingredient([Green Chartreuse]) โ‡Œ #ingredient([Cloosterbitter])*, a bit stronger/more aromatic vs. a notch less. \ Other options: #ingredient([Strega]), #ingredient([Bรฉnรฉdictine]), an #ingredient([Anisette]) if called for. - *#ingredient([Drambuie]) โ‡Œ #ingredient([Glayva])*. - *#ingredient([Dubonnet]) โ‡Œ #ingredient([Byrrh]) โ‡Œ #ingredient([Red Vermouth])*. - *#ingredient([Franciacorta])*: #ingredient([Contadi Castaldi Zรจro]), #ingredient([Corte Fusia Franciacorta Brut]), #ingredient([Barone Pizzini Bagnadore]). - *#ingredient([Gin]) โ‡Œ #ingredient([Jonge Jenever])*, slightly more herbal vs. slightly fuller bodied. \ Other options: #ingredient([Akvavit]), #ingredient([Cachaรงa]), #ingredient([Pinga]), #ingredient([Obstler]), #ingredient([Quetsch Schnapps]), #ingredient([Slivovitz]), #ingredient([Eau de Vie]), #ingredient([Vodka]), #ingredient([White Rum]), #ingredient([Tequila]). #ingredient([Whiskey]) tends to get boozy. \ *#ingredient([Gin])s*: #ingredient([Beefeater]), #ingredient([Bombay Sapphire]), #ingredient([Hendrickโ€™s]), #ingredient([Tanqueray No. 10]). - *#ingredient([Gomme Syrup]) โ‡Œ #ingredient([Simple Syrup])*. This is a _generic_ replacement. Same taste, without the silky texture. If you can get your hands on #ingredient([Arabic Gum]), make a syrup a gomme one by stirring in gum when simmering the syrup. - *#ingredient([Irish Cream])*: #ingredient([Baileys]), #ingredient([Coole Swan]), #ingredient([Saint Brendanโ€™s]). - *#ingredient([Lemon Vodka]) โ‡Œ #ingredient([Citroenjenever])*. - *#ingredient([Lillet Blanc]) โ‡Œ #ingredient([Sweet White Vermouth])*, the latter is slightly sweeter and carries notes of citrus. \ Other options: #ingredient([Cocchi Americano]), #ingredient([Sweet White Port]), #ingredient([Sherry Medium]), #ingredient([Amaro Angeleno]). - *#ingredient([Maraschino Liqueur]) โ‡Œ #ingredient([Kirsch])*. \ #ingredient([Cherry Liqueur]), #ingredient([Sweet White Port]) or #ingredient([Sherry Medium]) will do if they have to. - *#ingredient([Orange Liqueur])* โ‡Œ *#ingredient([Orange Bitters])* โ‡Œ *#ingredient([Curaรงao Bitters])*: #ingredient([Triple Sec]), #ingredient([Cointreau]), #ingredient([Grand Marnier]), #ingredient([Orange Curaรงao]), #ingredient([Patron Citrongรฉ]), #ingredient([Parfait d'Amour]) โ€” or simply #ingredient([Orange Zest]), maybe with a dash of #ingredient([Brandy]). - *#ingredient([Passion Fruit Liqueur])*: #ingredient([Passoรฃ]), #ingredient([De Kuyper]). - *#ingredient([Peychaudโ€™s Bitters]) โ‡Œ #ingredient([Angostura])*. - *#ingredient([Rye Whiskey]) โ‡Œ #ingredient([Bourbon])*, slightly drier vs. slightly sweeter and a tad more full-bodied. - *#ingredient([Scotch])* blends: #ingredient([Loch Lomond Signature]), #ingredient([Islay Mist]), #ingredient([Clan Campbell]), #ingredient([Famous Grouse]), #ingredient([Cutty Sark]). - *#ingredient([Cream Sherry]) โ‡Œ #ingredient([Sherry Medium]) โ‡Œ #ingredient([Tawny Port]) โ‡Œ #ingredient([Marsala])*. Ballpark stuff. - *#ingredient([Dry Vermouth]) โ‡Œ #ingredient([Dry White Port]) โ‡Œ #ingredient([Sherry Fino])*. Ballpark stuff. \ *#ingredient([Dry Vermouth])s*: #ingredient([Noilly Prat (Extra) Dry]), #ingredient([Dolin Dry]), #ingredient([Mancini Secco]), #ingredient([Yzaguirre]), #ingredient([Lo Fi]), #ingredient([Tximista Blanco]). - *#ingredient([Sweet Red Vermouth]) โ‡Œ #ingredient([Red Port]) โ‡Œ #ingredient([Ruby Port]) โ‡Œ #ingredient([Sherry Medium]) โ‡Œ #ingredient([Lillet Rouge])*. Ballpark stuff. \ Other options: #ingredient([Averna]), #ingredient([Madeira]), #ingredient([Mรกlaga]), #ingredient([Marsala]). - *#ingredient([Sparkling Water]) โ‡Œ #ingredient([Club Soda]) โ‡Œ #ingredient([Selzer Water]) โ‡Œ #ingredient([Queen Soda]) โ‡Œ #ingredient([San Pellegrino])* โ‡Œ *#ingredient([Perrier])* โ‡Œ *#ingredient([Q])*. - *#ingredient([Sparkling Wine])#indexIn([Bubbles]) โ‡Œ #ingredient([Champagne]) โ‡Œ #ingredient([Crรฉmant de Quelquโ€™part]) โ‡Œ #ingredient([Cava]) โ‡Œ #ingredient([Franciacorta]) โ‡Œ #ingredient([Prosecco])*. \ As long as they're _dry_ (#ingredient([Brut])). Hey, it's about the _fizz_. - *#ingredient([Xeres]) โ‡Œ #ingredient([Sherry Fino])*. - *#ingredient([Vodka])*: #ingredient([Stolichnaya]), #ingredient([Absolut]), #ingredient([Finlandia]), #ingredient([Smirnoff]). #pagebreak() = Index of Ingredients // cat thisfile | egrep -- '^-' | sed -e 's/^[^A-Z]*//' -e 's/ ([^)]*)$//' | egrep -v 'garnish|โ‡Œ|*' | sort | uniq -c| sort -rn #columns(2)[ #make-index(indexes: "Ingredients", use-bang-grouping: true, sort-order: upper) ] #pagebreak() = Index of Cocktails #columns(2)[ #make-index(indexes: "Default", title: none) ]
https://github.com/yonatanmgr/university-notes
https://raw.githubusercontent.com/yonatanmgr/university-notes/main/0366-%5BMath%5D/03661101-%5BCalculus%201A%5D/src/lectures/03661101_lecture_5.typ
typst
#import "/0366-[Math]/globals/template.typ": * #show: project.with( title: "ื—ื“ื•ืดื 1ืืณ - ืฉื™ืขื•ืจ 5", authors: ("<NAME>",), date: "11 ื‘ื™ื ื•ืืจ, 2024", ) #set enum(numbering: "(1.ื)") = ืžืฉืคื˜ื™ื ืฉื™ืžื•ืฉื™ื™ื == ื—ืฉื‘ื•ืŸ ื’ื‘ื•ืœื•ืช === (ืžืฉืคื˜) ื—ืฉื‘ื•ืŸ ื’ื‘ื•ืœื•ืช ืกื•ืคื™ื™ื ื ืชื•ื ื•ืช ืฉืชื™ ืกื“ืจื•ืช $(a_n)$ ื•-$(b_n)$, ื•ื ื ื™ื— $lim a_n =a$ ื•-$lim b_n = b$. ืื–ื™: + $exists lim (a_n + b_n) = lim a_n + lim b_n = a + b$ + $exists lim (a_n dot b_n) = lim a_n dot lim b_n = a dot b$ + $exists lim a_n / b_n = (lim a_n) / (lim b_n) = a / b$ (ื‘ืชื ืื™ ื ื•ืกืฃ: $forall n in NN, b_n != 0$ ื•-$b != 0$). ==== ื”ื•ื›ื—ื” + ื ืชื•ืŸ $forall epsilon>0 exists n'_epsilon in NN : abs(a_n - a) < epsilon/2, forall n > n'_epsilon$ ื•ื ืชื•ืŸ $forall epsilon>0 exists n''_epsilon in NN : abs(b_n - b) < epsilon/2, forall n > n''_epsilon$. ื•ืื– $forall n > n_epsilon = max{n'_epsilon, n''_epsilon}$: $ abs((a_n+b_n) - (a+b)) = abs(a_n-a+b_n-b) <= abs(a_n-a)+abs(b_n-b) < epsilon/2 + epsilon/2 = epsilon $ + ื™ื”ื™ $epsilon > 0$ ืฉืจื™ืจื•ืชื™. ื”ืกื“ืจื” $(a_n)$ ืžืชื›ื ืกืช ื•ืœื›ืŸ ื—ืกื•ืžื”, ื›ืœื•ืžืจ $exists M > 0: abs(a_n) <= M, forall n in NN$. ื•ืื–: $ abs(a_n b_n - a b) = abs(a_n b_n - a_n b + a_b b - a b) <= abs(a_n b_n - a_n b) + abs(a_n b - a b) = \ = abs(a_n) abs(b_n - b) + abs(b) abs(a_n -a) <= M abs(b_n - b) + abs(b) abs(a_n - a), forall n in NN $ ืžืฆื“ ืฉื ื™, ืžื”ื ืชื•ืŸ ื ื•ื‘ืข: $ exists n'_epsilon in NN : abs(a_n-a) < epsilon/(2abs(b)), forall n > n'_epsilon \ exists n''_epsilon in NN : abs(b_n-b) < epsilon/(2 M), forall n > n''_epsilon $ ื•ืื– $forall n > n_epsilon = max{n'_epsilon, n''_epsilon}$, ืž-(1) ื ื•ื‘ืข: $ abs(a_n b_n - a b) < epsilon/2 + epsilon/2 dot frac(abs(b), abs(b)+1) < epsilon $ + ื”ื•ื›ื—ื ื• (2), ื•ืœื›ืŸ ืžืกืคื™ืง ืœื”ื•ื›ื™ื— $lim 1/b_n = 1/b$. ืžื”ื ืชื•ืŸ $b_n -> b!=0$ ื•ืžื›ืš $abs(b_n) -> abs(b) > 0$. ื ืฉืชืžืฉ ื‘ืœืžื” ืžื”ืฉื™ืขื•ืจ ื”ืงื•ื“ื, ื•ื ืกื™ืง ื›ื™ $0<r<abs(b)$, ืขื‘ื•ืจ $r$ ืžืกื•ื™ื. ื ืจืื” ื›ื™ $exists n_0 in NN : abs(b) > r, forall n > n_0$. ื ืฉื™ื ืœื‘ ื›ื™ $forall n > n_0$ ืžืชืงื™ื™ื $abs(1/b_n-1/b) = frac(abs(b-b_n), abs(b_n) abs(b)) < 1/(r abs(b)) abs(b_n - b)$. ื›ืขืช, ื™ื”ื™ $epsilon > 0$ ืฉืจื™ืจื•ืชื™. ืื–: $ exists n'_epsilon in NN : abs(b_n - b) < epsilon r abs(b), forall n < n'_epsilon $ ื•ืื– $forall n > n_epsilon = max {n_0, n'_epsilon}$: $ abs(1/b_n - 1/b)<1/(r abs(b)) abs(b_n - b) < 1/cancel(r abs(b)) dot epsilon cancel(r abs(b)) = epsilon $ #QED #pagebreak() === ื“ื•ื’ืžื” $ liminff(sqrt(n)) (sqrt(n+1) -sqrt(n)) = limitn frac(sqrt(n)(sqrt(n+1) -sqrt(n))(sqrt(n+1) +sqrt(n)), sqrt(n+1)+ sqrt(n)) = \ limitn frac((n+1)-n, sqrt(1+1/n)+1) = limitn 1/(sqrt(1+1/n)+1) = 1/2 $ == ืžื•ื ื•ื˜ื•ื ื™ื•ืช ื”ื’ื‘ื•ืœ === (ืœืžื”) ื ืชื•ื ื” ืกื“ืจื” $(d_n)$ ื›ืืฉืจ $d_n >= 0$ ื•-$d_n->d$. ืื–ื™ $d>=0$. ==== ื”ื•ื›ื—ื” ืžื”ื ืชื•ืŸ ื ื•ื‘ืข $forall epsilon > 0 exists n_epsilon in NN : abs(d_n - d) < epsilon, forall n > n_epsilon$. ื ื ื™ื— ื‘ืฉืœื™ืœื” ืฉ-$d < 0$, ื•ื ื‘ื—ืจ $0 < epsilon < -d$. ืžื›ืš ื ื•ื‘ืข ืฉ-$d+epsilon<0$. ืื– ืขื‘ื•ืจ $epsilon$, $exists n_0 in NN$ ื›ืš ืฉ-$abs(d_n -d) < epsilon, forall n >n_0$ $arrow.double.l$ $d_n -d < epsilon, forall n > n_0$ $arrow.double.l$ $d_n < d+ epsilon, forall n > n_0$ ื•ื–ื• ืกืชื™ืจื” $forall n > n_0, d_n >=0$. #QED ==== ื”ืขืจื” ืžืขื‘ืจ ืœื’ื‘ื•ืœ ืดืœื ืžื›ื‘ื“ืด ืื™-ืฉื™ื•ื•ื™ื•ืŸ ื—ื–ืง, ืœืžืฉืœ $d_n = 1/n > 0 = d_n$ ื‘ื’ื‘ื•ืœ $0 >= 0$. === (ื”ื›ืœืœื” ืฉืœ ื”ืœืžื”) ื ืชื•ื ื•ืช ืฉืชื™ ืกื“ืจื•ืช $(a_n)$ ื•-$(b_n)$, ื•ื ื ื™ื— $lim a_n =a$ ื•-$lim b_n = b$ ื•-$a_n <= b_n$. ืื–ื™ $a<=b$. ==== ื”ื•ื›ื—ื” ื ื’ื“ื™ืจ $d_n = b_n - a_n >=0$. ืœื›ืŸ, $d_n -> b-a$. ืœืคื™ ื”ืœืžื”, $b-a >=0$, ื›ืœื•ืžืจ $a<=b$. #QED ื‘ืคืจื˜, ื”ืžืฉืคื˜ ืื•ืžืจ ืฉืื $c<=a_n<=b$ ื•-$c_n -> a$, ืื– $c<=a<=b$. == ื›ืœืœ ื”ืกื ื“ื•ื•ื™ืฅืณ === (ืžืฉืคื˜) ื›ืœืœ ื”ืกื ื“ื•ื•ื™ืฅืณ ื ืชื•ื ื•ืช ืฉืœื•ืฉ ืกื“ืจื•ืช $(x_n), (y_n), (z_n)$ ื›ืš ืฉ-$(x_n)->L, (y_n)->L$. ื ื ื™ื— ื’ื ืฉ-$ exists n_0 in NN : x_n <= z_n <= y_n, forall n < n_0 $ ืื–ื™ $liminff(z_n)=L$. ==== ื”ื•ื›ื—ื” ื ืชื•ืŸ: $ forall epsilon > 0 exists n'_epsilon in NN: L- epsilon < x_n < L+ epsilon, forall n > n'_epsilon \ exists n''_epsilon in NN : L- epsilon < y_n < L+ epsilon, forall n > n''_epsilon \ exists n_0 in NN : x_n <= z_n <= y_n, forall n > n_0 \ $ ืœื›ืŸ, $forall n > n_epsilon = max{n'_epsilon, n''_epsilon, n_0}$ ืžืชืงื™ื™ื $L- epsilon < x_n <= z_n <= y_n < L+ epsilon$. ื›ืœื•ืžืจ, $ forall epsilon >0 exists n_epsilon in NN: L- epsilon < z_n < L+epsilon, forall n>n_epsilon $ #QED #pagebreak() === ื“ื•ื’ืžืื•ืช + $liminff(sqrt(1+1/n)) = 1$ - ืคืชืจื•ืŸ ื‘ื›ืœืœ ื”ืกื ื“ื•ื•ื™ืฅืณ: $x_n = 1<= z_n = sqrt(1+1/n)<= 1 + 1/n =y_n$ ื•ื›ืœ ื”ืกื“ืจื•ืช ืฉื•ืืคื•ืช ืœ-$1$. + $frac(n, n^2 + 5n +3) = frac(1/n, 1+5/n+3/n^2) = frac(0, 1+0+0)=0$ - ืคืชืจื•ืŸ ื‘ื›ืœืœ ื”ืกื ื“ื•ื•ื™ืฅืณ: $0 <= frac(n, n^2 + 5n +3) <= n/n^2 = 1/n, forall n>=1$ ื•ื›ืœ ื”ืกื“ืจื•ืช ืฉื•ืืคื•ืช ืœ-$.0$ === (ื“ื•ื’ืžื” ืœืฉื™ืžื•ืฉ) ืชื”ื™ $(a_n)$ ืกื“ืจื” ื—ืกื•ืžื”. ืื–ื™ ื”ืกื“ืจื” $a_n/n -> 0$. ==== ื”ื•ื›ื—ื” ืžื”ื ืชื•ืŸ $exists M >0: abs(a_n) <= M, forall n in NN$. ื›ืœื•ืžืจ $-M <= a_n <= M, forall n in NN$ ื•ืœื›ืŸ $-M/n <= a_n/n <= M/n forall n in NN$ ื•ื›ืœ ื”ืกื“ืจื•ืช ืฉื•ืืคื•ืช ืœ-0 ืœืคื™ ื›ืœืœ ื”ืกื ื“ื•ื•ื™ืฅืณ. === (ื˜ืขื ื”) ืชื”ื™ ืงื‘ื•ืฆื” $B != emptyset$ ื—ืกื•ืžื” ืžืœืžืขืœื”. ืื– $exists (x_n) seq B$ ื›ืš ืฉ-$lim x_n = sup B$. ==== ื”ื•ื›ื—ื” ืžืชืงื™ื™ื $forall epsilon >0 exists x_epsilon in B: sup B - epsilon <= x_epsilon <= sup B$. ื ื‘ื—ืจ $epsilon = 1/n >0$, ื›ืœื•ืžืจ $exists x_n in B$ ื›ืš ืฉ-$forall n>=1, sup B - 1/n <= x_n <= sup B$ ื•ื›ืœ ื”ืกื“ืจื•ืช ืฉื•ืืคื•ืช ืœ-$sup B$. ==== ื”ืขืจื” ืื ืงื‘ื•ืฆื” $B != emptyset$ ื—ืกื•ืžื” ืžืœืžื˜ื”, ืื– $exists x_n in B$ ืœื›ืœ $n in NN$ ื›ืš ืฉ-$liminff(x_n) = inf B$. == ื ื•ืกื—ืช ืกื˜ื™ืจืœื™ื ื’ === ื”ื’ื“ืจื” ื”ื ื•ืกื—ื”: $n! tilde.eq frac(n^n, e^n) sqrt(2 pi n)$. ื›ืœื•ืžืจ $limitn frac(n!, n^n/e^n sqrt(2 pi n)) =1$.
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/notebook-matrix.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Typst Showcase: Decision Matrix", type: "notebook", date: datetime(year: 2023, month: 7, day: 28), author: "<NAME>", witness: "V<NAME>", ) During the decide step of the engineering design process we often use a tool called a decision matrix. In order to make this process easier we wrote this Typst function: ```typ #let nb_decision_matrix(properties: (), choices: ()) = { for choice in choices { if not (choice.len() - 1) == properties.len() { panic("a choice did not have the right amount of properties") } } let totaled_choices = choices.map( choice => { let total = 0 for element in choice { if type(element) == "integer" or type(element) == "float" { total += element } } choice + (total,) }, ) let highest = (index: 0, value: 0) for (index, choice) in totaled_choices.enumerate() { if choice.at(choice.len() - 1) > highest.value { highest.index = index + 1 highest.value = choice.at(choice.len() - 1) } [ #choice #choice.at(choice.len() - 1) #highest.value \ ] } table( columns: properties.len() + 2, // 1 column for the names, one for the total fill: (_, row) => if row == highest.index { green }, [], // Blank column to account for names of choices ..for property in properties { ([ #property ],) }, [Total], ..for element in totaled_choices.flatten() { ([ #element ],) }, ) } ``` #colbreak() This code automatically calculates the total for each choice that we are comparing, and also finds the highest total. It then finds the row with the highest total, and then highlights that row green. Here's an example of this function in use: This code: ```typ #nb_decision_matrix(properties: ("Crunchiness", "Versatility", "Flavour"), choices: ( ("Sweet Potato", 1, 2, 5), ("Red Potato", 2, 3, 2), ("White Potato", 4, 5, 2), )) ``` Renders this table: #decision-matrix( properties: ((name: "Crunchiness"), (name: "Versatility"), (name: "Flavour")), ("Sweet Potato", 1, 2, 5), ("Red Potato", 2, 3, 2), ("White Potato", 4, 5, 2), )
https://github.com/chendaohan/bevy_tutorials_typ
https://raw.githubusercontent.com/chendaohan/bevy_tutorials_typ/main/00_introduction/thumbnail.typ
typst
#set page(fill: rgb(35, 35, 38, 255), paper: "a3") #set text(fill: color.hsv(0deg, 0%, 90%, 100%), size: 22pt, font: "Microsoft YaHei") \ \ #grid( columns: (2.5fr, 1fr), image("images/bevy_logo_dark.svg"), text(size: 70pt, "0.14", weight: "bold"), ) #block( width: 100%, align(center, text(size: 80pt, weight: "bold", "00. ๆฆ‚่ฟฐ")), )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-ABC0.typ
typst
Apache License 2.0
#let data = ( ("MEETEI MAYEK LETTER KOK", "Lo", 0), ("MEETEI MAYEK LETTER SAM", "Lo", 0), ("MEETEI MAYEK LETTER LAI", "Lo", 0), ("MEETEI MAYEK LETTER MIT", "Lo", 0), ("MEETEI MAYEK LETTER PA", "Lo", 0), ("MEETEI MAYEK LETTER NA", "Lo", 0), ("MEETEI MAYEK LETTER CHIL", "Lo", 0), ("MEETEI MAYEK LETTER TIL", "Lo", 0), ("MEETEI MAYEK LETTER KHOU", "Lo", 0), ("MEETEI MAYEK LETTER NGOU", "Lo", 0), ("MEETEI MAYEK LETTER THOU", "Lo", 0), ("MEETEI MAYEK LETTER WAI", "Lo", 0), ("MEETEI MAYEK LETTER YANG", "Lo", 0), ("MEETEI MAYEK LETTER HUK", "Lo", 0), ("MEETEI MAYEK LETTER UN", "Lo", 0), ("MEETEI MAYEK LETTER I", "Lo", 0), ("MEETEI MAYEK LETTER PHAM", "Lo", 0), ("MEETEI MAYEK LETTER ATIYA", "Lo", 0), ("MEETEI MAYEK LETTER GOK", "Lo", 0), ("MEETEI MAYEK LETTER JHAM", "Lo", 0), ("MEETEI MAYEK LETTER RAI", "Lo", 0), ("MEETEI MAYEK LETTER BA", "Lo", 0), ("MEETEI MAYEK LETTER JIL", "Lo", 0), ("MEETEI MAYEK LETTER DIL", "Lo", 0), ("MEETEI MAYEK LETTER GHOU", "Lo", 0), ("MEETEI MAYEK LETTER DHOU", "Lo", 0), ("MEETEI MAYEK LETTER BHAM", "Lo", 0), ("MEETEI MAYEK LETTER KOK LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER LAI LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER MIT LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER PA LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER NA LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER TIL LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER NGOU LONSUM", "Lo", 0), ("MEETEI MAYEK LETTER I LONSUM", "Lo", 0), ("MEETEI MAYEK VOWEL SIGN ONAP", "Mc", 0), ("MEETEI MAYEK VOWEL SIGN INAP", "Mc", 0), ("MEETEI MAYEK VOWEL SIGN ANAP", "Mn", 0), ("MEETEI MAYEK VOWEL SIGN YENAP", "Mc", 0), ("MEETEI MAYEK VOWEL SIGN SOUNAP", "Mc", 0), ("MEETEI MAYEK VOWEL SIGN UNAP", "Mn", 0), ("MEETEI MAYEK VOWEL SIGN CHEINAP", "Mc", 0), ("MEETEI MAYEK VOWEL SIGN NUNG", "Mc", 0), ("MEETEI MAYEK CHEIKHEI", "Po", 0), ("MEETEI MAYEK LUM IYEK", "Mc", 0), ("MEETEI MAYEK APUN IYEK", "Mn", 9), (), (), ("MEETEI MAYEK DIGIT ZERO", "Nd", 0), ("MEETEI MAYEK DIGIT ONE", "Nd", 0), ("MEETEI MAYEK DIGIT TWO", "Nd", 0), ("MEETEI MAYEK DIGIT THREE", "Nd", 0), ("MEETEI MAYEK DIGIT FOUR", "Nd", 0), ("MEETEI MAYEK DIGIT FIVE", "Nd", 0), ("MEETEI MAYEK DIGIT SIX", "Nd", 0), ("MEETEI MAYEK DIGIT SEVEN", "Nd", 0), ("MEETEI MAYEK DIGIT EIGHT", "Nd", 0), ("MEETEI MAYEK DIGIT NINE", "Nd", 0), )
https://github.com/SergeyGorchakov/russian-phd-thesis-template-typst
https://raw.githubusercontent.com/SergeyGorchakov/russian-phd-thesis-template-typst/main/parts/part3.typ
typst
MIT License
#import "../lib.typ": * #part_count.step() // ะžะฑะฝะพะฒะปะตะฝะธะต ัั‡ะตั‚ั‡ะธะบะฐ ั€ะฐะทะดะตะปะพะฒ #show: fix-indent() = ะ’ั‘ั€ัั‚ะบะฐ ั‚ะฐะฑะปะธั† <ch3> == ะขะฐะฑะปะธั†ะฐ ะพะฑั‹ะบะฝะพะฒะตะฝะฝะฐั <ch3:sect1> ะขะฐะบ ะผะพะถะฝะพ ะฒัั‚ะฐะฒะธั‚ัŒ ั‚ะฐะฑะปะธั†ัƒ: #figure( table( columns: (auto,auto, auto), inset: 10pt, align: horizon, table.header( [*ะคะธะณัƒั€ะฐ*],[*ะŸะปะพั‰ะฐะดัŒ*],[*ะŸะฐั€ะฐะผะตั‚ั€*], ), [ะฆะธะปะธะฝะดั€], $pi h (D^2 - d^2) / 4$, [ $h$: ะฒั‹ัะพั‚ะฐ \ $D$: ะฒะฝะตัˆะฝะธะน ั€ะฐะดะธัƒั \ $d$: ะฒะฝัƒั‚ั€ะตะฝะฝะธะน ั€ะฐะดะธัƒั \ ], [ะŸะธั€ะฐะผะธะดะฐ], $sqrt(2) / 12 a^3$, [$a$: ะดะปะธะฝะฐ ั€ะตะฑั€ะฐ ะพัะฝะพะฒะฐะฝะธั] ), caption: [ะŸะปะพั‰ะฐะดะธ ะพัะฝะพะฒะฐะฝะธั ั„ะธะณัƒั€] ) <t1> ะะฐ ะฒัะต ั‚ะฐะฑะปะธั†ั‹ ะฒ ั‚ะตะบัั‚ะต ะดะธััะตั€ั‚ะฐั†ะธะธ ะฝะตะพะฑั…ะพะดะธะผะพ ะฟั€ะธะฒะพะดะธั‚ัŒ ััั‹ะปะบะธ: ะฒ ั‚ะฐะฑะปะธั†ะต @t1. ะŸะพะดั€ะพะฑะฝะตะต ะพ ั‚ะฐะฑะปะธั†ะฐั… ะทะดะตััŒ: https://typst.app/docs/reference/model/table/. == ะŸั€ะพะฒะตั€ะบะฐ ะฝัƒะผะตั€ะฐั†ะธะธ ัƒั€ะฐะฒะฝะตะฝะธะน ะฟะพ ั€ะฐะทะดะตะปะฐะผ ะฃั€ะฐะฒะฝะตะฝะธะต ะฒ ั‚ั€ะตั‚ัŒะตะผ ั€ะฐะทะดะตะปะต. $ z^2 = x^2 + y^2 $
https://github.com/Misterio77/typst-nix
https://raw.githubusercontent.com/Misterio77/typst-nix/main/README.md
markdown
# Typst Nix A dead-simple function to build your typst packages, including those that require [typst packages](https://typst.app/universe). ## Usage This repo contains a `mkTypstDerivation` function. It's a simple `mkDerivation` wrapper, with a `buildPhase` that calls `typst compile`: ```nix mkTypstDerivation { name = "paper-im-procrastinating-on"; # Directory containing the typst project src = ./.; # Main file name mainFile = "main.typ"; } ``` Besides the usual `mkDerivation` arguments, it also takes (all of them optional): - `mainFile`: the main typst file name (relative to `src`). Defaults to `main.typ`. - `outFormat`: the chosen output format. At the time of writing, typst supports `pdf`, `svg`, and `png`. Default to `pdf`. - `outputFile`: file name to output. Defaults to `mainFile` with `.typ` replaced by `.${outFormat}` (i.e. `main.pdf`). - `typstPackages`: an attribute set of package repositories. Defaults to `{ preview = "${typst-packages}/packages/preview"; }` - `extraFonts`: extra fonts typst should have access to. - `extraCompileFlags`: extra arguments to pass to typst compile. - `typst`: typst package used to compile, in case you want to use a different one. The function's available at `default.nix` and also exposed via flake `lib` and `overlays.default` outputs. ### As a flake input Minimal example: ```nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; typst-nix.url = "github:misterio77/typst-nix"; typst-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { nixpkgs, typst-nix, ... }: { packages.x86_64-linux = { default = typst-nix.lib.x86_64-linux.mkTypstDerivation { name = "ending-world-hunger-with-nix"; src = ./.; }; }); }; } ``` Do check [example/flake.nix](example/flake.nix) for a slightly better example. Also available as a nix flake template: ```bash nix flake init -t github:misterio77/typst-nix ``` ### With a fetcher ``` nix let mkTypstDerivation = import (fetchTarball "https://github.com/misterio77/typst-nix") {}; in mkTypstDerivation { name = "destroying-capitalism-with-nix"; src = ./.; } ``` ## About typst-packages rev Do note that by, default, you'll use this repo's locked typst-packages version. If that bothers you (maybe I forgor to update the lock idk), either: - Use flake inputs follows (see [example/flake.nix](example/flake.nix)); or - Set `mkTypstDerivation`'s `typstPackages.preview` argument (e.g. to a `fetchTarball` call), like so: ``` mkTypstDerivation { name = "hi-there"; src = ./.; typstPackages = { preview = "${fetchTarball "https://github.com/typst/packages"}/packages/preview"; }; } ```
https://github.com/mem-courses/calculus
https://raw.githubusercontent.com/mem-courses/calculus/main/template.typ
typst
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx, hlinex, vlinex, cellx #let font_song = ("New Computer Modern", "Source Han Serif SC", "Simsun", "STSong") #let font_fangsong = ("FangSong", "STFangSong") #let font_hei = ("Source Han Sans SC", "Source Han Sans HW SC", "SimHei", "Microsoft YaHei", "STHeiti") #let font_kai = ("KaiTi_GB2312", "KaiTi", "STKaiti") #let definition_counter = state("definition_counter", 0) #let theorem_counter = state("theorem_counter", 0) #let problem_counter = state("problem_counter", 0) #let indent = 2em #let fake_par = [#text()[#v(0pt, weak: true)];#text()[#h(0em)]] #let project( course: "", title: "", authors: (), date: none, body, course_fullname: "", semester: "", course_code: "", ) = { if (course_fullname == "") { course_fullname = course } if (course_code != "") { course_fullname = course_fullname + " (" + course_code + ")" } // ๆ–‡ๆกฃๅŸบๆœฌไฟกๆฏ set document(author: authors.map(a => a.name), title: title) set page( paper: "a4", margin: (left: 12mm, right: 12mm, top: 20mm, bottom: 20mm), numbering: "1", number-align: center, ) // ้กต็œ‰ set page(header: { locate(loc => { if (counter(page).at(loc).at(0) == 1) { return none } set text(font: font_song, 10pt, baseline: 8pt, spacing: 3pt) grid( columns: (1fr, 1fr, 1fr), align(left, course), []/* align(center, title)*/, align(right, date), ) line(length: 100%, stroke: 0.5pt) }) }) // ้กต่„š set page(footer: { set text(font: font_song, 10pt, baseline: 8pt, spacing: 3pt) set align(center) grid( columns: (1fr, 1fr), align(left, authors.map(a => a.name).join(", ")), align(right, counter(page).display("1/1", both: true)), ) }) set text(font: font_song, lang: "zh", size: 12pt) show math.equation: set text(weight: 400) // Set paragraph spacing. show par: set block(above: 1.05em, below: 1.05em) set heading(numbering: "1.1.") set par(leading: 0.75em) block( below: 4em, stroke: 0.5pt + black, radius: 2pt, width: 100%, inset: 1em, outset: -0.2em, )[ #text(size: 0.84em)[#grid( columns: (auto, 1fr, auto), align(left, strong(course_fullname)), [], align(right, strong(semester)), )] #v(0.75em) #align(center)[#text(size: 1.5em)[#title]] #v(0.75em) #block( ..authors.map(author => align(center)[ #text(size: 0.84em)[#grid( columns: (auto, 1fr, auto), align(left, author.name + " (" + author.id + ")"), [], align(right, author.email), )] ]), ) ] // Main body. set par(justify: true) show "ใ€‚": "๏ผŽ" show heading.where(level: 1): it => [ #definition_counter.update(x => 0) #theorem_counter.update(x => 0) #set text(size: 1.2em) #it #v(0.15em) ] show heading.where(level: 2): it => [ #theorem_counter.update(x => 0) #it ] set par(first-line-indent: indent) show heading: it => { text()[#v(1.6em, weak: true)] it fake_par } /* { slot: before-body } */ body } #let song(it) = text(it, font: font_song) #let fangsong(it) = text(it, font: font_fangsong) #let hei(it) = text(it, font: font_hei) #let kai(it) = text(it, font: font_kai) #let bb = it => [#strong[#it]] #let def = it => [#strong[#it]] #let definition(it, name: "") = { block(width: 100%)[ #definition_counter.update(x => (x + 1)) #strong[ #hei[ๅฎšไน‰]#locate(loc => [#counter(heading).at(loc).at(0)]).#definition_counter.display() ] #if (name != "") [(#kai[#name])] #math.space.thin#it ] fake_par } #let theorem(it, name: "", tag: "ๅฎš็†") = { block(width: 100%)[ #theorem_counter.update(x => (x + 1)) #strong[ #hei[#tag]#locate(loc => [#counter(heading).at(loc).at(0).#counter(heading).at(loc).at(1)]).#theorem_counter.display() ] #if (name != "") [(#kai[#name])] #math.space.thin#it ] fake_par } #let lemma(it, name: "") = theorem(it, name: name, tag: "ๅผ•็†") #let corollary(it, name: "") = theorem(it, name: name, tag: "ๆŽจ่ฎบ") #let property(it, name: "") = theorem(it, name: name, tag: "ๆ€ง่ดจ") #let conclusion(it, name: "") = theorem(it, name: name, tag: "็ป“่ฎบ") #let problem(it, name: "") = { block(width: 100%)[ #problem_counter.update(x => (x + 1)) #strong[ #hei[ไพ‹]#problem_counter.display() ] #if (name != "") [(#kai[#name])] #math.space.thin#it ] fake_par } #let solution(it, tag: "่งฃ") = { block(width: 100%)[ #strong[#hei[#tag:]] #math.space.thin#it ] fake_par } #let named_block(it, name: "", color: red, inset: 11pt) = { block( below: 1em, stroke: 0.5pt + color, radius: 3pt, width: 100%, inset: inset, )[ #place( top + left, dy: -6pt - inset, // Account for inset of block dx: 8pt - inset, block(fill: white, inset: 2pt)[ #set text(font: "Noto Sans", fill: color) #strong[#name] ] ) #let fontcolor = color.darken(0%) #set text(fill: fontcolor) #set par(first-line-indent: 0em) #it ] fake_par } #let example(it) = named_block(it, name: "Example", color: gray.darken(60%)) #let proof(it) = named_block(it, name: "Proof", color: rgb(120, 120, 120)) #let abstract(it) = named_block(it, name: "Abstract", color: rgb(0, 133, 143)) #let summary(it) = named_block(it, name: "Summary", color: rgb(0, 133, 143)) #let info(it) = named_block(it, name: "Info", color: rgb(68, 115, 218)) #let note(it) = named_block(it, name: "Note", color: rgb(68, 115, 218)) #let tip(it) = named_block(it, name: "Tip", color: rgb(0, 133, 91)) #let hint(it) = named_block(it, name: "Hint", color: rgb(0, 133, 91)) #let success(it) = named_block(it, name: "Success", color: rgb(62, 138, 0)) #let important(it) = named_block(it, name: "Important", color: rgb(62, 138, 0)) #let help(it) = named_block(it, name: "Help", color: rgb(153, 110, 36)) #let warning(it) = named_block(it, name: "Warning", color: rgb(184, 95, 0)) #let attention(it) = named_block(it, name: "Attention", color: rgb(216, 58, 49)) #let caution(it) = named_block(it, name: "Caution", color: rgb(216, 58, 49)) #let failure(it) = named_block(it, name: "Failure", color: rgb(216, 58, 49)) #let danger(it) = named_block(it, name: "Danger", color: rgb(216, 58, 49)) #let error(it) = named_block(it, name: "Error", color: rgb(216, 58, 49)) #let bug(it) = named_block(it, name: "Bug", color: rgb(204, 51, 153)) #let quote(it) = named_block(it, name: "Quote", color: rgb(132, 90, 231)) #let cite(it) = named_block(it, name: "Cite", color: rgb(132, 90, 231)) #let correction(it) = named_block(it, name: "Correction", color: rgb(216, 58, 49)) #let table3-global-align = align #let table3( ..args, inset: 0.5em, stroke: 0.5pt, width: 100%, align: center + horizon, columns: 1, ) = { set table3-global-align(center) if type(columns) == int { let new_columns = () for i in range(columns) { new_columns.push(1fr) } columns = new_columns } box( width: width, clip: true, stack( tablex( ..args, inset: inset, stroke: stroke, align: align, columns: columns, map-hlines: h => { if (h.y == 0) { (..h, stroke: (stroke * 2) + black) } else if (h.y == 1) { (..h, stroke: stroke + black) } else { (..h, stroke: 0pt) } }, auto-vlines: false, ), line(stroke: (stroke * 2) + black, length: 100%), ), ) } #import "./functions.typ": *
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/problems/p0008.typ
typst
#import "../helpers.typ": * #import "../solutions/s0008.typ": * = String to Integer (atoi) Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function). The algorithm for `myAtoi(string s)` is as follows: + Read in and ignore any leading whitespace. + Check if the next character (if not already at the end of the string) is '-' or '+'. Read this character in if it is either. This determines if the final result is negative or positive respectively. Assume the result is positive if neither is present. + Read in next the characters until the next non-digit character or the end of the input is reached. The rest of the string is ignored. + Convert these digits into an integer (i.e. "123" -> 123, "0032" -> 32). If no digits were read, then the integer is 0. Change the sign as necessary (from step 2). + If the integer is out of the 32-bit signed integer range $[-2^31, 2^31 - 1]$, then clamp the integer so that it remains in the range. Specifically, integers less than $-2^31$ should be clamped to $-2^31$, and integers greater than $2^31 - 1$ should be clamped to $2^31 - 1$. + Return the integer as the final result. *Note:* - Only the space character ' ' is considered a whitespace character. - *Do not ignore* any characters other than the leading whitespace or the rest of the string after the digits. #let string-to-integer(s) = { // Solve the problem here } #testcases( string-to-integer, string-to-integer-ref, ( (s: "42"), (s: " -42"), (s: "4193 with words") ) )
https://github.com/FurryAcetylCoA/sgu-thesis-typst
https://raw.githubusercontent.com/FurryAcetylCoA/sgu-thesis-typst/main/README.md
markdown
MIT License
# ้Ÿถๅ…ณๅญฆ้™ขๅญฆไฝ่ฎบๆ–‡ๆจกๆฟ sgu-thesis-typst ้Ÿถๅ…ณๅญฆ้™ขๅญฆไฝ่ฎบๆ–‡ ๏ผˆ่ฎพ่ฎก๏ผ‰็š„ Typst ๆจกๆฟ๏ผŒ่ƒฝๅคŸ็ฎ€ๆดใ€ๅฟซ้€Ÿใ€ๆŒ็ปญ็”Ÿๆˆ PDF ๆ ผๅผ็š„ๆฏ•ไธš่ฎบๆ–‡ใ€‚ ๆบ่‡ช[ๅ—ไบฌๅคงๅญฆๅญฆไฝ่ฎบๆ–‡](https://github.com/nju-lug/nju-thesis-typst). ๅฟซ้€Ÿๆต่งˆๆ•ˆๆžœ: ๆŸฅ็œ‹ [thesis.pdf](https://github.com/FurryAcetylCoA/sgu-thesis-typst/blob/main/thesis.pdf)๏ผŒๆ ทไพ‹่ฎบๆ–‡ๆบ็ ๏ผšๆŸฅ็œ‹ [thesis.typ](https://github.com/FurryAcetylCoA/sgu-thesis-typst/blob/main/thesis.typ) ่ฏฆ็ป†่ฏดๆ˜Ž่ฏท่งๅŽŸๅง‹้กน็›ฎ ![](images/editor.png) ## ๅ…ณไบŽTypst ๅฏไปฅ้˜…่ฏปๅŽŸไฝœ่€…็š„ [ไธ€็ฏ‡็ŸฅไนŽๆ–‡็ซ ](https://zhuanlan.zhihu.com/p/669097092) ่ฟ›ไธ€ๆญฅไบ†่งฃ Typstใ€‚ ๅฏไปฅๅ‚่€ƒ [Typst ไธญๆ–‡ๆ–‡ๆกฃ็ฝ‘็ซ™](https://typst-doc-cn.github.io/docs/) ่ฟ…้€Ÿๅ…ฅ้—จใ€‚ ## ไฝฟ็”จ ### ๆœฌๅœฐ็ผ–่พ‘ 1. ๅ…‹้š†ๆœฌ้กน็›ฎ๏ผŒๆˆ–่€…็›ดๆŽฅ้€š่ฟ‡็ปฟ่‰ฒ็š„CodeๆŒ‰้’ฎ-> Download zipไธ‹่ฝฝ็„ถๅŽ่งฃๅŽ‹ใ€‚ 2. ๅœจ [VS Code](https://code.visualstudio.com/) ไธญๆ‰“ๅผ€่ฏฅ็›ฎๅฝ•ใ€‚ 3. ๅœจ VS Code ไธญๅฎ‰่ฃ… [Typst LSP](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) ๅ’Œ [Typst Preview](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview) ๆ’ไปถใ€‚ๅ‰่€…่ดŸ่ดฃ่ฏญๆณ•้ซ˜ไบฎๅ’Œ้”™่ฏฏๆฃ€ๆŸฅ๏ผŒๅŽ่€…่ดŸ่ดฃ้ข„่งˆใ€‚ - ไนŸๆŽจ่ไธ‹่ฝฝ [Typst Companion](https://marketplace.visualstudio.com/items?itemName=CalebFiggers.typst-companion) ๆ’ไปถ๏ผŒๅ…ถๆไพ›ไบ†ไพ‹ๅฆ‚ `Ctrl + B` ่ฟ›่กŒๅŠ ็ฒ—็ญ‰ไพฟๆท็š„ๅฟซๆท้”ฎใ€‚ - ไฝ ่ฟ˜ๅฏไปฅไธ‹่ฝฝ [Typst Sync](https://marketplace.visualstudio.com/items?itemName=OrangeX4.vscode-typst-sync) ๅ’Œ [Typst Sympy Calculator](https://marketplace.visualstudio.com/items?itemName=OrangeX4.vscode-typst-sympy-calculator) ๆ’ไปถ๏ผŒๅ‰่€…ๆไพ›ไบ†ๆœฌๅœฐๅŒ…็š„ไบ‘ๅŒๆญฅๅŠŸ่ƒฝ๏ผŒๅŽ่€…ๆไพ›ไบ†ๅŸบไบŽ Typst ่ฏญๆณ•็š„็ง‘ๅญฆ่ฎก็ฎ—ๅ™จๅŠŸ่ƒฝใ€‚ 4. ๅœจ VS Code ไธญๆ‰“ๅผ€ `thesis.typ` 5. ๆŒ‰ไธ‹ `Shift + Ctrl + P`๏ผŒ็„ถๅŽ่พ“ๅ…ฅๅ‘ฝไปค `Typst Preview: Preview current file`๏ผŒๅณๅฏๅœจไพงๆ  **ๅŒๆญฅๆธฒๆŸ“่ฎบๆ–‡่พ“ๅ‡บ**๏ผŒ่ฟ˜ๆไพ›ไบ† **ๅ…‰ๆ ‡ๅŒๅ‘ๅฎšไฝๅŠŸ่ƒฝ**ใ€‚ **ไฝ ๅช้œ€่ฆไฟฎๆ”นๆ น็›ฎๅฝ•ไธ‹็š„ `thesis.typ` ๆ–‡ไปถๅณๅฏ๏ผŒๅŸบๆœฌๅฏไปฅๆปก่ถณไฝ ็š„ๆ‰€ๆœ‰้œ€ๆฑ‚๏ผŒ`nju-thesis` ็›ฎๅฝ•ไธ‹็š„ไปฃ็ ๅฏไปฅ็”จไบŽๅ‚ๆ•ฐๆŸฅ้˜…๏ผŒไฝ†ๆ˜ฏ็†่ฎบไธŠไฝ ไธๅบ”่ฏฅๅฏนๅ…ถ่ฟ›่กŒๆ›ดๆ”นใ€‚** Forkไฝœ่€…ๆณจ๏ผšๆˆ‘ๅทฒ็ปๆŒ‰็…ง`้Ÿถๅ…ณๅญฆ้™ขๆฏ•ไธš่ฎบๆ–‡๏ผˆ่ฎพ่ฎก๏ผ‰ๅŸบๆœฌ่ง„่Œƒ`ไฟฎๆ”น่ฟ‡้‡Œ้ข็š„ไธœ่ฅฟไบ† ๅฆ‚ๆžœไฝ ่ฎคไธบไธ่ƒฝๆปก่ถณไฝ ็š„้œ€ๆฑ‚๏ผŒๅฏไปฅๅ…ˆๆŸฅ้˜…ๅŽ้ข็š„ [Q&A](#Q%26A) ้ƒจๅˆ†ใ€‚ ## Q&A ### ๆˆ‘ไธไผš LaTeX๏ผŒๅฏไปฅ็”จ่ฟ™ไธชๆจกๆฟๅ†™่ฎบๆ–‡ๅ—๏ผŸ ๅฏไปฅใ€‚ ๅฆ‚ๆžœไฝ ไธๅ…ณๆณจๆจกๆฟ็š„ๅ…ทไฝ“ๅฎž็ŽฐๅŽŸ็†๏ผŒไฝ ๅฏไปฅ็”จ Markdown Like ็š„่ฏญๆณ•่ฟ›่กŒ็ผ–ๅ†™๏ผŒๅช้œ€่ฆๆŒ‰็…งๆจกๆฟ็š„็ป“ๆž„็ผ–ๅ†™ๅณๅฏใ€‚ ### ๆˆ‘ไธไผš็ผ–็จ‹๏ผŒๅฏไปฅ็”จ่ฟ™ไธชๆจกๆฟๅ†™่ฎบๆ–‡ๅ—๏ผŸ ๅŒๆ ทๅฏไปฅใ€‚ ๅช้œ€ๆ‰“ๅผ€`thesis.typ`๏ผŒ็ฟปๅˆฐไธญ้—ด๏ผŒ็…ง่‘ซ่Šฆ็”ป็“ขๅณๅฏ ### ไธบไป€ไนˆๆˆ‘็š„ๅญ—ไฝ“ๆฒกๆœ‰ๆ˜พ็คบๅ‡บๆฅ๏ผŒ่€Œๆ˜ฏไธ€ไธชไธชใ€Œ่ฑ†่…ๅ—ใ€๏ผŸ ่ฟ™ๆ˜ฏๅ› ไธบๆœฌๅœฐๆฒกๆœ‰ๅฏนๅบ”็š„ๅญ—ไฝ“๏ผŒ**่ฟ™็งๆƒ…ๅ†ต็ปๅธธๅ‘็”Ÿๅœจ MacOS ็š„ใ€Œๆฅทไฝ“ใ€ๆ˜พ็คบไธŠ**ใ€‚ ไฝ ๅบ”่ฏฅๅฎ‰่ฃ…ๆœฌ็›ฎๅฝ•ไธ‹็š„ `fonts` ้‡Œ็š„ๆ‰€ๆœ‰ๅญ—ไฝ“๏ผŒ้‡Œ้ขๅŒ…ๅซไบ†ๅฏไปฅๅ…่ดนๅ•†็”จ็š„ใ€Œๆ–นๆญฃๆฅทไฝ“ใ€ๅ’Œใ€Œๆ–นๆญฃไปฟๅฎ‹ใ€๏ผŒ็„ถๅŽๅ†้‡ๆ–ฐๆธฒๆŸ“ๆต‹่ฏ•ๅณๅฏใ€‚ ไฝ ๅฏไปฅไฝฟ็”จ `#fonts-display-page()` ๆ˜พ็คบไธ€ไธชๅญ—ไฝ“ๆธฒๆŸ“ๆต‹่ฏ•้กต้ข๏ผŒๆŸฅ็œ‹ๅฏนๅบ”็š„ๅญ—ไฝ“ๆ˜ฏๅฆๆ˜พ็คบๆˆๅŠŸใ€‚ ๅฆ‚ๆžœ่ฟ˜ๆ˜ฏไธ่ƒฝๆˆๅŠŸ๏ผŒไฝ ๅฏไปฅๆŒ‰็…งๆจกๆฟ้‡Œ็š„่ฏดๆ˜Ž่‡ช่กŒ้…็ฝฎๅญ—ไฝ“๏ผŒไพ‹ๅฆ‚ ```typst #let (...) = documentclass( fonts: (ๆฅทไฝ“: ("Times New Roman", "FZKai-Z03S")), ) ``` ๅ…ˆๆ˜ฏๅกซๅ†™่‹ฑๆ–‡ๅญ—ไฝ“๏ผŒ็„ถๅŽๅ†ๅกซๅ†™ไฝ ้œ€่ฆ็š„ใ€Œๆฅทไฝ“ใ€ไธญๆ–‡ๅญ—ไฝ“ใ€‚ **ๅญ—ไฝ“ๅ็งฐๅฏไปฅ้€š่ฟ‡ `typst fonts` ๅ‘ฝไปคๆŸฅ่ฏขใ€‚** ๅฆ‚ๆžœๆ‰พไธๅˆฐไฝ ๆ‰€้œ€่ฆ็š„ๅญ—ไฝ“๏ผŒๅฏ่ƒฝๆ˜ฏๅ› ไธบ **่ฏฅๅญ—ไฝ“ๅ˜ไฝ“๏ผˆVariants๏ผ‰ๆ•ฐ้‡่ฟ‡ๅฐ‘**๏ผŒๅฏผ่‡ด Typst ๆ— ๆณ•่ฏ†ๅˆซๅˆฐ่ฏฅไธญๆ–‡ๅญ—ไฝ“ใ€‚ ### ไธบไป€ไนˆๆฅทไฝ“ๆ— ๆณ•ๅŠ ็ฒ—๏ผŸ ๅ› ไธบไธ€่ˆฌ้ป˜่ฎคๅฎ‰่ฃ…็š„ใ€Œๆฅทไฝ“ใ€ๅชๆœ‰ๆ ‡ๅ‡†ๅญ—้‡็š„ๅญ—ไฝ“๏ผŒๆฒกๆœ‰ๅŠ ็ฒ—็‰ˆๆœฌ็š„ๅญ—ไฝ“๏ผˆๅŽๆ–‡็ฒ—ๆฅท็ญ‰ๅญ—ไฝ“ๅนถไธๆ˜ฏๅ…่ดนๅ•†็”จ็š„๏ผ‰๏ผŒ่€Œ Typst ๅˆๆฒกๆœ‰ๅฎž็Žฐไผช็ฒ—ไฝ“๏ผˆFake Bold๏ผ‰็ฎ—ๆณ•๏ผŒๆ‰€ไปฅๅฏผ่‡ดๆ— ๆณ•ๆญฃๅธธๅŠ ็ฒ—ใ€‚ ็›ฎๅ‰่ฟ˜ๆฒกๆ‰พๅˆฐไธ€ไธชๆฏ”่พƒๅฅฝ็š„่งฃๅ†ณๆ–นๆณ•ใ€‚ ### ๅญฆไน  Typst ้œ€่ฆๅคšไน…๏ผŸ ไธ€่ˆฌ่€Œ่จ€๏ผŒไป…ไป…่ฟ›่กŒ็ฎ€ๅ•็š„็ผ–ๅ†™๏ผŒไธๅ…ณๆณจๅธƒๅฑ€็š„่ฏ๏ผŒไฝ ๅฏไปฅๆ‰“ๅผ€ๆจกๆฟๅฐฑๅผ€ๅง‹ๅ†™ไบ†ใ€‚ ๅฆ‚ๆžœไฝ ๆƒณ่ฟ›ไธ€ๆญฅๅญฆไน  Typst ็š„่ฏญๆณ•๏ผŒไพ‹ๅฆ‚ๅฆ‚ไฝ•ๆŽ’็ฏ‡ๅธƒๅฑ€๏ผŒๅฆ‚ไฝ•่ฎพ็ฝฎ้กต่„š้กต็œ‰็ญ‰๏ผŒไธ€่ˆฌๅช้œ€่ฆๅ‡ ไธชๅฐๆ—ถๅฐฑ่ƒฝๅญฆไผšใ€‚ ๅฆ‚ๆžœไฝ ่ฟ˜ๆƒณๅญฆไน  Typst ็š„ใ€Œ[ๅ…ƒไฟกๆฏ](https://typst-doc-cn.github.io/docs/reference/meta/)ใ€้ƒจๅˆ†๏ผŒ่ฟ›่€Œ่ƒฝๅคŸ็ผ–ๅ†™่‡ชๅทฑ็š„ๆจกๆฟ๏ผŒไธ€่ˆฌ่€Œ่จ€้œ€่ฆๅ‡ ๅคฉ็š„ๆ—ถ้—ด้˜…่ฏปๆ–‡ๆกฃ๏ผŒไปฅๅŠไป–ไบบ็ผ–ๅ†™็š„ๆจกๆฟไปฃ็ ใ€‚ ๅฆ‚ๆžœไฝ ๆœ‰ Python ๆˆ– JavaScript ็ญ‰่„šๆœฌ่ฏญ่จ€็š„็ผ–ๅ†™็ป้ชŒ๏ผŒไบ†่งฃ่ฟ‡ๅ‡ฝๆ•ฐๅผ็ผ–็จ‹ใ€ๅฎใ€ๆ ทๅผใ€็ป„ไปถๅŒ–ๅผ€ๅ‘็ญ‰ๆฆ‚ๅฟต๏ผŒๅ…ฅ้—จ้€Ÿๅบฆไผšๅฟซๅพˆๅคšใ€‚ ### ๆˆ‘ๆœ‰็ผ–ๅ†™ LaTeX ็š„็ป้ชŒ๏ผŒๅฆ‚ไฝ•ๅฟซ้€Ÿๅ…ฅ้—จ๏ผŸ ๅฏไปฅๅ‚่€ƒ [้ขๅ‘ LaTeX ็”จๆˆท็š„ Typst ๅ…ฅ้—จๆŒ‡ๅ—](https://typst-doc-cn.github.io/docs/guides/guide-for-latex-users/)ใ€‚ ### ็›ฎๅ‰ Typst ๆœ‰ๅ“ชไบ›็ฌฌไธ‰ๆ–นๅŒ…ๅ’Œๆจกๆฟ๏ผŸ ๅฏไปฅๅ‚่€ƒ [็ฌฌไธ‰ๆ–นๅŒ…](https://typst-doc-cn.github.io/docs/packages/)ๅ’Œ[Awesome Typst Links](https://github.com/qjcg/awesome-typst)ใ€‚ ### ๆˆ‘ๅฆ‚ไฝ•ๆ›ดๆ”น้กต้ขไธŠ็š„ๆ ทๅผ๏ผŸๅ…ทไฝ“็š„่ฏญๆณ•ๆ˜ฏๆ€Žไนˆๆ ท็š„๏ผŸ ่ฏท่งๅŽŸๅง‹้กน็›ฎ[ๆ–‡ๆกฃ](https://github.com/FurryAcetylCoA/sgu-thesis-typst?tab=readme-ov-file) ### ่ฏฅๆจกๆฟๅ’Œๅ…ถไป–็Žฐๅญ˜ Typst ไธญๆ–‡่ฎบๆ–‡ๆจกๆฟ็š„ๅŒบๅˆซ๏ผŸ ๅ…ถไป–็Žฐๅญ˜็š„ Typst ไธญๆ–‡่ฎบๆ–‡ๆจกๆฟๅคงๅคš้ƒฝๆ˜ฏๅœจ 2023 ๅนด 7 ๆœˆไปฝไน‹ๅ‰๏ผˆTypst Verison 0.6 ไน‹ๅ‰๏ผ‰ๅผ€ๅ‘็š„๏ผŒๅฝ“ๆ—ถ Typst ่ฟ˜ไธไธๅคŸๆˆ็†Ÿ๏ผŒ็”š่‡ณ่ฟž **ๅŒ…็ฎก็†** ๅŠŸ่ƒฝ้ƒฝ่ฟ˜ๆฒกๆœ‰๏ผŒๅ› ๆญคๅฝ“ๆ—ถ็š„ Typst ไธญๆ–‡่ฎบๆ–‡ๆจกๆฟ็š„ๅผ€ๅ‘่€…ๅŸบๆœฌ้ƒฝๆ˜ฏ่‡ชๅทฑไปŽๅคดๅ†™ไบ†ไธ€้้œ€่ฆ็š„ๅŠŸ่ƒฝ/ๅ‡ฝๆ•ฐ๏ผŒๅ› ๆญค้€ ๆˆไบ† **ไปฃ็ ่€ฆๅˆๅบฆ้ซ˜**ใ€**ๆ„ๅคงๅˆฉ้ขๆกๅผไปฃ็ **ใ€**้‡ๅค้€ ่ฝฎๅญ** ไธŽ **้šพไปฅ่‡ชๅฎšไน‰ๆ ทๅผ** ็ญ‰้—ฎ้ข˜ใ€‚ ่ฏฅๆจกๆฟๆ˜ฏๅœจ 2023 ๅนด 10 ๏ฝž 11 ๆœˆไปฝ๏ผˆTypst Verison 0.9 ๆ—ถ๏ผ‰ๅผ€ๅ‘็š„๏ผŒๆญคๆ—ถ Typst ่ฏญๆณ•ๅŸบๆœฌ็จณๅฎš๏ผŒๅนถไธ”ๆไพ›ไบ† **ๅŒ…็ฎก็†** ๅŠŸ่ƒฝ๏ผŒๅ› ๆญค่ƒฝๅคŸๅ‡ๅฐ‘ๅพˆๅคšไธๅฟ…่ฆ็š„ไปฃ็ ใ€‚ ๅนถไธ”ๆจกๆฟ็š„ๆ–‡ไปถๆžถๆž„่ฟ›่กŒไบ†่งฃ่€ฆ๏ผŒไธป่ฆๅˆ†ไธบไบ† `utils`ใ€`templates` ๅ’Œ `layouts` ไธ‰ไธช็›ฎๅฝ•๏ผŒ่ฟ™ไธ‰ไธช็›ฎๅฝ•ๅฏไปฅ็œ‹ๅŽๆ–‡็š„ๅผ€ๅ‘่€…ๆŒ‡ๅ—๏ผŒๅนถไธ”ไฝฟ็”จ **้—ญๅŒ…** ็‰นๆ€งๅฎž็Žฐไบ†็ฑปไผผไธๅฏๅ˜ๅ…จๅฑ€ๅ˜้‡็š„ๅ…จๅฑ€้…็ฝฎ่ƒฝๅŠ›๏ผŒๅณๆจกๆฟไธญ็š„ `documentclass` ๅ‡ฝๆ•ฐ็ฑปใ€‚ ## ๅผ€ๅ‘่€…ๆŒ‡ๅ— ### ๅค–้ƒจ็›ฎๅฝ• - `thesis.typ` ๆ–‡ไปถ: ไฝ ็š„่ฎบๆ–‡ๆบๆ–‡ไปถ๏ผŒๅฏไปฅ้šๆ„ๆ›ดๆ”น่ฟ™ไธชๆ–‡ไปถ็š„ๅๅญ—๏ผŒ็”š่‡ณไฝ ๅฏไปฅๅฐ†่ฟ™ไธชๆ–‡ไปถๅœจๅŒ็บง็›ฎๅฝ•ไธ‹ๅคๅˆถๅคšไปฝ๏ผŒ็ปดๆŒๅคšไธช็‰ˆๆœฌใ€‚ - `bibs` ็›ฎๅฝ•: ๆ”พ็ฝฎๅ‚่€ƒๆ–‡็Œฎ็š„็›ฎๅฝ•ใ€‚ - `nju-thesis` ็›ฎๅฝ•: ๆจกๆฟ็›ฎๅฝ•๏ผŒๆ”พ็ฝฎๆจกๆฟ็š„ๆ‰€ๆœ‰ๅ†…ๅฎน๏ผŒ**่ฟ™ไธช็›ฎๅฝ•ๅฏไปฅไฝœไธบไธ€ไธช Local Package ๅฎ‰่ฃ…ๅˆฐๆœฌๅœฐๅŒ…็›ฎๅฝ•**๏ผŒๅ› ๆญค็†่ฎบไธŠไฝ ไธๅบ”่ฏฅไฟฎๆ”น่ฟ™ไธช็›ฎๅฝ•ไธ‹็š„ไปปไฝ•ไธœ่ฅฟใ€‚ ### ๅ†…้ƒจ็›ฎๅฝ• - `utils` ็›ฎๅฝ•: ๅŒ…ๅซไบ†ๆจกๆฟไฝฟ็”จๅˆฐ็š„ๅ„็ง่‡ชๅฎšไน‰่พ…ๅŠฉๅ‡ฝๆ•ฐ๏ผŒๅญ˜ๆ”พๆฒกๆœ‰ๅค–้ƒจไพ่ต–๏ผŒไธ” **ไธไผšๆธฒๆŸ“ๅ‡บ้กต้ข็š„ๅ‡ฝๆ•ฐ**ใ€‚ - `templates` ็›ฎๅฝ•: ๅŒ…ๅซไบ†ๆจกๆฟ็”จๅˆฐ็š„ๅ„ไธช **็‹ฌ็ซ‹้กต้ข**๏ผŒไพ‹ๅฆ‚ๅฐ้ข้กตใ€ๅฃฐๆ˜Ž้กตใ€ๆ‘˜่ฆ็ญ‰๏ผŒๅณ **ไผšๆธฒๆŸ“ๅ‡บไธๅฝฑๅ“ๅ…ถไป–้กต้ข็š„็‹ฌ็ซ‹้กต้ข็š„ๅ‡ฝๆ•ฐ**ใ€‚ - `layouts` ็›ฎๅฝ•: ๅธƒๅฑ€็›ฎๅฝ•๏ผŒๅญ˜ๆ”พ็€็”จไบŽๆŽ’็ฏ‡ๅธƒๅฑ€็š„ใ€ๅบ”็”จไบŽ `show` ๆŒ‡ไปค็š„ใ€**ๆจช่ทจๅคšไธช้กต้ข็š„ๅ‡ฝๆ•ฐ**๏ผŒไพ‹ๅฆ‚ไธบไบ†็ป™้กต่„š่ฟ›่กŒ็ฝ—้ฉฌๆ•ฐๅญ—็ผ–็ ็š„ๅ‰่จ€ `preface` ๅ‡ฝๆ•ฐใ€‚ - ไธป่ฆๅˆ†ๆˆไบ† `doc` ๆ–‡็จฟใ€`preface` ๅ‰่จ€ใ€`mainmatter` ๆญฃๆ–‡ไธŽ `appendix` ้™„ๅฝ•/ๅŽ่ฎฐใ€‚ - `template.typ`: - **่Œ่ดฃไธ€**: ไฝœไธบไธ€ไธช็ปŸไธ€็š„ๅฏนๅค–ๆŽฅๅฃ๏ผŒๆšด้œฒๅ‡บๅ†…้ƒจ็š„ utils ๅ‡ฝๆ•ฐ๏ผŒไพ‹ๅฆ‚ไธ‰็บฟ่กจ `tlt` ๅ‡ฝๆ•ฐใ€‚ - **่Œ่ดฃไบŒ**: ไฝฟ็”จ **ๅ‡ฝๆ•ฐ้—ญๅŒ…** ็‰นๆ€ง๏ผŒ้€š่ฟ‡ `documentclass` ๅ‡ฝๆ•ฐ็ฑป่ฟ›่กŒๅ…จๅฑ€ไฟกๆฏ้…็ฝฎ๏ผŒ็„ถๅŽๆšด้œฒๅ‡บๆ‹ฅๆœ‰ไบ†ๅ…จๅฑ€้…็ฝฎ็š„ใ€ๅ…ทไฝ“็š„ `layouts` ๅ’Œ `templates` ๅ†…้ƒจๅ‡ฝๆ•ฐใ€‚ ## ๅ‚ไธŽ่ดก็Œฎ - ๅœจ Issues ไธญๆๅ‡บไฝ ็š„ๆƒณๆณ•๏ผŒๅฆ‚ๆžœๆ˜ฏๆ–ฐ็‰นๆ€ง๏ผŒๅฏไปฅๅŠ ๅ…ฅ่ทฏ็บฟๅ›พ๏ผ - ๅฎž็Žฐ่ทฏ็บฟๅ›พไธญไปๆœชๅฎž็Žฐ็š„้ƒจๅˆ†๏ผŒ็„ถๅŽๆฌข่ฟŽๆๅ‡บไฝ ็š„ PRใ€‚ - ๆฌข่ฟŽ **ๅฐ†่ฟ™ไธชๆจกๆฟ่ฟ็งป่‡ณไฝ ็š„ๅญฆๆ ก่ฎบๆ–‡ๆจกๆฟ**๏ผŒๅคงๅฎถไธ€่ตทๆญๅปบๆ›ดๅฅฝ็š„ Typst ็คพๅŒบๅ’Œ็”Ÿๆ€ๅงใ€‚ ## ่‡ด่ฐข - ๆ„Ÿ่ฐข [@atxy-blip](https://github.com/atxy-blip) ๅผ€ๅ‘็š„ [NJUThesis](https://github.com/nju-lug/NJUThesis) LaTeX ๆจกๆฟ๏ผŒๆ–‡ๆกฃๅๅˆ†่ฏฆ็ป†๏ผŒๆœฌๆจกๆฟๅคงไฝ“็ป“ๆž„้ƒฝๆ˜ฏๅ‚่€ƒ NJUThesis ็š„ๆ–‡ๆกฃๅผ€ๅ‘็š„ใ€‚ - ๆ„Ÿ่ฐข [HUST-typst-template](https://github.com/werifu/HUST-typst-template) ไธŽ [sysu-thesis-typst](https://github.com/howardlau1999/sysu-thesis-typst) ็ญ‰ Typst ไธญๆ–‡่ฎบๆ–‡ๆจกๆฟใ€‚ ## TODO ่กจๆ ผ็š„ๆ ‡้ข˜ๅฅฝๅƒ่ฟ˜ๆœ‰็‚น้—ฎ้ข˜ ## License This project is licensed under the MIT License.
https://github.com/DustVoice/dustypst
https://raw.githubusercontent.com/DustVoice/dustypst/main/dustypst.typ
typst
#import "langs.typ": default_lang #let default_font = ( name: "Inter", name_raw: "JetBrains Mono", name_fallback: "Linux Libertine", size: 13pt, ) #let dustvoice_author = (name: "DustVoice", email: "<EMAIL>", affiliation: none, phone: none) #let dracula = ( colors: ( background: rgb("#282a36"), selection: rgb("#44475a"), foreground: rgb("#f8f8f2"), comment: rgb("#6272a4"), cyan: rgb("#8be9fd"), green: rgb("#50fa7b"), orange: rgb("#ffb86c"), pink: rgb("#ff79c6"), purple: rgb("#bd93f9"), red: rgb("#ff5555"), yellow: rgb("#f1fa8c"), ), ) #let cont2str(content) = { if type(content) == "content" and content.has("text") { content.text } else if type(content) == "string" { content } else { "" } } #let str2color(color) = { if type(color) == "string" { rgb(color) } else if type(color) == "color" { color } } #let border-block(width: 100%, color, content) = block( align(left, content), stroke: .25em + str2color(color), inset: 1em, radius: .5em, width: width ) #let fill-block(width: 100%, color, content) = block( align(left, content), fill: str2color(color), inset: 1em, radius: .5em, width: width, ) #let border-box(width: auto, color, content) = box( content, stroke: scale * .25em + str2color(color), outset: scale * .25em, radius: scale * .25em, inset: (x: lr_inset, y: tb_inset), width: width, ) #let fill-box(width: auto, color, content) = box( content, fill: str2color(color), inset: (left: .25em, right: .25em, top: .25em), outset: (bottom: .25em), radius: .25em, width: width, ) #let colorbox(title: "title", title_color: none, color: black, textcolor: white, content) = { return box( fill: none, stroke: .25em + color, radius: .5em, width: 100%, clip: false )[ #if title != "" { [ #box( fill: if title_color != none { title_color } else { color }, inset: (left: 1em, top: .5em, right: 1em, bottom: .5em), radius: (top-left: .5em, bottom-right: .5em), )[ #text(fill: textcolor, weight: "bold")[#title] ]\ ] } else { rect( fill: str2color(color), width: 100%, height: 2em, ) } #box( width: 100%, inset: (x: 1em, bottom: 1em) )[ #content ] ] } #let code(root: false, lang: "", content) = { let text_content = [ #if root { emoji.lock + h(.2em) } #raw( lang: lang, block: false, cont2str(content) ) ] fill-box( dracula.colors.yellow, text_content ) } #let cmd(root: false, content) = code(root: root, lang: "fish", content) #let cmd-root(content) = cmd(root: true, content) #let linkfn(plain: false, color: dracula.colors.green, dest, body) = { let link_markup = [ #link(dest, body)#footnote(link(dest, dest)) ] if plain { link_markup } else { fill-box(color, link_markup) } } #let filepath(content) = fill-box(dracula.colors.cyan, raw(cont2str(content))) #let filesrc(readonly: false, exec: false, perm: false, part: false, filename, content) = { let title = [ #let add_space = false #if readonly { emoji.glasses add_space = true } #if exec { emoji.joystick add_space = true } #if perm { emoji.lock add_space = true } #if add_space { h(.5em) } #raw(filename) #if part { h(.5em) + sym.dots } ] colorbox(title: text(weight: "regular", title), color: dracula.colors.cyan, textcolor: black, content) } #let pkg-target(aur: false, name) = { if aur { return "https://aur.archlinux.org/packages/" + name } else { return "https://archlinux.org/packages/" + name } } #let pkg-link(target: "", plain: false, nofn: false, aur: false, name) = { if target == "" { target = pkg-target(aur: aur, name) } let link_function(target, content) = if nofn { link(target, content) } else { linkfn(color: dracula.colors.orange, target, content) } if plain { link_function(target, name) } else { if aur { link_function(target)[#raw(name)#sub(raw("AUR"))] } else { link_function(target, raw(name)) } } } #let pkg(name) = pkg-link(name) #let pkg-aur(name) = pkg-link(aur: true, name) // IMPORTANT: The community repository was recently merged into extra! #let pkgtable(lang: default_lang, core: "", extra: "", /*community: "",*/ aur: "", multilib: "", groups: "") = { colorbox(title: lang.packages, color: dracula.colors.orange, text(size: .75em, fill: dracula.colors.selection, for repo in ( ("Core", "https://archlinux.org/packages/?repo=Core", core), ("Extra", "https://archlinux.org/packages/?repo=Extra", extra), //("Community", "https://archlinux.org/packages/?repo=Community", community), ("Multilib", "https://archlinux.org/packages/?repo=Multilib", multilib), ("AUR", "https://aur.archlinux.org/packages", aur), ("Groups", "https://archlinux.org/groups/", groups), ) { if repo.at(2).len() > 0 { [ / #repo.at(0): #link(repo.at(1), emoji.globe.eu.af)\ #{ repo.at(2).split(" ").map(pkg => { pkg-link(plain: true, nofn: true, aur: repo.at(0) == "AUR", pkg) }).join(" " + sym.hyph.point + " ") } ] } } ) ) } #let note(lang: default_lang, content) = colorbox( title: lang.note, color: dracula.colors.comment, content ) #let tip(lang: default_lang, content) = colorbox( title: lang.tip, color: dracula.colors.purple, content ) #let important(lang: default_lang, content) = colorbox( title: lang.important, color: dracula.colors.pink, content ) #let warning(lang: default_lang, content) = colorbox( title: lang.warning, color: dracula.colors.red, content ) #let caution(lang: default_lang, content) = colorbox( title: lang.caution, color: dracula.colors.background, content ) #let codeblock(content) = colorbox(title: "", color: dracula.colors.yellow, content) #let terminal(windows: false, lang: "fish", root: false, path, raw_content) = { if windows { lang = "cmd" } let format(content) = { raw(lang: lang, cont2str(content)) } let content = { let children = { if raw_content.has("children") { for child in raw_content.children { format(child) } } else { format(raw_content) } } children } let title = [ #if windows { emoji.window } #if root { emoji.lock + h(1em) } #path ] colorbox( title: text( weight: "regular", size: .75em, title ), color: dracula.colors.yellow, textcolor: black, content ) } #let terminal-root(windows: false, lang: "fish", path, content) = terminal(windows: windows, lang: lang, root: true, path, content) #let admindoc_project( title: none, subtitle: none, authors: (dustvoice_author,), font: default_font, lang: default_lang, outlined: true, body, ) = { set text(font: (font.name, font.name_fallback), size: font.size, lang: lang.lang) show raw: set text(font: font.name_raw) set document(author: authors.map(a => a.name), title: title) set page( paper: "a5", header: [ #counter(footnote).update(0) #align( center, block(spacing: 0pt)[ #if (title != none) {[ #text(1em, fill: dracula.colors.pink, title)\ ]} #if (subtitle != none) {[ #text(0.5em, fill: dracula.colors.purple, subtitle) ]} ] ) ], numbering: none ) show outline.entry: it => {[ #link(it.element.location(), it.body)#box(width: 1fr, repeat[#h(.25em)#sym.dot]) ]} if outlined { outline(title: lang.outline, indent: none) } set par(justify: true) set figure(numbering: "1") set heading(numbering: "1.1") show heading: heading => { pagebreak() text(1.25em, heading) } body } #let userdoc_project( title: none, authors: (dustvoice_author,), date: datetime.today().display("[day].[month].[year]"), logo: none, font: default_font, lang: default_lang, outlined: true, body, ) = { set document(author: authors.map(a => a.name), title: title) set page(numbering: "1", number-align: center) set text(font: (font.name, font.name_fallback), size: font.size, lang: lang.lang) show raw: set text(font: font.name_raw) set heading(numbering: "1.1") v(0.6fr) if logo != none { align(right, image(logo, width: 26%)) } v(9.6fr) text(1.1em, date) v(1.2em, weak: true) text(2em, weight: 700, title) pad( top: 0.7em, right: 20%, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(start)[ *#author.name* \ #author.email \ #author.affiliation \ #author.phone ]), ), ) v(2.4fr) pagebreak() set par(justify: true) if outlined { outline(title: lang.outline) pagebreak() } body }
https://github.com/sitandr/conchord
https://raw.githubusercontent.com/sitandr/conchord/main/README.md
markdown
MIT License
# Conchord > Notice: I'm preparing the update, so the documentation there is referring to the new version. `conchord` (concise chord) is a [Typst](https://github.com/typst/typst) package to write lyrics with chords and generate colorful fretboard diagram (aka chord diagram). From `0.1.1` there is also experimental tabs support (though quite simple and unstable yet). It is inspired by [chordx](https://github.com/ljgago/typst-chords) package and my previous tiny project for generating chord diagrams SVG-s. # Overview `conchord` makes it easy to add new chords, both for diagrams and lyrics. Unlike [chordx](https://github.com/ljgago/typst-chords), you don't need to think about layout and pass lots of arrays for drawing barres. Just pass a string with held frets and it will work: ```typst #import "@preview/conchord:0.2.0": new-chordgen, overchord #let chord = new-chordgen() #box(chord("x32010", name: "C")) #box(chord("x33222", name: "F#m/C#")) #box(chord("x,9,7,8,9,9")) ``` ![](examples/simple.png) > `x` means closed string, `0` is open, other number is a fret. In case of frets larger than `9` frets should be separated with commas, otherwise you can list them without any separators. > Chord diagram works like a usual block, so to put them into one line you need to wrap them into boxes. In real code it is recommended to create a wrapper function to customize box margins etc (see larger example below). It is easy to customize the colors and styles of chords with `colors` argument and `show` rules for text. You can also put `!` and `*` marks in the end of the string to force diagram generation. `!` forces barre, `*` removes it: ```typst #let custom-chord = new-chordgen(string-number: 3, colors: (shadow-barre: orange, grid: gray.darken(30%), hold: red, barre: purple) ) #set text(fill: purple) #box(custom-chord("320", name: "C")) #box(custom-chord("2,4,4,*", name: "Bm")) #box(custom-chord("2,2,2, *")) #box(custom-chord("x,3,2, !")) ``` ![](examples/crazy.png) > NOTE: be careful when using **!**, if barre cannot be used, it will result into nonsense. For lyrics, you don't need to add chord to word and specify the number of char in words (unlike [chordx](https://github.com/ljgago/typst-chords)). Simply add `#overchord` to the place you want a chord. Compose with native Typst stylistic things for non-plain look (you don't need to dig into [chordx](https://github.com/ljgago/typst-chords)'s custom arguments): ```typst #let och(it) = overchord(strong(it)) === #raw("[Verse 1]") #och[Em] Another head #och[C] hangs lowly \ #och[G] Child is slowly #och[D] taken ... ``` > Complete example of lyrics with chords (see [full source](examples/zombie.typ)): ![](examples/zombie.png) # Features I was quite amazed with general idea of [chordx](https://github.com/ljgago/typst-chords), but a bit frustated with implementation, so I decided to quickly rewrite my old js code to Typst. I use `cetz` there, so code is quite clean. > Note: This package doesn't use any piece of [chordx](https://github.com/ljgago/typst-chords), only the general idea is taken. Brief comparison may be seen there, some concepts explained below: ![](examples/compare.png) ## Think about frets, not layout Write frets for chord as you hold it, like a string like "123456" (see examples above). You don't need to think about layouting and subtracting frets, `conchord` does it for you. > NOTE: I can't guarantee that will be the best chord layout. Moreover, the logic is quite simple: e.g., barre can't be multiple and can't be put anywhere except first bar in the image. However, surprisingly, it works well in almost all of the common cases, so the exceptions are really rare. If you need to create something too _custom/complex_ ~~(but not _concise_)~~, maybe it is worth to try [chordx](https://github.com/ljgago/typst-chords). You can also try using core function `render-chord` for more manualย control, but it is still limited by one barre starting from one (but that barre may be shifted). If you think that feature should be supported, you can create issue there. ## Shadow barre Some chord generators put barre only where it _ought to_ be (any less will not hold some strings). Others put it where it can be (sometimes maximal size, sometimes some other logic). I use simple barre where it **ought to** be, and add _shadow barre_ where it **could** maximally be. You can easily disable it by either setting `use-shadow-barre: false` on `new-chordgen` (only necessary part of barre rendered) or by setting color of `shadow-barre` the same as `barre` (maximal possible barre). ## Name auto-scaling Chord name font size is _reduced_ for _large_ chord names, so the name fits well into chord diagram (see example above). That makes it much more pretty to stack several chords together. To achieve chordx-like behavior, you can always use `#figure(chord("โ€ฆ"), caption: โ€ฆ)`. ## Easier chords for lyrics Just add chord labels above lyrics in arbitrary place, don't think about what letter exactly it should be located. By default it aligns the chord label to the left, so it produces pretty results out-of-box. You can pass other alignments to `alignment` argument, or use the chords straight inside words. The command is _much_ simpler than chordx (of course, it is a trade-off): ```typst #let overchord(body, align: start, height: 1em, width: -0.25em) = box(place(align, body), height: 1em + height, width: width) ``` Feel free to use it for your purposes outside of the package. It takes on default `-0.25em` width to remove one adjacent space, so - To make it work on monospace/other special fonts, you will need to adjust `width` argument. The problem is that I can't `measure` space, but maybe that will be eventually fixed. - To add chord inside word, you have to add _one_ space, like `wo #chord[Am]rd`. ## Colors Customize the colors of chord elements. `new-chordgen` accepts the `colors` dictionary with following possible fields: - `grid`: color of grid, default is `gray.darken(20%)` - `open`: color of circles for open strings, default is `black` - `muted`: color of crosses for muted strings, default is `black` - `hold`: color of held positions, default is `#5d6eaf` - `barre`: color of main barre part, default is `#5d6eaf` - `shadow-barre`: color of "unnecessary" barre part, default is `#5d6eaf.lighten(30%)` ### Customizing text **Important**: _frets_ are rendered using `raw` elements. So if you want to customize their font or color, please use `#show raw: set text(fill: ...)` or similar things. The chord's name, on the other hand, uses default font, so to set it, just use `#set text(font: ...)` in the corresponding scope. ## Assertions Currently [chordx](https://github.com/ljgago/typst-chords) has almost no checks inside for correctness of passed chords. `conchord`, on the other side, checks for - Number of passed&parsed frets equal to set string-number - Only numbers and `x` passed as frets - All frets fitting in the diagram # Tabs > Everything there is highly experimental and unstable ![Tabs example](examples/tabs.png) ```typst #let chord = new-chordgen(scale-length: 0.6pt) #let ending(n) = { rect(stroke: (left: black, top: black), inset: 0.2em, n + h(3em)) v(0.5em) } *This thing doesn't follow musical notation rules, it is used just for demonstration purposes*: #tabs.new(``` 2/4 2/4-3 2/4-2 2/4-3 | 2/4-2 2/4-3 2/4 2/4 2/4 | 2/4-2 p 0/2-3 3/2-2 |: 0/1+0/6 0/1 0/1-3 2/1 | 3/1+3/5-2 3/1 3/1-3 5/1 | 2/1+0/4-2 2/1 0/1-3 3/2-3 | \ \ 3/2-2 `5/2-3 p-2 ## chord("022000", name: "Em") ##south 0/2-3 3/2 | | ## [...] ## p-4. | | 7/1-3 0/1-2 p-3 0/1 3/1 ## ending[1.] ##west | 2/1-3 2/1 3/1 0/1 2/1-2 p-3 0/2-3 3/2-3 ## ending[2.] ##west | 2/1-2 2/1 0/1-3 3/2 :| 0/6-2 | ^0/6-2 || \ 1/1 2/1 2/2 2/2 2/3 2/3 4/4 4/4 4/4 4/4 4/4 4/4 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 2/3 ## [notice there is no manual break] ##east | 2/3 2/3 8/3 7/3 6/3 5/3 4/3 2/3 5/3 8/3 9/3 7/3 2/3 | 2/3 2/2 2/3 2/4 | 10/1-3 10/1-3 10/1-3 10/1-4 10/1-4 10/1-4 10/1-4 10/1-5. 10/1-5. 10/1-5 10/1-5 10/1-2 \ 1/3bfullr+2/5-2 1/2b1/2-1 2/3v-1 ```, eval-scope: (chord: chord, ending: ending) ) Not a lot customization is available yet, but something is already possible: #show raw: set text(red.darken(30%), font: "Comic Sans MS") #tabs.new("0/1+2/5-1 ^0/1+`3/5-2.. 2/3 |: 2/3-1 2/3 2/3 | 3/3 ||", scale-length: 0.2cm, one-beat-length: 12, s-num: 5, colors: ( lines: gradient.linear(yellow, blue), bars: green, connects: red ), enable-scale: false ) ``` As you can see from example, you can use raw strings or code blocks to write tabs, there is no real difference. The general idea is very simple: to write a number on some line, write `<fret number>/<string>`. **Spaces are important!** All notes and special symbols work well only if properly separated. ### Duration By default they will be quarter notes. To change that, you have to specify the duration: `<fret>/<string>-<duration>`, where duration is $log_2$ from note duration. So a whole note will be `-0`, a half: `-1` and so on. You can also use as many dots as you want to multiply duration by 1.5, e.g. `-2.` Once you change the duration, all the following notes will use it, so you have to specify duration every time it is changed (basically, always, but it really depends on composition). Of course, you can just ignore all that duration staff. ### Bars and repetitions To add simple bar, just add `|`. To add double bar line, use `| |`. To add end movement/composition, add `||`. To add repetitions, use `|:` and `:|` respectively. ### Linebreaks Notes and bars that don't fit in line will be automatically moved to next. However, sometimes it isn't ideal and may be a bit bugged, so it is recommended to do that manually, using `\`. The line is autoscaled if it is possible and not too ugly. You can change the maximum and minimum scaling size with `scale-max` and `scale-min`. It is also possible to completely disable scaling with `enable-scale: false`. ### Ties and slides You can _tie_ notes or _slide_ between them. To use ties, you have to add `^` in front of _second_ tied note, like `1/1 ^3/1`. To use slides you have to do the same, but with \`. _Current limitation:_ tying and sliding works only on the same string and may work really bad if tied/slided through line break. ## Bends and vibratos Add `b` after note, but before the duration (e.g. `2/3b-2`) to add a bend. After `b` you can write custom text to be written on top (for example, `b1/2`). Add `r` to the end to add a release. Adding vibratos works the same way, via adding `v` to the note. The length of vibrato will be the same as the length of the note. Unfortunately, they are all supported things for now. But wait, there is still one cool thing left! ### Custom content Add any typst code you want between `## โ€ฆ ##`. It will be rendered with `cetz` on top of the line where you wrote it. That means you can write _lyrics, chords, add complex things like endings_, even **draw the elements that are still missing** (well, it is still worth to create issue there, I will try to do something). That code is evaluated with `eval`, so you will need to pass dictionary to `eval-scope` with all things you want to use. You can set align of these elements by writing cetz anchors after the second (e.g., `west`, `south` and their combinations, like `west-south`). Additionally, if you enjoy drawing missing things, you can also use `preamble` and `extra` arguments in `tabs.new` where you can put any `cetz` inner things (tabs uses canvas, and that allow you drawing on it) before or after the tabs are drawn. ### Plans 1. Add _(optional)_ "rhythm section" under tabs 2. Add more signs&lines 3. Add more built-in things to attach above tabs It is far from what I want to do, so maybe there will be much more! I will be very glad to receive _any feedback_, both issues and PR-s are very welcome (though I can't promise I will be able to work on it immediately)!
https://github.com/cu1ch3n/karenda
https://raw.githubusercontent.com/cu1ch3n/karenda/main/nord.typ
typst
#let nord0 = rgb("2E3440") #let nord1 = rgb("3B4252") #let nord2 = rgb("434C5E") #let nord3 = rgb("4C566A") #let nord4 = rgb("D8DEE9") #let nord5 = rgb("E5E9F0") #let nord6 = rgb("ECEFF4") #let nord7 = rgb("8FBCBB") #let nord8 = rgb("88C0D0") #let nord9 = rgb("81A1C1") #let nord10 = rgb("5E81AC") #let nord11 = rgb("BF616A") #let nord12 = rgb("D08770") #let nord13 = rgb("EBCB8B") #let nord14 = rgb("A3BE8C") #let nord15 = rgb("B48EAD")
https://github.com/yonatanmgr/university-notes
https://raw.githubusercontent.com/yonatanmgr/university-notes/main/0366-%5BMath%5D/03661111-%5BLinear%20Algebra%201A%5D/src/lectures/03661111_lecture_8.typ
typst
#import "/template.typ": * #import "@preview/colorful-boxes:1.2.0": * #show: project.with( title: "ืืœื’ื‘ืจื” ืœื™ื ืืจื™ืช 1ืืณ - ืฉื™ืขื•ืจ 8", authors: ("<NAME>",), date: "30 ื‘ื™ื ื•ืืจ, 2024", ) // #include "/utils/toc.typ" // #pagebreak() #set enum(numbering: "(1.ื)") = ื‘ืกื™ืกื™ื - ื”ืžืฉืš == ืชื–ื›ื•ืจืช ื™ื”ื™ $V$ ืžืดื• ืžืขืœ ื”ืฉื“ื” $F$ ื•ืชื”ื™ $A subset V$ ืงื‘ื•ืฆื”. - ื ืืžืจ ืฉ-$A$ *ืคื•ืจืฉืช* ืืช $V$ ืื $span_F (A)=V$, ื›ืœื•ืžืจ ื›ืœ ื•ืงื˜ื•ืจ ื‘-$V$ ื ื™ืชืŸ ืœื”ื‘ืขื” ื›ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $A$. - ื ืืžืจ ืฉ-$A$ *ื‘ืชืดืœ* ืื ื”ืฆื™ืจื•ืฃ ื”ืœื™ื ืืจื™ #underline[ื”ื™ื—ื™ื“ื™] ืฉืœ ืื™ื‘ืจื™ $A$ ืฉืžืชืืคืก ื”ื•ื ื”ื˜ืจื™ื•ื•ื™ืืœื™. - ื ืืžืจ ืฉ-$A$ *ื‘ืกื™ืก* ืฉืœ $V$ ืื ื›ืœ ื•ืงื˜ื•ืจ ื ื™ืชืŸ ืœื”ื‘ืขื” ื›ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $A$ ื‘ืฆื•ืจื” #underline[ื™ื—ื™ื“ื”]. - ื ืืžืจ ืฉ-$V$ *ื ื•ืฆืจ ืกื•ืคื™ืช* ืื ืงื™ื™ืžืช ืงื‘ื•ืฆื” ืกื•ืคื™ืช ืฉืคื•ืจืฉืช ืืช $V$. == ื˜ืขื ื•ืช, ืžืฉืคื˜ื™ื ื•ืžืกืงื ื•ืช === (ื˜ืขื ื”) ืื ื‘ืžืดื• $V$ ื™ืฉื ื” ืงื‘ื•ืฆื” ืคื•ืจืฉืช ื‘ืช $m$ ื•ืงื˜ื•ืจื™ื, ื›ืœ ืงื‘ื•ืฆื” ืฉื‘ื” ื™ื•ืชืจ ืž-$m$ ื•ืงื˜ื•ืจื™ื ืชื”ื™ื” ืชืดืœ === (ืžืฉืคื˜) ื™ื”ื™ $V$ ืžืดื• ืžืขืœ $F$ ื•ืชื”ื™ $B subset V$ ืงื‘ื•ืฆื”. ืื–ื™, $B$ ื‘ืกื™ืก ืฉืœ $V$ ืืืดื $B$ ืคื•ืจืฉืช ื•ื‘ืชืดืœ ==== ื”ื•ื›ื—ื” - $arrow.double.l$: ื ื ื™ื— ืฉ-$B$ ื‘ืกื™ืก ืฉืœ $V$. ื ืกื™ืง ืฉ-$B$ ืคื•ืจืฉืช ืืช $V$ ืฉื”ืจื™ ื›ืœ ื•ืงื˜ื•ืจ ื‘-$V$ ื ื™ืชืŸ ืœื”ื‘ื™ืข ื›ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $B$. ื›ืžื•-ื›ืŸ, ื›ืœ ื•ืงื˜ื•ืจ ื‘-$V$ ื ื™ืชืŸ ืœื”ื‘ื™ืข ื‘ืฆื•ืจื” ื™ื—ื™ื“ื” ื›ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $B$, ื•ื‘ืคืจื˜ ื’ื ืืช ื•ืงื˜ื•ืจ ื”ืืคืก ื ื•ื›ืœ ืœื”ื‘ื™ืข ืจืง ื›ืฆื™ืจื•ืฃ ื”ื˜ืจื™ื•ื•ื™ืืœื™. ื›ืœื•ืžืจ, $B$ ื‘ืชืดืœ. - $arrow.double.r$: ื ื ื™ื— ืฉ-$B$ ืคื•ืจืฉืช ื•ื‘ืชืดืœ. $B$ ืคื•ืจืฉืช ื•ืœื›ืŸ ื›ืœ ื•ืงื˜ื•ืจ ื‘-$V$ ื ื™ืชืŸ ืœื”ื‘ื™ืข ื›ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $B$. ื‘ื›ื“ื™ ืœื”ื•ื›ื™ื— ืืช ื”ื™ื—ื™ื“ื•ืช ื ืชื‘ื•ื ืŸ ื‘ื–ื•ื’ ืฆืดืœ ืฉืฉื•ื•ื™ื ื–ื” ืœื–ื”: $ sum_(k=1)^n alpha_k b_k = sum_(k=1)^n beta_k b_k \ alpha_1, dots, alpha_n, beta_1, dots, beta_n in F and b_1, dots, b_n in B $ ื ืขื‘ื™ืจ ืื’ืคื™ื: $ sum_(k=1)^n (alpha_k - beta_k) b_k = 0 $ ืงื™ื‘ืœื ื• ืฆืดืœ ืฉืœ ืื™ื‘ืจื™ $B$ ืฉืžืชืืคืก, $B$ ื‘ืชืดืœ ื•ืœื›ืŸ ื ืกื™ืง: $alpha_1 - beta_1 = alpha_2 - beta_2 = dots.h.c = alpha_n - beta_n $, ื›ืœื•ืžืจ $cases(alpha_1=beta_1, dots.v, alpha_n = beta_n)$. #QED === (ืžืกืงื ื”) ืื $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ื•-$B_1, B_2$ ื–ื•ื’ ื‘ืกื™ืกื™ื ืื– ื‘-$B_1, B_2$ ืžืกืคืจ ืื™ื‘ืจื™ื ื–ื”ื” ==== ื”ื•ื›ื—ื” $B_1$ ื‘ืกื™ืก ื•ืœื›ืŸ ืคื•ืจืฉ ืืช $V$. $B_2$ ื‘ืกื™ืก ื•ืœื›ืŸ ื‘ืชืดืœ. ื ืจืื” ื›ื™ ืžืกืคืจ ื”ืื™ื‘ืจื™ื ื‘-$<= B1$ ืžืกืคืจ ื”ืื™ื‘ืจื™ื ื‘-$B_2$. ืžืฆื“ ืฉื ื™, $B_2$ ื‘ืกื™ืก ื•ืœื›ืŸ ืคื•ืจืฉ ืืช $V$, $B_1$ ื‘ืกื™ืก ื•ืœื›ืŸ ื‘ืชืดืœ. ื ืจืื” ื›ื™ ืžืกืคืจ ื”ืื™ื‘ืจื™ื ื‘-$<= B_2$ ืžืกืคืจ ื”ืื™ื‘ืจื™ื ื‘-$B_1$. ืœื›ืŸ ืžืกืคืจ ื”ืื™ื‘ืจื™ื ื‘-$B_1$ ื•ื‘-$B_2$ ื–ื”ื”. #QED === (ื˜ืขื ื”) ืื $V$ ืžืดื• ืžืขืœ ื”ืฉื“ื” $F$ ื•-$A={u_1, u_2, dots, u_n}$ ืงื‘ืณ ืชืดืœ ืื– ืื—ื“ ืžืื™ื‘ืจื™ $A$ ื”ื•ื ืฆืดืœ ืฉืœ ื”ืื—ืจื™ื <s1> ==== ื”ื•ื›ื—ื” ื”ืงื‘ืณ ืชืดืœ ื•ืœื›ืŸ ืงื™ื™ื ืฆืดืœ ืœื ื˜ืจื™ื•ื•ื™ืืœื™ ืฉืžืชืืคืก $sum_(k=1)^n lambda_k u_k = 0$. ื‘ื”ืดื› ื ื ื™ื— $lambda_n !=0$ ื•ื ืฆื™ื’: $sum_(k=1)^(n-1) lambda_k u_k = -lambda_n u_n$. ื›ืœื•ืžืจ, $u_n = sum_(k=1)^(n-1) = (-lambda_n)^(-1) lambda_k u_k$, ื•ื ืกื™ืง: $u_n in span_F {u_1, dots, u_(n-1)}$. #QED === (ื˜ืขื ื”) ื™ื”ื™ $V$ ืžืดื• ืžืขืœ $F$ ื•ืชื”ื™ $A={u_1, u_2, dots, u_n}$ ืงื‘ื•ืฆื” ื‘ืชืดืœ, ื•ื™ื”ื™ ื’ื $w in V$. ืื–ื™ $A uu {w}$ ื‘ืชืดืœ ืืืดื $w in.not span_F (A)$ ==== ื”ื•ื›ื—ื” - $arrow.double.l$: ื ื ื™ื— $A uu {w}$ ื‘ืชืดืœ. ืื $w in span_F (A)$ ืื– $w=sum_(k=1)^n lambda_k u_k$ ื•ื ืงื‘ืœ $sum_(k=1)^n lambda_k u_k + (-1) dot w = 0$. ื ืกื™ืง ืฉ-$A uu {w}$ ืชืดืœ ื‘ืกืชื™ืจื” ืœื”ื ื—ื”. - $arrow.double.r$: ื ื ื™ื— $w in.not span_F (A)$. ื ืชื‘ื•ื ืŸ ื‘ืฆืดืœ ืฉืžืชืืคืก: $sum_(k=1)^n lambda_k u_k + alpha w = 0$. ืื $alpha != 0$ ื ืฆื™ื’: $w = sum_(k=1)^n (-alpha)^(-1) lambda_k u_k$ ื‘ืกืชื™ืจื” ืœื›ืš ืฉ-$w in.not span_F (A)$. ื›ืœื•ืžืจ $alpha=0$ ื•ื ืงื‘ืœ $sum_(k=1)^n lambda_k u_k$ ืฆืดืœ ืœื ื˜ืจื™ื•ื•ื™ืืœื™ ืฉืžืชืืคืก ื‘ืกืชื™ืจื” ืœื›ืš ืฉ-$A$ ื‘ืชืดืœ. === (ืžืกืงื ื”) ื™ื”ื™ $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ืžืขืœ $F$. ืื–ื™, ื‘ืกื™ืก ืฉืœ $V$ ื”ื•ื ืงื‘ืณ ื‘ืชืดืœ ืžืงืกื™ืžืœื™ืช (1) ื•ืงื‘ืณ ืคื•ืจืฉืช ืžื™ื ื™ืžืœื™ืช (2) ==== ื”ื•ื›ื—ื” + ื™ื”ื™ $B$ ื‘ืกื™ืก ืฉืœ $V$. ืื–ื™ $B$ ื‘ืชืดืœ ื•-$span_F (B) = V$ ื•ืœื›ืœ $v in V$ ืžืชืงื™ื™ื $v in span_F (B)$. ื›ืœื•ืžืจ $B uu {v}$ ืชืดืœ. + ื™ื”ื™ $B$ ื‘ืกื™ืก ืฉืœ $V$. ืื–ื™ $B$ ืคื•ืจืฉ ืืช $V$ ื•ื‘ืชืดืœ. ืื $b in B$ ื•ื ืชื‘ื•ื ืŸ ื‘ืงื‘ืณ $B without {b}$. ืงื‘ืณ ื–ื• ื›ื‘ืจ ืื™ื ื” ืคื•ืจืฉืช ืืช $V$, ื”ืจื™ ืฉ-$b in.not span (B without {b})$, ืฉื”ืจื™ ืื $b in span(B without {b})$ ื‘ื”ื›ืจื— $B=(B without {b}) uu {b}$ ืชืดืœ, ื‘ืกืชื™ืจื”. #QED === (ืžืกืงื ื”) ื™ื”ื™ $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ืžืขืœ $F$. ืื–ื™, (1) ื›ืœ ืงื‘ืณ ื‘ืชืดืœ ืžืงืกื™ืžืœื™ืช ื”ื™ื ื‘ืกื™ืก, (2) ื›ืœ ืงื‘ืณ ืคื•ืจืฉืช ืžื™ื ื™ืžืœื™ืช ื”ื™ื ื‘ืกื™ืก ==== ื”ื•ื›ื—ื” + ืงื‘ืณ ื‘ืชืดืœ ืžืงืกื™ืžืœื™ืช ื”ื™ื ื‘ืคืจื˜ ื‘ืชืดืœ. ื•ืื $B$ ืงื‘ืณ ื›ื–ื• ืฉืื™ื ื” ืคื•ืจืฉืช, ืื– ืงื™ื™ื $v in.not span(B)$ ืื– $B uu {v}$ ื‘ืชืดืœ ื‘ืกืชื™ืจื” ืœืžืงืกื™ืžืœื™ื•ืช. + ืื $B$ ืคื•ืจืฉืช ืžื™ื ื™ืžืœื™ืช ืื– ื‘ืคืจื˜ $B$ ืคื•ืจืฉืช ืืช $V$. ืื $B$ ืื™ื ื” ื‘ืชืดืœ ืื– ืœืคื™ ื˜ืขื ื” @s1 ืงื™ื™ื $b in B$ ื›ืš ืฉ-$b in span(B without {b})$ ื•ื ืงื‘ืœ $span(B without {b})=span(B)=V$ ื‘ืกืชื™ืจื” ืœืžื™ื ื™ืžืœื™ื•ืช ืฉืœ $B$. == ืžื™ืžื“ ื ื–ื›ื•ืจ ืฉื”ื’ื“ืจื ื• ืืช ื”ืžื™ืžื“ ืฉืœ ืžืดื• $V$ ื›ืขื•ืฆืžืช ื”ื‘ืกื™ืก ืฉืœื•: $dim(V) = abs(B)$ ($B$ ื‘ืกื™ืก ืฉืœ $V$). === (ื˜ืขื ื”) ื™ื”ื™ $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ืžืขืœ $F$ ืขื $dim(V)=n$. (1) ื›ืœ ืงื‘ืณ ื‘ืชืดืœ ื‘ืช $n$ ืื™ื‘ืจื™ื ื”ื™ื ื‘ืกื™ืก. (2) ื›ืœ ืงื‘ืณ ืคื•ืจืฉืช ื‘ืช $n$ ืื™ื‘ืจื™ื ื”ื™ื ื‘ืกื™ืก. ==== ื”ื•ื›ื—ื” + ื‘ืงื‘ื•ืฆื” ื‘ืชืดืœ ืžืกืณ ื”ืื™ื‘ืจื™ื $>=$ ืžืžืกืณ ื”ืื™ื‘ืจื™ื ื‘ืงื‘ื•ืฆื” ืคื•ืจืฉืช. ื•ืœื›ืŸ ืงื‘ืณ ื‘ืชืดืœ ืฉื‘ื” $dim(V)$ ืื™ื‘ืจื™ื ื”ื™ื ืงื‘ืณ ื‘ืชืดืœ ืžืงืกื™ืžืœื™ืช, ืœื›ืŸ ื‘ืกื™ืก. + ื‘ืงื‘ื•ืฆื” ืคื•ืจืฉืช ืžืกืณ ื”ืื™ื‘ืจื™ื $<=$ ืžืžืกืณ ื”ืื™ื‘ืจื™ื ื‘ืงื‘ื•ืฆื” ื‘ืชืดืœ. ื•ืœื›ืŸ ืงื‘ืณ ืคื•ืจืฉืช ืฉื‘ื” $dim(V)$ ืื™ื‘ืจื™ื ื”ื™ื ืคื•ืจืฉืช ืžื™ื ื™ืžืœื™ืช, ืœื›ืŸ ื‘ืกื™ืก. #QED === (ื˜ืขื ื”) ื™ื”ื™ $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ื•ืชื”ื™ $H=(u_1, dots, u_m)$ ืงื‘ืณ ื‘ืชืดืœ. ืื–ื™ ื ื™ืชืŸ ืœื”ืจื—ื™ื‘ ืืช $H$ ืœื‘ืกื™ืก ืฉืœ $V$, ื›ืœื•ืžืจ ืงื™ื™ื ื‘ืกื™ืก $B$ ืฉืœ $V$ ื›ืš ืฉ-$H seq B$ <s2> ==== ื”ื•ื›ื—ื” ื‘ืื™ื ื“ื•ืงืฆื™ื” ืขืœ $dim(V) - m$. ื ืฉื™ื ืœื‘ ืฉื”ื™ื•ืช ื•-$H$ ื‘ืชืดืœ ื‘ื”ื›ืจื— ืžืกืณ ื”ืื™ื‘ืจื™ื ื‘-$H$ $>=$ ืžืกืณ ื”ืื™ื‘ืจื™ื ื‘ืงื‘ืณ ืคื•ืจืฉืช. - *ื‘ืกื™ืก ื”ืื™ื ื“ื•ืงืฆื™ื”* - $dim(V)-m=0$ ื‘ืžืงืจื” ื”ื–ื”, ื™ืฉื ื” ืงื‘ืณ ื‘ืชืดืœ ืžืงืกื™ืžืœื™ืช (ื‘ืช $dim(V)$ ืื™ื‘ืจื™ื) ื•ื”ื™ื ื‘ื”ื›ืจื— ื‘ืกื™ืก. - *ืฆืขื“ ื”ืื™ื ื“ื•ืงืฆื™ื”* - $dim(V)-m>=1$ $H$ ื‘ื”ื›ืจื— ืื™ื ื” ืคื•ืจืฉืช ืืช $V$ ื”ืจื™ ืฉืื– ื”ื™ื™ื ื• ืžืงื‘ืœื™ื ืงื‘ืณ ืคื•ืจืฉืช ืฉื‘ื” ืคื—ื•ืช ืž-$dim(V)$ ืื™ื‘ืจื™ื. ื›ืœื•ืžืจ ืงื™ื™ื $v in.not span(H)$ ื•ืื– $H uu {v}$ ื‘ืชืดืœ ื‘ืช $m+1$ ืื™ื‘ืจื™ื. ื ืคืขื™ืœ ืขืœื™ื” ืืช ื”ื ื—ืช ื”ืื™ื ื“ื•ืงืฆื™ื” ื›ืืฉืจ $dim(V)-(m+1)$ ื•ื ืงื‘ืœ ืฉื ื™ืชืŸ ืœื”ืจื—ื™ื‘ ืืช $H uu {v}$ ืœื‘ืกื™ืก. #QED === (ื˜ืขื ื”) ื™ื”ื™ $V$ ืžืดื• ื ื•ืฆืจ ืกื•ืคื™ืช ืžืขืœ $F$, ื•ืชื”ื™ $H=(u_1, dots, u_m)$ ืงื‘ืณ ืคื•ืจืฉืช. ืื–ื™ ื ื™ืชืŸ ืœืฆืžืฆื ืืช $H$ ืœื‘ืกื™ืก ืฉืœ $V$, ื›ืœื•ืžืจ ืงื™ื™ื ืœ-$V$ ื‘ืกื™ืก $B$ ื›ืš ืฉ-$B seq H$ ==== ื”ื•ื›ื—ื” ื‘ืื™ื ื“ื•ืงืฆื™ื” ืขืœ $m-dim(V)$. - *ื‘ืกื™ืก ื”ืื™ื ื“ื•ืงืฆื™ื”* - $m-dim(V)=0$ ื›ืืŸ $H$ ืงื‘ืณ ืคื•ืจืฉืช ืžื™ื ื™ืžืœื™ืช ืฉื‘ื” $dim(V)$ ืื™ื‘ืจื™ื, ื•ืœื›ืŸ ื”ื™ื ื‘ื”ื›ืจื— ื‘ืกื™ืก. - *ืฆืขื“ ื”ืื™ื ื“ื•ืงืฆื™ื”* ื›ืืฉืจ $H$ ืงื‘ืณ ืฉื‘ื” ื™ื•ืชืจ ืž-$dim(V)$ ืื™ื‘ืจื™ื, ื”ื™ื ื‘ื”ื›ืจื— ืชืดืœ ื›ื™ ื”ื™ื ืžื›ื™ืœื” ื™ื•ืชืจ ืื™ื‘ืจื™ื ืžืงื‘ืณ ืคื•ืจืฉืช. ืž-@s2 ืงื™ื™ื ืื™ื‘ืจ ื‘-$H$ ืฉื”ื•ื ืฆืดืœ ืฉืœ ื”ืื—ืจื™ื, ื‘ื”ืดื› ื ื ื™ื— ืฉื–ื”ื• $u_m$. ื ืงื‘ืœ $V= span{u_1, dots, u_m} = span {u_1, dots, u_m}$ ื›ืืฉืจ $u_m = sum_(k=1)^(m-1) lambda_k u_k$. ืงื™ื‘ืœื ื• ืงื‘ืณ ื‘ืช $m-1$ ืื™ื‘ืจื™ื ื•ืžื”ื ื—ืช ื”ืื™ื ื“ื•ืงืฆื™ื” ื ื™ืชืŸ ืœืฆืžืฆื ืื•ืชื” ืœื‘ืกื™ืก ืฉืœ $V$. #QED
https://github.com/ludwig-austermann/typst-din-5008-letter
https://raw.githubusercontent.com/ludwig-austermann/typst-din-5008-letter/main/lib/helpers.typ
typst
MIT License
#let default-font-handler(styling) = { let font-size = if styling.text-params.keys().contains("size") { if styling.text-params.size < 10pt { panic("The general font size should be at least 10pt!") } styling.text-params.size } else { styling.text-params.insert("size", 11pt) 11pt } if not styling.text-params.keys().contains("font") { styling.text-params.insert("font", "Source Sans Pro") } let lang = if styling.text-params.keys().contains("lang") { styling.text-params.lang } else { styling.text-params.insert("lang", "de") "de" } (font-size: font-size, lang: lang, styling: styling) } #let address-field(address-zone, return-information: [], styling: (:), debug-options: (show-block-frames: false, show-address-field-calculation: false)) = style(sty => { let half-height-seperator = styling.address-field-seperator-spacing / 2 let rรผcksendeangabe = text(styling.text-params.size - 2pt, return-information) let height-rรผcksendeangabe = measure(rรผcksendeangabe, sty).height + half-height-seperator let height-anschriftzone = measure(address-zone, sty).height + half-height-seperator if height-anschriftzone + height-rรผcksendeangabe > 45mm { panic("Anschriftzone + Rรผcksendeangabe have height > 45mm, consider a smaller font with Anschriftzone font >= 8pt and Rรผcksendeangabe font >= 6pt.") } let anschriftfeld-seperator = if height-rรผcksendeangabe > 17.7mm { height-rรผcksendeangabe } else if height-anschriftzone > 27.3mm { 45mm - height-anschriftzone } else { 17.7mm } block( width: 85mm, height: 45mm, clip: true, inset: (left: 5mm), stroke: if debug-options.show-block-frames { red } else { none }, { place(dy: anschriftfeld-seperator - height-rรผcksendeangabe, rรผcksendeangabe) place(dy: anschriftfeld-seperator + half-height-seperator, address-zone) if debug-options.show-address-field-calculation { place(dx: -3mm, dy: anschriftfeld-seperator - height-rรผcksendeangabe, line(length: height-rรผcksendeangabe, angle: 90deg)) place(dx: -4mm, dy: anschriftfeld-seperator - height-rรผcksendeangabe, line(length: 2mm)) place(dx: -4mm, dy: anschriftfeld-seperator - half-height-seperator, line(length: 2mm)) place(dx: -5mm, dy: anschriftfeld-seperator, line(length: 5mm)) place(dx: -2mm, dy: anschriftfeld-seperator, line(length: height-anschriftzone, angle: 90deg)) place(dx: -3mm, dy: anschriftfeld-seperator + half-height-seperator, line(length: 2mm)) place(dx: -3mm, dy: anschriftfeld-seperator + height-anschriftzone, line(length: 2mm)) place(dx: -5mm, dy: 17.7mm, line(stroke: red + 0.2pt, length: 5mm)) } } ) })
https://github.com/PgBiel/glypst
https://raw.githubusercontent.com/PgBiel/glypst/main/test/samples/import/imports.typ
typst
MIT License
#import "/import/imported.typ": x #assert(x == 5)
https://github.com/darrior/typst-mirea-template
https://raw.githubusercontent.com/darrior/typst-mirea-template/main/README.md
markdown
# typst-mirea-template Implementation of MIREA document template in Typst ## Usage ``` #show: project.with( title: "<name of project>", authors: ( "<NAME>", ), ) ``` For chapters without numbering you must use `#numberless` function: ``` #numberless[ะ’ะ’ะ•ะ”ะ•ะะ˜ะ•] ```
https://github.com/Jollywatt/typst-wordometer
https://raw.githubusercontent.com/Jollywatt/typst-wordometer/master/tests/concat-adjacent-text/test.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: 15cm, height: auto) #let c = [ Hello, what is your name? ].children #c #concat-adjacent-text(c) #let c = [ A want this to be separate. #[From this.] <some-label> Not this either. ].children #c #concat-adjacent-text(c)
https://github.com/bamiesking/bicop-2023
https://raw.githubusercontent.com/bamiesking/bicop-2023/main/main.typ
typst
#import "theme.typ": conf, author, primary, secondary // #show: doc => conf(title, authors, affiliations ) #set text(font: "Raleway", size: 20.5pt) #set par(leading: 0.5em) #show figure.caption: set text(font: "Lato", size: 17pt) #let authors = ( ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 2, ), ( "name": "<NAME>", "affiliations": 2, ), ( "name": "<NAME>", "affiliations": 2, ), ( "name": "<NAME>", "affiliations": 2, ), ( "name": "<NAME>", "affiliations": (1, 3), ), ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 1, ), ( "name": "<NAME>", "affiliations": 1, ) ) #let affiliations = ( "University of York; York YO10 5FT, UK", "euNetworks Fiber UK Limited; London E14 5HU, UK", "Cyprus University of Technology; Limassol 3036, Cyprus", ) #let footer = align(bottom)[ #block(height: 2cm, fill: primary, inset: (x: 1cm))[ #set align(horizon) #set text(fill: white, size: 21.2pt, font: "Lato", weight: "bold") #stack( dir: ltr, block(width: 33%)[ #set align(left) doi: 10.3390/e25121572 ], block(width: 34%)[ #set align(center) Optica BICOP ], block(width: 33%)[ #set align(right) 13-15th December 2023 ], )] ] #set page( paper: "a1", number-align: center, margin: (x: 0cm, y: 0cm), footer: footer ); #block(height: 11cm, width: 100%, inset: 4pt, fill: primary, radius: (bottom-left: 2cm), spacing: 0cm, stroke: primary)[ #set block(width: 100%, height: 100%, inset: 4pt); #stack(dir: ltr, block(width: 2%), block(width: 25%)[ #set align(center + horizon); #stack(dir: ttb, block(height: 1cm), image("images/UOY_Logo.png", width: 16.6cm), block(height: 0.5cm), stack(dir: ltr, image("images/QCHub_Logo.png", width: 6.5cm), block(width: 1cm), align(right)[ #image("images/euNetworks_logo.svg", width: 6.5cm) ] ), block(height: 2cm) ) ], block(width: 5%), block(width: 65%)[ #set align(center + horizon) #stack(dir: ttb, block(height: 50%)[ #set text(fill: white, size: 40pt, weight: "bold") Feasibility of quantum communications between the UK and Ireland via 224~km of underwater fibre ], block(height: 30%)[ #stack(dir: ltr, block(width: 2cm), block(width: 58%)[ #set text(fill: white, size: 17pt) #for (i, a) in authors.enumerate() { box(width: auto, height: auto, inset: 0pt)[ #author(a.name, a.affiliations, bold: i == 0) #if i + 1 < authors.len() { "," h(0.5cm) } ] } ], block(width: 3%), block(width: 50%)[ #set text(fill: white, size: 17pt) #set align(left) #for (i, a) in affiliations.enumerate(start: 1) { super(str(i)) h(0.5cm) a linebreak() } ]) ] ) ]) ] #let heading(title) = { text(size: 28pt, fill: primary, weight: "bold")[#title] linebreak() line(length: 100%) } #let section(title, content) = { block(width: auto, height: auto)[ #heading(title) #set align(left) #par(justify: true)[ #content ] ] } #block(height: 80%, width: 100%, fill: primary, inset: 0cm, spacing: -1cm, radius: (top-left: 2cm))[ #block(height: 101%, width: 100%, radius: (top-right: 2cm), fill: white, inset: (y: 2cm), spacing: 0cm, outset: 0cm)[ #align(left)[ #block(width: 100%, height: auto)[ #set align(center + horizon); #stack(dir: ltr, block(width: 10%), block(width: 80%, fill: secondary, inset: 1cm)[ #section("Abstract")[ #set text(size: 21pt) The future of quantum key distribution (QKD) is contingent on its ability to utilise the existing fibre infrastructure that makes up the global Internet. In this work, we explore the feasibility of quantum communications over 224~km of submarine fibre between the UK and Ireland. We characterise differential phase drift, polarisation stability and entangled photon arrival times to demonstrate the suitability of this fibre for several common implementations of QKD. ] ], block(width: 10%, height: auto)[ #set align(center) #image("images/qr.png", width: 70%) ] ) ] ] #align(center)[ #block(width: 90%, height: 100%, inset: 1cm)[ #stack(dir: ltr, block(width: 50%)[ #section("Introduction")[ Quantum key distribution (QKD)@bennett_quantum_2014 offers information-theoretically secure communications against any eavesdropper, regardless of their computational capability. QKD is one of the most mature quantum technologies@peev_SECOQC_2009 @wengerowsky_entanglement_2019 and several protocols have already seen commercial implementations. In this work, we explore the suitability for QKD of euNetworks' 'Rockabill' link, which is a 224~km submarine fibre running between Portrane in the Republic of Ireland and Southport in the United Kingdom. We consider optical phase, polarisation, and entangled photons to provide a broad view of the feasibility of future deployments of QKD. ] #v(1cm) #block(width: auto, height: auto, fill: secondary, outset: 0.5cm)[ #section("Key objectives")[ #set align(left) #list( [Characterising phase and polarisation stability of long-haul submarine fibre.], [Emulating decoy-state BB84 with polarisation encoding.], [Detecting coincident photons from an entangled photon source after traversing the channel.] ) ] ] #v(1cm) #section("Methods")[ We designed compact and robust rack-mount modules to enable measurement of differential phase drift between a pair of fibres, long-term polarisation drift over the course of 14 hours, and polarisation quantum bit error rate (QBER) measurements for various decoy-state intensities at the single photon level. We also deployed a compact, commercial source of entangled photon pairs (OZ Optics Ruby) with the aim of testing the feasibility of entanglement distribution over the link. Schematics and detailed descriptions of the experiments are given in @amies-king_quantum_2023. #figure( image("images/map.png"), caption: [ Subfigures *a* and *b* show the Rockabill link between Portrane, IE and Southport, UK. Subfigures *c*-*e* show the experimental subsystems for differential phase, polarisation, and coincident pair measurements respectively. ] ) The high optical loss of a long single-hop submarine link, even one consisting of cutting-edge ultra-low-loss fibre, meant that a high-performance single photon detector was required to enable a launch power at the quantum level. To achieve this, we deployed our superconducting nanowire single-photon detector (SNSPD) system (IDQuantique ID281) in the Southport CLS. Each SNSPD channel has dark counts of around 50~Hz, with detection efficiency of \~90%. ] #v(1%) ], block(width: 3%), block(width: 50%)[ #section("Results")[ The results of the experiments showed that the 'Rockabill' link is a suitable link for implementing quantum communications between the mainland UK and Ireland. Firstly, low differential phase noise indicates good isolation from the environment, and residual phase characteristics are well within that which can be compensated with existing hardware or software techniques. #figure( image("plots/psd.png"), caption: [ Subplot *a* shows the power spectral density (PSD) of the channel phase drift (blue, upper line) and detector noise (orange, lower line). Subplot *b* shows the horizontal and vertical polarisation components of channel polarisation drift over \~14~h. ] ) Secondly, we observed very good polarisation stability over the course of 14 hours, and extrapolated a positive secret key rate (SKR) from our decoy-state polarisation-encoded BB84 emulation, indicating feasibility for polarisation-based QKD. However, our simulation showed us as being at the upper limits of tolerable loss, and so further optimisations may be required for a full QKD deployment. #figure( image("plots/sim.png"), caption: [ Simulated (blue line) and emulated (green diamond) key rates. #let spacing = 0.4em Simulation parameters: detection efficiency #h(spacing, weak: true) $eta_"det"$, #h(spacing, weak: true) receiver efficiency #h(spacing, weak: true) $eta _"rec"$, #h(spacing, weak: true) dark counts #h(spacing, weak: true) $p_"dark"$, #h(spacing, weak: true) background photons from the channel #h(spacing, weak: true) $p_"stray"$, #h(spacing, weak: true) optical noise #h(spacing, weak: true) $e_"opt"$, #h(spacing, weak: true) mean photon number #h(spacing, weak: true) $mu$, #h(spacing, weak: true) clock rate of the simulated system #h(spacing, weak: true) $f_"clock"$. ] ) As other fibres in the bundle are in active use by commercial entities, a high level of crosstalk-induced noise was present in the channels under test. In spite of this, we observed coincident single photon detections between the two channels indicating the arrival of pairs from the entangled photon source, with a coincidence to accidental ratio (CAR) of 1.92. ] #v(1cm) #block(width: auto, height: auto, fill: secondary, outset: 0.5cm)[ #section("Summary")[ We demonstrated the promising phase and polarisation stability of the Rockabill link, and emulated the performance of decoy-state BB84 with polarisation encoding in which a positive secret key rate was obtained. Furthermore, we demonstrated coincidence counts from an entangled photon source transmitted over the submarine link. ] ] #v(1cm) #section("References")[ #block()[ #set align(left) #set block(spacing: 0.6em) #bibliography("BICOP 2023.bib", title: none, style: "ieee-cite-collapse.csl") ] ] ]) ] ] ] ]
https://github.com/jcbhmr/typst.deb
https://raw.githubusercontent.com/jcbhmr/typst.deb/main/README.md
markdown
Apache License 2.0
# typst.deb ๐Ÿ”ด Typst packaged for Debian
https://github.com/jamesrswift/blog
https://raw.githubusercontent.com/jamesrswift/blog/main/assets/packages/booktabs/footnotes.typ
typst
MIT License
// I want my argument names to be intuitive, but these sometimes shadow // important functions, so lets copy them first. #let std-state = state #let std-numbering = numbering #let state = std-state("__booktabs:footnote", ()) #let numbering = std-state("__booktabs:numbering", "a") #let clear() = state.update(()) #let set-numbering(new) = numbering.update(new) #let make-numbering() = context std-numbering(numbering.get(), state.get().len() + 1) #let make( body) = { h(0em, weak: true) + sym.space.narrow + super(make-numbering()) state.update(it=>{it.push(body);it}) } #let display-numbering(key) = super(context std-numbering(numbering.get(), key + 1)) #let display = context { grid( columns: (auto, 1fr), inset: 0.15em, ..(for (key, value) in state.get().enumerate() { (display-numbering(key), value) }) ) } + clear() #let display-list = context { state.get() .enumerate() .map( ((key, value)) => box[#display-numbering(key) #value]) .join(", ", last: ", and ") } #let display-style(notes) = { v(-0.5em) set text(0.888em) set block(spacing: 0.5em) set par(leading: 0.5em) align(start, notes) }
https://github.com/tony-rsa/thonifho.muhali.cv
https://raw.githubusercontent.com/tony-rsa/thonifho.muhali.cv/main/src/sections/en/experience.typ
typst
MIT License
#import "../../template.typ": * #cvSection("Experience") #cvEntry( title: [Cloud Software Engineer (Python/Rust/SQL)], host: [#link("https://github.com/Stabl-Energy")[#gh #hSpc() STABL Energy] #hDot() Part-time], date: [January โ€” March 2023 (3 months)], mode: [Munich, Germany #hDot() Hybrid], logo: "assets/logos/stb.png", desc: list( marker: [โžค], [Set up automatic generation of custom Grafana dashboards.], [Created a Rust client for sending log streams to Grafana Loki.], [Migrated +20 GiB of IoT sensor data from AWS Timestream to InfluxDB.], [Configured custom CI pipelines for testing and linting Python and Rust codebases.], [Flashed +10 ESP32-S2 edge devices using the in-house bootstrap software and CP210x driver.], [Constructed efficient FluxQL queries for automatic cleanup, backup and recovery of InfluxDB data.], ), ) #cvEntry( title: [Deep Learning Engineer (Python/C++/CUDA)], host: [#link("https://github.com/phygitalism")[#gh #hSpc() Phygitalism] #hDot() Full-time], date: [October 2021 โ€” April 2022 (7 months)], mode: [Moscow, Russia #hDot() Hybrid], logo: "assets/logos/phy.png", desc: list( marker: [โžค], [Adapted and deployed RIFE and AdaAttN models as web services using Docker and RabbitMQ.], [Compared neural and differentiable renderers and wrote blog posts reviewing the recent papers.], [Implemented a point cloud boundary detection algorithm from a scientific publication in Python.], [Performed pre-processing, analysis and visualization of point cloud data from road LIDAR scans.], [Tested the NeRF model from the InstantNGP project and contributed with a Dev Container setup.], [Contributed to a data processing pipeline for training the Point Transformer model on road signs.], [Developed a mesh reconstruction pipeline for in-door point cloud scans with the CGAL C++ library.], ), )
https://github.com/rem3-1415926/Typst_Thesis_Template
https://raw.githubusercontent.com/rem3-1415926/Typst_Thesis_Template/main/sec/abstract.typ
typst
MIT License
#let abstract = [ = Abstract In this thesis, an ancient scripture was discovered. It reads as follows: #lorem(300) It could not be deciphered in any way and this thesis is therefore utterly pointless. ]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/emoji-01.typ
typst
Other
// These two shouldn't be affected by a zero-width joiner. ๐Ÿžโ€๐ŸŒ‹
https://github.com/saecki/zig-grep
https://raw.githubusercontent.com/saecki/zig-grep/main/paper/slides-template.typ
typst
#import "@preview/polylux:0.3.1": * #import "@preview/codelst:2.0.0": sourcecode, code-frame #let font_name = "JetbrainsMono NF" #let slide-colors = state("slide-colors", (:)) #let slide-short-title = state("slide-short-title", none) #let slide-short-author = state("slide-short-author", none) #let slide-short-date = state("slide-short-date", none) #let slide-progress-bar = state("slide-progress-bar", true) #let project( aspect-ratio: "16-9", short-title: none, short-author: none, short-date: none, bg-color: color, primary-color: color, primary-dimmed-color: color, footer-a-color: color, footer-b-color: color, progress-bar: true, body ) = { set page( paper: "presentation-" + aspect-ratio, fill: bg-color, margin: 0em, header: none, footer: none, ) set text( fill: rgb("#c0c0b0"), size: 25pt, font: font_name, features: (calt: 0), lang: "en", ) show footnote.entry: set text(size: .6em) slide-progress-bar.update(progress-bar) slide-colors.update(( bg: bg-color, primary: primary-color, primary-dimmed: primary-dimmed-color, footer-a: footer-a-color, footer-b: footer-b-color, )) slide-short-title.update(short-title) slide-short-author.update(short-author) slide-short-date.update(short-date) // Prettier raw text show raw.where(lang: none, block: false): r => { // -- blue highlighted -- let words = r.text.split(" ") for (idx, word) in words.enumerate() { let w-radius = if words.len() == 1 { 3pt } else if idx == 0 { (left: 3pt) } else if idx == words.len() - 1 { (right: 3pt) } else { 0pt } box( fill: rgb("#34364a"), outset: (y: 3pt), inset: (x: 2pt, y: 1pt), radius: w-radius, text(fill: rgb("#a0c0ff"), word), ) } // -- bold -- // text(weight: "bold", r.text) // -- quoted -- // quote(r.text) } body } #let title-slide( title: [], subtitle: none, authors: (), institution-name: "University", date: none, logo: none, ) = { let authors = if type(authors) == "array" { authors } else { (authors,) } let content = locate( loc => { let colors = slide-colors.at(loc) if logo != none { align(right, logo) } align(center + horizon, { block( inset: 0em, breakable: false, { text(size: 2em, fill: colors.primary, strong(title)) if subtitle != none { parbreak() text(size: 1.2em, fill: colors.primary.desaturate(30%).darken(15%), subtitle) } } ) set text(size: .8em) grid( columns: (1fr,) * calc.min(authors.len(), 3), column-gutter: 1em, row-gutter: 1em, ..authors.map(author => text(author)) ) v(1em) if institution-name != none { parbreak() text(size: .9em, institution-name) } if date != none { parbreak() text(size: .8em, date) } }) }) logic.polylux-slide(content) } #let slide( title: none, header: none, footer: none, new-section: none, body ) = { let body = pad(x: 2em, y: .5em, body) let progress-barline = locate( loc => { if slide-progress-bar.at(loc) { let cell = block.with( width: 100%, height: 100%, above: 0pt, below: 0pt, breakable: false ) let colors = slide-colors.at(loc) utils.polylux-progress( ratio => { grid( rows: 2pt, columns: (ratio * 100%, 1fr), cell(fill: colors.primary), cell(fill: colors.primary-dimmed) ) }) } else { [] } }) let header-text = { if header != none { header } else if title != none { if new-section != none { utils.register-section(new-section) } locate( loc => { let colors = slide-colors.at(loc) block(inset: (x: .8em), grid( columns: (60%, 40%), align(top + left, heading(level: 2, text(fill: colors.primary, title))), align(top + right, text(fill: colors.primary.desaturate(50%).darken(20%), utils.current-section)) )) }) } else { [] } } let header = { set align(top) grid(rows: (auto, auto), row-gutter: 3mm, progress-barline, header-text) } set page( margin: ( top: 2em, bottom: 1em, x: 0em ), header: header, footer-descent: 0em, header-ascent: .6em, ) logic.polylux-slide[ #align(horizon, body) ] } #let focus-slide( background-color: color, background-img: none, new-section: none, body, ) = { let background-color = if background-img == none and background-color == none { rgb("#0C6291") } else { background-color } set page(fill: background-color, margin: 1em) if background-color != none set page( background: { set image(fit: "stretch", width: 100%, height: 100%) background-img }, margin: 1em, ) if background-img != none set text(size: 2em) logic.polylux-slide(align(horizon, body)) if new-section != none { utils.register-section(new-section) } } #let code-space() = { v(0fr) v(0.41em) } #let dimmed-code(code) = { show raw.where(block: true): r => { text(size: 16pt, font: font_name, fill: rgb("#484848"), r.text) } code-space() code } #let code(code) = { set raw(theme: "Catppuccin-macchiato.tmTheme") show raw.where(block: true): r => { text(size: 16pt, font: font_name, fill: rgb("#f8eddd"), r) } code-space() code } #let walk-through-slides( title: str, code-parts: ([]), highlighted-parts: (), ) = { for hl in highlighted-parts { slide(title: title)[ #for (idx, part) in code-parts.enumerate() { if hl.contains(idx) { code(part) } else { dimmed-code(part) } } ] } }