repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/antonWetzel/prettypst
https://raw.githubusercontent.com/antonWetzel/prettypst/master/changelog.md
markdown
MIT License
# Changelog ## 2024.10.20 - Update dependencies ## 2024.09.29 - **Fix** | Higher priority for labels to fix labels for headings - Update tests ## 2024.07.29 - **ADD** | Only format label in Markup - Update tests ## 2024.06.24 - **ADD** | Better formatting for `(grid|table).(cell|header|footer)` - Update tests ## 2024.05.21 - **CHANGE** | Ignore trailing comma only in **arrays** with one item - Add some tests - Update **typst-syntax** ## 2023.12.06 | Update 1.1 - **BREAKING** | change settings to `kabab-case` - **ADD** | setting for methods, which arguments are formatted as columns - add `[columns-commands]` section - use `<method-name> = "<argument-name>` - ```toml [columns-commands] grid = "columns" gridx = "columns" table = "columns" tablex = "columns" ``` - `<argument-name>`, is the name of the named argument, where the column count is specified - **ADD** | setting for padding around `,` in arguments - ```toml [comma] space-before = false space-after = true ``` ## 2023.11.21 | Release
https://github.com/Lucas-Wye/tech-note
https://raw.githubusercontent.com/Lucas-Wye/tech-note/main/src/Tmux.typ
typst
= tmux #label("tmux") - tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权 - 使用它最直观的好处就是,通过一个终端登录远程主机并运行tmux后,在其中可以开启多个控制台而无需再“浪费”多余的终端来连接这台远程主机 == Install #label("install") ```sh # Ubuntu sudo apt-get install tmux # MacOS brew install tmux ``` == 基本操作 #label("基本操作") ```sh tmux # 新建一个无名称的会话 tmux new -s demo # 新建一个名称为demo的会话 # 进入之前会话 tmux a # 默认进入第一个会话 tmux a -t demo # 进入到名称为demo的会话 # 离开会话 [PREFIX] d # 关闭会话 tmux kill-session -t demo # 关闭demo会话 tmux kill-server # 关闭服务器,所有的会话都将关闭 # 查看会话 tmux list-session # 查看所有会话 tmux ls # 查看所有会话,提倡使用简写形式 # 滚屏/cope mode [PREFIX] [ # 设置滚屏vi快捷键 echo "setw -g mode-keys vi" > ~/.tmux.conf tmux source-file ~/.tmux.conf # copy [PREFIX] [ -> [Space] -> Select -> [Enter] # paste [PREFIX] ] # 新建窗口 [PREFIX] c # 切换窗口 [PREFIX] n # 切换pane [PREFIX] Up|Down|Left|Right # 垂直分屏 [PREFIX] % # 水平分屏 [PREFIX] " ``` == 用户共享 The first user should run: ```sh tmux -S /tmp/shared new-session -s shared chmod 777 /tmp/shared ``` The second user: ```sh tmux -S /tmp/shared attach-session -t shared ``` == More #label("more") #link("http://louiszhai.github.io/2017/09/30/tmux/")[tmux使用手册]
https://github.com/OverflowCat/BUAA-Data-and-Error-Analysis-Sp2024
https://raw.githubusercontent.com/OverflowCat/BUAA-Data-and-Error-Analysis-Sp2024/neko/5-regression/helper.typ
typst
#let hr = line(stroke: black.lighten(70%), length: 100%) #let c = x => calc.round(x, digits: 3)
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/stroke_05.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 29-56 unexpected key "thicknes", valid keys are "paint", "thickness", "cap", "join", "dash", and "miter-limit" // #line(length: 60pt, stroke: (paint: red, thicknes: 1pt))
https://github.com/kimushun1101/rengo2024-typst
https://raw.githubusercontent.com/kimushun1101/rengo2024-typst/main/README-en.md
markdown
MIT No Attribution
# rengo2024-typst This is a template for writing the manuscript of the 67th Japan Joint Automatic Control Conference Proceedings in Typst. For an overview of Typst, please click https://typst.app/docs/tutorial/writing-in-typst/. | Files | Description | | ------------- | ------------------------------------------- | | sample-en.typ | Source code of the template in Typst | | fig1.svg  | Sample figure | | refs.yml  | Reference list in YAML format | | refs.bib  | Reference list in BiBTeX format | | libs/rengo-en/lib.typ | Style file of the manuscript | | libs/rengo-en/rengo.csl | Style file of the reference list | `sample.typ` and `libs/rengo` are template files for Japanese manuscripts. ## How to use it The latest version of this template is available on [GitHub Releases page](https://github.com/kimushun1101/rengo2024-typst/releases/latest). If you are familiar with GitHub, you can use `git clone`, `use this template`, and so on. ### On VS Code 1. Install [VS Code](https://code.visualstudio.com/). 2. Open this folder with `File`→`Open Folder` on VS Code. 3. Install [Tinymist Typst](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) Extension. 4. Open `main.typ` from Explorer (`Ctrl` + `Shift` + `E`) 5. Check the Preview (`Ctrl` + `K` and then `V`) 6. Save the file (`Ctrl` + `S`) and PDF file will be exported. ### On the official Web App 1. Make your account on https://typst.app/. 2. Start a new project from `New project` or `Empty document`. 3. Open `Explorer files` tab, and `libs/rengo-en` folder from `Create a new folder`, and then upload `libs/rengo-en/lib.typ` and `libs/rengo-en/rengo.csl`. 4. Upload `sample-en.typ`, `fig1.svg`, and `refs.yml`. 5. Select `sample-en.typ` and it will be compiled. ### The others On the other editors, similar extensions may be provided. It can also be compiled via the command line interface (CLI). ``` typst compile sample.typ ``` For CLI installation, see https://github.com/typst/typst?tab=readme-ov-file#installation. ## License Typst files : MIT No Attribution CSL files : Creative Commons Attribution-ShareAlike 3.0 License
https://github.com/HULKs/rust-introduction
https://raw.githubusercontent.com/HULKs/rust-introduction/main/slides/slides.typ
typst
#import "theme.typ": * #show: workshop-theme.with( footer: [Rust Introduction], ) #title-slide( title: [Rust Introduction], author: [<NAME>], ) #slide(title: "Rust Introduction")[ Learning Rust in sessions implementing a simple red ball detection. #grid( columns: (25%, 1fr), column-gutter: 10pt, [ #set align(top) #set text(size: 18pt) = Agenda - Basics - Structs - Enums - Pattern Matching - Error Handling - Collections - Ownership - Testing - Crates ], [ #set align(top) #set text(size: 18pt) = Setup Steps This guide is for Arch Linux / Manjaro. If you are using another distribution, ask us or try to adapt yourself. - Install rustup: https://rustup.rs or `yay -S rustup` - Download stable toolchain: `rustup install stable` - Ensure `cargo --version` is successful If you are using Visual Studio Code, follow these steps: - In the left pane, select _Extensions_ - Search and install the `rust-analyzer` extension ], ) ] #slide(title: "What is Rust?")[ #grid( columns: (80%, 25%), [ - *Statically typed:* All types are known at compile time. - *Strongly typed:* Compiler checks for type safety. - *Memory safe:* No dangling pointers, no buffer overflows. #v(1em) *Hello World Example:* ```rust fn main() { println!("Hello, world!"); } ``` ], [ #figure( image( width: 90%, "Rust_programming_language_black_logo.svg" ) ) // https://upload.wikimedia.org/wikipedia/commons/d/d5/Rust_programming_language_black_logo.svg ], ) ] #slide(title: "Variables")[ ```rust let value = 42; ``` - *Integral:* ```rust i8```, ```rust u8```, ```rust i16```, ```rust u16```, ```rust i32```, ```rust u32```, ```rust i64```, ```rust u64```, ```rust isize```, ```rust usize``` - *Floating point:* ```rust f32```, ```rust f64``` - *Boolean:* ```rust bool``` - *Strings:* ```rust &str```, ```rust String``` - *Arrays:* ```rust [u32; 42]``` represents 42x ```rust u32``` items, zero indexed - *Empty Type:* ```rust ()``` - Slices, `HashMap`, `Vec`, ... ] #slide(title: "Control Flow")[ #list( [ *Conditionals:* ```rust if```, ```rust else```, ```rust match``` ], [ *Loops:* ```rust while```, ```rust for```, ```rust loop``` ], ) No parantheses around predicates: ```rust if x == 42 { ... }``` Logic operators: ```rust &&```, ```rust ||```, ```rust !``` Expressions evaluate to a value and can therefore be assigned to a variable: ```rust let x = if condition { 42 } else { 1337 };``` ] #slide(title: "Functions")[ ```rust fn add(x: u32, y: u32) -> u32 { x + y } ``` #pause #v(30pt) ```rust fn absolute_value(x: f64) -> f64 { if x < 0.0 { return -x; } x } ``` ] #slide(title: "Printing")[ ```rust println!("Hello, world!"); // Hello, world! let x = 42; println!("The answer is {x}"); // The answer is 42 let y = 1337; dbg!(y); // [src/main.rs:5] y = 1337 ``` ] #slide(title: "Task 1: Hello World and Functions")[ + Create a new project with `cargo new hello_world` + Inspect the directory structure (e.g. `src/main.rs`) + Run the project with `cargo run` + Add a function ```rust fn is_red(red_intensity: f64) -> bool``` + In the ```rust main()``` function: - Create a variable ```rust red_intensity``` containing a literal value $in [0, 1]$ - Determine whether the color is red using ```rust is_red()``` - Add an ```rust if``` statement to print whether the color is red or not ] #slide(title: "Mutability")[ #set text(size: 21pt) ```rust let immutable_value = 42; ``` #uncover("2-")[ ```rust // --------------- // | // first assignment to `immutable_value` // help: consider making this binding mutable: `mut immutable_value` ``` ] ```rust immutable_value = 1337; ``` #uncover("2-")[ ```rust // ^^^^^^ error: cannot assign twice to immutable variable ``` ] #v(30pt) #uncover("3-")[ ```rust let mut mutable_value = 42; mutable_value = 1337; ``` ] ] #slide(title: "Tuples")[ Tuple is a fixed size collection of values. ```rust (f64, bool, &str)``` is a 3-tuple ```rust let tuple = (1.0, true, "HULKs");``` Access fields with ```rust tuple.0```, ```rust tuple.1```, ```rust tuple.2``` ] #slide(title: "Structs")[ ```rust struct ComplexNumber { real: f64, imaginary: f64, } ``` #pause No inheritance, use composition instead. #pause Instantiate structs with: ```rust let complex_number = ComplexNumber { real: 1.0, imaginary: 2.0, }; ``` ] #slide(title: "Struct Implementations")[ #set text(size: 21pt) ```rust impl ComplexNumber { ``` #uncover("2-")[ ```rust fn zero() -> Self { Self { real: 0.0, imaginary: 0.0 } } fn norm(self) -> f64 { self.real.abs() + self.imaginary.abs() } ``` ] ```rust } ``` #uncover("3-")[ Call a method with: ```rust let complex_number = ComplexNumber::zero(); let norm = complex_number.norm(); ``` ] ] #slide(title: "Traits")[ Traits define shared behavior, like interfaces in other languages. #text(size: 21pt)[ ```rust trait MyAdd { fn my_add(self, other: Self) -> Self; } ``` ] #pause Traits can be implemented by other types: #text(size: 21pt)[ ```rust impl MyAdd for ComplexNumber { fn my_add(self, other: Self) -> Self { Self { real: self.real + other.real, imaginary: self.imaginary + other.imaginary, } } } ``` ] ] #slide(title: "Task 2: Structs")[ + Add ```rust struct PixelColor``` which holds three ```rust f64``` RGB color fields + Add two constructors in ```rust impl PixelColor```: - ```rust fn black() -> Self``` - ```rust fn new(red: f64, green: f64, blue: f64) -> Self``` + Add ```rust fn is_red(self) -> bool``` to ```rust impl PixelColor``` + Create two variables ```rust red_pixel``` and ```rust black_pixel``` + Use ```rust pixel.is_red()``` instead of ```rust is_red()``` + Fix all warnings by cleaning up your code ] #slide(title: "Enums")[ Enums are variants, more powerful than C++ enums. #only("1")[ #text(size: 21pt)[ ```rust enum Number { Real, Complex, NotANumber, } ``` ] ] #only("2-")[ #text(size: 21pt)[ ```rust enum Number { Real(f64), Complex{real: f64, imaginary: f64}, NotANumber, } ``` ] ] #uncover("3-")[ Instantiate enums with: #text(size: 21pt)[ ```rust let real_number = Number::Real(42.0); let complex_number = Number::Complex { real: 42.0, imaginary: 1337.0 }; let not_a_number = Number::NotANumber; ``` ] ] ] #slide(title: "Pattern Matching")[ // https://www.sheshbabu.com/images/2020-rust-for-javascript-developers-4/pattern-matching-rust-1.png // https://www.sheshbabu.com/images/2020-rust-for-javascript-developers-4/pattern-matching-rust-2.png #set text(size: 15pt) #show figure.caption: body => text(fill: gray, body) #figure( image("pattern-matching.png"), gap: 1em, caption: [https://www.sheshbabu.com/posts/rust-for-javascript-developers-pattern-matching-and-enums/], ) ] #slide(title: "Pattern Matching")[ #set text(size: 16pt) ```rust let number = Number::Real(42.0); match number { Number::Real(real) => println!("Real part: {real}"), // Binds `real` _ => println!("Something else"), } ``` #pause ```rust let norm = match number { Number::Real(real) => real.abs(), // Binds `real` Number::Complex{real: r, imaginary: i} => r.abs() + i.abs(), // Binds `real` to `r` and // `imaginary` to `i` Number::NotANumber => f64::NAN, }; ``` #pause ```rust if let Number::Real(real) = number { // Binds `real` println!("Real part: {real}"); } ``` #pause ```rust let my_value = true; match my_value { true => println!("Boolean value is true"), false => println!("Boolean value is false"), } ``` ] #slide(title: "Task 3: Enums and Pattern Matching")[ + Convert ```rust struct PixelColor``` into ```rust enum PixelColor``` with two variants: - ```rust Black``` - ```rust Custom { red: f64, green: f64, blue: f64 }``` + Refactor constructors to generate enum variants + Use pattern matching inside ```rust is_red()``` ] #slide(title: "Option")[ ```rust // part of std library enum Option<Value> { Some(Value), None, } let something = Some(42); let nothing = None; ``` No ```rust Option::``` prefix needed ] #slide(title: "Result")[ ```rust // part of std library enum Result<Value, Error> { Ok(Value), Err(Error), } let success = Ok(42); let failure = Err("no such file or directory"); ``` No ```rust Result::``` prefix needed ] #slide(title: "Error Handling")[ #[ #set text(size: 18pt) ```rust match File::open("file.txt") { Ok(file) => { read_from(file) }, Err(error) => { eprintln!("Failed to open: {error}") }, }; ``` ] #pause #[ #set text(size: 18pt) ```rust fn read_from(file: File) -> Result<String, std::io::Error> { let data = match file.read() { Ok(data) => data, Err(error) => return Err(error), }; Ok(data) } ``` ] #pause #[ #set text(size: 18pt) ```rust fn read_from(file: File) -> Result<String, std::io::Error> { let data = file.read()?; Ok(data) } ``` ] ] #slide(title: "Task 4: Result and Error Handling")[ #set text(size: 22pt) + Refactor ```rust PixelColor::new()``` to return ```rust Result<Self, String>``` - ```rust new()``` should return ```rust Err``` if a color channel is ```rust < 0``` or ```rust > 1``` - ```rust String``` represents an error message e.g., ```rust String::from("foo")``` + Change return type of ```rust main()``` to ```rust Result<(), String>``` and return ```rust Ok(())``` + Handle the result of ```rust PixelColor::new()``` with pattern matching - Save ```rust Ok``` in the variable - Print ```rust Err``` message and return error from ```rust main()``` + Test your code + Now, replace the pattern matching with a ```rust ?``` operator ] #slide(title: "Collections")[ - *Sequences:* ```rust Vec```, ```rust VecDeque``` (ring buffer), ```rust LinkedList``` - *Maps:* ```rust HashMap```, ```rust BTreeMap``` - *Sets:* ```rust HashSet```, ```rust BTreeSet``` - *Misc:* ```rust BinaryHeap``` (priority queue) - ... from external crates ```rust Vec``` example: ```rust let mut vector = Vec::new(); vector.push(1); vector.push(2); ``` ] #slide(title: "Ownership")[ Memory is always owned by a single entity. It can either be *moved* or *borrowed*. #uncover("2-")[ ```rust let complex_number = ComplexNumber::zero(); let mut vector = Vec::new(); ``` ] #uncover("3-")[ ```rust vector.push(complex_number); ``` ] #uncover("5-")[ ```rust // -------------- value moved here ``` ] #uncover("4-")[ ```rust vector.push(complex_number); ``` ] #uncover("5-")[ ```rust // ^^^^^^^^^^^^^^ error: value used here after move ``` ] ] #slide(title: "Ownership: Borrowing")[ #[ #set text(size: 18pt) ```rust let complex_number = ComplexNumber::zero(); let mut vector = Vec::new(); vector.push(&complex_number); // value immutably borrowed here vector.push(&complex_number); // value immutably borrowed here ``` ] #uncover("2-")[ #set text(size: 18pt) ```rust let mut complex_number = ComplexNumber::zero(); let mut vector = Vec::new(); vector.push(&mut complex_number); ``` ] #uncover("3-")[ #set text(size: 18pt) ```rust // ------------------- first mutable borrow occurs here ``` ] #uncover("2-")[ #set text(size: 18pt) ```rust vector.push(&mut complex_number); ``` ] #uncover("3-")[ #set text(size: 18pt) ```rust // ---- ^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here // | // first borrow later used by call ``` ] #uncover("4-")[ Borrowed references (sometimes) need to be dereferenced with ```rust *``` ] ] #slide(title: "Ownership: Moving Borrowed Values")[ #set text(size: 20pt) ```rust let complex_number = ComplexNumber::zero(); ``` #uncover("2-")[ ```rust // -------------- binding `complex_number` declared here ``` ] ```rust let mut borrowing_vector = Vec::new(); borrowing_vector.push(&complex_number); ``` #uncover("2-")[ ```rust // --------------- borrow of `complex_number` occurs here ``` ] ```rust let mut owning_vector = Vec::new(); owning_vector.push(complex_number); ``` #uncover("2-")[ ```rust // ^^^^^^^^^^^^^^ move out of `complex_number` occurs here ``` ] ```rust dbg!(borrowing_vector); ``` #uncover("2-")[ ```rust // ---------------- borrow later used here ``` ] ] #slide(title: "Task 5: Collections and Ownership")[ #set text(size: 18pt) Tips: - For this task, you will need index iteration: ```rust for index in 0..some_length {}``` - Documentation for ```rust Vec```: https://doc.rust-lang.org/std/vec/struct.Vec.html - See the visualization for the image type ```rust Vec<Vec<PixelColor>>``` on the next slide Steps: + ```rust fn create_image(width: usize, height: usize) -> Vec<Vec<PixelColor>>``` - Store red pixel if ```rust x == y```, else black - Create an image of size 20x10 in ```rust main()``` using this function + ```rust fn is_red(self) -> bool``` should now take ```rust self``` by reference (```rust &self```) + Create new function, iterate over pixels by index, find red pixels, store them in a collection - ```rust fn get_red_positions(image: &Vec<Vec<PixelColor>>) -> Vec<(usize, usize)>``` + Add ```rust #[derive(Debug)]``` to ```rust PixelColor``` + Use ```rust dbg!(positions);``` to print the resulting collection ] #slide(title: "Image Type for Task 5: Collections and Ownership")[ #figure( image("vec_vec_pixel_color.drawio.svg", height: 100% - 2em), gap: 1em, caption: [Row Major ```rust Vec<Vec<PixelColor>>```], ) ] #slide(title: "Functional Patterns")[ - Iterators from ranges, collections, ... - Transformations on iterators: ```rust map()```, ```rust filter()```, ```rust reduce()```, ```rust enumerate()```, ... - Collect iterators into collections #text(size: 20pt)[ ```rust fn get_red_positions(image: &Vec<Vec<PixelColor>>) -> Vec<(usize, usize)> { image.iter() .enumerate() .flat_map(|(y, row)| { row.iter() .enumerate() .filter(|(_x, pixel)| pixel.is_red()) .map(move |(x, _pixel)| (x, y)) }) .collect() } ``` ] ] #slide(title: "Testing")[ #set text(size: 20pt) ```rust #[test] fn test_complex_number_norm_is_zero() { let zero_complex_number = ComplexNumber::zero(); assert!(zero_complex_number.norm() == 0.0); // or assert_eq!(zero_complex_number.norm(), 0.0); } #[test] fn test_complex_number_norm_is_non_zero() { let mut zero_complex_number = ComplexNumber::zero(); zero_complex_number.real = 3.0; zero_complex_number.imaginary = 4.0; assert!(zero_complex_number.norm() == 5.0); // or assert_eq!(zero_complex_number.norm(), 5.0); } ``` ] #slide(title: "Task 6: Testing")[ + Implement two test cases with different image sizes - `create_image_of_2x3_image_has_3_rows` - `get_red_positions_of_4x4_finds_diagonal_positions` + Run your tests with `cargo test` ] #slide(title: "Test-Driven Development (TDD)")[ #grid( columns: (70%, 35%), [ - Software requirements are converted to test cases before implementation - Test-driven development cycle: + Add a test (must fail) + Write the simplest code that passes the test + Refactor as needed (functionality must be preserved, tests must still pass) + Go to 1. ], [ #figure(image("test-driven-development-TDD.png")) // https://marsner.com/wp-content/uploads/test-driven-development-TDD.png ], ) ] #slide(title: "Crates")[ External libraries are called crates.\ You can install them from crates.io using `cargo add`. Normal workflow: - Search for crates online - Find a fitting one - Copy dependency string, e.g. from docs.rs or crates.io - Paste it into your `Cargo.toml` - Start using the crate in your project ... or use `cargo add` ] #slide(title: "Task 7: Crates")[ #set text(size: 21pt) + Add `rand` to your `Cargo.toml`, make yourself familiar with the crate via docs.rs + Generate a random image - Create new function \ ```rust fn create_random_image(width: usize, height: usize) -> Vec<Vec<PixelColor>>``` - Store red pixel if e.g. random number is above some threshold, else black + Adjust ```rust main()``` to use ```rust create_random_image()``` ] #slide(title: "Outlook")[ - There is more to discover: Modules, Generics, Traits, Lifetimes, Concurrency, I/O - Additional material - https://doc.rust-lang.org/book/ - https://doc.rust-lang.org/rust-by-example/ - https://crates.io - https://docs.rs - https://lib.rs - https://rustlings.cool/ ] #slide(title: "Feedback")[ #set text(size: 40pt) #grid( columns: (48%, 27%, 35%), [ #align(end, [What should we#h(30pt)]) ], [ *Start* \ *Stop* \ *Continue* ], [ doing? ], ) ]
https://github.com/SillyFreak/typst-packages-old
https://raw.githubusercontent.com/SillyFreak/typst-packages-old/main/scrutinize/src/grading.typ
typst
MIT License
/// Takes an array of question `metadata` dictionaries and returns the sum of their points. /// Note that the points metadata is optional and may therefore be `none`; /// if your test may contain questions without points, you have to take care of that. /// /// This function also optionally takes a filter function. /// If given, the function will get the metadata of each question and must return a boolean. /// /// - questions (array): an array of question `metadata` dictionaries /// - filter (function): an optional filter function for determining which questions to sum up /// -> integer #let total-points(questions, filter: none) = { if filter != none { questions = questions.filter(filter) } questions.map(q => q.points).sum(default: 0) } /// A utility function for generating grades with upper and lower point limits. /// The parameters must alternate between grade names and threshold scores, with grades in ascending order. /// These will be combined in dictionaries for each grade with keys `body`, `lower-limit`, and `upper-limit`. /// The first (lowest) grade will have a `lower-limit` of `none`; /// the last (highest) grade will have an `upper-limit` of `none`. /// /// Example: /// /// ```typ /// #let total = 8 /// #let (bad, okay, good) = grading.grades( /// [bad], total * 2/4, [okay], total * 3/4, [good] /// ) /// [ /// You will need #okay.lower-limit points to pass, /// everything below is a #bad.body grade. /// ] /// ``` /// /// - ..args (any): only positional: any number of grade names interspersed with scores /// -> array #let grades(..args) = { assert(args.named().len() == 0) let args = args.pos() assert(calc.odd(args.len())) range(0, args.len(), step: 2).map((i) => ( body: args.at(i), lower-limit: if i > 0 { args.at(i - 1) }, upper-limit: if i < args.len() - 1 { args.at(i + 1) }, )) }
https://github.com/engboris/cv-template
https://raw.githubusercontent.com/engboris/cv-template/main/cv.typ
typst
MIT License
#import "icons.typ": * /* ============================================== Style functions ============================================== */ #let sepline(color) = { v(-12pt); line(length: 100%, stroke: color); v(3pt) } /* ============================================== CV constructors ============================================== */ #let cv_block(title: "", year: "", subtitle: "", place:"", description: "") = { grid( columns: (1fr, auto), rows: 1em, gutter: 4pt, [*#title*], year, text(black.lighten(40%), subtitle), align(right)[#place] ) v(-8pt) text(weight: "light", size: 11pt, description) } #let cv_list(..content) = { grid( columns: (30em, 1fr, auto), rows: 1em, gutter: 4pt, ..content ) } #let cv_item(title, description) = { [*#title* #h(3pt) #description] h(2em) } /* ============================================== Project configuration ============================================== */ #let project( title: "", firstname: "", familyname: "", website: "", email: "", github: "", phone: "", main_color: black, layout_type: "compact", body) = { /* ----------------------------------- Header ----------------------------------- */ set page(margin: (left: 12mm, right: 12mm, top: 12mm, bottom: 12mm)) set text(font: "IBM Plex Sans", lang: "en") let title_size = 35pt; show heading.where(level: 1): it => text( size: 12pt, weight: "semibold", fill: main_color, block(it + sepline(main_color)) ) let full_name = { align(left)[ #text(title_size)[ *#text(fill: main_color, title_size)[#firstname] #familyname* ]] } let info_compact = { grid( columns: (120pt, 150pt), rows: (15pt, auto), gutter: 1pt, [#fa(fa_email) #h(2pt) #email], [#fa(fa_phone) #h(2pt) #phone], [#fa(fa_website) #h(2pt) #link(website)], [#fa(fa_github) #h(2pt) #link(github)] ) } let info_extended = { [#fa(fa_email) #h(2pt) #email #h(2em)] [#fa(fa_phone) #h(2pt) #phone #h(2em)] [#fa(fa_website) #h(2pt) #link(website) #h(2em)] [#fa(fa_github) #h(2pt) #link(github)] } if layout_type == "extended" { full_name v(-2.5em) text(weight: "light", 10pt, black.lighten(10%), info_extended) v(0em) } else { grid( columns: (230pt, 200pt), rows: (25pt), gutter: 3pt, full_name, text(weight: "light", 10pt, black.lighten(10%), info_compact) ) } text(black.lighten(40%), weight: "semibold", 14pt, title) v(1em) /* ----------------------------------- Main content ----------------------------------- */ body }
https://github.com/Quaternijkon/Typst_ADSL
https://raw.githubusercontent.com/Quaternijkon/Typst_ADSL/main/lib.typ
typst
//<>在这里添加第三方库的导入 //时间轴:https://typst.app/universe/package/timeliney #import "@preview/timeliney:0.0.1" //代码块:https://typst.app/universe/package/codly #import "@preview/codly:0.2.0": * //图表:https://typst.app/universe/package/fletcher #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge //提示框:https://typst.app/universe/package/gentle-clues #import "@preview/gentle-clues:0.9.0": * //展示框:https://typst.app/universe/package/showybox #import "@preview/showybox:2.0.1": showybox //泡泡框:https://typst.app/universe/package/babble-bubbles #import "@preview/babble-bubbles:0.1.0": * //日历:https://typst.app/universe/package/cineca #import "@preview/cineca:0.2.1": * //伪代码:https://typst.app/universe/package/lovelace #import "@preview/lovelace:0.3.0": * //</> #let icon(codepoint) = { box( height: 0.8em, baseline: 0.05em, image(codepoint) ) h(0.1em) } //下面是自定义的方法 #let ( BLUE, GREEN, YELLOW, RED, )=( rgb("#4285f4"), rgb("#34a853"), rgb("#fbbc05"), rgb("#ea4335"), ) #let BlueText(_text)={ set text(fill: BLUE) [#_text] } #let GreenText(_text)={ set text(fill: GREEN) [#_text] } #let YellowText(_text)={ set text(fill: YELLOW) [#_text] } #let RedText(_text)={ set text(fill: RED) [#_text] } #import "@preview/suiji:0.3.0": * #let Colorful(_text)={ let colors = ( rgb("#4285F4"), rgb("#34A853"), rgb("#FBBC05"), rgb("#EA4335"), ) let i=7; let rng = gen-rng(_text.text.len() * i); let index_pre = integers(rng, low: 0, high: 4, size: none, endpoint: false).at(1); for c in _text.text{ let rng = gen-rng(i - 1); let index_cur = integers(rng, low: 0, high: 4, size: none, endpoint: false).at(1); let cnt=100; while index_cur == index_pre and cnt>0{ let rng = gen-rng(cnt + i); index_cur = integers(rng, low: 0, high: 4, size: none, endpoint: false).at(1); cnt -= 1; } let color = colors.at(index_cur); set text(fill: color) [#c] index_pre = index_cur; i += 2; } } // #let BlueBox(title:"信息",accent-color:BLUE,header-color:BLUE.lighten(0%),..args)=idea( // title:title, // accent-color:accent-color, // header-color:header-color, // ..args // ) #let undo(_text)={ text(fill: black.lighten(80%),_text) }
https://github.com/HollowNumber/DDU-Rapport-Template
https://raw.githubusercontent.com/HollowNumber/DDU-Rapport-Template/main/src/chapters/hovedafsnit.typ
typst
= Hovedafsnit #include "Hovedafsnit/ideudvikling.typ" #include "Hovedafsnit/koncept.typ" #include "Hovedafsnit/prototyper.typ" #include "Hovedafsnit/projekstyring.typ" #include "Hovedafsnit/produktion.typ" #include "Hovedafsnit/kvalitetssikring.typ"
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/packages/typst.node/npm/android-arm-eabi/README.md
markdown
Apache License 2.0
# `@myriaddreamin/typst-ts-node-compiler-android-arm-eabi` This is the **armv7-linux-androideabi** binary for `@myriaddreamin/typst-ts-node-compiler`
https://github.com/Chasing1020/typst-cv-template
https://raw.githubusercontent.com/Chasing1020/typst-cv-template/main/resume.typ
typst
Apache License 2.0
#set document(author: "Chasing1020", title: "resume") #set page( paper: "a4", margin: (x: 1.2cm, y: 1.2cm), footer: [ #set text(fill: gray, size: 10pt) #align(right)[Last updated on Month Date, Year] ], footer-descent: 0pt, ) #set text(size: 13pt, overhang: true, lang: "en") #show heading: set text(font: "Linux Biolinum") #let icon(name, shift: 1.5pt) = { box( baseline: shift, height: 10.5pt, image("icons/"+ name + ".svg") ) h(3pt) } #let period(t) = { set strong(delta: 0) text(12pt, style: "normal", weight: "light")[#icon("calendar")#t] } #let location(l) = { set strong(delta: 0) text(12pt, style: "normal", weight: "light")[#icon("location")#l] } #show heading.where(level: 1): it => text( size: 18pt, [ #set strong(delta: 0) #align(center)[#{it.body}] ] ) #show heading.where(level: 2): it => text( size: 15pt, [ #set strong(delta: 0) #v(-8pt) #{it.body} #v(-12pt) #line(length: 100%, stroke: 1pt) #v(-4pt) ] ) #show heading.where(level: 3): it => text( size: 13pt, [ #v(-7pt) #{it.body} #v(-5pt) ] ) #let concat(item) = { set text(13pt) let icon = icon.with(shift: 2pt) show link: underline icon(item.type) link(item.link)[#{item.display}] } #let concats(items) = { items.map(item => { h(1fr) concat(item) h(1fr) }).join("|") } #let skill_category(body) = { set text(size: 12pt, style: "normal", weight: "light") body } #let skill_item(category, desc) = { set block(above: 0.8em, below: 0.8em) grid( columns: (24fr, 80fr), gutter: 10pt, align(left)[ #skill_category[#category] ], align(left)[ #set text(size: 12pt, style: "normal", weight: "light") #desc ], ) } /* --------------------- Start --------------------- */ = Chasing1020 #concats( (( type: "envelope", link: "mailto:<EMAIL>", display: "<EMAIL>" ), ( type: "github", link: "https://github.com/chasing1020", display: "chasing1020" ), ( type: "website", link: "https://chasing1020.github.io", display: "https://chasing1020.github.io" ), ( type: "mobile-screen", link: "tel: +86 1234567890", display: "1234567890" )) ) == Education === #link("https://aaa.edu.cn")[AAA University] #h(1fr) #period[Month, Year started -- Month, Year ended] B. Eng in Computer Science and Technology #h(1fr) GPA 4.0/4.0, Rank 1/500 === #link("https://bbb.edu.cn")[BBB University] #h(1fr) #period[Month, Year started -- Month, Year ended] Master of Computer Science and Technology #h(1fr) GPA 4.0/4.0, Rank 1/300 == Honors and Awards + The title or brief description of the award #h(1fr) #period[Month, Year started -- Month, Year ended] + The title or brief description of the award #h(1fr) #period[Month, Year started -- Month, Year ended] + The title or brief description of the award #h(1fr) #period[Month, Year started -- Month, Year ended] + The title or brief description of the award #h(1fr) #period[Month, Year started -- Month, Year ended] == Internship Experience === #link("https://ccc.company.com")[CCC Company, Ltd.] #h(1fr) #period[Month, Year started -- Month, Year ended] _Server System R\&D Intern, CCC Team_ #h(1fr) #location[City, State, Country] - Situation: Describe the situation or problem you faced. - Task: Explain the task or goal you were given. - Action: Detail the actions you took to address the situation or complete the task. - Result: The outcome of your actions, including any meaningful results or impact you had. === #link("https://ddd.company.com")[DDD Company, Ltd.] #h(1fr) #period[Month, Year started -- Month, Year ended] _Backend R\&D Intern, DDD Team_ #h(1fr) #location[City, State, Country] - Situation: To help the reader understand the circumstances where you were working. - Task: The task or goal you were given should be clearly defined. - Action: A detailed account of the steps you took, including any challenges you faced. - Result: This is where you share the outcome of your actions. This could be a quantifiable result. == Project Experience #icon("github")#link("https://github.com/Chasing1020/Chasing1020")[#underline[Project1]]: Start by providing a brief overview of the project, including the purpose, goals, and any challenges or obstacles you faced. Use bullet points to describe your specific role in the project. This should include the tasks you were responsible for, any leadership or coordination you provided, and any unique contributions you made. #icon("github")#link("https://github.com/Chasing1020/Chasing1020")[#underline[Project2]]: Use the STAR principle to provide specific examples of your accomplishments. Describe the situation or problem you faced, the task or goal you were given, the actions you took to address the situation, and the results you achieved. #icon("github")#link("https://github.com/Chasing1020/Chasing1020")[#underline[Project3]]: Make sure to emphasize any skills or knowledge you gained from the project that would be relevant to the job you're applying for. This could include technical skills, project management experience, or communication and collaboration skills. == Skills #skill_item( "Languages:", "Golang > Scala > Rust > Java > Python > JavaScript" ) #skill_item( "Development Tools:", "Linux, Docker, Kubernetes and any tools you want to include." ) #skill_item( "Technology Stack:", "Database Systems, Multithreading Programming, Computer Networks, KV Storage Systems, Program Analysis, Distributed Systems." ) /* --------------------- End --------------------- */
https://github.com/r8vnhill/keen-manual
https://raw.githubusercontent.com/r8vnhill/keen-manual/main/omp/omp_main.typ
typst
BSD 2-Clause "Simplified" License
#import "@preview/ctheorems:1.1.2": * #show: thmrules #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)) = One Max Problem #include "definition.typ" #include "rep_ev.typ" #include "init.typ" #include "genetic_operators.typ" == Selection Following the initialization phase, the GA enters its main evolutionary cycle, with selection being a pivotal process. This step mimics natural selection by preferentially choosing individuals with higher fitness for reproduction, thus steering the population towards more optimal solutions. In this context, the concept of elitism is introduced through a survival rate $sigma$, which determines the fraction of the population that advances to the next generation unchanged. Specifically, the top $floor(sigma N)$ individuals, based on their fitness, are preserved, while the rest are replaced by offspring generated through genetic operators. This blend of elitism and generation of new individuals helps balance exploration and exploitation in the search space. #definition[Selection operator][ The selection process is formalized through a selection operator, denoted as $Sigma$, which is defined for a population $P$ comprising $N$ individuals, each with a fitness value $phi_i$. The operator is described as: $ Sigma (P: PP, n: NN, dots) -> P' $ where $PP$ is the set of all possible populations, $NN$ represents the set of natural numbers, $P'$ is the selected subset of the population, and $n$ is the number of selections to be made. ] A commonly used method within this operator is the *roulette wheel selection*, where each individual's chance of being selected is proportional to its fitness. This can be mathematically expressed as: $ rho_Sigma(i) = phi_i sum_[j=1]^N phi_j $ where $rho_Sigma(i)$ represents the selection probability of the $i$-th individual. In Keen, all selection methods conform to the `Selector` interface: ```kt interface Selector<T, G> : GeneticOperator<T, G> where G : Gene<T, G> { override fun invoke( state: EvolutionState<T, G>, outputSize: Int ): EvolutionState<T, G> { ... } fun select( population: Population<T, G>, count: Int, ranker: IndividualRanker<T, G> ): Population<T, G> } ``` Configuring the selection mechanism within a GA is typically straightforward, as demonstrated in the following Kotlin snippet for the Keen library: ```kt val engine = evolutionEngine(::count, genotypeOf { chromosomeOf { booleans { size = CHROMOSOME_SIZE trueRate = TRUE_RATE } } }) { // For selecting parents for crossover. parentSelector = RouletteWheelSelector() // For selecting individuals to survive to the next generation. survivorSelector = TournamentSelector() /* Additional configurations */ } ``` This configuration illustrates the use of `RouletteWheelSelector` for parent selection, where probabilities are aligned with individuals' fitness, and `TournamentSelector` for survivor selection, which involves selecting the best among a randomly chosen subset of individuals. The flexibility to use different selectors for these phases allows for a tailored approach, potentially enhancing the GA's ability to converge on optimal solutions. == Variation Variation is the cornerstone of GA, facilitating the creation of new individuals from existing ones to explore the solution space comprehensively. This process is essential to circumvent premature convergence to sub-optimal solutions, analogous to how genetic diversity in nature fosters adaptability and resilience in species. The primary mechanisms of variation in GAs are crossover and mutation. *Crossover* resembles biological recombination, merging genetic information from two or more parents to produce offspring. *Mutation*, akin to spontaneous genetic mutations in nature, introduces random alterations to an individual's genetic makeup. To formally define a variation operator, which is pivotal in generating new individuals within a population, consider the following: #definition[Variation operator][ A variation operator is a mechanism that derives new individuals from existing ones in a population. Formally, it can be represented as a function: $ phi.alt : (P: PP, ρ_phi.alt: RR, ...) → PP $ where: - $PP$ represents the set of all possible populations. - $RR$ denotes the set of real numbers, corresponding to the range of the probability parameter. - $P$ specifies the particular population subject to variation. - $ρ_phi.alt$ is the probability of applying the variation operator to an individual within $P$. The ellipsis ($dots$) signifies additional parameters that may be included based on the specific implementation and characteristics of the variation operator. ] Variation operators in genetic algorithms are typically variadic, capable of accepting a variable number of parent individuals to produce offspring. This adaptability enables a diverse array of genetic combinations within the population, encouraging a thorough exploration of potential solutions. Keen represents variation operators through the `Alterer` interface: ```kt interface Alterer<T, G> : GeneticOperator<T, G> where G : Gene<T, G> { operator fun plus(alterer: Alterer<T, G>) = listOf(this, alterer) } ``` === Crossover A critical variation operator is the *crossover*, which mirrors genetic recombination observed in nature. This operator facilitates the exchange of genetic material between two parent individuals, leading to the generation of new offspring. #definition[Crossover Operator][ The crossover operator recombines genetic material from existing individuals to create new ones. It is formally represented as: $ X(P: PP, rho_X: RR, dots) -> PP $ where: - $PP$ represents the set of all possible populations, - $RR$ is the set of real numbers, indicating probabilities, - $P$ denotes the current population under consideration, - $rho_X$ is the probability of applying the crossover to an individual. ] In Keen, the crossover functionality is encapsulated within the following interface: ```kt interface Crossover<T, G> : Alterer<T, G> where G : Gene<T, G> { val numOffspring: Int val numParents: Int val chromosomeRate: Double val exclusivity: Boolean override fun invoke( state: EvolutionState<T, G>, outputSize: Int ): EvolutionState<T, G> { ... } fun crossover(parentGenotypes: List<Genotype<T, G>>): List<Genotype<T, G>> { ... } fun crossoverChromosomes( chromosomes: List<Chromosome<T, G>> ): List<Chromosome<T, G>> } ``` We'll use a *single-point crossover* operator in our example. This operator selects a random index within the parent chromosome to swap genes before and after this cut point. For instance, consider two parent individuals, $I_1 = 1100$ and $I_2 = 0001$. Using the single-point crossover, if the cut is made after the second gene, the resulting offspring would be $O_1 = 1101$ and $O_2 = 0000$. Implementing this in Keen is straightforward: ```kt val engine = evolutionEngine(::count, genotypeOf { chromosomeOf { booleans { size = CHROMOSOME_SIZE trueRate = TRUE_RATE } } }) { alterers += SinglePointCrossover(chromosomeRate = 0.6) /* Other configurations */ } ``` Note the use of `+=` for adding alterers, as they are initialized to an empty mutable list to provide flexibility in configuration. === Mutation While the crossover operator effectively recombines existing genetic material, it is limited by the genetic diversity already present in the population. This can sometimes lead to premature convergence, especially for complex problems characterized by numerous local optima. To combat this and infuse fresh _diversity_, the *mutation* operator is employed. It introduces small, probabilistic changes to the genetic makeup of individuals. #definition[Mutation operator][ The mutation operator introduces variations in an individual's genetic material based on a predefined probability, resulting in a new population. Formally, a mutation operator can be represented as: $ Mu (P: PP, mu: [0, 1], dots) -> PP $ where: - $PP$ -- denotes the set of all possible populations - $[0, 1]$ -- is the range of valid probabilities - $P$ -- stands for the current population - $mu$ -- indicates the mutation rate, i.e., the chance of an individual undergoing mutation Additional parameters vary depending on the specific mutation operator in play. ] == Termination In genetic algorithms, termination criteria are pivotal as they dictate when the algorithm should stop. This is crucial for preventing unnecessary computations and focusing the search on promising areas of the solution space. In Keen, we represent these criteria using `Limit`s, which are defined with the following signature: ```kt interface Limit<T, G> where G : Gene<T, G> { var engine: Evolver<T, G>? operator fun invoke(state: EvolutionState<T, G>): Boolean } ``` For this example, we utilize one of Keen's integrated limits to halt the algorithm when either the desired fitness is achieved or a maximum number of generations has been reached: ```kt val engine = evolutionEngine(::count, genotypeOf { chromosomeOf { booleans { size = CHROMOSOME_SIZE trueRate = TRUE_RATE } } }) { // Add termination conditions limits += listOf(MaxGenerations(1000), TargetFitness(50.0)) } ``` By setting a clear termination condition, such as achieving the highest possible fitness score, the algorithm efficiently navigates the search terrain. Although it might not explore every possible solution, it strategically focuses on those that improve the fitness, effectively optimizing the search process. == Full implementation <omp-impl> ```kt private const val POPULATION_SIZE = 100 private const val CHROMOSOME_SIZE = 50 private const val TRUE_RATE = 0.15 private const val TARGET_FITNESS = CHROMOSOME_SIZE.toDouble() private const val MAX_GENERATIONS = 500 private fun count(genotype: Genotype<Boolean, BooleanGene>) = genotype.flatten().count { it }.toDouble() fun main() { val engine = evolutionEngine(::count, genotypeOf { chromosomeOf { booleans { size = CHROMOSOME_SIZE trueRate = TRUE_RATE } } }) { populationSize = POPULATION_SIZE parentSelector = RouletteWheelSelector() survivorSelector = TournamentSelector() alterers += listOf( BitFlipMutator(individualRate = 0.5), SinglePointCrossover(chromosomeRate = 0.6) ) limits += listOf(MaxGenerations(MAX_GENERATIONS), TargetFitness(TARGET_FITNESS)) listeners += listOf(EvolutionSummary(), EvolutionPlotter()) } engine.evolve() engine.listeners.forEach { it.display() } } ```
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/045%20-%20Kamigawa%3A%20Neon%20Dynasty/001_Kaito%20Origin%20Stories%3A%20A%20Test%20of%20Loyalty%20%26%20The%20Path%20Forward.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Kaito Origin Stories: A Test of Loyalty & The Path Forward", set_name: "Kamigawa: Neon Dynasty", story_date: datetime(day: 16, month: 12, year: 2021), author: "<NAME>", doc ) = A Test of Loyalty The street was crawling with kami tonight. The Lantern Festival was a favorite for many of Towashi's night-loving spirits. On any other day, Kaito might've appreciated the extra camouflage. Part of his job required the ability to move through the streets unseen—and hordes of kami were an ideal solution. But he was running out of time. If he didn't finish the job soon, he'd lose a payday to another Reckoner. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) It hadn't taken Kaito long to find his target. Gamblers were notoriously bad at keeping secrets, and this one had a history of debt and soured friendships. But if Kaito moved too soon, he'd risk scaring him off. And on a night like this, with heavy crowds and an abundance of fireworks displays, there were a thousand places for a stranger to hide. A group of children ran past Kaito with sparklers in their fists, shrieking with delight. He flinched at the sound. It had only been a year since the emperor went missing. Twelve months since Kaito chased the mysterious stranger out of Kyodai's temple. The rest of Kamigawa may have been carrying on as normal, but when Kaito saw the bright red festival lanterns floating through the sky, the skewers of syrup-soaked rice dumplings in every street stall, and the Kami of Exultant Revelry blazing across the rooftops in all its twinkling glory, he didn't feel an ounce of joy. All he could think about was his friend. Kaito would save his celebrating for the day the emperor came home. He stepped beneath the canopy of neon parasols that kept the street vendors sheltered, where a trio of electric kami squabbled near one of the faltering outdoor heaters. The smallest of the three spirits leapt up, and the floating metal orbs around its industrial-style body flashed with irritation. Kaito threw up a hand to shield his eyes from the bright light, blinking several times before the kami scattered across the street to find another source of energy. When his vision readjusted, he was almost certain he'd lost sight of his target entirely. And he probably would have if it weren't for the man's garish coat. The edges glowed a fluorescent yellow, and the rest of it was patterned with glossy, holographic koi. It was a bold choice for a man who owed Satoru Umezawa money. But there was something about festivals that tricked people into letting their guard down. Soundlessly, Kaito approached the man dressed in yellow, watching as he perched himself on one of the thin wooden chairs outside a curry stall. He leaned across the table, speaking in rushed, loose words to a woman with flour smeared across her forehead and drops of curry splattered on her apron. The Hyozan Reckoners wouldn't want witnesses. Kaito needed to be careful. He slipped between the approaching customers, moving as if he were no more than a wisp of smoke in the shadows. He walked behind the man without stopping, and in one fluid sweep of his hand, Kaito reached into the man's coat and retrieved his wallet. The man didn't feel a thing. Kaito made sure if it. Following the shifting crowd to the edge of the market, Kaito distanced himself from the mark. When he was sure he hadn't been followed, Kaito paused at the street corner, opened the wallet, and counted the translucent banknotes inside. Most people on Kamigawa were happier using credit chips attached to their wrists, but anyone with a penchant for gambling wouldn't be silly enough to use wearable tech. Those who frequented Towashi's card dens had a saying: #emph[only risk what you're willing to lose.] To avoid the temptation of risking everything, gamblers preferred physical money over credit chips. Luckily for Kaito, he'd picked up a few new skills over the years—pickpocketing being one of them. He thumbed through the notes, counting a second time just to be sure before removing a miniature tablet from his pocket. One day, he hoped he'd be able to afford hands-free tech like the retina lenses he'd seen some of the other Reckoners wear, but for now, the outdated comm would have to do. The device scanned his eyes, and a blurry hologram materialized. Kaito waved a finger, scrolling through details of every active listing, until a pixelated image of the gambler's face appeared. Below was the man's name, how much money he owed Satoru, and tip-offs as to where he might be hiding. Kaito typed a coded message into the device and hit send. The target's listing flashed from blue to red before vanishing. In the space it left behind was the word "Completed." Across Kamigawa, the Hyozan Reckoners would receive the same alert. They'd know Kaito cleared another job and that he'd be on his way to Satoru's den in the Undercity to collect the bounty. Kaito stuffed the device back in his pocket, the sound of festival drums and fireworks echoing behind him. It was true that he wasn't ready to celebrate—but that didn't mean he wasn't hungry. Kaito pulled a few of the extra notes from the gambler's wallet, walked up to the nearest stall, and bought the biggest dumpling skewer he could find. As he made his way to the train station, shoyu dripping down his hand, Kaito decided that even though working for Satoru hadn't been his first choice, being a Reckoner had its perks. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The Undercity was shadowed by looming skyscrapers and vibrant cherry trees that failed to mask the stench of the open sewers nearby. Kaito had been doing jobs for the Hyozan Reckoners for nearly a year. He'd grown used to the worst parts of Towashi's underbelly. He'd even grown used to the people—and they were far worse than anything that came out of the sewer. Kaito held his wrist up to the paneled door, and a red light scanned the wearable keycard. Security was mild in comparison to the Imperial Palace, but no one with any sense would ever attempt to break into Reckoner territory. A security system was merely a formality. The door slid open, and Kaito followed a metal staircase down to a wide lobby where card tables littered the room and a neon counter lined the back wall. Reckoners were perched on chairs and standing in doorways, most of their faces partially hidden by masks elaborately decorated with teeth and sharp horns. Colorful tattoos were visible on their arms. Some of the underlings only had one or two, but the higher-ups had tattoos that spread from their wrists all the way to their shoulders. For most Reckoners, their loyalty tattoo was their first. If they betrayed Satoru, the initiation mark would eat into their flesh, eventually leading to a slow and painful death. Kaito wasn't the youngest underling amongst them, but being on the cusp of sixteen made him just young enough to avoid initiation. He tried not to think about how long that would last. It wasn't that Kaito #emph[intended] to be disloyal. Satoru had given him a job, after all, not to mention a place to live and food to eat. If it weren't for the Hyozan, Kaito would've still been wandering Towashi, surviving off the few coins he managed to scrounge up from the gutters—and maybe a few more from the pockets of unsuspecting strangers. But Kaito hadn't joined the Hyozan Reckoners for the money. The gang's extensive network gave them access to every scrap of criminal information that existed. If anyone was going to know about a man with a metal arm, it would be Satoru's spies. If it meant finding the emperor's assailant, Kaito would suffer a loyalty tattoo and stay in the Undercity for as long as it took. It was a small price to pay to bring his friend home. A burly figure wearing sculpted, insectile armor stood in Kaito's path, brows as thick as caterpillars. He huffed, breath sour and eyes bloodshot. "You stole my mark." Kaito eyed the man's katana, its edges glowing a merciless red. Most of the Reckoners' weapons were laced with poisons and illegal enhancements. All Kaito had was a thin knife that was more suited to slicing fruit than it was to drawing blood, but the last time he'd gone to the armory, the knife was all he could afford. Kaito had never been one to shy away from confrontation, but he couldn't deny they were unevenly matched. So, he fought back with his words and hoped it wouldn't cost him a broken nose. "If a name is on the list, it's fair game," Kaito bit back coolly. "Not my fault you were too slow to get there first." The Reckoner whistled through his crooked teeth. "The gambler was only tagged as a mark this morning. How did you manage to find him so quickly?" "It was a festival," Kaito remarked. "People go where the food is." "I'd say you got lucky, but you don't even have blood on your hands." He narrowed his eyes. "If you're stalling for time—trying to keep the rest of us from him, just so you can score a bounty~" At the suggestion, a few of the other Reckoners glanced up from the nearby card table. One was a muscular woman with metal gloves trailing up to her elbows, each finger pointed and needle sharp. Kaito had seen her work before—one swipe of her hand would leave a special kind of poison that caused venomous flowers to blossom from a person's wounds. "I know about the code," Kaito said, and he made sure the others could hear him, too. "And I don't need to lie to get a payday—#emph[or ] rough up a target just to make myself feel important." He shrugged. "The listing said he owed money, so I got the money." "You're cocky for an underling, and too soft-bellied for a Reckoner." The man tilted his head accusingly. "Mercy is for the Imperials." "It wasn't mercy," Kaito snapped back. "I just don't see the point in wasting time making someone bleed when there are plenty of other jobs I could be doing. We aren't paid by the hour." "No," the woman with the metal fingers chimed in, a hint of a tattoo appearing along her collarbone. "But it sure is fun to make them beg." The others laughed in response, and the sound went straight through Kaito's core like an icy dagger. He knew if he wasn't careful, he might someday find the same kind of dagger in his back. A tall woman with jet-black hair appeared, and the laughter ceased. Kaito felt the chill seep through his bones, filling him with a sense of emptiness. Wisps of black smoke circled around her like phantom serpents. Unlike those who channel kami magic through mutual respect, this woman took a different approach to channeling. She'd allowed Azamaki, the Kami of Treachery Incarnate, to possess her, and more than once. She believed doing so gave her prophetic hallucinations and visions of what would come to be. All Kaito could see was the dying gray color of her skin, and the way the black of her eyes spilled out into the whites, like the kami hadn't just borrowed a part of her—it had consumed her very soul. "Satoru wishes to speak with you," she said in a hollow voice, sweeping a hand toward one of the back rooms. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Kaito followed her without a word, happy to leave the others behind, but he felt his nerves jolt to life across his skin. It was rare for Satoru to summon anyone. When he did, the people who stepped into his office usually came out with one less finger, or several missing teeth—if they came out alive at all. Kaito felt the weight of the stranger's wallet. Did Satoru know he'd taken some of the money to buy dumpling skewers? Kaito had counted the money several times over. There was plenty to cover the mark's debt. What Kaito took was extra—it couldn't possibly be seen as stealing from Satoru. Could it? The woman pushed the door opened, and Kaito stepped clumsily inside, eyes growing wide when he saw Satoru sitting behind his desk, bright tattoos trailing all the way up to the bottom of his ears. His black hair was wound in a tight bun and a harsh expression knotted his entire face. Metal armor was latched strategically across his chest and arms, but there were windowed panels across his shoulders and stomach that showed off his colorful markings. A gas mask hung from his neck, neon green with painted blue swirls, making it look like the jaws of a monster. Satoru didn't motion for Kaito to sit. He didn't say a word. He simply stared in a way that made Kaito's knees falter. "I can explain," Kaito said quickly. "I knew I'd be bringing you a profit on top of the debt. And I'd been tailing the guy since the afternoon, so when I smelled the shoyu—" Satoru held up a hand to interrupt, and Kaito snapped his mouth shut. When the leader of the Hyozan Reckoners still didn't speak, Kaito pulled the wallet out of his pocket and set it carefully on the table between them. Satoru's eyes dropped before gesturing to the nearby channeler. She took the wallet and moved away to count the contents. After a moment, she simply nodded. Satoru pressed his elbows against the table and clasped his hands together, leaning in. "I'm impressed by how well you're able to tail your marks. This is the third time this week you've cleared a name from the list on the same day it went up." Kaito swallowed, clenching his fists as if he were protecting his fingers. "However," Satoru said. "While your efficiency is worthy of praise, I'm not sure you've grasped what it means to send a message." Kaito's throat burned. He needed this job; he needed to be somewhere he could help the emperor. He couldn't afford to let Satoru doubt him. "There are Reckoners who can send a message, but they don't clear as many names off your lists as I do." Kaito knew he was being too bold, but it was all he could do to mask the cracks in his voice. "I'm the best underling you have." "Yet you have no loyalty mark." Satoru motioned to Kaito's bare skin, and then to the large screen against the wall. Surveillance feeds from the lobby appeared in rectangles. He'd been watching them the whole time. "It seems I'm not the only one who wonders whether you have the stomach for this job." "I'm here because I want to be." "Yes." Satoru paused. "You lived in Eiganjo before you came to us. I have seen Imperial samurai leave the palace for a different kind of life, and every now and then, one of them winds up here. But they leave because they see a broken system." His eyes darkened. "You don't strike me as someone who cares much about systems." The memory of his childhood made Kaito's cheeks burn. He still felt guilty—not about leaving the palace, but for leaving Eiko behind. Not that she would've followed him beyond the wall. Her heart belonged to the palace and everything it stood for. Kaito's heart didn't really belong to anything. At least not anything that could easily be explained. Kaito stiffened. "I ran away because I knew the things I wanted out of life weren't things I was going to find in Eiganjo." "And what is it you want?" Kaito shrugged. "Money. A better sword."#emph[ To find out what happened to the emperor and bring her home.] At that, Satoru chuckled, brow still furrowed. "I have a job for you," he said finally. "One that isn't on the list." "A job?" Kaito blinked with relief. Maybe he'd get to keep his fingers after all. Satoru leaned back in his chair. "There's a moonfolk on Otawara—a Futurist prodigy, as they're calling him—who is prototyping a way to connect tech and kami. His research would sell for a high price on the black market. And it's only a matter of time before Hyozan's rivals hear about it and get the same idea." He tilted his head, studying Kaito carefully before dipping his chin. "I want you to bring me the schematics." The pay would be good—black market dealings always were—but it would also be a way to prove his loyalty to Satoru. #emph[Without ] having to send any messages. Kaito gave a curt nod. "Consider it done." "I'll send you the details through your comm." Satoru waved a hand. "You can see yourself out." Kaito left the room, ignoring the way the channeler watched him with black, assessing eyes, and once he was out in the street under the shadows of a high-rise, he pulled out his tablet just in time to see the private message flash up on his holoscreen. There was only a photo, and a name. #emph[Tameshi.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Otawara wasn't at all like the surface. So many of the buildings were covered in metal and glass, reflecting the plane like it was shining a spotlight on every sudden movement. There were surveillance drones everywhere, and enormous, origami mechs that prowled the edges of the floating city. After the emperor vanished, the Imperials blamed the Futurists for the attack. Kaito wondered if the Futurists' raised defenses were a response to the accusations or if their security systems were less about protection and more about concealing whatever was going on in their labs. It wasn't a secret that the Futurists liked to push the boundaries of technology. But maybe they were past toeing the line—maybe they'd already leapt over it entirely. Kaito would be lying if he said the thought didn't pique his interest. When Kaito finally managed to track down information on Tameshi's whereabouts, he discovered the moonfolk was no longer on Otawara at all. He'd moved his research to the Boseiju District—the kami-filled forest, and home to the Order of Jukai. Tailing a mark and breaking into laboratories was one thing, but angering the kami? The ones in Boseiju were there to get away from the rest of Towashi. They were barely tolerant of the Order of Jukai. It was part of the reason Eiganjo trained so many kami diplomats to try to keep the peace between the mortal and spirit realms. The forest would not be friendly territory. Not without someone to mediate. So, he contacted the only person who could help him and pleaded his case. Kaito paced beneath the archway on the outskirts of Boseiju. Stone pillars carved into the shapes of ancient kami were perched throughout the moss garden, their mouths wide open with enough space to leave an offering. Some of them housed fruit, while others contained origami animals scribbled with messages for the spirits yet to enter the mortal realm. Behind the temple stood a wide merge gate, the colors around it shimmering with metallic hues. Most people knew not to get too close. No one knew exactly what would happen if a mortal tried to step through the void. But kami did occasionally make their way through the gates, and while the Imperials had constructed them to keep the crossings safe, the Order of Jukai built the temples to make sure the kami felt welcomed. They believed spirits were a sacred part of nature that should be revered. Kaito never saw the point in treating kami like they were gods. There was something about seeing a lethargic kami sunbathing in a heap of mud that made them less~ethereal. The crunch of footsteps sounded nearby, and Kaito lifted his head to find his sister standing several feet away. His shoulders relaxed. "Eiko. You came." She'd cut her hair since the last time he'd seen her. It was chopped short and severe, and made her look older. The way her lips were pursed and her eyes narrowed, she appeared strangely foxlike. #emph[Like a human version of Light-Paws] , Kaito thought, mouth curving slightly at the resemblance. Eiko crossed her arms. "Don't look so happy. If I'm going to help you, there will be rules." Kaito held up his hands innocently. "I wouldn't have assumed anything less." "First of all, I'm not here to steal anything. I'm here to protect the kami from whomever this Tameshi is. Because if he's doing the things you say he is—connecting tech and kami—then he's breaking Imperial law and threatening the balance of both realms. And in case your judgment is as poor as I remember, absolutely #emph[no weapons] . We cannot make the kami here feel threatened in any way." "Great speech," Kaito chirped. "But if I needed a battle buddy, I would've asked someone from the Undercity. You're here because I need an Imperial to guide me through the forest under the guise of diplomacy." "You know I'm not officially a kami diplomat yet, right?" Eiko pointed out. "I haven't completed my training." "The Order of Jukai don't need to know that. And with any luck, we won't even see them. You're just here to make sure the kami don't attack us along the forest border." "No," Eiko countered. "#emph[I'm] here to put a stop to your friend." "He's a mark, not a friend." There was a moment of silence, and when Eiko spoke again, her voice softened. "Why are you doing this, Kaito? If joining the Hyozan Reckoners is your way of getting back at Light-Paws for not believing you, then—" "It's not," Kaito interjected. Eiko's expression splintered. "Then why are you working for #emph[criminals] ?" "I'm doing this for the emperor," Kaito replied, voice stiff. "I've already heard rumblings of a secret organization not aligned with the Futurists #emph[or] the Reckoners. The palace wouldn't listen to me about the man with the metal arm, but I know what I saw—and if he shows himself in Kamigawa, the Reckoners will know about it." He shook his head. "Satoru is already questioning my loyalty. If I don't get him what he wants, I'll be back to where I was when I left the palace, with no leads, and no one willing to help." At that, Eiko said nothing. Kaito's jaw tensed. "All I need is Tameshi's research. After I take the schematics to Satoru and secure my place with the Reckoners, you can tell the Imperials whatever you have to." Eiko stood with her thoughts for a while, the tension building mostly in her shoulders. "Fine," she said at last. Kaito tried not to appear too grateful in case she changed her mind. He nodded toward the trees. "We should go while there's still light. I'd prefer to avoid running into the Kami of Empty Graves in the middle of the night." He smirked like it was a peace offering. "Especially since your plan is to go in unarmed." "Oh, I've met her. She's quite polite," Eiko noted, straightening the metal bracers around her forearms. "If I were you, I'd be more concerned with the Kami of Forgotten Clearings. She's#emph[ famously ] territorial." Kaito had the good sense not to laugh, even when Eiko's eyes sparkled with humor, and he followed his sister into the forest. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Eiko stood in front of the Kodama of the West Tree. It towered over her by nearly thirty feet, wide limbs covered in bark and its mouth stretched with threads of golden sap. A dozen luminescent blossoms circled the kami's head, and cascades of smaller branches trailed down its shoulders like a crown of hair. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/03.jpg", width: 100%), caption: [Art by: Daarken], supplement: none, numbering: none) Kaito drummed his fingers against his arms, watching the introduction from a distance. He didn't know exactly what his sister was saying, or how displeased the kami was to see trespassers so close to the border of Jukai Forest, but after a while, Eiko bowed low and returned to Kaito's side. "She says we can pass through safely, as long as we don't go beyond the river," Eiko explained carefully. She cast a glance over her shoulder and lowered her voice. "I didn't mention Tameshi. I thought it might complicate matters if they knew there was a threat in the forest." Kaito smirked. "Lying to the kami? Would Light-Paws approve?" Eiko scowled. "Don't make me regret this." They walked for nearly an hour. Kaito's eyes searched the faraway trees for signs of Tameshi's new research grounds—flattened earth, fresh tracks, metal where it shouldn't be. But if Tameshi was nearby, he'd done a thorough job of covering up his presence. Kaito sensed Eiko's stiffness beside him and turned to face her. Her chin jutted out, and her mouth was pressed into an impenetrable line. It was the same look she'd get as a child when she was worried about being reprimanded—usually because of Kaito's mistakes. She didn't like lying to the kami. But Kaito wondered if the possibility of disappointing Light-Paws was also weighing on her shoulders. He couldn't blame her if it was; he remembered the feeling all too well. The only difference was that Eiko #emph[wanted ] to make their mentor proud, whereas Kaito~he wanted Light-Paws to be proud of the person he already was, and not the samurai she hoped he'd become. The ground shuddered without warning, and Kaito leapt backward, dagger finding his grip before his eyes had even processed the threat. It wasn't an attack—just a slow-moving rock kami burrowing itself deeper into the earth for shade. Kaito relaxed, but Eiko's hardened stare made his cheeks burn. "I thought we agreed no weapons," she hissed. Kaito gave a sheepish shrug in response. "I would #emph[barely] call it a weapon. It's more of a survival tool. Depending on your perspective, you might even call it a small kitchen utensil." "My #emph[perspective ] is that you pulled out a blade the first time you saw a kami move!" Eiko replied tersely. She pinched the bridge of her nose. "This is exactly what I was worried about." Kaito slid the dagger into his belt, no longer bothering to conceal it in his clothes. "It's nothing. Nobody got hurt." "Don't you understand how serious this is? If you threaten the kami, you're not just putting us both in danger—you're putting everything I've worked toward in danger, too." Kaito bristled. "You didn't have to come." "Yes, I did." "No." Kaito took a step closer. "You could've told the Imperials about Tameshi. They would've sent samurai straight here, arrested him, and made sure his research was destroyed. You knew the risks, and you still #emph[chose ] to come. And I'm grateful for your help, but you can't just—" "I didn't come here to help you," Eiko confessed abruptly. Kaito flinched. She balled her fists. "I—I'm not trying to hurt your feelings. But this isn't just about stopping Tameshi's research. It's about proving what his research #emph[is] ." Kaito frowned. "What are you talking about?" "I saw something that night, too, Kaito. The night the emperor disappeared." Kaito felt as if the entire forest had become a tidal wave. He locked his knees, eyes glued to his sister, and waited for her to explain. Eiko chewed the edge of her lip, trying to find the right words. "When the alarms sounded, I—I tried to find you. I was halfway across the student gardens when I saw you running toward Kyodai's temple. And that's when I saw something on the roof." Kaito's heart pounded. "Did you see the man? The one I chased?" She shook her head. "It wasn't a man—it was a light. It was glowing as bright as a star, and then it #emph[exploded] . Everyone else was so busy looking toward the wall, but I was looking for you. And the light—it transformed into an animal and vanished. When I found out the emperor was missing, I knew they must've been connected somehow. That maybe the Futurists had found a way to #emph[weaponize] #emph[kami] ." #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/04.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Kaito scraped a hand through his hair, frustrated. "I've told you a thousand times—what happened had nothing to do with the Futurists. There was a man in the temple that night. A man who was in the very room where the emperor was last seen. #emph[That's ] who's responsible for the emperor's disappearance. Not a glowing animal." She narrowed her eyes. "You said Tameshi's research involves merging kami and technology. What if that's exactly what I saw on the roof?" Kaito stared, face morphing into understanding. "Light-Paws didn't believe you." Eiko blinked. "She didn't take what you saw seriously, the same way she didn't believe me." Kaito recognized the sting in her eyes. "That's why you came—to prove to her that you were right." "You make it sound childish." Kaito snorted. "It #emph[is ] childish. So what if she didn't take you seriously? She didn't believe me either. But at least you've had Light-Paws's approval since we were children." Eiko's expression faltered, eyes turning glassy. "Kaito~" Kaito looked away. "You were always the better one of us. I never expected Light-Paws to see anything else. But I stood in the temple that night begging the council to listen to me, and not one of them would." He swallowed the lump in his throat. "Maybe they didn't listen to you then, but the difference between you and me is that one day, they will." "I do believe what you saw, you know," she said quietly. "You believe he was a Futurist." Kaito lifted his eyes. "And that's not what I saw." Eiko nodded. "Maybe Tameshi's research will prove one of us right." She hesitated. "You can still come home, you know. It isn't too late to continue your training." "That isn't my life. Not anymore. But you?" Kaito flashed an earnest grin. "You'll be great at it." Eiko took his hand, squeezed, and turned back toward the path. Sometimes the unspoken words between them were the loudest of all. Beyond the next rock bed was a stone staircase that wrapped around a hill. Cascading from the crest was a small waterfall, trickling over the moss edges and pooling below. The stepped earth created uneven levels beneath the river, making the clearing echo with the sound of rushing water all the way through the heart of the forest. Kaito knew the best place to hide in Towashi was within the largest crowds. Maybe in Jukai Forest, it was near the loudest waterfalls. Eiko held out a hand to stop Kaito from moving. "We can't go any farther. I promised the Kodama of the West Tree." Kaito pointed ahead at the mist beyond the trees. "If Tameshi is here, he'll be close to the river, where it's loud and he can hide his tracks." He glanced at Eiko. "The only promise I made was to the emperor—and I'm not leaving here without the research." Ignoring Eiko's objections, Kaito stepped carefully across the protruding stones in the stream, balancing with care. When he reached the muddy bank, he scrambled to catch his footing before grabbing a fistful of thick vegetation and hoisting himself up the rocky hill. He turned to see if his sister had made it across the river—but she was gone. He had no right to feel hurt. He'd broken most of her rules, and they both had so much to lose if something went wrong. But the bitterness of being abandoned pinched his heart. Maybe it's what Eiko felt when he'd left Eiganjo. He wondered if it made them even. With his sister gone, it would only be a matter of time before she reported back to the Imperials. Feelings didn't matter—Kaito needed to find Tameshi before someone else came looking for him. Ducking to escape a low branch, Kaito found a path between the hills that led to a clearing. He pressed a finger to his wrist, and his metal crane drone came to life, breaking into sharp fragments before fluttering into the air. Kaito touched his temple and sent the drone skyward, squinting at the distorted image that shuddered through the camera feed. He'd been caught up in more than a few scuffles during his time with the Reckoners, and his drone had paid the price. There was no point using the damaged tech to track anyone in Towashi's busy crowds, but Kaito was only looking for one person in the forest. No matter how blurry the feed was, it was better than nothing. The crane raced through the woodland, and Kaito followed behind, staying close to the river. When he spotted metal on his camera, he knew he was close. The rushing water in every direction masked the noise completely, but the makeshift laboratory was almost impossible to miss. Laid out across the side of a felled tree was a collection of odd machines, all connected with wires and warped light. Most of the research was made up of scraps of metal, including a large steel box perched at the far end. Kaito took one step forward. The box rattled in response. Not a box—a #emph[cage] . And there was something trapped inside. Kaito heard the snap of twigs over the cascading waterfalls, but by the time he turned, it was too late. Tameshi had the upper hand—and he used it to crack his fist against Kaito's cheek. Kaito stumbled, fingers folding quickly over his dagger, and pointed the blade at the moonfolk. Tameshi had pale lilac skin and hair spun in a high knot. His lanky build and smooth face gave away his youth. He couldn't be more than a year or two older than Kaito. Tameshi lifted a brow, blue robes fluttering as he hovered in the air, and laughed. "I didn't realize the monks of Jukai were so~primitive." He tilted his head. "I've seen better knives for scaling fish." "I'm not with the order," Kaito replied, studying Tameshi's body language for a weakness. "That explains the Undercity clothes. Reckoner, I presume?" He paused, calculating. "I knew word of my research would get out eventually. I'm just surprised the Imperials didn't get here first." "What can I say? Getting people to underestimate me is kind of my thing." Tameshi nodded toward Kaito's sad excuse of a weapon. "You're welcome to come back when you're more prepared. I'd hate for you to spend the next five minutes embarrassing yourself." Kaito cracked a smile. "If I made it too easy on you, it wouldn't be any fun." Tameshi shrugged. "Suit yourself." He withdrew a small rod from his belt and pressed it tightly to a panel on his chest. In an instant, the rod expanded, reshaping like folds of origami, until it transformed into a metal staff with a serrated edge. Tameshi twirled it several times in his hands. "Okay, now you're just showing off," Kaito muttered, finding the edge in his voice. He had a feeling he'd need it. Tameshi charged, sweeping his staff against Kaito's legs. Kaito leapt, steadied himself, and spun with his dagger wedged in his fist. Tameshi cracked his staff down again, and Kaito rolled out of the way, slicing at the air. He couldn't reach Tameshi—not with the staff blocking his every swing. He could barely reach his robes. But Kaito had trained with the best teachers on Kamigawa. Of all the things he learned, the most important was that if his opponent was stronger, then he needed to be faster. The next time Tameshi swung, Kaito didn't hesitate. He jabbed his blade against the serrated edge of the staff with just enough force to keep it in place, then snatched the rod with his free hand and swung his leg up, striking Tameshi's head. The blow knocked Tameshi to the side, but the moonfolk glided back up, hovering in the air and still holding tight to his weapon. Kaito refused to release his own hold on the staff and dug his heels into the earth. Tameshi retaliated, dropping fast to the ground. He threw his elbow toward Kaito's chin, but Kaito didn't falter. He used his weight to spin around Tameshi, keeping the staff in front of the moonfolk's chest, until he managed to pull the rod against his opponent's throat. Tameshi was taller, and stronger, but Kaito had never been one to back down from a fight. And Kaito couldn't lose this one—not when he needed the Reckoners to help him find the man from the rooftop. Everything Kaito did was an effort to bring the emperor home. She was Kaito's best friend—and she was worth every risk, no matter the odds. Kaito pulled hard, and Tameshi choked against the metal stick, pushing back with all his might. Kaito heard him gasp, but all he could see in his vision was a desperate, unyielding red. Eiko's voice snapped him from his frenzy. "Kaito, what are you doing? Let him go!" He flashed his eyes toward his sister, still holding tight to the staff. "I thought you left!" "I had to leave an offering for the kami. Because contrary to what you think, paying respect and following rules #emph[can ] actually make a difference." She took several steps closer, words edged with authority. "Stop it before you squeeze the life out of him. Have you forgotten he still has information we need?" Kaito gritted his teeth. "He started it!" "I don't care," Eiko hissed. "This is not how we handle diplomatic relations." Kaito huffed before releasing Tameshi with a shove. He curved both his fists over the staff. Tameshi bent over, coughing violently. When the air returned to his lungs, he eyed Eiko. "So," he rasped, rubbing his throat, "they sent the Imperials after all." Eiko folded her arms in response. Kaito searched the sky before pressing his temple to recall his drone. It only took a few seconds to appear, and when he held out his arm, the crane shifted like paper and reattached comfortably to his wrist. Tameshi's eyes widened in surprise. "Where did you get that?" "It was a gift," Kaito said thinly. "From someone I met a long time ago." "You know Katsumasa?" Tameshi dropped his arms. The fire in his eyes receded, replaced by a strange recognition. "How do you know that name?" Kaito demanded. It had been years since he'd met the moonfolk in the Imperial gardens, but he could still picture him. More than that, he still remembered the things Katsumasa spoke of—about the future, and technology—and how they'd made Kaito feel like there was so much more he wanted to know. "He was my mentor. The drone you have—it's the design we worked on together." A spark of pride filled Tameshi's eyes. "It's what I've been building my research on." Eiko scowled, eyes blazing with anger. "Your experiments with kami and tech—it's a violation of the very foundations of Kamigawa." Tameshi frowned. "I'm trying to #emph[protect ] kami." "Is that why you have one of them in a cage?" Eiko marched toward the display of equipment. There was no lock on the crate, but she yanked the door with such force that Kaito wondered if a lock would've stopped her at all. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/05.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) She stepped back, waiting for a kami to appear, when the silver face of a metal tanuki peeked its head around the corner and released several beeps and a whistle. Kaito blinked. "What is #emph[that] ?" The robot leapt to the ground, limbs clicking like a thousand pieces of metal were falling into place, and twisted its head toward Kaito. Its paneled eyes scanned him, and for a moment Kaito was sure it was the robot's attempt at curiosity. "I told you," Tameshi huffed, straightening. "My research is to help kami—and the rest of Kamigawa. We know our two realms are merging and that one day they will exist as one. But we still know so little about what's beyond the merge gates, or how our kinds will be affected when the merge is complete. If we're going to truly understand the kami, we need a safe way to study them. A way to preserve the kami existing on Kamigawa. Technology doesn't have to just be for us—it can be for kami, too." His voice was impassioned, and maybe a little wild. But Kaito couldn't find anything evil in his motives. He turned to Eiko—to see what she thought—when he realized she still hadn't moved. Her eyes remained pinned to the metal tanuki, lips parted slightly like she was stuck in a trance. "This robot is almost identical to the animal I saw." She turned to Kaito. "The one that appeared from the flash of light." Kaito frowned, turning to Tameshi. "My sister thinks this creation of yours is the reason the Emperor of Kamigawa vanished. Care to defend yourself?" "What you're accusing me of is impossible. This #emph[creation] didn't even exist until a few months ago." Tameshi's shoulders fell. "But I'm familiar with the creature you speak of. I've been searching for it, too." "Why?" Kaito challenged. "And what does it have to do with the emperor?" "The light you saw was a kami being born. A very rare kami, and the only one of its kind. It is the very embodiment of the relationship the emperor shares with Kyodai and the spirit realm," Tameshi explained. "I've been chasing it across Kamigawa for some time and looking for ways to protect it." He motioned to the metal tanuki. "It's what I built this prototype for." Eiko folded her arms. "There are thousands of kami all around us, and none of them have ever required a #emph[robot ] for protection." "A kami that embodies a connection with the spirit realm could have a radical effect on the merge gates," Tameshi said, and Kaito didn't miss the warning in his voice. "There are variables here we have not accounted for. So yes, I want to protect it, but I also want to study its relationship between the two realms." He shrugged. "Creating a connection between kami and machine would give it the armor it needs. Think of it like a protective mech suit. It would allow us to track the kami, and make sure it remains safe. And that #emph[we] remain safe, too." "That same research could allow someone to manipulate it." Eiko pointed out. "If the kami really can affect the merge gates, you'd essentially be giving that same power to whoever holds the controls." Kaito's stomach dropped. If Satoru knew the truth, he would never sell the schematics on the black market. He'd keep the kami for himself. And if the spirit really did have untapped power over the merge gates? It would make the Hyozan Reckoners the strongest cell in the city. Maybe even in all of Kamigawa. #emph[Nobody] should have that much power. Before anyone could say another word, a noise echoed outside of the canyon. A sound Kaito knew all too well. A shout, a song, and a whisper, like three voices layered on top of one another. #emph[The voice of Kyodai.] "It can't be," Kaito mouthed. He moved slowly across the grass, eyes scanning the distance for a flash of the great kami. Kyodai never left the temple. If she were here, in Jukai Forest~ Did that mean the emperor~ Had the emperor #emph[returned] ? Kaito didn't wait. The hope in his heart was too powerful. Too desperate. Ignoring the warning shouts from Eiko and Tameshi, he raced after the sound. He fought branches and brambles, kicking up clumps of dirt and running until his chest burned. There were so many things he wanted to say to her again. But mostly he just wanted to see her face and know that she was okay. Kaito skidded to a halt at the foot of an enormous camphor tree, the branches twisting in spirals and the leaves glittering an emerald green. But Kyodai wasn't there, and neither was the emperor. Instead, he saw the tanuki-shaped kami, with glowing white eyes and translucent fur. And the kami saw him. = The Path Forward Kaito's chest felt bruised. He'd really thought the emperor might be in Jukai Forest—and that hearing Kyodai's voice was a sign she had finally found her way home. But the tanuki kami standing in the grass wasn't the friend he'd lost. And it certainly wasn't the ancient kami from the temple. The creature released another layered call, quieter this time. With Tameshi's staff still in his hands, Kaito slowly sank to his knees, eyes never leaving the kami's glowing face. Tameshi said it was the embodiment of the emperor's bond with Kyodai. If that was the case, was there a part of her still here? Would she—would the kami—recognize Kaito? He set the weapon on the ground and pressed a hand to his chest. "I mean you no harm." He'd come to Jukai Forest for Tameshi's research, but now that he knew what it could lead to, and what the kami represented~ A knot formed in his throat. He had to keep the kami safe. Leaves fluttered behind him, and a dark object burst from the treeline, metal body glittering beneath the sun. It hovered in circles above Kaito before making a slow descent. When it landed on the ground beside the kami, they were nearly identical in build. The difference was that while one was clearly a robot, the other was as dazzling as starlight, with multiple golden orbs spinning carefully around its body. They were like the spheres that ran along Kyodai's back, only a great deal smaller. The robot beeped. The kami released a layered greeting. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/06.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Eiko and Tameshi appeared on the hill. When their eyes fell on the kami, Eiko's gasp was audible. She slowly made her way to Kaito's side, hand clutched at the material near her neck. "Did—did it say anything?" Kaito shook his head. "Kyodai spoke to the emperor telepathically. Maybe this kami works the same way." He met Eiko's eyes. "We have to protect it." Eiko nodded like it was never a question. When she spotted the tanuki robot, her face crumpled. She sucked in a breath before spinning to face Tameshi. "I was wondering how you were tracking my brother so easily. You didn't just build armor—you built a #emph[drone] ." Tameshi pressed his hands against the air. "We need to be able to locate the kami if they get lost or hurt." "Drones have been #emph[weaponized ] with the right upgrades," Eiko argued. "Do you have any idea what the repercussions would be for something like that?" Kaito tried to imagine a Kamigawa where spirits ran around with armor and blades like miniature mechs. Spirits that could be controlled by people like Satoru. The thought was unsettling. "That isn't the purpose of my research," Tameshi said, firm. "The design isn't about controlling the kami—it's about keeping them safe." "Safe from what?" Eiko demanded. Tameshi's jaw hardened. "From whatever is on the other side of the merge gates." Kaito and Eiko both fell silent. He wasn't just trying to study the kami and the merge; he wanted to study what was on the other side. "You're trying to send kami back to the spirit realm," Kaito clarified. "If I can find a way to connect kami and drone, then eventually, yes." Tameshi sighed. "There's still so much we need to learn. And the knowledge is out there—we just need to be brave enough to find the key and open the door." "You don't care about the kami. You're just trying to protect the information they'd bring you if they could move between realms." Eiko clenched her teeth. "Your research threatens the balance of Kamigawa. It can't continue." Tameshi was stoic. "We already have the ability to channel with the kami. Is this really any different?" "A channeler has built a #emph[relationship ] with the kami. There's trust, and mutual respect. It's meant to be a gift." Eiko sounded exasperated. "What you want to do is capture their power and give it to whoever the highest bidder is." "No, I—" Tameshi started, but Eiko wasn't finished. "You might not intend for it to be a weapon, but it is. And if your research gets out, someday someone will use it to their advantage." Tameshi looked away, flustered. "What I'm trying to accomplish is not about greed. It's about understanding. The merge gates are proof that there is more to life than what we know. And to have that kind of knowledge—to lift the veil of the unknown—it may require sacrifices some aren't willing to make." Eiko shook her head. "Power requires balance. And in the wrong hands, your knowledge could #emph[destroy] the merge gates. It could destroy Kamigawa." Tameshi's gaze shuttered. "You say that because you're too stubborn to look ahead to the future. Of what Kamigawa will someday become, and the steps we need to take to make sure that future remains stable." His eyes flashed open. "The Imperials will fail us all if they don't take bigger risks to study the merge." "We are protecting the plane we have now." Eiko's voice didn't waver. "Your research—it needs to be destroyed." At that, Tameshi's shoulders sank. "I'm so close. If I could just—" The small kami howled again, voice raised in warning. Kaito's instincts clamored in agreement with the kami's distress. Something wasn't right. The forest had gone far too quiet, and there was an emptiness in the air, almost like—Kaito stiffened. The last time he'd felt this way was in Satoru's den. The grass rustled nearby, and Kaito spun to find Satoru's spies. Five Hyozan Reckoners, their belts littered with blades and their arms etched in colorful ink. The one in front was the woman with needle-tipped gloves. Nari—the Reckoner with an expertise in poisons, her hair scraped back into a high braid. And behind her was Satoru's channeler. Nari flashed her teeth. "Satoru sends his regards." #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/07.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Kaito tried not to react when tendrils of black smoke poured from the channeler's skin, snapping at the air like vipers. "I don't remember putting a request in for a babysitter," he said. Nari sniffed, flicking her claws at the air." Satoru always did wonder whether you were a spy. A former samurai is one thing, but an Imperial student?" She tutted. "Hard to believe anyone would leave such pretty walls unless they were #emph[ordered] to." "Sorry to disappoint you, but I'm not a spy." Kaito's fingers danced at his sides. His knife was tucked in his belt and the staff was still in the grass; there was no chance of reaching either weapon before the Reckoners retaliated. "Satoru knows that. Why do you think he hand-picked me for this job?" Even her words were laced with poison. "Probably for the same reason he asked us to keep an eye on you." They'd been watching him. How did Kaito not realize? How did he not sense them? For a moment he could hear Light-Paws's voice in his head, telling him he was too brazen and overconfident, that his ego was creating blind spots. Kaito tried not to scowl. Bluffing was the only card he had left. "If you've been tailing me, you know I came here for the schematics," he said with a shrug. Even if they #emph[had] been following Kaito, what could the Reckoners possibly have on him? Up until he came face to face with the kami, he'd never intended to double-cross Satoru. Everything he'd done before that was to get ahold of Tameshi's research. The channeler lifted her gray face. "You know I channel Azamaki, Treachery Incarnate." She didn't blink, but when the smoke formed into insect-like pincers that expanded from her spine, Kaito took several steps back. "Did you really think I wouldn't sense your betrayal?" One of the Reckoners moved quickly, grabbing hold of Eiko and holding a sword against her neck. Kaito clenched his fists, face growing hot. "If you hurt her—" Nari waved a hand. "You sought out an Imperial to help you. An Imperial you #emph[knew ] would report us." She lifted a thin brow. "It's all the proof Satoru will need to see you're a spy." Kaito's mind desperately tried to piece together a plan. But all he had was a way to stall for time. "Was this a setup from the beginning?" he asked, determined to keep the conversation going for as long as he could. "Did Satoru even #emph[want] the research?" "Of course he did," Nari replied. "Your loyalty may have been feigned, but your talents were not. He hoped you'd lead us to Tameshi." She flashed her canines. "And you did." Kaito inhaled sharply when he heard the kami move behind him. He wasn't sure if the Reckoners understood its significance, or if they knew quite how rare it truly was, but Kaito had understood the moment he heard its voice. He needed to get the Reckoners far away from the kami. Kaito tried to draw their focus. "The schematics aren't here. They're back at his camp." He turned to the moonfolk. If Tameshi really did want to protect the kami, this was the only option. Though Tameshi's face was ashen, he gave a curt nod like he understood more than Kaito did. "I can take you there," he said to the Hyozan. "But only if you let the others go." #emph[What are you doing?] Kaito wanted to hiss. Tameshi was practically a stranger. He didn't owe Kaito anything. But he was trying to spare them from harm, in whatever small way he could. Nari laughed. "You are hardly in a position to be making deals." Tameshi scowled. "You'll never make sense of the research. Not without my help. So either let them go, or I'm not telling you a thing." Nari stalked toward him and lifted Tameshi's chin with one hand, nails dangerously close to breaking skin. "You will." She tilted her head and gestured to one of the other spies. "We don't need witnesses. And don't forget the kami." She met Kaito's stricken gaze. "Something tells me we might need it." Kaito snarled and was bending his knees to lunge for the nearest spy when Eiko slammed her head back against her captor's face. As the Reckoner growled in pain, Eiko pulled her sleeve up to reveal a hidden weapon. A metal coil unwound from her, the miniature blades connected by a glowing white light, until they formed a sword. She gripped the hilt and swung for another Reckoner's neck with impeccable speed. Kaito didn't have time to gape—he hurled himself at one of the Reckoners and pinned him to the ground. Throwing several punches against the man's face, Kaito used the distraction to scramble for Tameshi's staff. He recovered it just in time to block a steel blade flying toward his chest. The Reckoners became a whirlwind of steel and fury. Kaito fell back, blocking again and again, staving off as many of them as he could until he reached Eiko on the battlefield. "What happened to 'no weapons'?" Kaito managed to shout as they fought back to back. Eiko grunted, kicking one of the assailants square in the chest. "This is diplomacy. When words fail, we use our blades." Her sword met flesh, and as the man fell, she threw a look over her shoulder. "I told #emph[you ] no weapons because I knew you would do the exact opposite." Several yards away, Tameshi landed beside the kami. Kaito couldn't hear him over the frenzy of weapons, but he could tell by the way he was holding onto the robot that he was trying to get the kami to merge with it. But the kami refused. Kaito strained beneath Nari's sword. The only thing keeping her back was the metal staff between them. He grunted, shoved hard, and swung his weapon to meet hers. Kaito and his sister may have been trained by the most elite samurai on Kamigawa, but they were clearly outnumbered. With every clash of metal against metal, Kaito's fear flowed to the surface of his mind. If something happened to his sister, he'd never forgive himself. He knew she would watch over the kami. She'd make sure Tameshi's research never fell into the wrong hands. She would do what was best for Kamigawa, and the emperor. If only one of them was going to make it out of the fight, he wanted it to be Eiko. "Take Tameshi and the kami and run," Kaito hissed. "Whatever you're planning, you can forget it," Eiko hissed back. "I'm not leaving you behind." Kaito opened his mouth to argue as a roar broke through the trees. The Reckoners hesitated only for a moment, and when Kaito looked up at the ridge, hope seeped back into his chest. The Order of Jukai had arrived. A woman with yellow flames in her hands stood at the edge of the hill. Seven glowing stones floated beside her, and she wore a helmet made of bone. All around her were at least a dozen more kami channelers, clad in leather armor and ready for a fight. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/08.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Nari released a guttural shout, and then—chaos. The Order of Jukai met the Reckoners in the clearing, and the once-silent forest filled with battle cries. It was a whirlwind of black smoke and yellow flames. Kaito grabbed Eiko by the arm and tugged. "We need to go!" Eiko's breathing was heavy. "But the Order—" "—are not going to be very happy with us if they win this fight," Kaito pointed out. "It isn't safe here. For any of us." He turned to look at the tanuki kami. Whatever happened, he needed to get the spirit out of the forest. Tameshi sent his drone for cover in the clouds. "I tried to explain, but she won't come with me." "She?" Kaito repeated, staring straight into the kami's bright eyes. He knelt to meet her. "These people—they'll hurt you if they get the chance. I need to take you somewhere safe." The tanuki stared back. Kaito took a breath and hoped the silence was an understanding between them. "Please don't bite me," he mouthed, and scooped the kami up in his arms. When he ran, Eiko and Tameshi followed him. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The woods were a blur of moss and bark. Kaito felt his throat burn with each running stride, desperate to catch his breath. There was only one place he knew the kami would be safe, but he needed to get over the border first, and far from Jukai Forest. Tameshi and Eiko weren't far behind. He could hear his sister's footsteps and the rush of air each time Tameshi flew under a branch. The moonfolk could've left them at any time and soared back to Otawara without a second glance. But he didn't. He stayed by their sides like he was more friend than foe. Kaito decided that someday—if they made it out of the forest in one piece—he'd find a way to repay him. The ground rumbled, and Kaito froze in his tracks. "Please tell me that's another rock kami," he said warily, watching the earth for movement. Eiko appeared on his left, face drained of color. A kami exploded from the river, and the entire forest seemed to shudder in response. With an ear-splitting cry, the spirit tore past the trees, felling one of them with a mere slice of its bone-like arm. It moved in erratic bursts, long limbs stretched out like it was searching by touch. Two orbs of unnatural green light glowed from a delicate stone face, but the carved smile it wore didn't match the anger radiating from its core. Frail as a skeleton, it had enough arms and legs to rival an insect, with heavy black cobwebs that fell over its crooked shape like a veil. Silk thread trailed from one of its bony fingers, fixed to a paper lantern that swayed in front of its chest like a pendulum. #emph[Gravelighter, the Kami of Forgotten Clearings.] #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/09.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) "I—I'll try to talk to her," Eiko murmured, almost too low for Kaito to hear. "It's way too dangerous," Kaito started, but she pressed a hand against his forearm, and then a finger to her lips. She wanted him to stay quiet. The kami flashed toward them, head rotating at odd angles, searching for the sound as if her glowing eyes couldn't see anything at all. Eiko knelt, pinning her eyes to the ground. "I am <NAME> of the Imperial Palace, and a Kami Diplomat." The moment she spoke, the kami slammed into the earth in front of her. Eiko's hair fluttered at the movement, but she didn't recoil. "It was not our intention to disturb you, nor do we mean to trespass in the forest any longer. We ask for safe passage to return to Boseiju." Gravelighter cracked her stone mouth open, too wide to be anywhere near human, and all Kaito could see was a horrible black void. The kami stopped inches away from Eiko's bent neck, sensing her posture, and her presence. When Gravelighter reared back too quickly, Kaito didn't know if she was going to leave or attack. He assumed the latter. "No!" Kaito shouted, bursting from his place in the grass and skidding in front of his sister. The kami wailed, and Kaito squeezed the tanuki close to his chest and wrapped an arm around Eiko like he was protecting her. Like he was protecting them both. The Kami of Forgotten Clearings ripped through the trees, splitting branches and pummeling the earth, and raced straight for Kaito's exposed back. But before she landed her attack, the tanuki kami leapt from Kaito's arms and flew toward the larger spirit. Starlight exploded around them. Kaito squinted. He couldn't see what was happening—it was too bright, and both kami were moving too fast. But it was enough time to pull Eiko to her feet and usher her toward Tameshi. "Go!" Kaito shouted. "I'll catch up!" Tameshi took Eiko by the waist and lifted her out of the way of splitting earth and flying stones while Kaito ran back for the tanuki. He held up a hand, staring at the heart of the light in search of the small creature. And he saw her, flickering left and right, trying to distract Gravelighter—except it only seemed to anger her. The Kami of Forgotten Clearings swung an arm back, preparing to swipe at the tanuki with all her strength, when Kaito leapt, grabbed hold of the smaller kami, and rolled out of the way. With deadly force, the arm smashed into the forest floor, rattling the surrounding woodland. Kaito searched the tanuki's eyes, frantic. There was nowhere to flee; he wasn't fast enough, and he'd never in his life fought a kami. He'd never even been trained for it. All he could do now was hold her close and brace for the next impact. But it didn't come. Kaito peeled his eyes apart and found Gravelighter staring at him with her strange, marble face. She stretched her bone fingers closer, stopping inches from the tanuki's body. The tanuki let out a cry in response. No—not a cry. #emph[A command] . Gravelighter released a breath. The rumble made Kaito jerk backward—and then the Kami of Forgotten Clearings dove back into the river, water spraying in every direction, and vanished from sight. Kaito shivered, looking down at the small kami still protected in his arms. "I—I guess that means we can go?" The kami answered with a layered chirp, and Kaito got to his feet, wiped the river water from his forehead, and hurried to find his sister and Tameshi. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The group reconnected near the border, to Eiko's visible relief. "You could've been killed." She squeezed her arms around Kaito's neck, voice muffled. Between them, the tanuki kami gave a growl before jumping to the ground. Eiko pulled back and bowed apologetically. "Thank you. I think you may have saved our lives in the forest." Kaito watched the kami stretch her legs, golden orbs dancing in circles. "Yeah. And she's not the only one." They both turned to Tameshi. "You were going to give up your research to protect us," Eiko said. Tameshi's eyes glinted. "Don't look at me like I'm a hero, because I'm not. Most of my research is up here." He tapped the side of his head. "And the rest of it? Well, I never keep all my research in one place. I was stalling, waiting for the Order of Jukai to turn up. I'm just glad they got my message in time." Kaito felt the shockwave like a punch to the gut. "#emph[You] sent for them?" Tameshi laughed. "I'm not going to set up a research lab in Jukai Forest without making sure I have security cameras." He shrugged. "When I saw the two of you, I sent a drone to their temple. I figured you all could fight it out amongst each other while I got my equipment somewhere safe. Which, I'd like to point out, turned out to be an excellent idea." Kaito shook his head. "And here I was, trying to decide whether I liked you." Tameshi chuckled, and Kaito cracked a smile. "We are grateful for your help. But I still have a duty to report you to the Imperials," Eiko said quietly. "And when I do, there'll be a mark against your name. They'll keep a close eye on you and anything you do for the rest of your life." Tameshi waited. "Unless?" There was another long pause. "Unless you agree never to continue this research," Eiko finished. "For the rest of my life, huh?" Tameshi pretended to weigh his options. "Well, I #emph[do] enjoy a challenge~" Kaito snorted, and Eiko cast him a glance. "I know he sounds like you, but#emph[ try] to remember you're on my side." Kaito lifted his shoulders. "What? As far as team players go, he isn't the worst." Tameshi beamed. "I appreciate the compliment." Eiko ignored their budding friendship and crossed her arms. "Do we have an agreement?" "You don't need one." Tameshi sighed. "I may have created a prototype to merge kami and tech, but I wanted them to possess it of their own accord. It should be their #emph[choice] ." Eiko frowned. "No kami would willingly sacrifice their freedom that way. It goes against their nature. Kami channelers are few and far between, but they exist because there's an exchange. Something #emph[shared] . A kami would have no reason to merge with a drone." "You're right. Which is why I've been searching for this little one." Tameshi nodded to the tanuki. "A kami born in the mortal realm is a new phenomenon. I thought perhaps being #emph[born] differently would lead her to #emph[react] differently." "But she refused you," Kaito acknowledged. "When the Reckoners attacked, you tried to get her to merge with the tech, and she wouldn't. Not even to save herself." Tameshi released a disappointed hum. "I am not one to easily admit defeat." He shook his head. "But you don't need to be concerned with my research. Not without a willing kami participant, which doesn't seem to exist." Eiko nodded. "Good." "Still, you're welcome to keep tabs on me." Tameshi winked. "I can't promise my next project will be #emph[entirely] Imperial approved." Her lips curved. "Something tells me I'm going to regret you and my brother meeting today." Tameshi pressed a panel on his belt, and his tanuki drone flew down to Kaito. "Take it. It's far better than that outdated crane you've been holding onto." Kaito's eyes widened. "I—are you sure?" "You can buy me lunch when you come to Otawara," Tameshi replied. "Katsumasa would love to see an old friend." "Thank you," Kaito said earnestly. He took the robot with both hands and flattened his lips to keep from smiling too wide. "I better clear what I can from my lab. It would be a shame for the Order of Jukai to destroy perfectly good equipment." Tameshi glanced at the kami. "Good luck out there. And thanks for the chase—it's been fun while it lasted." They watched him disappear back into the forest, and it was Eiko who spoke first. "So what now?" she asked. "Well, now you take our new friend back to the palace with you," Kaito replied simply. Eiko pulled her face back. "To Eiganjo?" Kaito shrugged. "If she really has a connection to the emperor and Kyodai, then who better to watch over her than the great kami herself?" On the ground, the tanuki kami was staring at them, listening intently. Kaito didn't particularly enjoy goodbyes, but he hadn't expected this one to tug at his chest so hard. He cleared his throat. "You should head to the train station before the Order comes back." Eiko stilled. "Where will you go?" He knew her meaning. He wasn't exactly going to be welcome in the Undercity any time soon. The Reckoners likely lost the fight, but there was always a chance some of them fled. Kaito preferred if word about what happened #emph[didn't] get back to Satoru, but it would be safest to lay low for a while, just in case. "I'll be fine." Kaito grinned. "Don't worry about me." Eiko pursed her lips. "You know what I think?" "That you've had way more fun here than you've ever had in Eiganjo?" Kaito offered. She made a face. "I think you never intended to give those schematics to Satoru. I think you asked for my help because you wanted to do the right thing. You're just too stubborn to admit it." Kaito laughed. "You still think there's an Imperial in me, but I promise—I'm an outlier through and through." Eiko looked down at the tanuki. "It would be good if we had something to call her. A kami this important deserves a formal introduction when we reach the palace." "Aren't you supposed to be an expert on kami relations?" Kaito pointed out. "How do you usually find out their names?" "It's not always that simple," she said. "Sometimes it's through words, or body language. Sometimes it's telepathic. But in some cases, you have to earn their trust before they'll properly communicate with you." "I vote we call her Pompon-chan for now," Kaito said. When the spirit let out a layered chirp, he grinned. "See? She likes it." Eiko moved to pick up the kami, but the tanuki immediately leapt out of her reach. When Eiko took another step, the kami scurried behind Kaito's feet for shelter. "Don't worry," Kaito said. "You'll be in good hands. My sister is one of the best people in Kamigawa—you just have to get past the frown lines." He took a step away, trying to encourage the kami to go to Eiko, but the kami released a frustrated howl and hid herself behind Kaito once again. Eiko lifted a brow. "I don't think she wants to go to the temple." "Well, she can't stay here alone. The Reckoners know about her. It's not safe," Kaito said. Eiko held back a laugh. "For someone who thinks they're so clever, you are terrible at seeing what's right in front of you." Kaito blinked. "But—I don't understand." He shook his head at the kami. "I have nothing to offer you. No shelter, or food. I barely know what I'm doing half the time." He ran a hand through his hair. "I just know that I need to find someone, and I'm not planning on stopping until I figure out how to bring her home." The kami's eyes brightened. Eiko pressed a hand against Kaito's shoulder. "Maybe that's exactly what she wants." Kaito leaned down in the grass, drone still wedged against his chest. "You want to help look for the emperor, too?" The kami let out a sound that mimicked Kyodai's song, and Kaito recognized the relief behind the light. The sense of purpose. Maybe the kami was never hiding in Jukai Forest. Maybe she was #emph[searching] . Kaito nodded like he understood. "Okay. I guess it's you and me from now on." Without warning, the kami leapt for Kaito's chest and bonded herself to the tanuki prototype. There was a flash of light, and metal fluttering like a trillion chrome hummingbirds. When the light eased, the tanuki drone blinked from behind its glass eyes. It clambered up Kaito's arm until it found a place to rest on his shoulders. A noise trickled into his mind, steady at first and faint as a bell, but in the seconds that followed the noise became an unmistakable chant. Kaito could hear it then—the kami's name, echoing through his mind. When he turned to look at the tanuki, she lowered her head, and a gentle understanding passed between the two of them. "Her name," he said slowly. "She says her name is Himoto." Kaito stood to face his sister, whose mouth was parted in fear. Tameshi's research—she'd tried to stop it. Tried to make sure it would never fall into the wrong hands. And now the very proof of it was sitting on Kaito's shoulders like a beloved pet. The tanuki robot shifted once more and drifted into Kaito's hands. When he turned it over, he realized it had morphed into a mask. He stared at the smooth edges and origami cutouts, wondering if a connection to the emperor really did live inside Himoto and if choosing to stay with Kaito meant anything at all. When he placed the tanuki mask over his face, he felt it immediately#emph[.] Energy thrummed in his core, all the way to his fingertips. It was like static and magic and power, begging to be released. Begging for Kaito to #emph[let go] . Somewhere behind him, Eiko was calling his name. Shouting with desperate, terrified breaths. But Kaito couldn't answer her. Something was pulling his soul in another direction—to another plane—and he couldn't fight it. He didn't #emph[want ] to fight it. For the first time in years, Kaito felt as if he knew exactly where he was meant to go. The power burst through him, coursing through every bone and vein. Kaito let it consume him entirely—and when he felt the tug against his soul once more, he answered the call as if it had been fate all along. Kaito took a step forward and vanished from Kamigawa. = Epilogue The familiar smells of Towashi made Kaito's mouth water. It had been a year since he'd tasted pork dumplings and curried rice—not because he hadn't returned to Kamigawa, but because he never stayed for very long. The emperor was still out there, somewhere in the Multiverse. He couldn't let street food distract him. When Himoto, the Kami of the Spark, turned Kaito into a planeswalker, he knew it must've been for a reason. That somehow the spirit realm had known Kaito was the only person on a hundred planes who would never stop searching for her. He'd made a promise, after all. Kaito reached for his tanuki mask and slid it over his face, shielding himself from the crowds. He'd always known how to make himself invisible, but these days, it was practically an art form. The Multiverse had information he needed—and in Kaito's experience, it was always better when his enemy didn't see him coming. Kaito pulled up his collar and stepped onto the pavement, the city reflected in every puddle around him. He was a shadow among neon lights, who could disappear at a moment's notice. And he would, soon enough. But today, Kaito had a friend on Otawara who wanted to see him, and a sister in Eiganjo who was waiting on news. And after that? There were many more planes to search. #figure(image("001_Kaito Origin Stories: A Test of Loyalty & The Path Forward/10.jpg", width: 100%), caption: [Art by: Yongjae Choi], supplement: none, numbering: none)
https://github.com/katamyra/Notes
https://raw.githubusercontent.com/katamyra/Notes/main/Compiled%20School%20Notes/CS2110/Quiz2StudyGuide.typ
typst
#import "../../template.typ": * #show: template.with( title: "CS 2110 Quiz 2 Study Guide", authors: ( ( name: "<NAME>", ), ), ) #set text( fill: rgb("#04055c") ) = K-Maps == Gray Codes #definition[ *Gray Codes* are a specific ordering of binary system where successive values can only differ by one bit. ] == Step 1: Create the K-Map Distribute the variables across the rows and columns using Gray Code order, and fill in the corresponding entries with either 1's, 0's, or X's #note[ We use *X*'s when we have a "don't care condition". Basically, this is when a certain condition will never occur or are not important to an application. You can choose these to be 0/1 if it makes grouping easier. ] == Step 2: Make Groupings #theorem[ *Rules for Groupings:* - Groups must be rectangular, but can wrap around edges and corners - Size of groups must be a power of 2 (including size 1) - Have as few groups as possible ] == Step 3: Create Simplified Expression You can find the simplified expression based on which terms _don't_ change between the 1's in a group = Storage == Address Space & Addressability #definition[ *Address Space* is the number of distinct locations you can access in memory. ] #definition[ *Addressability* is the amount of data stored at each location ] `Total Memory = address space * addressability` == RS Latch These are the basis of sequential logic, used to remember 1 bit. #image("Images/RSLatch.png", width: 100%-100pt) #note[ *RS Latches* are in a *quiescent state* when both S and R are 1. If we set S to 0, it sets the value to 1, and if we set R to 0, it resets the value to 0. Both S and R being 0 is an invalid state that we don't use. ] == Gated D-Latch These are RS Latches with a modified interface that allows us to access the value of storage when D = 1, and flip the value of storage when D = 1 and WE (write enable) = 1. #image("Images/DLatch.png") == D Flip Flops Gated D latches update immediately when WE is 1. Instead with D Flip FLops, the output changes only when WE changes from 0 to 1. == Edge vs. Level Triggered Logic #definition[ *Level Triggered Logic*: change happens whenever the clock has a 1 input and is level. So any time its at 1, the output can change. On the other hand, *edge triggered logic* only changes at the exact moment that the clock switches from 0 to 1. ] #note[ RS Latches, D Latches, and memory are all level triggered. Flipflops and registers are edge triggered. ] Registers are often only use for short term memory access, so we have them be edge triggered for synchronous operation where data is only transferred when the clock signal changes, ensuring its reliable. On the other hand, memory is often level triggered because this allows for continuous access to stored data, which allows for asynchronous operation where data can be accessed without strict synchronization. *Registers* Since registers are edge triggered, we created them simply by combining multiple D flip flops *Memory* Memory is more complicated, we use a lot of Gated D Latches alongside a decoder (to find which address line to get) #image("Images/Memory.png", width: 100%-75pt) = State Machines Digital logic structures that _both_ process information _and_ store decisions are called *sequential logic circuits*. #definition[ The *state* of a system is a snapshot of all the relevant elements of the system at the moment the snapshot is taken. ] #definition[ A *finite state machine* consists of five elements + A finite number of states + A finite number of external inputs + A finite number of external outputs + An explicit specification of all state transitions + An explicit specification of what determines each external output value ] State machines take in a state and action to spit out a new state and signal. We create them by building a combinational circuit (so kmaps) and adding sequential logic components, such as registers. The combinational circuit generates a new state that gets stored in the sequential component, which is then fed back into the combinational circuit. == The Synchronous Finite State Machine In the soda machine example for state machines, we could wait very long before having to put in the last coin into the machine and it would still work. However, most computers are different in that they are *synchronous*, meaning that the state transitions take place at identical fixed units of time. This is often done with the use of the *clock*, which produces a value which alternatives between 0 and some voltage in a repeated sequence of identical intervals known as the _clock cycle_. = LC-3 == Von Neuman Model A type of computer architecture known as the *Von Neuman Model*, which stores both data and program instructions in the same memory unit. Main Components: + I/O + Memory Unit + Control Unit + Arithmetic/Logic Unit == The PC The *program counter*, or PC, stores the _address_ or the next instruction, often a 16 bit value because the addresses are 16 bits. Main ways that PC can gte updated: - PC + 1 - Bus: PC set to value on bus - *PC + Offset*: offset value is added to incremented PC value for branching == Macrostates Each LC-3 operation goes through a cycle of three macrostate: Fetch-Decode-Execute === Fetch #definition[ *Fetch* is responsible for retrieving an instruction from memory and preparing it for easy access. It takes three different clock cycles + Take the address of the next instruction from PC and put it in MAR so we can access memory. Increment PC so it is ready for the next macrostate cycle. + Access the value of the instruction from memory and put it in the MDR, preparing it for the bus + Take the value from the bus and put it into the IR so it stores the value of the current instruction ] === Decode Once the instruction is in the IR, the finite state machine (FSM) uses the instruction's opcode and typical FSM logic to decide which instruction to execute. === Execute After the FSM decodes the instruction, it asserts signales through the data path to execute the specified operations. === Microstates While each operation has the same fetch and decode cycle, its execute phase has differing amounts of microstates depending on the context. == LC-3 Instructions Each instruction can be split into multiple parts. The first four bits are the opcode, which defines which operation we are doing. There are three types of instructions: - *Operate instructions* act on data, such as ADD and NOT - *Data movement instructions* move data around inside the data path and to/from I/O devices - *Control instructions* change the order in which the program will execute later instructions, such as JMP === Addressing Mode Instructions are comprised of their *opcode* and *operands*. Operands are things such as our source/destination register, or offesets, and how these operands are used to complete an instruction determine their addressing modes. ==== Immediate bits vs register When doing operate instructions specifically ADD and AND, the arithmetic operation can specify if the second operand in the addition will be either a 2nd source register or a sign extend immediate 5-bit value. + DR #sym.arrow.l SR1 + SR2 + DR #sym.arrow.l SR1 + sext[imm5] Note that imm5 is a sign extended 2's complement, so it ranges from -16 to 15. Whether the operate instruction uses register addressing or this immediate value is determined by bit 5 of the instruction. Bit 5 is sent to the SR2MUX, therefore choosing between this second source register immediate value. `ADD = [0001] [DR] [SR1] [0] [00] [SR2]` vs `ADD = [0001] [DR] [SR1] [1] [imm5]` ==== PC-relative vs Base + Offset vs Indirect When we do these data movement instructions, we often take a trip to memory. However, how can we give an address (16 bits) when we only have 16 bits for the whole instruction? #theorem[ *PC Relative* Pc relative calculates our memory address from `mem[PC* + PCOffset9]` Since our given offset is only nine bits, we can only load addresses [-256, 255] from our current PC `PC*` denotes that our PC has been incremented. This is already done by default in fetch. ] #theorem[ *Indirect* Indirect addressing calculates our memory address from `mem[mem[PC* + PCOffset9]]` This means our final address is the value we found at `mem[PC* + PCOffset9]]` #example[ For example, if our PC = x3002 and our PCOffset9 = x00001, we go to mem[x3003]. If mem[x3003] has hex value x5000, we go to mem[x5000] and load/store the value to/from memory. ] This allows us to theoretically get to any point in memory. ] #theorem[ *Base + Offset* Base + Offset addressing calculates our memory address from `mem[BaseReg + offset6]` #example[ For example, if R0 = x4000 (assuming its our base register) and our offset6 = x0005, we go to mem[x4005] ] ] === Control Instructions Control instructions are used when we want loops or conditional statements, go-tos, etc. Basically, anytime we don't want to run our program line by line. #theorem[ *BR* - this branch instruction uses the CC to determine whether or not to branch to a new PC value. For example based on a CC register value we might update our PC value, otherwise we use our current `PC*` as our PC. ] #theorem[ *JMP* - this _always_ updates the PC value, by doing PC #sym.arrow.l BaseReg. Fact check? ] === List of Some Instructions #theorem[ *LD*: Opcode 0010 LD is the load instruction. It loads the value at the memory address PC + PCOffset9 and stores it in a destination register. `DR = mem[PC* + PCPOffset9]` Also sets CC ] #theorem[ *LDI*: Opcode 1010 `DR = mem[mem[PC* + PFOffset9]]` Allows you to access memory further from the PC Also sets CC ] #theorem[ *LDR*: Opcode 0110 Adds the value of base register and a 6-bit 2's complement number to determine address in memory to load into destination register. `DR = mem[BaseR + Offset6]` Also sets CC ] #theorem[ *LEA* Used to calculate the effective address of an operand in memory and load that address into register without actually accessing the memory. DR #sym.arrow.l PC + PCOffset9 ] #theorem[ *ST* Puts the contents of a register into memory at the specific address (PC + offset) ] == Datapath #definition[ The *bus* is a 16-bit wire on the datapath that is connected to most of the major components in the LC3, and is used as a highway to transmit data. We can only have one signal on the bus at a time, which we control with *tri-state buffers*. ] #definition[ The *control code register* is a special register that holds 3 bits (N, Z, P) that tells us if an expression evaluates to negative, zero, or positive, using 1-hot representation. #note[ The following instructions set the condition code: ADD, AND, NOT, LD, LDR, LDI ] ] #definition[ The *finite state machine* decides the value of the next state based on the current state and current input (action). ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/truthfy/0.1.0/main.typ
typst
Apache License 2.0
// Transform a simple math equation to a string #let _strstack(obj) = obj.body.children.map(subobj => { if subobj.has("text") { subobj.text } else { if subobj.fields().len() == 0 { " " } else { _strstack(subobj.fields()) } } }).flatten().join("") // Replaces #let _replaces = (names, vals, obj) => { // Basic operations, they doesn't need a particular approach let text = str(obj.replace("∧", "and").replace("∨", "or")).replace("¬", "not") // => Approach // Please implement the do while :pray: while true { let pos = text.match(regex("([(]+.*[)]|[a-zA-Z])+[ ]*⇒[ ]*([(]+.*[)]|[a-zA-Z])+")) if(pos != none) { text = text.replace(pos.text, "not " + pos.text.replace("⇒", "or")) } else {break} } // <=> Approach while true { let pos = text.match(regex("([(]+.*[)]|[a-zA-Z])+[ ]*⇔[ ]*([(]+.*[)]|[a-zA-Z])+")) if(pos != none) { text = text.replace(pos.text, "(" + pos.text.replace("⇔", "==") + ")") } else {break} } // ⊕ Approach while true { let pos = text.match(regex("([(]+.*[)]|[a-zA-Z])+[ ]*⊕[ ]*([(]+.*[)]|[a-zA-Z])+")) if(pos != none) { text = text.replace(pos.text, "not (" + pos.text.replace("⊕", "==") + ")") } else {break} } // Replace names by their values for e in range(names.len()) { text = text.replace(names.at(e), vals.at(e)) } return text } // Extract all #let _extract = (..obj) => { let single_letters = (); for operation in obj.pos(){ let string_operation = _strstack(operation).split(" "); for substring in string_operation { let match = substring.match(regex("[a-zA-Z]")); if match != none and (match.text not in single_letters) { single_letters.push(match.text) } } } return single_letters } #let generate-empty = (info, data) => { let base = _extract(..info) let bL = base.len() let L = calc.pow(2, bL); let iL = info.len() let nbBox = (iL + bL) * calc.pow(2, bL) if data.len() < nbBox { for _ in range(nbBox - data.len()) { data.push([]) } } table( columns: iL + bL, ..base, ..info, ..(for row in range(L) { ( ..for col in range(1, bL + 1).rev() { let raised = calc.pow(2, col - 1); let value = not calc.even(calc.floor(row / raised)) ([#int(value)],) } ) (..data.slice(row * iL, count: iL).map((a) => [#a])) }) ) } #let generate-table = (..inf) => { let info = inf.pos() let base = _extract(..info) let bL = base.len() let L = calc.pow(2, bL); let iL = info.len() let nbBox = (iL + bL) * calc.pow(2, bL) let transform = info.map(_strstack) table( columns: iL + bL, ..base, ..info, ..(for row in range(L) { let list = (); ( ..for col in range(1, bL + 1).rev() { // The left side let raised = calc.pow(2, col - 1); let value = not calc.even(calc.floor(row / raised)) list.push(value) ([#int(value)],) } ) let x = list.map(repr) ( ..for col in range(iL) { // The right side let m = _replaces(base, x, transform.at(col)) let k = eval(m); ([#int(k)],) } ) }) ) }
https://github.com/mathias-aparicio/simple-preavis
https://raw.githubusercontent.com/mathias-aparicio/simple-preavis/main/lib.typ
typst
MIT License
#set text(lang: "fr") // le complément est optionnel #let adresse(rue, codepostal, ville, complement: "") = ( rue: rue, complement: complement, codepostal: codepostal, ville: ville ) // Formatte bien l'adresse #let affiche_adresse(adresse) = { [ #adresse.rue \ ] if adresse.complement != "" { [ #adresse.complement \ ] } adresse.codepostal + " " + adresse.ville } #let date_en_francais(date) = { // Liste d'associations mois anglais -> français let mois = ( "1": "janvier", "2": "février", "3": "mars", "4": "avril", "5": "mai", "6": "juin", "7": "juillet", "8": "août", "9": "septembre", "10": "octobre", "11": "novembre", "12": "décembre" ) let day = str(date.day()) let month = date.month() let year = str(date.year()) day + " " + mois.at(str(month)) + " " + year } #let locataire(nom, prenom, adresse) = ( nom: nom, prenom: prenom, adresse: adresse ) #let proprietaire(nom, prenom, adresse, genre) = ( nom: nom, prenom: prenom, adresse: adresse, genre: genre ) #let lettre_preavis( locataire: locataire, proprietaire: proprietaire, date_etat_des_lieux: datetime ) = { // En-tête locataire align(left)[ #locataire.prenom #locataire.nom \ #affiche_adresse(locataire.adresse) ] v(2cm) // En-tête propriétaire align(right,box()[ #align(left)[ #proprietaire.prenom #proprietaire.nom \ // Gère le complément d'adresse qui est optionnel #affiche_adresse(proprietaire.adresse) ]]) v(1cm) align(left)[ Objet : demande de congé de logement \ Lettre recommandée avec avis de réception ] v(0.5cm) // Apostrophe align(left)[ #proprietaire.genre, ] v(0.2cm) // Annonce de départ par[Nous allons prochainement quitter notre logement. Celui-ci se trouve en zone tendue. // TODO(derniere phrase devraiet etre fonction de l'adresse) ] // Rapel de la loi par[Conformément à la loi n° 89-462 du 6 juillet 1989 (article 15) et au décret n° 2013-392 relatif au champ d'application de la taxe annuelle sur les logements vacants instituée par l'article 232 du code général des impôts (premier tableau en annexe du décret), le préavis dans cette situation est d'un mois.] // TODO : fonction de zone tendue par[Le congé prendra effet 1 mois après la date d'accusé de réception du courrier recommandé.] par[Afin de convenir ensemble d'une date pour vous remettre les clés du logement et réaliser ensemble l'état des lieux, nous vous informons que le déménagement est prévu le #date_en_francais(date_etat_des_lieux) ] // Salutations TODO : fix date par[Veuillez agréer, #proprietaire.genre, l'expression de nos salutations distinguées.] v(1cm) // Lieu et date d'écriture align(right)[ //#let ville = #locataire.adresse.ville #locataire.adresse.ville le #date_en_francais(datetime.today()) ] // Signature v(2cm) align(right)[ #locataire.prenom #locataire.nom ] }
https://github.com/catppuccin/typst
https://raw.githubusercontent.com/catppuccin/typst/main/tests/colors/test.typ
typst
MIT License
#import "/src/lib.typ": catppuccin, themes, get-palette #set page(width: auto, height: auto) #let color-swatches(palette) = { let swatches = () for (_, color) in palette.colors { let swatch = stack( dir: ltr, spacing: 4pt, rect(fill: color.rgb, width: 15pt, height: 7pt), [#color.name (#color.hex)], ) swatches.push(swatch) } [= #palette.name #palette.emoji] grid( columns: 4, column-gutter: 1cm, row-gutter: 1em, ..swatches, ) } #for theme in themes.values() [ #pagebreak(weak: true) #show: catppuccin.with(theme) #let palette = get-palette(theme) #color-swatches(palette) ]
https://github.com/SnowManKeepsOnForgeting/NoteofModernControlTheory
https://raw.githubusercontent.com/SnowManKeepsOnForgeting/NoteofModernControlTheory/main/Chapter4/Chapter4.typ
typst
#import "@preview/physica:0.9.3": * #import "@preview/i-figured:0.2.4" #set heading(numbering: "1.1") #show math.equation: i-figured.show-equation.with(level: 2) #show heading: i-figured.reset-counters.with(level: 2) #set text(font: "CMU Serif") #let xbd = $accent(bold(x),dot)$ #let xbtilde = $accent(bold(x),tilde)$ #let Abtilde = $accent(bold(A),tilde)$ #let Bbtilde = $accent(bold(B),tilde)$ #counter(heading).update(3) = Controllability and Observability of Linear Time Invariant Systems == Definition of Controllability of Liner Time Invariant Systems Controllability is a property to determine whether a system can be driven from any initial state to any desired final state in finite time by applying a finite control input. Given a linear time-invariant state equation: $ xbd = bold(A) bold(x) + bold(B) bold(u) $<state_eq> *Given any initial state $bold(x)(t_0)$,if there exists a finite time $t_1$ and a admissible control input $bold(u)(t)$ such that the system can be driven from $bold(x)(t_0)$ to zero($bold(x)(t_1) = bold(0)$),then the system is said to be controllable.* *Given any initial state $bold(x)(t_0)$,if there exists a finite time $t_1$ and a admissible control input $bold(u)(t)$ such that the system can be driven from $bold(x)(t_0)$ to any state $bold(x)(t_1)$,then the system is said to be reachable.* In linear time-invariant systems,controllability and reachability are equivalent. Proof: Let us prove the necessity($arrow.double$) of the above theorem. Given any end state $bold(x)(t_1)$,we do linear transformation as below: $ xbtilde(t) = bold(x)(t) - bold(x)(t_1) $ @eqt:state_eq would be transformed as: $ accent(xbtilde,dot)(t) = bold(A)(xbtilde(t) + bold(x)(t_1)) + bold(B) bold(u)(t) $ We can solve this equation: $ accent(bold(x),tilde) ( t )= e^(bold(A) t) xbtilde(t_0) + e^(bold(A) t)integral_(t_0)^t e^(-bold(A) tau) bold(A) bold(x)( t_1 ) dd(tau) + e^(bold(A) t)integral_(t_0)^t e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau)\ = e^(bold(A) t)( xbtilde(t_0) + integral_(t_0)^t e^(-bold(A)tau) bold(A) bold(x)(t_1) dd(tau) )+ integral_(t_0)^t e^(bold(A)(t-tau)) bold(B) bold(u)(tau) dd(tau) $ Because given any initial state $bold(x)(t_0)$ there exists a finite time $t_1$ and a admissible control input $u(t)$ such that the system can be driven from $bold(x)(t_0)$ to zero($bold(x)(t_1) = 0$),we have: $ "let" bold(x)(t_0) = xbtilde(t_0) + integral_(t_0)^t e^(-bold(A)tau) bold(A) bold(x)(t_1) dd(tau), exists t, bold(u) ,"such that" \ xbtilde(t)=e^(bold(A) t)( xbtilde(t_0) + integral_(t_0)^t e^(-bold(A)tau) bold(A) bold(x)(t_1) dd(tau) )+ integral_(t_0)^t e^(bold(A)(t-tau)) bold(B) bold(u)(tau) dd(tau) = 0 $ Sufficiency($arrow.l.double$) is obvious. If the system have determined disturbance($bold(f)(t)$) and the disturbance is independent of $bold(u)$,the disturbance will not affect the controllability of the system. $ xbd(t) = bold(A) bold(x)(t) + bold(B) bold(u)(t) + bold(f)(t) $ It is easy to prove similarly as above. == Criteria of Controllability of Liner Time Invariant Systems + System like $xbd (t) = bold(A) bold(x)(t) + bold(B) bold(u)(t)$ is controllable if and only if the $n times n$ gram matrix is full rank. $ bold(W)_c (0,t_1) = integral_0^t_1 e^(-bold(A) tau) bold(B) bold(B)^T e^(-bold(A)^T tau) dd(tau) $ Proof:Let us prove the sufficiency ($arrow.l.double$).We have the following equation: $ bold(x)(t_1) = e^(bold(A) t_1) bold(x)(0) + integral_0^t_1 e^(bold(A)(t_1-tau)) bold(B) bold(u)(tau) dd(tau)\ = e^(bold(A) t_1)(bold(x)(0) + integral_0^t_1 e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau)) $ To let the system be controllable,we let $ bold(x)(0) + integral_0^t_1 e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau) = 0 $ Because the gram matrix is full rank,we let $ bold(u)(tau) = - bold(B)^T e^(-bold(A)^T tau) bold(W)_c^(-1)(0,t_1) bold(x)(0) $ Thus we have $bold(x)(t_1) = 0$ and the system is controllable. Let us prove the necessity($arrow.double$).We prove it by contradiction.Suppose the gram matrix is not full rank,then there exists a constant non-zero vector $bold(a)$ such that $bold(a) bold(W)_c (0,t_1) bold(a)^(T) = bold(0)$ Thus we have: $ bold(a) bold(W)_c (0,t_1) bold(a)^(T) = integral_0^t_1 bold(a) e^(-bold(A) tau) bold(B) bold(B)^T e^(-bold(A)^T tau) bold(a)^(T) dd(tau) = bold(0)\ bold(a)e^(-bold(A) tau) bold(B) = bold(0) $ Let the initial state be $bold(x)(0) = bold(a)^(T)$,then we have: $ bold(x)(t_1) = e^(bold(A) t_1) bold(a)^(T) + integral_0^t_1 e^(bold(A)(t_1-tau)) bold(B) bold(u)(tau) dd(tau)\ = e^(bold(A) t_1)(bold(a)^(T) + integral_0^t_1 e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau)) = bold(0)\ "We have" bold(a)^(T) + integral_0^t_1 e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau) = bold(0) $ We multiply $bold(a)$ on both sides: $ bold(a)bold(a)^(T) + integral_0^t_1 bold(a) e^(-bold(A) tau) bold(B) bold(u)(tau) dd(tau) = bold(0)\ "We have" bold(a)bold(a)^(T) = bold(0) $ This is a contradiction,thus the system is controllable. + System like $xbd (t) = bold(A)bold(x)(t) + bold(B)bold(u)(t)$ is controllable if and only if the controllability matrix below is full rank. $ bold(Q)_c = mat(delim: "[",bold(B), bold(A)bold(B), bold(A)^2bold(B), dots, bold(A)^(n-1)bold(B)) $ Proof:Let us prove the sufficiency($arrow.l.double$).We prove it by contradiction.Suppose the system is not controllable in other words the gram matrix is not full rank,then there exists a constant non-zero vector $bold(a)$ such that $bold(a) bold(W)_c (0,t_1)bold(a)^(T) = bold(0)$.We have: $ bold(a) e^(-bold(A) tau) bold(B)= bold(0),tau in [0,t_1] $ Because $forall tau in [0,t_1]$ the equation above holds,we have: $ bold(a)bold(B) = bold(0) $ And do differentiation on both sides to $tau$,we have: $ cases( bold(a)bold(B) = bold(0), bold(a)bold(A)bold(B) = bold(0), bold(a)bold(A)^2bold(B) = bold(0), #h(1em)dots.v, bold(a)bold(A)^(n-1)bold(B) = bold(0) ) $ #text(fill: red)[then we have $bold(Q_c)$ is not full rank,which is a contradiction.(Because we have non-zero solution of homogeneous equations).to be continued...] Proof:Let $bold(x)(t_1) = 0$ ,we have: $ bold(x)(t_1) = e^(bold(A) t_1) bold(x)(0) + integral_0^t_1 e^(bold(A)(t_1-tau)) bold(B) bold(u)(tau) dd(tau) = 0 $ Thus we have: $ bold(x)(0) = -integral_0^t_1 e^(- bold(A)tau) bold(B) bold(u)(tau) dd(tau) $ We use Cayley-Hamilton theorem to get: $ e^(-bold(A) tau) = sum_(i=0)^(n-1) a_i (tau) bold(A)^i $ Thus we have: $ bold(x)(0) = - sum_(i=0)^(n-1)bold(A)^i bold(B) integral_0^t_1 a_i (tau) bold(u)(tau) dd(tau)\ = mat(delim: "[",bold(B) ,bold(A) bold(B) ,dots,bold(A)^(n-1)bold(B)) mat(delim: "[",-integral_0^t_1 a_0 (tau) bold(u)(tau) dd(tau); -integral_0^t_1 a_1 (tau) bold(u) (tau) dd(tau);dots.v;-integral_0^t_1 a_(n-1) (tau) bold(u)(tau) dd(tau)) $ From the equation above,we can see that only when $bold(Q)_c$ is full rank,we can get the input $bold(u) (tau)$. + PBH Criterion.A liner time-invariant system is controllable is equivalent to for all eigenvalues of the system,we have: $ forall lambda_i,rank(mat(delim: "[",lambda_i bold(I)-bold(A),bold(B))) = n $ Proof:Let us prove the necessity($arrow.double$) first.Prove it by contradiction.Suppose $exists lambda_i ,rank(mat(delim: "[",lambda_i bold(I) - bold(A),bold(B))) < n$.Then we have: $ exists bold(a) != bold(0),bold(a) mat(delim: "[",lambda_i bold(I)- bold(A),bold(B)) = bold(0) $ We can get: $ bold(a) bold(A) = lambda_i bold(a),bold(a) bold(B) = bold(0) $ Thus $bold(a)bold(A)^m bold(B)=lambda_i^m bold(a) bold(B) = bold(0)$ $ bold(a) mat(delim: "[",bold(B),bold(A)bold(B),dots,bold(A)^(n-1)bold(B)) = bold(0) $ So the matrix $bold(Q)_c$ is not full rank,which is a contradiction. Let us prove the sufficiency($arrow.l.double$).We prove it by contradiction.Suppose the system is not controllable. We transform the system by controllability decomposition: $ accent(xbtilde,dot) = Abtilde xbtilde + Bbtilde u $where $Abtilde = bold(P)^(-1)bold(A)bold(P),Bbtilde = bold(P)^(-1)bold(B)$ Let us prove the sufficiency in this transformed system.The system is also not controllable.And the form of $Abtilde,Bbtilde$ is like: $ Abtilde = mat(delim: "[",Abtilde_(11),Abtilde_(12);bold(0),Abtilde_(22)),Bbtilde = mat(delim: "[",Bbtilde_(1);bold(0)) $where $Abtilde_(22) != bold(0)$ Thus we have: $ mat(delim:"[",lambda bold(I) - Abtilde,Bbtilde)= mat(delim:"[",lambda bold(I) - Abtilde_(11),-Abtilde_(12),Bbtilde_1;bold(0),lambda bold(I) - Abtilde_(22),bold(0)) $ Because $forall lambda_i,det[lambda_i bold(I) - Abtilde] = 0$ in other words $rank(lambda_i bold(I) - Abtilde) != n$.Thus we have:$exists lambda_i$ such that $lambda_i bold(I) - Abtilde_(22)$ is not full rank.Thus $exists lambda_i,rank mat(delim: "[",lambda_i bold(I)-Abtilde,Bbtilde) != n$.So we have a contradiction.
https://github.com/HarryLuoo/sp24
https://raw.githubusercontent.com/HarryLuoo/sp24/main/431/hw/1/hw5.typ
typst
#set math.equation(numbering:"(1)") #set page(margin: (x: 1cm, y: 1cm)) = HW 5, <NAME> == 3.65 - (a)$ "Recall that: Var"(a X)=a ^2 "Var"(X), "Var"(X+a) = "Var"(X).\ "Var"(2X+1)= "Var"(2X) = 4 "Var"(X) = 4*3 = 12. $ - (b) $ E[(3X - 4)^2] =& E[9X^2 - 24X + 16]\ =& 9E[X^2] - 24E[X] + 16\ =& 9*("Var"(X) + E[X]^2) - 24E[X] + 16\ =& 9*(3+4) - 24*2 + 16\ =& 31. $ == 3.66 Let $Y ~ "N(0,1)"$. We can express $X$ as $X = sqrt(3)Y + 8$. $ P(X> alpha) = P(sqrt(3)Y + 8 > alpha) = P(Y > (alpha-8)/sqrt(3)) \ = 1 - P(Y <= (alpha-8)/sqrt(3))\ = 1- Phi ((alpha - 8)/sqrt(3)) = 0.15\ "using the table of the standard normal distribution, we find that" (alpha-8)/sqrt(3) approx 1.04.\ => alpha approx 9.8 $ == 3.71 Let noon to be time =0, and random variable $X$ be the time of arrival. $X~N(0,6^2)$ We want to know the prob. of bus not departing by 12:05, that is to find $P(X >= 5)$ $ P(X >= 5) = 1- P(X < 5) = 1 - Phi(5/6) = 1- 0.7967 = 0.2033 $ The prob. of bus not departing by 12:05 is 0.2033. //4.2, 4.4, 4.16 (a), 4.20, 4.23 == 4.2 let X be the random variable of the number of single pairs. During our darwing, we either get single pairs or non-single pairs, so it is a binomial distribution $X~"Bin"(1000,0.42)$ To calculate prob of getting at least 450 single pairs, we can use the normal approximation to the binomial distribution. $ P(X >= 450) &= P((X - 1000 * 0.42)/ (sqrt(1000*0.42*0.58)) >= (450 - 1000 * 0.42)/ (sqrt(1000*0.42*0.58)) )\ &=P((X - 420)/ (sqrt(243.6))>= 1.92) && "letting Z"~N(0,1)\ &= P(Z >= 1.92)\ &= 1 - P(Z < 1.92)\ &= 1- Phi (1.92)\ & = 0.0274 $ == 4.4 Let RV X be the number of times where Liz rolls a 3,4,5 or 6. Since she either rolls a 1 or 2, or 3,4,5,6, it is a binomial distribution $X~"Bin"(90, 4/6)$ Since Liz either takes one step or two steps, we can represent the number of times she takes two steps as $160 - 90 = 70$. We therefore have to calculate $ P(X >= 70) = P((X - 90 *4/6 )/(sqrt(90*4/6*1/3))>= (70 - 90 *4/6 )/(sqrt(90*4/6*1/3)) ) = P((X- 60)/sqrt(20)>= sqrt(5) ) = 1 - Phi(sqrt(5))\ = 1 - 0.9875 = 0.0125 $ The probability of $X_90$ is at least 160 is 0.0125. == 4.16 (a )Less than 65 of the numbers start with the digit 1, is the same as having less than 65 numbers smaller than 2. We let rv X be how many numbers are smaller than 2, $X~"Bin"(500,(2-1.5)/(4.8-1.5))$ $ P(X < 65) = P((X - 500 * 0.1515)/ (sqrt(500*0.1515*0.8485)) < (65 - 75.7576)/(sqrt(64.2792))) = P((X -75.7576)/ sqrt(64.2792) < -1.34)\ approx Phi (-1.34) = 1-Phi (1.34) = 0.0901 $ == 4.20 Let X be the number of heads. 10000-X is the number of tails. $|X- (10000-X| = |2X-10000|$ is the difference between the number of heads and the number of tails. Since we either have head or tail, X \~ Bin(10000,0.5) $ P(|2X-10000| <= 100) &= P(4950 <= X <= 5050) \ &= P(((4950-10000*0.5)/(sqrt(10000*0.5*0.5)) <= (X - 5000)/ (sqrt(10000*0.5*0.5)) <= (5050-5000)/(sqrt(10000*0.5*0.5)))\ &= P(-1 <= (X - 5000)/(sqrt(1000*0.5*0.5))<= 1)\ &approx Phi(1) - Phi(-1) = 0.6826 $ == 4.23 Let $N (1200,10000)$ represent lifetime of each car battery. Letting $Z~N(0,1)$ $ P(X <= 1100) = P(100Z + 200<= 1100) = P(Z <= -) = 1- Phi (1) approx 0.1587 $ For each car battery, the probability that it will last less than 1100 hours is 0.1587. let Y be the number of car batteries in the batch of 100 with lifetime of less than 1100 hours. For each battery, it's either less than 1100 hours or not, so it is a binomial distribution $Y~"Bin"(100,0.1587)$ $ P(Y >= 20) = P((Y - 100 * 0.1587)/(sqrt( 100 * 0.1587 * 0.8413)) >= (20 - 100 * 0.1587)/(sqrt( 100 * 0.1587 * 0.8413)))\ = P((Y - 15.87)/ (sqrt(15.87)) >= 1.13) = 1 - Phi(1.13) = 0.1292 $
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/typstonomicon/original_image.md
markdown
MIT License
# Image with original size This function renders image with the size it "naturally" has. **Note: starting from v0.11**, Typst tries using default image size when width and height are `auto`. It only uses container's size if the image doesn't fit. So this code is more like a legacy, but still may be useful. This works because measure conceptually places the image onto a page with infinite size and then the image defaults to 1pt per pixel instead of becoming infinitely larger itself. ```typ // author: laurmaedje #let natural-image(..args) = style(styles => { let (width, height) = measure(image(..args), styles) image(..args, width: width, height: height) }) #image("../tiger.jpg") #natural-image("../tiger.jpg") ```
https://github.com/xrarch/books
https://raw.githubusercontent.com/xrarch/books/main/documents/a4xmanual/toc.typ
typst
#outline(title: "Table of Contents")
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/crates/conversion/vec2dom/README.md
markdown
Apache License 2.0
# reflexo-vec2dom Render vector format as DOM. It combines `vec2svg`, `vec2canvas`, `vec2sema` rendering. See [Typst.ts](https://github.com/Myriad-Dreamin/typst.ts)
https://github.com/JohnMeyerhoff/typst_utils
https://raw.githubusercontent.com/JohnMeyerhoff/typst_utils/master/README.md
markdown
# typst_utils Some utils for (mostly) my usecases Currently this contains listing.typ for my listings
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/columns_09.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test a page with a single column. #set page(height: auto, width: 7.05cm, columns: 1) This is a normal page. Very normal.
https://github.com/The-Notebookinator/notebookinator
https://raw.githubusercontent.com/The-Notebookinator/notebookinator/main/themes/radial/components/label.typ
typst
The Unlicense
#import "../colors.typ": * #import "../metadata.typ": * #import "/utils.typ" /// A label that corresponds with one of the entry types. /// /// - type (string): Any of the radial entry types /// - size (size): The size of the label /// -> content #let label(type, size: 0.7em, radius: 1.5pt) = { let data = entry-type-metadata.at(type) let colored-image = utils.change-icon-color(raw-icon: data.icon, fill: white) box(fill: data.color, outset: 3pt, radius: radius)[ #set align(center + horizon) #image.decode(colored-image, height: size) ] }
https://github.com/danbalarin/vse-typst-template
https://raw.githubusercontent.com/danbalarin/vse-typst-template/main/template/main.typ
typst
#import "/lib/lib.typ": template, revisit #show: template.with( title: "Thesis Title", author: "Bc. <NAME>", acknowledgements: [Thanks], abstract-en: [Abstract], keywords-en: [keywords], abstract-cs: [Abstrakt], keywords-cs: [keywords], bibliography-file: "/template/bibliography.bib", ) = Introduction #revisit[ This text is higlighted so it's easy to find and revisit. ] #lorem(20)
https://github.com/SeniorMars/tree-sitter-typst
https://raw.githubusercontent.com/SeniorMars/tree-sitter-typst/main/examples/meta/numbering.typ
typst
MIT License
// Test integrated numbering patterns. --- #for i in range(1, 9) { numbering("*", i) [ and ] numbering("I.a", i, i) [ for #i] parbreak() } --- // Error: 17-18 number must be positive #numbering("1", 0) --- // Error: 17-19 number must be positive #numbering("1", -1)
https://github.com/Toniolo-Marco/git-for-dummies
https://raw.githubusercontent.com/Toniolo-Marco/git-for-dummies/main/slides/animations/detached-head.typ
typst
#import "@preview/touying:0.5.2": * #import themes.university: * #import "@preview/numbly:0.1.0": numbly #import "@preview/fletcher:0.5.1" as fletcher: node, edge #let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide) #import "../components/git-graph.typ": branch_indicator, commit_node, connect_nodes, branch #slide(repeat: 5, self => [ #let (uncover, only) = utils.methods(self) #align(center)[ Here we have an example of this state #uncover("3-5")[in #text(fill: red)[red]] ] #align(center)[#scale(100%)[ #set text(11pt) #fletcher-diagram( node-stroke: .1em, node-fill: none, spacing: 4em, mark-scale: 50%, only("1", { branch( // main branch name:"main", color:blue, start:(0,1), length:5, head: 4 ) }), only("2", { branch( // main branch name:"main", color:blue, start:(0,1), length:5, head: 1 ) }), only("3-5",{ branch( // main branch name:"main", color:blue, start:(0,1), length:5, ) connect_nodes((3,0),(2,1),red) }), only("3", { branch(// detached HEAD commits color: red, start:(2,0), length:1, head:0 ) }), only("4",{ branch(// detached HEAD commits color: red, start:(2,0), length:2, head:1 ) }), only("5",{ branch(// detached HEAD commits color: red, start:(2,0), length:3, head:2 ) }), connect_nodes((3,1),(4,2),orange), branch( // develop branch name:"develop", color:orange, start:(3,2), length:5, ), ) ]] ])
https://github.com/PA055/5839B-Notebook
https://raw.githubusercontent.com/PA055/5839B-Notebook/main/Entries/sensors/new-odometry-sensors.typ
typst
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "New Odometry Sensors", type: "build", date: datetime(year: 2024, month: 3, day: 17), author: "<NAME>", witness: "<NAME>" ) Odometry is a position tracking algorithim used by the coder to implement complex autons. It relies on three sensors 2 vertical and 1 horizantal. The failures of the previous design were compactness and resilliance and the new designs makes a few imrpovments to this area. It is important to complete this first as any protoype drives made must be designed to fit the sensors. This along with a basic mecnum drive which can act as a tank drive when need be will allow the coder to begin making some basic frameworks for next year. New Design: - Verical Wheels save space by being in the same module - No plate is used without being reinforced - Pillow bearings used to simplfy mounting - Newer 3.25in wheels used for better traction #figure( rect(fill: black.lighten(10%))[ #image("./Vertical Odom Isometric.png", width: 80%) ], caption: [ Isometric View of the New Vertical Odometry Sensor ] ) <odomDiagram> #figure( rect(fill: black.lighten(10%))[ #image("./Vertical Odom Front.png", width: 80%) ], caption: [ Front View of the New Vertical Odometry Sensor ] ) <odomDiagram> #figure( rect(fill: black.lighten(10%))[ #image("./Horizantal Odom Isometric.png", width: 80%) ], caption: [ Isometric View of the New Horizantal Odometry Sensor ] ) <odomDiagram> #figure( rect(fill: black.lighten(10%))[ #image("./Horizantal Odom Front.png", width: 80%) ], caption: [ Front View of the New Horizantal Odometry Sensor ] ) <odomDiagram> ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/elsearticle/0.1.0/template/main.typ
typst
Apache License 2.0
#import "@preview/elsearticle:0.1.0": * #let abstract = lorem(100) #show: elsearticle.with( title: "Psychohistory: a primer", authors: ( ( name: "<NAME>", affiliation: "Psychohistory laboratory, Streeling university, Trantor", corr: "<EMAIL>", id: "a", ), ( name: "<NAME>", affiliation: "Mathematics laboratory, Synnax University, Synnax", corr: none, id: "b" ), ), journal: "Encyclopedia Galactica", abstract: abstract, keywords: ("Psychohistory", "Encyclopedia"), format: "preprint" ) = Introduction #lorem(100) = Foundations Psychohistory depends on the idea that, while one cannot foresee the actions of a particular individual, the laws of statistics as applied to large groups of people could predict the general flow of future events. Asimov used the analogy of a gas: An observer has great difficulty in predicting the motion of a single molecule in a gas, but with the kinetic theory can predict the mass action of the gas to a high level of accuracy @Sel10. Seldon applied this concept to the population of the Galactic Empire, which numbered one quintillion, by defining two axioms: #v(1em) - the population whose behaviour was modelled should be sufficiently large to represent the entire society. - the population should remain in ignorance of the results of the application of psychohistorical analyses because if it is aware, the group changes its behaviour. #v(1em) Ebling Mis added these axioms: - there would be no fundamental change in the society human reactions to stimuli would remain constant. #v(1em) Golan Trevize in Foundation and Earth added this axiom: - humans are the only sentient intelligence in the galaxy. #v(1em) == Probability and Psychohistory Psychohistory relies on the Seldon central limit theorem#footnote[It is actually the classical central limit theorem #emoji.face.lick]: $ sqrt(n) (macron(X)_n - mu) / sigma-> cal(N)(0, 1), $ where ... == Features === Table Below is @tab:tab1. #let tab1 = { table( columns: 3, table.header( [Substance], [Subcritical °C], [Supercritical °C], ), [Hydrochloric Acid], [12.0], [92.1], [Sodium Myreth Sulfate], [16.6], [104], [Potassium Hydroxide], table.cell(colspan: 2)[24.7], ) } #figure( tab1, kind: table, caption : [Example] ) <tab:tab1> === Figures Below is @fig:logo. #figure( image("images/typst-logo.svg", width: 50%), caption : [Typst logo - Credit: \@fenjalien] ) <fig:logo> === Subfigures Below are @figa and @figb, which are part of @fig:typst. #figure( grid(columns: 2, gutter: 1em, [#subfigure(image("images/typst-logo.svg")) <figa>], [#subfigure(image("images/typst-logo.svg"))<figb>] ), caption: [(a) Left image and (b) Right image], ) <fig:typst> #show: appendix = Appendix A == Figures In @fig:app #figure( image("images/typst-logo.svg", width: 50%), caption : [Books cover] ) <fig:app> == Subfigures Below are @figa-app and @figb-app, which are part of @fig:typst-app. #figure( grid(columns: 2, gutter: 1em, [#subfigure(image("images/typst-logo.svg")) <figa-app>], [#subfigure(image("images/typst-logo.svg"))<figb-app>] ), caption: [(a) Left image and (b) Right image], ) <fig:typst-app> == Tables In @tab:app #figure( tab1, kind: table, caption : [Example] ) <tab:app> == Equations In @eq $ y = f(x) $ <eq> #nonumeq[$ y = g(x) $ ] #bibliography("refs.bib")
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/013_Magic%202015.typ
typst
#import "@local/mtgset:0.1.0": conf #show: doc => conf("Magic 2015", doc) #include "./013 - Magic 2015/001_Beast.typ" #include "./013 - Magic 2015/002_Nissa, Worldwaker.typ" #include "./013 - Magic 2015/003_Veil of Deceit.typ" #include "./013 - Magic 2015/004_The Bard and the Biologist.typ" #include "./013 - Magic 2015/005_The Hunter Cannot Pity.typ" #include "./013 - Magic 2015/006_Ajani's Vengeance.typ" #include "./013 - Magic 2015/007_Comin' Through!.typ" #include "./013 - Magic 2015/008_Dreams of the Damned.typ" #include "./013 - Magic 2015/009_The Lunarch's Journal.typ" #include "./013 - Magic 2015/010_Monster.typ"
https://github.com/chaosarium/typst-templates
https://raw.githubusercontent.com/chaosarium/typst-templates/main/notebook/lib.typ
typst
#import "components/blocks.typ": * #import "components/envs.typ": * #let total_pages = locate(loc => counter(page).final(loc).at(0)) // template based on https://github.com/BeitianMa/typst-lecture-notes /* Figures */ // The numbering policy is as before, and the default display is centered #let notefig(path, width: 100%) = { let figure_counter = counter("Figure") locate(loc => { let serial_num = ( h1_marker.at(loc).last(), h2_marker.at(loc).last(), figure_counter.at(loc).last() + 1, ).map(str).join(".") let serial_label = label("Figure" + " " + serial_num) block( width: 100%, inset: 8pt, align(center)[#image(path, width: width)], ) set align(center) text(12pt, weight: "bold")[Figure #serial_num #serial_label #figure_counter.step()] }) } /* References of blocks */ // Automatically jump to the corresponding blocks // The form of the input should look something like "Definition 1.3.1" #let refto(class_with_serial_num) = { link(label(class_with_serial_num), [*#class_with_serial_num*]) } /* Headings of various levels */ // Templates support up to three levels of headings, // and notes with more than three headings are usually mess #let set_headings(body) = { set heading(numbering: "1.1.1") // 1st level heading show heading.where(level: 1): it => [ // Under each new h1, reset the sequence number of the blocks #for class in classes { counter(class).update(0) } #counter("h2").update(0) #counter("Figure").update(0) // Start a new page unless this is the first chapter #locate(loc => { let h1_before = query( heading.where(level: 1).before(loc), loc, ) if h1_before.len() != 1 { pagebreak() } }) // Font size and white space #set text(20pt, weight: "bold") #block[Chapter #counter(heading).display(): #it.body] #v(25pt) #h1_marker.step() ] // 2st level heading show heading.where(level: 2): it => [ #set text(17pt, weight: "bold") #block[#it] #h2_marker.step() ] // 3st level heading show heading.where(level: 3): it => [ #set text(14pt, weight: "bold") #block[#it] ] body } /* Cover page */ // Create a note cover with the course name, author, and time // Modify parameters here if you want to add or modify information item #let cover_page(title, author, professor, creater, time, abstract, university) = { set page( paper: "a4", header: align(right)[ #smallcaps[#title] #v(-6pt) #line(length: 40%) ], footer: locate(loc => { align(center)[#loc.page()] }), ) block(height: 30%, fill: none) align(center, text(18pt)[*#title*]) align(center, text(12pt)[*#author*]) align(center, text(11pt)[#professor]) v(7.5%) abstract block(height: 30%, fill: none) align(center, [_ #time _]) } /* Outline page */ // Defualt depth is 2 #let outline_page(title) = { set page( paper:"a4", // Headers are set to right- and left-justified // on odd and even pages, respectively header: locate(loc => { if calc.odd(loc.page()) { align(right)[ #smallcaps[#title] #v(-6pt) #line(length: 40%) ] } else { align(left)[ #smallcaps[#title] #v(-6pt) #line(length: 40%) ] } }), footer: locate(loc => { // if calc.odd(loc.page()) { // align(right)[#loc.page()] // } else { // align(left)[#loc.page()] // } align(center)[#loc.page()] }) ) show outline.entry.where(level: 1): it => { v(12pt, weak: true) strong("§ " + it) } align(center, text(18pt, weight: "bold")[#title]) v(15pt) outline(title: none, depth: 3, indent: auto) } /* Body text page */ // Format the headers and headings of the body #let body_page(title, body) = { set page( paper: "a4", header: locate(loc => { let h1_before = query( heading.where(level: 1).before(loc), loc, ) let h1_after = query( heading.where(level: 1).after(loc), loc, ) // Right- and left-justified on odd and even pages, respectively // Automatically matches the nearest level 1 title if calc.odd(loc.page()) { if h1_before == () { align(right)[_ #h1_after.first().body _ #v(-6pt) #line(length: 40%)] } else { align(right)[_ #h1_before.last().body _ #v(-6pt) #line(length: 40%)] } } else { if h1_before == () { align(left)[_ #h1_after.first().body _ #v(-6pt) #line(length: 40%)] } else { align(left)[_ #h1_before.last().body _ #v(-6pt) #line(length: 40%)] } } }), footer: locate(loc => { align(center)[#loc.page()] }), ) set_headings(body) } /* All pages */ // Organize all types of pages // If you want to add or modify other global Settings, please do so here #let note_page(title, author, professor, creater, time, abstract, university, body) = { set document(title: title, author: author) set par(justify: true) cover_page(title, author, professor, creater, time, abstract, university) outline_page("Contents") body_page( title, [ // Code #show raw.where(block: false): box.with( // fill: rgb("#ffffff44"), // stroke: rgb("#a1a1aaaa"), // inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, ) #show raw.where(block: true): block.with( width: 100%, fill: rgb("#ffffff44"), stroke: rgb("#a1a1aaaa"), inset: 10pt, // radius: 4pt, ) #show table: it => [ #set align(center) #it ] #let code_with_line_number = false // TODO fix broken numbering for long line // Code block with line numbers #show raw.where(block: true): it => { if not code_with_line_number { return it } let lines = it.text.split("\n") let length = lines.len() let i = 0 let left_str = while i < length { i = i + 1 str(i) + "\n" } grid( columns: (auto, 1fr), align( right, block( inset: ( top: 10pt, bottom: 10pt, left: 0pt, right: 5pt, ), left_str, ), ), align(left, it), ) } #body ], ) }
https://github.com/n3d1117/cv
https://raw.githubusercontent.com/n3d1117/cv/main/cv.typ
typst
/* TEMPLATE */ #set text(10.9pt, lang: "en") #set page(margin: (x: 1.5cm, y: 1.6cm)) #show link: underline #show heading.where(level: 2): it => text(15pt, [ #{it.body} #v(-13pt) #line(length: 100%, stroke: 0.7pt) ] ) #let icon(name, baseline: 2.5pt, height: 10pt, hspace: 3pt) = { box( baseline: baseline, height: height, image("img/" + name + ".svg") ) h(hspace) } #let links(services) = { set text(8pt, font: "SF Mono") services.map(service => { icon(service.name) if "display" in service.keys() { link(service.link)[#{service.display}] } else { link(service.link) } }).join(h(15pt)) } #let entry(name, where, city, date) = { text(12pt, weight: "semibold")[#name] h(4pt) text(style: "italic")[#where] h(3pt) text(style: "italic", fill: rgb("808080"))[-- #city] h(1fr) text[#date] v(1pt) } #let projects(projects) = { set par(leading: 0.5em) v(3pt) for (index, project) in projects.enumerate() [ - #block([ #text(weight: "semibold")[#link(project.link)[#project.name]] #h(1pt) #icon("github", baseline: 1.8pt, hspace: 3pt, height: 9pt) #project.description #if index != projects.len() - 1 [ #v(3pt) ] ]) ] } #let pills(skills) = { let cell = rect.with(radius: 5pt, inset: (top: 5pt, bottom: 5pt, left: 6pt, right: 6pt), fill: rgb("F0F0F0"), stroke: 0.4pt + rgb("808080")) let boxes = for skill in skills {(box(cell(text(9pt)[#skill])),)} v(-2pt) {boxes.join(" ")} } #let name(name) = { block(text(25pt, font: "Tiempos headline")[#name]) } #let tagline(tagline) = { block(text(11pt, font: "SF Mono", fill: rgb("808080"))[#tagline]) v(-1pt) } /* CONTENT */ #name("<NAME>") #tagline("/* Software Engineer passionate about iOS, Swift and SwiftUI */") #links(( (name: "email", link: "mailto:<EMAIL>"), (name: "website", link: "https://edoardo.fyi/", display: "edoardo.fyi"), (name: "github", link: "https://github.com/n3d1117", display: "n3d1117"), (name: "linkedin", link: "https://linkedin.com/in/edoardodangelis", display: "edoardodangelis") )) #v(5pt) == Work Experience #entry[iOS Engineer][Shape Games][Copenhagen, Denmark][Jan 2024 --- present] - Working on highly modular iOS apps using Swift packages #entry[Software Engineer][Magenta Srl][Florence, Italy][Sep 2021 --- Dec 2023] - Built the #link("https://www.greenapes.com/en/")[greenApes] iOS app, a social network focused on sustainability and positive environment impact, using Swift, SwiftUI and Combine. Lead a major rewrite from an old Objective-C codebase and successfully shipped 30+ updates on the App Store - Worked as a consultant at #link("https://www.thalesgroup.com/en")[Thales Italia], developing a suite of applications designed to monitor airport systems and enhance the efficiency of boarding processes, using Java (Quarkus), Apache Kafka and Angular (NgRx) - Applied robust regression models based on historical data to enhance the calibration process of the #link("https://www.airqino.it/en/")[AirQino] air quality stations, resulting in a 15% increase in accuracy for PM#sub[2.5] and PM#sub[10] sensors // - Optimized SQL queries and applied #link("https://www.timescale.com")[Timescale]'s _continuous aggregates_ technique to the #link("https://www.airqino.it/en/")[AirQino] backend APIs, resulting in a response time improvement of over 10x for specific queries // - Set up a 1:1 read-only streaming replica of the primary #link("https://www.airqino.it/en/")[AirQino] PostgreSQL database (>100#smallcaps([m]) rows) for performance tests, relieving the load on the primary database and increasing availability == Education #entry[MSc in Computer Science & Engineering][University of Florence][Florence, Italy][Sep 2019 --- Apr 2022] - #underline[Final grade]: 110/110 with honours // - #underline[Thesis]: Design and development of components for the #link("https://www.airqino.it/en/")[AirQino] platform dedicated to air quality monitoring #entry[BSc in Computer Science & Engineering][University of Florence][Florence, Italy][Sep 2015 --- Apr 2019] // - #underline[Thesis]: Semantic expansion of bibliographic records: using ML-based entity extraction tools (such as #link("https://spacy.io")[spaCy]) and #link("https://www.w3.org/TR/rdf-sparql-query/")[SPARQL] queries to generate annotations based on geographic data == Personal Projects #projects(( ( name: "chatgpt-telegram-bot", link: "https://github.com/n3d1117/chatgpt-telegram-bot", description: [A Telegram bot that uses OpenAI's ChatGPT, DALL·E and Whisper APIs to answer questions, generate images from text and transcribe audio files. Written in Python --- 1.8#smallcaps([k])+ stars on GitHub] ), ( name: "appdb", link: "https://github.com/n3d1117/appdb", description: [A fully-featured iOS client for _appdb_, a third party app store for iOS devices. Written in Swift with UIKit --- 250+ stars on GitHub] ), ( name: "stats-ios", link: "https://github.com/n3d1117/stats-ios", description: [A personal iOS app to keep track of movies and tv shows I've watched, books I've read, games I've played and music I've listened to. Written in SwiftUI] ), ( name: "cook", link: "https://github.com/n3d1117/cook", description: [A macOS command line tool to automate common iOS development tasks, such as managing iOS certificates, provisioning profiles and resigning `.ipa` files. Written in Swift] ), ( name: "dl-buddy", link: "https://github.com/n3d1117/dl-buddy", description: [A download manager for macOS with configurable destination, persistence and resumable downloads. Written in Swift with AppKit] ) )) #v(4pt) #grid( columns: (0.6fr, 0.4fr), gutter: 18pt, [ == Skills - *Programming Languages:* Swift, Python, Java, TypeScript - *Libraries & Frameworks* - SwiftUI, UIKit, Combine, AppKit and other Apple frameworks - Vapor, Quarkus, Apache Kafka, Angular, NgRx, Flask, Karate - *Tools & Platforms* - Git, GitHub, GitLab, Xcode, Fastlane, Crashlytics, Firebase - Jira, Docker, Kubernetes, RedPanda, AWS - *Other:* Experience with iOS reverse engineering and jailbreak tweaks development, CI/CD, unit and integration testing, relational databases, agile methodologies ], [ == Conferences attended #pills(( link("https://pragmaconference.com/")[\#Pragma (2023)], link("https://2019.pragmaconference.com")[\#Pragma (2019)] )) #v(-3pt) == Languages #pills(( "Italian (native)", "English (advanced)" )) #v(-3pt) == Interests #pills(( "Open Source Software", "Automation", "Reverse Engineering", "Football" )) ] )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/rose-pine/0.1.0/example.typ
typst
Apache License 2.0
#import "lib.typ" : apply #show: apply() #set align(center) = Example Typst Document #set heading(numbering: "1.") = Text and headings #lorem(30) == H2 #lorem(20) === H3 #lorem(15) = Links and other references <links> == Links #link("https://www.google.com")[ Google ] #link("https://www.google.com") == References @links == Footnotes Some text#footnote[footnote test] = Tables #table( columns: (1fr, auto, auto), inset: 10pt, align: horizon, [*Equation*], [*Area*], [*Parameters*], $ pi h (D^2 - d^2) / 4 $, [ $h$: height \ $D$: outer radius \ $d$: inner radius ], $ sqrt(2) / 12 a^3 $, ) = Visuals == Circles #circle(radius: 25pt) #circle[ #set align(center + horizon) Automatically \ sized to fit. ] == Ellipses // Without content. #ellipse(width: 35%, height: 30pt) // With content. #ellipse[ #set align(center) Automatically sized \ to fit the content. ] == Lines #line(length: 100%) #line(end: (50%, 10%)) #line( length: 4cm, ) == Paths #path( closed: true, (0pt, 50pt), (100%, 50pt), ((50%, 0pt), (40pt, 0pt)), ) == Polygons #polygon( (20%, 0pt), (60%, 0pt), (80%, 2cm), (0%, 2cm), ) == Rectangles #rect(width: 35%, height: 30pt) #rect[ Automatically sized \ to fit the content. ] == Squares #square(size: 40pt) #square[ Automatically \ sized to fit. ]
https://github.com/SeniorMars/tree-sitter-typst
https://raw.githubusercontent.com/SeniorMars/tree-sitter-typst/main/examples/meta/query.typ
typst
MIT License
// Test the query function. --- #set page( paper: "a7", margin: (y: 1cm, x: 0.5cm), header: { smallcaps[Typst Academy] h(1fr) locate(it => { let after = query(heading, after: it) let before = query(heading, before: it) let elem = if before.len() != 0 { before.last() } else if after.len() != 0 { after.first() } emph(elem.body) }) } ) #outline() = Introduction #lorem(35) = Background #lorem(35) = Approach #lorem(60) --- #set page( paper: "a7", numbering: "1 / 1", margin: (bottom: 1cm, rest: 0.5cm), ) #set figure(numbering: "I") #show figure: set image(width: 80%) = List of Figures #locate(it => { let elements = query(figure, after: it) for it in elements [ Figure #numbering(it.numbering, ..counter(figure).at(it.location())): #it.caption #box(width: 1fr, repeat[.]) #counter(page).at(it.location()).first() \ ] }) #figure( image("/glacier.jpg"), caption: [Glacier melting], ) #figure( rect[Just some stand-in text], caption: [Stand-in text], ) #figure( image("/tiger.jpg"), caption: [Tiger world], )
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/zalmy/Z087.typ
typst
Pane, ty Boh mojej spásy, \* dňom i nocou volám k tebe. Kiež prenikne k tebe moja modlitba, \* nakloň svoj sluch k mojej prosbe. Moja duša je plná utrpenia \* a môj život sa priblížil k ríši smrti. Už ma počítajú k tým, čo zostupujú do hrobu, \* majú ma za človeka, ktorému niet pomoci. Moje lôžko je medzi mŕtvymi, \* som ako tí, čo padli a odpočívajú v hroboch, na ktorých už nepamätáš, \* lebo sa vymanili z tvojej náruče. Hádžeš ma do hlbokej priepasti, \* do temravy a tône smrti. Doľahlo na mňa tvoje rozhorčenie, \* svojimi prívalmi si ma zaplavil. Odohnal si mi známych a zošklivil si ma pred nimi. \* Uväznený som a vyjsť nemôžem, aj zrak mi slabne od zármutku. K tebe, Pane, volám deň čo deň \* a k tebe ruky vystieram. Či mŕtvym budeš robiť zázraky? \* A vari ľudské tône vstanú ťa chváliť? Či v hrobe bude dakto rozprávať o tvojej dobrote \* a na mieste zániku o tvojej vernosti? Či sa v ríši tmy bude hovoriť o tvojich zázrakoch \* a v krajine zabudnutia o tvojej spravodlivosti? Ale ja, Pane, volám k tebe, \* včasráno prichádza k tebe moja modlitba. Prečo ma, Pane, odháňaš? \* Prečo predo mnou skrývaš svoju tvár? Biedny som a umieram od svojej mladosti, \* vyčerpaný znášam tvoje hrôzy. Cezo mňa sa tvoj hnev prevalil \* a zlomili ma tvoje hrozby. Deň čo deň ma obkľučujú ako záplava \* a zvierajú ma zovšadiaľ. Priateľov aj rodinu si odohnal odo mňa, \* len tma je mi dôverníkom. Pane, ty Boh mojej spásy, \* dňom i nocou volám k tebe. Kiež prenikne k tebe moja modlitba, \* nakloň svoj sluch k mojej prosbe.
https://github.com/Meisenheimer/Notes
https://raw.githubusercontent.com/Meisenheimer/Notes/main/src/Interpolation.typ
typst
MIT License
#import "@local/math:1.0.0": * = Interpolation == Polynomial Interpolation === Lagrange formula #env("Definition")[ To interpolate given points $(x_0, f(x_0)), dots, (x_n, f(x_n))$, the Lagrange formula is $ p_n (x) = sum_(i=0)^n f(x_i) l_i (x), $ where the *elementary Lagrange interpolation polynomial* (or *fundamental polynomial*) for pointwise interpolation $l_k (x)$ is $ l_k (x) = product_(i=0)^n (x - x_i)/(x_k - x_i). $ In particular, for $n = 0, l_0 (x) = 1$. ] === Newton formula #env("Definition")[ The $k$th divided difference ($k in NN^+$) on the *table of divided differences* #align(center)[ #table( columns: (auto, auto, auto, auto, auto), stroke: none, align: center + horizon, $x_0$,table.vline(), $f[x_0]$, "", "", "", $x_1$,table.vline(), $f[x_1]$, $f[x_0, x_1]$, "", "", $x_2$,table.vline(), $f[x_2]$, $f[x_1, x_2]$, $f[x_0, x_1, x_2]$, "", $x_3$,table.vline(), $f[x_3]$, $f[x_2, x_3]$, $f[x_1, x_2, x_3]$, $f[x_0, x_1, x_2, x_3]$, $dots.c$, $dots.c$, $dots.c$, $dots.c$, $dots.c$, ) ] where the *divided differences* satisfy $ & f[x_0] & & = f(x_0), \ & f[x_0, dots, x_k] & & = (f[x_1, dots, x_k] - f[x_0, dots, x_{k-1}]) / (x_k - x_0). $ ] #env("Corollary")[ Suppose $(i_0, dots, i_k)$ is a permutation of $(0, dots, k)$. Then $ f[x_0, dots, x_k] = f[x_(i_0), dots, x_(i_k)]. $ ] #env("Theorem")[ For distinct points $x_0, dots, x_n$ and $x$, we have $ f(x) = f[x_0] + f[x_0, x_1] (x - x_0) + dots.c + f[x_0, dots, x_n] product_(i=0)^(n-1) (x - x_i) + f[x_0, dots, x_n, x] product_(i=0)^n (x - x_i). $ ] #env("Definition")[ The *Newton formula* for interpolating the points $(x_0, f(x_0)), dots, (x_n, f(x_n))$ is $ p_n (x) = f[x_0] + f[x_0, x_1] (x - x_0) + dots.c + f[x_0, dots, x_n] product_(i=0)^(n-1) (x - x_i). $ ] === Neville-Aitken algorithm #env("Definition")[ Denote $p_0^([i])(x) = f(x_i)$ for $i = 0, dots, n$. For all $k = 0, dots, n-1$ and $i = 0, dots, n - k - 1$, define $ p_(k+1)^([i]) (x) = ((x - x_i) p_(k)^([i+1]) (x) - (x - x_(x+k+1)) p_(k)^([i]) (x)) / (x_(i+k+1) - x_i). $ Then each $p_(k)^([i]) (x)$ is the interpolating polynomial for the function $f$ at the points $x_i, dots, x_{i+k}$. In particular, $p_(n)^([0]) (x)$ is the interpolating polynomial of degree $n$ for the function $f$ at the points $x_0, dots, x_n$. ] === Hermite interpolation #env("Definition")[ Given distinct points $x_0, dots, x_k$ in $[a, b]$, non-negative integers $m_0, dots, m_k$, and a function $f in C^M [a, b]$ where $M = limits(max)_(i = 0, dots, k) (m_i)$, the *Hermite interpolation problem* seeks a polynomial $p(x)$ of the lowest degree satisfies $ forall i in {0, dots, k}, forall mu in {0, dots, m_i}, p^((mu)) (x_i) = f^((mu)) (x_i). $ ] #env("Definition", name: "Generalized divided difference")[ Let $x_0, dots, x_k$ be $k + 1$ pairwise distinct points with each $x_i$ repeated $m_i + 1$ times; write $N = k + sum_(i=0)^k m_i$. The $N$th divided difference associated with these points is the cofficient of $x^N$ in the polynomial p that uniquely solves the Hermite interpolation problem. ] #env("Corollary")[ The $n$th divided difference at $n + 1$ "confluent" (i.e. identical) points is $ f[x_0, dots, x_0] = 1 / (n!) f^((n)) (x_0), $ where $x_0$ is repeated $n + 1$ times on the left-hand side. ] === Approximation #env("Definition")[ Given condition functions $c_0, dots, c_k: PP_n -> RR^+$, the *Approximation problem* seeks a polynomial $p_n (x)$ of the given degree $n$ satisfies a unconstrained optimization $ min_(p_n in PP_n) sum_(i=0)^k c_i (p_n^((m_i)) ). $ where condition function $c(p)$ includes but is not limited to $ |p^((m)) (x)|, ( p_n^((m))(x))^2, integral_a^b |p^((m))| upright("d") x, integral_a^b (p^((m)))^2 upright("d") x. $ ] #env("Example")[ For non-negative integers $m_0, dots, m_k$ and condition functions $c_i (p_n) = (p_n^((m_i)) (x))^2$, denote by $ p_n (x) = sum_(i=0)^n c_i x^i $ the polynomial of the given degree $n$, then the $m$th derivative of $p_n$ is $ p_n^((m)) (x) = sum_(i=m)^n (i!) / ((i-m)!) c_i x^(i-m). $ All above implies the least squares system $ cases(p_n^((m_0)) (x) = & sum_(i=m_0)^n (i!) / ((i-m_0)!) c_i x^(i - m_0) = 0\,, & dots.c, p_n^((m_k)) (x) = & sum_(i=m_k)^n (i!) / ((i-m_k)!) c_i x^(i - m_k) = 0\,,) $ which can be solved by algorithms such as Householder transformation. ] === Error analysis #env("Theorem")[ Let $f in C^n [a, b]$ and suppose that $f^((n+1)) (x)$ exists at each point of $(a, b)$. Let $p_n (x) in PP_n$ denote the unique polynomial that coincides with f at $x_0, dots, x_n$. Define $ R_n (f; x) = f(x) - p_n (x), $ as the *Cauchy remainder* of the polynomial interpolation. If $a <= x_0 < dots.c < x_n <= b$, then there exists some $xi in (a, b)$ satisfies $ R_n (f; x) = (f^{(n+1)}(\xi)) / ((n+1)!) product_(i=0)^n (x - x_i) $ where the value of $xi$ depends on $x, x_0, dots, x_n$ and $f$. ] #env("Theorem")[ For the Hermite interpolation problem, denote $N = k + sum_(i=0)^k m_i$. Denote by $p_N (x) in PP_N$ the unique solution of the problem. Suppose $f^((N+1)) (x)$ exists in $(a, b)$. Then there exists some $xi in (a, b)$ satisfies $ R_N (f; x) = (f^((N+1))(xi)) / ((N+1)!) product_(i=0)^k (x - x_i)^(m_i+1). $ ] == Spline #env("Definition")[ Given nonnegative integers $n$, $k$, and a strictly increasing sequence $a = x_1 < dots.c < x_N = b$, the set of *spline* functions of degree $n$ and smoothness class $k$ relative to the partition ${ x_i }$ is $ SS_n^k = { s: s in C^k [a, b]; forall i in {1, dots, N-1}, s |_([x_i, x_(i+1)]) in PP_n }, $ where $x_i$ is the *knot* of the spline. ] === Cubic spline #env("Definition", name: "Boundary conditions of splines")[ The followings are common boundary conditions of cubic splines. - The *complete cubic spline* $s$ satisfies $s^prime (a) = f^prime (a), s^prime (b) = f^prime (b)$; - The *cubic spline with specified second derivatives* $s$ satisfies $s^prime.double (a) = f^prime.double (a), s^prime.double (b) = f^prime.double (b)$; - The *natural cubic spline* $s$ satisfies $s^prime.double (a) = s^prime.double (b) = 0$; - The *not-a-knot cubic spline* $s$ satisfies $s^prime.triple (x)$ exists at $x = x_2$ and $x = x_(N-1)$. - The *periodic cubic spline* $s$ satisfies $s(a) = s(b), s^prime (a) = s^prime (b), s^prime.double (a) = s^prime.double (b)$. ] #env("Theorem")[ Denote $m_i = s^prime (x_i), M_i = s^prime.double (x_i)$ for $s in SS^2_3$, then $ & forall i = 2, 3, dots, N-1, #h(1em) & & lambda_i m_(i-1) + 2 m_i + mu_i m_i+1 = 3 mu_i f[x_i, x_(i+1)] + 3 lambda_i f[x_(i-1), x_i], \ & forall i = 2, 3, dots, N-1, #h(1em) & & mu_i M_(i-1) + 2 M_i + lambda_i m_(i+1) = 6 f[x_(i-1), x_i, x_(i+1)], $ where $ mu_i = (x_i - x_(i-1)) / (x_(i+1) - x_(i-1)), #h(1em) lambda_i = (x_(i+1) - x_i) / (x_(i+1) - x_(i-1)). $ In particular, $m_i$ and $M_i$ should be replaced to the derivatives given at the boundary. ] #env("Theorem")[ Cubic spline $s in SS^2_3$ from the linear system of $lambda_i, mu_i, m_i, M_i$ and the boundary conditions. ] === B-spline #env("Definition")[ *B-splines* are defined recursively by $ B_i^(n+1) (x) = (x - x_(i-1))(x_(i+n) - x_(i-1)) B_i^n (x) + (x_(i+n+1) - x) / (x_(i+n+1) - x_(i-1)) B_(i+1)^n (x), $ where recursion base is the B-spline of degree zero $ B^0_i (x) = cases( 1\, & #h(1em) x in (x_(i-1), x_i]\,, 0\, & #h(1em) "otherwise".) $ ] #env("Theorem")[ The ${ B_i^n (x) }$ forms a basis of $SS^(n-1)_n$. ] #env("Definition")[ For $N in NN^*$, the *support* of a $B_i^n (x)$ is $ upright("supp") {B_i^n (x)} = overline({ x in RR: B_i^n (x) eq.not 0 }) = [x_(i-1), x_(i+n)]. $ ] #env("Theorem", name: "Integrals of B-splines")[ The average of a B-spline over its support only depends on its degree, $ 1 / (t_(i+n) - t_(i-1)) integral_(t_(i-1))^(t_(i+n)) B_i^n (x) upright("d") x = 1/(n+1). $ ] #env("Theorem", name: "Derivatives of B-splines")[ For $n >= 2$, we have $ forall x in RR, #h(1em) upright("d") / (upright("d") x) B_i^n (x) = (n B_i^(n-1) (x)) / (x_(i+n-1) - x_(i-1)) - (n B_(i+1)^(n-1)(x)) / (x_(i+n) - x_i). $ For $n = 1$, it holds for all $x$ except $x_(i-1), t_i, t_(i+1)$, where the derivative of $B_i^1 (x)$ is not defined. ] === Error analysis #env("Theorem")[ Suppose a function $f in C^4 [a, b]$, is interpolated by a complete cubic spline or a cubic spline with specified second derivatives at its end points. Then $ forall m = 0, 1, 2, |f^((m)) (x) - s^((m)) (x)| <= c_m h^(4 - m) max_(x in [a, b]) |f^((4)) (x)|, $ where $c_0 = 1 / 16, c_1 = c_2 = 1 / 2$ and $h = limits(max)_(i = 1, dots, N-1) |x_(i+1) - x_i|$. ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/viewers/bug-tutorial-example.typ
typst
Apache License 2.0
#set line(length: 100%) #let rainbow = gradient.linear(..color.map.rainbow) #stack( spacing: 1em, line(stroke: 2pt + red), line(stroke: (paint: blue, thickness: 4pt, cap: "round")), line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")), line(stroke: 2pt + rainbow), )
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/049%20-%20The%20Brothers'%20War/007_Chapter%203%3A%20Nemesis.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Chapter 3: Nemesis", set_name: "The Brothers' War", story_date: datetime(day: 25, month: 10, year: 2022), author: "<NAME>", doc ) #emph[Blood is foul, the flesh dross. My ascendance thirsts for life itself.] —Crovax, Evincar of Rath Karn did not speak, did not complain while hooks and razors—the Suture Bishops' preferred exploratory appendages—prodded his mangled body for seams that would facilitate his dissection. The silver golem was still alive, in the fashion that such a unique individual could be considered living, but more importantly, he was still #emph[aware] —aware of where he was, of what was happening to him, and who it was that was carrying out the grim deed of dismantling his body. Detecting Karn's cognizance wasn't an easy matter of checking for breathing or watching for subtle eye movements. One had to feel for a spark to know it was there. Tezzeret waited for any kind of movement from Karn. He half-expected, half-hoped the golem would rise from the bone-white slab, tear apart the nearest Phyrexian, and planeswalk away. But Karn gave no resistance to the team of aspirants as they bound him into place with wrist and ankle clamps, careful not to touch the double-bladed axe still embedded into the golem's chest. Once their task was completed, the aspirants stepped away, their heads bowed in supplication, to allow the Suture Bishops to resume their analyses. On Dominaria, Sheoldred had discovered a way to interfere with Karn's planeswalking. Tezzeret supposed that was what kept the golem trapped now as well: the bone-white slab was veined with minerals that made what flesh Tezzeret still had itch, even though he stood a good distance away. Why Karn was so docile, though~ #emph[A perfect vision.] Tezzeret hated all of this. Hated everything in the Fair Basilica. Hated anything to do with the Machine Orthodoxy. On Esper, the Seekers of Carmot also swathed themselves in sanctimonious claptrap, lording the secrets of etherium forging over all of Vectis. Though he was one of them, he'd also been bamboozled by their ruse. Carmot, the sacred reagent and key to creating etherium, did not exist as anything but an elaborate hokum to keep the unenlightened rabble under the Seekers' heel. So, too, was <NAME>'s promise of "enlightenment." Striding into the cold chamber was another familiar face, <NAME>. He was accompanied by a leader among the priests, a high exarch, who guided a floating assemblage of spider-like arms up to the altar where Karn lay prostrate. The priests, like their aspirants before them, seemed to intrinsically acknowledge rank—to acquiesce to their #emph[betters] —and swayed away from the altar with uncanny grace. "Rebirth," said Ajani. "The pains of destruction give way to glorious perfection." Tezzeret didn't respond. Ajani's very presence troubled him greatly, and not only for his proclivity to quote passage and verse from the Argent Etchings, <NAME>'s paean to her own vanity. No, it was more than that. During the time when he'd served <NAME>, there would be quiet periods when the elder dragon contemplated his next moves. Ajani was never left out of Bolas's plans. He'd devise special stratagems to occupy the leonin while Bolas's other schemes progressed. To Tezzeret, the truth was evident: <NAME>—Planeswalker, elder dragon, god-pharaoh—was obsessed with <NAME>. Whatever had happened in their battle during the conflux of Alara had inspired a hesitancy in Bolas that he had for few others. And yet, the Phyrexians had broken him easily. So easily. Tamiyo had been the first to undergo Jin-Gitaxias's special compleation process, enriching her with glistening oil while retaining the powers of her spark. Buoyed by that breakthrough, the master of the Progress Engine eagerly subjected captive Planeswalkers to ever more effective—and painful—procedures. Now, Tezzeret and some of his most hated adversaries were ostensibly "on the same side." #emph[Let go of your memories and be reborn.] Like the conductor of a grand symphony, the exarch began to weave patterns in the air with its six arms, the appendages on its dissection platform moving in accordance with the exarch's unspoken commands. Their white chitinous tips split open, revealing implements attuned to the task at hand: saws, blades, pincers, forceps. As the arms began their work, Karn still said nothing. Even as metal teeth ground into his body and sheared off his limbs, he kept silent. "Only in her grace are we saved," said Ajani, his voice quivering in exultation. "Our old forms are cages that the Mother melts down and reforges into destiny." "We make our own cages," muttered Tezzeret as he turned to leave. He found his way blocked by one of Elesh Norn's elite angelic guard, its serrated wings curled around its body. He attempted to step around the angel, but it used its staff to bar his way. "The ritual is not finished," the angel proclaimed. "Leaving is forbidden." "I'm not beholden to you," said Tezzeret. "Move." "You are to bear witness. Then you will receive what has been promised to you." Without thinking, Tezzeret placed his hand on his chest, the resting place of the Planar Bridge. Underneath his breastplate, he could feel the creep of the artifact eating him alive. A tiny bit at a time, but inexorably so. If not for periodic cauterizing in the Kuldotha forges, he may have already succumbed to the gate's debilitating energies. But that was only a stopgap. His life depended on him getting what he was promised, what he deserved—a new body made of darksteel, far stronger than etherium and free of the accursed Planar Bridge. Then he could quit this forsaken plane and all it entailed. Forever. "How do I get my reward? Tell me now." "When our deep faithful are finished, you will bring the pieces of Father to our Mother." #emph[Another damned errand?! ] He took a breath and calmed himself down. Though he fumed at being relegated to yet another menial task, one final indignity was worth his new body. Plus, if there was anything the Machine Orthodoxy valued above all, it was propriety. He had to play this delicately. "You would be a more appropriate courier," he demurred. "One does not refuse Mother's invitation," the angel answered. In this, it was correct. It had now been several weeks since Tezzeret had seen the praetor, since she'd quit her throne to reside full time among the Mycosynth. Though he'd enjoyed free rein to visit the innermost layers of the plane during his previous stints on New Phyrexia, that was no longer the case. She'd barred everyone from visiting the lower levels, even the other praetors. "There must be other tasks that demand my attention," he said, gritting his teeth. "Those with some measure of import?" "No." The angel unfurled its wings, exposing a suit of mail made of what looked like human teeth. "You have been given your orders." Tezzeret was suddenly aware that, despite his efforts at ingratiating himself to the angel, he'd become an object of scrutiny. He looked around, first at the angel glowering down upon him with a countenance made up of featureless red sinew, then at the aspirants and the priests momentarily sidetracked by his protests, and finally at Ajani, who stared at him with eyes that glowed a deep, burning red. Tezzeret forced a grin past his clenched jaw. "My attire is woefully inadequate for such an honor. I am fresh from helping Sheoldred back to her lair, and my armor still bears~ remnants from carrying her back to the Dross Pits." "Here," said Ajani, whipping off his white cloak, still stained with blood and soot from the events on Dominaria. "Clean yourself with this." Tezzeret picked up the cloak, white with gold trim save for faded patches on it, off-color, pink like scar tissue. It hadn't registered with him until now that it was the same cloak once worn by <NAME>. Interesting. He was aware they'd been allies on Alara, but not of how close they'd been. Tezzeret studied the leonin, knowing that deep inside that compleated body, the spirit of the true Ajani still existed. Suppressed. Was he aware of what was happening? Was the cape some kind of cryptic plea for help from the recesses of the leonin's mind? If so, Ajani was a bigger fool than Tezzeret had thought. This was neither the time nor the place to expose oneself in such an overt manner. #emph[Make no mistakes.] Tezzeret stepped backward and bowed his head to mimic the gesture the aspirants made to their Suture Bishops. Performing such signs of obeisance ate at him to his core, but the opportunity to give voice to his indignation would come soon enough. #emph[Patience, patience.] "As our Mother wishes," he said. "So shall it be done." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) When New Phyrexia was still Mirrodin, an informal network of lacunae connected all parts of the plane to the very heart where the Mycosynth grew. Some of these passageways had been extant ever since Karn created them, while others—more diseased arteries than intentional thoroughfares—formed much later as a result of the Phyrexian blight. At one time, Tezzeret could navigate his way to a destination through feel and smell alone. There was no longer a need. Led by the angel, he trudged across the open courtyards of the Fair Basilica to the grand, spine-covered bridge leading into the innermost layers of New Phyrexia. Such opulent constructions were one of many ways that <NAME> asserted her dominance. Though she allowed her fellow praetors to customize their resident layers, this graciousness had a limit. Order would rule—devotion, duty, and unity would be held paramount over ruthless scientific analysis or the feral laws of predator and prey. Harmony would replace the madness that had gripped the plane under previous masters—#emph[her] harmony. Twin regiments of aspirants waited for Tezzeret at the foot of the bridge, all mumbling the same prayer. Their eyes—a few embedded in heads, but more as sanguine, light-sensitive organs implanted onto the tips of femurs sharpened into horns or in columns bordering vertebrae erupting through paper-thin skin—were trained upward to the perpetually gray sky. No light from New Phyrexia's white mana sun penetrated the compounded layers above. Instead, the structures of the layer itself provided illumination. The walls of the basilica, composed of ossified Phyrexian corpses honored in death, shed pale white light; crimson capillaries etched into the marble-esque floor oozed a blood-red glow. #emph[Move ever forward.] Tezzeret walked toward the waiting crowd pushing his valuable tribute: a floating platform containing Karn's disassembled parts. Even though he'd draped Ajani's cloak to hide the silver golem, the aspirants still jabbered at the presence of their fallen Father, parting to make way or falling to their knees in reverence. #emph[Feeble-minded buffoons] , he thought as he approached a lone Phyrexian waiting for him on the bridge, spreading its six arms as if inviting Tezzeret into its embrace. "Who are you?" "Your guide," it voiced despite having no mouth. "The underworld can be treacherous." "I am familiar. I need no guide." "It is our Mother's decree." Tezzeret grimaced, but once again stayed his temper. "Get on with it, then." The guide turned and led the way across the bridge, the miasma surrounding them darkening as they ventured further into the bowels of the plane. Tezzeret followed, Karn's platform hovering between them. Soon, the Fair Basilica was out of sight, the monuments of tendon and bone defining the Machine Orthodoxy replaced by the towering columns of the Mycosynth, the unique growth that ran rampant over the core of the plane. Tezzeret viewed the Mycosynth with equal measures of awe and wariness. In a way, it was the ultimate organism—alive and abundant, its metallic lattice as perfect a crystalline structure as any artificer could render. But the Mycosynth hid a danger: prolonged exposure to it rendered metal into flesh and vice versa, explaining the partially metallic natures of the few remaining Mirrans as well as the inability of Phyrexians to attain wholly metal forms. Once they stepped off the bridge and into the Mycosynth Garden itself, Tezzeret became acutely aware of the sound—or rather, the lack of it. It was eerily quiet on this lower level, no doubt due to how Elesh Norn had locked down the center layers that lay below the basilica. "Do you speak with the Mother?" Tezzeret called out to the guide. His voice careened off the high ceilings and far walls of the core, echoing in all directions. He lowered his volume and spoke again: "Do you know how often she ascends from the plane's core?" "The Mother of Machines acts without account. It is not my station to know." "When was the last time she received a visitor?" "Obey and learn," said the guide. "That is the whole of my existence." Tezzeret didn't like this at all. So much pomp for what amounted to a menial delivery task. A sudden thought sent a shudder through his body. Why was #emph[he] getting an audience, and why now? Ever since aligning himself with Urabrask—a loose partnership to be sure, but one where both sides knew where the other stood—Tezzeret had been surreptitiously conveying information to Jace's little outfit on Ravnica. He had even managed to anonymously hire the ghost mage to track Vorinclex, for all the good it did. Had <NAME> learned of their treachery? Was Tezzeret marching into a trap? There was one way to find out. It was not without risk, but it was dwarfed by the risk of inaction, of accepting Elesh Norn's terms of engagement. "Stop," he called out, but the guide paid no heed. Tezzeret let go of the platform and held out his etherium arm, unspooling it away from him like a mass of tentacles that he then wrapped around the guide's neck. "I gave you an order." "I am not your thrall," the guide squealed. "No." Tezzeret reformed his hand into a blade and held it to the guide's neck. "But you do fear, do you not?" "There is no fear in our Mother's embrace." The guide's shoulders swiveled, sending two of its arms backward to bat Tezzeret's blade away. Fortunately for him, he'd at this point seen many Phyrexians in battle. Their power was in shock and surprise—limbs twisting in impossible ways, mandibles erupting from odd places on the body. Distraction, all of it. Tezzeret kicked the floating platform to knock the guide to the ground. Then he circled around to stand over the prone Phyrexian, and with a single well-placed thrust, ran it through. After rolling the body into a patch of low growth, Tezzeret took hold of the platform, turned off the path he'd been following, and headed into the Mycosynth. #emph[Wrath conquers wrath.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) It had been several years since Tezzeret ventured through the Mycosynth Garden of New Phyrexia. He'd assumed that it had been shielded from more recent environmental shifts evident in other parts of the plane; the Mycosynth Lattice had always been left to spread of its own accord, with occasional operations to mine the growths for material to build new structures. Sadly for him, things had changed. The landscape was different. Reorganized. "Where the hell is it?" Tezzeret grumbled. In every direction, all he could see were the spires that spanned the entire height of the layer like massive trees with sprawling canopies. He made his way through the garden's barely navigable spaces, taking pains to stay vigilant. Making actual physical contact with the growths could transmit the Phyrexian taint due to the lattice merging with glistening oil. #emph[Creation breeds destruction enables creation.] Squeezing the platform through an opening between two columns growing into one another, Tezzeret emerged at one end of a flat expanse. There he caught view of a lone tower that could have been mistaken for yet another part of the lattice except for its golden sheen. "At last," said Tezzeret. He made his way to the tower, a defunct fortress used by a previous lord of the plane, a deity the Vedalkens called "Memnarch." He had never gotten a satisfactory explanation for who or what this Memnarch was from either contacts in Lumengrid or any of the current Phyrexian leadership. Surprisingly, Jin-Gitaxias had been the most forthright when he described Memnarch as "a mistake, but a valuable one for our purposes." Whatever this Memnarch's nature, its former haven was still intact. In fact, it looked in far better condition than the toppled wreck Tezzeret remembered. #emph[So much the better] , Tezzeret thought. #emph[If the tower has been repaired, perhaps what I seek inside has also been fully restored.] When he reached the base of the tower, he at first didn't see any way of entering. He set aside the platform he'd been pushing and began to feel around on all sides of the tower base, finding only solid metal—darksteel, as a matter of fact. He cast a spell to spray a fine mist of luminescent dust onto the base of the tower, highlighting the outline of a door, one with no handle, no method of access. Forming a claw with his etherium arm, he attempted to pry the doorway open. But the darksteel resisted all attempts to bite into it, to bend it, to wrench it free from its position. "This is madness!" "It is," a voice called out, echoing off the metallic surfaces of the Mycosynth, "a vestige of the most treacherous madness." Tezzeret whirled around, his claw out and ready to strike at any sign of movement. But there was only him~ and the shrouded platform he'd brought with him. He elongated his arm into a pincer and pulled the cape off the platform, revealing the disassembled limbs and torso of Karn held in place with gold-tinged darksteel clasps. Tezzeret stepped up to the platform, where he saw Karn's silvery eyes open and glowing softly. "Father of Machines," said Tezzeret. "I'm strangely pleased your demise has been overstated." "Hello, Tezzeret," Karn answered. "I am not pleased with any of these circumstances." "Escape, then. You still have your mind. Rebuild your body on another plane." "I have tried, but the Phyrexians have bonded some kind of material to me, impeding interplanar travel. I am tethered here." So, his guess was correct: the slab restrained Karn's planeswalking. Tezzeret grimaced at the possibility that <NAME> could dampen #emph[his] ability to escape the plane, though he doubted she could hamper both his own abilities and the function of the Planar Bridge at the same time. Even so, he appreciated being made aware of the possibilities. "So, we are trapped together, as it were." "Why do you wish to enter the Panopticon?" Karn asked. "That is my business alone." Tezzeret gazed upward to the top of the tower, where it flared out into a large pentagonal chamber, each side with a set of viewing ports. "Unless you'd like to tell me how I may gain access." Karn closed his eyes and remained quiet for a time. Then, opening his eyes, he said, "I can take you inside. This was my realm once, after all." "You're hardly in a position to go anywhere," Tezzeret said with a laugh. "Only a piece is necessary," said Karn. "My head—it can be separated from my body." Tezzeret leaned over and grasped the sides of Karn's neck. He felt around, and sure enough, his fingers located a rather simple locking mechanism not unlike a buckle that held the golem's head in place. Undoing the latch, he gave Karn's head a half twist, freeing it from the rest of his torso. Tezzeret held the head up for him to look at. "Not a design choice I would have made," he said. "A magical bond is more secure." "My creator trusted his skill in artifice more than any spell." He had never given thought to the individual who created Karn. To have constructed such a being, his creator must have been someone of talent and import—not like his own father, a worthless dreg who manipulated Tezzeret into scrapping for etherium without sharing the profits. "Let's get on with this." Tezzeret scooped up the cape and draped it back over the rest of Karn's body. Then, as Karn instructed, he touched the golem's head to the darksteel door. Tezzeret began to feel an odd tingling in his fingers, an odd pressure that spread up his arm. "Don't be alarmed," said Karn. "I am redirecting the natural energies of the metal in your body to attune with the door. Only a few more moments." True to his word, Karn's efforts caused the door to slide open. Tezzeret tucked Karn's head under one arm, and with the other, he pulled himself into the doorway. Once inside, Tezzeret cast a spell causing his metal arm to glow a cool electric blue, illuminating his way up the curving steps to the chamber at the very top. Tezzeret noted the differences from the last time he was here. Gone were the burn marks on the walls, as were the clockwork throne and cracked floating orbs. Everything was clean. Upon two of the walls hung what looked like metal racks sized perfectly for restraining humans, and in the center of the room stood the object of Tezzeret's journey—an elongated, diamond-shaped monolith that would allow him to see into any part of New Phyrexia. "The Darksteel Eye," he said to Karn. "I was only able to use it a handful of times when I was spying for <NAME>. But when I did, even half-broken, it proved quite insightful." "If <NAME> has restored the eye," Karn warned, "it will only show what she wants you to see." "I'll be the judge of that." Tezzeret set Karn's head onto the floor and touched the surface of the Darksteel Eye. One of the facets opened, and he stepped inside. Like the Panopticon, the eye had been restored to full functionality. Each of its mirror-like viewscreens was pristine, and when he touched the control panel, they lit up, inundating him with visions of the various layers of New Phyrexia. #emph[Seek only certitude.] Tezzeret gazed at images from every layer of the plane. Legions were being assembled and outfitted for war. He'd known the scale of operations. The praetors were not shy about boasting. But as he witnessed the sheer size of the forces being gathered, he began to wonder about how such an army would be deployed onto other planes. He'd assumed that the Planar Bridge would be key to Elesh Norn's invasion efforts, but he could never transport this huge a force, one that far outsized Bolas's army of eternals. #emph[Then how is she going to do it?] he wondered. As he turned the knobs on the control panel to change the views and angles visible on screen, he discovered that two locations managed to defy the eye's intrusion. One, he deduced, was Urabrask's domain. It was no surprise that the ill-tempered praetor of the Quiet Furnace had taken pains to thwart outside monitoring. The other elusive location was Elesh Norn's sanctum. Tezzeret slammed his fist onto the control panel, causing the screens to shut off and the door to open again. Karn was right. It would have been foolish for Elesh Norn to allow any device—especially her own—to betray her secrets. A sensible precaution, but no less infuriating. He stepped back out into the main chamber of the Panopticon. "Did you see what you desired?" asked Karn. Tezzeret scowled at Karn's insolence, suppressing the urge to strike the once mighty Planeswalker. "I saw annihilation," he said, pressing his back to the Darksteel Eye and sinking to the ground. "The fate that awaits us all." "The fate you helped construct." "Don't lecture me," said Tezzeret. "I was there, remember? When the oil had you in its grip? Babbling incoherently one second and ordering the execution of Mirran prisoners the next. This is your folly!" "What you say is not untrue," said Karn in a penitent tone. "Once, I believed that my responsibility—the responsibility of all Planeswalkers—was to create, to welcome new voices into being and guide them. I wanted Argentum to be a refuge free from war and pain." "They would find you eventually," said Tezzeret. "War and pain~ They are insatiable. Unstoppable. With a thousand faces and a thousand names." "Like <NAME>." "I hated him, you know," Tezzeret said, touching the horn-shaped tattoos on his forehead—brands meant to remind him where his loyalties were supposed to lie. "He never let me forget the debt I owed to him—the life that he restored to me after Beleren left me a hollow, mindless shell. Let me officially thank you for ridding me of him." "We had no choice," said Karn. "He threatened the entire Multiverse." At that, Tezzeret roared with laughter. "Oh, Father of Machines, that is good! You know, after you left this plane, I returned to Bolas. He wanted to know if the Phyrexians had attained interplanar travel, and I told him the truth: They had not. But, if they ever did, they'd be a force of chaos, a danger to any who would seek to rule. I suggested that your precious plane be eliminated before that happened, and to my surprise, he agreed. His first act as god-emperor would have been to obliterate New Phyrexia from existence." "And in exchange, all we needed to do is die, leaving everyone else to be his loyal subjects." "It's always so simple to you—all of you simpering fools pretending your hands are so clean! The shining heroes come to eradicate the foul, the profane, the #emph[evil] !" Tezzeret felt his mask of congeniality burn away. "You speak of our responsibilities? You could have taken responsibility for your choices—embraced your position as lord over New Phyrexia. Surely, it would have been better than the 'paradise' promised by <NAME>!" He stumbled to his feet and picked up Karn's head. "Every day that I live is one more that I have fought for! Every breath I draw is one closer to~" "To what?" #emph[Freedom.] That's what he wanted to say. But in the same breath, another word edged onto his lips. #emph[Compleation.] His mind raced from one fleeting idea to the next. Ever since his initial arrival on New Phyrexia, he'd been protected from the influence of the glistening oil thanks to an inoculation furnished by <NAME>. But what if~ What if the protection had waned without the dragon alive to bolster it? Or worse, what if the treatments in the Kuldotha forges had introduced something worse than the Planar Bridge into his body? Something more insidious? #emph[Skin is the prison of the blessed.] "You hear them, don't you?" said Karn. "#emph[Pay attention. Do not question. Follow. Become and belong. ] The same voices I heard when the oil had command of my heart." "Shut up!" Tezzeret drew his hand back, transforming it into a spear point, and with his arm shaking with rage, held its tip to Karn's forehead. He stared into Karn's face, the golem's expression as placid as when Elesh Norn's priests tore him apart. "Do you fear your own end, Karn?" "Yes," he said. "I did all I could to prevent it. But it wasn't enough. Not enough." Tezzeret lowered his hand. "She'll suspect something if you're harmed." He made his way back down through the tower, reattached Karn's head to his body, and set out to find Elesh Norn. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Tezzeret wound about the Mycosynth Garden following the grade of the land as it decreased, figuring that he was looking for the lowest point possible on the plane. His bet proved right, as he came across a newly constructed staircase right in the very center of the garden. He neither remembered the staircase nor the odd, spiky shoots that superseded the Mycosynth from his previous visits this far into the plane. Tezzeret did remember what was underneath his feet. The very heart of New Phyrexia. Karn's old throne room. Proceeding down the steps and into a dark tunnel, he readied a spell in case of attack. If memory served, he'd eventually come to a metal door the width and height of a giant, festooned with gears and cogs. But there was no such door. Instead, the mouth of the tunnel let out into what had been the chasm-like chamber where Karn's throne sat. Only, the throne was no longer visible underneath a tangle of thick, armored cables that coiled around it, spiraling up to the ceiling of the chamber. The scene was bathed in a pulsating red glow. A heartbeat. Tezzeret followed the roots of the tree-like structure to its base, next to which stood a peristyle, in the center of which was a reflecting pool. Sitting beside the pool was Elesh Norn, her porcelain body cloaked in a cowl the color of blood. The Mother of Machines looked up at his approach. "Tezzeret," she said, her gentle voice cutting through the thick air. "Your journey here was pleasant, we trust." "Without incident," said Tezzeret. She seemed to be in a good mood. #emph[A bad sign overall] , he surmised. But in the short term, it boded well for him. He was ready—ready to receive his darksteel body and let the Phyrexians slaughter each other. The Multiverse was a nigh-infinite place. There were places to hide, to disappear into. To survive in. "I have done as you asked." He pulled the cape off the pieces of Karn's body, causing Ele<NAME> to rise to her feet and bow. "Father," she said. The darksteel braces released at her touch, letting her take Karn's torso into her hands. "We welcome you to our great work." Karn said nothing. "Things have been difficult between us," she said. "But when you learn how we have been carrying forward your dream, you will understand why we did what we did to you—what we will do to you. Not as a punishment, no. But as penance, to show that none, not even our beloved patriarch, is above reproach." "Your work is indeed great, Mother," said Tezzeret. "But I believe we also have unfinished business. My reward." "For faithful service, yes," she said. "You have shown us such grace, Tezzeret. We could not have our Realmbreaker without you." Tezzeret remembered standing in Elesh Norn's throne room in the Fair Basilica when she signaled him to open a portal to Kaldheim. The energy matrix of the Planar Bridge burst from his chest, bathing his body in a vortex of electric fire. Spilling out of the red portal was the scalding hot endoskeleton of Vorinclex, one claw scraping the floor and the other clutching a bottle, which one of Elesh Norn's aspirants carried away. That bottle—it must have contained the essence of Kaldheim's World Tree. And now, the Phyrexians had their own. #emph[Realmbreaker.] This was his doing. He was directly responsible. <NAME> smiled. "We have decided that you shall be our herald on Dominaria. There remain interlopers on the plane scheming against us—Planeswalkers of your acquaintance. You will lead the effort to enlighten them on the error of their ways." "Back to Dominaria?" "Patience, patience." #emph[Patience?] How often had he heard that word passed off to him in lieu of what he deserved? It was then that he understood—<NAME> had no intention of fulfilling her promise. Her plan for him was to use him until he couldn't be used anymore, then cast him aside or worse, flay and rebuild him to be another lapdog like Ajani. Whether the Seekers, <NAME>, or the praetors of Phyrexia, none who betrayed him in this manner would ever be spared his wrath. Not now. Not ever. He locked his eyes on <NAME>, pouring all his scorn, all his rage, all his hate into her image so that he would never forget this moment—this moment when everything became clear. If it was a war Urabrask wanted, he would get such a war. Tezzeret would make sure of it. At the far end of the reflecting pool, <NAME> placed Karn's torso onto a pedestal wreathed in porcelain white vines of ivy. She tilted her head. "Do you truly have nothing to say? After all this time? We are family, after all." That's when Karn finally spoke: "Jhoira~ Jhoira is my friend~ my best friend. We met in the original academy, before the accident drove us from Tolaria. She named me. Karn~ from an old Thran name. She said~ She said it meant—" "Enough," she snapped. "It is obvious that the stresses of this day have left you addled." #emph[Well played, Karn] , thought Tezzeret. #emph[In a weakened position, yes, but remaining on the board.] "Rest your mind, Father." <NAME> stroked Karn's face as a mother would an ailing child. "When our great work is achieved, you will bask in the joy of perfection with the rest of the Multiverse." Then she glanced up at Tezzeret. Gone was the facade of amiability, replaced by the frigid tenor of her voice. "You're still here. Why?" With a growl, Tezzeret turned and walked away. #figure(image("007_Chapter 3: Nemesis/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Tezzeret entered the cave complex hidden deep inside Shiv's Cometia Crater. Before the attack on the Mana Rig, these tunnels teemed with Phyrexian troops. Now, no more than a small company of centurions and negators remained in any kind of fighting shape. A good number among them suffered egregious injuries—sliced off appendages, whole sections of their bodies burned away or battered into jelly—requiring them to scavenge bodies from the battle site to use as organic material. As damaging as those losses had been, the real cost to the Phyrexians was the dearth of leadership left by the detonation of the Mana Rig. Tezzeret understood that such setbacks were the true death of a pursuit, noble or otherwise. #emph[Waste not, want not.] "Rona," Tezzeret said to the new head of operations on Shiv. "Status report." "I don't answer to you," said Rona. "Sheoldred left me in charge." "Do you see Sheoldred here?" His patience for discourse long depleted, Tezzeret immediately lashed out with his metal arm and skewered her shoulder with a long, thin barb. Rona grabbed hold of him, forcing Tezzeret away. He stumbled back, impressed. Rona had implemented her own augmentations since they'd last met. Good to know. Instead of pressing forward on the attack, Rona called for her lieutenants—one a centurion fitted with a pair of scaly wings, and the other a fleshier design with coils of knotted cables for arms—to intervene in the battle. That was her mistake. Under the Steel Thanes, shows of strength and power were the whole of the law. Her lieutenants weren't going to interfere. She called for them again, and Tezzeret used that momentary distraction to cast a spell multiplying the mass of the metal in her body, crumpling her to the ground. He placed his hand—his organic one—palm up on her shoulder. "I've been told that unprotected flesh takes a few seconds to vaporize in the Blind Eternities. In that small amount of time, I imagine that one would feel~ indescribable pain. But, as I said, it's over quickly. Supposedly. Care to see?" "No." Tezzeret leaned in close to her face. "Status report," he snarled, then dispelled his magic. Rona glared at Tezzeret while she regained her footing. "We suffered losses." "That is highly obvious. Have you called for reinforcements?" "Yes, but our cadres are already deployed into their positions. Enemy armies have assembled in Benalia, Corondor, and Krosa. There are few forces left to spare." "Hmph. How long will it take for our troops to be fully restored?" "A few weeks. A month at the longest." #emph[Well, well] , Tezzeret thought. He furrowed his brow, pretending to be concerned. #emph[We shall see which one of us is more patient, beloved Mother.] "Your spies. Have they maintained watch over the Planeswalkers?" "Yes. They have left Shiv," said Rona. "But we have been able to track them back to New Argive." #emph[New Argive? What would bring them back there?] As far as he knew, New Argive had been fully infested by Phyrexian forces. It would have been suicide to seek refuge within the walls of Argivia or any of the other major settlements. Unless they weren't trying to get help from their former allies. Curious. "What of the special troops left in your care? Mother's elite?" A smile cracked across Rona's face. "Newly whole and waiting for their orders." "Excellent," said Tezzeret. "One big happy family."
https://github.com/bigskysoftware/hypermedia-systems-book
https://raw.githubusercontent.com/bigskysoftware/hypermedia-systems-book/main/ch00-introduction.typ
typst
Other
#import "lib/definitions.typ": * #set heading(numbering: none) == Introduction This is a book about building applications using hypermedia systems. _Hypermedia systems_ might seem like a strange phrase: how is hypermedia a _system_? Isn't hypermedia just a way to link documents together? Like with HTML, on the World Wide Web? What do you mean hypermedia _systems_? Well, yes, HTML is _a_ hypermedia. But there is more to the way the web works than just HTML: HTTP, the Hyper Text Transfer Protocol, is what transfers HTML from servers to clients, and there are many details and features associated with it: caching, various headers, response codes, and so forth. And then, of course, there are _hypermedia servers_, which present _hypermedia APIs_ (yes, _APIs_) to clients over the network. #index[hypermedia client] #index[web browser] And, finally, there is the all-important _hypermedia client_: a software client that understands how to render a _hypermedia response_ intelligibly to a human, so that a human can interact with the remote system. The most widely known and used hypermedia clients are, of course, web browsers. Web browsers are perhaps the most sophisticated pieces of software we use. They not only understand HTML, CSS and many other file formats, but they also provide a JavaScript runtime and programming environment that is so powerful that web developers can create entire applications in it that are nearly as sophisticated as _thick clients_, that is, native applications. This JavaScript runtime is so powerful, in fact, that today many developers ignore the _hypermedia_ features of the browser, in favor of building their web applications entirely in JavaScript. Applications built in this manner have come to be called Single Page Applications (SPAs). Rather than navigating between pages, these web applications use JavaScript for updating the user interface directly. When they communicate with a server, these applications typically use JSON API calls via AJAX. And they often update the user interface using a "reactive" style frontend JavaScript library. In these applications HTML becomes a (somewhat awkward) graphical interface description language that is used because, for historical reasons, that's what happens to be there, in the browser. Applications built in this style are not _hypermedia-driven_: they do not take advantage of the underlying hypermedia system of the web. To explain what a hypermedia-driven application looks like, and to contrast it with the popular SPA approach of today, we need to first explore the entire _hypermedia system_ of the web, beyond just discussing HTML. We need to look at the _network architecture_ of the web, including how a web server delivers a hypermedia API, and how to effectively use the hypermedia features available in the hypermedia _client_ (e.g., the browser). Each of these are important aspects of building an effective hypermedia-driven application, and it is the entire _hypermedia system_ that comes together to make hypermedia such a powerful architecture. === What is a Hypermedia System? <what-is-a-hypermedia-system> #index["Fielding, Roy"] #index[REST] To understand what a hypermedia system is we'll first take an in-depth look at _the_ canonical hypermedia system: the World Wide Web. <NAME>, an engineer who helped create specifications and build the implementations of many early pieces of the web, gave us the term REpresentational State Transfer, or REST. In his PhD dissertation he described REST as a _network architecture_, and he contrasted it with earlier approaches to building distributed software. #index[hypermedia system] We define a _hypermedia system_ as a system that adheres to the RESTful network architecture in Fielding's _original_ sense of this term. Unfortunately, today, you probably associate the term "REST" with JSON APIs, since that is where the term is typically used in industry. This is a misapplied use of the term REST because JSON is not a _natural_ hypermedia due to the absence of hypermedia controls. The exchange of hypermedia is an explicit requirement for a system to be considered "RESTful." It is a long story how we got here, using the term REST so incorrectly, and we will go into the details later in this book. But, for now, if you think REST implies JSON, please try to set that understanding aside while reading this book, and come to the concept with fresh eyes. It is important to understand that, in his dissertation, Fielding was describing The World Wide Web as it existed in the late 1990s. The web, at that point, was simply web browsers exchanging hypermedia. That system, with its simple links and forms, was what Fielding was calling RESTful. JSON APIs were a decade away from becoming a common tool in web development: REST was about _hypermedia_ and the 1.0 version of the web. === Hypermedia-Driven Applications #index(text("Hypermedia-Driven Application (HDA)")) In this book we are going to take a look at hypermedia as a _system architecture_ and then explore some practical, _modern_ approaches to building web applications using it. We will call applications built in this style _Hypermedia-Driven Applications_, or HDAs, and we contrast them with a popular style in use today, the Single Page Application. A Hypermedia-Driven Application is an application built on top of a hypermedia system that respects and utilizes the hypermedia functionality of that underlying system. === Goals The goal of this book is to give you a strong sense of how the RESTful, hypermedia system architecture _differs_ from other client-server systems, and what the strengths (and weaknesses) of the hypermedia approach are. Further, we hope to convince you that the hypermedia architecture is _relevant_ to developers building modern web applications. We aim to give you the tools to evaluate the requirements for an application and answer the question: "Could I build this as a Hypermedia-Driven Application?" We hope that for many applications the answer to that question will be "Yes!" === Book Layout The book is broken into three parts: - An introduction (or re-introduction) to hypermedia, with a particular focus on HTML and HTTP. We will finish this review of core hypermedia concepts by creating a simple "Web 1.0"-style application, Contact.app, for managing contacts. - Next we will look at how we can use #link("https://htmx.org")[htmx], a hypermedia-oriented JavaScript library created by the authors of this book, to improve Contact.app. By using htmx, we will be able to achieve a level of interactivity in our application that many developers would expect to require a large, sophisticated front end library, such as React. Thanks to htmx, we will be able to do this using hypermedia as our system architecture. - Finally, we will look at a completely different hypermedia system, Hyperview. Hyperview is a _mobile_ hypermedia system, related to, but distinct from the web and created by one of the authors of this book -- <NAME>. It supports _mobile specific_ features by providing not only a mobile specific hypermedia, but also a mobile hypermedia client. These novel components, combined with any HTTP server, make it possible to build mobile Hypermedia-Driven Applications. Note that each section is _somewhat_ independent of the others. If you already know hypermedia in-depth and how basic Web 1.0 applications function, you may want to skip ahead to the second section on htmx and how to build modern web applications using hypermedia. Similarly, if you are well versed in htmx and want to dive into a novel _mobile_ hypermedia, you can skip ahead to the Hyperview section. That being said, the book is designed to be read in order and both the htmx and Hyperview sections build on the Web 1.0 application described at the end of the first section. Furthermore, even if you _are_ well versed in all the concepts of hypermedia and details of HTML & HTTP, it is likely worth it to at least skim through the first few chapters for a refresher. === Hypermedia: A New Generation Hypermedia isn't a frequent topic of discussion these days. Even many older programmers who grew up with the web in the late 1990s and early 2000s haven't thought much about these ideas in years. Many younger web developers have grown up knowing nothing but Single Page Applications and the frameworks that are used to build them. In particular, many young web developers began their careers by building React.js applications that interact with a Node server using a JSON API; they may never have learned about hypermedia as a system at all. This is a tragedy, and, frankly, a failure on the part of the thought leaders in the web development community to properly communicate and advocate for the hypermedia approach. Hypermedia was a great idea! It still is! By the end of this book, you will have the tools and the _language_ to put this great idea to work in your own applications. And, further, you will be able to bring the ideas and concepts of hypermedia systems to the broader web development community. Hypermedia can compete, hypermedia _can win_, hypermedia _has won_ as an architectural choice against the Single Page Application approach, but _only_ if smart people (like you) learn about it, build with it and then tell the world about it. #blockquote( attribution: [<NAME>, Terminator 2: Judgement Day], )[ Remember the message? “The future is not set. There is no fate but what we make for ourselves.” ] #html-note[Hypermedia In Practice][ Clearly, HTML plays a central role in the story we tell here. At the end of each chapter we will share what we have learned about writing HTML for hypermedia-driven web applications. To start, remember that our web applications are not islands. We're writing HTML not just for a particular application, but also to play along with other members of the web. When we write with the hypermedia _system_ in mind, we're better able to tap the range of abilities available to the web. HTML is hypermedia-friendly when it is written for the full range of constituents of the hypermedia system. It conveys the state of an application to people viewing our sites with a browser, as well as to people listening to screen readers that read sites aloud. It conveys the aims of our sites to search engines that scrape sites programmatically. It also conveys its behavior as clearly as possible to other developers. No, we can't fix every problem with good HTML. The mantra that HTML is "accessible by default" is misleading. We would miss out on important opportunities if we shunned other technologies like JavaScript. And we still need to test, a lot, everywhere, to ensure things work as expected. But good HTML lets browsers do a _lot_ of work for us. ]
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/edu/seminars/main.typ
typst
#import "/utils/template.typ": conf #import "/utils/datestamp.typ": datestamp #show: body => conf( title: "Совеменное образование", subtitle: "Семинары", author: "<NAME>, БПИ233", year: [2024--2025], body, ) #datestamp("2024-09-11") #include "2024-09-11.typ" #datestamp("2024-09-18") #include "2024-09-18.typ" #datestamp("2024-09-25") #include "2024-09-25.typ" #datestamp("2024-10-09") #include "2024-10-09.typ" #datestamp("2024-10-16") #include "2024-10-16.typ" #datestamp("2024-10-23") #include "2024-10-23.typ"
https://github.com/csimide/SEU-Typst-Template
https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/seu-thesis/utils/show-equation-degree.typ
typst
MIT License
// 研究生院要求:公式首行的起始位置空四格。 // #show math.equation: show-math-equation-degree #let show-math-equation-degree(eq) = { if eq.block and eq.numbering != none { set align(left) grid( columns: (4em, 100% - 4em), h(4em), eq ) } else { eq } }
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/PSD/homework4/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 Por Janelamento", subtitle: "Processamento de Sinais Digitais", authors: ("<NAME>",), date: "07 de Julho de 2024", doc, ) = Fundamentação Teórica: O janelamento é uma técnica utilizada para projetar filtros digitais, onde a resposta ao impulso do filtro ideal é multiplicada por uma janela. As janelas mais comuns são a janela retangular, de Hamming, de Hanning, de Blackman e de Kaiser Abaixo estão definidos alguns exemplos de filtros projetados por janelamento como exemplo para a resolução das questões posteriormente. == Exemplo 1: Projete um filtro que satisfaça as especificações a seguir: - M = 50 - Ωc1 = π/4 rad/s - Ωc2 = π/2 rad/s - Ωs = 2π rad/s Abaixo está o exemplo apresentado em sala para entender o projeto do filtro: #sourcecode[```matlab M = 50; Omega_c1 = pi/4; Omega_c2 = pi/2; ws = 2*pi; wc1 = Omega_c1*2*pi/ws; wc2 = Omega_c2*2*pi/ws; n = 1:M/2; h0 = 1 - (wc2 - wc1)/pi; haux = (sin(wc1.*n) - sin(wc2.*n))./(pi.*n); h = [fliplr(haux) h0 haux]; [H,w]=freqz(h,1,2048,ws); plot(w,20*log10(abs(H))) axis([0 ws/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência'); ```] == Exemplo 2: Projete um filtro rejeita-faixa que satisfaça as especificações a seguir usando as janelas retangular, de Hamming, de Hann e de Blackman: - M = 80 - Ωc1 = 2000 rad/s - Ωc2 = 4000 rad/s - Ωs = 10 000 rad/s #sourcecode[```matlab clear all M = 80; Omega_c1 = 2000; Omega_c2 = 4000; Omega_s = 10000; wc1 = Omega_c1*2*pi/Omega_s; wc2 = Omega_c2*2*pi/Omega_s; n = 1:M/2; h0 = 1 - (wc2 - wc1)/pi; haux = (sin(wc1.*n) - sin(wc2.*n))./(pi.*n); h_ideal = [fliplr(haux) h0 haux]; h_ret=h_ideal; [H_ret,w]=freqz(h_ret,1,2048,Omega_s); figure(1) plot(w,20*log10(abs(H_ret))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência - Janela Retangular'); h_aux=hamming(M+1); h_ham=h_ideal.*h_aux'; [H_ham,w]=freqz(h_ham,1,2048,Omega_s); figure(2) plot(w,20*log10(abs(H_ham))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência - Janela de Hamming'); h_aux=hanning(M+1); h_han=h_ideal.*h_aux'; [H_han,w]=freqz(h_han,1,2048,Omega_s); figure(3) plot(w,20*log10(abs(H_han))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência - Janela de Hanning'); h_aux=blackman(M+1); h_black=h_ideal.*h_aux'; [H_black,w]=freqz(h_black,1,2048,Omega_s); figure(4) plot(w,20*log10(abs(H_black))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência - Janela de Blackman'); ```] == Exemplo 3: Projete um filtro rejeita-faixa que satisfaça as especificações a seguir, usando a janela de Kaiser: - Ap = 1,0 dB - Ar = 45 dB - Ωp1 = 800 Hz - Ωr1 = 950 Hz - Ωr2 = 1050 Hz - Ωp2 = 1200 Hz - Ωs = 6000 Hz #sourcecode[```matlab Ap = 1; Ar = 45; Omega_p1 = 800; Omega_r1 = 950; Omega_r2 = 1050; Omega_p2 = 1200; Omega_s = 6000; delta_p = (10^(0.05*Ap) - 1)/(10^(0.05*Ap) + 1); delta_r = 10^(-0.05*Ar); F = [Omega_p1 Omega_r1 Omega_r2 Omega_p2]; A = [1 0 1]; ripples = [delta_p delta_r delta_p]; [M,Wn,beta,FILTYPE] = kaiserord(F,A,ripples,Omega_s); kaiser_win = kaiser(M+1,beta); h = fir1(M,Wn,FILTYPE,kaiser_win,'noscale'); figure(1) stem(0:M,h) ylabel('h[n]'); xlabel('n)'); title('Resposta ao Impulso'); [H,w]=freqz(h,1,2048,Omega_s); figure(2) plot(w,20*log10(abs(H))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (Hz)'); title('Resposta em Frequência'); ```] == Exemplo 4: Crie um sinal de entrada composto de três componentes senoidais, nas frequências 50 Hz, 350 Hz e 900 Hz, com Ωs = 2 kHz, com amplitudes de 5, 2 e 1, respectivamente. Projete um filtro usando as janelas retangular, Hamming, Hanning e Blackman para eliminar as componentes de 50 e 900 Hz. #sourcecode[```matlab clear all M = 71; Omega_c1 = 250; Omega_c2 = 750; Omega_s = 2000; wc1 = Omega_c1*2*pi/Omega_s; wc2 = Omega_c2*2*pi/Omega_s; %% Resposta ao impulso do filtro ideal h[n] n = [-1*((M-1)/2):(M-1)/2]; h_n = ((sin(wc2.*n) - sin(wc1.*n))./(pi.*n)); %resposta ao impulso para ≠0 h_n(((M-1)/2)+1) = (wc2 - wc1)/pi; %resposta ao impulso para n=0 w_hamm = 0.54 + 0.46*cos(2*n.*pi/(M));%coeficientes da janela de hamming w_hann = 0.5 + 0.5*cos(2*n.*pi/(M));%coeficientes da janela de hanning w_black = 0.42+0.5*cos(2*n.*pi/(M))+0.08*cos(4*n.*pi/(M)); %coeficientes da janela de blackman h_ret = h_n; h_hamm = w_hamm.*h_n; h_hann = w_hann.*h_n; h_black = w_black.*h_n; figure freqz(h_ret,1); title('Filtro FIR passa-faixa - Janela Retangular') figure freqz(h_hamm,1); title('Filtro FIR passa-faixa - Janela de Hammming') figure freqz(h_hann,1); title('Filtro FIR passa-faixa - Janela de Hanning') figure freqz(h_black,1); title('Filtro FIR passa-banda - Janela de Blackman') %% Sinal tmin = 0; tmax = 2; Fs=2000; Ts=1/Fs; L=(tmax-tmin)/Ts; t=0:Ts:tmax-Ts; s = 5*sin(2*pi*50*t) + 2*sin(2*pi*300*t) + sin(2*pi*900*t); S = fft(s); S = abs(2*S/L); S = fftshift(S); freq = Fs*(-(L/2):(L/2)-1)/L; %% Gráficos do sinal figure(1) subplot(3,1,1),plot(t,s); title('Sinal') xlabel('t') ylabel('s(t)') subplot(3,1,2),plot(freq,S) title('Espectro de Amplitude de s(t)') xlabel('f (Hz)') ylabel('|S(f)|') h_hamm = w_hamm.*h_n; h_hann = w_hann.*h_n; h_black = w_black.*h_n; s_f_h_ret = filter(h_ret,1,s); S_F_h_ret = fft(s_f_h_ret); S_F_h_ret = abs(2*S_F_h_ret/L); S_F_h_ret = fftshift(S_F_h_ret); subplot(3,1,3),plot(freq,S_F_h_ret) title('Espectro de Amplitude do sinal Filtrado ') xlabel('f (Hz)') ylabel('|S(f)|') ```] = Questões: Abaixo estão as resoluções das questões propostas, onde são projetados filtros passa-faixa e rejeita-faixa utilizando as janelas de Hamming, Hanning, Blackman e Kaiser. == Questão 1: Projete um filtro passa-faixa usando a janela de Hamming, a janela de Hanning e janela de Blackman que satisfaça a especificação a seguir. Para o projeto, varie a ordem do filtro "M" entre 10, 100 e 1000. === Ordem M = 10: - M = 10 - Ωc1 = 10 rad/s - Ωc2 = 35 rad/s - Ωs = 100 rad/s #sourcecode[```matlab clear all; close all; clc; % Parâmetros passados pela questão: M = 10; Omega_c1 = 10; Omega_c2 = 35; Omega_s = 100; % Definição das frequências de corte em radianos: wc1 = Omega_c1*2*pi/Omega_s; % Frequência de corte inferior (rad/s) wc2 = Omega_c2*2*pi/Omega_s; % Frequência de corte superior (rad/s) % Cálculo dos coeficientes do filtro passa-faixa ideal: n = 1:M/2; h0 = (wc2 - wc1)/pi; haux = (sin(wc2.*n) - sin(wc1.*n))./(pi.*n); h_ideal = [fliplr(haux) h0 haux]; h_ret = h_ideal; % Cálculo da resposta em frequência do filtro passa-faixa ideal: [H_ret, w] = freqz(h_ret, 1, 2048, Omega_s); % Plot da resposta em frequência do filtro passa-faixa ideal: figure(1) subplot(2,2,1) plot(w, 20*log10(abs(H_ret))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Filtro Passa-Faixa Ideal'); % Hamming: % Janela de Hamming com comprimento M+1 h_aux = hamming(M+1); h_ham = h_ideal .* h_aux'; [H_ham, w] = freqz(h_ham, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hamming: subplot(2,2,2) plot(w, 20*log10(abs(H_ham))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hamming'); % Hanning: % Janela de Hanning com comprimento M+1 h_aux = hanning(M+1); h_han = h_ideal .* h_aux'; [H_han, w] = freqz(h_han, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hanning: subplot(2,2,3) plot(w, 20*log10(abs(H_han))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hanning'); % Blackman: % Janela de Blackman com comprimento M+1 h_aux = blackman(M+1); h_black = h_ideal .* h_aux'; [H_black, w] = freqz(h_black, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Blackman: subplot(2,2,4) plot(w, 20*log10(abs(H_black))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Blackman'); ```] Abaixo temos o plot da resposta em frequência do filtro passa-faixa ideal e dos filtros projetados com as janelas de Hamming, Hanning e Blackman para a ordem M = 10. Nota-se que a atenuação gerada pelo filtro para "M = 10" não é suficiente para atender as especificações do projeto, além de que a banda de passagem sofre uma variação consideravel do ganho em relação ao filtro ideal. #figure( figure( rect(image("./pictures/q1.1.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Ordem M = 100: - M = 100 - Ωc1 = 10 rad/s - Ωc2 = 35 rad/s - Ωs = 100 rad/s #sourcecode[```matlab clear all; close all; clc; % Parâmetros passados pela questão: M = 100; Omega_c1 = 10; Omega_c2 = 35; Omega_s = 100; % Definição das frequências de corte em radianos: wc1 = Omega_c1*2*pi/Omega_s; % Frequência de corte inferior (rad/s) wc2 = Omega_c2*2*pi/Omega_s; % Frequência de corte superior (rad/s) % Cálculo dos coeficientes do filtro passa-faixa ideal: n = 1:M/2; h0 = (wc2 - wc1)/pi; haux = (sin(wc2.*n) - sin(wc1.*n))./(pi.*n); h_ideal = [fliplr(haux) h0 haux]; h_ret = h_ideal; % Cálculo da resposta em frequência do filtro passa-faixa ideal: [H_ret, w] = freqz(h_ret, 1, 2048, Omega_s); % Plot da resposta em frequência do filtro passa-faixa ideal: figure(1) subplot(2,2,1) plot(w, 20*log10(abs(H_ret))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Filtro Passa-Faixa Ideal'); % Hamming: % Janela de Hamming com comprimento M+1 h_aux = hamming(M+1); h_ham = h_ideal .* h_aux'; [H_ham, w] = freqz(h_ham, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hamming: subplot(2,2,2) plot(w, 20*log10(abs(H_ham))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hamming'); % Hanning: % Janela de Hanning com comprimento M+1 h_aux = hanning(M+1); h_han = h_ideal .* h_aux'; [H_han, w] = freqz(h_han, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hanning: subplot(2,2,3) plot(w, 20*log10(abs(H_han))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hanning'); % Blackman: % Janela de Blackman com comprimento M+1 h_aux = blackman(M+1); h_black = h_ideal .* h_aux'; [H_black, w] = freqz(h_black, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Blackman: subplot(2,2,4) plot(w, 20*log10(abs(H_black))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Blackman'); ```] Ao aumentar em 10 vezes a ordem do filtro, temos que a resposta em frequência do filtro projetado com as janelas de Hamming, Hanning e Blackman se aproximam da resposta do filtro ideal, e se assemelhando a uma resposta em frequência apropriada para um filtro passa-faixa. Nota-se que com essa ordem é possivel distinguir a banda de passagem e a banda de rejeição do filtro, além de que a atenuação gerada pelo filtro é suficiente para atender as especificações do projeto. #figure( figure( rect(image("./pictures/q1.2.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) === Ordem M = 1000: - M = 1000 - Ωc1 = 10 rad/s - Ωc2 = 35 rad/s - Ωs = 100 rad/s #sourcecode[```matlab clear all; close all; clc; % Parâmetros passados pela questão: M = 1000; Omega_c1 = 10; Omega_c2 = 35; Omega_s = 100; % Definição das frequências de corte em radianos: wc1 = Omega_c1*2*pi/Omega_s; % Frequência de corte inferior (rad/s) wc2 = Omega_c2*2*pi/Omega_s; % Frequência de corte superior (rad/s) % Cálculo dos coeficientes do filtro passa-faixa ideal: n = 1:M/2; h0 = (wc2 - wc1)/pi; haux = (sin(wc2.*n) - sin(wc1.*n))./(pi.*n); h_ideal = [fliplr(haux) h0 haux]; h_ret = h_ideal; % Cálculo da resposta em frequência do filtro passa-faixa ideal: [H_ret, w] = freqz(h_ret, 1, 2048, Omega_s); % Plot da resposta em frequência do filtro passa-faixa ideal: figure(1) subplot(2,2,1) plot(w, 20*log10(abs(H_ret))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Filtro Passa-Faixa Ideal'); % Hamming: % Janela de Hamming com comprimento M+1 h_aux = hamming(M+1); h_ham = h_ideal .* h_aux'; [H_ham, w] = freqz(h_ham, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hamming: subplot(2,2,2) plot(w, 20*log10(abs(H_ham))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hamming'); % Hanning: % Janela de Hanning com comprimento M+1 h_aux = hanning(M+1); h_han = h_ideal .* h_aux'; [H_han, w] = freqz(h_han, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Hanning: subplot(2,2,3) plot(w, 20*log10(abs(H_han))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Hanning'); % Blackman: % Janela de Blackman com comprimento M+1 h_aux = blackman(M+1); h_black = h_ideal .* h_aux'; [H_black, w] = freqz(h_black, 1, 2048, Omega_s); % Plot da resposta em frequência com a janela de Blackman: subplot(2,2,4) plot(w, 20*log10(abs(H_black))) axis([0 Omega_s/2 -150 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta - Janela de Blackman'); ```] Aumentando ainda mais a ordem do filtro para "M = 1000", temos a maximização da atenuação gerada pelo filtro na banda de rejeição, e uma queda mais acentuada do ganho na banda de passagem. Com isso, temos que a resposta em frequência do filtro projetado com as janelas de Hamming, Hanning e Blackman se aproximam ainda mais da resposta do filtro ideal, e se assemelhando a uma resposta em frequência apropriada para um filtro passa-faixa. #figure( figure( rect(image("./pictures/q1.3.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Questão 2: Projete um filtro que satisfaça as especificações a seguir, usando a janela de Kaiser: - Ap = 1,0 dB - Ar = 40 dB - Ωp = 1000 rad/s - Ωr = 1200 rad/s - Ωs = 5000 rad/s #sourcecode[```matlab clear all; close all; clc; pkg load signal; % Parâmetros passados pela questão: Omega_p = 1000; Omega_r = 1200; Omega_s = 5000; % Ripple de passagem em dB Ap = 1.0; % Atenuação mínima em dB Ar = 40; % Convertendo Ap para amplitude delta_p = (10^(0.05*Ap) - 1) / (10^(0.05*Ap) + 1); % Convertendo Ar para amplitude delta_r = 10^(-0.05*Ar); % Definição das frequências de corte em radianos: F = [Omega_p Omega_r]; A = [1 0]; ripples = [delta_p delta_r]; % Determinação dos parâmetros do filtro usando Kaiserord: [M, Wn, beta, FILTYPE] = kaiserord(F, A, ripples, Omega_s); % Geração da janela de Kaiser: kaiser_win = kaiser(M+1, beta); % Projeto do filtro FIR usando fir1 com a janela de Kaiser: h = fir1(M, Wn, FILTYPE, kaiser_win, 'noscale'); % Plot da resposta ao impulso: figure(1) stem(0:M, h) ylabel('h[n]'); xlabel('n'); title('Resposta ao Impulso'); % Cálculo e plot da resposta em frequência: [H, w] = freqz(h, 1, 2048, Omega_s); figure(2) plot(w, 20*log10(abs(H))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência'); ```] Abaixo temos a resposta em frequência do filtro projetado com a janela de Kaiser para as especificações dadas. Nota-se que a resposta em frequência do filtro projetado atende as especificações do projeto, com uma atenuação de 40dB na banda de rejeição e um ripple de 1dB na banda de passagem. #figure( figure( rect(image("./pictures/q2.1.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Abaixo também é exibido a resposta ao impulso do filtro projetado, onde é possível observar a resposta ao impulso do filtro projetado com a janela de Kaiser. #figure( figure( rect(image("./pictures/q2.2.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Questão 3: Projete um filtro que satisfaça as especificações a seguir, usando a janela de Kaiser: - Ap = 1,0 dB - Ar = 40 dB - Ωr = 1000 rad/s - Ωp = 1200 rad/s - Ωs = 5000 rad/s |#sourcecode[```matlab clear all; close all; clc; pkg load signal; % Especificações do filtro Ap = 1.0; % Ripple de passagem em dB Ar = 40; % Atenuação mínima em dB Omega_r = 1000; % Frequência de rejeição em rad/s Omega_p = 1200; % Frequência de passagem em rad/s Omega_s = 5000; % Frequência de amostragem em rad/s % Cálculo dos ripples em escala linear delta_p = (10^(0.05*Ap) - 1) / (10^(0.05*Ap) + 1); % Ripple de passagem delta_r = 10^(-0.05*Ar); % Atenuação de rejeição % Vetores de frequência e amplitude F = [Omega_r Omega_p]; % Frequências de interesse A = [0 1]; % Amplitudes desejadas (0 para rejeição, 1 para passagem) ripples = [delta_r delta_p]; % Ripples correspondentes % Determinação dos parâmetros do filtro usando Kaiserord [M, Wn, beta, FILTYPE] = kaiserord(F, A, ripples, Omega_s); % Geração da janela de Kaiser kaiser_win = kaiser(M+1, beta); % Projeto do filtro FIR usando fir1 com a janela de Kaiser h = fir1(M, Wn, FILTYPE, kaiser_win, 'noscale'); % Plot da resposta ao impulso figure(1) stem(0:M, h) ylabel('h[n]'); xlabel('n'); title('Resposta ao Impulso'); % Cálculo e plot da resposta em frequência [H, w] = freqz(h, 1, 2048, Omega_s); figure(2) plot(w, 20*log10(abs(H))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência'); ```] Abaixo temos a resposta em frequência do filtro projetado com a janela de Kaiser para as especificações dadas. Nota-se que a resposta em frequência do filtro projetado atende as especificações do projeto, com uma atenuação de 40dB na banda de rejeição e um ripple de 1dB na banda de passagem. Nota-se que a resposta em frequência deste filtro se assemelha bastante a resposta em frequência do filtro projetado na questão anterior, com a diferença de que a banda de passagem e a banda de rejeição estão invertidas. #figure( figure( rect(image("./pictures/q3.1.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) O mesmo ocorre para a resposta ao impulso do filtro projetado, onde é possível observar a resposta ao impulso do filtro projetado com a janela de Kaiser de maneira similar ao filtro projetado na questão anterior. #figure( figure( rect(image("./pictures/q3.2.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Questão 4: Projete um filtro que satisfaça as especificações a seguir, usando a janela de Kaiser: - Ap = 1,0 dB - Ar = 80 dB - Ωr1 = 800 rad/s - Ωp1 = 1000 rad/s - Ωp2 = 1400 rad/s - Ωr2 = 1600 rad/s - Ωs = 10000 rad/s #sourcecode[```matlab clear all; close all; clc; pkg load signal; % Parâmetros passados pela questão: Omega_r1 = 800; Omega_p1 = 1000; Omega_p2 = 1400; Omega_r2 = 1600; Omega_s = 10000; % Ripple de passagem em dB Ap = 1.0; % Atenuação mínima em dB Ar = 80.0; % Convertendo Ap para amplitude delta_p = (10^(0.05*Ap) - 1) / (10^(0.05*Ap) + 1); % Convertendo Ar para amplitude delta_r = 10^(-0.05*Ar); % Definição das frequências de corte em radianos: F = [Omega_r1 Omega_p1 Omega_p2 Omega_r2]; A = [0 1 0]; ripples = [delta_r delta_p delta_r]; % Determinação dos parâmetros do filtro usando Kaiserord: [M, Wn, beta, FILTYPE] = kaiserord(F, A, ripples, Omega_s); % Geração da janela de Kaiser: kaiser_win = kaiser(M+1, beta); % Projeto do filtro FIR usando fir1 com a janela de Kaiser: h = fir1(M, Wn, FILTYPE, kaiser_win, 'noscale'); % Plot da resposta ao impulso: figure(1) stem(0:M, h) ylabel('h[n]'); xlabel('n'); title('Resposta ao Impulso'); % Cálculo e plot da resposta em frequência: [H, w] = freqz(h, 1, 2048, Omega_s); figure(2) plot(w, 20*log10(abs(H))) axis([0 Omega_s/2 -90 10]) ylabel('Resposta de Módulo (dB)'); xlabel('Frequência (rad/s)'); title('Resposta em Frequência'); ```] Abaixo temos a resposta em frequência do filtro projetado com a janela de Kaiser para as especificações dadas. Nota-se que a resposta em frequência do filtro projetado atende as especificações do projeto, com uma atenuação de 80dB na banda de rejeição e um ripple de 1dB na banda de passagem. #figure( figure( rect(image("./pictures/q4.2.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Abaixo também é exibido a resposta ao impulso do filtro projetado, onde é possível observar a resposta ao impulso do filtro projetado com a janela de Kaiser. #figure( figure( rect(image("./pictures/q4.1.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Questão 5: Crie um sinal de entrada composto de três componentes senoidais, nas frequências 770 Hz, 852 Hz e 941 Hz, com Ωs = 8 kHz. Projete três filtros passa-faixa digitais, o primeiro com frequência central em 770 Hz, o segundo em 852 Hz e o terceiro em 941 Hz. Os parâmetros dados pela questão (resumo) estão abaixo. Para essa questão, será utilizado o filtro de kaiser, desta forma definimos um valor de atenuação maior que 60dB para garantir que o filtro atenda a especificação. ``` 1° Filtro - Ωs = 8 kHz - Ωc = 770 Hz - Ωr1 = 697 Hz - Ωr2 = 852 Hz 2° Filtro: - Ωs = 8 kHz - Ωc = 852 Hz - Ωr1 = 770 Hz - Ωr2 = 941 Hz 3° Filtro: - Ωs = 8 kHz - Ωc = 941 Hz - Ωr1 = 852 Hz - Ωr2 = 1209 Hz ``` #sourcecode[```matlab clear all; close all; clc; % Parâmetros do sinal e frequência de amostragem Omega_s = 8000; % Frequência de amostragem em Hz % Frequências das componentes senoidais freq1 = 770; % Hz freq2 = 852; % Hz freq3 = 941; % Hz % Amplitudes das componentes senoidais amp1 = 5; amp2 = 5; amp3 = 5; % Tempo de amostragem tmin = 0; tmax = 1; % segundos fs = 1/Omega_s; t = tmin:1/Omega_s:tmax-1/Omega_s; t1 = 2000*fs; t2 = 2100*fs; % Sinal composto de três senoidais sinal = amp1 * sin(2*pi*freq1*t) + amp2 * sin(2*pi*freq2*t) + amp3 * sin(2*pi*freq3*t); % Plot do sinal original no tempo figure; subplot(2,1,1); plot(t, sinal); xlim([t1 t2]) title('Sinal Original'); xlabel('Tempo (s)'); ylabel('Amplitude'); % Calculando o espectro do sinal original Sinal_fft = fft(sinal); L = length(sinal); Sinal_fft = abs(Sinal_fft/L); Sinal_fft = Sinal_fft(1:L/2+1); Sinal_fft(2:end-1) = 2*Sinal_fft(2:end-1); f = Omega_s*(0:(L/2))/L; subplot(2,1,2); plot(f, Sinal_fft); title('Espectro de Amplitude do Sinal Original'); xlabel('Frequência (Hz)'); ylabel('|S(f)|'); % Parâmetros dos filtros fc1 = 770; % Frequência central do primeiro filtro fc2 = 852; % Frequência central do segundo filtro fc3 = 941; % Frequência central do terceiro filtro largura_filtro = 4; % Extremidades das faixas de rejeição para cada filtro Omega_c1a = (697 + (((852-697)/2)/largura_filtro)) * 2 * pi / Omega_s; Omega_c1b = (852 - (((852-697)/2)/largura_filtro)) * 2 * pi / Omega_s; Omega_c2a = (770 + (((941-770)/2)/largura_filtro)) * 2 * pi / Omega_s; Omega_c2b = (941 - (((941-770)/2)/largura_filtro))* 2 * pi / Omega_s; Omega_c3a = (852 + (((1209-852)/2)/largura_filtro)) * 2 * pi / Omega_s; Omega_c3b = (1209 - (((1209-852)/2)/largura_filtro)) * 2 * pi / Omega_s; % Ordem dos filtros M = 1001; % Vetor de tempo para a resposta ao impulso n = (-M/2:M/2)'; % Janelas de Hamming para os filtros w_hamm = hamming(M+1); % Filtros passa-faixa projetados h1_n = ((sin(Omega_c1b.*n) - sin(Omega_c1a.*n))./(pi.*n)); h1_n((M+1)/2+1) = (Omega_c1b - Omega_c1a)/pi; h1_hamm = w_hamm.*h1_n; h2_n = ((sin(Omega_c2b.*n) - sin(Omega_c2a.*n))./(pi.*n)); h2_n((M+1)/2+1) = (Omega_c2b - Omega_c2a)/pi; h2_hamm = w_hamm.*h2_n; h3_n = ((sin(Omega_c3b.*n) - sin(Omega_c3a.*n))./(pi.*n)); h3_n((M+1)/2+1) = (Omega_c3b - Omega_c3a)/pi; h3_hamm = w_hamm.*h3_n; % Filtragem dos sinais sinal_filtrado1 = filter(h1_hamm, 1, sinal); sinal_filtrado2 = filter(h2_hamm, 1, sinal); sinal_filtrado3 = filter(h3_hamm, 1, sinal); % Calculando o espectro dos sinais filtrados Sinal_fft_filtrado1 = fft(sinal_filtrado1); Sinal_fft_filtrado1 = abs(Sinal_fft_filtrado1/L); Sinal_fft_filtrado1 = Sinal_fft_filtrado1(1:L/2+1); Sinal_fft_filtrado1(2:end-1) = 2*Sinal_fft_filtrado1(2:end-1); Sinal_fft_filtrado2 = fft(sinal_filtrado2); Sinal_fft_filtrado2 = abs(Sinal_fft_filtrado2/L); Sinal_fft_filtrado2 = Sinal_fft_filtrado2(1:L/2+1); Sinal_fft_filtrado2(2:end-1) = 2*Sinal_fft_filtrado2(2:end-1); Sinal_fft_filtrado3 = fft(sinal_filtrado3); Sinal_fft_filtrado3 = abs(Sinal_fft_filtrado3/L); Sinal_fft_filtrado3 = Sinal_fft_filtrado3(1:L/2+1); Sinal_fft_filtrado3(2:end-1) = 2*Sinal_fft_filtrado3(2:end-1); % Plot dos sinais filtrados no tempo e no domínio da frequência figure; % Sinal filtrado 1 subplot(2,2,1); plot(t, sinal_filtrado1); xlim([t1 t2]) title('Sinal Filtrado com Filtro Passa-Faixa 1 (770 Hz)'); xlabel('Tempo (s)'); ylabel('Amplitude'); subplot(2,2,2); plot(f, Sinal_fft_filtrado1); title('Espectro de Amplitude do Sinal Filtrado 1'); xlabel('Frequência (Hz)'); ylabel('|S(f)|'); % Resposta em frequência do filtro 1 [H1, W1] = freqz(h1_hamm, 1, 1024, Omega_s); subplot(2,2,[3 4]); plot(W1, 20*log10(abs(H1))); title('Resposta em Frequência do Filtro 1 (770 Hz)'); xlabel('Frequência (Hz)'); ylabel('Magnitude (dB)'); % Sinal filtrado 2 figure; subplot(2,2,1); plot(t, sinal_filtrado2); xlim([t1 t2]) title('Sinal Filtrado com Filtro Passa-Faixa 2 (852 Hz)'); xlabel('Tempo (s)'); ylabel('Amplitude'); subplot(2,2,2); plot(f, Sinal_fft_filtrado2); title('Espectro de Amplitude do Sinal Filtrado 2'); xlabel('Frequência (Hz)'); ylabel('|S(f)|'); % Resposta em frequência do filtro 2 [H2, W2] = freqz(h2_hamm, 1, 1024, Omega_s); subplot(2,2,[3 4]); plot(W2, 20*log10(abs(H2))); title('Resposta em Frequência do Filtro 2 (852 Hz)'); xlabel('Frequência (Hz)'); ylabel('Magnitude (dB)'); % Sinal filtrado 3 figure; subplot(2,2,1); plot(t, sinal_filtrado3); xlim([t1 t2]) title('Sinal Filtrado com Filtro Passa-Faixa 3 (941 Hz)'); xlabel('Tempo (s)'); ylabel('Amplitude'); subplot(2,2,2); plot(f, Sinal_fft_filtrado3); title('Espectro de Amplitude do Sinal Filtrado 3'); xlabel('Frequência (Hz)'); ylabel('|S(f)|'); % Resposta em frequência do filtro 3 [H3, W3] = freqz(h3_hamm, 1, 1024, Omega_s); subplot(2,2,[3 4]); plot(W3, 20*log10(abs(H3))); title('Resposta em Frequência do Filtro 3 (941 Hz)'); xlabel('Frequência (Hz)'); ylabel('Magnitude (dB)'); ```] A partir do código apresentado acima, primeiramente temos o plot do sinal original no tempo e no domínio da frequência. O plot no dominio da frequência permite verificar que as três componentes cossenoidais estão presentes no somatório do sinal. #figure( figure( rect(image("./pictures/q5.1.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Em seguida, temos o plot do sinal filtrado (com filtro passa faixa de 770Hz) no tempo e no domínio da frequência. Nota-se que no dominio da frequência, apenas o sinal de 770Hz é mantido, enquanto os sinais de 852Hz e 941Hz são atenuados até proximo de 0. Também há o plot da resposta em frequência do filtro passa-faixa de 770Hz, onde é possível observar a banda de passagem e a banda de rejeição do filtro. #figure( figure( rect(image("./pictures/q5.2.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Em seguida, temos o plot do sinal filtrado (com filtro passa faixa de 852Hz) no tempo e no domínio da frequência. Nota-se que no dominio da frequência, apenas o sinal de 852Hz é mantido, enquanto os sinais de 770Hz e 941Hz são atenuados até proximo de 0. Também há o plot da resposta em frequência do filtro passa-faixa de 852Hz, onde é possível observar a banda de passagem e a banda de rejeição do filtro. #figure( figure( rect(image("./pictures/q5.3.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Em seguida, temos o plot do sinal filtrado (com filtro passa faixa de 941Hz) no tempo e no domínio da frequência. Nota-se que no dominio da frequência, apenas o sinal de 941Hz é mantido, enquanto os sinais de 770Hz e 852Hz são atenuados até proximo de 0. Também há o plot da resposta em frequência do filtro passa-faixa de 941Hz, onde é possível observar a banda de passagem e a banda de rejeição do filtro. #figure( figure( rect(image("./pictures/q5.4.png")), numbering: none, caption: [Forma de filtragem do filtro projetado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Desta forma, podemos concluir que os três filtros projetados atendem as especificações do projeto, onde cada filtro mantém apenas a componente senoidal desejada e atenua as demais componentes cossenoidais.
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/025%20-%20Eternal%20Masters/002_All%20That%20Came%20Before.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "All That Came Before", set_name: "Eternal Masters", story_date: datetime(day: 01, month: 06, year: 2016), author: "<NAME>", doc ) #emph[Cho-Akhan is a caretaker for the dead, living with her family in a small Cho-Arrim village in the depths of the Rushwood. Life in the village is quiet and peaceful, and the long arm of Mercadia City seems impossibly far away…] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The morning began just the same as so many before: with a dead person. Cho-Akhan was used to dead people. Her mother—well, the mother who had given birth to her, not the other one—was a caretaker for the dead, taking in and caring for deserted Cho-Arrim bodies so that their souls could be sent on to rest. Her father had been a caretaker, too, before he’d joined the ranks of his charges. ‘Akhan came, in fact, from a long line of such people. So when her day started with rising with the sun, washing and dressing, and joining her mother Cho-Fihad in preparing the body of a woman from their village, it wasn’t anything out of the ordinary. The woman, a scout named Cho-Hanni, had been sick. Something had eaten up her insides while life still pumped through her, and the stink of her body when they had received her was, ‘Akhan supposed, unusual. ‘Fihad ran a hand across Cho-Hanni’s ashen face and told ‘Akhan to go out and fetch more sweet herbs to pack into the body before they sent her on her way. Cho-Hanni wouldn’t want to make her way down the river knowing that her body was left smelling like that, even though they were going to burn it in the end. ‘Akhan rolled her eyes when ‘Fihad wasn’t looking. ‘Fihad had a lot of ideas about what dead people did and didn’t want. Lots of adults in the village did. As though a dead person were in a position to want anything. ‘Akhan cared for the dead, but she didn’t think—as her mother clearly did—that the dead cared back. "Will you at least think about the garden this time?" she asked as she grabbed her gathering bag. "It would be so much easier for us to grow the herbs here. There’s plenty of space in our plot, and I could bring back some extra to plant." ‘Fihad shook her head, smiling an indulgent smile. "My persistent daughter. You know those herbs do best in the woods. Herbs growing in the garden would miss the wildness. They’d miss the trees and the river." ‘Akhan forced a smile and hitched up her bag. At the age of sixteen, she knew better than to argue. But she wanted to. Oh, she wanted to. ‘Akhan played it out in her head as she made her way down the dirt road that lead out of the village. It was ridiculous that she had to go so far to get something that they could just grow at home. She was good with plants. So was her brother, Cho-Ran. She knew he’d help her with the garden whenever he wasn’t off with the other scouts. It wasn’t even like ‘Fihad would have to do any work… She came to the river and followed it a ways, listening to the noises it made as it wound its slow course past rocks and roots. ‘Fihad thought it was full of souls, going to wherever it was that Cho-Hanni was headed. Of course she did. ‘Akhan cut north, away from the river and toward the tangled pocket of woodland where the sweet herbs grew. She thought about planting the garden anyway. What would ‘Fihad do, pull the herbs up by their roots when she found them growing behind the house? She stewed over it all the way up to her gathering place, lost completely in the tightening spiral of her own thoughts. She would have kept stewing, too, had a great horned troll not come crashing through the trees in front over her, right into her path. #figure(image("002_All That Came Before/02.jpg", width: 100%), caption: [Horned Troll | Art by <NAME>], supplement: none, numbering: none) She tripped backward in surprise, catching her foot on a thick root and tumble-skidding down a steep incline that, embarrassingly, she had overlooked. The incline had a sort of concave pocket at the base, though, and she pressed herself tightly into the hiding space it afforded, hoping desperately that the troll hadn’t noticed her. The troll was big, and very angry. Clods of dirt scattered down the incline and off the little earthen shelf over ‘Akhan’s head. She buried her face in the dead leaves. #emph[Go away,] she thought insistently. #emph[Go away, go away, go away.] After what felt like an eternity or two, the sound of the troll’s footsteps receded, tromp-tromping off through the trees and underbrush. #emph[Probably stomped all over my herbs, too] . That would figure. ‘Akhan moved into a crouch, brushing the worst of the dirt off of her clothing. She had just readjusted her bag on her shoulder when something caught her eye. She had gone to collect herbs many times before. This was the closest to the village that they grew, and she seldom trekked any farther into the dense forest. She had not, however, spent much time at the bottom of this particular drop-off, hiding from angry trolls, so she could forgive herself for never having seen the chiseled stone pillar that looked suspiciously like half a doorway. The pillar was barely taller than she was, covered over with thick, creeping vines. And beyond it… She was pulling the vines away before she quite realized what she was doing. Her efforts revealed more crumbling stones, fitted together imperfectly and accented with carved scribbles that she presumed were some sort of writing. This was a doorway, all right. A doorway with a wall fitted right over it. Unbearably curious, she pulled stone after stone away until the opening was wide enough to allow her to squeeze through. Inside was a dry mustiness, barely stirred by the currents of air passing through the newly unsealed door. ‘Akhan felt her way along the passage, fingers brushing against crumbling dirt. Soon, the dim light from the door disappeared altogether. She wished she had something to light her way, but it was too late to go back. She was committed. The passage abruptly opened into a small room. She could feel the walls drop away, the space opening around her into even deeper shadow. And there, in the middle of the room, she could make out a shape, standing out just slightly against the dark. Like a plinth, and something on top of it… #emph[A body.] ‘Akhan crept closer. An old body, she realized. An unbelievably old body, wrapped up in a desiccated sheet. And what was that all over its face? It seemed to be giving off a barely perceptible light. ‘Akhan crept closer, reaching out gingerly with her hands… A glowing mass erupted around her probing fingers. She jumped backward, heart pounding against her rib cage. Moths, she realized. A flurry of softly glowing moths, rising out of the object beneath her hands. #figure(image("002_All That Came Before/04.jpg", width: 100%), caption: [Goldenglow Moth | Art by <NAME>yon], supplement: none, numbering: none) Surrounded by the dry fluttering of dozens of feathery wings, she peered down at the face again, illuminated now from the outside. A mask, she realized. The body was wearing a mask, shattered into pieces. No…not shattered. The pieces of the mask were embedded in the mummified flesh of the face. She imagined what it would feel like to have skin growing over bits of ceramic, integrating, welcoming it in… Suddenly, she couldn’t be out of the cave fast enough. The moths rose in a whirlwind around her. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) ‘Akhan returned home with a bag full of herbs, and while mother Cho-Shadi may have raised her eyebrows as she polished her long spear, mother ‘Fihad said nothing about the delay. Instead, she simply smiled and directed ‘Akhan to help prepare the herbs. "I saw a troll today," ‘Akhan said, keeping her voice casual as she packed the herbs into small linen pouches. ‘Fihad had already removed Cho-Hanni’s blackened organs, and ‘Akhan’s pouches would soon take their place. Mother ‘Shadi, who wasn’t afraid of anything, shifted almost imperceptibly. Mother ‘Fihad sighed and took a pouch from ‘Akhan. "They’ve been restless. Much more…" Her brow furrowed. "Something bad is coming. Rushwood is afraid." Flaring nostrils. "This smells of Mercadia City." ‘Akhan set her jaw. It was an old argument, this business about Mercadia City. "Nothing bad is coming, Mom." She handed off another pouch of fragrant herbs. "Mercadians don’t come here. They just sit in their big shiny city, and they never send soldiers." #figure(image("002_All That Came Before/06.jpg", width: 100%), caption: [Cliffside Market | Art by <NAME>], supplement: none, numbering: none) Mother ‘Shadi snorted. "Listen to our grown-up daughter, ‘Fihad. So knowledgeable in matters of empire. So sure that that big polished cage does not move." ‘Akhan felt her jaw tighten. "City folk like their cities, and cities do not move. Mercadia won’t come, and neither will anything else. If anything, you should worry about making me walk so far to collect herbs when there’s perfectly good land out back. ‘Ran would help me work it, and I wouldn’t almost get eaten by trolls!" ‘Fihad smiled the shadow smile that meant she was thinking of ‘Akhan’s father, reminded by something in ‘Akhan’s face or voice or movement. Maybe that was why she’d chosen ‘Shadi after her husband was six years in the river. Rough ‘Shadi, quick with a spear, spare with her words, as different from ‘Akhan’s father as a jaguar was from a lamb. ‘Akhan, feeling the prickly discomfort that she felt every time she saw that smile, found herself blurting out: "I found a dead person, too." ‘Fihad looked up from Cho-Hanni, concerned. "Not someone from the village?" she asked. "Is the sickness spreading?" ‘Akhan shook her head quickly. "No, no. Not like that. Someone dead a long time, hidden in a cave. She had a mask—" and here she raised her hands to her face for emphasis "—built right into her face." ‘Fihad’s eyes sharpened. "Sounds like you found one of our old shamans. Not many left—Rushwood tends to swallow them down." ‘Akhan raised an eyebrow. "Shamans? Shamans just read the harvest and bless the hunt. Read nice words when people die. That sort of thing." #emph[They don’t push ceramic pieces into their skin] . "Maybe not our shamans. But my mother used to tell me stories. She told me that a long time ago, our ancestors honored their people with masks. Not just their own ancestors, but the people who were alive, too. Their parents and siblings and children who shared their table." She looked down at Cho-Hanni, waiting to be stitched and swathed. "The living along with the dead." "Uh-huh." ‘Akhan passed fine bone needles to her mother, sharp enough to pass clear through a finger before you could even feel it. "Living and dead. Got it." She didn’t want to seem interested. ‘Fihad always took that as an invitation to pull her down into ramblings about old mysticism and old rivers carrying old souls. But she #emph[was] interested, and that was almost more annoying by itself than any of the stuff that ‘Fihad believed in. ‘Fihad took the proffered needles from her daughter and threaded one, bending to the task of putting Cho-Hanni’s body back together. "It sounds strange, doesn’t it? But those shamans, they made their masks of all different pieces. Like a puzzle, or a mosaic. Each piece was meant to represent or channel a different aspect of their people. Kind of like a picture of who they were and what they could do. There’s great power in that sort of togetherness. It’s a shame what we’ve forgotten." "A picture, sure." ‘Akhan made a show of shaking her head, completing her work in silence. But deep down inside, she felt a little thrill. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #figure(image("002_All That Came Before/08.jpg", width: 100%), caption: [Island | Art by Martina Pilcerova], supplement: none, numbering: none) Long hours had passed since Cho-Hanni’s body was brought to the river, resting on a bier of fragrant cedar and wrapped in the colors of mourning. Their shaman—their normal shaman with his normal face—had said his words over the body while mother ‘Fihad shielded her eyes. She said that caretakers were supposed to cover their eyes so that the soul could slip from the body and into the river without everybody watching, and ‘Akhan had made the gesture too without really meaning it. She’d been doing it since she was little. The river was peaceful and beautiful, a good place for a funeral. What it wasn’t was some magical soul road. Cho-Hanni was gone. End of story. Now it was dark, and a heavy summer rain pounded against the roof. Over the rain, she could hear ‘Ran snoring heavily on the other side of the cloth wall that divided them. Her older brother had returned home from ranging just after Cho-Hanni’s body had been burned down to ashes and scattered into the river. Unsurprisingly to ‘Akhan, he carried no news of encroaching Mercadian soldiers or city-built war engines, though he did have an improbable story about a bear attack that made mother ‘Shadi snort and cuff him across the back of his head. Judging by his snores, he would sleep deep and wake early, ready to be up and moving. He’d even agreed to help her with her herb garden, offering a conspiratorial wink when mother ‘Fihad wasn’t looking. It would be a good day. The night noises should have lulled her off to sleep, but instead they pried her senses open. She kept thinking about the dead shaman woman and her dead shaman picture mask, covered up and forgotten in that crumbling dirt room. #emph[At least she’s got weird moths to remember her. Give her a light to see by…] Before she quite knew what she was doing, ‘Akhan was fully dressed and sneaking out the door, trusting the rain and ‘Ran’s abundant snores to cover the sound of her passage. The pounding rain shocked her skin and flattened her black hair against her head in an instant. She set out toward the river. She retraced her steps from the day before, following the curve of the rushing water. The river was running wide and wild, spilling its banks, exulting with the rain. She was just getting ready to peel away into the trees when something stopped her dead in her tracks. That something was mother ‘Shadi, matted with rainwater, long spear in her hand. She stood stock-still, looking at some great mass that lay at her feet. The water that cascaded off the head of the spear was tinged red. "Dead inside," ‘Shadi murmured as ‘Akhan approached. She angled the head of the spear downward to point. Fascinated, ‘Akhan followed the line of the spear down to the corpse of the horned troll sprawled in the mud. ‘Shadi had slit its belly open, and stinking, blackened innards spilled from the gash. "Like Cho-Hanni," breathed ‘Akhan. The smell of the sickness pushed up through the pounding rain. Her gut lurched. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) More people in the village got sick. It didn’t take long. Cho-Annu, the spearmaker. Cho-Biaal, who took all day to wash her clothing so that she could hear all the gossip on the banks of the river. Cho-Tunni, who kept three dogs and no husbands. People ‘Akhan had known all of her short life, brought down one by one. The healers tried everything that they knew, old arts and new measures alike, but still the sick burned up with fever. One by one, they followed the path that Cho-Hanni had trod. Cho-Annu, Cho-Biaal, Cho-Tunni, all laid out in the home of ‘Akhan and her mothers, ashes for the great river. ‘Ran with his crow-feather hair, devoted oldest son, beloved brother of ‘Akhan, felt his lungs curl and blacken within him. He died in their home, and they barely had to move him three feet to prepare him for his journey. #emph[His journey] . The words soured against the back of ‘Akhan’s tongue, unspoken and bitter. There would be no garden, now. Mother ‘Fihad stroked her son’s hair, still damp with old sweat. "The river will guide him true," she said. "It will take him to rest." A furry brown moth, trapped inside the house, battered against the ceiling, looking for a way out. ‘Akhan watched it struggle, feeling helpless and angry. "There’s nothing special about that river," she snapped. "‘Ran is #emph[dead] ." And then, quieter: "He’s not coming back." ‘Fihad said nothing, and ‘Akhan pretended that she didn’t see that her mother was crying as she prepared the body of her son. She clenched her jaw, teeth grinding, and counted out the pouches of herbs. She had made so many, lately. For the first time, she envied her mother’s belief. ‘Fihad would find peace somewhere in this, even with her dead son in her arms. But for herself, ‘Akhan was certain that there would be no peace. The moth continued to struggle, its small body slamming into the ceiling again and again. ‘Akhan wanted to scream. #emph[There’s a window] , she thought. #emph[It’s right there. Just fly down, and you’re free.] #emph[Just fly down.] The mask leapt into her thoughts. The dead shaman’s mask, down down down under the ground, lit with old knowledge and a whisper of dusty wings. #emph[She would have seen this] , ‘Akhan thought. #emph[If she really did have power, if Mom is right, she would have seen this coming. Wouldn’t she?] ‘Akhan passed a hand over her eyes and found a veil of tears. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) ‘Ran was nine days in the river when ‘Shadi brought news. Cho-Arrim scouts, galvanized in the wake of ‘Ran’s death, had ringed their eyes with his ashes and disappeared into the Rushwood wilds, ‘Shadi among them. They had returned in the predawn with reports of Mercadians, small bands of soldiers bearing the crest of their shining city. The soldiers were traveling light. They carried few weapons. But in their wake, the trees shuddered and groaned. Roots twisted in the earth, and tamarins fell from their high homes to rot in beds of dead leaves. #figure(image("002_All That Came Before/10.jpg", width: 100%), caption: [Dismal Backwater | Art by <NAME>], supplement: none, numbering: none) They were bringing sickness to Rushwood. "Nothing but scavengers," ‘Shadi muttered as she cleansed the dirt from her wiry arms. "They’ll kill us all off without even laying a finger on a single Cho-Arrim, then pick over our bones for whatever’s left." #emph[Rushwood is afraid.] #emph[Mercadia does not come here.] ‘Akhan had never felt so guilty in her life. The feeling sat in her bones, heavy and dark. She would have staked her life on ‘Fihad’s fears being the stuff of superstition, a grown-up who didn’t understand that the world had changed. Instead, ‘Fihad was right, and ‘Ran had paid for ‘Akhan’s error with his own life. He was dead because of her. Because she hadn’t believed her mother. Because she only knew how to prepare a body, not save one. Because, because, because. That night, when the moon was high above the canopy, ‘Akhan left her house and its parade of dead kinfolk. Brown moths fluttered in the air around her, wings catching in the moonlight. They watched her go. She padded through the wet chill, drifted alongside the river, made her way down into that old tomb and its shaman mask. Her body felt hollow. Her heart felt filled with fluttering moths. Moths in the moonlight. Moths under the mask. She felt that if she were to open her mouth, they would come bubbling out of her throat. She stared down at the shaman, long dead and inscrutable. She stared, and then she opened her mouth. The moths filling her body poured out. The moths filling the mask rose up and scattered. She screamed, and screamed. At first, it was wordless. A lifetime of confidence, shattered. An older brother who lived life out in the wild woods, dead on the floor of their home. A father who didn’t wake up, and a mother who cried every night while her young children tried not to listen. A thick film of ashes coating the back of the rushing river. Mercadia. Mercadia. Mercadia. She slumped against the dirt wall, exhausted. "Why?" she whispered between dry lips. #emph[Why did this happen? Why are we dying? Why are you here with your mask and your secrets, watching my world fall apart?] She closed her eyes. #emph["The Cho-Arrim don’t remember,"] said a voice in her head. #emph["They knew, once. How to be many."] "But…how?" she murmured. She knew that she was falling asleep, speaking to an empty room. It didn’t bother her. She had already been wrong about so much. #emph["The mask has power," ] came the voice again. #emph["You make it with pieces of your world. You become a reflection of your people." ] A hesitation. #emph["You lose yourself, though. You make yourself into a picture of everyone else, but it covers you."] Tears squeezed out through ‘Akhan’s closed eyelids. "Uh-huh. It covers you. Got it." She pulled in a shuddering breath. She felt the crushing weight of mother ‘Fihad’s rightness, of mother ‘Shadi’s bloody spear, of the capital city that had waved its hand and killed ‘Ran a million miles away. All of those deaths, filling up the air with ashes. "I don’t mind being covered," she said. "If it saves my people, I don’t mind. I haven’t helped my family. I couldn’t save my brother. It isn’t so great a loss, to lose me." The voice sounded sad, when it spoke again. "#emph[It is always a great loss when a family loses a child.] " ‘Akhan felt herself smiling. "Then I’ll make sure that no more families need to." The decision was made. Moths battered the air around her, a rising storm of wings and light. ‘Akhan knew that she wouldn’t have time to build a mask before the wave of the empire came crashing down on them…but maybe she wouldn’t need to. Her eyes cracked open. She looked to the body. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Pain. ‘Akhan could feel the blood on her face, cascading from the places where her skin was opened. Under the light of what seemed to be hundreds of soft wings, she had pulled the mask pieces from the dead shaman’s face. The shaman hadn’t put up much of a fight. Not giving herself the chance to hesitate, ‘Akhan had started pushing the dusty ceramic shards into her own face. #emph[For ‘Ran. For my mothers. For the Cho-Arrim.] The pain cracked her open like ripe fruit. Bloody red flowers bloomed in the cracks of her skin. There was power, too. Surges of it, building behind her teeth and against the insides of her wrists, shuddering in great swaths across the lean muscles of her back. For brief moments, as she made her stumbling way back toward her village, she could swear that her feet left the ground behind. For a beat of her heart, she would float, only to snag her foot in the next step and narrowly avoid falling to her knees. A great strength flooded her limbs, then drained out and left her struggling to place one foot in front of the other. She blinked her eyes and Rushwood was replaced with rows upon rows of Mercadian military, sun glinting off their helmets. And facing them, mother ‘Shadi at the front of mustered Cho-Arrim warriors. Standing ready. Another blink, and there was the forest again, the armies vanished. #emph[Mercadia is coming] , she thought through the haze of juddering power. #emph[Mercadia is coming, and mother ‘Shadi will try to drive them back.] She needed to reach them. She needed to get to the village and find ‘Shadi. Find their warriors. They would need the weapon that she brought, the weapon— With a sickening lurch in her gut, she realized that she wouldn’t be in time. She had thought to bring a great weapon, something to throw back at the invaders, to show the strength of the Cho-Arrim, but her body and mind were breaking apart under the strain of the dead shaman’s mask. The power was borrowed, and could not find a way to take root inside ‘Akhan. Her skin felt wet. The river. She was in the river. In the moment before she submerged, she thought she could see the surface of the water softly glowing. #emph[River full of souls] , she thought. #emph[Mother ‘Fihad would want me to cover my eyes] . She passed beneath the glowing surface, feeling the cool water fill in the gaps between her flesh and the mask shards. Relief. Relief from the pain, relief from the flickering vestiges of long-buried power. She opened her eyes. The dead stared back at her. They were everywhere. Cho-Arrim people, like her, and people older than Cho-Arrim, eddying in the current. She supposed that she should feel afraid. Or, perhaps, transcendent. #emph[Oh, there you are] , she thought instead. She wished ‘Fihad could see. All of the ashes poured into the river, all of the rites…it wasn’t empty at all. A lump formed in her throat. #emph[I thought you were gone. All of you, I thought you were gone.] #emph[I’m sorry.] One of the souls reached out and touched ‘Akhan’s broken skin. A coolness separate from the water suffused her. A piece of ceramic detached from her face and drifted toward the riverbed. #figure(image("002_All That Came Before/12.jpg", width: 100%), caption: [Ancestral Mask | Art by Magali Villeneuve], supplement: none, numbering: none) #emph[No, I need that…] she thought. More souls brushed against her, knitting her flesh and pushing out the mask. #emph[Stop, you can’t…] The hope for the Cho-Arrim fell away from her in ceramic splinters. She wondered dimly if it was possible to cry underwater. The final piece fell away. The water around her began to hum. The soul closest to her reached out and stroked her face. ‘Ran, she realized. #emph[This is ‘Ran] . It was like remembering somebody from a long time ago, or looking at them from a great distance. His fingers brushed the tracery of fresh scars, and ‘Akhan felt her body flood with light. Where before she had felt uncontrollable bursts and ebbs of unpredictable power, she instead felt a steady pulse, connecting her with every soul in the river. They were tied, bound up in each other, travelers on the last long road. A single, perfect picture. Suddenly, ‘Akhan felt herself being wrenched upward. The souls around her scattered like a cloud of moths as she burst up through the surface of the river. Somebody was gripping her arm and shouting her name. A face, somehow familiar. Mother ‘Shadi, eyes wild with worry, pulling her up onto the riverbank. "I know you…" said ‘Akhan. Her thoughts were sluggish. "You’re one of my mothers." ‘Shadi barked a laugh. "Listen to this daughter of mine, forgetting my face just because she fell in the river." She had tears in her eyes, and wiped them away with the heel of her hand. Her eyes widened, then, and she took in ‘Akhan’s face for the first time. "‘Akhan, what #emph[happened] ? Who did this to you?" ‘Akhan lifted a hand and touched the skin. Raised patterns greeted her fingertips, circles and whorls of scar tissue. She sat up carefully, pulling away from ‘Shadi’s grasp, and peered into the river. It no longer seemed to glow, but the scars did. Reflected in the water, they looked just like a mask. She smiled a slow smile and stood. A few moths, skimming the surface of the water, fluttered up and danced around her head. "‘Shadi? Did you find her?" ‘Fihad appeared from around a bend in the river and came running toward them. When she saw ‘Akhan’s face, she stopped in her tracks, tears in her eyes. "Oh, ‘Akhan," she said, brushing her daughter’s face with her fingertips. Her smile was that sad smile, the one that spoke of ‘Akhan’s father and that now spoke also of ‘Ran. "I had hoped that we wouldn’t lose you, too." ‘Akhan lifted her arms and enveloped ‘Fihad in a warm embrace. "I am Cho-Akhan," she whispered against ‘Fihad’s ear. "I am Cho-Ran. I am Cho-Hanni, Cho-Annu, and Cho-Biaal. I am Sia-am-Erh, interred under the grove. I am you, Cho-Fihad. And I am Cho-Shadi. I am our family. I am the family of our family." ‘Fihad pulled away and stared at the face of her daughter. Her eyes were filled with fierce pride and bottomless sorrow. ‘Akhan nodded and lifted her head. Strength surged through her limbs. She felt the river in her blood, the forest spreading through the length of her body. A chorus of voices sang in her heart, Cho-Arrim and the people who gave birth to the Cho-Arrim. An army would fall to her, she knew. Mercadia would behold her, and know that she was many voices. A mosaic of all that her people were, and all that they could be. "Show me our army," she said to ‘Shadi, the woman who had been her mother. The Mercadians were expecting to find a single, weakened village, full of sickness and ripe for the taking. They were not expecting to find every Cho-Arrim that had ever called Rushwood their home. They were not expecting a #emph[fight] . #emph[Won’t they be surprised?]
https://github.com/giZoes/justsit-thesis-typst-template
https://raw.githubusercontent.com/giZoes/justsit-thesis-typst-template/main/others/bachelor-assignment.typ
typst
MIT License
#import "../resources/utils/datetime-display.typ": datetime-display #import "style.typ": 字号, 字体 #import "../resources/utils/bilingual-bibliography.typ": bilingual-bibliography // 本科生r任务书 #let bachelor-assignment( // documentclass 传入的参数 anonymous: false, // anonymous: true, twoside: false, fonts: (:), info: (:), // 其他参数 stoke-width: 0.5pt, min-title-lines: 2, info-inset: (x: 0pt, bottom: 1pt), info-key-width: 72pt, column-gutter: -3pt, row-gutter: 18pt, anonymous-info-keys: ("grade", "student-id", "author", "supervisor", "supervisor-ii"), bold-info-keys: ("title",), bold-level: "semibold", datetime-display: datetime-display, ) = { // 1. 默认参数 fonts = 字体 + fonts info = ( title: "基于 Typst 的苏理工学位论文", grade: "20XX", student-id: "218111545200", author: "张居正", department: "电气与信息工程学院", major: "软件工程", supervisor: ("某某", "教授"), sign-date: datetime(day: 17, month: 7, year: 2024), ) + info // 2. 对参数进行处理 // 2.1 如果是字符串,则使用换行符将标题分隔为列表 // 2.3 处理提交日期 if type(info.sign-date) == datetime { info.sign-date = datetime-display(info.sign-date) } // 3. 内置辅助函数 let info-key(body) = { rect( width: 100%, inset: info-inset, stroke: none, text(font: fonts.宋体, size: 字号.小三, body), ) } let info-value(key, body) = { set align(center) rect( width: 100%, inset: info-inset, stroke: (bottom: stoke-width + black), text( font: fonts.宋体, size: 字号.小三, weight: if (key in bold-info-keys) { bold-level } else { "regular" }, bottom-edge: "descender", body, ), ) } let info-long-value(key, body) = { grid.cell(colspan: 3, info-value( key, if anonymous and (key in anonymous-info-keys) { "██████████" } else { body } ) ) } let info-short-value(key, body) = { info-value( key, if anonymous and (key in anonymous-info-keys) { "█████" } else { body } ) } let info-title(key, body) = { set align(center) rect( width: 100%, inset: info-inset, stroke: none, text( font: fonts.宋体, size: 字号.小三, weight: if (key in bold-info-keys) { bold-level } else { "regular" }, bottom-edge: "descender", body, ), ) } // 4. 正式渲染 { pagebreak(weak: true, to: if twoside { "odd" }) // 居中对齐 set align(center) // 匿名化处理去掉封面标识 if anonymous { v(8.2cm) } else { // 封面图标 v(3cm) // 调整一下左边的间距 text(size: 字号.小一, font: fonts.仿宋, spacing: 180%, weight: "bold")[江 苏 科 技 大 学 苏 州 理 工 学 院] v(3cm) } // 将中文之间的空格间隙从 0.25 em 调整到 0.5 em text(size: 字号.小初, font: fonts.宋体, spacing: 100%, weight: "bold")[毕业设计(论文)任务书] v(7cm) block(width: 100%, grid( columns: (info-key-width, 1fr, 18pt, info-key-width, 1fr), column-gutter: column-gutter, row-gutter: row-gutter, info-key("学院名称:"), info-short-value("department", info.department),[], info-key("专  业:"), info-short-value("major", info.major), info-key("学生姓名:"), info-short-value("author", info.author),[], info-key("学  号:"), info-short-value("student-id", info.student-id), info-key("指导教师:"), info-short-value("supervisor", info.supervisor.at(0)),[], info-key("职  称:"), info-short-value("supervisor", info.supervisor.at(1)), )) v(2cm) info-key(info.sign-date) } //表格部分 let table-stroke = 0.5pt pagebreak(weak: true) set text(size: 字号.小四, font: fonts.宋体) table( columns: 1fr, stroke: table-stroke, inset: 10pt, )[ #text(size: 字号.小三, "毕业设计(论文)题目:") #info-title("title",info.title) ][ 一、毕业设计(论文)内容及要求(包括原始数据、技术要求、达到的指标和应做的实验等) #v(25em) ][ 二、完成后应交的作业(包括各种说明书、图纸等) #v(25em) ][ 四、主要参考资料(包括书刊名称、出版年月等): #show heading.where(level: 1):"" //可以用新的bib #bilingual-bibliography(bibliography: bibliography.with("../ref.bib"), full: true) ][ #v(1em) #set underline(offset: 0.2em) 系(教研室)主任:#underline("        ")(签章)    #info.sign-date #v(1em) ][ #v(1em) #set underline(offset: 0.2em) 分管教学院长:#underline("        ")(签章)    #info.sign-date #v(1em) ] } #bachelor-assignment()
https://github.com/Pegacraft/typst-plotting
https://raw.githubusercontent.com/Pegacraft/typst-plotting/master/plotst/plotting.typ
typst
MIT License
#import "axis.typ": * #import "util/classify.typ": * #import "util/util.typ": * #import calc: * // hackyish solution to split axis and content #let render(plot, plot_code, render_axis, helper_line) = style(style => { let widths = 0pt let heights = 0pt let offset_left = 0pt let offset_bottom = 0pt // Draw coordinate system for axis in plot.axes { let (w,h) = measure_axis(axis, style) if(axis.location == "left") { offset_left += w } widths += w if(axis.location == "bottom") { offset_bottom += h } heights += h } let x_axis = plot.axes.filter(it => not is_vertical(it)).first() let y_axis = plot.axes.filter(it => is_vertical(it)).first() let offset_y = 0pt let offset_x = 0pt if x_axis.location == "bottom" { offset_y = -offset_bottom } if y_axis.location == "left" { offset_x = offset_left } place(dx: offset_x, dy: 100% - offset_bottom, box(width: 100% - widths, height: 100% - heights, fill: none, { if helper_line { for axis in plot.axes { draw_helper_lines(axis) } } if render_axis { for axis in plot.axes { draw_axis(axis) } } else { plot_code() } })) }) // Prepares everything for a plot and executes the function that draws a plot. Supplies it with width and height // size: the size of the plot either as array(width, height) or length // caption: the caption for the plot // capt_dist: distance from plot to caption //------- // width: the width of the plot // height: the height of the plot // the plot code: a function that needs to look accept parameters (width, height) // plot: if set this function will attempt to render the axes and prepare everything. If not, the setup is up to you // if you want to make the axes visible (only if plot is set) //------- #let prepare_plot(size, caption, plot_code, plot: (), render_axis: true) = { let (width, height) = if type(size) == "array" {size} else {(size, size)} figure(caption: caption, supplement: "Graph", kind: "plot", { // Graph box set align(left + bottom) box(width: width, height: height, fill: none, if plot == () { plot_code() } else { if render_axis { render(plot, plot_code, true, true) } render(plot, plot_code, false, false) }) }) } /// The constructor function for a plot. This combines the `data` with the `axes` you need to display a graph/plot. The exact structure of `axes` and `data` varies from the visual representation you choose. An exact specification of how these have to look will be found there. /// === Examples /// This is how your plot initialisation will look most of the time: /// ```typc /// let x_axis = axis(…) /// let y_axis = axis(…) /// let data = (…) /// let pl = plot(axes: (x_axis, y_axis), data: data) ``` \ /// How your plot initialisation would look for a _pie chart_: /// ```typc /// let data = (…) /// let pl = plot(data: data)``` \ /// This is a lot simpler ans a _pie chart_ doesn't require any axes. \ \ /// - axes (axis): A list of axes needed for drawing the plot (most likely a x- and y-axis) /// - data (array): The data that should be mapped onto the plot. The format depends on the plot type #let plot(axes: (), data: ()) = { let plot_data = ( axes: axes, data: data ) return plot_data } /// This function is used to overlay multiple plots. This can be used to render multiple graph lines in one plot and much more. The axes that get rendered, are the axes of the first plot inserted. Make sure all plots use the same axes as otherwise this will cause issues. /// - plots (array): An array of all the `plot` objects you want to render. /// - plot_types (array): An array of the different types of plots these should be rendered as. This array needs to have the same length, as the `plots` array. The array accepts the following strings: `scatter, graph, histogram, pie, bar`. The type of plot is applied per index. /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` #let overlay(plots, size) = { figure(caption: plots.at(0).caption, supplement: "Graph", kind: "plot", { set align(left + bottom) box(..convert_size(size), { // loop over every plots for (idx, plot) in plots.enumerate() { if idx == 0 { place(dx: 0pt, dy: 0pt, box(width: 100%, height: 100%, plot.body.child.body)) } else { place(dx: 0pt, dy: 0pt, box(width: 100%, height: 100%, plot.body.child.body.children.at(1))) } } }) }) } /// This function will display a scatter plot based on the provided `plot` object. /// === How to create a simple scatter plot /// First, we need to define the data we want to map to the scatter plot. In this case I will use some random sample data. \ /// ```typc let data = ((0, 0), (1, 2), (2, 4), (3, 6), (4, 8), (5, 3), (6, 6),(7, 9),(11, 12))``` \ \ /// Next, we need to define both the x and the y-axis. The x-axis location can either be `"bottom"` or `"top"`. The y-axis location can either be `"left"` or `"right"`. You can customise the look of the axes with `axis` specific parameters (here: `helper_lines: true`)\ /// ```typc let x_axis = axis(min: 0, max: 11, step: 1, location: "bottom") /// let y_axis = axis(min: 0, max: 13, step: 2, location: "left", helper_lines: true)``` /// Now we need to create a `plot` object based on the axes and the data. \ /// ```typc let pl = plot(axes: (x_axis, y_axis), data: data) ``` /// /// Last, we need to just call this function. In this case the width of the plot will be `100%` and the height will be `33%`. \ /// ```typc scatter_plot(pl, (100%, 33%))``` \ \ /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` Two axes are required. The first one as the x-axis, the second as the y-axis. \ _Example:_ `(x_axis, y_axis)` /// - `data:` An array of `x` and `y` pairs. \ _Example:_ `((0, 0), (1, 2), (2, 4), …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - stroke (none, auto, length, color, dictionary, stroke): The stroke color of the dots (deprecated) /// - fill (color): The fill color of the dots (deprecated) /// - render_axes (boolean): If the axes should be visible or not /// - markings (string, content): how the data points should be shown: "square", "circle", "cross", otherwise manually specify any shape (gets overwritten by stroke/fill) #let scatter_plot(plot, size, caption: [Scatter Plot], stroke: none, fill: none, render_axes: true, markings: "square") = { let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) // The code rendering the plot let plot_code() = { let step_size_x = calc_step_size(100%, x_axis) let step_size_y = calc_step_size(100%, y_axis) // Places the data points for (x,y) in plot.data { if type(x) == "string" { x = x_axis.values.position(c => c == x) } if type(y) == "string" { y = y_axis.values.position(c => c == y) } if stroke != none or fill != none { // DELETEME deprecation, only keep else draw_marking(((x - x_axis.min) * step_size_x, -(y - y_axis.min) * step_size_y), square(width: 2pt, height: 2pt, fill: fill, stroke: stroke)) } else { draw_marking(((x - x_axis.min) * step_size_x, -(y - y_axis.min) * step_size_y), markings) } } } // Sets outline for a plot and defines width and height and executes the plot code prepare_plot(size, caption, plot_code, plot: plot, render_axis: render_axes) } /// This function will display a graph plot based on the provided `plot` object. It functions like the _scatter plot_ but connects the dots with lines. /// === How to create a simple graph plot /// First, we need to define the data we want to map to the graph plot. In this case I will use some random sample data. \ /// ```typc let data = ((0, 0), (1, 2), (2, 4), (3, 6), (4, 8), (5, 3), (6, 6),(7, 9),(11, 12))``` \ \ /// Next, we need to define both the x and the y-axis. The x-axis location can either be `"bottom"` or `"top"`. The y-axis location can either be `"left"` or `"right"`. You can customise the look of the axes with `axis` specific parameters (here: `helper_lines: true`) /// ```typc let x_axis = axis(min: 0, max: 11, step: 1, location: "bottom") /// let y_axis = axis(min: 0, max: 13, step: 2, location: "left", helper_lines: true)``` /// Now we need to create a `plot` object based on the axes and the data. \ /// ```typc let pl = plot(axes: (x_axis, y_axis), data: data) ```\ \ /// Last, we need to just call this function. In this case the width of the plot will be `100%` and the height will be `33%`. \ /// ```typc graph_plot(pl, (100%, 33%))``` \ \ /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` Two axes are required. The first one as the x-axis, the second as the y-axis. \ _Example:_ `(x_axis, y_axis)` /// - `data:` An array of `x` and `y` pairs. \ _Example:_ `((0, 0), (1, 2), (2, 4), …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - rounding (ratio): The rounding of the graph, 0% means sharp edges, 100% will make it as smooth as possible (Bézier) /// - stroke (none, auto, length, color, dictionary, stroke): How to stoke the graph. \ See: #link("https://typst.app/docs/reference/visualize/line/#parameters-stroke") /// - fill (color): The fill color for the graph. Can be used to display the area beneath the graph. /// - render_axes (boolean): If the axes should be visible or not /// - markings (none, string, content): how the data points should be shown: "square", "circle", "cross", otherwise manually specify any shape #let graph_plot(plot, size, caption: "Graph Plot", rounding: 0%, stroke: black, fill: none, render_axes: true, markings: "square") = { let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) let plot_code() = { let step_size_x = calc_step_size(100%, x_axis) let step_size_y = calc_step_size(100%, y_axis) // Places the data points let data = plot.data.map(((x,y)) => { if type(x) == "string" { x = x_axis.values.position(c => c == x) } if type(y) == "string" { y = y_axis.values.position(c => c == y) } ((x - x_axis.min) * step_size_x, -(y - y_axis.min) * step_size_y) }) let delta = () let rounding = rounding * -1 for i in range(data.len()) { let curr = data.at(i) let next let prev if i != data.len() - 1 { next = data.at(i + 1) } if i != 0 { prev = data.at(i - 1) } if i == 0 { delta.push((rounding * (next.at(0) - curr.at(0)), rounding * (next.at(1) - curr.at(1)))) } else if i == data.len() - 1 { delta.push((rounding * (curr.at(0) - prev.at(0)), rounding * (curr.at(1) - prev.at(1)))) } else { delta.push((rounding * .5 * (next.at(0) - prev.at(0)), rounding * .5 * (next.at(1) - prev.at(1)))) } } place(dx: 0pt, dy: 0pt, path(fill: fill, stroke: stroke, ..data.zip(delta))) for p in data { draw_marking(p, markings) } } prepare_plot(size, caption, plot_code, plot: plot, render_axis: render_axes) } /// This function will display a histogram based on the provided `plot` object. \ \ /// === How to create a simple histogram /// First, we need to define the data and the classes we want to map to the graph plot. In this case I will use some random sample data. \ The tricky part about this is, that this data gets represented in `classes`. These are necessary to combine the data the right way, so the bars height can be displayed correctly. \ Here, I will use the same class size every time but once. \ \ /// Let's create the data now: /// ```typc let data = ( /// 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, /// 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, 28000, /// 35000, 46000, 75000, 95000 /// ) ``` \ /// Now, we will define the classes. To do this we can use the `class_generator(start, end, amount)` and the `class(lower_lim, upper_lim) `function (_see `classify.typ`_) /// ```typc let classes = class_generator(10000, 50000, 4) /// classes.push(class(50000, 100000)) /// classes = classify(data, classes)``` /// This will result in creating the following classes: `(10000 - 20000, 20000 - 30000, 30000 - 40000, 40000 - 50000, 50000 - 100000)`. \ \ /// Next, we need to define both the x and the y-axis. The x-axis location can either be `"bottom"` or `"top"`. The y-axis location can either be `"left"` or `"right"`. You can customise the look of the axes with `axis` specific parameters (here: `show_markings: true` and `helper_lines: true`) /// ```typc let x_axis = axis(min: 0, max: 100000, step: 20000, location: "bottom", show_markings: false) /// let y_axis = axis(min: 0, max: 26, step: 3, location: "left", helper_lines: true)``` \ /// Now we need to create a `plot` object based on the axes and the data. \ /// ```typc let pl = plot(axes: (x_axis, y_axis), data: data) ``` \ \ /// Last, we just need to call this function. Here we render the histogram with a black outline around the bars, and a gray filling of the bars. \ /// ```typc histogram(pl, (100%, 20%), stroke: black, fill: gray) ``` \ \ /// /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` Two axes are required. The first one as the x-axis, the second as the y-axis. \ _Example:_ `(x_axis, y_axis)` /// - `data:` An array of `x` and `y` pairs. \ _Example:_ `((0, 0), (1, 2), (2, 4), …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - stroke (none, auto, length, color, dictionary, stroke, array): The stroke color of a bar or an `array` of colors, where every entry stands for the stroke color of one bar /// - fill (color, array): The fill color of a bar or an `array` of colors, where every entry stands for the fill color of one bar /// - render_axes (boolean): If the axes should be visible or not #let histogram(plot, size, caption: [Histogram], stroke: black, fill: gray, render_axes: true) = { // Get the relevant axes: let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) let plot_code() = { let step_size_x = calc_step_size(100%, x_axis) let step_size_y = calc_step_size(100%, y_axis) let array_stroke = type(stroke) == "array" let array_fill = type(fill) == "array" // Get count of values let val_count = 0 for data in plot.data { val_count += data.data.len() } // Find most common class size // count class occurances let bin_count = () for data in plot.data { let temp = data.upper_lim - data.lower_lim let found = false for (idx, entry) in bin_count.enumerate() { if temp == entry.at(1) { bin_count.at(idx).at(0) += 1 found = true break } } if not found { bin_count.push((1, temp)) } } // find most common one let common_class = bin_count.at(0) for value in bin_count { common_class = if value.at(0) > common_class.at(0) {value} else {common_class} } // get the size of the most common class common_class = common_class.at(1) // place the bars for (idx, data) in plot.data.enumerate() { let width = (data.upper_lim - data.lower_lim) * step_size_x let rel_H = (data.data.len() / val_count) let bin_width = (data.upper_lim - data.lower_lim) let height = (data.data.len() * (common_class / bin_width)) * step_size_y let dx = data.lower_lim * step_size_x place(dx: dx, dy: -height, rect(width: width, height: height, fill: if array_fill {fill.at(idx)} else {fill}, stroke: if array_stroke {stroke.at(idx)} else {stroke})) } } prepare_plot(size, caption, plot_code, plot: plot, render_axis: render_axes) } /// This function will display a pie chart based on the provided `plot` object. \ \ /// === How to create a simple pie chart /// This is the easiest diagram to create. First we need to specify the data. I will use random data here. \ /// ```typc let data = ((10, "Male"), (20, "Female"), (15, "Divers"), (2, "Other")) ``` \ \ /// Because no axes are required, we can skip this step and jump straight to creating the `plot`. /// ```typc let p = plot(data: data) ``` \ \ /// Last, we just need to call this function. I will call it with all styles available. /// ```typc pie_chart(p, (100%, 20%), display_style: "legend-inside-chart") /// pie_chart(p, (100%, 20%), display_style: "hor-chart-legend") /// pie_chart(p, (100%, 20%), display_style: "hor-legend-chart") /// pie_chart(p, (100%, 20%), display_style: "vert-chart-legend") /// pie_chart(p, (100%, 20%), display_style: "vert-legend-chart")``` \ /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` No axes are required. /// - `data:` An array of single values or an array of `(amount, value)` tuples. \ _Example:_ `((10, "Male"), (5, "Female"), (2, "Divers"), …)` or `("Male", "Male", "Male", "Female", "Female", "Divers", "Divers", …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - display_style (string): Changes the style of the pie chart. Available are: `"vert-chart-legend", "hor-chart-legend", "vert-legend-chart", "hor-legend-chart", "legend-inside-chart"`. /// - colors (array): The colors used in the pie chart. If not enough colors were specified, the colors get repeated. /// - offset (length): The distance from the center to the text in the pie chart (only relevant when using `"legend-inside-chart"`) #let pie_chart(plot, size, caption: [Pie chart], display_style: "hor-chart-legend", colors: (red, blue, green, yellow, purple, orange), offset: 50%) = { // get a point on a radius 1 circle //--- // x: travelled distance around circle let point(x) = ( calc.cos(x), calc.sin(x) ) // calculate the points needed on a bezier curve to gain an approximation of a circle //--- // radius: the radius of the circle // start_angle: the angle at which the circle starts (counting from right going clockwise) // length: the angle of the segment let segment(radius, start_angle, length) = { let details = 4 //number of details, 3 is minimum let points = ((0pt, 0pt),) let distance = (4 / 3) * calc.tan(length / details / 4) for i in range(0, details + 1) { let angle = length / details * i + start_angle let pnt = point(angle) let delta = point(angle - 90deg) points.push(( (pnt.at(0) * radius, pnt.at(1) * radius), (delta.at(0) * radius * distance, delta.at(1) * radius * distance) )) } points.at(-1).push((0pt, 0pt)) // fix end corner let temp = points.at(1).at(1) points.at(1).at(1) = (0pt, 0pt) points.at(1).push((-temp.at(0), -temp.at(1))) points.push((0pt, 0pt)) return points } let data = plot.data if not type(data.at(0)) == "array" { let new_data = ((0, data.at(0)),) for value in data { let found = false for (idx, existing) in new_data.enumerate() { if existing.at(1) == value { new_data.at(idx).at(0) += 1 found = true break } } if not found { new_data.push((1, value)) } } data = new_data } // The code rendering the plot let plot_code() = { set align(center + top) layout(size => { box(width: size.width, height: size.height) let total = data.map(a => a.at(0)).sum() let angle = 0deg let radius = min( size.width, if display_style.split("-").at(0) == "vert" {size.height - 30pt} else {size.height}) / 2 let pie = [] let legend = [] let dx = radius if display_style == "legend-inside-chart" { dx = 50% } for (i, data) in data.enumerate() { let fraction = data.at(0) / total * 360deg let points = segment(radius, angle, fraction) pie += place(dy: -radius, dx: dx, path(fill: colors.at(calc.rem(i, colors.len())), ..points)) if display_style == "legend-inside-chart" { let pnt = point(angle + fraction / 2) pie += place(dx: pnt.at(0) * radius * offset + dx, dy: pnt.at(1) * radius * offset - radius, box(width: 0pt, height: 0pt, align(center + horizon, box(fill: purple, str(data.at(1)))))) } else { legend += text(fill: colors.at(calc.rem(i, colors.len())), sym.hexa.filled) + sym.space.thin + str(data.at(1)) if i != plot.data.len() - 1 { legend += if "hor" in display_style { "\n" } else { sym.space.quad } } } angle += fraction } style(s =>{ let legend-size = measure(legend, s) if display_style == "vert-chart-legend" { place(dx: 50% - radius, dy: -30pt, pie) place(dx: 50% - legend-size.width / 2, dy: -20pt, legend) } else if display_style == "vert-legend-chart" { place(dx: 50% - legend-size.width / 2, dy: -(radius * 2) - 20pt, legend) place(dx: 50% - radius, dy: 0pt, pie) } else if display_style == "hor-chart-legend" { place(dx: 50% - radius - legend-size.width / 2, dy: 0pt, pie) place(dx: 50% + radius - legend-size.width / 2 + 10pt, dy: -radius, box(height: 0pt, align(horizon, legend))) } else if display_style == "hor-legend-chart" { place(dx: 50% - radius + legend-size.width / 2, dy: 0pt, pie) place(dx: 50% - radius - legend-size.width / 2 - 10pt, dy: -radius, box(height: 0pt, align(horizon, legend))) } else if display_style == "legend-inside-chart" { pie } else { panic(display_style + " is not a valid display_style") } }) }) } // Sets outline for a plot and defines width and height and executes the plot code prepare_plot(size, caption, plot_code) } /// This function will display a bar chart based on the provided `plot` object. \ \ /// === How to create a simple bar chart /// First we need to specify the data, we want to display. I will use some random data here.\ /// ```typc let data = ((20, 2), (30, 3), (16, 4), (40, 6), (5, 7))``` \ \ /// Next we need to create the axes. Keep in mind that, if you want to make the bars go from left to right, not bottom to top, you need to basically invert the x and y-axis creation. You can also customise the axes (here: `show_markings: true` and `helper_lines: true`). /// ```typc let x_axis = axis(min: 0, max: 9, step: 1, location: "bottom") /// let y_axis = axis(min: 0, max: 41, step: 10, location: "left", show_markings: true, helper_lines: true)``` /// When `rotated: true`, in other words the bars grow from left to right, the axis creation looks like this: /// ```typc let x_axis = axis(min: 0, max: 41, step: 10, location: "bottom", show_markings: true, helper_lines: true) /// let y_axis = axis(min: 0, max: 9, step: 1, location: "left")``` \ /// Now we need to create the `plot` object. \ /// ```typc let pl = plot(axes: (x_axis, y_axis), data: data)``` \ \ /// Last, we just call this function to display the chart. We specify fill colors for every single bar to make it easier to differenciate and we make the bars 30% smaller to create small gaps between bars close to each other. \ /// ```typc bar_chart(pl, (100%, 120pt), fill: (purple, blue, red, green, yellow), bar_width: 70%)``` \ \ /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` Two axes are required. The first one as the x-axis, the second as the y-axis. \ _Example:_ `(x_axis, y_axis)` /// - `data:` An array of single values or an array of `(amount, value)` tuples. \ _Example:_ `((10, "Male"), (5, "Female"), (2, "Divers"), …)` or `("Male", "Male", "Male", "Female", "Female", "Divers", "Divers", …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - stroke (none, auto, length, color, dictionary, stroke, array): The stroke color of a bar or an `array` of colors, where every entry stands for the stroke color of one bar /// - fill (color, array): The fill color of a bar or an `array` of colors, where every entry stands for the fill color of one bar /// - centered_bars (boolean): If the bars should be on the number its corresponding to /// - bar_width (ratio): how thick the bars should be in percent. (default: 100%) /// - rotated (boolean): If the bars should grow on the `x_axis` - this means the data gets mapped to the `y-axis`. Don't forget to create the axes accordingly. /// - render_axes (boolean): If the axes should be visible or not #let bar_chart(plot, size, caption: "Barchart", stroke: black, fill: gray, centered_bars: true, bar_width: 100%, rotated: false, render_axes: true) = { // Get the relevant axes: let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) let plot_code() = { // get step sizes let step_size_x = calc_step_size(100%, x_axis) let step_size_y = calc_step_size(100%, y_axis) // get correct data let data = transform_data_count(plot.data) let array_stroke = type(stroke) == "array" let array_fill = type(fill) == "array" // draw the bars if not rotated { for (idx, data_set) in data.enumerate() { let height = data_set.at(0) * step_size_y let x_data = data_set.at(1) if type(data_set.at(1)) == "string" { x_data = x_axis.values.position(c => c == x_data) } let x_pos = x_data * step_size_x - if centered_bars {step_size_x * bar_width / 2} else {0pt} place(dx: x_pos, dy: -height, rect(width: step_size_x * bar_width, height: height, fill: if array_fill {fill.at(idx)} else {fill}, stroke: if array_stroke {stroke.at(idx)} else {stroke})) } } else { for (idx, data_set) in data.enumerate() { let width = data_set.at(0) * step_size_x let y_data = data_set.at(1) if type(data_set.at(1)) == "string" { y_data = y_axis.values.position(c => c == y_data) } let y_pos = y_data * step_size_y + if centered_bars {step_size_y * bar_width / 2} else {0pt} place(dx:0pt, dy: -y_pos, rect(width: width, height: step_size_y * bar_width, fill: if array_fill {fill.at(idx)} else {fill}, stroke: if array_stroke {stroke.at(idx)} else {stroke})) } } } prepare_plot(size, caption, plot_code, plot: plot, render_axis: render_axes) } /// This function will display a graph plot based on the provided `plot` object. It functions like the _scatter plot_ but connects the dots with lines in a circular fashion. /// === How to create a simple radar plot /// First, we need to define the data we want to map to the graph plot. In this case I will use some random sample data. \ /// ```typc let data = ((0,6),(1,7),(2,5),(3,4),(4,4),(5,7),(6,6),(7,1),)``` \ \ /// Next, we need to define both the x and the y-axis. You can customise the look of the axes with `axis` specific parameters (here: `helper_lines: true`) /// ```typc let y_axis = axis(min:0, max: 8, location: "left", helper_lines: true) /// let x_axis = axis(min:0, max: 8, location: "bottom")``` /// Now we need to create a `plot` object based on the axes and the data. \ /// ```typc let pl = plot(data: data, axes: (x_axis, y_axis))```\ \ /// Last, we need to just call this function. In this case the width of the plot will be `100%` and the height will be `33%`. \ /// ```typc radar_chart(pl, (100%, 33%))``` \ \ /// - plot (plot): The format of the plot variables are as follows: \ /// - `axes:` Two axes are required. The first one as the x-axis, the second as the y-axis. \ _Example:_ `(x_axis, y_axis)` /// - `data:` An array of `x` and `y` pairs. \ _Example:_ `((0, 0), (1, 2), (2, 4), …)` /// - size (length, array): The size as array of `(width, height)` or as a single value for both `width` and `height` /// - caption (content): The name of the figure /// - stroke (none, auto, length, color, dictionary, stroke): The stroke color of the graph /// - fill (color): The fill color for the graph. Can be used to display the area beneath the graph. /// - render_axes (boolean): If the axes should be visible or not /// - markings (none, string, content): how the data points should be shown: "square", "circle", "cross", otherwise manually specify any shape /// - scaling (ratio): how much the actual plot should be smaller to account for axis namings #let radar_chart(plot, size, caption: "Radar Chart", stroke: black, fill: none, render_axes: true, markings: "square", scaling: 95%) = { let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) let plot_code() = { let data = plot.data.map(((x,y)) => { if type(x) == "string" { x = x_axis.values.position(c => c == x) } if type(y) == "string" { y = y_axis.values.position(c => c == y) } (x,y) }) place(dy: -50%, dx: 50%, box(height: scaling, width: scaling, { layout(size => { let radius = min(size.width, size.height)/2 place( { let last = plot.data.at(-1) let x_size = x_axis.values.len() let y_size = y_axis.values.len() let step_size = radius / y_size let translate(x,y) = { (calc.sin(360deg/x_size * x) * y * step_size, -calc.cos(360deg/x_size * x) * y * step_size) } place(box(height: 50%, width: 0pt, draw_axis(y_axis)), dy: -50%) for x in range(1,x_size) { place(line(angle: 360deg/x_size * x -90deg, length: radius)) } if x_axis.show_values { for i in range(0, x_size) { let (x,y) = translate(i, y_size) place(dx: x / float(scaling), dy: y / float(scaling), box(width: 0pt, height: 0pt, align(center + horizon, text(str(x_axis.values.at(i)), fill: x_axis.value_color)))) } } for y in range(1, y_size) { let points = () for x in range(x_size) { points += (translate(x,y),) if(y_axis.show_markings) { place(line(start: points.at(-1), angle: 360deg/x_size*x, length: y_axis.marking_length)) place(line(start: points.at(-1), angle: 360deg/x_size*x, length: -y_axis.marking_length)) } } if(y_axis.helper_lines) { place(path(..points, closed: true, stroke: (paint: y_axis.helper_line_color, dash: y_axis.helper_line_style))) } } let points = () for p in data { let (x,y) = translate(p.at(0)/x_axis.step, p.at(1)/y_axis.step) points += ((x,y),) draw_marking((x,y), markings) } place(path(..points, closed: true, stroke: stroke, fill: fill)) }) }) })) } prepare_plot(size, caption, plot_code, plot: plot, render_axis: false) } /// This function will display a boxplot based on the provided `plot` object. #let box_plot(plot, size, caption: "Box plot", stroke: black, fill: none, whisker_stroke: black, box_width: 100%, pre_calculated: true, render_axes: true) = { // Get the relevant axes: let x_axis = plot.axes.at(0) let y_axis = plot.axes.at(1) let plot_code() = { // get step sizes let step_size_x = calc_step_size(100%, x_axis) let step_size_y = calc_step_size(100%, y_axis) // only data containing (minimum, first_quartile, median, third_quartile, maximum) // get correct data let calc_data = plot.data.map(dataset => transform_data_full(dataset).sorted()) let data = calc_data.map(dataset => ( dataset.at(0), if calc.rem(dataset.len() * 0.25, 1) != 0 { dataset.at(int(dataset.len() * 0.25))} else { (dataset.at(int(dataset.len() * 0.25) - 1) + dataset.at(int(dataset.len() * 0.25))) / 2}, if calc.rem(dataset.len() * 0.25, 1) != 0 { dataset.at(int(dataset.len() * 0.5))} else { (dataset.at(int(dataset.len() * 0.5) - 1) + dataset.at(int(dataset.len() * 0.5))) / 2}, if calc.rem(dataset.len() * 0.25, 1) != 0 { dataset.at(int(dataset.len() * 0.75))} else { (dataset.at(int(dataset.len() * 0.75) - 1) + dataset.at(int(dataset.len() * 0.75))) / 2}, dataset.at(dataset.len() - 1) )) data = if pre_calculated {plot.data} else {data} // let data = transform_data_count(plot.data) let array_stroke = type(stroke) == "array" let array_fill = type(fill) == "array" // draw the boxes data = if type(data.at(0)) == "array" { data } else { (data,) } for (idx, data_set) in data.enumerate() { let q(i) = (data_set.at(i) - y_axis.min) * step_size_y let x_data = data_set.at(5, default: idx + 1) if type(x_data) == "string" { x_data = x_axis.values.position(c => c == x_data) } let box_width = step_size_x * box_width let whisk_width = box_width * 50% let x_pos = x_data * step_size_x - box_width / 2 place(dx: x_pos, dy: -q(3), rect(width: box_width, height: q(3) - q(1), fill: if array_fill {fill.at(idx)} else {fill}, stroke: if array_stroke {stroke.at(idx)} else {stroke})) place(dx: x_pos, dy: -q(2), line(length: box_width)) place(dx: x_pos + (box_width - whisk_width) * .5, dy: -q(0), line(length: whisk_width)) place(dx: x_pos + box_width * .5, dy: -q(0), line(end: (0pt, q(0)-q(1)), stroke: whisker_stroke)) place(dx: x_pos + (box_width - whisk_width) * .5, dy: -q(4), line(length: whisk_width)) place(dx: x_pos + box_width * .5, dy: -q(3), line(end: (0pt, q(3)-q(4)), stroke: whisker_stroke)) } } prepare_plot(size, caption, plot_code, plot: plot, render_axis: render_axes) }
https://github.com/lphoogenboom/typstThesisDCSC
https://raw.githubusercontent.com/lphoogenboom/typstThesisDCSC/master/main.typ
typst
#import "typFiles/coverpage.typ": * #import "typFiles/titlepage.typ": * #import "typFiles/acronyms.typ": acrof, acro #import "typFiles/glossary.typ": * #set outline( indent: 1em ) #show: coverpage.with() #show: titlepage.with( title: "Thesis Title", subtitle: "Optional Subtitle", studentName: "<NAME>", coverIMG: "../graphics/template/COVER.jpg", ) #include "chapters/abstract.typ" #include "chapters/tableOfContents.typ" #include "chapters/preface.typ" #include "chapters/acknowledgements.typ" #counter(page).update(1) #set page(numbering: "1") #set heading(numbering: "1-1") #include "chapters/introduction.typ" #include "chapters/firstRealChapter.typ" #include "chapters/someBasics.typ" #show: glossary()
https://github.com/mrtz-j/typst-thesis-template
https://raw.githubusercontent.com/mrtz-j/typst-thesis-template/main/template/chapters/global.typ
typst
MIT License
// // About modern-uit-thesis: // // NOTE: // following is an (indirect) import of the 'lib.typ' file // The file lib.typ (and others) will be downloaded and cached // by your system. The location of the @preview cache directory // is explained in // https://github.com/typst/packages?tab=readme-ov-file#downloads // e.g. %APPDATA% on Windows on Windows // ~/.local/share or $XDG_DATA_HOME on Linux // ~/Library/Application Support on macOS // // NOTE: // If you like to modify "lib.typ", copy the file from the cache directory // or get it from the 'official' Typst Universe package git repo // (i.e. from proper 'version number subdir' of // https://github.com/typst/packages/tree/main/packages/preview/modern-uit-thesis) // Copy the lib.typ to a (sub)folder of this project and // set the path accordingly. #import "../../lib.typ": * // // Other packages used: // #import "@preview/glossarium:0.5.0": make-glossary, print-glossary, gls, glspl #import "@preview/codly:1.0.0": *
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/050%20-%20Phyrexia%3A%20All%20Will%20Be%20One/010_Alone.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Alone", set_name: "Phyrexia: All Will Be One", story_date: datetime(day: 17, month: 01, year: 2023), author: "<NAME>", doc ) #strong[?????????] A little crab walked over Teferi's hand. The waves—what did he say? #emph["I think our time is up," Urza said, pointing into a void above Teferi's head. "I can see something out there."] The Destroyer of Dominaria talking with the Destroyer of Zhalfir—always in that goat's shadow, old man. Wonder what he saw out there. Get up. Get off the beach. Forget it. Blink, and it's gone. This is probably the second time you died, but anyway, you're back now—what are you going to do about it? There is a war coming. What are you going to do about it? #figure(image("010_Alone/01.jpg", width: 100%), caption: [Art by: Chase Stone], supplement: none, numbering: none) Naked, alone, Teferi walked inland from the beach. The day was mild and warm. The sun shone through a low bank of clouds or fog on the horizon—hazy, gold, diffused. The memory of a sun, how Teferi saw the light in his dreams. Teferi paused where the sand gave way to tough coastal grass and the leading edges of a dune forest. The wind was steady off the water. Fine grains of sand brushed his ankles. There was a stone arch here, red stone from somewhere else, blasted by grains of sand dragged daily across it for untold time. Regular depressions in the arch's surface may once have been writing, language, a marker of where he was, but were too worn now to say anything. Beyond was a well-traveled trail, marked by standing columns and the root nubs of others that had toppled. Teferi leaned against the stone arch, catching his breath. Pain flooded in where moments ago there had only been pleasant nothing. Breathing hurt. His lungs felt tight, banded, like he'd just finished running for miles. His body ached. From core to extremity, he felt wrung, like a wet rag twisted dry. What did he know? Teferi's thoughts raced as he took inventory. You're no longer connected to Kaya. You're whole, not a spirit anymore, which means something happened on their end to make you wind up like this on your end. Wasn't planned, wasn't accounted for: not good. Try to get back. Teferi reached out, reached #emph[in] , summoned up the familiar movement of a planeswalk and found nothing. A limp twitch, the spasm of a numb limb. He squatted down, turned, and sat. A wave of panic, nausea. He rested his head against the archway and stared out to sea, squinting to see through the day's light and glittering water. A haze clung to the horizon. The waves were gentle, crumbling instead of crashing, rolling up the beach where shorebirds and crabs scuttled, dancing, hunter and prey. Distant, Teferi thought. Beautiful, like nothing at all. He watched the light over the ocean. He reached out to an imagined sun and willed it to plunge below the hidden horizon, for day to slip effortlessly into night. Time did not respond to his will. He dropped his hand back into his lap. "That's it," Teferi said aloud, speaking to the wind, the birds, and the crabs. "They win." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Night fell. Teferi slept. The cicadas' calls were buzzsaws, nightmares. He dreamed things he won't remember but will carry with him when he wakes up: Kroog. A field of mud scarred with trenches, a pox-marked face leering up from Dominaria's darkest history, crater lips wet with fresh and rotting and reanimated dead, wires running under its skin. Argoth, burning, streaked in oil, elves and humans crushed under the feet of metal beasts, whose buzzsaws rattled his molars, who were just the cicadas outside of his dreaming. Things he will remember when he wakes: The cold pressure when the Phyrexian stabbed him. The dark halls of Urza's Tower under siege reminded him of the halls of Tolaria all those years ago, fire-lit, chorused with agonies. What hurts the most: Subira doesn't wander anymore; he does that now. See you on the road sometime, Subi. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) A cold fog rolled in off the sea, prickling Teferi's skin to gooseflesh. He woke to see the tide had come in, and where the waves had crumbled, they now crashed, silver-blue dark under the moonlight. Teferi picked himself up. There were no moons. Nevertheless, pale blue light illuminated the landscape, hard-edged. Odd, but he needed to move. Head somewhere inland, warmer. Follow the tracks. Where there's people there's hope—people must eat, must sleep, must laugh. Must have a spare set of clothes as well, he thought, as he hugged himself against the cold. He rubbed his arms to build some heat and followed the path inland. The dune forest protected him from the worst of the wind, and the farther he walked, the warmer the night grew, the more still the air. The rich odor of rotting wood, tidal wetland, life, and death. Teferi emerged from the dune forest into a scrubland dominated by low, wide-canopied trees. Insects and the wind filled the night, a sound so droning that it may as well have been silence. By the hazy, non-moonlight, he could see the landscape rolling away into the far distance, dark features breaking the horizon into a lumpen border—mountains, low and old, many miles away. The path continued here, more defined. The pale sand shone like a beacon under the moonlight, a ribbon that stretched for a dozen yards into the grassland before giving way to a packed-earth path, rutted with light cart tracks, dry veins further eroded by the rain. Teferi crouched down and reached out to the sand. He hovered a hand over an old footprint and, with a slow, looping gesture, reached into time, pulling history from the dust. People came here, once. The beach beyond the dune forest used to be a happy place, where families would spend long afternoons relaxing in and near the gentle surf. Children would run screaming with joy down this path, jumping as they passed under the red archway, hoping to grow tall enough one day to slap the keystone at its zenith. Parents followed, hauling hand carts or soft knit bags filled with the day's supplies: dried and cold provisions, water, blankets, written stories, baskets in case they found mussels or caught small fish, coins to haggle with the vendors that patrolled the shore. Teferi closed his eyes. With his other hand, he described a larger loop. Casting the net wider, back to the breakers and the water's edge. Visions came to him like memory, like dreams. Long, wide-bellied, brightly painted fishing boats once lined the beach. By the afternoon, most of the sailors would have returned with their catches and made their way to the markets farther inland. Some would lounge on the beach with their lovers and friends, others might stay behind, chipping barnacles or painting fresh color onto the curved hulls of their boats. Huge nets fluttered from drying towers. Some of the laborers and sailors slept the long day off here, in the shade under their belly-up vessels, under the soft rain and heady ocean scent of their drying nets. Another rotation. Bring the past closer. Fewer families came here. Those that did walked together, close together, and some of the parents wore old weapons—daggers, staffs of hard wood capped in iron. The boats did not have any barnacles on them, and their paint was sun-bleached. It had been some time since any sailors had taken them out to sea; the older hulls were beginning to crack. The nets, hung to dry, had whitened, stiffened, grown brittle. The sailors didn't take their nets out anymore because they didn't need them. The sailors' fear was the same as the parents' fear, and it was Teferi's fear, the same that wriggled around at the base of his skull, that inner voice that whispered: be afraid of the sea. Be afraid of the night. Be afraid of what you can't see. Another rotation. Closer. Fear. The buzzing of insects in the present blended with the crashing of waves back then and the horrible sound of screams high on the sea-borne gale. Cataclysm. The ground shook under the stampede. The ground reached up, lurching, moving. Another. Empty. Rain washed over waves that beat against the flanks of the dunes. Another. The beach returned. The water was still as glass. A gentle wind tousled the dune grass, and then died. Another. At the far end of the path, at the edge of where Teferi's recall failed and the darkness became absolute, a finger of mist probed forward. It curled, then faded, plucked by an unfelt wind. The path had a heartbeat of its own, once: the footfalls of people bound for the sea and those returning home. Wrenn would have called it a song, Teferi thought. He stood and closed his spell. The stink of chronomancy faded. Teferi looked behind him. The path, too, was a body. A dead body he knew, stretching toward a distant horizon, beyond which there was nothing. A void, empyrean, severed from time and everything else. Zhalfir. Nearly four hundred years later, he was back in Zhalfir. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Zhalfir] Miles inland, the simple path Teferi followed joined with a broad, cobblestone road, running horizon to horizon, parallel to the coast. Without the sea breeze, the night clung to the day's heat. Tall grass lined the road, and the calls of insects drowned out thought. Teferi, with little direction, turned to the left and started walking. Hours later as dawn approached, the clattering of carts and hooves woke him. Teferi had settled just off the road to sleep; he could not now. Aching, he moved closer, using the thick brush for cover, and watched as a caravan trundled past. It was a long train of ten wagons each pulled by a gang of docile beasts—oxen or buffalo. Caravanners rode atop the wagons on shaded benches and wore light, layered clothing, cloaks in earthy tones of green and red. Their demeanor was calm, if tired—many held steaming mugs of coffee or some other hot drink. Teferi guessed them to be the day shift, having risen within the hour to take over from their compatriots who now slept in the tall, canvas-covered carts among the boxes and sacks of goods they transported. He waited, watching the lead carts roll by, taking measure of the armored guards that rode in the rear, some asleep sitting up, lashed to the support beams of their wagon so they did not tumble out. These guards were not the akinji that Teferi remembered—their armor was not uniform, their weapons were plain iron, and they wore undyed cloaks. Likely road-bound mercenaries hired cheaply by the caravanners. Teferi's stomach growled. He was shaking, he realized. Hungry, tired, thirsty, lost—he was alone. He needed help, he needed to risk trust. Teferi let another wagon pass, and then stepped out onto the road. "Hello," Teferi called to the approaching caravanner. He raised a hand and waved. The approaching caravanner screamed, waking her co-pilot with a start. He jumped, flailing his arms, knocking his companion's coffee into the air. The oxen hauling the cart were unfazed, happy to come to a stop. The lead bull snorted, swung its head to look at Teferi, and blinked. The commotion brought the caravan to a halt. Shouts, cries of "halt!" and "attack!" rang out up and down the line of wagons, and with a great cacophony, the guards spilled out of their posts, some tangling themselves in their sleeping lines, most moving with enough speed that they had Teferi surrounded and at spearpoint within the minute. "Who are you, naked man?" One of the guards shouted. She was a hoarse-voiced woman around Teferi's age in used but well-maintained armor. A fur collar over a repaired royal blue cloak marked her as once being a member of a warband. Likely the leader of this party, then. Like the rest of her guards, she held her spear aimed at Teferi's chest. "A traveler," Teferi said. "I was attacked by bandits," Teferi lied. "Two days ago, near the coast. They took my clothing and my food and left me for dead. Please—if you have anything you can spare." The guard leader relaxed. "Bandits," she said, waving for her compatriots to stand down. "Someone find him a cloak. Near the coast? Then don't worry, traveler—they won't trouble you anymore. We dealt with that clutch of traitors just last night." "You did?" Teferi asked. He hid his surprise well. One of the guards passed him a spare cloak. Teferi pulled it on, taking a moment to look over the guards. Many wore bandages around their limbs, sides, and heads. It had been a rough fight. "They're getting bold now," the guard leader grimaced. "People can't live under a hanging sword—they get angry. Hungry. No stomach for sacrifice." "Times are hard," Teferi agreed. No stomach for sacrifice? How long had it really been for them, he wondered—moments, or years? The leader looked down, firm, considering her next words. "We didn't find any of your party alive," she said. Direct, matter of fact. "Their bodies are in the last cart—we're taking them back to Kiingal. You can come with us and speak for them." The guard leader nodded. The decision made, she clipped a short, sharp whistle: back to work. As the caravan got underway, she started walking and motioned for Teferi to follow. Teferi fell in line, holding his cloak closed. The dawn had fully broken now, and the day's heat rose with the sun. "You look familiar," the guard leader said. "I am Eshe. Where are you from? What is your name?" "Sefu," Teferi lied again. "I'm from Kipamu. I have one of those faces," Teferi said, smiling. "It makes me a good trader—everyone trusts their friend." "Indeed." Eshe and Teferi walked in silence, keeping a steady, comfortable pace alongside the large, rolling carts. "You haven't asked about the dead." "The dead?" "Your comrades," Eshe said. "How many of them were there, again?" #emph[Damn.] Teferi couldn't turn and check, the cart was too far back. Instead, working quickly, he channeled a subtle spell and pulled the answer from Eshe's memory. He was never the best at scrying. Among the old guard of the Gatewatch, mind-reading was Jace's purview. Opening the realm of inner selves as one does an encyclopedia—it made Teferi uncomfortable to plunge into that private place, to risk plucking the wrong strand and unraveling the puzzle box that was the human mind. Moreover, he found it wrong, an invasion—but there was a need, he was desperate, and time was against them all. A slight ringing in his ear. The acrid stink of burning grass. A single scream, cut short by a leaf-blade spear. "Ten," Teferi said, the memory fading. "Ten dead?" Eshe shook her head. "A tragedy. But don't worry," she said. "We will take good care of you." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The caravan halted that next morning, a day out from Kiingal. "Line up, line up," the guards called, urging the caravanners to form ranks at the side of the road. "Hurry, there might be bandits," they cried, admonishing the bleary-eyed traders. Teferi lined up with the caravanners, swaying a little as he tried to stand at the attention the guards demanded. It had been a fitful night of sleep, even after his nightmares passed. He yawned, responding to the caravanner at his side, who trembled with the strength of her own yawn. "This a normal morning?" Teferi asked the caravanner. "No," she said. She shook, not from the cold, as it was a warm morning, but fear. "Do not trust these bandits," she said, whispering, speaking quickly. "They killed our guards and took their place, they plan to sell our goods to—" "Quiet," Eshe hissed. The caravanner started, surprised. Eshe looked between the two of them. Teferi met Eshe's stare, and in that moment understood. She looked at him with pure hatred, with recognition. She knew who he was. "Back in line Sefu," Eshe said to Teferi. "Not another move." Teferi nodded and stood in line. What happened next was not yet written; there could be a way out of this that was not just a collision. He stayed silent and waited. The guards stood across from the caravanners, outnumbered but armed and armored, waiting for Eshe to finish her slow review of their prisoners. She walked with stiff precision. "Listen to me," Eshe said, as she reached the end of the line. Her voice carried over the lonely stretch of road, rising above the morning's drone of insects, clear and bright. "You have been patient with us. Kind to us despite how we have treated you. Now, I am asking for one more act of charity: among you, there is a snake." The caravanners risked worried glances between each other. "Zhalfir is at war," Eshe continued. She turned and started, slowly, pacing back down the line of assembled caravanners. "We have been at war for generations. First, it was the Mirage War, then the Keldon War, and now this long wait. Preparation for the Phyrexian War, the defense of Dominaria against Yawgmoth's hordes. Our fields, our cities, our lands, our people—bent to war, for generations." Eshe stopped next to one of the caravanners. Without looking, she pointed at them. "You," she said. "How many of your family have you lost?" "Three during the Mirage War," the caravanner said, stammering to croak the words from her fear-dried throat. "My mother, my grandmother, and my grandfather." "And you?" Eshe pointed to the next caravanner. "Two, when the Keldons attacked," they said. "My husband and my brother." "You?" "My brother, my sister, and both of my daughters to Kaervek's armies in the Mirage War. And I was wounded at Tefemburu." #figure(image("010_Alone/02.jpg", width: 100%), caption: [Art by: Daarken], supplement: none, numbering: none) Eshe nodded. She reached out to this last caravanner, overcome for a moment. Resting her forehead against his, she whispered something quiet and private to him. Then, she kissed his forehead and stepped away. She looked to her bandit comrades, pointed to them, and then back to the caravanners. "Every one of us here is linked in grief," Eshe said. "We are brothers and sisters and siblings in loss, hunger, and fear." Teferi looked down at the red earth beneath his bare feet. No tears. They were not his to cry. "Zhalfir alone, us alone, stopped every blade aimed at us." Eshe's voice shook with emotion. "No matter how many dead, no matter how fearsome the enemy." Silence. Eshe tapped the base of her spear against the packed dirt of the road, a rhythm meant to calm, meant to steady unquiet hearts. She walked the few more steps necessary to bring her to Teferi. "Alone," Eshe said. All other sound seemed to have fled the warm morning. "One of us here did not suffer that pain. He slipped away. But he has returned," she said. Eshe raised an arm, pointing at Teferi. "Here is Teferi, the snake." The caravanners and guards both broke out into a commotion, shouting and gasping at the revelation. All order was forgotten as caravanners stepped away from Teferi and guards stepped toward, drawing their weapons. Some of the caravanners stalked toward him as well, balling their fists. Teferi did not resist as they grabbed him, he simply held his hands up. "Eshe, please." "No," Eshe said. She lifted her spear, coiled her strength, and thrust for his heart. "Stop," Teferi said, and time obliged. He sighed. Carefully, he untangled himself from the time-locked caravanners who restrained him, then crouched down, exhausted. He sat. "I didn't sleep well last night," Teferi muttered. "Eshe, can you hear me?" He asked. He looked up at Eshe, who was not quite frozen, but moving almost imperceptibly slow, still trapped in her thrust. She did not acknowledge him. A low moan rumbled from her throat—her killing cry, slowed. "Right." Teferi gestured, waving a finger in a lazy arc. Eshe's stab sped up, and Teferi could hear her cry pitching toward normal. Confusion started to bloom across her face as her eyes finally told her mind that Teferi had vanished. "Down here," he said. Eshe heard him minutes later. Confusion was turning to anger, but now she was looking at him. Teferi watched her struggle against slowed time, trying to turn the guard on her spear, trying to bring its blade down in an ugly but functional chop. "I loved a caravanner once," Teferi said. "Her name was Subira. She, like you, thought I was a murderer when she met me. An idiot. She thought many things about me. But she gave me charity. She listened to me," Teferi said. He looked up, not to Eshe but to the sky, blinking back tears. "She listened when I did not deserve to be listened to. We loved each other, and we made a family together." He wiped the tears away. "She didn't lose anyone when I sent Zhalfir away. She grew up on the road, as her family had for generations—Zhalfir was only a story to her. " He winced. What he would say next hurt, but he needed to hear himself say it. "I think," Teferi said, the words thick and cold in his mouth, "that I let her love absolve me of the great pain I caused you. The pain I caused Zhalfir, our home. Subira accepted me, which took a great deal of grace. But her accepting me, loving me—" Teferi shook his head. "Love like that saves a soul, but it doesn't heal this." Teferi plunged his fingers into the red earth, pulled two handfuls up, and let it spill between his fingers. The color painted his palms, dug under his nails. It would never leave. "She passed before I could find a way to fix this." Eshe's spear finally turned, edge on. It was a foot or more away, and Teferi could stop it without so much as a gesture; he was in no danger, but still Eshe fought. He wiped his palms on his donated robe, then reached up and grabbed the spear's blade. "I cannot be forgiven," Teferi said. "I can only do what is right." He squeezed the blade, letting it cut his palm. His blood, bright red, ran down his arm, fell from his elbow, and mingled with the dirt. Zhalfir in him, and he in Zhalfir, and the pain the cost. "I loved her as I loved this land," he said. "And I will see Zhalfir safe through what comes next. This is my promise. That is how I fix this." Could Eshe hear the pain in his voice? Trapped in that moment trying to kill the Destroyer of Zhalfir, a desperate man from the future telling her that her war would not end here. The echo of his own recent experience with Urza was not lost on him; he wondered if those dark shapes outside of the little lake they had swum in were looking in now. If they were turning their vast and unfathomable minds to this moment. If they were going to break in here, too, and send him somewhere else. Later, Teferi thought. Phyrexia, again, first. "Eshe, I am going to stop this spell," Teferi said. "But I need you to promise you will let me go." Being known to Zhalfir was unavoidable now. All Teferi could do was buy himself time before greater authorities came searching for him; this party may have been composed of bandits and their prisoners, but bringing news of his arrival would likely cause a storm that would erase their transgressions—or cause enough turmoil that they could escape in the clamor. Eshe's moan continued. Teferi released the spear and stood, checking his cut palm. He stepped a few paces back from where he had been standing, away from the caravanners that had restrained him and well outside of the range of Eshe's spear. He raised his hands, summoning up a fearsome blue light, a raw channel of mana that rankled the nose and set even the hairs on the back of his neck on end—this was the bared fang, the crackling core of a fire, something deep and primal not tied to any art but raw, searing power. A demonstration, just in case. Teferi let time resume its normal course. Eshe finished her cry, turning from anger to anguish. She stumbled backward, lifting her spearpoint from him. Teferi shook the bluing power from his hands, sending it back into the land. "Eshe, thank you." "Go away," Eshe said. Sweat slicked her dark skin, and she heaved from the effort of fighting against his magic. She worked to catch her breath, and her arms trembled. Teferi raised his hands, palms open to her. Eshe did not flinch, but many of the caravanners and guards scurried away, taking cover behind the wagons. "There is nothing more you can say to us," Eshe said. "Just go away." Teferi nodded. He stood, slowly, and started backing away. Eshe did not look at him. She stared at the ground where he had sat, at the disturbed earth where he had pulled handfuls of soil. Teferi went away, hurrying down the road, alone. After a long while, Eshe and her caravan departed in the opposite direction, together. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Elsewhere] Teferi slept and dreamed. There is a great chain of happening, first forged in fires long distant and dead. All things are linked to this chain and travel along it, but they travel backward, only able to see the chain that was and not how it will be. Teferi recalled he tried to explain this to Urza in their moment away, but articulating reality was difficult. Maybe he could have summed it all up better before he gave up his spark for the first time. Most beings in this great heaving mass of sentient creatures across time and the Multiverse never have the luxury of revelation or witness, much less the chance to grab history itself and bend it to their will; Teferi had given up his spark and then restored it—the power he held might as well be godlike. Time was his, alone. Anyway, this chain was made by many hands, and a rare few find themselves at the right moment of history to stamp their mark. The further back one goes down the chain, the more faded these marks become. The inverse, then, is true: the closer to the raw edge of the chain, the clearer the maker's mark is. The signatures of those who have forged a link, spliced a connection, or forced a diversion, all glow, cooling as if set in iron. Teferi, dreaming, looked down at the chain rattling through his core. No pain at all, just an infinite line, stretching down, down, down into the darkness of the past, each link stamped with his name. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Zhalfir, Months Later] The river water was cool and clear, carrying a welcome chill down from the Little Teremko Mountains. Even as the light dimmed, the vast plane clung to the day's heat. Teferi worked, stripped to the waist, wading through the river at the middle point of a long line of other laborers, trousers rolled up above their knees, hauling together a finely meshed net across the breadth of the river's long and shallow inner bend. Beyond the last fisher, the riverbed dipped, plunging deep as it reached the opposite bank where the current carved steadily away at the sandy loam. This was their final net, the last of the day. Minutes and hours mingled together. All moments were one: the gurgling water around his legs was the distant rumble of the mighty river. The gentle current was the coarse rope in his hands. Hauled in tempo with the simple song the others sang, then added his voice. The song from his lips was the air from the lungs of his comrades who also pulled the coarse rope, who kept their backs to the gentle current, who, too, heard the distant rumbling river and its soft gurgling. Labor, shared, time, shared. Beauty at the river, this simple work, this laboring of many arms pulling, many throats singing, many hands on this net crafted by deft-fingered artisans years before, hauling to catch fat silver fish from the cold clear river. Hope in the hands that pulled the fibers, the deft fingers that stitched, the sun-dark arms that pulled hope across time. One net that wrapped hundreds of lives in one unbroken length of time and labor to produce, at the end of it all, life. "Shaper," the laborer to his side called out to him. All up and down the line, under the song, little conversations carried on. Like the river, the song contained eddies and whorls. "When the war comes, will you march with the warclans, or will you stay here in the village?" "I would stay," Teferi said. He grunted and worked with his section to haul in the net, hand over hand. "But I serve at the pleasure of the queen. Where she says, I go." "You live like these fish," the laborer said. "I will join the akinji along with my sisters when the war comes." Teferi looked over to her. She was young and wore painted shoulders for strength. What she learned in this labor would guide her spear, draw her bow. "How many sisters do you have?" "Three," the laborer said. "Neema, Kani, and Amana." "And your name?" "Oyana. And I know who you are," Oyana said. "You are quiet, but you do not have to speak to be known. You should speak more." Teferi smiled. It was kind of her to suggest he speak more, but he felt he had spoken enough. Keeping quiet was prudent and penitent. "The others said you came to our village to hide," Oyana said. "Kani told me that that you were spit on and cursed when you went to the city. I cannot imagine the beautiful people there doing that, but Kani also says the beautiful people of the city speak with their mouths closed." Teferi grunted. He never noticed that. "My sister Neema was already in General Mageta's service when the queen called for them to prepare. Kani, Amana, and I would have had to remain here, doing this," she hauled her section of net. "Now all of us are old enough to fight, and this work has made me strong." Oyana stood and flexed. "When we return, I'll be at the front, and I'll show all of Dominaria who we are and who they are." Teferi bent to pull the next length, working to reel the net in. "Zhalfir is ready," Oyana said. Now she spoke with a firm voice, drawing the attention of the other laborers around them. "I am ready. My sisters and brothers are ready. The Phyrexians cannot stand against us." The other laborers muttered their agreement, rumbling, rising with the sound of the river. "So you have nothing to be quiet about," Oyana said to the Shaper. "You are the father of Zhalfir. Our creeds were shaped by you. Our land was moved by you. Speak with your mouth open, Teferi." Teferi grabbed up the next length of netting and said nothing. He worked, conscious of Oyana's eyes on him, of the eyes of all the laborers on him, of the setting sun and the water about his legs turning from cool to cold. He could feel the anger simmering through some of the laborers' gazes, but more were curious, staring at him the way one would stare at a rare, majestic, dangerous creature. "What was that?" Oyana asked. Though the other laborers had gone back to their diligent work, Oyana had not. She had watched Teferi, waiting for him to respond. He wasn't sure if her question was because she had heard him, or if his voice—so long quiet—had been lost under the river. "No one is ready," Teferi repeated himself. "No one can stop them. Not even the brave." Oyana stepped back. She frowned, looked Teferi up and down, and shook her head. She moved away. Teferi returned to his work. Downstream, where the catch danced and leaped, the river bent, taking with it the tall grasses and broad trees, the land and the horizon. Distant mountains caught the setting sun's light, ridges flaring bright in defiance of the end of the day, folds already dark as the approaching night. The clouds above streaked the sky in rich, warm tones of summer. High summer, no ceiling above the plane. And beyond the sky, a blankness. A blindness, empyrean, that hid them all from the terrors beyond. Looking up, Teferi could only just see that void behind the sky, as if it were bare stone visible under a thin layer of paint—the work of obscuring it not yet complete. He smiled. Teferi was home. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Teferi and the fishers returned to the village at twilight, the long net rolled and carried on their shoulders like the corpse of a great snake. They carried their catch with them and torches to light the way. There was little conversation—at nightfall, the day's labors caught up to them, and all minds were on food, a return to their families, and rest. The village blended into the earth, an orderly arrangement of clay-brick homes and long, low community buildings with living roofs. Granaries, kilns, smokehouses, cold forges, tanneries, public stables—this was a hub for the farmers, fishers, hunters, and foragers that lived in the region, and was itself a satellite of the city a dozen miles to the west. A small, squat, domed temple was the only building that stood out from the rest: the creedhall. Unlike the other buildings and homes that blended into the grassland, the creedhall wanted to be seen. It occupied a central location in the village, a humble temple to the five creeds of magic, a faith and philosophy that guided Zhalfir, and a place for members of any creed to rest while crossing Zhalfir. #figure(image("010_Alone/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Teferi ducked into the building, taking a moment to wash his feet in the tiled trough at the creedhall's entrance. A simple screen separated the inner domed space from the entryway, a baffle to dim any light and muffle any sound that might filter in from outside. Teferi breathed in the rich, faintly sweet incense that drifted out. Zhalfirin wellwood, smoldering in the mana well at the creedhall's center. He closed his eyes. A moment of reverence, of an ache mollified, of chambers of his lungs and his heart filling once more after being empty so long that he forgot they could be filled. He dried his feet. Stepped around the entry screen and into the main chamber. The room under the dome was a pentagon, each face representing one of the five colors of magic. Opposite the entry was a dark wall with a simple door set into it; beyond were humble quarters kept ready for members of the creeds. A low bench ringed in the room, set back from the central feature: a shallow, broad, stone bowl that held a modest bed of smoldering wellwood coals. That dim heat was the only light in this space which, under the dome, felt vast, far larger than the exterior of the mana well suggested. Teferi moved quietly and slowly, walking to his station just left of the entryway. There he paused before the arc of the Shaper Creed, knelt to grab the edge of the bowl, and pressed his forehead to it. The hum of mana resonated through him, a warm and familiar feeling that thrummed up through this well and collected into the wide stone basin. Somewhere below him, around him, through him, was a leyline. "Kaya," Teferi whispered. "Can you hear me?" Nothing. The coals sputtered; a wellwood log crumbling. "My name is <NAME>. I keep watch for the lost and forgotten. I am the father of Niambi and husband of Subira. I—" Teferi stopped his recitation. A shuffling, from the opposite side of the chamber. He looked over the lip of the bowl to see a young acolyte carefully closing the door behind her. She wore plain white robes, marking her as an inductee of the Civic Creed; an aspiring healer, she had stuck close to Teferi as soon as he had arrived in the village, not to learn but to make sure he did not fall into ruin. "Adia," Teferi said, greeting the acolyte. "Shaper," Adia murmured. To speak any louder in the creedhall would sound like shouting. "You're back. A good day?" "A good day," Teferi said, standing. "We caught plenty for our quota—the grangers might protest, but we'll be able to make the queen's order and have weight remaining for trade." Adia nodded. "Soldiers from Kipamu came looking for you." "When?" "Shortly after you left for the river. They thought to find you here." "Did they say what for?" "The war," Adia said. She spread her hands, palms up. Nothing more to be said. The queen ordered all Zhalfir to be mobilized, the five high wizards and General Mageta concurred, and so Zhalfir would be mobilized. A perfect organ, a state logical and sober, a people motivated to prove themselves, and a plane to be saved. Neat, clean, a myth waiting to be written, with monumental plazas of empty plinths waiting for statues of its heroes, bare walls waiting for mosaics of its great battles. That alley, that city, that boy whimpering, all that blood, those bodies, the fire above it all, the engine of living steel. "I told them you had gone to the river," Adia said. "And that you would return this evening." "Dutiful," Teferi grimaced. Adia inclined her head, a small gesture in place of a grand bow. "I'll need to wash first, and eat," Teferi walked past the acolyte, heading for his small room. "Go and find the soldiers, tell them I will be here. That's all. Thank you," he said, waving Adia away. He didn't wait to see if the young acolyte departed; he needed food and fresh clothing, a moment to rest. When Adia brought the soldiers back, none of those things would be guaranteed. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Soldiers had been a dramatic understatement. Teferi had expected a handful of akinji following some middle-seniority askari like ducklings trailing behind their mother; the party that greeted him when he stepped out into the creedhall's main chamber was closer to a war council. A dozen muscled sidars in rich blue robes and finely tanned armor waited for him, tall warriors who wore their swords ready to draw, rich furs across their shoulders and steel in their eyes. The sidars surrounded their leader, an officer in shining silver armor who clutched a red-winged helm under his arm. "<NAME>," the general roared, spreading his arms wide. "You bastard, I found you!" "I am just Teferi #emph[Akosa] now, Jabari," Teferi said. He allowed himself a small smile, relieved for the moment. If the queen had sent his executioner, at least he was a friend. "It has been so long." "Has it?" Jabari asked as they embraced. He slapped Teferi's back, squeezing him, then pulled back, cupping the back of Teferi's head. "Maybe for you," he said, pointing, "but for me, no. A few more gray hairs, but not so many as you." Jabari laughed again and let him go. "You're back, but where is the rest of the plane? Our sailors still say there is nothing beyond the shore, and our rangers who climb into the mist do not return." "Zhalfir is still on her own," Teferi said. "I'm sorry." "Don't do that now. No more apologizing," Jabari said. "I've heard stories of your penitent pilgrimage, it sounds exhausting." He waved for his retinue to part and led Teferi out from the creedhall. "The great mendicant, always a step ahead of us. Pick yourself up. You are the archmage of Zhalfir, and Zhalfir needs you." "Queen Wezna will kill me." "Well, yes," Jabari nodded. "But after you help Zhalfir, first." "I don't know if I can," Teferi said. "I'm not sure I can even help myself." "What do you mean?" "I don't know how I got here. I shouldn't have been able to. Zhalfir is~" Teferi waved a hand, searching for the words. "Lost. Alone. As you said: there's nothing beyond the shore." Jabari considered this, arms crossed, chin dipping to his chest. He frowned, walked a few steps away, stopped, and beckoned for Teferi to follow. Teferi and Jabari walked together away from the general's askari and the creedhall. The village was alive around them, full of the sound of song, laughter, and happy noise. The catch had been rich, just as Teferi thought—enough for the village's tithe to the war effort, and plenty to celebrate. "You need to know this," Jabari said, speaking quietly. "My askari only know that we are to recruit new soldiers and to retrieve you for the queen, but they do not know why." "Well?" "You are not the only one from outside to come here." "What?" "Zhalfir is not so alone," Jabari said. "Old friend, this is how you will help us; you will come with me to Aku to see this other wanderer like you." "Aku." Old memories came back to him: the pillar fields and the tombs, the ancient city of Aku, listing above the steaming quagmire that was the vast swamp of Uuserk. "Not Kaervek?" "No." Jabari said. "This one is a woman of regal bearing. We have her secured in amber as well, but before we did," Jabari reached out to Teferi again, tapping him on the chest to emphasize each word. "She asked for you." #emph[A woman of regal bearing.] He knew too many. Could Kaya and Saheeli have devised some way to cross the void and reach Zhalfir? How long had it been outside of this space? Time inside this place passed differently than time outside of it, he knew that well enough by now. Perhaps they had rebuilt the anchor, maybe they had found Karn, or sent this other Planeswalker as he had been sent, but in a way that they could reel them both back. "Describe her to me." "Young, but with white hair," Jabari said. "A thin sword, fine golden armor. The loremasters tell me that she looks Madaran. Also, this—" He looked past Teferi and whistled to one of his soldiers, gesturing for him to come over to them. The soldier, who had been carrying a cloth-wrapped object, hustled over. He bowed and offered the cloth to Teferi and Jabari. Teferi took the bundle. He unwrapped it, revealing an exquisite, wide-brimmed hat. It was armored in glossy, lacquered gold and green—light, but sturdy, balancing defense and ornament. "A strange hat, but good for travel," Jabari said. "Good for wandering," Teferi muttered. He recognized the woman's description. Not just any wanderer: the Wanderer. Another Planeswalker, here on Zhalfir. Not Kaya or Saheeli, but another who knew to look for him. "How soon will we leave?" Teferi asked. "Tomorrow," Jabari said. "We will have to hurry: the queen is already there, and she awaits the arrival of her archmage." "Tomorrow," Teferi repeated. Tomorrow they would set off to Aku, to meet the Wanderer and see what message she brought. What was this feeling? Hope, Teferi realized. Hope for a moment, followed by the cold whisper of truth: this was a happy revelation, but not a good one. Zhalfir connected to the Multiverse once more meant Zhalfir would be in danger. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The next morning, Jabari's sidars were up before the dawn, attending to their supply carts and personal packs. Later, as the sun began to burn away the morning's steamy haze, a brace of new recruits—youths finally of age to join the warbands—joined them. Teferi arrived with this group, along with the rest of the village. The fishers had already made for the river well before dawn, leaving only a quiet population of elders and dry land artisans to see them off. The journey would be long, crossing the Mtenda Plains to the rocky plateaus that bordered Zhalfir's north. In his youth, Teferi knew of roads that wound up into the mighty spines of the Teremko mountains, but he supposed the road they followed diverted west along the coast, crossing the shores of Buleusi Bay before wheeling back south. At the end of that road was Aku, the tomb city, tucked away in the remote Uuserk Marshes far from the light of Kipamu. "Shaper?" Teferi looked up from the ground to see Adia, the acolyte of the mana well, approaching him with a bundle of cloth. "I thought you should have these," Adia said. She held the bundle out to Teferi, a soft frown on her face. "What is this?" Teferi asked, accepting the soft bundle. He unrolled it, holding the robes up before him. "The old Shaper's robes, before you." Adia said. "They are clean. I mended the moth and mouse holes. They're appropriate for your rank. An older style, but"—she shrugged—"so are you." Teferi smiled. "Thank you, Adia." "I live to serve the creed," she said, her voice even. She bowed, stood, placed her hands in front of her, still didn't look at Teferi. "I have a daughter, Adia," Teferi said, kindly, as he rolled the up the robes. "She was your age once, too." "What?" "You seem like you have more to say." Adia nodded. Teferi finished securing the robes in his pack, letting Adia take the time she needed. "If Zhalfir is to return, that means the war is going to start," Adia said. "Really start. No more waiting or training. 'Zhalfir Alone' will end, and we'll be back in the real world." "That is true," Teferi said. Adia looked to the side, checking that no one else could hear. All others were engaged in small conversations—elders seeing off their adult grandchildren, eager recruits showing off to Jabari's askari, Jabari talking with his attendants. They had privacy in the middle of all of that. "I'm not so sure that Zhalfir returning to the world is a good thing if return means the war begins—actually begins," Adia said, speaking quickly and in one breath, as if spitting out a foul lozenge she had been forced to carry in her mouth. "This limbo is bad, but it is still peaceful; the Mirage and Keldon Wars took someone from every family, and those were wars against people, like you and me." She looked up to Teferi. "I am an orphan because of the Keldon War. I serve the Civic Creed because of what that war took from me. I think our people only imagine war against Phyrexia as a test. A great examination, where they can prove their might and show Dominaria where the sun rises. I think that we've all lost so much that we can't imagine losing anything else; we forget what war takes, even when there's nothing left." Teferi reached out and gently maneuvered Adia to the side, a little farther from the group. The recruits were saying their last goodbyes, and the sidars were starting to file into line. "I'm terrified of the cost of this war," Adia continued to whisper. "I'm sick with worry—to lose means ruin, but what happens when we win?" She gestured back at the sidars and recruits. "Zhalfir has spent so long waiting and sharpening her swords that when we defeat Phyrexia, we'll discover that war is the only thing we know how to do." Teferi said nothing. "What do we do?" Adia asked. "What do I do?" "Teferi!" Jabari called from the head of the forming column, waving him over. "Don't try to sneak off again, Planeswalker, or I'll use you to train my scouts!" Teferi waved, and then pulled on his pack. Adia hadn't moved. The acolyte waited for an answer Teferi did not yet have. Instead, all he could think of was his own daughter, Niambi. Once, when Niambi was quite young, they had been playing in their courtyard while Subira was away. Laughing, free, and without fear, Niambi had taken off running. She tripped before Teferi could warn her, and before Teferi knew it, he had frozen her in time, arresting her mid-fall. He remembered walking around her, trying to gauge every possible outcome of releasing her from what he could glean of that one moment, frozen in time. He could have kept her there forever if he wanted—and part of him wanted that, to keep her there, safe, away from the world—but he had shaken away that dark thought. His decision was to find a middle between fall and salvation: to catch her. He could not catch them now, but he could be there with them all. "Some things are so big," Teferi said, "that there's nothing you or I can do to stop them." "Not you," Adia said. "Not bigger than you. You sent us away to protect us, so keep us away. Protect us, protect Zhalfir." "I can't." Teferi shook his head. "But you did!" "I was a different person back then," Teferi said. "I was~ more. Less. I was someone else." He looked to the road. All the way to Aku and beyond. "Listen, Adia, I have not been here for many years, but in my brief time back—Zhalfir is not just war. We do not just fight. We were something else before all of this," Teferi said. "We can't stop what is coming, but we can control what happens after." Teferi gestured to the soldiers, the recruits, the land. "There is a great terror approaching, yes, but it will only remain as long as we choose to hold on to it." "I don't understand." "We are not bound by fate," Teferi said. "Only our past. We were not always soldiers. We were not always alone." Adia lifted a finger to respond, then stopped. She composed herself. "May you reach your destination," she said. Adia did not wait for Teferi to reply, but left, walking quickly back to the village. Teferi did not try to stop her, only watched as she pushed through the ranks of eager recruits. Her robes, white as clouds, disappeared into the crowd. What had he thought, back when Niambi fell? #emph[No amount of soul-searching could bring back Zhalfir. ] Well, some amount of soul-searching brought him back, only to find that no amount of apologizing could fix what he had done. It was never going to be as easy as bringing Zhalfir back; Zhalfir was not just a name on a map. It was a nation, a people, a history, a future, and nothing he could control. Nothing he could save on his own, no matter how much he wanted to. Wasn't that the mark of a good parent? Knowing when there was nothing that they could do but be there for their child when they needed them the most? He had wronged them all, but he could stand with them now; he could teach them how to brace against the fall and help them stand after. "Teferi!" "Jabari," Teferi shouted back. He waited a heartbeat. Reached his fingers to his lips, kissed them, touched them to his forehead, and placed his hand over his heart. An old gesture. Gratitude to this place for what it gave him, for what it taught him. Teferi left with the soldiers and recruits, marching alongside them up the long road to Aku. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Aku, Weeks Later] The journey to Aku was not long, but it was fraught with danger, but Jabari and his soldiers—with Teferi's help—had seen the road to its end without loss. Upon reaching the city, without even time to bathe or eat, runners came to collect Teferi and Jabari. The halls of Aku were warm and solemn. The queen's presence demanded tapestries be hung and rich rugs rolled out over the glossy floors, for braziers to be loaded with smoldering wellwood and other finely scented fuels; Aku might have been a tomb city, but it was not a scorned place. These decorations were for the living and the dead both: Zhalfir's royal lines rested here, and the queen had come to them to seek inspiration, comfort, and spiritual guidance—solemnity was a sign of respect, not fear. Peace, to better channel the wisdom of a people. However, this sense of peace did not extend throughout the entire city. The Amber Tombs, where the past's dark secrets were held under guard by the strongest magics, the most ancient and powerful wisdoms Zhalfir's ancestors could impart, bristled with unsettling energy. Extra torches and glowstones were ordered in to banish the persistent shadows that lingered throughout the corridors; this was especially the case inside of the Amber Tombs's main dome, where one could keep watch on the most dangerous threats to Zhalfir. Teferi and Jabari followed the runners through the winding corridors of Aku's central district to the Amber Tombs, where the queen waited for them. Every turn of the narrow, high halls of Aku's streets was patrolled by a pair of queen's guard, often accompanied by a Shaper Creed or, worryingly, Civic Creed clerics wearing armor. "Not a normal deployment, right?" Teferi whispered to Jabari as the two of them walked past a saluting pair of clerics. "Not at all," Jabari muttered. "Something must have happened in the tombs." "Maybe the queen will stay my execution," Teferi said. "I'm joking, not pleading," he added. "To be clear." Jabari grunted, not smiling, and picked up the pace. Teferi and Jabari reached the Amber Tombs to find its entrance crowded with soldiers and clerics, weapons drawn, some facing toward them, others facing inside. Two officers, askari of some high seniority, argued with each other in whispers, their voices harsh and unintelligible in the echoing hallway. "Askari," Jabari said, firm, loud but not shouting. His voice cut through the noise. "What's happening? Is the queen in danger?" The sidars stopped arguing, both turning to Jabari in unison. "Kaervek has escaped," one of the askari said. She was composed, but nerves thinned her already severe face. "His prison shattered. The general is wounded, but stable." "When?" Teferi asked. "An hour at most," the askari said, wiping sweat from her brow. "General Mageta was wounded #emph[an hour ago] ?" Jabari asked, shocked, his voice rising. "We only just discovered him," the askari said, raising a hand to try and calm Jabari. "He was wounded by Kaervek's prison shattering, but will survive—it is bad, but not fatal." "Let us through," Teferi ordered. Little time for words. The guards parted. Teferi led Jabari through into the central chamber of the Amber Tomb, a single, vast, dark dome. Sconces sunk into the wall at regular, regimented intervals, dim lights glowing deep within them. All were empty, but it was easy enough to discern what they once held: amber prisons. The chamber was ancient, and legends whispered of dark origins, magics and rituals Zhalfir's ancestors risked employing to ensure those who needed to stay locked away did, suspending a warding pendulum from the dome's apex to serve as a warning system. The scholars of Zhalfir waved these histories away as myth and wishful fantasy—but few ever visited the central dome of the tombs, and all of those that did could not deny a certain unnerving quality to the room. A silence blanketed the chamber that, being a dome, should echo like a concert hall. A deep, sure feeling that, should that dully burnished pendulum twitch, ruin would follow. With horror, Teferi saw that the pendulum had snapped and fallen to the polished floor of the dome. Its point was embedded in the ground, its large chain coiled around it like the corpse of a great snake. The floor, polished to a mirror shine, had shattered. Dark liquid—General Mageta's blood, Teferi guessed—pooled near the pendulum, resisting the efforts of a handful of soldiers who tried to swab it up. Queen Wezna stood off to the side, conversing with two robed figures, one in sky blue and the other in a velvet black. A third, armored in white, stood off to the side, idly examining the fallen pendulum and the shattered ground. Teferi did not recognize any of the robed figures—the leaders of their respective creed, he was sure—but the queen was unmistakable, aged only a decade since last he saw her centuries prior. "Your grace," Jabari called, bowing quickly as she turned. "I beg your understanding; we have only just arrived—" "Three hundred and sixty years," Queen Wezna said, striding toward Teferi. She did not shout—she declared, and the dome resounded with her voice. "Three hundred and sixty years gone, and it is still us against them," The queen said. "Phyrexia looms at our borders, Kaervek has escaped, and General Mageta wounded." She stopped a few paces away, trailed by the three creed leaders. "And you, returned to us. There is no punishment great enough to justly weigh the acts you have committed—tell me why I should not order my sentence for you carried out right at this moment." "If you kill me," Teferi said, "they will win." The queen inhaled, exhaled. Nodded. "<NAME>," Queen Wezna said, speaking to the old officer without breaking eye contact with Teferi. "The Civics have a hospital in the pillar district; the general convalesces there. Go and see him. You will lead the army until he recovers." "Yes, your grace," Jabari said. Teferi heard him walk away, the sound of his boots hurried on the polished stone. Queen Wezna turned and walked back to the fallen pendulum, hands crossed behind her back, thinking. She stopped before her three creed mages, back turned to Teferi. "You were not summoned by me," Queen Wezna said, speaking to Teferi. "I cannot have you brought to justice for your crimes—great or small—yet, but I have my pride." She turned back around to face him. "I did not summon you here." "Where is she?" Teferi asked. The queen reached into her robes, pulled out a small, palm-size amber bauble, and tossed it toward him. The amber prison bounced, skipping off the polished stone floor, and slid to a stop at Teferi's feet. Teferi bent to pick up the prison, pinching it between his pointer finger and thumb. He lifted it up to the light, illuminating the figure within. Small, frozen in time, likely moments after planeswalking, a warrior mid-strike. Squinting, Teferi could see on her face a look of determination slipping to confusion—a hard brow softening, her mouth opening to ask a question, her eyes wide with surprise. The Wanderer. "When you are done looking, set it down on the ground." The queen said. Teferi obliged. He set the prison gently on the ground, and then stepped back. <NAME> snapped her fingers, and the white-armored creed leader stepped forward. He whispered a quiet spell, subtle and without theater. The prison began to glow. "Another step back, archmage," he said, looking over the rising light at Teferi. Teferi obliged, stepping back as the prison began to spit and spark. He shielded his eyes, turning as the prison snapped, bursting open with a sharp report followed moments later by a short, sharp exhalation as the Wanderer finished her swing, crying out in surprise. The Wanderer recovered, resetting her stance and guard, breathing hard, her composure rattled but not broken. "Wanderer," Teferi shouted, hands up and palms out. "It's me." "Teferi?" She shouted, overloud. The Wanderer quickly took in her surroundings, guard high. "Where am I? How long has it been?" "Aku," <NAME> said. "On Zhalfir. It has been a month since you arrived." "A month?" The Wanderer repeated. She lowered her sword, eyes searching the space between them for something only she could see. "That's impossible—Teferi, you only disappeared days ago!" "The anchor failed," Teferi mused. How? Serra's powerstone—the potential of a plane, shunted through him—something to do with the sylex. That space that he and Urza went to after it detonated—all that potential had to go somewhere, had to find something to cling to. Chance, fate, or some combination of the two. "We might not even have the day," The Wanderer whispered. Her form flickered, shuddering. She was losing her hold on the plane. "What do you mean?" Queen Wezna asked. "New Phyrexia's invasion is upon us," the Wanderer said. She looked to the queen, then to Teferi. "Our attack was scattered across the plane, Nissa's gone—I think we're too late. I don't think we can stop them." A cold moment followed. Teferi stepped back, reached behind him, and sat on the ground. He dropped his head into his hands. All around him, the tombs exploded into action. The queen shouted orders to the three creed leaders, who dispatched their attachés and lieutenants before hurrying to depart for their commands. The Wanderer crouched down next to him and tried to tell him about the battle at Urza's Tower, the raid on New Phyrexia, the growing tree, the desperate plan, but her voice hiccupped and stuttered, and she flickered in and out of coherence. She faded, her unstable spark pulling her away. Maybe it was the uncanny acoustics of the domed chamber, or some comforting spell he had unconsciously cast, but it all faded to the side, sloughed off like a too-heavy coat. Jabari's voice echoed in his memory. No more apologizing. Teferi pulled his hands away from his face and looked to his palms. Though he washed them many times since that day on the road, they still were tinged with Zhalfir's red earth. He could never wash this land away. He could never be alone. Eshe, who had weathered the ages. Oyana, who looked to danger with bravery. Adia, who longed to build a peaceful future. Subira, whom he had loved, and who had loved him. Niambi, whom he loved, and who loved him. Zhalfir, with whom he stood, father of the creeds, father of a nation. "It's not too late," Teferi said, a fierce grin spreading across his face. The Phyrexians' probing through the Multiverse had awoken something that their machine minds would learn to fear: Teferi, who would show them that the sun rises in Zhalfir.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/numty/0.0.1/lib.typ
typst
Apache License 2.0
// == boolean helpers == #let arrarr(a,b) = (type(a) == array and type(b) == array) #let arrflt(a,b) = (type(a) == array and type(b) != array) #let fltarr(a,b) = (type(a) != array and type(b) == array) // == basic functions == #let pow(a, power) = { if arrarr(a,power) { a.zip(power).map(((a,b)) => a/b) } else { a.map(r => calc.pow(r,power)) } } #let mult(a,b) = { if arrarr(a,b) { a.zip(b).map(((a,b)) => a*b) } else if (type(a) == array) { a.map(a => a*b) } else { mult(b,a) } } #let div(a,b) = { if arrarr(a,b) { a.zip(b).map(((a,b)) => a/b) } else if (type(a) == array) { a.map(a => a/b) } else { b.map(b => b/a) } } #let add(a, b) = { if arrarr(a,b) { a.zip(b).map(((a,b)) => a+b) } else if (type(a) == array) { a.map(a => a+b) } else { add(b, a) } } #let sub(a, b) = { if arrarr(a,b) { a.zip(b).map(((a,b)) => a-b) } else if (type(a) == array) { a.map(a => a-b) } else { b.map(b => a-b) } } // == vectorial functions == #let norm(a) = { // normalize a vector let aux = a.sum() a.map(b => b/aux) } // dot product #let dot(a,b) = mult(a,b).sum() // == trigonometry == #let sin(a) = { if (type(a) == array) { a.map(a => calc.sin(a)) } else { calc.sin(a) } } #let cos(a) = { if (type(a) == array) { a.map(a => calc.cos(a)) } else { calc.cos(a) } }
https://github.com/tristan957/resume
https://raw.githubusercontent.com/tristan957/resume/master/README.md
markdown
<!-- SPDX-License-Identifier: CC0-1.0 SPDX-FileCopyrightText: 2023 <NAME> <<EMAIL>> --> <!-- prettier-ignore-start --> <!-- markdownlint-disable-next-line MD041 --> [![builds.sr.ht status](https://builds.sr.ht/~tristan957/resume.svg)](https://builds.sr.ht/~tristan957/resume?) <!-- prettier-ignore-end --> # Resume This is my resume written in [Typst](https://typst.app). A compiled PDF is hosted on my [personal website](https://tristan.partin.io/documents/Tristan_Partin_Resume.pdf). ## Building ```shell make ``` An initial build will require an internet connection to download Fontawesome, but after that, offline development can commence. Review the [`Makefile`](./Makefile) for additional targets.
https://github.com/MrToWy/hsh-thesis
https://raw.githubusercontent.com/MrToWy/hsh-thesis/main/template/chapters/1-einleitung.typ
typst
MIT License
#import "../customFunctions.typ": * = Template Ein vollständiges Beispiel ist auf GitHub zu finden: #link("https://github.com/MrToWy/Bachelorarbeit")[HIER KLICKEN]. In diesem Template für die #hsh können sowohl .yaml-Dateien @harry, als auch .bib-Dateien @typst verwenden werden. == Codebeispiel <code-abschnitt> Für Code @code1 und Bilder können Funktionen aus der `customFunctions.typ` verwendet werden. #code-figure("Caption", <code1>, "code") == Use Cases #use-case(1, "Erster Usecase")[ Der Use Case beschreibt, wie.... ][ Beispielakteur ][ Beispielvorbedingung ][ 1. Schritt 1 2. Schritt 2 ]<use-case-info-degree> == anforderungen Anforderungen können in Tabellen dargestellt werden. #task(title: [Aus @code-abschnitt ergeben sich folgende Anforderungen:])[ #narrow-track("Beispiel 1", type: "F", label: <example1>)[Lorem ipsum.] #linebreak() #narrow-track("Beispiel 2", type: "F", label: <example2>)[Lorem ipsum.] #linebreak() ] Auf die Anforderungen kann ebenfalls referenziert werden. @example1
https://github.com/Tiggax/famnit_typst_template
https://raw.githubusercontent.com/Tiggax/famnit_typst_template/main/template/main.typ
typst
MIT No Attribution
#import "@preview/sunny-famnit:0.2.0": project #show: project.with( date: datetime(day: 1, month: 1, year: 2024), // you could also do `datetime.today()` text_lang: "en", // the language that the thesis is gonna be written in. author: "your name", studij: "your course", mentor: ( name: "his name", en: ("prepends","postpends"), // you can prepend or postpend any titles sl: ("predstavki","postavki"),// you can prepend or postpend any titles ), somentor: none, // if you have a co-mentor write him here the same way as mentor, else you can just remove the line. work_mentor: none, // if you have a work mentor, the same as above naslov: "your title in slovene", title: "your title", izvleček: [ your abstract in slovene. ], abstract: [ your abstract ], ključne_besede: ("Typst", "je", "super!"), key_words: ("Typst", "is", "Awesome!"), kratice: ( "Famnit": "Fakulteta za matematiko naravoslovje in informacijske tehnologije", "PDF": "Portable document format", ), priloge: (), // you can add attachments as a dict of a title and content like `"name": [content],` zahvala: [ you can add an acknowlegment. ], bib_file: bibliography( "my_references.bib", style: "ieee", title: [Bibliography], ), /* Additional content and their defaults kraj: "Koper", */ ) = Uvod your thesis goes here.
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/grid/colspan.typ
typst
--- grid-colspan --- #grid( columns: 4, fill: (x, y) => if calc.odd(x + y) { blue.lighten(50%) } else { blue.lighten(10%) }, inset: 5pt, align: center, grid.cell(colspan: 4)[*Full Header*], grid.cell(colspan: 2, fill: orange)[*Half*], grid.cell(colspan: 2, fill: orange.darken(10%))[*Half*], [*A*], [*B*], [*C*], [*D*], [1], [2], [3], [4], [5], grid.cell(colspan: 3, fill: orange.darken(10%))[6], grid.cell(colspan: 2, fill: orange)[7], [8], [9], [10], grid.cell(colspan: 2, fill: orange.darken(10%))[11], [12] ) #table( columns: 4, fill: (x, y) => if calc.odd(x + y) { blue.lighten(50%) } else { blue.lighten(10%) }, inset: 5pt, align: center, table.cell(colspan: 4)[*Full Header*], table.cell(colspan: 2, fill: orange)[*Half*], table.cell(colspan: 2, fill: orange.darken(10%))[*Half*], [*A*], [*B*], [*C*], [*D*], [1], [2], [3], [4], [5], table.cell(colspan: 3, fill: orange.darken(10%))[6], table.cell(colspan: 2, fill: orange)[7], [8], [9], [10], table.cell(colspan: 2, fill: orange.darken(10%))[11], [12] ) --- grid-colspan-gutter --- #grid( columns: 4, fill: (x, y) => if calc.odd(x + y) { blue.lighten(50%) } else { blue.lighten(10%) }, inset: 5pt, align: center, gutter: 3pt, grid.cell(colspan: 4)[*Full Header*], grid.cell(colspan: 2, fill: orange)[*Half*], grid.cell(colspan: 2, fill: orange.darken(10%))[*Half*], [*A*], [*B*], [*C*], [*D*], [1], [2], [3], [4], [5], grid.cell(colspan: 3, fill: orange.darken(10%))[6], grid.cell(colspan: 2, fill: orange)[7], [8], [9], [10], grid.cell(colspan: 2, fill: orange.darken(10%))[11], [12] ) #table( columns: 4, fill: (x, y) => if calc.odd(x + y) { blue.lighten(50%) } else { blue.lighten(10%) }, inset: 5pt, align: center, gutter: 3pt, table.cell(colspan: 4)[*Full Header*], table.cell(colspan: 2, fill: orange)[*Half*], table.cell(colspan: 2, fill: orange.darken(10%))[*Half*], [*A*], [*B*], [*C*], [*D*], [1], [2], [3], [4], [5], table.cell(colspan: 3, fill: orange.darken(10%))[6], table.cell(colspan: 2, fill: orange)[7], [8], [9], [10], table.cell(colspan: 2, fill: orange.darken(10%))[11], [12] ) --- grid-colspan-thick-stroke --- #set page(width: 300pt) #table( columns: (2em, 2em, auto, auto), stroke: 5pt, [A], [B], [C], [D], table.cell(colspan: 4, lorem(20)), [A], table.cell(colspan: 2)[BCBCBCBC], [D] ) --- grid-colspan-out-of-bounds --- // Error: 3:8-3:32 cell's colspan would cause it to exceed the available column(s) // Hint: 3:8-3:32 try placing the cell in another position or reducing its colspan #grid( columns: 3, [a], grid.cell(colspan: 3)[b] ) --- grid-colspan-overlap --- // Error: 4:8-4:32 cell would span a previously placed cell at column 2, row 0 // Hint: 4:8-4:32 try specifying your cells in a different order or reducing the cell's rowspan or colspan #grid( columns: 3, grid.cell(x: 2, y: 0)[x], [a], grid.cell(colspan: 2)[b] ) --- grid-colspan-over-all-fr-columns --- // Colspan over all fractional columns shouldn't expand auto columns on finite pages #table( columns: (1fr, 1fr, auto), [A], [B], [C], [D], [E], [F] ) #table( columns: (1fr, 1fr, auto), table.cell(colspan: 3, lorem(8)), [A], [B], [C], [D], [E], [F] ) --- grid-colspan-over-some-fr-columns --- // Colspan over only some fractional columns will not trigger the heuristic, and // the auto column will expand more than it should. The table looks off, as a result. #table( columns: (1fr, 1fr, auto), [], table.cell(colspan: 2, lorem(8)), [A], [B], [C], [D], [E], [F] ) --- grid-colspan-over-all-fr-columns-page-width-auto --- // On infinite pages, colspan over all fractional columns SHOULD expand auto columns #set page(width: auto) #table( columns: (1fr, 1fr, auto), [A], [B], [C], [D], [E], [F] ) #table( columns: (1fr, 1fr, auto), table.cell(colspan: 3, lorem(8)), [A], [B], [C], [D], [E], [F] ) --- grid-colspan-multiple-regions --- // Test multiple regions #set page(height: 5em) #grid( stroke: red, fill: aqua, columns: 4, [a], [b], [c], [d], [a], grid.cell(colspan: 2)[e, f, g, h, i], [f], [e], [g], grid.cell(colspan: 2)[eee\ e\ e\ e], grid.cell(colspan: 4)[eeee e e e] )
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis
https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/src/lib.typ
typst
MIT License
#import "@preview/glossarium:0.4.1": gls, glspl #import "@preview/codly:1.0.0": * #import "utils.typ": * #import "assets.typ": * #import "pm_assets.typ": * #let project( lang: "de", authors: ( ( name: "Unknown author", // required id: "", email: "" ), ), title: "Unknown title", subtitle: none, date: none, version: none, thesis-compliant: false, // Format side-margins: ( left: 3.5cm, // required right: 3.5cm, // required top: 3.5cm, // required bottom: 3.5cm // required ), h1-spacing: 0.5em, line-spacing: 0.65em, font: "Roboto", font-size: 11pt, hyphenate: false, // Color settings primary-color: dark-blue, secondary-color: blue, text-color: dark-grey, background-color: light-blue, // Cover sheet custom-cover-sheet: none, cover-sheet: ( // none university: ( // none name: none, // required street: none, // required city: none, // required logo: none ), employer: ( // none name: none, // required street: none, // required city: none, // required logo: none ), cover-image: none, description: none, faculty: none, programme: none, semester: none, course: none, examiner: none, submission-date: none ), // Declaration custom-declaration: none, declaration-on-the-final-thesis: ( // none legal-reference: none, // required thesis-name: none, // required consent-to-publication-in-the-library: none, // required | true, false genitive-of-university: none // required ), // Abstract abstract: none, // Outlines depth-toc: 4, outlines-indent: 1em, show-list-of-figures: false, show-list-of-abbreviations: true, list-of-abbreviations: ( ( key: "", // required short: "", // required plural: "", long: "", longplural: "", desc: none, group: "", ), ), show-list-of-formulas: false, custom-outlines: ( // none ( title: none, // required custom: none // required ), ), show-list-of-tables: false, show-list-of-todos: false, literature-and-bibliography: none, list-of-attachements: ( // none (a: none), // required ), body ) = { import "@preview/hydra:0.5.1": hydra import "@preview/glossarium:0.4.1": make-glossary as make-list-of-abbreviations, print-glossary as print-list-of-abbreviations import "dictionary.typ": * import "cover_sheet.typ": * import "declaration_on_the_final_thesis.typ": * // Metadata let date-format = if lang == "de" { "[day].[month].[year]" } else { "[day]/[month]/[year]" } set document( title: title + if is-not-none-or-empty(version) { " v" + version }, author: authors.map(a => a.name) ) // Basics set page( paper: "a4", flipped: false, margin: side-margins ) set text( lang: lang, font: font, size: font-size, fill: text-color ) use-dictionary() show: make-list-of-abbreviations show: codly-init.with() if is-not-none-or-empty(date) == false { date = datetime.today().display(date-format) } // Cover Sheet if is-not-none-or-empty(custom-cover-sheet) == false and is-not-none-or-empty(cover-sheet) { let cover-sheet-dict-contains-key(key) = { return dict-contains-key(dict: cover-sheet, key) } get-cover-sheet( primary-color: primary-color, secondary-color: secondary-color, text-color: text-color, background-color: background-color, visualise-content-boxes: (flag: false, fill: background-color, stroke: text-color), university: if cover-sheet-dict-contains-key("university") { cover-sheet.university }, employer: if cover-sheet-dict-contains-key("employer") { cover-sheet.employer }, cover-image: if cover-sheet-dict-contains-key("cover-image") { cover-sheet.cover-image }, date: date, version: version, title: title, subtitle: subtitle, description: if cover-sheet-dict-contains-key("description") { cover-sheet.description }, authors: authors, faculty: if cover-sheet-dict-contains-key("faculty") { cover-sheet.faculty }, programme: if cover-sheet-dict-contains-key("programme") { cover-sheet.programme }, semester: if cover-sheet-dict-contains-key("semester") { cover-sheet.semester }, course: if cover-sheet-dict-contains-key("course") { cover-sheet.course }, examiner: if cover-sheet-dict-contains-key("examiner") { cover-sheet.examiner }, submission-date: if cover-sheet-dict-contains-key("submission-date") { cover-sheet.submission-date } ) } else { custom-cover-sheet } pagebreak() // Content basics show heading.where(level: 1): set text(fill: primary-color) show heading.where(level: 1): it => if thesis-compliant { colbreak(weak: true) } + it + v(h1-spacing) set page( numbering: "1", header: context { if thesis-compliant { align( left, text(weight: "bold", size: 8.5pt)[ #let h1 = hydra(1, skip-starting: false) #let numbered-heading = to-string(h1).split(regex("[.]\s")).at(1, default: none) #if numbered-heading != none { numbered-heading } else { h1 } ] ) v(-1em) line(length: 100%, stroke: 1.2pt + text-color) } } ) set par( leading: line-spacing, justify: true ) set text( hyphenate: hyphenate ) let get-figure-caption(it) = [ #set align(left) #h(1em) #box[ #it.supplement #context it.counter.display(it.numbering): #text(fill: primary-color)[*#it.body*] ] ] show figure.caption.where(kind: image): it => get-figure-caption(it) show figure.caption.where(kind: table): it => get-figure-caption(it) show link: set text(fill: secondary-color.darken(60%)) // Declaration if is-not-none-or-empty(custom-declaration) { page( header: "", footer: "" )[ #custom-declaration ] } else if thesis-compliant and is-not-none-or-empty(declaration-on-the-final-thesis) { page( header: "", footer: "" )[ #get-declaration-on-the-final-thesis( lang: lang, legal-reference: declaration-on-the-final-thesis.legal-reference, thesis-name: declaration-on-the-final-thesis.thesis-name, consent-to-publication-in-the-library: declaration-on-the-final-thesis.consent-to-publication-in-the-library, genitive-of-university: declaration-on-the-final-thesis.genitive-of-university ) ] } // Abstract if is-not-none-or-empty(abstract) { page( numbering: "I" )[ #counter(page).update(1) #heading(depth: 1)[ #txt-abstract ] #abstract ] } // Table of contents (TOC) page( numbering: none )[ #if is-not-none-or-empty(abstract) == false { counter(page).update(1) } #show outline.entry.where(level: 1): it => { v(1.5em, weak: true) upper(strong(it)) } #outline( indent: outlines-indent, depth: depth-toc ) ] // List of Figures if thesis-compliant or show-list-of-figures { page( numbering: "I" )[ #heading(depth: 1)[ #txt-list-of-figures ] #simple-outline( indent: outlines-indent, target: figure.where(kind: image) ) ] } // List of Abbreviations if show-list-of-abbreviations and is-not-none-or-empty(list-of-abbreviations){ if is-not-none-or-empty(list-of-abbreviations.at(0).key) and is-not-none-or-empty(list-of-abbreviations.at(0).short) { page( numbering: "I" )[ #heading(depth: 1)[ #txt-list-of-abbreviations ] #print-list-of-abbreviations(list-of-abbreviations) ] } } // List of Formulas set math.equation(numbering: if thesis-compliant or show-list-of-formulas { "(1)" } else { none }, supplement: [#txt-supplement-formula]) show math.equation.where(block: true) : it => rect(width: 100%, fill: background-color)[ #v(0.5em) #it #v(0.5em) ] if show-list-of-formulas { page( numbering: "I" )[ #simple-outline( title: txt-list-of-formulas, indent: outlines-indent, target: math.equation.where(block: true) ) ] } // Custom outlines if is-not-none-or-empty(custom-outlines) { for o in custom-outlines { if o.title != none and o.custom != none { page( numbering: "I" )[ #if is-not-none-or-empty(o.title) { heading(depth: 1)[ #o.title ] } #o.custom ] } } } // List of Tables if show-list-of-tables { page( numbering: "I" )[ #simple-outline( title: txt-list-of-tables, indent: outlines-indent, target: figure.where(kind: table) ) ] } // Body set page( footer: if thesis-compliant == false [ #set text(weight: "regular") #let size = 11pt #context { grid( columns: (1fr, auto, 1fr), align: (left, center, right), gutter: size, [ #text(fill: text-color, size: size)[ #date ] ], [ #text(fill: primary-color, size: size + 1pt)[ *#title* ] \ #text(fill: secondary-color, size: size)[ #subtitle ] ], [ #text(fill: text-color, size: size)[ #counter(page).display() / #counter(page).final().last() ] ] ) } ] ) counter(page).update(1) let todos() = { locate(loc => { let elems = query(<todo>, loc) if elems.len() == 0 { return } heading(depth: 1)[ TODOs ] for body in elems { text([+ #link(body.location(), body.text)], red) } }) } if show-list-of-todos { todos() } set heading(numbering: "1.1.") body // Literature, bibliography, attachements set heading(numbering: none) if is-not-none-or-empty(literature-and-bibliography) { page[ #heading(depth: 1)[ #txt-literature-and-bibliography ] #literature-and-bibliography ] } if is-not-none-or-empty(list-of-attachements) and (thesis-compliant or list-of-attachements.at(0).a != none) { page[ #heading(depth: 1)[ #txt-list-of-attachements ] #v(1.5em) #let index = 1 #for c in list-of-attachements { text()[ #txt-attachement A#index: #c.a ] v(1em) index = index + 1 } ] } }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/list-marker_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 19-21 array must contain at least one marker // #set list(marker: ())
https://github.com/OrangeX4/typst-talk
https://raw.githubusercontent.com/OrangeX4/typst-talk/main/examples/chicv.typ
typst
#show heading: set text(font: "Linux Biolinum") // 为链接加入下划线 #show link: underline // 推荐的简历文本大小为“10pt”到“12pt” #set text(size: 16pt) // 设置页边距 #set page(margin: (x: 0.9cm, y: 1.3cm)) #set par(justify: true) // 横线 #let chiline() = {v(-3pt); line(length: 100%); v(-5pt)} = <NAME> <EMAIL> | #link("https://github.com/skyzh")[github.com/skyzh] | #link("https://skyzh.dev")[skyzh.dev] == Education #chiline() #link("https://typst.app/")[*#lorem(2)*] #h(1fr) 2333/23 -- 2333/23 \ #lorem(5) #h(1fr) #lorem(2) \ - #lorem(10) *#lorem(2)* #h(1fr) 2333/23 -- 2333/23 \ #lorem(5) #h(1fr) #lorem(2) \ - #lorem(10) == Work Experience #chiline() *#lorem(2)* #h(1fr) 2333/23 -- 2333/23 \ #lorem(5) #h(1fr) #lorem(2) \ - #lorem(20) - #lorem(30) - #lorem(40) *#lorem(2)* #h(1fr) 2333/23 -- 2333/23 \ #lorem(5) #h(1fr) #lorem(2) \ - #lorem(20) - #lorem(30) - #lorem(40)
https://github.com/jxpeng98/Typst-Paper-Template
https://raw.githubusercontent.com/jxpeng98/Typst-Paper-Template/main/CHANGELOG.md
markdown
MIT License
# 0.6.0 - Make items more flexible than the previous version - All the following items are optional: - `font` - `fontsize` - `subtitle` - `date` - `abstract` - `keywords` - `JEL` - `acknowledgements` - Also the items in the `authors` list are optional - `name` - `affiliation` - `email` - `note` **Note**: All the above items can be removed from the template. **However, you must keep the comma at the end of the bracket of the author's list.** ```typst authors: ( ( name: "<NAME>", ), // this comma must be kept if you have author items ( name: "<NAME>", affiliation: "University of Nowhere", email: "<EMAIL>", note: "456", ) ), ```
https://github.com/mst2k/HSOS-PTP-Typst-Template
https://raw.githubusercontent.com/mst2k/HSOS-PTP-Typst-Template/main/templates/eidesstattliche_erklaerung.typ
typst
#let eidesstattliche_erklaerung(title) = {[ #set par(justify: true, first-line-indent: 0pt) #v(8em) #heading(outlined: false, numbering: none, [Eidesstattliche Erklärung]) Ich erkläre an Eides statt, dass ich meine Hausarbeit #v(12pt) #align(center, text(13pt, weight: 700, title)) #v(12pt) selbstständig und ohne fremde Hilfe angefertigt habe und dass ich alle von anderen Autoren wörtlich übernommenen Stellen wie auch die sich an die Gedankengänge anderer Autoren eng anlehnenden Ausführungen meiner Arbeit besonders gekennzeichnet und die Quellen zitiert habe. #v(40pt) #align(center, grid( columns: (1fr,1fr), rows: (0pt, 0pt), gutter: (8pt), align(bottom, datetime.today().display("Lingen, [day].[month].[year]")), align(bottom, image("../images/unterschrift.png", height: 15pt)), overline(extent: 20pt,offset: -10pt,[Ort, Datum]), overline(extent: 20pt,offset: -10pt,[Unterschrift]), )) ]}
https://github.com/pawarherschel/typst
https://raw.githubusercontent.com/pawarherschel/typst/main/modules/professional.typ
typst
Apache License 2.0
#import "../template/template.typ": * #import "../helpers/helpers.typ": * #let SOT = yaml("../SOT.yaml") #let professional = () #if SOT.keys().contains("professional") { professional = SOT.professional } #if professional.len() != 0 { cvSection("Professional Experience") for entry in professional { let title = entry.title let society = entry.society let logo = "" if entry.keys().contains("logo") { logo = entry.logo } let date = entry.date let location = entry.location let description = join-as-bullet-list(entry.description) cvEntry( title: title, society: society, logo: logo, date: date, location: location, description: description ) } }
https://github.com/LucaCiucci/bob-typ
https://raw.githubusercontent.com/LucaCiucci/bob-typ/main/typst-package/README.md
markdown
MIT License
# `bob-draw` svgbob for typst, powered by wasm This package provides a typst plugin for rendering [svgbob](https://github.com/ivanceras/svgbob) diagrams. # Basic example ````typ #import "@preview/bob-draw:0.1.0": * #render(``` /\_/\ bob -> ( o.o ) \ " / .------/ / ( | | `====== o o ```) ```` output: ![basic-example](./examples/basic-example.svg) ## Full example ````typ #import "@preview/bob-draw:0.1.0": * #show raw.where(lang: "bob"): it => render(it) #let svg = bob2svg("<--->") #render("<--->") #render( ``` 0 3 *-------* 1 /| 2 /| *-+-----* | | |4 | |7 | *-----|-* |/ |/ *-------* 5 6 ```, width: 25%, ) ```bob "cats:" /\_/\ /\_/\ /\_/\ /\_/\ ( o.o )( o.o )( o.o )( o.o ) ``` ````
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/05-group-theory/05-direct-prod.typ
typst
Other
#import "../../utils/core.typ": * == Прямые произведения #ticket[Внутреннее прямое произведение подгрупп] #def[ Пусть $H_1, H_2$ --- подгруппы $G$, говорят, что $G$ расскладывается во _внутреннее прямое произведение_ $H_1$ и $H_2$, если: + $G = H_1 H_2$ + $H_1 sect H_2 = {e}$ + $forall h_1 in H_1 space forall h_2 in H_2: h_1 h_2 = h_2 h_1$ Обозначается $G = H_1 times H_2$. ] #denote[ $TT$ --- группа комплексных чисел с модулем 1 (aka окружности с радиусом 1). ] #example[ Рассмотрим $G = CC^*$, $H_1 = TT$, $H_2 = RR^*_+$ Тогда $G$ --- прямое произведение $H_1$ и $H_2$. ] #pr[ Условия 1 и 2 можно заменить на условие ($12$) $ forall g in G space exists! h_1 in H_1, space h_2 in H_2: g = h_1 h_2 $ ] #proof[ - "$1 space \& space 2 ==> 12$": $h_1 h_2 = h_1 ' h_2 ' ==> underbrace((h_1 ')^(-1)h_1, in H_1) = underbrace(h_2 ' (h_2)^(-1), in H_2) = e$ - "$12 ==> 1 space \& space 2$": Пусть $h in H_1 sect H_2$. Тогда $h = h e = e h ==> h = e.$ ] #pr[ Условие 3) можно заменить на $ cases( H_1 nsubg G, H_2 nsubg G, ) $ ] #proof[ - "$==>$": Рассмотрим $h in H_1$, $g in G$, $g = h_1 h_2$, где $h_1 in H_1$ и $h_2 in H_2$. Тогда $ g h g^(-1) &= h_1 h_2 h h_2^(-1) h_1^(-1) = \ &= h_1 h h_2 h_2^(-1) h_1 \ &= h_1 h h_1^(-1) in H_1. $ Аналогично для $h in H_2$. - "$<==$": Пусть $h_1 in H_1, h_2 in H_2$, и $h_1 h_2 != h_2 h_1$, а следовательно $h_1 h_2 h_2^(-1) h_1^(-1) eq.not e$ $ h_1 h_2 h_1^(-1) h_2^(-1) in H_2 sect H_1 = {e}, #[где $h_1 h_2 h_1^(-1) in H_2, space h_2 h_1 ^(-1) h_2 ^(-1) in H_1$] $ ] #example[ $G = CC^*, H_1 = TT, H_2 = RR_+^*$, тогда: $ CC^* = TT RR_+^*, TT sect RR_+^* = \{1\} $ ] #ticket[Внешнее прямое произведение групп, связь с внутренним прямым произведением] #def[ Пусть $G_1, G_2$ --- группы, на их декартовом произведении $G_1 times G_2$ введем умножение: $(g_1, g_2) dot (g_1 ', g_2 ') = (g_1 g_1 ', g_2 g_2 ')$ Получили структуру группы. Она называется _внешним прямым произведением_ $G_1$ и $G_2$. ] #pr[ Пусть $G$ --- внутреннее прямое произведение подгрупп $H_1$ и $H_2$. Тогда если рассмотреть $ phi: H_1 times H_2 &--> G \ (h_1, h_2) &maps h_1 h_2 $ Тогда такое преобразование $phi$ --- изоморфизм. ] #proof[ - То, что $phi$ --- сюръекция, равносильно $ forall g: exists h_1 in H_1, h_2 in H_2: g = h_1 h_2 $ Это получилось по свойствам внутреннего произведения - $phi$ --- инъекция тогда и только тогда, когда такие $h_1$ и $h_2$ единственны, это можно понять из предыдущего предложения - Остается проверить, что $phi$ --- гомоморфизм. $ phi((h_1, h_2) dot (h_1 ', h_2 ')) &= phi((h_1 h_1 ', h_2 h_2 ')) = \ &= h_1 h_1 ' h_2 h_2' underbrace(=, #[коммутативность\ внутр. произв.]) h_1 h_2 dot h_1 ' h_2 ' =\ &= phi((h_1, h_2)) dot phi((h_1 ', h_2)) $ ] #def[ Пусть $forall g quad exists! h_1 in H_1, h_2 in H_2: g = h_1 h_2$, $H_1 nsubg G$. Тогда $G$ называется _полупрямым произведением_ $H_1$ и $H_2$. Обозначается $G = H_1 times.three.l H_2$ если $H_1 nsubg G$ или $G = H_1 times.three.r H_2$ если $H_2 nsubg G$ и $G = H_1 times H_2$ если выполняется оба условия, что то же самое, что внутреннее прямое произведение. ] #examples[ + Рассмотрим группу ${phi : RR --> RR bar phi(x) = a x + b, a != b}$\ В качестве $H_1$ возьмем ${phi bar phi(x) = a x} < G$, $H_2 = {phi bar phi(x) = x + b} nsubg G$ + $G = S_n, space H_1 = A_n, space H_2 = gen((12))$ ] #notice[ Аналогично определяются прямые произведения нескольких сомножителей. Стоит лишь обратить внимание на свойство 2. Достаточно, чтобы $ forall i : H_i sect H_1 ... hat(H_i) ... H_n = {e}. $ Это более сильное условие, чем для пересечения каждой пары. Например, если рассмотреть подпространства $RR^2$ с базисами $vec(0, 1)$, $vec(1, 0)$ и $vec(1, 1)$, то они не будут образовывать прямое произведение. ]
https://github.com/kotatsuyaki/canonical-nthu-thesis
https://raw.githubusercontent.com/kotatsuyaki/canonical-nthu-thesis/main/template/thesis.typ
typst
MIT License
#import "@preview/canonical-nthu-thesis:0.1.0": setup-thesis #let ( doc, cover-pages, preface, outline-pages, body, ) = setup-thesis( // Metadata of the document, which is used in places such as the cover pages and the PDF properties. info: ( degree: "master", title-zh: [一個標題有點長的 \ 有趣的研究], title-en: [An Interesting Research \ With a Somewhat Long Title], department-zh: "某學系", department-en: "Mysterious Department", id: "012345678", author-zh: "張三", author-en: "<NAME>", supervisor-zh: "李四 教授", supervisor-en: "Prof. <NAME>", year-zh: "一一三", month-zh: "七", date-en: "July 2024", keywords-zh: ("關鍵詞", "列表", "範例"), keywords-en: ("example", "keywords", "list"), ), // Customizable styling options. style: ( // Margin sizes for all non-cover pages. margin: (top: 1.75in, left: 2in, right: 1in, bottom: 2in), // Whether to show a list of tables/figures in the `outline-pages()` function. outline-tables: true, outline-figures: true, // Whether to show the text "Draft version" and the date on the margin. show-draft-mark: false, ), ) #cover-pages() //////////////////////////////////////////////////////////////////////////////////////////////// // The preface, which contains the abstract, the acknowledgements, and the table(s) of contents. // 前言部分,包含摘要、誌謝、大綱及圖表目錄。 #show: preface = 摘要 此論文模板使用Typst @madje2022programmable\標記語言排版。請參閱隨附的README文件以及位於https://typst.app/docs/的文檔了解如何使用Typst。 // Fake abstract text. Delete it and fill in your actual abstract. 本文深入探討一個未指定領域的主題,深入研究一個模糊的概念及其複雜性。研究方法採用了難以理解的方式進行,所呈現的發現幾乎沒有清晰度或實質性的貢獻。這項工作的意義同樣模糊不清,讓讀者留下更多疑問而非答案。 關鍵詞:未指定領域、模糊概念、難以理解的方法、不清的發現、模糊的意義 #pagebreak() = Abstract This template for master theses / doctoral dissertations uses Typst @madje2022programmable. Refer to the README file and the upstream documentations at https://typst.app/docs/ to know more about Typst. // Fake generic text. Delete it and fill in your actual abstract. #lorem(150) #pagebreak() = 誌謝 // Fake acknowledgements text. Delete it and fill in your actual acknowledgements. 在完成這篇論文的過程中,我得到了許多人的幫助和支持。首先,我要感謝我的指導老師李四,是他悉心的指導和鼓勵,才讓我得以順利完成這篇論文。其次,我要感謝我的父母和家人,是他們無私的愛和支持,給了我堅持下去的力量。此外,還要感謝我的同學和朋友們,是他們在學習和生活上對我的幫助,讓我受益匪淺。 最後,我要感謝所有曾經幫助過我的人。正是有了大家的幫助,我才得以取得今天的成績。 #pagebreak() #outline-pages() /////////////////// // The main matter. // 本文部分。 #show: body = Introduction #figure( square(size: 100pt, fill: gradient.linear(..color.map.rainbow)), caption: [A figure to populate the image list], placement: bottom, ) #lorem(300) = Background == Important background #lorem(100) == Previous works #lorem(100) = Methods == An excellent method #figure( table( columns: 4, table.header([], [Apples], [Bananas], [Cherries]), [Alice], [1.0], [2.0], [3.0], [Bob], [1.5], [1.0], [0.5], [Eve], [3.5], [7.5], [1.2], ), caption: [A dummy table to populate the table index page], placement: bottom, ) #lorem(100) == Another method #lorem(100) = Experiments == Setup #lorem(100) == The results #lorem(100) = Conclusion #lorem(200) #bibliography("citations.bib", style: "ieee")
https://github.com/jneug/typst-codetastic
https://raw.githubusercontent.com/jneug/typst-codetastic/main/util.typ
typst
MIT License
#let to-arr(code) = { if type(code) == "integer" { code = str(code) } if type(code) == "string" { code = code.clusters().map(int) } if type(code) != "array" { panic("Code needs to be provided as integer, string or array. Got " + type(code)) } return code } #let to-int-arr(code) = { return to-arr(code).map(int) } #let weighted-sum(nums, weights) = { let w-func if type(weights) == "array" { w-func = (i) => { return weights.at(calc.rem(i, weights.len())) } } else if type(weights) == "function" { w-func = weights } return nums.enumerate().fold(0, (s,v) => { let (i, n) = (..v) s + n * w-func(i) }) } #let check-code( code, digits, generator, tester ) = { if code.len() == digits - 1 { code.push(generator(code)) } else if code.len() == digits { if not tester(code) { panic("Checksum failed for code " + repr(code) + ". Should be " + str(generator(code.slice(0,-1)))) } } else { panic("Code has to be " + (digits - 1) + " digits (excluding checksum). Got " + code.len()) } return code } #let place-code(cnt) = box(cnt) #let place-rect(x, y, width, height, fill: black) = place( dx: x, dy:y, rect(width: width, height: height, fill: fill, stroke: none) ) #let typst-align = align #let place-content(x, y, width, height, cnt, fill:white, align:center+horizon) = place( dx: x, dy:y, block(width: width, height: height, fill: fill, stroke: none, typst-align(align, cnt)) ) #let draw-bars(bits, bar-width:0.264mm, bar-height:18.28mm, bg: white, fg: black) = { let width = bits.len() * bar-width // Cluster bits to draw thick bars // as one rect bits = bits.fold((), (c, v) => { if v { if c == () or c.last() == 0 { c.push(1) } else { c.at(-1) += 1 } } else { c.push(0) } c }) let bar(i, n) = place( dx: i * bar-width, rect(width: n * bar-width, height: bar-height, fill:fg, stroke:none) ) box( width: width, height: bar-height, { place(rect( width: width, height: bar-height, fill:bg, stroke:none )) let i = 0 for bit in bits { if bit > 0 { bar(i, bit) i += bit } else { i += 1 } } } ) } /// Draw a bitfield of binary data as a 2d code matrix. /// /// Bits will be drawn from the top left to the bottom right. /// `bits.at(0).at(0)` is located at coordinate `(0,0)` and /// `bits.at(-1).at(-1)` is located at the last coordinate /// on the bottom right. #let draw-modules( bitfield, quiet-zone: 4, size: 1mm, bg: white, fg: black ) = { let (w, h) = (bitfield.first().len(), bitfield.len()) let (x, y) = (quiet-zone, quiet-zone) let (width, height) = ( (w+2*quiet-zone) * size, (h+2*quiet-zone) * size ) let module(i, j) = place( dx: (x + j) * size, dy: (y + i) * size, square(size:size, fill:fg, stroke: none) ) box( width: width, height: height, baseline: quiet-zone * size, { place(rect( width: width, height: height, fill:bg, stroke:none )) for i in range(h) { for j in range(w) { if bitfield.at(i).at(j) { module(i, j) } } } } ) }
https://github.com/jomaway/typst-gentle-clues
https://raw.githubusercontent.com/jomaway/typst-gentle-clues/main/lib/lib.typ
typst
MIT License
#import "clues.typ" #import "clues.typ": gentle-clues, clue #import "predefined.typ": *
https://github.com/SeniorMars/tree-sitter-typst
https://raw.githubusercontent.com/SeniorMars/tree-sitter-typst/main/readme.md
markdown
MIT License
# A tree-sitter parser for the typst file format This language is soooo hard to parse… whitespace, parenthesizes for everything, and Unicode :( DONE: - [O] Code mode: `#` to enter code mode - [x] any literal: `1`, `"hi"`, `true`, `false`, `none`, `auto` - [ ] raw and labels are literals - [x] code block: `{ x = 1 }` - [x] content block: `[ hello ]` - [x] parenthesized expression: `(1 + 2)` - [x] array: `(1, 2, 3)` - [x] dictionary: `(a: "hi", b: 2)` - [x] unary operator: `-x` - [x] binary operator: `x + y` - [x] assignment: `x = 1` - [x] variable access: `x` - [x] field access: `x.y` - [x] method call: `x.flatten()` - [x] named function: `let f(x) = 2 * x` - [x] unnamed function: `(x, y) => x + y` - [x] function call: `min(x, y)` - [x] let binding: `let x = 1` - [x] set rule: `set text(14pt)` - [x] set-if rule: `set text(..) if ..` - [x] show-set rule: `show par: set block(..)` - [x] show rule with function: `show par: set block(..)` - [x] show-everything rule: `show: set block(..)` - [x] conditional: `if x < 0 {0} else {x}` - [x] for loop: `for x in [1, 2, 3]` - [x] while loop: `while x < 10 {}` - [x] loop control flow: `break`, `continue` - [x] return from function: `return x` - [x] include module: `include "bar.typ"` - [x] import module: `import "bar.typ"` - [x] import items from module: `import "bar.typ": a, b, c` - [x] comment: `// hi` or `/* hi */`. - [ ] Math mode - [ ] Everything :) - [ ] Markup mode - [x] Whitespace (Unicode) - [x] paragraph break - [x] text (Unicode) - [x] emphasis - [x] strong - [x] italic - [x] label - [x] reference - [ ] raw text - [ ] inline - [ ] block - [ ] link - [ ] heading - [ ] bullet list - [ ] numbered list - [ ] term list - [ ] math - [x] line break - [ ] smart quote - [ ] single quote - [x] double quote - [ ] symbol shorthand - [x] code expression - [x] character escape - [x] comment. --- Outdated specification comes from: https://www.user.tu-berlin.de/laurmaedje/programmable-markup-language-for-typesetting.pdf I'll be using the textmate grammar as inspiration: https://github.com/typst/typst/blob/main/tools/support/typst.tmLanguage.json For myself, I'll paste it here: --- ## Typst Grammar Below is an approximate EBNF grammar for the Typst language that is based on our handwritten recursive descent parser. We follow these conventions: – Production names are all lowercase. – Text enclosed in single (') or double quotes (") defines a terminal. – * for an arbitrary number of repetitions. – + for at least one repetition. – ? for zero or one repetitions. – ! to negate a simple (character-class-like) production. – . to match an arbitrary character. – a - b to match anything that matches a but not b. – unicode(Property) to match any character that has the given unicode property. Note that comments and spaces are allowed almost everywhere within code constructs. For readability, this is omitted in the grammar. Moreover, the grammar omits the indentation rules for lists, as EBNF cannot handle context-sensitive constructs. ``` // Markup. markup ::= markup-node* markup-node ::= space | nbsp | shy | endash | emdash | ellipsis | quote | strong | emph | raw | link | math | heading | list | enum | desc // Markup nodes. nbsp ::= '~' shy ::= '-?' endash ::= '--' emdash = '---' ellipsis ::= '...' quote ::= "'" | '"' strong ::= '*' markup '*' raw ::= '`' (raw | .*) '`' link ::= 'http' 's'? '://' (!space)* math ::= ('$' .* '$') | ('$[' .* ']$') heading ::= '='+ space markup list ::= '-' space markup enum ::= digit* '.' space markup desc ::= '/' space markup ':' space markup ```
https://github.com/mariuslb/thesis
https://raw.githubusercontent.com/mariuslb/thesis/main/content/04-analyse.typ
typst
#import "../template.typ": Template, code #let translations = json("../translations.json").at("de") = Analyse Die Datenanalyse bildet den Kern der Untersuchung. Aufbauend auf den in den vorangegangenen Kapiteln beschriebenen detaillierten Datenerhebungen und standardisierten Testbedingungen, konzentriert sich dieser Abschnitt auf die systematische Verarbeitung und Analyse der gesammelten Daten. Der Prozess umfasst die Aggregation und Vorverarbeitung der Fahrdaten, die Analyse von Key Performance Indicators (KPIs), die Anwendung geeigneter statistischer Methoden und ML-Verfahren zur Bewertung der Hypothesen. == Datenaggregation und -vorverarbeitung Bei den erhaltenen Fahrdaten handelt es sich pro Fahrt um csv-Dateien, welche durch das LCMM-System z. T. bereits anhand von ISO 23795-1:2022 voraggregiert wurden. Die Daten enthalten beispielsweise i. d. R. sekündliche Informationen zu Zeitstempeln, Geschwindigkeiten, Beschleunigungen, Distanzen und Energieverbräuchen. Zunächst werden die Daten in die verwendete Analyseumgebung importiert und ein erster Überblick über die Struktur und den Inhalt der Datensätze gewonnen, z. B. durch ```R str(dataset)```. (Quelle) Da für die meisten Analysen die Zellen zum Spritverbrauch bzw. den daraus resultierenden CO2-Emissionen nicht benötigt werden und bei den Elektrofahrzeugen ohnehin leer sind, werden diese Spalten entfernt. Ebenso sind in der ersten Zeile einer Fahrtaufzeichnung einige 'NA'-Werte enthalten. Dies liegt daran, dass diese z. B. im Falle der Geschwindigkeit anhand der Differenz zum vorherigen Zeitpunkt berechnet werden, dieser jedoch nicht existiert. Solche Felder werden durch den Wert 0 ersetzt. Eine weitere Imputation ist nun nicht weiter notwendig, da die Daten dann vollständig und konsistent sind. Als nächster Schritt folgt die Zusammenführung der einzelnen Fahrten zu einem Gesamtdatensatz. Die einzelnen Datenpunkte werden mithilfe einer weiteren Spalte zu dem jeweiligen Fahrzeugtyp zugeordnet. Um vor den Analysen bereits einen ersten Überblick über die Daten zu erhalten, werden die Verteilung der Energieverbräuche nach Geschwindigkeit und Fahrzeugtyp visualisiert. Dies ermöglicht es, erste Unterschiede und Muster zu erkennen, die für die weiteren Analysen relevant sein könnten. #figure( caption: [Verteilung des Energieverbrauchs nach Geschwindigkeit und Fahrzeugtyp.], grid( columns: 3, gutter: 5pt, figure( image("../img/pre-analysis/energy_consumption_speed_golf.png") ), figure( image("../img/pre-analysis/energy_consumption_speed_mokka.png"), ), figure( image("../img/pre-analysis/energy_consumption_speed_all.png"), ), ) ) Die ersten beiden Abbildungen zeigen die Verteilung des Energieverbrauchs des VW Golf und des Opel Mokka E in Abhängigkeit von der Geschwindigkeit inklusive einer Trendlinie. Die dritte Abbildung zeigt die beiden Trendlinien in einem gezoomten Bereich, um Unterschiede besser sichtbar zu machen. Die hohe Variabilität des Energieverbrauchs bei verschiedenen Geschwindigkeiten, die in den Streudiagrammen für beide Fahrzeuge sichtbar wird, könnte durch unterschiedliche Fahrstile, Straßenbedingungen oder externe Faktoren wie Wetter bedingt sein. Die Ausreißer im Diagramm des Mokka e könnten auf spezifische Situationen oder Fehlmessungen hindeuten, die einer genaueren Untersuchung bedürfen. Insgesamt ist zu erkennen, dass der Energieverbrauch bei höheren Geschwindigkeiten tendenziell steigt, wobei der Mokka E im Vergleich zum Golf einen niedrigeren Energieverbrauch aufweist.Dies bietet eine erste Orientierung für die weiteren Analysen und Hypothesenprüfungen. == Key Performance Indicators In diesem Abschnitt werden die bereits definierten KPIs, wie der Energy Performance Index (EPI) und der Acceleration Performance Index (API), berechnet und analysiert, um die Hypothese 1 (H1) zu überprüfen. Diese KPIs ermöglichen es, Energieverbräuche norminalisert pro 100 km und Tonne zu vergleichen und die Effizienz der Fahrzeuge zu bewerten. === Energy Performance Index (EPI) Der EPI wird berechnet, indem die gesamte verbrauchte Energie (in kWh) durch die gesamte zurückgelegte Strecke (in 100 km) und das Gewicht des Fahrzeugs (in Tonnen) geteilt wird. Dadurch wird der durchschnittliche Energieverbrauch pro 100 km und Tonne Fahrzeuggewicht ermittelt. $ "EPI" = "Gesamte aufgewendete Energie (kWh)" / (("Gesamtstrecke (km)" / 100) * "Fahrzeuggewicht (t)") $ Die spezifische Implementierung sind im Anhang X zu finden. #figure( image("../img/epi-api/epi.png", width: 80%), caption: [Energy Performance Index zwischen Golf und Mokka.], ) Die obige Abbildung zeigt einen Vergleich des Energy Performance Index (EPI) zwischen einem VW Golf (Verbrennungsmotor) und einem Opel Mokka (Elektrofahrzeug). Die Boxplots verdeutlichen, dass der Opel Mokka E einen deutlich niedrigeren mittleren EPI-Wert (Median von etwa 11 kWh/100km*t) aufweist als der VW Golf (Median von etwa 12,5 kWh/100km*t). Der Interquartilsabstand (IQR) des Mokka erstreckt sich von etwa 10 bis 12 kWh/100km*t, während der IQR des Golfs von etwa 11,5 bis 13,5 kWh/100km*t reicht. Der Gesamtbereich der EPI-Werte des Golfs, einschließlich Ausreißern, liegt zwischen etwa 10 und 15 kWh/100km*t, wobei einige Ausreißer oberhalb von 15 kWh/100km*t zu erkennen sind. Im Gegensatz dazu zeigt der Mokka eine geringere Streuung der Werte, die von etwa 9 bis 13 kWh/100km*t reichen, mit einem Ausreißer oberhalb von 14 kWh/100km*t. Die Analyse des EPI zeigt somit, dass der Opel Mokka E im Vergleich zum VW Golf eine höhere Energieeffizienz aufweist, was auf seinen niedrigeren Energieverbrauch pro 100 km und Tonne Fahrzeuggewicht zurückzuführen ist. === Acceleration Performance Index (API) Der Acceleration Performance Index (API) ist ein weiterer wichtiger KPI, der den Energieverbrauch für Beschleunigungsmanöver normiert und zwischen Fahrzeugen vergleichbar macht. Der API wird berechnet, indem die gesamte Energie für Beschleunigungsmanöver (in kWh) durch die gesamte zurückgelegte Strecke (in 100 km) und das Gewicht des Fahrzeugs (in Tonnen) geteilt wird. $ "API" = "Gesamte Beschleunigungsenergie (kWh)" / (("Gesamtstrecke (km)" / 100) * "Fahrzeuggewicht (t)") $ Die spezifische Implementierung sind im Anhang X zu finden. #figure( image("../img/epi-api/api.png", width: 80%), caption: [Acceleration Performance Index zwischen Golf und Mokka.], ) Die obige Abbildung zeigt einen Vergleich des Acceleration Performance Index (API) zwischen den beiden Fahrzeugen. Die Boxplots verdeutlichen, dass der Opel Mokka einen deutlich niedrigeren mittleren API-Wert (Median von etwa 14 kWh/100km*t) aufweist als der VW Golf (Median von etwa 15,5 kWh/100km*t). Der Interquartilsabstand (IQR) des Mokka erstreckt sich von etwa 13 bis 15 kWh/100km*t, während der IQR des Golfs von etwa 14 bis 16 kWh/100km*t reicht. Der Gesamtbereich der API-Werte des Golfs, einschließlich Ausreißern, liegt zwischen etwa 13 und 17,5 kWh/100km*t, wobei einige Ausreißer oberhalb von 17,5 kWh/100km*t zu erkennen sind. Im Gegensatz dazu zeigt der Mokka eine größere Streuung der Werte, die von etwa 12 bis 18 kWh/100km*t reichen, mit einem Ausreißer unterhalb von 12,5 kWh/100km*t und einem weiteren oberhalb von 18 kWh/100km*t. Die Analyse des API zeigt somit, dass der Opel Mokka E im Vergleich zum VW Golf eine höhere Energieeffizienz bei Beschleunigungsmanövern aufweist, da er im Mittel weniger Energie für Beschleunigungen verbraucht. == Statistische Modellierung Die statistische Analyse und Modellierung der Fahrdaten ist entscheidend, um die Hypothesen zu überprüfen und die Unterschiede zwischen Elektrofahrzeugen (EVs) und Fahrzeugen mit Verbrennungsmotor (ICEs) zu quantifizieren. In diesem Abschnitt werden verschiedene statistische Methoden und Machine-Learning-Verfahren angewendet, um die Beziehung zwischen Fahrzeugtyp und Energieverbrauch zu untersuchen. === Lineare Regression Die lineare Regression ist eine grundlegende statistische Methode, die verwendet wird, um die Beziehung zwischen einer abhängigen Variable und einer oder mehreren unabhängigen Variablen zu modellieren. In diesem Kontext dient die lineare Regression dazu, den Energieverbrauch (TotalWork.J.) in Abhängigkeit von verschiedenen Einflussfaktoren wie Fahrzeugtyp, Distanz, Rollarbeit, Steigungsarbeit, Beschleunigungsarbeit und Beschleunigung zu untersuchen. Die Wahl der linearen Regression ermöglicht es, die Stärke und Richtung dieser Beziehungen quantitativ zu bestimmen und Vorhersagen über den Energieverbrauch basierend auf den unabhängigen Variablen zu treffen. ==== Auswahl der Variablen für das Regressionsmodell #grid( columns: 2, gutter: 5pt, figure( image("../img/reg/correlation_funnel.png", ), caption: [Korrelationsdiagramm der Variablen.], ), figure( image("../img/reg/correlation_selected_vars.png"), caption: [Korrelationsdiagramm der ausgewählten Variablen.], ) ) Die Auswahl der Variablen für das Regressionsmodell basiert auf ihrer theoretischen und empirischen Relevanz für den Energieverbrauch. Der Prozess der Variablenauswahl wurde durch die Analyse der Korrelationen zwischen den potenziellen Prädiktoren und dem Energieverbrauch unterstützt. Diese Korrelationen wurden in Form eines Correlation Funnels (Abbildung 8) und einer Korrelationsmatrix visualisiert, um die Stärke und Richtung der Zusammenhänge zu bewerten. Der Correlation Funnel (Abbildung 8) zeigt die Korrelationen der unabhängigen Variablen mit der abhängigen Variable (TotalWork.J.). Die im Bild dargestellten Variablen „GradeWork.J.“, „AccWork.J.“ und „Acceleration.m.s.2.“ haben die höchsten positiven Korrelationen mit dem Energieverbrauch. Diese Variablen wurden aufgrund ihrer signifikanten Korrelationen und ihres theoretischen Zusammenhangs mit dem Energieverbrauch ausgewählt. Abbildung 9 verdeutlicht zusätzlich die Korrelationen dieser ausgewählten Variablen untereinander. Es wird gezeigt, dass „GradeWork.J.“, „AccWork.J.“ und „Acceleration.m.s.2.“ starke Korrelationen aufweisen und somit wichtige Prädiktoren für den Energieverbrauch darstellen. Neben diesen Variablen wurde auch „Vehicle_Type“ in das Modell aufgenommen, obwohl es nicht in der höchsten Korrelation mit dem Energieverbrauch stand. Dies ist notwendig, um die Hypothese H1 zu überprüfen. „Vehicle_Type“ als Variable ermöglicht es, den Einfluss des Fahrzeugtyps direkt zu modellieren und die Unterschiede zwischen Elektrofahrzeugen und Verbrennerfahrzeugen zu quantifizieren. ==== Regressionsformel Die Regressionsformel für das Modell lautet wie folgt: $ "TotalWork.J." = beta_0 + beta_1 * "Vehicle_Type" + beta_2 * "GradeWork.J." \ + beta_3 * "AccWork.J." + beta_4 * "Acceleration.m.s.2." + epsilon $ ==== Bewertung des Regressionsmodells Das Regressionsmodell wurde mit den oben genannten Variablen geschätzt und die Ergebnisse wurden anhand verschiedener statistischer Metriken wie dem Bestimmtheitsmaß (R²), dem Adjusted R², dem F-Test und den p-Werten der Koeffizienten bewertet. #code( ```R Residuals: Min 1Q Median 3Q Max -5607 -2873 -1021 1653 127202 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.501e+03 2.406e+01 228.594 < 2e-16 *** Vehicle_TypeMokka e -6.474e+02 2.990e+01 -21.653 < 2e-16 *** GradeWork.J. 5.626e-01 2.095e-03 268.533 < 2e-16 *** AccWork.J. 5.653e-01 3.497e-03 161.673 < 2e-16 *** Acceleration.m.s.2. -1.267e+02 3.837e+01 -3.302 0.000961 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 4365 on 93384 degrees of freedom Multiple R-squared: 0.6916, Adjusted R-squared: 0.6916 F-statistic: 5.236e+04 on 4 and 93384 DF, p-value: < 2.2e-16 ```, caption: [Zusammenfassung des Regressionsmodells.], supplement: translations.codeausschnitt ) <glacier> Die Ergebnisse zeigen, dass das Modell etwa 69,16 % der Varianz im Energieverbrauch erklären kann (R² = 0.6916). Alle unabhängigen Variablen haben signifikante Koeffizienten mit sehr niedrigen p-Werten (p < 0.001), was ihre Bedeutung im Modell bestätigt. Der F-Statistik-Wert und der damit verbundene p-Wert (< 2.2e-16) weisen darauf hin, dass das Modell insgesamt signifikant ist. Die signifikanten Koeffizienten für die Variablen „Vehicle_Type“, „GradeWork.J.“, „AccWork.J.“ und „Acceleration.m.s.2.“ zeigen, dass diese Faktoren wichtige Determinanten des Energieverbrauchs sind. Insbesondere zeigt die negative Schätzung für „Vehicle_TypeMokka e“, dass der Mokka E im Vergleich zum Referenzfahrzeug (Golf) einen geringeren Energieverbrauch hat. Dies unterstützt die Annahme, dass Elektrofahrzeuge effizienter sind als Verbrennerfahrzeuge. Somit wird die Hypothese H1 unterstützt. === ANOVA Die ANOVA (Analysis of Variance) ist eine statistische Methode, die verwendet wird, um festzustellen, ob es signifikante Unterschiede zwischen den Mittelwerten von zwei oder mehr Gruppen gibt. In diesem Fall wurde eine einfaktorielle ANOVA durchgeführt, um den Unterschied im Energieverbrauch (TotalWork.J.) zwischen verschiedenen Fahrzeugtypen zu analysieren. ==== Durchführung der ANOVA #code( ```R > anova_result <- aov(TotalWork.J. ~ Vehicle_Type, data = combined_data) > summary(anova_result) Df Sum Sq Mean Sq F value Pr(>F) Vehicle_Type 1 5.925e+09 5.925e+09 96.01 <2e-16 *** Residuals 93387 5.763e+12 6.171e+07 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 ```, caption: [Zusammenfassung der ANOVA-Analyse.], supplement: translations.codeausschnitt ) <glacier> Die Ergebnisse der ANOVA zeigen, dass der Fahrzeugtyp einen signifikanten Einfluss auf den Energieverbrauch hat (F-Wert = 96.01, p < 2e-16). Dies bedeutet, dass es signifikante Unterschiede im Energieverbrauch zwischen den verschiedenen Fahrzeugtypen gibt. ==== Tukey-HSD-Test Um genauere Informationen über die Unterschiede zwischen den Fahrzeugtypen zu erhalten, wurde ein Tukey-HSD-Test (Tukey’s Honest Significant Difference Test) durchgeführt. Der Tukey-HSD-Test ist ein post-hoc-Test, der nach der ANOVA durchgeführt wird, um festzustellen, welche spezifischen Gruppen sich signifikant voneinander unterscheiden. Der Vorteil des Tukey-HSD-Tests liegt darin, dass er die Fehlerwahrscheinlichkeit kontrolliert und somit zuverlässigere Ergebnisse liefert, wenn mehrere paarweise Vergleiche durchgeführt werden. #code( ```R > tukey_result <- TukeyHSD(anova_result) > print(tukey_result) Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = TotalWork.J. ~ Vehicle_Type, data = combined_data) $Vehicle_Type diff lwr upr p adj Mokka e-Golf -527.2025 -632.6571 -421.7479 0 ```, caption: [Zusammenfassung des Tukey-HSD-Tests.], supplement: translations.codeausschnitt ) <glacier> Der Tukey-HSD-Test bestätigt, dass der Mokka E im Vergleich zum Golf einen signifikant niedrigeren Energieverbrauch aufweist (Differenz: -527.2025 J, p-Wert: 0). ==== Bewertung der ANOVA und des Tukey-HSD-Tests Die Ergebnisse der ANOVA und des Tukey-HSD-Tests bestätigen somit ebenso die Hypothese H1, dass Elektrofahrzeuge im Vergleich zu Verbrennerfahrzeugen einen geringeren Energieverbrauch haben. === Random Forest Die Random Forest Regression ist ein leistungsstarkes maschinelles Lernmodell, das für die Vorhersage kontinuierlicher Werte verwendet wird. Es basiert auf der Aggregation von Vorhersagen mehrerer Entscheidungsbäume, um die Genauigkeit und Robustheit der Vorhersagen zu erhöhen. In diesem Abschnitt wird das Random Forest Modell zur Vorhersage des Energieverbrauchs (TotalWork.J.) verwendet. Dazu werden die Daten zunächst in Trainings- und Testdaten aufgeteilt und norminalisert, um das Modell zu trainieren und zu validieren. Anschließend wird das Random Forest Modell mit den Trainingsdaten trainiert und auf den Testdaten getestet, um die Vorhersagegenauigkeit zu bewerten. ==== Durchführung des Random Forest Modells #code( ```R library(randomForest) normalize <- function(x) { return((x - min(x)) / (max(x) - min(x))) } train_data_norm <- train_data %>% select(-TotalWork.J.) %>% mutate_if(is.numeric, normalize) train_data_norm$TotalWork.J. <- train_data$TotalWork.J. set.seed(123) train_index <- createDataPartition(train_data_norm$TotalWork.J., p = 0.8, list = FALSE) train_set <- train_data_norm[train_index, ] test_set <- train_data_norm[-train_index, ] rf_model <- randomForest(TotalWork.J. ~ ., data = train_set, ntree = 100) rf_pred <- predict(rf_model, test_set) ```, caption: [Durchführung des Random Forest Modells.], supplement: translations.codeausschnitt ) <glacier> ==== Bewertung des Random Forest Modells Die Ergebnisse des Random Forest Modells zeigen eine hohe Vorhersagegenauigkeit mit einem RMSE (Root Mean Squared Error) von 765.93, einem MAE (Mean Absolute Error) von 205.62 und einem Bestimmtheitsmaß (R²) von 0.9909. Der RMSE in Prozent des durchschnittlichen Energieverbrauchs beträgt etwa 15.38 %, während der MAE in Prozent des gesamten Wertebereichs nur 0.095 % beträgt. Dies deutet darauf hin, dass das Modell die Energieverbräuche mit hoher Genauigkeit vorhersagen kann. #figure( image("../img/rf/average_consumption.png", width: 80%), caption: [Ergebnisse des Random Forest Modells zu den Testdaten.], ) Die Vorhersageergebnisse zeigen, dass der durchschnittliche Energieverbrauch des Mokka E 6,82 % niedriger ist als der des Golfs. Dies unterstützt erneut die Hypothese H1, dass Elektrofahrzeuge im Vergleich zu Verbrennerfahrzeugen einen geringeren Energieverbrauch aufweisen. === Gradient Boosting Machine (GBM) Gradient Boosting Machine (GBM) ist ein leistungsstarkes Ensemble-Lernverfahren, das schwache Lernalgorithmen, in der Regel Entscheidungsbäume, kombiniert, um ein starkes Vorhersagemodell zu erstellen. Es arbeitet iterativ, indem es jedes neue Modell auf die Fehler der vorherigen Modelle trainiert. ```r library(gbm) # GBM-Modell gbm_model <- gbm(Energy_kWh ~ Vehicle_Type + Speed_kmh + Acceleration.m.s.2. + Distance_km, data = combined_data, distribution = "gaussian", n.trees = 5000, interaction.depth = 4, shrinkage = 0.01, cv.folds = 5) ``` === XGBoost XGBoost (Extreme Gradient Boosting) ist ein optimierter verteilbarer Gradient Boosting Library, der speziell für Geschwindigkeit und Leistung entwickelt wurde. Es ist eine erweiterte Implementierung des Gradient Boosting Algorithmus, die Regularisierungsparameter verwendet, um Überanpassung zu vermeiden und die Leistung zu verbessern. ```r library(xgboost) # Datenaufbereitung data_matrix <- model.matrix(Energy_kWh ~ Vehicle_Type + Speed_kmh + Acceleration.m.s.2. + Distance_km, data = combined_data) labels <- combined_data$Energy_kWh # XGBoost-Modell xgb_model <- xgboost(data = data_matrix, label = labels, nrounds = 100, objective = "reg:squarederror") # XGBoost-Zusammenfassung summary(xgb_model) ``` == Vergleich mit WLTP-Werten Dieses Kapitel untersucht den Energieverbrauch von Fahrzeugen unter realen Fahrbedingungen im Vergleich zu den WLTP-Normwerten (Worldwide Harmonized Light Vehicles Test Procedure), um die Hypothese 2 (H2) zu überprüfen. === Berechnung des WLTP-Verbrauchs Zunächst wurden die Fahrten nach den WLTP-Grenzgeschwindigkeiten eingeteilt, um den Energieverbrauch in verschiedenen Geschwindigkeitsbereichen zu analysieren. Anschließend wurde der durchschnittliche Energieverbrauch in jedem Geschwindigkeitsbereich berechnet und mit den entsprechenden WLTP-Normwerten verglichen. Die Abweichung zwischen den realen Verbrauchswerten und den WLTP-Normwerten wurde in Prozent berechnet, um festzustellen, ob die Fahrzeuge die Normwerte einhalten oder überschreiten. Diese Ergebnisse wurden in Diagrammen visualisiert, um eine klare Darstellung der Abweichungen zu ermöglichen und die Unterschiede zwischen den Fahrzeugtypen zu verdeutlichen. Außerdem lag der Fokus auf der Verteilung der Verbrauchswerte in den verschiedenen WLTP-Kategorien, um zu verstehen, wie sich die Verbräuche über verschiedene Fahrbedingungen und -umgebungen verteilen. Dies ermöglichte es, festzustellen, ob bestimmte Bedingungen zu höheren oder niedrigeren Abweichungen vom WLTP-Normwert führen. Der zugehörige Code zur Berechnung und Analyse der WLTP-Werte ist im Anhang X zu finden. #pagebreak()
https://github.com/binhtran432k/ungrammar-docs
https://raw.githubusercontent.com/binhtran432k/ungrammar-docs/main/contents/literature-review/github-actions.typ
typst
#import "/components/glossary.typ": gls == Github Actions <sec-githubactions> GitHub Actions has emerged as a powerful and popular platform for automating software development workflows, including #gls("ci") and #gls("cd"). This section will explore the key features, benefits, and challenges of using GitHub Actions, focusing on its role in streamlining development processes and ensuring code quality. GitHub Actions is a valuable tool for automating #gls("ci")/#gls("cd") pipelines and improving software development workflows. Its versatility, scalability, and integration with the GitHub ecosystem make it a popular choice for developers of all levels. By leveraging GitHub Actions, we can streamline their development processes, enhance code quality, and accelerate time-to-market @bib-github-actions. === Key Features of GitHub Actions - *Workflow Automation*: GitHub Actions allows we to automate various development tasks, such as building, testing, and deploying our code. - *Customizable Workflows*: We can create custom workflows to match our specific project requirements and integrate with other tools and services. - *Pre-built Actions*: GitHub provides a marketplace of pre-built actions that can be easily integrated into our workflows. - *Integration with GitHub Ecosystem*: GitHub Actions seamlessly integrates with GitHub's other features, such as pull requests, issues, and releases. - *Scalability*: GitHub Actions can handle projects of all sizes, from small personal projects to large enterprise applications. === Benefits of Using GitHub Actions - *Increased Efficiency*: Automation of routine tasks reduces manual effort and accelerates development cycles. - *Improved Code Quality*: Regular testing and code analysis help identify and fix issues early in the development process. - *Simplified Deployment*: GitHub Actions can automate the deployment process, making it easier to release new versions of our software. - *Enhanced Collaboration*: GitHub Actions facilitates collaboration among team members by providing a shared platform for automation and testing. - *Cost-Effective*: GitHub Actions is a hosted service, eliminating the need for managing our own #gls("ci")/#gls("cd") infrastructure.
https://github.com/PraneethJain/Science-1
https://raw.githubusercontent.com/PraneethJain/Science-1/main/Assignment-4/2022101093_Assignment_4.typ
typst
#align(center, text(17pt)[*Science-1*]) #align(center, text(16pt)[Assignment-4]) #align(center, text(13pt)[<NAME>, 2022010193]) = Question 1 == (1) Kinetic Energy $ T = 1/2 m_1 dot(x)_1^2 + 1/2 m_2 dot(x)_1^2 $ Potential Energy $ V = 1/2 k_1 x_1^2 + 1/2 k_2 (x_2 - x_1)^2 $ Lagrangian $ L = T - V $ $ L = 1/2 m_1 dot(x)_1^2 + 1/2 m_2 dot(x)_2^2 - 1/2 k_1 x_1^2 - 1/2 k_2 (x_2 - x_1)^2 $ == (2) For $x_1$ $ (diff L) / (diff x_1) = -(k_1 + k_2) x_1 + k_2 x_2 $ $ d/(d t) (diff L) / (diff dot(x)_1) = m_1 diaer(x)_1 $ Lagrange equation for $x_1$ $ d/(d t) (diff L) / (diff dot(x)_1) = (diff L) / (diff x_1) $ $ m_1 diaer(x)_1 = -(k_1 + k_2) x_1 + k_2 x_2 $ For $x_2$ $ (diff L) / (diff x_2) = -k_2 x_2 + k_2 x_1 $ $ d/(d t) (diff L) / (diff dot(x)_2) = m_2 diaer(x)_2 $ Lagrange equation for $x_2$ $ d/(d t) (diff L) / (diff dot(x)_2) = (diff L) / (diff x_2) $ $ m_2 diaer(x)_2 = -k_2 x_2 + k_2 x_1 $ == (3) $ diaer(x)_1 = -(k_1 + k_2) / m_1 x_1 + k_2 / m_1 x_2 $ $ diaer(x)_2 = k_2 / m_2 x_1 - k_2 / m_2 x_2 $ In matrix form $ mat(diaer(x)_1; diaer(x)_2) = mat(-(k_1 + k_2)/m_1, k_2/m_1; k_2/m_2, -k_2/m_2) mat(x_1; x_2) $ We now find eigenvalues of $ A = mat(-(k_1 + k_2)/m_1, k_2/m_1; k_2/m_2, -k_2/m_2) $ $ |A - lambda I| = 0 $ $ |mat(-(k_1 + k_2)/m_1 - lambda, k_2/m_1; k_2/m_2, -k_2/m_2 - lambda)| = 0 $ $ ((k_1 + k_2)/m_1 + lambda)(k_2/m_2 + lambda) = k_2^2/(m_1 m_2) $ On solving the quadratic equation, we get $ lambda_1 = (sqrt((k_1 m_2 + k_2 m_1 + k_2 m_2)^2 - 4 k_1 k_2 m_1 m_2) - k_1 m_2 - k_2 m_1 - k_2 m_2)/(2 m_1 m_2) $ $ lambda_2 = (-sqrt((k_1 m_2 + k_2 m_1 + k_2 m_2)^2 - 4 k_1 k_2 m_1 m_2) - k_1 m_2 - k_2 m_1 - k_2 m_2)/(2 m_1 m_2) $ $ w_1^2 = -lambda_1, w_2^2 = -lambda_2 $ The normal mode frequencies are $ w_1 = sqrt(-lambda_1) $ $ w_2 = sqrt(-lambda_2) $ $ w_1 = sqrt(-(sqrt((k_1 m_2 + k_2 m_1 + k_2 m_2)^2 - 4 k_1 k_2 m_1 m_2) - k_1 m_2 - k_2 m_1 - k_2 m_2)/(2 m_1 m_2)) $ $ w_2 = sqrt(-(-sqrt((k_1 m_2 + k_2 m_1 + k_2 m_2)^2 - 4 k_1 k_2 m_1 m_2) - k_1 m_2 - k_2 m_1 - k_2 m_2)/(2 m_1 m_2)) $ = Question 2 #figure( image("pendulum.png", width: 30%) ) == (1) $ x = l sin(theta) $ $ dot(x) = l cos(theta) dot(theta) $ $ y = l(1 - cos(theta)) $ $ dot(y) = l sin(theta) dot(theta) $ Kinetic Energy $ T = 1/2 m dot(x)^2 + 1/2 m dot(y)^2 $ $ T = 1/2 m l^2 dot(theta)^2 $ Potential Energy with reference to bottom-most position $ V = m g l (1 - cos(theta)) $ Lagrangian $ L = T - V $ $ L = 1/2 m l^2 dot(theta)^2 - m g l (1 - cos(theta)) $ Generalised momentum $ p_theta = (diff L) / (diff dot(theta)) $ $ p_theta = m l^2 dot(theta) $ == (2) Hamiltonian $ H = sum p_i dot(q)_i - L $ $ H = p_theta dot(theta) - L $ We know that $dot(theta) = p_theta / (m l^2)$ $ L = 1/2 p_theta^2 / (m l^2) - m g l (1 - cos(theta)) $ $ H = p_theta^2/(m l^2) - 1/2 p_theta^2/(m l^2) + m g l (1 - cos(theta)) $ $ H = 1/2 p_theta^2/(m l^2) + m g l (1 - cos(theta)) $ $ H = 1/2 p_theta^2/(m l^2) + 2 m g l sin^2(theta/2) $ == (3) when $theta$ is small, $sin(theta) -> theta$ $ H = 1/2 p_theta^2/(m l^2) + 2 m g l (theta/2)^2 $ $ H = p_theta^2/(2 m l^2) + theta^2 / (2 / (m g l)) $ $ p_theta^2 / (2 m l^2 H) + theta^2 / ((2 H) /(m g l)) = 1 $ Since the total energy is constant (no energy loss), and the hamiltonian is equal to the total energy in this case, $H$ is also constant. #figure( image("ellipse.png", width: 50%) ) with $a = (2H)/(m g l) "and" b=2 m l^2 H$ = Question 3 == (1) In polar form, $ x = r cos(theta) $ $ dot(x) = dot(r) cos(theta) - r sin(theta) dot(theta) $ $ y = r sin(theta) $ $ dot(y) = dot(r) sin(theta) + r cos(theta) dot(theta) $ Kinetic Energy $ T = 1/2 m dot(x)^2 + 1/2 m dot(y)^2 $ $ T = 1/2 m (dot(r)^2 + r^2 dot(theta)^2) $ Lagrangian $ L = T - V $ $ L = 1/2 m (dot(r)^2 + r^2 dot(theta)^2) + alpha / r $ Generalised momentum corresponding to $r$ $ p_r = (diff L) / (diff dot(r)) = m dot(r) $ Generalised momentum corresponding to $theta$ $ p_theta = (diff L) / (diff dot(theta)) = m r^2 dot(theta) = A $ $ dot(theta) = A/(m r^2) $ Lagrange equation for $theta$ $ d/(d t) (diff L)/(diff dot(theta)) = (diff L)/(diff theta) $ $ d/(d t) m r^2 dot(theta) = 0 $ $therefore$ Angular momentum $A$ remains conserved throughout. Lagrange equation for $r$ $ d/(d t) (diff L)/(diff dot(r)) = (diff L)/(diff r) $ $ m diaer(r) = m r dot(theta)^2 - alpha/r^2 $ $ m diaer(r) = A^2/(m r^3) - alpha / r^2 $ $ m diaer(r) = - diff/(diff r) (A^2/(2 m r^2) - alpha/r) $ $ m diaer(r) = - (diff V_"eff")/(diff r) $ $ therefore V_"eff" = A^2/(2 m r^2) - alpha / r $ #figure( image("graph.png", width: 70%) ) Since the kinetic energy $T$ is always positive, the total energy $E$ is always greater than the potential energy $V$. $therefore$ Orbit will be bound for negative total energies as it is between $r_1$ and $r_2$. Otherwise, orbit will be unbound. Condition for orbit to be bound is $E < 0$ == (2) For a circular orbit, $r_1 = r_2 = r_0$. To find $r_0$, since it is minima $ (d V_"eff")/(d r)|_(r=r_0) = 0 $ $ alpha/r_0^2 = A^2 / (m r_0^3) $ $ r_0 = A^2 / (m alpha) $ The corresponding energy is $ E = A^2/(2 m r_0^2) - alpha / r_0 $ $ E = (A^2 m^2 alpha^2)/(2 m A^4) - (alpha m alpha)/ A^2 $ $ E = (m alpha^2) / (2 A^2) - (m alpha^2) / A^2 $ $ E = -(m alpha^2) / (2 A^2) $ == (3) The minimum and maximum radius $r_1$ and $r_2$ are the roots of the equation $E = V_"eff"$ where $E < 0$, as can be seen from the graph above. $ E = V_"eff" $ $ E = A^2 / (2 m r^2) - alpha / r $ $ 2 E m r^2 = A^2 - 2 alpha m r $ On solving the quadratic, we get $ r_"min" = (-2 alpha m + sqrt(4 alpha^2 m^2 + 8A^2 E m))/(4 E m) $ $ r_"max" = (-2 alpha m - sqrt(4 alpha^2 m^2 + 8A^2 E m))/(4 E m) $ In case $E > 0$, we only get a minimum radius $r_min$
https://github.com/Xiaole-An/personalResume
https://raw.githubusercontent.com/Xiaole-An/personalResume/main/README.md
markdown
# personalRresume ## Acknowledgments Thanks to previous open-sourced repo: [Chinese-Resume-in-Typst](https://github.com/OrangeX4/Chinese-Resume-in-Typst)
https://github.com/LEXUGE/typzk
https://raw.githubusercontent.com/LEXUGE/typzk/main/manual-thm.typ
typst
MIT License
#import "@typzk/zkgraph:0.1.0": * #import "@preview/physica:0.9.2": * #import "@preview/ctheorems:1.1.2": * #let ii = sym.dotless.i #let to = sym.arrow.r #let vb(body) = $bold(upright(body))$ #let cdot = sym.dot.c #let inv(body) = $body^(-1)$ #let conj(body) = $overline(body)$ #let mkThmNode(fn) = return (identity, desc, body, ..args) => node(identity, desc: desc, prefix: "", ..args, [#fn(desc, body)]) #let def = mkThmNode(thmbox("definition", "Definition", stroke: purple + 1pt)) #let thm = mkThmNode(thmbox("theorem", "Theorem", fill: color.lighten(orange, 70%))) #let postl = mkThmNode(thmbox("postulate", "Postulate", stroke: red + 1pt)) #show: set math.equation(numbering: "(1.1)") #set heading(numbering: "1.1.") #show heading: args => [#heading_subgraph(args) #counter(heading).display(args.numbering) #args.body #label(heading_to_label()) \ ] #show: thmrules = Simple Examples #figure(render_graph(), caption: [Example Graph]) <complete> @complete is rendered by ```typst #figure( render_graph(), caption: [Example Graph] ) ``` #pagebreak() = Quantum Mechanics == Postulates #postl( "hilbert_space", )[Hilbert Space][The states of quantum mechanical objects live in a Hilbert Space. The dimension of the Hilbert Space is determined by the complete set of commutative operators.\ ] #postl( "observable", links: ("sch_eqn",), )[Observables are Hermitian][Observables are represented by Hermitian operators with real eigenvalues.\ ] #postl( "measurement", )[Measurement][ Measurements are represented by projecting (and renormalizing) state vectors onto the corresponding eigenspaces. ] == Dynamics #def( "sch_eqn", back_links: ("hilbert_space",), )[Schrödinger equation][ Let $ket(phi(t)): RR to cal(H)$ describes the trajectory of some system with Hamiltonian $op(H)$, then $ ii hbar pdv(ket(phi(t)), t) = op(H) ket(phi(t)) $ ] #def("prob_current", back_links: ("sch_eqn",))[Probability Current][ $ vb(J) = hbar / m rho grad theta $ ] The thmbox can also be easily referenced just as normal: @prob_current, @hilbert_space by using labels: ```typst @prob_current, @hilbert_space```. #pagebreak() = Internal State The `digraphState` state variable has the value: #context digraphState.final() = Graph Generation Code The above graph is realized by ```typst #let mkThmNode(fn) = return (identity, desc, body, ..args) => node(identity, desc: desc, ..args, [#fn(desc, body)]) #let def = mkThmNode(thmbox("definition", "Definition", stroke: purple + 1pt)) #let postl = mkThmNode(thmbox("postulate", "Postulate", stroke: red + 1pt)) #show heading: args => [#heading_subgraph(args) #counter(heading).display(args.numbering) #args.body #label(heading_to_label()) \ ] = Quantum Mechanics == Postulates #postl( "hilbert_space", )[Hilbert Space][The states of quantum mechanical objects live in a Hilbert Space. The dimension of the Hilbert Space is determined by the complete set of commutative operators.\ ] #postl( "observable", links: ("sch_eqn",), )[Observables are Hermitian][Observables are represented by Hermitian operators with real eigenvalues.\ ] #postl( "measurement", )[Measurement][ Measurements are represented by projecting (and renormalizing) state vectors onto the corresponding eigenspaces. ] == Dynamics #def( "sch_eqn", back_links: ("hilbert_space",), )[Schrödinger equation][ Let $ket(phi(t)): RR to cal(H)$ describes the trajectory of some system with Hamiltonian $op(H)$, then $ ii hbar pdv(ket(phi(t)), t) = op(H) ket(phi(t)) $ ] #def("prob_current", back_links: ("sch_eqn",))[Probability Current][ $ vb(J) = hbar / m rho grad theta $ ] ```
https://github.com/alex-touza/fractal-explorer
https://raw.githubusercontent.com/alex-touza/fractal-explorer/main/paper/src/chapters/3_estudi_computacional_dels_objectes_fractals.typ
typst
#import "../environments.typ": * #import "../utilities.typ": * #import "../shortcuts.typ": * #import "@preview/cetz:0.2.2": canvas, draw = Estudi computacional dels objectes fractals Explicació de la part pràctica del projecte. == Generació de fractals === Exemple senzill de fractal <cap-exemple-gen-fractal> Com a demostració de la propietat d'autosimilitud, creem una fractal senzilla, que generarem de forma iterativa. Sigui $F_0$ la primera iteració de la nostra fractal. $F_0$ consistirà en un quadrat de costat $c$ a $RR^2$. #let my_fractal(n) = { canvas({ import draw: * line((0, 0), (5, 0), (5, -5), (0, -5), close: true) let p = (2.5, 0) for i in range(n) { line((2.5, 0), (2.5, -5)) } }) } #figure(caption: [Representació de $F_0$])[ #grid(columns: 2, gutter: 2em)[ #my_fractal(0) ][ #my_fractal(1) ] ] == Anàlisi algorísmic Complexitat temporal dels algoritmes per generar cada fractal. == Entorn de generació Explicació de com aplicar els algoritmes. Amb quin llenguatge, en quin entorn. També mostrar la interfície del programa.
https://github.com/SkytAsul/trombinoscope
https://raw.githubusercontent.com/SkytAsul/trombinoscope/main/pages/pageStats.typ
typst
MIT License
#show: it => align(horizon, it) #align(center)[ = Effectif des élèves-ingénieur·es\ (au début de l'année scolaire 2023/2024) ] #v(2em) #show table.cell: align.with(center) #show table.cell.where(x: 0): set text(weight: "bold") #set table( fill: (rgb("EAF2F5"), none) ) == 1#super[er] cycle #table( columns: 2, inset: (x: 1em), [1#super[ère] année], [300], [2#super[ème] année], [292], [*Total*], [592], ) #v(2em) #show table.cell.where(y: 0): set text(weight: "bold", size: 0.8em) #show table.cell.where(y: 4): set text(weight: "bold") #show table.cell.where(x: 9): set text(weight: "bold") == 2#super[ème] cycle #table( columns: (auto,) + (1fr,) * 9, inset: (x: 0.5em), [/], [EII], [E-SET], [E&T], [GCU], [GMA], [GPM], [INFO], [MA], [Total], [3ème Année], [38], [18], [23], [68], [68], [51], [71], [22], [359], [4ème Année], [46], [19], [35], [63], [68], [51], [72], [23], [377], [5ème Année], [46], [24], [43], [96], [87], [56], [71], [34], [457], [Total], [130], [61], [101], [227], [223], [158], [214], [79], [1193] ) #v(2em) #set text(size: 1.1em) Nombre d'élèves-ingénieur·es Sportifs de Haut Niveau : *112* Nombre d'élèves-ingénieur·es internationaux : *285* Nombre d'élèves-ingénieures : *591* #v(1em) *Nombre total d'élèves-ingénieur·es : 1785* #pagebreak() #columns(2)[ *À l'INSA, il y a :* - 15 Thomas - 13 Camille - 12 Clément - 11 Théo et Alexandre - 10 <NAME> et Arthur - 9 Titouan, Léo, Pierre, Romain et Emma - 8 Valentin, Lucas, Paul, Maxime - 7 Eva, Pauline, Louis et Jules #colbreak() *Parmi les dates recueillies :* - 8 personnes sont nées le 13 avril, le 23 janvier et le 15 mars. - 7 personnes sont nées le 4 août et le 19 février. - 2 personnes sont nées le 29 février - seules 71 personnes ont une date de naissance unique - 267 personnes sont nées le même jour que quelqu'un d'autre ] #v(3em) #figure(image("stats/birth months.svg", width: 90%), caption: "Répartition des mois de naissance", supplement: none)
https://github.com/alberto-lazari/cv
https://raw.githubusercontent.com/alberto-lazari/cv/main/modules_en/education.typ
typst
#import "/common.typ": * #let unipd-logo = image("/images/unipd.png") = Education #entry( title: [Master of Science, Computer Science], society: [University of Padua], date: [Oct 2022 - Present], logo: unipd-logo, description: [Major: Programming Languages and Systems], tags: ("OCaml", "Android Security", "Java", "Python", "Typst"), ) #entry( title: [Bachelor of Science, Informatica (Computer Science)], society: [University of Padua], date: [Oct 2019 - Jul 2022], logo: unipd-logo, description: [Grade: 110 cum laude], tags: ("Qt", "C++", "Java", "Spring Boot", "Git"), )
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/docs-shiroa/g-exam-doc/latexmit/latexmit-without-spaces.typ
typst
MIT License
#import "mod.typ": * #show: book-page.with(title: "LaTeX Mit without spaces") = LaTeX Mit without spaces
https://github.com/mcarifio/explore.typst
https://raw.githubusercontent.com/mcarifio/explore.typst/main/README.md
markdown
# explore.typst tbs explore.typst
https://github.com/AxiomOfChoices/Typst
https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Courses/Math%2018_785%20-%20Number%20Theory/Assignments/Assignment%205.typ
typst
#import "/Templates/generic.typ": latex, header #import "@preview/ctheorems:1.1.0": * #import "/Templates/math.typ": * #import "/Templates/assignment.typ": * #show: doc => header(title: "Assignment 5", name: "<NAME>", doc) #show: latex #show: NumberingAfter #show: thmrules #let col(x, clr) = text(fill: clr)[$#x$] #let pb() = { pagebreak(weak: true) } #set page(numbering: "1") #let bar(el) = $overline(#el)$ #set enum(numbering: "(a)") // #show math.equation: set text(font: "Latin Modern Math") *Sources consulted* \ Classmates: <NAME>. He helped a lot with questions 3 and 4.\ Texts: Class Notes, Algebraic Number Theory by Milne, Elementary and Analytic Theory of Algebraic Numbers by Narkiewicz, Number Fields by Marcus. = Question == Statement Let $n > 1$ be an integer. Show that there are infinitely many primes $p equiv 1 mod n$. == Solution Assume there are finitely many, let $P$ be their product and consider $phi.alt_n$, the $n$-th cyclotomic polynomial. We know that $phi.alt_n (2 x n P)$ is a non-constant polynomial in $x$ and thus for some $x$ it gives a value which is divisible by a prime. Now $phi.alt_n (2 x n P) divides (2 x n P)^n - 1$ which is always odd so we may assume that there exists an odd prime $p$ and an $x$ such that $p divides phi_n (2 x n P)$. Now we know that because $p divides (2 x n P)^n - 1$ then $p divides.not 2 x n P$ so we know that $(p)$ cannot be ramified in $QQ(zeta_n)$ (see Neukirch 10.4), then we know that $ phi.alt_n (2 x n P) = 0 mod p. $ and so $X - 2 x n P$ is a factor of of $phi.alt_n (X) mod p$ so $(p, zeta_n - 2 x n P)$ is a prime over $(p)$. But now the Galois group acts transitively on the primes over $(p)$ so we can generate all the primes over $(p)$. All will be of the form $(p, zeta_n^i - 2 x n P)$ and so they all have degree 1, this will then give a total splitting of $(p)$. But again by Neukirch this would imply that $p = 1 mod n$ which is impossible because then $p divides P$ and thus $p divides 2 x n P$. = Question == Statement Let $L slash K$ be a finite Galois extension of number fields. Prove that if $K$ has any inert prime, then $Gal(L slash K)$ is cyclic. == Solution If $frak(p)$ is inert then we get an isomorphism chain $ (ZZ quo n ZZ)^times iso Gal((cal(O)_L quo frak(p)) slash (cal(O)_K quo frak(p))) iso D_frak(p) iso Gal(L slash K) $ where the second isomorphism is because of the SES $ 0 -> I_frak(p) -> D_frak(p) -> Gal((cal(O)_L quo frak(p)) slash (cal(O)_K quo frak(p))) -> 0, $ and the third holds because any automorphism of $L$ must map the primes over $frak(p)$ to themselves, and so every automorphism of $L$ fixes $frak(p)$ and thus is in $D_frak(p)$. = Question == Statement Let $L slash K$ be a finite extension of number fields. Show that a prime of $K$ splits completely in $L$ if and only if it splits completely in the normal closure of $L slash K$. == Solution Lets name $N$ the normal closure of $L slash K$ and let $frak(q)$ be a prime in $N$ lying over $frak(p) := frak(q) sect cal(O)_K$. If $frak(q)$ splits completely over $N$ then we know that $ [cal(O)_N quo frak(q) : cal(O)_K quo frak(p)] = 1 $ but since $ [cal(O)_N quo frak(q) : cal(O)_K quo frak(p)] = [cal(O)_N quo frak(q) : cal(O)_L quo (frak(q) sect cal(O)_L)] [cal(O)_L quo (frak(q) sect cal(O)_L) : cal(O)_K quo frak(p)] $ and so both these degrees are equal to $1$ and so in particular $f_(frak(q) sect cal(O)_L) = 1$. A similar argument applies to the exponents, giving us $e_(frak(q) sect cal(O)_L) = 1$. And since this applies to every prime $frak(q)'$ over $frak(p)$, we get that $frak(p)$ is split over $L$. On the other hand assume that it is split over $L$, then set $H = Gal(N slash L)$ and consider the set of double cosets $H backslash Gal(N slash L) slash D_(frak(q))$, as in equivalence classes of the relation $x tilde h x d$ for all $h in H, d in D_(frak(q))$. This set has a natural map to the set $P$ of prime ideals of $cal(O)_L$ over $frak(p)$, given by $ g : H x D_(frak(q)) |-> (x frak(q)) sect cal(O)_L $ this map is certainly a surjection because $N$ is normal, any prime over $frak(p)$ can be mapped to any other. On the other hand, it is also an injection, since if $(x frak(q)) sect cal(O)_L = (y frak(q)) sect cal(O)_L$ then since they are two primes in $cal(O)_L$ by normality of $N$ we know that for some $z in H$ we have $z x frak(q) = y frak(q)$. Then $y^(-1) z x$ clearly fixes $frak(q)$ so it is contained in $D_frak(q)$. We now know that $x = z^(-1) y (y^(-1) z x)$ and so $x tilde y$. Now since we assumed that $frak(p)$ is totally split over $cal(O)_L$ then we must have $ H backslash Gal(N slash L) slash D_frak(q) = abs(P) = [L : K] $ but we know that every double coset of $H backslash Gal(N slash L) slash D_frak(q)$ is union of cosets of $H backslash Gal(N slash L)$ which itself has cardinality $[G : H] = [L : K]$ by Galois theory. Thus every double coset is in fact a single right coset of $H$ which implies that for every $h x d$ there exists some $h' in H$ such that $ h x d = h' x => x d x^(-1) = h^(-1) h' $ so $H$ contains all conjugates of $D_frak(q)$, and hence the set of conjugates of $D_frak(q)$ is a subgroup of $G$ contained in $H$. Hence $H$ contains some normal subgroup $H'$, but such a normal subgroup would correspond to a normal field extension of $L$ but is strictly contained in $N$ if $H'$ is non-trivial. This is not possible, however, because this contradicts the assumption that $N$ is the normal closure. We thus must have $H'$ be trivial and hence $D_frak(q)$ must be trivial. This then implies that $frak(p)$ splits completely over $N$. = Question == Statement Let $L slash K$ be a finite Galois extension of number fields. For a prime $frak(q)$ of $cal(O)_L$, let $frak(p)$ be the unique prime of $cal(O)_K$ below $frak(q)$. Suppose that $frak(q)$ is unramified. + Show that there is a unique element $Frob_(frak(q), L quo K) in Gal(L slash K)$, called the Frobenius automorphism associated to $frak(q)$, such that $ Frob_(frak(q), L slash K) (x) equiv x^(p^m) mod frak(q) $ holds for all $x in cal(O)_L$, where $p^m$ is the number of elements in the residue field $cal(O)_K quo frak(p)$. Show that the decomposition group of $frak(q)$ is the cyclic group generated by $Frob_(frak(q), L quo K)$. + Let $M$ be a subfield extension of $L slash K$, Galois over $K$. Let $frak(q)_M$ be the prime $frak(q) sect cal(O)_M$. Then show that $Frob_(frak(q)_M, M slash K)$ is the image of the restriction of $Frob_(frak(q), L slash K)$ to $M$. == Solution We have, since $frak(q)$ is unramified, $ D_frak(q) iso Gal((cal(O)_L quo frak(q)) slash (cal(O)_K quo frak(q))) $ and we also have the injection $ D_frak(q) into Gal(L slash K). $ Now $Gal((cal(O)_L quo frak(q)) slash (cal(O)_K quo frak(q)))$ is generated by $x |-> x^(p^m)$ because this is the smallest iterate of the Frobenius map that that fixes all elements of $cal(O)_K quo frak(q)$. Then the image of this map under the injection is exactly the map $Frob_(q, L quo K)$ we are looking for. Uniqueness is immediate since $x |-> x^(p^m)$ is the only element of $Gal((cal(O)_L quo frak(q)) slash (cal(O)_K quo frak(q)))$ that acts this way. Next assume that $M$ is a Galois subfield extension of $L slash K$. We have that since $M$ is Galois, any element of $Gal(L slash K)$ must fix $M$, hence must fix $cal(O)_M$. We thus know that $Frob_(frak(q), L slash K)$ restricted to $M$ is an element of $Gal(M slash K)$, and we clearly also have $ Frob_(frak(q), L slash K)|_(M) (x) equiv x^(p^m) mod M sect frak(q) $ so by uniqueness above we get that $Frob_(frak(q), L slash K)|_M = Frob_(frak(q)_M, M slash K)$. = Question == Statement + Let $p$ be an odd prime, and define $p^* := (-1)^((p-1)/2) p$. Prove that $QQ(sqrt(p^*))$ is the unique quadratic subfield of $QQ(zeta_p)$. + Let $n > 1$ be an integer, let $p$ be a prime that does not divide $n$. Prove that the Frobenius automorphism for any prime above $p$ is the class $p mod n in (ZZ quo n ZZ)^times$ under _the_ canonical isomorphism $(ZZ quo n ZZ)^times iso Gal(QQ(zeta_n) quo QQ)$. + Deduce the quadratic reciprocity: for any odd prime $p != q$, we have $ (p/q) (q/p) = (-1)^((p-1)/2 (q-1)/2). $ == Solution + We know that the discriminant of $QQ(zeta_p)$ is $p^(p-2)$, so if $QQ(alpha)$ is a quadratic subfield its discriminant must be divide $p^(p-2)$. Now let $K = QQ(sqrt(n))$ be a quadratic field, we either have $Delta_K = n$ if $n = 1 mod 4$ or $Delta_K = 4 n$ if $n = 2,3 mod 4$. So since $p$ is odd we may assume that $n = 1 mod 4$, and that $n divides p^(p-2)$. Now since $n$ is square free this means $n = plus.minus p$. Now if $p = 1 mod 4$ then we must have $n = p$, and if $p = 3 mod 4$ then we have $n = -p$ and it is easy to see that $(-1)^((p-1)/2) p$ matches both cases. It remains to show that $QQ(sqrt(p^*))$ is indeed a quadratic subfield, we saw in the previous assignment that $sqrt(plus.minus p)$ is contained in $QQ(zeta_p)$ so the result follows immediately. + We know that elements $sigma$ of the Galois group $Gal(QQ(zeta_n) slash QQ)$ are uniquely determined by where they send $zeta_n$, namely $sigma |-> k in (ZZ quo n ZZ)^times$ if and only if $sigma(zeta_n) = sigma(zeta_n^k)$. Now we can check that for the case $k = p$ the action can be computed as $ sigma(sum_(i=0)^(n-1) a_i zeta_n^i) = sum_(i=0)^(n-1) a_i zeta_n^(p i) $ but also $ (sum_(i=0)^(n-1) a_i zeta_n^i)^p = sum_(i=0)^(n-1) a_i^p zeta^(p i)_n + p dot (...) $ and so for any prime $frak(p)$ lying above $(p)$ we get that these two are equal, and so the Frobenius element of $frak(p)$ is indeed the one corresponding to $p$ in $(ZZ quo n ZZ)^times$. + Consider the field extension $K = QQ(sqrt(p^*))$, a question in assignment 1 shows that $(q)$ splits inside $cal(O)_K$ if and only if $(p^* /q) = 1$. On the other hand we know that $L = QQ(zeta_p)$ is an extension of $K$, so $(q)$ splits in $K$ if and only if the decomposition group $D_(L slash QQ, (q))$ fixes $K$. Now since $K$ is quadratic, it is fixed by an element $sigma in Gal(L slash QQ)$ if and only if $sigma$ is a square, so since $D_(L slash QQ, (q)) = gen(q mod p)$ we get that this group consists solely of squares if and only if $q$ is a square $mod p$, which is equivalent to $(q/p) = 1$. This shows that $ (p^* /q) = 1 <=> (q/p) = 1 "which implies" (p^* /q) (q/p) = 1 $ and expanding the definition of $p^*$ we get $ 1 = (p^* /q) (q/p) = (-1/q)^((p-1)/2) (p/q) (q/p) = ((-1)^((q-1)/2))^((p-1)/2) (p/q) (q/p) = (-1)^( (q-1)/2 (p-1)/2 ) (p/q) (q/p) $
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/droplet/0.2.0/src/util.typ
typst
Apache License 2.0
// Elements that can be split and have a 'body' field. #let splittable = (strong, emph, underline, stroke, overline, highlight) // Element function of spaces. #let space = [ ].func() // Converts the given content to a string. #let to-string(body) = { if type(body) == str { body } else if body.has("text") { to-string(body.text) } else if body.has("child") { to-string(body.child) } else if body.has("children") { body.children.map(to-string).join() } else if body.func() in splittable { to-string(body.body) } else if body.func() == smartquote { // Unfortunately, we can only use "dumb" quotes here. if body.double { "\"" } else { "'" } } else if body.func() == enum.item { if body.has("number") { str(body.number) + ". " + to-string(body.body) } else { "+ " + to-string(body.body) } } else if body.func() == space { " " } } // Attaches a label after the split elements. // // The label is only attached to one of the elements, preferring the second // one. If both elements are empty, the label is discarded. If the label is // empty, the elements remain unchanged. #let attach-label((first, second), label) = { if label == none { (first, second) } else if second != none { (first, [#second#label]) } else if first != none { ([#first#label], second) } else { (none, none) } }
https://github.com/lxl66566/my-college-files
https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/机器视觉实践/报告/2/2.typ
typst
The Unlicense
#import "../template.typ": * #show: project.with( title: "1", authors: ("absolutex",), ) = 机器视觉实践 二 == 实验目的 图像马赛克: + 编程实现图像局部区域马赛克 + 要求算法具有交互性,能指定局部区域和马赛克大小 + 具体实现方法不限 + 编程语言不限,可通过C++,Python 或 Matlab 实现 == 实验内容 马赛克的实现原理非常简单,遍历图像的每个像素,并根据马赛克块的大小进行分组。对于每个马赛克块,计算该块内所有像素的平均颜色值,或使用块内某个像素的颜色值。 #include_code("../src/mosaic/__init__.py") 我用了两种方法,第一个是使用鼠标笔刷绘制马赛克区域,第二个是矩形区域。绘制过程中可以使用鼠标滚轮调节马赛克块的大小。 每一个马赛克块都使用其中心点作为马赛克的颜色,这样可以减少一点计算量。 == 实验结果 #figure( image("brush.jpg", width: 100%), caption: [笔刷绘制马赛克 效果图], ) #figure( image("square.jpg", width: 100%), caption: [矩形区域绘制马赛克 效果图], ) == 心得体会 实践过程中发现有拖影的情况,即前面一次使用的马赛克色块在后续过程中又被使用,造成颜色重复的现象。解决这个问题需要在绘制马赛克时从原图像上采样,而不能从绘制后的图像上采样;并且采样点不能选择马赛克块的边缘点,而是需要选择中心点。
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/187.%20cred.html.typ
typst
cred.html Coronavirus and Credibility April 2020I recently saw a video of TV journalists and politicians confidently saying that the coronavirus would be no worse than the flu. What struck me about it was not just how mistaken they seemed, but how daring. How could they feel safe saying such things?The answer, I realized, is that they didn't think they could get caught. They didn't realize there was any danger in making false predictions. These people constantly make false predictions, and get away with it, because the things they make predictions about either have mushy enough outcomes that they can bluster their way out of trouble, or happen so far in the future that few remember what they said.An epidemic is different. It falsifies your predictions rapidly and unequivocally.But epidemics are rare enough that these people clearly didn't realize this was even a possibility. Instead they just continued to use their ordinary m.o., which, as the epidemic has made clear, is to talk confidently about things they don't understand.An event like this is thus a uniquely powerful way of taking people's measure. As <NAME> said, "It's only when the tide goes out that you learn who's been swimming naked." And the tide has just gone out like never before.Now that we've seen the results, let's remember what we saw, because this is the most accurate test of credibility we're ever likely to have. I hope.Finnish TranslationGerman TranslationFrench Translation
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/159.%20ecw.html.typ
typst
ecw.html How to Be an Expert in a Changing World December 2014If the world were static, we could have monotonically increasing confidence in our beliefs. The more (and more varied) experience a belief survived, the less likely it would be false. Most people implicitly believe something like this about their opinions. And they're justified in doing so with opinions about things that don't change much, like human nature. But you can't trust your opinions in the same way about things that change, which could include practically everything else.When experts are wrong, it's often because they're experts on an earlier version of the world.Is it possible to avoid that? Can you protect yourself against obsolete beliefs? To some extent, yes. I spent almost a decade investing in early stage startups, and curiously enough protecting yourself against obsolete beliefs is exactly what you have to do to succeed as a startup investor. Most really good startup ideas look like bad ideas at first, and many of those look bad specifically because some change in the world just switched them from bad to good. I spent a lot of time learning to recognize such ideas, and the techniques I used may be applicable to ideas in general.The first step is to have an explicit belief in change. People who fall victim to a monotonically increasing confidence in their opinions are implicitly concluding the world is static. If you consciously remind yourself it isn't, you start to look for change.Where should one look for it? Beyond the moderately useful generalization that human nature doesn't change much, the unfortunate fact is that change is hard to predict. This is largely a tautology but worth remembering all the same: change that matters usually comes from an unforeseen quarter.So I don't even try to predict it. When I get asked in interviews to predict the future, I always have to struggle to come up with something plausible-sounding on the fly, like a student who hasn't prepared for an exam. [1] But it's not out of laziness that I haven't prepared. It seems to me that beliefs about the future are so rarely correct that they usually aren't worth the extra rigidity they impose, and that the best strategy is simply to be aggressively open-minded. Instead of trying to point yourself in the right direction, admit you have no idea what the right direction is, and try instead to be super sensitive to the winds of change.It's ok to have working hypotheses, even though they may constrain you a bit, because they also motivate you. It's exciting to chase things and exciting to try to guess answers. But you have to be disciplined about not letting your hypotheses harden into anything more. [2]I believe this passive m.o. works not just for evaluating new ideas but also for having them. The way to come up with new ideas is not to try explicitly to, but to try to solve problems and simply not discount weird hunches you have in the process.The winds of change originate in the unconscious minds of domain experts. If you're sufficiently expert in a field, any weird idea or apparently irrelevant question that occurs to you is ipso facto worth exploring. [3] Within Y Combinator, when an idea is described as crazy, it's a compliment—in fact, on average probably a higher compliment than when an idea is described as good.Startup investors have extraordinary incentives for correcting obsolete beliefs. If they can realize before other investors that some apparently unpromising startup isn't, they can make a huge amount of money. But the incentives are more than just financial. Investors' opinions are explicitly tested: startups come to them and they have to say yes or no, and then, fairly quickly, they learn whether they guessed right. The investors who say no to a Google (and there were several) will remember it for the rest of their lives.Anyone who must in some sense bet on ideas rather than merely commenting on them has similar incentives. Which means anyone who wants such incentives can have them, by turning their comments into bets: if you write about a topic in some fairly durable and public form, you'll find you worry much more about getting things right than most people would in a casual conversation. [4]Another trick I've found to protect myself against obsolete beliefs is to focus initially on people rather than ideas. Though the nature of future discoveries is hard to predict, I've found I can predict quite well what sort of people will make them. Good new ideas come from earnest, energetic, independent-minded people.Betting on people over ideas saved me countless times as an investor. We thought Airbnb was a bad idea, for example. But we could tell the founders were earnest, energetic, and independent-minded. (Indeed, almost pathologically so.) So we suspended disbelief and funded them.This too seems a technique that should be generally applicable. Surround yourself with the sort of people new ideas come from. If you want to notice quickly when your beliefs become obsolete, you can't do better than to be friends with the people whose discoveries will make them so.It's hard enough already not to become the prisoner of your own expertise, but it will only get harder, because change is accelerating. That's not a recent trend; change has been accelerating since the paleolithic era. Ideas beget ideas. I don't expect that to change. But I could be wrong. Notes[1] My usual trick is to talk about aspects of the present that most people haven't noticed yet.[2] Especially if they become well enough known that people start to identify them with you. You have to be extra skeptical about things you want to believe, and once a hypothesis starts to be identified with you, it will almost certainly start to be in that category.[3] In practice "sufficiently expert" doesn't require one to be recognized as an expert—which is a trailing indicator in any case. In many fields a year of focused work plus caring a lot would be enough.[4] Though they are public and persist indefinitely, comments on e.g. forums and places like Twitter seem empirically to work like casual conversation. The threshold may be whether what you write has a title. Thanks to <NAME>, <NAME>, and <NAME> for reading drafts of this.Spanish TranslationArabic Translation
https://github.com/jskherman/jsk-lecnotes
https://raw.githubusercontent.com/jskherman/jsk-lecnotes/main/README.md
markdown
Apache License 2.0
# README This is a lecture notes template that uses Typst to generate a PDF document. This is based off of [<NAME>](https://github.com/sara-venkatraman)'s [lecture notes template in LaTeX](https://github.com/sara-venkatraman/LaTeX-Templates#lecture-notes). There are some custom functions that are defined in the [`template.typ`](./template.typ) file that are used to add some markup. Additionally, here is [a link to Typst snippets files for VS Code and Vim/Neovim](https://www.jskherman.com/blog/typst-snippets/) converted from [Gilles Castel's LaTeX snippets](https://castel.dev/post/lecture-notes-1/) to make writing math in Typst more convenient. ## Preview See [example PDF](https://github.com/jskherman/jsk-lecnotes/releases/latest/download/example.pdf) in the Releases section. <a href="https://github.com/jskherman/jsk-lecnotes/releases/latest/download/example.pdf"> <img src="https://github.com/jskherman/jsk-lecnotes/assets/68434444/670d66c6-377b-4eea-bb6d-38ace128a66e" width="400"/> <img src="https://github.com/jskherman/jsk-lecnotes/assets/68434444/1eb03907-80c8-4803-8cf8-c23141b0938c" width="400"/> </a> ## Usage 1. Download a copy of the [`template.typ`](./template.typ) file and [`example.typ`](./example.typ). 2. Copy these files to your project's root directory. 3. Rename and customize the `example.typ` file to get started using the template. ### Notes > **Warning** > > If you plan to split your document into multiple files for organization, you may need to add `#import "template.typ": *` to the top of each file for certain functions to work such as `blockquote()` or `iboxed()`. > > For example, assuming you have a `./content/chapter.typ` file and a `./template.typ` file at the project root, you would need to add `#import "../template.typ": *` to the top of the file.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/touying/0.3.2/themes/aqua.typ
typst
Apache License 2.0
#import "../slide.typ": s #import "../utils/utils.typ" #import "../utils/states.typ" #import "../utils/components.typ" #let title-slide(self: none, ..args) = { self = utils.empty-page(self) self.page-args += ( margin: (top: 30%, left: 17%, right: 17%, bottom: 0%), background: utils.call-or-display(self, self.aqua-background), ) let info = self.info + args.named() let content = { set align(center) stack( spacing: 3em, if info.title != none { text(size: 48pt, weight: "bold", fill: self.colors.primary, info.title) }, if info.author != none { text(fill: self.colors.primary-light, size: 28pt, weight: "regular", info.author) }, if info.date != none { text( fill: self.colors.primary-light, size: 20pt, weight: "regular", utils.info-date(self), ) } ) } (self.methods.touying-slide)(self: self, repeat: none, content) } #let outline-slide(self: none, enum-args: (:), leading: 50pt) = { self = utils.empty-page(self) self.page-args += ( background: utils.call-or-display(self, self.aqua-background), ) set text(size: 30pt, fill: self.colors.primary) set par(leading: leading) let body = { grid( columns: (1fr, 1fr), rows: (1fr), align( center + horizon, { set par(leading: 20pt) if self.aqua-lang == "zh" { text( size: 80pt, weight: "bold", [#text(size:36pt)[CONTENTS]\ 目录] ) } else if self.aqua-lang == "en" { text( size: 48pt, weight: "bold", [CONTENTS] ) } } ), align( left + horizon, { set par(leading: leading) set text(weight: "bold") (self.methods.touying-outline)(self: self, enum-args: (numbering: "01", ..enum-args)) } ) ) } (self.methods.touying-slide)(self: self, repeat: none, body) } #let new-section-slide(self: none, section) = { self = utils.empty-page(self) self.page-args += ( margin: (left:0%, right:0%, top: 20%, bottom:0%), background: utils.call-or-display(self, self.aqua-background), ) let body = { stack( dir: ttb, spacing: 12%, align( center, text( fill: self.colors.primary, size: 166pt, states.current-section-number(numbering: "01") ) ), align( center, text( fill: self.colors.primary, size: 60pt, weight: "bold", section ) ) ) } (self.methods.touying-slide)(self: self, repeat: none, section: section, body) } #let focus-slide(self: none, body) = { self = utils.empty-page(self) self.page-args += (fill: self.colors.primary, margin: 2em) set text(fill: white, size: 2em, weight: "bold") (self.methods.touying-slide)(self: self, repeat: none, align(horizon + center, body)) } #let slide(self: none, title: auto, ..args) = { if title != auto { self.aqua-title = title } (self.methods.touying-slide)( self: self, setting: body => { show heading.where(level:1): body => text(fill: self.colors.primary-light)[#body#v(3%)] body }, ..args, ) } #let slides(self: none, title-slide: true, outline-slide: true, slide-level: 1, ..args) = { if title-slide { (self.methods.title-slide)(self: self) } if outline-slide { (self.methods.outline-slide)(self: self) } (self.methods.touying-slides)(self: self, slide-level: slide-level, ..args) } #let register( self: s, aspect-ratio: "16-9", footer: states.slide-counter.display(), lang: "en", ) = { assert(lang in ("zh", "en"), message: "lang must be 'zh' or 'en'") self = (self.methods.colors)( self: self, primary: rgb("#003F88"), primary-light: rgb("#2159A5"), primary-lightest: rgb("#F2F4F8"), ) self.aqua-title = { states.current-section-number(numbering: "01") [ ] states.current-section-title } self.aqua-footer = footer self.aqua-lang = lang self.aqua-background = (self) => { place(left + top, dx: -15pt, dy: -26pt, circle(radius: 40pt, fill: self.colors.primary)) place(left + top, dx: 65pt, dy: 12pt, circle(radius: 21pt, fill: self.colors.primary)) place(left + top, dx: 3%, dy: 15%, circle(radius: 13pt, fill: self.colors.primary)) place(left + top, dx: 2.5%, dy: 27%, circle(radius: 8pt, fill: self.colors.primary)) place(right + bottom, dx: 15pt, dy: 26pt, circle(radius: 40pt, fill: self.colors.primary)) place(right + bottom, dx: -65pt, dy: -12pt, circle(radius: 21pt, fill: self.colors.primary)) place(right + bottom, dx: -3%, dy: -15%, circle(radius: 13pt, fill: self.colors.primary)) place(right + bottom, dx: -2.5%, dy: -27%, circle(radius: 8pt, fill: self.colors.primary)) polygon(fill: self.colors.primary-lightest, (35%, -17%), (70%, 10%), (35%, 30%), (0%, 10%)) place(center + horizon, dy: 7%, ellipse(fill: white, width: 45%, height: 120pt)) place(center + horizon, dy: 5%, ellipse(fill: self.colors.primary-lightest, width: 40%, height: 80pt)) place(center + horizon, dy: 12%, rect(fill: self.colors.primary-lightest, width: 40%, height: 60pt)) place(center + horizon, dy: 20%, ellipse(fill: white, width: 40%, height: 70pt)) place(center + horizon, dx: 28%, dy: -6%, circle(radius: 13pt, fill: white)) } let header(self) = { place(center + top, dy: 45%, rect(width: 100%, height: 100%, fill: self.colors.primary)) place(left + top, line(start: (30%, 30%), end: (27%, 200%), stroke: 7pt + white)) place(left + bottom, dx: 4%, dy: 15%, text(fill:white, self.aqua-title)) } let footer(self) = { set text(size: 0.8em) place(right, dx: -5%, utils.call-or-display(self, self.aqua-footer)) } self.page-args += ( paper: "presentation-" + aspect-ratio, margin: (x: 0em, top: 10%, bottom: 10%), header: header, footer: footer, ) self.padding += (x: 5%, top: 7%) self.methods.init = (self: none, body) => { set text(size: 20pt) body } self.methods.title-slide = title-slide self.methods.outline-slide = outline-slide self.methods.focus-slide = focus-slide self.methods.new-section-slide = new-section-slide self.methods.touying-new-section-slide = new-section-slide self.methods.slide = slide self.methods.slides = slides self }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/modern-uit-thesis/0.1.0/modules/abbreviations.typ
typst
Apache License 2.0
// TODO: Update when 0.4.2 is published // #import "@preview/glossarium:0.4.2": make-glossary, print-glossary, gls, glspl #import "glossarium.typ": print-glossary // Only print short and long, disregard rest #let custom-print-title(entry) = { let short = entry.at("short") let long = entry.at("long", default: "") [#strong(smallcaps(short)) #h(0.5em) #long] } #let abbreviations-page(abbreviations) = { // --- List of Abbreviations --- pagebreak(weak: true, to: "even") align(left)[ = List of Abbreviations #v(1em) #print-glossary( abbreviations, user-print-title: custom-print-title, // Show all terms even if they are not referenced show-all: true, // Disable back references in abbreviations list disable-back-references: true ) ] }
https://github.com/gumelarme/nuist-master-thesis-proposal
https://raw.githubusercontent.com/gumelarme/nuist-master-thesis-proposal/main/pages/work-plan.typ
typst
// TODO: Make (1) and (2) a function, and fillable // TODO: Make (1) and (2) automatically resize #text(size: 1.5em, "2. Thesis Work Implementation Plan") (1) The Thesis Theoritical and Hardware Requirement Level should be Met and Results #rect( width: 100%, height: 40%, stroke: 0.5pt + black, )[ ] (2) Specific Work Progress and Schedule #table( rows: 3em, columns: (auto, 1fr, 8em), align: center + horizon, stroke: 0.5pt + black, [Start and End \ Dates], [Work Content and Requirements], [Notes], ..([], [], []) * 9 )
https://github.com/kazuyanagimoto/quarto-slides-typst
https://raw.githubusercontent.com/kazuyanagimoto/quarto-slides-typst/main/README.md
markdown
MIT License
# Some Examples for Quarto + Typst Slides ## [quarto-clean-typst](https://github.com/kazuyanagimoto/quarto-clean-typst) A Long Demo - [PDF](https://kazuyanagimoto.com/quarto-slides-typst/slides/quarto-clean-typst/clean.pdf) - [Code](https://github.com/kazuyanagimoto/quarto-slides-typst/blob/main/slides/quarto-clean-typst/clean.qmd)
https://github.com/saYmd-moe/note-for-statistical-mechanics
https://raw.githubusercontent.com/saYmd-moe/note-for-statistical-mechanics/main/contents/PartI/Chp04.typ
typst
#import "../../template.typ": * == 多元复相系的平衡与热力学第三定律 === 多元均匀系的热力学函数与基本微分方程 ==== 化学变量 单元均匀系中添加了系统总摩尔数 $N$ 作为独立变量。在此基础上引入多元均匀系,设系统包含 $k$ 种不同的分子,每种分子称作一个组元,每个组元的摩尔数称为*化学变量*:$N_1, N_2, dots.c, N_k$。 ==== 广延量的数学性质与偏摩尔量 当 $p,T$ 不变时,系统各组元物质量同时增加为 $lambda$ 倍,则所有广延量也增加为 $lambda$ 倍: $ U(p,T;lambda N_1, lambda N_2, dots.c, lambda N_k) = lambda U(p,T;N_1, N_2, dots.c, N_k)\ V(p,T;lambda N_1, lambda N_2, dots.c, lambda N_k) = lambda V(p,T;N_1, N_2, dots.c, N_k)\ S(p,T;lambda N_1, lambda N_2, dots.c, lambda N_k) = lambda S(p,T;N_1, N_2, dots.c, N_k)\ $也就是说#highlight[广延量是其广延变量的一次齐次函数]。*齐次函数*满足*欧拉定理*:$ U = sum_i N_i ((diff U)/(diff N_i))_(T,p,n_j) = sum_i N_i u_i\ V = sum_i N_i ((diff V)/(diff N_i))_(T,p,n_j) = sum_i N_i v_i\ S = sum_i N_i ((diff S)/(diff N_i))_(T,p,n_j) = sum_i N_i s_i\ $定义*偏摩尔量*:$ u_i equiv ((diff U)/(diff N_i))_(T,p,n_j)\ v_i equiv ((diff V)/(diff N_i))_(T,p,n_j)\ s_i equiv ((diff S)/(diff N_i))_(T,p,n_j)\ $也就是说*多元均匀系的广延量等于各组元的偏摩尔量与各自物质的量的乘积之和*。 ==== 多元均匀系的热力学基本微分方程 以 $S,V,N_i (i=1,dots.c,k)$ 为变量:$ dif U = ((diff U)/(diff S))_(V,N_i) dif S + ((diff U)/(diff V))_(p,N_i) dif V + sum_i ((diff U)/(diff N_i))_(S,V,N_j) dif N_i $其中:$ ((diff U)/(diff S))_(V,N_i) = T, quad ((diff U)/(diff V))_(p,N_i) = - p $定义*化学势*:$ mu_i equiv ((diff U)/(diff N_i))_(S,V,N_j) $于是有多元复相系的基本微分方程:$ dif U &= T dif S - p dif V + sum_i mu_i dif N_i\ dif H &= T dif S + V dif p + sum_i mu_i dif N_i\ dif F &=-S dif T - p dif V + sum_i mu_i dif N_i\ dif G &=-S dif T + V dif p + sum_i mu_i dif N_i\ dif Psi&=-S dif T- p dif V - sum_i N_i dif mu_i $其中对于吉布斯函数有_*吉布斯-杜安*_关系:$ G = sum_i N_i mu_i, quad dif G = sum_i mu_i dif N_i + sum_i N_i dif mu_i, quad dif G &=-S dif T + V dif p + sum_i mu_i dif N_i \ arrow.double.long S dif T - V dif p + sum_i N_i dif mu_i = 0 $ === 多元复相系的平衡 ==== 多元复相系的平衡条件 简单起见,我们考虑一个两相($alpha,beta$),多组元($i=1,2,dots.c,k$)的系统的平衡条件,考虑吉布斯函数判据:$ cases( display(delta G = 0), display(delta^2 G > 0), display(delta T = 0\, delta p = 0\, delta N_i = 0 quad (i = 1,dots.c,k)) ) $有约束条件:$ delta N_i = delta N_i^alpha + delta N_i^beta = 0 arrow.double.long delta N_i^alpha = - delta N_i^beta $又有基本微分方能 $dif G^alpha = - S^alpha dif T^alpha + V^alpha dif p^alpha sum_i mu_i^alpha dif N_i^alpha$,可以得到:$ delta G^alpha = sum_i mu_i^alpha delta N_i^alpha \ arrow.double.long delta G = delta G^alpha + delta G^beta = sum_i (mu_i^alpha - mu_i^beta) delta N_i^alpha $得到多元复相系的平衡条件(相变平衡条件):$ mu_i^alpha = mu_i^beta $如果相变平衡条件不满足,在 $(T,p)$ 不变的条件下,过程会向 $dif G < 0$ 的方向进行。对每个组元 $i$,都有:$ (mu_i^alpha - mu_i^beta) dif N_i^alpha < 0 $如果 $mu_i^alpha > mu_i^beta$,那么 $dif N_i^alpha < 0$,组元 $i$ 从化学势高的相向化学势低的相转变。 ==== 化学平衡 热力学观点下,化学反应表示为:$ sum_(i=1)^k nu_i A_i = 0 $其中 $k$ 表示组元总数,$A_i$ 表示第 $i$ 个组元,$nu_i$ 表示组元 $A_i$ 对应的系数。化学反应会引起各组元物质的量发生改变,注意到这个改变与系数呈正比:$ dif N_1 : dif N_2 : dots.c : dif N_k = nu_1 : nu_2 : dots.c : nu_k $因此我们可以通过吉布斯函数判据推导出化学反应平衡条件,假设化学反应引起各组元物质的量产生虚变动 $delta N_i$,我们令 $delta N_i = epsilon nu_i$,在等温等压条件下,有吉布斯函数判据:$ delta G = sum_i mu_i delta N_i = epsilon sum_i mu_i nu_i = 0\ arrow.double.long sum_i mu_i nu_i = 0 $该式就是化学平衡条件,当不满足该条件时,化学反应会向化学势小的一侧进行。 ==== 吉布斯相律 - *热力学系统的自由度:系统能独立改变的强度变量的个数*; - *相律:一个复相系在平衡态时的自由度等于独立组元数 $k$ 加其他外参量的数目 ($2$) 再减去平衡共存的相数 $sigma$ *:$ f = k + 2 - sigma $ - 说明: - $k$ 是系统中的总组元数,一组的组元可少于 $k$; - 其他外参量的数目根据实际系统也会不同; - 系统中没有化学反应 === 混合理想气体的性质 ==== 物态方程 由道尔顿分压定理:*混合气体的压强 $p$ 等于各个组元的分压 $p_i$ 之和*:$ p = sum_i p_i $和化学纯理想气体物态方程:$ p_i V = N_i R T $不难推广出混合理想气体的物态方程:$ p V = (N_1 + N_2 + dots.c + N_k) R T $<mix-gas-states> ==== 化学势与吉布斯函数 考虑仅允许组元 $i$ 通过的半透壁分开的混合理想气体 $(p_i,mu_i)$ 和纯组元 $i$ 理想气体 $(p'_i,mu'_i)$,由相变平衡条件,达到平衡时有 $mu_i = mu'_i$,化学势有(为表达简单,以下计算均假设 $c_p_i$ 与温度无关):$ cases( display(mu'_i &= R T {ln p'_i + phi_i (T)}), display(phi_i (T) &= (h_(i 0) - T s_(i 0))/(R T) + 1/(R T) integral c_p_i dif T - 1/R integral c_p_i (dif T)/T \ &= mu_(i 0)/(R T) + 1/R c_p_i - 1/R c_p_i ln T ) ) $有 $mu'_i = mu_i, p'_i = p_i = x_i p$ 可以得到吉布斯函数:$ G = sum_i N_i mu_i = sum_i N_i R T {ln (x_i p) + phi_i (T)} $ ==== 内能、熵与焓 由基本微分方程:$ dif G = - S dif T + V dif p + sum_i mu_i dif N_i $把上式代入,得:$ V = ((diff G)/(diff p))_(T,{N_i}) = sum_i (N_i R T)/p $重新得到了混合理想气体的物态方程 @mix-gas-states ,同样的方法计算熵:$ S &= - ((diff G)/(diff T))_(p,{N_i}) \ &= sum_i N_i {integral c_p_i (dif T)/T - R ln (x_i p) + s_(i 0)}\ &= sum_i N_i {c_p_i ln T - R ln (x_i p) + s_(i 0)} $<εντροπια>计算内能:$ U &= G + T S - p V = G - T ((diff G)/(diff T))_(p,{N_i}) - p ((diff G)/(diff p))_(T,{N_i}) \ &= sum_i N_i {integral c_v_i diff T + u_(i 0)}\ &= sum_i N_i {c_v_i T + u_(i 0)} $同样可以计算焓:$ H &= G + T S = G - T ((diff G)/(diff T))_(p,{N_i})\ &= sum_i N_i {integral c_p_i diff T + h_(i 0)}\ &= sum_i N_i {c_p_i T + h_(i 0)} $ ==== 吉布斯佯谬 改写混合理想气体的熵 @εντροπια:$ S = sum_i N_i {c_p_i ln T - R ln p + s_(i 0)} + C $其中常数:$ C = - R sum_i N_i ln x_i > 0 $熵表达式中第一项可以看作各组分未混合前在相同 $(T,p)$ 下的熵之和;第二项常数 $C$ 代表混合后的不可逆扩散引起的熵增,即:$ Delta S = C = - R sum_i N_i ln x_i > 0 $如果混合的是完全相同的气体,根据上述结论也会产生熵增 $Delta S = C$,但显然熵增应该为零 ($Delta S = 0$),这被成为*吉布斯佯谬*。下面根据统计力学,基于全同粒子的不可分辨性给出解释。 #note[ #h(2em)设初态 ($i$) 相同的两种单原子分子理想气体分别处于由隔板分开的容器的两部分中,两气体的 $(T,p)$ 相同,总分子数和体积分别为 $(N_1,V_1),(N_2,V_2)$。现在抽出隔板,求平衡后 ($f$) 的熵变,并讨论两部分气体完全相同的情况。 不同于由热力学基本微分方程推导出来的熵表达式 @εντροπια ,这里需要使用统计力学中考虑了粒子全同性后得到的熵表达式@single-atom-gas-thermo:$ S = 3/2 N k ln T + N k ln V/N + 3/2 N k {5/3 + ln [g_0^e ((2 pi m k)/(h^2))]} $由上式,熵增为:$ Delta S &= S_f (N_2,V_2) - S_i (N_1,V_1)\ &= N_1 k ln V/N_1 + N_2 k ln V/N_2 - N_1 k ln V_1/N_1 - N_2 k ln V_2/N_2\ &= N_1 k ln V/V_1 + N_2 k ln V/V_2 $其中 $V=V_1 + V_2 > V_1, V_2$,所以 $Delta S > 0$。当两部分为相同气体时:$ Delta S = N ln V/N - N_1 k ln V_1/N_1 - N_2 k ln V_2/N_2 $由于初、末态有相同的 $(T,p)$,所以:$ p/(k T) = N_1/V_1 = N_2/V_2 = N/V $于是:$ Delta S = 0 $基于量子统计的全同粒子不可分辨即可解决吉布斯佯谬。 ] === 热力学第三定律 ==== 热力学第三定律的三种表述 热力学第三定律有三种表述: - *能斯特定律:系统的熵在等温过程中的改变随绝对温度趋于零*:$lim_(T arrow 0) (Delta S)_T = 0$ - *系统的熵随绝对温度趋于零:*$lim_(T arrow 0) Delta S = 0$ - *不可能使物体冷却到绝对零度*。 ==== 绝对熵 绝对零度时系统的熵与其他参数无关,以此 $(S(0,y) = S_0 = 0)$ 为基准定义绝对熵:$ S(T,y) = integral_0^T C_y(T,y) (dif T)/T + S_0 = integral_0^T C_y (dif T)/T $ ==== 能斯特定理的推论 由_Maxwell_关系结合能斯特定理,在趋于绝对零度的情况下:$ lim_(T arrow 0) ((diff V)/(diff T))_p &= - lim_(T arrow 0) ((diff S)/(diff p))_T = 0\ lim_(T arrow 0) ((diff p)/(diff T))_V &= lim_(T arrow 0) ((diff S)/(diff V))_T = 0 $
https://github.com/typst-doc-cn/tutorial
https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/typ/book/variables.typ
typst
Apache License 2.0
// It is in default A4 paper size #let page-width = 595.28pt // default target is "pdf" #let target = "pdf"
https://github.com/indicatelovelace/kinave
https://raw.githubusercontent.com/indicatelovelace/kinave/main/0.1.0/resources/example.typ
typst
#import "@preview/kinase:0.1.0": * #show: make-link #update-link-style(key: l-mailto(), value: it => strong(it), ) #update-link-style(key: l-url(base: "typst\.app"), value: it => emph(it)) #update-link-style(key: l-url(base: "google\.com"), before: l-url(base: "typst\.app"), value: it => highlight(it)) #update-link-style(key: l-url(base: "typst\.app/docs"), value: it => strong(it), before: l-url(base: "typst\.app")) #link("mailto:<EMAIL>") \ #link("https://www.typst.app/docs") #link("typst.app") #link("+49 2422424422")
https://github.com/alberto-lazari/cns-report
https://raw.githubusercontent.com/alberto-lazari/cns-report/main/abstract.typ
typst
Most fuzzing methodologies are based on text inputs, that are crafted or randomly created to find bugs and input vulnerabilities in programs. While fuzzing Android applications is not an entirely new field, doing it specifically by using QR code inputs is still a less explored technique. _QRFuzz_ by @QRFuzz is one of the first implementations of this kind of testing, however it is limited by its use of a physical device and actual QR codes to scan, that cause difficulties in testing and pose a limit to the automation and scalability of the process. In this report, we provide an alternative design to the framework presented in @carboni2023if (_If You’re Scanning This, It’s Too Late! A QR Code-Based Fuzzing Methodology to Identify Input Vulnerabilities in Mobile Apps_), proving that it is possible to remove any physical device and QR code constraint by using a virtualized environment for the testing process, that can be easily configured in a reproducible and automated way. We are able to do it by running an Android Virtual Device (AVD), instead of using a real one, that is linked to a static video stream as a virtual webcam. A comprehensive setup system is used to automatically install and configure the toolkit.
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Phone_Apps.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Phone Apps", authors: ( "<NAME>", ), date: "10 Août, 2024", ) #set heading(numbering: "1.1.") - Amazon - Revanced Youtube - LibreTorrent - Tachiyomi - Numworks - Nyx - Hp Printer - Aniyomi - Whatsapp - Google Docs - Google Sheets - Google Messages - RVX Manager - Proton Mail - Skiff - Freebox App - Instagram - Hevy - Deep L - Seal - Revanced Youtube Music - Wikipedia - Google Maps - PassCulture - VLC - EcoleDirecte - Wo mic - Syncthings - Brawlstars - Jerboa - 20 minutes till dawn - Google Files - Brave Nightly - Google Play Books - RiotGames - MicroG - Eternity - Droid-ify - Json Genie - Oqee - Azure Authentificator - Blizzard Auth - Ankama Auth - Auth - Wallflow Plus - Google Phone - Kvaesitso - Github - MGit - Phone Link
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/3%20-%20PB/Documentazione%20interna/Verbali/24-03-17/24-03-17.typ
typst
#import "/template.typ": * #show: project.with( date: "17/03/24", subTitle: "Meeting di retrospettiva e pianificazione", docType: "verbale", authors: ( "<NAME>", ), timeStart: "15:00", timeEnd: "16:00", ); = Ordine del giorno - Valutazione del progresso generale; - Analisi retrospettiva; - Data di consegna; - Pianificazione. = Valutazione del progresso generale <avanzamento> Lo Sprint 19 ha visto buona parte dei task assegnati, sia riguardanti la documentazione che di codifica, completati nei tempi previsti. I task non conclusi risultano in corso d'opera e verranno portati in verifica nel prossimo Sprint. Il giorno venerdì 15/03/2024 si è svolto il meeting esterno con il Proponente, come pianificato, per un aggiornamento riguardo lo stato dei lavori e gli avanzamenti nello sviluppo dell'MVP. == #adr Gli Use Case sono stati estesi e i requisiti aggiornati in modo da rispecchiare con maggiore precisione le richieste del Proponente. == #ndp Sono state redatte e verificate le sezioni "Validation process" e "Transition process". == #pdp È stato redatto il consuntivo di periodo relativo allo Sprint 18. == #st Sono state redatte le sezioni relative alla: - struttura dell'applicazione WMS3; - data pattern utilizzati; - classi e componenti presenti in ciascun layer architetturale (con i corrispondenti diagrammi delle classi). Inoltre è stata aggiunta la sezione riguardante l'installazione. == #man Sono stati eseguiti e verificati i task: - individuazione della struttura del documento; - redazione della sezione relativa ai requisiti; - redazione della sezione relativa all'installazione; - redazione della sezione relativa al supporto tecnico. == Codifica L'attività di codifica ha visto completati i lavori: - realizzazione della creazione del piano rettangolare in Three.js; - implementazione della lettura del file SVG; - implementazione dell'elemento `orderItem`; - implementazione del pulsante "reimposta" nel Settings Panel; - implementazione della creazione di una zona; - implementazione della modifica di una zona; - implementazione dell'eliminazione di una zona; - rimozione del pulsante "sincronizzazione" da Order Panel; - implementazione del pulsante "sincronizzazione" in Settings Panel; - implementazione del componente `productItemDetails`; - implementazione `productItem` per il Product Panel; - implementazione dei campi di modifica delle dimensioni della planimetria in Settings Panel; - implementazione di una simulazione delle API per lo spostamento dei prodotti; - implementazione test per le Server Actions prodotte. = Analisi retrospettiva Il rendimento positivo dello Sprint è sostenuto dalle principali metriche esposte dal #pdq\: - CPI di progetto a 1.00, rappresenta un valore ottimo ($>=1.00$); - EAC aumenta passando da € 12.933,25 a € 12.990,31. Nonostante l'aumento, rientra nelle condizioni di accettabilità; - $"SEV" <= "SPV"$, rientra nelle condizioni di accettabilità poiché $"SEV" >= 80%$ del $"SVP"$. \ Maggiori dettagli in merito al valore delle metriche alla loro analisi sono reperibili all'interno dei documenti #pdq_v e #pdp_v. == Keep doing <keep-doing> Il gruppo ed il Proponente si ritengono soddisfatti dell'andamento dei lavori e dei progressi ottenuti. Le review delle pull request sono avvenute con precisione e in tempi brevi. == Improvements <improvements> === Criticità evidenziate *P01*: gli avanzamenti dei documenti #pdp e #pdq sono stati minori delle aspettative. === Soluzioni predisposte #figure(caption: [Soluzioni individuate alle criticità riscontrate.], table( align: left, columns: (auto, 1fr, auto), [ID risoluzione], [Titolo], [Criticità affrontate], [R1], [Migliore ridistribuzione dei task], [P01] ) ) = Data di consegna Il gruppo ha discusso l'avvicinarsi della data di consegna del progetto e ritiene importante il mantenimento dello stesso livello di intensità degli Sprint precedenti. A seguito del posticipo della data di consegna comunicata dal gruppo durante lo scorso diario di bordo, è stato prefissato il giorno 26/03/2024 come massimo per la presentazione della candidatura alla PB. = Pianificazione <pianificazione> #let table-json(data) = { let keys = data.at(0).keys() table( align: left, columns: keys.len(), ..keys, ..data.map( row => keys.map( key => row.at(key, default: [n/a]) ) ).flatten() ) } #show figure: set block(breakable: true) #figure(caption: [Task pianificate per lo Sprint 20.], table-json(json("tasks.json")) )
https://github.com/shiki-01/typst
https://raw.githubusercontent.com/shiki-01/typst/main/school/syspro/2nd/1.typ
typst
#import "../../../lib/conf.typ": conf, come, desc, ce, light #import "@preview/codelst:2.0.1": #import "@preview/pintorita:0.1.1" #import "@preview/fletcher:0.4.3" as fletcher: diagram, node, edge #show raw.where(lang: "pintora"): it => pintorita.render(it.text) #show: doc => conf( title: [情報システム 2学期], date: [2024年9月11日], doc, ) #show heading: it => [ #if it.level == 1 { [ #set align(center) #set text(22pt) #pad( bottom: -70pt, [#it\ ] ) ] } else if it.level == 2 { [ #set align(left) #set text(18pt) #pad( top: 15pt, bottom: -70pt, [#it\ ] ) ] } else if it.level == 3 { [ #set align(left) #set text(15pt) #pad( bottom: -70pt, [#it\ ] ) ] } else { [#pad( top: 10pt, bottom: 5pt, [#it ] )] } #if it.level == 2 {line(length: 100%,stroke: rgb("#eee"))} #pad(bottom: -20pt, []) #if it.level == 3 { [#pad(bottom: 10pt,[])] } else if it.level == 2 { [#pad(bottom: -10pt,[])] } ] = データ構造とアルゴリズム == データの、型と列データ === 基本的なデータ型 ==== 論理型 #table( columns: 8, table.cell(colspan: 2, align: center)[否定], table.cell(colspan: 3, align: center)[論理積], table.cell(colspan: 3, align: center)[論理和], [X],[NOT X],[X],[Y],[X AND Y],[X],[Y],[X OR Y], [偽],[真],[偽],[偽],[偽],[偽],[偽],[偽], [真],[偽],[偽],[真],[偽],[真],[偽],[真], [], [], [真],[偽],[偽],[真],[偽],[真], [], [], [真],[真],[真],[真],[真],[真], ) ==== 文字列型 #desc("Unicode")[ 文字をコンピュータで扱うための標準規格。\ 世界で使われる多くの文字を扱えるように策定されている Unicode が、文字集合(文字コード)として広く採用されている。 ] ==== 数値型 - 実数型は、#light[浮動小数点数]で表現される。 - 2進法で限られたビット数によって表現するため、表現できる数値の範囲が限られる。 #pagebreak() === 文字列 #desc("文字列")[ 文字を一列に並べたもの。\ 文字列は、文字の配列として扱われることが多い。 ] #table( columns: 8, [C],[o],[m],[p],[u],[t],[e],[r], [0],[1],[2],[3],[4],[5],[6],[7], ) #desc("文字列の長さ")[ 文字列の長さは、文字列に含まれる文字の数で表現される。\ 例えば、"Computer" は 8 文字の長さを持つ。\ このとき、先頭の文字の添字は 0 であり、これを 0-origin という。 ] ```python >>> s = 'Computer' >>> s 'Computer' >>> s[2] 'm' >>> type('AAA') <class 'str'> ``` ==== 2 つの文字列の連結 ```python >>> 'ABC' + 'DEF' 'ABCDEF' ``` ==== 2 つの文字列の比較 ```python >>> 'ABC' < 'ABE' # 小さい方が先 True >>> 'AB' < 'ABA' # 長い方が大きい True ``` ==== 部分文字列の取得 ```python >>> 'ABCDEF'[2:4] 'CD' >>> s = 'ABCDEF' >>> s[2:4] 'CD' ``` === 列データ構造 データ構造とはデータの集まりをコンピュータの中で効果的に扱うための形式のこと。 ==== リスト - リストは、複数のデータをまとめて扱うためのデータ構造。 - リストの要素は、インデックスを使ってアクセスできる。 ==== 配列 - 配列は、同じ型のデータを連続したメモリ領域に格納するデータ構造。 - 配列の要素は、インデックスを使ってアクセスできる。 ==== スタック - スタックは、データを一時的に保存するためのデータ構造。 - データの追加や削除は、常に一方向から行われる。 ```python >>> data = [4, 1, 7, 3, 2] >>> data.append(8) >>> data [4, 1, 7, 3, 2, 8] >>> data[-1] 8 >>> data.pop() 8 >>> data [4, 1, 7, 3, 2] ``` ==== キュー - キューは、データを一時的に保存するためのデータ構造。 - データの追加は一方向から行い、削除は反対方向から行う。 ```python >>> from collections import deque >>> data = deque([4, 1, 7, 3, 2]) >>> data deque([4, 1, 7, 3, 2]) >>> data.popleft() 4 >>> data deque([1, 7, 3, 2]) >>> data.append(5) >>> data deque([1, 7, 3, 2, 5]) >>> data.appendleft(6) >>> data deque([6, 1, 7, 3, 2, 5]) ``` === レコード型と連想配列 ==== レコード型 - レコード型は、複数のデータをまとめて扱うためのデータ構造。 - レコード型の要素は、フィールドと呼ばれる。 `フィールド名:値` の形式でデータを表現する。 ==== 連想配列 - 連想配列は、キーと値のペアを格納するデータ構造。 - キーを使って値にアクセスできる。 `キー:値` の形式でデータを表現する。 \ P.62 問 6 図書館で貸し出す本をレコード型で合わすとすると、どのようなフィールドが昼用になるか考えてみよう。図書館を利用する人の情報をレコード型で表すとすると、どのようなフィールドが必要になるか考えてみよう。 #grid( columns: 2, gutter: 10em, [ *貸し出す本* #table( columns: 2, [フィールド名],[型], [タイトル],[文字列], [著者],[文字列], [出版社],[文字列], [出版年],[整数], [貸出状況],[論理型], ) ], [ *利用者* #table( columns: 2, [フィールド名],[型], [氏名],[文字列], [住所],[文字列], [電話番号],[文字列], [貸出中],[リスト], ) ] )
https://github.com/yhs0602/Topology
https://raw.githubusercontent.com/yhs0602/Topology/main/1.typ
typst
// Get Polylux from the official package repository #import "@preview/polylux:0.3.1": * // Make the paper dimensions fit for a presentation and the text larger #set page( paper: "presentation-16-9", fill: rgb(235, 253, 255) ) #set text( size: 25pt, font: "Pretendard", ) #set list(spacing: 2em, tight: true) #show heading: it => { it.body v(0.2em) } #let KL = math.op("KL") #let Uniform = math.op("Uniform") #let ReLU = math.op("ReLU") // Use #polylux-slide to create a slide and style it using your favourite Typst functions #polylux-slide[ #align(horizon + center)[ = Topology \ 1. Introduction 양현서 July 20, 2024 ] ] #polylux-slide[ == Manifolds란 무엇인가? - 공간에서의 면을 일반화한 개념 - 예시: S2 (구면) - 여기서의 함수의 최댓값, 최솟값 구하기는 평범한 평면에서 하던 것과는 다르다. - A *manifold* is a *topological space* locally *homeomorphic* to $RR^n$. ] #polylux-slide[ == Metric - A non empty set $X$ - For $forall x, y in X$ - $d(x, y) > 0 <=> x != y$ - $d(x, y) = d(y, x)$ - $d(x, y) gt.eq d(x, z) + d(z, y)$ ] #polylux-slide[ == Example of metrics - Eucledian metric: $d(x, y) = sqrt((x_1 - y_1)^2 + (x_2 - y)^2)$ - Square metric: $d(x, y) = max(|x_1 - y_1|, |x_2 - y_2|)$ - Taxi-cab metric: $d(x, y) = |x_1 - y_1| + |x_2 - y_2|$ - Discrete metric: $d(x, y) = 1$ if $x != y$, $0$ if $x = y$ ] #polylux-slide[ == Metric Space - Set $X$ - Metric function $d: X^2 -> RR$ ] #polylux-slide[ == Open epsilon ball in metric space - $B(x, epsilon) = {y in X | d(x, y) lt epsilon}$ - It is an open set ] #polylux-slide[ == Examples of balls in metric spaces - inside of a circle with radius $r$ where $X = RR^2, d = "Eucledian metric"$ - inside of a square where $X = RR^2, d = "Square metric"$ - Discrete metric space - $B_"Discrete" (p, 0.1) = { p }$ - $B_"Discrete" (p, 1) = { p }$ - $B_"Discrete" (p, 1.000001) = X$ ] #polylux-slide[ == Open sets in metric space - if $U in X$, $U$ is an open set if $forall x in U, exists epsilon gt 0$ such that $B(x, epsilon) subset U$ - Example (Eucledian space) - $U = { (x, y) in RR^2 | x gt 0 }$ - $forall (x, y) in U, B((x, y), x) subset U$ ] #polylux-slide[ == Topology - *Metric is not needed* - Set $X$, $T subset.eq cal(P)(X)$ - $T$ is a topology on $X$ if - $emptyset, X in T$ - $U, V in T => U sect V in T$ - For any fixed index set $I$, $U_i in T => union.big_(i in I) U_i in T $ ] #polylux-slide[ == Open sets Elements of $T$ are called open sets ] #polylux-slide[ == Examples of topology - Discrete Topology: $T = cal(P)(X)$ is a topology on $X$ - Indiscrete Topology: $T = { emptyset, X}$ is a topology on $X$ ] #polylux-slide[ == Open epsilon ball is an open set - In a metric space $(X, d)$, for any $x in X$ and $epsilon > 0$, the set $B(x, epsilon) = {y in X | d(x, y) < epsilon}$ is called an $epsilon$-ball around $x$. - Proposition: Every $epsilon$-ball is an open set in the metric space $(X, d)$. ] #polylux-slide[ == Open epsilon ball is an open set: Proof - Let $B(x, epsilon)$ be an $epsilon$-ball and let $p in B(x, epsilon)$ - Then $d(x, p) < epsilon$ - Choose $delta = epsilon - d(x, p)$, then $delta > 0$. - For any $q in B(p, delta)$, we have $d(p, q) < delta$. - By triangle ineq, $d(x, q) lt.eq d(x, p) + d(p, q) < d(x, p) + delta = epsilon$ - Hence, $q in B(x, epsilon)$ - Thus, $B(p, delta) subset B(x, epsilon)$, implying $p$ is an interior point of $B(x, epsilon)$ - Since $p$ was arbitrary, $B(x, epsilon)$ is an open set. - Therefore, every $epsilon$-ball is an open set in the metric space $(X, d)$. ] #polylux-slide[ #align(horizon + center)[ = Teaser: Closed set, continuous function ] ] // #polylux-slide[ // == Joint space mapping for control // - Directly maps "Leader" joint angles to "Follower" joint angles // - Solves IK failing problem // // #figure( // // image("images/robots.png", width: 85%), // // ) // ]
https://github.com/swaits/typst-collection
https://raw.githubusercontent.com/swaits/typst-collection/main/glossy/0.1.0/src/themes.typ
typst
MIT License
#let theme-2col = ( section: (title, body) => { set par.line(numbering: none) heading(level: 1, title) columns(2, body) }, group: (name, body) => { if name != none { heading(level: 2, name) } body }, entry: (entry, i, n) => { // build our title, etc let short-display = text(weight: "regular", entry.short) let long-display = if entry.long == none { [] } else { [#h(0.25em) -- #entry.long] } // build our description let description = if entry.description == none { [] } else { [: #entry.description] } text( size: 0.75em, weight: "light", grid( columns: (auto,auto,auto,1fr,1em,auto), align: (left, left, left, center, center, right), [#short-display#entry.label], [#long-display], [#description], [#repeat(h(0.25em) + "." + h(0.25em))], [ . ], [#entry.pages] ) ) }, )
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/ConsuntivoSprint/QuindicesimoSprint.typ
typst
MIT License
#import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost #import "../../functions.typ": rendicontazioneOreAPosteriori, rendicontazioneCostiAPosteriori, glossary, team ==== Quindicesimo consuntivo *Inizio*: Venerdì 29/03/2024 *Fine*: Giovedì 04/04/2024 #rendicontazioneOreAPosteriori(sprintNumber: "15") #rendicontazioneCostiAPosteriori(sprintNumber: "15") ===== Analisi a posteriori La retrospettiva dell'ultimo #glossary[sprint] prima della seconda revisione #glossary[PB] mostra che ancora una volta il team è stato in grado di rispettare le ore preventivate, impiegando 29.5 ore produttive per portare a termine le attività previste; non sorprende che la maggior parte delle ore siano state impiegate dai Verificatori, dato che tra gli obiettivi della pianificazione vi erano la conclusione dello sviluppo del prodotto software e la revisione della #glossary[documentazione] in stile #glossary[walkthrough]. A tal proposito il team è riuscito a completare lo sviluppo del prodotto nei tempi previsti e lo ha presentato alla Proponente in data 02/04/2024 per effettuare i test di accettazione ed ottenere la validazione dello stesso come #glossary[MVP]. La retrospettiva evidenzia anche che, al termine dei 7 #glossary[sprint] effettuati nel periodo di tempo trascorso tra l'#glossary[RTB] e la #glossary[PB], le ore produttive rimanenti ammontano a 15 su 570 totali (2.6%) e, di conseguenza, il budget rimanente è di 282.5€ su 11.070€ totali (2.6%) a disposizione.
https://github.com/Corvus006/JIF_Robot
https://raw.githubusercontent.com/Corvus006/JIF_Robot/main/paper/main.typ
typst
#import "template.typ":* #show: ams-article.with( title: [Jif], authors: ( ( name: "<NAME>", ), ( name: "<NAME>", ), ( name: "<NAME>", ), ), bibliography-file: "refs.bib", ) #outline() #pagebreak() = Roboter == Fahrgestell und Karosserie Das Fahrgestell ist nicht von uns designt worden, eben so wenig wie der Kettenantrieb. Dies war auch nicht notwendig, da Dejan von HowToMechatronics eine wunderbare Basis für unser Vorhaben bereits geschaffen hatte. @howtomechatronics2024 Auf dieser Basis wurde eine Karosserie für unsere Zwecke in Fusion360 erstellt mit zwei aufklappbaren Deckeln, die die Wartung an dem Roboter erleichtern. Um die elektronischen Komponenten auf dem Fahrgestell zu befestigen, wurden Adapterstücke konstruiert, da die Löcher des Fahrgestells für andere Komponenten designt wurden. Ebenso wurden stärkere Federn in den Dämpfern eingebaut die 10 Newton in etwa maximal Belastung haben. Der Schlitz auf der Oberseite des Hinterendeckels ist für die Kabelführung der Webcam. #image("pictures/JifFusion.png") #pagebreak() == Hardware Der Roboter wird von zwei 37mm 12V DC-Motoren mit 66rpm betrieben, welche angesteuert werden über zwei L298N H-Brücken, wobei jeder Motor mit einem der Motoren verkabelt ist. Die Steuerung der H-Brücken hat ein ESP32 development board, welches seriell mit einem Raspberry Pi 3B+ verbunden ist, inne. Die Stromversorgung übernimmt ein 12V 5000mAh LiPo-Akku, der die Motortreiber direkt versorgt, parallel dazu geschaltet ist ein Abwärtswandler, welcher die 12V auf 5V konvertiert und so den Raspberry Pi mit Strom versorgt. Man stellt sich sicherlich die Frage warum zwei H-Brücken verbaut wurden, wenn man an einem 2 Motoren anschließen kann, aber eine H-Brücke kann maximal 2 Ampere abgeben, was sich dann auch auf beide Motoren aufteilen würde was zu einem Leistungsverlust führt, da jedem Motor nur 1 Ampere zugewiesen werden kann. Um diese Problematik zu lösen wurden zwei H-Brücken verbaut und so können jedem Motor 2 Ampere zugewiesen werden. Leider ist aber immer noch ein Spannungsabfall zu bemerken. So wird ein zukünftiger Schritt sein ein Motortreiber zu verbauen, welcher eine noch höhere Stromstärke stemmen kann. #image("pictures/SchaltplanUpdate.png") #pagebreak() == micro-ROS Um den ESP32 vom ROS2-Netzwerk aus anzusteuern, wurde micro-ROS verwendet. Dazu wurde zuerst ein neues Workspace erstellt, welches für das Flashen und dem micro-ROS-Agent zuständig sein wird. Anschließend noch ein src Ordner in dem micro-ROS Workspace erstellen, wo dann das micro_ros_setup Package hinein geklont wurde. @microros2024 Nachdem ersten Build ist nun ein firmware Ordner zu sehen, in dem Verzeichnis ,".../microros_ws/firmware/freertos_apps/apps", wurde dann die ros_esp32cam_diffdrive App geklont. @reinbert2024 Nach dem Konfigurieren und dem Builden konnte der ESP32 auch schon geflasht werden. Nun fehlte nur noch der micro-ROS-Agent. Nach dessen Builden und Starten konnte man unter den Topics auch unser /cmd_vel finden. Somit war der erste Teil der Basis geschaffen. #pagebreak()
https://github.com/LilNick0101/Bachelor-thesis
https://raw.githubusercontent.com/LilNick0101/Bachelor-thesis/main/content/conclusions.typ
typst
#v(10pt) = Conclusione Alla fine il tirocinio è durato in totale 320 ore di lavoro (o 8 settimane lavorative di 40 ore di lavoro), con la fine effettiva del tirocinio il 25/08/2023. In seguito, verranno segnati il consuntivo periodico rispetto al piano di lavoro iniziale, il resoconto degli obiettivi e le eventuali variazioni rispetto a quanto pianificato. == Consuntivo periodico === Periodo 1 (28/06/2023 - 05/07/2023) In questo periodo ho iniziato il periodo di formazione partendo con un rapido studio del linguaggio di programmazione _Kotlin_, studiandone la sintassi e i costrutti, e subito dopo ho iniziato con il corso online *Android Basics with Compose* partendo con l'apprendimento di _Jetpack Compose_. #figure( image("../resources/images/charts/ore_I.png", width: 75%), caption: [Grafico consuntivo ore periodo 1.] ) #figure( image("../resources/images/charts/requisiti_I.png", width: 75%), caption: [Grafico requisiti soddisfatti periodo 1.] ) Vedendo dai grafici, in questo periodo ho speso 40 ore di formazione ma non ho soddisfatto ancora nessun requisito, dato che ero ancora in periodo di formazione. === Periodo 2 (06/07/2023 - 19/07/2023) In questo periodo: - Ho continuato il periodo di formazione, imparando la struttura architetturale, ad usare client come _Ktor_ per scambiare dati remoti e ad usare _Room_; - Ho finito il periodo di formazione con una breve demo finale; - Ho iniziato a lavorare sul progetto effettivo, partendo con la creazione dell'applicazione e l'inizio dell'implementazione della lista dei luoghi, partendo dall'interfaccia grafica. #figure( image("../resources/images/charts/ore_II.png", width: 75%), caption: [Grafico consuntivo ore periodo 2.] ) #figure( image("../resources/images/charts/requisiti_II.png", width: 75%), caption: [Grafico requisiti soddisfatti periodo 2.] ) Vedendo dai grafici, in questo periodo ho speso 80 ore lavorative e ho soddisfatto in totale 4 requisiti su 56. === Periodo 3 (20/07/2023 - 02/08/2023) In questo periodo: - Ho continuato e finito la schermata della lista dei luoghi, implementando i filtri e l'ordinamento della lista; - Ho iniziato e finito l'implementazione della schermata di dettaglio del luogo; - Ho sviluppato anche la classe di repository dei luoghi e la classe per le chiamate alle API dei luoghi; - Alla fine del periodo ho iniziato anche a lavorare sull'interfaccia grafica della schermata del caricamento di un nuovo luogo. Le funzionalità completate in questo periodo sono state: - *F1*: Lista dei luoghi (con funzione di ordinamento e filtraggio); - *F3*: Visualizzazione in dettaglio di un luogo. #figure( image("../resources/images/charts/ore_III.png", width: 75%), caption: [Grafico consuntivo ore periodo 3.] ) #figure( image("../resources/images/charts/requisiti_III.png", width: 75%), caption: [Grafico requisiti soddisfatti periodo 3.] ) Vedendo dai grafici, in questo periodo ho speso 80 ore lavorative e ho soddisfatto in totale 22 requisiti su 56. === Periodo 4 (03/08/2023 - 16/08/2023) In questo periodo: - Ho implementato la chiamata al back-end per il caricamento di un nuovo luogo, concludendo la schermata; - Ho impostato la classe per configurare _AWS Cognito_ e ho implementato l'interfaccia grafica e le funzionalità della schermata di login; - Ho sviluppato la pagina del profilo utente, con la creazione della classe di repository degli utenti e la classe API per gli utenti; - Ho sviluppato la mappa dei luoghi con funzione di filtraggio, ci ho messo meno tempo dato che possiede una logica simile alla lista dei luoghi. Le funzionalità completate in questo periodo sono state: - *F2*: Mappa dei luoghi (con funzione di filtraggio); - *F4*: Caricamento di un luogo; - *F5*: Pagina di login; - *F6*: Pagina del profilo utente, con lista dei luoghi caricati e dei luoghi salvati. #figure( image("../resources/images/charts/ore_IV.png", width: 75%), caption: [Grafico consuntivo ore periodo 4.] ) #figure( image("../resources/images/charts/requisiti_IV.png", width: 75%), caption: [Grafico requisiti soddisfatti periodo 4.] ) Vedendo dai grafici, in questo periodo ho speso 80 ore lavorative e ho soddisfatto in totale 43 requisiti su 56. === Periodo 5 (17/08/2023 - 25/08/2023) Nel periodo finale: - Mi sono impegnato a impostare il database locale _Room_; - Ho implementato la funzionalità di salvataggio di un luogo; - Ho dato gli ultimi ritocchi all'applicazione sistemando alcuni problemi noti. #figure( image("../resources/images/charts/ore_V.png", width: 75%), caption: [Grafico consuntivo ore periodo 5.] ) #figure( image("../resources/images/charts/requisiti_V.png", width: 75%), caption: [Grafico requisiti soddisfatti periodo 5.] ) Vedendo dai grafici, in questo periodo ho speso 40 ore lavorative, con due giorni di pausa in mezzo, e ho soddisfatto in totale 47 requisiti su 56. === Variazioni rispetto alla pianificazione Rispetto il piano di lavoro iniziale, il periodo di formazione è durato una settimana in più del previsto, in quanto ho avuto bisogno di più tempo per finire il corso online. Inoltre, le schermate di login e profilo utente sono state sviluppate in un periodo diverso da quello previsto, in quanto è stato trovato più comodo ad iniziare con la schermata della lista dei luoghi e la visualizzazione dei dettagli dei luoghi. Le attività pianificate per il quinto periodo non sono state realizzate per mancanza di tempo. #pagebreak() == Resoconto obiettivi e prodotti attesi Alla fine del tirocinio ho raggiunto i seguenti obiettivi: #figure( table( fill: (_, row) => if calc.odd(row) { luma(240) } else { white }, columns: (0.3fr, 1fr, 0.3fr), align: horizon, [*Obiettivo*], [*Resoconto*], [*Grado di completamento*], [*O-1*],[Sono riuscito a comprendere lo sviluppo di un'applicazione mobile e di sviluppare a pieno un'applicazione funzionante, sperimentando lo sviluppo sia della logica di business che dell'interfaccia grafica], [Completato], [*O-2*],[Sono riuscito a sperimentarmi con l'interazione con un servizio remoto RestFul JSON, sia per ricevere dati che per inviare dati, e sono riuscito a presentare con successo i dati ricevuti nell'applicazione], [Completato], [*O-3*],[Grazie agli stand-up giornalieri ho avuto esperienza con una tipologia di lavoro agile che si concentra sul lavoro di squadra con il constante aggiornamento del progresso di lavoro], [Completato] ), caption: [Riepilogo obiettivi formativi tirocinio.] ) Per gli obiettivi formativi, in sintesi, sono riuscito a raggiungere tutti gli obiettivi con successo. Per quanto riguardano i prodotti finali attesi: #figure( table( fill: (_, row) => if calc.odd(row) { luma(240) } else { white }, columns: (0.3fr, 1fr, 0.3fr), align: horizon, [*Prodotto/i*], [*Resoconto*], [*Grado di completamento*], [*P-1*],[L'applicazione è stata sviluppata ed è funzionante, con la maggior parte dei requisiti soddisfatti], [Completato], [*P-2*],[I test automatici sono stati sviluppati nella parte di formazione ma non sono stati sviluppati per l'applicazione in sé], [Parzialmente completato], [*P-3* e *P-4*],[Non sono stati fatti per mancanza di tempo], [Non completati] ), caption: [Riepilogo prodotti attesi tirocinio.] ) Questa mancanza di tempo è dovuta ad un ritardo dell'inizio dello sviluppo del progetto effettivo a causa di una durata maggiore del previsto per la formazione, che è durata 1 settimana in più del previsto. Per quanto riguardano i rischi: - Il rischio che si è presentato in maniera più evidente è stato *R-1* che come già detto ha portato ad un ritardo nello sviluppo del progetto effettivo, ma che non ha portato a nessun problema di sorta, in quanto l'applicazione è stata sviluppata e funzionante, anche se non con tutti i requisiti soddisfatti; - Il rischio *R-2* non si è presentato in quanto già avevo una conoscenza di base di API REST dagli anni passati in università, l'unica cosa che ho dovuto apprendere è stata l'autenticazione utente con il token generato da _Cognito_; - Il rischio *R-3* non si è presentato in quanto durante il progetto sono stato in grado di lavorare con abbastanza autonomia, alcune volte chiedendo pareri o riportando il progresso del lavoro e raramente mi sono trovato in situazioni di stallo; - Il rischio *R-4* non si è presentato in quanto tutte le funzionalità sono state integrate senza problemi e tutte le _Pull requests_ venivano approvate in giornata. == Considerazioni finali Tutto sommato mi ritengo soddisfatto di questa esperienza di tirocinio, in quanto mi ha permesso di imparare a sviluppare un'applicazione mobile completa utilizzando le tecnologie più recenti e mi ha permesso di lavorare con un team di sviluppo in un ambiente professionale come l'azienda. Mi sarebbe piaciuto poter completare il progetto con tutti i prodotti attesi completati: infatti, personalmente una cosa che avrei migliorato sarebbe stata la mia gestione del tempo in generale, in quanto ciò ha portato via tempo allo sviluppo del progetto effettivo. Concludendo penso che tutto ciò che ho imparato durante questa esperienza certamente la userò in futuro, sia per quanto riguarda lo sviluppo di applicazioni mobile, ma soprattutto per quanto riguarda la gestione del tempo e del lavoro in un team di sviluppo. //Grazie per l'attenzione.//
https://github.com/JakMobius/courses
https://raw.githubusercontent.com/JakMobius/courses/main/mipt-os-basic-2024/sem04/utils.typ
typst
#import "../theme/theme.typ": * #import "@preview/cetz:0.2.2" #let cell-color(base-color) = { if base-color == none { base-color = blue } let background-color = color.mix((base-color, 20%), (white, 80%)) let stroke-color = color.mix((base-color, 50%), (black, 50%)) ( base-color: base-color, background-color: background-color, stroke-color: stroke-color, ) } #let conpro(color, content) = { set text(fill: white, weight: "black", size: 20pt) box( baseline: 0.5em, width: 1.5em, height: 1.5em, radius: 5pt, fill: color, )[ #align(center + horizon)[#content] ] h(0.5em) } #let pro() = conpro(green)[+] #let con() = conpro(red)[-] #let underline(from, to, line, ..options) = { let opts = ( char-width: 0.5, stroke-width: 3pt, line-height: 1.5, line-offset: 1, dy: -1.5, content: none, content-right-anchor: 15, content-func: (content) => { set align(horizon) set text(size: 20pt) content }, ..options.named() ) let hw = opts.stroke-width.cm() / 2; let x1 = opts.char-width * from; let x2 = opts.char-width * to; let anc = x1 + 0.5 let height = line * opts.line-height + 1 cetz.draw.line((x1 - hw, opts.dy), (x2 + hw, opts.dy)) cetz.draw.line((x1, opts.dy), (x1, -1.3)) cetz.draw.line((x2, opts.dy), (x2, -1.3)) cetz.draw.line((anc, opts.dy), (anc, opts.dy - height)) cetz.draw.line((anc + 0.5, opts.dy - height), (anc - hw, -1.5 - height)) if (opts.content != none) { cetz.draw.content( (anc + 0.7, opts.dy - height + opts.line-height / 2), (opts.content-right-anchor, opts.dy - height - opts.line-height / 2), (opts.content-func)(opts.content)) } } #let semibold(content) = { set text(weight: "semibold") content }