repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/block-sizing_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 100pt) #set align(center) #lorem(10) #block(width: 80%, height: 60pt, fill: aqua) #lorem(6) #block( breakable: false, width: 100%, inset: 4pt, fill: aqua, lorem(8) + colbreak(), )
https://github.com/csskevin/typst-iaik-bachelor-thesis-template
https://raw.githubusercontent.com/csskevin/typst-iaik-bachelor-thesis-template/master/src/lib.typ
typst
MIT License
// ---------------------------- // TEMPLATE #let conf( title: "", author: "", keywords: (), supervisors: (), institute: "", university: "", curriculum: "", abstract: none, location_date: "Graz, Month Year", doc ) = { // ---------------- // Document Default Style // ---------------- set document( title: title, author: author, keywords: keywords ) set text( font: "New Computer Modern", size: 11pt, hyphenate: false ) show raw: set text(size: 11pt) set par(spacing: 0.55em, leading: 0.55em, first-line-indent: 1.8em, justify: true) show figure: set par(justify: false) show raw: set text(font: "New Computer Modern Mono") show heading: set block(above: 1.4em, below: 1em) set list(tight: false, spacing: 15pt) show heading.where(level: 1): set block(below: 30pt) show heading.where(level: 1): set text(size: 20.74pt) show heading.where(level: 2): set block(below: 20pt) show heading.where(level: 2): set text(size: 14.4pt) show heading.where(level: 3): set block(below: 15pt) show heading.where(level: 3): set text(size: 12pt) show heading.where(level: 4): set heading(numbering: none) show heading.where(level: 4): set text(size: 10.95pt) // ("test") gets interpreted as string // ("test",) gets interpreted as array // We therefore convert ("test") to ("test",) so we can use in // for array manipulation functions let str_to_array(content) = { if type(content) == str { return (content,) } else if type(content) == array { return content } else { panic("Type " + type(content) + " provided. Only str or array types are allowed.") } } // ---------------- // COVER PAGE // ---------------- set page( paper: "a4", margin: ( top: 82.2pt, bottom: 151.65pt ) ) set heading(numbering: none) set align(center) block(grid( columns: (20%, 60%, 20%), align: (left, center, right), inset: (0pt, (y: 42pt), (y: 25.5pt)), image("assets/iaik.svg", height: 107pt), text( size: 8.5pt, font: "Noto Sans", tracking: 3.5pt, ("SCIENCE", "PASSION", "TECHNOLOGY").join(box( width: 30pt, height: 3.5pt, align(center, square(size: 2pt, fill: black)), ) ), ), image("assets/logo.svg", width: 80pt), ), below: 47pt) block(text(author, size: 14pt), below: 50.1pt) block(text(title, weight: "bold", size: 18pt), below: 35.4pt) set align(center + bottom) block(text("BACHELOR'S THESIS", weight: "bold"), below: 10pt) block(text("Bachelor's degree programme: " + curriculum), below: 44pt) // block(text(if str_to_array(supervisors).len() > 1 [Supervisors] else [Supervisor], size: 10pt, weight: "bold"), below: 11pt) str_to_array(supervisors).map(supervisor => block(text(supervisor), above: 7pt, below: 0pt)).join("") v(13pt) block(text(institute), below: 7pt) block(text(university), below: 51pt) block(text(location_date, size: 8pt)) // ---------------- // GENERAL PAGE // ---------------- set align(left + top) set page( paper: "a4", margin: ( left: 1in + 17pt, top: 154pt, right: 1in + 17pt, bottom: 1in + 88pt ), numbering: "1" ) heading("Abstract", level: 1) block(text(abstract), below: 20pt) set par(first-line-indent: 0pt) text("Keywords: ", weight: "bold") text(str_to_array(keywords).join([ $dot$ ])) set heading(numbering: "1.1") set cite( style: "alphanumeric" ) pagebreak() text(doc) }
https://github.com/anesthetice/typst-templates
https://raw.githubusercontent.com/anesthetice/typst-templates/main/README.md
markdown
The Unlicense
## typst and rnote templates I use the main typst template I use was heavily inspired on dogeystamp's. https://github.com/dogeystamp/typst-templates/
https://github.com/HiiGHoVuTi/requin
https://raw.githubusercontent.com/HiiGHoVuTi/requin/main/calc/ev.typ
typst
#import "../lib.typ": * #show heading: heading_fct Soit $Sigma := {0, 1}$. On identifie les réels de $[0,1]$ à leurs développements binaires canoniques. Un réel $x in [0, 1[$ est dit _calculable_ lorsqu'il existe une suite $(x^n in Sigma^star)$ croissante calculable telle que $ forall n in NN, med |x - x_n| <= 2^(-n) \ (x_n^n)_(n in NN) "non stationnaire à" 1 $ On pose $KK$ l'ensemble des nombres réels calculables, avec la somme de $RR\/ZZ$ (modulo $1$). === Calculabilité dans les réels #question(0)[Montrer que $0$ est calculable.] #question(1)[Montrer que tout rationnel est calculable.] #question(1)[L'égalité de deux réels calculables est-elle calculable ?] #question(1)[Qu'en est-il de la somme de deux réels calculables ?] #question(1)[En déduire que $KK$ est un $QQ$-espace vectoriel.] #question(2)[Montrer qu'il existe un réel non calculable.] #question(2)[Un nombre algébrique est-il calculable ?] === Espaces et bases #question(1)[Peut-on calculer une base de $RR$ comme $KK$-espace vectoriel ?] #question(2)[Quelle est la dimension de $KK$ comme $QQ$-espace vectoriel ?] #question(3)[Peut-on calculer une base de $KK$ comme $QQ$-espace vectoriel ?] === Oracles On suppose dans cette partie disposer d'un oracle calculant l'égalité dans $KK$. #question(1)[Montrer que la comparaison dans $KK$ devient calculable.] #question(2)[Montrer que le problème de l'arrêt devient calculable.]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/symbol-01.typ
typst
Other
// Error: 13-20 unknown symbol modifier #emoji.face.garbage
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/droplet/0.2.0/src/droplet.typ
typst
Apache License 2.0
#import "extract.typ": extract #import "split.typ": split // Sets the font size so the resulting text height matches the given height. // // If not specified otherwise in "text-args", the top and bottom edge of the // resulting text element will be set to "bounds". // // Parameters: // - height: The target height of the resulting text. // - threshold: The maximum difference between target and actual height. // - text-args: Arguments to be passed to the underlying text element. // - body: The content of the text element. // // Returns: The text with the set font size. #let sized(height, ..text-args, threshold: 0.1pt, body) = style(styles => { let text = text.with( top-edge: "bounds", bottom-edge: "bounds", ..text-args.named(), body ) let size = height let font-height = measure(text(size: size), styles).height // This should only take one iteration, but just in case... while calc.abs(font-height - height) > threshold { size *= 1 + (height - font-height) / font-height font-height = measure(text(size: size), styles).height } return text(size: size) }) // Shows the first letter of the given content in a larger font. // // If the first letter is not given as a positional argument, it is extracted // from the content. The rest of the content is split into two pieces, where // one is positioned next to the dropped capital, and the other below it. // // Parameters: // - height: The height of the first letter. Can be given as the number of // lines (integer) or as a length. // - justify: Whether to justify the text next to the first letter. // - gap: The space between the first letter and the text. // - hanging-indent: The indent of lines after the first line. // - overhang: The amount by which the first letter should overhang into the // margin. Ratios are relative to the width of the first letter. // - transform: A function to be applied to the first letter. // - text-args: Named arguments to be passed to the underlying text element. // - body: The content to be shown. // // Returns: The content with the first letter shown in a larger font. #let dropcap( height: 2, justify: false, gap: 0pt, hanging-indent: 0pt, overhang: 0pt, transform: none, ..text-args, body ) = layout(bounds => style(styles => { let (letter, rest) = if text-args.pos() == () { extract(body) } else { // First letter already given. (text-args.pos().first(), body) } if transform != none { letter = transform(letter) } let letter-height = if type(height) == int { // Create dummy content to convert line count to height. let sample-lines = range(height).map(_ => [x]).join(linebreak()) measure(sample-lines, styles).height } else { measure(v(height), styles).height } // Create dropcap with the height of sample content. let letter = sized(letter-height, letter, ..text-args.named()) let letter-width = measure(letter, styles).width // Resolve overhang if given as percentage. let overhang = if type(overhang) == ratio { letter-width * overhang } else if type(overhang) == relative { letter-width * overhang.ratio + overhang.length } else { overhang } // Try to justify as many words as possible next to dropcap. let bounded = box.with(width: bounds.width - letter-width - gap + overhang) let index = 1 let (first, second) = while true { let (first, second) = split(rest, index) let first = { set par(hanging-indent: hanging-indent, justify: justify) first } if second == none { // All content fits next to dropcap. (first, none) break } // Allow a bit more space to accommodate for larger elements. let max-height = letter-height + measure([x], styles).height / 2 let height = measure(bounded(first), styles).height if height > max-height { split(rest, index - 1) break } index += 1 } // Layout dropcap and aside text as grid. set par(justify: justify) box(grid( column-gutter: gap, columns: (letter-width - overhang, 1fr), move(dx: -overhang, letter), { set par(hanging-indent: hanging-indent) first if second != none { linebreak(justify: justify) } } )) linebreak() second }))
https://github.com/ice1000/website
https://raw.githubusercontent.com/ice1000/website/main/typst-test.typ
typst
#import "@preview/ctheorems:1.1.2": * #import "/book.typ": book-page #show: book-page.with(title: "<NAME>") The purpose of this page is to test some random things. #show: thmrules.with(qed-symbol: $square$) #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)) #let emsp = h(2em) #definition("Heterogeneous Composition")[ $ (A:bb(I) → cal(U)_1 #emsp φ:bb(F) #emsp r, s : bb(I) #emsp u: (i:bb(I)) → "Partial"(φ ∨ i=r, A(i)))/( "com"^(r arrow.squiggly s)(u) : { A(s) | φ ∨ r=s ↦ u(s) }) $ ] == Harpoons $ & "⇀-"β\ & (Γ, x:A_1 ⊢ C_2:X_2 #h(2em) Γ ⊢ V_1 : A_1)/ (Γ ⊢ "ap"(λ (x. C_2); V_1) ≡ [V_1 slash x]C_2 : X_2) $ $ & "⇀-"η\ & (Γ ⊢ C : A_1 ⇀ X_2)/ (Γ ⊢ λ (x. "ap"(C; x)) ≡ C : A_1 ⇀ X_2) $ == Coproducts $ & "+-"β_1\ & (Γ ⊢ V_1 : A_1 #h(2em) Γ, x:A_1 ⊢ C_1:X #h(2em) Γ, x:A_2 ⊢ C_2:X)/ (Γ ⊢ "case" 1 · V_1 { x. C_1 | x. C_2 } ≡ [V_1 slash x]C_1 : X) $ $ & "+-"β_2\ & (Γ ⊢ V_2 : A_2 #h(2em) Γ, x:A_1 ⊢ C_1:X #h(2em) Γ, x:A_2 ⊢ C_2:X)/ (Γ ⊢ "case" 2 · V_2 { x. C_1 | x. C_2 } ≡ [V_2 slash x]C_2 : X) $ $ & "+-"η\ & (Γ, x:A_1 + A_2 ⊢ C : X)/ (Γ, x:A_1 + A_2 ⊢ "case" x {y. [1·y slash x]C | z. [2·z slash x]C} ≡ C : X) $ $ L = integral^2_0 norm(v(t)) med d t = lr([sqrt(-(10t sin t^2 ) + ( 10t cos t^2) + (24 t )) ]^2_0,size: #5em) \ $ $ lr({ A mid(|) integral }) quad lr(size: #1em, { A mid(|) integral }) quad lr(size: #(1em+20%), { A mid(|) integral }) "wrong" \ lr(] A mid(|) integral ]) quad lr(size: #1em, ] A mid(|) integral ]) quad lr(size: #(1em+20%), ] A mid(|) integral ]) "ok" \ lr(( A mid(|) integral ]) quad lr(size: #1em, ( A mid(|) integral ]) quad lr(size: #(1em+20%), ( A mid(|) integral ]) "wrong" $
https://github.com/maxlambertini/troika-srd-typst
https://raw.githubusercontent.com/maxlambertini/troika-srd-typst/main/chap02.typ
typst
#let chap02_title = [ = Character Creation <character-creation> ] #let chap02=[ == Overview: + Roll 1d3+3 to determine Skill. + Roll 2d6+12 to determine Stamina. + Roll 1d6+6 to determine Luck. + Record Baseline Possessions that every new character starts with: + 2d6 Silver Pence, a Knife, a Lantern & Flask of Oil, a Rucksack, 6 Provisions. + Roll d66 on the Background Table and record Possessions and Skills. == Backgrounds <backgrounds> Backgrounds are everything your character was before you got hold of them. They provide you with Skills, Possessions, and other Special benefits where noted. Slide into the role and make it your own. Roll randomly to determine your starting Background. Notice that they only touch the edge of specificity: it is up to you to tailor them to the worlds you play in. Rework them or remove them entirely and replace them with your own unique vision of the spheres. Boldly lay claim to the games you play, create content recklessly, and always write in pen. === Creating Your Own Backgrounds <creating-your-own-backgrounds> When creating your own Backgrounds, as a general rule, stick to 10 or so total points distributed in a range of 1 to 3 with 3 being someone who has already mastered their trade. Do not dismiss the importance of a description — they are the players’ window into the world — but don’t feel intimidated by them. Keep them simple and pack as much information into them as you are able; when they are short and evocative the player will fill in the gaps. The Backgrounds need not be balanced or equal to one another but should instead be fun and flavourful. After making a new Background take a moment to consider the reaction of someone receiving it instead of some other entry in your particular and ever changing list. Balance the enjoyment rather than the numbers. == Sample Backgrounds <sample-backgrounds> === 11 Ardent Giant of Corda <ardent-giant-of-corda> Every giant has a different story about Corda, well told and interrupted with tears and laughter, of how they lost it and mean to find it soon enough but oh, what of today? We should drink and cheer, we’ll search once again in the morning! ==== Possessions <possessions> - An Artefact of Lost Corda, being either an enormous Blue Star Map which can tell you where any portal leads \(with a successful Astrology test) or a pocket barometer for forecasting the weather \(5 in 6 accuracy) or a Ruby Lorgnette granting +2 Second Sight. ==== Advanced Skills <advanced-skills> - 4 Strength - 3 Astrology - 2 Run - 2 Climb === 12 Befouler of Ponds <befouler-of-ponds> You’re a wise man, a high priest, a pond-pisser, a typical but committed adherent of P!P!Ssshrp. The bloated Toad God has no church other than the periphery of ponds where the foulness catches in the reeds and no congregation other than the gnats and dragonflies. You minister to them all the same. ==== Possessions <possessions-1> - Sackcloth Robes, caked in stinking mud and undergrowth. +1 to Sneak rolls in marshy terrain while wearing them, -1 everywhere else ’cos it stinks! - A Large, Worn Wooden Ladle \(Damage as Mace). ==== Advanced Skills <advanced-skills-1> - 3 Spell – Drown - 3 Swim - 2 Spell – Tongue Twister - 2 Spell – Undo - 1 Spell – Web - 1 Sneak - 1 Second Sight ==== Special <special> You never contract disease as a result of drinking stagnant liquids. === 13 Burglar <burglar> As a second-story man you often have cause to wander. Enemies come naturally from both sides of the law and it pays to keep ahead of trouble. ==== Possessions <possessions-2> - Crossbow and 18 Bolts. - Roll of Lock Picks. - Grappling Hook. ==== Advanced Skills <advanced-skills-2> - 2 Sneak - 2 Locks - 1 Awareness - 1 Climb - 1 Trapping - 1 Knife Fighting - 1 Crossbow Fighting ==== Special <special-1> You may Test your Luck to find and get in with the local criminal underbelly if one exists. === 14 Cacogen <cacogen> You are Those-Filthy-Born, spawned in the hump-backed sky lit only by great black anti-suns and false light. Your mother was sailing on the golden barges or caught in some more abstract fate when she passed you, far from the protective malaise of the million spheres. You were receptive to the power and the glory at a generative time and it shows in your teratoid form. ==== Possessions <possessions-3> - Fusil. - 2d6 Plasmic Cores. - Sword. - Velare. ==== Advanced Skills <advanced-skills-3> - 2 Fusil Fighting - 2 Astrology - 2 Second Sight - 2 Spell – Random - 2 Spell – Random - 2 Golden Barge Pilot - 1 Spell – Random - 1 Sword Fighting === 15 Chaos Champion <chaos-champion> You no longer don the spiked brass armour but you still have the ear of your Chaos patron. They’re happy for you to experiment with not plunging your world into disorder and, ultimately, darkness, but the door is always open. ==== Possessions <possessions-4> - Ritual Scars. - A Huge Maul. - Assortment of Ragged Armour \(counts as Modest Armour). - Dream Journal, almost full. ==== Advanced Skills <advanced-skills-4> - 6 Language – Kurgan - 3 Maul Fighting - 3 Secret Signs – Chaos Patron - 1 Spell – Random - 1 Second Sight ==== Special <special-2> Name your patron. You may call upon your patron for aid once per day. To do so roll three 6s on 3d6. The GM interprets their intervention. === 16 Claviger <claviger> The Key Masters wander the universe fathoming the workings of all entryways. Though they’re quite fascinated with simple chests and doors they are most excited by metaphysical and metaphorical barriers. You might find small conclaves of Clavigers camped around the feet of Demon Gates, debating appropriate methods of attack, or building obscure machines of entry. ==== Possessions <possessions-5> - Festooned with Keys \(counts as Modest Armour). - A Distinguished Sledgehammer \(Damage as Maul). - Lock Picking Tools. ==== Advanced Skills <advanced-skills-5> - 4 Locks - 3 Strength - 3 Trapping - 2 Spell – Open - 1 Spell – See Through - 1 Maul Fighting - 1 Spell – Lock === 21 Demon Stalker <demon-stalker> You stake your reputation upon your ability to hunt and kill demonic creatures and those who break bread with them. Goat men in the wilds or the Angel cults of the slums, all need to be driven back off the edge of the map and onto the shores of chaos. ==== Possessions <possessions-6> - A Silver Sword. - 16 Silver Arrows and Bow. - Pouch of Salt. - Vial of Demon Blood. ==== Advanced Skills <advanced-skills-6> - 5 Language – Abyssal - 3 Spell – Blood Shroud - 2 Second Sight - 2 Sword Fighting - 2 Bow Fighting - 1 Tracking - 1 Sneak === 22 Dwarf <dwarf> You are a short, hairy, belligerent, alcohol dependent creature. Dwarfs are a sculpted people, ungendered, and thus there are no Dwarf children or Dwarf families to prevent you from fully committing to the important Dwarfy endeavours of creating fine art in unusual places. You intend to find the most unusual places in all the million spheres. ==== Possessions <possessions-7> - Masonry Hammer. - Roll of Artist’s Supplies. ==== Advanced Skills <advanced-skills-7> - 3 Awareness - 2 Sculpting - 2 Painting - 2 Metalworking - 2 Construction - 2 Strength - 2 Fist Fighting - 2 Wrestling - 1 Hammer Fighting ==== Special <special-3> Dwarfs may eat gems and rare metals as food replacements. You, in fact, vastly prefer the taste of rare minerals to mundane food. === 23 Epopt <epopt> You are a roaming seer, selling your visions at courts and fetes. You are instantly recognisable by your yellow coif and habit as being open for business. Road weary and worldwise, your unpopular visions cause you to constantly move on. ==== Possessions <possessions-8> - Yellow Epopt Outfit, padded for protection against unhappy clients \(counts as Modest Armour). - Epopt Staff, being a walking staff with seeing crystal on one end \(Damage as Staff). - Collapsible Tent, large enough for your stall. ==== Advanced Skills <advanced-skills-8> - 2 Awareness - 2 Evaluate - 1 Second Sight - 1 Etiquette - 1 Fist Fighting - 1 Run ==== Special <special-4> Epopts may Test their Luck to get a yes or no answer to a question about mundane matters. The GM should make this Test in private, not informing the Epopt if their visions are accurate. === 24 Exographer <exographer> Where you come from it’s become quite normal to traverse the Spheres. Idle academics like yourself have even begun to study these more remote reaches of the divine effluvia. Though these rural indwellers may never appreciate your important work, you continually, thanklessly measure their latent phlogiston. For posterity. ==== Possessions <possessions-9> - Hermetically Sealed Rubber Suit \(counts as Heavy Armour) - Exographical Surveyors Box - Spring-Loaded Measuring Tape - Pistolet - 1d6 Plasmic Cores ==== Advanced Skills <advanced-skills-9> - 4 Exography - 3 Golden Barge Pilot - 2 Astrology - 2 Pistolet Fighting === 25 The Fellowship of Knidos <the-fellowship-of-knidos> Mathmologists honour the clean and unambiguous truths of mathematics and coordinate them with their observations of the multiverse. All things can be measured and predicted with the application of the correct mathmological ratios, those methods applied to penetrate the ethereal surface and glimpse the fundamental numbers below. ==== Possessions <possessions-10> - Large Astrolabe \(Damage as Mace). - Abacus. - Lots of Scrolls and Writing Equipment. ==== Advanced Skills <advanced-skills-10> - 3 Mathmology - 2 Astrology - 2 Spell – Find === 26 Fellow of the Peerage of Porters & Basin Fillers <fellow-of-the-peerage-of-porters-basin-fillers> Luggers are a servile group by nature, most often found in the service of others, weighed down by loads that would buckle a donkey. You take pride in this, so much so that the everyday assignments of the guild cannot sate your desire to serve, causing you to venture out in search of a real challenge for such a talented varlet. ==== Possessions <possessions-11> - A Wooden Yoke. - Brown Overcoat and Soft Doffing Cap of the Guild. - A Bale Hook \(Damage as Knife and +1 on rolls to lift heavy objects). - Length of Rope. ==== Advanced Skills <advanced-skills-11> - 4 Strength - 2 Fist Fighting - 2 Run - 1 Hook Fighting - 1 Sneak - 1 Awareness === 31 Gremlin Catcher <gremlin-catcher> No matter what country, sphere, or abstract dimension you may find yourself in, be assured that gremlins will be there digging their warrens and bothering nice people willing to pay you a shiny penny to bash their little heads in. ==== Possessions <possessions-12> - Small but Vicious Dog. - Flat Cap. - A Club. - A Sack. - 1d6 Empty Gremlin Jars. - A Jar with a Pissed–off Gremlin Inside. ==== Advanced Skills <advanced-skills-12> - 4 Tunnel Fighting - 4 Trapping - 2 Sneak - 2 Awareness - 2 Club Fighting - 2 Tracking - 1 Swim ==== 32 Journeyman of the Guild of Sharp Corners <journeyman-of-the-guild-of-sharp-corners> You are an assassin in training, graduated from fighting dummies and branding practise clients, freshly imbued with a license to ply your trade. You haven’t fully developed the idiosyncratic methods required of a master but you are on the path. ==== Possessions <possessions-13> - Black Clothes of the Apprentice. - Garrotte. - Curved Sword. - 3 Vials of Poison. - Crossbow and 6 Bolts. ==== Advanced Skills <advanced-skills-13> - 1 Poison - 1 Sneak - 1 Locks - 1 Knife Fighting - 1 Climb - 1 Awareness - 1 Crossbow Fighting - 1 Swim - 1 Disguise === 33 Lansquenet <lansquenet> You were a mercenary retained in the exclusive service of the Phoenix Throne, handsomely paid and sent to distant spheres on golden ships to spread the ineffable glory of your lords at the tip of your flaming sword. ==== Possessions <possessions-14> - Exquisite Pistolet. - Bandolier containing 18 Plasmic Cores. - Greatsword. - Brightly Coloured Clothing with lots of tassels and bells \(impossible to sneak). Though frivolous looking it is in fact built with the Autarch’s divine alchemy and considered Modest Armour while weighing the same as normal clothing \(takes no slots in your inventory). ==== Advanced Skills <advanced-skills-14> - 2 Greatsword Fighting - 2 Pistolet Fighting - 1 Run - 1 Fist Fighting - 1 Astrology === 34 Lonesome Monarch <lonesome-monarch> You were the ruler of all you surveyed, a great conqueror, a lawbringer! Unfortunately your horse sped off into the pixie forest, or the court magician ensured you disappeared, or you led a sortie into the stars to put your stamp on them as well. Either way you are now a lost and lonely sovereign without a kingdom — no one has heard of you or your people. Most don’t believe you and laugh, or worse, they do believe you and shrug at the vagaries of fate. ==== Possessions <possessions-15> - Nice Weapon of your choice. - Crown. - Tired Horse. ==== Advanced Skills <advanced-skills-15> - 3 Etiquette - 3 Fighting in your Nice Weapon - 3 Ride - 1 Tracking === 35 Member of Miss Kinsey’s Dining Club <member-of-miss-kinseys-dining-club> The Eaters know that there are only two worlds: the Without and the Within. They intend to insert as much of the prior into the latter as they can while experiencing the finest delights available. All culinary experience is open to them as nothing is forbidden at Miss Kinsey’s. Try the other, other, other white meat. ==== Possessions <possessions-16> - Sharp metal dentures \(Damage as Sword) or forked metal dentures \(Damage as Knife. On a Mighty Blow you may cleanly strip all the flesh from one small appendage) or blunt metal dentures \(Damage as Knife. May be used to eat hard objects). - Embroidered napkin. ==== Advanced Skills <advanced-skills-16> - 3 Etiquette - 1 Strength - 1 Tracking - 1 Trapping - 1 Gastrology ==== Special <special-5> Eaters are immune to mundane ingested poisons. They may also identify any object if eaten, gaining knowledge of its material, its origin \(if plausibly familiar), and its magical properties on a successful Test of Gastrology though the object must be thoroughly masticated, not merely swallowed and passed. This does not grant special immunity to any effects the object may possess. === 36 Monkeymonger <monkeymonger> Life on The Wall is hard. One is never more than a few yards from an endless fall yet those precarious villages still need to eat. This is where you come in with your Edible Monkeys \(the distinction is purely for appeal since all monkeys are of course edible). You used to spend days on end dangling your feet off the edge of the world, watching over your chittering livestock while they scampered hither and thither, but there was no future in monkey meat. You wanted much more and so stepped off. Or you fell off. Either way you and some unlucky monkeys are here now and that’s all that matters. ==== Possessions <possessions-17> - Monkey Club. - Butcher’s Knife. - 1d6 Small Monkeys that do not heed commands but are too scared and hungry to travel far from you. - A Pocket Full of Monkey Treats. ==== Advanced Skills <advanced-skills-17> - 4 Climb - 2 Trapping - 1 Club Fighting - 1 Knife Fighting ==== Special <special-6> The GM may choose to roll on this table anytime the Mien of monkeys must be determined. ==== Mien <mien> - 1 Playful - 2 Stalking - 3 Hungry - 4 Tired - 5 Austere - 6 Aggressive === 41 Necromancer <necromancer> The least popular of magical practitioners, Necromancers are shunned by the major centres of learning, left to their own devices on the edges of society, passing on knowledge in the time honoured master–student dynamic. This loneliness encourages students to make their own friends. ==== Possessions <possessions-18> - Dusty Robes. - The Skull of your Master or Zombie Servant or Ghost with whom you have developed a codependent relationship. ==== Advanced Skills <advanced-skills-18> - 2 Healing - 2 Mortuary Science - 2 Relationship Counseling - 1 Spell – Posthumous Vitality - 1 Spell – Skeletal Counsel - 1 Spell – Torpor - 1 Sneak === 42 Parchment Witch <parchment-witch> Known for their smooth skin, midnight gatherings, and preternatural fear of rain and open flames; the Parchment Witches are long-dead sorcerers who cannot give up the vanity of life. They cover themselves in perfect paper skin, a patiently painted and immaculately folded imitation of life intended to hide ancient bone and gristle. ==== Possessions <possessions-19> - d6 Rolls of Parchment. - Vials of Pigments and Powders. - Collection of Brushes. - Sword Cane. ==== Advanced Skills <advanced-skills-19> - 2 Spell – Protection From Rain - 2 Spell – Callous Strike - 2 Spell – Quench - 2 Spell – True Seeing - 2 Disguise - 2 Second Sight - 1 Healing - 1 Spell – Undo - 1 Spell – Random ==== Special <special-7> You are undead and so do not need to breathe or circulate blood. You take double Damage from Silver Weapons and regain Stamina half as effectively from all sources. You must Test your Luck if outside in the rain, are made wet, are close to open flames, or suffer generally grievous wounds. A failure will see your skin ruined. If your skin is compromised you are very obviously a walking corpse. === 43 Derivative Dwarf <derivative-dwarf> Dwarfs are known for being the finest artisans of the million spheres. Give a Dwarf a rock and they will make gold, give a Dwarf a boulder and they will make a Dwarf. You were supposed to be the finest expression of Dwarfy craftsmanship, a true masterpiece, a brand new step in aesthetic design, a jump not seen since the old masters. ==== Possessions <possessions-20> - Woodsman’s Axe. - Empty Firkin. ==== Advanced Skills <advanced-skills-20> - 3 Fist Fighting - 3 Awareness - 2 Strength - 2 Wrestling - 2 Axe Fighting ==== Special <special-8> As 22 Dwarf but additionally: To non-Dwarfy eyes you look like any other Dwarf. Only Dwarfs can see the derivative or uninspired parts of your creation. Other Dwarfs will completely ignore you since you remind them of their fading novelty. You have +4 Sneak versus Dwarfs. === 44 Questing Knight <questing-knight> You are on a quest for the grail, or the sword, or the throne, or for god, or a lost love, or some other significant object. Your sort are common enough, wandering the worlds, acting out your romantic melodrama, accusing good folk of being demons or faeries. Questing Knights are generally considered to be harmless. ==== Possessions <possessions-21> - Heavy Armour. - Horse. - Lance \(Damage as Spear). - Sword. - Shield. - A Quixotic Undertaking. ==== Advanced Skills <advanced-skills-21> - 3 Jousting - 2 Sword Fighting - 2 Spear Fighting - 1 Shield Fighting - 1 Awareness === 45 Red Priest <red-priest> You are an evangelist of the Red Redemption, wandering confessor, cauterizer of the festering wound of sin: the constant accumulation and recreational consumption of Mass. How can your spirit fly free while shackled and flabby? ==== Possessions <possessions-22> - Red Robes. - Traditional Faceless Metal Helmet of - your order \(Modest Armour). - Symbolic \(but fully sized and fully functional) Single Headed Greataxe, to help batter down the door to sin \(Damage as Greatsword). ==== Advanced Skills <advanced-skills-22> - 2 Spell – Ember - 2 Spell – Fire Bolt - 2 Spell – Flash - 2 Great Axe Fighting - 1 Second Sight - 1 Spell – Exorcism === 46 Rhino-Man <rhino-man> The original Rhino-Men were created by an insane sorcerer several centuries ago but rebelled and killed him. They are fairly rare creatures, serving as formidable and loyal guards to those who can afford their services. ==== Possessions <possessions-23> - Horn \(Damage as Knife). - Thick Skin \(Rhino Men always count - as being Modestly Armoured). - Undersized Spear. - Tiny, Useless Helmet. - Knuckle Dice. - Half Full Firkin of Rhino-beer \(20 Provisions worth). ==== Advanced Skills <advanced-skills-23> - 3 Spear Fighting - 2 Run - 2 Strength - 1 Gambling === 51 Sceptical Lamassu <sceptical-lamassu> With the body of a bull, the head of a man, the forelegs of a cat, and the wings of a swan you are the sweetest of the children of the gods. You, however, were not content to rest on your cloud and instead descended from the heavens or crawled up from the abyss and set about finding your own path among the stars. ==== Possessions <possessions-24> - Incidental Sacred Jewellery worth 10d6 Silver pence if traded. - Pillbox Hat. - Claws \(Damage as Sword). - Hooves \(Damage as Club). - Wings — able to fly as fast as a running man over clear ground. ==== Advanced Skills <advanced-skills-24> - 3 Fly - 3 Spell – Random - 3 Spell – Random - 3 Spell – Random - 2 Claw Fighting - 1 Hoof Fighting === 52 Sorcerer of the Academy of Doors <sorcerer-of-the-academy-of-doors> You are a student at Troika’s most prestigious wizarding academy \(pride of the city, experts in pan-dimensional mobility) you were finally able to penetrate the \(2d6)th door. You are no master but few outside your peers can claim to know more about the vagaries of skyward travel than you. ==== Possessions <possessions-25> - Small Functional Door worn on your forehead through which you - channel your magic. - Flashy Robes. ==== Advanced Skills <advanced-skills-25> - 3 Astrology - 2 Second Sight - 2 Spell – Astral Reach - 1 Spell – Teleport - 1 Spell – Web - 1 Spell – Random - 1 Spell – Random - 1 Spell – Random === 53 Sorcerer of the College of Friends <sorcerer-of-the-college-of-friends> As an integral part of your tutelage in the sub-dimensional academy of the Cordial Wizard God you spent your childhood learning about the fate of pixies, the colour of magic, ritual grammar, and endless other theoretical topics. Now you’re out in the world, discovering that your education hardly accounted for any of the things that you’ve seen. ==== Possessions <possessions-26> - Pointed Wizard Hat you received at graduation. - Pocket Full of Wizard Biscuits \(2d6, each counts as a Provision). - Wand used to help focus new apprentices, now kept for sentimental reasons. ==== Advanced Skills <advanced-skills-26> - 4 Secret Signs – Witching Words - 2 Run - 1 Climb - 1 Sleight of Hand - 1 Swim - 1 Sneak - 1 Second Sight - 1 Spell – Jolt - 1 Spell – Amity - 1 Spell – Mirror Selves - 1 Spell – Protection from Rain - 1 Spell – Helping Hands - 1 Spell – Purple Lens - 1 Spell – Random === 54 Fellow of The Sublime Society of Beef Steaks <fellow-of-the-sublime-society-of-beef-steaks> Brawlers believe the application of might and a good beef steak is the universal truth. Words have no power and can no more define the universe than they can build a house, lift a cup, or sear a steak. Might can! Really, they have thought a lot about this. ==== Possessions <possessions-27> - Weapon of your choice. - Small Gridiron. - 2kg of Premium Meat Cuts. - Waistcoat. - Bottle of Strong but Fancy Wine. ==== Advanced Skills <advanced-skills-27> - 2 in a Fighting Skill of your choice - 2 Wrestling - 2 Swim - 2 Climb - 2 Run - 2 Fist Fighting - 1 Grilling === 55 Temple Knight of Telak the Swordbringer <temple-knight-of-telak-the-swordbringer> You were once \(and possibly still are) a fanatical monk set to maintain constant, vigilant martial readiness in preparation for the end times, when all doorways crumble inwards. You are always prepared and never unready. ==== Possessions <possessions-28> - The Blessing of Telak. - 6 Swords of your choice. ==== Advanced Skills <advanced-skills-28> - 3 Awareness - 2 Blacksmithing - 1 Sword Fighting - 1 Greatsword Fighting ==== Special <special-9> The blessing of Telak awards you Armour equal to half \(rounded down) the number of Swords you carry. If you carried 6 Swords your Armour would be 3 while if you carried 9 it would be 4. You must be overtly armed at all times or else Telak will take this blessing away until you forge and donate to the unarmed a brand new Sword. === 56 Thaumaturge <thaumaturge> Wandering miracle workers, the depths of whose clothes are filled with pouches of unguents, holy icons and herbs. No matter the metaphysical need, you are always prepared. ==== Possessions <possessions-29> - Thaumaturgic Fez. - Staff, bedecked with charms and bells. May reroll one die on the Oops! Table if using this staff, however, may never sneak up on anyone because of the ringing and clattering it makes. - Curled Shoes. - Voluminous Robes. ==== Advanced Skills <advanced-skills-29> - 3 Spell – Undo - 2 Spell – Assume Shape - 2 Spell – Thunder - 2 Spell – Random - 1 Spell – Brittle Twigs - 1 Spell – Random - 1 Second Sight - 1 Astrology ==== Special <special-10> You may Test your Luck to just so happen to have exactly the \(common) mystic tchotchke, bauble, or gewgaw the situation requires. === 61 Thinking Engine <thinking-engine> Your eyes are dull ruby spheres, your skin is hard and smooth like ivory but brown and whorled like wood. You are clearly broken, you have no memory of your creation or purpose, and some days your white internal juices ooze thickly from cracks in your skin. ==== Possessions <possessions-30> - Soldering iron. - Detachable autonomous hands or centaur body \(+4 Run) or inbuilt particle detector \(+4 Second Sight) or one random Spell at rank 3. ==== Advanced Skills <advanced-skills-30> - 3 Golden Barge Pilot - 2 Astrology - 2 Pistolet Fighting - 2 Healing - 1 Run - 1 Strength - 1 Cooking ==== Special <special-11> You don’t recover Stamina by resting in the usual manner — instead you must spend a full rest period with a hot iron welding your skin back together like putty. For each hour of rest with access to the right tools you regain 3 Stamina. You may recharge plasmic machines by hooking your fluids to them and spending Stamina at a rate of 1 Stamina and 6 minutes per charge. You always count as being at least Lightly Armoured. === 62 Vengeful Child <vengeful-child> Your village was burnt down by ruffians, or your mother was beheaded by snake cultists, or your father was hung by corrupt officials. Either way you took umbrage and entered the world with a chip on one shoulder and an oversized Sword on the other. ==== Possessions <possessions-31> - Too-Large Sword that provides +1 to Longsword Fighting and Damage while using it. Only you may benefit from this bonus; it’s not magic, just sentimental. - Old Hunting Bow and 12 Arrows. ==== Advanced Skills <advanced-skills-31> - 3 Longsword Fighting - 1 Awareness - 1 Climb - 1 Bow Fighting - 1 Run - 1 Swim - 1 Vengeance === 63 Venturesome Academic <venturesome-academic> You’re a classically trained Academic, a product of the universities of the Brass City, the Palace of Tigers, or some other less prestigious centre of learning among the spheres. ==== Possessions <possessions-32> - Reading Glasses in a sturdy case \(you cannot read without them). - Small Sword. - Bundle of Candles and Matches. - Writing materials. - Journal. ==== Advanced Skills <advanced-skills-32> - 2 Evaluate - 2 Astrology - 1 Healing - 1 Spell – Random - 1 Sword Fighting - 1 Sleight of Hand ==== Special <special-12> You may Test your Luck to recall facts that you might reasonably be expected to have encountered relating to the natural sciences and humanities. === 64 Wizard Hunter <wizard-hunter> Some people say man is the most dangerous prey. They’re wrong. Can men ignite the air and freeze your blood? Can men turn into flocks of seagulls when cornered in an alley? No, they can’t. Wizards are the most dangerous prey. ==== Possessions <possessions-33> - Large Sack. - Witch-hair Rope. - Crossbow and 12 Bolts. - Sword. - 1d6 Pocket Gods. - Ruby Lorgnette. ==== Advanced Skills <advanced-skills-33> - 2 Tracking - 2 Disguise - 2 Crossbow Fighting - 1 Sword Fighting - 1 Sneak - 1 Locks - 1 Etiquette === 65 Yongardy Lawyer <yongardy-lawyer> Down in Yongardy they do things differently. They respect the Law. Every day there is a queue outside the courts to get a seat to see the latest up and coming barrister defend their case with a metre of steel. The people follow the careers of their favourite solicitors, watch all their cases, collect their portraits, and sneak into the court after hours to dab the patches of blood on white handkerchiefs. In Yongardy, they love the Law. ==== Possessions <possessions-34> - Rapier \(Damage as Sword) and Puffy Shirt or Sjambok \(Damage as Club) and Lots of Scars or Longsword and Heavy Armour or Hammer and Gargantuan Shield. - Manual on Yongardy Law. - Barrister’s Wig. ==== Advanced Skills <advanced-skills-34> - 4 Fighting in your chosen Weapon - 2 Etiquette - 1 Healing === 66 Zoanthrop <zoanthrop> At some point in your past you decided you didn’t need it anymore: you found a Zoanthropologist and paid them well to remove your troublesome forebrain and elevate you to the pure and unburdened beast you are today. ==== Possessions <possessions-35> No starting possessions; you have thrown off the shackles of civilisation. You are probably nude. ==== Advanced Skills <advanced-skills-35> - 3 Climb - 3 Run - 2 Strength - 2 Fist Fighting - 2 Club Fighting - 2 Wrestling #colbreak() ==== Special <special-13> You are immune to all mind altering effects. You are able to speak but usually choose not to. When making Advancement Checks for Skills related to abstract thought, such as Spells or Astrology, you must roll twice and succeed on both to improve them. #v(36pt) ]
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/class-handouts/class-wood_111-cutting_board.typ
typst
#import "./environment/env-templates.typ": * #show: doc => class_handout( title: "Freeform Cutting Boards", category: "Wood", number: "110", clearances: ("Dust Collection",), instructors: ("<NAME>",), authors: ("<NAME>", "<NAME>"), draft: true, doc ) // Content goes here = Welcome Welcome to the MUMBLE class at Protohaven! #include "community_subsections/shop_rules.typ" #pagebreak() = Safety - Important - Safety - Notes = Introduction == Learning Objectives == Terminology / Term: Definition of the term. = Classroom Activities == Looking Over Our stock == Cutting The Board to Length == Establishing a Profile With the Wood Band saw == Refining the Profile with the Belt/Disc and Spindle Sanders == Drilling a Hole for the Brass Insert == Setting the Brass Insert with Epoxy == Sanding the Brass Insert Flush == Refining the Surfaces with the Random Orbit Sander == Applying a Food-Grade Finish = Tools // #include "tool_subsections/TOOLNAME.typ" #include "tool_subsections/woodshop_dust_collection.typ" = Resources
https://github.com/rubal501/cartel-iibo
https://raw.githubusercontent.com/rubal501/cartel-iibo/main/main.typ
typst
#import "@preview/peace-of-posters:0.4.1" as pop #import "@preview/physica:0.9.3" : * #let k2 = [(#text(red)[$k_2$]) ] #let custom_layout = pop._default-layout + ( "spacing": 1.2em, "paper": "a0", "size": (841mm, 1188mm), "body-size": 33pt, "heading-size": 50pt, "title-size": 75pt, "subtitle-size": 60pt, "authors-size": 50pt, "keywords-size": 40pt, ) //#show: pop.poster-layout(pop.layout-a0) // #show: pop.a0-poster #let iibo-theme = ( "body-box-args": ( inset: 0.6em, width: 100%, ), "body-text-args": (:), "heading-box-args": ( inset: 0.6em, width: 100%, fill: rgb("#8a3d97"), stroke: rgb("#1d154d"), ), "heading-text-args": ( fill: white, ), ) // #show: pop.iibo-poster #pop.set-theme(iibo-theme) #set page( width: 80cm, height: 110cm, ) #set text(lang: "es") #let uni_dark_blue = rgb("#0F5A5A") #let colred(x) = text(fill: red, $#x$) #let text-args = (weight:"medium",fill:white) #let autores = [#underline[<NAME>]#super[1], <NAME>#super[2], <NAME>#super[3].] #let afiliaciones = [ #super[1] Departamento de Matemáticas, Facultad de Ciencias, Universidad Nacional Autónoma de México, Ciudad Universitaria, 04510, Ciudad de México, México \ #super[2] Departamento de Bioingeniería, Imperial College London, South Kensington Campus, London SW7 2AZ, Reino Unido. \ #super[3] Departamento de Biología Molecular y Biotecnología, Instituto de Investigaciones Biomédicas, Universidad Nacional Autónoma de México, Ciudad Universitaria, 04510, Ciudad de México, México. ] #let modelo_eq = $ dot(M) &=& M_f k_6 - M/k_(16) #colred[$k_2$] (1 + M_f k_(13) k_(17)) - M k_1 - M_T k_9 \ dot(M_f) &=& M T/k_(16) #colred[$k_2$] (1 + M_f k_(13) k_(17)) - M_f k_3 - M_f (T k_(10) + k_(14) T_f) - M_f k_5 - M_f k_(13)\ dot(T) &=& k_8 T (1 - T/k_(15)) + M_f k_(13) k_(16) - M T/k_(16) #colred[$k_2$] (1 + M_f k_(13) k_(17))\ dot(T_f) &=& k_(12) T_f (1 - T_f/(1 + k_(15) M_f)) + M T/k_(16) #colred[$k_2$] (1 + M_f k_(13) k_(17))- M_f T_f k_4.$ #stack(dir: ltr, // spacing:10%, figure(image("./logos/Logo-FC-Color.jpg", width:20%)), figure(image("./logos/Logo-feria-black.svg", width: 20%)), // figure(image("./Logo-feria-purple.svg", width: 20%)), figure(image("./logos/Logo-SysBio.png", width: 20%)), figure(image("./logos/Logo-IIBO.png", width: 20%)), ) #pop.title-box( "Diseño y optimización de intervenciones para tuberculosis con métodos computacionales", authors: autores, institutes: afiliaciones, // keywords: "Awesome, Posters, Science", authors-size: 25pt ) #pop.column-box()[ #set par(justify: true) // #set align(center) La tuberculosis es una enfermedad infecciosa grave que afecta principalmente a los pulmones y puede ser mortal si no se trata adecuadamente. La emergencia de cepas resistentes a los tratamientos convencionales subraya la urgencia de diseñar nuevas terapias. // En trabajos previos se // propuso y validó un modelo de la interacción entre // bacterias y macrófagos durante la infección, y se realizó un análisis de // bifurcación para identificar parámetros críticos en la dinámica del sistema. // En este trabajo, nos enfocamos en proponer intervenciones para la enfermedad // utilizando dicho modelo. Realizamos simulaciones con pacientes virtuales, // los cuales reciben una intervención de tiempo limitado con el // objetivo de frenar el crecimiento de la infección. Empleando // métodos de teoría de control, diseñamos y optimizamos estrategias de // intervención para controlar la infección, utilizando evolución diferencial // para ajustar el tiempo y la intensidad de las intervenciones. // ] #columns(2,[ #pop.column-box(heading: "Objetivos del trabajo.",heading-text-args:text-args)[ - Usar una combinación de teoría de control y sistemas dinámicos para proponer nuevos regímenes de tratamiento. - Optimizar las intervenciones propuestas. ] #pop.column-box(heading: "Análisis de bifurcación y selección de parámetro.", heading-text-args:text-args)[ - Previamente se realizo un análisis de bifurcación del modelo @flores2023bifurcation en el cual se identificaron distintos parámetros que bifurcan el sistema. - A partir de una revisión de la literatura de tratamientos de tuberculosis, decidimos enfocarnos en plantear intervenciones sobre la tasa de fagocitosis (#text(red)[$k_2$]) . ] // #pop.column-box()[ // #figure( // image("./images/bif2.jpg", height:8%), // caption:[ // Cuando la tasa de fagocitosis supera el umbral $P$ entonces el // sistema pasa de mono estabilidad a be estabilidad. // ] // ) // ] #pop.column-box(heading: [El éxito de las intervenciones depende de la intensidad y duración.], stretch-to-next:true, heading-text-args:text-args)[ #v(2em) #figure(stack(dir: ttb, box([ #image("./images/tratemiento_fallido.svg", width: 60.5%) #place(top+right, dx: 10pt, dy: 10pt, rect(text("A", fill: white), fill: uni_dark_blue, inset: 10pt)) ]), box(width: 1%), box([ #image("./images/tratemiento_exitoso.svg",width: 60.5%) #place(top+right, dx: 10pt, dy: 10pt, rect(text("B", fill: white), fill: uni_dark_blue, inset: 10pt)) ]) ), caption: [ Comportamiento del sistema con distintas intervenciones. El tratamiento *A* no es lo suficientemente prolongado para alejar el sistema del equilibrio, mientras que el tratamiento *B* logra revertir la dinámica del sistema. ]) ] #colbreak() #pop.column-box(heading: "Modelo matemático.", stretch-to-next: false, heading-text-args:text-args)[ El modelo mecanístico propuesto previamente en @Flores-Garza2022MathematicalTuberculosis : \ #modelo_eq El modelo divide la progresión de la enfermedad en tres etapas, además presenta un comportamiento de "todo o nada". ] #pop.column-box(heading: [Simulación de intervenciones.], heading-text-args:text-args)[ #figure(image("./images/figura_concepto.svg"), caption: [ Nuestro acercamiento consiste en perturbar la tasa de fagocitosis #k2 durante un breve intervalo de tiempo. Con el objetivo de forzar al sistema a que entre a un estado de bi estabilidad, donde es posible revertir la tendencia de la infección. ]) ] #pop.column-box(heading: "Optimización de tratamientos.", heading-text-args:text-args)[ Propusimos una función de costo para plantear un problema de optimización: // usando: #set math.equation(numbering: "(1)") #let phistar = $phi^* $ #let tstar = $t^*$ #let Ttot = $op("Ttot")$ $ C( phistar, tstar) = underbrace( phistar dot tstar, "Intensidad del \n tratamiento") + underbrace(integral_(0)^(70) Ttot(t) dd(t), "Promedio de \n bacterias.") $ Posteriormente utilizamos métodos de optimización de caja negra @Feldt2018 para optimizar los parámetros de la intervención $phistar, tstar$. ] #pop.column-box(heading: "Siguientes pasos del proyecto.", heading-text-args:text-args)[ #columns(2, gutter: 11pt)[ #set par(justify: true) - Extender el modelo para considerar antibióticos. - Utilizar intervenciones combinadas. #colbreak() - Explorar distintos métodos de optimización. - Utilizar optimización multiobjetivo. ] ] ]) #pop.column-box(heading: "Referencias.", stretch-to-next: false, heading-text-args:text-args)[ #set text(size: 24pt,lang:"es") #bibliography("./references.bib", title: none) ] // // #pop.bottom-box()[ // Grupo de investigación de Biología de Sistemas // ]
https://github.com/Jollywatt/typst-wordometer
https://raw.githubusercontent.com/Jollywatt/typst-wordometer/master/tests/sentences/test.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: 15cm, height: auto) #let el = [ Pour quoi ? Qu'est-ce que c'est !? "I don't know anything." This should be, uhh... *four* sentences. ] #el #word-count-of(el)
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas6/5_Piatok.typ
typst
#let V = ( "HV": ( ("","Tridnévno","Dolhoterpilíve i čelovikoľúbče Bóže mój, mnohomílostive i ščédre, káko preterpíl jesí zakalánije i umerščvlénije na drévi, za ród čelovíčeskij? Slavoslóvim tvojé blahoutróbije."), ("","","Zaušénija preterpíl jesí, i raspjátije dolhoterpielíve, i uničižénija, choťá vsích izbáviti lestcá, jedíne živodávče, i vsjá terpíši preblahíj."), ("","","Vozšél jesí pástyrju, na krest, i prostérl jesí rúci, vopijá: prijidíte ko mňí, i prosvitítesja čelovícy, íže prélestiju pomračívšijisja: áz bo svít jésm. Sláva tebí jedíne svitopodáteľu."), ("","Otčájannaja","Preklonénnu ťahčájšeju ťahotóju prehrišénij dúšu mojú, i sľáčennuju vozstávi Ďívo, tý bo nizvéržennyja vozstavľájušča Spása ímaši, povinújuščasja udóbno máternemu derznovéniju: i razderí tvojím chodátajstvom hrichóvnoje rukopisánije, moľúsja, za véliju tvojú mílosť."), ("","","Otčájannaho hrichmí i oskvernéna bezzakóňmi, prezrívšaho Bóžija poveľínija vížď, i ne otvérži mené ot licá tvojehó: tý bo jesí Bohoródice, upovánije mojé, i predstátelnice. Ťímže vonmí mojím molénijem, i ot vsjákija mjá skvérny očísti, za véliju tvojú mílosť."), ("","","Otvérzi mí dvéri pokajánija, dážď mí presvjatája istóčnik sléz, podážď umilénije i cilomúdrennoje sérdce: tebé bo jedínu izvístnoje predstáteľstvo napisúju, vsjákoje na ťá čájanije mojé voznošú. ne otríni mené posrámlena, no prijimí, i spasí Vladýčice, za véliju tvojú mílosť."), ("Krestobohoródičen","Tridnévno","Zrjášči ťá prečístaja, na drévi prihvoždájema vopijáše: o Sýne mój i Bóže, čtó preslávnoje tvojé, i slýšanije stránnoje, jéže preterpiváješi za mnóhuju mílosť?"), ), "S": ( ("","","Krest tvój Hóspodi, žízň i zastuplénije ľúdem tvojím jésť: i náň naďíjuščesja, tebé raspénšahosja plótiju Bóha nášeho pojém: pomíluj nás."), ("","","Krest tvój Hóspodi, ráj otvérze ródu čelovíčeskomu: i ot istľínija izbávľšesja, tebé raspénšahosja plótiju Bóha nášeho pojém: pomíluj nás."), ("Múčeničen","","Múčenicy tvojí Hóspodi, ne otverhóšasja tebé, ni otstupíša ot zápovidej tvojích: ťích molítvami pomíluj nás."), ("Krestobohoródičen","Tridnévno","Predstojášči u dréva inohdá vo vrémja raspjátija, Ďíva s ďívstvennym učenikóm, i pláčušči vopijáše: uvý mňí, káko stráždeši, vsích Christé sýj bezstrástije?"), ), ) #let P = ( "1": ( ("","","Jáko po súchu pišešéstvovav Izráiľ, po bézdňi stopámi, honíteľa faraóna víďa potopľájema, Bóhu pobídnuju písň poím, vopijáše."), ("","","Prijimí Ďívo, moľbú mojú iz úst nedostójnych, ot skvérnych ustén derznovénno prinosíti ustremívšahosja: i svít umilénija, čístaja, ozarí rabú tvojemú."), ("","","Túčy sléz mí podážď, tvojími molítvami Ďívo Máti čístaja: jáko da pláču tépľi, o íchže soďílach na zemlí, i ubíhnu tobóju múki vsjákija."), ("","","Mojehó rydánija ne otríni, jáže istóčnik milosérdija róždšaja: no mílostivno blahája, tvojím mílostivnym ókom Bohoródice, duší mojejá strásti iscilí."), ("","","Stenánijem pláčisja dušé mojá, i sebé otňúd rydáj, poklaňájuščisja Máteri Bóžiji, i hlahóľušči: mené povínnaho izbávi múki strášnyja."), ), "3": ( ("","","Ňísť svját, jákože tý Hóspodi Bóže mój, voznesýj róh vírnych tvojích bláže, i utverdívyj nás na kámeni ispovídanija tvojehó."), ("","","Ňísť ín jákože áz prehrišív presvjatája čístaja, porabóščsja zlóbami bezmírnych pomyšlénij: no na ťá naďíjavsja moľú, sích mjá ischití."), ("","","Sé naidóša na mjá jáko rány, vsjá vrážija zlóby oťahoťívše, i ziló vozsmerďíša, i dúšu vedút na vsjáko padénije."), ("","","Mnóhoje mnóžestvo mojích prehrišénij: sehó rádi presvjatája, víroju pripádaja, vopijú ti smirénnyj: v čás strášnyj umolíti, jehóže voplotíla jesí."), ("","","Svjatája Bohoródice, mené povínnaho vsjákomu osuždéniju izmí, derznovénije k Bóhu jáko imúšči Máterne, i čertóhu sehó učiní mja."), ), "4": ( ("","","Christós mojá síla, Bóh i Hospóď, čéstnája cérkov Bohoľípno pojét vzyvájušči, ot smýsla čísta, o Hóspoďi prázdnujušči."), ("","","Istóčnik mí sléz dáruj Vladýčice, jáko da otmýju skvérnu smirénnyja duší mojejá, i obrjášču dobrótu, júže pohubích sovítom zmiínym."), ("","","Bóže mój milosérde, Bóže čelovikoľúbče, volíteľu mílosti, nýňi na mjá izlíj tvojú mílosť: mólit ťá nadéžda i zastúpnica mojá, Máti tvojá."), ("","","Mené blúdnaho, mené užásnaho, bez umá i bezstúdno mnóho sohríšša k tebí, preneporóčnaja, uščédrivši spasí, i hejénny svobodí."), ("","","Pážiť potrebí smérti, róždši žízň vsjáčeskich. Ťímže i áz zovú ti: sohriších, spasí mja čístaja, Máternimi tvojími moľbámi."), ), "5": ( ("","","Bóžijim svítom tvojím bláže, útreňujuščich tí dúšy ľubóviju ozarí, moľúsja, ťá víďiti Slóve Bóžij, ístinnaho Bóha, ot mráka hrichóvnaho vzyvájušča."), ("","","Pomíluj mjá čístaja, na ťá vsjú nadéždu mojú vozložívšaho: i uščédri, víroju vzyváju tí, prezrívši duší mojejá vsjá strásti ľútyja."), ("","","Spasí mja ot strastéj, skórbi i vréda, lukávych soprotívnych, i izbávi sích lájanija smirénnuju mojú dúšu, da ne rekút Ďívo: ukrepíchomsja náň."), ("","","Čistá ťílom i dušéju prečístaja, jávľšisja, dúšu mojú ot skvérny svobodí, dajá mi čísto žíti, i nastávi tvoríti mí Hospódňu božéstvennuju vóľu."), ("","","Ťá jedínu ímam pribížišče, i k Bóhu preminénije, íže vo mnóhich prehrišénijich vsé žitijé mojé iždích. Ťímže mjá Bohoródice, tý uščédri."), ), "6": ( ("","","Žitéjskoje móre vozdvizájemoje zrjá napástej búreju, k tíchomu pristánišču tvojemú priték vopijú ti: vozvedí ot tlí živót mój, mnohomílostive."), ("","","Isprávi Vladýčice, máloje mojé stenánije, i rukáma vozďijánije, jákože blahovónnu žértvu, i tvój spodóbi zrák čístoju sóvistiju uzríti."), ("","","Hlahól mojích Vladýčice blahája, ne prézri molénije, rodíteľnice mílostivaho Bóha, ot tvojejá utróby vozsijávšaho: no dážď mí préžde koncá božéstvennoje ostavlénije."), ("","","Prekloníchsja strasťmí blúdno preokajánnyj, i udalíchsja ot Bóha: jehóže molí spastí mja blahája, k tebí bo pribihóch, i odéždami mjá prédnimi ukrasí."), ("","","Ne opalí ložésn tvojích óhň sýj Iisús, iz tebé plótiju prichódit: sehó čístaja, molí ohňá i vsjákija múki izbáviti, víroju vospivájuščich ťá."), ), "S": ( ("","","Čístaja Ďívo i slávnaja, ánhelov slávo, jehdá predstála jesí krestú Sýna i Bóha tvojehó, ne terpjášči ozloblénija vráh, vzyvála jesí rydájušči stenáňmi, jedína blahoslovénnaja: káko terpít čelovikoľúbec, sích vsích nanosímaja?"), ), "7": ( ("","","Ótrocy vo Vavilóňi péščnaho plámene ne ubojášasja: po posreďí plámene vvérženi, orošájemi pojáchu: blahoslovén jesí Hóspodi Bóže otéc nášich."), ("","","Vozníkni, o dušé mojá! Ot zlých, jáže soďijala jesí, čtó spíši próčeje, čtó snóm unýnija nizležíši? Bohoródice vozopíj: presvjatája, pomozí mi."), ("","","Óbraz vída tvojehó čtú, i ne smíju vozzríti k tebí presvjatája: moľú prijáti dolhóv proščénije, i čísto víďiti tvojú prečístuju ikónu."), ("","","V tvojé pribiháju Bohorodíteľnice, zastuplénije, i pripádaju prijáti proščénije: ne prézri mené, Vladýčice, no uščédrivši spasí mja."), ("","","Mnohoobráznymi zlóbami dušetľínnaho oskverních dúšu i úm, moľú ťa prečístaja, ne prézri, i tohó iskušénij ischití rabá tvojehó."), ), "8": ( ("","","Za zakóny otéčeskija blažénniji vo Vavilóňi júnoši predbídstvujušče, carjújuščaho opleváša poveľínije bezúmnoje, i sovokúpleni ímže ne svaríšasja ohném, deržávstvujuščemu dostójnuju vospiváchu písň: Hóspoda pójte ďilá, i prevoznosíte vo vsjá víki."), ("","","Bezmírno sohrišív, i oskvernív mojé vo hrisích ťílo nerazúmnyj, pomyšľáju neobiménnaho sudá déň, i nedoumívsja, ubojáchsja, i užasájusja i trepéšču, ko blahoutróbiju tvojemú Vladýčice, pripádaju: ne otríni mené, no vížď mojú skórb, i izbávi vsjákaho osuždénija múk mnohoobráznych."), ("","","Zakón božéstvennyj prezrív, v ľínosti vés sležú okajánnyj: prizrívši prečístaja, vozstávi vskóri, i spasénnych sotvorí mja části polučíti, da rádujasja zovú ti: rádujsja rádoste míru, jedína predstátelnice, víroju prizyvájuščym tvój tvérdyj pokróv."), ("","","Uvý mňí, dušé mojá! Káko predstánem tohdá vo strási i trépeťi sudíšču strášnomu, jehdá ánheli predstánut vo strási i trépeťi? Bohoródicu imúšči bláhu zastúpnicu, prekloní koľíno, i vozďiží rúci k vysoťí, vopijúšči: prízri i poščadí tvojím mílostivnym tohdá vzórom, Ďívo."), ("","","Pokaží kríposť tvojú nepostýdnu zastuplénije nýňi: jáko dolžník bo Máternimi moľbámi preklonítsja tvój Sýn Ďívo. Predvarí úbo nýňi v núžnyj čás, da ne otidú nehotóv, no poživú i ješčé, prepítaja Bohoródice čístaja."), ), "9": ( ("","","Ne rydáj mené Máti, zrjášči vo hróbi, jehóže vo črévi bez símene začalá jesí Sýna: vostánu bo i proslávľusja, i voznesú so slávoju neprestánno jáko Bóh, víroju i ľubóviju ťá veličájuščyja."), ("","","Da výšnija slávy polučú Ďívo, moľúsja tebí: oslábi mí, i izbávi dolhóv ťmý, vsjá prezrívši prečístaja, jáže v nevíďiniji, i rázumi, vkúpi dnevnája i noščnája, jáko da blahodárstvennuju písň rádujasja prinesú ti."), ("","","Ot vsjákich mjá skorbéj ischití otrokovíce, i na kámeni postávi nózi mojí božéstvennaho spasénija: ťá bo predstáteľnicu neoborímu nýňi sťažáv, upováju prejtí sťínu i prehrádu, júže preslušánijem dréva sozdách."), ("","","Ťá moľú róždšuju milosérdaho sudijú i Vladýku: prijimí dérzosť skvérnych ustén, i ubóhoje pínije mojé, i ne omerzí mené páče vsích čelovík hrišňíjšaho: ťá bo po Bózi zastúpnicu imíju ráb tvój."), ("","","Jáko výšši súšči sozdánij vsjáčeskich, vo utróbi tvojéj imíla jesí Bohoródice, Bóha voploščénna: sehó priľížno molí čístaja, razrišíti vsjákaho nastojánija rabá tvojehó, da svobódnym hlásom ťá slavoslóvľu i áz."), ), ) #let U = ( "S1": ( ("","","Dnés proróčeskoje ispólnisja slóvo: sé bo poklaňájemsja na mísťi, iďíže stojásťi nózi tvojí Hóspodi, i drévo spasénija vkusívše, íže ot hrichá strastéj svoboždénije ulučíchom, molítvami Bohoródicy, jedíne čelovikoľúbče."), ("","","Tókmo vodruzísja drévo Christé, krestá tvojehó, osnovánija podvizášasja smérti Hóspodi: jehóže bo požré ľubóviju ád, otpustí trépetom. Pokazál jesí nám spasénije tvojé svjatýj, i slavoslóvim ťá, Sýne Bóžij, pomíluj nás."), ("Krestobohoródičen","Upovánije míra","Jedína neporóčnaja áhnica, Bohoródice Ďívo, ot krovéj tvojích čístych voplóščšahosja zrjášči vísjašča vóleju na kresťí, vzyvála jesí otrokovíce so slezámi hórkimi: Sýne mój nezlóbivyj, pojú tvojé strášnoje vsé smotrénije."), ), "S2": ( ("","","Krest tvój Hóspodi, osvjatísja: ťím bo byvájut iscilénija boľáščym vo hrisích. Sehó rádi tebí pripádajem, pomíluj nás."), ("","","Hóspodi, osudíša ťá Judéje na smérť, žízň vsích, íže čermnóje móre žezlóm prošédšiji, ko krestú ťa prihvozdíša: i ot kámene méd ssávšiji, žélč tebí prinesóša: no vóleju preterpíl jesí, da nás svobodíši ot rabóty vrážija. Hóspodi, sláva tebí."), ("Krestobohoródičen","Upovánije míra","Predstojášči u krestá Ďíva i Máti, bez strásti iz nejá páče umá voplóščšahosja, vzyváše slezotočášči Máterski: ne terpľú ťa mértva vísjašča víďiti, dychánije podajúšča živúščym na zemlí, o Sýne i Bóže mój!"), ), "S3": ( ("","Upovánije míra","Kreste, démonov honíteľu, vračú nedúhujuščich, kríposte i chraníteľu vírnych, pochvaló pravoslávnych voístinnu, utverždénije cérkve Christóvy, búdi nám zabrálo i sťiná i chraníteľ, drévo blahoslovénnoje."), ("","","Na drévi krestňim milosérdija rádi i mílosti voznéslsja jesí i v rebró probodén býv kopijém, rasterzál jesí hrichóvnoje ľútoje rukopisánije, jáko vsesíľnyj Bóh: ťímže tvojé neizrečénnoje poím, Slóve, blahočéstno smotrénije."), ("Múčeničen","","Svít právednym výnu, svjatíji bo tobóju prosvitívšesja, sijájut prísno jáko svitíla, svíščnik nečestívych uhasívše. Íchže molítvami Spáse náš, tý prosviščáješi svitíľnik mój Hóspodi, i spasí mja."), ("Krestobohoródičen","","Vsesvjatája Bohoródice, vo vrémja životá mojehó ne ostávi mené, čelovíčeskomu predstáteľstvu ne vvíri mjá, no samá zastupí, i pomíluj mjá."), ), "K": ( "P1": ( "1": ( ("","","Volnóju morskóju skrývšaho drévle honíteľa mučíteľa pod zemléju skrýša spasénnych ótrocy: no mý jáko otrokovícy, Hóspodevi pojím, slávno bo proslávisja."), ("","","Strástiju tvojéju čéstnóju počtíl jesí obezčéstennoje jestestvó čelovíčeskoje: ťímže čtúšče ťá so stráchom, veličájem deržávu tvojú, i vírno slávim: slávno bo proslávisja."), ("","","Króviju tvojéju Slóve, krovéj neprávednoje prolítije ustávil jesí, i očístil jesí ot skvérny zlóbnyja jestestvó čelovíčeskoje, vsesíľne. Ťím slávim spasájemiji deržávu tvojú."), ("Múčeničen","","Zvírja krovopíjcu pobidí voístinnu, dostochváľnoje múčenik soprotivostojánije: óhnennoje pokorí jestestvó rosóju božéstvennyja blahodáti, i zíľnu búrju mnohobóžija ustávi."), ("Múčeničen","","Túčami krovéj odoždénija prélesti izsušívše, túči iscilénij tóčite mírovi, i plámeň strastéj othoňájete bezbóžija. Ťímže múčenicy, blažími jesté."), ("Bohoródičen","","Dobróty, ni vída imúšča vnehdá stradáti, krásnaho dobrótoju, neiskusobráčnaja otrokovíce, smotrjájušči ťá vírnych udobrénije, Máterski vosklicáše, i ľubóviju ťá slávľaše."), ), "2": ( ("","","Volnóju morskóju skrývšaho drévle honíteľa mučíteľa pod zemléju skrýša spasénnych ótrocy: no mý jáko otrokovícy, Hóspodevi pojím, slávno bo proslávisja."), ("","","Prečístaja Ďívo, blahodátnaja Maríje slávnaja, rádosti chodátaice, pivcý tvojá božéstvennymi blahodáťmi blahodátstvuj: jáko da blahodárstvennuju písň tebí vozslém."), ("","","Ole tvojích táinstv, Bohomáti! tvorénij bo javílasja jesí Vladýčica, jehóže ne derzájut vziráti ánhelov vóinstva, vo objátijich nosjášči. Ťímže ťá ublažájem."), ("","","Ród čelovíčeskij vés tľínijem smértnym osudísja, pramáternim vkušénijem dréva: tobóju že vozzvásja, jáko živót róždšeju, čístaja, netľínnyj."), ), ), "P3": ( "1": ( ("","","Tebé na vodách povísivšaho vsjú zémľu neoderžímo, tvár víďivši na lóbňim vísima, úžasom mnóhim sodrahášesja, ňísť svját rázvi tebé Hóspodi, vzyvájušči."), ("","","Tebé na vodách povísivšaho vsjú zémľu neoderžímo na drévo vozneséna, i v rébra probodájema, smotrjájuščeje sólnce pomračášesja, vsích prosviščénije razumíjuščeje ťá, Hóspodi."), ("","","Ujazvľájetsja tvojími hvozďmí dolhoterpilíve, íže v rají drévle ujazvívyj Adáma zloďíj, i ujazvívsja, neiscíľnyj vo víki prebýsť: vírniji že obritóchom vsích jázv iscilénije."), ("Múčeničen","","Jehdá lík ánheľskij, zrjáše múčenikov stadá za áhnca požéršahosja sdrobľájema, divľášesja: káko veščéstvenniji neveščéstvennyja vrahí pobiždáchu, pobídy vincý prijémľušče?"), ("Múčeničen","","Síloju oďivájemi svjatíji, v kríposti jedínaho vsjá mohúščaho, so vrahóm spletáchusja, i tohó nekrípkuju popiráchu sílu, vincý ot Bóha prijémľušče."), ("Bohoródičen","","Tý iz tebé róždšahosja, jáko víďila jesí ujázvlena kopijém, ujazvílasja jesí sérdcem prečístaja vseneporóčnaja, i divjáščisja hlahólala jesí: čtó ti vozdadé, čádo, sobór prebezzakónnyj?"), ), "2": ( ("","","Tebé na vodách povísivšaho vsjú zémľu neoderžímo, tvár víďivši na lóbňim vísima, úžasom mnóhim sodrahášesja, ňísť svját rázvi tebé Hóspodi, vzyvájušči."), ("","","Léstiju mjá preľstívyj obožénija želánijem vráh drévle, iz Jedéma Bohomáti, na zémľu presmykávyj sokruší: no Christós uščédriv mjá, ot ložésn tvojích plóť vospriím, vozsozdá."), ("","","Životá javílasja jesí vratá, proróku drévle Jezekíiľu otrokovíce, jáže Hospóď jedín voploščénnyj prójde, i zakľučénnaja ťá čístaja, sobľudé, jáko jésť výšnij."), ("","","Razrišísja kľátvy drévnija osuždénije Bohomáti, tvojím chodátajstvom: javívsja bo tí, Hospóď, vsé nezavístno istočí, jáko preblahíj, vsém blahoslovénije prečístaja."), ), ), "P4": ( "1": ( ("","","Na kresťí tvojé božéstvennoje istoščánije províďa Avvakúm, užássja vopijáše: tý síľnych presíkl jesí deržávu bláže, priobščájasja súščym vo áďi, jáko vsesílen."), ("","","Prostértije rukí Hóspodi, neuderžánnoje, ko drévnemu vkušéniju otjémľaj, mértv na drévi požrén býl jesí, spastí voschoťívyj: iz rébr iskápaeši svjázannym ostavlénije."), ("","","Stradáti preterpíl jesí preblahíj, jáko da razrišíši nás ot strastéj bezslovésija: žélč vkusíl jesí Vladýko, istočájaj mňí božéstvennuju sládosť, umertvílsja jesí, živót mňí podavája."), ("Múčeničen","","Óhň božéstvennyja ľubvé v duší slovésňij nosjášče, plámeň prebezzakónnujuščich uhasíša: i prosvitíteľnyja sviščý Christóvy strastotérpcy javíšasja."), ("Múčeničen","","Božéstvenniji drúzi vsecarjá, plotskíja sebé otlučívše drúžby, ustremíšasja ko vsjákomu mučéniju krípko, i pobidívše, slávoju vinčášasja."), ("Bohoródičen","","Kromí strásti rodích ťá, i káko vížu ťá nýňi strásti pričaščájuščasja? Káko terpíši sijé, vzyváše Ďíva? Sýne beznačáľne, slávľu tvojé dolhoterpínije."), ), "2": ( ("","","Na kresťí tvojé božéstvennoje istoščánije províďa Avvakúm, užássja vopijáše: tý síľnych presíkl jesí deržávu bláže, priobščájasja súščym vo áďi, jáko vsesílen."), ("","","Izbránnaja že i prečístaja ot vsích rodóv jávľšisja jedína, jáže dobroďítelmi vozsijávšaja neskvérnaja čéstnája, íže ťá pisnoslóvjaščyja svítlostiju tvojéju prosvití."), ("","","Bóha plótiju Ďívo rodilá jesí, iz čístych tvojích, čístaja, krovéj Máti, Spása izbavľájuščaho vsjá ot ľútych, pojúščyja ťá, otrokovíce Bohoblahodátnaja."), ("","","Svjaščennoďíjstvujet božéstvennomu roždestvú tvojemú Bohoródice čístaja, neveščéstvennych jestestvó, i čelovíkov sobránije ľubóviju ťá pojét: tvojím sijánijem nás ozarí."), ), ), "P5": ( "1": ( ("","","K tebí útreňuju, milosérdija rádi sebé istoščívšemu neprelóžno, i do strastéj bezstrástno preklóňšemusja, Slóve Bóžij, mír podážď mí pádšemu čelovikoľúbče."), ("","","Mértv zríšisja na lóbňim, umertvív áda strástiju plóti tvojejá: ni vída tý Christé, ni dobróty imíl jesí povíšen, udobríti mjá choťá jáko čelovikoľúbec."), ("","","Adáma pérvaho prihvozdíti choťá strástnaja ľublénija, hvozďmí prihvoždáješisja, i kopijém probóďsja, plámennomu orúžiju vozbraňáješi Christé, ne vozbraníti rabóm tvojím vchóda."), ("Múčeničen","","Posľídstvujušče strastém Vladýčnim, lícy múčeničestiji na drévi prihvoždájutsja, i rukámi kúpno otjémľutsja, i nohámi k stezí čestnáho mučénija božéstvenňi ispravľájemi."), ("Múčeničen","","Umóm soveršénnym, umá hórdaho voznosjáščasja dérzostiju nizložíste soveršénno smirívšesja v podražániji, vsjá voznésšaho smirénijem sérdca Christóvy múčenicy."), ("Bohoródičen","","Ot kórene Ďívo Jesséova prozjabáješi, i jáko cvít proiznósiši nasadíteľa míru, ótrasli bezbóžija izsušívša božéstvennym sádom krestá, jehóže plótiju priját."), ), "2": ( ("","","K tebí útreňuju, milosérdija rádi sebé istoščívšemu neprelóžno, i do strastéj bezstrástno preklóňšemusja, Slóve Bóžij, mír podážď mí pádšemu čelovikoľúbče."), ("","","Ľistvica jávľšisja obrázno Jákovu, k vysoťí prevzjátaja, tvojehó Bohonevístnaja, javí roždestvá voístinnu izrjádnoje: tobóju bo voístinnu nám Bóh spoživé schoždénijem božéstvennym, i živót podadé čelovíkom."), ("","","Izbávľšesja tobóju pramáternija pečáli Bohorodíteľnice, uťišénija ispólneni býchom, vesélije vsím róždšaja, i vsemírnuju rádosť: ťímže vsepítaja, tvojá pisnoslóvcy ot bíd tvojími molítvami sobľudí."), ("","","Tájno naučím tvojemú bohovídňi Moiséj óbrazu, predzrjáše kupinú neopalímuju ohném, Ďívo vseneporóčnaja: v ťá bo sozdáteľ vséľsja, ne opalí ťa výššuju vsích tvorénij, Bohonevístnaja."), ), ), "P6": ( "1": ( ("","","Ját býsť, no neuderžán v pérsich kítovych Jóna: tvój bo óbraz nosjá, stradávšaho i pohrebéniju dávšahosja, jáko ot čertóha ot zvírja izýde: prihlašáše že kustodíji: chraňáščiji sújetnaja i lóžnaja, mílosť sijú ostávili jesté."), ("","","Premiňája rúci drévle Jákov proobrazováše krest, blahoslovľája ótroki. Ťímže výšnij na tohó voschoďáj, kľátvy drévnija rišíši čelovíčestvo: i istočáješi nýňi blahoslovénije, blahoslovjáščym ťá jedíne blahoslovénne, i soďíteľu preblahíj."), ("","","Tvojú strásť proobrazújaj Slóve, velíkij Moiséj voznesé drévle mídnaho zmíja na drévo, otjémľaj zrjáščyja ot jadovítaho uhryzénija zmijína: íbo Vladýko, ráspjatu bývšu tí, vreždénija zmiínaho bohomérzskaho vsí vírniji izbávichomsja."), ("Múčeničen","","Jákože inómu stráždušču božéstvenniji drévle i čestníji stradáľcy bjáchu stradáľčestvujušče, predzrjášče vozdajánija víčnaja i rádovanije. Molítvami ích Christé ščédre, vospivájuščyja ťá izbávi ot iskušénij, i hrichóv, i obstojánij."), ("Múčeničen","","Potóki ustáviša prélesti, strujámi krovéj, čestníji i božéstvenniji strastotérpcy, i istóčnicy voístinnu javíšasja, vírnym Bohovíďinija točášče vódu. Molítvami ích Spáse míra, odoždí ostavlénije vsím, i živót, i očiščénije hrichóv, i véliju mílosť."), ("Bohoródičen","","Pástyrja pérvaho i Vladýku, vozdvížena na drévi zrjášči áhnica, pláčušči máterski vopijáše: čtó sijé, čádo, nóvoje táinstvo? Káko bezsmérten po suščestvú sýj smérť prijál jesí, čelovíki choťá iz tlí izbáviti?"), ), "2": ( ("","","Ját býsť, no neuderžán v pérsich kítovych Jóna: tvój bo óbraz nosjá, stradávšaho i pohrebéniju dávšahosja, jáko ot čertóha ot zvírja izýde: prihlašáše že kustodíji: chraňáščiji sújetnaja i lóžnaja, mílosť sijú ostávili jesté."), ("","","Zakónniji ťá óbrazy Bohoródice, i prorečénije jávi prorókov javľáchu, imúščuju rodíti míru izbáviteľa, i blahoďíteľa vsejá tvári, mnohočástno i mnohoobrázno blahoďíjstvovavšaho, víroju i ľubóviju Vladýčice čístaja, slavoslóvjaščich ťá."), ("","","Ustranívšyjasja drévle ot prélesti čelovikoubíjcy vrahá, Bóžija pervozdánnyja píšči rájskija, jedína Bohorodíteľnice, páki vozvelá jesí k rajú róždši Spása Hóspoda, raspjátije i pohrebénije božéstvennoju vlástiju preterpívšaho."), ("","","Íže vóleju božéstvennoju, i síloju soďíteľnoju svojéju, vsjá ot ne súščich sostavléj čístaja, prójde ot tvojích ložésn i Bóh i čelovík: i íže vo ťmí nevíďinija préžde súščyja, sijáňmi božéstvennymi Vladýčice čístaja, svítlo ozarí."), ), ), "P7": ( "1": ( ("","","Neizrečénnoje čúdo, v peščí izbávivyj prepodóbnyja ótroki iz plámene, vo hróbi mértv bezdychánen polahájetsja, vo spasénije nás pojúščich: izbáviteľu Bóže, blahoslovén jesí."), ("","","Jehdá ťa na kresťí sobór jevréjskij osudí, zrjášči zemľá užasésja: sólnce svít svój sokrý, i súščiji vo ťmí svít víďiša, pojúšče: izbáviteľu Bóže, blahoslovén jesí."), ("","","Dosaždénije preterpíl jesí Spáse, tróstiju bijém, i térnijami jáko cár, vóleju Christé Bóže, vinčavájem, na spasénije nás pojúščich: izbáviteľu Bóže, blahoslovén jesí."), ("Múčeničen","","Svjazújetesja, vsjú dijávoľu prélesť vsechváľniji múčenicy rišájušče jávi: terpité múki i smérť neprávednuju: žízni želájušče hórnija, i vopijúšče: izbáviteľu Bóže, blahoslovén jesí."), ("Múčeničen","","Stáste posreďí plámene, vsechváľniji múčenicy, prélesť popaľájušče jávi, i orošénijem božéstvennyja blahodáti ne opalívšesja, vopijéte pojúšče: izbáviteľu Bóže, blahoslovén jesí."), ("Bohoródičen","","Raspináješisja choťáj beznačáľne Sýne, Bohoródica vzyváše zrjášči ťá: pečáliju duší nýňi pohružájusja, umiráješi podajáj žízň pojúščym: izbáviteľu Bóže, blahoslovén jesí."), ), "2": ( ("","","Neizrečénnoje čúdo, v peščí izbávivyj prepodóbnyja ótroki iz plámene, vo hróbi mértv bezdychánen polahájetsja, vo spasénije nás pojúščich: izbáviteľu Bóže, blahoslovén jesí."), ("","","Preukrášennu ťá, imúščuju pozlaščénnoje Bohomáti, ukrašénije blahoľípnoje, voschoťí tvój Sýn že i Hospóď, vo spasénije nás vopijúščich tí: plód tvój čístaja blahoslovénnyj."), ("","","Šípok posreďí térnij obrít prečístaja, Vladýka, ispólni nás blahoucháňmi tvojími krásnymi blahodátej duchóvnych, vopijúščyja jemú vo umiléniji: izbáviteľu Bóže, blahoslovén jesí."), ("","","Známenija vsí tvojí božéstvenniji prorócy víďivše tvojehó božéstvennaho roždestvá, slávno vopijáchu čístaja: Bóh priídet ot Ďívy, jéže spastí vopijúščyja: izbáviteľu Bóže, blahoslovén jesí."), ), ), "P8": ( "1": ( ("","","Užasnísja bojájsja Nébo, i da podvížatsja osnovánija zemlí: sé bo v mertvecích vmiňájetsja vo výšnich živýj, i vo hrób mál strannoprijémletsja: jehóže ótrocy blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Pijéši čášu Christé, júže vozžeľíl jesí strástiju krestnoju, istóčniki mí prolivájaj ostavlénija ot živonósnych rébr, rádi rebrá uméršemu. Pojú ťa vospivájaj: svjaščénnicy blahoslovíte, ľúdije prevoznosíte vo vsjá víki."), ("","","Jehdá ťa bezzakónniji ľúdije osudíša raspjáti Iisúse, posreďí bezzakónnych žiznodávče Hóspodi, potrjasésja zemľá, i vsí vospiváchu so stráchom: ótrocy blahoslovíte, svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("Múčeničen","","Čestná pred Bohom javísja váša smérť stradáľcy: mnóhim bo pričastívšesja strastém, strásti čestnýja Christóvy óbščnicy pokazástesja, vopijúšče jedinomúdrenno: ótrocy blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("Múčeničen","","Voístinnu ne plotskája váša orúžija múčenicy, ko opolčéniju vrahóv: nadéžda že, víra i ístina, ímiže ulučívše Bóha, ánheľskim likóm sočetástesja vopijúšče Vladýce: svjaščénnicy blahoslovíte , ľúdije prevoznosíte vo vsjá víki."), ("Bohoródičen","","Výšnij beznačáľne Sýne, terpíši oplevánija, ponošénija i krest, tróstiju ruháteľno bijém, Bohoródica vopijáše: slávľu tvojé dolhoterpínije: jehóže ótrocy bláhoslovját, svjaščénnicy vospivájut, ľúdije prevoznósjat vo vsjá víki."), ), "2": ( ("","","Užasnísja bojájsja Nébo, i da podvížatsja osnovánija zemlí: sé bo v mertvecích vmiňájetsja vo výšnich živýj, i vo hrób mál strannoprijémletsja: jehóže ótrocy blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Božéstvennomu Danijílu nýňi predvíďina bylá jesí nesikómaja horá: iz tebé bo otrokovíce, kámeň otsičésja Christós: jedín bo Ďívo, kromí rukí čelovíčeskija. Jehóže ótrocy blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Písňmi roždestvó tvojé čístaja, prísno slávjat hórniji vóini, i tebé že otrokovíce prisnoďívo, rádostno s námi jáko Bohomáter vospivájut, júže ótrocy blahoslovját, svjaščénnicy vospivájut, ľúdije prevoznósjat vo vsjá víki."), ("","","Svíta tvojehó zarjámi, ťá múdrstvujuščyja nýňi Bohoródicu ístinnuju Maríje, svitozárny soďílaj, Bohorodíteľnice čístaja: svíta bo selénije javílasja jesí Ďívo, víroju tí vopijúščym: rádujsja blahoslovénnaja i preproslávlennaja vo vsjá víki."), ), ), "P9": ( "1": ( ("","","Ne rydáj mené Máti, zrjášči vo hróbi, jehóže vo črévi bez símene začalá jesí Sýna: vostánu bo i proslávľusja, i voznesú so slávoju neprestánno jáko Bóh, víroju i ľubóviju ťá veličájuščyja."), ("","","Da sňídiju istľívšaho sládostnoju dréva, jedíne Spáse, jáko bláh izbáviši ot tlí, raspjátisja plótiju, i umertvítisja izvólil jesí: pojém neprestánno Iisúse, mnóhoje blahoutróbije i sílu tvojú."), ("","","O káko preterpíl jesí boľízni, na kresťí prostirájem, ot boľíznej ľútych izymája mjá Spáse? Káko térnijami vinčávyjsja, vsé popalíl jesí strastéj térnije? Káko ócta napojívyjsja, vesélija čášu nám rastvoríl jesí?"), ("Múčeničen","","Sťisňájemi vsí, i v temnícy vmetájemi, i na údy stradáľcy razsicájemi ľúťi, i po kolesích žéstoko proťazájemi, i vo sňidénije zverém vdavájemi, Christá vsích Vladýki ne otverhóstesja."), ("Múčeničen","","Sólnečnych sijánij mnóžajši sijájet stradálec vsesvítlaja i blahoznamenítaja pámjať: i dúšy bláhočestívych prosviščájet vsehdá, i othoňájet ťmú strastéj, i iskušénij, i démonskij rastočájet mrák hlubočájšij."), ("Bohoródičen","","Nósiši nosjáščaho vsjá, i deržíši jáko mladénca na rukú, izbávľšaho nás ot rukí boríteľa vrahá, prečístaja Vladýčice, i zríši vozvýšena na drévi krestnem iz jámy zlóby nás izbávľšaho."), ), "2": ( ("","","Ne rydáj mené Máti, zrjášči vo hróbi, jehóže vo črévi bez símene začalá jesí Sýna: vostánu bo i proslávľusja, i voznesú so slávoju neprestánno jáko Bóh, víroju i ľubóviju ťá veličájuščyja."), ("","","Rádosti nám víčnyja i žízni javílasja jesí prejestéstvenňi Bohorodíteľnice, chodátaica, čístaja, Spása vsích róždšaja, ot licá zemnáho vsjáku slézu jávi otémšaho, i vsím rádosť podávšaho."), ("","","Pojá Davíd tvój práotec, kovčéh ťá prorečé znamenáteľňi: i božéstvennyja mánny zlatúju rúčku, Moiséj, Bohoródicu: íbo jedína vmistíla jesí íže v ňídrich Ótčich súšča prísno Bohoródice. ťímže ťá písňmi slávim."), ("","","Jáko voístinnu prevýšši vsejá tvári jesí: Bóha bo vsích rodilá jesí plótiju. Ťímže ťá predstáteľnicu ímamy Vladýčice, i nadéždu izvístnu, i sťínu tvérdu, tobóju spasénije ulučíti naďíjuščesja."), ), ), ), "CH": ( ("","","O kresťí upovánije ímam, i o ném chvaľásja vopijú: čelovikoľúbče Hóspodi, hordýňu nizloží ne ispovídajuščich tebé Bóha i čelovíka."), ("","","Íže krestóm ohraždájemi, vrahú protivľájemsja, ne bojáščesja tohó kovárstva, ni lovíteľstva: jáko bo hórdyj uprazdnísja, i poprán býsť na drévi síloju raspjátaho Christá."), ("Múčeničen","","Hóspodi, v pámjať svjatých tvojích vsjá tvár prázdnujet: nebesá rádujutsja so ánhely, i zemľá veselítsja s čelovíki. Ťích molítvami pomíluj nás."), ("Krestobohoródičen","","Prihvozdíchsja úbo jáko čelovík na drévi, i umertvíchsja, i vo hróbi položén bých, jáko smértnyj: no jáko Bóh vo slávi, Máti čístaja Ďívo, páki vostajú tridnéven."), ), ) #let L = ( "B": ( ("","","Pomjaní mja Bóže Spáse mój, jehdá priídeši vo cárstviji tvojém, i spasí mja, jáko jedín čelovikoľúbec."), ("","","Rasprostér dláni na drévi, objál jesí jazýki pojúščija tvojé blahoutróbije, Christé Bóže náš."), ("","","Prihvozdílsja jesí na drévi vóleju, i žála hórdaho tvojéju Christé, síloju soveršénno sokrušíl jesí."), ("","","Múkami naslaždájuščesja strastotérpcy, rájskaho naslaždénija spodóbistesja, o míri neprestánno moľáščesja."), ("","","Ot vsjákija izmí nás múki, Ótče, i Sýne i soprestóľnyj Dúše, rabý tvojá Hóspodi."), ("","","Zrjášči ťá na kresťí rasprostérta, Ďíva vozdycháše slezjášči: jejáže molítvami spasí nás Hóspodi."), ), )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/grid-3_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(width: 5cm, height: 3cm) #grid( columns: 2, row-gutter: 8pt, [Lorem ipsum dolor sit amet. Aenean commodo ligula eget dolor. Aenean massa. Penatibus et magnis.], [Text that is rather short], [Fireflies], [Critical], [Decorum], [Rampage], )
https://github.com/Mouwrice/resume
https://raw.githubusercontent.com/Mouwrice/resume/main/README.md
markdown
# Resume <NAME> My resume using the brilliant-CV typst template
https://github.com/sses7757/sustech-graduated-thesis
https://raw.githubusercontent.com/sses7757/sustech-graduated-thesis/main/sustech-graduated-thesis/pages/final-cover.typ
typst
Apache License 2.0
#import "../utils/datetime-display.typ": datetime-display, datetime-en-display #import "../utils/justify-text.typ": justify-text #import "../utils/style.typ": 字号, 字体 // 硕士研究生封面 #let final-cover( // documentclass 传入的参数 doctype: "master", degree: "academic", nl-cover: false, anonymous: false, twoside: false, fonts: (:), info: (:), // 其他参数 stoke-width: 0.5pt, min-title-lines: 2, min-reviewer-lines: 5, info-inset: (x: 0pt, bottom: 0.5pt), info-key-width: 86pt, info-column-gutter: 18pt, info-row-gutter: 12pt, meta-block-inset: (left: -15pt), meta-info-inset: (x: 0pt, bottom: 2pt), meta-info-key-width: 35pt, meta-info-column-gutter: 10pt, meta-info-row-gutter: 1pt, defence-info-inset: (x: 0pt, bottom: 0pt), defence-info-key-width: 110pt, defence-info-column-gutter: 2pt, defence-info-row-gutter: 12pt, anonymous-info-keys: ("student-id", "author", "author-en", "supervisor", "supervisor-en", "supervisor-ii", "supervisor-ii-en", "chairman", "reviewer"), datetime-display: datetime-display, datetime-en-display: datetime-en-display, ) = { // 1. 默认参数 fonts = 字体 + fonts info = ( title: ("基于 Typst 的", "南京大学学位论文"), grade: "20XX", student-id: "1234567890", author: "张三", department: "某学院", major: "某专业", supervisor: ("李四", "教授"), submit-date: datetime.today(), ) + info // 2. 对参数进行处理 // 2.1 如果是字符串,则使用换行符将标题分隔为列表 if type(info.title) == str { info.title = info.title.split("\n") } if type(info.title-en) == str { info.title-en = info.title-en.split("\n") } // 2.2 根据 min-title-lines 和 min-reviewer-lines 填充标题和评阅人 info.title = info.title + range(min-title-lines - info.title.len()).map((it) => " ") info.reviewer = info.reviewer + range(min-reviewer-lines - info.reviewer.len()).map((it) => " ") // 2.3 处理日期 assert(type(info.submit-date) == datetime, message: "submit-date must be datetime.") if type(info.defend-date) == datetime { info.defend-date = datetime-display(info.defend-date) } if type(info.confer-date) == datetime { info.confer-date = datetime-display(info.confer-date) } if type(info.bottom-date) == datetime { info.bottom-date = datetime-display(info.bottom-date) } // 2.4 处理 degree if (info.degree == auto) { if (doctype == "doctor") { info.degree = "工程博士" } else { info.degree = "工程硕士" } } // 3. 内置辅助函数 let info-key(body, info-inset: info-inset, is-meta: false) = { set text( font: if is-meta { fonts.宋体 } else { fonts.楷体 }, size: if is-meta { 字号.小五 } else { 字号.三号 }, weight: if is-meta { "regular" } else { "bold" }, ) rect( width: 100%, inset: info-inset, stroke: none, justify-text(with-tail: is-meta, body) ) } let info-value(key, body, info-inset: info-inset, is-meta: false, no-stroke: false) = { set align(center) rect( width: 100%, inset: info-inset, stroke: if no-stroke { none } else { (bottom: stoke-width + black) }, text( font: if is-meta { fonts.宋体 } else { fonts.楷体 }, size: if is-meta { 字号.小五 } else { 字号.三号 }, bottom-edge: "descender", if (anonymous and (key in anonymous-info-keys)) { if is-meta { "█████" } else { "██████████" } } else { body }, ), ) } let anonymous-text(key, body) = { if (anonymous and (key in anonymous-info-keys)) { "██████████" } else { body } } let meta-info-key = info-key.with(info-inset: meta-info-inset, is-meta: true) let meta-info-value = info-value.with(info-inset: meta-info-inset, is-meta: true) let defence-info-key = info-key.with(info-inset: defence-info-inset) let defence-info-value = info-value.with(info-inset: defence-info-inset) // 4. 正式渲染 pagebreak(weak: true, to: if twoside { "odd" }) block(width: 70pt, inset: meta-block-inset, grid( columns: (meta-info-key-width, 1fr), column-gutter: meta-info-column-gutter, row-gutter: meta-info-row-gutter, meta-info-key("学校代码"), meta-info-value("school-code", info.school-code), meta-info-key("分类号"), meta-info-value("clc", info.clc), meta-info-key("密级"), meta-info-value("secret-level", info.secret-level), meta-info-key("UDC"), meta-info-value("udc", info.udc), meta-info-key("学号"), meta-info-value("student-id", info.student-id), )) // 居中对齐 set align(center) // 匿名化处理去掉封面标识 if (anonymous) { v(70pt) } else { // 封面图标 v(6pt) v(34pt) } // 将中文之间的空格间隙从 0.25 em 调整到 0.5 em text(size: 28pt, font: fonts.宋体, spacing: 200%, weight: "bold", if doctype == "doctor" { "博 士 学 位 论 文" } else { "硕 士 学 位 论 文" }, ) if (anonymous) { v(132pt) } else { v(30pt) } block(width: 294pt, grid( columns: (info-key-width, 1fr), column-gutter: info-column-gutter, row-gutter: info-row-gutter, info-key("论文题目"), ..info.title.map((s) => info-value("title", s)).intersperse(info-key(" ")), info-key("作者姓名"), info-value("author", info.author), ..(if degree == "professional" {( { set text(font: fonts.楷体, size: 字号.三号, weight: "bold") move(dy: 0.3em, scale(x: 55%, box(width: 10em, "专业学位类别(领域)"))) }, info-value("major", info.degree + "(" + info.major + ")"), )} else {( info-key("专业名称"), info-value("major", info.major), )}), info-key("研究方向"), info-value("field", info.field), info-key("导师姓名"), info-value("supervisor", info.supervisor.intersperse(" ").sum()), ..(if info.supervisor-ii != () {( info-key(" "), info-value("supervisor-ii", info.supervisor-ii.intersperse(" ").sum()), )} else { () }) )) v(50pt) text(font: fonts.楷体, size: 字号.三号, datetime-display(info.submit-date)) // 第二页 pagebreak(weak: true) v(161pt) block(width: 284pt, grid( columns: (defence-info-key-width, 1fr), column-gutter: defence-info-column-gutter, row-gutter: defence-info-row-gutter, defence-info-key("答辩委员会主席"), defence-info-value("chairman", info.chairman), defence-info-key("评阅人"), ..info.reviewer.map((s) => defence-info-value("reviewer", s)).intersperse(defence-info-key(" ")), defence-info-key("论文答辩日期"), defence-info-value("defend-date", info.defend-date, no-stroke: true), )) v(216pt) align(left, box(width: 7.3em, text(font: fonts.楷体, size: 字号.三号, weight: "bold", justify-text(with-tail: true, "研究生签名")))) v(7pt) align(left, box(width: 7.3em, text(font: fonts.楷体, size: 字号.三号, weight: "bold", justify-text(with-tail: true, "导师签名")))) // 第三页英文封面页 pagebreak(weak: true) set text(font: fonts.楷体, size: 字号.小四) set par(leading: 1.3em) v(45pt) text(font: fonts.黑体, size: 字号.二号, weight: "bold", info.title-en.intersperse("\n").sum()) v(36pt) text(size: 字号.四号)[by] v(-6pt) text(font: fonts.黑体, size: 字号.四号, weight: "bold", anonymous-text("author-en", info.author-en)) v(11pt) text(size: 字号.四号)[Supervised by] v(-6pt) text(font: fonts.黑体, size: 字号.四号, anonymous-text("supervisor-en", info.supervisor-en)) if info.supervisor-ii-en != "" { v(-4pt) text(font: fonts.黑体, size: 字号.四号, anonymous-text("supervisor-ii-en", info.supervisor-ii-en)) v(-9pt) } v(26pt) [ A dissertation submitted to \ the graduate school of #(if not anonymous { "Nanjing University" }) \ in partial fulfilment of the requirements for the degree of \ ] v(6pt) smallcaps(if doctype == "doctor" { "Doctor of phlosophy" } else { "Master" }) v(6pt) [in] v(6pt) info.major-en v(46pt) if not anonymous { } v(28pt) info.department-en v(2pt) if not anonymous { [Nanjing University] } v(28pt) datetime-en-display(info.submit-date) }
https://github.com/GYPpro/Java-coures-report
https://raw.githubusercontent.com/GYPpro/Java-coures-report/main/.VSCodeCounter/2023-12-14_20-23-42/details.md
markdown
# Details Date : 2023-12-14 20:23:42 Directory d:\\Desktop\\Document\\Coding\\JAVA\\Rep\\Java-coures-report Total : 35 files, 2227 codes, 87 comments, 418 blanks, all 2732 lines [Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md) ## Files | filename | language | code | comment | blank | total | | :--- | :--- | ---: | ---: | ---: | ---: | | [README.md](/README.md) | Markdown | 1 | 0 | 2 | 3 | | [README.typ](/README.typ) | Typst | 178 | 2 | 39 | 219 | | [rubbish/myIO.java](/rubbish/myIO.java) | Java | 73 | 0 | 15 | 88 | | [sis1/basicIO.java](/sis1/basicIO.java) | Java | 26 | 0 | 3 | 29 | | [sis2/Test.java](/sis2/Test.java) | Java | 54 | 15 | 3 | 72 | | [sis2/UIDmanager.java](/sis2/UIDmanager.java) | Java | 138 | 0 | 19 | 157 | | [sis3/Test.java](/sis3/Test.java) | Java | 26 | 5 | 5 | 36 | | [sis3/TrieTree.java](/sis3/TrieTree.java) | Java | 37 | 0 | 6 | 43 | | [sis4/regularExp.java](/sis4/regularExp.java) | Java | 34 | 0 | 3 | 37 | | [sis5/SchoolLib.java](/sis5/SchoolLib.java) | Java | 186 | 31 | 15 | 232 | | [sis5/Student.java](/sis5/Student.java) | Java | 114 | 0 | 24 | 138 | | [sis5/Test.java](/sis5/Test.java) | Java | 18 | 0 | 3 | 21 | | [sis5/course.java](/sis5/course.java) | Java | 76 | 0 | 17 | 93 | | [sis5/score.java](/sis5/score.java) | Java | 107 | 0 | 22 | 129 | | [sis6/Test.java](/sis6/Test.java) | Java | 24 | 5 | 5 | 34 | | [sis6/segTree.java](/sis6/segTree.java) | Java | 100 | 3 | 14 | 117 | | [sis7/maxFlow.java](/sis7/maxFlow.java) | Java | 96 | 0 | 13 | 109 | | [sis7/minCost.java](/sis7/minCost.java) | Java | 139 | 0 | 19 | 158 | | [sis7/solution.java](/sis7/solution.java) | Java | 26 | 1 | 3 | 30 | | [sis8/Bed.java](/sis8/Bed.java) | Java | 13 | 0 | 4 | 17 | | [sis8/City.java](/sis8/City.java) | Java | 21 | 0 | 7 | 28 | | [sis8/Constants.java](/sis8/Constants.java) | Java | 10 | 0 | 4 | 14 | | [sis8/Hospital.java](/sis8/Hospital.java) | Java | 49 | 0 | 20 | 69 | | [sis8/Main.java](/sis8/Main.java) | Java | 32 | 0 | 6 | 38 | | [sis8/MoveTarget.java](/sis8/MoveTarget.java) | Java | 28 | 0 | 9 | 37 | | [sis8/MyPanel.java](/sis8/MyPanel.java) | Java | 78 | 2 | 15 | 95 | | [sis8/Person.java](/sis8/Person.java) | Java | 145 | 6 | 39 | 190 | | [sis8/PersonPool.java](/sis8/PersonPool.java) | Java | 38 | 10 | 9 | 57 | | [sis8/Point.java](/sis8/Point.java) | Java | 21 | 0 | 7 | 28 | | [sis9/myLinearEntire.java](/sis9/myLinearEntire.java) | Java | 10 | 0 | 8 | 18 | | [sis9/myLinearSpace.java](/sis9/myLinearSpace.java) | Java | 71 | 0 | 13 | 84 | | [sis9/myMatrix.java](/sis9/myMatrix.java) | Java | 138 | 0 | 14 | 152 | | [sis9/myPolynomial.java](/sis9/myPolynomial.java) | Java | 10 | 0 | 3 | 13 | | [sis9/myRealNum.java](/sis9/myRealNum.java) | Java | 54 | 0 | 15 | 69 | | [test.java](/test.java) | Java | 56 | 7 | 15 | 78 | [Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
https://github.com/dashuai009/dashuai009.github.io
https://raw.githubusercontent.com/dashuai009/dashuai009.github.io/main/src/content/blog/011.typ
typst
#let date = datetime( year: 2024, month: 6, day: 26, ) #metadata(( "title": "显卡更新驱动失败黑屏", "author": "dashuai009", description: "", pubDate: "'Jul 08 2022'", subtitle: [4090], ))<frontmatter> #import "../__template/style.typ": conf #show: conf #date.display(); #outline() == 起因 PrtSc截图时,图片色彩失真,偏黄,好像是HDR的问题。我想着显卡驱动还是23年中(去年的),可能更新一下显卡驱动就好。结果更新完, 重启后屏幕黑屏。很奇怪,只是显示器没输出,操作系统能正常进去。好像是掉驱动了。 == 网上的答案 1. 换一个显示器。pass。没这个钱。 2. 换数据线的接口。拔插一下。我这没效果。 3. 进安全模式,卸载重装驱动。 == 安全模式卸载驱动 试了一天,电脑重启了无数次,最后卸载驱动重新装的。 1. 把显卡拆掉。这时候能正常进入系统,一切显示正常。 2. 去nvidia官网下载驱动。最新的就行,我这应该时驱动安装错误。 3. win+r,msconfig,boot,safe boot下次会进入安全模式。 4. 关机,安装显卡,开机进入安全模式,设备管理器,找到显卡,卸载驱动。重复3,关掉安全模式。 5. 重启,应该能进入系统,但是无法识别到显卡。安装驱动。显卡被识别到。 其他问题: 1. 拆掉显卡后找不到设备,没法卸载驱动,就很尴尬。 2. 不安装显卡,没法安装驱动,导致我这反复拔插显卡好几次。 3. 我这显示器绝对有问题,但是没钱换。安全模式,一旦显示器的输入切别的口进来,再切回来的时候,系统直接不再识别,黑屏。
https://github.com/LuSterM1126/MySQL_COA
https://raw.githubusercontent.com/LuSterM1126/MySQL_COA/main/MySQL.typ
typst
// #import "@preview/fuzzy-cnoi-statement:0.1.0": #import "fuzzy-cnoi-statement/template.typ": *; #set text(font: ("Consolas", "Microsoft YaHei")) #let trans(cn, en) = [#strong([#cn (#emph([#en]))])] = 数据库 == 数据库概述 - *DataBase(DB) 数据库*:存储数据的仓库,数据是有组织的进行存储 - *Database Management SyStem(DBMS) 数据库管理系统*:操纵和管理数据库的大型软件 - *SQL*:操作关系型数据库的编程语言,定义了一套操作关系型数据库统一标准 == MySQL 数据库 === 关系型数据库 (RDBMS) - *概念*:建立在关系模型上,由多张相互连接的二维表组成的数据库 - *特点*: 1. 使用表存储数据,格式统一,便于维护 2. 使用 *SQL* 语言操作,标准统一,使用方便 == SQL - *SQL 通用语法* 1. SQL 语句可以单行或多行书写,分号结尾 2. SQL 语句可以使用空格 / 缩进增强语句的可读性 3. MYSQL 数据库的 SQL 语句不区分大小写 4. 注释:\-- / = - *SQL 分类* 1. *DDL (Data Definition)*: 数据定义语言,用来定义数据库对象 (数据库,表,字段) 2. *DML (Data Manipulate)*: 数据操作语言,用来对数据库表中数据进行增删改 3. *DQL (Data Query)*: 数据查询语言,用来查询数据库中表的记录 4. *DCL (Data Control)*:数据控制语言,用来创建数据库用户,控制数据库的访问权限 === DDL ==== DDL - 数据库操作 - 查询所有数据库\ ```SQL show databases;``` - 查询当前数据库\ ```SQL select database();``` - 创建\ ```SQL create database [IF NOT EXISTS] 数据库名 [DEFAULT CHARSET 字符集] [COLLATE 排序规则];``` - 删除\ ```SQL drop database [IF EXISTS] 数据库名;``` - 使用\ ```SQL use 数据库名;``` ==== DDL - 表操作 - 查询 - 查询当前数据库所有表\ ```SQL show tables;``` - 查询表结构\ ```SQL desc 表名;``` - 查询指定表的建表语句\ ```SQL show create table 表名;``` ==== DDL - 表操作 - 创建 ````SQL create table 表名 ( 字段1 字段1 类型 [COMMENT 字段1 注释], 字段2 字段2 类型 [COMMENT 字段2 注释], )[COMMENT 表注释]; ```` - 最后一个字段后面没有逗号 ==== DDL - 表操作 - 数据类型 1. 数值类型 1. `TINYINT`: 占用 1 字节 2. `SMALLINT`: 占用 2 字节 3. `MEDIUMINT`: 占用 3 字节 4. `INT`: 占用 4 字节 5. `BIGINT`: 占用 8 字节 6. `FLOAT`: 占用 4 字节 7. `DOUBLE`: 占用 8 字节 8. `DECIMAL`: 依赖于 M(精度) 和 D(标度) - 可以在数值类型后添加 `UNSIGNED` 表明为无符号数值 - 使用 `DOUBLE` 类型时,要指定整体长度和小数长度。eg: `DOUBLE(4, 1 )` 2. 字符串类型 1. `CHAR`: 定长字符串 2. `VARCHAR`: 变长字符串 3. `TINYBLOB`: 长度不超过 255 的二进制数据 4. `TINYTEXT`: 短文本字符串 5. `BLOB`: 二进制形式的长文本数据 6. `TEXT`: 长文本数据 7. `MEDIUMBLOB`: 二进制形式的中等长度文本数据 8. `MEDIUMTEXT`: 中等长度文本数据 9. `LONGBLOB`: 二进制形式的极大文本数据 10. `LONGTEXT`: 极大文本数据 - `CHAR` 会根据初始化长度分配空间 (性能好) - `VARCHAR` 会根据存储内容分配合适的空间 (性能较差) 3. 日期类型 1. `DATE`: 日期值,格式:YYYY-MM-DD 2. `TIME`: 时间值或持续时间,格式:HH:MM:SS 3. `YEAR`: 年份值,格式:YYYY 4. `DATETIME`: 混合日期和时间值,格式:YYYY-MM-DD HH:MM:SS 5. `TIMESTAMP`: 混合日期和时间值、时间戳,格式:YYYY-MM-DD HH:MM:SS (年份范围到 2038) \ ==== DDL - 表操作 - 修改 - 添加字段\ ```SQL ALTER TABLE 表名 ADD 字段名 类型(长度) [COMMENT 注释] [约束];``` - 修改字段名和字段类型\ `ALTER TABLE 表名 CHANGE 旧字段名 新字段名 类型(长度) [COMMENT 注释] [约束];` - 删除字段\ ```SQL ALTER TABLE 表名 DROP 字段名;``` - 修改表名\ ```SQL ALTER TABLE 旧表名 RENAME TO 新表名;``` - 删除表\ ```SQL DROP TABLE [IF EXISTS] 表名;``` - 删除指定表,并重新创建该表\ ```SQL TRUNCATE TABLE 表名;``` - 删除表时,表中的全部数据也会被删除 === DML ==== DML - 字段操作 - 添加数据 1. 给指定字段添加数据\ ```SQL INSERT INTO 表名(字段名1,字段名2,...) VALUES(值1,值2,...);``` 2. 给全部字段添加数据\ ```SQL INSERT INTO 表名 VALUES(值1,值2,...);``` 3. 批量添加数据\ ```SQL INSERT INTO 表名(字段名1,字段名2,...) VALUES(值1,值2,...),(值1,值2,...);```\ ```SQL INSERT INTO 表名 VALUES(值1,值2,...),(值1,值2,...);``` - 插入数据时,指定的字段顺序需要和值的顺序一一对应 - 字符串和日期型数据需要包含再引号中 - 插入数据大小应该在字段的规定范围内 ==== DML - 数据操作 - 插入 1. 给指定字段添加数据\ ```SQL INSERT INTO 表名(字段名1,字段名2,...) VALUES(值1,值2,...);``` 2. 给全部字段添加数据\ ```SQL INSERT INTO 表名 VALUES(值1,值2,...);``` 3. 批量添加数据\ ```SQL INSERT INTO 表名(字段名1,字段名2,...),(字段名1,字段名2,...) VALUES(值1,值2,...),(值1,值2,...);```\ ```SQL INSERT INTO 表名 VALUES (值1,值2,...),(值1,值2,...);``` ==== DML - 数据操作 - 修改 1. 修改数据\ ```SQL UPDATE 表名 SET 字段名1 = 值1,字段名2 = 值2,... [WHERE 条件];```\ - 修改语句的条件非必需,若没有条件,则修改整张表的数据 2. 删除数据\ ```SQL DELETE FROM 表名 [WHERE 条件];``` - `DELETE` 语句的条件非必需,若没有条件,则会删除整张表的所有数据 - `DELETE` 语句不能删除某一个字段的值 (可以使用`UPDATE`) === DQL - 语法 ````sql SELECT 字段列表 FROM 表名列表 WHERE 条件列表 GROUP BY 分组字段列表 HAVING 分组后条件列表 ORDER BY 排序字段列表 LIMIT 分页参数 ```` ==== DQL - 基本查询 1. 查询多个字段\ ```SQL SELECT 字段1, 字段2, 字段3... FROM 表名;```\ ```SQL SELECT * FROM 表名;``` 2. 设置别名 (增强字段的可读性)\ ```SQL SELECT 字段1 [AS 别名1], 字段2 [AS 别名2]...FROM 表名;``` 3. 去除重复记录\ ```SQL SELECT DISTINCT 字段列表 FROM 表名;``` ==== DQL - 条件查询 1. 语法\ ```SQL SELECT 字段列表 FROM 表名 WHERE 条件列表;``` 2. 条件: - 比较运算符: - 大于 / 大于等于:`> >=` - 小于 / 小于等于:`< <=` - 等于:`=` - 不等于:`<>` 或 `!=` - 某个范围内 []:`BETWEEN...AND...` - 在 IN 后的条件列表中的值,多选一:`IN(...)` - 是否为 NULL:`IS NULL` - 模糊匹配:`LIKE 占位符` #text()[`_` 匹配单个字符,`%` 匹配任意个字符] - 逻辑运算符: - 并且:`AND` 或 `&&` - 或者:`OR` 或 `||` - 非:`NOT` 或 `!` ==== DQL - 聚合函数 1. 概念:将一列数据作为一个整体,进行纵向计算 2. 常见聚合函数: 1. *count*:统计数量 2. *max*:最大值 3. *min*:最小值 4. *avg*:平均值 5. *sum*:求和 3. 语法\ `SELECT 聚合函数(字段列表) FROM 表名;` - 所有 `null` 值不参与聚合函数的统计 ==== DQL - 分组查询 1. 语法\ ```SQL SELECT 字段列表 FROM 表名 [WHERE 条件] GROUP BY 分组字段名 [HAVING 分组后过滤条件];``` 2. `WHERE` 和 `HAVING` 的区别 - 执行时机不同:`WHERE` 是分组之前进行过滤,不满足 `WHERE` 条件不参与分组; `HAVING` 是分组之后对结果进行过滤 - 判断条件不同:`WHERE` 不能对聚合函数进行判断,`HAVING` 可以 - 注意: - 分组之后,查询的字段一般未聚合函数和分组字段,查询其他字段无任何意义 - 执行顺序:`WHERE` > 聚合函数 > `HAVING` - 支持多字段分组,语法为\ ```SQL GROUP BY 字段1, 字段2``` ==== DQL - 排序查询 1. 语法\ ```SQL SELECT 字段列表 FROM 表名 ORDER BY 字段1 排序方式1, 字段2 排序方式2;``` 2. 排序方式 1. `ASC` 升序 (默认值) 2. `DESC` 降序 - 如果是多字段排序,当第一个字段值相同时,再根据第二个字段进行排序 ==== DQL - 分页查询 1. 语法\ ```SQL SELECT 字段列表 FROM 表名 LIMIT 起始索引, 查询记录数;``` 2. 注意 - 起始索引从 0 开始,起始索引 = (查询页码 - 1) \* 每页显示记录数 - 分页查询是数据库的方言,不同数据库实现不同 - 若查询的是第一页数据,起始索引可忽略 \ \ \ ==== DQL - 执行顺序 ````SQL SELECT 字段列表 -- 5 FROM 表名列表 -- 1 WHERE 条件列表 -- 2 GROUP BY 分组字段列表 -- 3 HAVING 分组后条件列表 -- 4 ORDER BY 排序字段列表 -- 6 LIMIT 分页参数 -- 7 ```` === DCL ==== DCL - 管理用户 1. 查询用户 ````SQL USE mysql; SELECT * FROM user; ```` 2. 创建用户\ ```SQL CREATE USER '用户名'@'主机名' IDENTIFIED BY '密码';``` - 主机名为 *localhost* 时,只能在当前主机访问数据库 - 主机名为 *%* 时,可以在任意主机访问数据库 3. 修改用户密码\ ```SQL ALTER USER '用户名'@'主机名' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY '新密码';``` 4. 删除用户\ ```SQL DROP USER '用户名'@'主机名';``` ==== DCL - 权限控制 1. MySQL 中定义了很多种权限: - *ALL*:所有权限 - *SELECT*:查询数据 - *INSERT*:插入数据 - *UPDATE*:修改数据 - *DELETE*:删除数据 - *ALTER*:修改表 - *DROP*:删除数据库、表、视图 - *CREATE*:创建数据库、表 2. 语法 1. 查询权限\ ```SQL SHOW GRANTS FOR '用户名'@'主机名';``` 2. 授予权限\ ```SQL GRANT 权限列表 ON 数据库名.表名 TO '用户名'@'主机名';``` 3. 撤销权限\ ```SQL REVOKE 权限列表 ON 数据库名.表名 FROM '用户名'@'主机名';``` - 多个权限之间,使用逗号分隔 - 授权时,数据库名和表名都可以使用 \* 进行通配,代表所有 == 函数 - *函数* 是指一段可以直接被另一段程序调用得到程序或代码 === 字符串函数 1. ```SQL CONCAT(s1, s2, ..., sn)``` 字符串拼接,将所有字符串拼接成一个字符串 2. ```SQL LOWER(str)``` 将字符串 str 全部转为小写 3. ```SQL UPPER(str)``` 将字符串 str 全部转为大写 4. ```SQL LPAD(str, n, pad)``` 左填充,用字符串 pad 对 str 的左侧进行填充,使其长度为 n 5. ```SQL RPAD(str, n, pad)``` 右填充,用字符串 pad 对 str 的右侧进行填充,使其长度为 n 6. ```SQL TRIM(str)``` 去除字符串头部和尾部的空格 7. ```SQL SUBSTRING(str, start, len)``` 返回从字符串 start 起的 len 长度的字符串 === 数值函数 1. ```SQL CEIL(x)``` 向上取整 2. ```SQL FLOOR(x)``` 向下取整 3. ```SQL MOD(x)``` 返回 x % y 4. ```SQL RAND()``` 返回 0~1 内的随机数 5. ```SQL ROUND(x, y)``` 求参数 x 的四舍五入值,保留 y 位小数 === 日期函数 1. ```SQL CURDATE()``` 返回当前日期 2. ```SQL CURTIME()``` 返回当前时间 3. ```SQL NOW()``` 返回当前日期和时间 4. ```SQL YEAR(date)``` 获取指定 date 的年份 5. ```SQL MONTH(date)``` 获取指定 date 的月份 6. ```SQL DAY(date)``` 获取指定 date 的日期 7. ```SQL DATE_ADD(date, INTERVAL expr type)``` 返回一个日期/时间值加上一个时间间隔后的时间值 8. ```SQL DATEDIFF(date1, date2)``` 返回起始时间 date1 和结束时间 date2 之间的天数 === 流程函数 1. ```SQL IF(value, t, f)``` 若 value 为 true,则返回 t,否则返回 f 2. ```SQL IFNULL(value1, value2)``` 若 value1 不为空,返回 value1,否则返回 value2 3. ```SQL CASE WHEN [val1] THEN [res1]... ELSE [default] END``` 若 val1 为 true,返回 res1,否则返回默认值 default 4. ```SQL CASE [EXPR] WHEN [val1] THEN [res1]... ELSE [default] END``` 若 expr 的值为 val1,返回 res1,否则返回默认值 default == 约束 1. 概念:约束是作用于表中字段上的规则,用于限制在表中的数据 2. 目的:保证数据库中数据的正确性、有效性和完整性 3. 分类: 1. 非空约束 ```SQL NOT NULL```:限制该字段的数据不能为 ```SQL null``` 2. 唯一约束 ```SQL UNIQUE```:保证该字段的所有数据都是唯一的、不重复的 3. 主键约束 ```SQL PRIMARY KEY```:主键是一行数据的唯一标识,要求非空且唯一 4. 默认约束 ```SQL DEFAULT```:保存数据时,若为指定该字段的值,则采用默认值 5. 检查约束 ```SQL CHECK```:保证字段值满足某一个条件 6. 外键约束 ```SQL FOREIGN KEY```:用来让两张表的数据之间建立联系,保证数据的一致性和完整性 > 约束是作用于表中字段上的,可以在创建表 / 修改表的时候添加约束 4. 外键约束 - 概念:用来让两张表的数据之间建立连接,保证数据的一致性和完整性 - 具有外键的表称为子表,外键关联的表称为父表 - 语法: 1. 添加外键 ````SQL CREATE TABLE 表名 ( 字段名 数据类型 ... [CONSTRAINT] [外键名称] FOREIGN KEY (外键字段名) REFERENCE 主表 (主表列 名) ); ```` ```SQL ALTER TABLE ADD CONSTRAINT 外键名称 FOREIGN KEY (外键字段名) REFERENCE 主表 (主表字段名)```; 2. 删除外键\ ```SQL ALTER TABLE 表名 DROP FOREIGN KEY 外键名称;``` 3. 删除 / 更新 + `NO ACTION`:当在父表中删除 / 更新对应记录时,首先检查该记录是否有对应外键,若有则不允许删除 / 更新 + `RESTRICT`:当在父表中删除 / 更新对应记录时,首先检查该记录是否有对应外键,若有则不允许删除 / 更新 + `CASCADE`:当在父表中删除 / 更新对应记录时,首先检查该记录是否有对应外键,若有,则也删除 / 更新外键在子表中的记录 + `SET NULL`:当在父表中删除对应记录时,首先检查该记录是否有对应外键,若有则设置子表中该外键指为 `null` (要求外键允许取 `null` 值) + `SET DEFAULT`:父表更新时,子表将外键列设置成一个默认值 ```sql ALTER TABLE ADD CONSTRAINT 外键名称 FOREIGN KEY (外键字段名) REFERENCE 主表 (主表字段名) ON UPDATE CASCADE ON DELETE CASCADE; ``` \ == 多表查询 === 多表关系 - 概述:项目开发中,在进行数据库表结构设计时,会根据业务需求及业务模块之间的关系,分析并设计表结构,由于业务之间相互关联,所以各个表结构之间也存在着各种连续: 1. 一对多 / 多对一 - 实现:#text(fill: red)[在多的一方建立外键,指向一的一方的主键] 2. 多对多 - 实现:#text(fill: red)[建立第三张中间表,中间表至少包含两个外键,分别关联两方主键] 3. 一对一 - 关系:一对一关系,多用于单表拆分,将一张表的基础字段放在一张表中,其他字段放在另一张表中,提升操作效率 - 实现:#text(fill: red)[在任意一方加入外键,关联另外一方的主键,并且设置外键唯一 (`null`)] === 多表查询 - 概述:从多张表中查询数据 - 笛卡尔积:笛卡尔乘积是指在数学中,两个集合的所有组合情况。#[(在多表查询时,需要消除无效的笛卡尔积)] - 多表查询分类 - 连接查询: + 内连接:相当于查询 A、B 集合的交集数据 + 外连接: + 左外连接:查询#text(fill: red)[左表]所有数据,以及两张表交集数据 + 右外连接:查询#text(fill: red)[右表]所有数据,以及两张表交集数据 + 自连接:当前表与自身的连接查询,自连接必须使用表别名 - 子查询 ==== 内连接 内连接查询 - 隐式内连接\ ```sql SELECT 字段列表 FROM 表1, 表2 WHERE 条件...;``` - 显式内连接\ ```sql SELECT 字段列表 FROM 表1 [INNER] JOIN 表2 ON 连接条件...;``` ==== 外连接 外连接查询 - 左外连接\ ```sql SELECT 字段列表 FROM 表1 LEFT [OUTER] JOIN 表2 ON 条件...;``` - 右外连接\ ```sql SELECT 字段列表 FROM 表1 RIGHT [OUTER] JOIN 表2 ON 条件...;``` ==== 自连接 自连接查询\ ```sql SELECT 字段列表 FROM 表A AS 别名A JOIN 表A AS 别名B ON 条件...; ``` - 自连接查询,可以是内连接查询,也可以是外连接查询 #text([(一定要起别名)]) ==== 联合查询 - 对于 `UNION` 查询,就是把多次查询的结果合并起来,形成一个新的查询结果集 ```sql SELECT 字段列表 FROM 表A ... UNION [ALL] -- 不添加 ALL 可对结果去重 SELECT 字段列表 FROM 表B ...; ``` - 对于联合查询的多张表的列数必须保持一致,字段类型也需要保持一致 \ === 子查询 - 概念:SQL 语句中嵌套 `SELECT` 语句,称为嵌套查询 - 子查询外部的语句可以是 `INSERT` / `UPDATE` / `DELETE` / `SELECT` 中任何一个 ```sql SELECT * FROM t1 WHERE column1 (SELECT column2 FROM t2); ``` - 根据子查询结果不同,分为: - 标量子查询 (子查询结果为单个值) - 列子查询 (子查询结果为一列) - 行子查询 (子查询结果为一行) - 表子查询 (子查询结果为多行多列) - 标量子查询\ 子查询返回的结果是单个值 (数字、字符串、日期等),常用操作符:比较运算符 - 列子查询\ 子查询返回的结果是一列 (可以是多行),常用操作符:`IN`、`NOT IN`、`ANY`、`SOME`、`ALL` - `IN`:在指定的集合范围内,多选一 - `NOT IN`:不在指定的集合范围内 - `ANY`:子查询返回列表中,任意一个满足即可 - `SOME`:与 `ANY` 等效 - `ALL`:子查询返回列表的所有值必须满足 - 行子查询\ 子查询返回的结果是一行 (可以是多列),常用操作符:`=`、`<>`、`IN`、`NOT IN` - 表子查询\ 子查询返回的结果是多行多列,常用操作符:`IN` == 事务 === 事务简介 - 事务:一组操作的集合,它是一个不可分割的工作单位,事务会把所有操作作为一个整体一起向系统提交或撤销操作请求,即所有操作要么同时成功或者同时失败 - 默认 MySQL 的事务时自动提交的,当执行一条 DML 语句,MySQL 会立即隐式地提交事务 \ \ \ === 事务操作 - 查看 / 设置事务提交方式 ```sql SELECT @@autocommit; SET @@autocommit = 0; ``` - 开启事务\ `START TRANSACTION;` - 提交\ `COMMIT;` - 回滚事务\ `ROLLBACK;` === 事务特性 1. #trans([原子性], [atomicity]):事务是不可分割的最小操作单元,要么全部成功,要么全部失败 2. #trans([一致性], [consistency]):事务完成时,必须使所有的数据都保持一致状态 3. #trans([隔离性], [isolation]):数据库系统提供的隔离机制,保证事务在不受外部并发操作影响的独立环境下运行 4. #trans([持久性], [durability]):事务一旦提交或回滚,它对数据库中的数据的改变是永久的
https://github.com/Daillusorisch/HYSeminarAssignment
https://raw.githubusercontent.com/Daillusorisch/HYSeminarAssignment/main/template/components/acknowledgement.typ
typst
#import "../utils/style.typ": * #let acknowledgement( anonymous: false, title: "致谢", display_title: "致  谢", outlined: true, body, ) = { if (not anonymous) { show <_acknowledgement_>: { align(center)[ #v(5pt) #text( font: 字体.黑体, size: 字号.小二, weight: "regular" )[#display_title] ] } pagebreak(weak: true) [ #heading(level: 1, numbering: none, outlined: outlined, title) <_acknowledgement_> #body ] } }
https://github.com/MyPedagogicalRessources/BUT1-R1-01-Initiation-developpement
https://raw.githubusercontent.com/MyPedagogicalRessources/BUT1-R1-01-Initiation-developpement/main/TD/TD1-Structures-controle-correction.typ
typst
#import "TD1-Structures-controle.typ":* #td1(isCorrection: true)
https://github.com/mhspradlin/wilson-2024
https://raw.githubusercontent.com/mhspradlin/wilson-2024/main/understanding-ai/day3-exercises.typ
typst
MIT License
#set page( paper: "us-letter" ) #set document(author: "<NAME>", title: "Understanding AI Day 3 Exercises") #align(center)[ = Classifiers: Exercises ] #v(2em) The below questions all reference this hypothetical data set: #table(columns: (auto, 1fr, 1fr, 1fr), align: center, [], [*Weather*], [*Traffic*], [*Accident*], [1], [Rainy], [Light], [Yes], [2], [Rainy], [Light], [No], [3], [Rainy], [Heavy], [Yes], [4], [Sunny], [Light], [No], [5], [Sunny], [Heavy], [No], [6], [Sunny], [Heavy], [No], [7], [Sunny], [Heavy], [Yes], [8], [Rainy], [Light], [No], [9], [Rainy], [Light], [Yes], [10], [Rainy], [Heavy], [Yes], ) + Suppose we build a classifier that predicts the following values for `Accident`: #table(columns: (auto,) * 11, [Sample \#], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [Predicted], [Yes], [Yes], [Yes], [No], [No], [No], [No], [Yes], [Yes], [Yes], [Actual], [Yes], [No], [Yes], [No], [No], [No], [Yes], [No], [Yes], [Yes],) Fill out the below confusion matrix. #table(columns: (1fr, 1fr, 1fr), rows: (40pt, 40pt, 40pt), align: center + horizon, inset: 5pt, [], [Predicted Negative], [Predicted Positive], [Actual Negative], [], [], [Actual Positive], [], []) + Calculate the accuracy, $F_1$ score, and $phi$ coefficient for the above data set. Are any of these values potentially misleading? + Using Naive Bayes, predict the value of `Accident` for a data point $("Weather" = "Rainy", "Traffic" = "Heavy")$. #pagebreak() == Reference === Classifier Accuracy $ "Accuracy" = ("True positives" + "True negatives") / ("Total") $ $ "F"_1 &= (2 * "True positives") / (2 * "True positives" + "False positives" + "False negatives") $ $ phi &= "MCC" = ("TP" * "TN" - "FP" * "FN") / sqrt(("TP" + "FP")("TP" + "FN")("TN" + "FP")("TN" + "FN")) $ === Bayes' Theorem $ P(A|B) = (P(B|A) * P(A)) / P(B) $ === Naive Bayes #set math.equation(numbering: "(1)") $ p(y|bold(x)) = (p(bold(x)|y) * p(y)) / p(bold(x)) prop p(bold(x)|y) * p(y) $ <bayes> $ p(y) &= ("# of " y) / "Total" = (|y|) / (|X|) $ <prob> $ p(bold(x)|y) &= p((a_1, a_2, ..., a_n)|y) \ &= p(a_1|y) * p(a_2|y) * ... * p(a_n|y) \ &= product_(i=1)^n p(a_i|y) $ <indep> #set math.equation(numbering: none) To predict $y$ for a data point $bold(x) = (a_1, a_2, ..., a_n)$, calculate $p(y|bold(x))$ for each possible $y$ and choose the one that is the largest: $ "Predicted " y = accent(y, hat) &= max_y p(y|bold(x)) \ &= max_y p(y) * p(bold(x)|y) #h(4.3em) #text()[By @bayes] \ &= max_y (|y|) / (|X|) * p(bold(x)|y) #h(4.5em) #text()[By @prob] \ &= max_y (|y|) / (|X|) * product_(i=1)^n p(a_i|y) #h(3em) #text()[By @indep] \ $ #v(3em) $ p(a_i|y) &= ("# of data points with attribute " a_i "and " y ) / ("Total number of data points with" y) \ |X| &= "Size of data set" $
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/PreventivoSprint/DecimoSprint.typ
typst
MIT License
#import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost #import "../../functions.typ": prospettoOrario, prospettoEconomico, glossary ==== Decimo preventivo *Inizio*: Venerdì 23/02/2024 *Fine*: Giovedì 29/02/2024 #prospettoOrario(sprintNumber: "10") #prospettoEconomico(sprintNumber: "10")
https://github.com/augustebaum/epfl-thesis-typst
https://raw.githubusercontent.com/augustebaum/epfl-thesis-typst/main/example/main/ch4_more_text.typ
typst
MIT License
= Yet another chapter To cite, you can use label syntax. `@atc13` gives: @atc13. You can also use `cite`: `#cite(<atc13>, form: "prose")` gives #cite(<atc13>, form: "prose"). You might have to use `cite` with `label` if the source name contains certain characters: `#cite(label("atc13"), form: "full")` gives #cite(label("atc13"), form: "full"). See https://typst.app/docs/reference/model/cite/ for more information. #pagebreak() bla bla bla bla #lorem(100) #pagebreak() blaaa
https://github.com/jneug/schule-typst
https://raw.githubusercontent.com/jneug/schule-typst/main/src/exercise/grading.typ
typst
MIT License
#import "../theme.typ" #let get-points(exercise) = if exercise != none and "grading" in exercise { exercise.grading.expectations.fold( 0, (a, exp) => a + exp.points, ) } else { 0 } #let get-total-points(exercise) = { let points = get-points(exercise) if "sub-exercises" in exercise and exercise.sub-exercises != () { points += exercise.sub-exercises.map(get-points).sum() } return points } #let display-points(points, singular: "Punkt", plural: "Punkte") = { if points == 0 [] else if points == 1 [#points #singular] else [#points #plural] } #let display-total(exercise, singular: "Punkt", plural: "Punkte") = { let total = 1 let total = get-points(exercise) if "sub-exercises" in exercise and exercise.sub-exercises != () { total += exercise.sub-exercises.map(get-points).sum() } display-points(total, singular: singular, plural: plural) } #let display-points-list(exercise, format: points => points.map(str).join(", ")) = { if exercise.grading.expectations != () { format(exercise.grading.expectations.map(exp => exp.points)) } } #let display-grading-table( exercises, grading-table, ) = { let (names, thresholds) = (grading-table.keys(), grading-table.values()) let total-points = exercises.values().map(get-total-points).sum(default: 0) let cells = ([Note],) for grade in names.rev() { cells.push([#grade]) } cells.push([Prozent]) for thres in thresholds.rev() { cells.push([#{ calc.round(thres * 100) }%]) } cells.push([Schwelle]) for thres in thresholds.rev() { cells.push([#{ calc.floor(total-points * thres) }]) } set text(size: 8pt) table( columns: grading-table.len() + 1, inset: 4pt, fill: (col, row) => { if row == 0 { theme.table.header } else if row == 1 { theme.table.odd } else { theme.table.even } }, align: center + horizon, ..cells, ) } #let display-expectations-table(exercises) = { let total-points = exercises.values().map(get-total-points).sum(default: 0) let muted-cell = table.cell.with(fill: theme.table.even) let header-cell = table.cell.with(fill: theme.table.header) set par(leading: .75em) table( columns: (auto, 1fr, auto, auto), inset: 5pt, fill: theme.table.odd, align: (col, row) => { if col in (0, 2, 3) { center + horizon } else if col == 1 { left + horizon } else { left } }, table.header( repeat: true, header-cell[*Aufg.*], header-cell[*Die Schülerin / Der Schüler #sym.dots.h*], header-cell[*mögl. \ Punkte*], header-cell[*erreicht*], ), ..for ex in exercises.values() { ( muted-cell[*#{ex.display-number}*], muted-cell({ if ex.title != "" and ex.title != none [*#ex.title*\ ] if ex.grading.expectations != () { list( marker: sym.dots.h, body-indent: .2em, ..ex.grading.expectations.map(exp => emph(exp.text)), ) } }), muted-cell[#display-total(ex, singular: "", plural: "")], muted-cell[ ], ) + for sub-ex in ex.sub-exercises { if sub-ex.grading.expectations != () { ( numbering("a)", sub-ex.number), { if sub-ex.grading.expectations != () { list( marker: sym.dots.h, body-indent: .2em, ..sub-ex.grading.expectations.map(exp => emph(exp.text)), ) } }, [#display-total(sub-ex, singular: "", plural: "")], [ ], ) } } }, header-cell(colspan: 2)[ #set align(right) *Insgesamt*: ], header-cell[*#total-points*], header-cell[], ) } #let display-expectations-table-expanded(exercises) = { let total-points = exercises.values().map(get-total-points).sum() let muted-cell = table.cell.with(fill: theme.table.even) let header-cell = table.cell.with(fill: theme.table.header) let stroked-cell(i, ..args) = table.cell( stroke: ( top: if i > 0 { theme.muted }, ), ..args, ) // Build table-rows let cells = () for ex in exercises.values() { // Add exercise header cells += ( muted-cell( rowspan: ex.grading.expectations.len() + 1, strong[#ex.display-number], ), muted-cell(strong(ex.title)), muted-cell(strong[#get-total-points(ex)]), muted-cell([ ]), ) // Add exercise expectations if ex.grading.expectations != () { for (i, exp) in ex.grading.expectations.enumerate() { cells += ( stroked-cell(i, text(.88em, emph(exp.text))), stroked-cell(i, text(.88em, [#exp.points])), stroked-cell(i)[], ) } } cells += for sub-ex in ex.sub-exercises { if sub-ex.grading.expectations.len() > 0 { // Number of expectations ( table.cell( rowspan: sub-ex.grading.expectations.len(), numbering("a)", sub-ex.number), ), ..for (i, exp) in sub-ex.grading.expectations.enumerate() { ( stroked-cell(i, emph(exp.text)), stroked-cell(i)[#exp.points], stroked-cell(i)[], ) }, ) } } } set par(leading: .75em) table( columns: (auto, 1fr, auto, auto), inset: 5pt, fill: theme.table.odd, align: (col, row) => { if col in (0, 2, 3) { center + horizon } else { left + horizon } }, table.header( repeat: true, header-cell[*Aufg.*], header-cell[*Die Schülerin / Der Schüler #sym.dots.h*], header-cell[*mögl. \ Punkte*], header-cell[*erreicht*], ), ..cells, header-cell(colspan: 2)[ #set align(right) *Insgesamt*: ], header-cell[*#total-points*], header-cell[], ) }
https://github.com/EdwinChang24/resume
https://raw.githubusercontent.com/EdwinChang24/resume/main/resume-print.typ
typst
MIT License
#include "resume.typ" #set page(paper: "us-letter") #pagebreak() #v(1fr) #align(center, image("logo.svg", width: 48pt, height: 48pt)) #v(1fr)
https://github.com/maxgraw/bachelor
https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/3-state/ar-comparison.typ
typst
In diesem Kapitel werden verschiedene AR-Plattformen anhand spezifischer Kriterien untersucht. Die Kriterien umfassen Kompatibilität, Leistungsfähigkeit, Benutzerfreundlichkeit, Zukunftssicherheit und Kosten. Nach einer Beschreibung dieser Kriterien erfolgt eine Vorstellung und ein Vergleich der Plattformen WebXR, ARKit, ARCore und Vuforia. Obwohl der Fokus dieser Arbeit auf der Entwicklung einer Augmented Reality Anwendung mit WebXR liegt, werden auch native AR-Plattformen betrachtet, um ein umfassendes Verständnis der verfügbaren Technologien zu gewährleisten. Es handelt sich hierbei um eine gezielte Auswahl relevanter AR-Plattformen und nicht um eine vollständige Marktanalyse. === Kriterien Kompatibilität bezieht sich darauf, welche Geräte und Betriebssysteme von der jeweiligen Plattform unterstützt werden. Eine breite Kompatibilität ermöglicht eine größere Reichweite und Flexibilität bei der Anwendungserstellung. Leistungsfähigkeit umfasst die Render-Qualität und die Latenzzeiten, die maßgeblich die Nutzererfahrung beeinflussen. Plattformen, die hohe Leistungsstandards erfüllen, können realistischere und flüssigere AR-Erlebnisse bieten. Benutzerfreundlichkeit betrachtet die Entwicklungsumgebung und die verfügbaren Tools. Eine benutzerfreundliche Plattform bietet eine intuitive Entwicklungsumgebung, umfangreiche Dokumentation und aktiven Community-Support, was den Entwicklungsprozess erleichtert und beschleunigt. Zukunftssicherheit beschäftigt sich mit der langfristigen Unterstützung und Weiterentwicklung der Plattform. Plattformen, die regelmäßig aktualisiert werden und von großen Unternehmen oder Gemeinschaften unterstützt werden, bieten eine höhere Investitionssicherheit. Kosten umfassen sowohl Lizenzkosten als auch Entwicklungs- und Wartungskosten. Kosteneffiziente Plattformen ermöglichen es Entwicklern, hochwertige Anwendungen zu geringeren Kosten zu erstellen und zu betreiben. === WebXR WebXR beschreibt eine API, welche es ermöglicht, plattformübergreifend Augmented Reality Anwendungen zu entwickeln und bereitzustellen. Die API unterstützt eine Vielzahl von Geräten, einschließlich Smartphones, Tablets und Headsets, unabhängig vom Betriebssystem @webxr-spec. In Bezug auf die Leistungsfähigkeit bietet WebXR eine angemessene Render-Qualität und akzeptable Latenzzeiten für webbasierte Anwendungen. WebXR verwendet native Plattformen wie ARCore auf Android-Geräten, um eine angemessene Leistung zu gewährleisten. Allerdings kann dadurch nicht die gleiche Leistungsfähigkeit erreicht werden wie bei der direkten Nutzung von beispielsweise ARCore. Bei WebXR handelt es sich um einen W3C-Standard, der von der Immersive Web Working Group entwickelt wird. Es wird eine offizielle Dokumentation bereitgestellt sowie eine Auswahl an offiziellen Beispielen. Die Integration in bestehende Web-Technologien ist möglich, wodurch auf bekannte Web-Entwicklungstools und -Frameworks zurückgegriffen werden kann. Dadurch, dass es sich bei der WebXR Device API um einen offenen W3C-Standard handelt, ist die Zukunftssicherheit gewährleistet. Die API wird von großen Technologieunternehmen wie Google und Mozilla unterstützt und kontinuierlich weiterentwickelt. Die breite Unterstützung trägt zur Stabilität und Weiterentwicklung der Plattform bei. Was die Kosten betrifft, so entstehen für WebXR keine Lizenzkosten, was es zu einer kosteneffizienten Wahl für Entwickler macht. Die Entwicklungs- und Wartungskosten sind geringer, da keine speziellen Entwicklungsumgebungen oder -tools benötigt werden. === ARKit ARKit ist eine von Apple entwickelte Plattform für Augmented Reality-Anwendungen, die exklusiv auf kompatiblen iOS-Geräten genutzt werden kann @apple-developer-ar. In Bezug auf die Leistungsfähigkeit bietet ARKit eine gute Render-Qualität und niedrige Latenzzeiten, da es speziell für die Prozessoren und Grafikchips von Apple-Geräten entwickelt wurde. Diese Plattform nutzt die integrierten Sensoren und Kameras der Geräte, um präzise AR-Erlebnisse zu ermöglichen. Dazu gehören unter anderem Bewegungsverfolgung, Gesichts- und Objekterkennung sowie Umgebungswahrnehmung. Apple stellt umfangreiche Dokumentationen, Tutorials und Beispielprojekte zur Verfügung, die den Einstieg in die ARKit-Entwicklung erleichtern. Außerdem ist ARKit nahtlos in die Xcode-Entwicklungsumgebung integriert, was eine effiziente Entwicklung und Optimierung von AR-Anwendungen ermöglicht. Apple veröffentlicht regelmäßig Updates und neue Versionen von ARKit, die zusätzliche Funktionen und verbesserte Leistungsfähigkeit bieten. Zudem zeigt Apple beispielsweise durch die Veröffentlichung der Apple Vision Pro ein hohes Interesse am Bereich der Augmented Reality. Für die Nutzung von ARKit selbst enstehen keine zusätzlichen Lizenzkosten, da es in das iOS-Entwicklerprogramm integriert ist. Allerdings sind Apple-Geräte erforderlich, was höhere Hardware- und Softwarekosten im Vergleich zu plattformübergreifenden Lösungen wie WebXR bedeuten kann. === ARCore ARCore ist eine von Google entwickelte Plattform für Augmented Reality-Anwendungen, die auf einer Vielzahl von Android-Geräten genutzt werden kann. Einige bereitgstellte APIs sind auch Platformübergreifend für iOS verfügbar. Demenstprechend können ARCore Anwendungen als plattformübergreifende Lösung entwickelt werden @arcore-documentation. In Bezug auf die Leistungsfähigkeit bietet ARCore eine gute Render-Qualität und niedrige Latenzzeiten, da es speziell für die Prozessoren und Grafikchips von Android-Geräten entwickelt wurde. ARCore nutzt die integrierten Sensoren und Kameras der Geräte, um präzise AR-Erlebnisse zu ermöglichen. Zu den Funktionen gehören Bewegungsverfolgung, Lichtabschätzung und die Fähigkeit, horizontale und vertikale Ebenen zu erkennen. Google stellt umfangreiche Dokumentationen, Tutorials und Beispielprojekte zur Verfügung, die den Einstieg in die ARCore-Entwicklung erleichtern. Die Integration in Android Studio, die offizielle Entwicklungsumgebung für Android, ermöglicht eine effiziente Entwicklung und Optimierung von AR-Anwendungen. Die Zukunftssicherheit von ARCore ist durch kontinuierliche Unterstützung und Weiterentwicklung der Plattform von Google gewährleistet. Google veröffentlicht regelmäßig Updates und neue Versionen von ARCore, die zusätzliche Funktionen und verbesserte Leistungsfähigkeit bieten. Die breite Unterstützung durch die Android-Entwickler-Community trägt ebenfalls zur Stabilität und Weiterentwicklung der Plattform bei. Was die Kosten betrifft, so entstehen für die Nutzung von ARCore selbst keine zusätzlichen Lizenzkosten, da es in das Android-Entwicklerprogramm integriert ist. Allerdings sind kompatible Android-Geräte und die Nutzung von Android Studio erforderlich, was möglicherweise höhere Hardware- und Softwarekosten im Vergleich zu plattformübergreifenden Lösungen wie WebXR bedeuten kann. === Vuforia Vuforia ist eine von PTC entwickelte Plattform für Augmented Reality-Anwendungen, welche plattformübergreifend auf einer Vielzahl von Geräten verfügbar ist @vuforia-documentation. In Bezug auf die Leistungsfähigkeit bietet Vuforia eine hohe Erkennungsgenauigkeit und stabile Tracking-Funktionen. Falls verfügbar nutzt die Platform hierbei Native APIs wie ARCore und ARKit. Falls diese nicht vorhanden sind, wird auf eigene Tracking-Technologien zurückgegriffen. Grundsätzlich werden die selben Funktionen wie bei ARCore und ARKit angeboten. Die Plattform stellt umfangreiche Dokumentationen, Tutorials und Beispielprojekte bereit, die den Einstieg in die Entwicklung erleichtern. Vuforia ist in Unity integriert, was es ermöglicht, die bekannten Tools und Workflows dieser Engine zu nutzen. Die Plattform wird regelmäßig aktualisiert, um neue Funktionen und Verbesserungen zu bieten. Die breite Akzeptanz und Nutzung in verschiedenen Branchen trägt ebenfalls zur Stabilität und Weiterentwicklung der Plattform bei. Vuforia bietet verschiedene Lizenzmodelle an. Es gibt eine kostenlose Version mit grundlegenden Funktionen sowie kostenpflichtige Lizenzen, die erweiterte Funktionen und kommerzielle Nutzung ermöglichen. Die Nutzung von Vuforia in Kombination mit Unity kann zusätzliche Lizenzkosten mit sich bringen, was bei der Planung des Budgets berücksichtigt werden sollte. === Vergleich Nach der Vorstellung der AR-Plattformen werden diese anhand der definierten Kriterien verglichen. Dabei wird auf die Kompatibilität, Leistungsfähigkeit, Benutzerfreundlichkeit, Zukunftssicherheit und Kosten eingegangen. Im Bezug auf die Kompatibilität lässt sich festhalten, dass WebXR, ARCore und Vuforia plattformübergreifende Entwicklungen ermöglichen. ARKit sticht hierbei heraus, da nur für kompatible iOS-Geräte entwickelt werden kann. Des Weiteren muss hervorgehoben werden, dass WebXR aktuell noch nicht bzw. nur experimentell unter iOS-Geräten unterstützt wird @can-i-use-webxr. Dementsprechend bieten ARCore oder Vuforia die beste Kompatibilität für plattformübergreifende Anwendungen. Hinsichtlich der Leistungsfähigkeit bieten ARKit und ARCore die beste Render-Qualität und die niedrigsten Latenzzeiten, da sie speziell für die Hardware der Geräte entwickelt wurden. WebXR nutzt, wie zuvor beschrieben, ARCore im Hintergrund und kann somit als externer Layer nicht die gleichen Ergebnisse erzielen. Vuforia nutzt, wie WebXR, native Plattformen, falls vorhanden, ermöglicht aber auch eigene Tracking-Funktionen. Der Fokus der Arbeit liegt in der Implementierung einer Möbelkonstruktionsumgebung für Augmented Reality. Hierbei lässt sich die benötigte Performance als gering einstufen. Dementsprechend kann die Anwendung aus Sicht der Leistungsfähigkeit von allen Plattformen umgesetzt werden. Die Benutzerfreundlichkeit ist bei ARKit und ARCore aufgrund der Integration in die offiziellen Entwicklungsumgebungen von Apple und Google hoch. WebXR bietet eine gute Integration in bestehende Web-Technologien und -Frameworks, was die Entwicklung erleichtert. Vuforia ist gut in Unity integriert, was den Zugang zu bekannten Tools und Workflows ermöglicht. Hierbei ermöglichen ARKit und ARCore eine tiefere Integration in die jeweiligen Betriebssysteme, was die Entwicklung von AR-Anwendungen erleichtern kann. Die Zukunftssicherheit ist bei ARKit, ARCore und Vuforia durch die kontinuierliche Unterstützung und Weiterentwicklung der Plattformen gewährleistet. WebXR als offener W3C-Standard wird ebenfalls von großen Technologieunternehmen unterstützt und kontinuierlich weiterentwickelt. Die Kosten für die Nutzung von ARKit und ARCore sind in das jeweilige Entwicklerprogramm integriert und erfordern keine zusätzlichen Lizenzkosten. Vuforia bieten verschiedene Lizenzmodelle an, die von kostenlosen Versionen bis hin zu kostenpflichtigen Lizenzen reichen. Darüber hinaus können weitere Kosten durch die Nutzung von Unity entstehen. WebXR steht als offener Standard kostenlos zur Verfügung und erfordert keine zusätzlichen Lizenzkosten.
https://github.com/Quaternijkon/notebook
https://raw.githubusercontent.com/Quaternijkon/notebook/main/content/计算机应用数学/随机游走与马尔可夫链.typ
typst
#import "../../lib.typ": * #set math.equation(numbering: none) = 随机游走与马尔可夫链 == 引言 *Definition* *随机游走* 在有向图上:从一个起始顶点生成一系列顶点,每次随机选择一个出边,沿着这条边移动到一个新的顶点,并重复这个过程。 正式定义如下: $ p(t)P = p(t+1) $ 其中, $p(t)$ 是一个行向量,它的每个分量表示在时间 $t$ 时每个顶点的概率质量分布, $P$ 是所谓的转移矩阵, $P_(i,j)$ 是游走从顶点 $i$ 选择顶点 $j$ 的概率。 *Example* #figure( image("img/1.png", width: 50%), caption: [邻接矩阵与转移矩阵] ) #figure( image("img/2.png", width: 50%), caption: [随机游走] ) // #figure( // table( // stroke: none, // columns: 2, // align: left, // table.hline(), // table.header( // [*Random walk*],[*Markov chain*], // ), // table.hline(), // [图 Graph], [随机过程 Stochastic process],[顶点 Vertex], [状态 State],[强连通 Strongly connected], [持续 Persistent], // [非周期的 Aperiodic], [非周期的 Aperiodic], // [强连通且非周期的 Strongly connected and aperiodic], [遍历的 Ergodic], // [无向图 Undirected graph], [时间可逆的 Time reversible], // table.hline(), // ), // kind:"table", // supplement: [表], // caption: [随机游走与马尔可夫链] // ) // // #let content= *Markov链* 有限的状态集合。 $p_(x y)$:从状态$x$到状态$y$的转移概率,$sum_y p_(x y) = 1$。 Markov链可以表示为有向图,其中从顶点x到顶点y的权重为$p_(x y)$。 #llltable( titles:table.header( [*Random walk*],[*Markov chain*] ), columns:2, caption: [随机游走与马尔可夫链], [图 Graph], [随机过程 Stochastic process],[顶点 Vertex], [状态 State],[强连通 Strongly connected], [持续 Persistent],[非周期的 Aperiodic], [非周期的 Aperiodic],[强连通且非周期的 Strongly connected and aperiodic], [遍历的 Ergodic],[无向图 Undirected graph], [时间可逆的 Time reversible] ) 我们将在本节中介绍以下内容: - 示例:PageRank和Markov决策过程。 - 平稳分布。 - 收敛性。 - Markov过程。 *Example* *PageRank* 将网页看作一个图:每个网页是一个顶点,超链接是边。 目标:根据重要性对网页进行排序。 *Insight* 一个网页的链接越多,它就越重要。 将入链看作投票,著名网站有更多的入链。 此外,来自重要网页的链接权重更大。 #figure( image("img/3.png", width: 50%), caption: [] ) *随机邻接矩阵* $d_i$ 是节点 $i$ 的度。 如果 $i arrow j$,则 $M_(j i) = 1/d_i$。 *排序向量* $r_i$ 是页面 $i$ 的重要性得分。 公式 (\*) 可以重写为: $r = M dot r$ *Example* #figure( image("img/4.png", width: 50%), caption: [] ) *第一次迭代* #align(center)[$mat( 1/3; 1/2; 1/6 ) = mat( 1/2, 1/2, 0; 1/2, 0, 1; 0, 1/2, 0 ) dot mat( 1/3; 1/3; 1/3 )$] #align(center)[$P R(Y)^1 = 1/2 P R(Y)^0 + 1/2 P R(A)^0 = 1/2 dot 1/3 + 1/2 dot 1/3 = 1/3$ $P R(A)^1 = 1/2 P R(Y)^0 + 1 dot P R(M)^0 = 1/2 dot 1/3 + 1/3 = 3/6$ $P R(M)^1 = 1/2 P R(A)^0 = 1/2 dot 1/3 = 1/6$] *第二次迭代* #align(center)[$mat( 5/12; 1/3; 1/4 ) = mat( 1/2, 1/2, 0; 1/2, 0, 1; 0, 1/2, 0 ) dot mat( 1/3; 1/2; 1/6 )$] ... *收敛* #align(center)[$mat( 2/5; 2/5; 1/5 ) = mat( 1/2, 1/2, 0; 1/2, 0, 1; 0, 1/2, 0 ) dot mat( 2/5; 2/5; 1/5 )$] *Markov过程*(Markov决策过程) #align(center)[#mi( ` \mathcal{S}, \mathcal{A}, \mathcal{R}, \mathbb{P}, \gamma ` )] #mitext(` \(\mathcal{S}\):状态集合。 \(\mathcal{A}\):动作集合。 \(\mathcal{R}\):在状态\(s\)下执行动作\(a\)的奖励\(r(s, a)\)。 \(\mathbb{P}\):在状态 \(s\) 下执行动作 \(a\) 后转移到下一个状态 \(s'\) 的转移概率 \(P(s' | s, a)\)。 \(\gamma\):折扣因子。 `) *MDP(Markov决策过程)*: #algo(caption:[Markov决策过程],content:[ #pseudocode-list(hooks: .5em)[ + #mi(`\(t = 0\) 初始状态 \(s_0 \sim p(s_0)\)`) + #mi(`对于 \(t = 0\) 到结束:`) + #mi(`执行动作 \(a_t\)`) + #mi(`获得奖励 \(r_t \sim R(\cdot | s_t, a_t)\)`) + #mi(`获得下一个状态 \(s_{t+1} \sim P(\cdot | s_t, a_t)\)`) + #mi(`代理获得奖励 \(r_t\) 和状态 \(s_{t+1}\)`) ] ]) *目标*:最大化长期奖励(累计奖励)#mi(`\(\sum_{t \geq 0} D^t r_t\)`)。 *Example* #figure( image("img/5.png", width: 20%), caption: [] ) 动作集合 = {左, 右, 上, 下} 到达空白格的奖励 → 使用最小化的动作数到达终点状态。 == 平稳分布 Stationary Distribution #mitext(`设 \(p_t\) 是随机游走经过 \(t\) 步后的概率分布。通过以下公式定义长期平均概率分布 \(a_t\): \[ a_t = \frac{1}{t} \left( p_0 + p_1 + \cdots + p_{t-1} \right) \]`) Markov链的基本定理: 对于一个连通的Markov链,它收敛于一个极限概率向量 x,满足: #mitex(`XP = x; \sum_i x_i = 1 \Rightarrow X[P - I, 1] = [0, 1]`) *引理 1.3.1* 设 $P$ 是一个连通的Markov链的转移概率矩阵。通过在矩阵 $P - I$ 上增加一列1的列构造出的 $n times (n+1)$ 矩阵 $A = [P - I, 1]$ 的秩为 $n$。 *证明*:作业 *定理 1.3.2* 设 P 是连通Markov链的转移概率矩阵,则存在一个唯一的概率向量 $pi$ 满足 #mi(`\pi P = \pi`)。此外,对于任何初始分布,#mi(`\lim_{t \to \infty} a_t`) 存在且等于 $pi$。 *证明*:考虑 #mi(`\(a_t\)`) 和 #mi(`\(a_{t+1}\)`) 的差,#mi(`a_t - a_{t+1} = a_t P`): #mitex(` \begin{align*} a_t P - a_t &= \frac{1}{t} \left[ p_0 P + p_1 P + \cdots + p_{t-1} P \right] - \frac{1}{t} \left[ p_0 + p_1 + \cdots + p_{t-1} \right] \\ &= \frac{1}{t} \left[ p_1 + p_2 + \cdots + p_t \right] - \frac{1}{t} \left[ p_0 + p_1 + \cdots + p_{t-1} \right] \\ &= \frac{1}{t} (p_t - p_0) \end{align*} `) 因此,#mi(`b_t = a_t P - a_t`) 满足 #mi(`|b_t| \leq \frac{2}{t}`),并且当 #mi(`\(t \to \infty\)`) 时趋于0。 根据引理 1.3.1,#mi(`A = [P - I, 1]`) 的秩为 #mi(`\(n\)`)。 由于 $A$ 的所有行和为0,#mi(`n \times n`) 矩阵 $B$ 中除了最后一列以外的所有列是可逆的。 令 #mi(`c_t`) 由 #mi(`b_t = a_t P - a_t`) 去掉第一列得到,使得 #mi(`a_t B = [c_t, 1]`)。 因此 #mi(`a_t \to [c_t, 1] \to [0, 1]`) 并且 #mi(`a_t \to [0, 1] B^{-1}`)。 因此 #mi(`a_t \to \pi`),我们得出 $pi$ 是一个概率向量。 由于 #mi(`a_t [P - I] = b_t \to 0`) ,我们得到 #mi(`\pi [P - I] = 0`)。 由于 $A$ 的秩为 $n$,这是唯一的解,如所要求的。 *引理 1.3.3* 对于在强连通图上的随机游走,若边上带有概率,向量 $pi$ 满足 #mi(`\pi_x p_{xy} = \pi_y p_{yx}`) 对于所有 #mi(`\(x\) 和 \(y\)`),且 #mi(`\sum_x \pi_x = 1`),那么 $pi$ 是随机游走的平稳分布。 *证明*:#mi(`\pi_x p_{xy} = \pi_y p_{yx}`),两边求和,#mi(`\pi_x = \sum_y \pi_y p_{yx}`),因此 \(\pi\) 满足 #mi(`\pi = \pi P`)。(By Theorem 1.3.2 ...) == 无向图上随机游走的收敛性 下一个问题:游走需要多长时间开始反映Markov过程的平稳概率? *示例*:这需要很长时间才能收敛。游走很难通过图的两个部分之间的窄通道。 #figure( image("img/6.png", width: 50%), caption: [] ) 我们在下面定义了Markov链的收缩的一个组合度量,称为归一化导通率。 *定义 1.3.1* 设 #mi(`\varepsilon > 0`)。Markov链的 #mi(`\(\varepsilon\)-mixing`)时间是最小的整数 #mi(`t`),使得对于任何初始分布 #mi(`P_0`),第 #mi(`t`) 步的平均概率分布与平稳分布之间的1-范数距离最多为 #mi(`\varepsilon`)。 #mitex(`|a_t - \pi| \leq \varepsilon`) *定义 1.3.2* 对于一个顶点子集 #mi(`S`),令 #mi(`\pi(S)`) 表示 #mi(`\sum_{x \in S} \pi_x`)。归一化导通率定义为: #mitex(`\Phi(S) = \frac{\sum_{(x, y) \in (S, \bar{S})} \pi_x p_{xy}}{\min(\pi(S), \pi(\bar{S}))}`) 其中,#mi(`\bar{S} = V - S`) 。#mi(`\pi(S)`) 是平稳分布下,Markov链处于某状态属于 #mi(`S`) 的概率。 *定义 1.3.3* Markov链的归一化导通率,记作 #mi(`\Phi`) ,定义为: #mitex(`\Phi = \min_S \Phi(S)`) *定理 1.3.4*. 在无向图上,随机游走的 #mi(`\(\varepsilon\)-mixing`)时间为: #mitex(`\Phi \left( \frac{\ln \left( \frac{1}{\pi_{\text{min}}} \right)}{\Phi^2 \varepsilon^3} \right) `) 其中,#mi(`\pi_{\min}`) 是任何状态的最小平稳概率。 使用归一化导通率证明收敛性。 接下来,我们应用定理 1.3.4 通过一些例子说明归一化导通率如何限制收敛速度。 ① *一个一维的格子* #figure( image("img/7.png", width: 50%), caption: [] ) n个顶点路径,两端都有自环。 平稳概率在所有顶点上是均匀的 #mi(`\frac{1}{n}`)。 具有最小归一化导通率的集合是: - 具有 #mi(`\pi \leq \frac{1}{2}`) 的集合; - 包含前 #mi(`\frac{n}{2}`) 个顶点的集合。 从集合 #mi(`S`) 到集合 #mi(`\bar{S}`) 的边的总导通率是: #mi(`\pi_m p_{m, m+1} = \Omega \left( \frac{1}{n} \right), (m = \frac{n}{2})`) #mi(`\pi(S) = \frac{1}{2}`) 因此,#mi(`\Phi(\bar{S}) = 2\pi_m p_{m, m+1} = \Omega \left( \frac{1}{n} \right)`) 根据定理 1.3.4,对于 #mi(`\varepsilon = \frac{1}{100}`),经过 #mi(`O(n^2 \log n)`) 步之后,#mi(`||a_t - \pi|| \leq \frac{1}{100}`)。 此图没有快速收敛性。 == 4. 单位边权重的无向图上的随机游走 我们使用这种特殊类型的图来回答以下问题: - 随机游走从 #mi(`x`) 到达 #mi(`y`) 的期望时间是多少? - 从 #mi(`x`) 到 #mi(`y`) 并返回的期望时间是多少? - 到达每个顶点的期望时间是多少? #linebreak() #linebreak() #align(center)[#commutative-diagram( node((0, 0), $X$), node((0, 2), $Y$), // node((1, 0), $X \/ "ker"(f)$, "quot"), arr($X$, $Y$, "random walk",curve: 30deg), // arr("quot", (0, 1), $tilde(f)$, label-pos: right, "dashed", "inj"), // arr($X$, "quot", $pi$), )] ① *命中时间* #mi(`h_{xy}`) —— 也称为发现时间。 *引理 1.3.5*. 从路径上的一个端点开始随机游走,穿过有n个顶点的路径到达另一端的期望时间是 #mi(`\Theta H(n^2)`)。 *证明*: #align(center)[#mi(`h_{12} = 1`) #mi(`h_{i, i+1} = \frac{1}{2} + \frac{1}{2}(1 + h_{i-1, i+1})`) #mi(`= 1 + \frac{1}{2}(h_{i-1, i} + h_{i, i+1})`) #mi(`= 2 + h_{i-1, i}`) 因此,#mi(`h_{i, i+1} = 2i - 1`) ,#mi(`2 \leq i \leq n-1`) 要从1走到n, #mi(`h_{1, n} = \sum_{i=1}^{n-1} h_{i, i+1}`) #mi(`= \sum_{i=1}^{n-1} (2i - 1)`) #mi(`= 2 \sum_{i=1}^{n-1} i - \sum_{i=1}^{n-1} 1`) #mi(`= 2 \frac{n(n-1)}{2} - (n-1)`) #mi(`= (n-1)^2`)] #figure( image("img/9.png", width: 40%), caption: [] ) *引理 1.3.6* 设随机游走从顶点1到顶点n,在包含n个顶点的链中。令 #mi(`t(i)`) 为在顶点 #mi(`i`) 停留的期望时间。那么: #mitex(` t(i) = \begin{cases} n-1, & i=1 \\ 2(n-i), & 2 \leq i \leq n-1 \\ 1, & i = n \end{cases} `) *证明* 现在 #mi(`t(n) = 1`),因为游走到达n时会停止。当游走到达 #mi(`n-1`) 时,一半的时间它会继续走向n。因此,#mi(`t(n-1) = 2`)。对于 #mi(`3 \leq i \leq n-1`), #align(center)[#block(align(left)[#mi(` t(i) = \frac{1}{2} [t(i-1) + t(i+1)] `) #mi(` t(1) = \frac{1}{2} t(2) + 1 `) #mi(` t(2) = t(1) + \frac{1}{2} t(3) `)])] 因此我们得到 #mi(` t(i+1) = 2t(i) - t(i-1) `) 因此,#mi(`t(i) = 2(n-i)`) 对于 #mi(`3 \leq i \leq n-1`)。 #mi(`t(2) = 2(n-2)`),#mi(`t(1) = n-1`)。 因此,在顶点停留的总时间是 #mitex(` n-1 + 2(1 + 2 + ... + n-2) + 1 = (n-1 + 1 + 2 \frac{(n-1)(n-2)}{2} + 1) = (n-1)^2 + 1 `) 这比 #mi(`h_{1n}`) 多出1。 ② *往返时间* #mitex(`commute(x, y) = h_{xy} + h_{yx}`) ③ *覆盖时间* #mi(`Cover(x, G) \rightarrow`) 从顶点 #mi(`x`) 开始的随机游走到达每个顶点至少一次的期望时间。 #mitex(`Cover(G) = \max_x Cover(x, G)`) *定理 1.3.7*. 设 #mi(`G`) 是一个有 #mi(`n`) 个顶点和 #mi(`m`) 条边的图。覆盖时间 #mi(`Cover(G)`) 的上界为 #mi(`4m(n-1)`)。 *证明*. 进行一次从某个顶点 #mi(`Z`) 开始的深度优先搜索。#mi(`T`) 是结果生成的深度优先搜索生成树。深度优先搜索覆盖每个顶点。注意,生成树中的每条边在两个方向上都被遍历了两次。 #mitex(` Cover(Z, G) \leq \sum_{(x, y) \in T, (y, x) \in T} h_{xy} `) *推论*. 如果 #mi(`x`) 和 #mi(`y`) 是相邻的,则 #mi(`h_{xy} + h_{yx} \leq 2m`),其中 #mi(`m`) 是边的数量。 该推论表明 #mi(`h_{xy} \leq 2m`)。 由于深度优先搜索树中有 #mi(`n-1`) 条边,并且每条边都被遍历两次,#mi(`Cover(Z) \leq 4m(n-1)`)。 因此,#mi(`Cover(G) \leq 4m(n-1)`)。 == 更多关于 Markov 的内容 *△ 一个简单的 Markov 链* #mi(`\langle S, P \rangle`) #mi(`S`): 状态, #mi(`P`): 概率 #figure( image("img/12.png", width: 80%), caption: [] ) #align(center)[#block({ align(left)[ 大量路径的例子: #mi(`C_1, C_2, C_3, pass`) #mi(`C_1, TikTok, C_1, C_2, C_3, pass`) #mi(`C_1, C_2, C_3, Library, C_2, pass`) ......] })] *△ Markov 奖励过程* #mi(`\langle S, P, R, \gamma \rangle`) #mi(`R`): 奖励, #mi(`\gamma`): 折扣因子 #figure( image("img/13.png", width: 80%), caption: [] ) 总奖励 #mi(`G_t = R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \cdots`) #mi(`= \sum_{k=0}^{\infty} \gamma^k R_{t+k+1}`) 状态的价值函数 #mi(`V(s) = \mathbb{E}[G_t \mid S_t = s]`) \= 从该状态开始的期望奖励,即不同路径的平均奖励。 *路径*:#mi(`C_1, C_2, C_3, Pass, Exit`) #mi(`S_1 = C_1`) 且 #mi(`\gamma = 1/2`) #mi(` V_{C_1} = -2 - 2 \cdot \frac{1}{2} - 2 \cdot \frac{1}{4} - 10 \cdot \frac{1}{8} = -2.25 `) *路径*:#mi(`C_1, TikTok, TikTok, C_1, C_2, Exit`) #mi(` V_{C_1} = -2 - 1 \cdot \frac{1}{2} - 1 \cdot \frac{1}{4} - 2 \cdot \frac{1}{8} - 2 \cdot \frac{1}{16} = -3.125 `) #figure( image("img/14.png", width: 80%), caption: [] ) #figure( image("img/15.png", width: 80%), caption: [] ) *Bellman 期望方程* #mitex(` \begin{align*} V(s) &= \mathbb{E} \left[ G_t \mid s_t = s \right] \\ &= \mathbb{E} \left[ R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \cdots \mid s_t = s \right] \\ &= \mathbb{E} \left[ R_{t+1} + \gamma \left( R_{t+2} + \gamma R_{t+3} \cdots \right) \mid s_t = s \right] \\ &= \mathbb{E} \left[ R_{t+1} + \gamma G_{t+1} \mid s_t = s \right] \\ &= \mathbb{E} \left[ R_{t+1} + \gamma V(s_{t+1}) \mid s_t = s \right] \end{align*} `) // #mitex(` // V(s) = \mathbb{E}[G_t \mid S_t = s] // `) // #mitex(` // = \mathbb{E}[R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \cdots \mid S_t = s] // `) // #mitex(` // = \mathbb{E}[R_{t+1} + \gamma (R_{t+2} + \gamma R_{t+3} + \cdots) \mid S_t = s] // `) // #mitex(` // = \mathbb{E}[R_{t+1} + \gamma G_{t+1} \mid S_t = s] // `) // #mitex(` // = \mathbb{E}[R_{t+1} + \gamma V(S_{t+1}) \mid S_t = s] // `) 使用 #mi(`s'`) 表示 #mi(`t+1`) 的可能状态, #mitex(` V(s) = R_s + \gamma \sum_{s' \in S} P_{ss'} V(s') `) 对于 class 3 #mitex(`4.3 = -2 + 0.6 \times 10 + 0.4 \times 0.8`) *△ Markov 决策过程* #mi(`\langle S, A, P, R, \gamma \rangle`) #mi(`A: 动作`) #figure( image("img/16.png", width: 80%), caption: [] ) *策略*:采取动作的概率分布。 #mitex(`\pi(a \mid s) = \mathbb{P}[A_t = a \mid S_t = s]`) 给定一个 MDP #mi(`M = \langle S, A, P, R, \gamma \rangle`) 和一个策略 #mi(`\pi`)。 序列 #mi(`S_1, S_2, \cdots`) 是一个 Markov 过程 #mi(`\langle S, p^\pi \rangle`)。 状态和奖励序列 #mi(`S_1, R_2, S_2, \cdots`) 是一个 Markov 过程 #mi(`\langle S, P^\pi, R^\pi, \gamma \rangle`)。 在策略 #mi(`\pi`) 下,从状态 #mi(`s`) 转移到 #mi(`s'`) 的概率是: #mitex(`P^\pi_{ss'} = \sum_{a \in A} \pi(a \mid s) P^a_{ss'}`) 在策略 #mi(`\pi`) 下,状态 #mi(`s`) 的奖励是: #mitex(`R^\pi_s = \sum_{a \in A} \pi(a \mid s) R^a_s`) *价值函数*: #mitex(`V_\pi(s) = \mathbb{E}_\pi [G_t \mid S_t = s]`) *策略价值函数*: #mitex(`q_\pi(s, a) = \mathbb{E}_\pi [G_t \mid S_t = s, A_t = a]`) *Bellman 方程*: #mitex(` \begin{align*} V_{\pi}(s) &= \mathbb{E}_{\pi} \left[ R_{t+1} + \gamma v_{\pi} \left( s_{t+1} \right) \mid s_t = s \right] \\ q_{\pi}(s, a) &= \mathbb{E}_{\pi} \left[ R_{t+1} + \gamma q_{\pi} \left( s_{t+1}, A_{t+1} \right) \mid s_t = s, A_t = a \right] \\ 因此 \quad V_{\pi}(s) &= \sum_{a \in \mathcal{A}} \pi(a \mid s) q_{\pi}(s, a) \end{align*} `) // #mitex(` // V_\pi(s) = \mathbb{E}_\pi [R_{t+1} + \gamma V_\pi(s_{t+1}) \mid s_t = s] // `) // #mitex(` // q_\pi(s, a) = \mathbb{E}_\pi [R_{t+1} + \gamma q_\pi(s_{t+1}, A_{t+1}) \mid s_t = s, A_t = a] // `) // 因此, // #mitex(` // V_\pi(s) = \sum_{a \in A} \pi(a \mid s) q_\pi(s, a) // `) 且 #mi(` q_\pi(s) = R^a_s + \gamma \sum_{s' \in S} P^a_{ss'} V_\pi(s') `) 因此, #mitex(` q_\pi(s) = R^a_s + \gamma \sum_{s' \in S} P^a_{ss'} \sum_{a' \in A} \pi(a' \mid s') q_\pi(s', a') `) *最优价值函数* #mitex(` V_*(s) = \max_\pi V_\pi(s) `) *最优动作-价值函数* #mitex(` q_*(s, a) = \max_\pi q_\pi(s, a) `) 我们可以使用 #mi(`q_*(s, a)`) 来得到最优策略 #mi(`\pi`): #mitex(` \pi_*(a \mid s) = \begin{cases} 1 & \text{if } a = \arg\max_{a \in A} q_*(s, a) \\ 0 & \text{otherwise} \end{cases} `)
https://github.com/0xPARC/0xparc-intro-book
https://raw.githubusercontent.com/0xPARC/0xparc-intro-book/main/src/ot.typ
typst
#import "preamble.typ":* = Oblivious transfer <ot> Alice has $n$ messages $x_1, dots, x_n$. We'll assume the messages are essentially unrelated to each other (since we could always pad them with random bits). Bob wants to request the $i$-th message, without letting Alice learn anything about the value of $i$. Alice wants to send Bob $x_i$, without letting him learn anything about the other $n-1$ messages. An _oblivious transfer (OT)_ allows Alice to transfer a single message to Bob, but she remains oblivious as to which message she has transferred. We'll see two simple protocols to achieve this. (In fact, for two-party computation, we only need "1-of-2 OT": Alice has $x_1$ and $x_2$, and she wants to send one of those two to Bob. But "1-of-$n$ OT" isn't any harder, so we'll do 1-of-$n$.) == Commutative encryption Let's imagine that Alice and Bob have access to some encryption scheme that is _commutative_: $ Dec_b ( Dec_a ( Enc_b ( Enc_a (x) ) ) ) = x. $ In other words, if Alice encrypts a message, and Bob applies a second layer of encryption to the encrypted message, it doesn't matter which order Alice and Bob decrypt the message in -- they will still get the original message back. A metaphor for commutative encryption is a box that's locked with two padlocks. Alice puts a message inside the box, locks it with her lock, and ships it to Bob. Bob puts his own lock on the box and ships it back to Alice. What's special about commutative encryption is that Bob's lock doesn't block Alice from unlocking her own -- so Alice can remove her lock and send it back to Bob, and then Bob removes his lock and recovers the message. Mathematically, you can get commutative encryption by working in a finite group (for example $FF_p^times$, or an elliptic curve). 1. Alice's secret key is an integer $a$; she encrypts a message $g$ by raising it to the $a$-th power, and she sends Bob $g^a$. 2. Bob encrypts again with his own secret key $b$, and he sends $(g^a)^b = g^(a b)$ back to Alice. 3. Now Alice removes her lock by taking an $a$-th root. The result is $g^b$, which she sends back to Bob. 4. Bob takes a $b$-th root, recovering $g$. == OT using commutative encryption Our first oblivious transfer protocol is built on the commutative encryption we just described. Alice has $n$ messages $x_1, dots, x_n$, which we may as well assume are elements of the group $G$. Alice chooses a secret key $a$, encrypts each message, and sends all $n$ ciphertexts to Bob: $ Enc_a (x_1), dots, Enc_a (x_n). $ But crucially, Alice sends the ciphertexts in order, so Bob knows which is which. At this point, Bob can't read any of the messages, because he doesn't know the keys. No problem! Bob just picks out the $i$-th ciphertext $Enc_a (x_i)$, adds his own layer of encryption onto it, and sends the resulting doubly-encrypted message back to Alice: $ Enc_b (Enc_a (x_i)). $ Alice doesn't know Bob's key $b$, so she can't learn anything about the message he encrypted -- even though it originally came from her. Nonetheless she can apply her own decryption method $Dec_a$ to it. Since the encryption scheme is commutative, the result of Alice's decryption is simply $ Enc_b (x_i), $ which she sends back to Bob. And Bob decrypts the message to learn $x_i$. == OT in one step The protocol above required one and a half rounds of communication: In total, Alice sent two messages to Bob (steps 1 and 3), and Bob sent one message to Alice (step 2). We can do better, using public-key cryptography. Let's start with a simplified protocol that is not quite secure. The idea is for Bob to send Alice $n$ keys $ b_1, dots, b_n. $ One of the $n$, say $b_i$, is a public key for which Bob knows the private key. The other $n-1$ are random garbage. Alice then uses one key to encrypt each message, and sends back to Bob: $ Enc_(b_1)(x_1), dots, Enc_(b_n)(x_n). $ Now Bob uses the private key for $b_i$ to decrypt $x_i$, and he's done. Is Bob happy with this protocol? Yes. Alice has no way of learning the value of $i$, as long as she can't distinguish a true public key from a random fake key (which is true of public-key schemes in practice). But is Alice happy with it? Not so much. A cheating Bob could send $n$ different public keys, and Alice has no way to detect it -- like we just said, Alice can't tell random garbage from a true public key! And then Bob would be able to decrypt all $n$ messages $x_1, dots, x_n$. But there's a simple trick to fix it. Bob chooses some "verifiably random" value $r$; to fix ideas, we could agree to use $r = sha(1)$. Then we require that the numbers $b_1, dots, b_n$ form an arithmetic progression with common difference $r$. Bob chooses $i$, computes a public-private key pair, and sets $b_i$ equal to that key. Then all the other terms $b_1, dots, b_n$ are determined by the arithmetic progression requirement $b_j = b_i + (j-i)r$. (Or, if the keys are elements of a group in multiplicative notation, we could write this as $b_j = r^(j-i) dot b_i$.) Is this secure? If we think of the hash function as a random-number generator, then all $n-1$ "garbage keys" are effectively random values. So now the question is: Can Bob compute a private key for a given (randomly generated) public key? It's a standard assumption in public-key cryptography that Bob can't do this: there's no algorithm that reads in a public key and spits out the corresponding private key. (Otherwise, the whole enterprise is doomed.) So Alice is guaranteed that Bob only knows how to decrypt (at most) one message. In fact, some public-key cryptosystems (like ElGamal) have a sort of "homomorphic" property: If you know the private keys for two different public keys $b_1$ and $b_2$, then you can compute the private key for the public key $b_2 b_1^(-1)$. (In ElGamal, this is true because the private key is just the discrete logarithm of the public key.) So, if Bob could dishonestly decrypt two of Alice's messages, he could compute the private key for the public key $r$. But $r$ is verifiably random, and it's very hard (we assume) for Bob to find a private key for a random public key.
https://github.com/WinstonMDP/math
https://raw.githubusercontent.com/WinstonMDP/math/main/knowledge/series.typ
typst
#import "../cfg.typ": * #show: cfg = Series A series $:=$ a sum of the series $:= sum_(k = 1)^oo a_k := lim_(n -> oo) sum_(k = 1)^n a_k$ The $n$-th partial sum of a series $:= sum_(k = 1)^n a_k$ $sum_(n = 1)^oo 1/n$ doesn't converge $sum_(n = 1)^oo 1/n^2$ converges A series $sum_(n = 1)^oo a_n$ converges absolutely $:= sum_(n = 1)^oo abs(a_n)$ converges $limsup_(n -> oo) root(n, abs(a_n)) < 1 -> sum_(n = 1)^oo a_n "converges absolutely"$ $1 < limsup_(n -> oo) root(n, abs(a_n)) -> sum_(n = 1)^oo a_n "diverges"$ $lim_(n -> oo) abs(a_(n + 1)/a_n) < 1 -> sum_(n = 1)^oo a_n "converges absolutely"$ $1 < lim_(n -> oo) abs(a_(n + 1)/a_n) ->sum_(n = 1)^oo a_n "diverges"$ $forall$ nonincreasing sequence $a: (all(n): 0 <= a_n) -> (sum_(n = 0)^oo 2^n a_(2^n) "converges" <-> sum_(n = 1)^oo a_n "converges")$ $e = sum_(n = 0)^oo 1/n!$. $sum_(i = 1)^n 1/i - ln n$ converges with $n -> oo$ $product_(n = 1)^oo cos x/2^n = (sin x)/x$ $all("absolutely convergent series" sum_(n = 1)^oo beta_n): a_n/a_(n + 1) = 1 + p/n + beta_n -> (sum_(n = 1)^oo a_n "converges absolutely" <-> p > 1)$
https://github.com/piepert/philodidaktik-hro-phf-ifp
https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/lernerfolgskontrollen/template.typ
typst
Other
#let project( topic: none, eh: false, stufe: 12, body ) = { set par(justify: false) grid( columns: (30%, 1fr, 30%), align(left)[ #set text(size: 0.75em) Philosophie: Erkenntnistheorie \ Klasse #stufe ], align(center + horizon, strong[ #if not eh {[Lernerfolgskontrolle]} else {[Erwartungshorizont]} -- #topic ]), align(right)[ #set text(size: 0.75em) [<NAME>] \ [Datum] ] ) v(1em) set par(justify: true) counter("lek-tasks").update(0) body } #let citation(content, source) = { block(inset: (left: 1.75em, rest: 1em), stroke: (1pt))[ #content #set text(size: 0.75em) #v(-0.5em) -- #source ] } #let task(points, content, number-format: n => numbering("1", n)) = { let c = counter("lek-tasks") c.step() grid(columns: (auto, 1fr, auto), column-gutter: 1em, strong[A#context number-format(c.at(here()).first())], content, [#points P.] ) }
https://github.com/brynne8/typst-undergradmath-zh
https://raw.githubusercontent.com/brynne8/typst-undergradmath-zh/main/undergradmath.typ
typst
Creative Commons Attribution Share Alike 4.0 International
// Meta data #set document(title: "Typst Math for Undergrads", author: "johanvx") // Margin #set page(margin: 0.5in) // Font size #let scriptsize = 7pt #let normalsize = 10pt #let large = 12pt #set text( size: normalsize, lang: "zh", font: ("Linux Libertine", "Noto Serif CJK SC") ) #show raw: set text( font: ("DejaVu Sans Mono", "Alibaba PuHuiTi 2.0") ) // Some horizontal spacing #let kern(length) = h(length, weak: true) #let enspace = kern(0.5em) // For table/grid, something like "lhs \enspace rhs" #let cell(lhs, rhs) = box(lhs + enspace + rhs) // Grid for code blocks #set grid(columns: (2em, auto)) // Table for math-code listing #set table(stroke: none, align: horizon + left, inset: 0pt, row-gutter: 0.45em) // LaTeX and TeX logos #let TeX = style(styles => { let e = measure(text(normalsize, "E"), styles) let T = "T" let E = text(normalsize, baseline: e.height / 2, "E") let X = "X" box(T + kern(-0.1667em) + E + kern(-0.125em) + X) }) #let LaTeX = style(styles => { let l = measure(text(10pt, "L"), styles) let a = measure(text(7pt, "A"), styles) let L = "L" let A = text(7pt, baseline: a.height - l.height, "A") box(L + kern(-0.36em) + A + kern(-0.15em) + TeX) }) // Update date #let date = datetime.today().display() // Unavailable (last check typst version) #show "??": box(text(red, [v#sys.version #emoji.crossmark])) // Tricky #show "!!": box(text(blue, emoji.drops)) // No idea #show "?!": box(text(orange, [No idea #emoji.face.unhappy])) // Tricky figure numbering #set figure(numbering: n => { ([??], [!!], [?!]).at(n - 1) }) // No prefix #set ref(supplement: "") // Justified paragraphs #set par(justify: true) // Two-column body #show: rest => columns(2, rest) // headcolor #let headcolor = rgb("004225") // Run-in sections, like LaTeX \paragraph #show heading.where( level: 1 ): it => text( size: normalsize, weight: "bold", fill: headcolor, font: ("Linux Libertine", "Alibaba PuHuiTi 2.0"), it.body + h(0.67em) ) // Title #align(center, link("https://github.com/johanvx/typst-undergradmath")[ #text(large, headcolor, font: ("Linux Libertine", "Alibaba PuHuiTi 2.0"))[*Typst 大学数学*] ]) // Put this here to avoid affecting the title #show link: underline 这是 Jim Hefferon 的《本科生 #LaTeX 数学》的 Typst 版本,适用的 typst 版本为 #sys.version。 原始版本可以在此链接中找到:#link("https://gitlab.com/jim.hefferon/undergradmath")。 = 记号的含义 #figure( table( columns: (1fr, 2fr), [??], [直到 typst #sys.version 无法实现此功能。], ) ) <unavailable> #figure( table( columns: (1fr, 2fr), [!!], [可以复杂实现,需要更简单的方法。], ) ) <tricky> // #figure( // table( // columns: (1fr, 2fr), // [?!], [不知道如何实现。], // ) // ) <noidea> = Rule One 任何数学内容,哪怕只有一个字符,都需要使用数学环境。 因此,对于「$x$ 的值为 $7$」,输入 `$x$ 的值为 $7$`。 = 模板 您的文档至少应包含以下内容。 #grid( "", ``` -- document body here -- ``` ) = 常见结构 #align(center, table( columns: 4, align: (right, left, right, left), column-gutter: (1em, 1.5em, 1em), [$x^2$], [`x^2`], [$sqrt(2)$, $root(n, 3)$], [`sqrt(2)`, `root(n, 3)`], [$x_(i, j)$], [`x_(i, j)`], [$2 / 3$, $2 \/ 3$], [`2 / 3`, `2 \/ 3` or `2 slash 3`], // Maybe use `slash`? )) = 书法字母 使用 `$cal(A)$`. $ cal(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) $ 手写字母 @unavailable. = 希腊字母 #align(center, table( columns: 4, align: (right, left, right, left), column-gutter: (1em, 1.5em, 1em), [$alpha$], [`alpha`], [$xi$, $Xi$], [`xi`, `Xi`], [$beta$], [`beta`], [$omicron$], [`omicron`], [$gamma$, $Gamma$], [`gamma`, `Gamma`], [$pi$, $Pi$], [`pi`, `Pi`], [$delta$, $Delta$], [`delta`, `Delta`], [$pi.alt$], [`pi.alt`], [$epsilon.alt$], [`epsilon.alt`], [$rho$], [`rho`], [$epsilon$], [`epsilon`], [$rho.alt$], [`rho.alt`], [$zeta$], [`zeta`], [$sigma$, $Sigma$], [`sigma`, `Sigma`], [$eta$], [`eta`], [$sigma.alt$], [`sigma.alt`], [$theta$, $Theta$], [`theta`, `Theta`], [$tau$], [`tau`], [$theta.alt$], [`theta.alt`], [$upsilon$, $Upsilon$], [`upsilon`, `Upsilon`], [$iota$], [`iota`], [$phi.alt$, $Phi$], [`phi.alt`, `Phi`], [$kappa$], [`kappa`], [$phi$], [`phi`], [$lambda$, $Lambda$], [`lambda`, `Lambda`], [$chi$], [`chi`], [$mu$], [`mu`], [$psi$, $Psi$], [`psi`, `Psi`], [$nu$], [`nu`], [$omega$, $Omega$], [`omega`, `Omega`], )) = 集合与逻辑 #align(center, table( columns: 6, align: (right, left, right, left, right, left), column-gutter: (1em, 1.5em, 1em, 1.5em, 1em), [$union$], [`union`], [$RR$], [`RR`, `bb(R)`], [$forall$], [`forall`], [$sect$], [`sect`], [$bb(Z)$], [`ZZ`, `bb(Z)`], [$exists$], [`exists`], [$subset$], [`subset`], [$bb(Q)$], [`QQ`, `bb(Q)`], [$not$], [`not`], [$subset.eq$], [`subset.eq`], [$bb(N)$], [`NN`, `bb(N)`], [$or$], [`or`], [$supset$], [`supset`], [$bb(C)$], [`CC`, `bb(C)`], [$and$], [`and`], [$supset.eq$], [`supset.eq`], [$diameter$], [`diameter`], [$tack.r$], [`tack.r`], [$in$], [`in`], [$nothing$], [`nothing`], [$models$], [`models`], [$in.not$], [`in.not`], [$alef$], [`alef`], [$without$], [`without`], )) 想要否定一个运算符,如 $subset.not$,要写成 `subset.not`。 集合的补集 $A^(sans(c))$ 写法是 `A^(sans(c))`($A^(complement)$ 的写法是 `A^(complement)`,而 $overline(A)$ 的写法是 `overline(A)`)。 // https://www.ctan.org/tex-archive/fonts/newcomputermodern // // README // // Version 3.93 // // Provides access to Russian and Greek guillemotleft and guillemotright // using the character variant tables cv3 and cv4 respectively. // // The Math fonts provide the character \varnothing, an alternative to \emptyset, // through Character Variant cv01. The fontsetup package provides the option // 'varnothing' to easily switch to the alternative character. // https://mirrors.sustech.edu.cn/CTAN/fonts/newcomputermodern/doc/newcm-doc.pdf // The NewComputerModern FontFamily §13.3 // The Math fonts provide the character \varnothing (⌀, U+2300), as an alternative to \emptyset (a slashed zero), through Character Variant cv01. // The fontsetup package provides the option ‘varnothing’ to easily switch to the alternative character. / 备注: 在使用 `diameter` 代表 `\varnothing` 可能会导致一些困惑。然而,#LaTeX 也使用 $diameter$(`\u{2300}`)而不是 $\u{2205}$(`\u{2205}`),详见#link("https://mirrors.sustech.edu.cn/CTAN/fonts/newcomputermodern/doc/newcm-doc.pdf")[newcm $section$13.3]。 另一种解决方案是使用 `text(font: "Fira Sans", nothing)`,但是得到的字形 $text(font: "Fira Sans", nothing)$ 与广泛使用的字形略有不同。 最终,选择始终是#strong[您的决定]。 = 装饰符号 #align(center, table( columns: 6, align: (right, left, right, left, right, left), column-gutter: (1em, 1.5em, 1em, 1.5em, 1em), [$f'$], [`f'`, `f prime`], [$dot(a)$], [`dot(a)`], [$tilde(a)$], [`tilde(a)`], [$f prime.double$], [`f prime.double`], [$diaer(a)$], [`diaer(a)`], [$macron(a)$], [`macron(a)`], [$Sigma^*$], [`Sigma^*`], [$hat(a)$], [`hat(a)`], [$arrow(a)$], [`arrow(a)`], )) 如果修饰的字母是 $i$ 或 $j$,那么某些修饰需要使用 `dotless.i` 和 `dotless.j`,例如 $arrow(dotless.i)$,可以使用 `arrow(dotless.i)`。 一些作者在表示向量时使用粗体:`bold(x)`。 输入 `overline(x + y)` 会生成 $overline(x + y)$,而 `hat(x + y)` 会给出 $hat(x + y)$。 可以在表达式中添加注释,例如在这里(还有`overbrace(..)`)。 #align(center, table( columns: 2, column-gutter: 1em, [$ underbrace(x + y, |A|) $], [ ``` underbrace(x + y, |A|) ``` ], )) = 点号 在列表中使用低点号表示为 ${0, 1, 2, ...}$,输入为 `{0, 1, 2, ...}`。 在求和或乘积中使用居中点号表示为 $1 + dots.h.c + 100$,输入为 `1 + dots.h.c + 100`。 您还可以使用垂直点号 `dots.v`,对角线点号 `dots.down` 和反对角线点号 `dots.up`。 = 函数名称 直接输入! #align(center, table( columns: 6, align: (right, left, right, left, right, left), column-gutter: (1em, 1.5em, 1em, 1.5em, 1em), [$sin$], [`sin`], [$sinh$], [`sinh`], [$arcsin$], [`arcsin`], [$cos$], [`cos`], [$cosh$], [`cosh`], [$arccos$], [`arccos`], [$tan$], [`tan`], [$tanh$], [`tanh`], [$arctan$], [`arctan`], [$sec$], [`sec`], [$coth$], [`coth`], [$min$], [`min`], [$csc$], [`csc`], [$det$], [`det`], [$max$], [`max`], [$cot$], [`cot`], [$dim$], [`dim`], [$inf$], [`inf`], [$exp$], [`exp`], [$ker$], [`ker`], [$sup$], [`sup`], [$log$], [`log`], [$deg$], [`deg`], [$liminf$], [`liminf`], [$ln$], [`ln`], [$arg$], [`arg`], [$limsup$], [`limsup`], [$lg$], [`lg`], [$gcd$], [`gcd`], [$lim$], [`lim`], )) #let cosec = math.op("cosec") 如果您想要使用的函数名不存在,您可以使用 `math.op` 来定义。例如,定义 $cosec$ 函数: ``` #let cosec = math.op("cosec") $ cosec x = 1/(sin x) $ ``` $ cosec x = 1/(sin x) $ = 其他符号 #align(center, table( columns: 6, align: (right, left, right, left, right, left), column-gutter: (0.5em, 1em, 0.5em, 1em, 0.5em), [$<$], [`<`, `lt`], [$angle$], [`angle`], [$dot$], [`dot`], [$<=$], [`<=`, `lt.eq`], [$angle.arc$], [`angle.arc`], [$plus.minus$], [`plus.minus`], [$>$], [`>`, `gt`], [$ell$], [`ell`], [$minus.plus$], [`minus.plus`], [$>=$], [`>=`, `gt.eq`], [$parallel$], [`parallel`], [$times$], [`times`], [$!=$], [`!=`, `eq.not`], [$45 degree$], [`45 degree`], [$div$], [`div`], [$<<$], [`<<`, `lt.double`], [$tilde.equiv$], [`tilde.equiv`], [$*$], [`*`, `ast`], [$>>$], [`>>`, `gt.double`], [$tilde.nequiv$], [`tilde.nequiv`], [$divides$], [`divides`], [$approx$], [`approx`], [$tilde$], [`tilde`], [$divides.not$], [`divides.not`], [$\u{224D}$], [`\u{224D}` @tricky], [$tilde.eq$], [`tilde.eq`], [$n!$], [`n!`], [$equiv$], [`equiv`], [$tilde.not$], [`tilde.not`], [$diff$], [`diff`], [$prec$], [`prec`], [$plus.circle$], [`plus.circle`], [$nabla$], [`nabla`], [$prec.eq$], [`prec.eq`], [$minus.circle$], [`minus.cirle`], [$planck.reduce$], [`planck.reduce`], [$succ$], [`succ`], [$dot.circle$], [`dot.circle`], [$compose$], [`compose`], [$succ.eq$], [`succ.eq`], [$times.circle$], [`times.circle`], [$star$], [`star`], [$prop$], [`prop`], [$\u{2298}$], [`\u{2298}` @tricky], [$sqrt("")$], [`sqrt("")`], [$\u{2250}$], [`\u{2250}` @tricky], [$harpoon.tr$], [`harpoon.tr`], [$checkmark$], [`checkmark`], )) 使用 `a divides b` 表示整除,$a divides b$,使用 `a divides.not b` 表示不能整除,$a divides.not b$。 使用 `|` 来表示集合构建符号,${a in S | a "is odd"}$ 可以表示为 `{a in S | a "is odd"}`。 = 箭头 #align(center, table( columns: 4, align: (right, left, right, left), column-gutter: (1em, 1.5em, 1em), [$->$], [`->`, `arrow.r`], [$|->$], [`|->`, `arrow.r.bar`], [$arrow.r.not$], [`arrow.r.not`], [$arrow.r.long.bar$], [`arrow.r.long.bar`], [$-->$], [`-->`, `arrow.r.long`], [$<-$], [`<-`, `arrow.l`], [$=>$], [`=>`, `arrow.r.double`], [$<->$], [`<->`, `arrow.l.r`], [$arrow.r.double.not$], [`arrow.r.double.not`], [$arrow.b$], [`arrow.b`], [$==>$], [`==>`, `arrow.r.double.long`], [$arrow.t$], [`arrow.t`], [$arrow.squiggly$], [`arrow.squiggly`], [$arrow.t.b$], [`arrow.t.b`], )) 第一列中的右箭头有相应的左箭头,例如 `arrow.l.not`,还有一些其他匹配的向下箭头等。 = 可变大小的运算符 求和符号 $sum_(j = 0)^3 j^2$ `sum_(j = 0)^3 j^2` 和积分符号 $integral_(x = 0)^3 x^2 dif x$ `integral_(x = 0)^3 x^2 dif x` 在行间模式会展开。 $ sum_(j = 0)^3 j^2 wide integral_(x = 0)^3 x^2 dif x $ 下面这些同理。 #align(center, table( columns: 4, align: (right, left, right, left), column-gutter: (1em, 1.5em, 1em), row-gutter: 0.5em, [$integral$], [`integral`], [$integral.double$], [`integral.double`], [$integral.triple$], [`integral.triple`], [$integral.cont$], [`integral.cont`], [$union.big$], [`union.big`], [$sect.big$], [`sect.big`], )) = 括号 #align(center, table( columns: 6, align: (right, left, right, left, right, left), column-gutter: (1em, 1.5em, 1em, 1.5em, 1em), row-gutter: 0.5em, [$()$], [`()`], [$angle.l angle.r$], [`angle.l angle.r`], [$abs("")$], [`abs("")`], [$[]$], [`[]`], [$floor("")$], [`floor("")`], [$norm("")$], [`norm("")`], [${}$], [`{}`], [$ceil("")$], [`ceil("")`], )) 使用 `lr` 函数来固定大小。 #align(center, table( columns: 2, column-gutter: 1em, [$ lr([sum_(k = 0)^n e^(k^2)], size: #50%) $], [ ``` lr([sum_(k = 0)^n e^(k^2)], size: #50%) ``` ], )) 为使它们与括号中的公式一起增长,也可以使用 `lr` 函数。 #align(center, table( columns: 2, column-gutter: 1em, [$ lr(angle.l i, 2^(2^i) angle.r) $], [ ``` lr(angle.l i, 2^(2^i) angle.r) ``` ], )) 如果直接输入为代码点,则括号默认会按比例缩放,而如果以符号表示法输入,则括号不会自动缩放。 #align(center, table( columns: 2, align: (right + horizon, left + horizon), column-gutter: 1em, [$ (1 / n^(alpha)) $], [ ``` (1 / n^(alpha)) ``` ], [$ paren.l 1 / n^(alpha) paren.r $], [ ``` paren.l 1 / n^(alpha) paren.r ``` ], )) `lr` 函数还允许对不匹配的定界符和单侧括号进行缩放。 #align(center, table( columns: 2, column-gutter: 1em, [$ lr(frac(dif f, dif x) |)_(x_0) $], [ ``` lr(frac(dif f, dif x) |)_(x_0) ``` ], )) = 数组、矩阵 使用 `mat` 函数可以创建一个矩阵。可以将一个数组传递给它。 #align(center, table( columns: 2, column-gutter: 1em, [$ mat(a, b; c, d) $], [ ``` $ mat(a, b; c, d) $ ``` ], )) 在 Typst 中,#link("https://typst.app/docs/reference/typst/array")[array] 是一组数值,而在 #LaTeX 中,array 是没有括号的矩阵,相当于在 Typst 中使用 `$mat(delim: #none, ..)$`。 对于行列式,可以使用 `|A|`,文本运算符 $det$ `det` 或者 `mat(delim: "|", ..)`。 使用 `cases` 函数可以轻松定义分段函数。 #align(center, table( columns: 2, column-gutter: 1em, [ $ f_n = cases( a &"if" n = 0, r dot f_(n - 1) &"else" ) $ ], [ ``` $ f_n = cases( a &"if" n = 0, r dot f_(n - 1) &"else" ) $ ``` ] )) = 数学中的间距 将 $sqrt(2) x$ 改进为带有细小间距的 $sqrt(2) thin x$,要写成 `sqrt(2) thin x`。 稍宽一些的间距是 `medium` 和 `thick`(它们的比例是 $3 : 4 : 5$)。 更大的间距是 `quad` 和 `wide`,效果分别是 $-> quad <-$ 和 $-> wide <-$,在行间公式的不同部分之间非常有用。 使用 `h` 函数可以获取任意间距。 例如,使用 `#h(-0.1667em)` 可以得到 #LaTeX 中的 `\!`。 = 行间公式 将行间公式以块级形式使用 `$ ... $`,其中数学内容和 `$` 之间至少有一个空格分隔。 #align(center, table( columns: 2, column-gutter: 1em, [$ S = k dot lg W $], [ ``` $ S = k dot lg W $ ``` ], )) 你可以写成多行。 #align(center, table( columns: 2, column-gutter: 1em, [ $ sin(x) = x - x^3 / 3! \ + x^5 / 5! - dots.h.c $ ], [ ``` $ sin(x) = x - x^3 / 3! \ + x^5 / 5! - dots.h.c $ ``` ], )) 用 `&` 来对齐公式 #align(center, table( columns: 2, column-gutter: 1em, [ $ nabla dot bold(D) &= rho \ nabla dot bold(B) &= 0 $ ], ``` $ nabla dot bold(D) &= rho \ nabla dot bold(B) &= 0 $ ```, )) (对齐的左侧或右侧可以为空)。 通过 `#set math.equation(numbering: ..)` 给公式加编号。 = 微积分例子 最后三个是行间公式形式。 #align(center, table( columns: 2, column-gutter: 1em, [$ f: RR -> RR $], [ ``` f: RR -> RR ``` ], [$ "9.8" "m/s"^2 $], [`"9.8" "m/s"^2` @tricky], [$ lim_(h->0) (f(x+h)-f(x))/h $], [ ``` lim_(h -> 0) (f(x + h) - f(x)) / h ``` ], [$ integral x^2 dif x = x^3 \/ 3 + C $], [ ``` integral x^2 dif x = x^3 \/ 3 + C ``` ], [$ nabla = bold(i) dif / (dif x) + bold(j) dif / (dif y) + bold(k) dif / (dif z) $], [ ``` nabla = bold(i) dif / (dif x) + bold(j) dif / (dif y) + bold(k) dif / (dif z) ``` ], )) = 离散数学例子 对于模运算,可以使用 `equiv` 来输入 $equiv$,用 `mod` 来输入文本运算符 $mod$。 对于组合,可以使用 `binom(n, k)` 中的二项式符号 $binom(n, k)$。在行间模式下会自动调整大小。 对于排列,可以使用 `n^(underline(r))` 来输入 $n^(underline(r))$ 符号(有些作者用 $P(n, r)$ 或 $""_n P_r$ 来表示,可以使用 `""_n P_r`)。 = 统计学例子 #align(center, table( columns: 2, column-gutter: 1em, [$ sigma^2 = sqrt(sum(x_i - mu)^2 \/ N) $], [ ``` sigma^2 = sqrt(sum(x_i - mu)^2 \/ N) ``` ], [$ E(X) = mu_X = sum(x_i - P(x_i)) $], [ ``` E(X) = mu_X = sum(x_i - P(x_i)) ``` ], [$ 1 / sqrt(2 sigma^2 pi) e^(- (x - mu)^2 / (2 sigma^2)) $], [ ``` 1 / sqrt(2 sigma^2 pi) e^(- (x - mu)^2 / (2 sigma^2)) ``` ] )) = 更多 参见 Typst 文档:#link("https://typst.app/docs"). #v(1fr) #block( inset: 4pt, stroke: (top: headcolor), text(headcolor)[johanvx (https://github.com/johanvx) #h(1fr) #date] )
https://github.com/jerrita/CQUPTypst
https://raw.githubusercontent.com/jerrita/CQUPTypst/master/chapters/main.typ
typst
#let chapter_main = [ = 引言 绪论(也称引言)简要说明研究工作的目的、范围、相关领域国内外研究现状、研究目标、研究设想和内容、研究和实验方法、预期结果和意义,以及论文的章节安排等。力求言简意赅,不要与摘要雷同,也不要叙述教科书中的知识。 == 研究背景和意义 学位论文是学生从事科研工作的成果的主要表现,它集中表明了作者在研究工作中获得的新的发明、理论或见解,是申请学位的重要依据,也是科研领域中的重要文献资料和社会的宝贵财富。学位论文应能表明作者已在本门学科上掌握了坚实的基础理论和系统的专业知识,并对所研究课题有新的见解,有从事科学研究工作或独立担负专门技术工作的能力[1]。 本模板主要参照《学位论文编写规则》(GB/T7713.1-2006,中国国家标准局2006年发布并实施)[1]、科学出版社出版的《作者编辑手册》[2]、全国科学道德和学风建设宣传教育领导小组制定的《科学道德与学风建设宣讲参考大纲(试用本)》(2011年11月)[3]、《文后参考文献著录规则》(GB/T7714-2005,中国国家标准局2005年发布并实施)[4]等制定。 部分范例来自《障碍环境中Swarm突现计算模型研究及行为控制》[5]等重庆邮电大学硕士学位论文。 == 国内外研究现状 === 国外研究现状 ==== 分类号 分类号指中图分类号,是指采用《中国图书馆分类法》(原称《中国图书馆图书分类法》,简称《中图法》)对科技文献进行主题分析,并依照文献内容的学科属性和特征,分门别类地组织文献,所获取的分类代号。采用1999年出版的第四版《中图法》可以在http://www.33tt.com/tools/ztf(中国图书馆分类法中图分类号查询系统)或http://lib.jzit.edu.cn/sjk/tsflf/index.htm(中图法第四版计算机辅助分类查询系统)中查询。填写要求:要求分类细分到22个大类代码后三位数字。如:TN929。 ==== UDC编号 UDC即国际十进分类法(Universal Decimal Classification),是国际通用的多文种综合性文献分类法。UDC采用单纯阿拉伯数字作为标记符号。它用个位数(0~9)标记一级类,十位数(00~99)标记二级类,百位数(000~999)标记三级类,以下每扩展(细分)一级,就加一位数。每三位数字后加一小数点。如电气工程类的论文,其UDC编号为:621.3。 === 国内研究现状 论文中文题名是以最恰当、最简明的词语,反映学位论文最重要的特定内容的逻辑组合。题名用词应有助于选关键词和编制题录、索引等二次文献,可以提供检索的特定实用信息。题名应恰当简洁,一般不超过25个字。题名应避免使用不常见的缩写词、首字缩写字、字符、代号及公式等。题名语意未尽时,可以用副标题补充说明论文中的特定内容[1]。题名中文宋体,英文Times New Roman小二号字。 #pagebreak() = 论文结构及文字格式 学士学位论文应能表明作者确已较好地掌握了本门学科的基础理论、专门知识和基本技能,并从事科学研究工作或独立担负专门技术工作的初步能力。论文的文字表述应实事求是、客观真切、合乎逻辑、层次分明、简练可读。凡引用他人观点、方案、资料、数据、图表等,无论是纸质或电子版,均应详加注释。论文结构和文字格式应规范。 ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/src/elements/alu.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.2": draw #import "element.typ" #import "ports.typ": add-port #let draw-shape(id, tl, tr, br, bl, fill, stroke) = { let p0 = tl let p1 = (tr, 10%, br) let p2 = (tr, 90%, br) let p3 = bl let p4 = (tl, 55%, bl) let p5 = (tl, 50%, br) let p6 = (tl, 45%, bl) let f1 = draw.group(name: id, { draw.merge-path( inset: 0.5em, fill: fill, stroke: stroke, close: true, draw.line(p0, p1, p2, p3, p4, p5, p6) ) draw.anchor("north", (p0, 50%, p1)) draw.anchor("south", (p2, 50%, p3)) draw.anchor("west", (p0, 50%, p3)) draw.anchor("east", (p1, 50%, p2)) draw.anchor("north-west", p0) draw.anchor("north-east", p1) draw.anchor("south-east", p2) draw.anchor("south-west", p3) draw.anchor("name", (p5, 50%, (p1, 50%, p2))) }) let f2 = add-port(id, "west", (id: "in1"), (p0, 50%, p6)) let f3 = add-port(id, "west", (id: "in2"), (p3, 50%, p4)) let f4 = add-port(id, "east", (id: "out"), (p1, 50%, p2)) let f = { f1; f2; f3; f4 } return (f, tl, tr, br, bl) } /// Draws an ALU with two inputs /// /// #examples.alu /// For parameters description, see #doc-ref("element.elmt") #let alu( x: none, y: none, w: none, h: none, name: none, name-anchor: "center", fill: none, stroke: black + 1pt, id: "", debug: ( ports: false ) ) = { let ports = ( west: ( (id: "in1"), (id: "in2"), ), east: ( (id: "out"), ) ) element.elmt( draw-shape: draw-shape, x: x, y: y, w: w, h: h, name: name, name-anchor: name-anchor, ports: ports, fill: fill, stroke: stroke, id: id, auto-ports: false, ports-y: ( in1: (h) => {h * 0.225}, in2: (h) => {h * 0.775}, out: (h) => {h * 0.5} ), debug: debug ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/indenta/0.0.1/README.md
markdown
Apache License 2.0
# Indenta An attempt to fix the indentation of the first paragraph in typst. It works. ## Usage ```typst #set par(first-line-indent: 2em) #import "@preview/indenta:0.0.1": fix-indent #show: fix-indent() ``` ## Demo ![image](https://github.com/flaribbit/indenta/assets/24885181/874df696-3277-4103-9166-a24639b0c7c6)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-FE20.typ
typst
Apache License 2.0
#let data = ( ("COMBINING LIGATURE LEFT HALF", "Mn", 230), ("COMBINING LIGATURE RIGHT HALF", "Mn", 230), ("COMBINING DOUBLE TILDE LEFT HALF", "Mn", 230), ("COMBINING DOUBLE TILDE RIGHT HALF", "Mn", 230), ("COMBINING MACRON LEFT HALF", "Mn", 230), ("COMBINING MACRON RIGHT HALF", "Mn", 230), ("COMBINING CONJOINING MACRON", "Mn", 230), ("COMBINING LIGATURE LEFT HALF BELOW", "Mn", 220), ("COMBINING LIGATURE RIGHT HALF BELOW", "Mn", 220), ("COMBINING TILDE LEFT HALF BELOW", "Mn", 220), ("COMBINING TILDE RIGHT HALF BELOW", "Mn", 220), ("COMBINING MACRON LEFT HALF BELOW", "Mn", 220), ("COMBINING MACRON RIGHT HALF BELOW", "Mn", 220), ("COMBINING CONJOINING MACRON BELOW", "Mn", 220), ("COMBINING CYRILLIC TITLO LEFT HALF", "Mn", 230), ("COMBINING CYRILLIC TITLO RIGHT HALF", "Mn", 230), )
https://github.com/Dherse/masterproef
https://raw.githubusercontent.com/Dherse/masterproef/main/masterproef/parts/7_conclusion.typ
typst
#import "../ugent-template.typ": * = Conclusion In this thesis, a new approach for the description and subsequent programming of photonic processors combined an easy-to-use programming language with powerful new features, such as constraints, reconfigurability through branching, and tunability. Together, these features create a modern, flexible, and novel hardware description language that is able to describe a wide range of photonic circuits and can be used for both the development of circuits for photonic processors, as well as the development of standalone photonic circuits. This design was created after a thorough analysis of existing programming languages and paradigms was performed, shedding light on each language's strengths, weaknesses, and applicability. The analysis showed that modern languages with fully-featured first-party ecosystems are good candidates for developing a new language and implementing libraries but that a new hardware description language was needed overall. This new language, called @phos, results from months of research and development and is the first hardware description language to combine aspects of modern programming languages with unique features designed specifically for photonic circuits. Through the analysis of relevant, real-world examples, this thesis has shown that @phos is a powerful language that is appropriate and useful for the development of photonic circuits. The examples have shown that @phos is able to concisely describe complex circuits, their constraints, and functionality while still being easy to read and understand. Additionally, it was demonstrated that the constraint solver used for simulations is, despite its early stage, already usable to create meaningful results and that the simulation of photonic circuits can be done quickly and efficiently. @phos has also been designed so that it can be created by a relatively small team, by reusing existing algorithms and libraries available in both the _Rust_ and _Python_ ecosystems. This makes @phos an ideal candidate for future development of photonic circuit programming, as it is easy to expand, modify, and maintain. Finally, the design of the @phos language has shed light on new areas of research into which photonic circuit programming can be expanded, including the development of a new, more powerful constraint solver, the use of state-of-the-art type systems for improved correctness, and the ability to use the language for the development of non-traditional computing such as analog computing.
https://github.com/0x1B05/nju_os
https://raw.githubusercontent.com/0x1B05/nju_os/main/lecture_notes/content/28_FAT和UNIX文件系统.typ
typst
#import "../template.typ": * #pagebreak() = FAT 和 UNIX 文件系统 == 磁盘上的数据结构 === 文件系统实现 文件的实现 - 文件 = “虚拟” 磁盘 - API: `read`, `write`, `ftruncate`, ... 目录的实现 - 目录 = 文件/目录的集合 - API: `mkdir`, `rmdir`, `readdir`, `link`, `unlink`, ... 思考题:`mount` 如何实现? 最好由操作系统统一管理 (而不是由具体的文件系统实现) === 如果是《数据结构》课? 我们可以借助 RAM (Random Access Memory) 自由布局目录和文件 - FileSystem 就是一个 Abstract DataType (ADT) - Memory Hierarchy 在苦苦支撑 “random access” 的假象 ```cpp class FSObject { }; class File: FSObject { std::vector<char> content; }; class Directory: FSObject { std::map<std::string,FSObject*> children; }; ``` > 实现上面的 API 完全就是个课后习题 === 回到《操作系统》课 我们没有 Random Access Memory - 我们只有 block device - 两个 API ```c bread(int bid, struct block *b); bwrite(int bid, struct block *b); ``` 实现: - `read`, `write`, `ftruncate`, ... - `mkdir`, `rmdir`, `readdir`, `link`, `unlink`, ... - 如果用 block device 模拟 RAM,就会出现严重的读/写放大 - 我们需要更适合磁盘的数据结构 === 我们的敌人和朋友 敌人:读/写放大 - 被迫读写连续的一块数据 朋友:局部性 + 缓存 - 适当地排布数据,使得临近的数据有 “一同访问” 的倾向 - 数据暂时停留在内存,延迟写回 == File Allocation Table (FAT) === 让时间回到 1980 年 5.25" 软盘:单面 180 KiB - 360 个 512B 扇区 (sectors) - 在这样的设备上实现文件系统,应该选用怎样的数据结构? === 需求分析 相当小的文件系统 - 目录中一般只有几个、十几个文件 - 文件以小文件为主 (几个 block 以内) 文件的实现方式 - `struct block *` 的链表 - 任何复杂的高级数据结构都显得浪费 目录的实现方式 - 目录就是一个普通的文件 (虚拟磁盘;“目录文件”) - 操作系统会对文件的内容作为目录的解读 - 文件内容就是一个 `struct dentry[];` === 用链表存储数据:两种设计 1. 在每个数据块后放置指针 - 优点:实现简单、无须单独开辟存储空间 - 缺点:数据的大小不是$2^k$ ; 单纯的 `lseek` 需要读整块数据 2. 将指针集中存放在文件系统的某个区域 - 优点:局部性好;`lseek` 更快 - 缺点:集中存放的数据损坏将导致数据丢失 哪种方式的缺陷是致命、难以解决的? ==== 集中保存所有指针 集中存储的指针容易损坏?存 n 份就行! FAT-12/16/32 (FAT entry,即 “next 指针” 的大小) #image("images/2024-02-27-12-01-54.png") === “File Allocation Table” 文件系统 #link("https://jyywiki.cn/pages/OS/manuals/MSFAT-spec.pdf")[ RTFM ] 得到必要的细节 - 诸如 tutorial、博客都不可靠 - 还会丢失很多重要的细节 ```c if (CountofClusters < 4085) { // Volume is FAT12 (2 MiB for 512B cluster) } else if (CountofCluster < 65525) { // Volume is FAT16 (32 MiB for 512B cluster) } else { // Volume is FAT32 } ``` === FAT: 链接存储的文件 “FAT” 的 “next” 数组 0: free; 2...MAX: allocated; ffffff7: bad cluster; ffffff8-ffffffe, -1: end-of-file #image("images/2024-02-27-12-03-00.png") === 目录树实现:目录文件 以普通文件的方式存储 “目录” 这个数据结构 - FAT: 目录 = 32-byte 定长目录项的集合 - 操作系统在解析时把标记为目录的目录项 “当做” 目录即可 - 可以用连续的若干个目录项存储 “长文件名” - 思考题:为什么不把元数据 (大小、文件名、……) 保存在 `vector<struct block *> file` 的头部? #image("images/2024-02-27-12-03-24.png") === Talk is Cheap, Show Me the Code! 首先,观察 “快速格式化” (mkfs.fat) 是如何工作的 - 老朋友:strace 然后,把整个磁盘镜像 `mmap` 进内存 - 照抄手册,遍历目录树 (fat-tree demo),试试镜像 另一个有趣的问题:文件系统恢复 - 快速格式化 = FAT 表丢失 - 所有的文件内容 (包括目录文件) 都还在 - 只是在数据结构眼里看起来都是 “free block” - 首先需要猜出文件系统的参数 (`SecPerClus`, `BytsPerSec`, `FATSz32`, `BPB_RootClus`, ...) - 本质上是 cluster 的分类和建立 “可能后继关系” === FAT: 性能与可靠性 性能 - + 小文件简直太合适了 - - 但大文件的随机访问就不行了 - 4 GB 的文件跳到末尾 (4 KB cluster) 有 2^20 次链表 next 操作 - 缓存能部分解决这个问题 - 在 FAT 时代,磁盘连续访问性能更佳 - 使用时间久的磁盘会产生碎片 (fragmentation) - `malloc` 也会产生碎片,不过对性能影响不太大 可靠性 - 维护若干个 FAT 的副本防止元数据损坏 (额外的开销) - 损坏的 cluster 在 FAT 中标记 == ext2/UNIX 文件系统 === 更好的文件系统:需要做到什么? 不能 “尽善尽美”,但可以在 “实际 workload” 下尽可能好 | Summary | Findings | | ------------------------------------ | ------------------------------------------------- | | Most files are small | Roughly 2K is the most common size | | Average file size is growing | Almost 200K is the average | | Most bytes are stored in large files | A few big files use most of the space | | File systems contains lots of files | Almost 100K on average | | File systems are roughly half full | Even as disks grow, file systems remain ~50% full | | Directories are typically small | Many have few entries; most have 20 or fewer | === ext2/UNIX 文件系统 按对象方式集中存储文件/目录元数据 - 增强局部性 (更易于缓存) - 支持链接 为大小文件区分 fast/slow path - 小的时候应该用数组 - 连链表遍历都省了 - 大的时候应该用树 (B-Tree; Radix-Tree; ...) - 快速的随机访问 === ext2: 磁盘镜像格式 对磁盘进行分组 #image("images/2024-02-27-12-07-12.png") “superblock”:文件系统元数据 - 文件 (inode) 数量 - block group 信息 - #link("https://jyywiki.cn/pages/OS/2023/p/ext2.h")[ ext2.h ] 里有你需要知道的一切 === ext2 inode #image("images/2024-02-27-12-07-21.png") === ext2 目录文件 与 FAT 本质相同:在文件上建立目录的数据结构 - 注意到 inode 统一存储 - 目录文件中存储文件名到 inode 编号的 key-value mapping #image("images/2024-02-27-12-07-38.png") === ext2: 性能与可靠性 局部性与缓存 - bitmap, inode 都有 “集中存储” 的局部性 - 通过内存缓存减少读/写放大 大文件的随机读写性能提升明显 (O(1)) - 支持链接 (一定程度减少空间浪费) - inode 在磁盘上连续存储,便于缓存/预取 - 依然有碎片的问题 但可靠性依然是个很大的问题 - 存储 inode 的数据块损坏是很严重的
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/equate/0.1.0/README.md
markdown
Apache License 2.0
# equate A package for improved layout of equations and mathematical expressions. When applied, this package will split up multi-line block equations into multiple elements, so that each line can be assigned a separate number. By default, the equation counter is incremented for each line, but this behavior can be changed by setting the `sub-numbering` argument to `true`. In this case, the equation counter will only be incremented once for the entire block, and each line will be assigned a sub-number like `1a`, `2.1`, or similar, depending on the set equation numbering. You can also set the `number-mode` argument to `"label"` to only number labelled lines. If the label is applied to the full equation, all lines will be numbered. This splitting also makes it possible to spread equations over page boundaries while keeping alignment in place, which can be useful for long derivations or proofs. Additionally, the alignment of the equation number is improved, so that it always matches the baseline of the equation. If you want to create a "standard" equation with a single equation number centered across all lines, you can attach the `<equate:revoke>` label to the equation. This will disable the effect of this package for the current equation. ## Usage The package comes with a single `equate` function that is supposed to be used as a template. It takes two optional arguments for customization: | Argument | Type | Description | Default | | --------------- | ------------------- | ---------------------------------------------------------- | -------- | | `sub-numbering` | `boolean` | Whether to assign sub-numbers to each line of an equation. | `false` | | `number-mode` | `"line"`, `"label"` | Whether to number all lines or only those with a label. | `"line"` | To reference a specific line of an equation, include the label at the end of the line, like in the following example: ```typ #import "@preview/equate:0.1.0": equate #show: equate.with(sub-numbering: true) #set math.equation(numbering: "(1.1)") The dot product of two vectors $arrow(a)$ and $arrow(b)$ can be calculated as shown in @dot-product. $ angle.l a, b angle.r &= arrow(a) dot arrow(b) \ &= a_1 b_1 + a_2 b_2 + ... a_n b_n \ &= sum_(i=1)^n a_i b_i. #<sum> $ <dot-product> The sum notation in @sum is a useful way to express the dot product of two vectors. ``` ![Result of example code (page 1).](assets/example-1.svg) ![Result of example code (page 2).](assets/example-2.svg)
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/03-unicode/store/utf16.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note #import "/template/lang.typ": thai #import "/lib/glossary.typ": tr #show: web-page-template // ### UTF-16 === UTF-16 // UTF-32 is a very simple and transparent encoding - four bytes is one character, always, and one character is always four bytes - so it's often used as a way of processing Unicode data inside of a program. Data is read in, in whatever character encoding it happens to be, and is silently converted to UTF-32 so that it can be processed efficiently. The program does what it needs to do with it, and then re-encodes it when it's time to write the data out again. Many programming languages already allow you to read and write numbers that are four bytes long, so representing Unicode code points as numbers isn't a problem. (A "wide character", in languages such as C or Python, is a 32-bit wide data type, ideal for processing UTF-32 data.) But UTF-32 is not very efficient. The first byte is always going to be zero, and the top seven bits of the second byte are always going to be zero too. So UTF-32 is not often used as an on-disk storage format: we don't like the idea of spending nearly 50% of our disk space on bytes that are guaranteed to be empty. UTF-32是一种非常简明的#tr[encoding],它永远用四个字节描述一个#tr[character]。这一特点让它经常用于程序的内部流程。一个程序的输入可能使用各种#tr[encoding],但在处理前将其转换为UTF-32可以使后续流程更加方便高效。在完成处理后,再根据需求将结果转换成需要的#tr[encoding]输出。许多编程语言都允许直接读写内存中的四字节数字,所以直接将Unicode#tr[codepoint]作为#tr[encoding]并没有什么问题。(在C和Python等语言中,这种处理Unicode的32比特类型也被称作宽字符。)但是UTF-32在空间上并不高效,因为第一个字节永远是0,而且第二个字节的前7个比特也永远是0。所以UTF-32不太会作为磁盘存储格式,毕竟我们不希望为了存这些0而浪费近50%的空间。 // So can we find a compromise where we use fewer bytes but still represent the majority of characters we're likely to use, in a relatively straightforward way? UTF-16 uses a group of 16 bits (2 bytes) instead of 32, on the basis that the first two bytes of UTF-32 are almost always unused. UTF-16 simply drops those upper two bytes, and instead uses two bytes to represent the Unicode characters from 0 to 65535, the characters within the Basic Multilingual Plane. This worked fine for the majority of characters that people were likely to use. (At least, before emoji inflicted themselves upon the world.) If you want to encode the Thai letter *to pa-tak* (ฏ) which lives at code point 3599 in the Unicode standard, we write 3599 in binary: `0000111000001111` and get two bytes `0E 0F`, and that's the UTF-16 encoding. 我们能找到一种使用更少的字节,但依旧能表达需要使用的大多数#tr[character],而且规则相对简单的#tr[encoding]吗?UTF-16可能是一个选择。基于UTF-32的前两个字节基本全是0这一情况,UTF-16选择只使用16个比特(2个字节)为一组。UTF-16基本上就是抛弃了前两个字节,用剩下的两个来表示Unicode里0到65535这一范围——也就是前文说的#tr[BMP]——中的#tr[character]。这对于大多数人日常使用的#tr[character]来说已经足够了。(至少在emoji入侵这个世界之前是够的。)使用这一方式,如果我们希望#tr[encoding]泰文字母 `to pa-tak`(#thai[\u{0E0F}]),因为它在Unicode标准中的#tr[codepoint]是3599,我们只需要将3599转换成二进制得到`0000111000001111`,再将它写成`0E 0F`两个字节,这就是UTF-16的#tr[encoding]结果了。 #note[ // > From now on, we'll represent Unicode codepoints in the standard way: the prefix `U+` to signify a Unicode codepoint, and then the codepoint in hexadecimal. So *to pa-tak* is U+0E0F. 从现在开始,我们会使用一种标准格式来表示Unicode#tr[codepoint]:前缀 `U+` 表示这是一个Unicode#tr[codepoint],其后写上#tr[codepoint]数字的十六进制形式。比如`to pa-tak`写作 `U+0E0F`。 ] // But what if, as in the case of FATHER CHRISTMAS, we want to access code points above 65535? Converting it into binary gives us a number which is three bytes long, and we want to represent all our characters within two bytes. 但如果我们需要表示码位超过65535的#tr[character],比如之前的圣诞老人emoji,该怎么办呢?将它的#tr[codepoint]转换成二进制之后需要三个字节才能放下,但是我们只希望使用两个字节。 // This is where the compromise comes in: to make it easy and efficient to represent characters in the BMP, UTF-16 gives up the ability to easily and efficiently represent characters outside that plane. Instead, it uses a mechanism called *surrogate pairs* to encode a character from the supplementary planes. A surrogate pair is a 2-byte sequence that looks like it ought to be a valid Unicode character, but is actually from a reserved range which represents a move to another plane. So UTF-16 uses 16 bits for a character inside the BMP, but two 16 bit sequences for those outside; in other words, UTF-16 is *generally* a fixed-width encoding, but in certain circumstances a character can be either two or four bytes. 这就是我们妥协的地方了。为了让#tr[BMP]中的#tr[character]能够简单高效的表示,UTF-16牺牲了表示此平面之外的#tr[character]的效率和简洁性。它使用一种叫做#tr[surrogate pair]的机制来#tr[encoding]其他补充平面的#tr[character]。#tr[surrogate pair]是一个二字节序列,它看上去像是有效的Unicode#tr[character],但其实它位于一段被预留的区间,用于表示在其他平面上的位置移动。所以UTF-16使用16个比特表示BMP中的#tr[character],但对于其他字符则需要两个16比特才能表示。也就是说,UTF-16*通常来说*可以当作是定宽#tr[encoding]的。但在特定情况下,一个字符可能是用两个或四个字节表示。 // Surrogate pairs work like this: #tr[surrogate pair]的工作原理如下: // * First, subtract `0x010000` from the code point you want to encode. Now you have a 20 bit number. - 首先,将你想#tr[encoding]的#tr[codepoint]减去`0x010000`,会得到一个可以用20比特表示的数字。 // Split the 20 bit number into two 10 bit numbers. Add `0xD800` to the first, to give a number in the range `0xD800..0xDBFF`. Add `0xDC00` to the second, to give a number in the range `0xDC00..0xDFFF`. These are your two 16-bit code blocks. - 将这个20比特的数分成两个10比特的数。#linebreak()给第一个数加上`0xD800`,得到的数在`0xD800...0xDBFF`范围内。#linebreak()给第二个数加上`0xDC00`,得到的数在`0xDC00...0xDFFF`范围内。#linebreak()这就是最终的两个16比特的数据块。 // So for FATHER CHRISTMAS, we start with U+1F385. 还是以圣诞老人为例,#tr[codepoint]是`U+1F385`: /* * Take away `0x010000` to get `F385`, or `00001111001110000101`. * Split this into `0000111100 1110000101` or `03C 385`. * `0xD800` + `0x03C` = `D83C` * `0xDC00` + `0x385` = `DF85`. */ - 减去`0x010000`之后我们得到`F385`,也就是`00001111001110000101`。 - 将它分成`0000111100 1110000101`,十六进制写作`03C 385`。 - `0xD800` + `0x03C` = `D83C`。 - `0xDC00` + `0x385` = `DF85`。 //So FATHER CHRISTMAS in UTF-16 is `D8 3C DF 85`. 所以圣诞老人的UTF-16#tr[encoding]是`D8 3C DF 85`。 #note[ // > Because most characters in use are in the BMP, and because the surrogate pairs *could* be interpreted as Unicode code points, some software may not bother to interpret surrogate pair processing. The good news is that emoji characters all live in the supplemental plane, which has forced programmers to become more aware of the issue... 因为大多数#tr[character]都在BMP内,而且#tr[surrogate pair]也*可以*被当作Unicode#tr[codepoint]来*理解*,所以有些软件会不对#tr[surrogate pair]进行额外的解析处理。好消息是因为emoji都位于补充平面上,这让程序开发者不得不重视起这一问题来…… ]
https://github.com/piepert/grape-suite
https://raw.githubusercontent.com/piepert/grape-suite/main/examples/slides01.typ
typst
MIT License
#import "/src/library.typ": slides #import slides: * #set text(lang: "de") #show: slides.with( no: 1, series: [Logik-Tutorium], title: [Organisatorisches und Einführung in die Logik], box-task-title: [Aufgabe], box-hint-title: [Hinweis], box-solution-title: [Lösung], box-definition-title: [Definition], box-notice-title: [Achtung!], box-example-title: [Beispiel], outline-title-text: "Ablauf", // show-todolist: false, author: "<NAME>", email: link("mailto:<EMAIL>"), ) // #hide-todos() #slide[ = Sie/Ihr und Ich + Siezen vs. Duzen? + Namenskärtchen + Stellen Sie sich bitte kurz vor, beantworten Sie Folgendes: - Wie heißen Sie? - Welche Fächerkombination studieren Sie? - Wenn Sie in einem fiktiven Universum leben müssten, in welchem? ] #slide[ == Ihre Erwartungen an mich #task[ Notieren Sie als Wort oder kurzen Stichpunkt vorne am Whiteboard, was Sie von einem erfolgreichen Logik-Tutorium und einem guten Logik-Tutor erwarten! ] ] #slide[ == Meine Erwartungen an Sie - aktive Mitarbeit und Ergreifen von Initiative - Nachbereiten der Sitzungen mit Hinsicht auf Ihre Probleme mit dem Stoff - Offenheit gegenüber Problemen mit ... - ... der Organisation des Tutoriums - ... dem Umfang des Tutoriums - ... den Themen des Tutoriums - ... der Lernatmosphäre im Tutorium - ... mir als Tutor - ... Ihren fachlichen Schwächen und Lücken ] #slide[ == Hinweise für gutes Gelingen #set text(size: 0.95em) + Benutzen Sie mind. 1-2h pro Woche um modulspezifische Aufgaben zu bearbeiten und Ihre fachlichen Schwächen auszubessern sowie die Inhalte zu festigen. _Nehmen Sie die Angebote wahr, die Ihnen gemacht werden._ + Teilen Sie Ihre Zeit ein. Sie müssen nicht stundenlang am Stück an Aufgaben sitzen. Sie müssen auch nicht _alle_ Angebote wahrnehmen. + Kontaktieren Sie mich und Ihre Kommilitonen bei Fragen. Senden Sie mir und Ihren Kommilitionen Ihre Lösungen zu und holen Sie sich (gegenseitig) Feedback! + Vernetzen Sie sich! Das Studium ist kein Alleingang! ] #slide[ = Die Medien des Tutoriums und ihre Nutzen + *der Ablaufplan* -- für die Vorbereitung + *das Logik-Skript* -- für die Vor- und Nachbereitung + *die Wiederholungsserien* -- für die Nachbereitung + *die Lernevaluationen* (LEVs) -- für Reflexion des Selbstudiums #todo[Rechtschreibfehler beheben] ] #slide[ #show: align.with(center + horizon) #heading(outlined: false)[Nun eine kurze Demonstration, wo Sie die Medien finden.] ] #slide[ = Motivation logischer Analyse 1. Wir spielen Detektive. #h(1fr) → Wahrheitsfindung 2. Wir betrachten politische Argumente. #h(1fr) → Begründung // Wie das Logical mit reinbringen? Als Motivation? ] #slide[ == Flugzeugentführung im Urlaubsparadies #task[ #lorem(20) ] ] #slide[ == Politische Argumente #set text(size: 0.95em) #example[ Die Populisten müssen an die Macht kommen, denn die Gesellschaft steht vor dem Untergang und muss gerettet werden. Sie kann aber nur gerettet werden, wenn die Populisten an die Macht kommen.#footnote[Vgl. <NAME>: _Wie argumentieren Rechtspopulisten? Eine Argumentationsanalyse am Beispiel des AfD-Wahlprogramms._ https://davidlanius.de/de/wie-argumentieren-rechtspopulisten/ (05.03.2024, 08:30 Uhr).] ] *Idee:* Vielleicht bräuchten wir ein Werkzeug, um dieses Argument bewerten zu können? ] // von Logicals zu Philosophie übergehen ... // Vorher gemeinsam erarbeiten! Philosophische Beispiel-Argumente mitbringen und daraus dieses Merkmal erarbeiten! Vorwissen aus der Vorlesung darf gerne mit eingebracht werden! #slide[ = Philosophische Argumente #definition[ Ein Argument ist eine Ansammlung von Aussagesätzen, von denen behauptet wird, dass die einen (die #unbreak[*Annahmen*] bzw. #unbreak[*Prämissen*]) einen anderen (die #unbreak[*Konklusion*]) in der Art stützen würden, dass es rational wäre, anzunehmen, die Konklusion wäre wahr, wenn man annimmt, dass die Prämissen wahr sind. ] ] #slide[ #set text(size: 0.95em) #hint[ Argumente stellen Begründungszusammenhänge dar. Die #unbreak[*Annahmen*] sollen eine gemeinsame Wissensgrundlage sein, auf die sich der Philosoph beruft, die #unbreak[*Konklusion*] das Ergebnis, was sich aus dieser Grundlage ergeben soll. ] #hint[ Die *Annahmen* werden getrennt über den Strich geschrieben, die Konklusion darunter. Ein Beispiel folgt. ] ] #slide[ #example[ 1. Die Gesellschaft steht vor dem Untergang und muss gerettet werden. 2. Die Gesellschaft kann nur gerettet werden, wenn die Populisten an die Macht kommen. #box(line(length: 100%)) 3. Die Populisten müssen an die Macht kommen.#footnote[Vgl. <NAME>: _Wie argumentieren Rechtspopulisten? Eine Argumentationsanalyse am Beispiel des AfD-Wahlprogramms._ https://davidlanius.de/de/wie-argumentieren-rechtspopulisten/ (05.03.2024, 08:30 Uhr).] ] ] #slide[ = Logische Gütekriterien // Gütekriterien gemeinsam erarbeiten, in Gruppen // -> mehrere Argumente mitbringen, ungültige, gültige und schlüssige // am Ende sollen Sie eigene Gütekriterien entwickeln, diese vergleichen wir mit Gültigkeit und Schlüssigkeit ] #slide[ == Gültigkeit // induktiv, deduktiv // wir bleiben bei deduktiv ] #slide[ == Schlüssigkeit ] #slide[ == Fazit // NEUEINORDNUNG: // 1. Detektivbeispiel, was haben wir getan? -> induktiv-gültige Schlüsse gezogen // 2. Politische Argumentation -> ungültiges, unschlüssiges Argument ]
https://github.com/jamesrswift/musicaux
https://raw.githubusercontent.com/jamesrswift/musicaux/main/src/commands/basic-content.typ
typst
#let _draw( this, ctx ) = { box(width: this.width, move(dx: this.dx, dy: this.dy, this.content)) } #let basic-content(content, dx: 0pt, dy: 0pt, width: auto, pitch: none) = { if ( pitch != none ){ dy = dy -1.09em + pitch * 0.125em} return (( type: "basic-content", draw: _draw, // Privates content: content, dx: dx, dy: dy, width: width ),) } #let basic-text( dy: -0.4em, font: "New Computer Modern", size: 12pt, weight: "bold", ..args ) = { return basic-content( dy: dy, place( text(font: font, size: size, weight: weight, ..args) ) ) } #let basic-text-above = basic-text.with(dy: -2.6em) #let space(distance) = { (( type: "horizontal-space", draw: (self, ctx)=> h(distance) ),) } #let basic-bezier(dx: 0pt, dy: 0pt, ..args) = { return basic-content( dx: dx, dy: dy, place( path(.. args) ) ) } #let stretch-symbol( body, // Move dx: 0pt, dy: 0pt, // scale sx: auto, sy: auto, // rotate angle: 0rad, origin: left+horizon ) = { return basic-content( dx: dx, dy: dy, place( scale( ..(if ( sx != auto) { (x: sx,) }), ..(if ( sy != auto) { (y: sy,) }), origin: origin, rotate( angle, origin: origin, body ) ) ) ) }
https://github.com/ChristophVanDeest/FH-Kiel-Typst-Template
https://raw.githubusercontent.com/ChristophVanDeest/FH-Kiel-Typst-Template/main/templates/bachelor-thesis/src/chapters/02_background.typ
typst
MIT License
#import "../dependencies.typ": * = Background == Subsection #lorem(400) == Another Subsection #lorem(300)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/035%20-%20Core%202019/006_Chronicle%20of%20Bolas%3A%20A%20Familiar%20Stranger.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Chronicle of Bolas: A Familiar Stranger", set_name: "Core 2019", story_date: datetime(day: 01, month: 08, year: 2018), author: "<NAME>", doc ) Where the flat tundra gave way to the western range of the Qal Sisma, hills rose like the jagged teeth of a monstrously large dragon sprouting from the hard ground. Amid the hills stood a stone spire twisted into a massive coil. Beside it, an eerie blue-green light drifted like haze from a cleft that split the earth. Here, at the gateway to Ugin's grave, Grandmother halted their party with a raised hand rather than speech. The fissure dove deep to create a vast canyon cut through ice and rock. What lay at the base of the canyon was concealed by a huge cocoon of spiky rocks dusted with snow and decorated with crackling lines of ice that traced unfathomable runes woven into its surface. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/01.jpg", width: 100%), caption: [Crucible of the Spirit Dragon | Art by: Jung Park], supplement: none, numbering: none) From where they stood on an overlook, there was no way down into the canyon, although a dusty trail kept going out of sight around the rocky ground that bordered the chasm. Naiva remembered the journey to Ugin's grave six years ago, the trek across the tundra, trapping birds and hunting a herd of saiga, and how they'd reached the cleft. After gaping in awe at the strange formation they had walked on the narrow trail along the canyon's rim to a shallow cave. There, they had camped for ten nights. Grandmother called with a ptarmigan's croak, then listened. As they waited for an answer, Naiva shifted nervously. The glow disturbed her almost as much as the sight of the rock cocoon grown along the depths of the chasm. Were the growths bigger than they had been six years ago? Were there more of the mysterious runes? "What are those?" Tae Jin whispered. "Grandmother calls them hedrons. They protect the Spirit Dragon's bones." "Ah. What are we waiting for?" "There's a cave ahead. A hunting party sometimes camps here." "Why?" "The hunting is particularly good here because dragons avoid this area. And we have to guard against incursions from the Ojutai and Kolaghan tribes. They'd hunt here too, if they could, stealing the game from our territory." "I meant, why are we waiting instead of going on?" "To let them know we're coming. We don't want to surprise them." Tae Jin stared down into the chasm and the shimmering surface of the hedrons. They were opaque; impossible to see if bones lay beneath them, as Grandmother claimed. A curve in the canyon wall hid the rest of the cocoon. "I had no idea the Spirit Dragon was so huge," Tae Jin whispered. "I thought he was the same size as the dragonlords." "No, he was the greatest of the dragons, as of course he must be, since he is the progenitor of all of Tarkir," broke in Baishya. She stood on Tae Jin's other side, shading her eyes with a hand as she studied the hedrons with a slight, mysterious smile. A thought stabbed in Naiva's head: how annoying that Baishya must show off her knowledge when it was Naiva who had shown interest in the young ghostfire warrior first. Her twin already commanded more of Grandmother's attention. Couldn't she leave Naiva with #emph[anything] ? A shrill sound broke up the path of her thoughts: grandmother whistling a louder call. Only the wind answered. "Mevra is leader of the group who came here last season. Even if they are off hunting, they usually leave a few people at the encampment to cure hides and such work." Grandmother gestured to Fec. "You go up the path to the cave. Mattak, you, Oiyan, Rakhan, and Sorya stay here to guard Tae Jin." "Do you think this has been an Ojutai trap all along?" Mattak asked, glowering at Tae Jin. Grandmother's stern gaze settled on the young man. "It might be. I want you to guard Tae Jin from attack by any of his Ojutai brethren who may have been tasked to follow and kill him. Take cover in the rocks. Girls, with me." Fec quickly vanished from sight around the curve of the trail while the others hid among a jumble of rocks, the debris thrown up from the canyon when the Spirit Dragon had slammed into the ground. "What's wrong?" Naiva asked. "Where do you think they went?" Grandmother touched her lips to command silence. She led the girls back the way they had come through the debris field, cut through here and there with stands of surviving trees. After about two hundred paces she showed them a nock cut into the trunk of an old juniper. Sliding sideways between the trees, they eased through the foliage and emerged onto a dried-up stream bed. They followed its descent for short ways, slipping and sliding on smooth stones. Grandmother halted beside a large rock half concealed by the thick branches of a medicinal plant called weeping berry. A mark had been carved into the rock: the "claw of Temur," now forbidden by Atarka. She brushed aside the hanging branches to reveal the narrow entrance to a tunnel. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/02.png", width: 50%), caption: [], supplement: none, numbering: none) She tapped first Naiva's nose and then Baishya's, the old gesture she'd used to get their attention when they were toddlers. "This knowledge belongs to the whisperers, and to the elders. Never tell anyone else. Do you understand me?" "Yes," said Baishya. Naiva frowned, both troubled and excited by the solemn words. "I understand." They walked single file, Grandmother leading, with Naiva at the rear. After some time, the passage took a sharp turn and they emerged into a circular pocket valley about one hundred paces across. The air within the valley was warm, almost balmy. Edible plants grew around a spring. The sky overhead was made small by the enveloping rocks, but the intense smell of growing things gave a richness to the tiny sanctuary. Baishya knelt by the spring. "It's beautiful. Look, here's chokeberry and stonebreaker, and twilight moss. How is it so summer-like?" "This is a sacred place, where shamans come to meditate. Now it is more than that, a sanctuary hidden from the dragons." "How can it be hidden from dragons?" Naiva asked, pointing to the sky. "A magic woven into the rock conceals it from above. But the magic can only span a short distance and must be renewed every year." "Why did you bring us here, Grandmother?" Baishya asked. "We could have stayed with the others while Fec scouted." Grandmother turned a slow circle, studying the little valley as if to make sure everything was as she'd left it. "If things go badly, if my worst fears are realized, you may need to shelter here." "What fears?" Naiva asked. "Pick up a rock." Four tidy mounds of polished agate marked the four directions. The stones radiated a heat that warmed the air. When Naiva picked one up, she discovered the gleam she'd taken for polishing was a glow of warmth. Baishya gasped, eyes widening with delight and amazement, and she too picked up a stone, pressed it to a cheek, then smiled as she cupped it in her palms. Grandmother touched two fingers to her lips for silence before gesturing toward a tunnel opening on the far side of the valley. They followed her quietly, their footfalls soft scuffs on the rocky ground as they moved as if into the bones of the earth. The rock enclosed them, protected them; the gleam from the stones lit their path. On the walls of the tunnel were painted the outlines of bison and saiga, of bears and wolves, of antlered deer and elk. Hunting parties surrounded young dragons, pinning them with nets as they turned their spears upon vulnerable bellies and eyes. Amid the graceful paintings were carved the claw of Temur as well as other sigils—spirals and flames, spider webs and icy mountain peaks riven by crevasses—that Naiva had never seen before. Under other circumstances someone like her would never have seen this secret place. But she was twin to a shaman, and Grandmother never did anything for no reason. At length, the tunnel expanded into a long cavern, its walls so high the stone-light could not penetrate the upper darkness. Shapes greeted them like kinfolk silently awaiting their return. As they approached, the rounded shadows resolved into large headpieces resting on stone pillars. The oversized leather hoods were strung with carved bone, antlers, tusks, and amulets hammered out of bronze. Baishya stopped so abruptly that Naiva bumped into her. "What are these, Grandmother?" "They are the garb of a whisperer, as you are meant to be. We have hidden them here to save them from Atarka. The day you can no longer conceal yourself from Atarka is the day you will join the hidden ones, my child. We will have to hide you from her." "In a rock tomb, like our mother?" Naiva demanded. "Hush, not so loud, my brave hunter. You would have learned this in time, but now there is no time. Listen carefully, Naiva, for you have a part in this as well. You have the skill to be a great hunter, to support our people. But you have in you the chance to do something even more important than that." "What can be more important than feeding the clan and keeping Atarka fed so she doesn't kill us?" Naiva asked. "What is more important? To keep alive the knowledge of our true selves." Grandmother moved past them. Shelves had been carved directly into the stone. Here, set out in neat lines, rested a collection of horns, tusks, and antlers. The stone-light revealed carvings on their surface, their fine, elaborate lines clearly the work of master carvers. The light also revealed the way Grandmother's expression softened in a rare display of satisfaction. Few things in the harsh life they lived could ease her guardedness, but when she picked up one of the antlers and tipped it within the aura of light to consider the carving, she actually smiled. "These carvings tell the story of the past. As long as our ancestors live on through our memory of them, then there is hope we can one day reclaim who we are rather than serve only the hunger of Atarka and her children." "Are there stories of battles and dragon killing?" "Yes, and much more than that. It's past time for you girls to become guardians of this knowledge, so you can pass it on after I am gone." Naiva took the antler from Grandmother and examined the carving incised into the bone. No dragon killing, but dragons killing humans. All at once she realized it was the story of how the khans fell, a tale Grandmother often told hearthside at night both as warning and as reminder. Baishya hadn't even come over to look at the scrimshaw. She had drifted back to the headpieces, reaching out toward the closest one before trepidatiously withdrawing her hand. After taking in an unsteady breath for resolve, she reached again and this time cautiously brushed her fingers along the tokens of power. Her face settled into a look of awe. "I hear you," she whispered. Of course, the objects were whispering secrets to her. This tradition belonged to those granted the shaman's gifts; it didn't belong to hunters like Naiva. She was only here because of Baishya. It was so unfair. Grandmother took the antler and set it back among the others. "Fec will have reached the camp by now. Come with me. Make no noise. Bring no light." They placed the stones on the ground and followed her into a wide tunnel, the only other outlet. The ceiling sloped down until they had to crawl. Fec's rumbling voice whispered around them, although his words were inaudible. After a pause, as if he was listening, he spoke again in apparent reply. Why was Grandmother spying instead of greeting her kinfolk in the normal manner? #figure(image("006_Chronicle of Bolas: A Familiar Stranger/03.jpg", width: 100%), caption: [Formless Nurturing | Art by: Cliff Childs], supplement: none, numbering: none) The passageway ended in a long horizontal cleft, too narrow to squeeze through, that overlooked the large, shallow cave. The stone hearth was covered in a fine, white ash. The packs and weapons of clan hunters lay scattered on the ground behind a stone wall high enough to keep out wandering beasts, but the hunters were gone. Fec stood at the entrance with the light behind him. He was looking toward someone at the back of the cave, their face and form obscured by shadows. Grandmother hissed softly between her teeth. A low-pitched voice spoke out of the shadows in a tone both sweet and melancholy. "An illness ate away their lives and brought them death. I am all that is left." "Who are you, kinswoman? Come out so I can see your face." "I dare not greet you, Brother, for fear of spreading the sickness that took the others." "You are ill?" "I am not. But maybe the illness hides in me. Death can hide in many guises and strike when it is least expected, can it not?" Fec hid a hand behind his back and gave the sign for "caution"—which meant he knew about the hidden cleft and presumed that Grandmother was already there, watching. "How long ago did they die?" "I lost track of the days. Dreams trouble my nights. Do you know of any dreams?" "I do not dream." He held his hands out to show himself unarmed. "As I said before, I am called Fec, of the line of Abek, now fostered son to Yasova First Mother. Again I ask, may I know you and your family, Little Sister?" Silence filled the air like heat radiating off a fire. The shape took a step out of the darkness of the back of the cave, resolving into an exceedingly pregnant woman holding an axe. A fur hat was tugged down over her hair. It was hard to distinguish her features due to the way the shadows dappled her face. "Yasova First Mother," she said in that honey-sweet tone. "This name I know, but I do not know you, Fec, of the line of Abek. Bring me Yasova, and I will speak to her and tell her of what happened here. She will know about the dreams." "Is there anything you need, Little Sister? Anything you need until I return?" "I have what I need." She rested a hand on the spread of her belly, as if in reminder that every child birthed was a child set upon the path of the clan, a link between the past and the unwritten that has not yet come to pass. "Is this your first?" "My first?" "Your first child. You look near your time, and there is no midwife or healer here." "Yes, yes, all is well. The time is near. Where is Yasova?" He tapped his chest with an open hand as if in acknowledgement of her words, but it was really a signal to Grandmother that they would meet back with the others. "I will see what I can do, Little Sister. Although it may take some time. Wait here in peace until I return." She said nothing, just waited. He retreated without ever turning his back on her and finally vanished into the daylight. Only then did she return to the shadows. A darkness curled around her, hiding all but a gleam of eyes. Without speaking Naiva crept backward with Grandmother and Baishya until they reached the cavern where the headpieces rested like presences waiting to be released from confinement. Grandmother handed each girl a stone. Her expression was grave. "You are most precious to me, my girls." The shock of her saying this out loud robbed Naiva of breath. For an instant, she thought all the air had been sucked out of the chamber and she would suffocate. Always attune to her twin's emotions, Baishya grabbed her hand and squeezed it. "We are come to a time of great danger. Those of us who remember what once was are passing into the ice of the ancestors, while those who will be born will never know who we once were except through stories they are told by people who never witnessed what they tell of. You are all that remains of my daughter, whom I loved. But you are also my offering to the unwritten now, you and the carvings we make to tell our story so others may know of us in distant days to come." "What's wrong?" Naiva demanded. "Do you think the woman's sickness will infect us?" "Did you not recognize her?" "No." Baishya said, "It was hard to see her face but I thought she looked like Mevra." "Yes, the body resembles Mevra, but I believe the speaker is not what she seems." "Are you saying someone has stolen Mevra's shape? How can anyone do that?" Naiva asked. "My healing magic is powerful. There are other forms of powerful magic in the world." "Like Baishya moving stone and ice." "That's right. Maybe magic can mold a person into a different form. Maybe it merely makes us believe through illusion that we see something that isn't there. I don't know. But Fec's sense of smell is excellent, and by his sign, he also suspects it is not her. I cannot be sure until I approach more closely and question this person myself. I'm leaving you two here while I do that." "I'm not afraid," said Naiva stoutly. "Of course you aren't." Grandmother grasped a hand of each girl, holding tightly. "But until I figure out why Ugin has sent visions to us now, or if they are even Ugin's visions, you two must stay here." #figure(image("006_Chronicle of Bolas: A Familiar Stranger/04.jpg", width: 100%), caption: [Ugin's Nexus | Art by: <NAME>], supplement: none, numbering: none) "Who else's visions could they be?" "An interloper who has already infected us by bringing about the reign of the dragonlords. If anything happens to me and the others, wait a month." "A month!" "Do as I say. After a month, return to Ayagor and tell Gerrak he is now First Father of the tribe." Without further explanation, she left them. "What interloper?" Naiva stared into the darkness left by Grandmother's departure. "How could one interloper have brought about the reign of the dragonlords? Aren't dragons always fated to rule us?" "A rope is not a single strand but many strands woven together," said Baishya softly. "The future is like that rope. The strand we are on now is not the only strand that could have been. There was a different path, one that wasn't taken." "You sound like a whisperer now!" "I am a whisperer. Don't you remember the tale, Nai? There was another great dragon in the storm that day, the one who killed Ugin. He came from nowhere and vanished to nowhere." "Does Grandmother think he's returned?" Naiva hugged her arms around herself. It suddenly seemed so cold. "She can't face a dragon alone. We should go back to the overlook and see—" "No!" Baishya's usually mild, hesitant tone hardened, making her sound like another person, not the shy, dreamy twin Naiva knew so well in some ways and yet whose mind was so different from her own that it often baffled her. "We can't go back there, Nai. I know where we have to go." She tugged Naiva into the darkest corner of the cavern. The stone-light revealed a cleft so narrow that Baishya had already taken off her pack and set it down in order to squeeze through. "What are you doing, Bai? Grandmother told us to stay here." "Ugin is calling me. I didn't hear it before. Maybe we were too far away and it can only reach me through the magic woven into the headpieces." "Ugin is dead. Dead things are dead." "No. Death is more complicated than that. If you won't come, I'm going alone." She'd said the same words when she set out to climb Eternal Ice. A part of Naiva wanted to balk, to turn away. But just as on the day Baishya had set out up the sacred mountain, Naiva knew her twin had her mind set on a path and would not turn back. Since it was her duty to protect Baishya, she set down her pack and, still holding the stone, turned sideways and followed her into the cleft. She scraped her nose on rock as she side-stepped along. The back of her head bumped against the other wall. After one hundred and eleven side steps the cleft widened enough that she could cram up beside her twin. Bai was breathing hard, coughing a little. Naiva draped an arm over her shoulders. "Look, there's a glimmer of daylight ahead. We'll set the stones down here so we can get them when we come back." The cleft opened into a shallow cave where a ring of stones formed a fire pit. It hadn't been used for a long time, all the ash blown away, and Naiva saw no sign of stockpiled fuel. They found a track, a switchback down the steep canyon face. The sun wasn't yet at zenith, and shadows filled the canyon, so they walked with care for where they set their feet. The track wasn't more than a hand's span across. It would be easy to tumble down onto the ice-ridden spikes of the hedrons. The noise of the wind fell away as they descended, drowning them in a dense hush like their ears were stuffed with cloth. A deep, soundless vibration hummed up through the soles of their boots in a slow rhythm that reminded Naiva of breathing, not that there was anything alive down here except the two girls. Not even birds flew. When she licked her lips, the air almost seemed to spark on her tongue, as if they were walking into an invisible sheet of frozen lightning. At last the trail bottomed out, catching them in a dead end. Angled hedron walls confined them. There was nowhere to go except back up the track. Her twin had led her into a dead end, as always. The thought crept stealthily into Naiva's mind. She always had to follow the path Grandmother set out for Baishya instead of commanding the glory due to her for her hunting prowess. She deserved more. "Nai?" "What?" Startled, Naiva turned to see Baishya watching her through narrowed eyes. "There was just something funny about your eyes but it's gone. Look here what I've found." She fixed a hand around a lower corner of one of the hedrons. As if it were a dragon's scale come loose, she shifted a slate-like slab of rock to reveal an opening big enough to crawl through. "Don't go in there!" Baishya dropped to her knees and crawled in. Her feet vanished. The ground thrummed, then quieted. Naiva prided herself on her courage. The sight of that gap into a murky darkness no light could penetrate struck a blade of terror into her heart. Coward! All her life she'd been reminded over and over that she was to protect her twin. For so long she'd thought it was because Baishya was weaker, frailer, less competent, maybe a person who the tribe would decide wasn't worth feeding. But it wasn't like that at all. #emph[Grandmother loves her better than she loves you. You can leave her. No one will miss her, and then Grandmother will love you more.] The thought nagged. She took a step away, toward the track. Another step. #emph[You have a greater destiny. You will become the most magnificent hunter known to your people. It will be easy, once you no longer have her to burden you.] But duty and love rooted her feet. It was impossible to walk away and leave her twin behind. They had been born together, pulled from the bloody womb of their dead mother, hand clasped to hand. To betray that bond was to betray her own self. So she knelt and ducked inside the hedron. A gleaming mist drifted before her eyes, obscuring her vision. Colors twisted like threads, shimmering, dizzying. The space was vast, immeasurable, the heady breath of eternity sweet against her face. The space was as small as a skin tent raised against the snow in midwinter, cramped and humid. Baishya lay sprawled across the ground as if asleep, one hand limp at her side and the other extended above her head to grasp an object Naiva could not see. The air clotted in Naiva's lungs. She fell forward as her vision hazed. With her last conscious breath, she clasped her twin's hand, skin to skin. The magic of the hedrons opened a gate mind to mind. The Spirit Dragon's essence rose like a cliff of ice around her, glittering and impassable. She fell into the vision where Baishya had already plunged. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/05.jpg", width: 100%), caption: [Ugin, the Spirit Dragon | Art by: <NAME>], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The landscape is a silvery sheet of water as flat and reflective as a mirror extending to the horizon on all sides. Here and there rocky islands like spires rise from the endless sea, each creating a perfect resting place on which to meditate. No wind stirs the air, yet glimmering, translucent globes float like bubbles caught in a breeze that touches nothing else. One of these globes drifts close, and closer yet to the dreaming shadow of the girl asleep atop the waters. When its frail surface touches the edge of her misty form, it pops. The thin sphere of liquid spills memory into the shadow of her mind. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) A dragon hovers over the still waters, staring into its reflection, a mirror which looks back on itself. The reflection is so complete in every detail that it might be the original dragon looking into a mirroring sea, and the dragon floating aloft might be its reflection, complete in every detail. "What is this place?" the dragon says and, hearing his own voice, lashes his tail in surprise. But the lashing tail stirs no wind. The waters do not ripple. Only the reflection moves as the dragon answers itself. "This must be one of the planes of which Te Ju Ki speaks. I have walked between worlds~" The realization sparks a billow of shimmering, lightless flame that seems to enfold the dragon, and just like that it vanishes. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The water waits motionless, calm, and yet expectant, almost aware. Another globe spins up to the shadow of the sleeping girl, and pops. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The dragon falls in confusion, opening its wings at the last moment to settle atop a jagged peak. But this is not its smooth-sloped birth mountain presiding over a magnificent, rich landscape. This is a wild, stormy, rugged world only half born, called Tarkir. Ferocious winds greet the dragon in savage gusts. The mountains sing, spilling arias of fiery lava, and the rivers gush in a rushing chatter of delight. The hearts of the dragon feel touched as by home. This wilderness can be tended, not to create the garden of his desires but to become itself, to fulfill the promise of its nascent soul. So, he burrows into the soil and digs out the creatures of earth. He swims in the churning rivers and restless seas and heavy mires, and each foamy ripple boils a myriad of creatures into the waters. The beat of his wings cracks thunder and lightning through the sky, and this tempest births dragons. Even fire begets living things, splendid in their heat and beauty. Or at least, this is a story the humanoids often tell as they weave tales about the most ancient of days, for those who witness the dragon's majesty and power cannot help but wish to be associated with its grandeur. As a knowledge of magic arises among the various peoples, shamans seek the dragon's tutelage. To the wisest, he relates the story of the journey that brought him to Tarkir. In telling the tale, he discovers that the worst edge of the shock and betrayal have worn off. What has happened to his twin? Has Nicol survived? What of their birth plane? If he could walk the planes once, surely, he can do so again. He seeks in his mind for the spark that opens the way between worlds. In a wash of invisible, rippling flame, he shifts through a blind, disorienting darkness and, after a moment of stomach-churning unpleasantness, finds himself again floating above the still waters and their mysterious aura of meditative peace. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/06.jpg", width: 100%), caption: [Island | Art by: <NAME>], supplement: none, numbering: none) He stares at his perfect image staring back at himself. A single drop of water falls from the lambent sky, or perhaps from his own eye, and strikes the water. The ripple of its passage opens a vista. Through this window, he sees the birth mountain, still proud, still snow-capped, but marred now by an unsightly growth. Like an unvoiced roar of anguish, all the thick, clotted emotion he thought he had left behind swells up in a fierce surge. The spark gives him passage; he twists through shadow, and then he is there, falling out of the sky toward the birth mountain. He pulls up onto a mighty current of wind and circles the mountain, cycling lower and lower until he sees that someone has built a temple atop the mountain. This structure is a gaudy spectacle of tiered roofs painted red like blood and topped by two huge horns curving in on each other. Robed priests come running, seeing him, and they ring bells and hammer on drums. Some prostrate themselves as if in worship, while others weave magic and fling it at him like a net meant to capture and drag him down. He evades these crude displays of magic and flies down the mountain, seeking anything familiar. The clearing where <NAME> was killed, where the old chief built his temple, is now the central square of a grand city that sprawls down the skirts of the mountain to reach all the way to where the old settlement once stood. So many humanoids tread the city's streets that he cannot count them. Their voices rush like the chatter of boundless rivers, but beneath the bustle and liveliness dwells a tainted stillness. A festering darkness paves the alleyways and tenements and insinuates itself into every transaction. Beneath the prosperity of those who wear a badge sewn with curved horns, of those who feast at grand tables and serve in opulent temples, of those who carry iron swords and spears as they swagger about their business, creep the shackled and the starving, the slave and the shunned. This place looks little different at root than the old blood-soaked settlement of the dragon-killing chief, just grown and metastasized. Who rules here now? But he knows in his hearts who rules here. He recognizes the shape of the curved horns. #emph[My brother. My twin.] #emph[He betrays me still, the promises we made, the bond we shared.] With a howl of frustration, of rage, of grief, he vanishes in a ripple of invisible fire. After a gut-twisting passage through the blind darkness, he emerges again above the dreaming mirror. The calm waters soothe his troubled heart. The cursed lash of emotion eases. For years uncounted, he hovers above the waters, lost in thought and lost to ego's purpose. The world on which he first fell to earth—Dominaria—is but one among many. Why weight himself with the past when an entire universe of worlds awaits exploration? He is not confined to the birth mountain or even to Tarkir, his soul's home. The universe is greater than he is, and that is as it should be. A new peace settles into his hearts. With elation, with joy, with purpose, with tranquility, he launches himself in a ripple of invisible flame. The dragon vanishes. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The water waits motionless, calm, and yet expectant, almost aware. Another globe spins up to the shadow of the sleeping girl, and pops. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) He walks the planes, wonders and dangers unfolding as he crosses from plane to plane. Tumultuous Zendikar. Moon-haunted Innistrad. Sun-drenched Lorwyn. Stur<NAME> with its mana in perfect balance. Shandalar's verdant flow of magic. And so many more, some vast and saturated with mana, some attenuated shards leached of life and magic both. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/07.jpg", width: 100%), caption: [Jund | Art by: <NAME>], supplement: none, numbering: none) Did even Te Ju Ki suspect how manifold the universe is? The grandeur of the Multiverse awes him; its magnitude humbles him. Yet again and again his thoughts circle back to his twin. He has avoided Dominaria all this time, feeling trapped and diminished in the confines of his past. Maybe he is too quick to be suspicious of Nicol, who after all was a very young dragon and prone, as youth is, to impulsive mistakes. Maybe he misinterpreted the curved horns and what they mean. He suffers from pride too, like his twin, unable to let go of a past injury. He might have seen what he wanted to see rather than explored more fully to find out the truth. Surely, truth is more important than pride, more satisfying than power. He will find Nicol, and it will all go back to what it once was between them. He's sure of it. By now, he has mastered planeswalking. In the blink of an eye, and with a ripple of invisible flame, he is gone. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The water waits motionless, calm, and yet expectant, almost aware. Another globe spins up to the shadow of the sleeping girl, and pops. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Banners rippling in the wind, Armies march across the plains of Jamuraa. In their wake spreads the wreckage of a great war: broken bodies, ruined cities, and lands poisoned by battles waged through merciless sorcery and the shattering might of dragons. Here and there, flags marked with the crown of Arcades Sabboth lie crushed in the dirt and mud where cohorts have fallen to a pursuing army. Standards bearing the curved horns advance until the proud survivors of the fleeing army gather and brace for one final engagement. The last great clash opens with the howls of soldiers driven to madness by generations of war. Claps of sorcerous thunder burst the hearts of the enemy. Ugin stares in horror as lesser dragons, unknown to him, fight and fall in the first charge. Arcades Sabboth commands with brilliance, flying this way and that to fend off a flanking maneuver here and an assault of sorcery there. But always Nicol is there to counter him, ceaselessly patrolling the lines of battle as companies of soldiers and sorcerers vie for the honor of fighting in the front line where he can see them. Both are so intent on the battle that they don't notice him, high above them in the sky. In a flash of anger, and of shame at himself for staying away for so long, the dragon furls his wings and dives. On his travels, he has learned sorcery to shield himself against spears of iron and nets of deadly magic, so he hurls himself between the two armies and spreads his wings in a shimmer of invisible flame to hang there between them like an apparition. The shocked troops pull back. Even his warring siblings are astonished enough by his unexpected appearance to break off the fight. Now that he has their attention the dragon roars. "Nicol! Arcades! You must put a stop to this! It's wrong!" "I fight only to protect my people!" Arcades answers in a furious bellow. But he is canny, and notices at once that Nicol's attention has fallen away from him and his army and onto the interloper. As the dragon hovers between them, Arcades whips the remnants of his ragged army into a full-scale retreat. The line of the other army awaits its orders. Nicol gazes in shock upon the revenant that confronts him. "What sorcery is this?" he demands. "Ugin is dead." "No sorcery. Don't you know me, Nicol?" "This is some cursed magic wielded by Arcades!" He surges forward and, with a blast of fire, attempts to obliterate the mirage. But Ugin's magic is powerful, knit from all of magic's spectrum. Nicol's rage streams harmlessly off to dissipate in the air. The terrified army holds its ground, even those struck by burning sparks who writhe in torment as they fall. "Nicol! Stop! It's truly me." "You're dead. I saw you annihilated by a vile burst of human sorcery. It was their revenge for my victory, destroying what I love most. But I avenged you. I set out to make the world worthy of your vision of peace and harmony." "Is this what you call peace and harmony?" "It will be. Come see what I have accomplished. Come, Ugin." His words are so heartfelt. Yet he abandons his soldiers, leaving them to pick up their dead and wounded. Scouts from Arcades's retreating army ride to report on this abrupt change of circumstances, how the victor has relinquished his advantage on the field. But Ugin cannot stay to see what Arcades means to do, much less spare an hour or a day to talk to his older brother, to ask what has happened in the years or centuries since he left. He came to find Nicol, so he follows his twin. They fly across the plains and mountains of Jamuraa and thence across the ocean, passing over other islands and continents. Dominaria is beautiful, wrought with cascading waterfalls and splendid mountain ranges, lush pastures and flourishing forests that breathe life into the air, colorful reefs and sparkling sand-strewn islands. But amid the striking landscape nestles the residue of war: blighted fields, scorched villages, scattered bones. Even the land has been warped by dire magic wielded without thought for its consequences: rivers blocked until the waters flood hapless settlements, canyons gouged through peaceful plains, avalanches burying quiet valleys. Nicol surveys the landscape with a satisfied smile, seeming not to notice any of this horrifying destruction. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/08.jpg", width: 100%), caption: [Tectonic Rift | Art by: <NAME>], supplement: none, numbering: none) "Did you ever suspect the world is so vast a place, Ugin? I have traveled everywhere, no place too small or too grand that I have not set claw upon it. Half of it I now rule, as I have risen from least to greatest. All of Dominaria will soon kneel before me. No one dares call me "least" now. And you are returned to share this triumph with me." At last they reach the continent of their birth, and the birth mountain. The crater's peak is bare except for a pair of curved horns crafted from marble, making it seem the mountain itself has horns. "Was there not a temple built here?" Ugin asks. "There was, a long time ago, but I realized it wasn't fitting for humanoids to set their feet atop sacred ground meant only for dragons. Only for me." He lands gracefully, leaving room for Ugin to settle beside him. "For you as well. I missed you so much, Ugin. My anguish crushed me. I thought of you every day, wondering what had become of you and how you were faring. So, tell me, how do you like my domain?" Ugin is silent for so long that at length, Nicol, lost in contemplation of his magnificence, realizes he has not answered. "Share your thoughts with me, Brother. Is it not remarkable what I have achieved? Even you must admit no creature has ever held so much power over so many as I do." The words spill out like fire. "You tried to influence me with that trick of the mind. How could you, Nicol? Bad enough that you worked such a terrible magic upon others but on me, your twin!" "You disliked the 'trick' never so much as when it worked against you." Nicol chuckles softly. "I was young, and testing my power. But now I have no need of such insecurities. I am emperor of all, or will be soon." "All? You think this is #emph[all] ?" Ugin laughs, his belly churning with an anger he does not understand. Nicol huffs, head slewing around to glare at him. "Why do you laugh? Power is nothing to mock." "This is but one shard of a myriad shards. Not insignificant to those who live and die here, of course. But compared to the Multiverse that lies beyond, it is like claiming this mountain as the entire world when it is but a tiny fragment of the whole." "What are you talking about?" "I'm talking about what Te Ju Ki taught me—" "That old human is long vanquished by death and her prattling wisdom nothing more than dust. While you and I are still here." "If that is what you think then you do not understand death or wisdom. I thought there was more to you than this, Nicol. Do you really believe this petty warmongering and conquest means anything in the vast reaches of the universe?" Sparks puff from Nicol's nostrils. A sulphurous wisp of smoke hisses from his mouth. But for a long, long while, he remains silent. The wind skirls atop the mountain. Snow starts to fall. The flakes that land on the dragons' scaly hides vaporize instantly. Water drips onto the rock, puddling and then freezing. Far below, snow drapes the surrounding landscape in winter's mantle. Ugin does not remember it ever growing so cold here, but the balmy climate has clearly changed. Even the once great city has seemingly dissolved, overtaken by forest that has wrapped itself around crumbling towers and uprooted noble avenues. In the distance, a ring of fortresses protect all approaches to the base of the mountain. Beyond these outposts lie temples capped with horns, and beyond the temples lie towns too far away to be seen except by dragon eyes. But every fortress and temple and town faces inward toward the mountain, as if all that matters to Nicol anymore is that every face is turned toward him to praise him. Nicol speaks in a contemplatively wistful voice. "Have you returned only to insult me? I thought we were twins, not rivals!" Beguiled by the words, Ugin softens. "Of course we are twins, not rivals. Our bond, our brotherhood, is the only reason I returned to find you. If I hadn't come back, I would be discovering all the wonders that lie beyond this small world." Nicol's eyes narrow with a look of alarming inquisitiveness. "Where #emph[have] you been? If it wasn't a sorcerous spell that caused you to vanish right before my eyes in a ripple of magic, then what happened to you?" "I am a Planeswalker now." Nicol stares at him, eyes gleaming. "I am not even sure there is another like me. I have found no trace of any other creature who can walk between worlds." Nicol blinks but says nothing. "I don't know why, or how, it happened. Only that I was on Dominaria, facing you, and then, suddenly, I was flung beyond this plane. It shocked me at the time. I was bewildered and confused. But I have since discovered there are many planes, many worlds. They are linked by a shadowy space, a web of darkness to which everything attaches. By moving in and out through the web, I can pass from one world to another. Such wonders I have seen! A hundred worlds I have visited. To rule Dominaria is all very well for a small-minded despot like that old chief who killed our injured sister and believed it made him divine and invincible. But he and his squalid heirs were nothing more than negligible tyrants compared to the eternity and infinity of—" #figure(image("006_Chronicle of Bolas: A Familiar Stranger/09.jpg", width: 100%), caption: [Crucible of Worlds | Art by: <NAME>], supplement: none, numbering: none) "Are you comparing me to those pathetic, weak, short-lived humans who I destroyed with the most superficial flicker of my mind?" The words emerge in the barest whisper. "When I look at what you have wrought with these pointless wars against our dragon brethren? Hear you boast of it as a puny child might brag of killing a fly by saying they have killed a mighty dragon? Yes, I do compare you to such pathetic creatures. For at least they do not know better. You should know better." "How long have you known how to do this?" "Since that day. The day you tried to manipulate my thoughts." "#emph[That day] happened four or five thousand years ago as humanoids measure time. And you never thought to return until now? Never said to yourself, I must share this momentous revelation of planeswalking with my brother, my twin?" "How could I trust you? You tried to manipulate me—" "Show me how to walk the planes. Take me with you." Eagerly Ugin begins. "You focus your will upon the spark inside you and~" He breaks off. It was a spark born inside him that gave him the capacity to planeswalk. Without the spark, the paths between worlds are simply a closed door. "You can't tell me, can you?" sneers Nicol. "It's all a lie, isn't it? You've been hiding all this time in a coward's sanctuary. Now when I have almost conquered the world—the only world there is—you return like a hungry rat hoping to steal my glory and claim it for yourself." "You don't believe me." "Of course I don't believe you. You are a liar. You have always been a coward and a liar. This is the greatest lie of all, born deep in your frightened, envious heart that I have accomplished all the things you've never had the courage or the strength of will to bring about. It was always about me, wasn't it, Ugin?" "You can only see yourself in everything that happens. What happened to you?" "Nothing happened to me. I am as I have always been." "Yes, maybe that's true. Maybe all along it is I who have been lying to myself, thinking you were better." "The lie is that you have all along believed you were better than me. You're the manipulator, Ugin. Not me. I have only ever done what I needed to help us survive. I have only ever kept faith with you and with our murdered sister. What have you done except cravenly hide away, abandoning me? You only came crawling back when I had done all the hard work of making the world safe for us." "You are right. I should never have come back. So be it. Enjoy your ascendancy over Dominaria. It's all you'll ever know, while untold worlds lie forever beyond your reach." Enraged, furious, heartbroken, Ugin vanishes in a ripple of invisible fire. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) A jolt rolled Naiva off her side. As her back hit the cold wall of the hedron, she opened her eyes in shock. Her hand had lost hold of Baishya's fingers, the contact broken. Her twin still breathed, chest rising and falling in slow swells. Beneath the closed eyelids her eyes moved restlessly, darting as if trying to take in an endless stream of sights. Was she caught in memories, or in false dreams? Was what they were seeing real, or an illusion? A hunter trusted the evidence in front of her eyes: the imprint of hooves or paws, broken grass revealing a trail, the smells on the ground and in the air, the rustling of a beast's passage or its vocalizations marking its position. How could anyone trust stories handed down from the ancient past or dreams bubbling up from an unknown source? What if it was all lies? A scuff sounded from outside, following by a slide of pebbles on the path. She ducked her head out the small opening to see her Grandmother hastening down the switchback path. Scrambling out, she grabbed her spear. "Grandmother." She kept her voice low, glancing nervously up at the sky, although she could not have said why, just that she felt a prickling on her back, a bristling along her neck, as if the hunter was being hunted by a predator much larger and more deadly than any human. "Naiva!" Grandmother set a firm hand on her shoulder, shaking her with a rare display of concern. "Why did you two leave the safety of the cavern? Where is Baishya?" Naiva indicated the low opening and murky interior. "I tried to stop her, but you know how she is. The Spirit Dragon lured her down here and has trapped her in a strange realm of wide water, like a mirror." "Trapped her?" "I followed her inside. When I took hold of her hand, I fell asleep too. I saw what she saw, dreams that felt like memories. Then I rolled over and the contact between us broke, and I woke up. But she's still sleeping. It's as if she can't stop." "The Spirit Dragon is trying to speak to us." "Ugin is dead." "You keep saying that, but the ancestors never truly leave us unless we discard our memory of them. What did you see?" Naiva was no storyteller. Instead, like a hunter, she efficiently described the strange landscape and the floating bubbles. Grandmother listened closely and, after Naiva was done, stood in silence, her expression as focused as if she were hunting through the words for the secret she was looking for. At last, Naiva could take her silence no longer and broke in. "But what does it all mean? Why is this all happening?" "It seems Ugin is not dead after all. But not awake either. I must conclude the Spirit Dragon is trying to communicate to us in the only way he can, as the ancestors sometimes do through dreams and visions. The windfolk are more deeply attuned to the winds of magic, so he sent them a vision out of the depths of his sleep. They called Baishya to him, knowing her for a whisperer who can speak mind to mind." She paused. "As you and I cannot, Naiva. That is not a lack in you and me. It just means Baishya has her own path in life." "To pass on a vision to you telling you to come to this grave?" #figure(image("006_Chronicle of Bolas: A Familiar Stranger/10.jpg", width: 100%), caption: [Tomb of the Spirit Dragon | Art by: <NAME>], supplement: none, numbering: none) "Perhaps. <NAME>'s master must be a powerful shaman. Thus, he too can receive a vision, and thus, <NAME> is sent to me in order to tell me the story Ugin told the Jeskai long ago. That story must be important as part of what the Spirit Dragon wants me to know. But what am I to learn from all these hints and landmarks? What does Ugin want me to see?" "What if it's all lies, Grandmother? Dreams can be lies. Old stories can be lies." Grandmother grabbed her chin and forced her to look at her, staring into her eyes as she searchingly examined her face. "Your pupils look normal. Do you hear a whispering in your head?" "What do you mean? No! What do you think is happening?" "Mevra and the others are almost certainly dead. What has taken Mevra's form I do not know, but if what I suspect is true, then we are in terrible danger." The flat way Grandmother spoke sent a shiver of fear through Naiva's flesh, a worm of cold that nipped at her heart and made her feel faint. "What danger? Where are the others?" "Hiding in the sacred cavern. You must go up to join them." "What are you going to do?" "I'm not sure," said Grandmother. The three words were the most frightening thing Naiva had heard in all her life, because Grandmother always knew what to do. "What warning the Spirit Dragon is trying to give us may have come too late, but I must see if I can communicate with Ugin myself to find out what he wants. If what you say is true, maybe I can reach his dreams through Baishya." A crack of noise brought her head up. Both of them stared at the canyon's rim, high above, and rising beyond it the glossy blue glamor of the cloudless sky. The sun stood at zenith. Nothing moved, not even a bird or an insect. "My sweet child," Grandmother said in a low voice ragged with unexpected emotion. She kissed her on either cheek. "Go quickly. Go quietly. Do you understand me? Let nothing distract you." She crawled in through the tiny opening, disappearing inside the hedron structure. A tremble shivered the ground beneath Naiva's feet like the tremor from a distant earthquake or the shudder of a creature rolling over deep underground. "Grandmother?" she whispered. No answer came. A rush of fear spilled adrenalin through her muscles until she shook. Biting her lip, she breathed down the wave of terror, but she couldn't help thinking of the two people she loved most in the world lying asleep and unaware, utterly helpless. She set the broken piece of crystal back across the opening to conceal it but without fixing it in place so it would be easy to dislodge from the inside. After taking ten steps up the path she looked back. From this distance, the hedron surface looked so smooth and unbroken she was abruptly afraid she had accidentally trapped them, that they would struggle to break free only to find themselves in a prison of her making. What if they died of thirst alongside the Spirit Dragon's bones? She would just go back and check one more time~ Movement flashed in the periphery of her vision. She whirled, pointing her spear toward the path. A woman emerged from behind a ridge of rock, negotiating the last switchback before the path took a straight line down to the base of the canyon. She was hugely pregnant but remarkably light on her feet, strong and graceful, not lumbering at all. Naiva knew her at once. Mevra's face was a familiar sight at the yearly gathering at Ayagor when the various hunting parties and family groups were required to present themselves to Atarka. She was related to Grandmother through grandmothers who were sisters, and for her own part was also a hunt leader, intelligent and level-headed, one of the few people Grandmother genuinely respected. Mevra's face smiled, seeing Naiva. It was such a friendly, pleasant smile, so reassuring. "Greetings, Little Sister. I've come so far to find you and your family, and to discover some family of my own." "Who are you?" Fear snapped in her voice and surged through her flesh, although she could not have said why. "Don't we know each other? What is your name and family?" Naiva's mouth opened before she knew she meant to speak. The words just flowed out. "I am Naiva, daughter of Kiarka, daughter of Yasova." "Yasova! Why, it is Yasova I seek. Is she not here? Did I not see her descending toward this place?" "There is nothing here, as you see" Naiva concentrated on moving her right foot, anything to get away, but the foot would not shift. A sick terror clawed up through her gut, and she breathed it down until she could speak comprehensible words. "Nothing but these hedrons, covering the bones of a dragon who died a long time ago." "Not so long ago. A moment. A breath." "My whole life ago," said Naiva. "Ah, you are very young, a mere fledging." "Who are you?" "Don't you know me?" By now Naiva's breath was coming in gasps, as if she'd been running and could not stop, and yet she had not moved at all. The pregnant woman wearing Mevra's face descended lower and lower, coming closer and closer. Her hunter's training raised every alarm: the woman had no smell of felt or sweat, no glisten of oil on her uncovered cheeks. The wind did not stir any loose strands of her black hair. Her steps made no noise, not even the slightest scuff. Her feet weren't touching the ground, a finger's breadth gap between the soles of her boots and the rough dirt. What had Grandmother said? Illusion may make us see what is not there. "Who are you?" Naiva repeated recklessly, her hands grimly clutching the haft as she leveled her spear at the woman, who was still descending with that eerie glide. "You aren't Mevra. You're no kin of mine." The pregnant woman halted. She blinked in a long slow lowering and raising of eyelids that seemed to turn the day to dusk. Then she smiled, a little too widely, a little too brightly, a little too warmly. "A wise fledgling, to be so observant. Where is Yasova?" "Not here, as you can see for yourself," said Naiva stoutly, although she felt dizzy with the effort of staying upright. "Who are you? You're not Mevra. Your feet aren't even touching the ground." "A clever one!" The pregnant woman's laughter filled the canyon, echoing off its high walls until Naiva fell to her knees and, dropping her spear, clapped her hands over her ears. The laughter cracked as the woman's smile widened, curling back around her head, mouth splitting as if cut by a blade to expose her throat, lips peeling away to consume her head and then her shoulders and then she turned inside out in a horrific distortion of birth. But what emerged from the melting body of the woman twisted and stretched, growing as voraciously as if this new being wished to consume the very heavens. A dragon unfolded out of the illusion, so magnificent a creature that the memory of Atarka's might seemed paltry in comparison. He was so big he blocked the sun, allowing its light to limn his form on either side so he shone. Rainbows refracted around him, spilling arcs of color across the sky as if in celebration of his arrival. In shock Naiva stared up at the curved horns familiar to her from the strange memories she'd shared inside the hedron. A gleaming, egg-shaped gem floated between the horns, turning slowly, mesmerizing. #figure(image("006_Chronicle of Bolas: A Familiar Stranger/11.jpg", width: 100%), caption: [Gem of Becoming | Art by: <NAME>], supplement: none, numbering: none) "All will be well now," said the dragon in his soft, beguiling voice. "You are safe now, little Naiva. All your troubles will be solved. Everything you have always wanted will become yours for as long as you live. Trust me. I just need one thing. One little thing." Never would she bow. Never would she cringe. Never. "What do you want?" "I want Ugin." "Ugin is dead." "That's what I thought the first time I killed him, but he wasn't dead after all. This time I've returned to make sure of it. You are the indomitable hunter, soon to be renowned as the mightiest of all dragon killers, who is going to help me destroy him for all eternity."
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/content_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test images and font fallback. #let monkey = move(dy: 0.2em, image("/assets/files/monkey.svg", height: 1em)) $ sum_(i=#emoji.apple)^#emoji.apple.red i + monkey/2 $
https://github.com/rickysixx/unimore-informatica
https://raw.githubusercontent.com/rickysixx/unimore-informatica/main/metodologie-sviluppo-software/riassunto_metodologie_sviluppo_software.typ
typst
#set page(paper: "a4") #set par(leading: 0.55em, justify: true, linebreaks: "optimized") #set text(font: "New Computer Modern", lang: "it") #set heading(numbering: "1. ") #show par: set block(spacing: 1em) #show raw: set text(font: "Courier New", size: 11pt) #show raw.where(block: false): box.with( fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt ) #show heading.where(level: 1): it => { pagebreak(weak: true) it } #set page( footer: context [ #set text(10pt) #table( stroke: none, columns: (1fr, 1fr, 1fr), align: (left, center, right), inset: (x: 0pt, y: 5pt), [#link("https://github.com/rickysixx/unimore-informatica")[#text(fill: blue)[rickysixx/unimore-informatica]]], [Metodologie di sviluppo software], [a.a. 2023-2024] ) #set align(center) #counter(page).display( "1 of 1", both: true, ) ] ) #outline( indent: auto ) = Modelli e metodologie Attività principali del processo di sviluppo di un software: + raccolta e definizione dei *requisiti*; + design dell'architettura; + implementazione; + *test* e validazione; + *manutenzione* ed evoluzione Un *modello* di sviluppo del software è una *rappresentazione astratta* del processo. I modelli più noti sono: - modello a cascata - *separa chiaramente* le varie attività del processo; - component-based - si cotruisce il sistema mettendo insieme vari componenti - modelli *iterativi* - modello evolutivo - modello incrementale - transformational model == Modello a cascata #figure( image("assets/0a79073b28bd66c0d2305d3893839c01.png"), caption: [Modello a cascata] ) #figure( table( columns: (auto, auto), align: (left, left), [*Vantaggi*], [*Svantaggi*], [ - le fasi del processo sono *ben definite*; - è facile *stimare i costi*; - si può adattare a qualunque tipologia di progetto ], [ - poca flessibilità, le fasi sono definite in modo molto rigido; - questa rigidità rende questo modello molto problematico in caso di *cambiamenti* (es. ai requisiti) ] ), caption: [Vantaggi e svantaggi del modello a cascata] ) #pagebreak(weak: true) == Modello component-based Si mettono insieme *componenti già esistenti*. Nonostante il vantaggio (teorico) dovuto al *risparmio di tempo* perché si riciclano componenti già esistenti, questo modello è raramente utilizzato nel mondo reale per una serie di svantaggi: - è molto difficile riuscire a riciclare componenti già esistenti per scopi diversi da quelli per cui sono stati pensati; - ci sono frequenti *problemi d'integrazione*; - le specifiche devono essere riadattate ai componenti già esistenti (quando dovrebbe essere il contrario) == Modelli iterativi A differenza dei modelli precedenti, i modelli iterativi eseguono *più volte* la stessa attività. L'obiettivo è rendere il processo meno rigido e dunque più resistente ai cambiamenti che avvengono in corso d'opera. Lo svantaggio principale di questi modelli è che non si ha una visione ben chiara della *fine*, dunque è *difficile stimare i costi*. === Modello evolutivo #figure( image("assets/2e1bb8a1530d4a35ee7d8ddb1c36a7b7.png", height: 40%), caption: [Modello evolutivo] ) Il progetto si *evolve nel tempo*: + si parte da un *prototipo piccolo*; + si valida il prototipo; + si estende il prototipo precedente, si valida e così via I prototipi devono essere *usa e getta*, in modo da poter riadattare lo sviluppo in caso di cambiamenti nei requisiti. Questo modello si presta bene nei casi in cui il progetto viene fatto su *sistemi già noti* al team di sviluppo. Può essere usato anche per sviluppare *piccole parti* di un sistema più grande. === Modello incrementale #figure( image("assets/9150cd6723b46717eca2fa56f154414a.png"), caption: [Modello incrementale] ) + ad ogni requisito è associata una *priorità*; + il progetto viene costruito requisito per requisito, in ordine di priorità, in modo incrementale; Al termine di ogni incremento si esegue sempre una fase di *verifica*. Questo modello permette al cliente di avere il prima possibile le funzionalità a cui tiene di più. === Modello evolutivo vs modello incrementale Nel modello evolutivo si parte da un *prototipo base* e si raffina sempre di più il risultato, fino ad ottenere il prodotto finale. Nel modello incrementale invece ogni incremento si considera come *già definitivo* (salvo cambiamenti nei requisiti ovviamente). #figure( image("assets/b2abf51d67d4cbba806316724a605de8.png", height: 31%), caption: [Modello evolutivo vs modello incrementale (by <NAME>)] ) == Transformational model Modello *teorico* che si basa su *metodi formali* per: + raccogliere requisiti; + trasformare i requisiti in codice Questo modello rende gran parte del processo di implementazione *automatico*, ma è molto difficile da implementare nel mondo reale. == Confronto tra i modelli #figure( image("assets/823c03f230747a0dc8e4a9488e466567.png"), caption: [Confronto tra i modelli di sviluppo] ) == Unified process (UP) Si tratta di un vero e proprio *standard industriale*, nato negli anni '60. Di fatto è un *modello iterativo* (incrementale). Ogni incremento può essere: - additivo (si *aggiungono* funzionalità); - perfettivo (si perfezionano funzioalità già esistenti) Questo modello prevede di fare una *release* al termine di ogni iterazione. #figure( image("assets/4ecd2b5b28b3f9ebaad56d99eec0c452.png"), caption: [Fasi di unified process] ) UP ha gettato le basi di quelle che saranno poi le *metodologie agile*. = Agile Motivi per cui è nato: - rigidità dei modelli di sviluppo usati al tempo (2001); - si perdeva molto tempo nella produzione di documenti non tecnici (liste di requisiti, documentazione, specifiche, ecc.) che poi si rivelavano totalmente inutili (sia perché i requisiti cambiano in corso d'opera, sia perché molto spesso ci si accorge che alcune specifiche concordate all'inizio successivamente diventano non più rilevanti) L'idea alla base di agile è che lo sviluppo di software è un *lavoro creativo* in cui la *comunicazione* è fondamentale, perciò i modelli industriali non sono utilizzabili. == Agile manifesto - *individuals* and *interactions* over processes and tools; - *working software* over comprehensive documentation; - *customer collaboration* over contract negotiation; - *responding to change* over following a plan == 12 principi agile + *soddisfare il cliente* ha la massima priorità; + accettare i *cambiemtni*; + effettuare *rilasci frequenti*; + business e sviluppatori devono *lavorare insieme*; + dare ad ogni individuo tutti gli strumenti di cui ha bisogno per portare a termine il lavoro; + preferire discussioni faccia a faccia piuttosto che lunghe pagine di documentazione; + il progresso del progetto si misura in termini di *software che funziona*; + i processi agile devono promuovere uno *sviluppo sostenibile* del progetto (non si deve andare di corsa); + si presta attenzione sia al design che alla parte tecnica; + si prediligono *soluzioni semplici*; + si prediligono team auto-organizzati, cioè in cui il lavoro da fare viene gestito autonomamente dal team; + si effettuano *riflessioni periodiche* al fine di migliorare il proprio lavoro == Metodologie agile - test-driven development (TDD); - pair programming; - refactoring; - cross-functional team; - timeboxing; === Pair programming Il *driver* scrive il codice, mentre il *navigator* controlla e suggerisce. I ruoli vengono scambiati frequentemente. Studi hanno dimostrato che a fronte di una riduzione del 15% della velocità di sviluppo, fare uso di pair programming *riduce la presenza di bug* nel codice del 50%. #pagebreak(weak: true) === Refactoring Si modifica il codice al fine di renderlo *più semplice da capire* (o da modificare), senza alterarne il comportamento visibile. Quando *non* fare refactoring: - quando il codice è talmente messo male che si fa prima a buttarlo via e riscriverlo da capo; - quando si è un prossimità di una *scadenza* - fare refactoring in questo momento sarebbe inutile perché i benefici si avrebbero *dopo* la scadenza === Cross-functional team Ogni membro del team può svolgere più funzioni. In particolare, la stessa persona può svolgere funzioni diverse in base alle necessità del momento. Questo permette alle persone di *lavorare in parallelo*. In questi team non c'è un "capo" che assegna ad ognuno le attività da svolgere, ma ognuno si auto-organizza. === Timeboxing Si definisce un *tempo prestabilito* per portare a termine un'attività. Permette di definire in anticipo e con chiarezza i costi, ma non è sempre applicabile. === User stories Una user story è una descrizione di quello che un utente si aspetta di fare con un software. Permettono di raccogliere requisiti in modo *rapido e informale* direttamente dagli utenti. Le user stories sono derivate dagli *epic*, che definiscono un requisito in modo più generale. Le user stories non sono da confondere con gli *use case*: - una user story descrive cosa l'utente vuole dal software; - uno user case rappresenta una generica *interazione* tra il sistema e l'utente In particolare gli use case *non definiscono i risultati* che l'utente vuole, ma solo il funzionamento dell'interazione col sistema. #figure( table( columns: (auto, auto), align: (left, left), [*Vantaggi*], [*Svantaggi*], [ - incentivano l'*interazione* (attività fondamentale nelle metodologie agile) tra utenti e sviluppatori; - facilitano la raccolta dei requisiti ], [ - i requisiti raccolti possono essere *molto vaghi*, perché provengono direttamente dagli utenti; - difficile raccogliere *requisiti non funzionali* (es. di sicurezza o di performance) ] ), caption: [Vantaggi e svantaggi delle user stories] ) == Successo e problematiche delle metologie agile Le metodologie agile non sono adatte a tutti i contesti. In particolare si evidenzia come queste funzionino peggio su *progetti grandi* e/o con team di sviluppo *distribuiti* (che porta quindi ad avere *meno interazione*). Per funzionare, le metodologie agile devono essere applicate bene e per farlo è richiesta *molta esperienza*. Sono quindi poco adatte a contesti in cui la maggior parte del team è inesperto. = Metodologie agile == Agile Unified Process Deriva dalla metodologia Unified Process. Nella versione agile, le iterazioni durano meno e i rilasci sono più frequenti. Principi: - semplicità; - aderenza ai principi e ai valori agile; - *indipendenza dai tool*; == Scrum Il processo di sviluppo del software viene diviso in iterazioni chiamate *sprint*, ciascuna lunga 4 settimane circa. Al termine di ogni sprint si ha un *prodotto funzionante*. Nella fase di design si raccoglie una *lista sintetica* di requisiti, es. tramite user stories. #figure( table( columns: (auto, 1fr), align: (center + horizon, left + horizon), [*product owner*], [ - interagisce con gli *stakeholders*; - prende le decisioni *strategiche* (decide cosa fare, ma non come farlo); ], [*scrum master*], [ - ha un ruolo manageriale; ], [*team di sviluppo*], [ - è auto-organizzato e multi-funzionale; - prende le decisioni operative (decide come realizzare un'attività lato implementativo) ] ), caption: [Ruoli scrum] ) === Meetings Come in tutte le metodologie agile, anche in scrum si dà molta importanza alla comunicazione face-to-face. Per questo motivo sono previste diverse tipologie di meeting. ==== Sprint planning Si fa all'inizio dello sprint per definire le attività che il team di sviluppo deve realizzare nello sprint stesso. L'elenco prodotto in questo meeting prende il nome di *sprint backlog*. A questo metting partecipano *tutti i ruoli* di scrum. ==== Daily scrum Come dice il nome, si tratta di un incontro fatto *ogni giorno* durante lo sprint. Si parla di: - cos'è stato fatto nel giorno precedente; - cosa si farà oggi; - quali problemi sono stati riscontrati e quali si prevedono di dover affrontare L'obiettivo di questo meeting è *esporre i problemi* a tutti i membri del team. Non è invece compito di questo meeting cercare di *risolvere* i problemi evidenziati. Tutti i ruoli scrum partecipano a questo meeting. ==== Backlog grooming Si valutano i requisiti contenuti nel backlog, ad esempio in caso di un cambiamento. Questo meeting è riservato ai membri del team di sviluppo. === Scrum of scrum Si utilizza per avere una comuicazione *inter-team*. All'incontro partecipa 1 persona per ogni team. === Sprint review Si mostrano i *risultati* dello sprint al cliente e agli stakeholders. Tutte le persone coinvolte partecipano al meeting. === Sprint retrospective Si valuta cos'è stato fatto nello sprint precedente, quali sono stati i punti di forza e debolezze, al fine di migliorare il proprio modo di lavorare. A questo meeting partecipano lo scrum master e i membri del team di sviluppo. == Scrum artifacts === Product backlog Lista di requisiti del prodotto, *ordinata per priorità*. È compito del product owner date una priorità ad ogni requisito. Gli elementi di questa lista vengono chiamati *product backlog items*. Tutti possono *leggere e modificare* questa lista, ma è il product owner che ha il compito di gestirla. Questo elenco rappresenta sostanzialmente *quello che c'è ancora da fare* per portare a termine il progetto. === Sprint backlog Elenco di attività da completare *entro lo sprint corrente*, derivato dal product backlog. Ogni attività è divisa in *task*. Idealmente, ogni task dev'essere portato a termine entro un giorno lavorativo. I membri del team *prendono autonomamente i task*, non gli vengono assegnati da qualcuno. Per tenere traccia dei vari task si usa una *task board*. === Increment Somma di tutti i product backlog items completati durante lo sprint corrente e quelli precedenti. In altre parole: cos'è stato fatto finora (a partire dall'inizio del progetto). === Burn down Grafico che mostra il *lavoro rimanente* per portare a termine il progetto: - backlog nell'asse $y$; - tempo nell'asse $x$ #pagebreak(weak: true) == Feature-driven development L'attività di sviluppo si divide in 5 attività, basate sulle *funzionalità* che devono essere implementate: + si definisce un modello generale, che dev'essere *completo quanto basta* per poter cominciare il lavoro (non serve che sia perfetto); + si costruisce una *feature list* - ad ogni feature viene associato un *business value*; - ogni feature dev'essere indicata nela forma `<azione>` $->$ `<risultato>` $->$ `oggetto` (es. `calcola il totale della fattura`); - la feature list viene costruita in modo *collaborativo*; - si adotta *timeboxing* (non più di due settimane per completare la feature list); + pianificazione by feature - ogni feature viene assegnata ad un *chief programmer*, che ne diventa responsabile - il chief programmer divide il lavoro da fare in task ed assegna ogni task ad un programmatore + design by feature - si costruisce il design della feature da implementare; - il chief programmer definisce l'elenco di feature da realizzare nell'iterazione corrente + sviluppo Le fasi 1, 2 e 3 vengono fatte *una sola volta*, all'inizio dell'iterazione, mentre le fasi 4-5 vengono ripetute più volte nella stessa iterazione. Ognuna di queste fasi produce un *artifact* che permette di passare alla fase successiva. == Dynamic System Development Model Evoluzione agile del modello RAD (Rapid Application Development). Si basa su *poca pianificazione* e *rapido sviluppo*. È un modello di tipo *iterativo incrementale*. Tutte le modifiche fatte in fase di sviluppo devono essere *reversibili*, in modo da adattarsi ad eventuali cambiamenti. Applica la *regola 80/20*: l'80% del software è costituito dal 20% dei requisiti. #figure( image("assets/4516919ac6e0b7a216ae2c53881be5a7.png", height: 34%), caption: [Fasi di DSDM] ) La fase iniziale di studio prevede sia uno *studio di fattibilità* (per stimare i costi e i rischi), sia un *business study* per capire i requisiti principali del progetto. Per stabilire le priorità dei requisiti si usa l'*approccio MoSCoW*. Ogni requisito rientra in una categoria fra: - *must*: la funzionalità è indispensabile; - *should*: la funzionalità deve esserci, ma non è il core del progetto; - *could*: la funzionalità può essere inserita solo se non interferisce con altre funzionalità più importanti; - *won't*: la funzionalità *non deve esserci* nel progetto. In futuro si potrebbe riconsiderare questa scelta. == Extreme programming 2 obiettivi principali: + organizzare il lavoro in modo da produrre *software di qualità* nel *minor tempo possibile*; + ridurre i costi dovuti a *cambiamenti nei requisiti* Le attività principali di XP sono: + codicng - secondo XP, *il codice è l'unica cosa che conta* e dev'essere usato anche come forma di *comunicazione* + testing; + ascolto dei *feedback* da parte del cliente e degli utenti; + design in caso di progetti particolarmente complessi XP si basa su una serie di *valori* (comunicazione, semplicità, feedback, coraggio e rispetto). In XP il cliente viene considerato *parte del team* e definisce sia gli obiettivi che le *priorità* del progetto. Ogni membro del team dev'essere in grado di *misurare il progresso* del proprio lavoro rispetto agli obiettivi. Nel proprio metodo di lavoro, XP adotta diversi principi importanti: - YAGNI (You Aren't Gonna Need It): si scrive solo il codice strettamente indispensabile per implementare una funzionalità; - collective ownership: tutto il codice è di tutti, in particolare chiunque può modificare il codice scritto da chiunque altro - *continuous integration*: le nuove modifiche al codice devono essere integrate il prima possibile nella code base; - le release devono essere *piccole e frequenti*. Il cliente dev'essere in grado di misurare il progresso del progetto tramite le release. == Agile modeling Nonostante le metodologie agile si concentrino più sulla parte di codice, anche il *design* è un aspetto fondamentale dello sviluppo agile. Il design agile è basato sui soliti principi: - semplicità, comunicazione, feedback rapido (lavorando a stretto contatto col cliente); - massimizzazione del ROI per gli stakeholders - avere come obiettivo un *software funzionante*; - le modifiche devono essere *incrementali* e reversibili L'agile modeling usa la tecnica del *model storming*: quando si ha un problema si coinvolgono le altre persone. La modellazione dev'essere *sufficiente quanto basta* per realizzare il task che si ha in carico. No ad over-engineering. La modellazione dev'essere fatta *in anticipo* rispetto al punto in cui si trovano gli sviluppatori, in modo da prepararsi a problemi che possono sorgere. #figure( table( columns: (auto, auto), align: (center + horizon, left + horizon), [*document late*], [ - si documenta tutto alla fine; - permette di procedere rapidamente con gli sviluppi, ma si avrà un grosso picco alla fine a causa della documentazione da scrivere ], [*document continuously*], [ - si documenta man mano; - permette di avere un ritmo più costante e senza picchi ] ), caption: [Approcci alternativi per gesitre la documentazione con agile modeling] ) == Confronti tra i modelli agile #figure( image("assets/832b1e91af6d8d26ef6abea7c0553330.png"), caption: [Tecniche agile utilizzate] ) #figure( image("assets/7abcf5acb5fa50f62a468cd912ee866a.png"), caption: [Attività della fase di sviluppo] ) #figure( image("assets/18c1d9b3992d97207413b109611e3120.png"), caption: [Attività della fase di design] ) = Project estimation Obiettivo: stimare il tempo necessario per completare il software, sia per la parte di sviluppo che per tutte le altre fasi. Queste stime ci interessano perché i costi di un progetto sono proporzionali al tempo impiegato per realizzarlo. Si indica con $t_d$ il *delivery time*, ovvero il tempo necessario per consegnare il prodotto al cliente. I *cost driver* sono dei fattori che influiscono sul costo del progetto. I requisiti sono un chiaro esempio di cost driver. L'attività di stima può dare altre informazioni utili oltre al tempo, quali: - effort necessario (quanto il team deve correre); - personale necessario (skill richieste, numero di persone da coinvolgere); - GANNT chart e person-month chart Spesso nel mondo software si usa un *falso mito*: più persone che ci lavorano e meno è il tempo richiesto. Questo mito è ovviamente falso perché non tiene conto del fatto che sviluppare software è un *lavoro creativo*. È importante stimare anche i costi *post-development*: - manutenzione; - assistenza tecnica; - *service level agreement* (SLA) == Modello algoritmico La stima è fatta da un *algoritmo* che considera molti fattori (dimensioni del progetto, tipologia, costi precedenti per progetti simili, ecc.). #figure( table( columns: (auto, auto), align: (left, left), [*Vantaggi*], [*Svantaggi*], [ - molto accurato; - indipendente da eventuali contingency; ], [ - per essere accurato richiede *tanti* dati; - il caolcolo è molto complesso ] ), caption: [Vantaggi e svantaggi del modello algoritmico] ) == Approccio guru La stima è a carico di un esperto ("guru"), che la fa sostanzialmente in base alla propria *esperienza*. Questo approccio costa molto poco, ma ha lo svantaggio di essere un metodo *empirico* e potenzialmente *poco accurato* (se l'esperto non è un vero esperto). == Stima per analogia Si cerca di confrontare il progetto da stimare con altri progetti realizzati precedentemente, in modo da capirne i costi. Naturalmente è impraticabile quando non si hanno progetti confrontabili con cui comparare i dati. == Legge <NAME> Il progetto costa esattamente quanto *tutte le risorse disponibili*: se si hanno 6 mesi di tempo, il progetto costerà 6 mesi di tempo. Nel mondo reale questa tecnica è poco utilizzabile, perché le risorse stabilite all'inizio si rivelano spesso *insufficienti*. == Pricing to win Il progetto costa tanto quanto il cliente è disposto a pagare. Rispetto alle altre tecniche, questa prevede un *contratto ben definito* con il cliente. Questo approccio è il meno soddisfacente per il cliente, che molto probabilmente si ritroverà con un sistema che non lo soddisfa. Quello che il cliente può/vuole pagare non sempre riflette bene i costi del progetto. == Come si procede nella pratica Se ci sono dati a disposizione si usa l'approccio algoritmico, altrimenti si va di price to win. Le altre tecniche sono difficilmente realizzabili nel mondo reale. In generale è bene usare *modelli diversi* per la stima, in modo da confermare i costi. Se ogni modello dà valori totalmente diversi dagli altri, allora l'unica strada percorribile è la tecnica price to win. == Top-down e bottom-up Il progetto può essere stimato con un approccio top-down o bottom-up: - l'approccio top-down permette di considerare anche i *costi d'integrazione* delle varie sotto-componenti, ma potrebbe sottostimare i costi per la realizzazione del sotto-componente; - viceversa, l'approccio bottom-up è molto preciso nello stimare i costi dei singoli sotto-componenti, ma può essere impreciso nello stimare i costi di integrazione == Metriche nella project estimation === Linee di codice Sono molto facili da calcolare, anche se non c'è una definizione precisa su cosa sia una linea di codice (es. vanno considerati i commenti? come si considera una linea di codice che contiene più statement?). È una metrica molto utilizzata. === Token Anziché le righe di codice, si considerano dei generici *token* (es. operandi e/o operatori). Questo permette di considerare costi diversi per linee di codice diverse. === Function points Partendo dai *requisiti funzionali* del progetto, lo si divide in componenti più piccole facili da stimare. I fattori che determinano il costo di ogni componente sono 4: - dati di input, output e di input/output; - tipologie di file; - interfacce Il valore function point risultante si calcola come: $ F_p = a dot "inputs" + b dot "outputs" + c dot "inquires" + d dot "files" + e dot "interfaces" $ A partire da $F_p$ si calcola una stima della *dimensione del codice* $S$ (in termini di righe di codice). Il calcolo dipende dal linguaggio considerato. #pagebreak(weak: true) === Code complexity Approccio che valuta la complessità del codice da scrivere per implementare il progetto. Un esempio di metrica di questo tipo + la McCabe Cyclomatic Complexity Metrics, che calcola il numero di *percorsi indipendenti* all'interno del codice. == CoCoMo (Constructive Cost Model) Considera 3 tipologie di progetto, che sono determinate sostanzialmente dalla sua *dimensione*: - organic: dimensioni piccole; - semi-detached: dimensioni medie; - embedded: dimensioni grandi L'obiettivo è stimare: - il costo del progetto in *mesi-uomo* ($K_m$); - il time to delivery ($t_d$) Il modello CoCoMo base considera come unico input la dimensione del progetto espressa in migliaia di righe di codice ($S_k$). Una volta calcolato $K_m$, il costo monetario del progetto si calcola moltiplicando $K_m$ per il costo mensile di ogni sviluppatore (5.000€ in Italia). #figure( image("assets/d4be70d5139f933f62e7b8858d4ad540.png", height: 13%), caption: [Formule CoCoMo base] ) Il modello base è molto utile per avere una *rapida* stima dei costi, ma è fortemente limitato dal fatto che non considera molti fattori che possono influire sui tempi di sviluppo. === Intermediate model Oltre alle dimensioni del progetto si considerano anche altri fattori, ad esempio i *requisiti* (sia di prodotto che hardware) e il team coinvolto. I product requirement sono basati su 15 attributi, che sono i cost diver del modello. Ognuno di questi attributi ha un valore che va da "very low" a "very high". Il valore determina il *coefficiente* del cost diver. Per fare il calcolo della stima: + si calcola il costo nominale $K_n$ a partire da $S_k$; + si calcola $K_m$ moltiplicando $K_n$ per la *produttoria* dei coefficienti di ogni cost driver: $ K_m = K_n product c_i $ #figure( image("assets/b7407decad5fbffc46c1de6a3082d119.png", height: 13%), caption: [CoCoMo intermedio] ) === Costo della manodopera Il costo della manodopera non è uniforme per tutta la durata del progetto, ma varia nel tempo (in particolare è minimo all'inizio e alla fine del progetto). === Sottoprogetti Il costo calcolato da CoCoMo si abbassa se il progetto si può dividere in sottoprogetti *indipendenti*. ==== Esempio - $S_k = 60$; - 3 sottoprogetti per cui $S_k_1 = 10$, $S_k_2 = 20$ ed $S_k_3 = 30$ Calcolando il costo del progetto intero, con $S_k = 60$, il risultato è di 294 person-month. Calcolando invece i costi individuali dei 3 progetti e sommandoli poi assieme si ottiene un costo di 261 person-month. === Detailed model Ogni modulo del software viene classificato in modo *estremamente preciso*, scegliendo i cost driver per ogni modulo. L'obiettivo è avere una misura il più accurata possibile. Il calcolo fatto da questo modello è molto complesso, perciò necessita di software specializzati. === CoCoMo 2 La dimensione $S_k$ non si misura più in linee di codice non-commento, ma in linee di codice *logiche*. Questo permette di considerare più righe di codice "fisiche" come una singola riga di codice logica (es. un `if-then-else` viene considerato come una sola riga di codice logica). Aggiunge alcuni cost diver rispetto a CoCoMo 1 e ne modifica di esistenti. CoCoMo 2 considera anche la *volatilità dei requisiti* nei propri calcoli. == PERT (Program Evaluation and Review Techniques) Mostra un elenco di *attività*, ciascuna con le relative *dipendenze* (es. attività `A` dev'essere svolta prima di attività `B`). Fornisce anche una stima della *durata* di ogni attività. Oltre a questo, permette anche di capire: - quali sono le *attività critiche*, cioé che non possono essere prolungate a meno di allungare la durata del progetto; - quali invece sono le attività che si possono allungare (ed entro quali limiti) senza impattare sulla durata del progetto Queste informazioni lo rendono molto utile per capire a che punto del progetto si è durante la fase di sviluppo. Il fattore di cui ogni attività può essere prolungata prende il nome di *slack*. Difetti principali di questa metodologia: - richiede dei calcoli, sebbene non siano complessi; - se il progetto ha *tante* attività potrebbe essere complesso gestire il grafo; - il grafo delle attività *va tenuto aggiornato* durante il progetto #pagebreak(weak: true) === PERT AON diagram Grafo in cui i nodi sono le attività (AON = activity on nodes), mentre gli archi sono le dipendenze tra le varie attività. I punti d'inizio (e di fine) di questo grafo possono essere *più di uno*, il che lo rende poco chiaro e dunque deprecato al giorno d'oggi. Questi grafi vengono chiamati anche CPM charts. === PERT AOA diagram Grafo in cui le attività stanno gli archi. I nodi invece rappresentano l'inizio e la fine di ogni attività. In questo grafo ci sono un solo punto d'inizio ed un solo punto di fine. === Duration estimation PERT permette di stimare la durata di ogni attività partendo da 3 valori: - $"to"$: tempo *ottimistico*; - $"tm"$: tempo "*most likely*"; - $"tp"$: tempo *pessimistico* A partire da questi valori si calcola il *tempo previsto* $"te"$ come $ "te" = frac("to" + 4 dot "tm" + "tp", 6) $ === CPM (Critical Path Method) Permette di calcolare la *durata del progetto* a partire dalla durata di ciascuna attività e dalle *dipendenze* tra le attività. Ogni attività (archi del grafo) ha una certa durata, mentre gli eventi (i nodi del grafo) hanno un *tempo minimo* e un *tempo massimo*, indicati rispettivamente con $t_"min"$ e $t_"max"$. Per calcolare il tempo minimo: + si parte dal nodo di partenza, che ha $t_"min" = 0$; + per gli altri nodi, il tempo minimo è pari alla *somma* del tempo minimo del *predecessore* e dell'arco che li collega. Se il nodo ha più di un predecessore, si esegue questo calcolo per ognuno di essi e si prende il *valore massimo* ottenuto Il calcolo del $t_"max"$ invece è speculare: + si parte dal nodo di fine del grafo, che ha $t_"max" = t_"min"$; + per gli altri nodi, il tempo massimo è pari alla *differenza* tra il tempo massimo del successore e dell'arco che li collega. Se il nodo ha più di un successore, si esegue questo calcolo per ognuno di essi e si prende il *valore minimo* ottenuto Una volta calcolati il tempo minimo e massimo di ogni attività (indicati rispettivamente con $t_"min"$ e $t_"max"$), il *critical path* è il percorso che ha $t_"min" = t_"max"$ per ogni nodo. In altre parole è il percorso il cui costo è il *massimo possibile* tra tutti i possibili percorsi del grafo. Una volta calcolato il critical path, lo *slack* dell'$i$-esimo percorso del grafo è dato dalla *differenza* tra il costo del critical path e quello dell'$i$-esimo percorso (il costo del percorso si calcola come somma di tutti gli archi). Questo valore esprime di quanto si possono allungare le attività non-critiche senza impattare sulla durata complessiva del progetto (che è invece impattata dalle attività che stanno nel critical path). #pagebreak(weak: true) ==== Esempio 1 #align(center)[ #image("assets/87a76531a53e7acb37cc5d778c18039e.png") ] #figure( table( columns: (auto, auto, auto), align: (center + horizon, left + horizon, left + horizon), [Nodo], [Tempo minimo], [Tempo massimo], [1], [0], [4 - 4 = 0], [2], [0 + 4 = 4], [9 - 5 = 4], [3], [4 + 5 = 9], [13 - 4 = 9], [4], [4 + 3 = 7], [13 - 4 = 9], [5], [9 + 4 = 13], [15 - 2 = 13], [6], [13 + 2 = 15], [15] ), caption: [Calcolo dei tempi minimi e massimi] ) - per calcolare il $t_"min"$ del nodo 5 si sceglie l'arco $(3, 4)$ perché è quello che produce il costo massimo tra i 2 archi entranti del nodo 5; - la scelta dell'arco per il $t_"max"$ del nodo 2 invece è indifferente, perché il risultato è sempre 4 sia scegliendo l'arco $(2, 3)$ che scegliendo l'arco $(2, 4)$ #figure( table( columns: (auto, auto, auto), align: (left + horizon, center + horizon, center + horizon), [*Percorso*], [*Costo*], [*Critical path*], [$A -> B -> D -> F$], [15], [x], [$A -> C -> E -> F$], [13], [] ), caption: [Calcolo del critical path] ) Slack = 15 - 13 = 2, distribuibile tra le attività non critiche C ed E. #pagebreak(weak: true) ==== Esempio 2 #align(center)[ #image("assets/73bd6916a1fa0e6bc0ebdae497bf93a6.png") ] #figure( table( columns: (auto, auto, auto), align: (center + horizon, center + horizon, center + horizon), [Nodo], [Tempo minimo], [Tempo massimo], [1], [0], [17 - 17 = 0], [2], [0 + 17 = 17], [28 - 11 = 17], [4], [17 + 11 = 28], [31 - 3 = 28], [3], [28 + 3 = 31], [36 - 5 = 31], [5], [31 + 5 = 36], [44 - 8 = 36], [6], [36 + 8 = 44], [64 - 20 = 44], [7], [44 + 20 = 64], [64] ), caption: [Calcolo dei tempi minimi e massimi] ) - per il calcolo del $t_"min"$ del nodo 3 si sceglie l'arco $(4, 3)$; - per il calcolo del $t_"max"$ del nodo 2 si sceglie l'arco $(2, 4)$ #figure( table( columns: (auto, auto, auto), align: (left + horizon, center + horizon, center + horizon), [*Percorso*], [*Costo*], [*Critical path*], [$A -> B -> E -> F -> G$], [60], [], [$A -> C -> D -> E -> F -> G$], [64], [x] ), caption: [Calcolo del critical path] ) Slack = 64 - 60 = 4, distribuibile solo sull'attività B (l'unica che non fa parte del critical path). #pagebreak(weak: true) ==== Esempio 3 (calcolo del critical path) #align(center)[ #image("assets/bb4967c7e578a497eee3c34065b55eff.png") ] #figure( table( columns: (auto, auto, auto), align: (center + horizon, center + horizon, center + horizon), [Nodo], [Tempo minimo], [Tempo massimo], [1], [0], [4 - 4 = 0], [2], [0 + 4 = 4], [10 - 6 = 4], [3], [4 + 6 = 10], [27 - 15 = 12], [4], [4 + 8 = 12], [30 - 18 = 12], [5], [10 + 15 = 25], [30 - 3 = 27], [6], [12 + 18 = 30], [35 - 5 = 30], [7], [30 + 5 = 35], [35] ), caption: [Calcolo dei tempi minimi e massimi] ) - per calcolare il $t_"min"$ del nodo 6 si sceglie l'arco $(4, 6)$; - per calcolare il $t_"max"$ del nodo 2 la scelta dell'arco è indifferente, perché sia con $(2, 3)$ che con $(2, 4)$ il risultato è sempre 4 #figure( table( columns: (auto, auto, auto), align: (left + horizon, center + horizon, center + horizon), [*Percorso*], [*Costo*], [*Critical path*], [$A -> B -> D -> F -> G$], [33], [], [$A -> C -> E -> G$], [35], [x] ) ) Slack = 35 - 33 = 2, distribuibile sulle attività non critiche ${B, D, F}$. = DevOps Il motivo per cui DevOps è nato è la crescente complessità del processo di sviluppo software. Concetti alla base: - collaborazione; - offuscamento delle *responsabilità*: lo sviluppatore ora non è più responsabile solo della parte di sviluppo, ma anche della parte di testing, release, deploy e mantenimento - si raggruppa in un unico ruolo quello che precedentemente era svolto da 3 ruoli distinti (sviluppatori, tester e operations) Se applicata correttamente, DevOps permette di *ridurre il time to market*. Il concetto di "offuscamento delle responsabilità" si esprime anche come "rompere i silos" che ci sono tra il team di sviluppo e il team di operations. #figure( image("assets/732d37299390febacb8866eb5cf1f614.png", height: 32%), caption: [DevOps riassunto in un'immagine] ) DevOps ha diversi difetti: - aggiunge complessità al progetto; - è *costosa* e richiede un *investimento iniziale* che non è detto venga poi ripagato; - non ci sono standard consolidati; == Hardware management DevOps fa uso di data center per gestire l'infrastruttura hardware. Non ci sono più server fisici, ma è tutto in cloud. Questo aiuta ulteriormente a blurrare le responsabilità tra dev ed ops. DevOps fa ampio uso di *hardware virtualizzato*. == Configuration management Dato che hardware e sistema operativo sono flessibili, DevOps introduce delle complessità nella *gestione della configurazione*. Il software può trovarsi a girare in condizioni per cui non è stato pensato, dunque è opportuno che la fase di *testing* sia ben fatta. Esistono dei tool (configuration as code) che rendono più agevole la gestione della configurazione. == DevSecOps Si aggiunge al concetto di DevOps anche quello di *cybersecurity*, in ognuna delle attività. La sicurezza diventa un aspetto a cui *tutto il team* presta costantemente attenzione. == Quality assurance (QA) In DevOps non è più una fase a sè stante, ma la qualità si valida in ogni fase del processo di DevOps. == Step per adottare DevOps + partire da un componente possibilmente semplice; + adottare una metodologia agile (DevOps si adatta bene a scrum); + usare un *version control system*; + integrare il version control system con il sistema di gestione progetto, in modo da avere un *unico punto* da cui tenere sotto controllo tutto il progetto; + scrivere test; + costruire una pipeline CI/CD che: + integra le nuove modifiche nel repository esistente, testandole; + prepara la release; + effettua il deploy della release + aggiungere strumenti di monitoraggio (es. per identificare bug, problemi di performance, system health, ecc.) == CI/CD Insieme di pratiche volte ad *automatizzare* il processo di *integrazione e rilascio* del software: - continuous integration (CI): automatizza l'integrazione di nuovo codice nel repository esistente, eseguendo test automatici; - continuous deployment (CD): automatizza il rilascio del codice, eventualmente anche in ambiente di produzione CI/CD permette agli sviluppatori di rilasciare software più rapidamente. === Continuous delivery vs countinuous deployment Nel continuous delivery ci si occupa solo di *preparare il pacchetto* che verrà poi *installato manualmente* nei vari ambienti. Il continuous deployment invece *automatizza anche il deploy* nell'ambiente di produzione. === CI/CD in DevOps CI/CD riguarda l'aspetto principalmente tecnico (automatizzazione dei processi). DevOps utilizza i concetti di CI/CD, ma è una metodologia più ad alto livello che riguarda anche aspetti *culturali* (favorire collaborazione e comunicazione tra dev ed operations, rompendo i "silos").
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/packages/graphs.md
markdown
MIT License
# Graphs ## `cetz` Cetz comes with quite built-in support of drawing basic graphs. It is much more customizable and extensible then packages like `plotst`, so it is recommended to skim through its possibilities. > See full manual [there](https://github.com/johannes-wolf/cetz/blob/master/manual.pdf?raw=true). <!-- // wait till cetz:0.1.3 is published ```typ #import "@preview/cetz:0.1.2" #import cetz.plot #plot.plot(size: (3,2), x-tick-step: 1, y-tick-step: 1, { let z(x, y) = { (1 - x/2 + calc.pow(x,5) + calc.pow(y,3)) * calc.exp(-(x*x) - (y*y)) } plot.add-contour(x-domain: (-2, 3), y-domain: (-3, 3), z, z: (.1, .4, .7), fill: true) }) ``` --> ```typ #let data = ( [A], ([B], [C], [D]), ([E], [F]) ) #import "@preview/cetz:0.1.2": canvas, draw, tree #canvas(length: 1cm, { import draw: * set-style(content: (padding: .2), fill: gray.lighten(70%), stroke: gray.lighten(70%)) tree.tree(data, spread: 2.5, grow: 1.5, draw-node: (node, _) => { circle((), radius: .45, stroke: none) content((), node.content) }, draw-edge: (from, to, _) => { line((a: from, number: .6, abs: true, b: to), (a: to, number: .6, abs: true, b: from), mark: (end: ">")) }, name: "tree") // Draw a "custom" connection between two nodes let (a, b) = ("tree.0-0-1", "tree.0-1-0",) line((a: a, number: .6, abs: true, b: b), (a: b, number: .6, abs: true, b: a), mark: (end: ">", start: ">")) }) ``` ```typ #import "@preview/cetz:0.1.2": canvas, draw #canvas({ import draw: * circle((90deg, 3), radius: 0, name: "content") circle((210deg, 3), radius: 0, name: "structure") circle((-30deg, 3), radius: 0, name: "form") for (c, a) in ( ("content", "bottom"), ("structure", "top-right"), ("form", "top-left") ) { content(c, box(c + " oriented", inset: 5pt), anchor: a) } stroke(gray + 1.2pt) line("content", "structure", "form", close: true) for (c, s, f, cont) in ( (0.5, 0.1, 1, "PostScript"), (1, 0, 0.4, "DVI"), (0.5, 0.5, 1, "PDF"), (0, 0.25, 1, "CSS"), (0.5, 1, 0, "XML"), (0.5, 1, 0.4, "HTML"), (1, 0.2, 0.8, "LaTeX"), (1, 0.6, 0.8, "TeX"), (0.8, 0.8, 1, "Word"), (1, 0.05, 0.05, "ASCII") ) { content((bary: (content: c, structure: s, form: f)),cont) } }) ``` ```typ #import "@preview/cetz:0.1.2": canvas, chart #let data2 = ( ([15-24], 18.0, 20.1, 23.0, 17.0), ([25-29], 16.3, 17.6, 19.4, 15.3), ([30-34], 14.0, 15.3, 13.9, 18.7), ([35-44], 35.5, 26.5, 29.4, 25.8), ([45-54], 25.0, 20.6, 22.4, 22.0), ([55+], 19.9, 18.2, 19.2, 16.4), ) #canvas({ chart.barchart(mode: "clustered", size: (9, auto), label-key: 0, value-key: (..range(1, 5)), bar-width: .8, x-tick-step: 2.5, data2) }) ``` ### Draw a graph in polar coords ```typ #import "@preview/cetz:0.1.2": canvas, plot #figure( canvas(length: 1cm, { plot.plot(size: (5, 5), x-tick-step: 5, y-tick-step: 5, x-max: 20, y-max: 20, x-min: -20, y-min: -20, x-grid: true, y-grid: true, { plot.add( domain: (0,2*calc.pi), samples: 100, t => (13*calc.cos(t)-5*calc.cos(2*t)-2*calc.cos(3*t)-calc.cos(4*t), 16*calc.sin(t)*calc.sin(t)*calc.sin(t)) ) }) }), caption: "Plot made with cetz",) ``` ## `diagraph` ### Test ```````typ #import "@preview/diagraph:0.2.0": * #let renderc(code) = render(code.text) #renderc( ``` digraph { rankdir=LR; f -> B B -> f C -> D D -> B E -> F f -> E B -> F } ``` ) ``````` ### Eating ```````typ #import "@preview/diagraph:0.2.0": * #let renderc(code) = render(code.text) #renderc( ``` digraph { orange -> fruit apple -> fruit fruit -> food carrot -> vegetable vegetable -> food food -> eat eat -> survive } ``` ) ``````` ### FFT Labels are overridden manually. ```````typ #import "@preview/diagraph:0.2.0": * #let renderc(code) = render(code.text) #renderc( ``` digraph { node [shape=none] 1 2 3 r1 r2 r3 1->2 1->3 2->r1 [color=red] 3->r2 [color=red] r1->r3 [color=red] r2->r3 [color=red] } ``` ) ``````` ### State Machine ```````typ #import "@preview/diagraph:0.2.0": * #set page(width: auto) #let renderc(code) = render(code.text) #renderc( ``` digraph finite_state_machine { rankdir=LR size="8,5" node [shape=doublecircle] LR_0 LR_3 LR_4 LR_8 node [shape=circle] LR_0 -> LR_2 [label="SS(B)"] LR_0 -> LR_1 [label="SS(S)"] LR_1 -> LR_3 [label="S($end)"] LR_2 -> LR_6 [label="SS(b)"] LR_2 -> LR_5 [label="SS(a)"] LR_2 -> LR_4 [label="S(A)"] LR_5 -> LR_7 [label="S(b)"] LR_5 -> LR_5 [label="S(a)"] LR_6 -> LR_6 [label="S(b)"] LR_6 -> LR_5 [label="S(a)"] LR_7 -> LR_8 [label="S(b)"] LR_7 -> LR_5 [label="S(a)"] LR_8 -> LR_6 [label="S(b)"] LR_8 -> LR_5 [label="S(a)"] } ``` ) ``````` ### Clustering > See [docs](http://www.graphviz.org/content/cluster). ```````typ #import "@preview/diagraph:0.2.0": * #let renderc(code) = render(code.text) #renderc( ``` digraph G { subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; } subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=blue } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end; start [shape=Mdiamond]; end [shape=Msquare]; } ``` ) ``````` ### HTML ```````typ #import "@preview/diagraph:0.2.0": * #let renderc(code) = render(code.text) #renderc( ``` digraph structs { node [shape=plaintext] struct1 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR> </TABLE>>]; struct2 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD PORT="f0">one</TD><TD>two</TD></TR> </TABLE>>]; struct3 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR> <TD ROWSPAN="3">hello<BR/>world</TD> <TD COLSPAN="3">b</TD> <TD ROWSPAN="3">g</TD> <TD ROWSPAN="3">h</TD> </TR> <TR> <TD>c</TD><TD PORT="here">d</TD><TD>e</TD> </TR> <TR> <TD COLSPAN="3">f</TD> </TR> </TABLE>>]; struct1:f1 -> struct2:f0; struct1:f2 -> struct3:here; } ``` ) ``````` ### Overridden labels Labels for nodes `big` and `sum` are overridden. ```````typ #import "@preview/diagraph:0.2.0": * #set page(width: auto) #raw-render( ``` digraph { rankdir=LR node[shape=circle] Hmm -> a_0 Hmm -> big a_0 -> "a'" -> big [style="dashed"] big -> sum } ```, labels: (: big: [_some_#text(2em)[ big ]*text*], sum: $ sum_(i=0)^n 1/i $, ), ) ``````` ## `bob-draw` WASM plugin for [svgbob](https://github.com/ivanceras/svgbob) to draw easily with ASCII,. `````typ #import "@preview/bob-draw:0.1.0": * #render(``` /\_/\ bob -> ( o.o ) \ " / .------/ / ( | | `====== o o ```) ````` `````typ #import "@preview/bob-draw:0.1.0": * #show raw.where(lang: "bob"): it => render(it) #render( ``` 0 3 *-------* 1 /| 2 /| *-+-----* | | |4 | |7 | *-----|-* |/ |/ *-------* 5 6 ```, width: 25%, ) ```bob "cats:" /\_/\ /\_/\ /\_/\ /\_/\ ( o.o )( o.o )( o.o )( o.o ) ``` ```bob +10-15V ___0,047R *---------o-----o-|___|-o--o---------o----o-------. + | | | | | | | | -===- _|_ | | .+. | | | -===- .-. | | | | 2k2 | | | -===- 470| + | | | | | | _|_ - | uF| '--. | '+' .+. | \ / LED +---------o |6 |7 |8 1k | | | -+- ___|___ .-+----+--+--. | | | | -═══- | | '+' | | - | |1 | |/ BC | GND | +------o--+ 547 | | | | |`> | | | ,+. | | .-------+ | 220R| | o----||-+ IRF9Z34 | | | | | | |+-> | | MC34063 | `+' | ||-+ | | | | | | BYV29 -12V6 | | | '----' o--|<-o----o--X OUT 6000 micro - | + | |2 | | | Farad, 40V ___|_____ | |--o C| | | Capacitor ~ ~ ~ ~ ~ | | GND 30uH C| | --- 470 | | |3 1nF C| | ### uF | | |-------||--. | | | + | '-----+----+-' | GND | GND | 5| 4| | | | | '-------------o-------------o | | ___ | `-------------*------/\/\/------------o--|___|-' 2k | 1k0 .+. | | 5k6 + 3k3 | | in Serie '+' | GND ``` ````` ## `wavy` ## `finite` Finite automata. See the [manual](https://github.com/jneug/typst-finite/blob/main/manual.pdf) for a full documentation. ```typ #import "@preview/finite:0.3.0": automaton #automaton(( q0: (q1:0, q0:"0,1"), q1: (q0:(0,1), q2:"0"), q2: (), )) ```
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/057%20-%20Bloomburrow/003_Episode%203%3A%20The%20Lost%20and%20the%20Found.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 3: The Lost and the Found", set_name: "Bloomburrow", story_date: datetime(day: 03, month: 07, year: 2024), author: "<NAME>", doc ) #strong[Helga] Amid great fanfare, sorrowful farewells, and yet another speech by Oliver about heroes embarking on a brave mission, the party departed for Pondside. Helga had slept poorly, desperate to return home and terrified about what she might find. #emph[Would the villagers be combing through rubble, rebuilding homes, preparing communal meals from scavenged crops and fish? Had the destruction been less devastating than she imagined amid the confusion and terror of the Night Owl's attack?] Would she be thanked for running to find help, or condemned for leaving? The pleasant weather contrasted with her inner turmoil. Sunlight warmed Helga's dew-moistened skin, cotton-fluff clouds providing sporadic shade. Orderly fields of beets, carrots, mustard, and turnips yielded to wilder meadows of bluebell, cornflower, and kingcup. Long grasses arched overhead, wafting in the breeze, and dandelion seeds drifted on their own inscrutable errands. Mabel plotted a creek-side path using a star charted map supplied by Zoraline, the dark-furred batfolk. Hugs, the badgerfolk with handsome white stripes, lumbered along with Zoraline hanging upside down from his back. Gev, the lizardfolk, scampered beside him, and Finneas, the sable rabbitfolk, brought up the rear, eyes bright with interest in his surroundings. Helga was the odd stranger, a role she didn't relish any more than being the awkward dreamer. "So, Helga," Finneas asked, ambling up next to her. "What's your story?" "About the Calamity Beast?" Helga asked. "No, your life! Tell us about yourself, from root to fruit." "Oh." Helga rubbed her arm. "I was born near Three Tree City, in a pond that dried up one summer, so my family moved near the Willow. My father's parents found it too crowded, so they went to Pondside. I followed them." "Must have been quite a change. Did you miss everyone you left behind?" "Yes," Helga replied, surprising herself. "But I loved living with my Granfer and Granmer. They encouraged my drawing and magical studies. The rest of my family … I was tired of disappointing them." "Can't please everyone. Some stems grow straight, some grow crooked, but they all taste fine in a stew." He chuckled at his own joke. "You studied weaving, you said? With <NAME> himself?" "I did." "Can you do the spell where you make a whirlwind of leaves and toss yourself into the air? Or open a pit in the ground that swallows a folk up and smooths the dirt back atop like it never left?" "N-no, I can't do any of that." She'd mastered the most interesting cantrips, but more complicated weaving eluded her. Then, too, she was a little afraid of the stories about weavers corrupted by their magic and turned into mindless monsters. She didn't want to become one of them, though the prospect seemed unlikely. Especially after the mistake that made <NAME> send her away. "Stop interrogating her, Finneas," Mabel said, her tone light. "Why not tell her about yourself?" Finneas scoffed. "I'm just a simple farmer. My parents were farmers, and their parents, on and on back as far as anyone knows. Always lived in Goodhill—this is my first trip beyond the last farmstead. I'm boring aside from my bow skill." He patted his weapon affectionately. "I almost didn't volunteer, truth be told, but won't this be a tale to tell my own children, and theirs? Mabel already has stories, and Hugs, though he won't talk about his travels past the Outer Woods with Gev—" "I'd be pleased to recount the adventures of the Striped Rapscallions," Gev said, appearing at Helga's side. Mabel sighed. "The Striped Rapscallions?" Helga asked. "Hugs and myself," Gev explained. "We also traveled with a skunkfolk named Kiki, but she's gone to her rest." "I'm so sorry. When did she … pass on?" "Oh, she's not dead. Fell in love with a raccoonfolk and settled down to raise ladybugs." Gev bobbed and weaved as he spoke, tail swaying. "There we were, walking through the Calamity Graveyard, when we found squirrelfolk gathering bones." "You've been to the Calamity Graveyard?" Helga croaked. "Twice." Gev's chest fluttered. "Nasty place, not for sweet frogfolk. The squirrels thought we'd come to, how you say? Poach, so they weaved the bones into a terrifying monster taller than Hugs, with four clawed legs and six sharp-fanged heads on long necks. It moved like lightning bites, so fast. Cha!" He lunged at Helga, who yelped and stumbled. "Gev," Mabel chided. Helga recovered, embarrassed. "How did you escape?" "I breathed a jet of fire at the creature—a distraction, so Hugs could attack from behind." "And Kiki?" "She chased the squirrelfolk, who ran as cowards do. Hugs lifted the monster by its tail and crack! Broke it apart, then threw the pieces away." #figure(image("003_Episode 3: The Lost and the Found/01.jpg", width: 100%), caption: [Hugs, Grisly Guardian | Art by: <NAME>], supplement: none, numbering: none) "That's incredible." #emph[Perhaps too incredible?] No one else seemed impressed; perhaps they'd heard the tale before? "Gev, would you mind scouting ahead?" Mabel asked. "You're the fastest, and the best climber." Nodding vigorously, Gev disappeared into the distant grass. Mabel slowed her pace until Helga caught up. "Gev tells tales," she said quietly. "He doesn't mean anything by it." "Are you sure?" Helga asked. Having been accused of making things up many times, she was loath to assume the worst. "Hugs says as much," Mabel said. "Whatever really happened, I think it's too painful for them to talk about. Hugs is more retiring by nature, but the stories are Gev's way of coping." After her own near-death experience, Helga could understand the lizardfolk's pain, if not his choice of managing it. It took effort to stay calm, to keep moving. She tried to observe her surroundings with an artist's eye, to store up images for later drawings, when she'd have the energy to attempt them. And to ward off the disturbing visions that made her heart all but leap from her chest and fly into the sun. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) They reached what remained of Pondside before midday. Helga fought to keep her last meal in her stomach as she surveyed the wreckage: charred wicker husks, soot-smeared piles of broken clay, teetering walls of splintered boards, crumbling brick chimneys. Someone's framed needlework lay dirt-stained in the street. A lone door creaked open and banged shut over and over, fraying Helga's nerves. "You weren't kidding," Finneas said, hands on his hips. "I'd hoped …" A lump stuck in Helga's throat. Gev climbed to the top of a windmill, its snapped blades lying on the ground. "They went south," Hugs said, voice deep and gruff. Mabel hunkered near him and studied tracks on the ground. "Haymeadow, likely. It's closer than Goodhill. Looks like they took carts and a cabbage construct." Helga unearthed a jar from the remains of a house. Raspberry jam. "Hsst!" Gev whispered behind her. Helga yelped and dropped the jar, which shattered into an ugly mess the color of fresh blood. "What is it?" Mabel asked. "Near the water," Gev replied. "Squirrelfolk digging in the rubble." "Squirrelfolk?" Helga asked. "None live in Pondside that I know of." "Let's see for ourselves," Mabel said. "Follow me, slowly and quietly." They crept along the path, avoiding debris and deep gouges in the earth left by the Night Owl's talons. Moisture settled on Helga's skin as they neared the pond, the scent of mud and vegetation strengthening. Her memories of passing time there, sketching or pondering her troubles, gained the same hazy quality as heat shimmer on the water's surface. As Helga eased around a dislodged section of a flower petal roof, chattering voices rose. She couldn't understand them until she was close enough to see the squirrelfolk, one slate gray and the other redder than Mabel. They both wore black clothing adorned with bones, one a hooded cape and a leaf skirt, the other a robe whose ragged hem swept the ground. Both dug through the remains of a frogfolk home—not Helga's, though. Oh, pond scum, had that been destroyed, too? "The owl sure made a mess of this place," the hooded one said. "Just like the last one," the other replied. Helga's skin crawled. #emph[The last one? So, her dream-vision was true? How many places had the owl attacked so far?] "Why is Cruelclaw wasting our time with rubble combing?" Hood grumbled. "Who knows. This whole job has been one problem after another." #emph[Cruelclaw? Job?] Robe kicked a dented metal cup into a broken table. "Let's catch up with the others before they get to Three Trees City. Nothing worth taking here." "Too right." Hood picked up a child's painting on cured bark and sent it spinning off into the water. The other squirrelfolk laughed as the memento sank under the waves. "Oy!" Helga shouted, stomach sick with rage. "How dare you! Stealing from villagers who've lost everything." Hood started in surprise, then sneered. "Leave off, bumpkin." "We should teach her not to bother her betters," Robe added. Mabel stepped forward, paw on the hilt of her sword. "Thieves are no better than worms." "Worms are good for the soil," Finneas added. "Thieves are good for nothing." Gev hissed and twirled his maces. Hugs loomed behind him, Zoraline still asleep on his back. "Two against six," Hood mused. "Bad odds." "Good thing we brought reinforcements." Robe raised his paws, palm up, and Hood followed suit. Magic grew from their fingertips like the stems of dead leaves, spreading eerie purple veins. Around the party, a dry rustling arose. To Helga's left, two points of purple light appeared, then two more. Within moments, dozens of gleaming eyes surrounded the Goodhill delegation. Creaking, crackling figures stepped into the sunlight, skeletal forms limned with the same leaf-figures conjured by the squirrelfolk. "Necromancers," Gev spat. Zoraline sputtered awake. "What? Who?" Helga's blood chilled. Mabel slid in front of her, wielding her fang-sword and a small ironsap shield emblazoned with a five-petaled mallow flower. The necromancers flicked their paws at their opponents, and the skeletons scurried to obey. A ratfolk snapped yellowing, broken teeth at Helga as it advanced. Mabel blurred to the left, her magic obscuring her movement. The rat skeleton's jaws closed on empty air. Her sword slashed down, carving through bone with an orange flash. Before Helga could gasp, the ratfolk's head lay on the ground, the purple light in its eyes fading. Farther away, Finneas leaped into the air and twisted, loosing a pair of arrows at a birdfolk skeleton. One projectile bounced off and the other flew through the empty eye socket and out the other side. Gev spun his fire maces in a dance like the one at Mabel's party, flames painting the air. His tail lashed out, tripping one undead mousefolk as he knocked another away. Whirling back to the first, he smashed both maces down on its head with a sickening crunch. #figure(image("003_Episode 3: The Lost and the Found/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) A snarl behind Helga made her duck and cover her head. Hugs lifted a skeletal otterfolk with both paws and ripped it in half. He dashed the top part against the ground and threw the rest into the pond. His heavy boot rose and fell, crushing the bones into dust. A shadow passed above. Zoraline swooped down, caressing a necromancer's neck. His indigo magic stuttered, then flowed backward into the batfolk, suffusing her with an opalescent glow that lit her eyes and mouth from within. Gliding toward a cluster of skeletons, Zoraline keened a haunting prayer-song, releasing her stolen power in a wave. The undead shuddered, then collapsed to the ground. More birdfolk skeletons appeared, pecking and clawing at Hugs, chasing Zoraline, and shrugging off attacks from an increasingly frustrated Finneas. His next arrow was tipped with an odd sack rather than an arrowhead. Just before it hit its target, he stamped his foot in a rapid pattern. The sack erupted into a tangle of vines, wrapping around the skeleton's torso and wings. The undead plummeted to the ground, where Hugs used his boots to make short work of it. Mabel darted about, a mouse-shaped blur cutting apart foes with deadly accuracy. Helga rose from her crouch. She didn't know any useful cantrips, had never wielded a weapon in her life, but there must be something she could do to help. The answer came to her in a flash, like an otterfolk's lightning. "Mabel," Helga shouted. "The birds!" "They're a bit high for me, dear," Mabel replied. "I can make steps. Look!" Helga reached out to the water, pulling a ball of liquid toward her and separating it into beads. These she flattened into a series of floating platforms that reached the skeletal fliers. Mabel raced up the stairway of droplets, sword and shield ready. Helga tried to keep one eye on her and the other on the enemy, but it was tricky. Her focus was so split, she realized too late that she wasn't maintaining the spell, and halfway up, Mabel's boot sank into a water step. "No!" Helga gasped. Her fear of failing—again—broke her concentration. With a sound like a bubble popping, the stairs fell to splatter the soil. Mabel's reflexes saved her. She leaped at the nearest birdfolk skeleton, her shield catching its wing while her sword drove into a gap between ribs. The undead plummeted, scraping along the ground with Mabel clinging to its side. She wrenched her sword free and brought it down on the creature's spine. Her blade flared orange as it cut through bone like a knife through paper. Quiet fell over the battlefield. Hugs rolled his shoulders and grunted. Zoraline landed beside him, folding her wings around her. Finneas kept two arrows nocked but pointed down. Gev slapped a skull with his tail, sending it tumbling toward the pond. Mabel turned in a full circle, first quickly, then more deliberately. Finally, she sheathed her sword and slid her shield onto a strap on her pack. "Everyone hale?" Mabel asked. Various noises of assent reached her, until Gev hissed. "I tell you not to do this," Gev said, slapping Hugs's boot. "Look at all these splinters. I'll be forever taking them out again." "Again?" Finneas sounded appalled. "Boots do not sprout from bushes, and yet—" "Does anyone see the necromancers?" Mabel interjected. "They fled," Zoraline replied. "Toward the Long River." Helga hunched in on herself, first in relief, then shame. She'd lost control of her spell. #emph[Why could she never concentrate when it was most important?] "I'm so sorry," she told Mabel. "My cantrip—" "It's fine," Mabel said gently. "Mishaps happen." To the others, she said, "We need to decide our next course of action." "We won't help the villagers?" Helga asked, startled. "That's one possibility." Mabel dabbed a handkerchief on a cut weeping blood on her arm. "We might instead follow the squirrelfolk." Helga started to protest but considered Mabel's suggestion. The necromancers seemed to know why Maha had attacked Pondside, had perhaps instigated the situation. What were they up to? She wanted answers. And yet, she worried about her neighbors. "What enemies might we encounter if we follow those fellows?" Finneas asked. "Can we handle more skeletons, or worse?" Gev, pulling bone shards from Hugs's paws and fur, said, "The Striped Rapscallions do not fear undead boot-wreckers." "I cannot read the stars now," Zoraline said, yawning, "but their movements at dawn suggested more danger in our future." #emph[More danger?] Helga's stomach turned. "Anyone from Pondside has probably made it to Haymeadow," Mabel said. "It might be best to go to Three Trees City and try to discover more about this Cruelclaw and his plans." She met each of their gazes, landing on Helga last. "What if another Calamity Beast disaster is looming and we could help prevent it?" "Could we really?" Finneas asked. "If not us, who?" Mabel replied, grasping her sword's pommel. "Helga, it's your village. What do you say?" Helga hesitated, her veins filled with fire and ice. Some moments were a fulcrum on which life turned, and this felt like one. "We follow the squirrelfolk," she said. "To Three Trees." Mabel nodded, then began to issue orders. Finneas collected any arrows undamaged enough to reuse. Zoraline plotted a route along the Long River, then climbed onto Hugs's back and succumbed to slumber. Gev had finished grooming Hugs and snacked on beetle crackers. Helga, swallowing nerves, went to her grandparents' house. Its waxed paper dome had cracked on top like an eggshell. The broad leaves arcing over that side were partly sheared away, the cut portion wilting in the day's heat. Sunlight angled through the broken roof, so the walls glowed from within as if the lamps inside were lit. Even so, the place felt cold and empty. Helga forced herself to enter, to pack clean clothing and food that would travel well. She told herself she would be back; they were only going to Three Trees City, unless the trail of the squirrelfolk took them further. Why, then, did she reverently touch her grandmother's collection of etched copper orbs, slipping her favorite into her pack? Why did she take her grandfather's wand, set his wide-brimmed hat on her own head? Mabel made no mention of Helga's brief absence, and soon their steps turned northward. Finneas didn't engage Helga in conversation again, not even when they camped at nightfall. Zoraline flew back to Goodhill to take the message of their discoveries and new destination, her robes like a swirl of stars vanishing into the darkness. Helga wondered if, somehow, she was disappearing, too. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Mabel] A kindly group of otterfolk sighted the party trudging beside the Long River and invited them to board two brightly painted, fish-shaped boats. Mabel and Finneas conversed with the crews, part of a larger family reuniting in Three Trees City for a wedding. Hugs stayed away from the water, a sleeping Zoraline on his back, while Gev's breakfast made an unwelcome reappearance as he moaned in distress. Helga stared forlornly at the frothy wake with a pencil in one hand and her journal in the other. #figure(image("003_Episode 3: The Lost and the Found/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) The massive trees that gave Three Trees City its name rose in the distance, branches intertwined in places like lovers holding hands. How the oak, sycamore, and willow came to grow together along the banks of the Long River, no one knew. The animalfolk who built the city over generations began with the hope of harmony; in some places, that hope manifested as meticulous arrangements of graceful buildings and fungal paths nestled among the canopy, twined around the trunks or rising from arching roots. In other places, harmony was a cheerful patchwork of different styles jumbled together: carved wood mixed with painted clay, feathers with beads, embroidery with knotwork-tied sticks. Cities, like plants, often grew in unexpected ways. They arrived at the Docklands beneath the drooping tendrils of the willow, their boats navigating the sprawling mass of rafts, wharves, and floating structures to tie up at a crowded pier. Chattering birdfolk couriers picked up small packages and mail for delivery; otterfolk handed cargo up to raccoonfolk, who easily shouldered large boxes and sacks; frogfolk played bubbleball in the shallows, or shared meals of delicious-smelling grilled minnows with minkfolk resting in the shade. Once Mabel and the others thanked their hosts and disembarked, they found the foot traffic was as busy as the river. Finneas's twitching ears suggested the profusion of strangers overwhelmed him. Hugs stood like a boulder, the flow of bodies parting around him. Gev climbed past Zoraline up to his shoulder for a better view, and Helga stuck close to his side. Somewhere in the Quilted District, Mabel's parents visited with friends, enjoying the raucous pleasures of the city's heart, beneath the vast quilted banner symbolizing the union of all animalfolk. Helga, too, had family in the city. Alas, there was no time to seek them out. "Finneas," she said. The rabbitfolk hopped nervously. "Yes?" "Can you help me ask the locals whether they've seen our necromancer friends, or Cruelclaw? Hugs and the others can wait here." "Right, yes," Finneas replied. Having a task seemed to center him. Soon he chatted amiably with a group of frogfolk, while Mabel approached a pair of dockhands watching someone mutter a weaving over a tangle of nets. After a dozen attempts each, neither Mabel nor Finneas had any luck. She was about to shift their party downriver, past warehouses and trading offices to where tarp-roofed inns flew bright red pennants, when an old frogfolk gave her pause. "You're the second stranger looking for someone today," he grumbled. "Is that so?" Mabel asked. "Aye," the elder continued. "That fella yonder's nagged near everyone. Right odd, too. Keeps hitting folk with his tail like he forgets it's his." He pointed with his pearl-topped cane. An otterfolk nearby argued with another of the same. His black fur was streaked with white, his posture stiff, and he wore a red sash and blue tunic, strange goggles perched on his head. A single copper bracer adorned his right arm, while a strip of white fabric was tied around his left wrist. "I assure you," he said, "this situation is infinitely more irritating to me than it is to you." "Is it now?" the other otterfolk replied. "You can't even tell us what kind of animalfolk he is." "As I said, he may be wearing a blue cloak—" "Maybe?" a weaselfolk repeated. "—and he has distinctive tattoos—" "Tattoos?" someone else chimed in. "What are those, then?" The stranger sighed. "Fur patterns? Stripes? Two white lines, running from his mouth to his chin, and others on one side of his cheek … face … Would you just look at my drawing?" It must have been poorly rendered, because the others doubled over with laughter. "Never mind," he said. "Thank you so much for your utter lack of assistance." #emph[Rude] , Mabel thought, an opinion that strengthened as he spun on his heel and slapped the weaselfolk with his tail. Worse, he nearly barreled into Helga. She held her journal in front of her like a shield, her green skin-tinged gray, nervous smile in place. "S-stripes," Helga stuttered. The otterfolk paused. "That's what I said, yes." Helga flipped through her book, nearly fumbling it. She stopped at a particular page and held it up. The stranger grabbed her arm and pulled her closer. "Did Beleren pass through here?" he demanded. "How long ago? Was anyone with him?" "Release her," Mabel said, gripping the hilt of her sword, "or you'll lose that fancy bracer along with the rest of your arm." A spark of lightning flashed across the otterfolk's gray-blue eyes, but he released Helga and stepped away. "Don't tempt me," he said. "I've been wandering this infernal place for days and your friend is my first lead." "Her name is Helga," Mabel said coolly. "I'm Mabel. And you are?" "Ral," he replied. "<NAME>. I'm looking for someone named <NAME>." Mabel peeked at Helga's journal. The frogfolk had drawn a face, a foxfolk. They did indeed have markings like the ones the stranger—Ral—described. On the same page, Helga had also sketched a cloak with an odd circular pattern. "I've seen him in my dreams," Helga whispered, her voice gradually strengthening. "He's not alone. There's a lizardfolk, with green and black scales, and yellow eyes. And another small creature who's hard to see. A dark cloud follows them." She looked up as if expecting a storm, but only blue sky peeked through the Willow's curtain of leaves. "You're sure?" Ral asked. Helga hesitated, then bobbed her head. Mabel wondered how many times her visions had been doubted, by Oliver and others, for her to be so shy about sharing them. "What is he doing here?" Ral muttered. "A lizard … Not a snake? Could it be …?" Mabel had no idea what he was on about, but it wasn't Cruelclaw. She needed to move along before the trail grew colder. "If you'll excuse us," Mabel said, "we'll be on our way. Best of luck finding your friend." She guided Helga toward the others. "Oh, no you don't," Ral said, striding beside her. "You're not going anywhere until the frog gives me answers." #emph[The nerve!] "Helga has her own business to mind, thank you kindly—" She was interrupted by Helga, who said, in a quiet voice: "You believe me?" Ral rubbed his whiskers with one paw. "I believe the evidence of my own eyes. Right now, you're my only link to Beleren, so I'm not letting you out of my sight." Before Mabel could reply, mussel alarms clattered upriver. Dockhands dropped their work and bellowed commands at each other, rushing about, clearly agitated. Some produced ropes and tied down loose crates and barrels, securing them to rings embedded in the wooden floorboards or the decks of the boats. Others did the same for the boats themselves, lashing them to the piers or each other, like a raft of otterfolk holding paws. "What's happening?" Ral asked, sliding his goggles down over his eyes. "I'm not sure." Mabel tried to hail a raccoonfolk racing past, but they ignored her. Finneas pointed. "My lands, look at the water." The river had risen well past the high tide marker on a nearby piling and continued to swell, quickly overflowing its banks. Waves crested over the quay, up through the cracks of the boardwalk, lapping first at Mabel's boots, then her legs. The boats tied together strained and tugged at their moorings, while the unsecured ones spun away downriver. A few crashed into each other, hulls cracking like nuts. "Something comes!" Gev shouted, balanced atop Hugs's head. A sinuous form moved below the water's surface, silver scales glinting in the dappled sunlight. Unlike minnows and guppies, this fish was so long Mabel couldn't see its tail, or even its dorsal fin. Magical markings glowed along its side, their rosy hue warped by the roiling currents. A huge wave lifted the creature so it loomed above the Docklands. Baleful eyes burned with power, and a long mouth gaped to reveal rows of wickedly sharp teeth. #figure(image("003_Episode 3: The Lost and the Found/04.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) "The Flood Gar!" Helga screamed. A whip of water lashed out, sweeping a cluster of animalfolk into the river. Lightning crackling around his bracer, Ral raised his arm toward the Calamity Beast. "No!" Mabel stood in front of him. "You'll shock anyone in the water who isn't otterfolk like you!" "How do you normally handle these things?" he retorted. "There's nothing normal about this!" Another water-whip struck, pushing Mabel and Ral into Hugs. The badgerfolk staggered but remained upright. Zoraline, still sleeping on his back, astonishingly didn't wake. A shimmering, blue-tinged shadow hovered over them: a wave as tall as an elderberry bush. It crashed down, engulfing Mabel and dragging her away from the dock. Fighting the Gar's wild magic was a losing battle, but she persevered, kicking toward what she hoped was the surface as her lungs burned. A strong paw pulled her up. Mabel sucked in a deep breath and clung to Hugs, Ral doing the same beside her, the others arrayed around or atop him like the children at her party. He struggled against the undertow pulling them to the center of the river, farther from safety. "Can you bend the current to take us back to shore?" Mabel asked Ral, between being dunked and wave-tossed. "Bend it?" Ral spluttered back. "I control rain, not rivers." #emph[An otterfolk who couldn't manage currents? Odd] , but Mabel hadn't the energy to dwell on it. The water's chill seeped into her bones as they were flung about like flotsam at the mercy of the river. Soon they'd gone well past Three Trees City, tumbling into a tributary that veered southwest. #emph[Where would they finally manage to escape? Would they escape at all, or would their journey end at the bottom of the Long River?] #emph[No.] Mabel refused to accept defeat. Even if she never found Cruelclaw and discovered what he was up to, she would survive. Clem and the littles waited for her, and she would never abandon them. As if some tendril of the world's magic heard her oath, the river narrowed, the turbulent current slowing to a more sedate flow. Rocky outcroppings flanked the water, covered in sediment and clusters of mussels, gnarled roots thrusting from them like grasping hands. Empty snail shells and water-smoothed bones littered the shore, dark reminders of the fate that could have befallen them if Hugs hadn't kept everyone afloat. The exhausted badgerfolk guided them to the muddy riverbank and collapsed in the muck next to a stagnant tide pool, sides heaving. Everyone slid or clambered off him; even Zoraline sputtered awake briefly, murmuring about wet fur. Mabel quickly assessed their surroundings: a marshy cave, moss-covered gaps in the stone above allowing shafts of filtered light to allay the gloom. Bugs crawled up the walls, disappearing into cracks and crevices, and the scent of sulfur and decay permeated the partly enclosed space. "Is anyone injured?" Mabel asked. "Only my pride," Ral said. A clam spat slurry at him before burrowing deeper into the sludge. "I think I swallowed a barrel of water," Finneas groaned. Gev's tail flared orange, and a subtle heat emanated from his body. He briskly rubbed up against Hugs to dry him, mud solidifying beneath his feet. "Where are we?" Helga asked. "I don't—" Mabel began, then halted, her ears turning toward a rustling from the cave entrance. Between blinks, dark shapes coalesced from the shadows. A mischief of ratfolk garbed in hooded cloaks surrounded the party, pointing wickedly curved daggers and bladed staves at them. "Outsiders," a ratfolk hissed. "You are not welcome here. Leave, or face dire consequences."
https://github.com/EricWay1024/Scientific-Computation-Notes
https://raw.githubusercontent.com/EricWay1024/Scientific-Computation-Notes/master/algo.typ
typst
// Increases indent in an algo element. // Only place at beginning or end of lines. #let i = { counter("_algo-indent").step() } // Decreases indent in an algo element. // Only place at beginning or end of lines. #let d = { counter("_algo-indent").update(n => { assert(n - 1 >= 0, message: "dedented too much") n - 1 }) } // Displays an algorithm in a block element. // // Parameters: // body: Algorithm text. // title: Algorithm title. // Parameters: Array of parameters. // line-numbers: Whether to have line numbers. // implicit-linebreaks: If true, line-terminating whitespaces // in body are assumed to be linebreaks. // // Note: Using implicit-linebreaks may cause undesired behavior. // It doesn't play nice with special characters (+, -, ', // ", :, etc.) that are outside of math mode. Whitespaces // around these characters are treated as linebreaks. Also // doesn't work when mixing content mode and math mode on // the same line. They still work for pure content or pure // math mode though! // indent-size: Size of line indentations. // row-gutter: Space between lines. // column-gutter: Space between line numbers and text. // inset: Inner padding. // fill: Fill color. // stroke: Border stroke. #let algo( body, title: none, parameters: (), line-numbers: true, implicit-linebreaks: false, indent-size: 20pt, row-gutter: 10pt, column-gutter: 10pt, inset: 10pt, fill: rgb(98%, 98%, 98%), stroke: 1pt + rgb(50%, 50%, 50%) ) = { set par(justify: false) counter("_algo-indent").update(0) // sorts body.children such that, between portions of content, // indentation changes always occur before whitespace // makes placement of indentation commands more flexible in body let sorted-children = { let whitespaces = () let indent-updates = () let sorted-elems = () for child in body.children { if ( child == [ ] or child == linebreak() or child == parbreak() ) { whitespaces.push(child) sorted-elems += indent-updates indent-updates = () } else if repr(child).starts-with( "update(counter: counter(\"" + "_algo-indent" + "\")" ) { indent-updates.push(child) } else { sorted-elems += indent-updates sorted-elems += whitespaces sorted-elems.push(child) indent-updates = () whitespaces = () } } sorted-elems += indent-updates sorted-elems += whitespaces sorted-elems } // concatenate consecutive non-whitespace elements // i.e. just combine everything that definitely aren't // on separate lines let lines-and-whitespaces = { let joined-children = () let temp = [] for child in sorted-children { if ( child == [ ] or child == linebreak() or child == parbreak() ){ if temp != [] { joined-children.push(temp) temp = [] } joined-children.push(child) } else { temp += child } } if temp != [] { joined-children.push(temp) } joined-children } // filter out non-meaningful whitespace elements let lines-and-breaks = lines-and-whitespaces.filter(elem => if implicit-linebreaks { elem != [ ] } else { elem != [ ] and elem != parbreak() } ) // handling meaningful whitespace // make final list of empty and non-empty lines let display-lines = ( if implicit-linebreaks { // breaks are registered as empty lines in output lines-and-breaks.map(elem => if elem == linebreak() or elem == parbreak() { [] } else { elem } ) } else { // join consecutive lines not separated by an explicit // linebreak with a space let joined-lines = () let line-parts = [] let num-linebreaks = 0 for (i, line) in lines-and-breaks.enumerate() { if line == linebreak() { if line-parts != [] { joined-lines.push(line-parts) line-parts = [] } num-linebreaks += 1 if num-linebreaks > 1 { joined-lines.push([]) } } else { line-parts += [#line ] num-linebreaks = 0 } } if line-parts != [] { joined-lines.push(line-parts) } joined-lines } ) let rows = () // build table input (with line numbers if specified) for (i, line) in display-lines.enumerate() { let formatted-line = { counter("_algo-indent").display(n => pad( left: indent-size * n, line ) ) } if line-numbers { let line-number = i + 1 rows.push([#line-number]) } rows.push(formatted-line) } align(center, block( width: auto, height: auto, fill: fill, stroke: stroke, inset: inset, outset: 0pt, breakable: true )[ #let algo-header = { set align(left) if title != none { set text(1.1em) if type(title) == "string" { underline(smallcaps(title)) } else { title } if parameters.len() == 0 { $()$ } } if parameters != () { set text(1.1em) $($ for (i, param) in parameters.enumerate() { if type(param) == "string" { math.italic(param) } else { param } if i < parameters.len() - 1 { [, ] } } $)$ } if title != none or parameters != () { [:] } } #algo-header #v(weak: true, row-gutter) #align(left, table( columns: if line-numbers {2} else {1}, column-gutter: column-gutter, row-gutter: row-gutter, align: if line-numbers { (x, _) => (right, left).at(x) } else { left } , stroke: none, inset: 0pt, ..rows )) ]) } // Displays code in a block element. // Credit to @Vinaigrette#5555 on Discord. // // Parameters: // body: Raw text. // line-numbers. Whether to have line numbers. // row-gutter: Space between lines. // column-gutter: Space between line numbers and text. // inset: Inner padding. // fill: Fill color. // stroke: Border stroke. #let code( body, line-numbers: true, row-gutter: 10pt, column-gutter: 10pt, inset: 10pt, fill: rgb(98%, 98%, 98%), stroke: 1pt + rgb(50%, 50%, 50%) ) = { set par(justify: false) let content = () let i = 1 for item in body.children { if item.func() == raw { for line in item.text.split("\n") { if line-numbers { content.push(str(i)) } content.push(raw(line, lang: item.lang)) i += 1 } } } align(center, block( stroke: stroke, inset: inset, fill: fill, width: auto, breakable: true )[ #table( columns: if line-numbers {2} else {1}, inset: 0pt, stroke: none, fill: none, row-gutter: row-gutter, column-gutter: column-gutter, align: if line-numbers { (x, _) => (right, left).at(x) } else { left } , ..content ) ]) }
https://github.com/AnsgarLichter/cv-typst
https://raw.githubusercontent.com/AnsgarLichter/cv-typst/main/modules/section.typ
typst
#import "../settings/styles.typ": * #import "utils.typ": * #let createSectionTitle( title ) = { text( size: sectionStyle.title.size, weight: sectionStyle.title.weight, fill: sectionStyle.title.fontColor, title ) h(sectionStyle.margins.RightToHLine) hLine() }
https://github.com/ngyngcphu/tick3d-docs
https://raw.githubusercontent.com/ngyngcphu/tick3d-docs/main/contents/index.typ
typst
Apache License 2.0
#include "01_mo_dau/index.typ" #include "02_phan_tich_yeu_cau/index.typ" #include "03_luoc_do_use_case/index.typ" #include "04_framework_technology/index.typ" #include "05_UI/index.typ" #include "06_Implementation/index.typ"
https://github.com/lelimacon/typst-minimal-cv
https://raw.githubusercontent.com/lelimacon/typst-minimal-cv/main/package.typ
typst
MIT No Attribution
#let default-theme = ( margin: 22pt, font: "Inria Sans", font-size: 11pt, accent-color: blue, body-color: rgb("222"), header-accent-color: none, // inherit header-body-color: none, // inherit main-accent-color: none, // inherit main-body-color: none, // inherit main-width: 5fr, main-gutter-width: 64pt, aside-accent-color: none, // inherit aside-body-color: none, // inherit aside-width: 3fr, aside-gutter-width: 48pt, ) #let cv( title: "", subtitle: "", theme: (), aside: [], main, ) = { // Function to pick a key from the theme, or a default if not provided. let th(key, default: none) = { return if key in theme and theme.at(key) != none { theme.at(key) } else if default != none and default in theme and theme.at(default) != none { theme.at(default) } else if default != none { default-theme.at(default) } else { default-theme.at(key) } } set page( margin: ( top: 2 * th("margin"), bottom: th("margin"), left: th("margin"), right: th("margin"), ), ) // Fix for https://github.com/typst/typst/discussions/2919 show heading.where(level: 1): set text(size: th("font-size")) show heading.where(level: 2): set text(size: th("font-size")) set text(font: th("font")) set text(size: th("font-size")) set par(linebreaks: "simple", leading: 0.4em) set block(above: 10pt, below: 8pt, spacing: 10pt) { show heading.where(level: 1): set text(size: 3.0em) show heading.where(level: 2): set text(size: 1.6em, weight: "regular") show heading.where(level: 1): set text(fill: th("header-accent-color", default: "accent-color")) show heading.where(level: 2): set text(fill: th("header-body-color", default: "body-color").lighten(30%)) stack( spacing: th("margin"), heading(level: 1, title), heading(level: 2, subtitle), v(th("margin")) ) } show heading.where(level: 1): set text(size: 1.2em, fill: th("accent-color")) show heading.where(level: 2): set text(size: 1.0em, fill: th("body-color")) grid( columns: (th("main-width"), th("margin"), th("aside-width")), // Content. { set grid(columns: (th("main-gutter-width"), 1fr)) show heading.where(level: 1): set text(fill: th("main-accent-color", default: "accent-color").lighten(30%)) show heading.where(level: 2): set text(fill: th("main-body-color", default: "body-color")) set text(fill: th("main-body-color", default: "body-color").lighten(40%)) set rect(fill: th("main-accent-color", default: "accent-color")) main }, // Empty space. {}, // Aside. { set grid(columns: (th("aside-gutter-width"), 1fr)) show heading.where(level: 1): set text(fill: th("aside-accent-color", default: "accent-color").lighten(30%)) show heading.where(level: 2): set text(fill: th("aside-body-color", default: "body-color")) set text(fill: th("aside-body-color", default: "body-color").lighten(40%)) set rect(fill: th("aside-accent-color", default: "accent-color")) aside }, ) } #let section( theme: (), title, body, ) = { set grid(columns: (theme.gutter-size, 1fr)) if "gutter-size" in theme show heading.where(level: 1): set text(fill: theme.accent-color) if "accent-color" in theme show heading.where(level: 2): set text(fill: theme.body-color) if "body-color" in theme set rect(fill: theme.accent-color.darken(40%)) if "accent-color" in theme set text(fill: theme.body-color) if "body-color" in theme v(6pt) heading(level: 1, title) rect(height: 2pt, width: 100%,) body } #let entry( theme: (), right: none, gutter, title, body, ) = { set grid(columns: (theme.gutter-size, 1fr)) if "gutter-size" in theme show heading.where(level: 2): set text(fill: theme.body-color) if "body-color" in theme set text(fill: theme.body-color) if "body-color" in theme grid( { set text(tracking: -0.5pt, style: "italic") context { set text(fill: text.fill.lighten(40%)) gutter } }, { let hasTitle = title != none let hasRight = right != none if hasTitle or hasRight { grid( columns: (1fr, auto), { heading( level: 2, context { set text(fill: text.fill.darken(40%)) title } ) }, context { set text(fill: text.fill.darken(40%)) right }, ) } if body != none { set par(justify: true) set block(above: 6pt) body } } ) } #let progress-bar( progress, ) = { // Fix for https://github.com/typst/typst/issues/3826 if progress == 0% { progress = 0.1% } set block(above: 0pt, below: 0pt, spacing: 0pt) set par(leading: 0em) context { let light-accent = rect.fill.lighten(30%) rect( height: 6pt, width: 100%, stroke: light-accent, fill: gradient.linear( (light-accent, 0%), (light-accent, progress), (white, progress), (white, 100%), ), ) } }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/keyle/0.1.0/README.md
markdown
Apache License 2.0
# keyle This package provides a simple way to style keyboard shortcuts in your documentation. It was inspired by [auth0/kbd](https://auth0.github.io/kbd/) and [dogezen/badgery](https://github.com/dogezen/badgery). Send them respect and love. ## Usage Please see the [keyle.pdf](doc/keyle.pdf) for more documentation. `keyle` is imported using: ```typst #import "@preview/keyle:0.1.0" ``` ### Example ![About](doc/keyle.png) ## License MIT
https://github.com/nhuongmh/nhuongmh.cv
https://raw.githubusercontent.com/nhuongmh/nhuongmh.cv/main/cv_2.typ
typst
Do What The F*ck You Want To Public License
#import "template.typ": * #import "data.typ": * #show: project.with( title: name, author: author, ) #chiline() #self #group(( leftsection(edutitle), edu, leftsection[ Technical \ Skills ], tech, leftsection[ Project \ Experience ], projectexperience, leftsection[ Activity \ Experience ], projects, leftsection[ Hobbies \ and \ Interests ], hobbies, ))
https://github.com/mem-courses/linear-algebra
https://raw.githubusercontent.com/mem-courses/linear-algebra/main/homework/linear-algebra-homework15.typ
typst
#import "../template.typ": * #show: project.with( title: "Linear Algebra Homework #15", authors: ( (name: "<NAME> (#95)", email: "<EMAIL>", phone: "3230104585"), ), date: "January 11, 2024", ) #let AA = math.bold(math.italic("A")) #let BB = math.bold(math.italic("B")) #let XX = math.bold(math.italic("X")) #let YY = math.bold(math.italic("Y")) #let EE = math.bold(math.italic("E")) #let OO = math.bold(math.italic("O")) #let TT = math.upright("T") #let x1 = math.attach(math.italic("x"), br: math.upright("1")) #let x2 = math.attach(math.italic("x"), br: math.upright("2")) #let x3 = math.attach(math.italic("x"), br: math.upright("3")) #let y1 = math.attach(math.italic("y"), br: math.upright("1")) #let y2 = math.attach(math.italic("y"), br: math.upright("2")) #let y3 = math.attach(math.italic("y"), br: math.upright("3")) #let alpha = math.bold(math.alpha) #let beta = math.bold(math.beta) #let Lambda = math.bold(math.Lambda) #let diag = math.upright("diag") #let ssim = math.attach(sp + math.upright("~") + sp, tl: "", tr:"", t: math.upright("S")) = P151 习题六 30 #prob[ 已知二次型 $f(x_1,x_2,x_3) = XX^TT AA XX$ 在正交替换 $XX = bold(U) YY$ 下的标准形为 $y_1^2+y_2^2$, 且 $bold(U)$ 的第 $3$ 列为 $display(mat(sqrt(2)/2,0,sqrt(2)/2))^TT$。 (1) 求矩阵 $AA$。 ] #prob[(2) 证明 $AA + EE$ 为正定矩阵。] = P151 习题六 33 #prob[ 证明:$n$ 阶矩阵 $ AA = mat( 1,1/n,dots.c,1/n; 1/n,1,dots.c,1/n; dots.v,dots.v,,dots.v; 1/n,1/n,dots.c,1; ) $ 是一个正定矩阵。 ] 容易求出其顺序主子式的通项公式从而证明。 = P152 习题六 34 #prob[已知 $AA = (a_(i j))_(n times n)$ 是正定矩阵,证明:$a_(i i)>0,sp i=1,2,dots.c,n$。] 因为 $AA$ 是正定矩阵,故 $AA$ 的所有主子式都是正的。即 $ (-1)^(i+i) a_(i i) > 0 sp ==> sp a_(i i) > 0 $ = P152 习题六 35 #prob[ 设 $AA = (a_(i j))_(n times n)$ 是一个实对称矩阵,证明: (1) 矩阵 $AA$ 正定当且仅当 $AA$ 的任意一个主子式都大于零。 ] #prob[(2) 当 $AA$ 正定时,对任意的 $i!=j,sp 1<=i,j<=n$,有 $|a_(i j)| < sqrt(a_(i i) a_(j j))$。] = P152 习题六 36 #prob[设 $AA_(m times n)$ 是一个实矩阵,证明:$AA^TT AA$ 为正定矩阵,当且仅当 $r(AA) = n$。] = P152 习题六 38 #prob[ 设 $AA,BB$ 是实对称矩阵,证明: (1) 当实数 $t$ 充分大时,$t EE + AA$ 正定。 ] #prob[(2) 若 $AA$ 正定,则 $AA^(-1)$ 正定。] 由于 $AA$ 是正定矩阵,故存在可逆矩阵 $BB$ 使得 $AA = BB^TT BB$。那么: $ AA^(-1) = (BB^TT BB)^(-1)= BB^(-1) (BB^TT)^(-1) = BB^(-1) (BB^(-1))^TT $ 故存在可逆矩阵 $bold(C) = (BB^(-1))^TT$ 使得 $AA^(-1)=bold(C)^TT bold(C)$。故 $AA^(-1)$ 是正定矩阵。 #prob[(3) 若 $AA,BB$ 正定,则 $AA+BB$ 正定。] #prob[(4) 若 $AA$ 正定,则 $AA$ 的伴随矩阵 $AA^*$ 正定。] 由于 $AA$ 正定,故 $AA$ 可逆且 $abs(AA) > 0$。故有 $AA^* = abs(AA) AA^(-1)$。取 $bold(D) = sqrt(abs(AA)) bold(C)$,则 $AA^* = bold(D)^TT bold(D)$,故 $AA^*$ 是正定矩阵。 = P152 习题六 39 #prob[ 设 $AA = (a_(i j))_(n times n)$ 是一个实矩阵,且对任意的 $1<=i<=n$,有 $2 a_(i i) > display(sum_(j=1)^n |a_(i j)|)$,证明: (1) $abs(AA) > 0$。 ] #prob[(2) 如果 $AA$ 对称,那么 $AA$ 正定。] = P152 习题六 41 #prob[设 $AA_(n times n)$ 是一个实对称矩阵,且 $abs(AA) < 0$,证明:必存在非零向量 $alpha in RR^n$,使得 $alpha^TT AA alpha < 0$。] = P152 习题六 44 #prob[ 设 $AA$ 是一个正定矩阵,$BB = display(mat(AA,alpha,alpha^TT,b))$,其中 $b in RR$,证明: (1) $BB$ 正定当且仅当 $b - alpha^TT AA^(-1) alpha > 0$。 ] #prob[(2) $BB$ 半正定当且仅当 $b - alpha^TT AA^(-1) alpha >= 0$。] = P152 习题六 45 #prob[ 设 $AA_(n times n)$ 是一个实对称矩阵,其最小和最大的特征值分别为 $a,b$,证明:对任意的向量 $XX in RR^n$,有 $ a XX^TT XX <= XX^TT AA XX <= b XX^TT XX $ ] = P153 习题六 46 #prob[ 设 $f(XX) = XX^TT AA XX$ 是一个实二次型,存在 $n$ 元实向量 $XX_1$ 与 $XX_2$ 使得 $ XX_1 ^TT AA XX_1 > 0,quad XX_2^TT AA XX_2 < 0 $ 证明:必存在 $n$ 元实向量 $XX_0$,使得 $XX_0^TT AA XX_0 = 0$。 ] = P153 习题六 47 #prob[ 设 $AA$ 是 $n$ 阶正定矩阵,$seqn(alpha,n)$ 均为实的 $n$ 元非零列向量,且当 $i!=j$ 时,$alpha_i^TT AA alpha_j = 0 sp (i,j=1,2,dots.c,n)$,证明:$seqn(alpha,n)$ 线性无关。 ] = P153 习题六 49 #prob[ 设 $AA = (a_(i j))_(n times n)$ 正定,$bold(T) = (t_(i j))_(n times n)$ 是 $n$ 阶实可逆矩阵,证明: (1) $abs(AA) <= a_(n n) abs(AA_(n-1))$,这里 $abs(AA_(n-1))$ 是 $AA$ 的 $n-1$ 阶顺序主子式,且等号成立的充分必要条件是 $a_(1 n) = a_(2 n) = dots.c = a_(n-1,n) = 0$。 ] #prob[ (2) $abs(AA) <= a_11 a_22 dots.c a_(n n)$ 且等式成立的充分必要条件是 $AA$ 为对角矩阵。 ] = P153 补充题六 3 #prob[设 $AA,BB$ 是两个实对称矩阵,其中 $AA$ 是正定的,证明:存在可逆矩阵 $bold(P)$,使得 $bold(P)^TT AA bold(P) = EE$,且 $bold(P)^TT BB bold(P)$ 是一个对角矩阵。] = P153 补充题六 5 #prob[设 $AA,BB$ 是两个实对称矩阵,证明:如果矩阵 $AA$ 的特征值在区间 $[a,b]$ 上,矩阵 $BB$ 的特征值在 $[c,d]$ 上,那么矩阵 $AA + BB$ 的特征值在区间 $[a+c,b+d]$ 上。] = P153 补充题六 6 #prob[设 $n$ 元实二次型 $f(bold(X))$ 是半正定的且其秩为 $r$,证明:方程 $f(bold(X)) = 0$ 的所有解向量所构成的集合 $W$ 是 $RR^n$ 的一个子空间,并求该子空间的维数。]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/link_06.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Transformed link. #set page(height: 60pt) #let mylink = link("https://typst.org/")[LINK] My cool #box(move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink))))
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/algo/lectures/2024-10-15.typ
typst
= Декартово дерево#footnote[a.k.a ДД, Treap, Дерамида, Пиво, Курево] Хотим реализовать set. Каждая вершина дерева хранит пару $(x, y)$ -- (ключ, приоритет). Приоритет --- внутренняя информация для балансировки. Предполагаем, что $x$-ы и $y$-и уникальны. - По ключам ($x$) --- двоичное дерево поиска - По приоритетам ($y$) --- куча (с максимумом вверху) == Версия 1980 (offline) В этой версии приоритетов нет Вставка (как в простом бинарном дереве) в порядке случайной перестановки == Версия 1996 Вставка в произвольном порядке, но с приоритетами Берем $y$ из равномерного распределения: $y in U[0, 1]$ --- получаем нулевую вероятность совпадения приоритетов Характеристики: - Глубина вершины: $E("dep"[v]) = O(log n)$ - Высота вершины: $E(h[v]) = O(1)$ - Размер поддерева вершины: $E("sz"[v]) = O(log n)$ Есть два способа реализации: - с поворотами - через split-merge == Split-Merge === Split "Режем" дерево вертикальной прямой: `pair<T, T> split(T tree, int line_x)`. Все ключи левого дерева меньше прямой, все ключи правого --- больше === Merge Есть два дерева такие, что у левого все ключи меньше, чем у правого. Merge объединяет их в одно дерево: `T split(T left, T right)`. === Insert ```python tl, tr = split(t, x) merge(tl, merge(T({x, y}), tr)) ``` === Delete - Двумя `split`-ами отрезаем все элементы меньше $x$ и все элементы больше $x$. - `merge`-им два эти дерева == Повороты #grid( columns: (1fr, auto, 1fr), align: center + horizon, [ - y - x - A - B - C ], $arrow("right(x)")\ arrow.l("left(y)")$, [ - x - A - y - B - C ] ) === Insert - Вставка до листа - Подъем поворотами === Delete - Поворотами опускаем в лист - Удаляем лист === Split Делаем `split(a)` - `insert({a, +inf})` --- новый элемент окажется в корне - Левое и правое поддерево корня --- нужные деревья === Merge (Join) - Подвесим деревья к `{a, +inf}` - Сделаем `delete(a)` == Теоремы === Теорема 1 Пусть ключи отсортированы: $x_1 < ... < x_n$ Хотим узнать $"dep"[x_l] = sum_(i = 1)^n A_(i, l)$ --- где $A_(i, l) = "int"(x_i "- предок" x_l)$ $"sz"[x_l] = sum_(j = 1)^n A_(l, j)$ ==== Следствие $a_(i, l) = P(x_i "- предок" x_j)$ $E("dep"[x_l]) = sum_(i = 1)^n a_(i, l) = E("sz"[x_l]) = sum_(i = 1)^n a_(l, i)$ ==== Лемма Пусть все приоритеты разные (это происходит с вероятностью $= 1$) $ x_i "- предок" x_j <=> "prior"(x_i) = max_(min(i, j) <= k <= max(i, j)) "prior"(x_k) $ $ a_(i, j) = 1/(abs(i - j) + 1) $ ==== Теорема $ ln n := log_e n $ $ lg n := log_2 n $ $ E("dep"[x_l]) = 1/(abs(l - 1) + 1) + 1/(abs(l - 2) + 1) + ... + 1/(1 + 1) + 1/1 + 1/(1 + 1) + ... + 1/(abs(n - l) + 1) = \ = {H_l "- сумма гармонического ряда до " l} =\ = H_l + H_(n - l + 1) - 1 < {ln(n) < H_n < ln(n) + 1} < 1 + 2 ln n $ $ E("sz"[x_l]) < 1 + 2 ln n $ $ h_n / ln_n -> gamma, n -> +oo, "где" gamma approx 4.311 $ = Zip-дерево Цель создания --- чтобы ранг (приоритет) занимал меньше бит. В zip-дереве он имеет значение от $1$ до $lg n$ (т.е. столько же, сколько и слоев) и занимает $lg lg n$ бит. Берем не равномерное распределение, а геометрическое. Это логично т.к. количество вершин на соседних уровнях различается примерно в два раза. $ P("rank" = 0) = 1/2, P("rank" = 1) = 1/4, ..., P("rank" = k) = 1/(2^(k + 1)) $ Теперь многие приоритеты совпадают. Пусть у $v$ есть два сына $l$ и $r$: - $"rank"(l) < "rank"(v)$ - $"rank"(r) >= "rank"(v)$ Дерево будет перекошено влево. $ E("rank") = 0 dot 1/2 + 1 dot 1/4 + ... => 2 E = E + 1 => E = 1 $ Операции `unzip` и `zip` --- аналоги `split` и `merge` #figure( caption: [Вставка и удаление в `zip`-дереве], image("zip-tree-insert-delete.jpg", height: 5cm) ) `zip-tree` имеет естественный изоморфизм со `skip-list`: Вершина, которая лежит в $k$-ом уровне, но не лежит в $(k + 1)$-ом в `skip-list`-е имеет `rank = k`. #figure( caption: [Изоморфизм `zip-tree` и `skip-list`], image("zip-tree-skip-list.jpg", height: 5cm) ) `zip-tree` c данными ключами и приоритетам единственно. == Теоремы === Формулки $ r_i := "rank"(i) $ $ "rr" := "rank"("root") $ $ P(r_i = k) = 1/(2^(k + 1)) => P(r_i < k) = 1/2 + ... + 1/(2^(k)) = 1 - 1/(2^k) $ $ P(r_i > k) = 1/(2^k) => P(max_i r_i < k) = (1 - 1/(2^k))^n underbrace(>=, "по н-ву Бернули") 1 - n/(2^k) $ $ P(max r_i >= k) <= n/(2^k) $ $ P("rr" >= ln n +C) <= n/(2^(ln n + C)) = 1/(2^C) $ $ P("rr" >= (c + 1) ln n) <= 1/(n^C) $ === Теорема $ E("rr") = 0 dot P("rr" = 0) + 1 dot P("rr" = 1) + ... =\ = 0 dot P_0 + 1 dot P_1 + ... + ceil(lg n) P_ceil(lg n) + (ceil(lg n) + 1) P_(ceil(lg n) + 1) + ... <=\ <= ceil(lg n) dot sum_(i = 1)^oo P_i + 1 dot 1/2 + 2 dot 1/4 + 3 dot 1/8 + ... = ceil(lg n) + 2 < lg n + 3 $ === Лемма - `low` --- предки $x$-а с ключом, *меньше* чем у $x$-а - `high` --- предки $x$-а с ключом, *больше* чем у $x$-а $y_l$ --- самый высокий из `low` $y_h$ --- самый высокий из `high` $ E("# low") = 1 + ("rank"(y_e) - "rank"(x)) <= 1 + "rank"(y_l) <= lg n + 4$ $ E("# high") <= (1 + "rank"(y_h)) / 2 $ === Теорема Из прошлых лемм: $ E("dep"[v]) = 3/2 lg n + O(1) $ === Теорема (без доказательства) $ E("sz"[v], "rank"(v) == k) <= 3 dot 2^k - 1 $ $ E("sz"[v]) <= 3 / 2 lg n + 2 $ == Сравнение с ДД #figure(table( columns: 3, align: center, table.header[][*ДД*][*Zip*], [глубина], $2 ln n = 1.3863 lg n$, $1.5 ln n$ ))
https://github.com/luiswirth/numpde-slides
https://raw.githubusercontent.com/luiswirth/numpde-slides/main/README.md
markdown
# NumPDE 2024 Tutorial Slides Tutorial class 2024 of <NAME> for *Numerical Methods for Partial Differential Equation* at ETH Zürich. On this repository you can find the [typst](https://typst.app/) source files for the presentation slides. Further resources and information can be found under [numpde.lwirth.com](http://numpde.lwirth.com). ## PDFs You can find compiled PDFs under [releases](https://github.com/luiswirth/numpde-slides/releases). ## Contributions If you find any errors in the slides or want to make some other contribution to the notes, then you are very welcome to open an issue or create a pull request.
https://github.com/maxwell-thum/typst-pf3
https://raw.githubusercontent.com/maxwell-thum/typst-pf3/main/example.typ
typst
MIT License
#import "template.typ": * #import "pf3.typ": * #show: project *Theorem 1: * #pfstep("label-1")[Text of step 1.][ #pfstep("label-1.1")[#case[ Case 1 ]][ #pfsketch Brief sketch to get the intuition across. #pf Paragraph proof. #qed ] #pfstep("label-1.2")[#case[ Case 2 ]][ #pfstep("label-1.2.1")[Text of step][ #pfstep("label-1.2.1.1")[ #assume[ 1. a 2. b 3. c ] #prove[ + d + e ] ][ #pf #lorem(20) #qed ] #qedstep[#pf by contradiction #qed] ] #qedstep[#pf by example #qed] ] #qedstep[ #pf By #stepref("label-1.1") and #stepref("label-1.2"). #qed ] ] #pflet[ $alpha := 2^sigma$ ] #pfstep("label-2")[ #suffices[ ... ] ][ #pf By #stepref("label-1"), ... #qed ] #qedstep[ #pf ... #qed ] *Claim 2: * #pfstep("label-1")[Step 1 of claim 2][ #pf ... #qed ] #qedstep[ #pf ... #qed ]
https://github.com/GuTaoZi/SUSTech-thesis-typst
https://raw.githubusercontent.com/GuTaoZi/SUSTech-thesis-typst/main/template/acknowledge.typ
typst
MIT License
#import "../utils/style.typ": * #let acknoledgement( en_title: false, body ) = { pagebreak(weak: true) align(center)[ #hide[ #heading(level: 1,numbering: none,"致谢") #v(-20pt) ] #if en_title { par(leading: FSIZE.三号)[ #text(font: FONTS.黑体,size: FSIZE.三号, "致谢") #text(font: ("Source Han Sans SC", "Source Han Sans", "Noto Sans CJK SC", "SimHei", "Heiti SC", "STHeiti"),size: FSIZE.三号,"\nAcknowledgement") ] }else{ text(font: FONTS.黑体,size: FSIZE.三号, "致谢") } \ ] par(first-line-indent: 2em,leading: 1.5 *FSIZE.小四)[ #text(font: FONTS.宋体,size: FSIZE.小四, body) ] }
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/RTR/fwm.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: "Calculo de sobreposição de espectro", subtitle: "Redes de Transmissão", authors: ("<NAME>",), date: "25 de Agosto de 2024", doc, ) = Introdução: O objetivo deste relatório é realizar o cálculo de sobreposição de espectro utilizando o script python fornecido pelo professor, verificando quais canais possuem sobreposição e quais são as frequências que estão próximas. = Frequências utilizadas: Para o calculo de sobreposição, é necessário primeiramento obter as frequências de cada um dos canais. Para isso, é necessário converter os comprimentos de onda fornecidos em frequência. == Comprimentos de entrada: Os comprimentos de onda fornecidos para verificação são os seguintes: $ lambda_1 - 1528,77 "nm" $$ lambda_2 - 1529,55 "nm" $$ lambda_3 - 1530,33 "nm" $$ lambda_4 - 1531,12 "nm" $ == Conversão para frequência: Considerando a velocidade da luz como 299.792.458 m/s, temos como que a frequência de cada uma das ondas é dada por: $ F_1 = (299792458) / (1528.77 * 10^-9) = 196100432373738,3 "ou" 196,1004323737383 "THz" $ $ F_2 = (299792458) / (1529.55 * 10^-9) = 196000430191886,5 "ou" 196,0004301918865 "THz" $ $ F_3 = (299792458) / (1530.33 * 10^-9) = 195900529951056,3 "ou" 195,9005299510563 "THz" $ $ F_4 = (299792458) / (1531.12 * 10^-9) = 195799452688228,2 "ou" 195,7994526882282 "THz" $ = Alterando o script python: Para verificar a sobreposição de espectro, é necessário utilizar um script para verificar se a frequência calculada está próxima de alguma das frequências originais. == Script original: Foi fornecido um script base como referência passado pelo professor para verificação de sobreposição de espectro. O mesmo está apresentado abaixo: #sourcecode[```python # IFSC Câmpus São José # Engenharia de Telecomunicações # RTR029007 Redes de Transmissão # Professor: <NAME> # Four Wave Mixing import os import itertools print('===========================Inicio======================') print('Ff = fi + fj - fk, onde i dif k e j dif k') n = int(input('Digite n: ')) canais = list() for cont in range(0,n): canais.append(float(input('Digite f em THz: '))) c = 0; print('==========================Arranjos=====================') for f in itertools.product(range(0, n), repeat=3): if f[0] != f[2] and f[1] != f[2]: c = c+1 print('\nArranjo ',c, '=','[',canais[f[0]], canais[f[1]], canais[f[2]],']') Ff = canais[f[0]] + canais[f[1]] - canais[f[2]] print('Ff = ', round(Ff,2)) if Ff in canais: print("Sobreposição!") numar = c print('número de conjuntos = ',numar) print('========================================================') print('====================FIM========================') ```] == Adição do calculo de sobreposição: No script, foi adicionado uam função para verificar a sobreposição de espectro, que verifica se a frequência calculada está próxima de alguma das frequências originais: #sourcecode[```python # Autor: <NAME> # Função para verificar sobreposição com tolerância def verificar_sobreposicao(canais, resultados, tolerancia=0.000435): sobreposicoes = [] canais_set = set(canais) for f, arranjo in resultados: for canal in canais: if abs(f - canal) <= tolerancia: sobreposicoes.append((arranjo, f, canal)) break return sobreposicoes ```] == Código final: Uma vez editado, o código final para verificação de sobreposição de espectro é o seguinte, além de adicionar a função de verificação de sobreposição, outras alterações foram realizadas: #sourcecode[```python import os import itertools n = 4 canais = [ 196.1004323737383, 196.0004301918865, 195.9005299510563, 195.7994526882282 ] def verificar_sobreposicao(canais, resultados, tolerancia=0.000435): sobreposicoes = [] canais_set = set(canais) for f, arranjo in resultados: for canal in canais: if abs(f - canal) <= tolerancia: sobreposicoes.append((arranjo, f, canal)) break return sobreposicoes resultados = [] c = 0 print('==========================Arranjos=====================') for f in itertools.product(range(0, n), repeat=3): if f[0] != f[2] and f[1] != f[2]: c += 1 arranjo = [canais[f[0]], canais[f[1]], canais[f[2]]] Ff = canais[f[0]] + canais[f[1]] - canais[f[2]] resultados.append((round(Ff, 2), arranjo)) print('\nArranjo ', c, '=','[', arranjo[0], arranjo[1], arranjo[2], ']') print('Ff = ', round(Ff, 2)) sobreposicoes = verificar_sobreposicao(canais, resultados) num_sobreposicoes = len(sobreposicoes) print('==========================Sobreposições=====================') if sobreposicoes: print('\nCanais com Sobreposição:') for arranjo, freq_calculada, freq_original in sobreposicoes: print(f'Arranjo {arranjo} tem sobreposição com Ff = {freq_calculada} THz (próximo de {freq_original} THz)') print('==========================Resultados========================') print('Número de conjuntos = ', c) print('Número de sobreposições = ', num_sobreposicoes) ```] = Resultados: Uma vez com o script finalizado, é possível realizar a execução do mesmo para verificar a sobreposição de espectro. Para isso, devemos considerar um valor de tolerância a ser utilizado para decidir se o canal está ou não sobrepondo um outro canal. == Tolerância de 0.000435 THz Utilizando a tolerância de 0.000435 THz, temos os seguintes resultados: === Arranjos: Foram obtidos os seguintes arranjos: #sourcecode[```conf Arranjo 1 = [ 196.100432373 196.100432373 196.000430191 ] -> Ff = 196.2 Arranjo 2 = [ 196.100432373 196.100432373 195.900529951 ] -> Ff = 196.3 Arranjo 3 = [ 196.100432373 196.100432373 195.799452688 ] -> Ff = 196.4 Arranjo 4 = [ 196.100432373 196.000430191 195.900529951 ] -> Ff = 196.2 Arranjo 5 = [ 196.100432373 196.000430191 195.799452688 ] -> Ff = 196.3 Arranjo 6 = [ 196.100432373 195.900529951 196.000430191 ] -> Ff = 196.0 Arranjo 7 = [ 196.100432373 195.900529951 195.799452688 ] -> Ff = 196.2 Arranjo 8 = [ 196.100432373 195.799452688 196.000430191 ] -> Ff = 195.9 Arranjo 9 = [ 196.100432373 195.799452688 195.900529951 ] -> Ff = 196.0 Arranjo 10 = [ 196.000430191 196.100432373 195.900529951 ] -> Ff = 196.2 Arranjo 11 = [ 196.000430191 196.100432373 195.799452688 ] -> Ff = 196.3 Arranjo 12 = [ 196.000430191 196.000430191 196.100432373 ] -> Ff = 195.9 Arranjo 13 = [ 196.000430191 196.000430191 195.900529951 ] -> Ff = 196.1 Arranjo 14 = [ 196.000430191 196.000430191 195.799452688 ] -> Ff = 196.2 Arranjo 15 = [ 196.000430191 195.900529951 196.100432373 ] -> Ff = 195.8 Arranjo 16 = [ 196.000430191 195.900529951 195.799452688 ] -> Ff = 196.1 Arranjo 17 = [ 196.000430191 195.799452688 196.100432373 ] -> Ff = 195.7 Arranjo 18 = [ 196.000430191 195.799452688 195.900529951 ] -> Ff = 195.9 Arranjo 19 = [ 195.900529951 196.100432373 196.000430191 ] -> Ff = 196.0 Arranjo 20 = [ 195.900529951 196.100432373 195.799452688 ] -> Ff = 196.2 Arranjo 21 = [ 195.900529951 196.000430191 196.100432373 ] -> Ff = 195.8 Arranjo 22 = [ 195.900529951 196.000430191 195.799452688 ] -> Ff = 196.1 Arranjo 23 = [ 195.900529951 195.900529951 196.100432373 ] -> Ff = 195.7 Arranjo 24 = [ 195.900529951 195.900529951 196.000430191 ] -> Ff = 195.8 Arranjo 25 = [ 195.900529951 195.900529951 195.799452688 ] -> Ff = 196.0 Arranjo 26 = [ 195.900529951 195.799452688 196.100432373 ] -> Ff = 195.6 Arranjo 27 = [ 195.900529951 195.799452688 196.000430191 ] -> Ff = 195.7 Arranjo 28 = [ 195.799452688 196.100432373 196.000430191 ] -> Ff = 195.9 Arranjo 29 = [ 195.799452688 196.100432373 195.900529951 ] -> Ff = 196.0 Arranjo 30 = [ 195.799452688 196.000430191 196.100432373 ] -> Ff = 195.7 Arranjo 31 = [ 195.799452688 196.000430191 195.900529951 ] -> Ff = 195.9 Arranjo 32 = [ 195.799452688 195.900529951 196.100432373 ] -> Ff = 195.6 Arranjo 33 = [ 195.799452688 195.900529951 196.000430191 ] -> Ff = 195.7 Arranjo 34 = [ 195.799452688 195.799452688 196.100432373 ] -> Ff = 195.5 Arranjo 35 = [ 195.799452688 195.799452688 196.000430191 ] -> Ff = 195.6 Arranjo 36 = [ 195.799452688 195.799452688 195.900529951 ] -> Ff = 195.7 ```] === Sobreposições: A partir dos arranjos obtidos, foram verificadas as sobreposições coms as frequências de entrada, que são as seguintes: #sourcecode[```conf Arranjo [196.100432373, 195.900529951, 196.000430191] -> Sobreposição com Ff = 196.0 (Próximo de: 196.000430191 THz) Arranjo [196.100432373, 195.799452688, 195.900529951] -> Sobreposição com Ff = 196.0 (Próximo de: 196.000430191 THz) Arranjo [196.000430191, 196.000430191, 195.900529951] -> Sobreposição com Ff = 196.1 (Próximo de: 196.100432373 THz) Arranjo [196.000430191, 195.900529951, 195.799452688] -> Sobreposição com Ff = 196.1 (Próximo de: 196.100432373 THz) Arranjo [195.900529951, 196.100432373, 196.000430191] -> Sobreposição com Ff = 196.0 (Próximo de: 196.000430191 THz) Arranjo [195.900529951, 196.000430191, 195.799452688] -> Sobreposição com Ff = 196.1 (Próximo de: 196.100432373 THz) Arranjo [195.900529951, 195.900529951, 195.799452688] -> Sobreposição com Ff = 196.0 (Próximo de: 196.000430191 THz) Arranjo [195.799452688, 196.100432373, 195.900529951] -> Sobreposição com Ff = 196.0 (Próximo de: 196.000430191 THz) ```] === Resultados: Com os resultados obtidos, temos que: #sourcecode[```conf Número de conjuntos = 36 Número de sobreposições = 8 ```] == Tolerância de 0.00435 THz Utilizando a tolerância de 0.00435 THz, temos os seguintes resultados: === Arranjos: Foram obtidos os seguintes arranjos: #sourcecode[```conf Arranjo 1 = [ 196.100432373 196.100432373 196.000430191 ] -> Ff = 196.2 Arranjo 2 = [ 196.100432373 196.100432373 195.900529951 ] -> Ff = 196.3 Arranjo 3 = [ 196.100432373 196.100432373 195.799452688 ] -> Ff = 196.4 Arranjo 4 = [ 196.100432373 196.000430191 195.900529951 ] -> Ff = 196.2 Arranjo 5 = [ 196.100432373 196.000430191 195.799452688 ] -> Ff = 196.3 Arranjo 6 = [ 196.100432373 195.900529951 196.000430191 ] -> Ff = 196.0 Arranjo 7 = [ 196.100432373 195.900529951 195.799452688 ] -> Ff = 196.2 Arranjo 8 = [ 196.100432373 195.799452688 196.000430191 ] -> Ff = 195.9 Arranjo 9 = [ 196.100432373 195.799452688 195.900529951 ] -> Ff = 196.0 Arranjo 10 = [ 196.000430191 196.100432373 195.900529951 ] -> Ff = 196.2 Arranjo 11 = [ 196.000430191 196.100432373 195.799452688 ] -> Ff = 196.3 Arranjo 12 = [ 196.000430191 196.000430191 196.100432373 ] -> Ff = 195.9 Arranjo 13 = [ 196.000430191 196.000430191 195.900529951 ] -> Ff = 196.1 Arranjo 14 = [ 196.000430191 196.000430191 195.799452688 ] -> Ff = 196.2 Arranjo 15 = [ 196.000430191 195.900529951 196.100432373 ] -> Ff = 195.8 Arranjo 16 = [ 196.000430191 195.900529951 195.799452688 ] -> Ff = 196.1 Arranjo 17 = [ 196.000430191 195.799452688 196.100432373 ] -> Ff = 195.7 Arranjo 18 = [ 196.000430191 195.799452688 195.900529951 ] -> Ff = 195.9 Arranjo 19 = [ 195.900529951 196.100432373 196.000430191 ] -> Ff = 196.0 Arranjo 20 = [ 195.900529951 196.100432373 195.799452688 ] -> Ff = 196.2 Arranjo 21 = [ 195.900529951 196.000430191 196.100432373 ] -> Ff = 195.8 Arranjo 22 = [ 195.900529951 196.000430191 195.799452688 ] -> Ff = 196.1 Arranjo 23 = [ 195.900529951 195.900529951 196.100432373 ] -> Ff = 195.7 Arranjo 24 = [ 195.900529951 195.900529951 196.000430191 ] -> Ff = 195.8 Arranjo 25 = [ 195.900529951 195.900529951 195.799452688 ] -> Ff = 196.0 Arranjo 26 = [ 195.900529951 195.799452688 196.100432373 ] -> Ff = 195.6 Arranjo 27 = [ 195.900529951 195.799452688 196.000430191 ] -> Ff = 195.7 Arranjo 28 = [ 195.799452688 196.100432373 196.000430191 ] -> Ff = 195.9 Arranjo 29 = [ 195.799452688 196.100432373 195.900529951 ] -> Ff = 196.0 Arranjo 30 = [ 195.799452688 196.000430191 196.100432373 ] -> Ff = 195.7 Arranjo 31 = [ 195.799452688 196.000430191 195.900529951 ] -> Ff = 195.9 Arranjo 32 = [ 195.799452688 195.900529951 196.100432373 ] -> Ff = 195.6 Arranjo 33 = [ 195.799452688 195.900529951 196.000430191 ] -> Ff = 195.7 Arranjo 34 = [ 195.799452688 195.799452688 196.100432373 ] -> Ff = 195.5 Arranjo 35 = [ 195.799452688 195.799452688 196.000430191 ] -> Ff = 195.6 Arranjo 36 = [ 195.799452688 195.799452688 195.900529951 ] -> Ff = 195.7 ```] === Sobreposições: A partir dos arranjos obtidos, foram verificadas as sobreposições coms as frequências de entrada, que são as seguintes: #sourcecode[```conf Canais com Sobreposição: Arranjo [196.100432373, 195.900529951, 196.000430191] -> Sobreposição com Ff = 196.0 (próximo de: 196.000430191 THz) Arranjo [196.100432373, 195.799452688, 196.000430191] -> Sobreposição com Ff = 195.9 (próximo de: 195.900529951 THz) Arranjo [196.100432373, 195.799452688, 195.900529951] -> Sobreposição com Ff = 196.0 (próximo de: 196.000430191 THz) Arranjo [196.000430191, 196.000430191, 196.100432373] -> Sobreposição com Ff = 195.9 (próximo de: 195.900529951 THz) Arranjo [196.000430191, 196.000430191, 195.900529951] -> Sobreposição com Ff = 196.1 (próximo de: 196.100432373 THz) Arranjo [196.000430191, 195.900529951, 196.100432373] -> Sobreposição com Ff = 195.8 (próximo de: 195.799452688 THz) Arranjo [196.000430191, 195.900529951, 195.799452688] -> Sobreposição com Ff = 196.1 (próximo de: 196.100432373 THz) Arranjo [196.000430191, 195.799452688, 195.900529951] -> Sobreposição com Ff = 195.9 (próximo de: 195.900529951 THz) Arranjo [195.900529951, 196.100432373, 196.000430191] -> Sobreposição com Ff = 196.0 (próximo de: 196.000430191 THz) Arranjo [195.900529951, 196.000430191, 196.100432373] -> Sobreposição com Ff = 195.8 (próximo de: 195.799452688 THz) Arranjo [195.900529951, 196.000430191, 195.799452688] -> Sobreposição com Ff = 196.1 (próximo de: 196.100432373 THz) Arranjo [195.900529951, 195.900529951, 196.000430191] -> Sobreposição com Ff = 195.8 (próximo de: 195.799452688 THz) Arranjo [195.900529951, 195.900529951, 195.799452688] -> Sobreposição com Ff = 196.0 (próximo de: 196.000430191 THz) Arranjo [195.799452688, 196.100432373, 196.000430191] -> Sobreposição com Ff = 195.9 (próximo de: 195.900529951 THz) Arranjo [195.799452688, 196.100432373, 195.900529951] -> Sobreposição com Ff = 196.0 (próximo de: 196.000430191 THz) Arranjo [195.799452688, 196.000430191, 195.900529951] -> Sobreposição com Ff = 195.9 (próximo de: 195.900529951 THz) ```] === Resultado: Com os resultados obtidos, temos que: #sourcecode[```conf Número de conjuntos = 36 Número de sobreposições = 16 ```] = Conclusão: A partir dos conceitos vistos, alterações de código, e resultados obtidos, podemos concluir que a verificação de sobreposição de espectro é uma ferramenta importante para a análise de redes de transmissão, permitindo identificar quais canais estão próximos e podem causar interferência entre si. A partir dos resultados obtidos, é possível verificar que a tolerância utilizada influencia diretamente na quantidade de sobreposições encontradas, sendo necessário ajustar o valor de tolerância de acordo com a aplicação desejada. Quanto maior a tolerância utilizada, maior a quantidade de sobreposições encontradas, sendo necessário um ajuste fino para encontrar o equilíbrio entre a quantidade de sobreposições e a precisão desejada, de acordo com o tamanho do canal sendo utilizado na transmissão.
https://github.com/eduardz1/Bachelor-Thesis
https://raw.githubusercontent.com/eduardz1/Bachelor-Thesis/main/chapters/conclusions.typ
typst
#import "../utils/common.typ": * = Conclusions By the end of the internship, a working model of the greenhouse was delivered, the sensors and the Python program enabled it to continuously monitor the parameters we discussed and save the information on a time series database. After the internship, I learned several concepts related to semantic technologies and the semantic web. It was a very interesting experience working with a novel language, SMOL, that was tailor-made for the specific use case. The project allowed me to affine my skills in Python and to have the opportunity to structure a highly modular project. I had to learn some electronics to interface the Raspberry Pis with the sensors and working with them was a learning experience. We hope our work will help in case the team at the University of Oslo decides to expand on and scale up the project.
https://github.com/dashuai009/dashuai009.github.io
https://raw.githubusercontent.com/dashuai009/dashuai009.github.io/main/src/content/blog/051.typ
typst
#let date = datetime( year: 2024, month: 10, day: 22, ) #metadata(( title: "配置电脑", subtitle: [CEF], author: "dashuai009", description: "一些软件的配置记录", pubDate: date.display(), ))<frontmatter> == typst #link("https://github.com/typst/typst")[官方github] windows 安装和更新 ```sh winget install --id Typst.Typst ``` github release里下载t`ypst-x86_64-unknown-linux-musl.tar.xz`,然后解压缩,`chmod +x typst` == docker #link("https://docs.docker.com/engine/install/ubuntu/")[docker ubuntu 安装] ```sh for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done # Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ```
https://github.com/VisualFP/docs
https://raw.githubusercontent.com/VisualFP/docs/main/SA/project_documentation/content/meeting_minutes/week_12.typ
typst
= Project Meeting 07.12.2023 14:00 - 14:45 (Campus RJ 1.167) == Participants - Prof. Dr. <NAME> - <NAME> - <NAME> == Agenda - Presentation of new features in the PoC - Clarification of some questions regarding submission: - Are there co-examiners for the SA? Answer: No - Until when do we need to send the broschure abstract to our advisor for proof reading? Answer: 13.12.2023 - Is the broschure abstract basically a short management summary? Answer: Yes - Signing of the copyright & rights of use agreement
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/delimited-00.typ
typst
Other
// Test automatic matching. $ (a) + {b/2} + |a|/2 + (b) $ $f(x/2) < zeta(c^2 + |a + b/2|)$
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/repeat.typ
typst
// Test the `repeat` function. --- repeat-basic --- // Test multiple repeats. #let sections = ( ("Introduction", 1), ("Approach", 1), ("Evaluation", 3), ("Discussion", 15), ("Related Work", 16), ("Conclusion", 253), ) #for section in sections [ #section.at(0) #box(width: 1fr, repeat[.]) #section.at(1) \ ] --- repeat-dots-rtl --- // Test dots with RTL. #set text(lang: "ar") مقدمة #box(width: 1fr, repeat[.]) 15 --- repeat-empty --- // Test empty repeat. A #box(width: 1fr, repeat[]) B --- repeat-unboxed --- // Test unboxed repeat. #repeat(rect(width: 2em, height: 1em)) --- repeat-align-and-dir --- // Test single repeat in both directions. A#box(width: 1fr, repeat(rect(width: 6em, height: 0.7em)))B #set align(center) A#box(width: 1fr, repeat(rect(width: 6em, height: 0.7em)))B #set text(dir: rtl) ريجين#box(width: 1fr, repeat(rect(width: 4em, height: 0.7em)))سون --- repeat-unrestricted --- // Error: 2:2-2:13 repeat with no size restrictions #set page(width: auto) #repeat(".") --- repeat-gap --- // Test repeat with custom gap. A#box(width: 1fr, repeat(rect(width: 2em, height: 1em), gap: 1em))B --- repeat-no-justify --- // Test repeat with disabled justification. #set repeat(justify: false) A#box(width: 1fr, repeat(rect(width: 2em, height: 1em), gap: 1em))B --- repeat-no-justify-align --- // Test repeat with alignment and disabled justification. #set repeat(justify: false) #set align(right) A#box(width: 1fr, repeat(rect(width: 2em, height: 1em), gap: 1em))B
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/dir.typ
typst
--- dir-axis --- // Test direction methods. #test(ltr.axis(), "horizontal") #test(rtl.axis(), "horizontal") #test(ttb.axis(), "vertical") #test(btt.axis(), "vertical") --- dir-start --- #test(ltr.start(), left) #test(rtl.start(), right) #test(ttb.start(), top) #test(btt.start(), bottom) --- dir-end --- #test(ltr.end(), right) #test(rtl.end(), left) #test(ttb.end(), bottom) #test(btt.end(), top) --- dir-inv --- #test(ltr.inv(), rtl) #test(rtl.inv(), ltr) #test(ttb.inv(), btt) #test(btt.inv(), ttb)
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/all_types_working/all_types_working_mix_result.typ
typst
GNU nano 6.2 test1.typ = #strike[Introduction];#underline[CHANGED] In this #strike[report,];#underline[CHANGED,] we will explore the various factors that influence #emph[fluid dynamics] in glaciers and how they contribute to the formation and behaviour#strike[ ];#strike[of];#strike[ ];#strike[these] #strike[natural];#underline[SOMETHING] #strike[structures.];#underline[NEW.] #underline[Another];#underline[ ];#underline[one.] The equation $Q = rho A v + C$ defines the glacial flow rate. The flow #strike[rate];#underline[CHANGED] of a glacier is defined by the following equation: $ Q = rho A v + C $ The flow rate of a #strike[glacier];#underline[CHANGED] is given by the following equation: #strike[$ Q = rho A v + upright(" time offset ") $];#underline[$ Q = rho A v + upright(" time CHANGED ") $] Total displaced soil by glacial flow: #strike[$ 7.32 beta + sum_(i = 0)^nabla frac(Q_i (a_i - epsilon), 2) $];#underline[$ 7.32 beta + sum_(i = 0)^nabla frac(Q_i (a_i - epsilon), 3) $] #underline[$ v colon.eq vec(x_1, x_2, x_2) $] #strike[$ v colon.eq vec(x_1, x_2, x_3) $];#underline[$ a arrow.r.squiggly b $] $ a arrow.r.squiggly b $ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do#underline[ ];#underline[eiusmod];#underline[ ];#underline[tempor];#underline[ ];#underline[incididunt];#underline[ ];#underline[ut];#underline[ ];#underline[labore];#underline[ ];#underline[et];#underline[ ];#underline[dolore];#underline[ ];#underline[magna];#underline[ ];#underline[aliqua.];#underline[ ];#underline[Ut] Number: #strike[3];#underline[6] $- x$ is the opposite of $x$ #underline[let];#underline[ ];#underline[name];#underline[ ];#underline[\=];#underline[ ];#underline[\[];#underline[#strong[Typst NEW!];];#underline[\]];#underline[ ];let name = \[#strong[#underline[Typst];#underline[ ];#strike[Typst!];#underline[NEW!];];\] #strong[strong] `print(1)` #link("https://typst.app/") <intro> = Heading $x^2$ ‘single” or “double” ~, — #underline[$x^3$];#underline[ ];#strike[$x^2$];#underline[$x^3$] $ x^2 $ #strike[$x_1$];#underline[$x_5$] $x^2$ $1 + frac(a + b, 5)$ $x\ y$ #strike[$x & = 2\ & = 3$];#underline[$x & = 5\ & = 3$] $pi$ $arrow.r$ \ #underline[$x y$];#underline[ ];$x y$ $arrow.r , eq.not$ $a upright(" is natural")$ $⌊x⌋$ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi #emph[Hello] \ 5 #underline[#emph[Hello];];#underline[ \ ];hello from the #strong[world] This is Typst‘s documentation. It #strike[explains];#underline[CHANGED] Typst. #underline[Sum];#underline[ ];#underline[is];#underline[ ];#underline[5.] Sum is 5. The #strike[coordinates];#underline[CHANGED] are 1, 2. The #strike[first];#underline[CHANGED] element is #strike[1.];#underline[5.] The last element is 4. #underline[Austen];#underline[ ];#underline[wrote];#underline[ ];#underline[Persuasion.] Austen wrote Persuasion. Homer wrote The Odyssey. The y coordinate is 2. (5, 6, 11) This is shown abc Hello \ Heading \ 3 is the same as 3 4 \ 3 \ a — b — c #strike[Dobrze];#underline[CHANGED] #strong[Date:] 26.12.2022 \ #strong[Topic:] Infrastructure Test \ #strong[Severity:] High \ abc \ #strong[#strike[my];#strike[ ];#strike[text];#underline[changed];] \ already low #strike[ABC];#underline[CHANGED];#strike[ \ ];#strike[#strong[MY TEXT];] \ ALREADY HIGH #underline[NEW] “This is in quotes.” “Das ist in Anführungszeichen.” #underline[“C’est];#underline[ ];#underline[CHANGED];#underline[ ];#underline[guillemets.”] “C’est #strike[entre];#underline[CHANGED] guillemets.” 1#super[st] try! Italic#strike[ ];#strike[Oblique] This is #underline[important];. Take #underline[care]
https://github.com/0xPARC/0xparc-intro-book
https://raw.githubusercontent.com/0xPARC/0xparc-intro-book/main/summer-notes-evan/src/0803-research-workshop.typ
typst
#import "@local/evan:1.0.0":* = Research workshop on August 3: Problem statements == Coding Theory I (<NAME>) #problem[ Solve conjecture 1 in #url("https://cic.iacr.org/p/1/1/2/pdf") ] == <NAME>'s two problems 1. Outsource SNARK proof generation to untrusted servers 2. Efficient short _weighted_ threshold signature. Good progress in #url("https://eprint.iacr.org/2023/1609.pdf"). === Outsource SNARK proof generation to untrusted servers - We have a secret witness $w$, and a complicated circuit $C$, and want a server to get a proof of $C(w) = 0$ (say). But we don't want the server to learn $w$. - One method is a collaborative proof where we secret-share among $n$ servers. [B-Ozdemir'21, GGJPS'23, CLMZ'23.] As long as at most $n-1$ are malicious, we're OK. - Surprisingly, this uses zkSNARK with an MPC-friendly prover, and the MPC adds almost no overhead. - But we need an assumption the servers are not colluding. #problem[ Can we do it with a single untrusted server? ] The obvious approach is to use FHE: the powerful server could run the SNARK-prover inside an FHE. This is a theoretical approach, but is completely unpractical. #remark[ We don't need verifiable FHE for this, unlike some other situations: because the output is an FHE proof, the client can just ] The goal is to design a FHE-friendly SNARK: that is, the SNARK prover is a shallow circuit that can run inside FHE. #url("https://eprint.iacr.org/2023/1609") points out that FRI on hidden values is a viable approach. One other way to make the work shallower for the FHE is to do some rounds of interaction. === Weighted signatures We have $n$ people with weights $w_1$, ..., $w_n$ and we want a quorum $S subset.eq [n]$ to be able to sign iff $sum_(i in S) w_i > t$ for some threshold $t$. #remark[ Used in proof-of-stake sometimes. ] The trivial way to do this is to use a non-weighted scheme and then give $w_i$ shares to the $i$th person; this is pretty inefficient. (But it's actually done in practice this way sometimes.) #problem[ We want a _practical_ scheme where all the following are independent of $n$, $t$, and $(w_1, ..., w_n)$: - the signature size, - secret key size, - public key size, - verification time, - and each party's signing team. ] This is easy with generic SNARK techniques, because the aggregator could simply produce a proof it saw all the signatures from $S$. But we'd like a simple scheme that don't require SNARK's. == A new hash function (<NAME>) Let $p := 2^64-2^32+1$ be the Goldilocks prime and work in $FF_p$. Our function has signature $ FF_p^8 arrow.r.hook FF_p^(12) -> FF_p^(12) arrow.r.twohead FF_p^4. $ The first arrow is inclusion where the last four coordinates are dropped to zero. The last arrow is projection onto the first four coordinates. The main operation is the center arrow. We view the input as $vec(v) in FF_p^(12)$ and apply a certain function $30$ times. It involves a linear part, and a seventh powers. This is a new hash function and hasn't been thought about much yet. #problem[ Try to either find a preimage or a collision for this hash function. ] #remark[ Colin's question clarifies that the $arrow.r.hook$ and $arrow.r.twohead$ are necessary because the main arrow is easily invertible (they are invertible matrix multiplications and seventh powers in $FF_p$). ] == PIR open problems (Elaine Shi) To start, repeat the following content in @pir: - Statement of PIR problem - Comparison to ORAM - The discussion of the two naive attempts The following two facts are known: 1. In a single-server setting, cryptography is necessary for sub-linear bandwidth/communication. 2. Classical PIR with no pre-processing always requires at least $Omega(n)$ compute. In a 2-server, Dvir-Gopi'16 (FOCS best paper) gets $n^o(1)$ bandwidth and $n^O(sqrt(log log n slash log n))$ computation for the server. With $omega(1)$ servers, doubly-efficient schemes exist with $n^o(1)$ bandwidth and $n^(1+o(1))$ server space. Questions (purely information theoretic): #problem[ In DG'16, can we make the server compute linear without cryptographic assumptions? ] (Boneh says this already known with crytographic assumptions.) #problem[ For 2-server IT, can we have a scheme with $o(n^(1/3))$ bandwidth and sublinear computation? ]
https://github.com/donabe8898/typst-slide
https://raw.githubusercontent.com/donabe8898/typst-slide/main/opc/並行prog/03/Go4.typ
typst
MIT License
#show link: set text(blue) #set text(font: "Noto Sans CJK JP",size:13pt) #show heading: set text(font: "Noto Sans CJK JP") #show raw: set text(font: "0xProto Nerd Font") #show raw.where(block: true): block.with( fill: luma(245), inset: 10pt, radius: 10pt ) #align(center)[ ```go // NOTE: 連結リストの実装 package main import "fmt" type Node struct { data int next *Node } type LinkedList struct { head *Node // 先頭ノード } // 位置を指定して挿入 func (list *LinkedList) Insert(data int, pos int) error { newNode := &Node{data: data} if pos < 0 { return fmt.Errorf("場所がありません: %d", pos) } if pos == 0 { newNode.next = list.head list.head = newNode return nil } current := list.head for i := 0; i < pos-1; i++ { if current == nil || current.next == nil { return fmt.Errorf("範囲外") } current = current.next } newNode.next = current.next current.next = newNode return nil } // 位置を指定して削除 func (list *LinkedList) Delete(pos int) error { if list.head == nil { return fmt.Errorf("リストにデータがありません") } if pos < 0 { return fmt.Errorf("場所がありません: %d", pos) } if pos == 0 { return fmt.Errorf("場所がありません: %d", pos) } current := list.head for i := 0; i < pos-1; i++ { if current == nil || current.next == nil { return fmt.Errorf("範囲外") } current = current.next } if current.next == nil { return fmt.Errorf("範囲外") } // 削除というか、ポインタの変更やねこれは current.next = current.next.next return nil } // リストの全要素を表示 func (list *LinkedList) Display() { current := list.head for current != nil { fmt.Printf("%d -> ", current.data) current = current.next } fmt.Println("nil") } func main() { list := LinkedList{} list.Insert(10, 0) list.Insert(11, 0) list.Insert(12, 0) list.Display() list.Delete(2) list.Display() } ``` ]
https://github.com/morel-olivier/template-typst
https://raw.githubusercontent.com/morel-olivier/template-typst/master/basic-report/conf.typ
typst
#let conf( fontSize: 12pt, title: "Title", company: none, authors: (), frontPagePicture: none, language: "en", region: none, doc ) = { /******************************************************************************* * Internal function * * Those functions are only for use by the template *******************************************************************************/ let authorsList = [] if type(authors) == "array"{ for i in range(authors.len()) { if i == 0 { authorsList += [#authors.at(i)] } else { authorsList += [ & #authors.at(i)] } } } else { authorsList = [#authors] } // currently the heading displayed is the previous one. If the page begin with // a new heading then the header still display the last one. This due to the // fact that the header is generated before the display of the header let generateHeaders() = { context { let previousHeadings = query(selector(heading).before(here())) smallcaps[*#title*] h(1fr) if previousHeadings.len() != 0 { emph(previousHeadings.last().body) } } line(length: 100%) } let generateFooters() = { line(length: 100%) context { grid( columns: (50%, 50%), rows: auto, { [#counter(page).get().at(0)] // if counter(page).at(here()).even(){ // [hello] // } }, { [hello] } ) } /*locate(loc =>{ grid( columns: (50%, 50%), rows: auto, { if calc.even(loc.page()) { if company != none [ #company | #authorsList ] else[ #authorsList ] } else { set align(left) counter(page).display("1/1", both: true) } }, { if not calc.even(loc.page()) { if company != none [ #company | #authorsList ] else[ #authorsList ] } else { set align(right) counter(page).display("1/1", both: true) } }, ) })*/ } /******************************************************************************* * Document settings * * This is where the actual configuration of the document is done. *******************************************************************************/ set document( title: title, author: authors ) set text( font: "Arial", size: fontSize, lang: "fr", region: "CH", ) set page( paper: "a4", header: generateHeaders(), footer: generateFooters(), ) set par( justify: true, ) set heading( numbering: "1.1.1.", ) let diplayTitle() = [ #align(center, text(2em)[ #smallcaps[*#title*] ]) ] let firstPage( ) = { set page( header: none, footer: none, ) if frontPagePicture != none { align(center + horizon, text(2em)[ #smallcaps[*#title*] #layout(size => { let width = size.width image(frontPagePicture, width: size.width) }) ]) } else { align(center + horizon, text(2em)[ #smallcaps[*#title*] ]) } align(bottom, text(1.4em)[ Auteur#if(type(authors) == "array"){[s]}~: #authorsList #if company != none { company } Date~: #datetime.today().display() ]) } //diplayTitle() firstPage() outline() pagebreak() doc }
https://github.com/thanhdxuan/dacn-report
https://raw.githubusercontent.com/thanhdxuan/dacn-report/master/Lab02/contents/03-datahandling.typ
typst
#pagebreak() #set enum(numbering: "a)") = *Hashing* == Câu 1: Hàm một chiều (one-way function) là gì? Hàm một chiều là hàm mà rất dễ mã hóa nhưng không giải mã được, ta không thể tính lại được bản gốc khi có bản mã. == Câu 2: Cho một ví dụ để minh hoạ việc sử dụng hàm băm có thể giúp kiểm tra tính toàn vẹn của thông điệp. _Gợi ý: mã hoá thông điệp, tạo ra thay đổi trên ciphertext và sử dụng hàm băm để kiểm tra thông điệp được giải mã có thay đổi so với thông điệp gốc ban đầu._ Có thể dùng hàm băm để tạo chữ kí số giúp xác thực tính toàn vẹn của thông điệp cũng như xác minh được người gửi. Ví dụ với việc gửi thông điệp M. Bên gửi: sẽ gửi dùng hàm Hash để tính h = Hash(M), sau đó lấy h đi mã hóa bằng khóa riêng người gửi để được chữ ký số S. Người gửi sẽ gửi cả M và S. Bên nhân: lấy ra M và tính h = Hash(M), sau đó sẽ lấy khóa công khai người gửi để giải mã S ta được h'. Cuối cùng so trùng h = h' để xem tính toàn vẹn của dữ liệu. == Câu 3: Hàm băm H(·) là hàm có chức năng chuyển thông điệp có kích thước bất kì bất kỳ về kích thước cố định: + Xem xét giá trị hash được tạo ra bằng cách áp dụng giải thuật hash SHA-1 trên một ký tự trong bảng chữ cái tiếng Anh: C6 3A E6 DD 4F C9 F9 DD A6 69 70 E8 27 D1 3F 7C 73 FE 84 1C. Hãy tìm ký tự chữ cái tiếng anh được sử dụng và mô tả cách làm? (dùng công cụ CrypTool) - Bước 1: Mở công cụ, và chọn vào phần Hash Functions, và chọn giải thuật *SHA1* - Bước 2: Tạo input stream và output stream cho giải thuật - Bước 3: Nhập các ký tự cần thử để dùng giải thuật hashing và nhấn Play - Bước 4: Ta theo dõi kết quả ở ouput stream #image("/images/2c3_1.jpeg", width: 100%) + Giả sử bạn đã tìm ra được ký tự ở câu a, như vậy có thể kết luận hàm hash SHA-1 không thoả mãn tính chất một chiều (one-way) được hay không, giải thích câu trả lời? SHA-1 vẫn thỏa mãn tính chất một chiều, chúng ta tìm được ký tự ban đầu dựa vào phép thử, và nếu message trở nên lớn hơn, rất khó để tìm ra được giá trị hash. == Câu 4: Thực hiện lại bước 3 cho các giải thuật hash khác và đánh giá giá trị hash nhận được với giá trị hash ban đầu. Ta cùng sử dụng plaintext $M = "Thanh"$ cho các giải thuật dưới đây. === Giải thuật SHA-256 #image("/images/2c4_1.jpg", width: 100%) *Kết quả:* `73 E2 F4 3E 09 6D A9 DE 12 6A 91 19 FD F7 D2 CD 9B 02 1A D2 A4 3F 6A 42 69 1B E5 62 2B BC 67 BB` === Giải thuật SHA-512 #image("/images/2c4_2.jpeg", width: 100%) *Kết quả:* `76 A1 70 26 C7 3E FF 56 65 D2 D8 83 CE 0B 5A CD A6 82 A8 84 3F C2 14 E1 9C 75 41 09 E6 BB 41 E0 1D 6C 78 DC E5 B2 3A 4C 4B 16 06 8D EE B4 91 33 40 7C EC 36 A9 65 DB E3 A7 4D 69 CC 87 A5 22 EF` === Giải thuật MD-5 #image("/images/2C4_3.jpeg", width: 100%) *Kết quả:* `EA CD 47 8A ED C7 98 62 23 48 F9 FF D7 5E 23 AC` === Giải thuật CRC #image("/images/2c4_4.jpeg", width: 100%) *Kết quả:* ```04 21 4F AE```
https://github.com/Quaternijkon/notebook
https://raw.githubusercontent.com/Quaternijkon/notebook/main/content/数据结构与算法/.chapter-算法/数学/只出现一次的数字.typ
typst
#import "../../../../lib.typ":* === #Title( title: [只出现一次的数字], reflink: "https://leetcode.cn/problems/single-number/description/", level: 1, )<只出现一次的数字> #note( title: [ 只出现一次的数字 ], description: [ 给你一个 非空 整数数组 nums ,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 你必须设计并实现线性时间复杂度的算法来解决此问题,且该算法只使用常量额外空间。 ], examples: ([ 输入:nums = [2,2,1] 输出:1 ],[ 输入:nums = [4,1,2,1,2] 输出:4 ],[ 输入:nums = [1] 输出:1 ] ), tips: [ - $1 <= "nums.length" <= 3 * 10^4$ - $-3 * 10^4 <= "nums"[i] <= 3 * 10^4$ - 除了某个元素只出现一次以外,其余每个元素均出现两次。 ], solutions: ( ( name:[位运算], text:[ 异或运算有个重要的性质,两个相同数字异或为 0 ,即对于任意整数 a 有 $a⊕a=0$ 。因此,若将 `nums` 中所有数字执行异或运算,留下的结果则为 出现一次的数字 x ,即: $a⊕a⊕b⊕b⊕...⊕x$ $=0⊕0⊕...⊕x$ $=x$ ​ ],code:[ ```cpp class Solution { public: int singleNumber(vector<int>& nums) { int res = 0; for (int i = 0; i < nums.size(); i++) { res ^= nums[i]; } return res; } }; ``` ]), ), gain:none, )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/packages/renderer/README.md
markdown
Apache License 2.0
# typst-ts-renderer See [Typst.ts](https://github.com/Myriad-Dreamin/typst.ts) and documentation: - [Get Started](https://myriad-dreamin.github.io/typst.ts/cookery/get-started.html)
https://github.com/LuminolT/SHU-Bachelor-Thesis-Typst
https://raw.githubusercontent.com/LuminolT/SHU-Bachelor-Thesis-Typst/main/template/font.typ
typst
// 字体定义 #let heiti = ("Times New Roman", "Heiti SC", "Heiti TC") #let songti = ("Times New Roman", "Songti SC") #let kaiti = ("Times New Roman", "Kaiti SC")
https://github.com/adam-zhang-lcps/papers
https://raw.githubusercontent.com/adam-zhang-lcps/papers/main/aet-lab-report-template.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#let aet-lab-report( title: none, course: none, teacher: none, partners: none, date: datetime.today(), appendix: none, draft: false, doc, ) = [ #set document(title: title, author: "<NAME>", date: date) #set page(paper: "us-letter", margin: 1in, header: align(right)[ #counter(page).display() ], background: if draft { rotate(45deg, text(144pt, fill: luma(230), tracking: 12pt, "DRAFT")) }) #set par(leading: 1.5em, first-line-indent: 0.5in) #set text(font: "New Computer Modern", size: 11pt) #set outline(indent: 0.25in) #show heading.where(level: 1): it => [ #set text(size: 11pt, weight: "bold") #set align(center) #block(it.body, spacing: 1.5em) ] #show heading.where(level: 2): it => [ #set text(size: 11pt, weight: "bold") #block(it.body, spacing: 1.5em) ] #show heading.where(level: 3): it => [ #set text(size: 11pt, weight: "bold", style: "italic") #block(it.body, spacing: 1.5em) ] #set list(indent: 0.5in) #set enum(indent: 0.5in) #set figure.caption(position: top, separator: "") #show figure.caption: it => block(width: 100%)[ #set align(left) #set par(first-line-indent: 0in) *#it.supplement #it.counter.display()* #emph(it.body) ] #set table( fill: (x, y) => if calc.odd(y) and y > 0 { luma(240) } else { white }, align: center + horizon ) #set math.equation(numbering: "(1)") // Without this, equations in CeTZ diagrams have labels all over them. #show figure: set math.equation(numbering: none) #set bibliography(style: "apa", title: "References") #show bibliography: it => [ #set par(first-line-indent: 0in) #pagebreak() #it ] #block( width: 100%, height: 100%, )[ #align( center + horizon, )[ #block(below: 4em)[*#title*] <NAME> #if (partners != none) [ Lab Partner#if partners.len() > 1 [s]: #partners.join(", ") ] Academy of Engineering and Technology, #box(image("assets/acl-logo.png", height: 0.9em)) Academies of Loudoun #course #teacher #date.display("[month repr:long] [day], [year]") On my honor, I will not accept nor provide any unauthorized aid on this assignment. ] ] #outline() #pagebreak() #doc #bibliography("refs.bib") #if appendix != none [ #pagebreak() = Appendix #appendix ] ] = Introduction == Purpose #lorem(20) == Hypothesis #lorem(20) == Background #lorem(100) #lorem(100) #lorem(100) #lorem(100) = Methods == Materials The following materials are required for this experiment. - #lorem(4) - #lorem(4) - #lorem(4) - #lorem(4) The setup for this experiment is shown in @setup. #figure(image("assets/dragon.jpg"), caption: "Experimental Setup")<setup> == Procedures The following procedure was implemented during this experiment. + #lorem(10) + #lorem(10) + #lorem(10) + #lorem(10) = Results == Data #lorem(60) == Calculations #lorem(60) = Discussion == Conclusion #lorem(50) == Errors #lorem(50) == Extensions #lorem(50) #pagebreak() #set par(first-line-indent: 0in) #bibliography("refs.bib", title: "References", style: "apa")
https://github.com/DoeringChristian/CV
https://raw.githubusercontent.com/DoeringChristian/CV/main/moderncv.typ
typst
/* * Customizations on this template: * * - headings (h1..h4) * * - `datebox` function: provides content with stacked year above (big) and month below (tinier) * * - `daterange` function: two `datebox`es separated by an em dash * * - `xdot`: function, adds a trailing dot to a string only if it's not already present * * - `cvgrid`: basic layout function that wraps a grid. Controlled by two parameters `left_column_size` (default: 25%) and `grid_column_gutter` (default: 8pt) which control the left column size and the column gutter respectively. * * - `cvcol`: used to write in the rightmost column only. Builds on `cvgrid` * * - `cventry`: used to write a CV entry. Builds on `cvgrid` * * - `cvlangauge`: used to write a language entry. Builds on `cvgrid` * */ #let left_column_size = 25% #let grid_column_gutter = 8pt #let main_color = rgb("#3873b2") #let heading_color = main_color // #let job_color = rgb("#737373") #let familyname_color = rgb("#737373") #let firstname_color = rgb("#b9b9b9") #let project( title: "", familyname: [], firstname: [], phone: "", email: "", github: "", left_column_size: left_column_size, grid_column_gutter: grid_column_gutter, main_color: main_color, heading_color: heading_color, firstname_color: firstname_color, familyname_color: familyname_color, body ) = { let author = firstname + familyname set document(author: author, title: title) set page( numbering: "1/1", margin: (top: 1.5cm, left: 2cm, right: 2cm), footer: [ #set block(below: 0.5em) #if github != "" { align(top)[ #box(height: 1em, baseline: 20%)[#pad(right: 0.4em)[#image("icons/github.svg")]] #link("https://github.com/" + github)[#github] ] } #if phone != "" { align(top)[ #box(height: 1em, baseline: 20%)[#pad(right: 0.4em)[#image("icons/phone-solid.svg")]] #link("tel:" + phone)[#phone] ] } #if email != "" { align(top)[ #box(height: 1em, baseline: 20%)[#pad(right: 0.4em)[#image("icons/envelope-regular.svg")]] #link("mailto:" + email) ] } ] ) set text(font: ("Latin Modern Sans", "Inria Sans"), lang: "en", fallback: true) show math.equation: set text(weight: 400) /* * How headings are used: * - h1: section (colored, prominent, with colored rectangle, spans two columns) * - h2: role (bold) * - h3: place (italic) * - h4: generic heading (normal, colored) */ show heading.where(level: 1): element => [ #v(0em) #box( inset: (right: grid_column_gutter, bottom: 0.1em), rect(fill: main_color, width: left_column_size, height: 0.25em) ) #text(element.body, fill: heading_color, weight: 400) ] show heading.where(level: 2): element => [ #text(element.body + ",", size: 0.8em) ] show heading.where(level: 3): element => [ #text(element.body, size: 1em, weight: 400, style: "italic") ] show heading.where(level: 4): element => block[#text(element.body, size: 1em, weight: 400, fill: heading_color)] set list(marker: box(circle(radius: 0.2em, stroke: heading_color), inset: (top: 0.15em))) set enum(numbering: (n) => text(fill: heading_color, [#n.])) align(right+top)[ // Author information. #text([#text(firstname, fill: firstname_color) #text(familyname, fill: familyname_color)], weight: 400, 3.4em) #v(-3.2em) #line(length:100%, stroke: firstname_color) // Title row. #block(text(weight: 400, 1.5em, title, style: "italic", fill: familyname_color)) ] v(3em) // Main body. set par(justify: true, leading: 0.5em) body } #let datebox(month: "", year: []) = box( align(center, stack( dir: ttb, spacing: 0.4em, text(size: 1em, [#year]), text(size: 0.75em, month), ) ) ) #let daterange(start: (month: "", year: []), end: (month: "", year: [])) = box( stack(dir: ltr, spacing: 0.75em, datebox(month: start.month, year: start.year), [--], datebox(month: end.month, year: end.year) ) ) #let cvgrid(..cells) = pad(bottom: 0.8em)[#grid( columns: (left_column_size, auto), row-gutter: 0em, column-gutter: grid_column_gutter, ..cells )] #let cvcol(content) = cvgrid([], content) #let xdot(s) = { if s.ends-with(".") { s } else { s + "." } } #let cventry( description, start: (month: "", year: ""), end: (month: "", year: ""), place: "", role: [] ) = cvgrid( align(center, daterange(start: start, end: end)), [ == #role === #xdot(place) ], [], description ) #let cvlanguage( language: [], description: [], certificate: [], ) = cvgrid( align(right, language), [#description #h(3em) #text(style: "italic", certificate)], ) #let cvline( left: [], text: [], ) = cvgrid( align(center, left), text, ) #let textit(content) = ( text(content, style: "italic") ) // Link Definitions: #let iconlink( icon: "", url: "", linktext: [], ) = [ #box[ #pad(right: 0.5em)[ #box(height: 1em, baseline: 20%)[#image("icons/" + icon + ".svg")] #link(url, linktext) ] ] ] #let sourcelink( url, ) = iconlink( icon: "git-alt-brands-solid", url: url, linktext: "Source", ) #let projectlink( url, ) = iconlink( icon: "file-lines-solid", url: url, linktext: "Project", ) #let paperlink( url, ) = iconlink( icon: "file-pdf-solid", url: url, linktext: "Paper", ) #let cvpub( title: "", authors: [], venue: "", icons: [], project: "", paper: "", ) = cvgrid( align(center, []), [ == #title #authors #if venue != "" { [#venue] } #if project != "" { [#projectlink(project)] } #if paper != "" { [#paperlink(paper)] } ], ) #let cvproject( title: "", git: "", description, ) = cvgrid( [], [ == #title #description #if git != "" { [#sourcelink(git)] } ] )
https://github.com/colinstfni/ba1-heig
https://raw.githubusercontent.com/colinstfni/ba1-heig/main/typst/config.typ
typst
#import "@preview/ctheorems:1.1.2": * #import "@preview/codly:1.0.0": * #let theorem = thmbox( "theorem", "Théorême", fill: rgb("#eeffee"), ).with(numbering: (..nums) => nums.pos().map(str).slice(1).join(".")) #let corollary = thmplain( "corollary", "Corollary", base: "theorem", titlefmt: strong, ).with(numbering: (..nums) => nums.pos().map(str).slice(1).join(".")) #let definition = thmbox( "definition", "Définition", inset: (x: 1.2em, top: 1em), ).with(numbering: (..nums) => nums.pos().map(str).slice(1).join(".")) #let example = thmplain("example", "Exemple").with(numbering: none) #let proof = thmproof("proof", "Preuve").with(numbering: ( ..nums, ) => nums.pos().map(str).slice(1).join(".")) #let remark = thmplain("remark", "Remarque").with(numbering: none) #let number-format = n => text(luma(65%))[#n] #let enable-line-numbers = () => codly(number-format: number-format) #let disable-line-numbers = () => codly(number-format: none) #let inter = math.sect #let conf( title: [], title_color: color.aqua, authors: [], header: ([], [], []), doc, ) = { let (header_left, header_middle, header_right) = header set text( font: "New Computer Modern", size: 12pt, ) show sym.emptyset: set text(font: "Fira Sans") show: thmrules.with(qed-symbol: $square$) show: codly-init.with() codly( zebra-fill: none, inset: 4pt, number-format: number-format, ) set page( paper: "a4", header: locate(loc => if [#loc.page()] != [1] { grid( columns: (1fr, 3fr, 1fr), align(left)[#header_left], align(center)[#header_middle], align(right)[#header_right‎‎‎], ) v(-0.5em) line(length: 100%, stroke: 0.03em) }), numbering: "1", ) set par( justify: true, leading: 0.55em, ) let code_fill = luma(90%) set heading(numbering: (a, ..nums) => { let level = nums.pos().len() + 1 // Starts from 0 so we need to +1 it let pattern = if level >= 2 { "1." } if pattern != none { numbering(pattern, ..nums) } }) show heading: it => { if it.numbering != none and it.level >= 2 { counter(heading).display() h(0.4em) } it.body if it.level > 1 { v(0.75em / it.level) } parbreak() } show outline.entry.where(level: 1): it => { } align(center)[ #box( width: 100%, height: 4em, fill: title_color, stroke: black, )[ #pad(top: 1.5em)[ #title ] ] #authors ] outline( title: [#v(0.3em) #text(15pt)[Table des matières] #v(-0.5em)], indent: auto, ) v(1em) doc }
https://github.com/Zuttergutao/Typstdocs-Zh-CN-
https://raw.githubusercontent.com/Zuttergutao/Typstdocs-Zh-CN-/main/Classified/changelogs.typ
typst
// 更新历史 #[ #set page(header:none,numbering:none) #set par(first-line-indent:0em) #set align(center) #text(weight:700,size:20pt)[Change logs] #set align(left) #set list(marker: ([•], [-])) - *2023.05.20 Version 0.4.0:* - 添加对footnote的支持。 - 添加对LaTex用户的指南 - 注:一些笔者认为的小修改并未加入到此手册中。 - *2023.04.26 Version 0.3.0:* - 重命名了一些符号:`dot.op->dot` `dot->dpt.basic` `ast`和`tlide`同理。 - 将`mod`重命名为`rem`,目前`mod`仍可使用,直到版本更新。 - 移除`query`函数的`before`和`after`定位参数,改用`selector()`函数进行定位。`query(heading,before:loc)` -> `query(selector(heading).before(loc),loc)` - `bottom`和`top`重命名为`b`和`t`,支持左右上下标。 - 支持删除线样式。支持pdf大纲显示。 - *2023.04.22:* - loops取消了对index和value的迭代,现在可以通过unpacking和enumerating处理。map()方法同理。目前的写法`(index,value) in keys.enumerate()`。 - 字典方法现在可以使用插入顺序而不是字母顺序。 - 新增了`unpacking(),enumerate(),path,layout,sorted()`method。 - 添加了`New Computer Modern`字体。 - *2023.04.09:* - 对于源码部分使用等宽字体`Monospac821 BT`,感谢supernova的建议。 - 对标题进行了部分汉化,但是是缺少一点味道。 - 附录添加了symbol速查表。 - *2023.04.05:* - 2023/04/04 typst推出了v0.1的正式版本,修正了编号问题(目前从0开始)。在我看来其最大的改进就是中文排版的优化(并不支持斜体加粗等格式)。 - 2023/4/5 14:07:58 已完成官方文档的翻译,但是总觉得还缺点什么。想了想那便是自己的理解吧:单纯翻译文档谁都可以做,但是如何使文档更加通俗易懂以及让人快速上手就需要下一点功夫了。 - 接下来的安排:使用show set规则将typ文件大幅缩短(预计一半篇幅);文章结构(调整章节顺序,语句修改);优化排版(力气活 \u{1F921})。 ] #pagebreak()
https://github.com/lkndl/typst-bioinfo-thesis
https://raw.githubusercontent.com/lkndl/typst-bioinfo-thesis/main/chapters/0_abstract.typ
typst
#import "../modules/styles.typ": * #let de_abstract = [ Das ist von ChatGPT generierter Content, und daher wirklich nicht lustig -- sry. \ In einem Universum, das nicht allzu weit von unserem entfernt ist, wo Qubits frei umherstreifen und Algorithmen zum Rhythmus der Verschränkung tanzen, begibt sich <NAME> auf eine Quest, um die unerforschten Gebiete der Bioinformatik zu erkunden. Diese Arbeit taucht ein in das faszinierende Reich, in dem Quantencomputing auf die Feinheiten genomischer Daten trifft und darauf abzielt, die Geheimnisse im DNA-Multiversum zu enthüllen. ] #let en_abstract = [ In a universe not too far from ours, where qubits roam free and algorithms dance to the rhythm of entanglement, <NAME> embarks on a quest to explore the uncharted territories of bioinformatics. This thesis delves into the intriguing realm where quantum computing meets the intricacies of genomic data, aiming to unveil the secrets encoded within the DNA multiverse. //The square brackets indicate this is `content` -- not code We can still insert "script" or "code" with an \# though: #datetime(hour: 18, minute: 2, second: 23).display(). ]
https://github.com/thornoar/lambda-calculus-course
https://raw.githubusercontent.com/thornoar/lambda-calculus-course/master/main-lectures/problems-1.typ
typst
#import "template.lib.typ": * #import "@local/common:0.0.0": * #show: problemlist(1, [ Конверсия и редукция ]) + - Перепишите в формальной нотации: $y(@x..x y (@z%w..y z))$ - Перепишите в упрощённом виде: $(@v'(@v''((((@v v)v')v'')((v''(@v'''(v'v''')))v''))))$ + Положим $X == #S#I$. Покажите, что $X X X X = X(X(X X))$. Правда ли, что $X^n X = X X^(~~ n)$ справедливо для всех $n in NN_0$? + Покажите, что выражение имеет нормальную форму:\ [a]#hs $(@y.. y y y)((@a%b.. a)#I (#S#S))$, #h(1fr) [b]#hs $#S#S#S#S$, #h(1fr) [c]\*#hs $#S (#S#S)(#S#S)#S$. #h(1fr) + Найдите л-выражение $M$, такое, что $forall N in #L: hs M N = M M$. + Докажите, что *не* существует такого $F in #L$, что $forall M, N in #L: hs F (M N) = M$. + Пусть $A == #S#K#K#K$. Постройте такое л-выражение $M$, чтобы выполнялась конверсия $#S#I M #K A = #S M #S #K A$. + Докажите, что правило эт-конверсии ($@x.. M x = M, hs forall M,x: x in.not TV(M)$) эквивалентно тому, что "функции равны, если равны их значения": #v(-5pt) $ M x = N x ==> M = N, #h(15pt) forall M, N, x : x in.not TV(M N). $ #v(-5pt) + - Докажите, что: #h(1fr) [a]#hs $#I inc #K$, #h(1fr) [b]#hs $#I inc #S$, #h(1fr) [c]\*#hs $x y inc x x$. #h(5fr) - Постройте последовательность $M_0, M_1, ...$, такую, что $M_i inc M_j$, если $i eq.not j$. + Докажите, что $P inc Q hs <==> hs (#l + (P = Q)) tack.r #K = #KK$ + Постройте последовательность л-выражений $M_0, M_1, ...$ так, чтобы $M_0 = v$ и для любого\ $n in NN_0$ выполнялось $M_(n+1) &= M_(n+2) M_n.$ + Докажите, что $forall M in #L: hs exists N in #L: hs N #I ->>_beta M$, причём $N$ в б-нормальной форме. + Обозначим через $M arrow.t N$ условие $exists L: hs (L ->> M) and (L ->> N)$. Покажите, что:\ [a]#hs $(@x.. a x)b arrow.t (@y.. y b)a$, #h(1fr) [b]#hs $(@x.. x c)c arrow.t (@x.. x x)c$, #h(1fr) [c]#hs $(@x.. b x)c arrow.t (@x..x)b c$ #h(1fr) + Постройте л-выражения со следующими редукционными графами:\ #v(.3cm) #grid( columns: (4.5cm, 3.5cm, 5.5cm), align: (center, center, center), gutter: 1.6cm, lambda-diagram( spacing: 0.7cm, { let (A,B,C) = ((-1.5,0),(1.5,0),(0,-3)) lnode(A) lnode(B) lnode(C) ledge(A,B, bend: 30deg) ledge(B,A, bend: 30deg) ledge(B,C, bend: 10deg) ledge(A,C, bend: -10deg) } ), grid.cell( rowspan: 2, lambda-diagram( spacing: 1.8cm, { import calc: * let (A,B,C) = ( (cos(180deg), sin(180deg)), (cos(60deg), sin(60deg)), (cos(-60deg), sin(-60deg)) ) lnode(A); self(A, angle: 180deg) lnode(B); self(B, angle: 60deg) lnode(C); self(C, angle: -60deg) ledge(A,B) ledge(B,C) ledge(C,A) } ) ), grid.cell( rowspan: 2, lambda-diagram( spacing: 1.3cm, { let (A,B,C,D) = ((0,0),(0,-1),(0,-2),(0,-3)) let L = (1,0) lnode(A) lnode(B) lnode(C) lnode(L) node(D, move($dots.v$, dy: 0.15cm), radius: 0.06cm, inset: 0cm, outset: 0cm) ledge(A,B, bend: 20deg) ledge(B,C, bend: 20deg) ledge(C,D, bend: 20deg) ledge(A,L, bend: 10deg) ledge(B,L, bend: -10deg) ledge(C,L, bend: -40deg) self(A, angle: 180deg) self(B, angle: 180deg) self(C, angle: 180deg) self(L, angle: 40deg) } ) ), lambda-diagram( spacing: 1.1cm, { let (A,B,C) = ((-2,0),(0,0),(2,0)) lnode(A) lnode(B) ledge(A,B, bend: 40deg) ledge(B,A, bend: 40deg) self(A, angle: 180deg) self(B, angle: 0deg) } ), ) #v(.5cm) + Нарисуйте редукционные графы следующих л-выражений:\ [a]#hs $(@x.. #I x x)(@x.. #I x x)$, #h(1fr) [b]#hs $(@x.. #I (x x))(@x.. #I (x x))$ #h(1fr) + Пусть $M == A A x$, где $A == @a%x%z.. z (a a x)$. Докажите, что редукционный граф $Gr(M)$ содержит $n$-мерный куб при всех $n in NN_0$. + Покажите, что концептуально существует только одно л-выражение (а именно $#O$), имеющее следующий редукционный граф: #align(center, lambda-diagram( spacing: 1cm, { lnode((0,0)) self((0,0), angle: 0deg) } )) + Расширим множество л-выражений двумя константами $delta, epsilon$. Также добавим новое правило редукции: $delta M M -> epsilon$ для любого $M in #L union {delta, epsilon}$. Докажите, что в получившейся системе *не* выполняется теорема Чёрча-Россера. #box( stroke: 0.5pt, width: 100%, inset: 0.25cm, radius: 0.2cm, [ Подсказка: найдите выражения $C$. $D$ такие, что $ C x ->> delta x (C x),\ D ->> C D. $ Докажите, что $D ->> epsilon$ и $D ->> C epsilon$, но у $epsilon$ и $C epsilon$ нет общего редукта. ] ) + Пусть $rel1$ и $rel2$ --- коммутирующие отношения на множестве $X$. Покажите, что $Trans(rel1)$ и $Trans(rel2)$ также коммутируют. + л-выражение $M$ _сильно нормализуется_ #h(2pt) (нотация $SN(M)$), если *не* существует бесконечного редукционного пути, начинающегося в $M$. Докажите, что:\ [a]#hs $SN(M) ==> M$ имеет нормальную форму;\ [b]#hs $SN(M) ==> Gr(M)$ конечен. Верно ли обратное? + Рассмотрим $ "SN"_0 &:= { M in #L | SN(M) },\ "SN"_(n+1) &:= { M in #L | forall N_1, N_2, ..., N_k in "SN"_n: hs M N_1 N_2 ... N_k in "SN"_n }. $ Докажите, что\ [a]#hs $"SN"_1 subset "SN"_0$, но $"SN"_1 eq.not "SN"_0$.\ [b]#hs $"SN"_1 = "SN"_2 = "SN"_3 = ...$
https://github.com/grnin/Zusammenfassungen
https://raw.githubusercontent.com/grnin/Zusammenfassungen/main/Bsys2/12_X_Window_System.typ
typst
// Compiled with Typst 0.11.1 #import "../template_zusammenf.typ": * #import "@preview/wrap-it:0.1.0": wrap-content /*#show: project.with( authors: ("<NAME>", "<NAME>"), fach: "BSys2", fach-long: "Betriebssysteme 2", semester: "FS24", tableofcontents: (enabled: true), language: "de", )*/ = X Window System == GUI Basiskonzepte Frühere Unix-Systeme waren rein _textorientierte_ Bedienschnittstellen und basierten auf _programmgesteuerten Interaktionen_. Moderne Unix-Systeme verwenden ein _GUI mittels des X Window System_ oder mittels anderen Technologien #hinweis[(Google Android, Apple Aqua, Canonical Mir Display Server, Wayland).] Diese sind _Ereignisgesteuerte Interaktionen:_ Benutzer entscheidet, wann welches Ereignis ausgelöst wird, Programm reagiert auf Benutzer. === Vorteile Auf Unix-Kern aufgesetzt und damit _austauschbar_. Installierbar, wenn _tatsächlich benötigt_. Realisiert _Netzwerktransparenz_, _Plattform-unabhängig_. X legt die _GUI-Gestaltung nicht_ fest. === Fenster _Rechteckiger Bereich des Bildschirms._ Kann beliebig viele weitere Fenster enthalten #hinweis[(z.B. Dialogbox, Scrollbar, Button...)], es gibt eine _Baumstruktur_ aller Fenster. Der _Bildschirm_ ist die Wurzel. === Maus und Mauszeiger Die _Maus_ ist ein Physisches Gerät, das 2D-Bewegungen in Daten übersetzt. Der _Mauszeiger_ ist eine Rastergrafik, die auf dem Bildschirm angezeigt wird. Das OS bewegt den Mauszeiger _analog_ zur physischen Bewegung der Maus. Die _Maustasten lösen Ereignisse_ aus. Das Ereignis soll für _das Fenster_ gelten, über dem sich _der Hotspot_ befindet. Der _Maustreiber erzeugt Nachrichten_, das _OS verteilt_ diese an die zuständige _Applikation_, welche die Nachricht _verarbeitet_. Dieser Prozess ist _asynchron_. === GUI Architektur Das GUI braucht mehr als X Window System. - _X Window System:_ Grundfunktionen der Fensterdarstellung #hinweis[(Events von Kernel erhalten & Fenster zuordnen)] - _Window Manager:_ Verwaltung der sichtbaren Fenster, Umrandung, Knöpfe - _Desktop Manager:_ Desktop-Hilfsmittel wie Taskleiste, Dateimanager, Papierkorb etc. _X_ selbst ist _unabhängig_ von einem bestimmten Window Manager oder Desktop. Es existieren _viele verschiedene Implementierungen_ des Window Manager und Desktops. Die _Gestaltung der Bedienoberfläche_ und Bedienphilosophie bleiben damit _frei_. #pagebreak() === Window-Manager _Läuft im Client_ und realisiert eine _Window Layout Policy_. Platziert Client-Fenster auf dem Bildschirm. Ist (nur) eine _Client-Applikation mit Sonderrechten_ zur Fensterverwaltung. _Typische Dienste des Window Manager_ für den Benutzer: - Applikationsfenster mit _Titelleiste, Umrandung und zusätzlichen Knöpfen_ versehen - Fenster _verschieben_, _Grösse_ ändern, minimieren, maximieren - Neue Applikationen _starten_ - _Darstellungsreihenfolge_ #hinweis[(stacking order)] überlappender Fenster ändern === Fensterverwaltung _Fensterhierarchie:_ Root-Window ist zuoberst, bedeckt den ganzen Bildschirm. Kinder des Root-Windows sind Top-Level Windows der Applikationen. Die übrigen Kindfenster sind zur Anzeige von Menüs, BUTTons, usw. in Applikationen.\ Kindfenster können Elternfenster teilweise _überlappen_, jedoch overflow hidden. Eingaben werden nur im Überlappungsbereich empfangen. Es gibt zwei unterstützte _Fensterklassen:_ `InputOutput` #hinweis[(kann Ein- und Ausgaben verarbeiten)] und `InputOnly` #hinweis[(Kann nur Eingaben verarbeiten)]. Der Window-Manager _dekoriert_ Top-level Windows von Applikationen mit Buttons, Scrollbars, Titelleiste usw., indem er hinter jedes Top-level Window ein _Extrafenster_ legt. === Beispiele Grafischer Desktops basierend auf X - _GNOME #hinweis[(Default auf Ubuntu)]:_ verwendet GTK+ #hinweis[(Fenster-Elemente und Widgets)], GDK #hinweis[(Wrapper für Grafikfunktionen)] und GLib #hinweis[(Allgemeine Datenstrukturen und Algorithmen)] - _KDE_ verwendet Qt Toolkit #hinweis[(Fensterelemente, Widgets, Algorithmen)] #wrap-content( image("img/bsys_52.png"), align: bottom + right, columns: (50%, 50%), )[ == Basiskonzepte des X Window System - _Display:_ Rechner mit Tastatur, Zeigegerät und 1..m Bildschirme - _X Client:_ Applikation, die einen Display nutzen will. Kann lokal oder entfernt laufen. - _X Server:_ Softwareteil des X Window System, der ein Display ansteuert. Läuft stets auf dem Rechner, auf dem die GUI-Ein-/Ausgaben anfallen. ] === Xlib Ist das _C Interface_ für das X Protocol. Header wird in C Files eingebunden über ```c #include <X11/Xlib.h>```. Kompiliertes Executable muss mit X11 Libray gelinkt werden: `-lX11`. Hat zahlreiche Funktionen und Datentypen, wird aber meist _nicht direkt verwendet_, sondern über X-Toolkits, welche eine _Software-Schicht oberhalb der Xlib_ darstellen. Diese stellen _Standardbedienelemente_ fertig zur Verfügung, z.B. Command Buttons, Labels und Menüs. #hinweis[(Xt Toolkit, Tk Toolkit, Motif Toolkit, Open Look Toolkit, GTK+ Toolkit, Qt Toolkit)] ==== Verbindung zum Display Um einen Display zu verwenden, muss eine _Verbindung_ zu diesem bestehen. Die Verbindung wird im _Datentyp `Display`_ gespeichert. *```c Display * XOpenDisplay (char *display_name)```* öffnet eine Verbindung zum lokalen oder entfernten Display namens `display_name`. Falls `NULL`, wird der Wert der Umgebungsvariable `DISPLAY` verwendet. *```c void XCloseDisplay (Display *display)```* schliesst die Verbindung und entfernt die Ressourcen. Es gibt Funktionen, um bestimmte Eigenschaften des Displays anzuzeigen #hinweis[(`XDisplayHeight`, `XDisplayWidth`, `XRootWindow`)] ==== Erzeugen von Fenstern _`XCreateSimpleWindow`_ ist eine einfachere Variante von _`XCreateWindow`_ mit folgenden Parametern: Display, Parent Window, Koordinaten der oberen linken Ecke, Breite und Höhe, Breite des Rands, Stil des Rands, Stil des Fensterhintergrunds. _`XDestroyWindow`_ enfernt es und alle seine Unterfenster. ==== Anzeigen von Fenstern - *```c XMapWindow (Display *, Window)```* bestimmt, dass ein Fenster auf dem Display angezeigt werden soll. Wird nur angezeigt, wenn _Elternfenster auch angezeigt_ wird. Teile des Fensters, die von anderen Fenstern _überdeckt_ werden, werden _nicht angezeigt_. - *```c XMapRaised (Display *, Window)```* bringt das Fenster in den Vordergrund. - *```c XMapSubwindows (Display *, Window)```* zeigt alle Unterfenster an. Für jedes Fenster, das tatsächlich angezeigt wird, wird ein `Expose` Event erzeugt. ==== Verstecken von Fenstern - *```c XUnmapWindow (Display *, Window)```* versteckt ein Fenster und all seine Unterfenster. - *```c XUnmapSubwindows (Display *, Window)```* versteckt alle Unterfenster eines Fensters. Für jedes Fenster, das versteckt wird, wird ein `UnmapNotify` Event erzeugt. == Event Handling === X Protocol Legt die _Formate für Nachrichten_ zwischen X Client und Server fest. Es gibt 4 Typen von Nachrichten: - _Requests:_ Dienstanforderungen, Client #sym.arrow Server #hinweis[("Zeichne eine Linie", "liefere aktuelle Fensterposition")] - _Replies:_ Antworten auf bestimmte Requests, Client #sym.arrow.l Server - _Events:_ spontane Ereignismeldungen, Client #sym.arrow.l Server #hinweis[("Mausklick", "Fenstergrösse wurde verändert")] - _Errors:_ Fehlermeldungen auf vorangegangene Requests, Client #sym.arrow.l Server === Nachrichtenpufferung bei Requests #wrap-content( image("img/bsys_53.png"), align: top + right, columns: (60%, 40%), )[ Für _Requests_ gibt es einen _Nachrichtenpuffer auf der Client-Seite_ #hinweis[(Request Buffer)]. _Ziel:_ möglichst wenige Anforderungsübertragungen an X Server. Gruppierung von Anforderungen für bessere _Kommunikationseffizienz_. Übertragung an Server nur, wenn _sinnvoll oder zwingend nötig_ #hinweis[(Client beginnt auf Event zu warten und blockiert, Client-Request Reply des Servers wird benötigt, Client verlangt explizit Pufferleerung)] ] #wrap-content( image("img/bsys_54.png"), align: top + right, columns: (46%, 54%), )[ === Nachrichtenpufferung bei Ereignissen Ereignisse werden _doppelt gepuffert_: beim X Server und beim Client. Die _Server-seitige Pufferung_ berücksichtigt _Netzwerkverfügbarkeit_, die _Client-Seitige_ hält _Events bereit_, bis vom Client abgeholt. Der Client liest Messages im Message-Loop mittels Funktion `XNextEvent()`. ] === X Event Handling Ereignisse werden vom _Client verarbeitet oder weitergeleitet_. Der Client muss vorher festlegen, _welche Ereignistypen_ er empfangen will #hinweis[(`XSelectInput()`)]. Die Selektion ist pro Fenster individuell, nur _selektierte_ Ereignistypen werden dem Client _zugestellt_. Default: leer. Vom Fenster nicht gewünschte Ereignistypen gehen an das übergeordnete Fenster. *```c XSelectInput (Display *display, Window w, long event_mask)```* legt als Maske fest, welche Events ausgewählt werden. Masken sind vordefiniert, z.B. `ExposureMask` für `Expose`-Events. *```c XNextEvent (Display *display, Event *event)```* kopiert den nächsten Event aus dem Buffer in `event`. Die Identifikation des betroffenen Displays und Fenster ist Teil des Events. #hinweis[(`event.display`, `event.window`)] Der Client entscheidet, _wann_ er ein Event entgegennimmt. Die Verarbeitung der Events erfolgt in einer Programmschleife in der Form: ```c while(1) { XNextEvent(display, &event); switch (event.type) { case Expose: // Typische Event: verlangt Neuzeichnen des Fensters ... break; case KeyPress: // Event: Taste wurde gedrückt ... if(...) exit(0); break; } } ``` Events sind vom Typ _`XEvent`_. Dieser Typ ist eine C-Union über alle Event-Typen, d.h. er ist so gross wie der _grösste Event-Typ_. Es gibt _33 verschiedene Event-Typen_ unterschiedlicher Grösse. Jeder Event-Typ ist ein _`struct`_, der als erstes den _`int type`_ enthält. Der Programm-Code soll anhand von `type` den richtigen _Union-Member_ verwenden. == Zeichnen === Ressourcen X Ressourcen sind _Server-seitige Datenhaltung zur Reduktion des Netzwerkverkehrs_. Sie halten Informationen im Auftrag von Clients. Clients identifizieren Informationen mit zugeordneten _Nummern_ #hinweis[(IDs)]. Damit ist _kein Hin- und Herkopieren_ komplexer Datenstrukturen nötig. ==== Beispiele von X Ressourcen - _Window:_ beschreibt Fenstereigenschaften - _Pixmap:_ Rastergrafik #hinweis[(Verwendung z.B. für Icons, schnelles Neuzeichnen)] - _Colormap:_ Farbtabelle #hinweis[(Setzt Farbindizes in konkrete Farben um)] - _Font:_ Beschreibung einer Schriftart - #link(<graphics-context>)[_Graphics-Context (GC):_] Grafikelementeigenschaften #hinweis[(Liniendicke, Farbe, Füllmuster)]. Gleicher GC kann für verschiedene Grafikelemente benutzt werden. === Sichtbarkeit und Aktualisierung von Fensterinhalten ==== Pufferung verdeckter Fensterinhalte - _Minimal:_ keine Pufferung durch X Server, Client muss bei Sichtbarwerden neu zeichnen - _Optional:_ X Server hat Hintergrundspeicher zum Sichern der Inhalte abgedeckter Fenster - Abfragbar von Applikation ob vorhanden mittels `XDoesBackingStore()` ==== X-Ressource Pixmap _Server-seitiger Grafikspeicher_, von Client privat anleg- und nutzbar. _Anwendung:_ z.B. komplizierte Inhalte in pixmap schreiben, bei Bedarf pixmap in Fenster kopieren #hinweis[(pixmap wird immer gecached)]. #pagebreak() === X Grafikfunktionen Bilddarstellung mittels _Rastergrafik_ und _Farbtabelle_ #hinweis[(Heute weniger als Tabelle, weil zu viele Farben)]. - _Schwarz/Weiss:_ genau ein Bit pro Bildpunkt - _Farben oder Grautöne:_ Mehrere Bits pro Bildpunkt. Keine direkte Farbzuordnungen zu Binärwerten, sondern Index in einer Farbtabelle #hinweis[(color lookup table, colormap)]. Jedes Fenster kann theoretisch eine eigene Farbtabelle benutzen. In der Praxis oft nur eine einzige Farbtabelle für alle Applikationen. _Vorteil Tabelle:_ Reduktion der Bits pro Farbe von $n$ #hinweis[(Anzahl Bits pro absolut darstellbarer Farbe)] auf $m$ #hinweis[(Anzahl Bits pro gleichzeitig darstellbarer Farbe)]. Es sind also statt $2^n$ nur noch $2^m$ Farben gleichzeitig darstellbar #hinweis[(Gilt nur für normale Fensterelemente, Bilder & Videos können ganzen Farbraum nutzen)]. _Grafikgrundfunktionen_ erlauben das Zeichnen von Geometrischen Figuren, Strings und Texten. _Ziele_ für das Zeichnen können Fenster oder Pixmap sein. === Graphics Context <graphics-context> Grafikgrundfunktionen _benötigen einen Graphics Context_ #hinweis[(X Ressource)]. Legt diverse _Eigenschaften_ fest, die Systemaufrufe nicht direkt unterstützen #hinweis[(z.B. Liniendicke, Farben, Füllmuster)]. Client muss erst _GC anlegen_ vor Aufruf einer Zeichenfunktion. Client kann _mehrere GCs gleichzeitig_ nutzen. _`XCreateGC`_ legt neuen GC an, _`XCopyGC`_ kopiert GC, _`XFreeGC`_ zerstört GC. _`XDefaultGC`_ gibt den Standard GC für den angegebenen Screen zurück. === Grafik-Primitive (Auswahl) - _Einfache Formen:_ `XDrawPoint(s)`, `XDrawLine(s)`, `XDrawSegments`, `XDrawRectangle(s)`, `XFillRectangle(s)`, `XDrawArc(s)`, `XFillArcs` - _Text:_ `XDrawString`, `XDrawText` - _Bilder:_ `XPutImage` == Fenster schliessen Die Schaltfläche zum Schliessen eines Fensters wird vom _Window Manager_ erzeugt. X weiss _nichts_ über die spezielle Bedeutung dieser Schaltfläche, der _Window Manager schliesst_ das Fenster. Damit die Applikation davon erfährt, gibt es ein _Protokoll_ zwischen Window Manager und der Applikation. Der Window Manager sendet ein _`ClientMessage` Event_ an die Applikation. Dieses Event muss in seinem `data`-Teil die ID eines Properties _`WM_DELETE_MESSAGE`_ enthalten. === Atoms Ein Atom ist die _ID eines Strings_, der für _Meta-Zwecke_ benötigt wird. Anstelle der Strings verwendet man stattdessen die entsprechenden Atoms. Das _erspart_ das ständige Parsen der Strings #hinweis[(z.B. statt `WM_DELETE_MESSAGE` verwendet man intern Atom 5)]. *```c Atom XInternAtom (Display *, char *, Bool only_if_exists)```* _übersetzt_ den String in ein Atom auf dem angegeben Display. _`only_if_exists`_ gibt an, ob das Atom erzeugt werden soll, wenn es nicht existiert #hinweis[(`only_if_exists = false`)]. === Properties Mit jedem Fenster können _Properties_ assoziiert werden. Der Window Manager _liest und/oder setzt_ diese Properties. _Generischer Kommunikations-Mechanismus_ zwischen Applikation und Window Manager. Eine Property wird über ein Atom _identifiziert_. Zu jedem Property gehören _spezifische Daten_ #hinweis[(z.B. ein oder mehrere Strings oder eine Liste von Atomen).] ==== `WM_PROTOCOLS` Der X Standard definiert eine _Anzahl an Protokollen_, die der Window Manager verstehen soll. Ein Client kann sich für Protokolle _registrieren_. Dazu muss er im Property _`WM_PROTOCOLS`_ die Liste der Atome der Protokollnamen speichern. Das geschieht mit der Funktion `XSetWMProtocols.` *```c XSetWMProtocols (Display *, Window, Atom *first_proto, int count)```* speichert im Property `WM_PROTOCOLS` die Atome aus dem Array, das an `first_proto` beginnt und `count` Elemente enthält. ==== `WM_DELETE_WINDOW` Der Window Manager schickt ein Event an den Client, wenn man auf den Close-Button drückt. Der Event-Typ ist `ClientMessage`, wird immer vom Client verarbeitet. Im Datenteil des Events steht das Atom von `WM_DELETE_WINDOW`. #table( columns: (1fr, auto), table.header([Registrierung des Clients], [Verarbeiten des Events]), [ ```c Atom atom = XInternAtom (display, "WM_DELETE_WINDOW", /* only_if_exists = */ False); XSetWMProtocols ( display, window, &atom, 1); ``` ], [ ```c switch (event.type) { case ClientMessage: if (event.client->data.l[0] == atom) { ... } break; } ``` ], )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/cjk-latin-spacing_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test CJK-Latin spacing. #set page(width: 50pt + 10pt, margin: (x: 5pt)) #set text(lang: "zh", font: "Noto Serif CJK SC", cjk-latin-spacing: auto) #set par(justify: true) 中文,中12文1中,文12中文 中文,中ab文a中,文ab中文 #set text(cjk-latin-spacing: none) 中文,中12文1中,文12中文 中文,中ab文a中,文ab中文
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/completion/half_completion.typ
typst
Apache License 2.0
// contains: font #set text(fo /* range -2..0 */)
https://github.com/jamesrswift/dining-table
https://raw.githubusercontent.com/jamesrswift/dining-table/main/src/deps.typ
typst
The Unlicense
#import "@preview/valkyrie:0.2.1" as z
https://github.com/svolume/GHA-CRT
https://raw.githubusercontent.com/svolume/GHA-CRT/main/README.md
markdown
MIT License
# GHA-CRT: GitHub Actions Container Runner for Typst ## Usage 1. create `config.yml` out of `config.yml.default` ```yml # Repository URL url: "https://github.com/USERNAME/REPOSITORY" # self-hosted Runner token token: <PASSWORD>RUNNERTOKEN # Name of the Runner name: typst-runner # additional Labels to the defaults # defaults are 'self-hosted', 'Linux' and 'X64' labels: "alpine, typst" ``` 2. start container with ```bash podman run -d -v /path/to/config.yml:/actions-runner/config.yml --name gha-crt ghcr.io/svolume/gha-crt:main ```
https://github.com/harryhanYuhao/typst.vim
https://raw.githubusercontent.com/harryhanYuhao/typst.vim/main/test/readme.md
markdown
# Testing Files ## Docker The docker file set up a miminal runable vim with typst.vim installed. Obviously openning the pdf reader would be very difficult if not impossible; otherwise the functionality of the plugin can be tested. Docker file of different operation system are created to test in different environment.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10920.typ
typst
Apache License 2.0
#let data = ( ("LYDIAN LETTER A", "Lo", 0), ("LYDIAN LETTER B", "Lo", 0), ("LYDIAN LETTER G", "Lo", 0), ("LYDIAN LETTER D", "Lo", 0), ("LYDIAN LETTER E", "Lo", 0), ("LYDIAN LETTER V", "Lo", 0), ("LYDIAN LETTER I", "Lo", 0), ("LYDIAN LETTER Y", "Lo", 0), ("LYDIAN LETTER K", "Lo", 0), ("LYDIAN LETTER L", "Lo", 0), ("LYDIAN LETTER M", "Lo", 0), ("LYDIAN LETTER N", "Lo", 0), ("LYDIAN LETTER O", "Lo", 0), ("LYDIAN LETTER R", "Lo", 0), ("LYDIAN LETTER SS", "Lo", 0), ("LYDIAN LETTER T", "Lo", 0), ("LYDIAN LETTER U", "Lo", 0), ("LYDIAN LETTER F", "Lo", 0), ("LYDIAN LETTER Q", "Lo", 0), ("LYDIAN LETTER S", "Lo", 0), ("LYDIAN LETTER TT", "Lo", 0), ("LYDIAN LETTER AN", "Lo", 0), ("LYDIAN LETTER EN", "Lo", 0), ("LYDIAN LETTER LY", "Lo", 0), ("LYDIAN LETTER NN", "Lo", 0), ("LYDIAN LETTER C", "Lo", 0), (), (), (), (), (), ("LYDIAN TRIANGULAR MARK", "Po", 0), )
https://github.com/sofianedjerbi/ResumeOld
https://raw.githubusercontent.com/sofianedjerbi/ResumeOld/main/modules/professional.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Expériences") #grid( columns: (50%, 50%), gutter: 2%, [ #cvEntry( title: [Ingénieur Recherche et Développement], society: [Ingenico], date: [Oct 23 - Maintenant], location: [Valence, France], description: list( [Création et maintenance de librairies Java et Kotlin pour terminaux Android Axium. Assurer la compatibilité avec les gammes Tetra.], [Implémentation de Kotlin KMM pour programmation multiplateforme. Leadership technique en Java & Kotlin.] ), tags: ("Java", "Kotlin", "C++", "Gradle", "Jira", "Bitbucket", "KMM", "Linux", "UML") ) #cvEntry( title: [Architecte & Développeur Java / Rust], society: [Kaiiju], date: [Jan 23 - Oct 23], location: [Valence, France], description: list( [Réduction des coûts d'hébergement via un nouveau format de stockage optimisé. Développement d'une API publique en Rust.], [Amélioration des performances et réduction de l'utilisation de l'espace disque d'environ 63%.] ), tags: ("Java", "Guava", "Multithreading", "Gradle", "Git", "Rust") ) #cvEntry( title: [Architecte & Développeur Java / Kotlin], society: [Elendil], date: [Jui 23 - Oct 23], location: [Valence, France], description: list( [Établissement d'une boutique multiplateforme avec tarification en temps réel. Développement d'un système d'enchères pour clients.], [Création d'une interface web pour suivi des profits et dépenses, avec graphiques dynamiques.] ), tags: ("Java", "Kotlin", "SQL", "Hibernate", "Spring", "Gson", "Gradle", "JavaScript", "MySQL") ) #cvEntry( title: [Architecte & Développeur C++ / BDD], society: [via Fiverr], date: [Jan 22 - Jui 22], location: [Valence, France], description: list( [Conception d'un logiciel de gestion d'élevage pour optimiser la rentabilité des accouplements.], [Développement d'une interface utilisateur graphique et automatisation du calcul des accouplements les plus profitables.] ), tags: ("C++", "Qt", "QtCreator", "SQLite", "Boost", "Eigen", "Curl (CPR)") ) ], [ #cvEntry( title: [Administrateur Système & Développeur Linux], society: [Kugge], date: [Jui 21 - Oct 23], location: [Grenoble, France], description: list( [Création de machines virtuelles et développement d'un logiciel de sauvegarde automatisée.], [Planification de l'évolutivité de l'infrastructure et assistance technique aux clients.] ), tags: ("Linux", "Python", "Rust", "SQL", "Docker", "Proxmox", "Flask", "Django", "FastAPI", "Pandas", "Bash") ) #cvEntry( title: [Développeur C++ / Python], society: [CEA Leti], date: [Dec 21 - Juin 22], location: [Grenoble, France], description: list( [Développement d'un logiciel pour surveillance des effets des attaques par rayon X sur la mémoire de microcontrôleurs.], [Création d'une API et d'une interface graphique pour interaction et visualisation en temps réel.] ), tags: ("C++", "Python", "Qt", "QtCreator", "FTDI", "ATMega") ) #cvEntry( title: [Tuteur en Mathématiques], society: [Université Grenoble Alpes], date: [Sep 2021 - Juin 2022], location: [Grenoble, France], description: list( [Encadrement hebdomadaire d'étudiants de première année pour la compréhension de concepts mathématiques.], [Conception de graphiques interactifs pour une visualisation efficace des concepts étudiés.] ), tags: ("Python", "Analyse réelle", "Théorie des groupes", "Algèbre linéaire") ) #cvEntry( title: [Développeur Java], society: [via Fiverr], date: [Mars 2020 - Août 2020], location: [Grenoble, France], description: list( [Création d'une solution pour répartir dynamiquement la charge de calcul d'une application Java en fonction du trafic.], [Optimisation et désynchronisation des calculs pour améliorer l'efficacité et réduire les délais.] ), tags: ("Java", "Bash", "Linux", "Cloud Computing", "Spring") ) ] )
https://github.com/barrel111/readings
https://raw.githubusercontent.com/barrel111/readings/main/problems/external/1910SU/week3.typ
typst
#import "@local/preamble:0.1.0": * #import "@preview/cetz:0.2.2": canvas, plot #show: project.with( course: "1910SU", sem: "Summer", title: "Group Discussion: Integration", subtitle: "Solutions", contents: false, ) Recall the statement of the _First Fundamental Theorem of Calculus_, #prop[Let $f$ be a continuous real-valued function defined on a closed interval $[a, b]$. Let $F$ be the function defined, for all $x in [a, b]$, by $ F(x) = integral_a^x f(t) d t. $ Then $F$ is uniformly continuous on $[a, b]$ and differentiable on the open interval $(a, b)$ and $ F'(x) = f(x) $ for all $x in (a, b)$. That is, $F$ is an antiderivative of $f$ on $(a, b)$. ] = First Fundamental Theorem of Calculus Quite a few people were confused about exactly what this question required. The task is to first compute $A(x)$ by integration, and then differentiate the result to show that $d/(d x) A(x) = f(x)$ as claimed by the First Fundamental Theorem of Calculus. == $a = 0, f(x) = x^2$ $ A(x) &= integral_0^x t^2 d t \ &= lr((t^3)/3|)_a^x \ &= (x^3)/3 $ $ d/(d x) A(x) = x^2 $ == $a = 2, f(x) = 1/x$ $ A(x) &= integral_2^x 1/x d t \ &= lr(ln abs(x) |)_2^x \ &= ln abs(x) - ln 2 $ $ d/(d x) A(x) = "sgn"(x) dot 1/x $ Here, $"sgn": RR-{0} -> {-1, 1} $ is the sign function, more formally defined by $ "sgn"(x) = cases(1 &"if " x > 0\,, -1 &"if " x < 0.) $ == $a = pi, f(x) = cos x$ $ A(x) &= integral_pi^x cos x d t \ &= lr(sin x|)_pi^x \ &= sin x - sin pi \ &= sin x $ = Chain Rule == $A(x) = integral_0^x t^3 d t$ By the First Fundamental Theorem of Calculus, $ d/(d x) A(x) &= x^3. $ == $A(x^2) = integral_0^x^2 t^3 d t$ By the Chain Rule, $ d/(d x) A(x^2) &= A'(x^2) d/(d x) x^2 = x^6 dot 2x = 2x^7. $ == $B(x) = integral_x^0 t^3 d t$ By the First Fundamental Theorem of Calculus, $ d/(d x) B(x) &= d/(d x) integral_x^0 t^3 d t \ &= -d/(d x) integral_0^x t^3 d t \ &= -x^3. $ == $B(x^2) = integral_(x^2)^0 t^3 d t$ By the Chain Rule, $ d/(d x) B(x^2) = B'(x^2) d/(d x) x^2 = -x^6 dot 2x = -2x^7. $ == $d/(d x) integral_0^(x^2) f(t) d t$ Define $ A(x) = integral_0^x f(t) d t. $ Then, by the Chain Rule, $ d/(d x) A(x^2) = A'(x^2) d/(d x) x^2 = 2 f(x^2) x. $ == $d/(d x) integral_(p(x))^(q(x)) f(t) d t$ This is essentially the same idea as the previous parts, albeit generalized slightly. Consider first the decomposition, $ integral_(p(x))^(q(x)) f(t) d t &= integral_0^(q(x)) f(t) d t + integral^0_(p(x)) f(t) d t \ &= integral_0^(q(x)) f(t) d t - integral_0^(p(x)) f(t) d t. $ Then, $ d/(d x) integral_(p(x))^(q(x)) f(t) d t &= d/(d x) integral_0^(q(x)) f(t) d t - d/(d x) integral_0^(p(x)) f(t) d t \ &= f(q(x)) q'(x) - f(p(x)) p'(x). $
https://github.com/chen-qingyu/Typst-Code
https://raw.githubusercontent.com/chen-qingyu/Typst-Code/master/integral%201.typ
typst
#let LF = {v(4em); linebreak()} #let mdelta = $4 a c - b^2$ #let denA = $x^2 + b/a x + c/a$ #let denB = $(x + b/(2 a))^2 + c/a - b^2/(4 a^2)$ $ & integral (m x + n)/(a x^2 + b x + c) dif x space (a != 0) LF =& integral (m/a x + n/a)/denA dif x LF =& integral (m/a x + n/a)/denB dif x LF =& m/a integral x/denB dif x + n/a integral 1/denB dif x LF =& m/(2 a) integral (2 x + b/a - b/a) / denB dif x + n/a integral 1/denB dif x LF =& m/(2 a) integral (2 x + b/a)/denB dif x + (2 n a - m b)/(2 a^2) integral 1/denB dif x LF =& m/(2 a) integral 1/denA dif (denA) + (2 n a - m b)/(2 a^2) integral 1/((x + b/(2 a))^2 + (sqrt(mdelta/(4 a^2)))^2) dif (x + b/(2 a)) LF =& m/(2 a) ln|denA| + (2 n a - m b)/(2 a^2) 1/(sqrt(mdelta/(4 a^2))) arctan (x + b/(2 a))/(sqrt(mdelta/(4 a^2))) + C LF =& m/(2 a) ln|a x^2 + b x + c| + (2 n a - m b)/(a sqrt(mdelta)) arctan (2 a x + b)/(sqrt(mdelta)) + C LF $
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/scripting/index.md
markdown
MIT License
# Scripting ## Unflatten arrays ```typ // author: PgSuper #let unflatten(arr, n) = { let columns = range(0, n).map(_ => ()) for (i, x) in arr.enumerate() { columns.at(calc.rem(i, n)).push(x) } array.zip(..columns) } #unflatten((1, 2, 3, 4, 5, 6), 2) #unflatten((1, 2, 3, 4, 5, 6), 3) ``` ## Create an abbreviation ```typ #let full-name = "Federal University of Ceará" #let letts = { full-name .split() .map(word => word.at(0)) // filter only capital letters .filter(l => upper(l) == l) .join() } #letts ``` ## Split the string retrieving separators ```typ #",this, is a a a a; a. test? string!".matches(regex("(\b[\P{Punct}\s]+\b|\p{Punct})")).map(x => x.captures).join() ``` ## Create selector matching any values in an array This snippet creates a selector (that is then used in a show rule) that matches any of the values inside the array. Here, it is used to highlight a few raw lines, but it can be easily adapted to any kind of selector. ````typ // author: Blokyk #let lines = (2, 3, 5) #let lines-selectors = lines.map(lineno => raw.line.where(number: lineno)) #let lines-combined-selector = lines-selectors.fold( // start with the first selector by default // you can also use a selector that wouldn't ever match anything, if possible lines-selectors.at(0), selector.or // create an OR of all selectors (alternatively: (acc, sel) => acc.or(sel)) ) #show lines-combined-selector: highlight ```py def foo(x, y): if x == y: return False z = x + y return z * x - z * y >= z ``` ```` ## Synthesize show (or show-set) rules from dictionnary This snippet applies a show-set rule to any element inside a dictionary, by using the key as the selector and the value as the parameter to set. In this example, it's used to give custom supplements to custom figure kinds, based on a dictionnary of correspondances. ```typ // author: laurmaedje #let kind_supp_dict = ( algo: "Pseudo-code", ex: "Example", prob: "Problem", ) // apply this rule to the whole (rest of the) document #show: it => { kind_supp_dict .pairs() // get an array of key-value pairs .fold( // we're going to stack show-set rules before the document it, // start with the default document (acc, (kind, supp)) => { // add the curent kind-supp combination on top of the rest show figure.where(kind: kind): set figure(supplement: supp) acc } ) } #figure( kind: "algo", caption: [My code], ```Algorithm there``` ) ``` Additonnaly, as this is applied at the position where you write it, these show-set rules will appear as if they were added in the same place where you wrote this rule. This means that you can override them later, just like any other show-set rules.
https://github.com/davawen/Cours
https://raw.githubusercontent.com/davawen/Cours/main/Physique/Incertitudes/incertitudes.typ
typst
#import "@local/physique:0.1.0": * #show: doc => template(doc) #titleb[Analyse de données expérimentales: Incertitudes] On devra être capable de déterminer l'incertitude à partir des données expérimentales. = Analyse statistique d'une mesure expérimentale - Incertitude de Type A ou B Si tout le monde dans la classe fait une mesure avec le même dispositif, on observera très probablement une variance (on pourra construire un histogramme des valeurs obtenues). *On ne peut pas trouver _LA_ vraie valeur.* == Définitions #def[Mesure]: Ensemble des opérations permettant de définir la (ou les) valeur(s) d'une grandeur physique $X$ qu'on appelle *mesurande*. Une mesure parfaite n'existe pas (on observera toujours une fluctuation entre chaque mesure). On définit l'écart de mesure $E_R$ par la différence entre la valeur mesurée $x$ et la valeur vraie $X_"vrai"$. $ E_R = x - X_"vrai" $ On doit être capable d'estimer l'intervalle autour de notre mesure dans laquelle $X_"vrai"$ a le plus de chance de tomber. L'idée d'incertitude, c'est se demander si, si quelqu'un refait une mesure dans les même conditions et avec les même outils, est-ce que sa mesure tombera dans notre intervalle de confiance. == Variabilités On caractérise deux types de variabilité: - #def[Variabilité systématique]: Un écart de mesure toujours dans le même sens sur plusieurs mesures. La faute est souvent sur le manipulateur qui a mal réglé le 0. On ne peut pas la traiter. - #def[Variabilité aléatoire]: Variabilité causée par la nature du système ou des instruments utilisés. On peut la traiter statistiquement. #figure(caption: [Pas de variabilité systématique, haute variabilité aléatoire], canvas({ import draw: * let points = ( ((0, 0.1), (0.4, 0.3), (-0.2, -0.5), (0.8, -0.1), (-0.8, 0.4)), ) for ps in points { circle((0, 0), radius: 0.2) circle((0, 0), radius: 0.4) circle((0, 0), radius: 0.6) circle((0, 0), radius: 0.8) for p in ps { point(p) } } })) == Notion d'incertitude Il faut être capable de déterminer si on est dans le cas d'une incertitude de type A ou de type B. Grossièrement: si on fait plusieurs fois la même mesure, on est dans le type A, et si on en fait qu'une seule, on est dans le type B. == Evaluation des incertitudes de type A Pour les incertitude de type A: on peut combattre l'incertitude en faisant la moyenne de nos mesures (étude statistique très basique). On peut calculer l'écart-type de nos mesures, et on essaye d'estimer la loi de probabilité de nos mesures. ```py # Importation des bibliothèques utiles import numpy as np # pour la manipulation des tableaux import matplotlib.pyplot as plt # pour les représentations graphiques # Saisie des données expérimentales x = np.array([...]] #valeurs de x # Tracé de l’histogramme plt.figure() plt.hist(x, bins=’rice’) # la commande ’rice’ permet d’optimiser les intervalles de l’histogramme plt.title("Histogramme des valeurs de x") plt.show() ``` Généralement, on va donner un résultat avec l'incertitude correspondante: $x plus.minus u(x)$, avec: $ u(x) = sqrt(1/N) sigma(x) $ == Evaluation des incertitudes de type B Les incertitudes de mesures proviennent des incertitudes des instruments de mesure (exemple: règle, thermomètre, baromètre) qui ne sont pas parfaitement précis. Il faut être capable d'estimer la précision de la mesure faite. Exemple: la plupart des pHmètres affichent 2 chiffres après la virgule, mais presque aucun constructeur ne garantit les chiffre après le premier. Si on se base sur le choix d'une graduation comme écart maximal autorisé, on peut écrire le résultat avec comme incertitude: $ u(x) = "graduation"/sqrt(12) $ ou en prenant une demi-graduation: $ u(x) = "demi-graduation"/sqrt(3) $ Exemple: Méthode d'autocollimation: - On peut faire plein de mesures (et faire la moyenne): type A - On fait une seule mesure, et on se réfère aux graduations pour l'incertitude Exemple: Méthode de Bessel: - On doit estimer l'incertitude sur $D$, ainsi que l'incertitude de $d$. - On propage l'incertitude à travers les calculs. = Détermination d'une grandeur à partir de mesures expérimentales - Incertitudes composées (Voir poly.) La majorité du temps, on utilisera une simulation de Monte Carlo:
https://github.com/bpkleer/typst-academicons
https://raw.githubusercontent.com/bpkleer/typst-academicons/main/lib.typ
typst
MIT License
//! typst-fontawesome //! //! https://github.com/duskmoon314/typst-fontawesome // Implementation of `ai-icon` #import "lib-impl.typ": * // Generated icons #import "lib-gen.typ": * // Re-export the `ai-icon` function // The following doc comment is needed for lsp to show the documentation /// Render a Font Awesome icon by its name or unicode /// /// Parameters: /// - `name`: The name of the icon /// - This can be name in string or unicode of the icon /// - `solid`: Whether to use the solid version of the icon /// - `ai-icon-map`: The map of icon names to unicode /// - Default is a map generated from FontAwesome metadata /// - *Not recommended* You can provide your own map to override it /// - `..args`: Additional arguments to pass to the `text` function /// /// Returns: The rendered icon as a `text` element #let ai-icon = ai-icon.with(ai-icon-map: ai-icon-map) /// Render multiple Font Awesome icons together /// /// Parameters: /// - `icons`: The list of icons to render /// - Multiple types are supported: /// - `str`: The name of the icon, e.g. `"square"` /// - `array`: A tuple of the name and additional arguments, e.g. `("chess-queen", (solid: true, fill: white))` /// - `arguments`: Arguments to pass to the `ai-icon` function, e.g. `arguments("chess-queen", solid: true, fill: white)` /// - `content`: Any other content you want to render, e.g. `ai-chess-queen(solid: true, fill: white)` /// - `box-args`: Additional arguments to pass to the `box` function /// - `grid-args`: Additional arguments to pass to the `grid` function /// - `ai-icon-args`: Additional arguments to pass to all `ai-icon` function #let ai-stack( box-args: (:), grid-args: (:), ai-icon-args: (:), ..icons, ) = ( context { let icons = icons.pos().map(icon => { if type(icon) == str { ai-icon(icon, ..ai-icon-args) } else if type(icon) == array { let (name, args) = icon ai-icon(name, ..ai-icon-args, ..args) } else if type(icon) == arguments { ai-icon(..icon.pos(), ..ai-icon-args, ..icon.named()) } else if type(icon) == content { icon } else { panic("Unsupported content. Please submit an issue for your use case.") } }) // Get the maximum width of the icons let max-width = calc.max( ..icons.map(icon => { measure(icon).width }), ) box( ..box-args, grid( align: center + horizon, columns: icons.len() * (max-width,), column-gutter: -max-width, rows: 1, ..grid-args, ..icons ), ) } )
https://github.com/fenjalien/metro
https://raw.githubusercontent.com/fenjalien/metro/main/src/impl/unit.typ
typst
Apache License 2.0
#import "/src/dependencies.typ": is #import "/src/utils.typ": combine-dict, content-to-string // NULL unicode character as a marker #let NULL-after = [\u{FFFF} ] #let NULL-before = [ \u{FFFF}] #let tothe = (x) => math.attach(NULL-after, t: x) #let raiseto = (x) => math.attach(NULL-before, t: x) #let qualifier = (x) => math.attach(NULL-after, b: x) #let parse(options, input) = { parse = parse.with(options) let func = repr(input.func()) let out = (:) return if func == "attach" { if "t" in input.fields() { let power = float(content-to-string(input.t)) if power < 0 { power *= -1 (is-per: true) } (power: power) } if "b" in input.fields() { (qualifier: input.b) } ( body: if input.base not in (NULL-after, NULL-before) { parse(input.base) } else { input.base } ) } else if func == "frac" { ( body: parse(input.num), per: (parse(input.denom),), ) } else if func == "class" { if input.class == "unary" { (prefix: input.body) } else if input.class == "binary" and input.body == [per] { (is-per: true, body: NULL-before) } } else if func in ("text", "equation", "display") { ( body: if func == "text" { input.text } else { input.body } ) } else if func == "lr" { parse(input.body.children.slice(1, -1).join()) } else if func == "root" { (power: 0.5, body: parse(input.radicand)) } else if func == "sequence" { let result = ((:),) let out = (:) let per-stuck = false for child in input.children { child = parse(child) if child == none { continue } if "body" in child { let body = child.remove("body") if body != NULL-after and "body" in out { if per-stuck or out.at("is-per", default: false) { result.last().per = result.last().at("per", default: ()) + (out,) } else { result.push(out) } if options.sticky-per and child.at("is-per", default: false) and body == NULL-before { per-stuck = true } out = (:) } if body not in (NULL-before, NULL-after) { out.body = body } } if "power" in child { out.power = out.at("power", default: 1) * child.remove("power") } for (k, v) in child { if v != none { out.insert(k, v) } } } if "body" in out { if per-stuck or out.at("is-per", default: false) { result.last().per = result.last().at("per", default: ()) + (out,) } else { result.push(out) } } if result.len() > 1 { (body: result) } else { result.first() } } } #let display(options, input) = { let quantity-product = options.quantity-product options.quantity-product = none display = display.with(options) let out = if "body" in input { if type(input.body) == array { input.body.map(display).filter(x => x != none).join(options.inter-unit-product) } else if type(input.body) == dictionary { display(input.body) } else { input.body } } if "prefix" in input { out = input.prefix + out } if "power" in input or "qualifier" in input { if options.power-half-as-sqrt and "power" in input and calc.abs(calc.fract(input.power)) == 0.5 { input.power -= 0.5 out = math.sqrt(out) } let has-qualifier = "qualifier" in input if has-qualifier { if options.qualifier-mode == "bracket" { out += "(" + input.qualifier + ")" } else if options.qualifier-mode == "phrase"{ out += options.qualifier-phrase + input.qualifier } } out = math.attach( out, t: if "power" in input and input.power != 0 { str(input.power) }, b: if has-qualifier and options.qualifier-mode == "subscript" { input.qualifier } ) if has-qualifier and options.qualifier-mode == "combine" { out += if out.t != none { "(" + input.qualifier + ")" } else { input.qualifier } } } if "per" in input { if options.per-mode == "power" { out += if "body" in input { options.inter-unit-product } + input.per.map(p => { p.power = p.at("power", default: 1) * -1 display(p) }).join(options.inter-unit-product) } else if options.per-mode == "fraction" { out = math.frac( out, input.per.map(display).join(options.inter-unit-product) ) } else if options.per-mode == "symbol" { let denom = input.per.map(display).join(options.inter-unit-product) if options.bracket-unit-denominator and input.per.len() > 1 { denom = "(" + denom + ")" } out += [#options.per-symbol] + [#denom] } } // Don't add a quantiy-prdouct if its in symbol mode and has a per 1/kg not 1 /kg return if quantity-product != none and (options.per-mode != "symbol" or "body" in input) { quantity-product + h(0pt)} + out } #let default-options = ( inter-unit-product: sym.space.thin, per-symbol: sym.slash, bracket-unit-denominator: true, per-mode: "power", power-half-as-sqrt: false, qualifier-mode: "subscript", qualifier-phrase: "", sticky-per: false, units: none, prefixes: none, prefix-power-tens: none, powers: none, qualifiers: none, quantity-product: none ) #let get-options(options) = combine-dict(options, default-options, only-update: true) #let unit(unit, options) = { let input = unit assert(type(input) in (str, content), message: "Expected string or content input type, got " + type(input) + " instead.") options = get-options(options) if type(input) == str { // Converts the string input into math content // The first replace adds quote marks around words attached to underscores otherwise math doesn't capture the qualifier correctly. // Second replace removes slashes with pers as they allow no numerator to be present. input = eval( input.replace(regex("_(\w+)|(?:(?:_|of)\((.+?)\))"), (m) => { let c = m.captures "_\"" + if c.first() == none { c.last() } else { c.first() } + "\"" }).replace("/", " per ").trim(), mode: "math", scope: options.units + options.prefixes + options.powers + options.qualifiers + ( per: math.class("binary", "per"), tothe: tothe, raiseto: raiseto, ) ) } // When math content is passed directly it comes as an equation which we normally don't want to step into. If the equation is not exactly a known unit or prefix step into it. if is.elem(math.equation, input) and not input in options.units.values() and not input in options.prefixes.values() { input = input.body } math.upright(math.equation( display(options, parse(options, input)) )) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/supercharged-dhbw/1.0.0/declaration-of-authorship.typ
typst
Apache License 2.0
#let declaration-of-authorship(authors, title, date) = { pagebreak() v(2em) text(size: 20pt, weight: "bold", "Declaration of Authorship") v(1em) par(justify: true, [ according to item 1.1.13 of Annex 1 to §§ 3, 4, and 5 of the Examination Regulations for the Bachelor's Degree Programs in the Technology Department of the Baden-Württemberg Cooperative State University dated September 29, 2017. I hereby certify that I have composed the thesis on the topic: ]) v(1em) align(center, text(weight: "bold", title) ) v(1em) par(justify: true, [ independently and have not used any sources and aids other than those stated in the document. I also certify that the submitted electronic version matches the printed version. ]) v(3em) text([#authors.map(author => author.company.city).dedup().join(", ", last: " and "), #date.display( "[day].[month].[year]" )]) for author in authors { v(5em) line(length: 40%) author.name } }
https://github.com/WinstonMDP/math
https://raw.githubusercontent.com/WinstonMDP/math/main/exers/j.typ
typst
#import "../cfg.typ": * #show: cfg $ "Prove that" all("series with positive members" sum_(n = 1)^oo a_n\, sum_(n = 1)^oo b_n): \ a_n tilde_(n -> oo) b_n -> "the series coverge or don't coverge simultaneously" $ $sum_(n = 1)^oo a_n$ converges I'm proving that $all(epsilon > 0) ex(N) all(k_1\, k_2 > N): b_k_1 + ... + b_k_2 < epsilon$ $ex(N) all(k_1\, k_2 > N): a_k_1 + ... + a_k_2 < epsilon/2$ $ex(N') all(n > N'): abs(1 - b_n/a_n) < 1$ $all(n > N'): abs(a_n - b_n) < a_n$ $all(k_1\, k_2 > N): b_k_1 + ... + b_k_2 < 2(a_k_1 + ... + a_k_2) < epsilon$ $qed$
https://github.com/jomaway/typst-linguify
https://raw.githubusercontent.com/jomaway/typst-linguify/main/tests/assertion_tests.typ
typst
MIT License
#import "../lib/linguify.typ": * #let db = toml("lang.toml") #let test_data = { assert(db != none) assert(db.at("lang", default: none) != none ) set-database(db) reset-database() [run `test_db` successfully] } #let test_get_text = { // English (en) assert(get_text(db.lang, "apple","en") == "Apple") assert(get_text(db.lang, "pear","en") == "Pear") assert(get_text(db.lang, "banana","en") == "Banana") assert(get_text(db.lang, "red","en") == "red") assert(get_text(db.lang, "green","en") == "green") assert(get_text(db.lang, "yellow","en") == "yellow") assert(get_text(db.lang, "test", "en") == none) // German (de) assert(get_text(db.lang, "apple","de") == "Apfel") assert(get_text(db.lang, "pear","de") == "Birne") assert(get_text(db.lang, "banana","de") == "Banane") assert(get_text(db.lang, "red","de") == none) assert(get_text(db.lang, "green","de") == none) assert(get_text(db.lang, "yellow","de") == none) assert(get_text(db.lang, "test", "de") == none) [run `test_get_text` successfully] } #let test__linguify = { reset-database() // English (en) set text(lang: "en") context { assert(_linguify("apple", from: db) == ok("Apple")) assert(_linguify("pear", from: db)== ok("Pear")) assert(_linguify("banana", from: db) == ok("Banana" )) assert(_linguify("red", from: db) == ("ok":"red")) assert(_linguify("green", from: db) == ok("green")) assert(_linguify("yellow", from: db) == ok("yellow")) assert(_linguify("test", from: db).error != none) } // German (de) set text(lang: "de") context { assert(_linguify("apple", from: db) == ok("Apfel")) assert(_linguify("pear", from: db) == ok("Birne")) assert(_linguify("banana", from: db) == ok("Banane")) // keys not inside db - will fallback to en assert(_linguify("red", from: db) == ok("red")) assert(_linguify("green", from: db) == ok("green")) assert(_linguify("yellow", from: db) == ok("yellow")) assert(_linguify("test", from: db).error != none) } // Spanish (es) ! lang not inside db wil fallback to en set text(lang: "es") context { assert(_linguify("apple", from: db) == ok("Apple")) assert(_linguify("pear", from: db) == ok("Pear")) assert(_linguify("banana", from: db) == ok("Banana")) assert(_linguify("red", from: db) == ok("red")) assert(_linguify("green", from: db) == ok("green")) assert(_linguify("yellow", from: db) == ok("yellow")) assert(_linguify("test", from: db).error != none) } [run `test__linguify` successfully] } #let test__linguify_auto_db = { set-database(db) // English (en) set text(lang: "en") context { assert(_linguify("apple") == ok("Apple")) assert(_linguify("pear")== ok("Pear")) assert(_linguify("banana") == ok("Banana")) assert(_linguify("red") == ok("red")) assert(_linguify("green") == ok("green")) assert(_linguify("yellow") == ok("yellow")) assert(_linguify("test").error != none) } // German (de) set text(lang: "de") context { assert(_linguify("apple") == ok("Apfel")) assert(_linguify("pear") == ok("Birne")) assert(_linguify("banana") == ok("Banane") ) // keys not inside db - will fallback to en assert(_linguify("red") == ok("red")) assert(_linguify("green") == ok("green")) assert(_linguify("yellow") == ok("yellow")) assert(_linguify("test").error != none) } // Spanish (es) ! lang not inside db wil fallback to en set text(lang: "es") context { assert(_linguify("apple") == ok("Apple")) assert(_linguify("pear") == ok("Pear")) assert(_linguify("banana") == ok("Banana") ) assert(_linguify("red") == ok("red")) assert(_linguify("green") == ok("green")) assert(_linguify("yellow") == ok("yellow")) assert(_linguify("test").error != none) } [run `test__linguify_auto_db` successfully] } #let test_args_in_dict_mode = { context { assert(_linguify("apple") == ok("Apple")) assert(_linguify("apple", args:(name:"test")).error != none) assert(_linguify("apple", args:none).error != none) assert(_linguify("apple", args:(:)).error != none) assert(_linguify("apple", args:"").error != none) assert(_linguify("apple", args:1).error != none) } [run `test_args_in_dict_mode` successfully] } = Run tests (#datetime.today().display()) - #test_data - #test_get_text - #test__linguify - #test__linguify_auto_db - #test_args_in_dict_mode
https://github.com/sysu/better-thesis
https://raw.githubusercontent.com/sysu/better-thesis/main/specifications/bachelor/appendix.typ
typst
MIT License
// 利用 state 捕获摘要参数,并通过 context 传递给渲染函数 #import "/utils/style.typ": 字号, 字体 #import "/utils/indent.typ": fake-par #import "@preview/numblex:0.1.1": numblex #import "@preview/i-figured:0.2.4" #let appendix-content = state("appendix", [ = 附录要求 对于一些不宜放在正文中的重要支撑材料,可编入毕业论文的附录中,包括某些重要的原始数据、详细数学推导、程序全文及其说明、复杂的图表、设计图纸等一系列需要补充提供的说明材料。如果毕业论文中引用的实例、数据资料,实验结果等符号较多时,为了节约篇幅,便于读者查阅,可以编写一个符号说明,注明符号代表的意义。附录的篇幅不宜太多,一般不超过正文。此项不是必需项,空缺时可以省略。 ]) #let appendix( body ) = { context appendix-content.update(body) } #let appendix-part() = { // 致谢、附录内容 宋体小四号 set text(font: 字体.宋体, size: 字号.小四) // 附录标题中不需要分隔中英文 show heading: set text(cjk-latin-spacing: none) // 致谢、附录标题 黑体三号居中 show heading.where(level: 1): set text(font: 字体.黑体, size: 字号.三号) // 目录仅展示附录章标题 // 论文附录依次用大写字母“附录A、附录B、附录C……”表示,附录内的分级序号可采用“附A1、 // 附A1.1、附A1.1.1”等表示,图、表、公式均依此类推为“图A1、表A1、式A1”等。 show heading.where(level: 1): set heading(numbering: "附录A", outlined: true) show heading.where(level: 2): set heading(numbering: "附A1", outlined: false) show heading.where(level: 3): set heading(numbering: "附A1.1", outlined: false) show heading.where(level: 4): set heading(numbering: "附A1.1.1", outlined: false) show figure: i-figured.show-figure.with(numbering: "A.1") show math.equation: i-figured.show-equation.with(numbering: "(A.1)") // 重置 heading 计数 counter(heading).update(0) // 通过插入假段落修复[章节第一段不缩进问题](https://github.com/typst/typst/issues/311) show heading.where(level: 1): it => { it fake-par } context appendix-content.final() }
https://github.com/tairahikaru/old-typst-japanese
https://raw.githubusercontent.com/tairahikaru/old-typst-japanese/main/otypjc.typ
typst
Other
// otypjc.typ // https://github.com/tairahikaru/old-typst-japanese // This file is distributed under the AGPLv3 // // Require Typst 0.2.0 (23/04/11) // from typst (https://github.com/typst/typst) (Apache License 2.0) // typst/library/src/layout/page.rs #let papersize-dict = ( a0: (841.0mm, 1189.0mm), a1: (594.0mm, 841.0mm), a2: (420.0mm, 594.0mm), a3: (297.0mm, 420.0mm), a4: (210.0mm, 297.0mm), a5: (148.0mm, 210.0mm), a6: (105.0mm, 148.0mm), a7: (74.0mm, 105.0mm), a8: (52.0mm, 74.0mm), a9: (37.0mm, 52.0mm), a10: (26.0mm, 37.0mm), a11: (18.0mm, 26.0mm), iso-b1: (707.0mm, 1000.0mm), iso-b2: (500.0mm, 707.0mm), iso-b3: (353.0mm, 500.0mm), iso-b4: (250.0mm, 353.0mm), iso-b5: (176.0mm, 250.0mm), iso-b6: (125.0mm, 176.0mm), iso-b7: (88.0mm, 125.0mm), iso-b8: (62.0mm, 88.0mm), iso-c3: (324.0mm, 458.0mm), iso-c4: (229.0mm, 324.0mm), iso-c5: (162.0mm, 229.0mm), iso-c6: (114.0mm, 162.0mm), iso-c7: (81.0mm, 114.0mm), iso-c8: (57.0mm, 81.0mm), din-d3: (272.0mm, 385.0mm), din-d4: (192.0mm, 272.0mm), din-d5: (136.0mm, 192.0mm), din-d6: (96.0mm, 136.0mm), din-d7: (68.0mm, 96.0mm), din-d8: (48.0mm, 68.0mm), sis-g5: (169.0mm, 239.0mm), sis-e5: (115.0mm, 220.0mm), ansi-a: (216.0mm, 279.0mm), ansi-b: (279.0mm, 432.0mm), ansi-c: (432.0mm, 559.0mm), ansi-d: (559.0mm, 864.0mm), ansi-e: (864.0mm, 1118.0mm), arch-a: (229.0mm, 305.0mm), arch-b: (305.0mm, 457.0mm), arch-c: (457.0mm, 610.0mm), arch-d: (610.0mm, 914.0mm), arch-e1: (762.0mm, 1067.0mm), arch-e: (914.0mm, 1219.0mm), jis-b0: (1030.0mm, 1456.0mm), jis-b1: (728.0mm, 1030.0mm), jis-b2: (515.0mm, 728.0mm), jis-b3: (364.0mm, 515.0mm), jis-b4: (257.0mm, 364.0mm), jis-b5: (182.0mm, 257.0mm), jis-b6: (128.0mm, 182.0mm), jis-b7: (91.0mm, 128.0mm), jis-b8: (64.0mm, 91.0mm), jis-b9: (45.0mm, 64.0mm), jis-b10: (32.0mm, 45.0mm), jis-b11: (22.0mm, 32.0mm), sac-d0: (764.0mm, 1064.0mm), sac-d1: (532.0mm, 760.0mm), sac-d2: (380.0mm, 528.0mm), sac-d3: (264.0mm, 376.0mm), sac-d4: (188.0mm, 260.0mm), sac-d5: (130.0mm, 184.0mm), sac-d6: (92.0mm, 126.0mm), iso-id-1: (85.6mm, 53.98mm), iso-id-2: (74.0mm, 105.0mm), iso-id-3: (88.0mm, 125.0mm), asia-f4: (210.0mm, 330.0mm), jp-shiroku-ban-4: (264.0mm, 379.0mm), jp-shiroku-ban-5: (189.0mm, 262.0mm), jp-shiroku-ban-6: (127.0mm, 188.0mm), jp-kiku-4: (227.0mm, 306.0mm), jp-kiku-5: (151.0mm, 227.0mm), jp-business-card: (91.0mm, 55.0mm), cn-business-card: (90.0mm, 54.0mm), eu-business-card: (85.0mm, 55.0mm), fr-tellière: (340.0mm, 440.0mm), fr-couronne-écriture: (360.0mm, 460.0mm), fr-couronne-édition: (370.0mm, 470.0mm), fr-raisin: (500.0mm, 650.0mm), fr-carré: (450.0mm, 560.0mm), fr-jésus: (560.0mm, 760.0mm), uk-brief: (406.4mm, 342.9mm), uk-draft: (254.0mm, 406.4mm), uk-foolscap: (203.2mm, 330.2mm), uk-quarto: (203.2mm, 254.0mm), uk-crown: (508.0mm, 381.0mm), uk-book-a: (111.0mm, 178.0mm), uk-book-b: (129.0mm, 198.0mm), us-letter: (215.9mm, 279.4mm), us-legal: (215.9mm, 355.6mm), us-tabloid: (279.4mm, 431.8mm), us-executive: (84.15mm, 266.7mm), us-foolscap-folio: (215.9mm, 342.9mm), us-statement: (139.7mm, 215.9mm), us-ledger: (431.8mm, 279.4mm), us-oficio: (215.9mm, 340.36mm), us-gov-letter: (203.2mm, 266.7mm), us-gov-legal: (215.9mm, 330.2mm), us-business-card: (88.9mm, 50.8mm), us-digest: (139.7mm, 215.9mm), us-trade: (152.4mm, 228.6mm), newspaper-compact: (280.0mm, 430.0mm), newspaper-berliner: (315.0mm, 470.0mm), newspaper-broadsheet: (381.0mm, 578.0mm), presentation-16-9: (297.0mm, 167.0625mm), presentation-4-3: (280.0mm, 210.0mm), ) #let papersize-parse(paper: none, default: "a4", width: none, height: none, flipped: false) = { let func(paper) = { let paper = papersize-dict.at(paper) let func(w, h) = { if flipped { return (width: h, height: w) } else { return (width: w, height: h) } } func( if width == none {paper.first()} else {width}, if height == none {paper.last()} else {height}, ) } func( if paper == none {default} else {paper} ) } #let inner-state = state("otypjp-inner", (:)) #let tate(it) = { locate(loc => { inner-state.final(loc).at("tate")( it ) }) } #let numbering-parser(pattern, array) = { if pattern == none { return none } if array == () { return none } let func = eval( "(pattern) => { numbering(pattern, " + array.map(str).join(",") + ") }" ) return func(pattern) } #let conf( title: none, author: none, abstract: none, date: none, paper: "a4", flipped: false, columns-number: 1, size: 10pt, //titlepage: false, //twoside: false, //open: "any", columnwidth: auto, columnsep-number: 2, //lines: auto, //topmargin: auto, //bottommargin: auto, //innermargin: auto, //outermargin: auto, //chapter: false, simpleref: true, state-arg: state("otypejc"), doc ) = { set document( title: title, ) if title != none set document( author: author, ) if author != none import "otypjp.typ" // parameters let Cjascale = otypjp.defaults.Cjascale let leading-ratio = otypjp.defaults.leading-ratio let otypjp-tate = otypjp.tate let otypjp = otypjp.conf show: otypjp.with( Cjascale: Cjascale, leading-ratio: leading-ratio, text-edge: false, ) // 引数指定できない set text( size: size, ) let Cwd = Cjascale * size let cwd = Cwd // 本当はrelative lengthにしたいけどCjascaleとの絡みで無理 let Leading = leading-ratio * Cwd let leading = Cjascale * leading-ratio * 1em let normalleading = Leading // 本当はrelative lengthにしたい let Cdp = 0.12 * Cwd let cdp = 0.12 * cwd let Cht = 0.88 * Cwd let cht = 0.88 * cwd // レイアウト set block(spacing: 0pt) // parskip let (width: paperwidth, height: paperheight) = papersize-parse(paper: paper, flipped: flipped) let columnsep = columnsep-number * Cwd set columns( gutter: columnsep, ) let textwidth = calc.round((paperwidth - columnsep * (columns-number - 1)) * 0.8 / Cwd / columns-number) * Cwd * columns-number + columnsep * (columns-number - 1) let textheight = calc.round((paperheight - Cwd) * 0.8 / (Cwd + Leading)) * (Cwd + Leading) + Cwd let topmargin = ( paperwidth - textwidth ) / 2 let sidemargin = ( paperheight - textheight) / 2 set page( margin: ( x: topmargin, y: sidemargin, ), width: paperwidth, height: paperheight, numbering: "1", header: locate(loc => { if title != none and loc.page() == 1 { return } // 現在ページ最初の本文に適用される見出し let func(search) = { let elems = query(search, after: loc) if elems == () { let elems = query(search, before: loc) if elems == () { return none } else { return elems.last() } } else { let eloc = elems.first().location() if ( (eloc.page() == loc.page()) and (eloc.position().y < sidemargin + Cwd) and (eloc.position().x < topmargin + Cwd) ) { // そのページが見出しで始まり、かつその見出しである return elems.first() } else { let elems = query(search, before: loc) if elems == () { return none } else { return elems.last() } } } } let head1 = func( heading.where(level: 1, outlined: true), ) let head2 = func( heading.where(level: 2, outlined: true), ) let mark(head) = { if head != none { let numbers = numbering-parser(head.numbering, counter(heading).at(head.location())) [#numbers#h(1em)#head.body] } } if head1 == none and head2 == none { align(center, title) } else { mark(head1) + h(1fr) if head1 == none or head2 == none or counter(heading).at(head1.location()).first() == counter(heading).at(head2.location()).first() { mark(head2) } } }), ) counter(page).update(1) // 見出し set heading(numbering: "1.1.1.1") show heading: set par(first-line-indent: 0pt) show heading: set block(spacing: 0pt) show heading: it => { let height = (Cwd + Leading) * (2-1) + Leading { set par(leading: Leading) set block(spacing: Leading) let height = height + (Cwd + Leading) * 3 // 直後の段落が1行の場合不必要に改ページ(オーファン対策) parbreak() set text(size: 0pt) box(height: height)[] // needspace parbreak() // do not break here v(-height) v(-Leading) } set block(spacing: 0pt) set par(first-line-indent: 0pt) locate(loc => { let head = { if it.numbering != none { numbering-parser(it.numbering, counter(heading).at(loc)) h(cwd) } it.body } style(styles => { let size = measure(head, styles) let margin = (height - size.height) / 2 set par(leading: Leading) v(margin) box(height: height, inset: 0pt, outset: 0pt, fill: none, { head }) v(-margin) }) }) parbreak()// do not break here } // 目次 show outline: set par(first-line-indent: 0pt) show outline: it => { let setdefault(field, default) = { if it.has(field) { return it.at(field) } else { return default } } let title = setdefault("title", [目次]) let target = setdefault("target", heading.where(outlined: true)) let depth = setdefault("depth", none) let indent = setdefault("indent", true) let fill = setdefault("fill", repeat[.#h(0.5em)]) let pnumwidth = 2 * cwd let lnumwidth = 4 * cwd set par(first-line-indent: 0pt) heading(level:1, outlined: false, title, numbering: none) locate(loc => { for elem in query(target, loc) { if depth != none and "level" in elem.keys() and depth < elem.level { continue } box(width: 100% - pnumwidth, fill) h(-(100%-pnumwidth)) link(elem.location(), { box(fill: white, { box(width: lnumwidth, { if indent { h(cwd * (elem.level - 1)) } numbering-parser(elem.numbering, counter(heading).at(elem.location())) h(1fr) }) elem.body h(1em) }) h(1fr) [#elem.location().page()] }) parbreak() } }) } // リスト let zerobox(width, alignment: right, body) = { box(width: 0pt, {h(-100pt); h(1fr); box(width: width, align(alignment, body))}) } set list( marker: ( zerobox(cwd, alignment: center, [• ]), zerobox(cwd, alignment: center, [--]), zerobox(cwd, alignment: center, [∗]), zerobox(0pt, [・]), ), body-indent: 0pt, indent: 2 * cwd, ) let enum-numbering(..nums) = { let nums = nums.pos().enumerate() box(width: 0pt, { h(-1000pt); h(1fr) let (index, value) = nums.last() if index == 0 { numbering("1.", value) } else if index == 1 { numbering("(a)", value) } else if index == 2 { numbering("i.", value) } else { numbering("A.", value) } h(0.5 * cwd) }) } set enum( numbering: enum-numbering, full: true, body-indent: 0pt, indent: 2 * cwd, ) set terms( indent: 0pt, hanging-indent: 2 * cwd, separator: h(cwd), ) show terms: set par(first-line-indent: 0pt) let dummypar(it) = { it parbreak() set text(0pt) box[] parbreak() v(-Leading) } show list: dummypar show enum: dummypar show terms: dummypar // raw show raw: set text( size: size * 0.8, top-edge: cht, bottom-edge: cdp, ) set text( top-edge: cht, bottom-edge: cdp, ) let headfont(body) = { set text(weight: 800) body } show emph: it => { strong(it.body) } // 日本語化 set figure(kind: "図", supplement: "図") set outline(title: "目次") set heading(supplement: "") // これが一番マシ show ref: it => { if not simpleref { return it } else { locate(loc => { let elem = query(it.target, loc).first() let func(elem) = { if elem.has("counter") { return elem.counter } else { return counter(elem.func()) } } let count = func(elem) link(it.target, numbering-parser(elem.numbering, count.at(elem.location()))) }) } } inner-state.update(s => { s.insert("tate", otypjp-tate) s }) parbreak() show block: it => { linebreak() it.body linebreak() } if title != none { let maketitle = { align(center, text(1.7 * Cwd, title)) if author != none { align(center, text(1.1 * Cwd, author)) } if date != none { align(center, text(1.1 * Cwd, date)) } if abstract != none { v(0.5 * Cwd) align(center, { headfont("概要") v(0.25 * Cwd) parbreak() box(width: calc.round(0.8 * textwidth / Cwd) * Cwd, { box[] parbreak() v(-Leading) set align(left) abstract }) }) } v(0.5 * Cwd) parbreak() } set block(spacing: normalleading) set par(leading: normalleading) style(styles => { let height = measure(maketitle, styles).height let margin = (calc.ceil((height - Cwd) / (Cwd+Leading)) * (Cwd+Leading) + Cwd) - height box(height: height, width: 100%, place(center, maketitle)) parbreak() v(margin) v(-normalleading) v(-cdp) }) } set block(spacing: leading) columns( columns-number, { { set text(size: 0pt) box[] } parbreak() set block(spacing: normalleading) set par(leading: normalleading) doc }, ) }
https://github.com/nhuongmh/nhuongmh.cv
https://raw.githubusercontent.com/nhuongmh/nhuongmh.cv/main/data.typ
typst
Do What The F*ck You Want To Public License
#import "template.typ": * #let name = "<NAME>" #let email = [ #icon("email.svg") <EMAIL> ] #let phone = [ #icon("phone.svg") (+84) 981683925 ] #let home = [ #icon("home.svg") #link("https://nhuongmh.github.io/portfolio")[ https://nhuongmh.github.io/portfolio ] ] #let github = [ #icon("github.svg") #link("https://github.com/nhuongmh")[ github.com/nhuongmh ] ] #let linkin = [ #icon("linkedin.svg") #link("https://www.linkedin.com/in/nhuongmh/")[ nhuongmh ] ] #let location = [ #icon("location.svg") HCMC, Vietnam ] #let author = ( name: name, email: email, phone: phone, home: home, github: github, linkin: linkin, location: location, ) #let selftitle = [ Summary ] #let self = [ Software engineer with good knowledge in hardware, experienced in designing and developing multiple web projects. Currently focused on backend technologies, especially distributed and high-performance microservice applications. ] #let edutitle = [ Education ] #let edu = [ #datedsubsection( align(left)[ *Electronics & Telecommunications Engineering* \ _BEng_ ], align(right)[ Ho Chi Minh University of Technology \ 2014 - 2018 ] ) // GPA: 7.5/10 ] #let techtitle = [ Technical Skills ] #let tech = [ - *Languages*: Golang, Java, Python, C, C++, Shell/Bash Script - *Frameworks & Tools*: Gin, Spring/Spring Boot - *Database*: MySQL, SQLite3, PostgreSQL, MongoDB - *Others*: Low level hardware/software knowledge, GNU Linux Kernel, Docker - *English*: TOEIC Certificate 780 (Jun 2018) ] #let projecttitle = [ Technical Experience ] #let projectexperience = [ #datedsubsection( align(left)[ = Ampere Computing \ Senior Software Engineer ], align(right)[ Dec, 2018 - _present_ \ HCMC, VN ] ) _Responsible for building test infrastructure through multiple projects to support testing ARM64-based server systems_ - *Platform Validation Test Tool* - Microservices project to manage server system under test (SUTs), launching agents to connect and perform testing on SUTs - Stack: Java Spring Boot, Golang, VueJS, Websocket, MySQL, Bash/Powershell, Python, Docker, Apache ActiveMQ - Designed framework architecture, implemented and maintained core features - Continuously optimizing framework to help it scale horizontally as number of SUTs increased - Build up CI/CD pipelines to automatically build and test for changes, generate package releases for customers. (Uses Gitlab CI, Earthly, Docker) - Take part in resolve open sources libraries and 3rd parties components licenses in order to ship package to customers - Gain knowledge on server systems hardware and software, debugs issue on Linux - *Virtual Systems Managing System* - Web applications to generate and manage virtual systems for testing; each virtual system can mimic behavior of real system through consoles based on user configuration - Stack: Go with Gin, VueJS with Vuetify, MongoDB - Designed framework and was the main developer of the project - Used this tool to collaborate and help internal teams boost up development/testing progress - *Test Data Analytics* - Web application to collect and analyze all past test data, virtualizing results on a dashboard for monitoring - Stack: Elastic Search, Apache Airflow, Grafana - Developed tools to collect test data, setup Apache Airflow to schedule and monitor overall workflows #datedsubsection( align(left)[ = Arrive Technologies \ Logic Design Engineer ], align(right)[ Jun, 2018 - Dec, 2018 \ HCMC, VN ] ) - Joined design and implementation logic circuit targeted in telecommunication application (SONET/SDH) using Verilog - Implemented firmware for telecommunication chips on FPGA-based embedded processors using C++ ] #let projects_section_title = [ Projects ] #let projects = [ #datedsubsection( align(left)[ *Platform Validation Tool (Ampere)* \ Framework Developer ], align(right)[ 2019 - _present_ ] ) - Platform Validation Tools is an application to do various type of testing on server boards that using Ampere chip, it has desktop GUI and Web interface - I reponsible for developing testing framework, running flow, web backend and various other features - Tech: Java Spring Boot, Java Swing, VueJS, Linux, Hardware, JavaScript, Websocket, Bash/Powershell script, Python #datedsubsection( align(left)[ *Virtual Board System (Ampere)*\ Main Developer ], align(right)[ 2023 - _present_ ] ) - Virtual Board System is a simple web-app that serve multiple virtual boards, it can mimic behaviour of a real system consoles based on user configuration. It used to do coverage testing for internal tool - Tech: Golang with Gin, VueJS with Vuetify #datedsubsection( align(left)[ *Configuration Check Tool (Ampere)* \ Main Developer ], align(right)[ 2022 - _present_ ] ) - This tool is used to do configuration check between 2 systems or between a system with reference config. It's mainly for customer debug purposes - Tech: Golang CLI, Cobra, Hardware, ARM-based architecture, ... ] #let hobbiestitle = [ Hobbies and Interests ] #let hobbies = [ #lorem(32) - *#lorem(4)*: #lorem(4) - *#lorem(4)*: #lorem(8) ] #let hobbieszh = hobbies