repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/onefact/letterhead-template
https://raw.githubusercontent.com/onefact/letterhead-template/main/onefact.org-letterhead-template.typ
typst
Apache License 2.0
// This function gets your whole document as its `body` // and formats it as a simple letter. #let letter( // The letter's sender, which is display at the top of the page. sender: none, // The letter's recipient, which is displayed close to the top. recipient: none, // The date, displayed to the right. date: none, // The subject line. subject: none, // The name with which the letter closes. name: none, // The letter's content. body ) = { // Configure page and text properties. set page(margin: (top: 2cm)) set text(font: "Fairfax HD") // Display sender at top of page. If there's no sender // add some hidden text to keep the same spacing. text(9pt, if sender == none { hide("a") } else { sender }) v(1.8cm) // Display recipient. recipient v(0.5cm) // Display date. If there's no date add some hidden // text to keep the same spacing. align(right, if date != none { date } else { hide("a") }) v(2cm) // Add the subject line, if any. if subject != none { pad(right: 10%, strong(subject)) } // Add body and name. body v(1.25cm) name }
https://github.com/lublak/typst-spreet-package
https://raw.githubusercontent.com/lublak/typst-spreet-package/main/README.md
markdown
MIT License
# Spreet Spreet is a spreadsheet decoder for typst (excel/opendocument spreadsheets). The spreadsheet will be read and parsed into a dictonary of 2-dimensional array of strings: Each workbook in the spreadsheet is mapped as an entry in the dictonary. Each row of the workbook is represented as an array of strings, and all rows are summarised in a single array. ## Example ```typst #import "@preview/spreet:0.1.0" #let excel_data = spreet.file-decode("excel.xlsx") #let opendocument_data = spreet.file-decode("opendocument.ods") #let excel_data_from_bytes = spreet.decode(read("excel.xlsx", encoding: none)) #let opendocument_data_from_bytes = spreet.decode(read("opendocument.ods", encoding: none)) /** excel_data or opendocument_data contains a dict of all worksheets ( Worksheet1: ( (Row1_Column1, Row1_Column2), (Row2_Column1, Row2_Column2), ), Worksheet2: ( (Row1_Column1, Row1_Column2), (Row2_Column1, Row2_Column2), ) ) **/ ```
https://github.com/juanppalacios/typst-gvsu-egr
https://raw.githubusercontent.com/juanppalacios/typst-gvsu-egr/main/main.typ
typst
// features added from typst's IEEE template #import "template.typ": thesis #show: doc => thesis( title: [ A Working Thesis Title ], authors: ( ( name: "<NAME>", affiliation: "Grand Valley State University", college: "Padnos College of Engineering", degree: "Master of Science in Engineering", date: "August 2024", email: "<EMAIL>", ), ), acknowledgements: lorem(100), abstract: lorem(150), bibliography-file: "references.bib", doc, ) = Introduction #lorem(50) == Motivation #lorem(50) == Problem Statement #lorem(50) #figure( image("image.png", width: 20%), caption: [A nice figure!], ) = Related Work #lorem(50) #figure( table( columns: 4, [t], [1], [2], [3], [y], [0.3], [0.7], [0.5], ), caption: [Experiment results], ) = Conclusion #lorem(50) Example citation here @IEEEhowto:IEEEtranpage. Example citation there @IEEEexample:shellCTANpage. // = Appendix A
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/casoslov/casy/cas1.typ
typst
#import "/style.typ": * #import "/SK/texts.typ": * #import "../styleCasoslov.typ": * = Prvý čas #show: rest => columns(2, rest) #nacaloBezKnaza #zalm(5) #zalm(89) #zalm(100) #si #lettrine("Aleluja, aleluja, aleluja, sláva tebe, Bože.") #note[(3x)] #lettrine("Pane, zmiluj sa.") #note[(3x)] == Tropáre #note[Berieme tropár, prípadne tropáre podľa predpisu] #primText[I teraz: (Bohorodičník)] #lettrine("Ako ťa nazveme, Milostiplná? * Nebom, lebo z teba zažiarilo Slnko spravodlivosti. * Rajom, lebo z teba vyrástol kvet neporušiteľnosti. * Pannou, lebo si zostala neporušená. * Čistou Matkou, lebo si mala vo svojom svätom náručí Syna, Boha všetkých. * Jeho pros za spásu našich duší.") #zoznam(( "Riaď moje kroky podľa tvojho výroku; * nech ma neovláda nijaká neprávosť. * Chráň ma pred ohováračmi * a budem zachovávať tvoje príkazy.", "Vyjasni tvár nad svojím služobníkom * a nauč ma svojim ustanoveniam.", "Nech sa mi ústa naplnia tvojou oslavou * a nech ťa velebím deň čo deň." )) #trojsvatePoOtcenas == Kondák #note[Berieme kondák podľa predpisu] #lettrine("Pane, zmiluj sa.") #primText([40x]) #vKazdomCase #ektenia(3) #lettrine("Čestnejšia si ako cherubíni * a neporovnateľne slávnejšia ako serafíni, * bez porušenia si porodila Boha Slovo, * opravdivá Bohorodička, velebíme ťa.") Pane Ježišu Kriste, Bože náš, pre modlitby našich svätých otcov zmiluj sa nad nami. #prepustenieMaleBezKnaza
https://github.com/kiwiyou/algorithm-lecture
https://raw.githubusercontent.com/kiwiyou/algorithm-lecture/main/slide.typ
typst
#let style(body) = { set page(paper: "presentation-16-9", margin: 2em) set text(size: 25pt, font: "Pretendard", lang: "ko") set footnote(numbering: "1)") body } #let slide(title, body) = { set page(header: [= #title], margin: (top: 4em)) body } #let problem(id, title) = link("https://www.acmicpc.net/problem/" + id)[#id #title] #let link(body) = text(fill: blue)[#underline(stroke: blue)[#body]] #let footnote(body) = text(size: 0.7em, body) #let algorithm(caption, body) = text(size: 15pt)[ #figure(body, caption: caption, kind: "algorithm", supplement: body => strong[알고리즘]) ]
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/024%20-%20Shadows%20over%20Innistrad/004_Sacrifice.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Sacrifice", set_name: "Shadows Over Innistrad", story_date: datetime(day: 23, month: 03, year: 2016), author: "<NAME>", doc ) #emph[Dark and deep, Lake Zhava lies in the highlands of Nephalia, near the border with Gavony. Villagers who live on the lake's shores and fish its waters have long spoken of a monster living in its depths. But despite the villagers' pleas, the church of Avacyn has sent no cathar or angel to protect them. As the madness in Innistrad grows, how will the villagers face the horrors of the lake?] #figure(image("004_Sacrifice/01.png", height: 40%), caption: [], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Mia didn't believe in the old horror stories. Not because she didn't believe in horrors. Quite the opposite. She believed in many things that even most adults would consider too horrible to think about. Spirits that haunted the living. Reanimated corpses, stitched together by madmen. Werewolves, feral and ravenous. Vampires who viewed villages as nothing more than a selection of choice morsels. She believed in these things, things that were not #emph[polite] to speak of—as if not speaking of them would keep them from being real. No, there were too many horrors in the world, horrors the village elders feared to name, for her to give much credence to town gossip, vague in details and heavy in hysteria. Wilbur had quite a different opinion. "It is #emph[too] real," he insisted, pounding his fist on the grass. "Veryl said he saw it once—just a glimpse, but it was as wide as his ship." Mia rolled her eyes. "Veryl also once claimed he kissed an angel," she said. "How long have we heard tales of the Gitrog? And how many credible people have seen it? Aren't we a little old to believe such nonsense?" Wilbur stood up, shaking his head. "This isn't some dumb story. You don't go out on Lake Zhava every day, Mia. You don't see what I do. Especially lately. The unnatural fog. The lingering chill. There's more than fish in those depths." "Is that your expert opinion as a fisherman? A fisherman who has turned fifteen and still isn't allowed to sail on his own yet?" Wilbur blushed. "This has nothing to do with that, Mia! I'm being serious, and you're being a jerk." Mia shrugged as she walked toward her flock. A few had straggled farther afield than she liked. "There's no sense in being afraid of the dark, Wil. What you should be fearing is what's #emph[in] the dark." Wilbur scowled, chasing after her. "What is that, another quote from your brilliant father?" Mia didn't take the bait, but Wilbur pressed on anyway. "Famed slayer, traveling the land as a noble agent of the Skiltfolk, but too busy to deal with monsters back home?" "Too busy to deal with the whining delusions of small-minded townsfolk!" Mia whipped around, brandishing her crook. "Look around, Wilbur. None of this matters. This village doesn't matter. #emph[We] don't matter. This stupid little hamlet isn't even #emph[big ] enough for real terrors to haunt it! We're just a no-name nowhere mountain town slowly driving itself to madness through runaway imaginations." #figure(image("004_Sacrifice/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) She turned, looked out at her flock, and sighed. One sheep had wandered far from the group. The little bell around its neck jangled faintly as it continued its adventure up the stony hillside. She started after it. "Is that what your father told you when he left you behind? That you don't matter?" Mia stopped in her tracks. She shot Wilbur an angry glare. Wilbur, to his credit, looked slightly green and like he was trying to swallow the words that just flew out of his mouth. Mia scowled. "You didn't mean that." "...Maybe I did—" "We both know I can take you in a fight. You #emph[didn't] mean that." She turned away before Wilbur could answer and whirled the crook above her head, breaking into a light run. A short jog, a few sharp commands, and one crook under a stubborn sheep's chin later, she had herded most of her flock toward the field. She glanced back to see if Wilbur had run home. To her surprise, he still stood there, looking dumb and lost. "I didn't mean that!" he shouted across the field. Mia sighed, a smile sneaking across her face. "I know." Mia let out a sharp whistle, herding her sheep onto the path back home. Wilbur hurried across the field to catch up. "And it's not because you could take me in a fight. I mean, you could. But that's not why." Wilbur fell into stride next to her. Mia laughed. "I know, Wil. That's why I like you." The two walked on, the comfortable silence between them broken by occasional bleats from sheep. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Later that week, Mia awoke to a cold, gray dawn and found a section of her sheep pen broken. A quick count showed that one sheep was missing. She spent the morning searching to no avail. A rambunctious sheep probably broke out of the pen, as they were wont to do from time to time, and wandered off to get eaten by wolves in the woods. Mia cursed her luck and mended the fence, thinking nothing more of it. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Mia walked through the market, picking at the meager wares. The village's marketplace had never been thriving, but last season's poor crops and the decrease in caravans coming through the mountain pass made the options even more sparse than usual. Even the selection of fish seemed paltry, with the best offering being a sad sack of unimpressive cod. "Poor haul this week, Lehren?" Mia nodded to the old fisherman. Lehren shook his head, letting out a sigh. "Haven't spent much time on the waters. Fog's heavier than usual. Dangerous." "It's dangerous all right," croaked a voice. "And not just due to fog. Wise fishermen are staying off the lake." #figure(image("004_Sacrifice/03.jpg", width: 100%), caption: [Art by John Stanko], supplement: none, numbering: none) Mia looked at the speaker and rolled her eyes. "If all the fishermen were as wise as you, Veryl, they'd all have starved to death by now." "The wise know that the Gitrog rises again!" pressed Veryl, a sneer sneaking into his voice. "Only a fool would fish the lake." "I've never met a fisherman so afraid of the lake, or so eager to blame his poor skills on imaginary beasts." Mia picked out the fattest cod from Lehren's haul, making a show of handing him extra coin as she did so. "Watch what you call imaginary, girl," a deep voice rumbled. Mia turned to face the speaker and stopped, surprised. Kalim, barrel-chested and towering above the rest of the merchants, looked stern as ever. Thick brows, a thick, dark beard, thick arms sculpted from hauling nets—the only slender thing on his body was the curved fishing knife on his belt. "The Gitrog is real. Surely a slayer's daughter knows better than to doubt the monsters of the world." Mia noticed several other merchants and shoppers leaning in to listen or sneaking furtive glances. She gritted her teeth. "A slayer's daughter knows to first rule out all other possibilities before crying 'monster' like a frightened child." Veryl sidled up behind Kalim, greasy blond hair flopping across his eyes. "Rude words from a shepherd girl. Talking like #emph[you] are the slayer." "I'm more of a slayer than you are a fisherman, Veryl." As much as she wanted to knock the smugness (and just a #emph[few ] teeth) from Veryl's face, she knew better than to throw a punch with Kalim watching. She turned her attention to him. "Surely #emph[you] of all people do not believe Veryl's tall tales about actually #emph[seeing] the Gitrog, Elder Kalim." "I believe. For I #emph[have] seen it." The marketplace fell silent, and Mia lost all decorum as she stared at Kalim. Veryl started to say something, but Kalim put his hand across Veryl's chest, shushing the lad, and turned to address the whole marketplace. "The Elders convened last night, and we decree that fishing on the lake is suspended until further notice. We will post the announcement in the square this afternoon." He held up his hand against the groans and alarmed shouts. "The safety of the village comes first. I...I have also written to the Church of Avacyn for help." His gaze fell back on Mia. "Perhaps you could write your father as well." A hushed silence fell over the crowd. Mia's pulse quickened as she met Kalim's gaze. Beneath the calm and commanding exterior, she saw it—terror, deep and rumbling, a flooding undercurrent in his otherwise resolute stare. She swallowed, a feeling of dread creeping up and clenching her throat. "Father, I finally found some coriander!" Mia and Kalim turned as Wilbur came running down the market street. He waved the leafy greens, a stupid grin plastered on his face—until he tripped and went sprawling across the cobblestones. Mia let out a nervous laugh, exhaling—only then realizing she had been holding her breath. Around her, onlookers resumed their previous activities, some laughing at Wilbur, many whispering and murmuring, all dispersing, the tension of the moment broken. Kalim took the coriander and ruffled Wilbur's hair. Wilbur looked around sheepishly until he caught Mia's eye. His face went from goofy embarrassment to serious in an instant, his brow furrowing. #emph[You okay] ? he mouthed. Mia blinked, surprised, and shrugged. She started to speak, but Wilbur had already turned to Kalim, chattering and leading him from the marketplace, away from her. She stood alone, awash in a whirlpool of emotions, thoughts, and questions. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "He asked you to write your father?" Wilbur stared, incredulous. Mia nodded, stirring slowly. "But...he hates your father." "Trust me. I haven't forgotten." Mia tasted the soup, then offered the spoon to Wilbur. He sipped, made a face, and reached over to throw another pinch of salt into the pot. The two huddled in Mia's cabin near her small hearth. The flickering flame cast a warm glow over the room as the woodsmoke mixed with the savory smell of mutton stew. Mia carefully pulled the pot off the fire and set it down on a nearby table while Wilbur retrieved a fresh loaf of bread from his pack. Mia slumped into a chair and drew a knife from her hip, slicing the bread. Wilbur frowned. "Tell me you've cleaned that since using it to cut rope in the sheep pen this morning. Or since cutting mutton for the stew. Or since cutting your hair three months ago." Mia scowled. "It's my best knife. Multifunctional." Wilbur shrugged, grabbed bowls from the nearby shelf, and sat down to spoon out generous portions of stew. "Do you even know how to reach him?" Mia looked up, confused. "Your father, that is." "I know the branch of Skiltfolk in Drunau where he is based," Mia answered, sheathing her knife. She dipped the bread into the stew and took a bite, marveling at how it always seemed to taste better when Wilbur helped make it. "Has he ever written back?" Wilbur watched Mia intently, ignoring his stew. "I have never written him." "How could—" "I did not want to trouble him with trivial matters." Mia ate another spoonful and gestured to Wilbur's stew. Wilbur grumbled, then took a bite. "Are you going to write him now?" Mia continued eating, trying not to grind her teeth. Wilbur didn't seem to notice. "Do you think he'd come? Maybe bring others? I mean, I don't think even he could take on the Gitrog without help—" "I don't know!" Mia slammed her fist on the table, cutting him off. "I don't even know if I'll write to him." "But—I mean, this is what he does, right? Slay monsters?" #figure(image("004_Sacrifice/04.jpg", width: 100%), caption: [Midnight Guard | Art by <NAME>. Engle], supplement: none, numbering: none) Mia stood, throwing her hands in the air in exasperation. "We still don't know if there #emph[is] a monster!" Wilbur gaped at Mia, dumbfounded. "You still don't believe?" "I still don't #emph[know] for certain. It's all anecdotal evidence—" Now Wilbur stood, an edge of anger sharpening his voice. "My father has seen it! Veryl has seen it! Mia, I don't know why you refuse to—" "Veryl is still an idiot, and your father is—your father." Mia looked into Wilbur's eyes. The two stood across the table, faces flushed and tempers raised. Even in that heated moment, Mia couldn't help but notice she and Wilbur stood eye to eye. Just that summer she had stood taller than him by a palm. "My father is what, Mia?" "An Elder. It's his job to err on the side of caution," Mia backpedaled. "He said he saw it. He's not issuing decrees because he's cautious. He saw it." "Unless he didn't." Mia sat down and started eating Wilbur's stew. "Are you calling my father a liar?" The pain in Wilbur's voice cut far deeper than the angry shouting moments ago. "People make mistakes. See things in the fog. They always have. A slayer must distinguish—" Wilbur groaned. "Stop talking like that, Mia! You're no slayer!" "And you're no fisherman!" Mia's eyes flashed angrily. Wilbur's brow scrunched in anger for a moment, then his face slowly cleared and he sighed. "None of us are. Fishermen, that is. Not until aid comes from the Church." Wilbur walked to the pot, grabbing Mia's empty bowl and scooping himself more stew. Mia frowned. Stupid Wil, can't even get angry long enough for a real fight. She shoveled stew into her mouth as Wilbur sat back down. The two ate in silence for a while, each lost in their own thoughts. "It's not just anecdotal." Mia looked up over her bowl at Wilbur, curious. Wilbur stared into his. "Boats destroyed. Property damaged. And recently, livestock going missing. Pa says we're lucky no #emph[person] has been hurt." Mia paused. Her missing sheep... Wilbur looked up. "Please, Mia. You have to believe. Or at least, pretend to. Just...be safe? I—I don't want you to get hurt." Mia hesitated. Wilbur looked at her with the same seriousness as that moment in the market, a seriousness that looked strange on a face so familiar. It made him seem older. It made her feel...she couldn't figure out how it made her feel, so she looked away. "You're right," she sighed. "I'm not saying I'm convinced," she interjected, catching Wilbur's excitement out of the corner of her eye. "But there's enough reason for doubt. There's the possibility. And the moment we move from improbable to possible, we must stand watch. Now, vigilance and diligence is demanded—if you're on watch, no noise is harmless and no shadow can be ignored." #figure(image("004_Sacrifice/05.jpg", width: 100%), caption: [Mausoleum Guard | Art by <NAME>], supplement: none, numbering: none) "Why do you always talk like you're reciting some slayer handbook?" Wilbur rested his head against his hand, raising an eyebrow at Mia, a crooked grin sneaking onto his face. "I may not be a slayer yet, but I turn fifteen in just two months." Mia went over to the cabinet and began rummaging through it, partially to find something, and partially to avoid looking at Wilbur's stupid face. Stupid, dopey, kind, sweet face. "You're going to join the Skiltfolk?" Mia pushed aside some old parchment and books in the cabinet, still searching. "I'm going to try. I have no intention of tending sheep the rest of my life—aha!" Mia turned around, bringing a small case back to the table. Though simple, it looked sturdy—oak panels, iron reinforcement, a heavy lock on the front. Mia reached to the necklace hidden beneath her blouse, took the key, and unlocked the chest. "Oh wow." Wilbur's eyes grew wide as she pulled out a small crossbow, ornately dressed in silver. The craftsmanship was clear, even in the dim firelight. Holy runes lined both sides of its stock. Though it was slender and light, Mia felt its power as she cranked back its bowstring with a practiced hand. She took sight down its length, pointing it toward the front window, her finger lightly brushing the trigger. A heavy #emph[twang] rang out, dust flurrying in the flickering light, cast loose by the reverberating string. "Is that your father's?" "It's mine." Mia grinned. "You don't think Olgard, famed Skiltfolk shieldbearer, would stand for the embarrassment of a daughter who couldn't defend herself, did you?" "I know you can handle yourself. I just didn't know you knew how to shoot." Wilbur leaned back, admiring the weapon. "Why do you keep it locked up?" "Weapons heighten tension and danger, even if there's none present before." Mia took out the quiver of bolts, counting through them. "Only have your arms at ready when necessary. Only draw them when you must." #figure(image("004_Sacrifice/06.jpg", width: 100%), caption: [Wolfhunter's Quiver | Art by <NAME>], supplement: none, numbering: none) Wilbur shook his head, grinning. "I think, very soon, no one can tell you to stop speaking like you're a slayer." "I certainly hope so." Mia picked up the crossbow and quiver, walking to the small room in the rear to place it by her bed. When she returned, Wilbur had already cleared the bowls. He smiled at her. "Thanks, Mia. Even if you're just doing this for me." "Don't flatter yourself." Mia grinned at him, ignoring the fluttering feeling in her stomach. Wilbur stood. "You'll see. The Church will send help. Or, if you decide to write him, perhaps your father will come back. In the meantime, though, we'll do what we can to keep the Gitrog at bay." "If it exists." Mia couldn't help herself. Wilbur graciously ignored it. "I trust my father to do what he can to keep us safe." Wilbur looked at her again, serious again. "And I'll do what I can to keep us safe." Mia walked up to him, close, their noses inches apart. She then planted her palm on his face, giving it a light shove. Wilbur laughed in surprise, stumbling back a step. Mia rolled her eyes. "Get out of my house, Wil. Lest the Gitrog eat you as you walk home in the darkness." Wilbur grinned and gave her a little wave, turning and walking out the cabin. Mia walked to the door and watched him amble out of sight. Yeah. That was the correct way to react to his stupid face. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The joy of that evening didn't last long. Days turned to weeks, creeping by cold and dreary. As winter approached, the fog reached its gray tendrils farther and farther off Lake Zhava, creeping deeper into the village before the feeble sun would chase it back to the shore. On colder mornings, it even enshrouded Mia's cabin on the hill. Mia kept her crossbow by her bed at night, and carved time out to practice her aim. In all that time, no slayer from the Church came. Soon, the caravans stopped altogether, and more and more fishermen loitered around the marketplace, huddled together, grumbling and whispering. Mia broke down and wrote her father, scrapping a dozen drafts before settling on a brief and formal missive asking for aid. She received no reply. Shortly after, the postal rider stopped coming to town. Within two days, accounts of the Gitrog devouring the mail carrier transformed from rumor to story to fact. Mia thought the poor lad didn't want to make the cold and dangerous trek to a wretched little village. He probably chose to spend the winter in Drunau instead. However, there were many Gitrog rumors that Mia couldn't explain away. By first snowfall, three more sheep had gone missing. Each time, the fence was broken in a different spot—as though something was testing the strength of her pen. Or, as Mia reminded herself, spooked sheep pick random points to break fences. But what could be spooking them? The latest time, she had heard the fence snap in the night, but by the time she burst out of the cabin, crossbow in hand, there was nothing but broken wood and alarmed bleating. After that, she had finally given in and hired the local carpenter to help her reinforce the pen, dipping into the money her father had left her. Though she hated spending anything she hadn't earned herself, she knew she was fortunate to have this cache. The fishermen, banned from the lake early in the season, struggled as snowfall began. Many relied on the kindness of neighbors—but the poor soil of the village could only produce so much. Fights in the local tavern became more frequent. Cursing the Gitrog intensified. More and more townsfolk retreated to their homes earlier and earlier in the day, barring their doors and boarding up windows as the pervasive fog rolled in thicker and deeper than ever before. Through it all, it appeared that Wilbur was right when he promised his father would do something. As winter deepened, armed men and women began patrolling the streets, some wielding torches and blades, but many armed with only a pitchfork or meat cleaver. They always wore heavy cloaks with the hoods drawn up—to guard against the creeping chill, but also as uniforms. Mia wondered what a baker with a bread knife could do against the Gitrog. It gnawed at her until one afternoon, she made the mistake of asking Wilbur. #figure(image("004_Sacrifice/07.jpg", width: 100%), caption: [Sharpened Pitchfork | Art by <NAME>], supplement: none, numbering: none) "They're patrols. Extra eyes. You said it before yourself, Mia. 'Vigilance and diligence.' We watch, and sound the alarm if we see anything." Wilbur looked annoyed, his lanky figure dripping from the rain. "I just wonder if it's actually useful." Mia also wondered why Wilbur refused to take off his coat and boots. Or take a seat. Or smile. "I just wonder if you'll sell me the wool so I can go home." "You're not staying for dinner?" "Some of us have more than ourselves to take care of." Wilbur crossed his arms, and Mia wondered when he had grown taller than her. "What, do you have to walk around brandishing your fishing rod, protecting the people?" The words left her mouth as her heart begged her to shut up. "There are things I can't tell you. You see the surface of what we're doing to keep the village safe, to keep people alive, and all you can do is mock." The truth in his words dragged like sandpaper across her heart, leaving her bloody and raw. "Why are you still here, Mia?" Mia looked at his the stern line of his mouth, his furrowed brow, his eyes cold and questioning. Her stomach churned between anger and sadness, a bitterness rising in her throat. Wilbur pressed on. "Why haven't you left for the Skiltfolk headquarters to take your test and leave us behind like your father did?" "I am not my father. And I...I'm not fifteen yet." Wilbur laughed, and Mia's chest tightened. She had never heard that laugh from him—empty of joy, full of daggers. "You knew the snow would come before your birthday. You know the pass is nigh unpassable after the snowfall. If you really wanted to test, you would've left already." His words snapped, sharp and biting as the frigid air. "You're scared. Scared you're all memorized rules and bluster." Mia grabbed the bundle of wool and threw it at him. "Take it. Get out." Wilbur reached to the pouch at his belt, but Mia gave him a hard shove. "I said get out! Keep your father's coin. I don't want it." "You mean you don't need it." Mia bit her lip. It was her own fault he knew how to hurt her most. Wilbur turned with the wool under one arm and tossed the pouch behind him as he crossed her threshold. The coins bounced out and scattered, clattering against the floor. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Mia paused, sweating despite the cold. This was the third time today she'd had to change the water for her sheep, breaking through the ice that formed in the troughs. Between this and all her other errands and chores, she hardly had a moment to catch her breath. The sun was already sinking below the horizon, throwing a few last, feeble rays against a sky of iron clouds. The wind howled as she returned to her cabin, cutting through her coat, chilling her to the bone. #emph[At least it isn't snowing] , she thought. Two hours later, Mia watched the flurry of white slowly overtake the scenery through the window. Of course. What a perfect end to a cold and miserable birthday. #figure(image("004_Sacrifice/08.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) She had hoped to make it into the village. Hoped to find her way to Wilbur's house. They hadn't spoken since their fight, and the intervening time grew heavier every passing day, lending heft to the silence and breadth to the distance now separating them. Though she did not put much stock in them, she couldn't help hoping that her birthday would bring Wilbur visiting like he used to. She sighed, forehead on the glass, breath fogging. She didn't know when she had dozed off—just that something woke her some time later. She stretched. The fire had died down to soft orange embers, and outside, the faint glow of moonlit snow edged a silhouette of the landscape. The storm had broken crisp and clear, stars winking in the inky sky. All seemed so peaceful. What had woken her? Then she heard it again. A loud #emph[snap-crack!] rang outside the cabin. Mia sat up with a start, heart racing. She listened intently, peering out into the silvery semidarkness, senses on alert, mind racing. Nothing but silence. She took a deep breath and leaned back, head drifting sleepily back onto her arm. It was likely a frozen tree, bursting as its sap expanded in the cold. Nothing to worry about if there wasn't anything el— Suddenly, Mia was sprinting, grabbing her crossbow, throwing on her coat, and bursting outside, fear and dread clutching at her chest. It wasn't the sound that scared her. It was the silence that followed. No bleating of startled sheep. No jangling of bells. Even as she ran out into the snow, she could hear nothing. She held her crossbow at the ready, slowing to a brisk walk as she approached the pen. The sight that greeted her stopped her cold. An entire side of the pen was in tatters, the fence posts ripped clean from the ground. Broken planks littered the snow, and as she watched, one post cracked and the lean-to roof collapsed. Slowly, Mia crept closer, praying and hoping, even though she already knew. As she quietly crossed into the pen, her fears were confirmed. #figure(image("004_Sacrifice/09.jpg", width: 100%), caption: [To the Slaughter | Art by <NAME>], supplement: none, numbering: none) Not one sheep remained. Instead, blood and gore covered the ground and splattered the few planks still standing. Cold wind swept through the wreckage, and the pungent smell of viscera hit her. She doubled over, crossbow falling by her side as she inhaled through her coat sleeve, trying to calm her stomach. As she gathered herself, a strange shape in the snow caught her eye. She snapped erect, crossbow leveled, squinting at the...thing. She cursed herself for not bringing a torch, slowly moving aside, shifting her shadow away. The pale moonlight revealed a massive footprint in the fresh powder. She walked closer. The imprint looked like a large, webbed foot, with three talon-like divots at one end. As she looked across the pen, she saw several more prints, scattered among sweeping, dragging tracks and more pools of blood. #emph[The Gitrog.] Mia's pulse pounded in her ears as she gazed out. Leading away from the pen was a wide swath of drag marks and three-toed, webbed footprints pointing to the woods toward the lake. Her mind swam. The Gitrog was real! It had devoured her flock. Which also meant it roamed quite far from the lake. Which meant it probably had ventured into the village! She had to tell Wilbur. Had to apologize. Had to warn them! She began marching toward the faint lights in the distance, boots crunching through the snow, when a nagging voice in her mind stopped her. #emph[If a menace is confirmed as monster and not man, a slayer must track and isolate it if possible. Slay it away from townsfolk and cities—avoid the panic and mayhem of frightened innocents.] Mia stood, her breath flaring in front of her in pale puffs, torn on what to do. Surely there's no way she could handle something like the Gitrog. Not alerting the town seemed incredibly foolish. She needed to talk to Wilbur—Wilbur's father, rather. Kalim and the Elders would know what to do. But would they even help her? After all her doubts? Even if they wanted to help, what could they do? The image of bakers and farmers armed with bread knives and pitchforks flashed through her mind. If the Gitrog could devour her entire flock with hardly a sound... Mia looked down at the crossbow in her hand. The silver gleamed in the moonlight, and she ran her finger along the runes etched in the side. She reached to her hip and rested her hand on the hilt of the long dagger there. The familiar blade had seen more use as a utility knife, but its cold iron edge was crafted to slay spirits and witches. She had dreamed of becoming a slayer, following in her father's footsteps. But he left her here where it was "safe" and gave her a flock to keep her busy—keep her distracted. Her weapons gathered dust or became household tools, even as she tried to hone her skills on her own. Now, here she was—fifteen years old, with danger falling into her lap. She had played the role of shepherd too long, waiting for permission to become what she most wanted. Mia took a deep breath through her nose, the cold air sharpening her focus. This was it. Her first step toward becoming a slayer. A practical trial. Even if she couldn't take down the Gitrog, she would at least track it, learn more of its patterns, perhaps even catch sight of it before it slipped back into the lake—and then she could bring that information to Kalim, or her father and the Skiltfolk of Drunau. Mia shouldered her crossbow and followed the tracks methodically, her reckless, fear-driven pace slowing in the face of purpose. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) It didn't make any sense. She had followed the tracks carefully into the woods. They were easy to follow—the Gitrog did little to hide. However, the tracks vanished just a short span past the tree line. It did not make sense, unless the Gitrog could climb thin trees or burrow into ground frozen solid. Something that left footprints that big didn't just disappear. She doubled back, examining the tracks more closely, expanding her search to the surrounding area. That's when she found it—a fresh, human footprint some distance from where the Gitrog trail ended. At first, she feared someone had been caught. However, the faint, isolated print didn't suggest struggle. Something didn't add up. Mia again held her crossbow at the ready and spiraled out from the footprint looking for clues, ears sharp to any sound. Two spans from the footprint, a series of tracks and signs of dragging resumed—but they weren't Gitrog tracks. Human footprints intermingled with long furrows like sled marks, headed to the lake. Anger replaced fear. Mia walked faster, eyes darting between the tracks and her surroundings. Someone had gone to the trouble of faking an attack, of making false prints, then sweeping away their tracks. Someone wanted to make her look like a fool. Someone had slaughtered her flock. Someone was going to pay. The tracks led her almost straight to the lake. As she got closer, her pace slowed. Flickers of torchlight danced by the shore. She moved quickly from tree to tree, staying under cover. Soon, she was near enough to hear voices drift through the cold night air. The torches illuminated several figures, all wearing dark cloaks with hoods pulled up. From Mia's spot, she couldn't make out any faces—nor could she hear any words that were spoken. They stood in a circle, heads bowed, chanting something in a low drone. After a moment, they filed onto a nearby ship, a fair-sized fishing vessel. #emph[Lehren's ship] , Mia realized, heart dropping. What was going on? Mia watched as the hooded figures boarded. She ground her teeth, suppressing an angry shout, as she watched each stop to load their cargo—lamb carcasses lifted from a nearby sled. She nocked a bolt, about to demand an explanation, when a strange sight stopped her. One of the hooded figures stood on the boarding ramp, blocking the way. Even with the high ground, the one on the ramp seemed dwarfed by the figure before him, the latter casting an imposing shadow in the moonlight. The taller figure leaned forward and whispered something to the person on the ramp, then walked past. The two bumped shoulders, and the face of the figure on the ramp caught the moonlight. Mia stifled as gasp as Wilbur gave one last lingering gaze into the woods before turning to board. A million questions flashed through her mind—but she had no time for them as the ship began to pull away from the shore. Slinging her crossbow across her back, Mia sprinted, leaping to catch the boat as it pushed off into water, hanging on the small ladder on the stern. She was sure she would be seen, but peeking over the deck, she saw most of the hooded figures had moved to the bow, looking ahead. A few held torches and lanterns that illuminated the group feebly. Only one stood near her, and his eyes were glued to the horizon as he helmed the ship. Two more poled on either side, pushing hunks of ice away from the ship. Her feet dipped into the water as the ship bobbed, and she shifted up a rung—but she didn't dare move farther. As she clung to the ship, voices drifted back to her, familiar voices she had heard countless times. They talked about the weather and the icy conditions as though they were all just gossiping at the marketplace. If it weren't for the hooded cloaks and pile of dead lamb carcasses piled high at the center of the deck, Mia would've thought this were a casual outing onto the lake. The effect was dizzyingly surreal—a terrible dream come to life. She wasn't sure how long she held onto the side of that ship. The temperature dropped as they sailed farther onto the water, and the fog grew thicker. Just when she thought she couldn't hold on any longer, they lurched to a stop. Mia looked about—on all sides, gray mist obscured her sight. The water looked calm, a few jagged blocks of ice bobbing nearby. "We are here," announced a deep voice. Mia knew that voice, knew the face even before she looked over the deck, even before she saw Kalim pull down his hood and stand before the gathered assembly. "Brothers and sisters, tonight we bring sacrifice in the hopes that it brings peace. Tonight, we offer that which was unwillingly given, from a nonbeliever. Tonight we gift the Gitrog with the sheep of the slayer's daughter." #figure(image("004_Sacrifice/10.jpg", width: 100%), caption: [Welcome to the Fold | Art by <NAME>], supplement: none, numbering: none) Curses and dark muttering spread among the gathered hooded figures, but Mia had stopped listening at that point. She had pulled herself over the ledge of the boat and had the butt of her crossbow lined up with the back of what she was fairly certain was Lehren's head. #emph[Just one] #emph[quick, sharp blow] , she thought. The figure coughed a sad, wheezing cough. Mia grimaced. She couldn't hit a frail old man. #emph[A frail old man who helped half the village slaughter your entire flock.] She sighed. Lehren started to turn. #emph[Thud!] #emph[Wumpf.] Lehman dropped like a sack of potatoes. Mia immediately flipped her crossbow around, aiming it at the cluster of figures in hoods—just in time to watch them begin to throw the lamb carcasses overboard. "What the hell are you doing?!" The hooded figures turned to stare at her almost as one. Not one person spoke. Mia took an uneasy step back, lifting her crossbow higher. "You do not understand, child." Kalim broke the silence, striding forward. He sounded calm and quiet. She trained the crossbow on him, and Kalim halted. "You have a lot of explaining to do," she snarled, "and reparations to pay." "Your sheep are serving a greater purpose," Kalim said. Many hooded figures muttered in agreement, echoing Kalim's words. "What purpose is that?" She swung her crossbow to aim at a figure who had started inching toward her. The figure halted, and from beneath the hood, Veryl's face stared at her. She shivered a little, almost not recognizing him. His cheeks had taken on a gaunt look and his eyes flickered wildly from staring at her to gazing back to Kalim to looking off in seemingly random directions. "We must appease the Gitrog!" shouted one of the hooded figures. "The Gitrog!" echoed among the crowd. "There is no Gitrog! You destroyed my pen and slaughtered my herd!" A sudden realization dawned on her. "It was you all, wasn't it—killing my sheep, a few at a time, before tonight?" "They're the only thing that could stop it." Kalim again moved toward her, right hand now drifting towards his waist. Mia raised her crossbow again, but this time he continued at his glacial pace forward, forcing Mia slowly back. "The only thing that could satiate its hunger. The only thing that stopped it from coming for us." "You're mad. You're the only one who's seen it." Mia took another step back, her foot hitting the edge of the boat. "We have all seen it. Why do you think we're all here? We have seen the truth. We have gazed into its eyes. We know we cannot stop it. We can only feed it so it does not feed on us." Kalim was almost upon her now. Her eyes jumped to the other villagers in hoods. Familiar faces, twisted by shadows and the moonlight, gazed blankly back at her. She didn't want to shoot Kalim, but if he didn't stop...a sudden idea flickered in her head. "Show me, then." Kalim stopped, looking at her. Mia stood up straighter. "Show me your Gitrog." Kalim stared at her for a long time. Finally, he took a step back and waved his hand. The other villagers all rushed to the pile of sheep carcasses, carrying them to the bow of the boat and casting them into the water. One loud splash after another broke the stillness of the lake and the quiet of the night. Soon, all that remained was a bloody stain on the wooden deck. All the hooded figures stepped back from the edge. Mia kept her crossbow trained on Kalim, walking with her back to the edge of the boat until she could look off one side toward the bow. She saw an inky patch of water spread, the blood from the sheep staining the water. A few bubbles floated to the surface, then stillness resumed. A tense silence ticked by as everyone on the ship watched the placid waters. "Nothing," whispered Mia. "There's nothing there." She turned to the villagers on the boat. "Do you all see now? There's no such thing as the—" A sudden burst of water and roar of sound cut Mia's tirade short. The horrific sound of the crunching of bones rang out across the water, and hooded villagers scrambled and shoved their way toward the back of the boat. Mia pushed her way through the terrified crowd, rushing to the bow to see what happened. The water churned and roiled a short distance from the boat. Mia squinted her eyes in the moonlight, looking for what was out there. As the water settled, she saw it. The monster. The Gitrog. She scoffed. "That? That's it? That's the Gitrog?" She looked back at the villagers huddled on the other end of the boat. "It's...it's just a giant frog." Veryl ran up to her, pushing back his hood. He grabbed her shoulders before she could swing her crossbow up and shook her violently, a look of sheer terror in his eyes. #figure(image("004_Sacrifice/11.jpg", width: 100%), caption: [Art by David Gaillet], supplement: none, numbering: none) "You don't understand, Mia! If it isn't satisfied by the sheep, then we are all—" Mia never did get to find out what they all were. At that moment, Veryl went flying backward off the ship, screaming through the air, and disappeared with a splash into the water. Mia didn't understand what happened—until she saw the Gitrog open its mouth again and a dark shape lash out and fly at the ship. She dove for the deck as the thing whizzed overhead, striking the mast and knocking shards of wood clean off the boat. As villagers screamed and cried, Mia realized—that thing #emph[was its tongue] . Another loud crack boomed out as the Gitrog struck again, punching a chunk out of the mast this time. As the Gitrog pulled its tongue back, Mia sprang up from the deck and took aim with her crossbow. Just as she pulled the trigger, however, a sudden force hit her from behind and she fell back to the deck, hard. She turned around and saw a hooded figure clinging to her legs. "What are you doing!" she cried, squirming against his grasp. "You must not anger the Gitrog! We cannot bear its wrath!" The hood had flopped down in the struggle, and Mia saw the village baker clinging tighter to her legs, his voice squeaking as he shouted. "Too late for that," Mia grunted, pulling one leg loose. She kicked hard, hitting the baker square in the nose, her boot producing an audible crunch. The baker let go and Mia rolled away, scrambling to her feet. "The sheep no longer satisfy it!" She looked back to the cluster of hooded villagers crying out. "It wants more." "Feed it the girl!" "What did you just say?" She stared at the woman who shouted the last thing. It was the blacksmith's wife, Sarah, who had once baked her cookies for her birthday. "Kill her! A sacrifice to the Gitrog!" Sarah let out a chilling scream and rushed towards Mia, drawing a mean-looking knife. With a shout, several others followed suit, hoisting their makeshift weapons. Mia scrambled backward, loading a new bolt into her crossbow as the crazed villagers descended on her. Sarah slashed at Mia's face, coming closer with each swing, when another battering from the Gitrog's tongue swatted her and two others overboard. Screams rang out, cut short by sudden gurgles and muffled pleas for help. In the chaos, another pair of hands grasped her throat from behind, squeezing hard. Mia struck out blindly with an elbow. The grip loosened and she turned around and fired blindly into the stomach of her assailant. The man fell back, and Mia caught sight of familiar blue eyes—#emph[Kyle, the cobbler's apprentice] —just before another hooded figure charged her, his hood down—#emph[Terrance, Veryl's younger brother] . Mia reached for another bolt, but he was on her, an actual sword in hand, swinging wildly. Mia stumbled back and fell, the tip of the sword grazing her shoulder and drawing blood. Terrance drew back for a killing stroke—and was knocked across the back of the head by another hooded figure wielding a club. As Terrance slumped to the deck, Mia finally loaded a bolt. She leveled the crossbow to the club-wielding figure's face, finger on the trigger. "Wait! Mia, it's me!" The figure threw back his hood, and Mia cried out. "Wilbur! What is—" "I'm so sorry. Everything got out of hand. We were just trying to keep the village safe, but when they started stealing your sheep—" Another loud crash resounded behind them as the Gitrog's tongue swung by. "So you've seen it before this?" Wilbur shook his head. "Only bubbles." A burst of splinters rained down on the pair. They looked up—just in time to see the Gitrog's tongue retract, leaving a massive hole in the mast. With a slow, creaking groan, the mast wobbled, leaned, and finally snapped and toppled over, smashing against the side of the boat and into the water. "Tell me more later." Mia grabbed his hand, fired the crossbow at another villager charging toward them with a pitchfork—#emph[Verna, flower girl] —and ran for the aft of the boat. "Where are we going?" Wilbur shouted. "I—I don't know!" Mia looked out at the chaos surrounding her. With each swing of the Gitrog's tongue, more villagers were knocked into the water or grabbed and swallowed whole. Some just cowered in the boat, trying to hide. A few had dived into the water and were now trying to swim away. Mia considered jumping overboard as well—until she saw one swimmer (#emph[Elder Ethan's son] ) disappear beneath the water, leaving nothing but a trail of bubbles in his wake. #figure(image("004_Sacrifice/12.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) "There's nowhere to run." Mia and Wilbur spun around, looking at the speaker. Kalim stood before them, his gaze locked onto Mia. "Dad! What do we do? This...this is insanity!" Wilbur still held tightly onto Mia's hand, and even in all the mayhem, Mia could feel his pulse throbbing through his fingers. "Your dad's right," Mia said, looking at Wilbur with sudden clarity. "We can't outrun it. We have to try to kill it." Mia let go of Wilbur's hand and raised her crossbow, drawing one of her bolts as she looked back to Kalim. "That's our only hope now." To her surprise, Kalim laughed. "You are a fool. You cannot kill the Gitrog. There is only one thing to do." Kalim's eyes narrowed. "Sacrifice." Kalim lunged forward, fishing knife suddenly drawn and in his hand, swinging straight for Mia's throat. Mia stumbled back, surprised, falling to the deck and barely dodging the assault. She scrambled back as Kalim flipped the knife in his hand into an icepick grip and drove it down toward her. Mia rolled out of the way of a second strike and fired her crossbow wildly. The bolt lodged into Kalim's shoulder on a lucky shot—but he seemed not to notice, slashing again at Mia's face—just as Wilbur tackled Kalim to the ground. Mia loaded a new bolt and aimed it at the two struggling on the deck, unable to get a clean shot. Just then, the ship lurched to port with a sudden thud. All three turned to look at the source of the sound. Immediately, Kalim and Wilbur pushed off each other, scrambling to stand while Mia swung her crossbow around, backing up as fast as she could. The Gitrog lumbered forward onto the ship, its webbed limbs heaving its body over the side of the boat and plopping wetly on the deck. Kalim, Wilbur, and Mia stood frozen and staring. The Gitrog gazed back at them with blank, dead eyes. With lightning speed, Kalim reached out and grabbed Mia, flicking the knife against her throat and holding her body to him in a bear grip. "Oh great Gitrog! I offer this girl in sacrifice to you! Eat, and forgive this village of its sins, and slumber so we may live in peace!" #emph[He's mad. ] Mia pushed against his hands, but Kalim's grip was too strong. Wilbur was shouting something, but all Mia could see was Kalim raising his hand, the dagger flashing in the torchlight. #emph[Thwap! ] The Gitrog's tongue suddenly lashed out and smashed straight into Kalim's face. The dagger flew out of his hand in surprise as he let go of Mia, both hands grabbing onto the tongue. The Gitrog pulled, and Mia was knocked into the ground as Kalim flew forward, his yells muted by the monstrous tongue wrapping around his head. Mia scrambled up, letting loose one, two, three bolts into the Gitrog as it dragged Kalim along the ground. The beast didn't even flinch as the bolts were buried into its flesh, drawing its tongue slowly back. Mia watched in horror as Kalim's head disappeared into its gullet, watched as his feet kicked desperately once, twice, then no more as the Gitrog's maw closed down. Another swallow, and Kalim's feet disappeared as well. Mia was vaguely aware that Wilbur was shouting as she turned to again grab his hand. She tossed her crossbow down as she ran to the aft of the boat, stopping only to knock over a torch onto the deck. As flames bloomed, she saw the Gitrog slowly waddle toward them, stopping to devour the villagers huddling behind barrels. She watched as it scooped up the unconscious form of Lehren. She watched as it lethargically plodded through the flames, coming slowly their way. Only then did Mia snap back to herself. She turned forward and without a pause dove into the icy water, dragging Wilbur with her. The two swam hard, pushed beyond endurance by terror and adrenaline. Slowly, the boat became nothing but a bright ember fading in the fog. The two swam, the freezing water a thousand needles stabbing into skin, toes and fingers falling numb, then hands, then bodies as they flailed back toward the shore. Mia was certain the Gitrog would find them at any moment, would drag them under, would swallow them whole. Somehow, they made it back onto land. The two crawled from the water. Wilbur flopped down, face-first in the pebbles, shivering. Mia forced herself to sit and tried to think. They needed to make it back to her cabin. Back to warmth. Otherwise the cold would kill them before the Gitrog could. Then, the moment they were dry and warm...they would leave. Flee the village. Leave it all behind. Run anywhere else. Face down a thousand vampires, or werewolves, or ghouls. Anywhere without the Gitrog. A wet #emph[plop] sounded from behind Mia. She sat, frozen. Another #emph[plop] . She needed to stand. Needed to see. Needed to run. But she could do none of those things. Another #emph[plop] , and suddenly Wilbur was dragging her to her feet, pulling her away. The two didn't make it far before they collapsed on the stones. Mia's muscles screamed. The adrenaline had worn away, leaving nothing but stiff bodies locked with terror. Slowly, she rolled over. The Gitrog loomed over her, its girth taking up all her vision. It gazed down at her, its eyes two black, fathomless pits, empty of emotion, empty of thought. Mia stared into its eyes and saw...nothing. Wilbur was pulling her to her feet again, yelling something about running, but Mia couldn't hear him. A low drone echoed in her skull, growing in volume, as she fell into the endless hole of the Gitrog's gaze. She fell, tumbling through oozing shadows, fell through the crevices of her mind, collapsed through the membranes into the spongy slime of delirium, cocooned by a strange warmth seeping into her bones and chasing away the pesky cold of doubt and fear and uncertainty. She knew, knew everything now. She saw truth in its blackest form, the clarity of a thousand lifetimes compressed into one moment. She turned to Wilbur, who was still tugging at her arm. She saw his lips move, trembling blue, saying something to the Gitrog, begging, pleading. She reached a tender hand to his cheek, stopping his babbling. He did not see. He could not hear. He did not know yet. Wilbur turned, his frantic eyes locking with Mia as the Gitrog loomed over them. How green they were, two crystal clear pools, currently swimming with tears. Mia could see herself in them, in their fractured, speckled surface. She smiled, and for a second, Wilbur seemed to calm a little. She saw trust and faith in his eyes, and she smiled as she caressed his cheek, smiled as she ran her fingers through his sandy hair, smiled as she slid her dagger out of its sheath and through his rib cage in one smooth motion. She heard him then, finally surfaced from the drone in her skull to hear his gasp of surprise, his breath turning from the ragged pant of hypothermia to one of pain and shock. Mia smiled softly and put a finger to his lips, sliding the dagger out, then back in again, this time through his abdomen. She smiled as Wilbur slumped against her, smiled as he whispered her name weakly. She whispered quietly in his ear. "All hail the Gitrog," She breathed more than spoke. She put her ear to Wilbur's chest, listening as his pulse slowed and stopped. She looked up at the Gitrog, bowing her head in supplication. "All is sacrifice." The Gitrog gazed down at Mia. Then, slowly, it opened its maw, and a monstrous tongue lapped out, grasping the body of the broken boy beside her. Mia sat in her position, a wide grin on her face, as the slurp and crackle of bone and blood and organs sloshed over her. She smiled as the wet sounds of webbed feet plodding against stones echoed away from her. Smiled until all was still again, the chill fog pierced by the now-rising morning sun. Then she rose, still smiling, stumbling away from the shore. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) When spring broke that year and the snows finally melted, a young apprentice rode his horse through the pass, into a sleepy little fishing village near Lake Zhava. He carried with him a satchel of letters, many long overdue, written before the first snowfalls of the winter before. He did not think too much of the windows and doors snapping shut as he rode by; many small hamlets had fearful or mistrusting townsfolk, especially after a harsh season. He also noticed but didn't think much of how many empty homes there seemed to be, letters delivered to properties clearly abandoned. His final letter carried him to a small cabin on the hill. As he rode up, he couldn't help but notice a dilapidated pen of some sort rotting nearby. He feared he would find yet another empty home, until he noticed the small wisps of smoke coming from the chimney. He knocked on the door, and a wild-eyed girl answered. She seemed uninterested in the post, even unimpressed by the letter that came from the Skiltfolk of Drunau. However, her eyes lit up when he mentioned the lake, and she invited him in to stay for the night, offering to feed him and give him rest, and even to take him onto the lake if he wished. The boy blushed and agreed, as he had always been curious of boats and the water. He thanked her for her kindness. Mia smiled. #figure(image("004_Sacrifice/13.jpg", width: 100%), caption: [The Gitrog Monster | Art by <NAME>], supplement: none, numbering: none)
https://github.com/isaacholt100/isaacholt100.github.io
https://raw.githubusercontent.com/isaacholt100/isaacholt100.github.io/master/maths-notes/2-durham%3A-year-2/math-phys/math-phys.typ
typst
#import "../../template.typ": template #show: template = The action principle - For small $delta s in RR$, $f(s + delta s) = f(s) + (d f(s)) / (d s) delta s + R(s, delta s)$ - With $delta f := f(s + delta s) - f(s)$, $delta f = (d f(s)) / (d s) delta s + R(s, delta s)$, with $ lim_(delta s -> 0) R(s, delta s) / (delta s) = 0 $ So $delta f$ vanishes to first order in $delta s$, so $R(s, delta s)$ can be written as $O((delta s)^2)$ - At the extrema of $f$, $(d f(s)) / (d s) = 0$ so $delta f = O((delta s)^2)$ - *Functional*: map from functions to $RR$ - $y(t)$ *stationary* for functional $S$ if $ (d S[y(t) + epsilon z(t)]) / (d epsilon) divides_(epsilon = 0) = 0 $ for every smooth $z(t)$ with $z(a) = z(b) = 0$. We use the notation $delta y(t) = epsilon z(t)$. $y(t)$ is called a *path*. - *Action principle (variational principle)*: paths described by particles are stationary paths of $S$ (an action functional): $ delta S := S[x + delta x] - S[x] = O((delta x)^2) $ for arbitrary smooth small deformations $delta x(t)$ around true path $x(t)$. - *Fundamental lemma of the calculus of variations*: Let $f(x)$ be continuous in $[a, b]$ and $ integral_a^b f(x) g(x) dif x = 0 $ for every smooth $g(x)$ in $[a, b]$ with $g(a) = g(b) = 0$. Then $f(x) = 0$ in $[a, b]$. - *Notation*: $ (diff L) / (diff x) = (diff L(r, s)) / (diff r) divides_((r, s) = (x(t), dot(x)(t))), quad (diff L) / (diff dot(x)) = (diff L(r, s)) / (diff s) divides_((r, s) = (x(t), dot(x)(t))) $ - For a path $underline(q)$ and a Lagrangian $L(underline(q), underline(dot(q)))$, the action for the path is $ S = integral_(t_0)^(t_1) L(underline(q)(t), underline(dot(q))(t))) dif t $ - The action above satisfies $ 0 = delta S = integral_(t_0)^(t_1) (sum_(i = 1)^N (diff L) / (diff q_i) delta q_i + sum_(i = 1)^N (diff L) / (diff dot(q)_i) delta dot(q)_i) dif t $ - *Euler-Lagrange equation*: $ (diff L) / (diff x) - d / (d t) ((diff L) / (diff dot(x))) = 0 $ - The arguments in a Lagrangian, $x$ and $dot(x)$, are independent: $ (diff x) / (diff dot(x)) = (diff dot(x)) / (diff x) = 0 $ - *Configuration space, $cal(C)$*: set of all possible instantaneous confiugratinons of a physical system. (Includes positions but not velocities). - For configuration space $cal(C)$ of system $cal(S)$, $S$ has $dim(cal(C))$ *degrees of freedom*. - *Generalised coordinates*: A set of coordinates in configuration space. - Notation: $underline(q)$ shows results holds for arbitrary choices of generalised coordinates. - *Euler-Lagrange equation for configuration space $cal(C)$*: $ (diff L) / (diff q_i) - d / (d t) ((diff L) / (diff dot(q)_i)) = 0 quad forall i in {1, ..., dim(cal(C))} $ - For system with kinetic energy $T(underline(q), underline(dot(q)))$ and potential energy $V(underline(q))$, the Lagrangian for the system is $ L(underline(q), underline(dot(q))) = T(underline(q), underline(dot(q))) - V(underline(q)) $ - *Ignorable coordinate $q_i$*: Lagrangian does not depend on $q_i$: $ (diff L(q_1, ... q_N, dot(q)_1, ... dot(q)_N)) / (diff q_i) = 0 $ - *Generalised momentum* of coordinate $q_i$: $ p_i := (diff L) / (diff dot(q)_i) $ - Generalised momentum of ignorable coordinate is conserved. = Symmetries, Noether's theorem and conservation laws - *Transformation depending on $epsilon$*: family of smooth maps $phi(epsilon): cal(C) -> cal(C)$ with $phi(0)$ the identity map. Can be written as $ q_i -> q_i' = phi.alt_i(q_1, ..., q_N, epsilon) $ where the $phi.alt_i$ are a set of $N = dim(cal(C))$ functions representing the transformation in the given coordinate system. Change in velocities is $ dot(q)_i -> d/(d t) phi.alt_i $ - *Generator of $phi$*: $ (d phi(epsilon)) / (d epsilon) divides_(epsilon = 0) = phi'(0) $ - In any coordinate system, $ q_i -> phi.alt_i(underline(q), epsilon) = q_i + epsilon a_i(underline(q)) + O(epsilon^2) $ where $ a_i = (diff phi.alt_i(underline(q), epsilon)) / (diff epsilon) divides_(epsilon = 0) $ So the generator of the transformation is $a_i$. - For velocities, $ dot(q)_i -> dot(q)_i + epsilon dot(a)_i (q_1, ..., q_N, dot(q)_1, ..., dot(q)_N) + O(epsilon^2) $ generated by $dot(a)_i$. - Equations of motion don't change when total derivative of function of coordinates and time is added to Lagrangian: $ L -> L + (d F(q_1, ..., q_N, t)) / (d t) $ doesn't change equations of motion. - Transformation $phi(epsilon)$ is *symmetry* if for some $F(underline(q), t)$, $ L -> L' = L(phi.alt(q_1, epsilon), ..., phi.alt(q_N, epsilon)) = L + epsilon (d F(q_1, ..., q_N, t)) / (d t) + O(epsilon^2) $ $F(underline(q), t)$ defined up to a constant. - For ignorable coordinate $q_i$, transformation $q_i -> q_i + c_i$ is symmetry since $q_i$ doesn't appear in Lagrangian and $dot(q)_i$ stays invariant. So $F = 0$ here and $a_k = delta_(i k)$. - *Noether's theorem*: Let a symmetric transformation be generated by $a_i(q_1, ..., q_N)$, so $ L -> L + epsilon (d F(q_1, ..., q_N, t)) / (d t) + O(epsilon^2) $ Then $ Q := (sum_(i = 1)^N a_i (diff L) / (diff dot(q)_i)) - F $ is conserved (so $(d Q) / (d t) = 0$). - $Q$ is called *Noether charge*. - Given Lagrangian $L(underline(q), underline(dot(q)), t)$, *energy* is $ E := (sum_(i = 1)^N dot(q)_i (diff L) / (diff dot(q)_i)) - L $ - Along path $underline(q)(t)$ satisfying equations of motion, $ (d E)/(d t) = -(diff L)/(diff t) $ - So energy conserved iff Lagrangian doesn't depend explicitly on time. = Normal modes - *Canonical* kinetic term: of the form $T = 1/2 sum_(i = 1)^n dot(q)_i^2$. - *Normal mode*: solution to $dot.double(underline(q)) + A underline(q) = 0$, associated with eigenvalue $lambda^((i)) > 0$ of $A$, of form $ underline(q)(t) = underline(v)^((i)) (alpha^((i)) cos(sqrt(lambda^((i))) t) + beta^((i)) sin(sqrt(lambda^((i))) t)) $ - *Zero mode*: solution to $dot.double(underline(q)) + A underline(q) = 0$, associated with eigenvalue $lambda^((i)) = 0$ of $A$, of form $ underline(q)(t) = underline(v)^((i)) (alpha^((i)) t + beta^((i))) $ - *Instability*: solution to $dot.double(underline(q)) + A underline(q) = 0$, associated with eigenvalue $lambda^((i)) < 0$ of $A$, of form $ underline(q)(t) = underline(v)^((i)) (alpha^((i)) cosh(sqrt(-lambda^((i))) t) + beta^((i)) sinh(sqrt(-lambda^((i))) t)) $ - When no instabilities, general solution is superposition (sum) of normal modes and zero modes. = Fields and the wave equation - *Generalised Euler-Lagrange equations for fields*: $ (diff cal(L)) / (diff u) - diff / (diff x) ((diff cal(L)) / (diff u_x)) - diff / (diff t) ((diff cal(L)) / (diff u_t)) = 0 $ and for $n$ fields $u^((i))$: $ (diff cal(L)) / (diff u^((i))) - diff / (diff x) ((diff cal(L)) / (diff u_x^((i)))) - diff / (diff t) ((diff cal(L)) / (diff u_t^((i)))) = 0 quad forall i $ - If fields don't depend on $(t, x)$ but on $d$ coordinates $x_i$, $ (diff cal(L)) / (diff u^((i))) - sum_(k = 1)^d diff / (diff x_k) ((diff cal(L)) / (diff u_k^((i)))) $ where $u_k^((i)) = (diff u^((i))) / (diff x_k)$ - *Massless scalar field Lagrangian*: $ cal(L) = 1/2 rho u_t^2 - 1/2 tau u_x^2 $ $rho$ is *density*, $tau$ is *tension*. The field $u$ is the *massless scalar*. - Equation of motion for massless scalar field is $ rho u_(t t) - tau u_(x x) = 0 $ which rearranges to *wave equation*: $ u_(t t) = c^2 u_(x x) $ where $c^2 = tau \/ rho$. - *D'Alembert's solution to wave equation*: $ u(x, t) = f(x - c t) + g(x + c t) $ $f(x - c t)$ corresponds to a wave moving to the right with speed $c$, $g(x + c t)$ corresponds to a wave moving to the left with speed $c$. - If $u(x, 0) = phi(x)$ and $u_t(x, 0) = psi(x)$ then $ u(x, t) = 1/2 (phi(x - c t) + phi(x + c t)) + 1/(2c) integral_(x - c t)^(x + c t) psi(s) dif s $ - In field theory, *symmetry* is transformation $ u -> u' = u + epsilon a(u) $ such that $delta cal(L) = O(epsilon^2)$. $a(u)$ *generates* the transformation. - *Note*: often, $x_0$ chosen to be $t$. - Let $u_i = (diff u) / (diff x_i)$, *generalised momentum vector* is $ underline(Pi) := ((diff cal(L)) / (diff u_0), ..., (diff cal(L)) / (diff u_d)) $ - *Noether current* associated to transformation generated by $a$ is $ underline(J) = a underline(Pi) $ - If $underline(J)$ associated to symmetry, $ underline(nabla) dot.op underline(J) = sum_(i = 0)^d (diff J_i) / (diff x_i) = 0 $ - *(Noether) charge density*: $ cal(Q) := J_0 $ - For $d = 1$, *charge contained in interval $(a, b)$*: $ Q_((a, b)) = integral_a^b cal(Q) dif x $ - For $d = 1$, $ (d Q_((a, b))) / (d t) = J_1(a) - J_1(b) $ - *Noether charge* is total charge over all space. For $d = 1$: $ Q := Q_((-oo, oo)) = integral_(-oo)^oo J_0 dif x $ - If $d = 1$ and $lim_(x -> plus.minus oo) J_1 = 0$, $ (d Q) / (d t) = 0 $ - *Energy-momentum tensor*: $ T_(i j) := (diff cal(L)) / (diff u_j) (diff u) / (diff x_i) - delta_(i j) cal(L) $ - *Energy density*: $ cal(E) := T_(0 0) $ - *Conservation law for energy-momentum tensor*: $ sum_(j = 0)^d (diff T_(i j)) / (diff x_j) = 0 $ - *Energy flux*: $T_(t x)$. - *Dirichlet boundary condition* for wave equation: $u_t(0, t) = 0$ (so $u(0, t) = 0$ as $u$ has shift symmetry) which gives $ u(x, t) = f(x - c t) - f(-x - c t) $ Here, waves reflected off boundary and turned upside down. - *Neumann (free) boundary condition*: $u_x(0, t) = 0$ which gives $ u(x, t) = f(x - c t) + f(-x - c t) $ So waves reflected off boundary and not turned upside down. - *Junction conditions*: - $u$ continuous at $0$: $ lim_(epsilon -> 0^+) u(epsilon, t) = lim_(epsilon -> 0^-) u(epsilon, t) $ - Energy conservation across junction: $ d/(d t) (lim_(epsilon -> 0^+) E(-epsilon, epsilon)) = lim_(epsilon -> 0^+) (T_(t x))_(x = -epsilon) - lim_(epsilon -> 0^+) (T_(t x))_(x = epsilon) $ - *Ansatz for wave function with spring at junction at $x = 0$*: $ u(x, t) = cases( "Re"((e^(i p x) + R e^(-i p x)) e^(-i p c t)) & "if" x <= 0, "Re"(T e^(i p(x - c t))) & "if" x > 0 ) $ = The Hamiltonian formalism - *State* of classical system at given instant in time is complete set of data that fully fixes future evolution of system. - *Phase (state) space* of system is space of all possible states system can be in at instant in time. - *Hamiltonian formalism* parameterises phase space as generalised coordinates $underline(q)(t)$ and associated generalised momenta $underline(p)(t)$. - When going from Lagrangian to Hamiltonian formalism, define *generalised momentum* as $ p_i := (diff L(underline(q), underline(dot(q)), t)) / (diff dot(q)_i) $ - *Poisson bracket* of $f(underline(q), underline(p), t)$ and $g(underline(q), underline(p), t)$: $ {f, g} := sum_(i = 1)^n ((diff f) / (diff q_i) (diff g) / (diff p_i) - (diff f) / (diff p_i) (diff g) / (diff q_i)) $ where $n$ is dimension of configuration space (half dimension of phase space). Position and momentum treated as independent when taking partial derivatives. - *Properties of Poisson bracket*: - *Antisymmetric*: ${f, g} = -{g, f}$. - *Linear*: ${a f + b g, h} = a {f, h} + b {g, h}$. - *Leibniz identity*: ${f g, h} = f {g, h} + g {f, h}$. - *Jacobi identity*: ${{f, g}, h} + {{h, f}, g} + {{g, h}, f} = 0$. - Let $cal(P)$ be phase space, $cal(F)$ be set of functions from $cal(P)$ to $RR$. - *Hamiltonian flow* defined by $f: cal(P) -> RR$ is infinitesimal transformation on $cal(F)$ given by $ Phi_f^((e)): cal(F) -> cal(F), quad Phi_f^((e))(g) := g + epsilon{g, f} + O(epsilon^2) $ - $Phi_f^((e))$ is *generator* of map from $cal(P)$ to $cal(P)$: $ Phi_f^((e))(q_i) = q_i + epsilon (diff f) / (diff p_i) + O(epsilon^2) \ Phi_f^((e))(p_i) = p_i - epsilon (diff f) / (diff q_i) + O(epsilon^2) $ - Noether charge $Q = (sum_(i = 1)^n a_i p_i) - F$ generates symmetry transformation via Hamiltonian flow: $ Phi_Q^((e))(q_i) = q_i + epsilon {q_i, Q} + O(epsilon^2) = q_i + epsilon a_i + O(epsilon^2) $ - *Hamiltonian* gives *energy*: $ H = (sum_(i = 1)^n p_i dot(q)_i) - L $ - *Hamilton's equations of motion*: $ dot(q)_i = {q_i, H} = (diff H) / (diff p_i), quad dot(p)_i = {p_i, H} = -(diff H) / (diff q_i) $ - Time evolution of $f(underline(q), underline(p))$ generated by $H$: $ (d f) / (d t) = {f, H} $ If $f$ depends explicitly on time, $ (d f) / (d t) = (diff f) / (diff t) + {f, H} $ - *Relation between Hamiltonian and Lagrangian*: $ (diff H(underline(q), underline(p), t)) / (diff t) divides_(underline(q), underline(p)) = -(diff L(underline(q), underline(dot(q)), t)) / (diff t) divides_(underline(q), underline(dot(q))) $ - If function $Q$ doesn't depend explicitly on time, ${H, Q} = 0$ so Hamiltonian left invariant by transformation generated by $Q$: $ Phi_Q(H) = H + epsilon{Q, H} + O(epsilon^2) = H + O(epsilon^2) $ = Wave function and probabilities - *Wave function*: continuous, complex function of position $x$ and time $t$: $psi(x, t)$. - *Probability density to find particle at time $t$ and position $x$*: $P(x, t) = |psi(x, t)|^2$, with $ integral_(-oo)^oo P(x, t) dif x = 1 $ If this integral exists, $psi$ is *square-normalisable*. If integral equal to $1$, $psi$ is *normalised*. Probability of finding particle in interval $(a, b)$ is $ integral_a^b P(x, t) dif x $ - *Expectation value* of $f(x)$: $ angle.l f(x) angle.r = integral_(-oo)^oo f(x) P(x, t) dif x $ - *Uncertainty* in position: $Delta x = sqrt(angle.l x^2 angle.r - angle.l x angle.r^2)$ - *Infinite potential well* in $0 < x < L$: $ V(x) = cases( 0 & "if" 0 < x < L, oo & "otherwise" ) $ Wave function vanishes in regions $x <= 0$ and $x >= L$. Eigenfunctions for this potential are $ phi_n(x) = sqrt(2 / L) sin((n pi x) / L) $ - *Wave function collapse*: if position is measured to be $x_0$, wave function becomes very localised around at $x_0$, and measurement immediately afterwards will also yield $x_0$. - $angle.l x angle.r$ is not average of repeated measurements of same particle, but average of measurements of many particles with same wave function. = Momentum and Planck's constant - *Position operator*: $ hat(x) = x $ - *Momentum operator*: $ hat(p) = -i planck.reduce diff / (diff x) $ where $planck.reduce$ is *reduced Planck constant*. - *Commutator*: $ [hat(x), hat(p)] := hat(x) hat(p) - hat(p) hat(x) = i planck.reduce $ - *Expectation value of momentum for wave function $psi$*: $ angle.l p angle.r = integral_(-oo)^oo overline(psi(x, t)) hat(p) psi(x, t) dif x = -i planck.reduce integral_(-oo)^oo overline(psi(x, t)) diff / (diff x) psi(x, t) dif x $ - *Expection value of function of momentum*: $ angle.l f(p) angle.r = integral_(-oo)^oo overline(psi(x, t)) f(hat(p)) psi(x, t) dif x $ - *Momentum uncertainty*: $ Delta p = sqrt(angle.l p^2 angle.r - angle.l p angle.r^2) $ - *Heisenberg's uncertainty principle*: for any normalised wave function, $ Delta x Delta p >= planck.reduce / 2 $ = Schrodinger's equation - *Hamiltonian operator*: $ hat(H) = hat(p)^2 / (2m) + V(x) = -(planck.reduce^2) / (2m) (diff^2) / (diff x^2) + V(x) $ Corresponds to measurements of energy. - *Schrodinger's equation*: $ i planck.reduce (diff psi(x, t)) / (diff t) = hat(H) psi(x, t) $ = The Hilbert space - *Hermitian inner product on vector space $V$*: map $angle.l dot.op, dot.op angle.r: V times V -> CC$ satisfying: - $angle.l v, w angle.r = overline(angle.l w\, v angle.r)$. - $angle.l v, a_1 w_1 + a_2 w_2 angle.r = a_1 angle.l v, w_1 angle.r + a_2 angle.l v, w_2 angle.r$. - $angle.l a_1 v_1 + a_2 v_2, w angle.r = overline(a_1) angle.l v_1, w angle.r + overline(a_2) angle.l v_2, w angle.r$ - $angle.l v, v angle.r >= 0$ for all $v$ and $angle.l v, v angle.r = 0 <==> v = 0$. - Set of continuous square-integrable wave functions forms complex vector space. So $a_1 psi_1 + a_2 psi_2$ is also square-integrable. - *Hermitian inner product of two wave functions*: $ angle.l psi_1, psi_2 angle.r = integral_(-oo)^oo overline(psi_1(x)) psi_2(x) dif x $ - If ${phi_n(x)}$ is orthonormal basis so $angle.l phi_m, phi_n angle.r = delta_(m n)$, then any vector can be expressed $ psi(x) = sum_n c_n phi_n(x) $ where $c_m = angle.l phi_m, psi angle.r$. Hermitian product is then $ angle.l psi_1, psi_2 angle.r = sum_i overline(psi_1(x)) psi_2(x) = sum_n overline(c)_(1, n) c_(2, n) $ So squared norm of $psi$ is $|psi|^2 = angle.l psi, psi angle.r = sum_n |c_n|^2$. = Hermitian operators - For vector space $V$, *linear operator* is map $A: V -> V$ with $ A (a_1 v_1 + a_2 v_2) = a_1 (A v_1) + a_2 (A v_2) $ - Any linear combination or composition of linear operators is linear operator. - *Matrix elements of linear operator* for orthonormal basis ${e_j}$: $A_(i j) = angle.l e_i, A e_j angle.r$. - *Adjoint* $A^dagger$: $angle.l v_1, A v_2 angle.r = angle.l A^dagger v_1, v_2 angle.r$. Adjoint has matrix elements which are conjugate of transpose of original matrix. - Properties of adjoint: - $(a_1 A_1 + a_2 A_2)^dagger = overline(a_1) A_1^dagger + overline(a_2) A_2^dagger$. - $(A_1 A_2)^dagger = A_2^dagger A_1^dagger$. - *Hermitian operator*: linear operator that is equal to adjoint. Matrix is Hermitian: $A_(i j) = overline(A_(j i))$. - Position and momentum operators Hermitian, w.r.t. orthonomal basis of wave functions ${phi_n(x)}$. = The spectrum of a Hermitian operator - Wave function $psi_a$ is *eigenfunction* of Hermitian differential operator $A$ with *eigenvalue* $a$ if $A psi_a(x) = a psi_a(x)$. - Expectation value of Hermitian operator: $ angle.l A angle.r = angle.l psi, A psi angle.r = integral_(-oo)^oo overline(psi(x)) A psi(x) dif x $. - If $psi_a$ is eigenfunction, $angle.l A angle.r = a$ and $angle.l A^n angle.r = a^n$. So uncertainty $Delta A = 0$. - Let $A$ Hermitian operator. - Eigenvalues are real and - $psi_1, psi_2$ eigenfunctions of $A$ with distinct eigenvalues are orthogonal. - If $A$ has discrete spectrum, can choose orthonormal basis of eigenfunctions ${phi_n(x)}$ with eigenvalues $a_n$. Then any wave function can be written as $psi(x) = sum_n c_n phi_n(x)$ where $c_n = angle.l phi_n, psi angle.r$. Can interpret $|c_n|^2$ as probability of measurement of $A$ yielding $a_n$. - *Dirac delta function*: $ delta(a) = cases( 0 & "if" a != 0, infinity & "if" a = 0 ) $ with $integral_(-oo)^oo delta(a) dif a = 1$ and $ integral_(-oo)^oo delta(a - a') f(a') dif a' = f(a) $ - *Limit definition of Dirac delta function*: limit as $epsilon -> 0^+$ of $ delta_epsilon(a) = 1/(epsilon sqrt(pi)) e^(-a^2 \/ epsilon^2) $ - *Delta funtion is Fourier transform of $1$*: $ delta(a) = 1/(2 pi) integral_(-oo)^oo e^(i a a') dif a' $ - If $A$ has continuous spectrum (eigenvalues $a in RR$) then can choose basis of eigenfunctions $phi_a(x)$ with $angle.l phi_a, phi_(a') angle.r = delta(a - a')$. Can uniquely expand wave function $ psi(x) = integral_(-oo)^oo c(a) phi_a(x) dif a $ where $c(a) = angle.l phi_a, psi angle.r $. Norm of wave function is $ angle.l psi, psi angle.r = integral_(-oo)^oo |c(a)|^2 dif a $ For normalised wave function, $ integral_(-oo)^oo |c(a)|^2 = 1 $ so treat $|c(a)|^2$ as probability distribution for measurements of $A$. = Postulates of quantum mechanics - *Postulates of quantum mechanics*: - Particle described by normalised wave function $psi(x)$. - Measurable quantities represented by Hermitian operators $A(x, p)$, constructed from polynomial/real analytic functions of position and momentum operators: $ hat(x) & = x,\ hat(p) & = -i planck.reduce diff / (diff x) $ - Possible outcomes of measurement of $A$ are given by its eigenvalues $a$. If spectrum discrete, ${a_j}$, then choose eigenfunction basis $phi_j(x)$ with $angle.l phi_i, phi_j angle.r = delta_(i j)$. Then probability of finding measurement as eigenvalue $a_j$ is $|angle.l phi_j, psi angle.r|^2$. If spectrum continuous, $a in RR$, choose eigenfunctions $phi_a(x)$ with $angle.l phi_a, phi_(a') angle.r = delta(a - a')$, then probability of finding measurement as eigenvalue $a$ is $|angle.l phi_a, psi angle.r|^2$. - If measurement of $A$ yields eigenvalue $a_j$ (or $a$), wave function immediately afterwards is $phi_j(x)$ (or $phi_a(x)$). *Note*: in continuous case, wave function immediately afterwards not square-normalisable. - If no measurements made, $psi$ evolves in time according to Schrodinger equation: $ i planck.reduce (diff psi(x, t)) / (diff t) = hat(H) psi(x, t) $ - For discrete spectrum, expectation value of $A$ is $ angle.l A angle.r = sum_j a_j P_j $ for eigenvalues $a_j$, $P_j = |c_j|^2$ is probability of measurement being $a_j$. - For continuous spectrum, expectation value of $A$ is $ angle.l A angle.r = integral_(-oo)^oo a P(a) dif a $ where $P(a) = |c(a)|^2$ is probability distribution. = Commutators and uncertainty principle - *Commutator* of operators $A, B$: $ [A, B] = A B - B A $ - Properties of commutator: - *Anti-symmetry*: $[A, B] = -[B, A]$. - *Linearity*: $[a_1 A_1 + a_2 A_2, B] = a_1 [A_1, B] + a_2 [A_2, B]$. - $[A, B C] = B[A, C] + [A, B]C$. - *Jacobi identity*: $[A, [B, C]] + [B, [C, A]] + [C, [A, B]] = 0$. - If $[A, B] = 0$, possible to find orthonormal basis of wave functions which are eigenfunctions of $A$ and $B$. - $A, B$ *compatible* if $[A, B] = 0$. - *Generalised uncertainty principle*: for any square-normalisable wave function, $ Delta A Delta B >= 1/2 |angle.l [A, B] angle.r| $ - *Anti-commutator*: ${A, B} = A B + B A$. = Energy revisited - Eigenfunctions of Hamiltonian are *bound states* if classical solution is bounded in space. - Let $V(x) >= V_0$ for all $x in RR$. Then if wave function normalised, $angle.l H angle.r > V_0$. - If $psi(x)$ is normalised eigenfunction of $H$ with eigenvalue $E$, then $E > V_0$. - *Zero-point energy*: smallest eigenvalue $E > V_0$. - Spectrum of Hamiltonian is non-degenerate. = Stationary states - Solution to Schrodinger's equation is $psi(x, t) = phi(x) e^(-i E t \/ planck.reduce)$ where $phi(x)$ is eigenfunction of Hamiltonian with eigenvalue $E$. This solution is *stationary wave function*. - *Full solution to Schrodinger's equation*: $ psi(x, t) = sum_j c_j phi_j(x) e^(-i E_j t \/ planck.reduce) $ where $\{phi_j(x)\}$ is orthonormal basis of Hamiltonian eigenfunctions with eigenvalues $E_j$, $c_j$ are coefficients of initial wave function expansion: $ psi(x, 0) = sum_j c_j phi_j(x) $ Probability of energy measurement being $E_j$ is $P_j = |angle.l phi_j, psi angle.r|^2 = |c_j|^2$. - *Time-independent Schrodinger equation*: $ hat(H) phi(x) = E phi(x) $ where $phi(x)$ is Hamiltonian eigenfunction with eigenvalue (energy) $E$. = Case study: the free particle - If $V(x) = 0$, eigenfunction of $hat(p)$ is eigenfunction of $hat(H)$. = Two particle systems - For two particles in one dimension, wave function is $psi(x_1, x_2)$, probability density is $P(x_1, x_2) = |psi(x_1, x_2)|^2$: probability of finding particle one in $(a, b)$ and particle two in $(c, d)$ is $ integral_a^b integral_c^d P(x_1, x_2) dif x_1 dif x_2 $. - Probability of finding particle one in $(a, b)$ is $ P(x_1) = integral_a^b P(x_1, x_2) dif x_2 $ (similarly for particle two). - If both positions measured as $tilde(x)_1, tilde(x)_2$, wave function collapses to product of position eigenfunctions: $ psi_"before"(x_1, x_2) -> psi_"after"(x_1, x_2) prop delta(x_1 - tilde(x)_1) delta(x_2 - tilde(x)_2) $ - If only particle one measured, $ psi_"before"(x_1, x_2) -> delta(x_1 - tilde(x)_1) psi_"before"(tilde(x)_1, x_2) $ - Hamiltonian for two particles with zero potential: $ hat(H) = -planck.reduce^2 / (2m) diff / (diff x_1^2) - planck.reduce^2 / (2m) diff / (diff x_2^2) $ Eigenfunctions are product are single-particle eigenfunctions: $ phi(x_1, x_2) = 2/L sin((n pi x_1) / L) sin((m pi x_2) / L) $ Eigenvalues are sum of eigenvalues of single-particle Hamiltonians. - Wave function separable if can be written as product of function of $x_1$ and function of $x_2$. - *Entangled states*: when measurement of one particle affects subsequent measurement of other particle. Occurs for non-separable wave functions. = Simple harmonic oscillator - *Simple harmonic oscillator potential*: $ V(x) = 1/2 m omega^2 x^2 $ where $omega$ is angular frequency. - If $V$ has minimum at $x = x_0$ and $|x - x_0|$ small, $m omega^2 approx 1/2 V''(x_0)$ by Taylor expanion of $V(x)$ around $x_0$. - Energy spectrum of Hamiltonian for simple harmonic oscillator is $E_n = planck.reduce omega (n + 1/2)$ = The continuity equation - *Probability current density*: $ J := planck.reduce / (2m i) (overline(psi) diff_x psi - psi diff_x overline(psi)) $ - *Continuity equation*: $ diff_t P + diff_x J = 0 $ where $P(x, t) = |psi(x, t)|^2$. - Probability current vanishes as $x -> plus.minus infinity$ for square-normalisable wave functions. = Scattering problems - When particle has to cross potential, for $t -> -oo$, $psi(x, t) -> psi_I(x, t)$ is incoming wavepacket, then it scatters from the potential, as $t -> oo$, tends to sum of reflected and transmitted wavepackets: $ psi(x, t) -> psi_R(x, t) + psi_T(x, t) $ As $t -> oo$, reflected and transmitted wavepackets don't interfere. - Probability of reflection is $ R = lim_(t -> oo) integral_(-oo)^oo |psi_R(x, t)|^2 dif x $ Probability of transmission is $ T = lim_(t -> oo) integral_(-oo)^oo |psi_T(x, t)|^2 dif x $ $R + T = 1$ if $psi$ normalised. = Tunnelling - *Finite step potential*: for $V_0 > 0$ $ V(x) = cases( 0 & "if" x < 0, V_0 & "if" x >= 0 ) $ - Scattering occurs when particle has energy $E > V_0$. - Tunnelling occurs when particle has energy $0 < E < V_0$. - For scattering, Hamiltonian eigenfunctions are $ phi(x) = cases( e^(i k x) + r e^(-i k x) & "if" x < 0, t e^(i k' x) & "if" x >= 0 ) $ where $k = sqrt(2m E \/ planck.reduce^2)$, $k' = sqrt(2m(E - V_0) \/ planck.reduce^2)$ - Determine $r$ and $t$ by using that $psi$ and $diff_x psi$ continuous at $x = 0$. - *Finite barrier potential*: $ V(x) = cases( 0 & "if" x < 0, V_0 & "if" 0 <= x <= L, 0 & "if" x > L ) $ - For tunnelling, Hamiltonian eigenfunctions are $ phi(x) = cases( e^(i k x) + r e^(-i k x) & "if" x < 0, t e^(-kappa x) & "if" x >= 0 ) $ where $kappa = sqrt(2m (V_0 - E) \/ planck.reduce^2)$. Coefficients $r$ and $t$ found by replacing $k' -> i kappa$. = Momentum-space wave function - *Momentum-space wave function*: $ tilde(psi)(p) = 1/sqrt(2pi planck.reduce) integral_(-oo)^oo psi(x) e^(-i p x \/ planck.reduce) dif x $ satisfies $ psi(x) = 1/sqrt(2 pi planck.reduce) integral_(-oo)^oo tilde(psi)(p) e^(i p x \/ planck.reduce) dif p $ - For momentum-space wave function, position and momentum act as operators $ hat(x) & = i planck.reduce diff / (diff p) \ hat(p) = p $ - *Momentum probability density*: $tilde(P)(p) = |tilde(psi)(p)|^2$. Probability of momentum measurement being $a < p < b$ is $ integral_a^b tilde(P)(p) dif p $ - Momentum expectation value of $f(p)$: $ angle.l f(p) angle.r = integral_(-oo)^oo f(p) tilde(P)(p) dif p $ - Position expectation value of $f(x)$: $ angle.l f(x) angle.r = integral_(-oo)^oo overline(tilde(psi)(p)) f(i planck.reduce diff / (diff p)) tilde(psi)(p) dif p $ - $psi(x)$ normalised iff $tilde(psi)(p)$ normalised. - Translating $psi(x)$ by $x_0$ multiplies $tilde(psi)(p)$ by $e^(-i p x_0 \/ planck.reduce)$. - Translating $tilde(psi)(p)$ by $p_0$ multiplies $psi(x)$ by $e^(i p_0 x \/ planck.reduce)$.
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/scripting/destructuring.typ
typst
--- destructuring-group-1 --- // This wasn't allowed. #let ((x)) = 1 #test(x, 1) --- destructuring-group-2 --- // This also wasn't allowed. #let ((a, b)) = (1, 2) #test(a, 1) #test(b, 2) --- destructuring-dict-underscore --- // Here, `best` was accessed as a variable, where it shouldn't have. #{ (best: _) = (best: "brr") } --- destructuring-dict-array-at --- // Same here. #{ let array = (1, 2, 3, 4) (test: array.at(1), best: _) = (test: "baz", best: "brr") test(array, (1, "baz", 3, 4)) } --- destructuring-dict-bad --- // Error: 7-10 expected identifier, found group // Error: 12-14 expected pattern, found integer #let ((a): 10) = "world" --- destructuring-bad-duplicate --- // Here, `a` is not duplicate, where it was previously identified as one. #let f((a: b), (c,), a) = (a, b, c) #test(f((a: 1), (2,), 3), (3, 1, 2)) --- destructuring-non-atomic --- // Ensure that we can't have non-atomic destructuring. #let x = 1 #let c = [#() = ()] #test(c.children.last(), [()]) --- destructuring-let-array --- // Simple destructuring. #let (a, b) = (1, 2) #test(a, 1) #test(b, 2) --- destructuring-let-array-single-item --- #let (a,) = (1,) #test(a, 1) --- destructuring-let-array-placeholders --- // Destructuring with multiple placeholders. #let (a, _, c, _) = (1, 2, 3, 4) #test(a, 1) #test(c, 3) --- destructuring-let-array-with-sink-at-end --- // Destructuring with a sink. #let (a, b, ..c) = (1, 2, 3, 4, 5, 6) #test(a, 1) #test(b, 2) #test(c, (3, 4, 5, 6)) --- destructuring-let-array-with-sink-in-middle --- // Destructuring with a sink in the middle. #let (a, ..b, c) = (1, 2, 3, 4, 5, 6) #test(a, 1) #test(b, (2, 3, 4, 5)) #test(c, 6) --- destructuring-let-array-with-sink-at-start-empty --- // Destructuring with an empty sink. #let (..a, b, c) = (1, 2) #test(a, ()) #test(b, 1) #test(c, 2) --- destructuring-let-array-with-sink-in-middle-empty --- // Destructuring with an empty sink. #let (a, ..b, c) = (1, 2) #test(a, 1) #test(b, ()) #test(c, 2) --- destructuring-let-array-with-sink-at-end-empty --- // Destructuring with an empty sink. #let (a, b, ..c) = (1, 2) #test(a, 1) #test(b, 2) #test(c, ()) --- destructuring-let-array-with-sink-empty --- // Destructuring with an empty sink and empty array. #let (..a) = () #test(a, ()) --- destructuring-let-array-with-unnamed-sink --- // Destructuring with unnamed sink. #let (a, .., b) = (1, 2, 3, 4) #test(a, 1) #test(b, 4) // Error: 10-11 duplicate binding: a #let (a, a) = (1, 2) // Error: 12-15 only one destructuring sink is allowed #let (..a, ..a) = (1, 2) // Error: 12-13 duplicate binding: a #let (a, ..a) = (1, 2) // Error: 13-14 duplicate binding: a #let (a: a, a) = (a: 1, b: 2) // Error: 13-20 expected pattern, found function call #let (a, b: b.at(0)) = (a: 1, b: 2) // Error: 7-14 expected pattern, found function call #let (a.at(0),) = (1,) --- destructuring-let-empty-array --- #let () = () --- destructuring-let-empty-array-too-many-elements --- // Error: 6-8 too many elements to destructure // Hint: 6-8 the provided array has a length of 2, but the pattern expects an empty array #let () = (1, 2) --- destructuring-let-array-too-few-elements --- // Error: 13-14 not enough elements to destructure // Hint: 13-14 the provided array has a length of 2 #let (a, b, c) = (1, 2) --- destructuring-let-array-too-few-elements-with-sink --- // Error: 7-10 not enough elements to destructure // Hint: 7-10 the provided array has a length of 2 #let (..a, b, c, d) = (1, 2) --- destructuring-let-array-bool-invalid --- // Error: 6-12 cannot destructure boolean #let (a, b) = true --- destructuring-let-dict --- // Simple destructuring. #let (a: a, b, x: c) = (a: 1, b: 2, x: 3) #test(a, 1) #test(b, 2) #test(c, 3) --- destructuring-let-dict-with-sink-at-end --- // Destructuring with a sink. #let (a: _, ..b) = (a: 1, b: 2, c: 3) #test(b, (b: 2, c: 3)) --- destructuring-let-dict-with-sink-in-middle --- // Destructuring with a sink in the middle. #let (a: _, ..b, c: _) = (a: 1, b: 2, c: 3) #test(b, (b: 2)) --- destructuring-let-dict-with-sink-at-end-empty --- // Destructuring with an empty sink. #let (a: _, ..b) = (a: 1) #test(b, (:)) --- destructuring-let-dict-with-sink-empty --- // Destructuring with an empty sink and empty dict. #let (..a) = (:) #test(a, (:)) --- destructuring-let-dict-with-unnamed-sink --- // Destructuring with unnamed sink. #let (a, ..) = (a: 1, b: 2) #test(a, 1) --- destructuring-let-nested --- // Nested destructuring. #let ((a, b), (key: c)) = ((1, 2), (key: 3)) #test((a, b, c), (1, 2, 3)) --- destructuring-let-dict-key-string-invalid --- // Keyed destructuring is not currently supported. // Error: 7-18 expected pattern, found string #let ("spacy key": val) = ("spacy key": 123) #val --- destructuring-let-dict-key-expr-invalid --- // Keyed destructuring is not currently supported. #let x = "spacy key" // Error: 7-10 expected identifier, found group #let ((x): v) = ("spacy key": 123) --- destructuring-let-array-trailing-placeholders --- // Trailing placeholders. // Error: 10-11 not enough elements to destructure // Hint: 10-11 the provided array has a length of 1 #let (a, _, _, _, _) = (1,) #test(a, 1) --- destructuring-let-dict-patterns-invalid --- // Error: 10-13 expected pattern, found string // Error: 18-19 expected pattern, found integer #let (a: "a", b: 2) = (a: 1, b: 2) --- destructuring-let-dict-shorthand-missing-key --- // Error: 10-11 dictionary does not contain key "b" #let (a, b) = (a: 1) --- destructuring-let-dict-missing-key --- // Error: 10-11 dictionary does not contain key "b" #let (a, b: b) = (a: 1) --- destructuring-let-dict-from-array --- // Error: 7-11 cannot destructure named pattern from an array #let (a: a, b) = (1, 2, 3) --- destructuring-during-loop-continue --- // Test continue while destructuring. // Should output "one = I \ two = II \ one = I". #for num in (1, 2, 3, 1) { let (word, roman) = if num == 1 { ("one", "I") } else if num == 2 { ("two", "II") } else { continue } [#word = #roman \ ] } --- destructuring-assign --- // Test destructuring assignments. #let a = none #let b = none #let c = none #((a,) = (1,)) #test(a, 1) #((_, a, b, _) = (1, 2, 3, 4)) #test(a, 2) #test(b, 3) #((a, b, ..c) = (1, 2, 3, 4, 5, 6)) #test(a, 1) #test(b, 2) #test(c, (3, 4, 5, 6)) #((a: a, b, x: c) = (a: 1, b: 2, x: 3)) #test(a, 1) #test(b, 2) #test(c, 3) #let a = (1, 2) #((a: a.at(0), b) = (a: 3, b: 4)) #test(a, (3, 2)) #test(b, 4) #let a = (1, 2) #((a.at(0), b) = (3, 4)) #test(a, (3, 2)) #test(b, 4) #((a, ..b) = (1, 2, 3, 4)) #test(a, 1) #test(b, (2, 3, 4)) #let a = (1, 2) #((b, ..a.at(0)) = (1, 2, 3, 4)) #test(a, ((2, 3, 4), 2)) #test(b, 1) --- destructuring-assign-commas --- // Test comma placement in destructuring assignment. #let array = (1, 2, 3) #((key: array.at(1)) = (key: "hi")) #test(array, (1, "hi", 3)) #let array = (1, 2, 3) #((array.at(1)) = ("hi")) #test(array, (1, "hi", 3)) #let array = (1, 2, 3) #((array.at(1),) = ("hi",)) #test(array, (1, "hi", 3)) #let array = (1, 2, 3) #((array.at(1)) = ("hi",)) #test(array, (1, ("hi",), 3)) --- destructuring-assign-nested --- // Test nested destructuring assignment. #let a #let b #let c #(((a, b), (key: c)) = ((1, 2), (key: 3))) #test((a, b, c), (1, 2, 3)) --- destructuring-assign-nested-invalid --- #let array = (1, 2, 3) // Error: 3-17 cannot destructure string #((array.at(1),) = ("hi")) #test(array, (1, ("hi",), 3)) --- issue-3275-normal-variable --- // Normal variable. #for x in (1, 2) {} #for x in (a: 1, b: 2) {} #for x in "foo" {} #for x in bytes("😊") {} --- issue-3275-placeholder --- // Placeholder. #for _ in (1, 2) {} #for _ in (a: 1, b: 2) {} #for _ in "foo" {} #for _ in bytes("😊") {} --- issue-3275-destructuring --- // Destructuring. #for (a,b,c) in (("a", 1, bytes(())), ("b", 2, bytes(""))) {} #for (a, ..) in (("a", 1, bytes(())), ("b", 2, bytes(""))) {} #for (k, v) in (a: 1, b: 2, c: 3) {} #for (.., v) in (a: 1, b: 2, c: 3) {} --- issue-3275-loop-over-content --- // Error: 11-17 cannot loop over content #for x in [1, 2] {} --- issue-3275-loop-over-arguments --- // Error: 11-25 cannot loop over arguments #for _ in arguments("a") {} --- issue-3275-loop-over-integer --- // Error: 16-21 cannot loop over integer #for (x, y) in 12306 {} --- issue-3275-destructuring-loop-over-content --- // Error: 16-22 cannot loop over content #for (x, y) in [1, 2] {} --- issue-3275-destructuring-loop-over-string --- // Error: 6-12 cannot destructure values of string #for (x, y) in "foo" {} --- issue-3275-destructuring-loop-over-string-array --- // Error: 6-12 cannot destructure string #for (x, y) in ("foo", "bar") {} --- issue-3275-destructuring-loop-over-bytes --- // Error: 6-12 cannot destructure values of bytes #for (x, y) in bytes("😊") {} --- issue-3275-destructuring-loop-over-bytes-array --- // Error: 6-12 cannot destructure bytes #for (x, y) in (bytes((1,2)), bytes((1,2))) {} --- issue-3275-destructuring-loop-over-int-array --- // Error: 6-12 cannot destructure integer #for (x, y) in (1, 2) {} --- issue-3275-destructuring-loop-over-2d-array-1 --- // Error: 10-11 not enough elements to destructure // Hint: 10-11 the provided array has a length of 1 #for (x, y) in ((1,), (2,)) {} --- issue-3275-destructuring-loop-over-2d-array-2 --- // Error: 6-12 too many elements to destructure // Hint: 6-12 the provided array has a length of 3, but the pattern expects 2 elements #for (x, y) in ((1,2,3), (4,5,6)) {}
https://github.com/SkytAsul/trombinoscope
https://raw.githubusercontent.com/SkytAsul/trombinoscope/main/pages/pageIntro.typ
typst
MIT License
#show: it => align(horizon + center, block(width: 90%, align(left, it))) #align(center)[= Introduction] #v(2em) #set text(size: 1.2em) #set par(justify: true) Le projet du trombinoscope renaît de ses cendres ! Dès que tu auras tourné cette page tu découvriras les têtes des 1067 futurs ingénieurs humanistes de demain qui se sont prêtés au jeu des photos. Ce sera l'occasion pour toi de mettre un nom sur les visages que tu croises tous les jours dans les couloirs. À la fin de cette nouvelle version du trombinoscope tu trouveras quelques infos sur l'école que tu pourras ressortir pour briller en société ainsi qu'une liste non exhaustive des membres des bureaux et clubs des associations de notre chère école.
https://github.com/typst-doc-cn/tutorial
https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/typ/templates/side-notes.typ
typst
Apache License 2.0
#let side-attrs = state("tuturial-side-note-attrs", (:)) #let side-note(dy: -0.65em, content) = locate(loc => { let attr = side-attrs.at(loc) // side-notes.update(it => { // let p = str(loc.page()) // let arr = it.at(p, default: ()) // arr.push((loc.position().y, content)) // it.insert(p, arr) // it // }) box( width: 0pt, box( width: attr.width, place( left, dy: dy, dx: attr.left - loc.position().x, { set text(size: 10.5pt) content }, ), ), ) })
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Chapters/1-Einleitung.typ
typst
#import "../Template/customFunctions.typ": * = Einleitung <introduction> == Hintergrund und Motivation <motivation> Modulhandbücher begegnen vielen Menschen bereits vor dem Start des Studiums bei der Recherche nach interessanten Studiengängen @ects. In Modulhandbüchern befinden sich die wesentlichen Informationen und Rahmenbedingungen zu den einzelnen Modulen eines Studiengangs. Da sich Lehrinhalte, Zuständigkeiten und auch ganze Studiengänge verändern @hachmeister_im_2016, müssen die Modulhandbücher ebenfalls regelmäßig bearbeitet und bereitgestellt werden. Dieser Aktualisierungsprozess wird vom zuständigen Dekanat der Abteilung Informatik als suboptimal angesehen, weshalb Verbesserungsvorschläge diskutiert werden. Weiterhin befinden sich andere Systeme in der Entwicklung (mehr dazu in @andereAnwendungen), welche von einer korrekten und aktuellen Auflistung aller Module eines Studienganges profitieren. In dieser Arbeit soll eine Webanwendung erstellt werden, welche die Bearbeitung und Veröffentlichung von Modulhandbüchern erleichtert. Der neue Prozess soll eine bessere Usability haben und effizienter sein. Das Ergebnis dieser Arbeit soll eine lauffähige Software sein, mit dem Modulhandbücher in einer Oberfläche verwaltet, bearbeitet und angezeigt werden können. Die Weboberfläche, die von den Anwendern genutzt werden wird, wird "StudyModules" heißen. == Definition und Zweck eines Modulhandbuchs<definition> § 7 der niedersächsischen Studienakkreditierungsverordnung @studAkkVO beschreibt, dass jeder Studiengang in zeitlich und thematisch abgegrenzte Module einzuteilen ist. Des Weiteren ist eine Beschreibung des Moduls und dessen Merkmale erforderlich. Die Aufgabe eines Modulhandbuches ist es, die Orientierung im Studium zu erleichtern und die Prüfungsordnung abzubilden. Das Handbuch soll über die einzelnen Lehrveranstaltungen informieren und diese detailliert beschreiben. @modulhandbuecher Es gibt noch weitere Dokumente, die Informationen über die Module eines Studienganges enthalten. In @mdiCurr ist das vorgeschlagene Curriculum des Studiengangs Mediendesigninformatik zu sehen. Hier entspricht eine Spalte einem Semester. Die Höhe der Module spiegelt die Anzahl der zu erreichenden Credits wider. #imageFigure(<mdiCurr>, "MDI_Curriculum.png")[Curriculum Mediendesigninformatik @fak4] #box()[ Im Anhang des besonderen Teils der Prüfungsordnung @btpo befindet sich eine Auflistung aller Module des Studiengangs in tabellarischer Form (@currTable). #imageFigure(<currTable>, "currTable.png")[Auszug Anhang Prüfungsordnung @btpo] ] Es gibt verschiedene Zielgruppen für Modulhandbücher, die in @zielgruppen genauer betrachtet werden. Des Weiteren wird in @structure die Struktur von verschiedenen Modulhandbüchern untersucht und anschließend in @dbschema ein dazu passendes Datenbankschema erstellt. == Ähnliche Arbeiten <verwandteArbeiten> Bevor mit der Planung des neuen Systems zur Verwaltung von Modulhandbüchern begonnen wurde, fand zunächst eine Recherche zu ähnlichen Arbeiten statt. Ein System, welches ein ähnliches Problem löst, ist der "Curriculum Designer" im #hone @hisinone der #his @his. Das #hone wird beispielsweise von der Universität Hohenheim zur Verwaltung der Modulhandbücher genutzt @hohenheimHIS. Weiterhin ist das #hone an der #hsh im Einsatz @hshHIS, um dort die zum Beispiel die Prüfungsanmeldungen zu realisieren. Da es keine öffentlichen Dokumentationen für die Nutzung der Schnittstellen vom #hone gab und zu diesem Zeitpunkt auch unklar war, ob das #hone hochschulweit zur Verwaltung von Modulhandbüchern eingesetzt werden sollte, bot es sich an ein eigenes System zu entwickeln. Das selbst entwickelte System hatte den zusätzlichen Vorteil, dass es an alle besonderen Anforderungen angepasst werden konnte, ohne einen Antrag bei der #his stellen zu müssen. Sollte die #hsh entscheiden, das #hone in Zukunft auch für die Verwaltung von Modulhandbüchern zu nutzen, könnten die Informationen der Handbücher über Webservices vom #hone und über die REST-Schnittstellen des neuen Systems synchronisiert werden. == Aufbau der Arbeit In dieser Arbeit werden zunächst in @anforderungsanalyse die Anforderungen an das neue System ermittelt. Dafür wird der aktuelle Prozess analysiert, auf Schwachstellen geprüft und es werden die Zielgruppen ermittelt. Anschließend werden Use Cases, sowie ein zukünftiger Arbeitsprozess entwickelt. Abschließend wird eine Liste der Anforderungen erstellt und die Struktur eines Modulhandbuchs analysiert. In @entwurf werden die Strukturen verschiedener Modulhandbücher untersucht und verglichen. Aus den Ergebnissen der Untersuchung soll dann ein Datenbankschema erstellt werden. Außerdem werden Entwürfe für die Benutzeroberflächen erstellt. In @implementierung wird zu dem zuvor erstellten Datenbankschema ein Backend erstellt. Anschließend werden aus den zuvor erstellten Entwürfen die Benutzeroberflächen angefertigt. Zuletzt werden in @review die Ergebnisse überprüft. Dazu wird ein Interview geführt und es werden die Anforderungen auf Erfüllung geprüft. Anschließend gibt es in @fazit ein Fazit zum Stand des Systems und es wird eingeschätzt, ob es einsetzbar ist. Im Ausblick (@ausblick) werden Ideen für zukünftige Erweiterungen diskutiert.
https://github.com/ClazyChen/Table-Tennis-Rankings
https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2004/MS-04.typ
typst
#set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (1 - 32)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [1], [<NAME>], [CHN], [2618], [2], [<NAME>], [CHN], [2560], [3], [WANG Liqin], [CHN], [2554], [4], [<NAME>], [GER], [2375], [5], [CHEN Qi], [CHN], [2365], [6], [<NAME>], [BLR], [2347], [7], [KONG Linghui], [CHN], [2345], [8], [<NAME>], [GRE], [2329], [9], [CHIANG Peng-Lung], [TPE], [2317], [10], [<NAME>], [CHN], [2307], [11], [<NAME>], [CZE], [2293], [12], [<NAME>], [KOR], [2286], [13], [LIU Guozheng], [CHN], [2282], [14], [<NAME>], [AUT], [2256], [15], [JOO Saehyuk], [KOR], [2243], [16], [CHEN Weixing], [AUT], [2242], [17], [<NAME>], [SLO], [2219], [18], [<NAME>], [BEL], [2197], [19], [<NAME>], [BEL], [2162], [20], [<NAME>], [SWE], [2155], [21], [OH Sangeun], [KOR], [2150], [22], [<NAME>], [GER], [2148], [23], [<NAME>], [ESP], [2148], [24], [QIU Yike], [CHN], [2147], [25], [#text(gray, "KIM Taeksoo")], [KOR], [2145], [26], [CHUANG Chih-Yuan], [TPE], [2134], [27], [ROSSKOPF Jorg], [GER], [2134], [28], [BLASZCZYK Lucjan], [POL], [2128], [29], [<NAME>], [ROU], [2127], [30], [<NAME>], [DEN], [2110], [31], [ERLANDSEN Geir], [NOR], [2105], [32], [<NAME>], [CRO], [2105], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (33 - 64)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [33], [LI Ching], [HKG], [2101], [34], [KARLSSON Peter], [SWE], [2086], [35], [TUGWELL Finn], [DEN], [2084], [36], [<NAME>], [SWE], [2068], [37], [YANG Min], [ITA], [2066], [38], [SMIRNOV Alexey], [RUS], [2066], [39], [LEE Jungwoo], [KOR], [2066], [40], [<NAME>], [RUS], [2062], [41], [KEEN Trinko], [NED], [2058], [42], [<NAME>], [CHN], [2056], [43], [LUNDQVIST Jens], [SWE], [2055], [44], [<NAME>], [SWE], [2030], [45], [KARAKASEVIC Aleksandar], [SRB], [2026], [46], [#text(gray, "<NAME>")], [CHN], [2021], [47], [<NAME>], [HKG], [2021], [48], [<NAME>], [HKG], [2020], [49], [<NAME>], [NOR], [2010], [50], [<NAME>], [GER], [2000], [51], [<NAME>], [NED], [1996], [52], [<NAME>], [CHN], [1986], [53], [<NAME>], [CZE], [1985], [54], [<NAME>], [GER], [1982], [55], [<NAME>], [ITA], [1976], [56], [<NAME>], [KOR], [1968], [57], [<NAME>], [BRA], [1949], [58], [<NAME>], [AUT], [1947], [59], [<NAME>], [POL], [1945], [60], [<NAME>], [CZE], [1944], [61], [<NAME>], [GER], [1936], [62], [CIOTI Constantin], [ROU], [1936], [63], [<NAME>], [SWE], [1935], [64], [<NAME>], [SWE], [1934], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (65 - 96)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [65], [<NAME>], [DEN], [1932], [66], [<NAME>], [HUN], [1930], [67], [<NAME>], [CAN], [1930], [68], [<NAME>], [NGR], [1930], [69], [#text(gray, "<NAME>")], [JPN], [1929], [70], [<NAME>], [ROU], [1928], [71], [<NAME>], [BLR], [1923], [72], [<NAME>], [JPN], [1921], [73], [<NAME>], [IND], [1919], [74], [<NAME>], [CZE], [1919], [75], [<NAME>], [AUT], [1917], [76], [ELOI Damien], [FRA], [1917], [77], [#text(gray, "<NAME>")], [FRA], [1915], [78], [<NAME>], [GER], [1911], [79], [<NAME>], [CHN], [1911], [80], [PHUNG Armand], [FRA], [1908], [81], [<NAME>], [CRO], [1906], [82], [SHMYREV Maxim], [RUS], [1906], [83], [<NAME>], [POL], [1904], [84], [<NAME>], [FRA], [1903], [85], [<NAME>], [HUN], [1902], [86], [<NAME>], [RUS], [1900], [87], [<NAME>], [SRB], [1898], [88], [<NAME>], [KOR], [1898], [89], [<NAME>], [SVK], [1897], [90], [<NAME>], [CZE], [1896], [91], [CHEUNG Yuk], [HKG], [1894], [92], [#text(gray, "<NAME>")], [FRA], [1892], [93], [<NAME>], [GRE], [1889], [94], [<NAME>], [GER], [1889], [95], [<NAME>], [BUL], [1887], [96], [LEE Chulseung], [KOR], [1885], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (97 - 128)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [97], [ZHUANG David], [USA], [1880], [98], [TANG Peng], [HKG], [1870], [99], [KUSINSKI Marcin], [POL], [1866], [100], [JOVER Sebastien], [FRA], [1866], [101], [<NAME>], [ISL], [1865], [102], [<NAME>], [DEN], [1862], [103], [<NAME>], [NOR], [1859], [104], [<NAME>], [BRA], [1855], [105], [<NAME>], [SVK], [1855], [106], [<NAME>], [JPN], [1854], [107], [<NAME>], [CZE], [1854], [108], [<NAME>], [POL], [1850], [109], [<NAME>], [POL], [1847], [110], [<NAME>], [SVK], [1841], [111], [<NAME>], [HUN], [1841], [112], [<NAME>], [JPN], [1836], [113], [TAVUKCUOGLU Irfan], [TUR], [1836], [114], [TASAKI Toshio], [JPN], [1832], [115], [#text(gray, "<NAME>")], [IND], [1829], [116], [<NAME>], [GER], [1829], [117], [<NAME>], [ITA], [1824], [118], [ZOOGLING Mikael], [SWE], [1824], [119], [CHANG Yen-Shu], [TPE], [1823], [120], [<NAME>], [AUS], [1823], [121], [PAPAGEORGIOU Konstantinos], [GRE], [1820], [122], [<NAME>], [ITA], [1811], [123], [SORENSEN Mads], [DEN], [1806], [124], [<NAME>], [FRA], [1805], [125], [<NAME>], [BUL], [1802], [126], [LASHIN El-Sayed], [EGY], [1802], [127], [<NAME>], [CHN], [1801], [128], [<NAME>], [AUT], [1801], ) )
https://github.com/SillyFreak/tu-wien-software-engineering-notes
https://raw.githubusercontent.com/SillyFreak/tu-wien-software-engineering-notes/main/template/template.typ
typst
#let notes( title: none, subtitle-lines: (), authors: (), doc, ) = { set document( title: title ) // title page { set page( paper: "a4", margin: (x: 2.8cm, y: 8cm), ) set align(center) set heading(outlined: false) [ #set text(size: 16pt) = #title #v(1cm) #for subtitle in subtitle-lines [ #subtitle ] #v(3cm) #set text(size: 12pt) #for author in authors [ #author ] ] } pagebreak() set page( paper: "a4", margin: (x: 2.8cm, y: 2cm), numbering: "1/1", ) set heading(numbering: "1.") set table(stroke: 0.5pt) outline() pagebreak() doc }
https://github.com/ludwig-austermann/typst-ouset
https://raw.githubusercontent.com/ludwig-austermann/typst-ouset/main/README.md
markdown
MIT License
# ouset Package [GitHub Repository including Examples and Changelog](https://github.com/ludwig-austermann/typst-ouset) This is a small package providing over- and underset functions for math mode in [typst](https://typst.app/). ## Usage To use this package simply `#import "@preview/ouset:{{PACKAGE VERSION}}"`. To import all functions use `: *` and for specific ones, use either the module or as described in the [typst docs](https://typst.app/docs/reference/scripting#modules). The main function provided in this package is `ouset` for math environments. This function can take arbitrary many arguments, but with the following rules: - if the first argument is `&`, a 'alignpoint' is inserted immediately before the symbol - next follows the symbol, then the content to put on top, and then the content to put at the bottom - if the last argument is `&`, a 'alignpoint' is inserted immediately after the symbol There is a named argument `insert-and`, which if false, does not insert an 'alignpoint' in the above cases, but only clips at these points. This package provides furthermore 3 other functions: - `overset(s, t, c: 0, insert-and: true)`: output the symbol s with t on top of it - `underset(s, b, c: 0 insert-and: true)`: output the symbol s with b on below of it - `overunderset(s, t, b, c: 0, insert-and: true)`: output the symbol s with t on top of it and b below it All functions put enough spacing around the operator, such that other content does not interfere with it. However, this spacing can be disabled, by setting `c` to 1, 2 or 3. This is a flag system with - `c=0`: normal spacing on the left and right - `c=1`: left spacing is according to the operator / symbol s and right spacing is normal - `c=2`: left spacing is normal and right spacing according to the operator / symbol s - `c=3`: both spacings are according to the operator / symbol s Hence: clip param `c ∈ {0,1,2,3} ≜ {no clip, left clip, right clip, both clip}` ## Example usage Try something like: - `$ouset(-->,, n->oo)$` - `$ouset(-,1,2)$` - ```typst #import "@preview/ouset:{{PACKAGE VERSION}}": ouset $ M &= sum_(k=0)^oo q^k = 1 + q + q^2 + q^3 + q^4 + dots\ &= 1 + q (1 + q + q^2 + q^3 + dots)\ ouset(&, =, "Def.", "of" M) 1 + q dot M $ ```
https://github.com/eliapasquali/typst-thesis-template
https://raw.githubusercontent.com/eliapasquali/typst-thesis-template/main/structure.typ
typst
Other
// Frontmatter #include "./preface/firstpage.typ" #include "./preface/copyright.typ" #include "./preface/dedication.typ" #include "./preface/summary.typ" #include "./preface/acknowledgements.typ" #include "./preface/table-of-contents.typ" // Mainmatter #counter(page).update(1) #include "./chapters/introduction.typ" #include "./chapters/process.typ" #include "./chapters/stage-description.typ" #include "./chapters/requirements.typ" #include "./chapters/product-design.typ" #include "./chapters/product-testing.typ" #include "./chapters/conclusion.typ" // // Appendix // #include "./appendix/appendice-a.typ" // // Backmatter // // Praticamente il glossario // Bibliography #include("./appendix/bibliography/bibliography.typ")
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/复习/物理实验/0/temple/main.typ
typst
#import "template.typ": * #let data=yaml("./data.yaml") #import "@preview/tablex:0.0.8": tablex, rowspanx, #show: doc => conf( linespacing: 1em, outlinedepth: 3, blind: false, listofimage: true, listoftable: true, listofcode: true, alwaysstartodd: true, doc ) #import "@preview/colorful-boxes:1.3.1": * // = 实验7 // == 原理 // #figure( // align(center, // [#image("img/1.png",width: 35%), // #image("img/2.png",width: 35%)] // ) // , caption: [干涉仪] // ) // 光程的改变可以通过观测干涉条纹来进行分析,光路结构如图1所示,由一个光纤Michelson干涉仪构成。该干涉仪中,作为参考臂和测量的两臂通过使用一个3dB的耦合器对光进行了分路和合路,干涉仪的光程差(OPD)通过一个扫描镜来改变。当二个光束之间光程差小于光源相干长度的时候,就会产生一个白光干涉图。当两光束的光程绝对相等时,光程精确匹配,干涉图出现中央条纹,该中央条纹位于干涉图中心,振幅极大。 // == 结果分析和讨论 // === 实验结论 // === 结果讨论 // === 误差分析 // === 本实验的应用 // === 收获和体会 // === 思考题 // 思考题: // 干涉的基本条件是什么?什么是相干长度?什么是相干时间?二者之间什么关系? // 频率,振动方向相同,相位差恒定;相干长度是两列波在传播过程中相位关系不变,能发生干涉地最大距离; // 基于光纤Michelson干涉仪设计一种传感器(温度、压力、折射率)。 // = 图片 // = 图片 // #import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx // #v(0.5em) // #h(-3em)*插入损耗* // #v(0.5em) // #align(center,[ // #tablex( // columns: 4, // align: center + horizon, // auto-vlines: false, // header-rows: 4, // /* --- header --- */ // [*种类*], [*输入$(m w)$*], // [*输出$(m w)$*], [*插入损耗*], // [单模光纤-单模光纤], [4.234 (5.26dBm)], // [3.313(3.124dBm)], {str({calc.ceil(-10*(calc.log(3.313/4.234)/calc.log(10))*100)}/100)+"dB"}, // [单模光纤-多模光纤], [4.098(6.024dBm)], // [4.007(6.12dBm)], {str({calc.ceil(-10*(calc.log(4.007/4.098)/calc.log(10))*100)}/100)+"0dB"}, // [多模光纤-多模光纤], [11.12(10.24dBm)],[1.198(0.87dBm)],{str({calc.ceil(-10*(calc.log(1.198/11.12)/calc.log(10))*100)}/100)+"0dB"}, // ) // ]) // 其中插入损耗计算为 // $ I_("THP") -10 lg P_("out")/P_("in") $ // #let use_1=(功率,损耗)=>{ // $功率"mw"(损耗 "dBm")$ // } // #let 比值形式=(比值1,比值2)=>{ // let ans=float(比值1)/float(比值2) // ans=calc.round(ans,digits: 3) // $比值1 ":" 比值2 = ans$ // } // #v(0.5em) // #h(-3em)*分光比* // #align(center,[ // #tablex( // columns: 4, // align: center + horizon, // auto-vlines: false, // header-rows: 4, // /* --- header --- */ // [*输入端*], [*输出端*], // [*功率*], [*分光比*], // rowspanx(2)[白],[红],[#use_1(1.6,2.1)],rowspanx(2)[#比值形式(1.6,1.67)],[蓝],[#use_1(1.67,2.27)] // , // rowspanx(2)[黑],[红],[#use_1(1.618,2.31)],rowspanx(2)[#比值形式(1.618,1.609)],[蓝],[#use_1(1.609,2.29)] // , // rowspanx(2)[红], // [白],[#use_1(1.706,2.39)], // rowspanx(2)[#比值形式(1.706,1.698)], // [黑],[#use_1(1.698,2.3)], // rowspanx(2)[蓝], // [白],[#use_1(1.746,2.59)], // rowspanx(2)[#比值形式(1.746,1.728)], // [黑],[#use_1(1.728,2.34)] // ) // ]) // 分光比计算公式为 // $ alpha=P_3/P_4 $ // 光衰减器 // 加衰减器后 // $ 2.587mu w (-24.67"dBm")- 500u w (-3.09"dBm") $ // 衰减范围 // $ 24.67"dBm"-3.09"dBm" $ // *菲涅尔反射* // #let 菲涅尔反射 = (输入功率,a1,输出功率,a2)=>{ // let ans=2*(输入功率*calc.pow(10,(a1)))/(输出功率*calc.pow(10,(a2))) // ans=calc.ceil(ans*10000)/100 // $ 2*P_("IN")/P_("OUT")= (2 times 输入功率 times 10^(a1))/ (输出功率 times 10^(a2))= ans "%" $ // } // 输入端光功率$17.89mu w$,输除端光功率$1.089m w$ // #菲涅尔反射(17.89,-6,1.066,-3) // #import "img/ctez/散点图.typ":* // #散点图2 = 思考题 == 光纤的操作与处理 #h(-2em) 1. *学习回波损耗的概念,设计一个能测试回波损耗的光路(2021251124古翱翔)* *回波损耗定义*: 当入射光传输至光器件时,入射光总有部分光被光器件反射回来。其中后向反射光功率与入射光功率的比值称为该器件的反射率R。光回波损耗和反射率定义为 $ R=P_(#text(font: "Source Han Serif")[后向])/P_(#text(font: "Source Han Serif")[入射光功率]) #h(3em) R_L("dB")=lg(1/R) $ *设计题*: 光回波损耗的测试方法主要有相干域反射法(OCDR),光时域反射法(OTDR)和光连续波反射法(OCWR)三种。 这里采用最简单的*光连续波反射法* 由图可得 $ P_I=P_s times k_1 , P_("RD")=P_(I) R_("DUT"), P_("DD")=P_("RD")k_2+P_s S $ #h(2em) 待测件的光回波损耗RL(dB)为 $ R_L("dB")=10lg(1/R_("DUT"))=10lg(P_I/P_("RD")) $ #figure( align(center, image("img/3.png",width: 80%) ) , caption: [] ) == 光纤的焊接与损耗 #h(-2em)*1. 光纤接续的方法有哪些种,比较并说明如何选择*(2021251124古翱翔) 熔接法和粘接法。优点是损耗小,可靠,受外界影响小,缺点是需要昂贵的熔接设备。适用于需要长期固定连接,如光缆等。 活动连接 优点是灵活,简单,缺点是会有较大的损耗。适用于经常需要插拔的场合。 #h(-2em)*2. 简述光纤焊接工具结构及其光纤焊接过程*(2021251124古翱翔) #import "img/ctez/散点图.typ":* // #散点图1 #散点图2 #散点图3 #散点图4
https://github.com/flaribbit/typst-tetris
https://raw.githubusercontent.com/flaribbit/typst-tetris/main/tetris.typ
typst
#let blocks_data=( // ZSLJTOI ((0,2),(1,2),(1,1),(2,1)), ((0,1),(1,1),(1,2),(2,2)), ((0,1),(1,1),(2,1),(2,2)), ((0,1),(1,1),(2,1),(0,2)), ((0,1),(1,1),(2,1),(1,2)), ((1,1),(2,1),(1,2),(2,2)), ((0,2),(1,2),(2,2),(3,2)), ) #let block_center=((1,1),(1,1),(1,1),(1,1),(1,1),(1.5,1.5),(1.5,1.5)) #let kick_data1=( // for ZSLJT (( 0, 0),(-1, 0),(-1, 1),( 0,-2),(-1,-2)), // 0->R (( 0, 0),( 1, 0),( 1,-1),( 0, 2),( 1, 2)), // R->2 (( 0, 0),( 1, 0),( 1, 1),( 0,-2),( 1,-2)), // 2->L (( 0, 0),(-1, 0),(-1,-1),( 0, 2),(-1, 2)), // L->0 (( 0, 0),( 1, 0),( 1, 1),( 0,-2),( 1,-2)), // 0->L (( 0, 0),( 1, 0),( 1,-1),( 0, 2),( 1, 2)), // R->0 (( 0, 0),(-1, 0),(-1, 1),( 0,-2),(-1,-2)), // 2->R (( 0, 0),(-1, 0),(-1,-1),( 0, 2),(-1, 2)), // L->2 ) #let kick_data2=( // for I (( 0, 0),(-2, 0),( 1, 0),(-2,-1),( 1, 2)), // 0->R (( 0, 0),(-1, 0),( 2, 0),(-1, 2),( 2,-1)), // R->2 (( 0, 0),( 2, 0),(-1, 0),( 2, 1),(-1,-2)), // 2->L (( 0, 0),( 1, 0),(-2, 0),( 1,-2),(-2, 1)), // L->0 (( 0, 0),(-1, 0),( 2, 0),(-1, 2),( 2,-1)), // 0->L (( 0, 0),( 2, 0),(-1, 0),( 2, 1),(-1,-2)), // R->0 (( 0, 0),( 1, 0),(-2, 0),( 1,-2),(-2, 1)), // 2->R (( 0, 0),(-2, 0),( 1, 0),(-2,-1),( 1, 2)), // L->2 ) #let color_data=(rgb("#F44336"),rgb("#4caf50"),rgb("#ff9800"),rgb("#2196f3"),rgb("#9c27b0"),rgb("#ffeb3b"),rgb("#00bcd4")) #let check(field,hand)={ for i in range(4){ let (x,y)=hand.data.at(i) x=int(x+hand.x) y=int(y+hand.y) if x< 0 or x>=10 or y< 0 or y>=20 or field.at(y).at(x)!=0{ return false } } return true } #let turn_left(field,hand)={ let newhand=hand newhand.rot=calc.rem(newhand.rot+3,4) let (o1,o2)=block_center.at(hand.id -1) for i in range(4){ let (p1,p2)=hand.data.at(i) newhand.data.at(i)=(o1 -(p2 -o2),o2+(p1 -o1)) } let kickdata=if hand.id==7{kick_data2}else{kick_data1} for i in range(5){ let (dx,dy)=kickdata.at(hand.rot+4).at(i) newhand.x=hand.x+dx newhand.y=hand.y+dy if check(field,newhand){ return newhand } } return hand } #let turn_right(field,hand)={ let newhand=hand newhand.rot=calc.rem(newhand.rot+1,4) let (o1,o2)=block_center.at(hand.id -1) for i in range(4){ let (p1,p2)=hand.data.at(i) newhand.data.at(i)=(o1+(p2 -o2),o2 -(p1 -o1)) } let kickdata=if hand.id==7{kick_data2}else{kick_data1} for i in range(5){ let (dx,dy)=kickdata.at(hand.rot).at(i) newhand.x=hand.x+dx newhand.y=hand.y+dy if check(field,newhand){ return newhand } } return hand } #let move_left(field,hand)={ let newhand=hand newhand.x=hand.x -1 if check(field,newhand){ return newhand } return hand } #let move_right(field,hand)={ let newhand=hand newhand.x=hand.x+1 if check(field,newhand){ return newhand } return hand } #let move_down(field,hand)={ let newhand=hand newhand.y=hand.y -1 if check(field,newhand){ return newhand } return hand } #let drop(field,hand)={ let newhand=hand while true{ newhand.y=hand.y -1 if check(field,newhand){ hand=newhand }else{ break } } return hand } #let line_full(line)={ for i in range(10){ if line.at(i)==0{ return false } } return true } #let lock(field,hand)={ for i in range(4){ let (x,y)=hand.data.at(i) x=int(x+hand.x) y=int(y+hand.y) field.at(y).at(x)=hand.id } // check clear let j=0 for i in range(20){ if not line_full(field.at(i)){ if i!=j{ field.at(j)=field.at(i) } j=j+1 } } for i in range(j,20){ field.at(i)=(0,0,0,0,0,0,0,0,0,0) } field } #let tetris(keys)={ let hand=(data:none,id:3,rot:0,x:3,y:17) let field=range(20).map(_=>(0,0,0,0,0,0,0,0,0,0)) hand.data=blocks_data.at(hand.id -1) if "text" in keys.fields(){ for (i,key) in keys.text.codepoints().enumerate(){ if key=="a"{ hand=move_left(field,hand) }else if key=="d"{ hand=move_right(field,hand) }else if key=="s"{ hand=move_down(field,hand) }else if key=="w"{ hand=drop(field,hand) field=lock(field,hand) hand=(data:none,id:calc.rem(i,7)+1,rot:0,x:3,y:17) hand.data=blocks_data.at(hand.id -1) }else if key=="j"{ hand=turn_left(field,hand) }else if key=="k"{ hand=turn_right(field,hand) } } } rect(width: 100pt, height: 200pt, inset: 0pt, { for i in range(20){ for j in range(10){ let block=field.at(i).at(j) if block==0{ continue } place(top+left, dx:10pt*j, dy:10pt*(19-i), rect(width: 10pt, height: 10pt, fill: color_data.at(block -1))) } } for i in range(4){ let (x,y)=hand.data.at(i) x=x+hand.x y=y+hand.y place(top+left, dx:10pt*x, dy:10pt*(19-y), rect(width: 10pt, height: 10pt, fill: color_data.at(hand.id -1))) } }) } #tetris[]
https://github.com/iceghost/typst-at-hcmut
https://raw.githubusercontent.com/iceghost/typst-at-hcmut/main/contents/03/00.typ
typst
Apache License 2.0
= Sử dụng Việc sử dụng trên web app đơn giản rồi. Mình hướng dẫn trên máy tính cá nhân. == Compile và edit Flow đơn giản là bạn treo lệnh này trong terminal: ```console typst watch main.typ ``` Sau đó bạn sẽ đi edit các file thoải mái. Cho đến khi có lỗi xảy ra hoặc file pdf không như ý muốn, bạn mở terminal lên để xem nó báo lỗi gì rồi fix. == Preview Sau khi nó compile xong xuôi, không có lỗi gì, bạn sẽ thấy xuất hiện file `main.pdf` ở ngoài cùng. Bạn có thể sử dụng phần mềm đọc PDF yêu thích của bạn để mở file pdf được compile. Trên Windows, mình gợi ý phần mềm #link("https://www.sumatrapdfreader.org/free-pdf-reader", [SumatraPDF]), vì nó có thể: - Auto reload file PDF mượt mà khi compile. - Có _dark mode_. #footnote([Thật ra là _invert color_ thôi, nhấn phím `I`]) #figure(caption: [Dark mode đây, không điêu], image("screenshot.png") ) Trên MacOS, mình thấy phần mềm `Preview.app` mặc định xài ngon. Trên VSCode cũng có extension để xem pdf, nhưng cá nhân mình thấy không ngon lắm vì mỗi lần reload nó trắng tinh. Ngoài ra, các bạn cẩn thận khi xài Acrobat Reader vì phần mềm này block không cho compile file pdf mới khi nó đang mở.
https://github.com/drupol/ipc2023
https://raw.githubusercontent.com/drupol/ipc2023/main/src/ipc2023/package-manager.typ
typst
#import "imports/preamble.typ": * #focus-slide[ #set align(center + horizon) #set text(size: 1.5em, fill: white, font: "Virgil 3 YOFF") Nix is just#uncover("2-4")[.]#uncover("3-4")[.]#uncover("4-4")[.] #uncover("5-")[a *package manager*] #pdfpc.speaker-note(```md A few slides back, I introduced NixOS; now, let's shift our focus to Nix. You might be wondering, where is this all leading? Well, our aim is to deepen our understanding of these tools. As I just said, Nix is a package manager, at first. And NixOS is a Linux distribution built on top of Nix, just like what apt is to Debian for example. Easy, right? Well, that wraps it up! Thank you all for coming, enjoy your lunch! Just kidding! There's so much more to delve into. However, during the making of this presentation, I had to make some choices. Also, covering all the features and nuances would take well over an hour, so I hope you won't mind if we take some shortcuts. ```) ] #slide(title: "The package manager", new-section: "Nix")[ #let cell = box.with() #grid( columns: (1fr, 2fr), cell(height: 100%)[ #uncover("1,9-", mode: "transparent")[- Portability] #uncover("2,9-", mode: "transparent")[- Immutable] #uncover("3,9-", mode: "transparent")[- Declarative] #uncover("4,9-", mode: "transparent")[- Atomic updates] #uncover("5-7,9-", mode: "transparent")[- Package repository] #uncover("8,9-", mode: "transparent")[- Easy to contribute] #uncover("9,9-", mode: "transparent")[- Reproducibility] ], cell(height: 100%, width: 100%)[ #set text(size: 15pt) #only("1")[ #set text(size: .5em) #figure( image("../../resources/screenshots/Screenshot_20231015_192226.png", height: 90%), caption:[ #link("https://www.reddit.com/r/linux/comments/nt1tm9/i_made_a_uniform_icon_set_of_linux_distribution/")[reddit.com] ] ) ] #only("2")[ #set text(size: .5em) #figure( image("../../resources/screenshots/Screenshot_20231015_193514.png", fit: "contain") ) ] #only("3")[ #set text(size: .5em) #figure( image("../../resources/images/Untitled-2023-10-14-2343.png", height: 90%), caption:[Programming paradigms] ) ] #only("4")[ #figure( image("../../resources/images/ds.png", height: 90%) ) #show par: set block(spacing: 0.40em) #place(center, dx: -55pt, dy: -301pt)[#text(size: 1.2em, font: "Virgil 3 YOFF", fill: rgb("#000000"))[#rotate(-21deg)[ Don't update ]]] #place(center, dx: 20pt, dy: -300pt)[#text(size: 1.05em, font: "Virgil 3 YOFF", fill: rgb("#000000"))[#rotate(-21deg)[Update]]] ] #only("5")[ #set text(size: .5em) #figure( image("../../resources/images/map_repo_size_fresh.svg", height: 90%), caption:[ #link("https://repology.org/repositories/graphs")[https://repology.org/repositories/graphs] ] ) ] #only("6")[ #set text(size: .5em) #figure( image("../../resources/images/map_repo_size_fresh.svg", height: 90%), caption:[ #link("https://repology.org/repositories/graphs")[https://repology.org/repositories/graphs] ] ) #place(top + right, dx: -2.7cm, dy: .9cm)[ #rotate(-25deg)[ #image("../../resources/images/arrow.svg", width: 200pt), ] ] #place(top, dx: 2cm, dy: 3cm)[ #text(size: 6em, font: "Virgil 3 YOFF", fill: rgb("#000000"))[nix is here!] ] ] #only("7")[ #set text(size: .5em) #figure( image("../../resources/screenshots/Screenshot_20231015_191236.png", height: 90%), caption:[ #link("https://repology.org/repository/nix_unstable")[https://repology.org/repository/nix_unstable] ] ) ] #only("8")[ #set text(size: .5em) #figure( image("../../resources/screenshots/23fd43389a1dfeb3.png", height: 90%), caption:[ #link("https://github.com/NixOS/nixpkgs/pulse/monthly")[https://github.com/NixOS/nixpkgs/pulse/monthly] ] ) ] #only("9")[ #set align(center) #figure( image("../../resources/images/essawy-triangle.png", height: 90%), caption: [ Adapted from Essawy et al. 2020 @ESSAWY2020104753 ] ) ] ] ) #pdfpc.speaker-note(```md - Nix is portable. It works on every Linux distributions. There is no difference in using Nix on your favorite linux distribution than on any other. - Nix is a package manager, but not like the others. It is immutable, which means that once a package is built, it cannot be modified. It is not like other package managers where you can install a package, then modify it, then install another package that depends on the first one, and so on. - In Nix, once a package is built, it cannot be modified. If you want to modify it from where it has been installed, you have to rebuild it. Nix uses a content-addressed store, which means that every package is identified by a hash of its content. This is what makes Nix immutable. This is what we can see on this screenshot, we can see that the php interpreter is installed in a very specific directory that looks like a hash and it's content is not writable by anybody. - Unlike the PHP language which is mostly imperative, the package manager uses a declarative language, a more functional approach to package management. - Nix performs upgrades atomically, meaning either all changes are made or none are. Additionally, it's easy to roll back to a previous configuration. - The package repository of Nix is called `nixpkgs`. It is a huge repository of expressions (or recipes), and it is growing every day. It is the biggest package repository of any Linux distribution as we can see on this slide. - It's also very easy to contribute, here's the activity of the repository over the last month. As you can see, it is very active. Later in the presentation I'll show you how easy it is to contribute. - Nix is trying to be as reproducible as possible. Meaning that when you build something with Nix, it put you in the good conditions to be able to rebuild it anywhere else and get the same result. About reproducibility, I don't know if you're aware of this concept yet, but let me explain what it is. ```) ]
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/completion/sig_dict_rest.typ
typst
Apache License 2.0
// contains: paint,cap #text(stroke: (paint: red, /* range after 1..2 */ ))[]
https://github.com/ern1/typiskt
https://raw.githubusercontent.com/ern1/typiskt/main/templates/util.typ
typst
/*#show "ArtosFlow": name => box[ #box(image( "assets/dog1.png", height: 0.9em, )) #name ]*/ // TODO: Bör använda sig av baseline istället för move? #let imageIcon(path, h: 0.9em) = { box(move(dy: h/6, image( path, height: h, ))) } #let iconWithText(iconPath, str, h: 1.0em) = box[ #imageIcon(iconPath, h: h) #"" #str ] #let iconWithTextHighlight(iconPath, color, str, h: 1.0em) = box( //baseline: 2pt, fill: color, inset: (x: 3pt, y: 0pt), outset: (y: 2pt), radius: 5pt, move(dy: -2pt)[ #imageIcon(iconPath, h: h) #str ] ) #let textColorMap(str, skillLevel, colorHigh: green, colorLow: red) = text(fill: gradient.linear( (colorHigh, 0%), (colorLow, skillLevel), (colorLow, 100%), ), str ) // Maybe could use location() #let addDividers(..items, charPerRow: 30, divider: " | ") = { let n = 1 for it in items { if v != "" { // Adds linebreak after charPerRow items have been added if n > charPerRow + it.len() { linebreak() n = 1 } if n != 1 { divider } it } n = n + it.len() } } /* Tester*/ //#imageIcon("assets/dog1.png", h: 1em) //#imageIcon("assets/dog1.png", h: 1em) //#iconWithText("assets/dog1.png", "texr", h:1em) /*#let linkItemStyle(icon, liink, iconColor: accentColor, linkColor: accentColor2) = { set text(fill: linkColor) box(height: 1em, baseline: 20%, fill: linkColor)[ #pad(left: 0.4em)[#image(item.icon)] ] + h(2pt) liink }*/
https://github.com/danbalarin/typst-templates
https://raw.githubusercontent.com/danbalarin/typst-templates/main/vse-assignment/README.md
markdown
# VSE Assignment template Template used for assignments on University of Economics in Prague, Faculty of Informatics. ## Usage Copy the content of `template.typ` and paste it into the Typst editor. Copy `vse-fis.png` and paste it into the same directory as the `template.typ` file. In the document entry point add following lines: ```typst #import "template.typ": * #show: project.with( title: "", subtitle: "", // Optional place: "", // Optional, must be used with date date: "", // Optional, must be used with place authors: ( // Optional (but recommended) "<NAME>", ), ) Your text goes here. ```
https://github.com/PgBiel/typst-truthtable
https://raw.githubusercontent.com/PgBiel/typst-truthtable/main/examples/example.typ
typst
MIT License
#import "../truthtable.typ": truth-table, l-and, l-imp, l-iff, l-not, l-or, l-var, l-operator, l-logic-convert, l-parens-repr-if-composite, l-expr-tree #set text(font: "Linux Libertine") #align(center, text(17pt)[*Some truth table examples*]) Importing some names with: ```typ #import "../truthtable.typ": truth-table, l-and, l-or, l-imp, l-iff, l-not, l-var, l-operator, l-expr-tree ``` Import more as needed (do note, however, that there are several "private" functions, so importing everything at once might be excessive). #let expression = l-or("A", l-imp("B", "C")) 1. For #expression.repr: ```typ #let expression = l-or("A", l-imp("B", "C")) For #expression.repr: #truth-table(expression) ``` #truth-table(expression) It has the following tree: ```typ #l-expr-tree(expression).flatten().map(c => c.repr).join([; ]) ``` #l-expr-tree(expression).flatten().map(c => c.repr).join([; ]) 2. *Customize T/F:* ```typ #let expression = l-iff("A", l-not(l-and("A", "A"))) #truth-table(expression, repr_true: 1, repr_false: 0) ``` #let expression = l-iff("A", l-not(l-and("A", "A"))) #truth-table(expression, repr_true: 1, repr_false: 0) 3. *Skip a column:* ```typ #let expression = l-iff("A", l-not(l-and("A", "A"), skip: true)) #truth-table(expression, repr_true: 1, repr_false: 0) ``` #let expression = l-iff("A", l-not(l-and("A", "A"), skip: true)) #truth-table(expression, repr_true: 1, repr_false: 0) 4. *Specify a custom text representation for your variables:* Use `l-var`: ```typ #let expression = l-iff(l-var("P+Q", repr: $P(x) + Q(x)$), l-not(l-var("R", repr: $R(x)$))) #truth-table(expression, repr_true: 1, repr_false: 0) ``` #let expression = l-iff(l-var("P+Q", repr: $P(x) + Q(x)$), l-not(l-var("R", repr: $R(x)$))) #truth-table(expression, repr_true: 1, repr_false: 0) 5. *Customize the table:* Pass table parameters directly: ```typ #let expression = l-iff("A", l-not(l-and("A", "A"), skip: true)) #truth-table(expression, repr_true: 1, repr_false: 0, fill: yellow, stroke: 5pt + blue) ``` #let expression = l-iff("A", l-not(l-and("A", "A"), skip: true)) #truth-table(expression, repr_true: 1, repr_false: 0, fill: yellow, stroke: 5pt + blue) 6. *Creating a custom operator:* Use `l-operator`. See the sample code below: ```typ #let my-xor(a, b, skip: false) = { // convert bools and strings // to l-bool and l-var objects let a = l-logic-convert(a) let b = l-logic-convert(b) // automatically place parentheses around a and/or b // if they are composite expressions with 2+ children let a_repr = l-parens-repr-if-composite(a) let b_repr = l-parens-repr-if-composite(b) l-operator( "MY_XOR", a, b, value: mapping => { let a_val = (a.value)(mapping) // consider the given map of (VARIABLE: bool) let b_val = (b.value)(mapping) ((a_val or b_val) and not (a_val and b_val)) }, repr: $ #a_repr space dot(or) space #b_repr $, skip: skip ) } #let expression = my-xor("A", "B") #expression.repr #align(center, truth-table(expression)) ``` #let my-xor(a, b, skip: false) = { let a = l-logic-convert(a) let b = l-logic-convert(b) // automatically place parentheses around a and/or b // if they are composite expressions with 2+ children let a_repr = l-parens-repr-if-composite(a) let b_repr = l-parens-repr-if-composite(b) l-operator( "MY_XOR", a, b, value: mapping => { let a_val = (a.value)(mapping) // consider the given map of (VARIABLE: bool) let b_val = (b.value)(mapping) ((a_val or b_val) and not (a_val and b_val)) }, repr: $#a_repr space dot(or) space #b_repr$, skip: skip ) } #let expression = my-xor("A", "B") $ #expression.repr $ #align(center, truth-table(expression))
https://github.com/jamesrswift/dining-table
https://raw.githubusercontent.com/jamesrswift/dining-table/main/src/lib.typ
typst
The Unlicense
#import "note.typ" as note #import "styles.typ": * #import "impl.typ": make
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/021%20-%20Battle%20for%20Zendikar/014_Promises%20to%20Keep.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Promises to Keep", set_name: "Battle for Zendikar", story_date: datetime(day: 02, month: 12, year: 2015), author: "<NAME>", doc ) #emph[Weeks ago, <NAME> decided against getting involved with Zendikar's woes. She remains on the plane of Regatha, where she has accepted the position of abbot for a monastery of pyromancer-monks. Her thoughts often stray to the battle currently raging on Zendikar, the pain her friends might be suffering there—and the help she could be providing. But she has made a promise to fulfill her duties on Regatha, and a promise is a promise.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Sleep wasn't forthcoming, and wasn't an option anyway. A pile of parchment pages lay on the floor of Chandra's bedchamber. Even with her back shoved as far as it could go into the corner of the room, Chandra could still read the lines she had written on the topmost page: #emph[MY INSPIRING ORATION] #emph[BY ABBOT NALAAR] That was all. The quill was in the same place she had left it—jammed headfirst into the masonry. Chandra felt her brain trying to writhe out of her skull. Tomorrow she would give the traditional Mount Keralia Address. Tomorrow she would impress Mother Luti and all her students with a well-planned litany of self-assured pyromantic demonstrations, some rousing words that probably evoked their beloved Jaya, and maybe some fire-based metaphors. She would prove herself worthy of being the abbot of Keral Keep, as every abbot had since the beginning of time, probably. She flopped back on her bed in her abbot's robe, staring up at the ceiling of her bedchamber. #emph[This is the life you've chosen] , she reminded herself. She had made a promise. No matter what was happening on Zendikar, no matter how much they might need her, no matter how #emph[freeing] it might be to be part of that battle. This was her role now. #figure(image("014_Promises to Keep/01.jpg", width: 100%), caption: [Mountain | Art by <NAME>], supplement: none, numbering: none) She regarded the quill stuck in the wall, and slowly her eyes shifted to the door. She stood and walked to the doorway. She leaned out, glancing back and forth down the corridors of the Keep. Shadows danced from flickering braziers: the night lanterns. The Keep would be silent for hours. #emph[This is what keeping a promise feels like] , she told herself. #emph[You're not a child anymore. This is taking—] she balanced herself against the doorframe with one hand and forced herself to think the next word—#emph[responsibility.] She bit her lip, standing in the doorway, checking back and forth along the hallway once more. Then she closed the door of her chamber firmly. She glanced down at the unwritten speech, and at the almost-untouched pot of ink. She planted her feet and cinched her abbot's robe around her waist, and glared straight ahead at the opposite wall. #emph[Just one peek] , she thought. She pressed her will against the whereness around her, forcing it to change. #emph[Zendikar] . Her bedchamber dissolved. The walls became humid night air. The stone floor became a pebbled slope. The ceiling became a dark sky strewn with floating land masses and tilted diamond shapes. She crouched instinctively. It had been hundreds of days, maybe a thousand, since the dirt of Zendikar had smudged her face. She could still smell the rich earth, the untrammeled purity of the place, the crisp edge of warning on the air. But there was something new—a smell of dry dust. A drained smell. Her heart pounded. She wiped her palms on her ceremonial robe. She felt suddenly unprepared, ill-equipped for Zendikar's vast danger. It stole her breath away. #figure(image("014_Promises to Keep/02.jpg", width: 100%), caption: [Skyline Cascade | Art by <NAME>], supplement: none, numbering: none) She was surrounded by twirling-trunked trees and spiky crags. She hurried to high ground to get a glimpse of where she was. The land fell away before her, leading down to a shimmering sea. Beyond the sea rose a city of white stone towers—Sea Gate! She had managed to planeswalk close to her goal, close to where Gideon had said to find him. The white towers were anchored by a mighty seawall, and over the sea floated a semicircular collection of hedrons, their runes glimmering in the night, reflecting in the tips of the waves. In the distance, Chandra saw a strange, vast silhouette on the horizon that she didn't recognize. It was probably one of Zendikar's gravity-defying mountain ranges or monumental landforms, distorted into enormity by the dim light. And just below her, at the base of a cliff, were people. Some of whom she knew. Gideon was shouting directives, looking as natural in a leadership role as in his armor. "Careful now—that's good," Gideon was saying. "All right. Gate team, pull!" Chandra followed Gideon's eye line. One of the larger hedrons, hovering over the water, was #emph[moving] . In fact, she could see teams of figures guiding it along the surface of the water, hauling it through the air with heavy ropes and nudging spells. Kor ropeworkers along the seawall pulled on their guidelines, shepherding the hedron gradually into place. "And—halt it there!" Gideon shouted. A second team pulled in an opposite direction. The moving hedron slowed to a halt in its place in the circle. "Placement's good," Gideon said. "Altitude's good. Next team, prepare your lines!" #emph[They're doing it] , she thought. #emph[My friends are doing it. They've come here, and they're helping. They're saving this world] . Chandra made an involuntary fist-swipe of pride—causing her to stumble with vertigo at the cliff's edge. She caught herself, but a cluster of pebbles tumbled down the trail behind her. "Eyes on! Eyes on!" came a woman's shout from above her. Chandra ducked down between two curving trees, glancing her head against a bough, and looked up. Overhead flew a scout: a sky-manta's broad body gliding through the air, with an elf woman at the reins. The manta pivoted sharply, and the scout peered down across the area where Chandra hid. #figure(image("014_Promises to Keep/03.jpg", width: 100%), caption: [Skyrider Elf | Art by <NAME>cott], supplement: none, numbering: none) "Movement in the trees, that way!" the elf called down. She heard Gideon reply from below. "Take another pass," he shouted. "I need to know how many, and how big." The manta rider began a wide turn to double back to Chandra's position. Chandra only had moments before the scout's sharp eyes would discover her. Chandra wasn't here to stay. #emph[Just one peek.] Chandra dashed down the trail she had climbed up, half-skidding down the slope. She began to slide on the loose rocks, and managed to catch herself on an arc-shaped crag—only to run into another species of trouble entirely. When she stopped herself, she was face-to-faceplate with a trio of angular, meaty-ribbed, bony-headed creatures. They had the unsettling impression of wearing their insides as their outsides. #figure(image("014_Promises to Keep/04.jpg", width: 100%), caption: [Eyeless Watcher | Art by <NAME>], supplement: none, numbering: none) #emph[Eldrazi] . These were Eldrazi. The creatures that afflicted this world, that Gideon and Jace had asked for her help in fighting. The largest one let out a rattling, whistling hiss, and the others answered in kind, moving toward Chandra. "No, no, no," she whispered. Chandra glanced up. The elf scout was swinging back in her direction, but had not yet completed her turn. She looked back at her opponents just in time to see one of them slicing at her face with a bladelike leg. She dodged, but another of the Eldrazi was upon her, pinning her arm against a boulder. She ripped her arm free, but the third leaped on top of her, grasping at her jaw and hair with slimy pincers. "Manners!" she murmured, grabbing a handful of sternum and hurling the creature off of her. The largest one collapsed onto her, forcing its weight down onto her shoulders, adding to the weight of her robe. She felt the Eldrazi's serrated front limbs trying to immobilize her—or crush her flat. She grunted under its weight, trying to maintain her footing. Her spine bent painfully, and she fell onto her knees. She pushed up at the creature's legs, and its spines sank into her hands. Still it pressed down, and Chandra's grimace of effort became a snarl. She summoned all her strength, set her feet, and shoved back at it. "Rah-#emph[AGHH!] " The thing tumbled off of her, and she was free for the moment. The sky manta passed over her. Had the scout seen her? The elf scout whistled, and the flyer wheeled again, sinking lower as it turned back toward Chandra. There was no time. Chandra eyed the Eldrazi creatures, and felt her skin prickle with heat. She tucked and spun her body, and the spin became rage, and the rage became fire. #figure(image("014_Promises to Keep/05.jpg", width: 100%), caption: [Flames of the Firebrand | Art by <NAME>], supplement: none, numbering: none) She emitted a dome of flame, pushing out from her body in all directions. For a moment all she saw was the flash of her own fire, but then she saw the night around her again, and the creatures were on their backs, but still alive. Their scorched bodies and legs scrambled for purchase. #emph[No time no time no time.] They clambered upright and rattle-shrieked at her. She crossed her forearms in front of her, built up mana from the mountain under her feet—and slashed her arms out to her sides, creating a tripartite blade of fire that sliced through each one of them. The creatures went still, each one silently wafting smoke from its own personal grave-crater. She squeezed her fists in triumph. She half-shouted out, but caught herself and slapped a hand over her mouth. She glanced up again, sidestepping back under the tree line. The elf scout passed over her, eyes glued to the smoking Eldrazi corpses. Her body trembled, a drumbeat of dread and exhilaration hammering inside her. She pressed her back against a tree trunk, covering the reflective glass of her goggles with the sleeve of her robe, hoping to stay hidden. #emph[That's it. That's all I came for. Just to know they're safe. Just to know—that they don't need me.] She began her planeswalk back to Regatha. The landscape of Zendikar began to melt around her. She allowed herself one more glance back at Gideon and the others. That's when she saw that shape on the horizon—the thing she had dismissed as a floating landmass or irregular mountain. In the first rays of predawn, she could see that the giant shape on the horizon #emph[moved] . It slowly undulated its limbs, which meant it had #emph[limbs] . Its twin jawbones shone pale and jagged in the night. It wasn't just looming. It was #emph[approaching] . It was heading toward Sea Gate, toward Gideon and the others, carving its death-path across the world. It threatened to destroy all life in its way. The creatures she had fought—those were insignificant compared to this monstrosity. This—Ulamog—#emph[this] was what the true battle was about. #emph[This] was what caused that death-dust smell that was new to the world, and what her compatriots were risking their lives to confront. #figure(image("014_Promises to Keep/06.jpg", width: 100%), caption: [Ulamog, the Ceaseless Hunger | Art by <NAME>], supplement: none, numbering: none) This was what she had helped unleash. —But the image of Ulamog dissolved, an undulating shadow on her retinas. She was already planeswalking away from there. Regatha faded into existence around her, replacing the stretch of land that led to the hedrons, that led to her friends, that led to the Eldrazi titan. Her bedchamber brightened as it formed around her, morning light streaking in the windows. "#emph[No] ," she said aloud. The sound of urgent knocking at the door came to Chandra's ears as the world resolved. The door jerked open, and Mother Luti's irritated face emerged. To Chandra, it looked like she was shimmering through a still-lingering afterimage of Ulamog. "Chandra?" Mother Luti scolded. "Are you #emph[ready?] The Address! The chants have already started!" Chandra's mouth hung open. "You will #emph[not] shirk your responsibilities here, <NAME>," said Mother Luti. "You will #emph[not] break your promise." With that, Mother Luti stormed off down the corridor. Chandra slowly closed her mouth. She was still wearing the robe—Serenok's robe. The embroidered mantle had a tiny tear in the sleeve now, from where an Eldrazi's serrated pincer had lanced into her bicep. Swimming in a surreal fog, she walked two steps, bent down, and picked up the sheaf of parchment pages: her speech. #emph[MY INSPIRING ORATION] , the top page read, scrawled in her own hand. #emph[BY ABBOT NALAAR.] She looked at the door. It led to the rest of the Keep, to her students, to Mother Luti, to Regatha. Her feet just didn't know how to move toward it. Suddenly she crunched the pages into a clumped ball in her hands. The pages burst into flames, burning up in a flash. She let them drop as flakes of ash out of her fingers. #emph[This is what it feels like to keep a promise] , she thought. She stepped out of her room, the form of Ulamog still imprinted on her mind. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The abbot greeted her students with a nod of her head. So many faces looking back at her across the great hall of Keral Keep. Mother Luti looked on from the back. "Good, um, morning," she said. She clung to the stone obelisk that acted as her podium, trying to remember how words worked. She coughed into her robe's sleeve. She furrowed her brow, trying to recall some Abbot Serenok sayings. "Fire is a symbol," she said stiffly. "For the—well, fire. In all our hearts." Somehow that had come out better when Serenok said it. Monks looked at one another. Somebody cleared their throat. "We must be sure to..." she trailed off, looking at the podium in front of her. "Stoke! That fire. So that it. Uh." She glanced up and saw Mother Luti's face. That was a mistake. Chandra rubbed her temples with her forefingers. She coughed. She took a breath. "Look," she said. "When I came here as a child, I was a mess. I had no idea what to do with #emph[this] thing, at all." She raised her hand, and it blossomed with fire. She shook her hand and the fire went out again. "The people of this place—<NAME>, <NAME>, all of you—you #emph[showed] me. You didn't try to control me. You didn't try to change me. You taught me how to express who I was in my own way." She looked out at the dozens of individual faces before her. "If there's anything I can do to repay that favor, it's to encourage you to do the same thing. Each of you is a separate, individual #emph[you] . You are not the fire-monks of Keral Keep, not really. You are not the devotees of the teachings of Jaya. You are not here to listen to me or any other abbot. You are a unique person, with wild ideas about what's truly important. You're only here because it's a place where you're allowed to find out #emph[who you are] ." #emph[Am I really saying this] , she thought. #emph[Am I saying what I think I'm saying? ] Chandra looked for Mother Luti's face, but couldn't find her in the crowd anymore. "I'm sorry to those I'm disappointing right now," Chandra continued. "But the best way I know to honor the tradition of the Mount Keralia Address is to tell you to #emph[stop listening] to this Mount Keralia Address." The monks looked at one another again. Chandra undid the belt of the abbot's robe, pulled her arms out of the sleeves, and shouldered out of it—she wore her usual armor underneath. She let the robe hang from her hands, gently, the way one holds an important treasure that was meant for someone else. "Each of you has a gift that only you can bring to the world. A way you can help that others couldn't. And the way you express that gift is to hear this: trust yourself. Trust your gift. Don't put all your reliance in speeches, from me or anyone else." Some of the monks slowly stood. Heads nodded. She saw the sparkle of a few smiles. "There are purposes for you out there, more important than a tradition or an address," she went on. "Crises that you should be part of right now, problems that won't be solved without you. I urge you to #emph[go] . Go and find out what they are." She bowed her head, raising Serenok's robe as a kind of salute. "Thank you." Many monks shook their heads, mouths curved in disappointment. But a few others cheered and threw up their fists. She felt them come alive, saw their eyes awaken, in ways she hadn't seen in weeks of routines and metaphors. #figure(image("014_Promises to Keep/07.jpg", width: 100%), caption: [Chandra, Roaring Flame | Art by <NAME>], supplement: none, numbering: none) "Thank you," she said, blinking through tears, cradling the robe in her arms. "Thank you so much for all you've done for me. Thank you." Chandra smiled and turned away from the podium. She ran into a wall of <NAME>. Chandra's smile faltered. "I'm sorry, <NAME>," she said. "But you know I have to go." "This is how you feel?" Mother Luti asked evenly. "This is what you want?" "I'm going to Zendikar," Chandra said. "I'm needed there." Chandra looked in Luti's eyes, and immediately she saw the pain her departure would cause. She saw how she would be abandoning this place, the place that had welcomed her in, the place that had believed in her and helped her become herself. Mother Luti's face was unreadable. "You're not sure," she said. "Is this the truth of your heart?" Chandra saw the phantom of Ulamog flickering at the corners of her vision. "Yes, I believe so." "Not acceptable," Mother Luti snapped. "You are needed here!" "I have to go," Chandra said. "Listen, I'm sorry I have to leave you—I know this leaves you without an abbot, and I've appreciated everything—" Mother Luti cut her off. "I'm sorry I have to do this. But I must remind you of your promise. You will be staying on as abbot of this Keep." "What?" "You committed to this place. You considered leaving, but you decided to stay. Get the students back. You will deliver your oration and you will teach pyromancy." Chandra's brow lowered. "What are you saying?" Mother Luti was deadly serious. "I forbid you to leave." Chandra's hands squeezed into fists, but she forced them back open again. She shook her head, chuckling. "Now, look, I—" "Chandra, need I remind you? Even though you are abbot, I rank higher than you. And I say that you will stay." Fists. "I am #emph[not] staying." "You are and you will." "Don't do this." "You have a responsibility!" "I #emph[do] have a responsibility!" Chandra shouted. She jabbed a finger into the air, pointing anywhere. "There are people suffering out there right now, and I can help them. I can #emph[help] . I can't stay here and repeat exercises endlessly, knowing that I could go out and #emph[use] what you've taught me to prevent a disaster." Mother Luti's face suddenly glowed with quiet pride. "#emph[Now] you're certain," she said softly. "Congratulations, Chandra." Chandra breathed. "I..." "Now you know the truth in that head of yours." "That's—that's what you needed to hear?" "That's what #emph[you] needed to #emph[know] ." Chandra's shoulders dropped. She wiped at a droplet that was forming unbidden in the corner of her eye. "Thank you," she said. Mother Luti reached out to accept the abbot's robe, but Chandra slammed into her for a hug. Chandra felt Luti hesitate, then squeeze her arms around her. "Go, <NAME>," Luti whispered into her hair. "Go and save worlds." "I promise," Chandra said inaudibly. Chandra released her. She gathered up Serenok's robe and folded it carefully. Then she folded it again a different way, and then refolded it again and furrowed her brow at the third asymmetrical crinkled mess she had created. She began folding it once more, and then smiled as Mother Luti gently took the mantle from her. "It's fine," Mother Luti chided. "It's fine." Chandra turned, and many of the students applauded. "Goodbye," she said. "Goodbye. I hope to see you all again one day." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The air smelled of dust on Zendikar. But she had hope—it smelled of salt water as well, so she wasn't far. She had emerged somewhere in the forested area by the coast, but she could see the towers of Sea Gate rising over the trees. She also saw Ulamog. He had reached the city already. His monstrous head rose higher than the towers, its bony jaws and bifurcated arms threatening the city. She hoped she wasn't too late. The seawall was close, just down a tree-covered slope. A small squad of Eldrazi creatures dropped out of the branches in front of her, rattle-hissing and brandishing spiked limbs. But she threw a spell with a spin and a lash of her arm, and the creatures turned to ash in a blur of fire magic, and she shoulder-rammed through their charred forms. She made it to Sea Gate. Chandra ran up the thoroughfare of wide white stone, the crest of the mighty seawall. Dozens or hundreds of Zendikari people looked over the seawall at Ulamog— And they were #emph[cheering] . Chandra ran to the edge of the seawall. She struggled to take in what she was seeing. Ulamog was trapped. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Chandra could see the titan thrashing inside a ring of hedrons, unable to move beyond them. All around her, elves and kor and goblins shouted, jeering at the incapacitated titan. Alarmingly, an eight-armed sea creature was emerging from the waters, but Chandra saw that it was using its limbs to slap at various Eldrazi stragglers. It was helping, too! She could barely see a merfolk mage directing the octopoid monster with her two-pronged spear. Chandra's heart leaped. She ran back down the seawall, dodging past smiling and hugging Zendikari people, continuing to try to look over the seawall. She was eager to find faces she recognized, but she couldn't place Jace or Gideon. The moment she spied the winged shadow skimming over the water, time seemed to slow down. When she raised her gaze to see the hell-veined demon, a pang of dread started in her gut and flooded through her entire body. She saw the demon rear back in the air with a flap of his powerful wings, pausing over Ulamog's prison. She saw the demon reach down with clawed fingers, as if drawing power toward him from far below. He spoke unintelligible words, and she felt the earth shudder. Around her, cheers quieted to murmurs of concern. The tips of the hedrons were aimed at the demon now. The hedron prison had become some new form of hedron device, a vortex of power with the demon at its apex. Veins of dark energy slashed forth from the hedrons, converging on the demon. His body arched, taking in the power, and his head was flung back. He laughed a deep, satisfied laugh, floating there in the air above Ulamog's skull. #figure(image("014_Promises to Keep/08.jpg", width: 100%), caption: [Ob Nixilis Reignited | Art by <NAME>], supplement: none, numbering: none) #emph[Demons laughing] , she thought. #emph[Never good news.] Chandra spit in her hands, rubbed them together, and conjured an unreasonable amount of flame from nowhere. Three separate fire spells at once should do it. She twisted her body and spun with a grunt, hurling a barrage of pyromancy all at once at the demon. But as her spells sped toward the dark leylines, they became entangled and engulfed in the lines of force, and the flames dispersed without reaching their target. The ground shifted, and around her murmurs became screams. She looks down to see the hedrons of Ulamog's imprisoning ring tilt and tremble. The ground rumbled with more violence, rocking the seawall and churning up enormous waves. Zendikari people stampeded along the seawall in raucous panic. Waves surged and splashed over the seawall from the Halimar side. One particularly huge surge loomed high, cresting forty feet above some running refugees. Chandra blasted the wave with a cone of heat, sizzling it to steam before it could crush them and inundate the seawall. She ran with them, beating back the gushing seawater with waves of pyromantic air. As Chandra ran with the crowd for lower ground, she looked up to see the tops of Sea Gate's towers swinging to and fro. A crack formed in one of the spires, showering white dust and debris down on them. As the demon's empowerment spell ended, gravity began to take hold of the hedrons down at the water's surface. The hedrons fell, splashing down into the churning sea one by one, snapping the rope lines that connected them to each other and to the wall of Sea Gate. The circle was breaking. The structure of Ulamog's prison was rupturing. No longer restrained, Ulamog unfurled like an apocalyptic flower. The titan grasped at nearby fleeing humanoids, who turned instantly to dust. Chandra screamed in rage. She whipped missiles of fire at Ulamog, but they seemed to do nothing. She still couldn't see Gideon or Jace in the crowd. She wasn't able to stop the demon or damage the newly-freed titan. #emph[What else could go wrong today?] The rocky peninsula at the far end of Sea Gate shuddered, then the land broke with a snap. Rock and earth fell in on itself, a self-swallowing sinkhole. The sinkhole spread in an unnatural way, the edges of the hole bending and retracting inward, the terrain forming bizarre right-angled patterns with an iridescent sheen. There was movement of something massive deep underground, surging toward the surface. #emph[OF COURSE] , she thought. #emph[WHY NOT? WHY NOT THIS NOW?] Gigantic, angular shards of a shimmering, obsidian-like material stabbed up from the ground. As the being rose, Chandra saw that the shards floated in formation above a great swiveling globe of a head, which was embedded in an armored, split-limbed torso, which was supported by a forest of chthonic tentacles. As it rose, it shed earth like a doffed robe, terrain tumbling from it and raining down into the sea. This was not merely an additional Eldrazi creature to fight. This was the advent of another god-thing, like Ulamog—a horrific divinity of the Blind Eternities. A second Eldrazi titan had entered the battle. #figure(image("014_Promises to Keep/09.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/par-00.typ
typst
Other
// Test ragged-left. #set align(right) To the right! Where the sunlight peeks behind the mountain.
https://github.com/danbalarin/vse-typst-template
https://raw.githubusercontent.com/danbalarin/vse-typst-template/main/README.md
markdown
# VSE Diploma Thesis template ## Usage ```typst #show: template.with( // Thesis title title: "Thesis Title", // Thesis author author: "Bc. <NAME>", // Thesis submission date date: "January 2025", // University university: "Prague University of Economics and Business", // Faculty faculty: "Faculty of Informatics and Statistics", // Study program study-program: "Study Program", // Specialization (optional) specialization: "", // Supervisor supervisor: "Ing. <NAME>", // Consultant (optional) consultant: "", // Place of submission city: "Prague", // Language (currently only english) lang: "en", // Acknowledgements acknowledgements: [Thanks], // Abstract and keywords abstract-en: [Abstract], keywords-en: [keywords], abstract-cs: [Abstrakt], keywords-cs: [keywords], // If set to true, cs and en abstracts and keywords will be on separate pages separated-abstracts: false, // path to the bibliography file bibliography-file: "/template/bibliography.bib", ) ``` ## Utils Block that is highlighted with a color. ```typst #revisit[ == This chapter should be revisited Useful for marking chapters that need to be revisited. ] ``` Heading that is not included in the table of contents and does not have a number. ```typst #heading-like(level: 2)["Chapter 1"] ```
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/pagebreak.typ
typst
// Test forced page breaks. --- pagebreak --- // Just a pagebreak. // Should result in two pages. #pagebreak() --- pagebreak-around-set-page --- // Pagebreak, empty with styles and then pagebreak // Should result in one auto-sized page and two conifer-colored 2cm wide pages. #pagebreak() #set page(width: 2cm, fill: conifer) #pagebreak() --- pagebreak-weak-after-set-page --- // Two text bodies separated with and surrounded by weak pagebreaks. // Should result in two aqua-colored pages. #set page(fill: aqua) #pagebreak(weak: true) First #pagebreak(weak: true) Second #pagebreak(weak: true) --- pagebreak-set-page-mixed --- // Test a combination of pagebreaks, styled pages and pages with bodies. // Should result in three five pages, with the fourth one being forest-colored. #set page(width: 80pt, height: 30pt) #[#set page(width: 60pt); First] #pagebreak() #pagebreak() Third #page(height: 20pt, fill: forest)[] Fif#[#set page();th] --- pagebreak-followed-by-page-call --- // Test hard and weak pagebreak followed by page with body. // Should result in three navy-colored pages. #set page(fill: navy) #set text(fill: white) First #pagebreak() #page[Second] #pagebreak(weak: true) #page[Third] --- pagebreak-in-container --- #box[ // Error: 4-15 pagebreaks are not allowed inside of containers // Hint: 4-15 try using a `#colbreak()` instead #pagebreak() ] --- pagebreak-weak-place --- // After place // Should result in three pages. First #pagebreak(weak: true) #place(right)[placed A] #pagebreak(weak: true) Third --- pagebreak-weak-meta --- // After only ignorables & invisibles // Should result in two pages. First #pagebreak(weak: true) #counter(page).update(1) #metadata("Some") #pagebreak(weak: true) Second --- pagebreak-meta --- // After only ignorables, but regular break // Should result in three pages. First #pagebreak() #counter(page).update(1) #metadata("Some") #pagebreak() Third --- pagebreak-to --- #set page(width: 80pt, height: 30pt) First #pagebreak(to: "odd") Third #pagebreak(to: "even") Fourth #pagebreak(to: "even") Sixth #pagebreak() Seventh #pagebreak(to: "odd") #page[Ninth] --- pagebreak-to-auto-sized --- #set page(width: auto, height: auto) // Test with auto-sized page. First #pagebreak(to: "odd") Third --- pagebreak-to-multiple-pages --- #set page(height: 30pt, width: 80pt) // Test when content extends to more than one page First Second #pagebreak(to: "odd") Third --- issue-2134-pagebreak-bibliography --- // Test weak pagebreak before bibliography. #pagebreak(weak: true) #bibliography("/assets/bib/works.bib") --- issue-2095-pagebreak-numbering --- // The empty page 2 should not have a page number #set page(numbering: none) This and next page should not be numbered #pagebreak(weak: true, to: "odd") #set page(numbering: "1") #counter(page).update(1) This page should --- issue-2162-pagebreak-set-style --- // The styles should not be applied to the pagebreak empty page, // it should only be applied after that. #pagebreak(to: "even") // We should now skip to page 2 Some text on page 2 #pagebreak(to: "even") // We should now skip to page 4 #set page(fill: orange) // This sets the color of the page starting from page 4 Some text on page 4 --- issue-2591-single-weak-pagebreak --- #pagebreak(weak: true) --- issue-2841-pagebreak-to-weak --- First #pagebreak(to: "odd") #pagebreak(weak: true) Odd
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/经济学原理/hw/hw11.typ
typst
#import "../../template.typ": * #show: note.with( title: "作业8", author: "YHTQ ", date: none, logo: none, withOutlined: false, withTitle: true ) = + 总收入 $R = p q = q(a - b q) $\ 边际收入 $M R = der(R, q) = a - b q - b q = a - 2 b q $ + 垄断时应有边际收入等于边际成本,也即: $ a - 2 b q = c\ q_0 = (a - c)/(2 b)\ p_0 = a - b q_0 = a -(a-c)/2 = (a + c)/2\ $ 利润为: $ w = p_0 q_0 - c q_0 = (a^2 - c^2)/(4 b) - c (a - c)/(2b) = (a^2 - 2 a c +c^2)/(4b) = (a - c)^2/(4b) $ 消费者剩余为: $ u = integral_(0)^(q_0) p(q) - p_0 dif q\ = integral_(0)^(q_0) a - p_0 - b q dif q\ = integral_(0)^(q_0) (a - c)/2 - b q dif q\ = b integral_(0)^(q_0) (a - c)/(2 b) - q dif q\ = b integral_(0)^(q_0) q_0 - q dif q\ = b integral_(0)^(q_0) q dif q\ = b q_0^2/2 = (a-c)^2/(8b)\ $ + 完全竞争状态下,应有边际收益 $M R' = p_0'$,边际成本为 $c$ ,因此: $ p_0 ' = c\ q_0 ' = (a - c)/b $ 利润为: $ p_0 ' q_0 ' - c q_0 ' = 0 $ 消费者剩余为: $ u ' = integral_(0)^(q_0 ') p(q) - p(q_0 ') dif q\ = q_0 ' p((q_0 ')/2) = (a-c)/b (a - (a-c)/2) = (a^2 - c^2)/(2b) $ = + 总利润为: $ p q -338 = (25 - 0.5 q)q - 338 < 0 $ 利润最大化时有 $25 = q$,利润为 $25^2/2 -338 = 312.5 - 338 < 0 $\ 从而无论如何都会亏本 + 总利润为: $ p q + t q -338 = (25 - 0.51q +t)q -338 = (t + 25 - 0.51q)q -338 $ 上式取最大值时 $q$ 满足: $ t + 25 = 2 dot 0.51 q = 1.02q $ 利润为: $ (1.02q)^2/2 - 338 $ 考虑到 $q$ 是整数,取 $q = 26$ 利润已经为正,此时 $t = 1.02 * 26 - 25 = 1.52$\ 发放的总补贴为: $ 26 t = 39.52 $ + 总利润为: $ p q + K -338 = 312.5 + K - 338 >0 => K > 25.5 $ + 方案二的政府支出更小。注意到按量补贴时,相当于边际收益增加,因此会改变企业最优化利润的点,企业更倾向于生产更多的同时获得更多的补贴,因此政府的支出更大。 = + $ q = cases( 0 space &p > 7, 140 - 20p space &5.5 < p lt.eq 7, 360 - 60p space &0 < p lt.eq 5.5 ) $ + 对后两段分别计算 - 在第二段时,最优价格满足: $ 40p = 140 => p = 3.5 $ 不合法,因此不在这段内取最大值 - 在第三段时,最优价格满足: $ 360 = 120p => p = 3 $ 这就是利润最大化时的价格,利润为: $ (360 - 180)*3 = 540 $ 此时: $ q_s = 220 - 40 * 3 = 100\ q_n = 140 - 20 * 3 = 80 $ + 设对两群体售价分别为 $p_s, p_n$,总利润为: $ p_s q_s + p_n q_n = p_s (220 - 40p_s) + p_n (140 - 20 p_n) $ 利润最大化时有: $ 80 p_s = 220 => p_s = 11/4\ 40 p_n = 140 => p_n = 7/2 $ 最大总利润为: $ 11/4 * 110 + 7/2 * 70 = (1210 + 980)/4 = 1095/2 > 540 $ 厂商总利润增大了 + 厂商当然受益了。对于两类顾客,分别计算前后的消费者剩余: $ u_s = integral_(0)^(q_s) (p(q) - p(q_s)) dif q\ = integral_(p_0)^(5.5) p - p_0 dif 40p\ =40 integral_(p_0)^(5.5) p - p_0 dif p\ =40 integral_(p_0)^(5.5) p - p_0 dif p\ = 40 integral_0^(5.5-3) p dif p\ = 40 * (2.5)^2/2 = 125 $ $ u_n = integral_(0)^(q_n)p(q) - p(q_n) dif q\ = p(q_n/2)q_n - p(q_n)q_n\ = (7 - 40/20 - 3) * 80 = 160 $ $ u_s ' = integral_(0)^(q_s') (p(q) - p(q_s')) dif q\ = (5.5 - 55/40 - 11/4) * 110 = 151.25 $ $ u_n ' = integral_(0)^(q_n') (p(q) - p(q_n')) dif q\ = (7 - 35/20 - 3) * 70 = 157.5 $ 因此学生受益了,其他人群亏损了
https://github.com/ParaN3xus/numblex
https://raw.githubusercontent.com/ParaN3xus/numblex/main/lib/parser.typ
typst
MIT License
#import "model.typ": ord, match_ord, ord_mod, const, match_const /// -> (condition, element) #let parse_case(s) = { assert(type(s) == str) let cond = (..args) => true if ":" in s { let (_s, cond_str) = s.split(":") s = _s cond = (..args) => eval( cond_str, mode: "code", scope: ( d: args.named().depth, depth: args.named().depth, ), ) } if regex("\[.*\]") in s { // Ordinal let ORD_PATTERN = regex("\[([^]]*)\]") let ord_str_arr = s.matches(ORD_PATTERN).map(x => x.captures.at(0)) assert( ord_str_arr.len() == 1, message: "Case should have exactly one ordinal", ) let ord_str = ord_str_arr.at(0) let res = ord(ord_str) let (pre, suf) = s.split(ORD_PATTERN) res = ord_mod(res, prefix: pre, suffix: suf) return (cond, res) } return (cond, const(s)) } /// "{xxx}" /// "xxx" -> element #let parse_element(s) = { assert(type(s) == str) let cases = s.split(";").map(parse_case) assert(cases.len() > 0, message: "Element should have at least one case") if cases.at(0).at(1).type == "ord" { return match_ord(..cases) } return match_const(..cases) } /// Parse a string into a list of elements #let parser(s) = { assert(type(s) == str) let res = () // Ohno this is not supported // `let elements = s.matches(regex("(?<!\\)\{([^{}]*)\}"))` // TODO: support `\{` quoting let elements = s.matches(regex("\{([^{}]*)\}")).map(x => x.captures.at(0)).map(parse_element) return elements }
https://github.com/kajiLabTeam/ipsj-national-convention-typst-template
https://raw.githubusercontent.com/kajiLabTeam/ipsj-national-convention-typst-template/main/template/template.typ
typst
#import "head.typ": header_title #import "functinos.typ": spacer #let template( title: (), names: (), affiliations: (), paper-size: "a4", fonts: ( sans-ja: "Noto Sans JP", serif-ja: "Noto Serif JP", ), ref-path: "", body, ) = { // ドキュメントの設定 set document( title: title.join(""), author: names.map(a => a.ja) ) // ページの設定 set par( justify: true, spacing: 1em, first-line-indent: 1em, ) set page( columns: 2, paper: paper-size, footer: align(center)[#context(counter(page).display("1"))] ) set figure( numbering: "1.1.1", gap: 10pt, ) show figure: it => { it spacer() } // 段落の設定 set heading( numbering: "1.1.1", ) // 図の設定 set figure(supplement: "図") // フォントの設定 set text( font: (fonts.serif-ja), size: 0.8em, ) // 1段落目の字下げ show heading: it => { text( font: fonts.sans-ja, weight: "medium", it ) spacer() } let footnotes = (:); for author in names + affiliations { let is_exist = footnotes.keys().contains(str(author.group)); let index = 0 if not is_exist { footnotes.insert(str(author.group), ( index: footnotes.len() + 1, text: author.en, )); } else { let text = footnotes.at(str(author.group)).text; footnotes.insert(str(author.group), ( index: footnotes.at(str(author.group)).index, text: text + ", " + author.en, )); } } place( top + center, scope: "parent", float: true, header_title( fonts: fonts, title: title, names: names, affiliations: affiliations, footnotes: footnotes, ) ) set footnote(numbering: "*") show footnote: it => text(size:0pt, it) for f in footnotes { footnote(str(f.at(1).text)) } spacer() body }
https://github.com/taooceros/CV
https://raw.githubusercontent.com/taooceros/CV/main/modules_en/education.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cvSection, cvEntry, hBar #let metadata = toml("../metadata.toml") #let cvSection = cvSection.with(metadata: metadata) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("Education") #cvEntry( title: [*_B.S._* in Computer Science (Honors), Math and Data Science, _Comprehensive Honors_], society: [University of Wisconsin-Madison], date: [2021-2024], location: [Madison, WI], logo: link("https://www.wisc.edu/", image("../src/logos/uw-madison.png")), description: [ - *Thesis*: Usage-Fairness in Delegation-Styled Locks - *GPA*: 3.94/4.0 - *Relevent Courses*: Operating System, Computer Network, Database System, Compiler, Algorithm (Honors), Quantum Algorithm, Machine Learning, Linear/Non-Linear Optimization, Probability Theory (Honors), Stochastic Process (Honors), Analysis (Honors), Modern Algebra I & II, Linear Algebra (Honors) ], )
https://github.com/taylorh140/typst-pintora
https://raw.githubusercontent.com/taylorh140/typst-pintora/main/package/lib.typ
typst
#import "./pintorita.typ": render, render-svg
https://github.com/shiki-01/typst
https://raw.githubusercontent.com/shiki-01/typst/main/lib/component/comment.typ
typst
#let comment(title, type, body) = { let color let acsent let icon let content let text_color if type == "info" {color = "#ccf1ff"; text_color = "#31708f"; acsent = "#54a2df"; icon = "../image/info.svg"} if type == "important" {color = "#ffdbdb"; text_color = "#a94442"; acsent = "#ff4d4d"; icon = "../image/exra.svg"} if type == "sucsess" {color = "#dff4cf"; text_color = "#3c763d"; acsent = "#67cb1b"; icon = "../image/check.svg"} if type == "comment" {color = "#fbf5e0"; text_color = "#8a6d3b"; acsent = "#ffce1f"; icon = "../image/comment.svg"} if title == "" { content = [ #grid( columns: (30pt, 1fr), [ #pad( right: 8pt, image(icon, width: 20pt), ) ], [ #pad( top: 6pt, bottom: 5pt, right: 2pt, text(fill: rgb(text_color))[#body] ) ] ) ] } else { content = [ #grid( columns: (30pt, 1fr), [ #pad( right: 8pt, image(icon, width: 20pt), ) ], text(fill: rgb(text_color))[#align(horizon)[*#title*]] ) #pad( top: 10pt, bottom: 10pt, left: 28pt, right: 28pt, text(fill: rgb(text_color))[#body] ) ] } block( fill: rgb(color), inset: 15pt, radius: 4pt, stroke: 1pt + rgb(acsent), [#content] ) }
https://github.com/hei-templates/hevs-typsttemplate-thesis
https://raw.githubusercontent.com/hei-templates/hevs-typsttemplate-thesis/main/00-templates/boxes.typ
typst
MIT License
// // Description: Creating nice looking information boxes with different logos // Author : <NAME> // #import "constants.typ": * #let iconbox( width: 100%, radius: 4pt, border: 4pt, inset: 10pt, outset: -10pt, linecolor: code-border, icon: none, iconheight: 1cm, body ) = { if body != none { align(left, rect( stroke: (left:linecolor+border, rest:code-border+0.1pt), radius: (left:0pt, right:radius), fill: code-bg, outset: (left:outset, right:outset), inset: (left:inset*2, top:inset, right:inset*2, bottom:inset), width: width)[ #if icon != none { align(left, table( stroke:none, align:left+horizon, columns: (auto,auto), image(icon, height:iconheight), [#body] ) ) } else { body } ] ) } } #let infobox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-info, icon: icon-info, )[#body] } #let warningbox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-warning, icon: icon-warning, )[#body] } #let ideabox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-idea, icon: icon-idea )[#body] } #let firebox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-fire, icon: icon-fire, )[#body] } #let importantbox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-important, icon: icon-important, )[#body] } #let rocketbox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-rocket, icon: icon-rocket, )[#body] } #let todobox( width: 100%, radius: 4pt, border: 4pt, inset:10pt, outset: -10pt, body ) = { iconbox( width: width, radius: radius, border: border, inset: inset, outset: outset, linecolor: color-todo, icon: icon-todo, )[#body] } // Creating nice looking information boxes with different headings #let colorbox( title: "title", color: color-todo, stroke: 0.5pt, radius: 4pt, width: auto, body ) = { let strokeColor = color let backgroundColor = color.lighten(50%) return box( fill: backgroundColor, stroke: stroke + strokeColor, radius: radius, width: width )[ #block( fill: strokeColor, inset: 8pt, radius: (top-left: radius, bottom-right: radius), )[ #text(fill: white, weight: "bold")[#title] ] #block( width: 100%, inset: (x: 8pt, bottom: 8pt) )[ #body ] ] } #let slantedBackground( color: black, body) = { set text(fill: white, weight: "bold") style(styles => { let size = measure(body, styles) let inset = 8pt [#block()[ #polygon( fill: color, (0pt, 0pt), (0pt, size.height + (2*inset)), (size.width + (2*inset), size.height + (2*inset)), (size.width + (2*inset) + 6pt, 0cm) ) #place(center + top, dy: size.height, dx: -3pt)[#body] ]] }) } #let slantedColorbox( title: "title", color: color-todo, stroke: 0.5pt, radius: 4pt, width: auto, body ) = { let strokeColor = color let backgroundColor = color.lighten(50%) return box( fill: backgroundColor, stroke: stroke + strokeColor, radius: radius, width: width )[ #slantedBackground(color: strokeColor)[#title] #block( width: 100%, inset: (top: -2pt, x: 10pt, bottom: 10pt) )[ #body ] ] }
https://github.com/piepert/typst-custombib
https://raw.githubusercontent.com/piepert/typst-custombib/main/typst-custombib.typ
typst
#import "typst-custombib-generator.typ": * #let ifnotnone(elem, fn-true, fn-false: k => none) = if elem != none { fn-true(elem) } else { fn-false(elem) } #let ifhaskey(elem, key, fn-true, ..k) = if elem.at(key, default: none) != none { fn-true(elem) } else if k.pos().len() > 0 { k.pos().first()(elem) } #let get-bibliography-data(location) = { return TCBSTATES.data.at(location) } #let load-bibliography(path) = { let data = yaml(path) for entry in data.keys() { if "entry-type" not in data.at(entry) { return strong(text(red, [`entry-type` NEEDS TO BE SET IN #entry.])) } else if data.at(entry).at("entry-type") == "custom" { // return strong(text(red, [#get-option(location, "styles", "custom", "sort-by") NEED TO BE SET IN #entry.])) // need to check if all custom items have the field set in styles.custom.sort-by, but later when generating the bibliography } else if "title" not in data.at(entry) or "author" not in data.at(entry) { return strong(text(red, [`author` AND `title` NEED TO BE SET IN #entry.])) } for k in data.at(entry).keys() { if type(data.at(entry).at(k)) == "integer" { data.at(entry).at(k) = str(data.at(entry).at(k)) } } } if data == none { panic("error loading bib data!") } TCBSTATES.data.update(data) TCBSTATES.used-citations.update(()) TCBSTATES.citation-history.update(()) TCBSTATES.last-citation.update(()) } #let tcb-bibliography(path) = { load-bibliography(path) } #let tcb-show-bibliography() = { locate(loc => generate-bibliography(loc, TCBSTATES.style.at(loc), TCBSTATES.data.at(loc), TCBSTATES.used-citations.at(loc))) } #let tcb-style(data) = { TCBSTATES.style.update(data) } #let tcb-has-key(location, key) = { return key in TCBSTATES.data.at(location) } #let tcb-cite(key, postfix: none, prefix: none, wrap-single: true) = { TCBSTATES.last-citation.update(key) TCBSTATES.citation-history.update(k => (k, key).flatten()) TCBSTATES.used-citations.update(k => if k == none { (key,) } else if key not in k { (k, key).flatten() } else { k }) locate(loc => { let wrapper = e => e if has-option(loc, "inline.wrap-any") and wrap-single { wrapper = get-option(loc, "inline.wrap-any") } wrapper(generate-citation-inline(loc, TCBSTATES.style.at(loc), TCBSTATES.data.at(loc), key, postfix: postfix, prefix: prefix)) }) } #let tcb-cites(..keys) = { let keys = keys.pos() locate(loc => { let wrapper = e => e if has-option(loc, "inline.wrap-any") { wrapper = get-option(loc, "inline.wrap-any") } if not has-option(loc, "options.separator") { return strong(text(red, [NEEDS options.separator!])) } let sep = get-option(loc, "options.separator") let content = [] for i in range(0, keys.len()) { content += tcb-cite(keys.at(i), wrap-single: false) if i+1 < keys.len() { content += eval("["+sep+"]") } } let styler = get-option(loc, "inline.wrap-multi") if type(styler) != "content" { // IF NOT ERROR return wrapper(styler(content)) } wrapper(content) }) }
https://github.com/GartmannPit/Praxisprojekt-II
https://raw.githubusercontent.com/GartmannPit/Praxisprojekt-II/main/Praxisprojekt%20II/PVA-Templates-typst-pva-2.0/template/acronymsList.typ
typst
#let createListofAcronyms() = { set heading(numbering: none) par[= Abkürzungsverzeichnis] // Edit heading here to change language set terms(tight: false, separator: none) include "../acronyms.typ" }
https://github.com/alikindsys/aula
https://raw.githubusercontent.com/alikindsys/aula/master/readme.md
markdown
# `aula` - Um sistema de tipografia para anotações escolares. ## Features - Separação entre código compartilhado e código relacionado a uma matéria especifica. - Geração de glossário automática - Facilidade de criação de uma matéria nova ## Como criar uma nova matéria *Opcional:* Crie uma nova pasta com o nome dessa matéria. Crie um novo arquivo `.typ` com o nome dessa matéria, esse arquivo será a base de todos arquivos que forem desta mesma matéria. ```typst // Tema aula #import "../Core/prelude.typst": * // Glossário vazio, por enquanto. #let glossario = () #let portugues(doc) = [ #show: aula(materia: [Portugûes], glossary: glossario, doc); ] ``` Para usar sua matéria, crie um novo arquivo e use: ```typst #import "portugues.typ" #show: portugues = Seu texto aqui. Descrição que você desejar ``` Veja um exemplo em [test.typ](test.typ). [Renderizado](test.pdf)
https://github.com/ojas-chaturvedi/typst-templates
https://raw.githubusercontent.com/ojas-chaturvedi/typst-templates/master/resume/yml.typ
typst
MIT License
#import "template.typ": resume, header, resume_heading, edu_item, exp_item, project_item, skill_item #let yml_personal(data) = { header( name: data.name, phone: data.phone, email: data.email, linkedin: data.linkedin, site: data.site ) } #let yml_education(data) = { resume_heading[Education] for edu in data { edu_item( name: edu.name, degree: edu.degree, location: edu.location, date: edu.date, ) } } #let yml_experience(data) = { resume_heading[Experience] for exp in data { exp_item( role: exp.role, name: exp.name, location: exp.location, date: exp.date, .. exp.points ) } } #let yml_projects(data) = { resume_heading[Projects] for proj in data { project_item( name: proj.name, skills: proj.skills, site: proj.site, date: proj.date, ..proj.points ) } } #let yml_skills(data) = { resume_heading[Technical Skills] for skill in data { skill_item( category: skill.category, skills: skill.skills ) } } #let yml_resume(data) = { show: resume yml_personal(data.personal) yml_education(data.education) yml_experience(data.experience) yml_projects(data.projects) yml_skills(data.skills) }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/if-02.typ
typst
Other
// Test else if. // Ref: false #let nth(n) = { str(n) if n == 1 { "st" } else if n == 2 { "nd" } else if n == 3 { "rd" } else { "th" } } #test(nth(1), "1st") #test(nth(2), "2nd") #test(nth(3), "3rd") #test(nth(4), "4th") #test(nth(5), "5th")
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/grid/styling.typ
typst
// Test grid styling options. --- grid-fill-func --- #set page(height: 70pt) #set grid(fill: (x, y) => if calc.even(x + y) { rgb("aaa") }) #grid( columns: (1fr,) * 3, stroke: 2pt + rgb("333"), [A], [B], [C], [], [], [D \ E \ F \ \ \ G], [H], ) --- grid-stroke-none --- #grid(columns: 3, stroke: none, fill: green, [A], [B], [C]) --- grid-align --- // Test general alignment. #grid( columns: 3, align: left, [Hello], [Hello], [Hello], [A], [B], [C], ) // Test alignment with a function. #grid( columns: 3, align: (x, y) => (left, center, right).at(x), [Hello], [Hello], [Hello], [A], [B], [C], ) // Test alignment with array. #grid( columns: (1fr, 1fr, 1fr), align: (left, center, right), [A], [B], [C] ) // Test empty array. #set align(center) #grid( columns: (1fr, 1fr, 1fr), align: (), [A], [B], [C] ) a --- grid-inset --- // Test inset. #grid( columns: (1fr,) * 3, stroke: 2pt + rgb("333"), inset: 5pt, [A], [B], [C], [], [], [D \ E \ F \ \ \ G], [H], ) #grid( columns: 3, inset: 10pt, fill: blue, [A], [B], [C] ) #grid( columns: 3, inset: (y: 10pt), [A], [B], [C] ) #grid( columns: 3, inset: (left: 20pt, rest: 10pt), stroke: 3pt + red, [A], [B], [C] ) #grid( columns: 2, inset: ( left: 20pt, right: 5pt, top: 10pt, bottom: 3pt, ), [A], [B], ) #grid( columns: 3, fill: (x, y) => (if y == 0 { aqua } else { orange }).darken(x * 15%), inset: (x, y) => (left: if x == 0 { 0pt } else { 5pt }, right: if x == 0 { 5pt } else { 0pt }, y: if y == 0 { 0pt } else { 5pt }), [A], [B], [C], [A], [B], [C], ) #grid( columns: 3, inset: (0pt, 5pt, 10pt), fill: (x, _) => aqua.darken(x * 15%), [A], [B], [C], ) --- grid-inset-folding --- // Test inset folding #set grid(inset: 10pt) #set grid(inset: (left: 0pt)) #grid( fill: red, inset: (right: 0pt), grid.cell(inset: (top: 0pt))[a] ) --- grid-funcs-gutter --- // Test interaction with gutters. #grid( columns: (3em, 3em), fill: (x, y) => (red, blue).at(calc.rem(x, 2)), align: (x, y) => (left, right).at(calc.rem(y, 2)), [A], [B], [C], [D], [E], [F], [G], [H] ) #grid( columns: (3em, 3em), fill: (x, y) => (red, blue).at(calc.rem(x, 2)), align: (x, y) => (left, right).at(calc.rem(y, 2)), row-gutter: 5pt, [A], [B], [C], [D], [E], [F], [G], [H] ) #grid( columns: (3em, 3em), fill: (x, y) => (red, blue).at(calc.rem(x, 2)), align: (x, y) => (left, right).at(calc.rem(y, 2)), column-gutter: 5pt, [A], [B], [C], [D], [E], [F], [G], [H] ) #grid( columns: (3em, 3em), fill: (x, y) => (red, blue).at(calc.rem(x, 2)), align: (x, y) => (left, right).at(calc.rem(y, 2)), gutter: 5pt, [A], [B], [C], [D], [E], [F], [G], [H] )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/style-00.typ
typst
Other
// Test italic defaults. $a, A, delta, ϵ, diff, Delta, ϴ$
https://github.com/nafkhanzam/typst-common
https://raw.githubusercontent.com/nafkhanzam/typst-common/main/src/km/lib.typ
typst
#import "../common/binary.typ": * #import "../common/gray.typ": * #import "../common/data.typ": * #let zstack( alignment: top + left, ..args, ) = ( context { let width = 0pt let height = 0pt for item in args.pos() { let size = measure(item.at(0)) width = calc.max(width, size.width) height = calc.max(height, size.height) } block( width: width, height: height, { for item in args.pos() { place( alignment, dx: item.at(1), dy: item.at(2), item.at(0), ) } }, ) } ) #let kmap-render( row, col, cells, x-label: none, x-headers: (), y-label: none, y-headers: (), implicants: (), horizontal-implicants: (), vertical-implicants: (), corner-implicants: false, cell-size: 2.2em, stroke-width: 0.5pt, colors: ( rgb(255, 0, 0, 100), rgb(0, 255, 0, 100), rgb(0, 0, 255, 100), rgb(0, 255, 255, 100), rgb(255, 0, 255, 100), rgb(255, 255, 0, 100), ), implicant-inset: 5pt, edge-implicant-overflow: 10pt, implicant-radius: 5pt, implicant-stroke-transparentize: -100%, implicant-stroke-darken: 60%, implicant-stroke-width: 0.5pt, ) = { implicants = implicants.map(v => v.map(vv => (vv.at(0), row - 1 - vv.at(1)))) horizontal-implicants = horizontal-implicants.map(v => v.map(vv => (vv.at(0), row - 1 - vv.at(1)))) vertical-implicants = vertical-implicants.map(v => v.map(vv => (vv.at(0), row - 1 - vv.at(1)))) let implicant-count = 0 let cell-total-size = cell-size let base = table( columns: col * (cell-size,), rows: cell-size, align: center + horizon, stroke: stroke-width, ..cells.map(term => [#term]) ) let body = zstack( alignment: bottom + left, (base, 0pt, 0pt), // Implicants. ..for (index, implicant) in implicants.enumerate() { implicant-count += 1 let p1 = implicant.at(0) let p2 = implicant.at(1) let bottom-left-point let top-right-point bottom-left-point = (calc.min(p1.at(0), p2.at(0)), calc.min(p1.at(1), p2.at(1))) top-right-point = (calc.max(p1.at(0), p2.at(0)), calc.max(p1.at(1), p2.at(1))) let dx = bottom-left-point.at(0) * cell-total-size + implicant-inset let dy = bottom-left-point.at(1) * cell-total-size + implicant-inset let width = (top-right-point.at(0) - bottom-left-point.at(0) + 1) * cell-size - implicant-inset * 2 let height = (top-right-point.at(1) - bottom-left-point.at(1) + 1) * cell-size - implicant-inset * 2 // Loop back on the colors array if there are more implicants than there // are colors. let color = colors.at(calc.rem-euclid(implicant-count - 1, colors.len())) ( ( rect( stroke: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, fill: color, width: width, height: height, radius: implicant-radius ), dx, -dy ), ) }, // Implicants. // Horizontal implicants. ..for (index, implicant) in horizontal-implicants.enumerate() { implicant-count += 1 let p1 = implicant.at(0) let p2 = implicant.at(1) let bottom-left-point = (calc.min(p1.at(0), p2.at(0)), calc.min(p1.at(1), p2.at(1))) let bottom-right-point = (calc.max(p1.at(0), p2.at(0)), calc.min(p1.at(1), p2.at(1))) let top-right-point = (calc.max(p1.at(0), p2.at(0)), calc.max(p1.at(1), p2.at(1))) let dx1 = bottom-left-point.at(0) * cell-total-size - edge-implicant-overflow + implicant-inset let dx2 = bottom-right-point.at(0) * cell-total-size + implicant-inset let dy = bottom-left-point.at(1) * cell-total-size + implicant-inset // let dy2 = bottom-right-point.at(1) * cell-total-size let width = cell-size + edge-implicant-overflow - implicant-inset * 2 let height = (top-right-point.at(1) - bottom-left-point.at(1) + 1) * cell-size - implicant-inset * 2 // Loop back on the colors array if there are more implicants than there // are colors. let color = colors.at(calc.rem-euclid(implicant-count - 1, colors.len())) ( ( rect( stroke: ( top: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, right: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, bottom: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width ), fill: color, width: width , height: height, radius: (right: implicant-radius) ), dx1, -dy ), ( rect( stroke: ( top: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, left: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, bottom: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width ), fill: color, width: width, height: height, radius: (left: implicant-radius) ), dx2, -dy ) ) }, // Vertical implicants. ..for (index, implicant) in vertical-implicants.enumerate() { implicant-count += 1 let p1 = implicant.at(0) let p2 = implicant.at(1) let bottom-left-point = (calc.min(p1.at(0), p2.at(0)), calc.min(p1.at(1), p2.at(1))) let top-left-point = (calc.min(p1.at(0), p2.at(0)), calc.max(p1.at(1), p2.at(1))) let top-right-point = (calc.max(p1.at(0), p2.at(0)), calc.max(p1.at(1), p2.at(1))) let dx = bottom-left-point.at(0) * cell-total-size + implicant-inset let dy1 = bottom-left-point.at(1) * cell-total-size - edge-implicant-overflow + implicant-inset let dy2 = top-left-point.at(1) * cell-total-size + implicant-inset let width = (top-right-point.at(0) - bottom-left-point.at(0) + 1) * cell-size - implicant-inset * 2 let height = cell-size + edge-implicant-overflow - implicant-inset * 2 // Loop back on the colors array if there are more implicants than there // are colors. let color = colors.at(calc.rem-euclid(implicant-count - 1, colors.len())) ( ( rect( stroke: ( left: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, top: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, right: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width ), fill: color, width: width, height: height, radius: (top: implicant-radius) ), dx, -dy1 ), ( rect( stroke: ( left: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, bottom: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, right: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, ), fill: color, width: width, height: height, radius: (bottom: implicant-radius) ), dx, -dy2 ) ) }, // Vertical implicants. // Corner implicants. ..if corner-implicants { implicant-count += 1 // Index (below) of array is the Gray code position of that corner. // // 0 1 // // 2 3 // // For example, at index 3, in a 4x4 K-map, the Gray code at that corner // is 10. let dx-left = -edge-implicant-overflow + implicant-inset let dx-right = (col - 1) * cell-total-size + implicant-inset let dy-top = (row - 1) * cell-total-size + implicant-inset let dy-bottom = edge-implicant-overflow - implicant-inset let width = cell-size + edge-implicant-overflow - implicant-inset * 2 // Loop back on the colors array if there are more implicants than there // are colors. let color = colors.at(calc.rem-euclid(implicant-count - 1, colors.len())) ( ( rect( width: width, height: width, stroke: (right: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, bottom: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width), fill: color, radius: (bottom-right: implicant-radius) ), dx-left, -dy-top ), ( rect( width: width, height: width, stroke: (left: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, bottom: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width), fill: color, radius: (bottom-left: implicant-radius) ), dx-right, -dy-top ), ( rect( width: width, height: width, stroke: (top: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, right: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width), fill: color, radius: (top-right: implicant-radius) ), dx-left, dy-bottom ), ( rect( width: width, height: width, stroke: (top: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width, left: color.darken(implicant-stroke-darken).transparentize(implicant-stroke-transparentize) + implicant-stroke-width), fill: color, radius: (top-left: implicant-radius) ), dx-right, dy-bottom ) ) } // Corner implicants. ) block( breakable: false, grid( columns: 3, align: center + horizon, [], [], x-label, [], [], table( columns: col * (cell-size,), align: center + horizon, inset: (y: 10pt), stroke: none, ..x-headers, ), y-label, table( rows: cell-size, align: center + horizon, inset: (x: 10pt), stroke: none, ..y-headers, ), body, ), ) } #let kmap( vars: (), landscape: true, headers: (:), terms: (:), implicants: (), // ((top-left, bottom-right),) | "maxterms" | "minterms" ) = { terms = ( type: "gray", // "minterms" | "maxterms" | "manual" | "gray" label-1: [1], label-0: [0], label-X: [X], positions: (), ignores: (), values: (), ..terms, ) let n = vars.len() let r = if landscape { int(calc.floor(n / 2)) } else { int(calc.ceil(n / 2)) } let c = n - r let rr = calc.pow(2, r) let cc = calc.pow(2, c) let nn = rr * cc let gray-indices = range(nn).map(v => decimal-to-gray(v)) let gray-mat = gray-indices.chunks(cc).enumerate().map(((i, res)) => { if calc.rem-euclid(i, 2) == 1 { res = res.rev() } res }) let gray-map = nn * (none,) for (k, v) in gray-mat .enumerate() .map(((i, v)) => v.enumerate().map(((j, v)) => (v, (x: j, y: i)))) .flatten() .chunks(2) { gray-map.at(k) = (v.x, v.y) } let gray-at(x, y) = gray-mat.at(y).at(x) let pos-at(g) = gray-map.at(g) let cells = if terms.type == "manual" { terms .values .enumerate() .sorted(key: ((i, v)) => { let g = gray-map.at(i) g.at(1) * cc + g.at(0) }) .map(v => v.at(1)) } else if terms.type == "gray" { gray-mat.flatten() } else if ("minterms", "maxterms").contains(terms.type) { gray-mat.flatten().map(i => if terms.ignores.contains(i) { terms.label-X } else if int(terms.positions.contains(i)).bit-xor(int(terms.type == "maxterms")) == 1 { terms.label-1 } else { terms.label-0 }) } let gen-headers(n) = range(n).map(v => decimal-to-binary(v, n: binary-count(n - 1))).map(v => binary-to-gray(v)) if access-field(headers, "x") == none { headers.x = gen-headers(cc) } if access-field(headers, "y") == none { headers.y = gen-headers(rr) } let corner-pair = ( gray-at(-1, -1), gray-at(0, 0), ) let corner-implicants = implicants.contains(corner-pair) let implicants-pos = implicants.map(pair-g => pair-g.map(pos-at)) let vertical-implicants = implicants-pos.filter(((g1, g2)) => g1.at(1) > g2.at(1) and g1.at(0) <= g2.at(0)) let horizontal-implicants = implicants-pos.filter(((g1, g2)) => g1.at(0) > g2.at(0) and g1.at(1) <= g2.at(1)) let implicants = implicants-pos.filter(((g1, g2)) => g1.at(0) <= g2.at(0) and g1.at(1) <= g2.at(1)) kmap-render( rr, cc, cells, corner-implicants: corner-implicants, vertical-implicants: vertical-implicants, horizontal-implicants: horizontal-implicants, implicants: implicants, x-label: vars.slice(r, r + c).join([]), y-label: vars.slice(0, r).join([]), x-headers: headers.x, y-headers: headers.y, ) } // #kmap(vars: ($x$, $y$)) // #kmap(vars: ($x$, $y$, $z$)) // #kmap(vars: ($x$, $y$, $z$), landscape: false, implicants: ((5, 0),)) // #kmap( // vars: ($x$, $y$, $z$, $w$), // implicants: ((10, 0),), // ) #kmap( vars: ($x$, $y$, $z$, $w$), // terms: (type: "gray"), terms: (type: "minterms", positions: (5, 7, 13, 15)), implicants: ((10, 0), (9, 3), (6, 12), (5, 15)), )
https://github.com/dssgabriel/master-thesis
https://raw.githubusercontent.com/dssgabriel/master-thesis/main/src/titlepage.typ
typst
Apache License 2.0
#grid( columns: (1fr, 1fr), align(top + center)[ #image("../figures/ups_logo.svg", width: 45%) ], align(center)[ #image("../figures/cea_logo.svg", width: 40%) ] ) #align( center, text(24pt)[ Paris-Saclay University ] ) #align( center, text(18pt)[ Master 2 High Performance Computing, Simulation \ End-of-studies internship report\ ] ) #line(length: 100%) #v(1.8em) #align(center, text(32pt)[*Rust and GPU programming*]) #line(length: 100%) #v(1em) #grid(columns: (1fr, 1fr), align(center, box(align(start, text(16pt)[ *Author :* \ Gabriel #smallcaps("<NAME>") ]))), align(center, box(align(end, text(16pt)[ *Supervisors :* \ Cédric #smallcaps("Chevalier") \ Soraya #smallcaps("Zertal") ]))) ) #v(1fr) #align(center, text(13pt)[*Abstract*]) #text(11pt)[ In recent years, the field of High Performance Computing (HPC) has known significant advances in hardware technology. With the advent of heterogeneous architectures, these improvements imply an ever-increasing need for hardware accelerator programming, which is essential to harness the computational performance of exascale supercomputers. #linebreak() To meet these new requirements, software engineering and programming languages are evolving to improve programmers' control and safety over parallel applications. Rust is a modern programming language focused on performance, memory safety, and concurrency. Its features make it an ideal choice for guaranteeing the robustness and efficiency of compute-intensive codes, particularly when parallelizing certain forms of data-flow algorithms. In this context, the CEA uses Rust to develop several applications and tools, some of which could benefit from the accelerations offered by GPUs. This internship aims to explore the capabilities of the Rust language for programming hardware accelerators. This work consists of a detailed overview of the current state of the art, performance analysis depending on the chosen code generation method, and a proof of concept by porting partitioning algorithms from CEA's #link("https://github.com/LIHPC-Computational-Geometry/coupe")[`coupe`] library on NVIDIA GPUs. ] #align(center, text(16pt)[CEA, DAM, DIF, F-91297, Arpajon, France]) #align(center, text(14pt)[August 31, 2023])
https://github.com/rabotaem-incorporated/probability-theory-notes
https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/02-general/!sec.typ
typst
= Общая теория вероятностей #include "01-kolmogorov.typ" #include "02-random-variables.typ" #include "03-joint-distribution.typ" #include "04-expected-value-and-variance.typ" #include "05-random-sequence-convergence.typ" #include "06-generating-functions.typ"
https://github.com/gianzamboni/cancionero
https://raw.githubusercontent.com/gianzamboni/cancionero/main/theme/legacy.typ
typst
// #import "@preview/cetz:0.2.1" // // #let chord = single-chord.with( // font: "Arial", // size: 10pt, // weight: "semibold", // background: color.silver) #let project(title: "", authors: (), date: none, body) = { show par: set block(spacing: 3em) set par(first-line-indent: 0em, leading: 1.75em) body } // #let newVerse = v(1em) // #let write(coord, text) = { // import cetz.draw: * // content(coord, [ // #set align(center) // #text // ]) // } // #let centerBox(body) = [ // #set align(center) // #body // ] // #let parseSongBodyWithoutChords(body) = { // let parsed = body.children.map((element) => { // if element == [ ] { // linebreak() // } else { // element // } // }) // parsed.remove(0) // return parsed // } // #let nonChordSong(body) = [ // #let parsed = parseSongBodyWithoutChords(body) // #columns(2, gutter: 1em)[ // #parsed.join("") // ] // ] // #let parseSongBodyWithChords(body) = { // let verses = body.children.split(parbreak()) // let parsed = () // parsed.push(verses.at(0)) // let counter = 1 // while counter < verses.len() { // let verse = verses.at(counter) // let shouldAddSpace = verse // .filter(elem => elem != [ ]) // .filter(elem => elem != colbreak()) // .filter(elem => elem.fields() == (:)).len() == 0 // parsed.push(linebreak()) // if(shouldAddSpace and verse.at(0) != [stanza]) { // parsed.push(v(-1em)) // } else if(verse.at(0) == colbreak()) { // parsed.push(v(-10em)) // } // if(verse.at(0) != [stanza]) { // parsed.push(verse) // } // counter = counter + 1 // } // parsed = parsed.flatten() // parsed.remove(0) // return parsed // } // #let chordSong(body) = [ // #set par(leading: 0.5em) // #let parsed = parseSongBodyWithChords(body) // #columns(2, gutter: 1em)[ // #parsed.join("") // ] // ] // #let cancion(title, artist, withCords: false, notas: [], body) = [ // #set par(first-line-indent: 0pt) // == #title // === #artist // #if(notas != []) [ // #notas // === Letra // ] // #if withCords { // chordSong(body) // } else { // nonChordSong(body) // } // #pagebreak() // ] // #let seccion(name) = text(size: 10pt, weight: "bold", font: "Arial", fill: rgb(255, 0, 0))[*\[#name\]*] // #let new-stanza = "stanza" // #let chordText(body) = [ // #set text(size: 16pt) // #body // ] // #let create-cord(tabs, fingers, size:2em, body) = chart-chord(tabs: tabs, fingers: fingers, size: size)[ // #chordText[#body] // ] // #let chordsData = ( // Am: ( fingers: "nn231nnn", tabs: "xo231o"), // A: ( fingers: "nn23nnn", tabs: "oo23oo"), // E: ( fingers: "n231nnn", tabs: "o231oo"), // Dm: ( fingers: "nnn231", tabs: "xxo231"), // D7: ( fingers: "nnn213", tabs: "xxo213"), // G: ( fingers: "21nn34", tabs: "32oo33") // ) // #let drawScaledChord(name) = { // let data = chordsData.at(name) // create-cord(data.tabs, data.fingers, name, size: 1.5em) // } // #let tipoRasgeos = ( // p: text(size: 13pt, baseline: -2.5pt)[#sym.arrow.b], // r: text(size: 16pt)[#sym.arrow.b.triple] // ) // #let rasgeo(..rasgeos) = { // let parsed = rasgeos.pos().map((rasgeo) => { // tipoRasgeos.at(rasgeo) // }) // [*Rasgeo* #parsed.join("")] // } // #let seconds(tuple) = tuple.at(1) // #let niveles(..notas) = { // let levels = notas.pos().map(seconds) // let spacing = 1 / calc.max(..levels) // let parsed = notas.pos().map((nota) => { // let altura = (-1 - nota.at(1)*spacing)*1em // overline(offset: altura )[#nota.at(0)] // }) // parsed.join("-") // }
https://github.com/Lslightly/TypstTemplates
https://raw.githubusercontent.com/Lslightly/TypstTemplates/main/templates/theory.typ
typst
MIT License
#import "@preview/ctheorems:1.1.2": * #show: thmrules #let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee")) #let corollary = thmplain( "corollary", "Corollary", base: "theorem", titlefmt: strong ) #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)) #let example = thmplain("example", "Example").with(numbering: none) #let proof = thmproof("proof", "Proof") // = Prime numbers // #definition[ // A natural number is called a #highlight[_prime number_] if it is greater // than 1 and cannot be written as the product of two smaller natural numbers. // ] // #example[ // The numbers $2$, $3$, and $17$ are prime. // @cor_largest_prime shows that this list is not exhaustive! // ] // #theorem("Euclid")[ // There are infinitely many primes. // ] // #proof[ // Suppose to the contrary that $p_1, p_2, dots, p_n$ is a finite enumeration // of all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list, // it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. Since // $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = 1$, a // contradiction. // ] // #lemma[ // a // ] // #corollary[ // There is no largest prime number. // ] <cor_largest_prime> // #corollary[ // There are infinitely many composite numbers. // ]
https://github.com/FkHiroki/ex-D2
https://raw.githubusercontent.com/FkHiroki/ex-D2/main/sections/section3.typ
typst
MIT No Attribution
= 問3 星の明るさと距離 == (1) 見かけの等級を$m$、絶対等級を$M$、星の地球からの距離を$d$とすると、 $ m - M = 5 log_(10) d - 5 $ の関係がある。まず、こと座α星の絶対等級は、 $ M &= m + 5 - 5 log_(10) d \ &= 0 + 5 - 5 log_(10) 7.67 \ &= 0 + 5 - 5 times 0.8848 \ &= 0 + 5 - 4.424 = 0.576 $ より、$0.58$ 等級である。次にわし座α星の絶対等級は、 $ M &= m + 5 - 5 log_(10) d \ &= 0.77 + 5 - 5 log_(10) 5.1 \ &= 0.77 + 5 - 5 times 0.7076 \ &= 0.77 + 5 - 3.538 = 2.232 $ より、$2.23$ 等級である。 == (2) 太陽とベテルギウスの平均光度、表面温度、半径をそれぞれ、$L_0$、$L$、$T_0$、$T$、$R_0$、$R$とする。この時、以下の関係が成り立つ。 $ L / L_0 = (R / R_0)^2 (T / T_0)^4 $ よって、この式を変形することで、ベテルギウスと太陽の半径比は、 $ R / R_0 &= (L / L_0)^(1/2) (T / T_0)^(-2) \ &= ((126000 L_(dot.circle)) / L_(dot.circle))^(1/2) (3600 / 6000)^(-2) \ &= 354.96 times 2.7778 tilde.eq 986 "倍" $ 次に、ベテルギウスの半径を1天文単位で表すことを考える。太陽半径は$R_0 = 6.955 times 10^8 m$であること(第4回講義スライドより)と、太陽から地球までの距離(1 au)が$1.5 times 10^11 m$(第3回講義スライドより)であることを考慮すると、ベテルギウスの半径は、 $ R &= 986 R_0 \ &= (986 times 6.955 times 10^8) / (1.5 times 10^11) \ &= 4.571 tilde.eq 4.57 "au" $
https://github.com/maxgraw/bachelor
https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/2-theory/webxr-hit-test.typ
typst
Das Hauptziel der Augmented Reality-Anwendung besteht in der Integration virtueller und realer Inhalte. Im @webxr-chapter wurde das WebXR Spaces Interface vorgestellt, welche das Tracking von Position und Bewegung in einer XRSession ermöglichen. Das System kann jedoch nicht bestimmen, ob sich das platzierte virtuelle Objekt auf einer realen Ebene oder Wand befindet. Die WebXR Hit Test API ermöglicht das Abfragen von realen Flächen und ermöglicht damit eine präzise Platzierung von Objekten @webxr-hit-test-module. In dieser Arbeit wird der Hit Test als ein Prozess definiert, der überprüft, ob ein mathematischer Strahl mit der durch die Technologie erfassten realen Welt interagiert. Virtuelle Objekte werden in diesem Zusammenhang nicht berücksichtigt. === XRHitTestSource Das Interface XRHitTestSource ermöglicht das Verwalten von Hit Tests innerhalb einer XRSession. Als Grundlage dient hierbei die jeweilige XRSession welche Informationen bereitstellt, die für die Durchführung des Hit Tests benötigt werden @webxr-hit-test-module. #let code = ```ts interface XRHitTestSource { undefined cancel(); }; partial interface XRSession { Promise<XRHitTestSource> requestHitTestSource(options); }; ``` #figure( code, caption: [XRHitTestSource Interface und requestHitTestSource Funktion] ) <XRHitTestSource-listing> Die Funktion requestHitTestSource aus @XRHitTestSource-listing einer XRSession ermöglicht das Initialisieren eines Hit-Testes. Bei diesem Vorgang wird ein XRSpace-Objekt übergeben, welches Informationen über die erfasste Umgebung enthält. Diese Informationen dienen als Grundlage für die räumliche Verortung der Hit-Tests in der realen Welt @webxr-hit-test-module. === XRHitTestResult Um die Ergebnisse eines Hit-Tests zu verarbeiten, wird das Interface XRHitTestResult bereitgestellt. Dieses Interface ermöglicht es, die Position und Orientierung eines getroffenen Punktes in der realen Welt zu bestimmen @webxr-hit-test-module. #let code = ```ts interface XRHitTestResult { XRPose? getPose(XRSpace); }; partial interface XRFrame { FrozenArray<XRHitTestResult> getHitTestResults(XRHitTestSource); }; ``` #figure( code, caption: [XRHitTestResult Interface und getHitTestResults Funktion] ) <XRHitTestResult-listing> Um das Ergebnis abzurufen, wird die Funktion getHitTestResults eines XRFrame-Objektes bereitgestellt. Wie in @XRHitTestResult-listing dargestellt wird hierbei das zuvor initialisierte XRHitTestSource-Objekt als Parameter übergeben. Das Ergebnis wird als Array von XRHitTestResult-Objekten zurückgegeben, welche Informationen über den getroffenen Punkt in der realen Welt enthalten. Die Funktion getPose eines XRHitTestResult-Objektes ermöglicht es, die Position und Orientierung des getroffenen Punktes in der realen Welt zu bestimmen @webxr-hit-test-module.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cuti/0.1.0/demo-and-doc/demo-and-doc.typ
typst
Apache License 2.0
#import "../lib.typ": * #import "@preview/sourcerer:0.2.1": code #set par(justify: true) = Cuti Demo & Doc == Introduction Cuti is a package that simulates fake bold weight for fonts by utilizing the `stroke` attribute of `text`. This package is typically used on fonts that do not have a `bold` weight, such as "SimSun". This package uses 0.02857em as the parameter for stroke. In Microsoft Office software, enabling fake bold will apply a border of about 0.02857em to characters. This is where the value of 0.02857em is derived from. (In fact, the exact value may be $1/35$.) #line(length: 100%) == fakebold `#fakebold[]` with no parmerter will apply the #fakebold[fakebold] effect to characters. #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst Fakebold: #fakebold[#lorem(5)] \ Bold: #text(weight: "bold", lorem(5)) \ Bold + Fakebold: #fakebold[#text(weight: "bold", lorem(5))] ``` ) #block( stroke: (paint: blue, thickness: 1pt, dash: "dashed"), inset: 10pt, )[ Fakebold: #fakebold[#lorem(5)] \ Bold: #text(weight: "bold", lorem(5)) \ Bold + Fakebold: #fakebold[#text(weight: "bold", lorem(5))] ] `#fakebold[]` has a `base-weight` parameter that can be used to specify a certain weight as the base weight for fake bold. By default, or when `base-weight` is `none`, the base weight will be inherited from the above context. #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst Bold + Fakebold: #fakebold(base-weight: "bold")[#lorem(5)] \ #set text(weight: "bold") Bold + Fakebold: #fakebold[#lorem(5)] ``` ) #block( stroke: (paint: blue, thickness: 1pt, dash: "dashed"), inset: 10pt, )[ Bold + Fakebold: #fakebold(base-weight: "bold")[#lorem(5)] \ #set text(weight: "bold") Bold + Fakebold: #fakebold[#lorem(5)] ] #line(length: 100%) == #regex-fakebold The `#regex-fakebold` is designed to be used in multilingual and multi-font scenarios. It allows the use of a RegExp string as the `reg-exp` parameter to match characters that will have the fake bold effect applied. It also accepts the `base-weight` parameter. #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst + RegExp `[a-o]`: #regex-fakebold(reg-exp: "[a-o]")[#lorem(5)] + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] \ #set text(weight: "bold") + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] ``` ) #block( stroke: (paint: blue, thickness: 1pt, dash: "dashed"), inset: 10pt, )[ + RegExp `[a-o]`: #regex-fakebold(reg-exp: "[a-o]")[#lorem(5)] \ + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] \ #set text(weight: "bold") + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] ] In Example \#3, `9` and `15` are the real bold characters from the font file, while the other characters are simulated as "fake bold" based on the `regular` weight. #line(length: 100%) == show-fakebold In multilingual and multi-font scenarios, different languages often utilize their own fonts, but not all fonts contain the `bold` weight. It can be inconvenient to use `#fakebold` or `#regex-fakebold` each time we require `strong` or `bold` effects. Therefore, the `#show-fakebold` function is introduced for `show` rule. The `show-fakebold` function shares the same parameters as `regex-fakebold`. By default, `show-fakebold` will apply the RegExp `"."`, which means all characters with the `strong` or `weight: "bold"` property will be fakebolded if the corresponding show rule has been set. `show text` rule and `show strong` rule should be set sperately. #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst #show text: show-fakebold Regular: #lorem(10) \ #text(weight: "bold")[Bold: #lorem(10)] ``` ) #block( stroke: (paint: blue, thickness: 1pt, dash: "dashed"), inset: 10pt, )[ #show text: show-fakebold Regular: #lorem(10) \ #text(weight: "bold")[Bold: #lorem(10)] ] Typically, the combination of bold + fakebold is not the desired effect. It is usually necessary to specify the RegExp to indicate which characters should utilize the fakebold effect. #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst #show strong: it => show-fakebold(reg-exp: "\p{script=Han}", it) Regular: 我正在使用 Typst 排版。 \ Strong: *我正在使用 Typst 排版。* ``` ) #block( stroke: (paint: blue, thickness: 1pt, dash: "dashed"), inset: 10pt, )[ #show strong: it => show-fakebold(reg-exp: "\p{script=Han}", it) Regular: 我正在使用 Typst 排版。 \ Strong: *我正在使用 Typst 排版。* ] It also accepts the `base-weight` parameter. #line(length: 100%) == cn-fakebold & show-cn-fakebold `cn-fakebold` and `show-cn-fakebold` are encapsulations of the above `regex-fakebold` and `show-fakebold`, pre-configured for use with Chinese text. Please refer to the Chinese documentation for usage instructions.
https://github.com/floriandejonckheere/utu-thesis
https://raw.githubusercontent.com/floriandejonckheere/utu-thesis/master/thesis/figures/07-proposed-solution/architecture.typ
typst
#import "@preview/cetz:0.2.2" #v(2em) #set text(font: "Fira Sans", size: 9pt) #cetz.canvas(length: 1cm, { import cetz.draw: * set-style( content: (padding: .2), stroke: black ) rect( (0, 0), (3.5, -1.25), radius: 0.1, fill: green.lighten(60%), stroke: 1pt + green.darken(20%), name: "source_code") content("source_code", align(center, [Source code\ repository])) rect( (0, -2), (3.5, -2.75), radius: 0.1, fill: yellow.lighten(60%), stroke: 1pt + yellow.darken(20%), name: "static_analysis") content("static_analysis", align(center, [Static analysis])) rect( (0, -3), (3.5, -3.75), radius: 0.1, fill: yellow.lighten(60%), stroke: 1pt + yellow.darken(20%), name: "evolutionary_analysis") content("evolutionary_analysis", align(center, [Evolutionary analysis])) line("source_code", "static_analysis", mark: (end: ">", fill: black)) rect( (5, -3), (8.5, -3.75), radius: 0.1, fill: yellow.lighten(60%), stroke: 1pt + yellow.darken(20%), name: "dependency_graph") content("dependency_graph", align(center, [Dependency graph])) line("evolutionary_analysis", "dependency_graph", mark: (end: ">", fill: black)) rect( (0, -4.75), (3.5, -5.5), radius: 0.1, fill: yellow.lighten(60%), stroke: 1pt + yellow.darken(20%), name: "clustering_algorithm") content("clustering_algorithm", align(center, [Clustering algorithm])) line("evolutionary_analysis", "clustering_algorithm", mark: (end: ">", fill: black)) rect( (0, -6.5), (3.5, -7.25), radius: 0.1, fill: yellow.lighten(60%), stroke: 1pt + yellow.darken(20%), name: "quality_metrics") content("quality_metrics", align(center, [Quality metrics])) line("clustering_algorithm", "quality_metrics", mark: (end: ">", fill: black)) rect( (0, -8.25), (3.5, -9.5), radius: 0.1, fill: green.lighten(60%), stroke: 1pt + green.darken(20%), name: "proposed_microservices") content("proposed_microservices", align(center, [Proposed\ microservices])) line("quality_metrics", "proposed_microservices", mark: (end: ">", fill: black)) // Groups rect( (-3, -1.75), (3.75, -4), radius: 0.1, stroke: (paint: gray, dash: "dashed"), name: "information_extraction") content("information_extraction.west", text: gray, align(center, [#h(8em)Information\ #h(8em)extraction])) rect( (-3, -4.5), (3.75, -5.75), radius: 0.1, stroke: (paint: gray, dash: "dashed"), name: "decomposition") content("decomposition.west", text: gray, align(center, [#h(8em)Decomposition])) rect( (-3, -6.25), (3.75, -7.5), radius: 0.1, stroke: (paint: gray, dash: "dashed"), name: "evaluation") content("evaluation.west", text: gray, align(center, [#h(8em)Evaluation])) rect( (4.5, -1.75), (9, -4), radius: 0.1, stroke: (paint: gray, dash: "dashed"), name: "visualization") content("visualization.north", text: gray, align(center, [\ Visualization])) }) #v(2em)
https://github.com/jassielof/typst-templates
https://raw.githubusercontent.com/jassielof/typst-templates/main/apa7/utils/addendum.typ
typst
MIT License
#import "languages.typ": * // for supplement: either "Appendix" or "Annex" #let addendum( heading-numbering: "A.1.", supplement: "Appendix", body, ) = context { show heading: set heading( supplement: get-terms(text.lang).at(supplement), numbering: heading-numbering ) counter(heading).update(0) show heading.where(level: 1): it => align(center)[ #pagebreak() #it.supplement #numbering(it.numbering, ..counter(heading).at(it.location())) #it.body ] show heading.where(level: 2): it => par(first-line-indent: 0in)[ #numbering(it.numbering, ..counter(heading).at(it.location())) #it.body ] show heading.where(level: 3): it => par(first-line-indent: 0in, emph[ #numbering(it.numbering, ..counter(heading).at(it.location())) #it.body ]) body }
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/basics/math/index.md
markdown
MIT License
# Math Math is a special environment that has special features related to... math. ## Syntax To start math environment, `$`. The spacing around `$` will make it either _inline_ math (smaller, used in text) or _display_ math (used on math equations on their own). ```typ // This is inline math Let $a$, $b$, and $c$ be the side lengths of right-angled triangle. Then, we know that: // This is display math $ a^2 + b^2 = c^2 $ Prove by induction: // You can use new lines as spacing too! $ sum_(k=1)^n k = (n(n+1)) / 2 $ ``` ## Math.equation The element that math is displayed in is called `math.equation`. You can use it for set/show rules: ```typ #show math.equation: set text(red) $ integral_0^oo (f(t) + g(t))/2 $ ``` Any symbol/command that is available in math, _is also available_ in code mode using `math.command`: ```typ #math.integral, #math.underbrace([a + b], [c]) ``` ## Letters and commands Typst aims to have as simple and effective syntax for math as possible. That means no special symbols, just using commands. To make it short, Typst uses several simple rules: - All single-letter words _turn into variables_. That includes any _unicode symbols_ too! - All multi-letter words _turn into commands_. They may be built-in commands (available with math.something outside of math environment). Or they **may be user-defined variables/functions**. If the command **isn't defined**, there will be **compilation error**. <div class="warning"> If you use kebab-case or snake_case for variables you want to use in math, you will have to refer to them as #snake-case-variable. </div> - To write simple text, use quotes: ```typ $a "equals to" 2$ ``` <div class="warning"> Spacing matters there! </div> ```typ $a "is" 2$, $a"is"2$ ``` - You can turn it into multi-letter variables using `italic`: ```typ $(italic("mass") v^2)/2$ ``` Commands see [there](https://typst.app/docs/reference/math/#definitions) (go to the links to see the commands). All symbols see [there](https://typst.app/docs/reference/symbols/sym/). ## Multiline equations To create multiline _display equation_, use the same symbol as in markup mode: `\\`: ```typ $ a = b\ a = c $ ``` ## Escaping Any symbol that is used may be escaped with `\\`, like in markup mode. For example, you can disable fraction: ```typ $ a / b \ a \/ b $ ``` The same way it works with any other syntax. ## Wrapping inline math Sometimes, when you write large math, it may be too close to text (especially for some long letter tails). ```typ #lorem(17) $display(1)/display(1+x^n)$ #lorem(20) ``` You may easily increase the distance it by wrapping into box: ```typ #lorem(17) #box($display(1)/display(1+x^n)$, inset: 0.2em) #lorem(20) ```
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/3-methodology/study-1/factors.typ
typst
MIT License
#import "../../../lib/mod.typ": * #v(-0.4em) === Factor Graph <s.m.factor-graph> #v(-0.4em) This section describes how the factor graph theory is used in the developed software. Thus, detailing each factor used in the #acr("GBP") algorithm, as was also done in the original work@gbpplanner. As touched on in @s.b.factor-graphs, the factors are the components of the factor grah that introduces constraints between the variables. ==== Variables $bold(V)$ <s.m.factors.variables> The variables represent the state of the robot at a given time in the future. The state-space is four dimensional, and consists of the robot's position and its first derivative; velocity, see @eq.state. $ #m.x = mat(x, y, equation.overdot(x), equation.overdot(y)) $<eq.state> Hence, the variables and thus robots all have four #acr("DOF") each; i.e. $"DOFS" = 4$ and does not change during the inference process. The implemented mathematics for the variables align with that which is described in #nameref(<s.b.gaussian-belief-propagation>, "Gaussian Belief Propagation"). ==== First Order Jacobian <s.m.factors.jacobian-first-order> The first order Jacobian is used to calculate the gradient of the factor measurement. The Jacobian is defined in $RR^(R times C)$, where $R$ is defined by the amount of rows in the factor measurement $h(#m.x)$, and $C$ is the amount of columns in the linearization point, which is state space columns multiplied by the amount of variables the factor connects. In mathematical terms, the implemented `first_order_jacobian`#footnote[Found in the #gbp-rs(content: [#crates.gbpplanner-rs]) crate at #source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/9d06aab257eec234a57a8a8a87ce54369da00cce/crates/gbpplanner-rs/src/factorgraph/factor/mod.rs#L102", "/src/factorgraph/factor/mod.rs:102")] function, can be expressed as follows; let - $h : RR^n -> RR^m$ be the factor measurement function that maps a linearization point to a measurement. - $#m.x$ be the linearization point, an $n$-dimensional vector, representing the state or states at which the Jacboian is computed. - $delta$ be a small perturbation value for computing the finite difference approximation. The function computes the Jacobian matrix $jacobian$ of $h$ at $#m.x$ by approximating the partial derivatives with respect to each component of $x$ using the #acr("FDM"). Mathematically, the $j$-th column of $jacobian$, denoted as $jacobian_j$, is computed using @eq.foj-column-j: $ jacobian_j = (h(#m.x + delta e_j) - h(#m.x)) / delta $<eq.foj-column-j> #let eq-exp = [ #show regex("(Matrix)"): set text(theme.mauve, font: "JetBrainsMono NF") Where $e_j$ is the $j$-th unit vector in $RR^n$, i.e. with 1 in the $j$-th position and 0 elsewhere. The Jacobian matrix is then computed by stacking the columns $jacobian_j$ for $j = 1, 2, ..., n$, which is described in @alg.jacobian-first-order; where `Matrix(r,c)` is a function that creates a zero matrix of size $r times c$. ] #let func(content) = text(theme.mauve, content) #let alg = [ #algorithm( [ #show regex("(Matrix|nrows)"): set text(theme.mauve, font: "JetBrainsMono NF", size: 0.85em) #let ind() = h(2em) *Input:* $#m.x, delta$ \ \ $h_0 #la h(#m.x)$ \ $jacobian #la "Matrix"(m, n)$ \ \ *for* $j = 1, dots, n$ *do* \ #ind()$#m.x _j #la #m.x _j + delta$ \ #ind()$h_1 #la h(#m.x)$ \ #ind()$h^prime #la (h_1 - h_0) / delta$ \ #ind()$jacobian_j = h^prime$ \ #ind()$#m.x _j #la #m.x _j - delta$ \ *end* \ \ *Output:* $jacobian$ ], caption: [First Order Jacobian] )<alg.jacobian-first-order> ] #let exp = [Thus the first order Jacobian is formed, resulting in an $RR^(m times n)$ matrix, where $m$ is the amount of rows in the measurement, $h$, and $n$ is the amount of columns in the linearization point, $#m.x$. This Jacobian represents the linear approximation of how the factor measurement changes with respect to small changes in each component of the linearization point.] #grid( columns: ( 5fr, 4fr, ), column-gutter: 1em, alg, eq-exp + linebreak() + h(1em) + exp, ) ==== Pose Factor $bold(f_p)$ <s.m.factors.pose-factor> The pose factor is the most basic, but also quite a crucial factor in the factor graph. It expresses a strictness on a variables belief at a given timestep. The pose factor can thereby be used to enforce a "known" position. For example, the robot is known to be at its current position and therefore the first variable in the chain has a strict pose factor attached. The same is the deal for the last variable in the chain, which enforces a _want_ to be at that position in the future. Every variable inbetween does not have a pose factor, as they are free to move within the constraints of the other factors. This is what allows the robot to diverge from its trajectory to collaboratively avoid other agents while maintaining a trajectory that will eventually lead to the goal. // sigma_pose = 0.000000000000001 The pose factor is a _anchoring_ factor, which means it imposes final constraints on the factor graph, which would otherwise only have contained relative positional information#footnote[_A visual introduction to Gaussian Belief Propagation_@gbp-visual-introduction presents a great interactive figure to see this and understand the anchoring effect #link("https://gaussianbp.github.io/#gaussian_gm", [_Gaussian Models_ section]).]. Pose factors do not exist for all variables in the prediction horizon, but rather only on the first and last variables. This grounds the belief of these variables in the environment. As in the original work, the pose factor standard deviation, $sigma_p$, is configurable, but as a default set to an extraordinarily low value of $1 times 10^(-15)$, which essentially fixes these positions in place during inference. This is an example of a very strong constraint imposed on the factor graph; as mentioned earlier, hard constraints are impossible, and this is the way to mimic them. An anchoring factor as the pose factor is the simplest as message passing and inference is not necessary here. Instead the factor essentially just overrides the prior distribution of the variable, and sets it to the known value. ==== Dynamic Factor $bold(f_d)$ <s.m.factors.dynamic-factor> The dynamic factor imposes the kinematic constraints on the robot. If one were to model a differential drive robot, it would take place here. For the purpose of this reproduction, the dynamic factor does not impose any strict non-holonomic constraints, but attempts to ensure a trajectory with smooth curvature and minimal jerk. This factor has a much more unsure default standard deviation, $sigma_d = 0.1$, which allows all variables between the first and last to move much more freely, which is key to the robots' ability to avoid each other and the environment.It is derived from a noise-on-acceleration dynamics model, promoting a zero-acceleration, feasible, and smooth trajectory@Mukadam_2018. The dynamic factor Jacobian, $jacobian_d$, is defined in $RR^(4 times 8)$, as the factor connects two variables. This Jacobian is computed and cached when the factor is created, as it does not change during the inference process. $ #let ident = $bold(upright(I))$ #let zero = $bold(upright(0))$ jacobian_d = mat( ident_n, delta_t ident_n, -ident_n, zero_n; zero_n, ident_n, zero_n, -ident_n; ) = mat( 1, 0, delta_t, 0, -1, 0, 0, 0; 0, 1, 0, delta_t, 0, -1, 0, 0; 0, 0, 1, 0, 0, 0, -1, 0; 0, 0, 0, 1, 0, 0, 0, -1; ) $<eq.jacobian-d> Where $ident_n$ is the $n times n$ identity matrix, $zero_n$ is the $n times n$ zero matrix, $delta_t$ is the time step between the two variables, and $n = "DOFS""/" 2$ is half the state space dimensions. The measurement function, $h_d$, is defined as the dot product between the above jacobian, and the linearization point, $#m.x$. $ h_d (#m.x) &= jacobian_d #m.x,#h(1em)"where" \ #m.x &= mat( x_1, y_1, equation.overdot(x_1), equation.overdot(y_1), x_2, y_2, equation.overdot(x_2), equation.overdot(y_2) )^top $<eq.dynamic-factor.measurement> // This measurement vector represents the following: // The relative position difference in the x-direction, adjusted by the predicted motion (velocity times time step). // The relative position difference in the y-direction, adjusted by the predicted motion (velocity times time step). // The relative velocity difference in the x-direction. // The relative velocity difference in the y-direction. // The measure function thus computes the relative state between two connected variables, incorporating both their positions and velocities, and adjusts for the predicted motion over the time step 𝛿𝑡δt. This is useful in state estimation frameworks where such relative measurements help in correcting and updating the state estimates of connected entities. The result of this dot product is a vector of length 4, which represents the information listed below, #boxed[*I-X*], and written out in @eq.dynamic-factor.measurement.result. #[ #set enum(numbering: box-enum.with(prefix: "I-")) + The relative position difference in the $x,y$-directions, adjusted by the predicted motion; $delta_t times mat(equation.overdot(x_1), equation.overdot(y_1))$. + The relative velocity difference in the $x,y$-directions. ] $ h_d (#m.x) = mat( x_1 + delta_t equation.overdot(x_1) - x_2; y_1 + delta_t equation.overdot(y_1) - y_2; equation.overdot(x_1) - equation.overdot(x_2); equation.overdot(y_1) - equation.overdot(y_2); ) $<eq.dynamic-factor.measurement.result> ==== Obstacle Factor $bold(f_o)$ <s.m.factors.obstacle-factor> The obstacle factor makes sure that the robot does not collide with any of the static environment. This is done by using a 2D #acr("SDF") representation of the environment baked into a rasterized image. The obstacle factors then measure the lightness of the #acr("SDF") at the linearization point, which determines whether the factor detects future collision or not. And example #acr("SDF") was shown earlier in @f.m.sdf#text(accent, "C"). As it is only the middle variables that are free to move, obstacle factors are only connected to these. However, do note that even though they only connect to a single variable, they are not anchoring factors as they do not override the variable priors, but are part of the message passing inference process. The Jacobian for the obstacle factor, $jacobian_o$, is defined in $RR^(1 times 4)$, and is the first order Jacobian following @alg.jacobian-first-order. As such, using the first order Jacobian, measuring the gradient of the underlying #acr("SDF"), enables the Jacobian to impact the factor potential to _push_ the variable in the opposite direction of environment obstacles, during the next message iteration. The measuring and effect of the obstacle factor is shown in @f.m.obstacle-factor. #let obstacle-colors = ( third: rgb("#E5B600"), second: rgb("#E0D305"), ) #let robot-color = catppuccin.macchiato.green #let s = 85% #figure( { set text(theme.text) grid( columns: 2, std-block[ #image("../../../figures/img/obstacle-factors-example-with-variables.png") A: Robot With Obstacle Factors ], std-block[ #image("../../../figures/img/obstacle-factors-example-only-sdf.png") A: Pure Environment SDF ], ) }, caption: [ Screenshots taken from #acr("MAGICS") of how the obstacle factor samples from the environment #acr("SDF"). A) In the left image a robot #swatch(robot-color) can be seen with its factorgraph extended in front of it. The obstacle factors of the second #swatch(obstacle-colors.second) and third #swatch(obstacle-colors.third) variable from the horizon variable, have sampled into the gradient boundary. The color reflects the magnitude of the repulsive effect the obstacle factor adds from the sample at that point. On the right image, the underlying #acr("SDF") sampled from is shown alone. B) The #acr("SDF") is shown by itself, without robot and environment colliders. ] )<f.m.obstacle-factor> The default standard deviation, $sigma_o$, for this factor is $0.01$, which is an order of magnitude lower than for the dynamic factor. This means that the obstacle factors' influence is stronger than the dynamic factor, making sure that avoiding obstacles is prioritized as a stronger constraint. The obstacle measurement function, $h_o (#m.x)$, is parameterized by the linearization point, $x$, and the #acr("SDF") image. The resulting measurement is a scalar value, $0 <= h_o (#m.x) <= 1$, essentially representing the lightness of the inverted #acr("SDF") at the position of the linearization point in 2D space. That is, the closer to 1, the closer the robot is to an obstacle, and 0 is completely free space. ==== Interrobot Factor $bold(f_i)$ <s.m.factors.interrobot-factor> The interrobot factor expresses how robots should interact with each other when they get close enough. Interrobot factors measure the distance between the two robots, and if they get too close, the factor will in turn impose a repulsive force on the robots. Interrobot factors only exist between robots that are close enough, however, as soon as they are, an interrobot factor will be created between each variable for each timestep. This happens symmetrically, which means both robots will have a factor for each of its variables that connects externally to the other robot's variables. These are the connection that are used when external iterations of #acr("GBP") are made, see @s.iteration-schedules. To identify the connected variable in the external factorgraph, the interrobot factor store an unique identifier that consists of a two field tuple of the robots id, and index offset from the current variable. The interrobot factors take a safety distance into account which is a scaled version of the two robots' radii, see @eq.interrobot-factor. $ h_i (#m.x _A, #m.x _B) = cases( 1 - (d_r (#m.x _A, #m.x _B)) / d_s "if" d_r (#m.x _A, #m.x _B) < d_s, 0, ) $<eq.interrobot-factor> where $#m.x _A$ is the linearization point for a variable in robot A's factor graph, $#m.x _B$ is the linearization point for the corresponding variable in robot B's factor graph, $d_r$ is the distance between the two robots, see @eq.interrobot-distance, and $d_s$ is the safety distance, which is calculated as $d_s = f times r$, where $f$ is a configurable parameter; scaling the robot's radius. $ d_r (#m.x _A, #m.x _B) = ||#m.x _A - #m.x _B|| $<eq.interrobot-distance> To weaken the effect of states further into the future, the factors precision matrix is defined as $Lambda_r = (t_k sigma_r)^(-2) bold(I)$. The interrobot factor Jacobian, $jacobian_i$, is defined in $RR^(4 times 8)$ as shown in @eq.jacobian-i. // #att[The Jacobian is used to calculate the gradient of the factor], which is used in the inference process. $ jacobian_i = mat( - (r (p_1_x - p_2_x)) / d_s, - (r (p_1_y - p_2_y)) / d_s, 0, 0, (r (p_1_x - p_2_x)) / d_s, (r (p_1_y - p_2_y)) / d_s, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0; ) $<eq.jacobian-i> Where $r$ is the robot's radius, $d_s$ is the safety distance, $p_1$ and $p_2$ are the positions of the two variables. ==== Asynchronous Message Passing <s.m.factors.asynchronous-message-passing> As mentioned in @s.b.factor-graphs, the factor graph inference typically happens in a synchronous manner. A variable to factor message first, then a factor to variable message. This synchronous method is likely to converge towards the true marginals. However, the factor graph structure allows for asynchronous message passing and asynchronous scheduling. In fact, with an asynchronous schedule it achieves better converge times than a synchronous one@gbp-visual-introduction, and can be made even better with a fixed round-robin approach@koller_2009. This result is expected as the asynchronous schedule allows for higher information density in each message, instead of sending low-delta messages that do not provide much new information. // although with a slower convergence, and likely with a higher variance@gbp-visual-introduction. But in theory, variables and factors can always keep each other updated as soon as they have something to update with, or as soon as they get the opportunity to do so. Thus all the necessary information for inference will still be passed, hence still expecting convergence. This is very useful in a multi-agent system such as `gbpplanner`@gbpplanner, where robots do not have boundless communication possibilities. As described above; the messages passed to and from interrobot factors from represent the communication between the robots. In `gbpplanner`, and thus also in this reproduction the robots have a finite communication radius, and radios that sometimes fail. This means that synchronous iterations are not guaranteed, but messages are rather passed on an opportunistic basis. For more details on internal and external iteration schedules see @s.iteration-schedules.
https://github.com/Carraro-Riccardo/Thesis
https://raw.githubusercontent.com/Carraro-Riccardo/Thesis/main/template/coverPage.typ
typst
#let coverPage( body ) = { box(width: 100%, height: 100%, stroke: 0.5pt, outset: 50pt, clip: false)[ #v(1.5em) #align(center, image("./assets/logo.png", width: 15em)) #v(4em) #align(center, text("UNIVERSITÀ DEGLI STUDI DI PADOVA", size: 2em, weight: "bold")) #align(center, text(smallcaps("Dipartimento DI Matematica \"Tullio Levi-Civita\""), size: 1.5em,)) #v(2.5em) #align(center, text(smallcaps("Corso di Laurea in"), size: 1.5em)) #align(center, text("INFORMATICA", size: 2em, weight: "bold")) #v(2.5em) #align(center, text(smallcaps("Tesi di Laurea"), size: 1.5em)) #align(center, text([VISUALIZZAZIONE TRIDIMENSIONALE PER \ LA GESTIONE DI MAGAZZINO], size: 1.6em)) #v(3em) #align(center, text(smallcaps("A.A. 2023/2024"), size: 1.5em, weight: "extralight")) #show grid: set text(size: 1.2em) #align(bottom, grid( columns: (1fr,1fr), align: (left, right), align(left+bottom, [*RELATORE*] + text("\nProf. <NAME>\n" + [*Proclamazione*: 20 Settembre 2024]),), align(right+bottom, [*STUDENTE*] + text("\n<NAME>\n" + [*Matricola n.* 2042346])) )) ] pagebreak() set page( numbering: "i", number-align: center, paper: "a4", margin: (x: 3cm, y: 2.5cm), ) counter(page).update(1) align(center+bottom, [<NAME>: _Visualizzazione tridimensionale per la gestione di magazzino_, Tesi di laurea triennale, © Settembre 2024 ]) pagebreak() align(center+horizon, [_"Non puoi risolvere un problema con lo stesso tipo di pensiero che hai usato per crearlo" \ - \ <NAME>_]) pagebreak() heading("Ringraziamenti", outlined: false) text([ Al termine di questo percorso universitario, desidero ringraziare tutte le persone che mi hanno sostenuto e accompagnato credendo in me anche nei momenti più difficili. Ringrazio il professor <NAME> per tutto il supporto ricevuto durante il tirocinio e nella redazione di questo documento, dimostrandosi sempre disponibile per chiarimenti e consigli. Un grazie a tutti i colleghi di Sanmarco Informatica S.p.A. per l'accoglienza e la disponibilità dimostrata, con i quali sin da subito ho instaurato un rapporto di collaborazione e amicizia che ha reso l'intera esperienza formativa e piacevole. Dedico inoltre un grazie speciale a mia madre Marilisa, mio padre Claudio e la sua compagna Silvia per l'enorme supporto che mi hanno dato in questi anni di studio e per avermi sempre sostenuto e spronato a dare il meglio di me stesso. Ringrazio in modo altrettanto speciale Sofia, la persona che amo, per essere sempre stata al mio fianco durante questa esperienza e per tutti i momenti vissuti insieme in questi anni. Infine ringrazio tutti i miei amici e compagni di corso che hanno reso questi anni di studio indimenticabili, insieme ai quali ho condiviso gioie e momenti di difficoltà, crescendo e imparando insieme. \ Grazie a tutti voi. #grid( columns: (1fr, 1fr), align: (left, right), [_Padova, settembre 2024_], [_<NAME>_] ) ] ) pagebreak() heading("Sommario", outlined: false) [ Il presente documento descrive l'esperienza di tirocinio svolta presso l'azienda Sanmarco Informatica S.p.A. del laureando <NAME>, nel periodo 20 maggio - 12 luglio 2024. L'obiettivo era lo sviluppo di una visualizzazione tridimensionale per la gestione di magazzino, dando la possibilità di creare ordini di movimentazione della merce in modo intuitivo e veloce mediante un'operazione di _drag & drop_ direttamente nell'ambiente 3D. Il lavoro svolto è stato direttamente integrato nel _software_ sviluppato dall'azienda, risultando in un'estensione delle funzionalità utilizzabili del prodotto. Il documento è strutturato in quattro capitoli, quali: - *L'azienda Sanmarco Informatica*: presenta il contesto organizzativo e produttivo in cui il laureando è stato inserito; - *Il tirocinio*: descrive il progetto proposto, il rapporto dell'azienda con lo _stage_ e le motivazioni che hanno portato alla scelta di questo progetto; - *Svolgimento del tirocinio*: descrive il metodo di lavoro adottato, le attività svolte e i risultati ottenuti; - *Valutazione retrospettiva*: riporta le considerazioni finali del laureando sul progetto svolto e sulle competenze acquisite. \ Al fine di agevolare la lettura, il documento rispetta le seguenti convenzioni tipografiche: - i termini in linguaggio diverso dall'italiano sono posti in _corsivo_; - ogni immagine è corredata da una didascalia e dalla fonte da cui è stata tratta; - i termini riportati nel glossario riportano una _G_ posta a pedice. \ In appendice è presente il glossario dei termini meno consueti utilizzati, insieme alla lista di abbreviazioni e acronimi e alla bibliografia e sitografia consultata. ] pagebreak() body }
https://github.com/Skimmeroni/Appunti
https://raw.githubusercontent.com/Skimmeroni/Appunti/main/README.md
markdown
Creative Commons Zero v1.0 Universal
# Appunti Appunti su alcuni corsi della facoltá di Informatica all'_Universitá degli Studi di Milano - Bicocca_. ## Compilare da sorgente Nelle varie cartelle sono giá presenti i file PDF precompilati, quindi basta scaricare quelli (o clonare l'intera repo). Se si volesse comunque compilare i file sorgente, questi sono scritti con [SILE](https://sile-typesetter.org), un sostituto moderno di LaTeX. Banalmente: ``` sile filename.sil ``` Oltre ai pacchetti inclusi di default in SILE, servono `ptable` per tabelle e box di testo e `textsubsuper` per il testo in apice/pedice. Ora sto sperimentando con [Typst](https://typst.app), probabilmente riscriveró gli appunti in questo linguaggio. Per compilare: ``` typst compile filename.typ ``` I diagrammi sono scritti con [Pikchr](https://pikchr.org). I file SVG che questo restituisce possono poi essere convertiti in PDF con, ad esempio, [CairoSVG](https://cairosvg.org) o [Inkscape](https://inkscape.org): ``` pikchr --svg-only filename.pikchr | cairosvg -o filename.pdf - ```
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/05-features/adobe-fea-lang.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note #import "/lib/glossary.typ": tr #show: web-page-template // ## The Adobe feature language == Adobe 特性语言 // OpenType instructions - more usually known as "rules" - are normally written in a language that doesn't exactly have a name; it's known variously as "AFDKO" (from the "Adobe Font Development Kit for OpenType", a set of software tools one of which reads this syntax and adds the rules into binary font files), "Adobe feature language", "fea", or "feature format". Other ways of representing rules are available, (and inside the font they are stored in quite a different representation) but this is the most common way that we can write the rules to program our fonts. OpenType 指令也被称为规则,它们通常由一种并没有具体名字的语言写成。人们可能会称它为“AFDKO”、“Adobe特性语言”、“fea”或者“特性格式”。其中 AFDKO 是Adobe OpenType 字体开发套件(Adobe Font Development Kit for OpenType)的简称。这种规则也有其他书写方式(比如当被储存到字体中时,就又是另一种不同的格式),但Adobe的这种格式是被最普遍使用的。 // There are a number of alternatives to AFDKO for specifying OpenType layout features - Microsoft's VOLT (Visual OpenType Layout Tool), my own FLUX (Font Layout UX), and High Logic Font creator all allow you to create features and proof and preview them visually. Monotype also has their own internal editor, FontDame, which lays out OpenType features in a text file. (I've also written an alternative syntax called FEE, which allows for extensions and plugins to add higher-level commands to the language.) 除了 AFDKO 之外还有其他编写OpenType#tr[layout]特性的工具:微软的 VOLT(Visual OpenType Layout Tool),我编写的FLUX(Font Layout UX),以及支持创建并可视化验证OpenType特性的High Logic FontCreator。蒙纳公司也有一个内部的编辑工具,叫做FontDame,它使用文本文件来编辑OpenType特性。(我也编写过一个类似的叫做 FEE 的语言,它支持使用插件和扩展来添加高级命令。) // But Adobe's language is the one that almost everyone uses, and as a font engineer, you're going to need to know it very well. So let's begin. 但总的来说Adobe的语言还是使用最广泛的。而且作为字体设计师,你也需要对它有足够的了解,所以我们就选它了。
https://github.com/piepert/logik-tutorium-wise2024-2025
https://raw.githubusercontent.com/piepert/logik-tutorium-wise2024-2025/main/src/packages/inference.typ
typst
Creative Commons Zero v1.0 Universal
#let normalform(..arguments) = { let lines = () for argument in arguments.pos() { if type(argument) != "array" { return normalform(arguments.pos()) } else { let i = 0 for sentence in argument { if i+1 >= argument.len() { lines.push((align(right)[Also:], sentence)) } else { lines.push(([], sentence)) } i += 1 } } } grid(columns: 2, column-gutter: 1em, row-gutter: 0.65em, ..lines.flatten()) } #let inference-line = (v(-0.6em), table.hline(stroke: 0.75pt), v(0em)) #let inference(..lines) = { table( inset: 0pt, row-gutter: 0.65em, stroke: none, ..lines.pos().map(e => if e != inference-line { block(inset: (x: 2pt), e) } else { e }).flatten()) } #let inference-raw(raw-block) = { inference(..raw-block.text.split("\n") .map(e => e.trim()) .map(e => if e == "----" { inference-line } else { eval(mode: "markup", e) })) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/showybox/1.1.0/showy.typ
typst
Apache License 2.0
/* * ShowyBox - A package for Typst * <NAME> and Showybox Contributors (c) 2023 * * Main Contributors: * - <NAME> (<https://github.com/jneug>) * * showy.typ -- The package's main file containing the * public and (more) useful functions * * This file is under the MIT license. For more * information see LICENSE on the package's main folder. */ /* * Import functions */ #import "lib/func.typ": * #import "lib/sections.typ": * /* * Function: showybox() * * Description: Creates a showybox * * Parameters: * - title: Title of the showybox * - footer: Footer of the showybox * - frame: * + title-color: Color used as background color where the title goes * + body-color: Color used as background color where the body goes * + footer-color: Color used as background color where the footer goes * + border-color: Color used for the showybox's border * + inset: Inset for the title, body, and footer, if title-inset, body-inset, footer-inset aren't given * + radius: Showybox's radius * + thickness: Border width of the showybox * + dash: Showybox's border style * - title-style: * + color: Text color * + weight: Text weight * + align: Text align * + boxed: Whether the title's block should be apart or not * + boxed-align: Alignement of the boxed title * + sep-thickness: Title's separator thickness * - body-styles: * + color: Text color * + align: Text align * - footer-style: * + color: Text color * + weight: Text weight * + align: Text align * + sep-thickness: Footer's separator thickness * - sep: * + width: Separator's width * + dash: Separator's style (as a 'line' dash style) * + gutter: Separator's gutter space * - shadow: * + color: Shadow color * + offset: How much to offset the shadow in x and y direction either as a length or a dictionary with keys `x` and `y` * - width: Showybox's width * - align: Alignement of the showybox inside its container * - breakable: Whether the showybox can break if it reaches the end of its container * - spacing: Space above and below the showybox * - above: Space above the showybox * - below: Space below the showybox * - body: The content of the showybox */ #let showybox( frame: ( title-color: black, body-color: white, border-color: black, footer-color: luma(220), inset: (x: 1em, y: .65em), radius: 5pt, thickness: 1pt, dash: "solid" ), title-style: ( color: white, weight: "bold", align: left, boxed: false, boxed-align: left, sep-thickness: 1pt ), body-style: ( color: black, align: left ), footer-style: ( color: luma(85), weight: "regular", align: left, sep-thickness: 1pt, ), sep: ( width: 1pt, dash: "solid", gutter: 0.65em ), shadow: none, width: 100%, breakable: false, /* align: none, / collides with align-function */ /* spacing, above, and below are by default what's set for all `block`s */ title: "", footer: "", ..body ) = style(styles => { /* * Useful booleans */ let titled = (title != "") let boxed = title-style.at("boxed", default: false) /* * Useful sizes and alignements */ let title-size = measure(title, styles) let title-block-height = title-size.height + showy-inset(top, showy-section-inset("title", frame)) + showy-inset(bottom, showy-section-inset("title", frame)) let boxed-align = title-style.at("boxed-align", default: left) /* * Alignment wrapper */ let alignprops = (:) for prop in ("spacing", "above", "below") { if prop in body.named() { alignprops.insert(prop, body.named().at(prop)) } } let alignwrap( content ) = block( ..alignprops, width: 100%, if "align" in body.named() and body.named().align != none { align(body.named().align, content) } else { content } ) /* * Optionally create one or two wrapper * functions to add a shadow. */ let shadowwrap = (sbox) => sbox let boxedtitleshadowwrap = (tbox) => tbox if shadow != none { /* Since we cannot modify a exxtern variable from style(), define a local variable for shadow values, called d-shadow */ let d-shadow = shadow if type(shadow.at("offset", default: 4pt)) != "dictionary" { d-shadow.offset = ( x: shadow.at("offset", default: 4pt), y: shadow.at("offset", default: 4pt) ) } shadowwrap = (sbox) => { /* If it has a boxed title, leave some space to avoid collisions with other elements next to the showybox*/ if titled and boxed { v(title-block-height - 10pt) } block( breakable: breakable, radius: frame.at("radius", default: 5pt), fill: shadow.at("color", default: luma(128)), spacing: 0pt, outset: ( left: -d-shadow.offset.x, right: d-shadow.offset.x, bottom: d-shadow.offset.y, top: -d-shadow.offset.y ), /* If it have a boxed title, substract some space to avoid the shadow to be body + title height, and only body height */ if titled and boxed { v(-(title-block-height - 10pt)) sbox } else { sbox } ) } if titled and boxed { /* Due to some uncontrolable spaces between blocks, there's the need of adding an offset to `bottom-outset` to avoid an unwanted space between the boxed-title shadow and the body. Hopefully in the future a more pure-mathematically formula will be found. At the moment, this 'trick' solves all cases where a showybox title has only one line of heights */ let bottom-outset = 10pt + frame.at("thickness", default: 1pt)/2 - .15pt boxedtitleshadowwrap = (tbox) => block( breakable: breakable, radius: (top: frame.at("radius", default: 5pt)), fill: shadow.at("color", default: luma(128)), spacing: 0pt, outset: ( left: -d-shadow.offset.x, right: d-shadow.offset.x, top: -d-shadow.offset.y, bottom: -bottom-outset ), tbox ) } } let showyblock = { if titled and boxed{ v(title-block-height - 10pt) } block( width: width, fill: frame.at("body-color", default: white), radius: frame.at("radius", default: 5pt), inset: 0pt, spacing: 0pt, breakable: breakable, stroke: showy-stroke(frame) )[ /* * Title of the showybox */ #if titled and not boxed { showy-title(frame, title-style, title) } else if titled and boxed { // Leave some space for putting a boxed title v(10pt) place( top + boxed-align, dy: -(title-block-height - 10pt), dx: if boxed-align == left { 1em } else if boxed-align == right { -1em } else { 0pt }, boxedtitleshadowwrap(showy-title(frame, title-style, title)) ) } /* * Body of the showybox */ #showy-body(frame, body-style, sep, ..body) /* * Footer of the showybox */ #if footer != "" { showy-footer(frame, footer-style, footer) } ] } alignwrap( shadowwrap(showyblock) ) })
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/algorithmic/0.1.0/test.typ
typst
Apache License 2.0
#import "algorithmic.typ": algorithm #import "algorithmic.typ" #algorithm({ import algorithmic: * Cmt[blah] })
https://github.com/KrisjanisP/lu-icpc-notebook
https://raw.githubusercontent.com/KrisjanisP/lu-icpc-notebook/main/notebook.typ
typst
#set text(size: 8pt,font: "New Computer Modern",) #set page(paper: "a4",flipped: true,margin: (x:1cm,y:1cm)) #set page(header: context [ #block(inset:5pt)[ *University of Latvia* #h(1fr) #counter(page).display( "1/1", both: true, ) ] ]) #set par(justify: true) #set document(title: "LU ICPC kladīte ;)",author: ("<NAME>","<NAME>", "<NAME>", "<NAME>")) #set heading(numbering: "1.") // #show: columns.with(3, gutter: 2em) #columns(3, gutter: 2em)[ #show heading.where( level: 1 ): it => block(width: 100%)[ #set align(center) #set text(12pt, weight: "regular") #it.body #v(1em) ] #align(center)[#block(text(weight: 700, 1.75em, "LU ICPC kladīte ;)"))] #outline(indent: 2em) #include "1-cpplang.typ" #colbreak() #include "2-algebra.typ" #colbreak() #include "3-geometry.typ" #colbreak() #include "4-structures.typ" #colbreak() #include "5-graph.typ" #colbreak() #include "6-strings.typ" #colbreak() #include "7-dynamic.typ" #colbreak() ] #include "8-other.typ"
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/construct-10.typ
typst
Other
// Error: 6-8 expected integer, float, label, or string, found content #str([])
https://github.com/jneug/typst-codetastic
https://raw.githubusercontent.com/jneug/typst-codetastic/main/README.md
markdown
MIT License
# Codetastic (v0.2.2) **Codetastic** is a [Typst](https://github.com/typst/typst) package for drawing barcodes and 2d codes. ## Usage For Typst 0.6.0 or later, import the package from the Typst preview repository: ```typst #import "@preview/codetastic:0.2.2" ``` After importing the package call any of the code generation functions: ```typst #import "@preview/codetastic:0.2.2": ean13, qrcode #ean13(4012345678901) #qrcode("https://github.com/typst/typst") ``` The output should look like this: ![Example for codes drawn with Codetastic](assets/example.png) ## Further documentation See `manual.pdf` for a full manual of the package. ## Development The documentation is created using [Mantys](https://github.com/jneug/typst-mantys), a Typst template for creating package documentation. To compile the manual, Mantys needs to be available as a local package. Refer to Mantys' manual for instructions on how to do so. ## Changelog ### Version 0.2.2 - qrcodes: - Fixed issue with alignment pattern placement. - Removed minimal borders around modules for sharper edges with small module sizes. ### Version 0.2.1 - qrcodes: - Fixed wrong sizing for `width` key. - The code didn't take the quiet zone into account. - Moved debug information into quiet zone. ### Version 0.2.0 - Removed CeTZ as a dependecy. - Now using native Typst drawing functions. - Hugh speed improvements for large QR-Codes. - Fixed issue with checksum calculation for gtin/ean codes. ### Version 0.1.0 - Initial release submitted to [typst/packages](https://github.com/typst/packages).
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10B80.typ
typst
Apache License 2.0
#let data = ( ("PSALTER PAHLAVI LETTER ALEPH", "Lo", 0), ("PSALTER PAHLAVI LETTER BETH", "Lo", 0), ("PSALTER PAHLAVI LETTER GIMEL", "Lo", 0), ("PSALTER PAHLAVI LETTER DALETH", "Lo", 0), ("PSALTER PAHLAVI LETTER HE", "Lo", 0), ("PSALTER PAHLAVI LETTER WAW-AYIN-RESH", "Lo", 0), ("PSALTER PAHLAVI LETTER ZAYIN", "Lo", 0), ("PSALTER PAHLAVI LETTER HETH", "Lo", 0), ("PSALTER PAHLAVI LETTER YODH", "Lo", 0), ("PSALTER PAHLAVI LETTER KAPH", "Lo", 0), ("PSALTER PAHLAVI LETTER LAMEDH", "Lo", 0), ("PSALTER PAHLAVI LETTER MEM-QOPH", "Lo", 0), ("PSALTER PAHLAVI LETTER NUN", "Lo", 0), ("PSALTER PAHLAVI LETTER SAMEKH", "Lo", 0), ("PSALTER PAHLAVI LETTER PE", "Lo", 0), ("PSALTER PAHLAVI LETTER SADHE", "Lo", 0), ("PSALTER PAHLAVI LETTER SHIN", "Lo", 0), ("PSALTER PAHLAVI LETTER TAW", "Lo", 0), (), (), (), (), (), (), (), ("PSALTER PAHLAVI SECTION MARK", "Po", 0), ("PSALTER PAHLAVI TURNED SECTION MARK", "Po", 0), ("PSALTER PAHLAVI FOUR DOTS WITH CROSS", "Po", 0), ("PSALTER PAHLAVI FOUR DOTS WITH DOT", "Po", 0), (), (), (), (), (), (), (), (), (), (), (), (), ("PSALTER PAHLAVI NUMBER ONE", "No", 0), ("PSALTER PAHLAVI NUMBER TWO", "No", 0), ("PSALTER PAHLAVI NUMBER THREE", "No", 0), ("PSALTER PAHLAVI NUMBER FOUR", "No", 0), ("PSALTER PAHLAVI NUMBER TEN", "No", 0), ("PSALTER PAHLAVI NUMBER TWENTY", "No", 0), ("PSALTER PAHLAVI NUMBER ONE HUNDRED", "No", 0), )
https://github.com/skriptum/diatypst
https://raw.githubusercontent.com/skriptum/diatypst/main/lib.typ
typst
MIT License
#let layouts = ( "small": ("height": 9cm, "space": 1.4cm), "medium": ("height": 10.5cm, "space": 1.6cm), "large": ("height": 12cm, "space": 1.8cm), ) #let slides( content, title: none, subtitle: none, date: none, authors: (), layout: "medium", ratio: 4/3, title-color: none, counter: true, footer: true, toc: true, code-styling: true ) = { // Parsing if layout not in layouts { panic("Unknown layout " + layout) } let (height, space) = layouts.at(layout) let width = ratio * height // Colors if title-color == none { title-color = blue.darken(50%) } let body-color = title-color.lighten(80%) let header-color = title-color.lighten(65%) let fill-color = title-color.lighten(50%) // Setup set document( title: title, author: authors, ) set heading(numbering: "1.a") set page( width: width, height: height, margin: (x: 0.5 * space, top: space, bottom: 0.6 * space), header: [ #context { let page = here().page() let headings = query(selector(heading.where(level: 2))) let heading = headings.rev().find(x => x.location().page() <= page) if heading != none { set align(top) set text(1.4em, weight: "bold", fill: title-color) v(space / 2) block(heading.body + if not heading.location().page() == page [ #{numbering("(i)", page - heading.location().page() + 1)} ] ) } } // Counter #if counter == true { v(-space/1.5) align(right+top)[ // Dots before the current slide #context { let before = query(selector(heading).before(here())) for i in before { [ #link(i.location())[ #box(circle(radius: 0.08cm, fill: fill-color, stroke: 1pt+fill-color)) ] ] } } // current slide #context { let current = query(selector(heading).after(here())).first() link(current.location())[ #box(circle(radius: 0.08cm, fill: fill-color, stroke: 1pt+fill-color)) ] } // Dots after current slide #context { let after = query(selector(heading).after(here())).slice(1) for i in after { [ #link(i.location())[ #box(circle(radius: 0.08cm, stroke: 1pt+fill-color)) ] ] } } ] } ], header-ascent: 0%, // Footer footer: [ #if footer == true { set text(0.7em) box()[#line(length: 50%, stroke: 2pt+fill-color )] box()[#line(length: 50%, stroke: 2pt+body-color)] v(-0.3cm) grid( columns: (1fr, 1fr), align: (right,left), inset: 4pt, [#smallcaps()[#title]], [ #if subtitle != none { subtitle } else if authors != none { if (type(authors) != array) {authors = (authors,)} authors.join(", ", last: " and ") } else [#date] ], ) } ], footer-descent:0.8em, ) set bibliography( title: none ) // Section Slides show heading.where(level: 1): x => { set page(header: none,footer: none, margin: 0cm) set align(horizon) grid( columns: (1fr, 3fr), inset: 10pt, align: (right,left), fill: (title-color, white), [#block(height: 100%)],[#text(1.2em, weight: "bold", fill: title-color)[#x]] ) } show heading.where(level: 2): pagebreak(weak: true) show heading: set text(1.1em, fill: title-color) // Title Slide if (title == none) { panic("A title is required") } else { if (type(authors) != array) { authors = (authors,) } set page(footer: none, header: none, margin: 0cm) block( inset: (x:0.5*space, y:1em), fill: title-color, width: 100%, height: 60%, align(bottom)[#text(2.0em, weight: "bold", fill: white, title)] ) block( height: 30%, width: 100%, inset: (x:0.5*space,top:0cm, bottom: 1em), if subtitle != none {[ #text(1.4em, fill: title-color, weight: "bold", subtitle) ]} + if subtitle != none and date != none { text(1.4em)[ \ ] } + if date != none {text(1.1em, date)} + align(left+bottom, authors.join(", ", last: " and ")) ) } // Additional Styling (Term, Code) show terms.item: it => { set block(width: 100%, inset: 5pt) stack( block(fill: header-color, radius: (top: 0.2em, bottom: 0cm), strong(it.term)), block(fill: body-color.lighten(20%), radius: (top: 0cm, bottom: 0.2em), it.description), ) } if (code-styling == true) { show raw.where(block: false): it => { box(fill: body-color.lighten(40%), inset: 1pt, radius: 1pt, baseline: 1pt)[#text(size:8pt ,it)] } show raw.where(block: true): it => { block(radius: 0.5em, fill: body-color.lighten(40%), width: 100%, inset: 1em, it) } } show list: set list(marker: ( text(fill: title-color)[•], text(fill: title-color)[‣], text(fill: title-color)[-], )) show table: set table( stroke: (x, y) => ( x: none, bottom: 0.8pt+black, top: if y == 0 {0.8pt+black} else if y==1 {0.4pt+black} else { 0pt }, ) ) show table.cell.where(y: 0): set text( style: "normal", weight: "bold") // for first / header row set table.hline(stroke: 0.4pt+black) set table.vline(stroke: 0.4pt) // Outline set outline( // target: heading.where(level: 1), indent: true, ) show outline: set heading(level: 2) if (toc == true) { outline() } // Content content }
https://github.com/SillyFreak/typst-scrutinize
https://raw.githubusercontent.com/SillyFreak/typst-scrutinize/main/src/grading.typ
typst
MIT License
/// Takes an array of _flattened_ task metadata and returns the sum of their points. Tasks without points count as zero points. /// /// - tasks (array): a flat array of task metadata dictionaries /// - field (string): the field in the metadata over which to calculate the sum /// -> integer, float #let total-points(tasks, field: "points") = { tasks.map(t => { if t.data != none { t.data.at(field, default: 0) } else { 0 } }).sum(default: 0) } /// A utility function for generating grades with upper and lower point limits. The parameters must /// alternate between grade names and threshold scores, with grades in ascending order. These will /// be combined into dictionaries for each grade with keys `body`, `lower-limit`, and `upper-limit`. /// The first (lowest) grade will have a `lower-limit` of `none`; the last (highest) grade will have /// an `upper-limit` of `none`. /// /// Example: /// /// #example( /// mode: "markup", /// ratio: 1.8, /// scale-preview: 100%, /// ```typ /// #let total = 8 /// #let (bad, okay, good) = grading.grades( /// [bad], total * 2/4, [okay], total * 3/4, [good] /// ) /// You will need #okay.lower-limit points to pass, /// everything below is a _#(bad.body)_ grade. /// ``` /// ) /// /// - ..args (any): only positional: any number of grade names interspersed with scores /// -> array #let grades(..args) = { assert(args.named().len() == 0) let args = args.pos() assert(calc.odd(args.len())) range(0, args.len(), step: 2).map((i) => ( body: args.at(i), lower-limit: if i > 0 { args.at(i - 1) }, upper-limit: if i < args.len() - 1 { args.at(i + 1) }, )) }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/calc-24.typ
typst
Other
// Error: 20-21 base may not be zero, NaN, infinite, or subnormal #calc.log(1, base: 0)
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/05-features/ligature.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note #import "/lib/glossary.typ": tr #show: web-page-template // ## Basic feature coding - substitutions and ligatures == 编写基础特性——#tr[substitution]与#tr[ligature] // Here is the simplest complete OpenType program: 这是一个最简单但完整的OpenType程序: ```fea feature liga { sub f f by f_f; } liga; ``` // Read this as "in the `liga` feature, substitute the glyphs `f f` by `f_f`." This assumes that we have at least two glyphs in our font, one of which is called `f` and another which is called `f_f`. Later on we'll see precisely what we mean by "feature" and why we made one called `liga`, but for now what you need to know is that we have created a rule that will be applied by the shaper whenever some text is set in our font. 此代码可以理解为:在名为`liga`的特性开启时,将#tr[glyph]`f f`替换为`f_f`。这就表明我们的字体里至少有 `f` 和 `f_f`两个#tr[glyph]。后面我们会明确定义什么叫“特性”,也会了解为什么将它起名为`liga`。现在只需要知道,通过这段代码我们就能创建一条在某些文本被设置为此字体时会被#tr[shaper]应用的规则。 // The feature language has a simple syntax. The full details are available as part of the [AFDKO Documentation](http://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html), but the basics are fairly easy to pick up by inspection; a feature is defined like so: 这种用于编写特性的语言语法十分简单。它的完整定义可以参考AFDKO的文档,但其基本使用通过观察上例就能掌握。特性通过如下方式定义: ```fea feature name { ... } name; ``` // We created a feature called `liga` and placed a rule inside it. The rules all start with a rule name and end with a semicolon, but what is in the middle depends on the nature of the rule. The rule we created will substitute one set of glyphs for another, so it is a `sub` rule (you can also spell this `substitution`, if you like). There are various kinds of `sub` rule, and we'll look at them systematically in the next chapter, but the one we're using has two parts to it: the *match*, which consists of one glyph name, and then the *replacement* which is introduced by the keyword `by` and consists of two glyph names. There are also `pos` (or `position`) rules to change the position of glyphs; `sub` rules go in the `GSUB` table and `pos` rules go in the `GPOS` table. Simple, really. 上例就用这种方式创建了一个叫做`liga`的特性,并在其中放置了一条规则。规则语句由规则名开始,使用分号结尾,中间部分的格式则取决于使用的规则。例子中的规则用于对一些#tr[glyph]进行#tr[substitution]操作,这种规则叫做`sub`(表示subtitution,#tr[substitution])。`sub`规则还有其他几种变体,会在下章中进行具体介绍。现在我们先专注于最简单的这个,它由两部分组成:匹配部分,由两个#tr[glyph]名组成;替换部分,由 `by` 关键字引出,只有一个#tr[glyph]名。另外还有用于改变#tr[glyph]位置的 `pos`(或写成`position`)规则。`sub` 规则放在 `GSUB` 表中,`pos` 规则放在 `GPOS` 表中。很简单,对吧! // But how do we convert the textual rules we have written into the binary format of these tables? As a designer you might be used to using your font editor, which may also automate some or all of the process of creating OpenType rules and compiling them into the font. But this is often quite slow; it may take a few seconds to completely build and export a font, and when we're developing and testing complex layouts, we don't want to wait that long between tests. (We don't want to be installing fonts and resetting caches before generating our testing documents either, but we'll come to that later.) I like to have a nice quick build process which I can call from `Makefile` or in a command-line script, so that the font is rebuild with new layout rules every time I save the feature file. 但我们如何将文本格式的规则写入字体的二进制数据表中呢?作为设计师,你可以使用字体编辑器。它应该会自动化关于OpenType规则的部分甚至全部流程,包括代码编写、编译以及将其嵌入字体文件等。但通常来说这个过程会比较慢,经常需要数秒才能完成编译并导出字体文件。当我们在开发和测试复杂#tr[layout]的字体时,这些等待时间就有些太长了。(我们也不想每次测试前都要重新安装字体,刷新缓存。)所以我更希望有一个能在`Makefile`或命令行脚本中调用的快速编译流程,以便在我保存特性代码文件时自动使用新的规则重新构建字体。 // One way to achieve this is to use the `fontTools` library, which has a command line script to add features to an existing font file. You can export a "dummy" version of your font from your editor - just the outlines with no layout rules - and use that as a base for adding feature files: 达成这个目标的方式之一是使用 `fontTools` 程序库,它包含一个能将特性直接加入现有字体文件的命令行脚本。你可以先用字体编辑器导出一个最简版本的字体文件(只有#tr[glyph]#tr[outline],没有任何#tr[layout]规则),将其作为添加特性的目标: ```bash fonttools feaLib -o MyFont.otf features.fea MyFont-Dummy.otf ``` // A similar utility, `makeotf`, comes as part of the Adobe Font Development Kit for OpenType: 你也可以使用 AFDKO 中的类似工具 `makeotf`: ```bash makeotf -o MyFont.otf -f MyFont-Dummy.otf -ff features.fea ``` // I prefer the `fontTools` version as it automatically handles the corrections needed to lay out very complex feature files. 我更喜欢 `fontTools` 的版本,因为它能自动对非常复杂的特性代码文件进行编译所必须的修正。 // Finally, if you're learning about OpenType layout and just want to test out rules in an interactive environment, my own `OTLFiddle` software might be helpful. It allows you to drop in a font, type some feature code and immediately see how it affects a given piece of text. In fact, if you're learning about OpenType feature syntax for the first time, I'd seriously encourage you to use OTLFiddle to explore the examples given in this chapter. 最后,如果你是在学习OpenType,并且想在一个交互式的环境中进行规则测试的话从o,我编写的`OTLFiddle`#[@Cozens.Otlfiddle.2020]软件可能会有所帮助。它允许你拖入一个字体文件,编写一些特性代码,然后你就能在软件的界面中直接看到这些代码会如何影响输入文本的显示效果。如果你是第一次学习OpenType特性代码的语法的话,我强烈推荐使用`OTLFiddle`软件来体验本章中的这些例子。 // Download [OTLFiddle](https://github.com/simoncozens/otlfiddle), drop in a font with the `f` and `f_f` glyphs - [Open Sans](https://fonts.google.com/specimen/Open+Sans) is my favourite test Latin font - and type the feature above into the editor. Compile the font, and type the text "official" into the box on the right - although the visual difference is quite subtle, you should be able to see in the read-out of glyphs above the image that the two `f` glyphs have indeed become a single `f_f` glyph. 现在就去下载`OTLFiddle`吧。拖入任何含有`f`和`f_f`#tr[glyph]的字体(我最喜欢用于西文测试的字体是Open [email protected]),并在编辑器中输入上面的特性代码。编译字体后,在右边的文本框中输入“Official”。尽管差别非常小,但你应该能看出预览界面中的两个`f`#tr[glyph]变成了一个`f_f`#tr[glyph]。
https://github.com/jomaway/typst-gentle-clues
https://raw.githubusercontent.com/jomaway/typst-gentle-clues/main/README.md
markdown
MIT License
# gentle-clues Simple admonitions for typst. Add predefined or define your own. Inspired from [mdbook-admonish](https://tommilligan.github.io/mdbook-admonish/). ## Overview of all predefined clues: ![Overview of the predefined clues](./gc-overview.svg) ## Usage For full information, see the [docs.pdf](https://github.com/jomaway/typst-gentle-clues/blob/main/docs.pdf) To use this package, simply add the following code to your document: ```typst #import "@preview/gentle-clues:1.0.0": * // add an info clue #info[ This is the info clue ... ] // or a tip with custom title #tip(title: "Best tip ever")[Check out this cool package] ``` _This will create an info clue and tip clue inside your document. See the overview for all available clues. ### Features This package provides some features which helps to customize the clues to your liking. - Set global default for all clues - Overwrite each parameter on a single clue for changing title, color, etc. - Show or hide a counter value on tasks. - Define your own clues very easily. - ... For a full list see the [documentation](https://github.com/jomaway/typst-gentle-clues/blob/main/docs.pdf). ## Language support This package does use [linguify](https://github.com/jomaway/typst-linguify) to support multiple languages. **Header titles:** The language of the header titles is detected automatically from the `context text.lang`. See the file [lang.toml](https://github.com/jomaway/typst-gentle-clues/blob/main/lib/lang.toml) for currently supported languages. If an unsupported language is set it will fallback to english as default. Feel free to open a PR with your language added to the `lang.toml` file. ## License [MIT License](LICENSE) ## Changelog [See CHANGELOG.md](CHANGELOG.md)
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/edu/seminars/2024-09-18.typ
typst
= Домашнее задание Дедлайн: - загрузка таблицы -- 1 октября - загрузка эссе -- 2 октября Книга: "<NAME>" <NAME> Прочитать, заполнить вопросы в таблице Эссе пишется уже после семинара = Постановка целей, задач, образовательные результаты Типы занятий: - Изучение нового материала - Совершенствование знаний, умений, навыков (отработка отдельных тем) - Обобщение и систематизация (отработка нескольких тем) - Контроль - Комплексное применение знаний Образовательный процесс должен планироваться от цели Ошибка проектирования от содержания: - получается поток сознания - ученики могут многое знать или быть неготовы - отсутствие логики и структуры Цель vs Задача: - Цель --- конечная точка (только одна) - Задача --- шаги, необходимые для достижения цели (много) Задачи принято формулировать через глагол Плохо формулировать задачу через "научиться" тк это сложно проверить/ измерить Ошибки при формулировке образовательной цели: - Цель слишком абстрактна - Цель невозможно измерить/ оценить - Цель недостижима - Цель формулируется от лица преподавателя --- делает цель менее осязаемой - Цель заменяется форматом или содержанием занятия == Как правильно формулировать цель? Анализ целевой аудитории: - Учет возраста обучающихся - Выявление предшествующего опыта и знаний - Учет интересов обучающихся == SMART Алгоритм для постановки цели #figure( caption: [SMART-критерии], table( columns: 3, align: (center, left, left), [*S*], [Specific], [конкретная, прозрачная], [*M*], [Measurable], [измеримая], [*A*], [Attainable], [достижимая, реалистичная], [*R*], [Relevant], [актуальная], [*T*], [Time-Bound], [ограниченная по времени], ) ) == Таксономия Блума-Андерсона Иерархическая система учебных целей - Создание: применение знаний для создания нового - Оценка: "зачем нам это всё" - Анализ: понимание структуры, применение и понимание вместе - Применение: использование полученных знаний в новых ситуациях - Понимание: осознание сути материала - Запоминание: запоминание и воспроизведение материала Каждый уровень опирается на предыдущий Задачи нужно давать в порядке снизу вверх == Образовательный результат В англоязычных источниках результат и цель --- один термин ПРО --- планируемый образовательный результат - Может быть шире (менее конкретным), чем цель - Позволяет отобрать материал для работы в процессе обучения - Позволяет определить элементы контроля === На что опираться при формулировке ПРО + ФГОС + Учебная программа + Дополнительные образовательные программы + Профессиональный стандарт + Независимые международные рамки + Программа дисциплины == Метод ABC Помогает формулировать ПРО #figure( table( columns: 3, align: (center, left, left), [*A*], [Actor], [кто учится], [*B*], [Behaviour], [поведение], [*C*], [Condition], [в каком контексте происходит действие], ) )
https://github.com/El-Naizin/cv
https://raw.githubusercontent.com/El-Naizin/cv/main/modules_fr/education.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Formation") #cvEntry( title: [Master en Science des Données], society: [Université de Californie à Los Angeles], date: [2018 - 2020], location: [USA], description: list( [Thèse : Prédiction du taux de désabonnement des clients dans l'industrie des télécommunications en utilisant des algorithmes d'apprentissage automatique et l'analyse de réseau], [Cours : Systèmes et technologies Big Data #hBar() Exploration et exploitation de données #hBar() Traitement du langage naturel] ) ) #cvEntry( title: [Bachelors en Informatique], society: [Université de Californie à Los Angeles], date: [2014 - 2018], location: [USA], description: list( [Thèse : Exploration de l'utilisation des algorithmes d'apprentissage automatique pour la prédiction des prix des actions : une étude comparative des modèles de régression et de séries chronologiques], [Cours : Systèmes de base de données #hBar() Réseaux informatiques #hBar() Génie logiciel #hBar() Intelligence artificielle] ) )
https://github.com/jonsch318/rules_typst
https://raw.githubusercontent.com/jonsch318/rules_typst/main/examples/simple/simple.typ
typst
Apache License 2.0
= Test wow this really works.
https://github.com/NycRat/arduino-workshop
https://raw.githubusercontent.com/NycRat/arduino-workshop/main/slides_v2/main.typ
typst
#set page(width: 1920pt, height: 1080pt, fill: rgb("#fffbfc")) #set page(footer: context [ #set text(30pt) #h(1fr) #counter(page).display( "1/1", both: true, ) ]) /* #let x = 2.2 #set page(width: 11in * x, height: 8.5in * x, fill: rgb("#fffbfc")) */ #set text(40pt, font: "IBM Plex Mono") #[ #set align(center + horizon) = Creating a fun game with Arduino! #text(rgb("#888"))[Basics of Arduino Circuits _<NAME>_ ] ] #pagebreak() #[ #set page(columns: 2) = Introduction --- - We are going over everything from the basics - Learning _why_ is just as important as _what_ /* - What is everyone's experience with Arduino or Programming or Electronics? - Do you want to play a game? - What are we doing this workshop? */ *For Students* \ --- - Follow along with the workshop - Ask questions whenever you want - Try to be creative \ (ignore rule one sometimes) #colbreak() #align(center + horizon)[ #set text(36pt) $ upright("The area of a circle with radius r is:") $ #v(-7pt) #set text(14.5pt) $ A = 2 integral_(- r)^r sqrt(r^2 - x^2) d x $ $ upright("let ") x = r sin theta arrow.r.double.long d x = r cos theta d theta $ $ = 2 integral_(x = - r)^(x = r) sqrt(r^2 - lr((r sin theta))^2) dot.op r cos theta d theta $ $ = 2 r^2 integral_(- r)^r sqrt(1 - sin theta^2) dot.op cos theta d theta $ $ = 2 r^2 integral_(- r)^r cos^2 theta d theta $ $ = 2 r^2 integral_(- r)^r frac(cos 2 theta + 1, 2) d theta $ $ = r^2 integral_(- r)^r lr((cos 2 theta + 1)) d theta $ $ = r^2 lr([1 / 2 sin 2 theta + theta])_(- r)^r $ $ = r^2 lr([sin theta cos theta + theta])_(- r)^r $ $ = r^2 lr([x / r dot.op sqrt(r^2 - x^2) / r + arcsin lr((x / r))])_(- r)^r $ $ = r^2 lr((r / r dot.op sqrt(r^2 - r^2) / r + arcsin lr((r / r)))) - lr( (frac(- r, r) dot.op sqrt(r^2 - lr((- r))^2) / r + arcsin lr((frac(- r, r)))) ) $ $ = r^2 lr((lr((pi / 2)) - lr((- pi / 2)))) $ $ = r^2 pi $ #v(-30pt) #set text(60pt) $ #box(stroke: black, inset: 10pt, [$ A = pi r^2 $]) $ ] ] #pagebreak() #[ #set page(columns: 2) = Outline of Workshop --- - Electricity - Circuits - Integration of Arduino - Arduino Programming - LCD I2C Protocol - Programming the Project #colbreak() #align(center + horizon)[#image("project.png", width: 110%)] ] #[ #set page(columns:2) = Electricity --- - Electrons flowing from negative to positive - Powers components in its path (LEDs, Arduino, Light Bulb) - Electricity can only flow if there is a path #colbreak() #align(center + horizon)[ #image("circuit_closed.png") ] ] #pagebreak() #align(center)[ #image("circuit_closed.png") ] #pagebreak() #align(center)[ #image("circuit_open.png") ] #pagebreak() #align(center)[ #image("river.png") ] #[ #set page(columns: 2) = Electricity Terms --- - *Current* = How much electricity flows per second - *Voltage* = Potential electricity - *Resistance* = How much electricity a material stops #v(48pt) - Ohm's Law: $V = I R ==> I = V/R$ - Too much current = some components overheat and break - LEDs, Arduino, etc. #colbreak() // #align(center + horizon)[#image("circuit.png", width: 100%)] #align(right + horizon)[#image("resistorcircuit.png", width: 95%)] ] #pagebreak() #align(center)[ #image("water_mill.png", width: 80%) ] #pagebreak() #[ #set page(columns: 2) = LEDs --- - *Light-emitting diode* - Diode lets current go through _one direction_ - LED = _"thing that lights up when current goes through in a certain direction"_ - Longer end to high voltage (*5V*), shorter end to low voltage (*Ground*) #colbreak() #align(center + horizon)[#image("leds.png")] ] #pagebreak() #[ #set page(columns: 2) = Circuits and Wiring --- - Circuit on *breadboard*, with wires and other components - LEDs, Buttons, LCDs, Arduino, resistor, etc. - Breadboards make wiring _easy to change_ - Connects wires just by plugging in - Blue is connected, red is connected, black is connected - Great for learning & projects #colbreak() #align(center + horizon)[#image("breadboard.png", width: 85%)] ] #pagebreak() #[ #set page(columns: 2) = Arduino --- - Has pins for _output_ and _input_ - Has pins for *ground* and *V5* / *V3.3* (constant) - Connects to power source (could be computer) - Computer connects to upload code - Arduino runs code that is uploaded, with any power source #colbreak() #align(center + horizon)[#image("arduino.png", width: 90%)] ] #pagebreak() #align(center + horizon)[ #image("arduino_pins.png") ] #pagebreak() #[ #set page(columns: 2) = Arduino Code --- - Uses Arduino language (C++ with special built-in functions) - _digitalWrite_(...), _delay_(...), _analogRead_(...), etc. - Runs *setup*, then runs *loop* function until it is off #colbreak() #set text(30pt) #align(horizon)[ #text(25pt, rgb("#888"))[Code that turns LED on and off] #v(-20pt) #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt)[ ```c // The setup() function runs once arduino gets power void setup() { // initialize digital pin 13 for output pinMode(13, OUTPUT); } // the loop() function runs over and over again forever void loop() { // turn the LED on (HIGH is the voltage level) digitalWrite(13, HIGH); // wait for a second (1000 milliseconds) delay(1000); // turn the LED off by making the voltage LOW digitalWrite(13, LOW); // wait for a second (1000 milliseconds) delay(1000); } ``` /*```c const int LED_PIN = 6; // digital 6 pin void setup() { pinMode(LED_PIN, OUTPUT); // set pin to output } void loop() { digitalWrite(LED_PIN, HIGH); // turn on delay(1000); // in milliseconds digitalWrite(LED_PIN, LOW); // turn off delay(1000); // in milliseconds } ```*/ ] ] ] #pagebreak() #[ #set page(columns: 2) = Buttons --- - Buttons control when circuit is open or closed - Pushing button connects circuit - _"Pull-Down Resistors"_ are necessary when using buttons for input - Get rid of excess charge (sends it to *ground*) #colbreak() #align(center + horizon)[#image("button.png", width: 116%)] ] #pagebreak() #align(horizon + center)[ #image("circuit_open.png") ] #pagebreak() #align(horizon)[ #columns(2)[ #image("pulldown.png", width: 100%) (with pulldown) #colbreak() #image("nopulldown.png", width: 100%) (without pulldown) (the slideshow budget ran out) ] ] #pagebreak() #[ = Code with Button Logic --- #set text(30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 70%)[ #set align(left) ```c const int BUTTON_PIN = 10; const int LED_PIN = 6; void setup() { pinMode(LED_PIN, OUTPUT); pinMode(BUTTON_PIN, INPUT); // set pin to input } void loop() { // runs if there is high input to the pin if (digitalRead(BUTTON_PIN) == HIGH) { // flash light once digitalWrite(LED_PIN, HIGH); delay(100); digitalWrite(LED_PIN, LOW); delay(100); } } ``` ] ] ] #pagebreak() #[ #set page(columns: 2) = LCD I2C Protocol --- - Uses two signals - SDA used to transmit data - SCL used for data timing - Two other pins are... - VCC, for positive voltage - GND, for zero voltage - With LCD, the data transmitted is the text to display #colbreak() #align(center + horizon)[#image("i2c.png", width: 100%)] ] #pagebreak() #align(center)[ #image("i2c_sda_scl.png") (slideshow budget ran out again) ] #pagebreak() #[ = LCD I2C Code --- #set text(30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 60%)[ #set align(left) ```c #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // port, rows, columns void setup() { lcd.init(); // initializes the lcd lcd.backlight(); // turns the backlight on lcd.print("Starting the LCD"); // prints to the lcd } void loop() { lcd.setCursor(0, 1); // set the cursor to the second row lcd.print(" "); // clear line lcd.setCursor(0, 1); // set the cursor to the second row again lcd.print(millis()); // print time in milliseconds lcd.print("ms"); delay(200); } ``` ] ] ] #pagebreak() #[ #set page(columns: 2) = Reaction Time Game --- - Wait for an LED to turn on - Player presses button ASAP - Displays their reaction time - That's it! #colbreak() #align(center + horizon)[#image("project1.png", width: 100%)] ] #pagebreak() #[ #set text(size: 30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 60%)[ #set align(left) ```c #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); const int BUTTON_PIN = 10; const int LED_PIN = 2; long ledStartTime; // stores start time of LED turning on void setup() { // set up pins to proper input/output pinMode(BUTTON_PIN, INPUT); pinMode(LED_PIN, OUTPUT); // set up lcd, and print welcome message lcd.init(); lcd.backlight(); lcd.print("CLICK TO START!"); // initialize / reset is the same reset(); } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 68%)[ #set align(left) ```c void loop() { if (digitalRead(BUTTON_PIN) == HIGH) { // check if clicked early lcd.clear(); lcd.print("TOO EARLY"); reset(); } if (millis() >= ledStartTime) { // check if time to turn on led // turn on led and display message digitalWrite(LED_PIN, HIGH); lcd.clear(); lcd.print("CLICK!"); // wait until user clicks and calculate time it took waitForClick(); int resultTime = millis() - ledStartTime; // clear lcd and print resulting time lcd.clear(); lcd.print(resultTime); lcd.print("ms"); reset(); } } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 60%)[ #set align(left) ```c void reset() { waitForClick(); // click to reset // turn off led digitalWrite(LED_PIN, LOW); // clear lcd and print wait message lcd.clear(); lcd.print("WAIT FOR LIGHT!"); // set led to turn on in 1-3 seconds ledStartTime = millis() + random(1000, 3000); } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 60%)[ #set align(left) ```c void waitForClick() { // wait for button release while (true) { if (digitalRead(BUTTON_PIN) == LOW) { break; } } // wait for button down while (true) { if (digitalRead(BUTTON_PIN) == HIGH) { break; } } // wait for button release while (true) { if (digitalRead(BUTTON_PIN) == LOW) { break; } } } ``` ] ] ] #pagebreak() #[ #set page(columns: 2) = Reaction Time Game 1v1 --- - Wait for an LED to turn on - Two players press button as fast as possible - Displays their reaction time, and who won - A bit more complicated...? #colbreak() #align(horizon)[#image("project1v1.png", width: 100%)] ] #pagebreak() #[ #set text(size: 30pt) #set page(margin: 0pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 60%)[ #set align(left) ```c #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); const int BUTTON_PIN_1 = 10; const int BUTTON_PIN_2 = 12; const int LED_PIN = 2; long ledStartTime; // stores start time of LED turning on void setup() { // set up pins to proper input/output pinMode(BUTTON_PIN_1, INPUT); pinMode(BUTTON_PIN_2, INPUT); pinMode(LED_PIN, OUTPUT); // set up lcd, and print welcome message lcd.init(); lcd.backlight(); lcd.print("CLICK TO START!"); // initialize / reset is the same reset(); } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #set page(margin: 0pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 52%)[ #set align(left) ```c void loop() { checkEarlyClick(); if (millis() >= ledStartTime) { // check if time to start lcd.clear(); lcd.print("CLICK!"); digitalWrite(LED_PIN, HIGH); int winningPlayer = waitForClick(); int resultTime = millis() - ledStartTime; lcd.clear(); lcd.print(resultTime); lcd.print("ms"); lcd.setCursor(0, 1); lcd.print("Player "); lcd.print(winningPlayer); lcd.print(" wins"); reset(); } } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #set page(margin: 0pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 52%)[ #set align(left) ```c void reset() { waitForClick(); // click to reset digitalWrite(LED_PIN, LOW); lcd.clear(); lcd.print("WAIT FOR LIGHT!"); ledStartTime = millis() + random(1000, 3000); } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #set page(margin: 0pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 52%)[ #set align(left) ```c void checkEarlyClick() { if (digitalRead(BUTTON_PIN_1) == HIGH) { // check if clicked early lcd.clear(); lcd.print("TOO EARLY"); lcd.setCursor(0, 1); lcd.print("Player 2 wins"); reset(); } if (digitalRead(BUTTON_PIN_2) == HIGH) { // check if clicked early lcd.clear(); lcd.print("TOO EARLY"); lcd.setCursor(0, 1); lcd.print("Player 1 wins"); reset(); } } ``` ] ] ] #pagebreak() #[ #set text(size: 30pt) #set page(margin: 0pt) #align(center + horizon)[ #block(stroke: gray, fill: rgb("f0f0f0"), inset: 20pt, radius: 5pt, width: 52%)[ #set align(left) ```c int waitForClick() { int p1 = 0; int p2 = 0; while (true) { if (p1 == 0 && digitalRead(BUTTON_PIN_1) == LOW) { p1++; } if (p1 == 1 && digitalRead(BUTTON_PIN_1) == HIGH) { p1++; } if (p1 == 2 && digitalRead(BUTTON_PIN_1) == LOW) { return 1; } if (p2 == 0 && digitalRead(BUTTON_PIN_2) == LOW) { p2++; } if (p2 == 1 && digitalRead(BUTTON_PIN_2) == HIGH) { p2++; } if (p2 == 2 && digitalRead(BUTTON_PIN_2) == LOW) { return 2; } } // shouldn't be possible return -1; } ``` ] ] ] #pagebreak() #[ #align(center + horizon)[= THANK YOU FOR COMING TO THE WORKSHOP] ] #pagebreak() #[ #align(center + horizon)[*consider* \ _learning more_ about programming \ _learning more_ about electronic circuits \ _learning more_ about your interests \ *learning more*] ]
https://github.com/Shuenhoy/modern-zju-thesis
https://raw.githubusercontent.com/Shuenhoy/modern-zju-thesis/master/pages/template-individual.typ
typst
MIT License
#import "../utils/fonts.typ": 字号, 字体 #import "../utils/datetime-display.typ": datetime-display #import "../utils/twoside.typ": twoside-pagebreak #let template-individual( outlined: false, titlelevel: 2, bodytext-settings: (size: 字号.四号), pagetitle, s, ) = { context { twoside-pagebreak set text(font: 字体.仿宋) align( center, text(size: 字号.三号, weight: "bold")[ #show heading: x => x.body #heading(pagetitle, numbering: none, level: titlelevel, outlined: outlined) #v(1em)], ) block(width: 100%)[ #set par(justify: true) #set text(..bodytext-settings) #s ] } }
https://github.com/DaAlbrecht/thesis-TEKO
https://raw.githubusercontent.com/DaAlbrecht/thesis-TEKO/main/content/Research.typ
typst
#import "@preview/tablex:0.0.5": tablex, cellx == RabbitMQ RabbitMQ is an open-source message broker software that is widely used for building scalable and robust messaging systems. It provides a messaging middleware that facilitates communication between different parts of a distributed application. RabbitMQ is often used in scenarios where you need to handle asynchronous communication, decouple components of a system, and ensure reliable message delivery. It's particularly valuable in distributed systems, and microservices architectures, as well as for implementing various messaging patterns such as publish-subscribe, request-reply, and more. RabbitMQ, or rather AMQP-0-9-1 achieves this by decoupling the sending and receiving systems. The sending system is called a producer and the receiving system is called a consumer. #figure( image("../assets/rabbitmq_components.svg"), caption: [RabbitMQ component overview], kind: image, ) A 'connection' represents a persistent, long-lived TCP connection established between a client and a RabbitMQ broker. Within this connection, producers have the capability to create 'channels,' which can be thought of as virtual connections nested within the primary connection. These channels serve as conduits for producers to transmit messages to an entity known as an 'exchange,' which can be likened to a message-routing intermediary, akin to a post office in a metaphorical sense. The primary function of the exchange is to receive messages from producers and, based on predefined rules called 'bindings,' route these messages to various queues. In this context, a 'queue' acts as a storage buffer for messages. A binding is a relationship between an exchange and a queue. Additionally, a binding can have an optional 'binding key' parameter that further refines the routing process. The binding key is a string that the exchange can use to determine how to route the message to the queue. The binding key is specific to the exchange type. For an overview of the different exchange types, see @exchange-types. Consumers have two options for interacting with queues: they can either passively subscribe to one or multiple queues and receive messages as they arrive, or they can actively fetch messages from the queue when they choose to do so. == Exchange<exchange> Exchanges are AMQP-0-9-1 entities. An exchange receives messages from producers and pushes them to queues depending on rules called bindings. An exchange routes a message to zero or more queues. AMQP-0-9-1 defines four types of exchanges@rabbitmq-exchange-types: #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, left), [*Exchange Type*], [*Default pre-declared names*], [Direct exchange], [(Empty string) and amq.direct], [Fanout exchange], [amq.fanout], [Topic exchange], [amq.topic], [Headers exchange], [amq.match (and amq.headers in RabbitMQ)] ), kind: table, caption: [Exchange Types], )<exchange-types> === Default Exchange The default exchange@rabbitmq-default-exchange is an unattributed exchange provided by the broker without a specific name (it's represented by an empty string). The default exchange is a RabbitMQ extension to the AMQP 0-9-1 direct exchange specification. It is a direct exchange with a pre-declared name that cannot be changed. The default exchange routes every message it receives to a queue with the same name as the routing key of the message. #figure( image("../assets/rabbitmq_default_exchange.svg" ,width: 70%), caption: [Default Exchange], kind: image, ) For instance, if you were to define a queue with the name "inventory" the AMQP 0-9-1 broker would automatically establish a binding to the default exchange, using "inventory" as the binding key (also referred to as routing key, but this is ambiguous and therefore not used here). Consequently, a message sent to the default exchange with the routing key "inventory" will be directed to the "inventory" queue. Essentially, the default exchange creates the illusion of delivering messages directly to queues, even though that's not precisely what's occurring from a technical standpoint. The main difference between the default exchange and a direct exchange is, that the default exchange cannot be explicitly bound to queues. #pagebreak() === Direct Exchange A direct exchange@rabbitmq-direct-exchange operates by delivering messages to queues based on their binding key. It is well-suited for single-target (unicast) message routing but can also be applied to multicast routing scenarios. Here is a breakdown of how it functions: #figure( image("../assets/rabbitmq_direct_exchange.svg" ,width: 70%), caption: [Direct Exchange], kind: image, ) A queue establishes a binding with the exchange using a specific binding key, denoted as K. Whenever a new message arrives at the direct exchange with a routing key R, the exchange forwards it to the associated queue if and only if the binding key K matches R. In cases where multiple queues are bound to the same direct exchange with identical binding key K, the exchange will transmit the message to all queues where K equals R. === Fanout Exchange A fanout exchange@rabbitmq-fanout-exchange distributes messages to every queue connected to it, disregarding the routing key. If there are N queues linked to a fanout exchange, when a new message is sent to the exchange, a duplicate of the message is dispatched to all N queues. Fanout exchanges are perfectly suited for broadcasting messages. #figure( image("../assets/rabbitmq_fanout_exchange.svg" ,width: 70%), caption: [Fanout Exchange], kind: image, ) === Topic Exchange A topic exchange@rabbitmq-topic-exchange routes messages to queues based on matching patterns between the routing key of the message and the binding key used to establish a binding. #figure( image("../assets/rabbitmq_topic_exchange.svg" ,width: 70%), caption: [Topic Exchange], kind: image, ) #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, left), [*Wildcard*], [*Description*], [\* (star)], [Matches exactly one word.], [\# (hash)], [Matches zero or more words.], ), kind: table, caption: [Topic Exchange Wildcards], ) === Headers Exchange A headers exchange@rabbitmq-headers-exchange routes messages based on the value of attributes also known as headers that are associated with the message. In this case, the routing key is not used. Instead, the attributes of the message are evaluated against the attributes of the queue bindings#footnote([https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchange-headers]). If they match, the message is routed to the queue. == Queues A RabbitMQ queue is a structured arrangement of messages, where messages are added and removed in a FIFO manner, typically delivered to consumers. In a general sense, a queue is a sequential data structure with two primary operations: adding an item to the end (enqueuing) and removing an item from the front (dequeuing). In messaging systems, various features are closely tied to queues. Some of RabbitMQ's queue features, like priorities#footnote([https://www.rabbitmq.com/queues.html#properties]) can influence the order in which consumers perceive messages. === Streams Streams@rabbitmq_about_streams are a new type of queue in the RabbitMQ ecosystem. Streams are a persistent and replicated data structure. With the addition of streams, a new protocol was introduced, the RabbitMQ Streams protocol@rabbitmq_stream_spec. Streams represent an immutable record of messages, allowing for multiple readings until they expire. These streams maintain persistence and replication consistently. When it comes to accessing messages within a RabbitMQ stream, one or more consumers can subscribe to it and read the messages repeatedly, as many times as needed. The ability to read messages repeatedly is a significant advantage of streams and what will be taken advantage of in the microservice. ==== Use Cases of streams #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, left), [*Use Case*], [*Description*], [Large fan-outs], [Currently, when users aim to send a message to several subscribers, they must create a unique queue for each consumer. This process can become inefficient, particularly with a large number of consumers, especially when considering the desire for message persistence and replication. Streams will address this issue by enabling any number of consumers to access the same messages from a single queue without causing any data loss. This eliminates the necessity to establish multiple queues. Additionally, stream consumers will have the capability to read from replicas, distributing the read workload throughout the cluster.], [Replay (Time-travelling)], [Since all existing queue types in RabbitMQ operate with a consume behavior that results in message removal from the queue once a consumer finishes processing them, it's currently impossible to re-access messages that have already been consumed. Streams, however, will introduce a significant change by permitting consumers to connect at any position within the message log and retrieve messages from that point onward. This means that messages can be revisited and processed again as needed.], [Throughput Performance], [Streams will provide a significant performance boost over the existing queue types.], [Large backlogs], [Most queues are designed to operate on an empty backlog. When a queue has a large backlog, it can cause performance issues. Streams will be able to handle large backlogs without performance issues.], ), kind: table, caption: [Streams Use Cases], ) #pagebreak() == Protocols RabbitMQ supports several protocols@rabbitmq-protocols: #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, left), [*Protocol*], [*Description*], [AMQP 0-9-1], [AMQP is the fundamental protocol used by RabbitMQ. RabbitMQ was initially created to facilitate the use of AMQP. AMQP is a binary protocol that defines strong messaging semantics. The protocol is easy to implement for clients and is therefore supported in a large number of clients and languages.], [STOMP], [STOMP is a text-based messaging protocol. STOMP emphasizes simplicity. It does not define strict messaging semantics and is therefore easy to implement. It is also the only protocol that can be used manually over telnet.], [MQTT], [MQTT is a binary communication protocol that places a strong emphasis on lightweight publish/subscribe messaging. It is designed primarily for use with resource-constrained devices. While it offers clear and well-defined messaging principles for publish/subscribe interactions, it lacks similar specifications for other messaging styles.], [AMQP 1.0], [Although they share a similar name, AMQP 1.0 is a completely different protocol from AMQP 0-9-1. AMQP 1.0 places fewer semantic demands, making it easier to add to existing brokers. Although it is easier to add to existing brokers, the protocol is substantially more complex than AMQP 0-9-1 and there are fewer client implementations.], [HTTP and WebSockets], [HTTP and WebSockets are not messaging protocols. RabbitMQ can transmit messages over HTTP in the following ways: - STOMP messaging using WebSockets. - MQTT messaging using WebSockets. - HTTP API to send and receive messages.], [RabbitMQ Streams], [The RabbitMQ Streams protocol is a new messaging protocol that is designed to be used with RabbitMQ Streams. It's still in development and subject to change.] ), kind: table, caption: [RabbitMQ Protocols], ) The microservice needs to be able to queue a message again, therefore a streaming queue is used. For working with streams, the best suited is either the AMQP-0-9-1 or the RabbitMQ-Streams protocol. === AMQP 0-9-1<amqp_0_9_1> AMQP, also known as the Advanced Message Queuing Protocol, facilitates communication between compliant client applications and matching messaging middleware brokers. In the next sections, we will take a brief look at the AMQP wire-level format as specified in the AMQP 0-9-1 specification@amqp_0_9_1_spec. This is the format that is used to send and receive messages over the network. The short excursion is intended to provide a better understanding of the AMQP 0-9-1 protocol and help evaluate a suitable client library in @evaluation ==== AMQP Wire-Level Format The client MUST start a new connection by sending a protocol header. This is an 8-byte sequence: #figure( rect( ``` +---+---+---+---+---+---+---+---+ |'A'|'M'|'Q'|'P'| 0 | 0 | 9 | 1 | +---+---+---+---+---+---+---+---+ 8 bytes ```, fill: (rgb("#F5DEB3")), ) , caption: [AMQP Protocol Header], ) The client and server then agree on a protocol version. After this, the general format of a frame is as follows: #figure( rect( ``` 0 1 3 7 size+7 size+8 +------+---------+---------+ +-------------+ +-----------+ | type | channel | size | | payload | | frame-end | +------+---------+---------+ +-------------+ +-----------+ byte short long 'size' bytes byte ```, fill: (rgb("#F5DEB3")), ), caption: [AMQP Frame Format], kind: auto ) There are four types of frames: #figure( tablex( columns: (auto, auto), rows:(auto), align: (center + horizon, center + horizon), [*Type*], [*Name*], [1], [Method], [2], [Header], [3], [Body], [4], [Heartbeat], ), kind: table, caption: [AMQP Frame Types], ) The channel number is set to 0 for all global frames, whereas it ranges from 1 to 65535 for frames that are associated with a particular channel. The size field indicates the payload's size, excluding the byte at the end of the frame. Even though AMQP operates under the assumption of a dependable protocol, we utilize the frame's end byte to identify framing errors that might result from flawed client or server implementations. #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, center + horizon), [*Type*], [*Payload*], [Method], cellx(fill: rgb("#F5DEB3"))[``` 0 2 4 +----------+-----------+-------------- - - | class-id | method-id | arguments... +----------+-----------+-------------- - - short short ...```], [Header],cellx()[``` 0 2 4 12 14 +----------+--------+-----------+----------------+------------- - - | class-id | weight | body size | property flags | property list... +----------+--------+-----------+----------------+------------- - - short short long long short remainder... ```], [Body],cellx(fill: rgb("#F5DEB3"))[``` +-----------------------+ +-----------+ | Opaque binary payload | | frame-end | +-----------------------+ +-----------+ ```], [Heartbeat], [no payload], ), kind: table, caption: [AMQP frame payloads], ) This is a general overview of the AMQP 0-9-1 protocol. For more details, see the AMQP 0-9-1 specification#footnote([https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf]). AMQP-0-9-1 does not have first-class support for streaming queues but streams can be implemented using optional 'queue and consumer arguments' #footnote([https://www.rabbitmq.com/queues.html#optional-arguments]). === RabbitMQ Streams Protocol The RabbitMQ Streams protocol is a new messaging protocol that is designed to be used with RabbitMQ Streams@rabbitmq_stream_spec. It is still in development and subject to change. Similar to in @amqp_0_9_1, we take a short tour through the protocol to get a better understanding of the protocol. For a more detailed and complete description, see the RabbitMQ Streams Protocol specification#footnote([https://github.com/rabbitmq/rabbitmq-server/blob/v3.12.x/deps/rabbitmq_stream/docs/PROTOCOL.adoc]). ==== Types #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, center + horizon), [*Type*], [*Description*], [int8, int16, int32, int64], [Signed integers of 8, 16, 32, and 64 bits, respectively, in big-endian order.], [uint8, uint16, uint32, uint64], [Unsigned integers of 8, 16, 32, and 64 bits, respectively, in big-endian order.], [bytes], [32-bit signed integer denoting the length of the bytes, followed by the bytes themselves. length of -1 indicates null.], [string], [16-bit signed integer denoting the length of the string, followed by the UTF-8 encoded string itself. length of -1 indicates null.], [array], [32-bit signed integer denoting the length of the array, followed by the repetition of the structure, notation uses \[\], e.g. \[int32\] for an array of int32.] )) ==== Frame Format Each frame is only composed of the size and the payload. The size is a 32-bit unsigned integer denoting the length of the payload in bytes. #figure( rect( ``` 0 4 size+4 +------+---------------+ | size | payload | +------+---------------+ int32 'size' bytes ```, fill: (rgb("#F5DEB3")), ), kind: auto, caption: [RabbitMQ Streams Frame Format], ) The payload can be one of the following: #figure( tablex( columns: (auto, 1fr), rows:(auto), align: (center + horizon, center + horizon), [*Type*], [*Frame*], [Request], cellx()[``` 0 2 4 8 size+8 +------+---------+---------------+-------------+ | key | version | correlationId | command | +------+---------+---------------+-------------+ uint16 uint16 uint32 'size' bytes ```], cellx()[Response], cellx(fill: rgb("#F5DEB3"))[``` 0 2 4 8 10 +------+---------+---------------+--------------+ | key | version | correlationId | responseCode | +------+---------+---------------+--------------+ uint16 uint16 uint32 uint16 ```], [Command], cellx()[``` 0 2 4 size+4 +------+---------+-------------+ | key | version | content | +------+---------+-------------+ uint16 uint16 'size' bytes ```], ), kind: table, caption: [RabbitMQ Streams Frame Types], ) The key at the start of the protocol, tells the server what kind of command will follow. An example of a 'declarepublisher' request and the corresponding response would look like this: *Request* #figure( rect( ``` 0 2 4 8 9 9+size +------+---------+---------------+--------------+--------------------+-------- - - | 0x01 | version | correlationId | publisherId | publisherReference | stream +------+---------+---------------+--------------+--------------------+-------- - - uint16 uint16 uint32 uint8 string(max255) remainder... ```, fill: (rgb("#F5DEB3")), ), kind: auto, caption: [RabbitMQ Streams DeclarePublisherRequest Frame], ) *Response* #figure( rect( ``` 0 2 4 8 10 +--------+---------+---------------+--------------+ | 0x8001 | version | correlationId | responseCode | +--------+---------+---------------+--------------+ uint16 uint16 uint32 uint16 ```, fill: (rgb("#F5DEB3")), ), kind: auto, caption: [RabbitMQ Streams DeclarePublisherResponse Frame], ) For a complete list of commands, see the RabbitMQ Streams Protocol specification#footnote([https://github.com/rabbitmq/rabbitmq-server/blob/v3.12.x/deps/rabbitmq_stream/docs/PROTOCOL.adoc#commands]). #pagebreak()
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/168.%20talk.html.typ
typst
talk.html Write Like You Talk October 2015Here's a simple trick for getting more people to read what you write: write in spoken language.Something comes over most people when they start writing. They write in a different language than they'd use if they were talking to a friend. The sentence structure and even the words are different. No one uses "pen" as a verb in spoken English. You'd feel like an idiot using "pen" instead of "write" in a conversation with a friend.The last straw for me was a sentence I read a couple days ago: The mercurial Spaniard himself declared: "After Altamira, all is decadence." It's from <NAME>'s A History of Ancient Britain. I feel bad making an example of this book, because it's no worse than lots of others. But just imagine calling Picasso "the mercur<NAME>" when talking to a friend. Even one sentence of this would raise eyebrows in conversation. And yet people write whole books of it.Ok, so written and spoken language are different. Does that make written language worse?If you want people to read and understand what you write, yes. Written language is more complex, which makes it more work to read. It's also more formal and distant, which gives the reader's attention permission to drift. But perhaps worst of all, the complex sentences and fancy words give you, the writer, the false impression that you're saying more than you actually are.You don't need complex sentences to express complex ideas. When specialists in some abstruse topic talk to one another about ideas in their field, they don't use sentences any more complex than they do when talking about what to have for lunch. They use different words, certainly. But even those they use no more than necessary. And in my experience, the harder the subject, the more informally experts speak. Partly, I think, because they have less to prove, and partly because the harder the ideas you're talking about, the less you can afford to let language get in the way.Informal language is the athletic clothing of ideas.I'm not saying spoken language always works best. Poetry is as much music as text, so you can say things you wouldn't say in conversation. And there are a handful of writers who can get away with using fancy language in prose. And then of course there are cases where writers don't want to make it easy to understand what they're saying—in corporate announcements of bad news, for example, or at the more bogus end of the humanities. But for nearly everyone else, spoken language is better.It seems to be hard for most people to write in spoken language. So perhaps the best solution is to write your first draft the way you usually would, then afterward look at each sentence and ask "Is this the way I'd say this if I were talking to a friend?" If it isn't, imagine what you would say, and use that instead. After a while this filter will start to operate as you write. When you write something you wouldn't say, you'll hear the clank as it hits the page.Before I publish a new essay, I read it out loud and fix everything that doesn't sound like conversation. I even fix bits that are phonetically awkward; I don't know if that's necessary, but it doesn't cost much.This trick may not always be enough. I've seen writing so far removed from spoken language that it couldn't be fixed sentence by sentence. For cases like that there's a more drastic solution. After writing the first draft, try explaining to a friend what you just wrote. Then replace the draft with what you said to your friend.People often tell me how much my essays sound like me talking. The fact that this seems worthy of comment shows how rarely people manage to write in spoken language. Otherwise everyone's writing would sound like them talking.If you simply manage to write in spoken language, you'll be ahead of 95% of writers. And it's so easy to do: just don't let a sentence through unless it's the way you'd say it to a friend.Thanks to <NAME> and <NAME> for reading drafts of this.Japanese TranslationArabic Translation
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/regression/issue3.typ
typst
Other
#let alpha=(named:(a:1,b:2)) #(..alpha.named, c: 3)
https://github.com/0x1B05/english
https://raw.githubusercontent.com/0x1B05/english/main/cnn10/content/20240425.typ
typst
#import "../template.typ": * #pagebreak() = 20240425 == Start What's up sunshine? Hope you have a thoroughly thankful Thursday. Gratitude is good for the attitude. I'm Coy Wire, this is cnn 10. == TikTok We kick off today's show with some news could be #strike[an] #underline[of] particular interest to a lot of us, TikTok could be one step closer to being banned in the United States. President <NAME> signing a bill#strike[,] sent to #underline[him by] Congress #strike[to] #underline[that would] effectively ban the social media app in America if the company that owns it doesn't find a new owner in the next few months. Why is this happening? Because many American leaders say TikTok is a threat to U.S. National Security. The #underline[app is owned] by ByteDance #underline[, a ]privately own#underline[ed] Chinese company. But in China, the authoritarian #strike[in] government #underline[often treats privately] owned companies like they are government owned. Even though the bill has been signed #underline[in]to law, it doesn't mean TikTok would just disappear. The social media giant plans to #underline[*sue*] the U.S. government to block the law, claiming it's #underline[*unconstitutional* and] violate #strike[for the] #underline[free] speech. TikTok is #underline[ready to fight.] They#underline['ll] go hard and *call on*, #underline[they'll say it's a] free speech #underline[issue]. But even so say it takes a year to possibly find #underline[someone] who wants to buy it. And then maybe if the White House #underline[sees that there's some progress], they can even give #underline[them like] 90-day #underline[*extension*]. So between the #underline[court fight] and #underline[the] extensions, it's unlikely anything going to happen very quickly. So it could be up to a year before anything happens, but if ByteDance refuses to sell the TikTok or if the Chinese government steps in and says ByteDance cannot sell TikTok, then by January of next year, you might not be able to download or update TikTok app in United States. That means you could theoretically keep TikTok on your phone and keep using it but you won't be able to update it. So over time it #underline[would] probably get buggy, start to get #underline[*glitchy*] and likely stop working after a while. === words, phrases ==== words - _authoritarian_ - _treat_ - _giant_ - _sue_ - _unconstitutional_ - _violate_ - _free speech_ - _extension_ - _theoretically_ - _glitchy_ ==== phrases - _call on_ === 回译 ==== 原文 What's up sunshine? Hope you have a thoroughly thankful Thursday. Gratitude is good for the attitude. I'm <NAME>, this is cnn 10. We kick off today's show with some news could be of particular interest to a lot of us, TikTok could be one step closer to being banned in the United States. President <NAME> signing a bill sent to him by Congress that would effectively ban the social media app in America if the company that owns it doesn't find a new owner in the next few months. Why is this happening? Because many American leaders say TikTok is a threat to U.S. National Security. The app is owned by ByteDance, a privately owned Chinese company. But in China, the authoritarian government often treats privately owned companies like they are government owned. Even though the bill has been signed into law, it doesn't mean TikTok would just disappear. The social media giant plans to sue the U.S. government to block the law, claiming it's unconstitutional and violate free speech. TikTok is ready to fight. They'll go hard and call on, they'll say it's a free speech issue. But even so say it takes a year to possibly find someone who wants to buy it. And then maybe if the White House sees that there's some progress, they can even give them like 90-day extension. So between the court fight and the extensions, it's unlikely anything going to happen very quickly. So it could be up to a year before anything happens, but if ByteDance refuses to sell the TikTok or if the Chinese government steps in and says ByteDance cannot sell TikTok, then by January of next year, you might not be able to download or update TikTok app in United States. That means you could theoretically keep TikTok on your phone and keep using it but you won't be able to update it. So over time it would probably get buggy, start to get glitchy and likely stop working after a while. ==== 参考翻译 嗨,阳光!希望你度过了一个充满感恩的星期四。感恩有助于保持心态积极。我是科伊·怀尔,这里是 CNN 十点新闻。 我们今天的节目以一条对许多人可能特别感兴趣的新闻开始,TikTok 可能离在美国被禁止又近了一步。美国总统Joe Biden签署了国会送交给他的一项法案,如果拥有该应用的公司在未来几个月内找不到新的买家,将有效地禁止这款社交媒体应用在美国的使用。为什么会发生这样的事情?因为许多美国领导人认为 TikTok 对美国国家安全构成威胁。这款应用由字节跳动拥有,是一家私营的中国公司。但在中国,威权政府经常把私营公司当作政府所有的企业。尽管这项法案已经签署成为法律,但这并不意味着 TikTok 会消失。这家社交媒体巨头计划起诉美国政府以阻止这项法律,声称这违反了宪法并侵犯了言论自由。 TikTok 已经准备好了战斗。他们会全力以赴,称这是一个言论自由的问题。但即使这样,也可能需要一年的时间才能找到愿意购买的人。然后,如果白宫看到有一些进展,他们甚至可以给他们90天的延期。所以在法庭上的争斗和延期之间,很可能不会有什么事情很快发生。 因此,可能要等到一年之后才会有任何进展,但如果字节跳动拒绝出售 TikTok,或者如果中国政府干预并表示字节跳动不能出售 TikTok,那么到明年一月,你可能就不能在美国下载或更新 TikTok 应用了。这意味着你理论上可以继续在手机上使用 TikTok,但无法更新。随着时间的推移,它可能会变得不稳定,开始出现故障,并且可能在一段时间后停止工作。 ==== 1st Hi, sunshine! Hope you are having a #underline[thoroughly] thankful Thursday. Gratitude is helpful to attitude. I'm Coy Wire, this is cnn 10. Today's show begins with #strike[a]#underline[some] news #strike[that many people may take considerable interest in] #underline[could be of particular interest to a lot of us], TikTok getting one step closer to being banned in the U.S. The American president <NAME> has signed a bill that the Congress sent to him which would effectively ban the social media in the U.S. if the company who owned the app aren't able to find a new #strike[buyer] #underline[owner]. Why #strike[would] #underline[is] this happen#underline[ing]? Because many American leaders #strike[consider] #underline[say] TikTok is a threat to the National Security. The app is owned by ByteDance, a privately owned #underline[Chinese] company. But in China, #strike[a privately owned company is often regarded as government owned company by authoritarian government] #underline[the authoritarian government often treats privately owned companies like they are government owned]. Even though the bill has been signed into a law, it doesn't mean that TikTok #strike[will] #underline[would just] disappear. The social media giant plans to sue the American government, trying to block the law, claiming the law is unconstitutional and violate speech free. TikTok is ready to fight. They will #strike[endeavor themselves] #underline[go hard and call on], stating it's a #underline[free speech]issue on speech free. But it may takes one year to find one who are willing to buy it though. And then, if the White House sees some progress, they can offer a 90-day extension. So during the time of the court fight and extension, it won't happen quickly. So, it takes a year to see any progress. But if ByteDance refuses to sell TikTok or the Chinese government interferes in and doesn't allow ByteDance to sell TikTok, then you wouldn't be able to download or update TikTok in America by January next year. And it means you could keep using TikTok on your phone theoretically but couldn't update the app. As time passed, it could become buggy, start to go wrong and could stop working then. == Pro-Palestinian Protests Pro-Palestinian protests#strike[, it] #underline[that] started at U.S. Columbia University are now spreading to colleges in universities across the U.S. #underline[*Fundamentally*], students are protesting how their school#underline[s] #strike[are investing and ... or large pulls of money the] #underline[invest their *endowments* or large pools of money that] colleges #strike[in]#underline[and] universities usually acquire through donations. Pro-Palestinian #strike[in students] #underline[student] protesters#strike[, one]#underline[want] the school to #underline[*divest*] or take money away from companies that #underline[are] either #strike[is rarely more]#underline[Israeli or] involved in #underline[Israel's] war in Gaza. CNN's Isabel Rosales has more: Growing #strike[protesters]#underline[protests]#strike[, a]#underline[ as] student from Columbia University #strike[balloting]#underline[*vowing*] to occupy school grounds until the university meets their demands. This#underline[, as] calls #strike[recognition]#underline[for the *resignation*] of the school's president <NAME>, continue to get louder. Shafik *under fire* from both inside and outside the university and could face #underline[a *censure* vote] from the university #underline[senate _as early as tomorrow_]. Shafik and other university officials are facing internal criticism#strike[. And] #underline[that NYPD] arrests and students suspensions #strike[legendary]#underline[*allegedly* violated *tenets* of] "Academic Freedom" and "Free Expression on Campus". From Boston to Berkeley, #underline[_there is a spotlight on_] how colleges are managing student *outrage*. Harvard Yard closed for a second day in #underline[a row], while at MIT, #underline[a] Pro-Palestinian #underline[*encampment* _stands firm in solidarity with_] other protesting students. The growing #strike[arrest]#underline[*unrest*] #strike[in]#underline[on] college campus#underline[es] causing concern and #underline[chaos as] schools prepare for the graduation in the coming weeks. Many students saying, they fear for their safety. While others say they're #underline[*vehemently* opposing all forms of *oppression*.] === words, phrases ==== words - _fundamentally_ - _endowment_ - _divest_ - _vow_ - resignation - _censure_ - _allegedly_ - _tenet_ - _outrage_ - _encampment_ - _unrest_ - _vehemently_ - _oppression_ ==== phrases - _stand frim in solidarity with_ === 回译 ==== 原文 Pro-Palestinian protests that started at U.S. Columbia University are now spreading to colleges in universities across the U.S. Fundamentally, students are protesting how their schools invest their endowments or large pools of money that colleges and universities usually acquire through donations. Pro-Palestinian student protesters want the school to divest or take money away from companies that are either Israeli or involved in Israel's war in Gaza. CNN's Isabel Rosales has more: Growing protests, as student from Columbia University vowing to occupy school grounds until the university meets their demands. This, as calls for the resignation of the school's president <NAME>, continue to get louder. Shafik under fire from both inside and outside the university and could face a censure vote from the university senate as early as tomorrow. Shafik and other university officials are facing internal criticism that NYPD arrests and students suspensions allegedly violated tenets of "Academic Freedom" and "Free Expression on Campus". From Boston to Berkeley, there is a spotlight on how colleges are managing student outrage. Harvard Yard closed for a second day in a row, while at MIT, a Pro-Palestinian encampment stands firm in solidarity with other protesting students. The growing unrest on college campuses causing concern and chaos as schools prepare for the graduation in the coming weeks. Many students saying, they fear for their safety. While others say they're vehemently opposing all forms of oppression. ==== 参考翻译 亲巴勒斯坦的抗议活动从美国哥伦比亚大学开始,现在正在扩散到全美各大高校。根本上,学生们抗议的是他们的学校如何对他们的捐赠基金或通过捐赠获得的大笔资金进行投资。亲巴勒斯坦的学生抗议者希望学校撤资,即将资金从以色列公司或与以色列在加沙的战争有关的公司撤出。CNN的Isabel Rosales带来了更多报道: 抗议活动日益增长,哥伦比亚大学的学生誓要占领校园,直到大学满足他们的要求。同时,要求学校校长<NAME>辞职的呼声也越来越高。Shafik面临来自校内外的压力,最早可能在明天面临大学参议院的谴责投票。 Shafik和其他大学官员面临内部批评,指控纽约警察局逮捕和学生停学事件涉嫌违反“学术自由”和“校园言论自由”的原则。从波士顿到伯克利,各大高校如何应对学生的愤怒引起了广泛关注。哈佛大学校园连续第二天关闭,而在麻省理工学院,一个亲巴勒斯坦的营地坚守立场,声援其他抗议学生。 随着各校为即将到来的毕业季做准备,校园内日益增长的不安引发了担忧和混乱。 许多学生表示,他们担心自己的安全。还有一些学生表示,他们坚决反对一切形式的压迫。 ==== 1st Pro-Palestinian protests started from the Columbia University in the U.S. and now are spreading to #strike[all the] colleges #underline[in universities] in America. Fundamentally, what students are protesting is how the schools invests their #strike[donation funds]#underline[*endowments*] or large #strike[sums]#underline[pools] of money #strike[from]#underline[that colleges and universities usually acquire through] donations. Pro-Palestinian student protesters hope the school to #strike[withdraw]#underline[*divest* or take] their money from #strike[Israel] companies #strike[or companies concerning]#underline[that are either Isaraeli or involved in] Israel's wars in Gaza. CNN's Isabel Rosales #strike[gives]#underline[has] more: #strike[The protests growing daily]#underline[Growing protests], #underline[as] the students in Columbia university #strike[swear to take possession of]#underline[are vowing to occupy] the #strike[campus]#underline[school] until the university meet their demands. Meanwhile, #strike[their calls of the president Minouche Shafik to resign become louder and louder]#underline[calls for the resignation of the school's president Minouche Shafik, continue to get louder]. Shafik #strike[are confronting the pressure]#underline[is *under fire*] from both inside and outside #underline[the university] and would #strike[be ... of]#underline[face a *censure vote* from] the university senate as early as tomorrow. Shafik and other officials are facing internal criticism#strike[, being accused of the arrests by the New York Police and the violation of "Academic Free" and "Campus Speech Free" principle in the ...]#underline[that NYPD arrests and students suspension allegedly violated *tenets* of "Academic Freedom" and "Free Expression on Campus"]. From Boston to Berkeley, #strike[each college attracts people's attention in how to deal the angry from students]#underline[_there's a spotlight on_ how colleges are managing student *outrage*]. Harvard Yard closed #strike[its campus] for a second day #underline[in a row], while #strike[in]#underline[at] MIT, a Pro-Palestinian #strike[student]#underline[*encampment*] #strike[stock to their side and supports]#underline[*stands firm in solidarity*] other student protesters. #strike[As colleges are preparing for the coming graduation week, the growing anxiety in Campus causes chaos and worry.]#underline[The growing *unrest* on college campuses causing concern and chaos as schools prepare for the graduation in the coming weeks] Many students said, they #strike[are worried about]#underline[fear for] their safety. And others said, the are vehemently opposing all #strike[kinds]#underline[forms] of oppression. == North Korea North Korea isn't known for its export#underline[s], it's known as the *hermit kingdom* because basically it #underline[*willfully*] shuts its#underline[elf off] for most of the world. Things like TV shows, movies from the United States and other western countries are banned in North Korea. But what if I told you that some of the very shows in North Koreans are#underline[n't] legally allowed to watch #strike[where]#underline[were] at least partially created by North Koreans. CNN's Alex Marquardt is here to explain: _Invincible_ is a popular animated show streaming on Amazon Prime #strike[, the]#underline[with a] third season on the way. It's based on #strike[the]#underline[a] comic book about #underline[a] superhero #strike[routine]#underline[teen]. While its main character is all American. Some animation in the new season #strike[makes what comes]#underline[may come] from one of America#underline['s] biggest #underline[*foes*] North Korea. <NAME> is a North Korean *analyst* at the Stimson center. He shows us what was inside #strike[in]#underline[a] recently discovered North Korean internet server. Files including sketches and video from North Korea, which #strike[is] *resemble* #strike[with] the animation from two shows produced and streamed by American companies, Amazon's _Invincible_ and another coming soon called _Iyanu - Child of Wonder_ #strike[is] set to stream on IMAX, which along with CNN, #underline[is owned by Warner Brothers] Discovery. There is no evidence that the studio knew that any #underline[*proprietary* work] #strike[were]#underline[was] on #strike[the]#underline[a] North Korean server. There #underline[is a *clip* of] _Iyanu_ which hasn't been released yet. William says, a lot of American production work is *outsourced*, particularly to #underline[China] #strike[what can]#underline[, where it could then] be *subcontracted* to North Koreans without American company awareness. A draft of one animation has Chinese instructions, translated into Korean. There's also a production sheet in English for _Invincible_. Using North Korean labor #strike[will]#underline[would] be a violation of U.S. *sanctions*. Max and #underline[the] producer of _Iyanu_ Lion Forge Entertainment declined to #strike[the common,]#underline[comment.] Unique studios, which co-created the graphic novel series didn't respond. Skybound Entertainment, which produces _Invincible_ told CNN it never #strike[proved]#underline[approved] outsourcing and #underline[would *investigate*.] === words - _hermit_ - _willfully_ - _foe_ - _analyst_ - _resemble_ - _proprietary_ - _clip_ - _outsource_ - _subcontract_ - _sanction_ - _investigate_ === 回译 ==== 原文 North Korea isn't known for its exports, it's known as the hermit kingdom because basically it willfully shuts itself off for most of the world. Things like TV shows, movies from the United States and other western countries are banned in North Korea. But what if I told you that some of the very shows in North Koreans aren't legally allowed to watch were at least partially created by North Koreans. CNN's Alex Marquardt is here to explain: _Invincible_ is a popular animated show streaming on Amazon Prime with a third season on the way. It's based on a comic book about a superhero teen. While its main character is all American. Some animation in the new season may come from one of America's biggest foes North Korea. <NAME> is a North Korean analyst at the Stimson center. He shows us what was inside a recently discovered North Korean internet server. Files including sketches and video from North Korea, which resemble the animation from two shows produced and streamed by American companies, Amazon's _Invincible_ and another coming soon called _Iyanu - Child of Wonder_ set to stream on IMAX, which along with CNN, is owned by Warner Brothers Discovery. There is no evidence that the studio knew that any proprietary work was on a North Korean server. There is a clip of _Iyanu_ which hasn't been released yet. William says, a lot of American production work is outsourced, particularly to China, where it could then be subcontracted to North Koreans without American company awareness. A draft of one animation has Chinese instructions, translated into Korean. There's also a production sheet in English for _Invincible_. Using North Korean labor would be a violation of U.S. sanctions. IMax and the producer of _Iyanu_ Lion Forge Entertainment declined to comment. Unique studios, which co-created the graphic novel series didn't respond. Skybound Entertainment, which produces _Invincible_ told CNN it never approved outsourcing and would investigate. ==== 参考翻译 朝鲜并不以出口闻名,它被称为“隐士王国”,因为它基本上故意将自己与大部分世界隔绝。来自美国和其他西方国家的电视节目、电影在朝鲜是被禁止的。但是,如果我告诉你,一些朝鲜人不被允许观看的节目,至少部分是由朝鲜人创作的,你会怎么想?CNN的<NAME>在这里为我们解释: 《Invincible》是一部在Amazon Prime上播放的热门动画剧,第三季即将到来。这部剧改编自一本关于青少年超级英雄的漫画书。虽然其主角是彻头彻尾的美国人,但新一季的一些动画可能来自美国最大的对手之一——朝鲜。 <NAME>是Stimson中心的朝鲜分析师。他向我们展示了最近在朝鲜互联网服务器中发现的一些内容。这些文件包括来自朝鲜的草图和视频,这些作品与两部由美国公司制作并流媒体播放的动画节目相似,分别是Amazon的《Invincible》和即将在IMAX上映的《Iyanu - Child of Wonder》。IMAX和CNN同属Warner Brothers Discovery公司。没有证据表明这些工作室知道任何专有作品在朝鲜的服务器上。 《Iyanu》的一段尚未发布的片段显示了这种情况。William说,许多美国的制作工作被外包,特别是外包给中国,然后中国可能会在美国公司不知情的情况下再转包给朝鲜人。 其中一个动画的草稿上有中文指示,被翻译成了韩文。还有一份用英语写的《Invincible》的制作单。使用朝鲜劳工会违反美国的制裁。IMAX和《Iyanu》的制作公司Lion Forge Entertainment拒绝置评。共同创作图画小说系列的Unique Studios没有回应。制作《Invincible》的Skybound Entertainment告诉CNN,它从未批准外包,并将对此进行调查。 ==== 1st The North Korea isn't known by exports. It is #strike[called]#underline[known as] "hermit kingdom", for it basically #underline[*willfully* shuts] itself #strike[from]#underline[off for] most of the world. #underline[Things like] TV shows and movies from America or other Western countries are banned in North Korea. But what if I tell you some of the banned shows in North Korea #underline[that aren't legally allowed to watch] are #underline[at least] partially #strike[made]#underline[created] by North Koreans. CNN's Alex Marquardt gives us more explanation: "Invincible" is a popular #strike[animation]#underline[animated show] #strike[streamed]#underline[streaming] on Amazon Prime #strike[and]#underline[with] its third season #strike[is coming]#underline[on the way]. #strike[The animation is adopted by]#underline[It is based on] a comic book concerning a young superhero. Although its main character is #strike[totally an]#underline[all] American, the latest season of the animation may come from one of the biggest American foes -- North Korea. <NAME> is a North Korean analyst of Stimson Center. He showed us #strike[some content that had been discovered recently in]#underline[what was inside in a recently discovered] North Korean Internet servers. These files includes some #strike[drafts]#underline[*sketches*] and video from North Korea, which resemble two animation #underline[produced and] streamed #strike[and made] by #strike[the] American companies. They are "Invincible" on Amazon and "Iyanu - Child of Wonder", one would be #underline[set to streamed] on IMAX #strike[later. IMAX and CNN both belong to] #underline[, which along with CNN, is owned by] Warner Brothers Discovery. There is no evidence that #strike[these ...]#underline[the stuidio] have known any #underline[*propretary*] work#strike[s of their own are]#underline[was] on North Koreans servers. A clip that haven't be #strike[published]#underline[released] of "Iyanu" showed this situation. William said, #strike[many]#underline[a lot of] American work#strike[s are]#underline[ is] outsourced, particularly to China, #strike[and China]#underline[where it] would #underline[be then] subcontracted to North Koreans #strike[when the American company didn't know]#underline[*without* American company awareness]. One draft of the animation even has Chinese instructions and it is translated into Korean. And there's also a sheet #strike[of]#underline[for] "Invincible" in English. Using North Korean labor #strike[is]#underline[would be] a violation of the American sanctions. #strike[The company, Lion Forge Entertainment, of IMAX and "Iyanu" refused to comment.]#underline[IMAX and the producer of "Iyanu", Lion Forge Entertainment, *declined to comment*]. #underline[Unique studios,] #strike[The]#underline[which] co-created novel series, "Unique Studios" didn't respond. Sky Entertainment that made "Invincible" told CNN, outsourcing is never approved and they would investigate it.
https://github.com/jijinbei/typst_template
https://raw.githubusercontent.com/jijinbei/typst_template/main/report/main.typ
typst
#import "template.typ": * #import "@preview/physica:0.9.0": * #show: project.with( title: "", authors: ( "", ), date: true, titlepage: false, )
https://github.com/voXrey/cours-informatique
https://raw.githubusercontent.com/voXrey/cours-informatique/main/typst/18-diviser-pour-régner.typ
typst
#import "@preview/codly:0.2.1": * #show: codly-init.with() #codly() #set text(font: "Roboto Serif") = Diviser Pour Régner <diviser-pour-régner> == Introduction aux algorithmes <introduction-aux-algorithmes> Ce sont des techniques classiques pour résoudre un problème donné. Par exemple : trier une liste d’éléments. On appelle alors une instance du problème une liste en particulier. Un algorithme qui résout un problème P permet de donner une solution à chaque instance. == I - Principe <i---principe> Pour résoudre un problème P sur une instance $I$ : - \[0\] - Cas de base : Les "petites" instances sont résolus immédiatement. - \[1\] - Diviser : On "découpe" $I$ en sous-instances $I_1 , . . . I_k$. - \[2\] - Régner : On résout (récursivement) les sous-instances. - \[3\] - Combiner : On combine les solutions des instances $I_1 , . . . I_k$ pour donner une solution à l’instance $I$. #emph[Remarque : on appelle les sous-instances des sous-problèmes.] == II - Exemples <ii---exemples> ==== Tri fusion <tri-fusion> ===== Listes OCaml <listes-ocaml> ```ocaml let rec divide = function | [] -> [],[] | [e] -> [e],[] | a::b::l -> let (l1,l2) = divide l in (a::l1, b::l2);; let rec fusion l1 l2 = match l1,l2 with | [],l2 -> l2 | l1,[] -> l1 | h1::t1, h2::t2 when h1 < h2 -> h1 :: (fusion t1 (h2::t2)) | h1::t1, h2::t2 -> h2 :: (fusion (h1::t1) t2);; let rec fusion_sort l = (*Cas de base*) if List.length l < 2 then l else (*DIVISER*) let (l1,l2) = divide l in (*REGNER*) let (l3,l4) = (fusion_sort l1, fusion_sort l2) in (*COMBINER*) fusion l3 l4;; ``` ===== Tableaux OCaml <tableaux-ocaml> ```ocaml let divide a = let len = Array.length a in let l1 = Array.init (len/2) (fun i -> a.(i)) in let l2 = Array.init (len-len/2) (fun i -> a.(len-1-i) in l1,l2;; let fusion_arr a1 a2 = ```
https://github.com/galaxia4Eva/galaxia4Eva
https://raw.githubusercontent.com/galaxia4Eva/galaxia4Eva/main/typst/Zelensky%20Patronus/document.typ
typst
#set text(font:"Arsenal", size:31pt) #set page(width:1280pt, height:720pt) #grid( columns: (2fr, 128pt, 128pt), rows: (128pt, 1fr, ..), column-gutter: (0pt, 31pt, ..), row-gutter:31pt, align(center+horizon)[Class of 2023],[#image("images/Zelensky.jpeg")],[#image("images/Patronus.jpeg")], align(horizon)[Brings war to the West],align(center+horizon)[#sym.checkmark],align(center+horizon)[#sym.checkmark], align(horizon)[Convinces you his battle with russia is also yours],align(center+horizon)[#sym.checkmark],align(center+horizon)[#sym.checkmark], align(horizon)[Has authority to make you do whatever he wants],align(center+horizon)[#sym.checkmark],align(center+horizon)[#sym.checkmark], align(horizon)[Wants to cuddle with you],align(center+horizon)[#image("images/Cross-Not-Pattee-Not-Maltese.svg")],align(center+horizon)[#sym.checkmark], )
https://github.com/coco33920/sqs
https://raw.githubusercontent.com/coco33920/sqs/mistress/sqs.typ
typst
#set page(footer:[#link("https://agh.nwa2coco.fr","Space Queer Station") © 2023 by #link("https://me.nwa2coco.fr","<NAME>") is licensed under #link("https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1","CC BY-NC-SA 4.0")],numbering: "1/1",number-align: right + top) #v(1fr) #set text(size:24pt) #set align(center) *Space Queer Station*\ by <NAME>,\ _Last updated: December 5th, 2023_\ #set text(size:12pt) #set align(left) #v(1fr) #pagebreak(weak: true) #show link: set text(rgb("#55cdfc").darken(10%)) #set align(left) #let middle = block(width: 100%)[ #v(1em) #set align(center) #set text(weight: "bold") $ast.basic$~$ast.basic$~$ast.basic$ #v(1em) ] #let c = counter("chapter"); #let o = false; #show heading.where(level: 1): it => { c.step() pagebreak(weak: true) v(1em) set align(center) set text(size:16pt,weight: "bold") [Chapter #c.display("I.")\ #it.body] v(2em) } #set heading(numbering: "I.") #set par(justify: true) = Part 1 *ring ring ring*\ Yul awoke at the sound of her old school vintage alarm clock, today was the day, she graduated from the Federation Space Science Academy yesterday she was officially Dr <NAME>, PhD in Astrophotometry. Officially ? Well no she was Dr _deadname_ Klid, PhD in Astrophotometry, and it was exhausting, she didn't looked like a girl so she never outed herself to the government and changed name. She was worried, why? No idea bigots were a thing of the past and the Federation had all the necessary medical technology to transition she just... never got the guts to do it and now she will be trapped on a space station more than ten thousands light years from home and will not be able to transition... Anyway, she had a transport to catch, she listed her checklist for the last time in their head. Her clothes? Check. Her cute clothes she never worn? Check. Diploma? Check. Health supply? Check. Everything is okay and she's ready to take her station at the *cough* the _Deep Space Station for Scientific and Engineering research Alpha-Kappa-Two_ it's really a mouthful. One suitcase, that's all, all her memories, stories, personal belongings, clothes, for a _lifetime_ was in _one_ suitcase. She would like to say goodbye to someone but... no one was left on earth. She had no friends from the Academy, her parents died more than a decade ago, no familly, no one. She could leave Earth and no one would miss her there. She hoped the station was better... #middle She had her own shuttle, a gift from the government for young graduates who don't have families anymore. She had the pleasure of naming it and she chose the _USS Ada Lovelace_ after an old earth woman who was considered to be the first programmer more than three hundred years ago. It was a class-5 private shuttle but attached to the Federation Fleet, and thus have an official number, _USS Ada Lovelace, FSN-$657 kappa$_. It was capable of achieving speed up to 50 light years an hour at cruising speed, the transit will be a bit over 8 days. Vessels of the Federation uses a kind of FTL travel called "Space Distortion Transportation" she was not an engineering but she roughly remembered it warped space in front of the vessel and generates a pathway out of micro-worm hole to slip through space thousands the time of speed of light without being subject to relativistic effects. Being alone in the shuttle meant all role but piloting was up to her, the computer will pilot, she was a good but fairly inattentive pilot, thanks to ADHD. she began the pre-launch sequence start and contacted Paris air control, who was the station for this side of earth. She was in vacation in a family home a few dozens kilometers south of Bordeaux. - <NAME>lid to Paris Air Control, this is the Lovelace FSN-$657 kappa$ my flight path was uploaded to your server this morning requesting permission to lift off in a path to low earth orbit - Paris Air Control, request granted, flight vector uploaded to your flight computer, please keep following it until you achieve low earth orbit and then switch to the Earth Space Control frequency. - Lovelace here, copy that, thanks. Yule then pressed the button to launch the vessel, she felt the launch thrusters gently lift the vessel off the floor and gently follow the flight vector to low earth orbit. The flight shield automatically raised and the vessel weapons activated on standby. The flight plan had portion outside Federation space. So the computer activated automatically the low alert. #middle The flight was pleasing until achieving low earth orbit, it was a bit over an hour, and she could see Earth becoming smaller and smaller, she always marveled at the view, nothing could be so magical. When low earth orbit was achieved a _bip_ could be heard inside the cockpit. - USS Ada Lovelace FSN-$657 kappa$ to Earth Space Traffic, in low earth orbit 500 km above Earth, request permission to switch to sublight, leave the planetary system and activate SDT drive. - Earth Space Traffic, you can leave the system on the $sigma$ route and activate SDT drive once you've cleared the orbit of the moon, EST out. - Copy that, see you on the other side. Yule pushed the coordinates for the $sigma$ route and activated sublight. A few minutes later she passed the orbit of the moon and said "Activate SDT, authorization Yule-Kappa-Delta-673". She felt the reaction of the shuttle as the space was constricted, mangled and distorted and the shuttle slipped on the first wormhole. The exterior was familiar, everything was as seen through a fish eye lens. = Part 2 The _Ada Lovelace_ dropped out of FTL in the Layoidora system, where the _Deep Space Station for Scientific and Engineering research Alpha-Kappa-Two_ is located, at the edge of Federation Space, doing front of the line new research about science. Yule was really excited to be there, after 8 days of boring travel she was on the verge of arriving at her new assignment, Junior Researcher in Astrophotometry. - This is <NAME>, Aboard the _USS Ada Lovelace FSN-$657 kappa$_, a new arrival in the Astrophotometry laboratory hailing the _Deep Station Alpha-Kappa-Two_ to request docking clearance. - Lieutenant! You can dock your shuttle in the staff bay. Activating tractor beam. - Copy that. #middle A few minutes later after she docked her precious shuttle in the staff bay she was in the main lobby of the station. It was _not_ like she thought it would be, she was awaiting a white futuristic immaculate station and not this homey station. The main room was maybe a hundred metre wide circle with some cafés, sofas, chairs, observations decks, all with colours, and marked with utilisation over time, mood lighting over some reading areas with plants were here and there, and finally, _Flags_, just _Flags_. There were flags, _everywhere_, she spotted the trans flag at least thrice, the non binary flag, the intersex flag, the pansexual flag, polyamourous flag, etc. A lot of flags, this station was.... Open-minded. Yule did not hear someone walking up to her. - Hey lieutenant! Yule was surprised and quickly threw a salute to the officer which seems to be the captain of the station - No need this much formality lieutenant, I'm <NAME> but you can call me Aria, of the station, on behalf of the crew welcome to _SQS_. The _Space Queer Station_. As you've seen we're very... queer here and you're welcome to explore your gender and sexuality here, we have doctors on board and people to talk about. Your section is special, you will see! - Okay, captain, Aria, it's not what I imagined but this is *fantastic* I think I'll be able to transition here, she finished mumbling in her own voice. #middle The next morning after installing herself in her cabin she walked up to a café to take a flat latte, without caffeine. And sat to wonder while looking at the stars. A person sat next to her. - Hey hum, lieutenant, I'm <NAME>, I'm the senior officer in the astrophotometry department, I wanted to talk to you before you see the rest of the department because of.... things I've seen and I know the girls will be less cautious about that. Hum, it's fairly obvious with your presenting and clothes but... you're not really a guy are you? - No I'm not, I never told someone else though. But well _this_ station seems as accepting as anyone could be... The commander giggled at that - It is indeed, what about we see this doctor for this transition of yours you got a name hun? - Yule - Yule! It's cute, annnnd it's uploaded on the station and federation database, your name will be officially changed in about a day! - Whaaa? Already? I heard it was hard to have a meeting to change your name? - I have some ties don't worry, the commander winked. #middle The med bay was, contrary to the remaining of the station, very how she imagined it to be, white, futuristic, and very immaculate. - Hey doc! We have another one for your wonderful paws to work with!, the commander yelled An ederly cat-kin woman in a doctor's coat approached the two of them. - Oh, I see, hun, how do you want to look like? A long discussion during a few hours between the doctor and Yule ensued, and a few hours later while sleeping she woke up as herself for the first time. The first thing she saw was her height. She knew she would be much smaller, she _asked_ for it, but _being_ smaller was marvelous! She was small! And huggable! Then she heard her voice! Cute! She regained her quarters, and a long night of discovering herself was _definetely_ on the menue. #set align(center) *The End* #set align(left)
https://github.com/RandomcodeDev/FalseKing-Design
https://raw.githubusercontent.com/RandomcodeDev/FalseKing-Design/main/game/concept.typ
typst
= Concept == Gameplay overview There are three main parts of the gameplay: combat, exploration, and puzzles. While exploring, the player can find NPCs, points of interest, and easter eggs. Some areas will feature traps and simplistic puzzles to open doors and reveal things. During both exploration and puzzles, the player will encounter combat. The player will be able to attack enemies and defend themself with different elemental abilities. == Mechanics #table( columns: 3, [*Mechanic*], [*Description*], [*Demo*], [Attacking], [The player has three kinds of attacks, basic, heavy, and special. The special attack has to charge to be used. If done after jumping or dashing, the attacks will be different.], [not done], [Dashing], [The player can dash, which lets them get over short gaps unaffected by gravity, or dodge enemy attacks.], [not done], [Elements], [The player unlocks the element of each kingdom after conquering it (except aether, this is unlocked by combining the other four before fighting the King of Aether). Each element will have different attacks, and allow the player to explore new areas, such as fire burning away wood in the way, or earth letting the player build bridges.], [not done] )
https://github.com/DashieTM/ost-5semester
https://raw.githubusercontent.com/DashieTM/ost-5semester/main/patterns/weeks/POSA.typ
typst
== Whole-Part Pattern <whole-part-pattern> Moderator: <NAME> === Intro <intro> Das Whole-Part Pattern ist nicht so bekannt, wie ein Singleton- oder Factory-Pattern. Es ist eher eine Art, wie man seine Software organisiert, bzw. strukturiert. Es geht darum, grosse, komplexe Software, in kleinere Subprobleme aufzuteilen, #strong[um die Komplexität und Fehleranfälligkeit zu reduzieren]. #strong[Jeder Komponent ist ein "Part" vom grösseren "Whole" System]. === Problem <problem> #strong[Um komplexe Systeme entwickeln zu können, muss Software in einzelne Teile struktuiert werden], damit es überhaupt möglich ist weiterhin die Software anzupassen, da sonst die Komplexität eine Stufe erreichen kann, bei welcher es nicht mehr möglich ist Software zu entwickeln. === Forces <forces> #strong[Modularität]: Das "Ganzes-Teil" Muster fördert Modularität und Kapselung, wodurch es einfacher wird, große Softwaresysteme zu verwalten und zu warten. #strong[Wiederverwendbarkeit]: Komponenten können oft in verschiedenen Teilen des Systems oder in verschiedenen Projekten wiederverwendet werden, was die Entwicklungszeit und den Aufwand reduziert. #strong[Skalierbarkeit]: Wenn das System wachsen oder sich an sich ändernde Anforderungen anpassen muss, ist es einfacher, Komponenten innerhalb der Hierarchie hinzuzufügen oder auszutauschen. === Solution <solution> Man kann Strukturen so bauen, dass es für den Endbenutzer nach wie vor nach einem Whole-Part aussieht, also der Benutzer merkt nicht, dass eine Komponente aus einzelnen Teilkomponenten besteht. Dies kann primär durch Abstrahierung geschehen. === Aktuelle Praxisbeispiele <aktuelle-praxisbeispiele> In einem Videospiel hat man meistens eine Spiel-Engine als gesamtes System. Mit Komponenten kann man zb. Darstellung, Physiksimulation, Ton, Eingabebehandlung und die Spiellogik beeinflussen. === Prüfungsfragen <prüfungsfragen> + Fördert das Whole-Part Pattern die Wiederverwendbarkeit von Komponenten? \[ Ja \] + Wenn man das Whole-Part Pattern zu extrem anwendet und (zu) viele Komponenten hat, kann dies zu Überkomplexität führen? \[ Ja \] == VWO5 POSA: Forwarder / Receiver <vwo5-posa-forwarder-receiver> ==== Intro <intro> Das Forwarder / Receiver Pattern setzt sich mit der inter-process Kommunikation zwischen verschiedenen Komponenten auseinander. Der Forwarder auf der Client Seite erhält den Request und kümmert sich ums Mapping für IPC (Inter-process communication) und der Receiver auf der Server seite Packt die Nachricht aus und übergibt sie dem Server. Es gibt hier keinen Broker. ==== Problem <problem> Das Problem welcher gelöst werden soll, ist wie man die Kommunikation zwischen Komponenten in einer Distributed Applikation abstrahieren soll. Es bezieht sich primär um Low-Level Mechanismen. Es soll eine Architektur gebaut werden, welche die Abhängigkeiten der effektiven IPC von der Applikation abkapselt. ==== Forces <forces> - Die IPC soll austauschbar sein mit möglichst minimalem impact auf die Applikation. ==== Solution <solution> Die Kommunikation wird nicht von den effektiven Peers durchgeführt sondern in Intermediäres, den Forwarder und Receiver ausgelagert. Das führt dazu, dass wenn es später Änderungen an der IPC gibt, muss diese nicht bei allen Peers nachgezogen werden. == Aktuelle Praxisbeispiele <aktuelle-praxisbeispiele> ==== Benefits <benefits> - Es gibt keinen Broker. Deshalb ist es simpler und weniger code als z.B. beim Broker Pattern. - Der Code bleibt anpassbar. - Die Skallierbarkeit ist auch besser, da die Lastenverteilung zentral beim Forwarder und Receiver geregelt werden kann. - Die IPC ist effizient, jeder forwarder kennt die addresse der receiver (via name-to-address mapping). ==== #strong[Liabilities] <liabilities> - Weniger flexibel == #strong[Prüfungsfragen] <prüfungsfragen> Wenn das Forwarder / Receiver Pattern eingesetzt wird, kann mit wenig Aufwand die IPC implementiert werden, ist dann aber kaum noch anpassbar. (Falsch) Der Forwarder bestimmt die Physische addresse des Empfänger über das name-to-address mapping. (Richtig) == VW07 POSA: Blackboard <vw07-posa-blackboard>=== Intro <intro> Stellt euch vor eine Expertengruppe sitzt vor einer Wandtafel und versucht eine mathematische Gleichung schrittweise, mit dem Beitrag von allen Experten, zu lösen. Hierbei werden immer wieder neue Hypothesen ausprobiert und weiterverfolgt um zu einer Lösung zu kommen. Daraus entsteht auch der Name Blackboard. === Problem <problem> Das Hauptproblem das gelöst werden soll ist es komplexe, nicht-deterministische Probleme anzugehen, bei denen keine klaren Algorithmen oder Lösungswege existieren. Es ermöglicht einer Gruppe von spezialisierten Modulen, unabhängig voneinander Informationen beizutragen und zu verarbeiten, um gemeinsam eine Lösung zu finden. Dieses Pattern ist besonders nützlich in Anwendungen, in denen die beste Lösung nicht von Anfang an offensichtlich ist und iterative Verarbeitung erforderlich ist. === Forces <forces> #strong[Experimentation]: In Domains wo kein definitiver Ansatz existiert. Es erlaubt ein ausprobieren von verschiedenen Algorithmen und Heuristiken #strong[Wiederverwendbare Knowledge Sources]: Knowledge Resources sind unabhängig und spezialisiert für bestimmte Aufgaben. Voraussetzung für Wiederverwendung jedoch müssen Blackboard und Knowledge Source gleiches Protokoll und Daten kennen #strong[Support für Fehlertoleranz]: Die Teillösungen oder auch Hypothesen genannt "überleben" nur, wenn sie von anderen Hypothesen und Daten unterstützt werden. Dies liefert eine gewisse Toleranz gegenüber Noisy Data und unsicheren Schlussfolgerungen === Solution <solution> #figure([#image(width: 50%,"../presentations/uploads/65683560cc733705bb3a21e0e5d8759a/image.png")], caption: [ image ] ) Die Idee vom Blackboard Pattern ist es, dass unabhängige Programme kooperativ mit einer gemeinsamen Datenstruktur an einem Problem arbeiten. Während des Problemlösungsprozesses arbeitet das System mit Teillösungen, die kombiniert, geändert oder abgelehnt werden. System wird in folgende Komponenten unterteilt: #strong[Blackboard:] Eine strukturierter Hauptspeicher, der Teillösungen(Hypothesen) der Knowledge Sources enthält #strong[Control]: wählt auszuführende Knowledge Source anhand einer definierten (anpassbaren) Strategie #strong[Knowledge Sources]: spezialisierte,unabhängige Module zur Bildung von Teillösungen(Hypothesen) \#\#\# Strategie Es wird eine gewisse Experimentation benötigt um eine optimale Strategie zu finden. Die Strategie erfolgt nach dem Opportunistischem-Problemlösungs Prinzip. Das heisst es wird die Knowledge Ressource ausgewählt, die am wahrscheinlichsten etwas zur Lösung des Problems beitragen kann. === Liabilities <liabilities> -#strong[Testing:] Schwer zu testen, da es keine deterministische Lösung gibt und somit die Lösungen oftmals nicht reproduzierbar sind. Ausserdem sind falsche Hypothesen Teil des Lösungsprozesses -#strong[Korrektheit]: Keine gute Lösung ist garantiert. Blackboard Systeme können nur einen gewissen Prozentsatz der Aufgaben richtig lösen. -#strong[Strategieentwicklung:] Schwierig gute Kontroll-Strategie zu finden. Diese kann nur in experimentell ermittelt werden. -#strong[Effizienz:] Geringe Effizienz. Es entsteht viel overhead bei verworfenen Hypothesen. Jedoch besser als gar nichts. -#strong[Aufwand:] Hoher Entwicklungsaufwand. Brauchen Jahre um sich zu entwicklen, da man durch trial-and-error Programmierung nur schwer vorankommt. -#strong[Parallelisierung:] Kein Support für Parallelisierung. Es verhindert zwar nicht eine Kontrollstrategie umzusetzten, welche Parallelisierbarkeit unterstützt. Jedoch müssen auch Daten auf Blackboard synchronisiert werden === Prüfungsfragen <prüfungsfragen> 1.Kommunizieren im Blackboard-Pattern die spezialisierten Module miteinander, um eine Lösung zu finden? \[Nein\] 2.Kann das Blackboard-Pattern verwendet werden, um komplexe und sich schnell ändernde Probleme in der Softwareentwicklung anzugehen?\[Ja\] == Lazy Acquisition <lazy-acquisition> Moderator: <NAME> === Intro <intro> Das Lazy Acquisition Software Pattern ist ein Designansatz, der darauf abzielt, die Ressourcennutzung zu optimieren und die Leistung des Systems zu verbessern, indem die Beschaffung von Ressourcen verschoben wird, bis sie tatsächlich benötigt werden. Dieses Muster ist besonders nützlich in Szenarien, in denen die Beschaffung von Ressourcen von Anfang an zu unnötigem Overhead führen kann oder wenn die Verfügbarkeit von Ressourcen unsicher ist. === Problem <problem> In der traditionellen Softwareentwicklung werden Ressourcen wie Datenbankverbindungen, Netzwerkverbindungen oder aufwendige Berechnungen oft zu Beginn der Programmausführung erworben, unabhängig davon, ob sie sofort benötigt werden. Diese vorausschauende Beschaffung kann zu verschwendeten Ressourcen und längeren Startzeiten führen, insbesondere in Fällen, in denen bestimmte Ressourcen nicht während der gesamten Programmlaufzeit benötigt werden. === Forces <forces> #strong[Ressourceneffizienz]: Das trägerweise Erwerben von Ressourcen ermöglicht eine effizientere Nutzung der Systemressourcen, da sie nur dann bezogen werden, wenn sie tatsächlich benötigt werden. #strong[Verbesserte Startleistung]: Das Hinauszögern der Ressourcenbeschaffung bis zum tatsächlichen Bedarf kann zu schnelleren Programmstartzeiten führen, was Anwendungen zugutekommt, die eine schnelle Initialisierung priorisieren. #strong[Dynamische Ressourcenverfügbarkeit]: In Situationen, in denen die Verfügbarkeit von Ressourcen dynamisch oder unsicher ist, ermöglicht die trägerweise Beschaffung Systemen, sich an wechselnde Bedingungen anzupassen, ohne unnötige Ressourcen in Anspruch zu nehmen. #strong[Verringerter Overhead]: Das Vermeiden der vorausschauenden Beschaffung von Ressourcen reduziert unnötigen Overhead, was entscheidend ist, um die Leistung in ressourcenbeschränkten Umgebungen zu optimieren. === Solution <solution> Das Lazy Acquisition-Muster schlägt vor, Ressourcen nur dann zu beschaffen, wenn sie während der Programmausführung tatsächlich benötigt werden. Anstatt alle Ressourcen zu Beginn des Programms zu erwerben, initialisiert sich das System mit minimalen Ressourcen und beschafft zusätzliche Ressourcen bei Bedarf. Diese Strategie der bedarfsgesteuerten Beschaffung wird durch Mechanismen wie das trägerweise Laden umgesetzt, bei dem Ressourcen nur geladen oder initialisiert werden, wenn sie zum ersten Mal abgerufen werden. Dieses Muster verbessert die Ressourceneffizienz, verringert die Startzeiten und bietet eine größere Flexibilität im Umgang mit dynamischer Ressourcenverfügbarkeit. === Aktuelle Praxisbeispiele <aktuelle-praxisbeispiele> Bei einem Patientendossier kann man zum Beispiel für alle Bilder einen Proxy verwenden, statt diese direkt zu laden. Dann kann man dies bei Bedarf nachladen. === Prüfungsfragen <prüfungsfragen> + Das Lazy Acquisition Software Pattern zielt darauf ab, alle Ressourcen zu Beginn der Programmausführung zu erwerben. \[ Nein \] + Das Lazy Acquisition-Muster kann zur Verbesserung der Startleistung beitragen, indem die Beschaffung von Ressourcen verschoben wird, bis sie tatsächlich benötigt werden. \[ Ja \] == VW 11 - Coordinator <vw-11---coordinator> === Intro <intro> Das Coordinator pattern beschreibt wie in einem system konsistenz behalten werden kann, in dem tasks mit mehreren teilnehmern koordiniert werden können. Diese können jeweils eine resource, einen resource user und einen resource provider enthalten. Das pattern sagt aus, das der Task nur abgeschlossen ist, wenn alle teilnehmer abgeschlossen haben. === Problem <problem> Das Pattern setzt sich mit dem Problem auseinander, wie komplizierte vorgänge koordiniert werden können, die verschiedene Teilnehmer haben. Das ganze muss auch konsistent bleiben, wenn ein schritt des Tasks fehlschlägt. Wenn andere sub-systeme ihre tasks aber schon erfolgreich abgeschlossen haben, kann das zu änderungen auf ihrem system führen. Das kann dann dazu führen, das der Zustand nicht konsistent ist, da auf dem System, auf welchem der Task fehlgeschlagen ist, die Daten in einem anderen Zustand sind. === Forces <forces> - Consistency: Ein Task soll einen neuen Validen zustand eines systems erstellen - Atomicity: Bei einem Task mit mehreren Teilnehmern soll der gesamte Task oder garnichts abgeschlossen werden. - Location transparency: Soll in distributed systems funktionieren. - Scalability: Skalirbar ohne das die pefrormance schlechter wird - Transparency: Transparent für system benutzer. === Solution <solution> Es soll ein Coordinator eingeführt werden, welcher für die ausführung und den abschluss der arbeit jeder teilnehmer zustßndig ist. Die Arbeit von jedem Teilnehmer ist unterteilt in prepare und commit. Bei Prepare prüft jeder Teilnehmer die konsistenz und prüft ob die durchführung zu einem fehler führen würde. Wenn ein Teilnehmer prepare nicht Erfolgreich durchführen kann, wird die Task excecution abgebrochen. Bei den Teilnehmern die erfolgreich prepared haben wird ein abort ausgelöst durch den coordinator. In der commit phase wird effektiv die arbeit verrichtet. #figure([#image(width: 50%,"../presentations/uploads/62b311900aa6e59c08e89d932d0c3966/Screenshot_2023-12-01_at_11.44.32.png")], caption: [ Screenshot 2023-12-01 at 11.44.32.png ] ) === Benefits <benefits> Gleich wie forces. === Liabilities <liabilities> - Overhead -\> jeder task wird in zwei Phasen unterteilt. - Zusätzliche aufgaben -\> jeder Teilnehmer muss sich beim Coordinator registrieren. === Prüfungsfragen <prüfungsfragen> Die Arbeit jedes Teilnehmer wird in prepare und commit unterteilt. Ja Der Einsatz des Patterns führt zu overhead, weil der Task in vier Phasen unterteilt wird. Nein == VW 13 - Resource Lifecycle Manager(RLM) <vw-13---resource-lifecycle-managerrlm>=== Intro <intro> Das Pattern des Ressourcen-Lebenszyklus-Managers(RLM) entkoppelt die Verwaltung des Lebenszyklus von Ressourcen von ihrer Nutzung, indem es einen separaten Ressourcen-Lebenszyklus-Manager einführt. Die alleinige Verantwortung dieses Managers besteht darin, die Ressourcen einer Anwendung zu verwalten. === Problem <problem> Ressourcenverwaltung in grossen Systemen ist aufwendig und bietet grosse Herausforderungen. Ohne ein effektives Ressourcenmanagement kann es zu Überlastungen, ineffizienter Nutzung und Leistungsproblemen kommen. Manuelle Ressourcenfreigabe und -verwaltung können zu Fehlern führen und die Wartbarkeit der Anwendung beeinträchtigen. === Forces <forces> - #strong[Availability:] In grossen Systemen ist es wichtig, Ressourcen effizient und effektiv zu verwalten, um sicherzustellen, dass sie für Benutzer verfügbar sind, wenn sie benötigt werden. - #strong[Scalability:] Mit zunehmender Grösse von Systemen wächst auch die Anzahl der Ressourcen, die verwaltet werden müssen. Somit kann es für Benutzer erheblich schwieriger werden, sie direkt zu verwalten. - #strong[Complexity:] Das Aufrechterhalten und Verfolgen von komplexen Abhängigkeiten zwischen Ressourcen in grossen Systemen ist wichtig, um eine ordnungsgemäße und rechtzeitige Freigabe von Ressourcen zu ermöglichen, wenn sie nicht mehr benötigt werden. - #strong[Performance:] Bottlenecks verhindern. Die Bereitstellung solcher Optimierungen kann recht komplex sein, wenn sie von einzelnen Ressourcennutzern durchgeführt wird. - #strong[Stability:] User könnten vergessen Ressourcen freizugeben, was zu Systeminstabilitäten führen kann. Die Steuerung der Ressourcenbeschaffung verhindert Starvation. - #strong[Interdependencies:] Lebenszyklen von Ressourcen können voneinander abhängig sein und müssen entsprechend angemessen verwaltet werden. - #strong[Flexibility:] Verschiedene Strategien sollten möglich und konfigurierbar sein - #strong[Transparency:] Der Ressourcennutzer sollte nicht mit den Komplexitäten der Ressourcenverwaltung konfrontiert werden müssen. === Solution <solution> Der RLM-Ansatz umfasst die Definition klarer Lebenszyklusphasen für Ressourcen, einschließlich Erstellung, Zuweisung, Nutzung und Freigabe. Automatisierungswerkzeuge und -Strategien werden implementiert, um den Lebenszyklus von Ressourcen zu verwalten. #figure([#image(width: 50%,"../presentations/uploads/789b9dc78de8558c6553081c63611f42/RLMdynamics.PNG")], caption: [ RLMdynamics ] ) === Liabilities <liabilities> - #strong[Single point of failure:] . Bug oder Fehler in RLM kann zu Ausfällen in grossen Teilen der Applikation führen. - #strong[Flexibility:] Wenn individuelle Ressourceninstanzen eine spezielle Behandlung benötigen, könnte das RLM möglicherweise zu unflexibel sein === Prüfungsfragen <prüfungsfragen> - Erfordert der Ressource Lifecycle Manager, dass der Ressourcennutzer sich mit den Komplexitäten der Ressourcenverwaltung auseinandersetzt? \[Nein\] - Hilft der Ressource Lifecycle Manager die Effizienz der Ressourcennutzung in einer Anwendung zu verbessern? \[Ja\]
https://github.com/505000677/2060-hw5
https://raw.githubusercontent.com/505000677/2060-hw5/main/book.typ
typst
#import "@preview/book:0.2.4": * #show: book #book-meta( title: "2060 HW5", summary: [ #prefix-chapter("sample-page.typ")[Hello, Prof<NAME>!] ] ) // re-export page template #import "/templates/page.typ": project #let book-page = project
https://github.com/DashieTM/ost-5semester
https://raw.githubusercontent.com/DashieTM/ost-5semester/main/experiment/weeks/week8.typ
typst
#import "../../utils.typ": * #section("Random Variables") A random variable in math is just a function that maps each result a number in the result quantity.\ In fucktarded math notation:\ #set text(16pt) #align(center, [ $X := {text("Event1, Event2")} in RR $\ \ $X(omega) := vec( (1, text("if") omega text(" = Event1")), (-1, text("if") omega text(" = Event2")), delim: "{", )$ #align( center, [#image("../../Screenshots/2023_11_09_03_40_02.png", width: 80%)], ) - $Omega$: result quanitity - A: event quantity - P: Probability -> of an event ]) #set text(11pt) Roulette Example: #align( center, [#image("../../Screenshots/2023_11_09_03_12_36.png", width: 80%)], ) #align( center, [#image("../../Screenshots/2023_11_09_03_13_14.png", width: 80%)], ) #align( center, [#image("../../Screenshots/2023_11_09_03_14_08.png", width: 80%)], ) #subsection("Random Variables and Probability") Usually random variables are represented as one possible value within an interval, so it makes sense to calculate the interval instead of just one variable:\ Essentially, we have two quantities, the quantity A which is the event quantity and the quanitity $Omega$ which is the result quantity.\ Aka the event is the mapping of random result to real world event -> if i get result 12 I win -> event +1, other numbers give -1.\ #set text(16pt) #align(center, [ $A = {omega in Omega | X(omega) in II} in AA$ #align( center, [#image("../../Screenshots/2023_11_09_03_44_11.png", width: 80%)], ) ]) I is the wanted subquantity of $Omega$ aka the resultquantity. #set text(11pt) #text( teal, )[Note: Even single values are subquantities -> just quantities with 1 element...] Example: #align( center, [#image("../../Screenshots/2023_11_09_03_44_59.png", width: 100%)], ) #subsection("Probability with discrete and continuous ranges") #align( center, [#image("../../Screenshots/2023_11_09_03_49_03.png", width: 100%)], ) #text( teal, )[As one can see, on the left we have the summation of each probability, while on the right we can take a derivation of the function since it is continuous.] Example: #align( center, [#image("../../Screenshots/2023_11_09_03_50_44.png", width: 100%)], ) #align( center, [#image("../../Screenshots/2023_11_09_03_51_03.png", width: 100%)], ) #align( center, [#image("../../Screenshots/2023_11_09_03_51_21.png", width: 100%)], ) #subsection("Bernoulli Process") - a repeated process of a random experiment - binary process -> does event happen or not, 1 or 0 - probability for success -> p - probability for failure -> q -> $1-p$ - no memory -> previous results are ignored #set text(16pt) $E(x) = overline(x) = sum_(i=1)^2 x_i * p_i$ $E(x) = 1 * p + 0 * (1-p) = p$ $text("Var")(x) = sigma^2 = sum_(𝑖=1)^2 x_i^2 p_i − p^2$ $sigma^2 = 1^2 * p + 0 * (1-p) - p^2 = p $ $sigma^2 = p - p^2 = p * (1 - p) = p * q$ - $sigma^2$: Variance - $E(x)$: amount of appearances of expected result #set text(11pt) #subsection("Binomial Distribution") - usage - only 2 events -> binary - experiment will be repeated n times -> scope n - result: probability with n repeats that: - result appears once - result appears x times - result appears at least x times - result does not appear - etc. #align( center, [#image("../../Screenshots/2023_11_09_04_04_54.png", width: 50%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_05_20.png", width: 80%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_05_38.png", width: 80%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_06_00.png", width: 80%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_06_22.png", width: 80%)], ) \ #set text(16pt) $f(x) = P(X = x) = (vec(n, x, delim: "(")p^x(1-p)^(n-x))$\ $E(X) = n*p$\ $text("Var")(X) = n * p(1-p)$\ - n: amount of repeats - x: amount of wanted result appearing - p: probability of wanted result - $E(x)$: amount of appearances of expected result #set text(11pt) #subsection("Poisson Distribution") Within a time frame the result appears on average $mu$ times.\ You can now compare this with it appearing x amount of times.\ #set text(16pt) $f(x) = P(X = x) = (mu^x)/(x!)e^(-mu)$\ $E(X) = text("Var")(X)=mu$\ #set text(11pt) #align( center, [#image("../../Screenshots/2023_11_09_04_25_55.png", width: 100%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_26_08.png", width: 100%)], ) #subsection("Possion and Binomial") With *np 10 or below and n 1500 or above* for the binomial distribution, you can set the poission and binomial distribution to be equal: #align( center, [#image("../../Screenshots/2023_11_09_04_32_14.png", width: 100%)], ) #subsection("All combined") #align( center, [#image("../../Screenshots/2023_11_09_04_26_31.png", width: 100%)], ) #align( center, [#image("../../Screenshots/2023_11_09_04_26_52.png", width: 100%)], )
https://github.com/donabe8898/typst-slide
https://raw.githubusercontent.com/donabe8898/typst-slide/main/opc/Algorithm/01/main.typ
typst
MIT License
#import "../template.typ": * #set text(font: "Noto Sans CJK JP",size:11pt) #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 ) // 表紙とか #show: project.with( title: "データ構造とアルゴリズム", subtitle: "配列構造(コンテナとソート)1", authors: ( (name: "<NAME>"), ), date: "2024年hoge月huga日", ) // ページ設定 #set page( numbering: "1", ) #set figure( numbering: "1", ) // 目次設定 #counter(page).update(1) #outline(title: [目次]) // 改ページ #pagebreak() #v(1.5em) #h(1em)本資料はOECUプログラミングサークル(以下OPC)の下級生メンバーに向けて, プログラミングの際に必要と思われるアルゴリズムとデータ構造を学ぶために作成した. 前期授業期間で錦氏 `@nkiib` やぶっとん氏 `@button501` がC/C++の基礎知識について解説してくれており, 前提として先述の講義を受けた者を本講義のターゲットとしている. #strike[なお筆者の都合で他の言語による実装が登場するかもしれないが, やってることはC++とほとんど同じなので読み替えてもらって構わない.] #h(1em)講義全体の内容は筆者の学科で「アルゴリズムとデータ構造」という授業が存在し, 基本的にはその講義の内容に沿いつつも一部で競技プログラミングの知識・問題を引用することもある. #pagebreak() = 配列構造 #v(1em) == 固定長配列 #v(1.5em) - メモリ上で指定した個数の変数をまとめて確保するデータ構造 - 静的配列とも呼ばれる - 互いの要素はメモリアドレス上で隣接している - 配列の確保に成功すると*配列の先頭へのポインタが返される* #v(2em) #align(center)[ 4つの固定長配列を確保したときのイメージ図 ```text pointer │ ┌───┬───┬───┬───┐ │ │ 4 │ 5 │ 8 │ 3 │ └─˃ ├───┼───┼───┼───┤ │a1 │a2 │a3 │a4 │ └───┴───┴───┴───┘ ``` ] - 要素の下側a1~a4はメモリアドレス - ポインタは配列の先頭要素を表す #v(2em) == 動的配列 #v(1.5em) - プログラム実行中でもサイズを変更できる配列 - 配列宣言時よりも余分にメモリを確保し, 足りなくなるとメモリを確保する処理を行う - 多くの場合は静的配列よりも実行速度が落ちる - C言語ではプログラマー自身が`malloc`等を用いて確保しなければならない. #align(center)[ ```C int *arr; arr = (int*)malloc(sizeof(int)* 11); // int型配列を要素数11個で確保 ``` ] #v(1em) - C++では`vector`, Rustでは`vec!`, Pythonでは`List`がそれに値する #align(center)[ ```cpp std::vector<int> arr(11, 0); // int型のベクタを要素数11個で確保. 同時に0で初期化 arr.push_back(3); // 末尾に3を挿入 arr.pop_back(); // 末尾の要素を削除 int l = arr.size(); // 配列のサイズを取得 arr.insert(begin() + 2, 2); // イテレータを指定して挿入 ``` ] #pagebreak() == ソートアルゴリズム #v(1.5em) - 配列の中身を昇順・降順に並べ替えるアルゴリズム - 安定ソートは順位が同じである複数の要素がソート前後で入れ替わらない. #v(1em) 本講義で紹介するソートアルゴリズムは以下の通り #table( columns: (auto,auto,auto,auto,auto), align: horizon, [名称],[平均計算時間],[最悪計算時間],[メモリ使用量],[安定], [バブルソート],[$ n^2 $],[$ n^2 $],[$ 1 $],[○], [クイックソート],[$ n log n $],[$ n^2 $],[$ log n $],[-], [選択ソート],[$ n^2 $],[$ n^2 $],[$ 1 $],[-], [ヒープソート],[$ n log n $],[$ n log n $],[$ 1 $],[-], [挿入ソート],[$ n^2 $],[$ n^2 $],[$ 1 $],[○], [シェルソート],[$ n log n $],[$ n^(3/2) $],[$ 1 $],[-], [マージソート],[$ n log n $],[$ n log n $],[$ n $],[○] ) #v(2em) === バブルソート #v(1.5em) - 全ての要素に対して, 隣合う2つの要素を比較して順序が逆であれば入れ替える. これを要素数-1回繰り返す. - 平均・最悪計算時間共に$O(n^2)$なので効率は悪い - 実装が簡単かつ安定ソート #v(1em) #figure( caption: [バブルソートの実装(C++)], )[ #text()[ #set align(center) ```cpp #include <cstdlib> #include <iostream> #include <vector> int main() { std::vector<int> arr = {6, 1, 3, 2, 8, 2, 4, 9}; for (int i = 0; i < arr.size(); ++i) { for (int j = 1; j < arr.size() - i; ++j) { if (arr[j - 1] > arr[j]) { std::swap(arr[j], arr[j - 1]); } } } for (int i : arr) { std::cout << i << ", "; } // 1, 2, 2, 3, 4, 6, 8, 9, std::cout << std::endl; return EXIT_SUCCESS; } ``` ] ] #pagebreak() === クイックソート #v(1.5em) // TODO: クイックソート #v(1em) #figure( caption: [クイックソートの実装(C++)], )[ #text()[ #set align(center) ```cpp #include <iostream> void swap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } int partition(int arr[], int l, int r) { int pivot = arr[r]; int i = (l - 1); for (int j = l; j < r; j++) { if (arr[j] <= pivot) { i++; swap(&arr[i], &arr[j]); } } swap(&arr[i + 1], &arr[r]); return (i + 1); } void quickSort(int arr[], int l, int r) { if (l < r) { int pivot = partition(arr, l, r); quickSort(arr, l, pivot - 1); quickSort(arr, pivot + 1, r); } } int main() { int l; int arr[8] = {6, 1, 3, 2, 8, 2, 4, 9}; quickSort(arr, 0, sizeof(arr) / sizeof(arr[0]) - 1); for (int i : arr) { std::cout << i << ", "; } std::cout << std::endl; return 0; } ``` ] ] // TODO: 選択ソート, ヒープソート // TODO: 挿入ソート, シェルソート // TODO: マージソート // TODO: 線形サーチ // TODO: バイナリサーチ(二分探索) // TODO: bit全探索
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/align_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 8-22 cannot add two horizontal alignments // #align(center + right, [A])
https://github.com/brayevalerien/Learning-Typst
https://raw.githubusercontent.com/brayevalerien/Learning-Typst/main/tutorial/03_advanced_styling/advanced_styling.typ
typst
MIT License
Lets reproduce the style from the #link("https://typst.app/docs/tutorial/advanced-styling/", "Typst tutorial"). Here are the styling requirements: - The font should be an 11pt serif font - The title should be in 17pt and bold - The paper contains a single-column abstract and two-column main text - The abstract should be centered - The main text should be justified - First level section headings should be 13pt, centered, and rendered in small capitals - Second level headings are run-ins, italicized and have the same size as the body text - Finally, the pages should be US letter sized, numbered in the center of the footer and the top right corner of each page should contain the title of the paper The first page contains the notes I'm currently taking and are using the plain, default Typst format. Setting the `page` rule (with `#set page(...)`) introduces a page break in Typst, so the new format will only be used after this page. // Set title here #let title = [ Paper title ] // General formating rules #set page( paper: "us-letter", header: align(right+horizon)[ #title ], // add title in the heared, right aligned numbering: "1" // use basic numbering in the footer, middle aligned ) #set par( justify: true // justify paragraphs ) #set text( size: 11pt, // set body text size to 11pt font: "New Computer Modern" // use serif font (we'll use LaTeX font!) ) // Title formatting #align( center, // center align the paper title text(size: 17pt)[ *#title* // use title variable and strongly emphasize it ] ) // Authors formating #grid( columns: (1fr, 1fr), align(center)[ <NAME> \ An Institute \ #link("mailto:<EMAIL>") ], align(center)[ <NAME> \ Another Institute \ #link("mailto:<EMAIL>") ] ) // Abstract formatting #align(center)[ #set par(justify: false) // abstract is a centered paragraph in a single column (default) *Abstract* \ #lorem(80) // placeholder text ] // Rest of a the text formating: two columns #show: rest => columns( 2, // number of columns gutter: 15pt, // gutter width rest // content ) // Headers formating #show heading.where( level: 1 // first level headers formating ): it => block(width: 100%)[ #set align(center) // center align 1st level headers #set text(13pt) // 13pt font size for 1st level headers #smallcaps(it.body) // use small caps ] #show heading.where( level: 2 // second level headers formating ): it => text( size: 11pt, // body text size. This could be a variable if needed weight: "regular", // use body weight instead of the heavier default weight style: "italic", // italicize 2nd level headers it.body + [.], // add a dot after the header to separate it from the section content ) // Below is the actual content of the document, which can be written without carring about the styling since it has been already defined above. = Introduction #lorem(200) = Related work #lorem(25) == Paper 1 #lorem(40) == Paper 2 #lorem(30) == Paper 3 #lorem(50) = Method #lorem(20) == Subsection 1 #lorem(100) == Subsection 2 #lorem(150) == Subsection 3 #lorem(50) = Conclusion #lorem(100)
https://github.com/binhtran432k/ungrammar-docs
https://raw.githubusercontent.com/binhtran432k/ungrammar-docs/main/contents/evaluation/plan.typ
typst
== Evaluation Plan === Objective The primary objective of this evaluation plan is to ensure that the implemented LSP ecosystem aligns with our expectations and delivers the desired functionality. === Scope - *Local and Cloud Environments*: We will conduct thorough testing of the ecosystem across both local development environments and cloud-side deployments. - *Key Features*: The following functionalities will be evaluated: - *View Annotations*: Verify the accuracy and display of annotations. - *Code Completion*: Assess the effectiveness of code completion suggestions. - *Code Actions*: Evaluate the relevance and usefulness of suggested code actions. - *Diagnostics*: Ensure that error diagnostics are accurate and informative. - *Navigation*: Test the functionality of go-to-definition and find all references features. - *Code Folding*: Verify the proper expansion and contraction of code sections. - *Renaming*: Ensure that renaming functionality works correctly for symbols and their references. - *Hover*: Validate the display of relevant information when hovering over code elements. - *Formatting*: Check the accuracy and consistency of code formatting. - *Syntax Highlighting*: Verify the correct semantic highlighting of code elements. - *Related Highlight*: Ensure that related code elements are highlighted appropriately. - *Quick Navigation*: Evaluate the efficiency of navigating between different code elements. - *Configuration*: Test the ability to update and apply configuration settings.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/grid-3_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 70pt) #v(40pt) The following: + A + B
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/204.%20own.html.typ
typst
own.html A Project of One's Own June 2021A few days ago, on the way home from school, my nine year old son told me he couldn't wait to get home to write more of the story he was working on. This made me as happy as anything I've heard him say — not just because he was excited about his story, but because he'd discovered this way of working. Working on a project of your own is as different from ordinary work as skating is from walking. It's more fun, but also much more productive.What proportion of great work has been done by people who were skating in this sense? If not all of it, certainly a lot.There is something special about working on a project of your own. I wouldn't say exactly that you're happier. A better word would be excited, or engaged. You're happy when things are going well, but often they aren't. When I'm writing an essay, most of the time I'm worried and puzzled: worried that the essay will turn out badly, and puzzled because I'm groping for some idea that I can't see clearly enough. Will I be able to pin it down with words? In the end I usually can, if I take long enough, but I'm never sure; the first few attempts often fail.You have moments of happiness when things work out, but they don't last long, because then you're on to the next problem. So why do it at all? Because to the kind of people who like working this way, nothing else feels as right. You feel as if you're an animal in its natural habitat, doing what you were meant to do — not always happy, maybe, but awake and alive.Many kids experience the excitement of working on projects of their own. The hard part is making this converge with the work you do as an adult. And our customs make it harder. We treat "playing" and "hobbies" as qualitatively different from "work". It's not clear to a kid building a treehouse that there's a direct (though long) route from that to architecture or engineering. And instead of pointing out the route, we conceal it, by implicitly treating the stuff kids do as different from real work. [1]Instead of telling kids that their treehouses could be on the path to the work they do as adults, we tell them the path goes through school. And unfortunately schoolwork tends to be very different from working on projects of one's own. It's usually neither a project, nor one's own. So as school gets more serious, working on projects of one's own is something that survives, if at all, as a thin thread off to the side.It's a bit sad to think of all the high school kids turning their backs on building treehouses and sitting in class dutifully learning about Darwin or Newton to pass some exam, when the work that made Darwin and Newton famous was actually closer in spirit to building treehouses than studying for exams.If I had to choose between my kids getting good grades and working on ambitious projects of their own, I'd pick the projects. And not because I'm an indulgent parent, but because I've been on the other end and I know which has more predictive value. When I was picking startups for Y Combinator, I didn't care about applicants' grades. But if they'd worked on projects of their own, I wanted to hear all about those. [2]It may be inevitable that school is the way it is. I'm not saying we have to redesign it (though I'm not saying we don't), just that we should understand what it does to our attitudes to work — that it steers us toward the dutiful plodding kind of work, often using competition as bait, and away from skating.There are occasionally times when schoolwork becomes a project of one's own. Whenever I had to write a paper, that would become a project of my own — except in English classes, ironically, because the things one has to write in English classes are so bogus. And when I got to college and started taking CS classes, the programs I had to write became projects of my own. Whenever I was writing or programming, I was usually skating, and that has been true ever since.So where exactly is the edge of projects of one's own? That's an interesting question, partly because the answer is so complicated, and partly because there's so much at stake. There turn out to be two senses in which work can be one's own: 1) that you're doing it voluntarily, rather than merely because someone told you to, and 2) that you're doing it by yourself.The edge of the former is quite sharp. People who care a lot about their work are usually very sensitive to the difference between pulling, and being pushed, and work tends to fall into one category or the other. But the test isn't simply whether you're told to do something. You can choose to do something you're told to do. Indeed, you can own it far more thoroughly than the person who told you to do it.For example, math homework is for most people something they're told to do. But for my father, who was a mathematician, it wasn't. Most of us think of the problems in a math book as a way to test or develop our knowledge of the material explained in each section. But to my father the problems were the part that mattered, and the text was merely a sort of annotation. Whenever he got a new math book it was to him like being given a puzzle: here was a new set of problems to solve, and he'd immediately set about solving all of them.The other sense of a project being one's own — working on it by oneself — has a much softer edge. It shades gradually into collaboration. And interestingly, it shades into collaboration in two different ways. One way to collaborate is to share a single project. For example, when two mathematicians collaborate on a proof that takes shape in the course of a conversation between them. The other way is when multiple people work on separate projects of their own that fit together like a jigsaw puzzle. For example, when one person writes the text of a book and another does the graphic design. [3]These two paths into collaboration can of course be combined. But under the right conditions, the excitement of working on a project of one's own can be preserved for quite a while before disintegrating into the turbulent flow of work in a large organization. Indeed, the history of successful organizations is partly the history of techniques for preserving that excitement. [4]The team that made the original Macintosh were a great example of this phenomenon. People like <NAME> and <NAME> and <NAME> and <NAME> were not just following orders. They were not tennis balls hit by <NAME>, but rockets let loose by <NAME>. There was a lot of collaboration between them, but they all seem to have individually felt the excitement of working on a project of one's own.In Andy Hertzfeld's book on the Macintosh, he describes how they'd come back into the office after dinner and work late into the night. People who've never experienced the thrill of working on a project they're excited about can't distinguish this kind of working long hours from the kind that happens in sweatshops and boiler rooms, but they're at opposite ends of the spectrum. That's why it's a mistake to insist dogmatically on "work/life balance." Indeed, the mere expression "work/life" embodies a mistake: it assumes work and life are distinct. For those to whom the word "work" automatically implies the dutiful plodding kind, they are. But for the skaters, the relationship between work and life would be better represented by a dash than a slash. I wouldn't want to work on anything that I didn't want to take over my life.Of course, it's easier to achieve this level of motivation when you're making something like the Macintosh. It's easy for something new to feel like a project of your own. That's one of the reasons for the tendency programmers have to rewrite things that don't need rewriting, and to write their own versions of things that already exist. This sometimes alarms managers, and measured by total number of characters typed, it's rarely the optimal solution. But it's not always driven simply by arrogance or cluelessness. Writing code from scratch is also much more rewarding — so much more rewarding that a good programmer can end up net ahead, despite the shocking waste of characters. Indeed, it may be one of the advantages of capitalism that it encourages such rewriting. A company that needs software to do something can't use the software already written to do it at another company, and thus has to write their own, which often turns out better. [5]The natural alignment between skating and solving new problems is one of the reasons the payoffs from startups are so high. Not only is the market price of unsolved problems higher, you also get a discount on productivity when you work on them. In fact, you get a double increase in productivity: when you're doing a clean-sheet design, it's easier to recruit skaters, and they get to spend all their time skating.<NAME> knew a thing or two about skaters from having watched <NAME>. If you can find the right people, you only have to tell them what to do at the highest level. They'll handle the details. Indeed, they insist on it. For a project to feel like your own, you must have sufficient autonomy. You can't be working to order, or slowed down by bureaucracy.One way to ensure autonomy is not to have a boss at all. There are two ways to do that: to be the boss yourself, and to work on projects outside of work. Though they're at opposite ends of the scale financially, startups and open source projects have a lot in common, including the fact that they're often run by skaters. And indeed, there's a wormhole from one end of the scale to the other: one of the best ways to discover startup ideas is to work on a project just for fun.If your projects are the kind that make money, it's easy to work on them. It's harder when they're not. And the hardest part, usually, is morale. That's where adults have it harder than kids. Kids just plunge in and build their treehouse without worrying about whether they're wasting their time, or how it compares to other treehouses. And frankly we could learn a lot from kids here. The high standards most grownups have for "real" work do not always serve us well.The most important phase in a project of one's own is at the beginning: when you go from thinking it might be cool to do x to actually doing x. And at that point high standards are not merely useless but positively harmful. There are a few people who start too many new projects, but far more, I suspect, who are deterred by fear of failure from starting projects that would have succeeded if they had.But if we couldn't benefit as kids from the knowledge that our treehouses were on the path to grownup projects, we can at least benefit as grownups from knowing that our projects are on a path that stretches back to treehouses. Remember that careless confidence you had as a kid when starting something new? That would be a powerful thing to recapture.If it's harder as adults to retain that kind of confidence, we at least tend to be more aware of what we're doing. Kids bounce, or are herded, from one kind of work to the next, barely realizing what's happening to them. Whereas we know more about different types of work and have more control over which we do. Ideally we can have the best of both worlds: to be deliberate in choosing to work on projects of our own, and carelessly confident in starting new ones. Notes[1] "Hobby" is a curious word. Now it means work that isn't real work — work that one is not to be judged by — but originally it just meant an obsession in a fairly general sense (even a political opinion, for example) that one metaphorically rode as a child rides a hobby-horse. It's hard to say if its recent, narrower meaning is a change for the better or the worse. For sure there are lots of false positives — lots of projects that end up being important but are dismissed initially as mere hobbies. But on the other hand, the concept provides valuable cover for projects in the early, ugly duckling phase.[2] Tiger parents, as parents so often do, are fighting the last war. Grades mattered more in the old days when the route to success was to acquire credentials while ascending some predefined ladder. But it's just as well that their tactics are focused on grades. How awful it would be if they invaded the territory of projects, and thereby gave their kids a distaste for this kind of work by forcing them to do it. Grades are already a grim, fake world, and aren't harmed much by parental interference, but working on one's own projects is a more delicate, private thing that could be damaged very easily.[3] The complicated, gradual edge between working on one's own projects and collaborating with others is one reason there is so much disagreement about the idea of the "lone genius." In practice people collaborate (or not) in all kinds of different ways, but the idea of the lone genius is definitely not a myth. There's a core of truth to it that goes with a certain way of working.[4] Collaboration is powerful too. The optimal organization would combine collaboration and ownership in such a way as to do the least damage to each. Interestingly, companies and university departments approach this ideal from opposite directions: companies insist on collaboration, and occasionally also manage both to recruit skaters and allow them to skate, and university departments insist on the ability to do independent research (which is by custom treated as skating, whether it is or not), and the people they hire collaborate as much as they choose.[5] If a company could design its software in such a way that the best newly arrived programmers always got a clean sheet, it could have a kind of eternal youth. That might not be impossible. If you had a software backbone defining a game with sufficiently clear rules, individual programmers could write their own players. Thanks to <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/flow/orphan.typ
typst
// Test that lines and headings doesn't become orphan. --- flow-heading-no-orphan --- #set page(height: 100pt) #lines(4) = Introduction A --- flow-par-no-orphan-and-widow-lines --- #set page(width: 60pt, height: 140pt) #set text(weight: 700) // Fits fully onto the first page. #set text(blue) #lines(8) // The first line would fit, but is moved to the second page. #lines(6, "1") // The second-to-last line is moved to the third page so that the last is isn't // as lonely. #set text(maroon) #lines(4) #lines(4, "1") // All three lines go to the next page. #set text(olive) #lines(3) --- flow-widow-forced --- // Ensure that a widow is allowed when the three lines don't all fit. #set page(height: 50pt) #lines(3) --- issue-1445-widow-orphan-unnecessary-skip --- // Ensure that widow/orphan prevention doesn't unnecessarily move things // to another page. #set page(width: 16cm) #block(height: 30pt, fill: aqua, columns(2, lorem(19)))
https://github.com/totikom/slides
https://raw.githubusercontent.com/totikom/slides/main/README.md
markdown
Creative Commons Attribution Share Alike 4.0 International
# Presentation slides monorepo In this repository I store presentations for my talks. Each directory is a separate presentation, that can be build by [typst](https://github.com/typst/typst) via `make`: ```bash # build make compile # or just make # watch make watch # delete build artifacts make clean ``` ## [Что такое блокчейн?](2024-05-01-turing-blockchain) [video](https://youtu.be/8OB97iBm31I?si=Wv_4aLTUeiXQy0v0) # Legal notice Contents of this presentation are licenced under CC BY-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/ or check out [LICENCE](LICENCE) file. Figures may be distributed under its own licence conditions.
https://github.com/noahjutz/AD
https://raw.githubusercontent.com/noahjutz/AD/main/components/code.typ
typst
#let code(code, comments) = { show table.cell.where(x: 0): set text(font: "Noto Sans Mono") let lines = code.split("\n") let i = 0 let j = 0 while i < lines.len() and j < comments.len() { let (start, end, _) = comments.at(j) if i < start { comments.insert(j, (i, s - 1, "")) } i = end+1 j += 1 } if i < lines.len() { comments.push((i, lines.len() - 1, "")) } let cells = () for (start, end, txt) in comments { cells.push(lines.at(start)) cells.push(table.cell(rowspan: end - start + 1, txt)) for i in range(start+1, end+1) { cells.push(lines.at(i)) } } block( stroke: rgb(0, 0, 0, 20%), radius: 4pt, above: 8pt, below: 8pt, breakable: false, table( columns: (auto, 1fr), stroke: (x, y) => { if x == 0 {(right: 1pt + rgb(0,0,0,20%))} else if y != 0 {(top: 1pt + rgb(0,0,0,20%))} }, fill: (x, y) => { if x == 0 and calc.odd(y) { rgb(0, 0, 0, 5%) } }, inset: (x: 8pt, y: 6pt), ..cells ) ) }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/009%20-%20Born%20of%20the%20Gods/007_The%20Hero%20of%20Iroas.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Hero of Iroas", set_name: "Born of the Gods", story_date: datetime(day: 05, month: 03, year: 2014), author: "<NAME>", doc ) In fairness, the giant had just been awakened. Still, not everyone would be able to bring down a brute twice the size of a city temple, even if it was in a stupor, so I guess I am a hero. That's not to say I'm the greatest hero or would even be remembered once I fell, but I would not turn away being called "Aesrias, the hero." I am stronger than others of my age and have always been able to easily master all manner of weapons, although for challenge I prefer to use my own fists in combat. But I boast too much. In truth I am one of many who are blessed with the might of Iroas, children of devout parents to whom the God of Victory has given the strength to serve and protect the people. Everyone always said I was born a hero. #figure(image("007_The Hero of Iroas/01.jpg", width: 100%), caption: [Hero of Iroas | Willian Murai], supplement: none, numbering: none) That shambling giant was an easier monster to take down than the hydra. The flock of harpies was probably the worst. Giants and hydras you can punch in the head. Even a hydra, with multiple heads, only has so many as long as you don't cut them off. It was time consuming knocking each of its ravenous heads unconscious, but it was better to deal with eight heads rather than one hundred. No, the harpies were the worst to fight. This was at a crossroads in a desolate area. There was no cover save for the sparse, dead trees the harpies occupied. Word of my hydra conquest became my gravest enemy. Fighting the eight heads of a hydra did not mean I could fight eight harpies in the open. They can fly and dive in to attack, swarming me with their sharp claws. They also employed a deafening caw whenever they retreated to the air. I should have brought a sword. In the end, I killed them all, of course. I grabbed a branch from their roost tree and was able to swat the monsters to the ground when they got close, delivering the killing blow with their own perch. I did this until the last two flew away. I was cut and bloodied, exhausted from the ordeal, but it was a good fight. I took the heads of the creatures to the city of Tynthal, north of One-Eyed Pass. It is a larger city, where most of the populace lives in smaller villages or in the capital within the walls of the Kolophon. It is large enough for a permanent detachment of Stratians, the warriors of the Akroan army. Tynthal's governor, Pilun, had summoned me to deal with the harpies. I arrived at the civic temple and entered the governor's chamber where he met with citizens. There were two soldiers outside who opened the doors for me and eight more in formation in the room. I gave the harpy heads to a young attendant who tried to balance them, still dripping, in his arms. Pilun sat in a gold throne, although I suspect it was only gilded, wearing a purple and blue robe—those colors are some of the most expensive dyes in Theros. I try not to judge others by their appearance, but if I saw him in the street, not flanked by soldiers in a meeting hall, I would think he were a pickpocket. He wore a crown, which bothered me, because in Akros only Anax wears a crown. "You return to the scene of the crime?" Pilun said, not rising from his seat. His guards held spears in my direction. "Governor, I am <NAME>ros, Hero of Iroas. I came at your behest to slay the harpies terrorizing your roads." "A clever ruse, I'm sure," he said. "But there is the fact that this very day several gold coins were stolen from a merchant by a man meeting your description." Someone entered the chamber from behind me. It was an older man who wore rags, but also, oddly, bright golden bracelets and rings. He gasped when he saw me, the kind of gasp I've seen in a bad Meletian drama. He began to act like he was crying, although there were no tears. "This man attacked me, my lord. He stole my purse," sobbed the liar. "Guards, it seems we have our criminal." I ran through all of it in my head. This was wrong—the governor overstepped his bounds. There had been no trial. I came here after having fought harpies he had sent me to defeat and I was tired and weaker than usual. This was all planned. I did not have the strength to fight the soldiers, did not know if the corruption touched them or if they were as innocent as I. I let them shackle me and did not fight. I would recover and then force my way out of this madness. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) I did not know how to pray to Xenagos. He was the new god everyone spoke of in whispers, some pretending he had been a god since the beginning, others denying his existence. I always prayed to all of the gods, although I admit I was lax. I could rattle off, "Blessings be to Iroas from whom my strength flows and watch over me Heliod, Thassa, Erebos, Purphoros, Nylea, Ephara, Phenax, Mogis, Karametra, Athreos, Pharika, Kruphix, and Keranos." I've said this prayer since I was a child; it is hard to add a new god to the practiced plea. I now pray to Xenagos just to be safe, but I've yet to hear divine reply. Xenagos might be a new god, but he's learning how to play the part quickly. I was praying to all the gods as I was brought to jail. At least, the guards called it a jail, but I knew what I was meant for. At the edge of the city is a coliseum used for hosting part of the games. These were meant to bring the humans of the nations of the world together in competition. As I was thrown into a holding pen designed for animals, I saw others held in cages and knew I was here to partake in an ancient and illegal practice that the Iroan Games were meant to replace. I would be sent to kill or die in an arena. They left me shackled and locked me in a cell. My legs were manacled together and my wrists attached to the lower chains so I could not raise my arms. The cell was small, the bars a grid, so I could barely squeeze my hand through. There was some hay and stains of what was probably blood and urine on the stone floor. It was dark. The dim candlelight did not grant much vision. I could not see how big the room was, but I could see there were many cages like mine. I heard some men whispering, but guards walked the prison, jabbing those who spoke with the ends of their spears. I no longer had to worry about hurting the soldiers. I could also hear the grunts and screeches of other creatures in the cages. I could hear minotaurs and the screeches of harpies. I heard what I was sure were wolves and, at least three cages away, a leonin. The only other inhabitant I was unsure of was in the cell next to mine. I did not know if he could be called a man. I had heard of the nyxborn, the agents of the gods walking among mortals. They were here to help, I had been told, to protect us from the monsters, but now there were more of them by the month and I was unsure of their intentions. #figure(image("007_The Hero of Iroas/02.jpg", width: 100%), caption: [Eidolon of Countless Battles | Raymond Swanland], supplement: none, numbering: none) He was not bound like I was. He wore some armor, but most of his skin—if I could call it skin—was exposed. It was like looking at the night sky. He walked toward me, having noticed me looking. The stars that made up his form were not like tattoos—as he moved the sky shifted on his skin, like he was a lens to a different place. I'm not proud to admit this, but when I saw him, I began to cry. I'd never seen the divine so close. "Are you a soldier?" he said. "No," I replied in a whisper. "What is your name?" he asked. "<NAME>." He tilted its head and said, "I've heard your name and I know your mother. She fell at the third battle of the Pharagax Bridge. She slew seven, although she was wounded, and shouted Iroas's name as she fought." "Did you know my mother? Were you there?" I was no longer crying—I was curious. My father never spoke about my mother's death, although her sacrifice was the reason Iroad blessed me. "I was there," he said. "I have been to many wars. Through this we are connected." "I am no soldier." "You and I both serve Iroas." "Can you not free us, then?" I asked. "You are not chained." "I cannot." He spoke slowly, deliberately. "I do not wish to be here, but I was sent to serve the governor of this city. Iroas wishes Akros secure, but this governor seems to no longer serve the true king. I am not sure what to do." "Get us out of here!" I said, raising my voice. "This foul place serves no purpose." "I can help you; you will be needed in battle one day." "I will take what help I can get, but why not save yourself?" "I don't think I can." He fell silent. The guards were walking by. Once they passed he continued. "You share Iroas's power," he said. "Come close and I can give you more of his blessing. This is something I can do." "How would I repay Iroas?" I said, hesitant. "They mean to send you against a flock of sirens. I am no god; this is Iroas's power. But it is my gift and I ask no reward." He poked his fingers, star-skin shifting, through the bars. I knew if I was still sore from my bout with simple harpies, sirens with their vocal trickery would surely do me in. I got close to the bars and he touched my shoulders. And I felt better. My wounds healed. I was no longer tired. I tried to break my bonds. The metal stressed, but it did not break. "Thank you," I told him. "There is one more favor I must ask. Can you get me one of the candles from outside your cell?" He nodded and took a candle from the wall. "What do you need this for?" he asked. "I need you to pour the wax into my ears." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) This was a modest coliseum. Nothing compared to the grand arenas in Akros. It could only seat a thousand and the vine-ridden walls broke away parts of the stadium. As the soldiers ushered me into the sand-floored arena, the sun beginning to rise, I saw Pilun sitting in a special, central area of the stadium. He was there with several women drinking wine as they stroked his chest. Pilun still wore the same clothing from the day before, as well as the crown. The coliseum was nearly empty. A few people dotted the seats, but most were drinking wine and feasting, hardly paying attention to the man walking to his death. I was not even meant to die for the masses. I was meant to die as a drunken diversion for a false king and his friends. Soldiers brought the sirens out. There were nine of them; all were wrapped in chains, each with one of their legs manacled at the ankle. Their bright green and purple wings were bound around them and metal masks covered their faces. As the sirens were brought into view, those in attendance put small items into their ears, as if they'd seen the sirens perform before. #figure(image("007_The Hero of Iroas/03.jpg", width: 100%), caption: [Chorus of the Tides | <NAME>], supplement: none, numbering: none) The soldiers took the chains attached to the sirens' legs and secured one end to a massive metal loop that emerged from the center of the arena. The soldiers nervously prepared to unlock the devices that bound the sirens' faces and wings. They all counted together, then released the sirens and ran to the arena's edge. The creatures were still connected to the chains, so when they tried to rush after their handlers, they were pulled back. They could fly into the air, but the chains would not allow them enough slack to reach the arena seats. The sirens then began to fly in the air, although some seemed slower than the others. One didn't even take off once released. I wondered how long they'd been confined. With spears to my back, my manacles were released and I was pushed forward. My handlers exited through the door we entered through. Pilun did not even look over to start the combat or recognize that it had begun. The sirens dove at me and I could see some were trying to sing. Their songs fell on deaf ears, the wax doing the trick. They came at me, diving with their talon feet first. I did not move. They tried to rend my skin, but it did not break. I moved quickly, grabbing the chain of one to wrap it around the neck of another. When the first siren tried to fly away in a panic, she choked her sister to death. I pulled another two down, quickly breaking their necks as the remaining one tried desperately to claw off my skin. Their one advantage, their songs, was lost, and with the nyxborn's blessing on me they could not succeed. I felt bad for these beasts that had been caged, just as I had been. When four remained, I walked over to the loop that connected all their chains. I was able to easily break the links and held fast to the sirens. They took to the sky, carrying me with them. I'm sure those in the arena gasped or let out cries of fear or excitement, but I couldn't hear it. I wished the sirens would fly toward Pilun so I could grab that crown from his head or deliver one more strike to the pretender's face, but they flew chaotically, spinning and fighting among themselves for control. I held as they flew out of the coliseum and dipped, nearly delivering me into the side of a building, but I braced my legs and pushed outward, propelling myself to relative safety. I watched the city pass below me as the sirens, in chorus with each other, flew into the countryside. Eventually, they tired and dropped to the ground. They looked at me with a predator's eyes, but the captivity and escape had drained them of strength. I thanked them and broke their necks quickly, but I could not let their human likeness cause me to forget that they killed innocents when free. The nyxborn's magic had faded and I too felt tired and weaker than ever. I have needed Iroas before, called upon him in dire times, but why only then did I meet his emissary? And why would Iroas send an emissary to assist Pilun? The journey to the Kolophon to inform the king of Pilun's secession and my encounter with a nyxborn will be dangerous. But I still have my fists. And I am a hero, after all.
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Code/appendStructureItems.typ
typst
#import("../Template/customFunctions.typ"): * #codly( highlights:( (line:6, fill:green, label: <appendStructureItemsTakeTwoColumns>), (line:4, start:26, end:36, label: <getValueCall>) ) ) ```ts private async appendStructureItems(items: any[], entity: any, languageAbbreviation: string): Promise<string> { let latexString = ""; for (const line of items) { const col1 = line.translations[activeTranslationIndex].name; const col2 = await this.getValue(entity, languageAbbreviation, line.paths as PdfStructureItemPathIncludingField[]); if (!line.takeTwoColumns) { latexString += `\\textbf{${col1}} & ${col2} \\\\ \n`; } else { latexString += `\\multicolumn{2}{{p{16.5cm}}}{ \\textbf{{${col1}}} \\newline ${col2} } \\\\ \n`; } } return latexString; } ```
https://github.com/typst-community/glossarium
https://raw.githubusercontent.com/typst-community/glossarium/master/CHANGELOG.md
markdown
MIT License
# Changelog ## Unreleased ## 0.4.2 > [!TIP] > For Typst v0.12.0 and later > A new function is introduced `register-glossary`. > Recommended usage is the following: > ```diff > #import "@preview/glossarium:0.4.0": make-glossary, register-glossary, print-glossary, gls, glspl > #show: make-glossary > + #let entry-list = (...) > + #register-glossary(entry-list) > ... // Your document body > #print-glossary( > - ( > - ... > - ) > + entry-list > ) > ``` > [!NOTE] > Deprecate `location` argument in queries > [!TIP] > `short` is no longer **required**, but **semi-optional**. > Accept `short` or `long` for an entry, but not neither. ## 0.4.1 - Resolved an issue causing Glossarium to crash when all entries had a defined, non-empty group. ## 0.4.0 - Support for plurals has been implemented, showcased in [examples/plural-example/main.typ](examples/plural-example). Contributed by [@St0wy](https://github.com/St0wy). - The behavior of the gls and glspl functions has been altered regarding calls on undefined glossary keys. They now cause panics. Contributed by [@St0wy](https://github.com/St0wy). ## 0.3.0 - Introducing support for grouping terms in the glossary. Use the optional and case-sensitive key `group` to assign terms to specific groups. The appearanceof the glossary can be customized with the new parameter `enable-group-pagebreak`, allowing users to insert page breaks between groups for better organization. Contributed by [indicatelovelace](https://github.com/indicatelovelace). ## 0.2.6 ### Added - A new boolean parameter `disable-back-references` has been introduced. If set to true, it disable the back-references (the page number at the end of the description of each term). Please note that disabling back-references only disables the display of the page number, if you don't have any references to your glossary terms, they won't show up unless the parameter `show-all` has been set to true. ## 0.2.5 ### Fixed - Fixed a bug where there was 2 space after a reference. Contributed by [@drupol](https://github.com/drupol) ## 0.2.4 ### Fixed - Fixed a bug where the reference would a long ref even when "long" was set to false. Contributed by [@dscso](https://github.com/dscso) ### Changed - The glossary appearance have been improved slightlyby. Contributed by [@JuliDi](https://github.com/JuliDi) ## Previous versions did not have a changelog entry
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/georges-yetyp/0.2.0/lib.typ
typst
Apache License 2.0
#let trads = ( fr: ( summary: [Résumé], student: [Étudiant⋅e], year: [Année d'étude dans la spécialité], year-value: year => [#year#super[ème] année], company: [Entreprise], address: [Adresse], responsable: [Responsable administratif⋅ve], tuteur: [Tuteur⋅ice de stage], référent: [Enseignant⋅e référent⋅e], title: [Titre], bibliography: [Bibliographie], figures: [Table des figures], glossary: [Glossaire], appendices: [Annexes], report: year => [Rapport de stage de #year#super[ème] année], book-name: [Tome principal \ & \ Annexes], uni-year: (from, to) => [Année universitaire #from -- #to], ), en: ( summary: [Summary], student: [Student], year: [Study year in the department], year-value: year => [#year#super[th] year], company: [Company], address: [Address], responsable: [Administrative manager], tuteur: [Internship mentor], référent: [Referent teacher], title: [Title], bibliography: [Bibliography], figures: [Figures], glossary: [Glossary], appendices: [Appendices], report: year => [#year#super(if year == 3 { "rd" } else { "th"}) year internship report], book-name: [Main book \ & \ Appendices], uni-year: (from, to) => [University year #from -- #to], ) ) #let rapport( nom: none, entreprise: ( nom: none, adresse: none, téléphone: none, logo: none, ), filière: "INFO", année: 5, titre: none, référent: none, responsable: none, tuteur: none, période: [25 Mars 2024 -- 25 Août 2024], résumé: none, fonte: "New Computer Modern", glossaire: none, lang: "fr", bibliographie: none, annexes-extra: none, body ) = { let fontes-dict = if type(fonte) == str { ( corps: fonte, titres: fonte, ) } else { fonte } set text(lang: lang, font: fontes-dict.corps, size: 12pt) set par(justify: true, leading: 0.8em) set heading(numbering: "I.1 -") show heading: block.with(spacing: 1.5em) show heading: set text(font: fontes-dict.titres) set bibliography(title: none) show raw.where(block: false, lang: none): set text(fill: purple) show link: set text(fill: blue) if lang != "fr" and lang != "en" { panic("Ce template n'est disponible qu'en français et en anglais") } if nom == none { panic("`nom` doit être une chaîne de caractère (avec votre nom et prénom)") } if titre == none { panic("`titre` doit être une chaîne de caractère (avec le titre du rapport)") } if type(entreprise) != dictionary { panic("`entreprise` doit être un dictionnaire contenant `nom`, `adresse` et éventuellemenent `téléphone` et `logo`") } if entreprise.nom == none { panic("`entreprise.nom` doit être une chaîne de caractères ou un bloc de contenu") } let trad = trads.at(lang) let entreprise-text-info = align(horizon + right, { text(size: 14pt, entreprise.nom) linebreak() entreprise.adresse }) let entreprise-info = if "logo" in entreprise and entreprise.logo != none { ( align( right + horizon, entreprise.logo ), [], entreprise-text-info ) } else { (entreprise-text-info,) } { grid( columns: (1fr, 1fr), column-gutter: 5em, row-gutter: 1em, align(horizon, image("logo-polytech.png")), ..entreprise-info ) v(1fr) align(center, [ #set text(size: 16pt) #nom \ #filière \ #trad.at("report")(année) #v(1fr) #{ set par(justify: false) box(width: 60%, smallcaps(heading(outlined: false, numbering: none, text(size: 20pt, titre)))) } #v(1fr) #trad.book-name #v(1fr) #let year = datetime.today().year() #trad.at("uni-year")(year - 1, year) \ #période ]) } pagebreak() { set page(header: context { let headings-before = query( selector(heading.where(outlined: true)).before(here()) ) let heading = if headings-before.len() == 0 { query( selector(heading.where(outlined: true)).after(here()) ).first() } else { headings-before.last() } set text(size: 9pt) grid( columns: (1fr, auto), emph(titre), emph([#heading.body]) ) }, numbering: "1") show figure: it => align(center, block(spacing: 3em, it)) show raw: set text(font: ("Fira Code", "FiraCode", "FiraCode Nerd Font")) show raw.where(block: true): it => { block( width: 110%, stroke: 1pt + gray, radius: 0.2em, inset: (y: 1em, x: 5%), align(left, it) ) } { set page(header: none) v(1fr) let summary = (title, contents) => { align(center, heading(outlined: false, numbering: none, title)) align(center, block(width: 80%, align(left, contents))) v(0.5fr) } if type(résumé) == dictionary { for (l, t) in trads { if l in résumé { summary(t.summary, résumé.at(l)) } } } else { summary(trad.summary, résumé) } v(1fr) pagebreak() outline(indent: auto) } show heading.where(level: 1): it => { pagebreak(weak: true) it } body pagebreak() set page(header: none) heading(numbering: none, outlined: false, [#trad.appendices]) if annexes-extra != none { annexes-extra } if glossaire != none { heading(numbering: none, outlined: false, level: 2, [#trad.glossary]) glossaire } heading(numbering: none, outlined: false, level: 2, [#trad.figures]) outline(target: figure, title: none) if bibliographie != none { heading(numbering: none, outlined: false, level: 2, [#trad.bibliography]) bibliographie } } pagebreak() let résumé-contents = if type(résumé) == dictionary { résumé.at(lang) } else { résumé } let personne = (p) => { if "fonction" in p [ #p.nom, #p.fonction ] else { p.nom } linebreak() if "téléphone" in p [ #p.téléphone \ ] if "email" in p [ #p.email ] } show strong: it => text(size: 10pt, [#it \ ]) set table.cell(colspan: 2) table( columns: (1fr, 1fr), gutter: 1em, stroke: none, table.cell(colspan: 1, [*#trad.student* #nom]), table.cell(colspan: 1, align(right, [*#trad.year* #trad.at("year-value")(année)])), [ *#trad.company* #entreprise.nom \ *#trad.address* #entreprise.adresse \ #if "téléphone" in entreprise [ *#trad.phone* #entreprise.téléphone ] ], [ *#trad.responsable* #personne(responsable) ], [ *#trad.tuteur* #personne(tuteur) ], [ *#trad.référent* #personne(référent) ], [*#trad.title* #titre], [*#trad.summary* #résumé-contents] ) }
https://github.com/Lucas-Wye/tech-note
https://raw.githubusercontent.com/Lucas-Wye/tech-note/main/src/Kali.typ
typst
= Kali #label("kali") - Kali Linux是基于Debian的Linux发行版, 设计用于数字取证操作系统。由Offensive Security Ltd维护和资助。最先由Offensive Security的<NAME>和<NAME>通过重写BackTrack来完成,BackTrack是他们之前写的用于取证的Linux发行版。 - Kali Linux预装了许多渗透测试软件,包括nmap 、Wireshark 、John the Ripper,以及Aircrack-ng;用户可通过硬盘、live CD或live USB运行Kali Linux。Kali Linux既有32位和64位的镜像。可用于x86 指令集。同时还有基于ARM架构的镜像,可用于树莓派和三星的ARM Chromebook。 == More #label("more") #link("https://www.kali.org/")[kali官网]