repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/013%20-%20Magic%202015/003_Veil%20of%20Deceit.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Veil of Deceit",
set_name: "Magic 2015",
story_date: datetime(day: 02, month: 07, year: 2014),
author: "<NAME>",
doc
)
#emph[The planeswalking necromancer <NAME> knows all too well that everybody dies, but that doesn't mean she's going to let it happen to her. She made a pact with four demons from four different planes—a contract, etched on her skin, that granted her power and agelessness, in exchange for services rendered.]
#emph[But she wasn't really in over her head until one of her demonic creditors sent her after the evil artifact known as the Chain Veil...]
Liliana of the Veil
As the world took shape around her, <NAME> stumbled. The unending chaos of the Blind Eternities formed itself into lush trees all around, soft loam beneath her feet, sweltering heat, the pungent smell of rotting humus. Perhaps there was sound—the call of birds startled by her arrival, the tromp of a baloth in the distance—but all she could hear was the veil.
"...nurtured the root...strong enough...the vessel..."
Different voices rose and fell over each other in a constant susurrus that gnawed at the edges of her mind. It was always worst right after she used magic—the rest of the time she could ignore them or drown them out with her own thoughts.
"Pipe down, boys," she said aloud, leaning against a tree to steady herself.
"...hallowed earth...the void's first breath..."
"Shut up!"
Silence. The voices stopped. If birds had been calling, they quieted at the sound of her outburst.
"Don't talk to me about the void," she said. "Now where in this cursed world am I?"
#figure(image("003_Veil of Deceit/01.jpg", width: 100%), caption: [Liliana Vess | Art by <NAME>], supplement: none, numbering: none)
Liliana had visited Shandalar only twice before—once when her demon patron Kothophed had sent her to fetch the Chain Veil she wore. Instead of bringing it back to him like a good little retriever, she'd used its power to kill him. Then she took it to Innistrad and killed Griselbrand, the second of her four demonic masters. There was no denying its power.
The cost, though—that, she could do without.
Her second visit had been an ill-fated attempt to learn more about the Onakke, the ancient civilization of ogres who were connected to the Chain Veil in some way she still didn't understand as well as she wanted to. That visit had ended with a crowd of pitchfork-bearing peasants demanding her death and left her with not much more information than she'd started with.
Lacking any better sense of where she was in relation to the ancient catacomb she sought, Liliana started walking. "You'll take me there, won't you?" she said. The whispers rose just to the edge of her hearing before she quashed them again.
"...where the seed took root..."
She walked, and soon enough—as she had expected—a sort of pressure behind one eye steered her to the right.
"...the vessel draws near..."
"Shut up," she said again. "I'm not a piece of pottery."
The trees and ferns opened up just enough to let an old trail pass through, and she felt drawn along it as if the Chain Veil were a rope pulling her forward.
"I've been here before," she said to herself. The packed earth showed no sign of the hoof prints her horse must have left before—of course it wouldn't, after so much time. But the scene was printed more firmly in her memory. She'd reached the very spot where some jungle predator had leaped out of the brush and killed her horse on her first visit.
She had barely given a thought to killing it. A single spell had wrapped it in shadow that wrung the life out of it. Like refreshing water on her tongue. If she had known the trouble it would bring her, would she have done it differently? The dirt mage Garruk had followed her to the catacomb and confronted her, providing her first opportunity to draw on the power of the veil she'd found. She'd used it to infect him with shadow, polluting his nature magic with the touch of death.
"...the root of evil..."
"Evil is such a strong word," she said, silencing the whispers again.
And then Garruk had hunted her across the worlds, as far as Innistrad, to force her to lift the curse—or to claim his revenge. She had bested him there, just as she had bested him in their first encounter here on Shandalar.
#figure(image("003_Veil of Deceit/02.jpg", width: 100%), caption: [Garruk, Apex Predator | Art by <NAME>], supplement: none, numbering: none)
"Death always wins," she muttered.
"...the vessel of destruction..."
<NAME>
The Chain Veil drew Liliana along the path until the ancient catacomb came into view. Or temple, or tomb—whatever it was that housed the catacombs below. Compared to when she'd last visited, it was in poor shape. Her battle with Garruk had left it partly crumbled to rubble. Roots and vines crawled over the fallen stones.
A light shone inside that was not there before, golden and pure, and Liliana knew what that meant. She could practically smell the angel. With a sigh, she adjusted the veil on her face and strode up the steps.
She stopped in the doorway. The angel hovered in the alcove directly opposite, where once an Onakke skeleton had stood with a different metal veil draped over its tusks. Except, instead of an alcove, it was a tunnel's gaping mouth, choked with rubble. Liliana wondered how long the angel had been there, and who or what she was waiting for—Liliana, or some other intruder into this ancient place?
#figure(image("003_Veil of Deceit/03.jpg", width: 100%), caption: [Guardian Seraph | Art by <NAME>ner], supplement: none, numbering: none)
"Stop, defiler," the angel said. "You can go no farther."
Purely out of spite, Liliana took three more steps in, making sure the angel could see the veil draped across her face.
"I've done it before and I'll do it again," she said, folding her arms across her chest.
"You!" the angel gasped.
"You know me? Or you know what I wear, more likely."
"Please, for the sake of your soul—"
"The only thing that matters to me about my soul is that it stay with my body for a good long while."
"You don't know what's at stake," the angel said, a pleading note entering the cloying melody of her voice.
"I've heard that before. They were just about Kothophed's last words. And yours as well."
She punctuated her words with a killing wave of raw necromantic power that flayed flesh from the angel's bones and raised squawks and bellows from animals dying in the forest behind her.
#figure(image("003_Veil of Deceit/04.jpg", width: 100%), caption: [Killing Wave | Art by <NAME>], supplement: none, numbering: none)
"The Onakke...," the angel croaked.
Liliana clucked her tongue as she walked to the dying angel's side. "Angels. You just don't know when to quit. It's almost like you enjoy pain." She crouched beside the angel, her hands beginning to glow with violet light. "Here, this will only hurt...a lot."
"...vessel," the angel said with obvious effort.
Liliana stood and stepped back. "What did you say?"
"You...the vessel...holding them...freeing them..."
The whispers in her head became a roaring chorus of voices drowning out whatever the angel said with her dying breath. In all their clamor, only three words rose above the din to clarity in her mind: "Root...Vessel...Veil."
Ancestral Vision
Liliana slumped to the floor beside the dead angel, clutching her head in her hands and trying to silence the Onakke spirits clamoring in her mind.
"Stop it! Shut up!" But her protests did nothing to quell their riot.
Then something dripped onto her leg and the voices fell silent, all at once. She opened her eyes and saw blood everywhere, seeping from every line Kothophed had etched in her skin, joining in tiny rivulets down her arms. She pulled hands sticky with blood away from her hair and sighed.
"This again."
The same thing had happened after she killed Kothophed, and again after Griselbrand. Drawing too much power from the Chain Veil was not just painful, but...so #emph[messy] .
She got slowly to her feet, every joint burning in protest. Then something moved at the edge of her vision, drawing her gaze to the mausoleum doorway.
The verdant forest was—not gone, but pushed back, cleared away to make room for proud buildings that had been crumbling heaps of rubble mere moments before. For a crazed moment, she wondered if this was somehow her doing, some weird side effect of her devastating spell. But that made no sense, she realized. People were walking around among the buildings, going about the normal business of life. No, not people. Ogres. Ogres with enormous, curling horns or tusks jutting from their heads, like the skeletons behind her. The Onakke.
The whispers of the Chain Veil in her mind were displaced by the hubbub of a marketplace outside. As darkness settled over the jungle, merchants and artificers were packing up their goods and starting to disperse. Liliana saw spectacular artistry in every booth and cart, the work of artisans whose awkward size belied their incredible talent. The buildings, no longer choked with jungle growth and worn by the passing ages, were elegant and stately, decorated with masterful carvings showing all aspects of life—hunting and war, sowing and reaping, feasts and what she assumed were religious rites, childbirth and sex.
"I really didn't need to see that," she muttered.
But something was happening. Ogres were standing still, looking around, cocking their heads to listen. Then Liliana heard it, too, a low roar in the distance, but growing louder with each second. Across the square, she saw one ogre running wild-eyed out of the jungle, shouting words she couldn't make out as those nearest to him dropped their goods and launched into a mad scramble.
The running ogre fell on his face, but his body sloshed forward as if melted, turning into a black smear on the ground around a scattering of bones. And around him roiled a purplish cloud that washed over the remains and surged onward, extending new tendrils ahead of it as though it were dragging itself along the ground.
And every ogre it touched suffered the same deliquescent fate.
#figure(image("003_Veil of Deceit/05.jpg", width: 100%), caption: [Damnation | Art by <NAME>], supplement: none, numbering: none)
The sun had made way for a field of gleaming stars, but even they seemed restless amid the chaos of the market. A cascade of meteors streaked across the sky as the Onakke were utterly obliterated before her eyes.
A bird croaked nearby, a raven, perched on a ledge of a nearby building overlooking the killing field. It cocked its head toward her, the first creature here to notice or acknowledge her presence.
"Raven Man," she said.
A bolt of shadow streaked from her outstretched hand toward the raven—and struck only the crumbling rubble where the building had been a moment before.
The marketplace was gone, the roiling fog and its Onakke victims, the stately buildings, the hubbub of life and the horror of death. Only the jungle, coming to life again as the sun's last light faded from the sky and the creatures of the night came out to hunt.
Chain Veil
Liliana turned away from the doorway, swallowing hard.
"Stop messing with my head," she said. "It's bad enough that I can hear you all the time. I don't want to see you, too."
She took a few steps toward the tunnel mouth at the far end of the hall.
"Not that the scene wasn't lovely, mind you. A masterful stroke of death. That's a trick I wouldn't mind learning. Wipe an entire civilization off the plane with a single spell? Right up my alley."
The voices of the Chain Veil surged in angry, harsh whispers promising her an equally terrible death. She ignored them. Gathering her strength and noting with satisfaction that the blood seeping from her skin had dried, she turned her attention to the rubble-choked tunnel that led to the catacombs where she first discovered the veil.
"...the vessel returns...harbinger...carrying destruction..."
The whispers grew louder, although no less jumbled, as she ducked her head and stepped over the rubble to enter the tunnel. A twisting descent led her back to the vaulted chamber with its stately columns and glowing block of stone—an altar, she supposed—where the Chain Veil had lain.
"I've brought it back," she said, taking the veil from her face. The soft clanking of the chains echoed in the hall. "I don't think I want it anymore."
"...just a child...unimaginable..." The whispers echoed as well, no longer confined to her thoughts.
"Trust me, I've tasted its power. It's really something. Great work."
She moved to stand next to the altar and hesitated, staring down at the veil in her hands. She had thought it was the key to her freedom, and indeed, it had helped her free herself from two of her four demonic masters. She had thought to use its power to kill the other two as well, to end the bargain that bound her to them, body and soul.
"But I seem to have killed two masters and taken on a million more," she said. "I'm not your damned vessel."
"...a million in one..."
She laid the Chain Veil on the altar, but kept hold of one edge.
#figure(image("003_Veil of Deceit/06.jpg", width: 100%), caption: [Carnage Altar | Art by <NAME>], supplement: none, numbering: none)
"I don't know what you thought I was going to do for you," she said, "but I don't do errands for anyone. Not anymore."
"...the vessel of destruction..."
She pulled her hand back—and realized with surprise that she still held the veil.
"No. I'm not playing this game." She tried to open her hand, to let the thing drop, but her fingers wouldn't obey her will. She moved it from her right hand to her left easily enough, but her left hand was just as recalcitrant.
"Stupid hands! Don't you know who's in charge here?"
The purplish light of the glowing altar filtering through the Chain Veil created the fleeting impression of an inhuman face behind the veil.
Turning on her heel, she retraced her steps to the outer chamber, where the angel's flayed corpse still lay. Ignoring it, Liliana turned to one of the gigantic ogre skeletons standing silent watch over the place.
"You'll do," she said, jabbing her finger toward it. With a shudder, it came to attention and stepped toward her.
"Take this," she said, holding the veil up toward it.
The skeleton lumbered forward and reached for the veil. An instant before its bony hand closed over it, Liliana yanked it away.
"No!"
With a mighty effort of will, she held the veil up again, letting it rest on her open palms, and turned her gaze away from it and her skeletal creation. "Take it," she said again.
A thrill went through her as the skeleton snatched it from her hands. She looked at her empty hands in disbelief.
"I am," she said aloud. "I am in charge here. Take it down there." She pointed at the open tunnel, but the skeleton didn't move. It held the veil almost gingerly in its enormous hands, its empty eye sockets fixed on her.
"Get it away from me," she said. Still it didn't move.
"Fine. You don't want to move? Then just stay here. I'll leave."
She turned and walked to the entrance, but the skeleton's clattering footsteps behind her stopped her dead. Without turning around, she said, "I told you to stay here. If you can't follow my orders, you're useless to me."
She lifted a hand and snapped her fingers, and the skeleton crumpled to the floor, robbed of the magic that had given it the semblance of life. As it fell, though, it lunged forward and hung the veil over her upraised arm. She stared at the veil in horror as bones clattered to the floor all around her.
Silence descended on the mausoleum as the bones settled back to rest and Liliana found herself without words. But then the silence broke—as it always did—as the voices of the veil resumed their whispering.
"...shall rain...root of evil...annihilation..."
She fell to her knees and clutched her hands to her ears, trying in vain to silence the voices.
"Vessel," came one voice, clear and loud—just the single word and it paused as if awaiting a response. It took Liliana a moment to realize that her ears had heard it, not just her mind.
She looked up and saw another Onakke skeleton towering over her. Even as she looked, though, it changed—sinews wrapped the bones and tied them together, muscle and organs, blood vessels and finally skin clothed the skeleton until a whole ogre stood above her.
#figure(image("003_Veil of Deceit/07.jpg", width: 100%), caption: [Kurkesh, Onakke Ancient | Art by Slawomir Maniak], supplement: none, numbering: none)
"Vessel," it said again.
Liliana sprang to her feet. "I am #emph[not your vessel] !" With the last word, she sent tendrils of shadow to wrap around the creature and squeeze the life out of it.
Instead, the tendrils passed right through it and dissolved into oily black liquid that splashed onto the floor.
"We are beyond the reach of your magic," the Onakke said. "Even though you wear our veil."
At that, Liliana realized that she was, in fact, wearing the fine chain mesh, though she couldn't remember draping it over her face. She pulled it off again and held it out toward the ogre.
"If it's your veil," she said, "why don't you take it back?"
"The veil of deceit is of no use to us, vessel. Not yet."
"Well, I don't want it either. Take it." Once again she tried to drop it, but her hand wouldn't let it go.
"You want it. Your hands know it, although you mind can't see it yet."
"Yet," she repeated. "What are you waiting for?"
"The root has not yet come to full flower in you, vessel."
"What root?"
"The root that was planted in you so many years ago, when you killed your brother."
Another blast of shadows erupted from Liliana with barely a thought from her, this one more effective—the dark tendrils pulled and tore at the incorporeal substance of the Onakke spirit. But if it felt pain, it showed no sign of it.
"What do you know of my brother?" she shouted. "Get out of my damned head!"
"We have no other place to go, vessel."
"Vessel. So I'm carrying you around with me. What does that have to do with my brother?"
The room filled with a low snuffling, wheezing sound, and Liliana realized after a moment that the spirit was laughing. More shadowy tendrils sprang from her hand to tear at its ghostly form.
"What's so damned funny?" she demanded.
"The veil of deceit is but one more lie in a life built on lies," the Onakke said. To Liliana's satisfaction, the spirit's voice was tight with pain. "Soon enough, the time will come. You will finally see clearly."
"Oh? And then what?"
"Then the root will come to flower, and the destruction you carry within you will bloom forth."
Liliana smirked. "Is that all? That sounds like fun."
"Yes, you like to destroy, to toy with the boundaries between life and death. So easily you consign others to the void, and so blithely you call them back to serve you."
Liliana shrugged. "Everyone dies."
"But not you," the spirit whispered, and a shiver washed down Liliana's spine. "Everything you've done has been to avoid following Josu into the void. Your magic, your schemes. Your pacts."
"That's enough," she said. "You live in my head, so you think you know me. You don't. And you don't know what I can do."
Three attacks against the spirit had been enough. She knew then what it would take to really hurt the thing, and she drew on all the power of the Chain Veil to do it. Reaching toward the Onakke, she pinched her fingers together as if extinguishing a candle. Blood welled up in the engraved lines that swirled across her skin, and pain roared in every nerve. And like a snuffed candle flame, the spirit vanished.
Silence fell once more over the still tomb. Liliana sank to her knees again, cradling her bloody arms across her chest. "What a mess," she whispered, her soft voice echoing in the chamber. Then she added, "It's getting worse."
Aside from her voice, the tomb was still. Silent. She looked around, half expecting the spirit to reappear, but nothing moved except swirling dust.
"Is it done?" she asked the air. "No more whispers?" She took off the Chain Veil and turned it over in her hands.
"Maybe now..." she said. She held the veil at arm's length and dropped it to the floor—or tried to drop it.
"Damn," she spat. Aching everywhere, she struggled to her feet and shuffled out the door into the jungle night, clutching the veil at her side.
"...swallowed up...annihilation..." The whispers, barely audible in her mind, began as soon as she set foot on the soft earth.
"Shut up," she said.
"...You carry the seed of destruction..."
"Yes, I know." The world began to melt away around her. She didn't know where she was going—just away from Shandalar, away from the mausoleum, away from her utter defeat.
As she walked into the Blind Eternities, she wondered if she had taken into herself the one thing she had spent her whole life trying to avoid.
#figure(image("003_Veil of Deceit/08.jpg", width: 100%), caption: [The Chain Veil | Art by Volkan Baga], supplement: none, numbering: none)
#figure(image("003_Veil of Deceit/09.png", height: 40%), caption: [], supplement: none, numbering: none)
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/032%20-%20Ixalan/003_The%20Talented%20Captain%20Vraska.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"The Talented Captain Vraska",
set_name: "Ixalan",
story_date: datetime(day: 20, month: 09, year: 2017),
author: "<NAME> & <NAME>",
doc
)
=== HOUSE OF THE OCHRAN, RAVNICA
Vraska first found the dragon's invitation tucked into a copy of the book she was reading.
Her name was written on the front in golden ink, and the paper had the distant scent of sandalwood and cinders and magic. Whoever had spelled this here had a delicate enough touch to know just how to reach her.
At first she was annoyed—the Ochran had been assigned to a new client, and she had had her fill of shadows and secrets in the dark places of Ravnica for one day. She was looking forward to nestling in by the fireplace in her flat with a history she picked up on her last holiday. But that irritation vanished when she read what the invitation said.
"#emph[MEDITATION PLANE] "
Vraska narrowed her eyes. She held the paper up to her eyes and tilted the note. The light of the fire reflected a faint blue haze over the words, and she realized the ink had been enchanted with some sort of information.
She held a hand over the letters and immediately knew where she was meant to go and what she had to do when she arrived.
It came to her in a flash—a faraway plane with an artificial texture about it, blue waters and hills that flew up and away from their base, with its location in the Multiverse delicately placed in her mind. And once she arrived, a spell to prove she was who she said she was to be granted entrance.
Vraska was intrigued. The whole business felt like a trap, so she put on her flats in the event she had to make an escape.
She concentrated on the location in her mind, her room fell into shadow, and she planeswalked through a dark slice in the air.
#figure(image("003_The Talented Captain Vraska/01.jpg", width: 100%), caption: [Pools of Becoming | Art by <NAME>], supplement: none, numbering: none)
She arrived in a courtyard filled with shallow water surrounded on all sides by a cage of violet arcs of lightning.
It was alarming, but Vraska remembered what the other half of the note had conveyed. She did her best to remember the spell to grant her entrance.
She held one hand out and traced a wide circle in the air in front of her. The other hand flicked a series of sharp gestures. Vraska channeled enough mana into the spell to manifest a slight glow of dark energy as the fingers of her outstretched hand completed the circle.
The glow vanished, and the cage of magic disappeared. The password had worked.
And a dragon flickered in front of her.
He was golden, vast and sinuous, with an unreadable expression and a strange calmness to his presence. Vraska waded ankle-deep onto the plane with confidence.
She had never seen a dragon so immense yet so #emph[human] . It unnerved her, but she refused to show any intimidation.
"Vraska, assassin of the Ochran," he said in a voice like thunder, "I'm glad you received my invitation. I am <NAME>, and I would like to hire you for the use of your talents."
Vraska crossed her arms, unbothered. "I'm not looking for new clients," she responded in a bored tone.
"I am uninterested in your skills as an assassin."
She stilled.
Vraska had never been hired to do anything other than kill before.
Her ears began to ring, and she had the odd sense that the dragon overheard that thought.
He lifted his mass to its full height. <NAME> towered over her, a gold streak against the sky, posture as far from reptilian as his anatomy would allow.
"You wish to lead . . ." he mused, to Vraska's horror. ". . . You crave a better world for those you call your own. You would pay whatever cost to deliver them the respect they deserve."
#emph[You read my mind?]
#strong[I am currently reading your mind.]
Vraska's arms had dropped to her sides. Her lips were parted in terror and her ears were still ringing at the dragon's intrusion, and she began to charge the magic necessary to petrify a foe this large.
The dragon lowered his head. His eyes were as large as dinner plates, his teeth as long as daggers. <NAME> smiled.
"I can make you Guildmaster of the Golgari, Vraska."
Her breath caught in her chest.
She thought of Mazirek, of the kraul, of the rest of the Ochran assassins and the malignant Jarad who reigned with casual ruin over the most downtrodden of the downtrodden. She remembered her years of isolation, and the heinous cruelty of the Azorius, and how no group deserved to suffer as much as those who would subjugate her own.
Eliminating that hell was all she ever wanted.
She responded with trepidation. "What is it you desire in return?"
"There exists a place on the continent of Ixalan on a faraway plane. The place is known as the Golden City of Orazca. Retrieve the item that is there, summon my associate to transport it, and I will give you the means to lead your guild to the glory it deserves. You will have an #emph[empire] , Vraska, should your mission prove successful."
She was humbled, alarmed, and excited all at once. No one had hired her to do anything other than kill before.
Everything about this felt dangerous. Nothing about this beast was trustworthy. But Vraska thought back to her life of contract after contract, death after death, playing a role assigned for her with no opportunity to #emph[escape] .
The dragon was staring.
He wanted an answer.
And #emph[she] wanted to lead.
Against all better judgment she bowed.
"I accept your terms," said Vraska.
#emph[I can double-cross him if this goes south.]
"No," said <NAME>. "You cannot."
He waved a claw, and Vraska felt the ringing in her ear vanish. The dragon had departed her mind.
"You will need this," he said, holding his claw up again. Something heavy fell into the pocket of her dress.
"It is the thaumatic compass," said the dragon. "It will lead you to the Golden City. I will also gift you with knowledge of two concepts."
The dragon held out his upright claw.
"You will use this spell to call my associate when you have reached the center of the Golden City . . ."
A sharp migraine jabbed through Vraska's temples. Her knees buckled with the sudden onslaught of knowledge. The spell was complicated, intended to pass through worlds—but to whom? It did not matter; the spell was designed to have only one recipient on only one place. She was not privy to the privilege of knowing who that was.
She felt woozy, but awed. Vraska had no idea this sort of spell was even #emph[possible] , and yet, she knew it inside and out. A single line that could reach between worlds to a single individual. She would not be able to convey a message, but by tugging the metaphysical line the recipient would know what to do. It was incredible and more than a little frightening.
But the dragon was not finished.
". . . You will also need to know how to sail."
The impact of the psychic weight made Vraska hit the ground this time.
She fell to her hands and knees and landed in the thin layer of water that covered this plane. She gasped at the influx of knowledge. #emph[Spinnaker whipstaff leeward leeboard forecastle back splice moonraker headway athwartships] —Vraska's mind was overcome with an ocean's worth of knowledge. She grit her teeth and lowered her aching head until her forehead touched the water.
She inhaled. Exhaled.
She limply stood. The vast catalogue of new nautical knowledge in her head felt like a hangover and a study session combined in one foul package. She successfully avoided throwing up.
"You'd be surprised what one learns over millennia of boredom," mused the dragon. "I never found the knowledge useful, but you and your lack of wings will need it if you intend to cross the seas."
Vraska was trembling, and her head was aching. #emph[Bowline sheet bend figure eight clove hitch—] the terms and techniques and libraries' worth of knowledge were crashing around the sides of her mind, tumbling over themselves as she mentally tried to catalogue it all.
The dragon did not care.
"Depart for your voyage. You will not be able to return until your task is complete."
#emph[The end is worth the means] , Vraska told herself, her mind still categorizing the lump sum of techniques and terms the dragon had impressed into her brain. #emph[If I do this, I will get everything I've ever wanted for myself and my own.]
The area around her darkened into shadow. Vraska stepped through a rip of night in the midday air and planeswalked home.
She had preparations to make.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
=== STORMWRECK SEA, IXALAN
The bright midday sun had turned the sea from slate gray to a brilliant cyan. A breeze like a warm bath brushed the tips of gentle turquoise waves, and a great schooner glided over the water's surface. Voices shouted over the rustle of canvas, and in the palm of Captain Vraska's hand, the largest light of her enchanted compass needle twitched violently south.
She held up an emerald hand. "Navigator!"
The navigator, Malcolm, flew up to the quarterdeck and approached Capt<NAME>. He was a siren, naturally gifted in the art of navigation, and a lifelong member of the Brazen Coalition. As a celestialist, he specialized in using charts, compasses, and astrolabes—combined with spells—to divine more information from the stars.
#figure(image("003_The Talented Captain Vraska/02.jpg", width: 100%), caption: [Siren Lookout | Art by <NAME>], supplement: none, numbering: none)
"What's wrong, Captain?"
Vraska held out the thaumatic compass. "We need to go south."
Malcolm, ever the careful navigator, made a small noise of concern. "Are you certain?"
Vraska nodded. "We go where it points, and what we need is that way."
She passed Malcolm the compass. He held it close to his face as if proximity could somehow illuminate the device's purpose. He sighed and looked back to his captain. "Your patron never told you what exactly this thing pointed to?"
Vraska sighed. "<NAME> was not willing to share that information. His instructions were only to find and retrieve the object it led to."
The quartermaster climbed up the steps and looked to Vraska. "Captain, the crew awaits your orders."
Amelia, #emph[The Belligerent] 's quartermaster, was tall as a foremast and just as sturdy. The quartermaster was in charge of day-to-day management of the ship and oversaw distribution of both plunder and pay. She was also a talented helmsmage, gifted in the magic of ships. Her spells lifted the breeze as well as the sails, and knots would tighten at her touch. She won her position as quartermaster in a landslide vote, and the crew knew better than to cross her. Amelia had a penchant for using her skills with a sail for punitive purposes, after all, and fulfilling any duties wrapped in a canvas sheet was no pleasant punishment.
Malcolm was staring at the strange compass. "But the direction it is pointing to is away from the continent of Ixalan. The Golden City isn't an island off its coast . . ."
Vraska spoke with reassurance. "With all due respect, Malcolm, #emph[you ] are the navigator. If you do not feel we should follow our mission, and thus, the compass, it is your decision to make. I implore you to trust me as I trust you."
The navigator pursed his lips. He looked to the weathervane, nodding to himself.
"Set course due south," he said firmly to Vraska. Vraska looked to the quartermaster and confirmed, "Set course due south." Amelia nodded, and turned to the rest of the crew below. "Set course due south!" she relayed.
The quartermaster's command echoed across the length of the ship as each of her crew repeated the order. It sounded like a folk song sung in the round, chorus after chorus overlapping as it travelled down #emph[The Belligerent] . Vraska couldn't help but smile at the effect.
The crew immediately set about raising the sail, adjusting the rigging, and preparing for the course change. The navigator moved toward the tiller, sat down, and walked the large rudder to one side. #emph[The Belligerent ] began to turn. They worked diligently, a motley collection of humans, ogres, and goblins. All capable, all skilled, all loyal only to each other.
#emph[Perhaps our prize is closer than we think] , Vraska mused to herself.
"Where did <NAME> find that compass, anyway?" Malcolm asked. He was walking the tiller back to its resting position, the ship having completed its turn.
"Our client is a purveyor of rare curiosities. This is on loan from his private collection of magical navigational tools."
Amelia nodded, lighting a pipe she revealed from a pocket in her coat. "Have you worked for him before?"
"No. He only approached me just before this assignment. At first, I was uncertain if I should accept, but he was confident I was right for the job."
"He's a good judge of character," Malcolm said with a reassuring smile.
Vraska wrinkled her nose. #emph[Good is a stretch.]
"He has lofty expectations." She replied. "High risk, high reward."
Malcolm grinned. "Those are odds I can live with. I'll be sure to tell my beloved to expect a shipful of gold on our return."
"And a shipful you'll have, friend," Vraska said with a nod.
And she meant it.
The implicit trust between Vraska and her crew had turned what should have been a frightening challenge of her untested skills into the most satisfying period of her life. She had spent the prior months assembling her crew. While initially it had been difficult to convince strangers to join the crew of an unknown captain, Vraska proved herself with fair payments, a truly phenomenal knowledge of sailing technique, and an unparalleled protectiveness of those she saw as her own. The people of this plane were stubborn, prone to swearing, and morally mercurial—and Vraska adored them for it. She secured her own ship through hefty payments and more than a little negotiation and soon sailed to begin her journey.
Gorgons on Ravnica could only ever be one thing. But here? A gorgon could be whatever she damn well pleased. Vraska relished in that newfound freedom and beamed with pride when she thought of how she would lead the Golgari when she returned home.
Vraska, Malcolm, and Amelia—captain, navigator, and quartermaster—set about discussing the logistics of their expedition, inspecting their maps and charts for the best route inland once they reached the continent of Ixalan.
The compass had proven difficult to interpret. It changed direction occasionally only to switch back hours later, and its several hands pointed in several directions. Vraska had reasoned the largest needle would point where she needed to go, but its reliability was proving questionable.
She wondered what the dragon would do if she should fail.
Later in the day one of the crew called down from the crow's nest.
"Avast! Man onshore!"
Edgar, the ship's other helmsmage, balled his hands into fists and willed the ship's sails down in a gentle wash of blue light. For the second time that day, #emph[The Belligerent] stowed its sails and came to a halt.
A lump of rock jutted out of the water nearby, its tops coated in a thick layer of white and its surface dotted with hundreds of nesting seabirds. Laying on that rock was a lump of blue clothes and sunburned pale skin.
Amelia looked over the edge and turned her round face to Vraska. "Should we send Malcolm over?"
"No." Vraska said, irritated at the prospect of having one more mouth to feed on the voyage, "Prepare the dinghy. I want a good look at him first." The coxswain, a dour-looking man named Gavven, prepared a small vessel to retrieve the castaway, and Vraska leaned over the rail to see who had been found.
He was laying on his back on the one piece of the seastack #emph[not ] covered in bird excrement. He was dark-haired, desperately flicking away flies with whatever energy he had left. A pile of blue clothes sat under his head, but dipping into the water was a piece of blue cloth with familiar white symbols stitched on the front.
Vraska's heart stopped in her chest.
#emph[No.]
It was <NAME>.
#emph[How the hell did he find me?]
Vraska didn't bother to answer. Panic and fury alit her mind, and she mentally prepared herself to kill the man as soon as she could look him in the eye. She had taken every precaution, every measure, used every ounce of an assassin's talent to avoid being seen. #emph[No one ] from Ravnica knew where she was, and no Planeswalker should have been able to find her. What the #emph[hell ] was Jace doing here?
Vraska thrust her spyglass into Malcolm's feathered hand. "Let me deal with him."
She climbed into the dinghy and yelled to Gavven to get in and lower them down. Edgar, the helmsmage, followed suit and took the oars in hand.
Edgar called out his intent, "Lowering the away vessel!" The three of them took their seats, and Edgar made a sharp hand gesture causing the dinghy to descend. The away ship hit the surface of the sea with a slap, and Vraska quickly detached the hooks that had lowered her craft.
She sat back as Edgar rowed and Gavven steered their dinghy toward Jace. With every stroke of her oar, she grew more resolute about what needed to be done.
#emph[He must have been following me from the start. As soon as I approach, I need to petrify him before he can slough off this ruse and wipe my mind. Of ] course#emph[, of all the obnoxious interlopers in the Multiverse, it ] had#emph[ to be him.]
"I'd tell you not to leave, but the point is a bit moot. It's like planeswalking into a window, isn't it?" Vraska yelled.
Edgar and Gavven gave her a confused look, but Vraska didn't bother to translate what "planeswalking" was. She was too angry.
"My ship needs a new figurehead, Beleren! Tell me who you're working for and your death will be a painless one!"
Vraska called on that little flicker in the back of her mind and felt her gaze charge with the petrification magic only gorgons possessed. She stood up, sensing her own magic as a warm heat behind her face, and in one swift motion, turned to lock eyes with her foe.
But his lids were shut, glued together with salt and sleep, and his hollow cheeks were covered with a thick beard that obscured the tattoos on his face. His arms were lean with muscle, but Vraska could count the ribs beneath his sunburned torso.
#emph[Dear gods, what happened to him?]
He looked devastatingly ill. There was no freshwater in sight on the island, no evidence of means for survival. The look of him derailed her train of action.
He may as well already have been dead.
Jace coughed and blinked open his eyes. Vraska snuffed the fire in her mind and looked down at him with no magic in her eyes.
#emph[I can kill him after he gives me some goddamn answers.]
"Jace, what the hell happened to you?"
Her words tumbled out as more fact than question. She ought to have killed him on sight, but what logic told her should be straightforward was muddied by the fact that . . . it was him.
Why was it always #emph[him] ?
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Jace finished his first bowl of porridge in two minutes flat, and his flagon of freshwater in even less time. He hadn't said a word since he arrived. He looked around the galley of #emph[The Belligerent] with a curious-yet-overwhelmed interest. Upon close examination, Vraska was struck by how much he had changed since she last saw him. There was no way he'd been hiding those muscles under that cape all these years.
They sat now in the galley with an empty bowl at Jace's feet. Vraska nodded at her crew to leave her alone, and pulled a stool directly in front of the mind mage.
Vraska's tendrils twitched against her face. "You have two minutes to explain how you found me before I turn you to stone and use you as a paperweight, Jace."
He blinked once.
She raised her eyebrows.
Jace shook his head. "I wasn't looking for you because I do not know who you are."
Both of Vraska's eyebrows raised as high as she could lift them.
"Are you trying to make a joke, Beleren?"
He shut his mouth and shook his head again. "I don't remember anything from before I woke up on the first island."
#emph[The ] first #emph[island?]
Vraska picked up his spoon and threw it at his chest. He tried to bat it away and missed.
"Hey!"
Clumsiness like that couldn't be faked. "Not an illusion," she concluded.
Jace's irritation evaporated into happy surprise. "You know I can make those?" His lips were lifting in a little half smile.
Vraska couldn't believe this. Why the hell was he so #emph[chipper] ? Where was the pasty, moody Guildpact she knew and loathed?
She pursed her lips. "You're an illusionist. Not an actor. Why are you still lying to me?"
"You know more about me than I do. What would I have to gain by lying to you?"
"A lot," Vraska deadpanned. "I think you're faking this."
"What is your name?"
#emph[This is hell. I'm actually in hell.]
". . . My name is Vraska."
"Vraska." Jace smiled a bit. "Your name sounds like it has a different linguistic root than mine. Where are you from? "
"You know damn well where I'm from, asshole."
Jace looked visibly hurt.
Oh.
Vraska felt . . . bad?
#emph[He's like a dog] , Vraska thought. #emph[He's a human-shaped retriever. What ] happened #emph[to him?]
It would be best if Jace were dead, but he was clearly harmless in his current state. She had a personal rule to not kill those who didn't deserve it in some way, and here sat a man with no past in his mind, no sin in his heart, and one foot in his grave.
She awkwardly stood and made her way to the stove. Everything about this was strange, unexpected, a departure from what this quest was supposed to be.
Vraska was entirely uncertain what to do, so she did the one thing she knew that eased the sensation of helplessness.
"Do you take sugar, Jace?"
"Let's find out," he said with a playful look.
Vraska sighed. This was going to get old.
Jace busied himself, and she watched him as she prepared the tea.
There was no mystery in his movements; he existed entirely in the present. Gone was the uptight Guildpact Vraska had known, who hid uncertainty with fidgeting and wrapped himself in melancholy. Here sat a lean, earnest, and jarringly friendly variation of the second most dangerous psychic in the Multiverse.
"How do we know each other?" Jace asked, brimming with curiosity.
Vraska recalled the distant memory of killing terrible people with convenient names to get the Guildpact's attention all those years ago.
It was, admittedly, clumsy.
"I asked you to work with me, and you turned me down."
"What were you asking me to work with you on?"
Vraska chose her words carefully. "I was hoping we could work together to get rid of some very bad people in very important places." She then poured the tea into a mug and handed it to Jace.
Jace gingerly sipped at the tea. "What did these bad people do?"
Vraska's mouth went tight and she turned her back to him. #emph[Arrested me. Beat me. Locked me away when I had done nothing wrong.]
Jace gasped. "Are you serious?"
Vraska turned her head around in alarm.
He had read her mind . . . but had not realized it. Jace must have thought she had spoken aloud.
He was staring back with a genuine shock and empathy in his eyes.
"That should never have happened to you, Vraska."
His expression was transparent, the emotion in his voice gentle and honest.
Vraska loudly hummed a song in her mind to drown out any other thoughts she might be projecting, and eventually found words. "My past is a part of me, but it is not who I am."
Jace smiled.
"I know that feeling all too well," he said with dry mirth.
Vraska was taken aback. #emph[The man has a sense of humor after all.]
"What is the first thing you remember, Jace?"
His lips parted as if he were going to say something, but his jaw quickly shut. He looked at her sheepishly.
"May I show you?"
Vraska shifted uncomfortably. "What do you mean show me?"
"I want to practice, if it's all right with you."
Vraska had a feeling she knew what was coming next. "Yes. It's all right."
The galley around them dissolved. Vraska remained seated in her chair, but now sat in a grove of bamboo taller than the masts of her ship. Jace sat in his chair, eyes aglow, and began an illusory summary of his last forty days. Vraska watched as bamboo changed to pristine sand. Rain sprinkled down on an imaginary fire and a very dead fish. She watched him learn to hunt and scavenge, build and survive. The gorgon sipped her tea and marveled at both the beauty of Jace's island and the plethora of things Jace had learned while he was there. He smiled as he showed her what he had learned and built. He clearly delighted in filling the empty gaps in his knowledge, and his enthusiasm was contagious. It #emph[was ] incredible that he constructed fish hooks, a platform, a raft. Vraska finished her tea by the end of the tour, and the island faded back to the familiar wood of the galley.
Jace's magic receded. Vraska found herself shaking her head. Of course he of all people would #emph[enjoy ] being marooned on an island with no memory. But this series of illusions did not answer how he had ended up here in the first place.
"You really don't remember anything, do you?" she asked.
He gave Vraska a bittersweet look and echoed her own words: "My past is part of who I am, but it is not who I am today."
Jace had rediscovered the illusion-casting talents he possessed, but none of the truly frightening ones. It was unsettling. On this plane, she alone knew what he was capable of.
She looked at the tea in her hand and sighed. She would keep him alive. His talents would be of use to her, for now. Naivety was not a warrant for death, especially under an assassin's code. But this case was different . . .
The man in front of her wasn't Jace. Not really. The Guildpact as she knew him was gone.
#emph[If I am not paid to do so, I do not kill strangers.]
Her mind was set.
"We'll prepare a hammock for you in the forecastle," Vraska said. "When we arrive at our next harbor, we'll leave you to your own devices."
Jace nodded and set his empty mug down by his feet.
#emph[Look at the state of him] , Vraska thought. #emph[He's helpless.] #emph[Am I making a mistake by letting him live?]
"Did you say something?" Jace asked.
Vraska's heart caught in her chest; she shook her head, and Jace frowned.
"Strange," he muttered, "must have been the ship."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#figure(image("003_The Talented Captain Vraska/03.jpg", width: 100%), caption: [Sorcerous Spyglass | Art by <NAME>], supplement: none, numbering: none)
Jace had spent eight days aboard the ship and was having a difficult time acting as a guest on #emph[The Belligerent] .
Though the ship's physician had ordered him to rest below deck, Jace had earned a reputation for being unable to stay in one place for long.
On one windless day, Vraska watched as he disassembled and reassembled a telescope.
The entire process took about fifteen minutes.
He began by studying the outside of the thing, finding its crevices, then using a borrowed tool to gently dismantle it. He was knolling the pieces as he went, organizing the bits in a meticulous grid on the deck of the ship. Once it was apart, he worked backward, putting each piece back together in the reverse of order he had taken it apart.
A small crowd gathered to watch in fascination. Vraska hung in the back, as impressed as she was perturbed. She whispered in the ear of her transfixed quartermaster, who hastily apologized and snapped at the crew to get back to work.
Jace stood, embarrassed, and handed the reassembled telescope to Vraska.
"I'll be in the galley. Sir." His eyes were downcast with apology.
Vraska turned the telescope over in her hand. She looked back at Jace and yelled to get his attention.
"Oi!"
He looked up. Vraska tossed him a second telescope. Jace caught it, and looked back, confused. He walked over to her. "What do you want me to do with this?"
"Can you fix mine, too?" Vraska asked.
Jace grinned and clapped Vraska on the back.
"DON'T!" she yelled with a hard flinch.
Jace froze. Amelia strode over on long, thick legs and looked down at the mind mage with her best quartermaster glare. "No one touches the captain!" she growled.
"It's fine," Vraska said, trying to ease her own nerves. "He didn't know, Amelia."
Vraska's heart was racing with panic, and she took a deep breath to ease away the alarm. She had not physically touched anyone in years. The crew didn't need to know why. She hid those old prison scars for a reason.
"Captain, I'm sorry," Jace said, eyes on his own shoes.
"Don't be sorry," Vraska said, an edge to her voice. "Just don't do it again."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The sky outside was overcast, and the air felt thick with the threat of rain. The wind was steady and vigorous; Malcolm had estimated they would make landfall at High and Dry within the next day. Most of the crew was below decks, eating their meals and passing the time.
The crewman in the crow's nest called out, and Malcolm flew up to meet them. He paused atop the mast and flew into the sky far above. He returned in a swift dive, landing immediately next to Vraska.
He whispered sharply. "Ship just over the horizon. She bears black sails."
Vraska set her mouth in a firm line. #emph[The Legion of Dusk.]
#figure(image("003_The Talented Captain Vraska/04.jpg", width: 100%), caption: [Dusk Legion Dreadnought | Art by Titus Lunter], supplement: none, numbering: none)
The enemy ship was beginning to crest the horizon, emerging slowly from a dark fog of magic. Its sides were of dense, dark wood, weathered by time and travel. The ship's sails were as dark as the smoke that followed it and its cabin as large and imposing as a cathedral.
Vraska had survived worse.
She remembered the first run-in she had had with the vampires of the Legion of Dusk. It was within the first few weeks of her ownership of #emph[The Belligerent] , and her crew was as unfamiliar with each other as she was with her foe. The vampire's approach turned noon into evening, and the ship had been enveloped with a dark cloud. Vraska was initially confused as to why a larger ship would overtake their own, but it was clear that her crew, not their loot, was the objective. The conquistadors did not need to use their weapons. They cried out to their saints and feasted with a fierceness Vraska had never seen before. She lost four crewmates that day, all drained in pious fervor before she could petrify their killers.
#figure(image("003_The Talented Captain Vraska/05.jpg", width: 100%), caption: [Skyblade of the Legion | Art by Daarken], supplement: none, numbering: none)
Malcolm was there that day. "They were breaking their Blood Fast," he said. The Legion of Dusk justified their bloodlust by only killing sinful criminals. It was no accident they saw the Brazen Coalition as an alliance of sinners.
She remembered, too, how Amelia had told her what the vampires were after. "They seek an end to their vampirism," she had said. "They crave eternal life without needing blood. The Immortal Sun was stolen from their monasteries, and so they ventured to the sea to reclaim it. They took our ancestral lands on Torrezon, and they take all homes in the end."
#figure(image("003_The Talented Captain Vraska/06.jpg", width: 100%), caption: [Duskborne Skymarcher | Art by <NAME>], supplement: none, numbering: none)
Vraska brought herself back to the present moment.
She narrowed her eyes and assessed her options.
She could try to outrun the ship and resupply at High and Dry . . . or she could avoid draining the ship's coffers and steal from the conquistadors instead.
Vraska decided to go with the fun option.
"All hands on deck!" she cried to her crew below.
They immediately answered her call, rapidly ascending the ladder from the crew's quarters and leaping to their duties as Vraska called them out.
Her heart raced with excitement to command.
She assessed the skies above. The clouds were heavy with impending rain, and #emph[The Belligerent ] was tacking. The other ship's sails were down, and if Vraska attacked quickly, they would be able to take advantage of their upwind position.
"Battle stations! Bear away and raise colors!"
As Vraska yelled orders, she heard her crew echo the commands throughout the ship. Malcolm flew to the tiller and moved it hard to one side as the crew shifted the stays far above. Amelia and Edgar stood back to back and raised both main and mizzenmast with a sharp burst of magic. The ship began turning sharply to the starboard side, its sails filling with a brief summoned breeze.
Jace emerged onto the deck, in awe of the commotion and visibly unsure of where he ought to be.
A moment of inspiration struck Vraska.
"Jace! Up here!" She called to him from the quarterdeck and beckoned him up the small ladder to where she and the quartermaster stood. His eyes were wide with excitement and unease.
Vraska looked to him. "Jace, we mean to board that ship and capture supplies. Can you camouflage #emph[The Belligerent] 's approach?"
A smile tugged at Jace's lips, but he quickly smoothed it out into a look of determination. "Yes, Captain."
Vraska nodded. "Then proceed."
Jace looked skyward, his eyes aglow, and like water pouring over a curved surface, his magic flowed down around #emph[The Belligerent] , seemingly wiping it from existence as it went.
The crew could see each other and the ship below. Jace maintained concentration, and nodded briskly at the captain. Vraska grinned and turned to her shipmates.
"Crew! We'll proceed silently until the ship is positioned for immediate boarding! Once we're within range, Jace will drop the camouflage, and we board. Retrieve supplies and food #emph[only] ."
Several members of the crew audibly groaned.
"I'm kidding, dear friends," Vraska smiled, "take what you like from those bloodsucking magpies."
The crew cheered and set about adjusting the rigging to hasten their approach.
Jace looked to Vraska. "What do you mean 'silently'?"
"It's a specialty of our ship." Vraska approached the ship's bell and pulled a bundle of small flags from a box near the rail. "I haven't landed on a good name for this tactic yet."
She held one of the small flags aloft so the trained crew would know what was coming next, and held up a hand to begin her spell.
She made a series of subtle gestures, and the volume of the ship's busywork began to fade into silence. It was an old assassin's enchantment she had learned while working for the Golgari, and she had used it on countless assignments since. The spell itself was soundless, invisible, and its effect was immediate. Even if she yelled at the top of her lungs, the spell would stifle her cry.
#emph[The Belligerent ] was now imperceptible to any outside its rails.
Vraska used her signal flags to communicate her orders to the crew in the absence of sound. At her command, the ship curved wide around the path of the enemy vessel. The Legion of Dusk had certainly spotted them on the horizon before #emph[The] #emph[Belligerent] had vanished, but they were now sailing in a misguided direction, their target lost from view.
Vraska grinned at Jace and turned back toward the ship. #emph[Excellent work] , she thought.
Jace smiled and replied a reflexive "Thank you, Captain," its volume cancelled by the spell of silence.
Vraska made a quiet mental note to be more careful. She did not want him to be consciously aware of his more frightening abilities yet.
The Legion of Dusk dropped their sails. Vraska held up two flags at once, and #emph[The Belligerent ] turned sharply on its approach to the stalled vessel.
#emph[The Belligerent ] closed to a ship's length away from the Legion of Dusk. Vraska tapped Jace's shoulder and held up a hand as a conductor would to an orchestra. He understood her meaning and nodded, maintaining the illusion that cloaked the ship from view.
Vraska simultaneously closed the hand facing Jace and lifted a black flag with the other.
All at once, the spell of silence lifted, the ship became visible, and a third of the crew yelled out a battle cry as they swung on grappling lines toward the deck of the conquistadors' ship.
The vampires were caught completely off guard.
#figure(image("003_The Talented Captain Vraska/07.jpg", width: 100%), caption: [Swashbuckling | Art by <NAME>], supplement: none, numbering: none)
The silence erupted into chaos and noise as #emph[The Belligerent] 's crew swung onto the Legion of Dusk's ship. The crew of the vampire ship jolted in surprise at the onslaught. Most crewmates were easily subdued, their eyes wide and guards down as the pirates bore down on their ship. Some were smart enough to pull out their weapons, and they scrambled to maintain their composure as Vraska's crew attacked. The clang of steel-on-steel rang through the air, and the deck became a busy wash of panic and pirates.
#figure(image("003_The Talented Captain Vraska/08.jpg", width: 100%), caption: [Skulduggery | Art by <NAME>], supplement: none, numbering: none)
The vampires emerged from below deck. Their armor was shining and brilliant, meticulously clean and of higher quality than that worn by the ship's crew. These conquistadors were the stuff of legend and myth, sophisticated yet savage, eternally cursed. Their light eyes peered from underneath golden helms, and their teeth flashed in the light of the sun.
"What sort of vampires are they?" Jace asked, yelling above the crowd.
Vraska looked at him with an are-you-kidding-me glance. "You remember vampires but you don't remember your own name?"
"I remember things that matter," he replied with the hint of a grin.
From their vantage point Vraska could hear one calling above the rest.
"Saint Elenda! Grant me the will to purge this sea of sinners!"
#emph[She's not listening] , Vraska mused to herself. #emph[But I am.]
She ran down the side of the quarterdeck and barreled across the gangplank, slicing her way past vampires and human alike, wielding a cutlass, the tendrils of her hair coiling in excitement. Jace leapt into battle after her, summoning several copies of himself to run rampant through the crowd of confused Legion of Dusk conquistadors.
The illusions distracted and dodged, distracting the vampires just long enough for the pirates to subdue them.
After cutting her way through several attacking vampires, she yelled above the chaos, "Bring me the captain!"
Her call was answered by the emergence a glittering, golden-armored vampire. His armor was elaborate and cloying, an affront to the tropical climate around them. He locked eyes with Vraska and charged, sword drawn and teeth bared. The gorgon smiled.
Vraska dodged the vampire's sword and began gathering the magical energy required to petrify. She stalled for time by swinging at the captain with her own cutlass.
The man hissed and spat, meeting each blow of Vraska's sword with a clang of his own.
Vraska jolted in surprise as Jace appeared on her left, and then also on her right, the twin illusions misleading the vampire captain long enough for Vraska to land a strike. One of the Jaces managed to land a punch, and Vraska realized that he was #emph[physically alongside her] .
The vampire was dodging, parrying, and striking with a zealot's prayer on his lips, all the while watching each of the Jace clones with a close eye, visibly trying to discern which was the physical version.
Jace's voice cried out in the air, and vampire grabbed hold of his physical neck. The other vanished in a flash while the real Jace screwed his eyes shut and tried to claw his way free. The vampire opened his mouth just as Vraska grabbed hold him. She shoved herself between him and Jace, locking eyes with the captain as she released her hold on the magic she had been building.
The vampire's skin and clothes turned to stone in her grip.
#figure(image("003_The Talented Captain Vraska/09.jpg", width: 100%), caption: [Vraska's Contempt | Art by <NAME>], supplement: none, numbering: none)
She lowered her gaze to the ground for a moment, avoiding the eyes of her crew as the last of her magic receded, then she looked to Jace.
He had scrambled out of the grip of the petrified vampire, and now met her gaze with a look of surprise. Vraska felt tossed off-balance, not because she had let herself be seen for what she was, but because what looked back at her was not a face contorted in horror, but one lit up with awe.
Jace was not afraid. He was amazed.
The surviving vampires knelt in submission under the watchful eyes of Malcolm and Amelia, who were working quickly to magically bind them with rope and torn sails.
"Clear their storage, sink all weapons, and carry this one over to #emph[The Belligerent] ," she called, kicking the stone captain with her foot. "I think we could use a figurehead."
The crew laughed, and Vraska briefly smiled. She turned and began to make her way back to the deck of her own ship as the crew began to pack up their spoils.
The mind mage had proven himself absurdly useful.
She walked across the gangplank that straddled the two ships, and Jace followed. On the privacy of their own ship, he approached her.
"I didn't know you could do that!" he remarked.
"Well . . . surprise," Vraska said with a shrug.
"Vraska," Jace said in earnest. "I was in trouble, and you saved me. Thank you."
The gorgon looked back in confusion. "You weren't frightened?"
Jace shook his head.
"I think you're talented."
Vraska didn't know what to say to that.
Compliments to her were as foreign as flying.
Jace was absurdly useful. Perhaps it would be best if she kept him around to make use of his skills.
And so, Vraska spoke with certainty. "I once thought we would make a good team, Beleren, and it appears I was right. Would you like to stay with my crew and help me with my mission?"
Jace's smile reached his eyes, a grin emboldened with a voyager's curiosity. "I would love to."
#figure(image("003_The Talented Captain Vraska/10.jpg", width: 100%), caption: [Jace, C<NAME>away | Art by <NAME>], supplement: none, numbering: none)
|
|
https://github.com/nathanielknight/tsot | https://raw.githubusercontent.com/nathanielknight/tsot/main/src/theme.typ | typst | #let common(doc) = {
set text(font: "Vollkorn", weight: "regular")
show heading: it => text(font: "National Park", it)
doc
}
#let phase(doc) = {
set text(size: 12pt)
set page(margin: 36mm)
doc
}
#let playbook(doc) = {
set text(size: 10pt)
set page(margin: 12mm)
doc
}
|
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/209.%20words.html.typ | typst | words.html
Putting Ideas into Words
February 2022Writing about something, even something you know well, usually shows
you that you didn't know it as well as you thought. Putting ideas
into words is a severe test. The first words you choose are usually
wrong; you have to rewrite sentences over and over to
get them exactly right. And your ideas won't just be imprecise, but
incomplete too. Half the ideas that end up in an essay will be ones
you thought of while you were writing it. Indeed, that's why I write
them.Once you publish something, the convention is that whatever you
wrote was what you thought before you wrote it. These were your
ideas, and now you've expressed them. But you know this isn't true.
You know that putting your ideas into words changed them. And not
just the ideas you published. Presumably there were others that
turned out to be too broken to fix, and those you discarded instead.It's not just having to commit your ideas to specific words that
makes writing so exacting. The real test is reading what you've
written. You have to pretend to be a neutral reader who knows nothing
of what's in your head, only what you wrote. When he reads what you
wrote, does it seem correct? Does it seem complete? If you make an
effort, you can read your writing as if you were a complete stranger,
and when you do the news is usually bad. It takes me many cycles
before I can get an essay past the stranger. But the stranger is
rational, so you always can, if you ask him what he needs. If he's
not satisfied because you failed to mention x or didn't qualify
some sentence sufficiently, then you mention x or add more
qualifications. Happy now? It may cost you some nice sentences, but
you have to resign yourself to that. You just have to make them as
good as you can and still satisfy the stranger.This much, I assume, won't be that controversial. I think it will
accord with the experience of anyone who has tried to write about
anything nontrivial. There may exist people whose thoughts are so
perfectly formed that they just flow straight into words. But I've
never known anyone who could do this, and if I met someone who said
they could, it would seem evidence of their limitations rather than
their ability. Indeed, this is a trope in movies: the guy who claims
to have a plan for doing some difficult thing, and who when questioned
further, taps his head and says "It's all up here." Everyone watching
the movie knows what that means. At best the plan is vague and
incomplete. Very likely there's some undiscovered flaw that invalidates
it completely. At best it's a plan for a plan.In precisely defined domains it's possible to form complete ideas
in your head. People can play chess in their heads, for example.
And mathematicians can do some amount of math in their heads, though
they don't seem to feel sure of a proof over a certain length till
they write it down. But this only seems possible with ideas you can
express in a formal language. [1] Arguably what such people are
doing is putting ideas into words in their heads. I can to some
extent write essays in my head. I'll sometimes think of a paragraph
while walking or lying in bed that survives nearly unchanged in the
final version. But really I'm writing when I do this. I'm doing the
mental part of writing; my fingers just aren't moving as I do it.
[2]You can know a great deal about something without writing about it.
Can you ever know so much that you wouldn't learn more from trying
to explain what you know? I don't think so. I've written about at
least two subjects I know well — Lisp hacking and startups
— and in both cases I learned a lot from writing about them.
In both cases there were things I didn't consciously realize till
I had to explain them. And I don't think my experience was anomalous.
A great deal of knowledge is unconscious, and experts have if
anything a higher proportion of unconscious knowledge than beginners.I'm not saying that writing is the best way to explore all ideas.
If you have ideas about architecture, presumably the best way to
explore them is to build actual buildings. What I'm saying is that
however much you learn from exploring ideas in other ways, you'll
still learn new things from writing about them.Putting ideas into words doesn't have to mean writing, of course.
You can also do it the old way, by talking. But in my experience,
writing is the stricter test. You have to commit to a single, optimal
sequence of words. Less can go unsaid when you don't have tone of
voice to carry meaning. And you can focus in a way that would seem
excessive in conversation. I'll often spend 2 weeks on an essay and
reread drafts 50 times. If you did that in conversation
it would seem evidence of some kind of
mental disorder.
If you're lazy,
of course, writing and talking are equally useless. But if you want
to push yourself to get things right, writing is the steeper hill.
[3]The reason I've spent so long establishing this rather obvious point
is that it leads to another that many people will find shocking.
If writing down your ideas always makes them more precise and more
complete, then no one who hasn't written about a topic has fully
formed ideas about it. And someone who never writes has no fully
formed ideas about anything nontrivial.It feels to them as if they do, especially if they're not in the
habit of critically examining their own thinking. Ideas can feel
complete. It's only when you try to put them into words that you
discover they're not. So if you never subject your ideas to that
test, you'll not only never have fully formed ideas, but also never
realize it.Putting ideas into words is certainly no guarantee that they'll be
right. Far from it. But though it's not a sufficient condition, it
is a necessary one.Notes[1] Machinery and
circuits are formal languages.[2] I thought of this
sentence as I was walking down the street in Palo Alto.[3] There are two
senses of talking to someone: a strict sense in which the conversation
is verbal, and a more general sense in which it can take any form,
including writing. In the limit case (e.g. Seneca's letters),
conversation in the latter sense becomes essay writing.It can be very useful to talk (in either sense) with other people
as you're writing something. But a verbal conversation will never
be more exacting than when you're talking about something you're
writing. Thanks to <NAME>, <NAME>, and <NAME> for reading drafts of this. French Translation
|
|
https://github.com/dankelley/typst_templates | https://raw.githubusercontent.com/dankelley/typst_templates/main/qe/0.0.2/qe.typ | typst | MIT License | // https://typst.app/docs/tutorial/making-a-template/
// https://github.com/typst/packages/?tab=readme-ov-file#local-packages
#let conf(
student: none,
paper: none,
date: none,
venu: none,
time: none,
doc,
) = {
set text(font: "Times Roman", size: 12pt)
set page("us-letter",
header: [
_Qualifying Examination_ #h(1fr) *#student* #h(1fr) #date
\
#venu #h(1fr) #time
])
text(11pt)[#paper]
doc
}
|
https://github.com/Treeniks/bachelor-thesis-isabelle-vscode | https://raw.githubusercontent.com/Treeniks/bachelor-thesis-isabelle-vscode/master/chapters/04-main-refinements/desyncs.typ | typst | #import "/utils/todo.typ": TODO
#import "/utils/isabelle.typ": *
== Desync on File Changes <didchange>
While building the Neovim Isabelle client mentioned in @intro:motivation, the language server frequently got out of sync with the file's actual contents. For example, it might have happened that the user wanted to write `apply auto`, but wrote `apply autt` by accident instead. If the user then corrected their mistake by removing the additional `t` and replacing it with an `o`, it could happen that the language server would think the content of the file was `apply autto`. Somewhat awkwardly, this problem _only_ occurred when using Neovim; it did not happen in VSCode.
Document synchronization is done primarily through `textDocument/didChange` and `textDocument/didOpen` notifications. We will discuss the `textDocument/didOpen` notification in more detail in @symbol-handling, but this desyncing issue results from the handling of the `textDocument/didChange` notifications. Its content is outlined in @did-change-interface.
#figure(
box(width: 90%)[
```typescript
interface DidChangeTextDocumentParams {
textDocument: VersionedTextDocumentIdentifier;
contentChanges: TextDocumentContentChangeEvent[];
}
```
],
caption: [`DidChangeTextDocumentParams` interface definition @lsp-spec.],
kind: raw,
// placement: auto,
) <did-change-interface>
The exact details of how these `contentChanges` are structured are not of interest; however, there can be multiple such content changes within a single notification. The client can decide to group multiple content changes into a single `textDocument/didChange` notification. The desyncing problem now arises because such a list of content changes is not commutative. The LSP spec says the following about the order of application of these content changes:
#quote(block: true, attribution: <lsp-spec>)[
The content changes describe single state changes to the document. So if there are two content changes $c_1$ (at array index $0$) and $c_2$ (at array index $1$) for a document in state $S$ then $c_1$ moves the document from $S$ to $S'$ and $c_2$ from $S'$ to $S''$. So $c_1$ is computed on the state $S$ and $c_2$ is computed on the state $S'$.
To mirror the content of a document using change events use the following approach:
- start with the same initial content
- apply the `textDocument/didChange` notifications in the order you receive them.
- apply the `TextDocumentContentChangeEvent`s in a single notification in the order you receive them.
]
The language server had code that _normalized_ the `contentChanges` list, sorting them by different types of changes before applying them. Simply removing this normalization was enough to fix the original desyncing issue. We are still unsure why the issue did not occur in VSCode; however, most likely, VSCode simply groups document changes together far less frequently than Neovim.
|
|
https://github.com/danjones1618/presentations | https://raw.githubusercontent.com/danjones1618/presentations/main/python-lark/python-lark.typ | typst | #import "@preview/fontawesome:0.1.0": *
#import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge
#import "../catppuccin/src/lib.typ": get-palette as get_palette
#import "../template.typ": *
#import "@preview/polylux:0.3.1": pdfpc, pause, side-by-side
#set document(
title: "The Earley Lark parses more: from structured text to data classes",
author: "<NAME>",
keywords: ("Python", "Lark", "Parsers", "PyUtrecht"),
)
#let theme = "mocha";
#let palette = get_palette(theme)
#show: dan_theme.with(theme: theme);
#pdfpc.config(
duration-minutes: 25,
)
//#centered-slide(
// title: "REGEX: something familiar",
// raw(
// block: true,
// lang: "python",
// read("test.py")
// ),
//)
#title-slide(
[
The Earley Lark parses more:
#linebreak()
#set text(size: 0.8em)
from structured text to data classes
#pdfpc.speaker-note(```md
We've all been there: given a text document and we needed to extract value out of it.
Maybe this is the advent of code input or something more complex.
Luckily, help is at hand to squash our parsing foes.
```)
],
author: "<NAME>"
)
#slide(
grid(
columns: (2fr, 1fr),
rows: (1fr),
gutter: 1em,
//stroke: 1pt,
[
#v(20%)
#set text(size: 1.3em)
== Hey, I'm Dan
Just your average coffee enjoyer
#linebreak()
who writes code
],
align(bottom, text(size:0.75em)[
- From the UK
- Living in NL
- Studied MEng Computer Science at University of Bristol
- Enjoys: #emoji.coffee #emoji.climbing #emoji.beer.clink #fa-code()
],
))
)
#centered-slide(title: "An Advent of Code esque file")[
```
6
10 10
23 24
1 2
5 3
123 4
1 1345
```
#pdfpc.speaker-note(```md
Let's start our example off with parsing a file from advent of code.
The first line states the number of coordinates.
Each subsequent line is a coordinate.
Pretty simple, right?
```)
]
#column-and-figure-slide(
"Quick and dirty",
column_content: [
`str.split` to the rescure
- Okay for simple files
- Hard to read
- Harder to debug as complexity grows
#pdfpc.speaker-note(```md
The quick and dirty way is to just use a lot of `str.split`.
This is _fine_... maybe for hacky scripts and advent of code
but please don't do this in production.
With a more complex file structure this will be a pain to debug and extend.
```)
],
figure: [
```py
def parse_input(path: Path) -> list[tuple[int, int]]:
content = path.read_text().splitlines()
num_points = int(content[0])
results: list[tuple[int, int]] = []
for line in content[1:]:
x, y = line.split(" ", maxsplit=1)
results.append((int(x), int(y))
return resutls
```
]
)
#column-and-figure-slide(
"Regex is a bit nicer...",
column_content: [
- More robust
- Complexity explodes with file complexity
- `if`... `if`... `else`... `if`...
- What was the format?
#pdfpc.speaker-note(```md
Using REGEX is a bit nicer. We get:
- checks that our integers are integers wihout int parsing blowing up
- validate that we only have two integers on coordinate line
- it's a bit easier to read allbeit a bit more verbose
```)
],
figure: [
```py
import re
def parse_input(path: Path) -> list[tuple[int, int]]:
count_pattern = re.Pattern(r"^(?P<count>\d+)$")
coord_pattern = re.Pattern(r"^(?P<x>\d+) (?P<y>\d+)$")
content = path.read_text().splitlines()
count_match = count_pattern.match(content[0])
if not count_match:
raise ParseError("No valid count")
num_points = int(count_match.group("count"))
results: list[tuple[int, int]] = []
for line in content[1:]:
match = coord_pattern.match(line)
if not match:
raise ParseError("Could not parse coord")
coord = (int(match.group("x")), int(match.group("y"))
results.append(coord)
return resutls
```
]
)
#slide[
== A better way?
Lark aims to make parsing and aims to:
1. be readable
2. be clean and simple
3. be usable
#pdfpc.speaker-note(```md
Lark is a Python library which aims to make these issues fly away.
It has a few key aims which address the issues we see in the previous excamples.
One way it achives this is by having clear seperation between the grammar of the file
and how to convert that into your internal data structures.
Note: this is seperating combining lots of REGEXes and if statements out from building
up class instnaces.
```)
]
#centered-slide[
== Is the input valid?
A step back to university
#pdfpc.speaker-note(```md
The first key point we need is to know if the file is valid or not.
Let's forget about extracting the data from the file for now but check if we
can validate the file's structure
```)
]
#column-and-figure-slide(
"Regular Languages",
column_content: [
- Parsed via a _deterministic finite automata_
- A REGEX encodes a Regular Language
#pdfpc.speaker-note(```md
A REGEX can represent any regular language.
Behind the scenes, it's representing a DFA.
This is simply a state machine.
You start from the starting node and if you encounter
a character which matches a valid transition you move to the next node.
You do this until you reach and stay at the end node (denoted with green outline).
Congrats: you validated a language
```)
],
figure: diagram(
debug: false,
edge-stroke: palette.colors.overlay1.rgb,
crossing-fill: palette.colors.base.rgb,
node-stroke: palette.colors.surface1.rgb,
node-fill: palette.colors.surface0.rgb,
spacing: 3em,
{
let (A, B, C, D, E) = ((1,0), (1,1), (0, 3), (2, 3), (1, 5))
node(A, $1$)
node(B, $2$)
node(C, $3$)
node(D, $4$)
node(E, $5$, extrude: (0, 3), stroke: palette.colors.green.rgb)
edge((0.5, 0), (1, 0), marks: "->", label: "Start", label-size: 0.8em, label-pos: 0)
edge(A, B, marks: "->-", label: "A")
edge(B, C, marks: "->-", label: "B", bend: -35deg)
edge(C, C, marks: "->-", label: "B", bend: -130deg, label-pos: 0.25)
edge(B, D, marks: "->-", label: "C", bend: 35deg)
edge(D, D, marks: "->-", label: "C", bend: -130deg, label-pos: 0.75)
edge(C, D, marks: "->-", label: "C", bend: 35deg)
edge(D, C, marks: "->-", label: "B", bend: 35deg)
edge(C, E, marks: "->-", label: "B", bend: -35deg, crossing: true)
edge(D, E, marks: "->-", label: "B", bend: 35deg, crossing: true)
}
),
)
#main-point-slide[
== Regex can't parse everything
Can you parse `A{n}B{n}`?#footnote[we want to parse a string with equal number A's and B's]
]
#column-and-figure-slide("Introducing CFGs",
column_content: [
- Superset of regular languages
- Written in extended Backus-Naur form (EBNF)
#pdfpc.speaker-note(```md
1. superset of regular language
2. start at start node. Then you replace each rule that matches recursivly until hit a terminal rule
3. This is what Lark parses
```)
],
figure: [
$ S |-> a R b \
R |-> a R b | #sym.epsilon
$
#block[
#set align(left)
#set text(size: 0.8em)
To parse `a{n}b{n}`:
1. $a a b b$
2. Apply $S$: $cancel(a) a b cancel(b) |-> a b$
3. Apply $R$: $cancel(a) cancel(b) |-> #sym.epsilon$
4. After $R$: $cancel(#sym.epsilon) |->$ validated #fa-check()
]
],
)
#centered-slide[
== Parsing with Lark
#pdfpc.speaker-note(```md
Lark allows us to parse a CFG in Python.
But what will we parse?
```)
]
//#slide[
// == There were some talks
//
// 1. Writing Python like it's #only(1)[Rust]#only(2)[#strike(stroke: 2pt)[Rust] *C++*]
// 2. How to Build a Python-to-C++ Compiler out of Spare Part
// 3. Enhancing Decorators with Type Annotations: Techniques and Best Practices
//]
#centered-slide(title: "Plain Text Accounting")[
#pdfpc.speaker-note(```md
Plain text accounting is a format for doing double-entry-book keeping
in, well..., plain text.
Funny story: I actually discovered this and started a journy learning
accounting one evening because I was procrastentating from packing
for a trip.... Turns out accounting doesn't make you fall asleep.
Any ways, it's a simple file format.
Comments are prefixed by a ';'.
There are two main sections: declerations and transactions.
```)
```
; a comment
2016-01-01 open Assets:Checking
2016-01-01 open Equity:Opening-Balances
2016-01-01 open Expenses:Groceries
2016-01-01 txn "set opening balance"
Assets:Checking 500.00 USD
Equity:Opening-Balances
2016-01-05 txn "farmer's market"
Expenses:Groceries 50 USD
Assets:Checking
```
#pause
#place(
left,
rect(width: 16em, height: 3em, stroke: 2pt + palette.colors.blue.rgb),
dx: 4.5em,
dy: -10.25em,
)
#pause
#place(
left,
rect(width: 16em, height: 6.5em, stroke: 2pt + palette.colors.peach.rgb),
dx: 4.5em,
dy: -6.75em,
)
]
#centered-slide(title: "Creating the grammar: drop comments")[
```lark
// This is a comments in Lark
%ignore /;.*/ // <- Look a REGEX
```
]
#centered-slide(title: "Creating the grammar: import standard terminals")[
```lark
// You can rename imports with ->
%import common.ESCAPED_STRING -> STRING
%import common.SIGNED_NUMBER -> NUMBER
%import common.WS
%ignore /;.*/
```
]
#centered-slide(title: "Creating the grammar: import standard terminals")[
```lark
// You can rename imports with ->
%import common.ESCAPED_STRING -> STRING
%import common.SIGNED_NUMBER -> NUMBER
%import common.WS
%ignore /;.*/
```
]
#centered-slide(title: "Creating the grammar: our terminals", sub_title: "Where everything ends at")[
```lark
// Note: terminals are UPPER case
ACCOUNT_NAME: /\w+:\w+/
DATE: /\d{4}[-/.]\d{2}[-/.]\d{2}/ // YYYY-MM-DD, YYYY.MM.DD, YYYY/MM/DD
PUT_CALL: "put" | "call"
%import common.ESCAPED_STRING -> QUOTE_STRING
%import common.SIGNED_NUMBER -> NUMBER
%import common.WS
%import common.NL
%ignore /;.*/
```
]
#centered-slide(title: "Plain Text Accounting: start rules", sub_title: "Remember two sections")[
```
2016-01-01 open Assets:Checking
2016-01-01 open Equity:Opening-Balances
2016-01-01 open Expenses:Groceries
2016-01-01 txn "set opening balance"
Assets:Checking 500.00 USD
Equity:Opening-Balances
2016-01-05 txn "farmer's market"
Expenses:Groceries 50 USD
Assets:Checking
```
#place(
left,
rect(width: 16em, height: 3em, stroke: 2pt + palette.colors.blue.rgb),
dx: 4.5em,
dy: -10.25em,
)
#place(
left,
rect(width: 16em, height: 6.5em, stroke: 2pt + palette.colors.peach.rgb),
dx: 4.5em,
dy: -6.75em,
)
]
#centered-slide(title: "Creating the grammar: starting rules")[
```lark
root: account* WS* transaction*
account: // TODO
transition: // TODO
ACCOUNT_NAME: /\w+:\w+/
ASSET_NAME: /[A-Z]+/
DATE: /\d{4}[-/.]\d{2}[-/.]\d{2}/ // YYYY-MM-DD, YYYY.MM.DD, YYYY/MM/DD
// ... imports and ignores
```
]
#centered-slide(title: "Creating the grammar: the account line")[
```lark
root: account* WS* transaction*
account: DATE "open" ACCOUNT_NAME NL
transition: // TODO
ACCOUNT_NAME: /\w+:\w+/
DATE: /\d{4}[-/.]\d{2}[-/.]\d{2}/ // YYYY-MM-DD, YYYY.MM.DD, YYYY/MM/DD
// ... imports and ignores
```
]
#centered-slide(title: "Creating the grammar: transactions")[
```lark
root: account* WS* transaction*
account: DATE "open" ACCOUNT_NAME NL
transition: transaction_start full_posting+ final_posting
transaction_start: DATE "txn" QUOTE_STRING
full_posting: ACCOUNT_NAME amount
final_posting: ACCOUNT_NAME [amount]
amount: NUMBER ASSET_NAME
ACCOUNT_NAME: /\w+:\w+/
DATE: /\d{4}[-/.]\d{2}[-/.]\d{2}/ // YYYY-MM-DD, YYYY.MM.DD, YYYY/MM/DD
// ... imports and ignores
```
]
#centered-slide(title: "Parsing a file with our grammar")[
```python
from lark import Lark
def parse_ledger(ledger_file: Path) -> Lark.Tree:
parser = Lark(Path("./grammar.lark").read_text())
return parser.parse(ledger_file.read_text())
```
#pause
#emoji.rocket we've parsed and validated the file!
]
#main-point-slide[
== To dataclasses
]
#centered-slide(title: "Define some dataclasses")[
#side-by-side[
```python
from dataclasses import dataclass
from datetime import date
from typing import NewType
AccountName = NewType("AccountName", str)
AssetName = NewType("AssetName", str)
@dataclass()
class Account:
open_date: date
name: AccountName
```
][
```python
@dataclass()
class Posting:
account: AccountName
amount: float
asset: AssetName
@dataclass()
class Transaction:
dated: date
postings: list[Posting]
```
]
]
#centered-slide(title: "Lark gives us a tree")[
#diagram(
debug: false,
edge-stroke: palette.colors.overlay1.rgb,
crossing-fill: palette.colors.base.rgb,
node-stroke: palette.colors.surface1.rgb,
node-fill: palette.colors.surface0.rgb,
spacing: 3em,
{
let (S, A, A1, A2, T, T1, T2) = (
(1,0),
(0,1), (-0.5, 2), (0.5, 2),
(2, 1), (1.5, 2), (2.5, 2))
node(S, "Start")
node(A, "Accounts")
node(A1, "A1")
node(A2, "A2")
node(T, "Transactions")
node(T1, "T1")
node(T2, "T2")
//edge((0.5, 0), (1, 0), marks: "->", label: "Start", label-size: 0.8em, label-pos: 0)
edge(S, A)
edge(A, A1)
edge(A, A2)
edge(S, T)
edge(T, T1)
edge(T, T2)
}
),
]
#centered-slide(title: "Raise to dataclasses via transfomrers")[
#set text(size: 0.8em)
#grid(columns: (1fr, 1fr),
```python
@v_args(inline=True)
class LedgerTransfomrer(Transformer):
def start(
self, accounts: list[Account],
transactions: list[Transactions]
): ...
def account(
self, dated: date, name: AcocuntName
) -> Account:
return Account(dated=dated, name=name)
def ACCOUNT_NAME(self, node) -> AccountName:
return AccountName(node)
def DATE(self, node) -> date:
return date.parse(node)
LedgerTransformer().transform(tree)
```,
```lark
root: account* WS* transaction*
account: DATE "open" ACCOUNT_NAME NL
ACCOUNT_NAME: /\w+:\w+/
DATE: /\d{4}[-/.]\d{2}[-/.]\d{2}/
```
)
]
#slide[
== Lark tips
- use `[val]` over `val?` in grammars
- `[val]` gives explicit `None`
- `print(tree)` will show you the parsed tree
- `@v_args(inline=True)` parses all items explicitly
- Pair with Pydantic for even easier type coercion and validation
]
#slide[
== Summary
- #quote(attribution: [<NAME> \@ EuroPython 2024], block: true)[Writing code is communicating to your future self and other developers]
- Lark can make parsing structured text easy#footnote[probably]
- Seperating transforming and grammars is nice
- Lark is fun
]
#end-slide(
grid(
rows: (1fr, auto, 2fr),
[],
[= Questions?],
[],
)
)
|
|
https://github.com/jordanqt327/Typst-Pruebas | https://raw.githubusercontent.com/jordanqt327/Typst-Pruebas/main/Typst/prueba3.typ | typst | #table(
columns: 3,
table.header( [ "Nombre"], ["Edad"], ["Ciudad"],),
[ "Alice"], [30], ["<NAME>" ],
[ "Bob"], [25], ["Los Ángeles" ],
[ "Charlie"], [35], ["Chicago" ]
)
#let jso = json("ejemplo.json")
#jso
#for user in jso.usuarios [
#user.nombre
#user.edad
#user.ciudad
#h(8pt)
]
#(jso.usuarios.at(0)).nombre
#(jso.usuarios.at(0)).edad
#(jso.usuarios.at(0)).ciudad
#(jso.usuarios.at(1)).nombre
#(jso.usuarios.at(1)).edad
#(jso.usuarios.at(1)).ciudad
#table(
columns: 3,
table.header( [Nombre], [Edad], [Ciudad],),
for user in jso.usuarios [
[#user.nombre],[#user.edad],[#user.ciudad]
]
) |
|
https://github.com/DawodGAMIETTE/ENSEA_template-Typst | https://raw.githubusercontent.com/DawodGAMIETTE/ENSEA_template-Typst/master/src/main.typ | typst | #import "template.typ": *
#show: project.with(
title: "TP ?",
authors: (
"LastName1 FirstName1",
"LastName2 FirstName2",
"etc. etc."
),
objective: [Insert your objective here...],
)
= Introduction
#lorem(30)
== In this paper
#lorem(10)
=== Contributions
#lorem(20)
= Related Work
#lorem(150) |
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/019.%20nerds.html.typ | typst | nerds.html
Why Nerds are Unpopular
February 2003When we were in junior high school, my friend Rich and I made a map
of the school lunch tables according to popularity. This was easy
to do, because kids only ate lunch with others of about the same
popularity. We graded them from A to E. A tables were full of
football players and cheerleaders and so on. E tables contained the
kids with mild cases of Down's Syndrome, what in the language of
the time we called "retards."We sat at a D table, as low as you could get without looking
physically different. We were not being especially candid to grade
ourselves as D. It would have taken a deliberate lie to say otherwise.
Everyone in the school knew exactly how popular everyone else was,
including us.My stock gradually rose during high school. Puberty finally arrived;
I became a decent soccer player; I started a scandalous underground
newspaper. So I've seen a good part of the popularity landscape.I know a lot of people who were nerds in school, and they all tell
the same story: there is a strong correlation between being smart
and being a nerd, and an even stronger inverse correlation between
being a nerd and being popular. Being smart seems to make you
unpopular.Why? To someone in school now, that may seem an odd question to
ask. The mere fact is so overwhelming that it may seem strange to
imagine that it could be any other way. But it could. Being smart
doesn't make you an outcast in elementary school. Nor does it harm
you in the real world. Nor, as far as I can tell, is the problem
so bad in most other countries. But in a typical American secondary
school, being smart is likely to make your life difficult. Why?
The key to this mystery is to rephrase the question slightly. Why
don't smart kids make themselves popular? If they're so smart, why
don't they figure out how popularity works and beat the system,
just as they do for standardized tests?One argument says that this would be impossible, that the smart
kids are unpopular because the other kids envy them for being smart,
and nothing they could do could make them popular. I wish. If the
other kids in junior high school envied me, they did a great job
of concealing it. And in any case, if being smart were really an
enviable quality, the girls would have broken ranks. The guys that
guys envy, girls like.In the schools I went to, being smart just didn't matter much. Kids
didn't admire it or despise it. All other things being equal, they
would have preferred to be on the smart side of average rather than the
dumb side, but intelligence counted far less than, say, physical
appearance, charisma, or athletic ability.So if intelligence in itself is not a factor in popularity, why are
smart kids so consistently unpopular? The answer, I think, is that
they don't really want to be popular.If someone had told me that at the time, I would have laughed at
him. Being unpopular in school makes kids miserable, some of them
so miserable that they commit suicide. Telling me that I didn't
want to be popular would have seemed like telling someone dying of
thirst in a desert that he didn't want a glass of water. Of course
I wanted to be popular.But in fact I didn't, not enough. There was something else I wanted
more: to be smart. Not simply to do well in school, though that
counted for something, but to design beautiful rockets, or to write
well, or to understand how to program computers. In general, to
make great things.At the time I never tried to separate my wants and weigh them
against one another. If I had, I would have seen that being smart
was more important. If someone had offered me the chance to be
the most popular kid in school, but only at the price of being of
average intelligence (humor me here), I wouldn't have taken it.Much as they suffer from their unpopularity, I don't think many
nerds would. To them the thought of average intelligence is unbearable.
But most kids would take that deal. For half of them, it would be
a step up. Even for someone in the eightieth percentile (assuming,
as everyone seemed to then, that intelligence is a scalar), who
wouldn't drop thirty points in exchange for being loved and admired
by everyone?And that, I think, is the root of the problem. Nerds serve two
masters. They want to be popular, certainly, but they want even
more to be smart. And popularity is not something you can do in
your spare time, not in the fiercely competitive environment of an
American secondary school.
Alberti, arguably the archetype of the Renaissance Man, writes that
"no art, however minor, demands less than total dedication if you
want to excel in it."
I wonder if anyone in the world works harder
at anything than American school kids work at popularity. Navy SEALs
and neurosurgery residents seem slackers by comparison. They
occasionally take vacations; some even have hobbies. An American
teenager may work at being popular every waking hour, 365 days a
year.I don't mean to suggest they do this consciously. Some of them truly
are little Machiavellis, but what I really mean here is that teenagers
are always on duty as conformists.For example, teenage kids pay a great deal of attention to clothes.
They don't consciously dress to be popular. They dress to look good.
But to who? To the other kids. Other kids' opinions become their
definition of right, not just for clothes, but for almost everything
they do, right down to the way they walk. And so every effort they
make to do things "right" is also, consciously or not, an effort
to be more popular.Nerds don't realize this. They don't realize that it takes work to
be popular. In general, people outside some very demanding field
don't realize the extent to which success depends on constant (though
often unconscious) effort. For example, most people seem to consider
the ability to draw as some kind of innate quality, like being tall.
In fact, most people who "can draw" like drawing, and have spent
many hours doing it; that's why they're good at it. Likewise, popular
isn't just something you are or you aren't, but something you make
yourself.The main reason nerds are unpopular is that they have other things
to think about. Their attention is drawn to books or the natural
world, not fashions and parties. They're like someone trying to
play soccer while balancing a glass of water on his head. Other
players who can focus their whole attention on the game beat them
effortlessly, and wonder why they seem so incapable.Even if nerds cared as much as other kids about popularity, being
popular would be more work for them. The popular kids learned to
be popular, and to want to be popular, the same way the nerds learned
to be smart, and to want to be smart: from their parents. While the
nerds were being trained to get the right answers, the popular kids
were being trained to please.
So far I've been finessing the relationship between smart and nerd,
using them as if they were interchangeable. In fact it's only the
context that makes them so. A nerd is someone who isn't socially
adept enough. But "enough" depends on where you are. In a typical
American school, standards for coolness are so high (or at least,
so specific) that you don't have to be especially awkward to look
awkward by comparison.Few smart kids can spare the attention that popularity requires.
Unless they also happen to be good-looking, natural athletes, or
siblings of popular kids, they'll tend to become nerds. And that's
why smart people's lives are worst between, say, the ages of eleven
and seventeen. Life at that age revolves far more around popularity
than before or after.Before that, kids' lives are dominated by their parents, not by
other kids. Kids do care what their peers think in elementary school,
but this isn't their whole life, as it later becomes.Around the age of eleven, though, kids seem to start treating their
family as a day job. They create a new world among themselves, and
standing in this world is what matters, not standing in their family.
Indeed, being in trouble in their family can win them points in the
world they care about.The problem is, the world these kids create for themselves is at
first a very crude one. If you leave a bunch of eleven-year-olds
to their own devices, what you get is Lord of the Flies. Like
a lot of American kids, I read this book in school. Presumably it
was not a coincidence. Presumably someone wanted to point out to
us that we were savages, and that we had made ourselves a cruel and
stupid world. This was too subtle for me. While the book seemed
entirely believable, I didn't get the additional message. I wish
they had just told us outright that we were savages and our world
was stupid.
Nerds would find their unpopularity more bearable if it merely
caused them to be ignored. Unfortunately, to be unpopular in school
is to be actively persecuted.Why? Once again, anyone currently in school might think this a
strange question to ask. How could things be any other way? But
they could be. Adults don't normally persecute nerds. Why do teenage
kids do it?Partly because teenagers are still half children, and many
children are just intrinsically cruel. Some torture nerds for the
same reason they pull the legs off spiders. Before you develop a
conscience, torture is amusing.Another reason kids persecute nerds is to make themselves feel
better. When you tread water, you lift yourself up by pushing water
down. Likewise, in any social hierarchy, people unsure of their own
position will try to emphasize it by maltreating those they think
rank below. I've read that this is why poor whites in the United
States are the group most hostile to blacks.But I think the main reason other kids persecute nerds is that it's
part of the mechanism of popularity. Popularity is only partially
about individual attractiveness. It's much more about alliances.
To become more popular, you need to be constantly doing things that
bring you close to other popular people, and nothing brings people
closer than a common enemy.Like a politician who wants to distract voters from bad times at
home, you can create an enemy if there isn't a real one. By singling
out and persecuting a nerd, a group of kids from higher in the
hierarchy create bonds between themselves. Attacking an outsider
makes them all insiders. This is why the worst cases of bullying
happen with groups. Ask any nerd: you get much worse treatment from
a group of kids than from any individual bully, however sadistic.If it's any consolation to the nerds, it's nothing personal. The
group of kids who band together to pick on you are doing the same
thing, and for the same reason, as a bunch of guys who get together
to go hunting. They don't actually hate you. They just need something
to chase.Because they're at the bottom of the scale, nerds are a safe target
for the entire school. If I remember correctly, the most popular
kids don't persecute nerds; they don't need to stoop to such things.
Most of the persecution comes from kids lower down, the nervous
middle classes.The trouble is, there are a lot of them. The distribution of
popularity is not a pyramid, but tapers at the bottom like a pear.
The least popular group is quite small. (I believe we were the only
D table in our cafeteria map.) So there are more people who want
to pick on nerds than there are nerds.As well as gaining points by distancing oneself from unpopular kids,
one loses points by being close to them. A woman I know says that
in high school she liked nerds, but was afraid to be seen talking
to them because the other girls would make fun of her. Unpopularity
is a communicable disease; kids too nice to pick on nerds will still
ostracize them in self-defense.It's no wonder, then, that smart kids tend to be unhappy in middle
school and high school. Their other interests leave them little
attention to spare for popularity, and since popularity resembles
a zero-sum game, this in turn makes them targets for the whole
school. And the strange thing is, this nightmare scenario happens
without any conscious malice, merely because of the shape of the
situation.
For me the worst stretch was junior high, when kid culture was new
and harsh, and the specialization that would later gradually separate
the smarter kids had barely begun. Nearly everyone I've talked to
agrees: the nadir is somewhere between eleven and fourteen.In our school it was eighth grade, which was ages twelve and thirteen
for me. There was a brief sensation that year when one of our
teachers overheard a group of girls waiting for the school bus, and
was so shocked that the next day she devoted the whole class to an
eloquent plea not to be so cruel to one another.It didn't have any noticeable effect. What struck me at the time
was that she was surprised. You mean she doesn't know the kind of
things they say to one another? You mean this isn't normal?It's important to realize that, no, the adults don't know what the
kids are doing to one another. They know, in the abstract, that
kids are monstrously cruel to one another, just as we know in the
abstract that people get tortured in poorer countries. But, like
us, they don't like to dwell on this depressing fact, and they don't
see evidence of specific abuses unless they go looking for it.Public school teachers are in much the same position as prison
wardens. Wardens' main concern is to keep the prisoners on the
premises. They also need to keep them fed, and as far as possible
prevent them from killing one another. Beyond that, they want to
have as little to do with the prisoners as possible, so they leave
them to create whatever social organization they want. From what
I've read, the society that the prisoners create is warped, savage,
and pervasive, and it is no fun to be at the bottom of it.In outline, it was the same at the schools I went to. The most
important thing was to stay on the premises. While there, the
authorities fed you, prevented overt violence, and made some effort
to teach you something. But beyond that they didn't want to have
too much to do with the kids. Like prison wardens, the teachers
mostly left us to ourselves. And, like prisoners, the culture we
created was barbaric.
Why is the real world more hospitable to nerds? It might seem that
the answer is simply that it's populated by adults, who are too
mature to pick on one another. But I don't think this is true.
Adults in prison certainly pick on one another. And so, apparently,
do society wives; in some parts of Manhattan, life for women sounds
like a continuation of high school, with all the same petty intrigues.I think the important thing about the real world is not that it's
populated by adults, but that it's very large, and the things you
do have real effects. That's what school, prison, and ladies-who-lunch
all lack. The inhabitants of all those worlds are trapped in little
bubbles where nothing they do can have more than a local effect.
Naturally these societies degenerate into savagery. They have no
function for their form to follow.When the things you do have real effects, it's no longer enough
just to be pleasing. It starts to be important to get the right
answers, and that's where nerds show to advantage. <NAME> will
of course come to mind. Though notoriously lacking in social skills,
he gets the right answers, at least as measured in revenue.The other thing that's different about the real world is that it's
much larger. In a large enough pool, even the smallest minorities
can achieve a critical mass if they clump together. Out in the real
world, nerds collect in certain places and form their own societies
where intelligence is the most important thing. Sometimes the current
even starts to flow in the other direction: sometimes, particularly
in university math and science departments, nerds deliberately
exaggerate their awkwardness in order to seem smarter. <NAME>
so admired <NAME> that he adopted his habit of touching the
wall as he walked down a corridor.
As a thirteen-year-old kid, I didn't have much more experience of
the world than what I saw immediately around me. The warped little
world we lived in was, I thought, the world. The world seemed cruel
and boring, and I'm not sure which was worse.Because I didn't fit into this world, I thought that something must
be wrong with me. I didn't realize that the reason we nerds didn't
fit in was that in some ways
we were a step ahead. We were already thinking about
the kind of things that matter in the real world, instead of spending
all our time playing an exacting but mostly pointless game like the
others.We were a bit like an adult would be if he were thrust back into
middle school. He wouldn't know the right clothes to wear, the right
music to like, the right slang to use. He'd seem to the kids a
complete alien. The thing is, he'd know enough not to care what
they thought. We had no such confidence.A lot of people seem to think it's good for smart kids to be thrown
together with "normal" kids at this stage of their lives. Perhaps.
But in at least some cases the reason the nerds don't fit in really
is that everyone else is crazy. I remember sitting in the audience
at a "pep rally" at my high school, watching as the cheerleaders
threw an effigy of an opposing player into the audience to be torn
to pieces. I felt like an explorer witnessing some bizarre tribal
ritual.
If I could go back and give my thirteen year old self some advice,
the main thing I'd tell him would be to stick his head up and look
around. I didn't really grasp it at the time, but the whole world
we lived in was as fake as a Twinkie. Not just school, but the
entire town. Why do people move to suburbia? To have kids! So no
wonder it seemed boring and sterile. The whole place was a giant
nursery, an artificial town created explicitly for the purpose of
breeding children.Where I grew up, it felt as if there was nowhere to go, and nothing
to do. This was no accident. Suburbs are deliberately designed to
exclude the outside world, because it contains things that could
endanger children.And as for the schools, they were just holding pens within this
fake world. Officially the purpose of schools is to teach kids. In
fact their primary purpose is to keep kids locked up in one
place for a big chunk of the day so adults can get things done. And
I have no problem with this: in a specialized industrial society,
it would be a disaster to have kids running around loose.What bothers me is not that the kids are kept in prisons, but that
(a) they aren't told about it, and (b) the prisons are run mostly
by the inmates. Kids are sent off to spend six years memorizing
meaningless facts in a world ruled by a caste of giants who run
after an oblong brown ball, as if this were the most natural thing
in the world. And if they balk at this surreal cocktail, they're
called misfits.
Life in this twisted world is stressful for the kids. And not just
for the nerds. Like any war, it's damaging even to the winners.Adults can't avoid seeing that teenage kids are tormented. So why
don't they do something about it? Because they blame it on puberty.
The reason kids are so unhappy, adults tell themselves, is that
monstrous new chemicals, hormones, are now coursing through their
bloodstream and messing up everything. There's nothing wrong with
the system; it's just inevitable that kids will be miserable at
that age.This idea is so pervasive that even the kids believe it, which
probably doesn't help. Someone who thinks his feet naturally hurt
is not going to stop to consider the possibility that he is wearing
the wrong size shoes.I'm suspicious of this theory that thirteen-year-old kids are
intrinsically messed up. If it's physiological, it should be
universal. Are Mongol nomads all nihilists at thirteen? I've read
a lot of history, and I have not seen a single reference
to this supposedly universal fact before the twentieth century.
Teenage apprentices in the Renaissance seem to have been cheerful
and eager. They got in fights and played tricks on one another of
course (Michelangelo had his nose broken by a bully), but they
weren't crazy.As far as I can tell, the concept of the hormone-crazed teenager
is coeval with suburbia. I don't think this is a coincidence. I
think teenagers are driven crazy by the life they're made to lead.
Teenage apprentices in the Renaissance were working dogs. Teenagers
now are neurotic lapdogs. Their craziness is the craziness of the
idle everywhere.
When I was in school, suicide was a constant topic among the smarter
kids. No one I knew did it, but several planned to, and
some may have tried. Mostly this was just a pose. Like other
teenagers, we loved the dramatic, and suicide seemed very dramatic.
But partly it was because our lives were at times genuinely miserable.Bullying was only part of the problem. Another problem, and possibly
an even worse one, was that we never had anything real to work on.
Humans like to work; in most of the world, your work is your identity.
And all the work we did was
pointless, or seemed so at the time.At best it was practice for real work we might do far in the future,
so far that we didn't even know at the time what we were practicing
for. More often it was just an arbitrary series of hoops to jump
through, words without content designed mainly for testability.
(The three main causes of the Civil War were....
Test: List the three main causes of the Civil War.)And there was no way to opt out. The adults had agreed among
themselves that this was to be the route to college. The only way
to escape this empty life was to submit to it.
Teenage kids used to have a more active role in society. In
pre-industrial times, they were all apprentices of one sort or
another, whether in shops or on farms or even on warships. They
weren't left to create their own societies. They were junior members
of adult societies.Teenagers seem to have respected adults more then, because
the adults were the visible experts in the skills they were trying
to learn. Now most kids have little idea what their parents do in
their distant offices, and see no connection (indeed, there is
precious little) between schoolwork and the work they'll do as
adults.And if teenagers respected adults more, adults also had more use
for teenagers. After a couple years' training, an apprentice could
be a real help. Even the newest apprentice could be made to carry
messages or sweep the workshop.Now adults have no immediate use for teenagers. They would be in
the way in an office. So they drop them off at school on their way
to work, much as they might drop the dog off at a kennel if they
were going away for the weekend.What happened? We're up against a hard one here. The cause of this
problem is the same as the cause of so many present ills: specialization.
As jobs become more specialized, we have to train longer for them.
Kids in pre-industrial times started working at about 14 at
the latest; kids on farms, where most people lived, began far
earlier. Now kids who go to college don't start working full-time
till 21 or 22. With some degrees, like MDs and PhDs, you may not
finish your training till 30.Teenagers now are useless, except as cheap labor in industries like
fast food, which evolved to exploit precisely this fact. In almost
any other kind of work, they'd be a net loss. But they're also too
young to be left unsupervised. Someone has to watch over them, and
the most efficient way to do this is to collect them together in
one place. Then a few adults can watch all of them.If you stop there, what you're describing is literally a prison,
albeit a part-time one. The problem is, many schools practically
do stop there. The stated purpose of schools is to educate the kids.
But there is no external pressure to do this well. And so most
schools do such a bad job of teaching that the kids don't really
take it seriously-- not even the smart kids. Much of the time we
were all, students and teachers both, just going through the motions.In my high school French class we were supposed to read Hugo's Les
Miserables. I don't think any of us knew French well enough to make
our way through this enormous book. Like the rest of the class, I
just skimmed the Cliff's Notes. When we were given a test on the
book, I noticed that the questions sounded odd. They were full of
long words that our teacher wouldn't have used. Where had these
questions come from? From the Cliff's Notes, it turned out. The
teacher was using them too. We were all just pretending.There are certainly great public school teachers. The energy and
imagination of my fourth grade teacher, Mr. Mihalko, made that
year something his students still talk about, thirty years later.
But teachers like him were individuals swimming
upstream. They couldn't fix the system.
In almost any group of people you'll find hierarchy.
When groups of adults form in the real world, it's generally for
some common purpose, and the leaders end up being those who are best
at it. The problem with most schools is, they have no purpose.
But hierarchy there must be.
And so the kids make one out of nothing.We have a phrase to describe what happens when rankings have to be
created without any meaningful criteria. We say that the situation
degenerates into a popularity contest. And that's exactly what
happens in most American schools.
Instead of depending on some real test, one's rank
depends mostly on one's ability to increase one's rank. It's
like the court of Louis XIV. There is no external opponent, so the
kids become one another's opponents.When there is some real external test of skill, it isn't painful
to be at the bottom of the hierarchy. A rookie on a football team
doesn't resent the skill of the veteran; he hopes to be like him
one day and is happy to have the chance to learn from him.
The veteran may in turn feel a sense of
noblesse oblige.
And most importantly, their status depends on how well they
do against opponents, not on whether they can push the other down.Court hierarchies are another thing entirely. This type of society
debases anyone who enters it. There is neither admiration at the
bottom, nor noblesse oblige at the top. It's kill or be killed.This is the sort of society that gets created
in American
secondary schools. And it happens because these schools have no
real purpose beyond keeping the kids all in one place for a certain
number of hours each day. What I didn't realize at the time, and
in fact didn't realize till very recently, is that the twin horrors
of school life, the cruelty and the boredom, both have the same
cause.
The mediocrity of American public schools has worse consequences
than just making kids unhappy for six years. It breeds a rebelliousness
that actively drives kids away from the things they're supposed to
be learning.Like many nerds, probably, it was years after high school before I
could bring myself to read anything we'd been assigned then.
And I lost more than books. I mistrusted words like "character" and
"integrity" because they had been so debased by adults. As they
were used then, these words all seemed to mean the same thing:
obedience. The kids who got praised for these qualities tended to
be at best dull-witted prize bulls, and at worst facile schmoozers.
If that was what character and integrity were, I wanted no part of
them.The word I most misunderstood was "tact." As used by adults, it
seemed to mean keeping your mouth shut.
I assumed it was derived from the same root as
"tacit" and "taciturn," and that it literally meant being quiet. I
vowed that I would never be tactful; they were never going to shut
me up. In fact, it's derived from the same root as "tactile," and
what it means is to have a deft touch. Tactful is the opposite of
clumsy. I don't think I learned this until college.Nerds aren't the only losers in the popularity rat race. Nerds are
unpopular because they're distracted. There are other kids who
deliberately opt out because they're so disgusted with the whole
process.Teenage kids, even rebels, don't like to be alone, so when kids opt
out of the system, they tend to do it as a group. At the schools I
went to, the focus of rebellion was drug use, specifically marijuana.
The kids in this tribe wore black concert t-shirts and were called
"freaks."Freaks and nerds were allies, and there was a good deal of overlap
between them. Freaks were on the whole smarter than other kids,
though never studying (or at least never appearing to) was an
important tribal value. I was more in the nerd camp, but I was
friends with a lot of freaks.They used drugs, at least at first, for the social bonds they
created. It was something to do together, and because the drugs
were illegal, it was a shared badge of rebellion.I'm not claiming that bad schools are the whole reason kids get
into trouble with drugs. After a while, drugs have their own momentum.
No doubt some of the freaks ultimately used drugs to escape from
other problems-- trouble at home, for example. But, in my school
at least, the reason most kids started using drugs was rebellion.
Fourteen-year-olds didn't start smoking pot because they'd heard
it would help them forget their problems. They started because they
wanted to join a different tribe.Misrule breeds rebellion; this is not a new idea. And yet the
authorities still for the most part act as if drugs were themselves
the cause of the problem.
The real problem is the emptiness of school life. We won't see
solutions till adults realize that. The adults who
may realize it first are the ones who were themselves nerds in
school. Do you want your kids to be as unhappy in eighth grade as
you were? I wouldn't. Well, then, is there anything we can do to
fix things? Almost certainly. There is nothing inevitable about the
current system. It has come about mostly by default.Adults, though, are busy. Showing up for school plays is one thing.
Taking on the educational bureaucracy is another. Perhaps a few
will have the energy to try to change things. I suspect the hardest
part is realizing that you can.Nerds still in school should not hold their breath. Maybe one day
a heavily armed force of adults will show up in helicopters to
rescue you, but they probably won't be coming this month. Any
immediate improvement in nerds' lives is probably going to have to
come from the nerds themselves.Merely understanding the situation they're in should make it less
painful. Nerds aren't losers. They're just playing a different game,
and a game much closer to the one played in the real world. Adults
know this. It's hard to find successful adults now who don't claim
to have been nerds in high school.It's important for nerds to realize, too, that school is not life.
School is a strange, artificial thing, half sterile and half feral.
It's all-encompassing, like life, but it isn't the real thing. It's
only temporary, and if you look, you can see beyond it even while
you're still in it.If life seems awful to kids, it's neither because hormones are
turning you all into monsters (as your parents believe), nor because
life actually is awful (as you believe). It's because the adults,
who no longer have any economic use for you, have abandoned you to
spend years cooped up together with nothing real to do. Any society
of that type is awful to live in.
You don't have
to look any further to explain why teenage kids are unhappy.I've said some harsh things in this essay, but really the thesis
is an optimistic one-- that several problems we take for granted
are in fact not insoluble after all. Teenage kids are not inherently
unhappy monsters. That should be encouraging news to kids and adults
both.
Thanks to <NAME>, <NAME>, <NAME>,
<NAME>, and <NAME> for reading drafts of this essay,
and <NAME> for scanning photos.Re: Why Nerds are UnpopularGateway High School, 1981Japanese TranslationFrench TranslationMy War With BrianButtonsPortuguese TranslationSpanish Translation
|
|
https://github.com/cadojo/correspondence | https://raw.githubusercontent.com/cadojo/correspondence/main/src/vita/src/experience.typ | typst | MIT License | #let experiencelist = state("experiencelist", ())
#let experience(
organization,
role: none,
start: none,
stop: none,
notes
) = {
let content = [
#grid(
columns: (1fr, 1fr),
heading(level: 3, organization),
align(right)[
#set text(rgb(90,90,90))
#start #if stop != none { " — " + stop}
]
)
#if role != none {
set text(rgb(90,90,90))
if type(role) == "string" {
v(-0.5em)
text(role)
} else {
v(-0.5em)
text(role.join(", "))
}
}
#notes
]
experiencelist.update(current => current + (content,))
}
#let experiences(header: "Professional Experience") = {
locate(
loc => {
let experiencelist = experiencelist.final(loc)
if experiencelist.len() > 0 {
heading(level: 2, text(header))
line(length: 100%, stroke: 1pt + black)
experiencelist.join()
}
}
)
} |
https://github.com/pedrofp4444/BD | https://raw.githubusercontent.com/pedrofp4444/BD/main/report/content/[2] Levantamento e Análise de Requisitos/metodo.typ | typst | #let metodo = {
[
== Método de Levantamento e de Análise de Requisitos Adotado
De forma a garantir um eficiente desenvolvimento do sistema de gestão de base de dados para a _Lusium_, a equipa “Quatro em Linha” dedicou-se a registar e documentar todas as condições e determinações da empresa em relação à melhor forma de organizar todo o modelo que envolve o problema que é enfrentado. Para tal, esta recorreu aos seguintes métodos de levantamentos de requisitos:
- *Reuniões*: Foram feitas reuniões com os detetives da B.E.L.O e representantes da _Lusium_ de forma a entender qual a melhor forma de gerir os dados relacionados com os funcionários e terrenos onde trabalham, bem como os dados relacionados com os os casos e os suspeitos que neles se integram;
- *Inquérito*: Foi executado um questionário denominado “Inquérito Estatístico de Opinião”, orientado aos colaboradores da _Lusium_, com a principal meta de aprofundar o conhecimento e a transversalidade dos recursos humanos da “Quatro em Linha” de acordo com o contexto do caso em estudo.
O registo destes procedimentos é imprescindível para assegurar a consistência dos requisitos recolhidos a partir da intervenção dos diversos trabalhadores da _Lusium_, estando a documentação destes procedimentos visível no #link(<Anexo1>, "anexo 1"), #link(<Anexo2>, "anexo 2"), #link(<Anexo3>, "anexo 3"), #link(<Anexo4>, "anexo 4") e #link(<Anexo15>, "anexo 15"). Numa fase final do tratamento dos requisitos, a estruturação dos mesmos foi apresentada ao representantes e detetives da _Lusium_, de forma a obter a sua validação.
]
}
|
|
https://github.com/dashuai009/dashuai009.github.io | https://raw.githubusercontent.com/dashuai009/dashuai009.github.io/main/src/content/blog/050.typ | typst | #let date = datetime(
year: 2024,
month: 10,
day: 20,
)
#metadata((
title: "你的电脑上有多少CEF?",
subtitle: [CEF],
author: "dashuai009",
description: "你的电脑上有多少CEF?",
pubDate: date.display(),
))<frontmatter>
最近电脑C盘爆了,
#figure(
image("050/imgs1.png", width: 50%),
)
想起来有个项目#link("https://github.com/ShirasawaSama/CefDetectorX")[【升级版-Electron】Check how many CEFs are on your computer. 检测你电脑上有几个CEF.]能检测电脑上装了多少个#link("https://bitbucket.org/chromiumembedded/cef/")[CEF (Chromium Embedded Framework)]。然后。。。。134个。。。。。。。。
#figure(
image("050/imgs2.png"),
) |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/data-00.typ | typst | Other | // Test reading plain text files
#let data = read("test/assets/files/hello.txt")
#test(data, "Hello, world!")
|
https://github.com/Kirchoffs/typst-demo | https://raw.githubusercontent.com/Kirchoffs/typst-demo/main/math-hello-world/math-1.typ | typst | The equation $Q = rho A v + C$ defines the glacial flow rate.
The flow rate of a glacier is defined by the following equation:
$ Q = rho A v + C $
The flow rate of a glacier is given by the following equation:
$ Q = rho A v + "time offset" $
Total displaced soil by glacial flow:
$ 7.32 beta + sum_(i=0)^nabla Q_i / 2 $
Total displaced soil by glacial flow:
$ 7.32 beta + sum_(i=0)^nabla (Q_i (a_i - epsilon)) / 2 $
$ v := vec(x_1, x_2, x_3) $
$ a arrow.squiggly b $
|
|
https://github.com/fufexan/cv | https://raw.githubusercontent.com/fufexan/cv/typst/modules_ro/skills.typ | typst | #import "../src/template.typ": *
#cvSection("Skills")
#cvSkill(
type: [Limbi vorbite],
info: [Română, Engleză],
)
#cvSkill(
type: [Limbaje de prog.],
info: [Bash, C/C++, Java, JavaScript, Matlab, Nix, PHP, Python, Rust],
)
#cvSkill(
type: [Baze de date],
info: [Microsoft SQL, MySQL, Firestore],
)
#cvSkill(
type: [Build tools],
info: [CMake, Meson, Nix],
)
#cvSkill(
type: [DevOps],
info: [NixOS, QEMU, Terraform],
)
#cvSkill(
type: [Skilluri sociale],
info: [A lucrat în echipe multiple, a participat în activități de team-building.
Lucrul în echipă este un punct forte.],
)
|
|
https://github.com/Tetragramm/flying-circus-typst-template | https://raw.githubusercontent.com/Tetragramm/flying-circus-typst-template/main/src/Impl.typ | typst | MIT License | #import "@preview/cetz:0.3.1"
#import "@preview/cetz-plot:0.1.0"
#import "@preview/cuti:0.2.1": regex-fakebold
#import "@preview/tablex:0.0.8": gridx, cellx, hlinex, vlinex
/// Sets the tex to the Koch Fette FC font for people who don't want to remember that.
///
/// - body (content)
/// - ..args: Any valid argument to the text function
/// -> content
#let KochFont(body, ..args) = text(..args)[#text(font: "Koch Fette FC")[#body]]
#let defaultImg = read("images/Default.png", encoding: none)
#let regex-fakeitalic(reg-exp: "\b.+?\b", ang: -18.4deg, s) = {
show regex(reg-exp): it => {
box(skew(ax: ang, reflow: false, it))
}
s
}
#let fakesc(s) = {
show regex("[\p{Lu}]"): text.with(1.25em)
text(0.8em, upper(s))
}
/// Defines the FlyingCircus template
///
/// - Title (str): Title of the document. Goes in metadata and on title page.
/// - Author (str): Author(s) of the document. Goes in metadata and on title page.
/// - CoverImg (bytes): Image to make the first page of the document.
/// - Description (str): Text to go with the title on the title page.
/// - Dedication (str): Dedication to go down below the title on the title page.
/// - body (content)
/// -> content
#let FlyingCircus(Title: str, Author: str, CoverImg: none, Desciption: "Aircraft Catalogue", Dedication: "", body) = {
//Set PDF Metadata
set document(title: Title, author: Author)
//Set Default Font document settings
set text(font: "Balthazar", size: 14pt)
// set par(spacing: 0.5em)
set par(leading: 0.35em)
set par(justify: true)
set list(indent: 1em)
set enum(indent: 1em)
set page(numbering: "1")
//Create fake italics because fonts don't have it.
show emph: it => {
regex-fakeitalic(it.body)
}
show strong: it => {
regex-fakebold(it.body)
}
show smallcaps: it => {
fakesc(it.body)
}
//Replace Synchronization Marker
show regex("✣"): text(font: "Material Symbols Sharp", [#str.from-unicode(61800)])
//Create default page format
set page(
paper: "a4",
//Header is alternating directions and the centered "Flying Circus" with border
header: context{
align(center, cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
line((-.5, 0), (.5, 0))
circle((-.5, 0), radius: 1.5mm, fill: black)
circle((.5, 0), radius: 1.5mm, fill: black)
if (calc.rem(counter(page).get().first(), 2) == 1) {
for x in range(-490, 480, step: 13){
line((x / 1000, -2mm), ((x + 20) / 1000, 2mm))
}
} else {
for x in range(-470, 500, step: 13){
line((x / 1000, -2mm), ((x - 20) / 1000, 2mm))
}
}
content((0, 1pt), KochFont(stroke: 5pt + white)[Flying Circus])
content((0, 1pt), KochFont(stroke: 0.5pt + black)[Flying Circus])
}))
},
//Footer is alternating directions with page number at outside and only partial bar
footer: context{
align(center, cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
if (calc.rem(counter(page).get().first(), 2) == 1) {
content((-.5, 0), KochFont(size: 18pt)[#counter(page).get().first()])
line((-.45, 0), (.5, 0))
circle((-.45, 0), radius: 1.5mm, fill: black)
circle((.5, 0), radius: 1.5mm, fill: black)
for x in range(-440, 480, step: 13){
line((x / 1000, -2mm), ((x + 20) / 1000, 2mm))
}
} else {
content((.5, 0), KochFont(size: 18pt)[#counter(page).get().first()])
line((-.5, 0), (.45, 0))
circle((-.5, 0), radius: 1.5mm, fill: black)
circle((.45, 0), radius: 1.5mm, fill: black)
for x in range(-470, 450, step: 13){
line((x / 1000, -2mm), ((x - 20) / 1000, 2mm))
}
}
}))
},
//Margins, duh.
margin: (top: 0.5in, bottom: 0.75in, left: 0.75in, right: 0.75in),
)
//Place CoverImage, if it exists
if (CoverImg != none) {
page(paper: "a4", header: none, footer: none, margin: 0pt)[
#set image(height: 100%, fit: "stretch")
#CoverImg
]
}
//Create Title Page (and eventual TOC)
let onepage(body) = page(
//Header is evenly LtR, no text
header: context{
align(center, cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
line((-.45, 0), (.45, 0))
circle((-.45, 0), radius: 1.5mm, fill: black)
circle((.45, 0), radius: 1.5mm, fill: black)
for x in range(-440, 430, step: 13){
line((x / 1000, -2mm), ((x + 20) / 1000, 2mm))
}
}))
},
//Footer is smaller and even LtR
footer: context{
set align(center)
cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
line((-.25, 0), (.25, 0))
circle((-.25, 0), radius: 1.5mm, fill: black)
circle((.25, 0), radius: 1.5mm, fill: black)
for x in range(-240, 230, step: 13){
line((x / 1000, -2mm), ((x + 20) / 1000, 2mm))
}
})
},
body,
)
onepage[
#set align(center)
//The Big FC
#KochFont(size: 75pt)[
Flying\
#box(rotate(90deg)[#scale(x: -100%)[$ theta.alt $]]) Circus #box(rotate(-90deg)[$ theta.alt $])
]
//Title and description
#text(size: 24pt)[
#Desciption \
#Title
]
//Fancy swirls
#text(
size: 75pt,
)[
#box(rotate(-90deg, reflow: true)[#scale(y: 300%, reflow: true)[$ sigma.alt $]]) #box(rotate(-90deg, reflow: true)[#scale(y: -300%, reflow: true)[$ sigma.alt $]])
]
#v(1fr)
//Dedication is optional
#Dedication
#v(2fr)
//And the Author, of course
#text(size: 24pt)[
#Author
#v(1em)
]
]
//Style outline
// show outline.title: it => {
// text
// }
show outline.entry.where(level: 1): it => {
v(10pt, weak: true)
text(size: 20pt, it)
}
onepage[#align(
center,
box(
width: 80%,
outline(depth: 10, indent: 1em, title: KochFont(size: 50pt, fill: white, stroke: black + 1pt)[Contents #h(1fr)]),
),
)]
//Set up headings (gotta be styled after #outline)
show heading: it => {
KochFont[#align(left)[#it.body]]
}
show heading.where(level: 1): it => {
KochFont(size: 24pt)[#align(left)[#it.body]]
v(-1.3em)
line(length: 100%, stroke: 1pt + luma(100))
}
show heading.where(level: 2): it => {
KochFont(size: 24pt)[#align(left)[#it.body]]
}
show heading.where(level: 3): it => {
KochFont(size: 18pt)[#align(left)[#it.body]]
}
//Reset Page counter to 1, and let's go!
counter(page).update(1)
body
}
#let MaybeImage(img, ..args) = if (img != none) {
[
#set image(..args)
#img
]
}
/// Defines the FlyingCircus Plane page. Always on a new page. Image optional.
///
/// - Plane (str | dictionary): JSON string or dictionary representing the plane stats.
/// - Nickname (str): Nickname to go under the aircraft name.
/// - Img (bytes | none): Image to go at the top of the page. Set to none to remove.
/// - BoxText (dictionary): Pairs of values to go in the box over the image. Does nothing if no Img provided.
/// - BoxAnchor (str): Which anchor of the image to put the box in? Sample values are "north", "south-west", "center".
/// - DescriptiveText (content)
/// -> content
#let FCPlane(Plane, Nickname: str, Img: defaultImg, BoxText: none, BoxAnchor: "north", DescriptiveText) = {
pagebreak(weak: true)
let plane = Plane
//Read in json.decode file if it's a path
if (type(Plane) == str) {
plane = json.decode(Plane)
}
//Define image element
let plane_image = if (Img != none) {
context cetz.canvas(length: 100%, {
import cetz.draw:*
content((0.5, 1), anchor: "north", MaybeImage(Img, width: page.width * 0.95, fit: "stretch"), name: "image")
if (BoxText != none) {
content("image." + BoxAnchor, anchor: BoxAnchor, padding: 5mm, align(center)[
#let cells = (hlinex(),)
#for (k, v) in BoxText {
cells.push(text(size: 12pt, k))
cells.push(text(size: 12pt, v))
cells.push(hlinex())
}
#grid(columns: 2, fill: white.transparentize(50%), stroke: luma(170), vline(x: 0), vline(x: 2), ..cells)
])
}
})
}
//Define title element
let plane_title = {
set text(fill: luma(100))
set block(spacing: 0.1em)
let hN = plane.keys().contains("Price")
let hU = plane.keys().contains("Used")
text(size: 20pt)[#plane.Name];h(1fr); if (hN) { [#plane.Price;þ New] }; if (hN and hU) { [, ] }; if (hU) { [#plane.Used;þ Used] }
line(length: 100%, stroke: luma(100))
[_\"#Nickname\"_ #h(1fr); #plane.Upkeep;þ]
}
//Read through the stat rows and push them into cells
let cells = ()
for row in plane.Stats {
for (k, v) in row {
if (k == "Name") {
cells.push(table.cell([#v], align: right, stroke: none))
} else {
cells.push(table.cell([#v]))
}
}
}
//Construct the stats table element
let statTable = table(
columns: 6,
align: center,
table.cell(stroke: none)[],
table.cell(stroke: none)[Boost],
table.cell(stroke: none)[Handling],
table.cell(stroke: none)[Climb],
table.cell(stroke: none)[Stall],
table.cell(stroke: none)[Speed],
..cells,
)
//Define the vital parts table element
let vitalTable = table(
columns: (100%),
rows: (auto, 1fr),
align: center + horizon,
table.header(table.cell(stroke: none)[Vital Parts]),
[#plane.at("Vital Parts") \ #plane.Crew],
)
//Define the secondary stats table element
let miscTable = table(
columns: (100%),
align: center + horizon,
[#plane.Propulsion],
[#plane.Aerodynamics],
[#plane.Survivability],
table.cell(align: left + horizon, [#plane.Armament]),
)
place(top + left, box(width: 0pt, height: 0pt, hide[= #plane.Name]))
grid(
columns: 1,
rows: (auto, 1fr, auto),
grid.cell(
align: center,
[
#plane_image
#plane_title
#v(-1em)
#context stack(dir: ltr, spacing: 1%, box(width:59%, height:measure(statTable).height, statTable), box(width: 40%,
height: measure(statTable).height, vitalTable))
#v(-1em)
#miscTable
],
),
grid.cell(columns(2)[#DescriptiveText], inset: (y: 0.5em)),
grid.cell(align(center)[#text(size: 24pt)[#underline[#link(plane.Link)[Plane Builder Link]]]]),
)
}
/// Defines the FlyingCircus Simple Vehicle. Not always a full page. Image optional.
///
/// - Vehicle (str | dictionary): JSON string or dictionary representing the Vehicle stats.
/// - Img (bytes): Image to go above the vehicle.
/// - DescriptiveText (content)
/// -> content
#let FCVehicleSimple(Vehicle, Img: none, DescriptiveText) = {
//Read in the Vehicle JSON file
let vehicle = Vehicle;
if (type(Vehicle) == str) {
vehicle = json.decode(Vehicle)
}
//Define title element
let veh_title = par(leading: -1em)[
#set text(fill: luma(100))
#set block(spacing: 0.1em)
#link(vehicle.Link)[#text(size: 20pt)[#vehicle.Name]]; #h(1fr); #vehicle.Price;þ, #vehicle.Upkeep;þ Upkeep
#line(length: 100%, stroke: luma(100))
]
//Define image element
let veh_image = align(center)[
#MaybeImage(Img, width: 110%, fit: "stretch")
]
//Define the stat table element
let veh_stats = align(center)[#table(
align: center + horizon,
columns: (1fr, 1fr, 1fr, 1fr, 1fr, 1fr),
[Speed],
[#vehicle.Speed],
[Torque],
[#vehicle.Torque],
[Handling],
[#vehicle.Handling],
[Armour],
[#vehicle.Armour],
[Integrity],
[#vehicle.Integrity],
[Safety],
[#vehicle.Safety],
[Reliability],
[#vehicle.Reliability],
[Fuel Uses],
[#vehicle.at("Fuel Uses")],
[Stress],
[#vehicle.Stress],
table.cell(colspan: 3, [#vehicle.Size]),
table.cell(colspan: 3, [#vehicle.Cargo]),
)
]
let cells = ()
for row in vehicle.Crew {
for (idx, (k, v),) in row.pairs().enumerate() {
if (idx == 0) {
if (v.contains("Loader")) {
cells.push(table.cell(stroke: none)[])
cells.push(table.cell([#v]))
} else {
cells.push(table.cell(colspan: 2)[#v])
}
} else {
cells.push(table.cell([#v]))
}
}
}
let veh_crew = table(
align: (left, left, center, center, center, left),
columns: (1em, auto, auto, auto, auto, 1fr),
table.cell(stroke: none, []),
table.cell(stroke: none, []),
[Type],
[Vis.],
[Escape],
[Notes],
..cells,
)
place(top + left, box(width: 0pt, height: 0pt, hide[= #vehicle.Name]))
if (Img != none) {
veh_image
v(-1em)
}
veh_title
DescriptiveText
veh_stats
v(-1em)
align(center)[#KochFont(size: 18pt)[Crew]]
v(-1em)
veh_crew
}
/// Defines the FlyingCircus Plane page. Always on a new page. Image optional.
/// If the Img is provided, it will take up two facing pages, otherwise only one, but a full page, unlike the Simple.
///
/// - Vehicle (str | dictionary): JSON string or dictionary representing the Vehicle stats.
/// - Img (bytes | none): Image to go at the top of the first page. Set to none to remove.
/// - TextVOffset (length): How far to push the text down the page. Want to do that inset text thing the book does? You can, the text can overlap with thte image. Does nothing if no Img provided.
/// - BoxText (dictionary): Pairs of values to go in the box over the image. Does nothing if no Img provided.
/// - BoxAnchor (str): Which anchor of the image to put the box in? Sample values are "north", "south-west", "center".
/// - FirstPageContent (content): Goes on the first page. If no image is provided, it is not present.
/// - AfterContent (content): Goes after the stat block. Always present.
/// -> content
#let FCVehicleFancy(Vehicle, Img: none, TextVOffset: 0pt, BoxText: none, BoxAnchor: "north", FirstPageContent, AfterContent) = {
//Read in the Vehicle JSON file
let vehicle;
if (type(Vehicle) == str) {
vehicle = json.decode(Vehicle)
}
//Define image element is done below because it needs context.
//Define Firsttitle element
let veh_title = par(leading: -1em)[
#set text(fill: luma(100), size: 24pt)
#set block(spacing: 0.1em)
#link(vehicle.Link)[#vehicle.Name]
#line(length: 100%, stroke: luma(100))
]
//Define title element
let veh_title2 = align(center)[#box(width: 70%)[#par(leading: -1em)[
#set text(fill: luma(100))
#set block(spacing: 0.1em)
#link(vehicle.Link)[#text(size: 20pt)[#vehicle.Name]]; #h(1fr); #vehicle.Price;þ
#line(length: 100%, stroke: luma(100))
#vehicle.Nickname;#h(1fr)Upkeep #vehicle.Upkeep;þ
]]]
//Define the stat table element
let veh_stats = align(center)[#box(width: 70%)[
#table(
align: center + horizon,
columns: (1fr, 1fr, 1fr, 1fr, 1fr, 1fr),
table.cell(colspan: 2, [Speed]),
table.cell(colspan: 2, [Torque]),
table.cell(colspan: 2, [Handling]),
table.cell(colspan: 2, [#vehicle.Speed]),
table.cell(colspan: 2, [#vehicle.Torque]),
table.cell(colspan: 2, [#vehicle.Handling]),
table.cell(colspan: 2, [Armour]),
table.cell(colspan: 2, [Integrity]),
table.cell(colspan: 2, [Safety]),
table.cell(colspan: 2, [#vehicle.Armour]),
table.cell(colspan: 2, [#vehicle.Integrity]),
table.cell(colspan: 2, [#vehicle.Safety]),
table.cell(colspan: 2, [Reliability]),
table.cell(colspan: 2, [Fuel Uses]),
table.cell(colspan: 2, [Stress]),
table.cell(colspan: 2, [#vehicle.Reliability]),
table.cell(colspan: 2, [#vehicle.at("Fuel Uses")]),
table.cell(colspan: 2, [#vehicle.Stress]),
table.cell(colspan: 3, [#vehicle.Size]),
table.cell(colspan: 3, [#vehicle.Cargo]),
)
]]
let cells = ()
for row in vehicle.Crew {
for (idx, (k, v),) in row.pairs().enumerate() {
if (idx == 0) {
if (v.contains("Loader")) {
cells.push(table.cell(stroke: none)[])
cells.push(table.cell([#v]))
} else {
cells.push(table.cell(colspan: 2)[#v])
}
} else {
cells.push(table.cell([#v]))
}
}
}
let veh_crew = table(
align: (left, left, center, center, center, left),
columns: (1em, auto, auto, auto, auto, 1fr),
table.cell(stroke: none, []),
table.cell(stroke: none, []),
[Type],
[Vis.],
[Escape],
[Notes],
..cells,
)
//If we have an image, then this is a two-page thing
if (Img != none) {
pagebreak(weak: true, to: "even")
page(
background: align(
top,
)[
#context cetz.canvas( length: 100%, { import cetz.draw:*
content((0.5, 1), anchor: "north", MaybeImage(Img, width: page.width, fit: "stretch"), name: "image"); if (BoxText !=
none) { content("image." + BoxAnchor, anchor: BoxAnchor, padding: 1in, align(center)[
#let cells = ()
#for (k, v) in BoxText {
cells.push(text(size: 12pt, [#k: #v]))
}
#gridx(
columns: 1,
fill: white.transparentize(50%),
stroke: black,
vlinex(x: 0),
vlinex(x: 1),
hlinex(y: 0),
..cells,
hlinex(),
), ]) } }, )
],
margin: (top: 0pt),
header: none,
)[
#place(top + left, box(width: 0pt, height: 0pt, hide[= #vehicle.Name]))
#v(TextVOffset)
#veh_title
#FirstPageContent
]
}
//Second page goes back to normal
pagebreak()
if (Img == none) {
place(top + left, box(width: 0pt, height: 0pt, hide[= #vehicle.Name]))
}
veh_title2
veh_stats
align(center)[#KochFont(size: 18pt)[Crew]]
v(-1em)
veh_crew
AfterContent
}
/// Defines the FlyingCircus Ship page. Always on a new page. Image optional.
///
/// - Ship (str | dictionary): JSON string or dictionary representing the Ship stats.
/// - Img (bytes | none): Image to go at the top of the page. Set to none to remove.
/// - DescriptiveText (content): Goes below the name and above the stats table.
/// - notes (content): Goes in the notes section.
/// -> content
#let FCShip(Ship: dictionary, Img: bytes, DescriptiveText, notes) = {
pagebreak(weak: true)
//Define image element
let ship_image = align(center)[
#MaybeImage(Img, width: 80%, fit: "contain")
]
//Define title element
let ship_title = KochFont(size: 24pt)[#Ship.Name]
//Construct the stats table element
let statTable = gridx(
columns: (30%, 30%, 30%),
align: center + horizon,
hlinex(end: 2, expand: (0pt, 1.9em)),
[Speed],
[Handling],
cellx(rowspan: 6, inset: (top: -2em, right: -2em, bottom: -3em))[
#let data = ()
#for s in Ship.DamageStates {
data.push((value: 1, label: s))
}
#cetz.canvas(length: 100%, {
import cetz.draw: *
import cetz-plot: *
set-style(stroke: (paint: black))
chart.piechart(
data,
radius: 0.5,
value-key: "value",
label-key: "label",
outer-label: (content: none),
inner-label: (content: "LABEL", radius: 130%),
slice-style: ((fill: white, stroke: black),),
legend: (label: none),
)
line((0, 0), (0, 0.5), stroke: (thickness: 3pt))
})
],
hlinex(end: 2, expand: (0pt, 0.8em)),
[#Ship.Speed],
[#Ship.Handling],
hlinex(end: 2, expand: (0pt, 0.3em)),
[Hardness],
[Soak],
hlinex(end: 2, expand: (0pt, 0em)),
[#Ship.Hardness],
[#Ship.Soak],
hlinex(end: 2, expand: (0pt, 0.1em)),
[Strengths],
[Weaknesses],
hlinex(end: 2, expand: (0pt, 0.4em)),
[#Ship.Strengths],
[#Ship.Weaknesses],
hlinex(end: 2, expand: (0pt, 1.0em)),
vlinex(x: 0),
vlinex(x: 1),
)
let cells = ()
for weap in Ship.Weapons {
cells.push([#weap.Name])
for dir in ("Fore", "Left", "Right", "Rear", "Up"){
cells.push([#weap.at(dir, default: "-")])
}
}
let weaponTable = table(
columns: (3fr, 1fr, 1fr, 1fr, 1fr, 1fr),
table.cell(stroke: none)[],
[Fore],
[Left],
[Right],
[Rear],
[Up],
..cells,
)
place(top + left, box(width: 0pt, height: 0pt, hide[= #Ship.Name]))
grid(columns: 1, rows: (auto, 1fr, auto), grid.cell([
#ship_image
#ship_title
#v(0.5em)
]), grid.cell([#DescriptiveText
#v(1.5em)
]), grid.cell([
#statTable
#align(center)[#KochFont(size: 18pt)[Weapons]]
#weaponTable
#align(center)[#KochFont(size: 18pt)[Notes]]
#notes
]))
}
/// Defines the FlyingCircus Weapon card. Image optional.
///
/// - Weapon (str | dictionary): JSON string or dictionary representing the Weapon stats.
/// - Img (bytes | none): Image to go above the card. Set to none to remove.
/// - DescriptiveText (content): Goes below the name and above the stats table.
/// -> content
#let FCWeapon(Weapon, Img: none, DescriptiveText)={
let weapon = Weapon
//Read in json.decode file if it's a path
if (type(Weapon) == str) {
weapon = json.decode(Weapon)
}
place(top + left, box(width: 0pt, height: 0pt, hide[== #weapon.Name]))
MaybeImage(Img)
{
set text(fill: luma(100))
set block(spacing: 0.1em)
text(size: 20pt)[#weapon.Name]; h(1fr); weapon.Price
line(length: 100%, stroke: luma(100))
}
DescriptiveText
v(-1em)
let cells = ()
for (k, v) in Weapon.Cells {
cells.push(table.cell(fill: black)[#text(fill: white)[#k]])
cells.push([#v])
}
table(
columns: (1fr,) * (2 * Weapon.Cells.len()),
align: center + horizon,
..cells,
table.cell(align: left, colspan: (2 * Weapon.Cells.len()))[#Weapon.Tags],
)
}
#let HiddenHeading(body) = {
show heading: it => []
body
}
#let ac(a, b) = {
(a.at(0) + b.at(0), a.at(1) + b.at(1))
}
#let FCPSection(title, content) = {
block(
spacing: 0.4em,
inset: 2pt,
stroke: (bottom: 1pt),
)[#KochFont(size: 14pt)[#title]#h(1fr)#text(size: 10pt)[#emph[#content]]]
}
#let FCPRule() = {
context if (here().position().x.inches() < 5.5) {
block(spacing: 0.4em)[
#line(start: (-0.24in, 0pt), length: 100% + 0.4in)
]
} else {
block(spacing: 0.4em)[
#line(start: (-0.16in, 0pt), length: 100% + 0.4in)
]
}
}
#let FCPStatTable(name, tagline, stats) = {
set par(spacing: 0.6em)
block(stroke: (bottom: 0.5pt), inset: (bottom: 0.75pt))[#smallcaps[#name]]
emph[#tagline]
let cells = (table.hline(stroke: 2pt), table.vline(stroke: 2pt),)
let cells2 = ()
for (k, v) in stats {
cells.push(table.cell(fill: black)[#text(fill: white)[#smallcaps[#k]]])
cells2.push([#v])
}
cells.push(table.vline(stroke: 2pt))
cells2.push(table.hline(stroke: 2pt))
table(columns: (1fr,) * (stats.len()), align: center + horizon, ..cells, ..cells2)
}
#let FCPlaybook(
Name: str,
Subhead: str,
Character: content,
Questions: content,
Starting: content,
Stats: content,
StatNames: (),
Triggers: content,
Vents: content,
Intimacy: content,
Moves: content,
) = {
let pb_counter = counter("playbook")
pb_counter.update(0)
set page(
paper: "a4",
flipped: true,
//Header is nothing
header: none,
//For the Playbook the background contains the header and lines.
background: context{
cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
line((0, 0), (1, 0.7071), stroke: white)
let topl = (0.5in, 8in)
let topm = ac(topl, (5.35in, 0mm))
let topr = ac(topl, (10.7in, 0mm))
circle(topl, radius: 1.5mm, fill: black)
circle(topr, radius: 1.5mm, fill: black)
line(topl, topr)
line(ac(topl, (0mm, 1.5mm)), ac(topr, (0mm, 1.5mm)), stroke: 0.5mm)
line(ac(topl, (0mm, -1.5mm)), ac(topr, (0mm, -1.5mm)), stroke: 0.5mm)
line(topm, ac(topm, (0mm, -7.58in)))
set-style(stroke: (paint: black, thickness: 0.25mm))
line(ac(topl, (0.3mm, 0mm)), ac(topl, (0.3mm, -8in)))
line(ac(topl, (-0.3mm, 0mm)), ac(topl, (-0.3mm, -8in)))
line(ac(topr, (0.3mm, 0mm)), ac(topr, (0.3mm, -8in)))
line(ac(topr, (-0.3mm, 0mm)), ac(topr, (-0.3mm, -8in)))
if (pb_counter.get().at(0) == 0) {
rect(ac(topl, (0.3mm, -1.5mm)), ac(topm, (0mm, -2cm)), fill: black)
}
content(topm, KochFont(stroke: 8pt + white)[Flying Circus])
content(topm, KochFont(stroke: 0.25pt + black)[Flying Circus])
})
},
//Footer is alternating directions with page number at outside and only partial bar
footer: context{
align(center, cetz.canvas(length: 100%, {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.75mm))
circle((-.5, 0), radius: 1.5mm, fill: black)
circle((.5, 0), radius: 1.5mm, fill: black)
for x in range(-470, 500, step: 10){
line((x / 1000, -2mm), ((x - 20) / 1000, 2mm))
}
set-style(stroke: (paint: black, thickness: 0.25mm))
line((-.5, 0.5mm), (.5, 0.5mm))
line((-.5, -0.5mm), (.5, -0.5mm))
content((0, 0), KochFont(size: 20pt, stroke: 10pt + white)[#Name])
content((0, 0), KochFont(size: 20pt, stroke: 0.5pt + black)[#Name])
}))
},
//Margins, duh.
margin: (top: 0.5in, bottom: 0.75in, left: 0.75in, right: 0.75in),
)
set text(size: 11pt)
set par(justify: false)
set par(spacing: 0.8em)
set list(indent: 0pt, marker: [•], spacing: 0.4em)
let barwidth = 100% + 0.3in - 0.3mm
columns(2, gutter: 0.3in)[
#v(-.16in)
#align(center)[
#box(
width: barwidth,
inset: (left: 0.25in, right: 0.25in, top: 0.2cm, bottom: 0.2cm),
// outset:(top:0.16in),
)[
#set align(left)
#set text(fill: white)
#KochFont(size: 28pt)[#Name]\
#h(1fr)#KochFont(size: 18pt)[#Subhead]
]
]
#place(top + left, box(width: 0pt, height: 0pt, hide[= #Name]))
#Character
#colbreak()
#Questions
#FCPRule()
#Starting
#FCPRule()
#v(1fr)
#align(center)[
_Choose, and add +1 to a stat._
#columns(2, gutter: 0.5in)[
#Stats
]
]
]
pb_counter.step()
pagebreak()
columns(2, gutter: 0.5in)[
#box(width: 35%)[
#FCPSection("")[]
#KochFont(size: 14pt)[Name]
#columns(2, gutter: 0.1in)[
#FCPSection("")[]
#KochFont(size: 14pt)[Age]
#colbreak()
#FCPSection("")[]
#KochFont(size: 14pt)[Pronouns]
]
]#h(5%)#box(width: 60%)[
#cetz.canvas(length: (100% / (StatNames.len() + 1)), {
import cetz.draw:*
set-style(stroke: (paint: black, thickness: 0.5mm), content: (padding: 0.1))
line((0, -1cm), (0, 1cm), name: "L", stroke: (paint: white))
for (idx, sn) in StatNames.enumerate() {
circle((1.25 * idx + 0.5, 0.5), radius: 0.5, name: "S")
content((name: "S", anchor: "south"), [#sn], anchor: "north")
}
})
]
#FCPRule()
#box(baseline: -4pt)[#KochFont(size: 16pt)[Stress ]] #box(width: 60%)[#cetz.canvas(length: 100%, {
import cetz.draw:*
rect((0.4, -10pt), (1, 10pt), fill: black)
circle((0.05, 0), radius: 7pt, fill: white)
circle((0.15, 0), radius: 7pt, fill: white)
circle((0.25, 0), radius: 7pt, fill: white)
circle((0.35, 0), radius: 7pt, fill: white)
circle((0.45, 0), radius: 7pt, fill: white)
circle((0.55, 0), radius: 7pt, fill: white)
circle((0.65, 0), radius: 7pt, fill: white)
circle((0.75, 0), radius: 7pt, fill: white)
circle((0.85, 0), radius: 7pt, fill: white)
circle((0.95, 0), radius: 7pt, fill: white, stroke: (paint: white, dash: (0.5pt, 0.5pt), thickness: 0.03))
})] #box(baseline: -4pt)[#KochFont(size: 16pt)[XP ]] #box(width: 1fr)[#cetz.canvas(length: 100%, {
import cetz.draw:*
rect((0, -10pt), (1, 10pt))
})]
#columns(2)[
#Triggers
#colbreak()
#Vents
]
#FCPRule()
#grid(
columns: (auto, auto),
gutter: 1em,
grid.cell(inset: (bottom: 1em, right: 1em))[#FCPSection([Comrades#h(100fr)Trust?])[]
#align(right)[#text(size: 30pt)[
○\
○\
○\
○
]]],
grid.vline(),
grid.cell(inset: (bottom: 1em, left: 1em))[#FCPSection("Familiar Vices")[]
],
)
#FCPRule()
#Intimacy
#colbreak()
#Moves
]
}
#let FCShortNPC(plane, img: none, img_scale: 1.5, img_shift_dx: -10%, img_shift_dy: -10%, content) = {
let plane_title = {
set text(fill: luma(100))
set block(spacing: 0.1em)
let hN = plane.keys().contains("Price")
let hU = plane.keys().contains("Used")
let hUp = plane.keys().contains("Upkeep")
text(size: 20pt)[#plane.Name];h(1fr); if (hN) { [#plane.Price;þ New] }; if (hN and hU) { [, ] }; if (hU) { [#plane.Used;þ Used] }
line(length: 100%, stroke: luma(100))
[_\"#plane.Nickname\"_ #h(1fr); #if (hUp) { [#plane.Upkeep;þ Upkeep] }]
}
plane_title
grid(columns: (1fr, 3fr), grid.cell(
align: right,
place(auto, float: true, scope: "parent", dx: img_shift_dx, dy: img_shift_dy, cetz.canvas(length: 100%, {
import cetz.draw: *
content((0, 0.0), (img_scale, 1), img)
})),
), [
#emph(content)
#table(
align: center,
columns: (2fr, 1fr, 1fr),
[Speeds],
[Handling],
[Structure],
[#plane.Speeds],
[#plane.Handling],
[#plane.Structure],
table.cell(align: left, colspan: 3, plane.Notes),
)
])
}
#let FCShortAirship(airship, img: none, img_scale: 1.5, img_shift_dx: -10%, img_shift_dy: -10%, content) = {
let title = {
set text(fill: luma(100))
set block(spacing: 0.1em)
let hN = airship.keys().contains("Price")
let hU = airship.keys().contains("Used")
let hUp = airship.keys().contains("Upkeep")
text(size: 20pt)[#airship.Name];h(1fr); if (hN) { [#airship.Price;þ New] }; if (hN and hU) { [, ] }; if (hU) { [#airship.Used;þ Used] }
line(length: 100%, stroke: luma(100))
[_\"#airship.Nickname\"_ #h(1fr); #if (hUp) { [#airship.Upkeep;þ Upkeep] }]
}
title
grid(columns: (1fr, 3fr), grid.cell(
align: right,
place(auto, float: true, scope: "parent", dx: img_shift_dx, dy: img_shift_dy, cetz.canvas(length: 100%, {
import cetz.draw: *
content((0, 0.0), (img_scale, 1), img)
})),
), [
#emph(content)
#table(
align: center,
columns: (1fr, 1fr, 1fr, 1fr),
[Max Speed],
[Lift],
[Handling],
[Toughness],
[#airship.Speed],
[#airship.Lift],
[#airship.Handling],
[#airship.Toughness],
table.cell(align: left, colspan: 4, airship.Notes),
)
])
} |
https://github.com/El-Naizin/cv | https://raw.githubusercontent.com/El-Naizin/cv/main/modules_zh/education.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("教育经历")
#cvEntry(
title: [数据科学硕士],
society: [加利福尼亚大学洛杉矶分校],
date: [2018 - 2020],
location: [美国],
logo: "../src/logos/ucla.png",
description: list(
[论文: 使用机器学习算法和网络分析预测电信行业的客户流失],
[课程: 大数据系统与技术 #hBar() 数据挖掘与探索 #hBar() 自然语言处理]
)
)
#cvEntry(
title: [计算机科学学士],
society: [加利福尼亚大学洛杉矶分校],
date: [2014 - 2018],
location: [美国],
logo: "../src/logos/ucla.png",
description: list(
[论文: 探索使用机器学习算法预测股票价格: 回归与时间序列模型的比较研究],
[课程: 数据库系统 #hBar() 计算机网络 #hBar() 软件工程 #hBar() 人工智能]
)
)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/game-theoryst/0.1.0/src/nfg.typ | typst | Apache License 2.0 | #import table: cell
#set cell(fill: none)
#import "utils/programming_utils.typ": *
#import "utils/styling_utils.typ": *
#import "utils/table_utils.typ": *
#import "@preview/pinit:0.1.4": *
// State + setting function for black-white vs color
#let _bw = state("no-colors", false)
#let colorless(bw: true) = _bw.update(bw)
// Counter, needed for pin IDs
#let _nfg-counter = counter("nfg-counter")
/* Main function to make normal/strategic form games */
// ..args represents payoffs
// "pad": Pads cells with additional space, helpful for underlines
// "lazy-cells": don't equalize cell dimensions
// Note: This function requires context in order to equalize cell lengths.
// --It's possible that the scope of the context could be reduced at a later point through refactoring
#let nfg(
players: ("A", "B"),
s1: ($x$, $y$),
s2: ($a$, $b$),
mixings: none,
eliminations: none,
ejust: (:), // -ex: (s11: (x: (0,0), y: (0,0)))
gid: none,
pad: none,
lazy-cells: false,
bw: none,
custom-fills: (:),
// opts: (:), // --Other options, tbd
..args
) = context {
let nrow = s1.len()
let ncol = s2.len()
let payoffs = args.pos()
let (S1, S2) = (s1, s2)
/* Colors */
let colors = (
hp: red, vp: blue, //players
hm: "#e64173", vm: eastern, //mixings
he: orange, ve: olive //elim-lines
)
for p in custom-fills.pairs() { colors.insert(..p) }
let bw = if-none(bw, _bw.get(), bw)
colors = if-else(bw, colors.keys().map(k => (str(k): black)).join(), colors)
// Previous version, easier to understand:
// for (k,v) in colors.pairs() {
// if bw {colors.at(k) = black}
// }
/* Mixed Strategies */
let (hmix, vmix) = {
if type(mixings) == "array" {
assert(mixings.len() == 2, message: "`mixings` must be a dictionary or an array of length 2")
mixings
} else if type(mixings) == "dictionary" {
assert(("hmix", "vmix").any(k => k in mixings.keys()), message: "Must provide one of (`hmix`, `vmix`) keys to mixings")
let dmixings = (hmix: none, vmix: none)
for p in mixings.pairs() { dmixings.insert(..p) }
(dmixings.hmix, dmixings.vmix)
} else {
(none, none)
}
}
let (x-col-w, x-row-h) = {
(hmix, vmix)
.map(mix => if-none(mix, 0pt, auto))
}
hmix = if-none(hmix, ([],) * nrow, hmix)
.map(m => mixd(color: colors.hm, m))
vmix = if-none(vmix, ([],) * ncol, vmix)
.map(m => mixd(color: colors.vm, m))
/* Equalize Cell Dims. */
// Get array of content widths and heights
let (warray, harray) = {
(s2 + vmix, s1 + hmix)
.map(strat =>
(strat + payoffs)
.map(ent => measure(ent))
)
}
// Compute maximums
let (cw, rh) = (
10pt + warray.fold(0pt, (acc, val) => calc.max(acc, val.width)),
10pt + harray.fold(0pt, (acc, val) => calc.max(acc, val.height))
)
/* Additional Padding */
// Format pad => cpad arg
let cpad = {
if type(pad) == "array" {
assert(pad.len() == 2, message: "When padding is an array, it must be of length 2")
("x": pad.at(0), "y": pad.at(1))
} else if type(pad) == "length" {
("x": pad, "y": pad)
} else if type(pad) == "dictionary" {
req-keys(pad, ("x", "y"))
} else { req-keys((:), ("x", "y")) }
}
// Add padding, account for lazy sizing
(cw, rh) = if-else(
lazy-cells,
(auto, auto),
(cw + cpad.at("x"), rh + cpad.at("y"))
)
// Function to build cells w. default padding
// Also allows lazy-cells + custom padding
let pad-cell(dinset, body) = {
let sinset = if-else(
cpad != (none, none) and lazy-cells,
(x: 5pt + cpad.at("x"), y: 5pt + cpad.at("y")),
dinset
)
cell(inset: sinset, body)
}
/* Eliminations */
let pin-names = if-none(eliminations, (), eliminations)
let pin-strats = if-none(eliminations, (), eliminations)
let elim-id = if-none(gid, "nfg" + _nfg-counter.display() + "-", gid)
for strat-name in pin-strats {
let e = int(strat-name.at(2))
if (strat-name.at(1) == "1") {
S1.at(e - 1) = S1.at(e - 1) + pin(elim-id + strat-name + "--start")
payoffs.at( (e * ncol) - 1 ) = payoffs.at( (e * ncol) - 1 ) + pin(elim-id + strat-name + "--end")
} else {
S2.at(e - 1) = S2.at(e - 1) + pin(elim-id + strat-name + "--start")
payoffs.at( (nrow * ncol) - (ncol - (e - 1)) ) = payoffs.at( (nrow * ncol) - (ncol - (e - 1)) ) + pin(elim-id + strat-name + "--end")
}
}
// Elimination Adjustments
let eljust = (:)
for name in pin-strats {
eljust.insert(name, (x: (0pt, 0pt), y: (0pt, 0pt)))
if name in ejust.keys() {
for p in ejust.at(name).pairs() {
eljust.at(name).insert(..p)
}}
}
/* Make NFG */
table(
stroke: (x, y) => {strf(x, y)},
align: (x, y) => {alif(x, y)},
rows: ((auto, x-row-h, auto), ((rh,) * nrow)).join(),
columns: ((auto, x-col-w ,auto), ((cw,) * ncol)).join(),
p2(players.at(1), color: colors.vp, cspn: ncol),
blank-cells(), ..(vmix.map(m => { pad-cell((top: 1pt), m) })),
blank-cells(), ..S2.map(s => pad-cell((top: 1pt), s)),
p1(players.at(0), color: colors.hp, rspn: nrow),
..for i in range(0, nrow) {
(pad-cell(0pt, hmix.at(i)), pad-cell(auto, S1.at(i)), ..range(0, ncol).map(j => payoffs.at(i * ncol + j)))
}
)
/* Draw Eliminations */
for el-strat-name in pin-strats {
let fill = if-else(el-strat-name.at(1) == "1", colors.he, colors.ve)
let this-just = eljust.at(el-strat-name)
pinit-line(
stroke: fill,
start-dx: this-just.x.at(0),
end-dx: this-just.x.at(1),
start-dy: this-just.y.at(0),
end-dy: this-just.y.at(1),
elim-id + el-strat-name + "--start",
elim-id + el-strat-name + "--end",
)
}
_nfg-counter.step()
} |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/root_01.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test root size with radicals containing attachments.
$ sqrt(a) quad
sqrt(f) quad
sqrt(q) quad
sqrt(a^2) \
sqrt(n_0) quad
sqrt(b^()) quad
sqrt(b^2) quad
sqrt(q_1^2) $
|
https://github.com/xkevio/parcio-typst | https://raw.githubusercontent.com/xkevio/parcio-typst/main/parcio-thesis/chapters/background/background.typ | typst | MIT License | #import "../../template/template.typ": parcio-table, section
= Background<bg>
_In this chapter, ..._
== Citations
You can comfortably reference literature @DuweLMSF0B020.#footnote[This is a footnote.] BibTeX entries for a large number of publications can be found at https://dblp.org/. @girshick_fast_2015
== Tables
// Either use `parcio-table` for special tables (with an extra argument at the start, max-rows) or just use the normal `table` function and style it however you like.
#figure(caption: "Caption")[
#parcio-table(3, columns: 3, align: (left, center, right),
[*Header 1*], [*Header 2*], [*Header 3*],
[Row 1],[Row 1],[Row 1],
[Row 2],[Row 2],[Row 2],
)
]<tbl:tb1>
You can also refer to tables (@tbl:tb1).
== Math<m>
$ E = m c^2 $<eq:eq1>
\
#section[Summary]
#lorem(80) |
https://github.com/ymgyt/techbook | https://raw.githubusercontent.com/ymgyt/techbook/master/programmings/js/typescript/specification/function.md | markdown | # function
```typescript
function increment(num: number): number {
return num + 1;
}
```
## arrow function
```typescript
const hello = (num: number): number => num + 1;
```
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/features_02.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test alternates and stylistic sets.
#set text(font: "IBM Plex Serif")
a vs #text(alternates: true)[a] \
ß vs #text(stylistic-set: 5)[ß]
|
https://github.com/ustctug/ustc-thesis-typst | https://raw.githubusercontent.com/ustctug/ustc-thesis-typst/main/chapters/abstract.typ | typst | MIT License | #block[
This is a sample document of USTC thesis LaTeX template for bachelor,
master and doctor. The template is created by zepinglee and seisman,
which orignate from the template created by ywg. The template meets the
equirements of USTC thesis writing standards.
This document will show the usage of basic commands provided by LaTeX
and some features provided by the template. For more information, please
refer to the template document ustcthesis.pdf.
]
|
https://github.com/EGmux/ControlTheory-2023.2 | https://raw.githubusercontent.com/EGmux/ControlTheory-2023.2/main/unit3/main.typ | typst | #include "./stabilitiy.typ"
#include "./timeresponse.typ"
#include "./errors.typ"
#include "./lugarRaizes.typ"
#include "./rootLocusProject.typ"
|
|
https://github.com/yan-aint-nickname/uni | https://raw.githubusercontent.com/yan-aint-nickname/uni/main/computer-networks/cm1/main.typ | typst | MIT License | #import "template.typ": *
#import "@preview/codelst:2.0.1": sourcecode, sourcefile
// Take a look at the file `template.typ` in the file panel
// to customize this template and discover how it works.
#show: project.with(
title: "Компьютерные сети. КМ-1",
authors: (
"<NAME>. ИДз-21-21. Вариант 8.",
),
)
#show figure: set block(breakable: true)
= Задание
Имеется симметричная матрица взвешенных расстояний $M(6,6)$, элементы
$m_(i j)$ которой заданы так: $m_(i j) = N + 3 times i times j$ при $i eq.not j$, $m_(i j) = infinity$ при $i = j$,
где $N$ – последняя цифра номера зачётной книжки студента. Используя алгоритм Прима, определить древовидную связную сеть, имеющую наименьшую суммарную внешнюю длину (в качестве ответа привести матрицу результатов расчёта структуры).
#let N = 8
#let fill_value(i, j) = (
if i == j { $infinity$ }
else { N + 3*i*j }
)
#let data = (1, 2, 3, 4, 5, 6).map(i => ((1, 2, 3, 4, 5, 6).map(j => fill_value(i, j)) ))
#let matrix = math.mat(..data)
== Построение матрицы весов
$ M = #matrix $
== Применение алгоритма Прима
1. Выбираем любую вершину для начала (например, вершину 1). Включаем её в остовное дерево.
2. Из оставшихся вершин выбираем ребро с наименьшим весом, соединяющее одну из уже включенных вершин с одной из оставшихся. Повторяем до тех пор, пока все вершины не будут включены.
=== Решение
Начинаем с вершины 1
1. Включаем вершину 2\
Минимальное ребро — (1,2) с весом 14.
2. Включаем вершину 3\
Минимальное ребро из оставшихся — (1,3) с весом 17.
3. Включаем вершину 4\
Минимальное ребро из оставшихся — (1,4) с весом 20.
4. Включаем вершину 5\
Минимальное ребро из оставшихся — (1,5) с весом 23.
5. Включаем вершину 6\
Минимальное ребро из оставшихся — (1,6) с весом 26.
#let v = (14, 17, 20, 23, 26)
#let enumerated_rows = data.enumerate()
== Результирующая матрица остовного дерева
$ M_("остов") = mat(
0, 1, 1, 1, 1, 1;
1, 0, 0, 0, 0, 0;
1, 0, 0, 0, 0, 0;
1, 0, 0, 0, 0, 0;
1, 0, 0, 0, 0, 0;
1, 0, 0, 0, 0, 0;
) $
== Итоговая длина сети
$14+17+20+23+26=100$
Для самопроверки я написал программу
=== Код программы
#figure(
caption: "Алгоритм Прима main.c",
sourcefile(
file: "main.c",
read("main.c"),
)
)
Для сборки программы я использовал встроенный компилятор `zig cc`, он совместим с `clang`
Для запуска программы выполнить команду
```sh
zig cc main.c && ./a.out
```
На википедии наглядно показано как работает алгоритм.#footnote(link("https://ru.wikipedia.org/wiki/Алгоритм_Прима"))
Оригинальная реализация алгоритма. #footnote(link("https://the-algorithms.com/algorithm/prims-minimum-spanning-tree"))
Полный код работы содержится в репозитории.#footnote(link("https://github.com/yan-aint-nickname/uni/tree/main/computer-networks/cm1"))
|
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/typstfmt/113-math-indent.typ | typst | Apache License 2.0 | $
EE_(i_k ~ "Unif"({1,...,d}))[f(x x_(k+1)) - f(x x_k)]
&<= sum_(i=1)^d 1/d (delta nabla_i f(x_k) + L_i/2 delta^2) \
&= 1/d sum_(i=1)^d (-alpha_i_k nabla_i f(x_k)^2 + alpha^2_i_k L_i/2 nabla_i f(x_k)^2) \
&= 1/d sum_(i=1)^d (-alpha_i_k + alpha^2_i_k L_i/2) nabla_i f(x_k)^2 \
$
|
https://github.com/liuzhuan/reading-list | https://raw.githubusercontent.com/liuzhuan/reading-list/master/templates/notes.typ | typst | #let notes(doc) = {
set page(
paper: "a4",
margin: (
x: 4em,
y: 3em,
),
numbering: "1"
)
outline(
title: "目录",
indent: auto
)
set text(11pt, font: "Songti SC")
show heading.where(level: 1): set heading(
numbering: "第 1 章"
)
show heading.where(level: 2): set heading(
numbering: "1.1"
)
show heading.where(level: 3): set heading(
numbering: "1.1"
)
[#doc]
}
|
|
https://github.com/Toniolo-Marco/git-for-dummies | https://raw.githubusercontent.com/Toniolo-Marco/git-for-dummies/main/book/components/git-graph.typ | typst | #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge, shapes, draw
#import fletcher.shapes: diamond
#import "multi-label.typ" : multi_label
#import "utils.typ": alignment_to_coordinates, generate_label
#let branch_indicator(name, start, color, remote: none, lbl_stroke: (1pt+white)) = {
let near = (start.at(0)+0.25,start.at(1))
if remote == none {
// Single label node
node(near, [#name], corner-radius: 2pt, fill: color, stroke: lbl_stroke)
} else if type(remote) == "string" {
// Double label node
node(near,multi_label((name,remote),lbl_stroke).node,inset:0pt, corner-radius:3pt, fill: color, stroke: lbl_stroke)
} else if type(remote) == array {
// Multi label node
remote.insert(0,name)
node(near,multi_label(remote,lbl_stroke).node,inset:0pt, corner-radius:3pt, fill: color, stroke: lbl_stroke)
}
}
#let commit_node(position, color, out_radius, inner_radius, name) = {
node(position, "", name: name, radius: out_radius, stroke: color,extrude: 0, outset: 0.099em)
node(position, "", name: name, radius: inner_radius, fill: color, stroke: none)
}
#let branch(
name:"",
remote: none,
indicator-xy:none,
color:black,
start:(0,1),
length:1,
nodes_out_radius:1.5em,
nodes_inner_radius: 1em,
head:none,
alignment:top,
angle: 90deg,
commits: none) = {
// branch indicator
if indicator-xy != none {
branch_indicator(name, indicator-xy, color,remote: remote)
} else {
branch_indicator(name, start, color, remote: remote)
}
let x = start.at(0) + 1 // x node coordinate
let i = 0 // position index
// default branch
if commits == none {
// makes an array of commits with no message
commits = range(length).map(_ => "")
}
for c in commits {
if c != none { //if there is a commit
// generate node label
let lbl = generate_label(branch:name,commit-number:i)
// draw the node
if(head != none and i == head) {
commit_node((x,start.at(1)),color,nodes_out_radius,nodes_out_radius,lbl)
} else {
commit_node((x,start.at(1)),color,nodes_out_radius,nodes_inner_radius,lbl)
}
// make the message
if type(c) == "string" and c.len() > 0 {
let lbl = generate_label(branch:name,commit-number: i)
node(
(rel: alignment_to_coordinates(alignment), to: lbl),
[#rotate(angle,[#c])],
stroke: 0pt,
inset:0pt,
outset: 0pt
)
}
}
// draw edge between nodes
if i < length - 1 {
edge((x,start.at(1)), (x+1,start.at(1)), stroke: 2pt+color)
}
i = i + 1
x = x + 1
}
}
#let connect_nodes(start, end, edge_stroke, bend: -20deg) = {
if type(edge_stroke) == color {
edge(start, end, stroke: 2pt+edge_stroke, bend: bend)
}
else if type(edge_stroke) == stroke {
edge(start, end, edge_stroke,bend: bend)
}
} |
|
https://github.com/QuadnucYard/cswc-lecture-report-typst | https://raw.githubusercontent.com/QuadnucYard/cswc-lecture-report-typst/main/lib.typ | typst | MIT License | #let lec-report(doc, stu-id: [], stu-name: [], time: [], loc: [], speaker: [], subject: []) = {
set page(margin: (top: 1in, bottom: 1in, left: 1.25in, right: 1.25in))
set text(font: "FangSong", size: 16pt)
set par(leading: 1em)
let title = text(font: "SimSun", size: 20pt, stroke: 0.5pt)[人文讲座听课报告]
let body = {
set text(font: ("Times New Roman", "SimSun"), size: 10.5pt)
set par(justify: true, first-line-indent: 2em, leading: 18pt - 1em)
set block(spacing: 18pt - 1em)
v(-0.5em)
doc
}
let remark = [
#set text(font: "Microsoft YaHei", size: 9pt, fill: rgb(192, 0, 0))
#set par(justify: true)
该报告请提交电子版。在吴健雄学院开设的“高端人文讲座系列”(讲座预告中会标注)中选听,每场完成 1 篇《听课报告》,通过网上系统完成报名、签到、提交报告,第3学年结束前进行审核。
]
table(
columns: (2.8cm, 1fr, 2.75cm, 1fr),
rows: (auto, auto, auto, 1fr, auto),
align: center + horizon,
inset: (x: 0em, y: 0.7em),
table.cell(colspan: 4, stroke: none, inset: (y: 1em), title),
[学号+姓名],
[#stu-id#stu-name],
[时间地点],
block[#time \ #loc],
[主讲人],
speaker,
[讲座题目],
subject,
[讲座摘要及听讲心得(参考字数:500字左右)],
table.cell(colspan: 3, align: top + start, body),
[说明],
table.cell(colspan: 3, align: left, inset: (y: 0.7em), remark),
)
}
|
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/themes/bipartite.typ | typst | // This theme is inspired by https://slidesgo.com/theme/modern-annual-report
#import "../logic.typ"
#let bipartite-dark = rgb("#192e41")
#let bipartite-bright = rgb("#fafafa")
#let bipartite-accent = rgb("#fc9278")
#let bipartite-theme(
aspect-ratio: "16-9",
body
) = {
set page(
paper: "presentation-" + aspect-ratio,
margin: 0pt,
)
body
}
#let title-slide(title: [], subtitle: none, author: [], date: none) = {
let title-block(fg, bg, height, body) = block(
width: 100%, height: height, outset: 0em, inset: 0em, breakable: false,
stroke: none, spacing: 0em, fill: bg,
align(center + horizon, text(fill: fg, body))
)
let content = {
title-block(bipartite-dark, bipartite-bright, 60%, text(1.7em, title))
title-block(bipartite-bright, bipartite-dark, 40%, {
if subtitle != none {
text(size: 1.2em, subtitle)
parbreak()
}
text(size: .9em, { author; if date != none { h(1em); sym.dot.c; h(1em); date } })
})
place(
center + horizon, dy: 10%,
rect(width: 6em, height: .5em, radius: .25em, fill: bipartite-accent)
)
}
logic.polylux-slide(content)
}
#let _bipartite-content-box(fg, bg, width, alignment, body) = box(
width: width, height: 100%, outset: 0em, inset: (x: 1em), baseline: 0em,
stroke: none, fill: bg,
align(alignment + horizon, text(fill: fg, body))
)
#let west-slide(title: none, body) = {
let content = {
_bipartite-content-box(
bipartite-bright, bipartite-dark, 30%, left,
if title != none { heading(level: 2, title) } else { [] }
)
_bipartite-content-box(bipartite-dark, bipartite-bright, 70%, left, body)
}
logic.polylux-slide(content)
}
#let east-slide(title: none, body) = {
let content = {
_bipartite-content-box(bipartite-dark, bipartite-bright, 70%, right, body)
_bipartite-content-box(
bipartite-bright, bipartite-dark, 30%, right,
if title != none { heading(level: 2, title) } else { [] }
)
}
logic.polylux-slide(content)
}
#let split-slide(body-left, body-right) = {
let content = {
_bipartite-content-box(bipartite-dark, bipartite-bright, 50%, right, body-left)
_bipartite-content-box(bipartite-bright, bipartite-dark, 50%, left, body-right)
}
logic.polylux-slide(content)
}
|
|
https://github.com/catg-umag/inach-workshop-2024 | https://raw.githubusercontent.com/catg-umag/inach-workshop-2024/main/document/sections/1_working_env.typ | typst | #import "@preview/gentle-clues:1.0.0": *
#import "../catgconf.typ": cmd
= Entorno de Trabajo
== Línea de comandos
La línea de comandos es una interfaz de texto que permite interactuar con el sistema operativo mediante comandos. Es fundamental al procesar datos bioinformáticos, ya que muchas herramientas carecen de interfaz gráfica y el uso de la terminal facilita la automatización y ejecución de tareas en entornos HPC o en la nube.
Un comando es una instrucción que se escribe en la terminal y se ejecuta al presionar #cmd(`Enter`). La estructura típica de un comando es:
```sh
comando [subcomando] [opciones] <argumentos>
```
Los #cmd(`<argumentos>`) suelen ser archivos de entrada y salida, mientras que las #cmd(`opciones`) modifican el comportamiento del comando. Estas pueden ser largas (#cmd(`--opcion`)) o cortas (#cmd(`-o`)), y pueden requerir argumentos. Finalmente, algunos comandos poseen #cmd(`[subcomandos]`), que permiten realizar tareas específicas.
#tip(title: "Ayuda en comandos")[
Para obtener ayuda sobre un comando, utiliza #cmd(`--help`) o #cmd(`-h`). Por ejemplo: #cmd(`git --help`).
Los corchetes (#cmd(`[ ]`)) indican argumentos opcionales, mientras que los obligatorios se escriben con corchetes angulares (#cmd(`< >`)) o sin ellos.
]
== Interacción con archivos en Linux
Para ejecutar herramientas desde la terminal, es necesario saber cómo encontrar y manipular archivos. A continuación, se presentan algunos de los comandos más básicos para interactuar con archivos en Linux.
#heading([#cmd(`ls`) -- Listar archivos y directorios], depth: 3, numbering: none)
```sh
ls # Muestra los archivos en el directorio actual
ls -l # Muestra detalles de los archivos
ls -a # Incluye archivos ocultos en la lista
```
#heading([#cmd(`pwd`) -- Imprimir el directorio actual], depth: 3, numbering: none)
```sh
pwd
```
#heading([#cmd(`cd`) -- Cambiar de directorio], depth: 3, numbering: none)
```sh
cd data # Entra a la carpeta indicada
cd .. # Sube un nivel en el árbol de directorios
cd ../.. # Sube dos niveles
cd ~ # Regresa al directorio de inicio
```
#heading([#cmd(`cp`) -- Copiar archivos o directorios], depth: 3, numbering: none)
```sh
cp config.yaml analisis/ # Copia el archivo a la ubicación destino
cp -r results results_bak # Copia una carpeta y su contenido
```
#heading([#cmd(`mv`) -- Mover o renombrar archivos], depth: 3, numbering: none)
```sh
mv sample01.fastq data/ # Mueve el archivo al destino
mv config.test.txt config.txt # Cambia el nombre del archivo
```
#pagebreak()
#heading([#cmd(`rm`) -- Eliminar archivos o directorios], depth: 3, numbering: none)
```sh
rm test.txt # Elimina el archivo
rm -r tmp # Elimina una carpeta y su contenido
```
#heading([#cmd(`mkdir`) -- Crear directorios], depth: 3, numbering: none)
```sh
mkdir data # Crea un directorio en la ubicación actual
mkdir -p analysis/quality # Crea directorios anidados
```
#heading([#cmd(`head`) / #cmd(`tail`) / #cmd(`less`) -- Visualizar el contenido de archivos], depth: 3, numbering: none)
```sh
less sequences.fasta # Permite desplazarse por el contenido
head -n 10 sequences.fasta # Muestra las primeras 10 líneas
tail -n 5 sequences.fasta # Muestra las últimas 5 líneas
```
#heading([Redirección de salida], depth: 3, numbering: none)
```sh
head -n 100 sequences.fa > subset.fa # Guarda la salida del comando ejecutado en un archivo
```
== Tipos de archivos relevantes al procesar datos bioinformáticos
#align(
center,
table(
columns: 3,
align: (center, center, left),
table.header([Tipo], [Extensión], [Contenido]),
[FASTA], [#cmd(`.fasta`) #cmd(`.fa`) #cmd(`.fna`) #cmd(`.fsa`) #cmd(`.faa`)], [Secuencias biológicas],
[FASTQ], [#cmd(`.fastq`) #cmd(`.fq`)], [Secuencias biológicas con calidad],
[BAM], [#cmd(`.bam`) #cmd(`.ubam`)], [Alineamiento de secuencias contra una referencia (comprimido)],
[POD5], [#cmd(`.pod5`)], [Datos crudos de Oxford Nanopore],
[CSV / TSV], [#cmd(`.csv`) #cmd(`.tsv`)], [Datos tabulares separados por comas (CSV) o tabulaciones (TSV)],
[YAML], [#cmd(`.yaml`) #cmd(`.yml`)], [Datos estructurados en formato YAML],
),
)
#tip(title: "Archivos comprimidos")[
Es común comprimir los archivos para ahorrar espacio de almacenamiento. Los archivos comprimidos generalmente tienen la extensión adicional #cmd(`.gz`). Para descomprimirlos, debes utilizar el comando #cmd(`gunzip`).
```sh
gunzip sequences.fastq.gz # Descomprime el archivo
head sequences.fastq # Visualiza las primeras líneas del archivo descomprimido
```
]
== Gestión de entorno de trabajo con mamba
Mamba es un gestor de paquetes que facilita la instalación y gestión de paquetes de Python y R, y también herramientas bioinformáticas. Estos paquetes se instalan en 'ambientes', entornos de trabajo aislados y reproducibles que mantienen la instalación de paquetes separada de otros ambientes y del sistema operativo. Los ambientes pueden activarse y desactivarse según sea necesario. Los paquetes están disponibles en 'canales', destacando #link("https://conda-forge.org/")[conda-forge] para paquetes de Python y R y #link("https://bioconda.github.io/")[bioconda] para herramientas bioinformáticas.
Algunas de las tareas más comunes que se pueden realizar con Mamba son:
#heading([Listar, crear y eliminar ambientes], depth: 3, numbering: none)
```sh
mamba env list # Lista los ambientes disponibles
mamba create -n qc # Crea un ambiente llamado 'qc'
mamba env remove -n analysis # Elimina el ambiente 'analysis'
```
#pagebreak()
#heading([Activar y desactivar ambientes], depth: 3, numbering: none)
```sh
mamba activate qc # Activa el ambiente 'qc'
mamba deactivate # Desactiva el ambiente activo
```
#heading([Gestionar paquetes], depth: 3, numbering: none)
```sh
mamba list # Lista los paquetes instalados en el ambiente activo
mamba install python # Instala Python en el ambiente activo si no está presente
mamba install bioconda::samtools # Instala el paquete 'samtools' desde el canal 'bioconda'
mamba install bioconda::nanoq=0.9.0 # Instala una versión específica del paquete 'nanoq'
mamba update nanoq # Actualiza el paquete 'nanoq'
mamba remove samtools # Desinstala el paquete 'samtools'
```
#heading([Exportar e importar ambientes], depth: 3, numbering: none)
```sh
mamba env export -n qc > qc.yaml # Exporta el ambiente 'qc' a un archivo YAML
mamba env create -f qc.yaml # Crea un ambiente a partir del archivo YAML
```
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/codelst/0.0.3/manual.typ | typst | Apache License 2.0 | #import "@local/mantys:0.0.2": *
#show: mantys.with(
name: "codelst",
title: "The codelst Package",
subtitle: [A *Typst* package to render source code],
authors: "<NAME>",
url: "https://github.com/jneug/typst-codelst",
version: "0.0.3",
date: "2023-07-19",
abstract: [
#pkg[codelst] is a *Typst* package inspired by LaTeX package like #pkg[listings]. It adds functionality to render source code with line numbers, highlighted lines and more.
],
example-imports: ("@local/codelst:0.0.3": "*")
)
#import "codelst.typ"
#let footlink( url, label ) = [#link(url, label)#footnote(link(url))]
#let gitlink( repo ) = footlink("https://github.com/" + repo, repo)
// End preamble
= About
This package was created to render source code on my exercise sheets for my computer science classes. The exercises required source code to be set with line numbers that could be referenced from other parts of the document, to highlight certain lines and to load code from files into my documents.
Since I used LaTeX before, I got inspired by packages like #footlink("https://ctan.org/pkg/listings", pkg("listings")) and attempted to replicate some of its functionality. CODELST is the result of this effort.
= Usage
== Use as a package (Typst 0.6.0 and later)
For Typst 0.6.0 and later CODELST can be imported from the preview repository:
#sourcecode(linenos: false)[```typ
#import "@preview/codelst:0.0.3": sourcecode
```]
Alternatively, the package can be downloaded and saved into the system dependent local package repository.
Either download the current release from GitHub#footnote[#link("https://github.com/jneug/typst-codelst/releases/latest")] and unpack the archive into your system dependent local repository folder#footnote[#link("https://github.com/typst/packages#local-packages")] or clone it directly:
#sourcecode(linenos: false)[
```shell-unix-generic
git clone https://github.com/jneug/typst-codelst.git codelst-0.0.3
```]
In either case, make sure the files are placed in a folder with the correct version number: `codelst-0.0.3`
After installing the package, just import it inside your `typ` file:
#sourcecode(linenos: false)[```typ
#import "@local/codelst:0.0.3": sourcecode
```]
== Use as a module
To use CODELST as a module for one project, get the file `codelst.typ` from the repository and save it in your project folder.
Import the module as usual:
#sourcecode(linenos: false)[```typ
#import "codelst.typ": sourcecode
```]
== Rendering source code
CODELST adds the #cmd[sourcecode] command with various options to render code blocks. It wraps around any #cmd-[raw] block to add some functionality and formatting options to it:
#example(raw("#sourcecode[```typ
#show \"ArtosFlow\": name => box[
#box(image(
\"logo.svg\",
height: 0.7em,
))
#name
]
This report is embedded in the
ArtosFlow project. ArtosFlow is a
project of the Artos Institute.
```]"))
Line numbers are added to the output, but not much more. CODELST refrains from adding formatting to allow easy integration in templates. On the other hand, the package gives some easy ways to change the output of the source code.
Line numbers can be formatted in different ways:
#example(raw("#sourcecode(
numbers-side: right,
numbers-format: \"I\",
numbers-start: 10,
numbers-style: (i) => align(right, text(fill:blue, emph(i))),
)[```typ
#show \"ArtosFlow\": name => box[
#box(image(
\"logo.svg\",
height: 0.7em,
))
#name
]
This report is embedded in the
ArtosFlow project. ArtosFlow is a
project of the Artos Institute.
```]"))
It is common to highlight code blocks by putting them inside a #cmd-[block] element. This can be done individually or for all source code with a #var-[show] rule:
#example(raw("#show <codelst>: (code) => block(fill:luma(245), stroke:1pt+luma(120), radius: 4pt, inset:(x:10pt, y: 5pt), code)
#sourcecode[```typ
#show \"ArtosFlow\": name => box[
#box(image(
\"logo.svg\",
height: 0.7em,
))
#name
]
This report is embedded in the
ArtosFlow project. ArtosFlow is a
project of the Artos Institute.
```]"))
Line numbers can be formatted globally in a similar way:
#example(raw("#show <lineno>: (no) => no.counter.display((n, ..args) => text(fill:luma(120), size:10pt, emph(str(n)) + sym.arrow.r))
#sourcecode(gutter:2em)[```typ
#show \"ArtosFlow\": name => box[
#box(image(
\"logo.svg\",
height: 0.7em,
))
#name
]
This report is embedded in the
ArtosFlow project. ArtosFlow is a
project of the Artos Institute.
```]"))
CODELST handles whitespace in the code to save space and view the code as intended (and indented), even if tabs are used:
#example(raw("#sourcecode[```java
class HelloWorld {
public static void main( String[] args ) {
System.out.println(\"Hello World!\");
}
}
```]"))
Unnecessary blank lines at the beginning and end will be removed, alongside superfluous indention:
#example(raw("#sourcecode[```java
class HelloWorld {
public static void main( String[] args ) {
System.out.println(\"Hello World!\");
}
}
```]"))[#codelst.sourcecode[```java
class HelloWorld {
public static void main( String[] args ) {
System.out.println("Hello World!");
}
}
```]]
This behavior can be disabled or modified:
#example(raw("#sourcecode(showlines:true, gobble:false)[```java
class HelloWorld {
public static void main( String[] args ) {
System.out.println(\"Hello World!\");
}
}
```]"))[#codelst.sourcecode(showlines:true, gobble:false, tab-indent:2)[```java
class HelloWorld {
public static void main( String[] args ) {
System.out.println("Hello World!");
}
}
```]]
To show code from a file load it with #cmd[read] and pass the result to #cmd[sourcefile]:
#example(raw("#sourcefile(read(\"typst.toml\"), lang:\"toml\")"))[
#codelst.sourcefile(read("typst.toml"), lang:"toml")
]
#cmd-[sourcefile] takes the same arguments as #cmd-[sourcecode]. For example, to limit the output to a range of lines:
#example(raw("#sourcefile(
showrange: (2, 4),
read(\"typst.toml\"),
lang:\"toml\"
)"))[
#codelst.sourcefile(
showrange: (2, 4),
read("typst.toml"),
lang:"toml"
)
]
Specific lines can be highlighted:
#example(raw("#sourcefile(
highlighted: (2, 3, 4),
read(\"typst.toml\"),
lang:\"toml\"
)"))[
#codelst.sourcefile(
highlighted: (2, 3, 4),
read("typst.toml"),
lang:"toml",
)
]
To reference a line from other parts of the document, CODELST looks for labels in the source code and makes them available to Typst. The regex to look for labels can be modified to accommodate different syntaxes:
#example(raw("#sourcefile(
label-regex: regex(\"\\\"(codelst.typ)\\\"\"),
highlight-labels: true,
highlight-color: lime,
read(\"typst.toml\"),
lang:\"toml\"
)
See #lineref(<codelst.typ>) for the _entrypoint_."))[
#codelst.sourcefile(
label-regex: regex("(codelst.typ)"),
highlight-labels: true,
highlight-color: lime,
read("typst.toml"),
lang:"toml"
)
See #codelst.lineref(<codelst.typ>) for the _entrypoint_.
]
== Formatting
As shown above, source code and line numbers can be formatted using #var-[show] rules.
#sourcecode(```typ
#show <lineno>: (i) => i.counter.display("I")
#show <codelst>: (code) => block(fill:luma(245), code)
```)
Though CODELST does not impose some default formatting by default, it provides the two commands #cmd[number-style] and #cmd[code-frame] to quickly apply some styling to source code:
#sourcecode(```typ
#show <lineno>: number-style
#show <codelst>: code-frame
```)
#ibox[Remember to import the commands first:
```typ
#import "@preview/codelst:0.0.3": sourcecode, number-style, code-frame
```]
If #cmd-[sourcecode] is used inside #cmd[figure], it is recommended to also allow page breaks for that kind of figure:
#sourcecode[```typ
#show figure.where(kind: raw): set block(breakable: true)
```]
To quickly apply these styles to a document, the #cmd[codelst-styles] command is provided as a shortcut:
#sourcecode(```typ
#show: codelst-styles
```)
Instead of the build in styles, custom functions can be used:
#example(```typ
#show <lineno>: (i) => i.counter.display(
(n, ..args) => text(
fill:rgb(220, 65, 241),
font:("Comic Sans MS"),
str(n)
)
)
#show <codelst>: (code) => block(
width:100%,
inset:(x:10%, y:0pt),
block(fill: green, width:100%, code)
)
#sourcecode(raw("*some*
_source_
= code", lang:"typc"))
```)
Note that the style function for line numbers receives the result of a call to #cmd-[counter.display]. The #doc("meta/counter") can be accessed via the `counter` attribute.
== Command overview
#command("sourcecode", ..args(line-numbers: true,
numbers-format: "1",
numbers-start: auto,
numbers-side: left,
numbers-style: (i) => i.counter.display((no, ..args) => raw(str(no))),
continue-numbering: false,
gutter: 10pt,
tab-indent: 4,
gobble: auto,
highlighted: (),
highlight-color: rgb(234, 234,189),
label-regex: regex("// <([a-z-]{3,})>$"),
highlight-labels: false,
showrange: none,
showlines: false,
[code]))[
#argument("line-numbers", default:true)[
Set to #value(false) to disable line numbers.
]
#argument("numbers-format", type:"string", default: "1")[
The #doc("meta/numbering") format to use for line numbers.
]
#argument("numbers-start", default: auto)[
The number of the first code line. If set to #value(auto), the first line will be set to the start of #arg[showrange] or #value(1) otherwise.
]
#argument("numbers-side", default:choices(left, right, default:left), type:"alignment")[
On which side of the code the line numbers should appear.
]
#argument("numbers-style", default:"(i) => i", type:"function")[
A function of one argument to format the line numbers. Should return #dtype[content].
]
#argument("continue-numbering", default:false)[
If set to #value(true), the line numbers will continue from the last call of #cmd-[sourcecode].
#example(raw("#sourcecode[```
one
two
```]
#lorem(10)
#sourcecode(continue-numbering: true)[```
three
four
```]
"))
]
#argument("gutter", default:10pt)[
Gutter between line numbers and code lines.
]
#argument("tab-indent", default:4)[
Number of spaces to replace tabs at the start of each line with.
]
#argument("gobble", default:auto, type:(auto, "integer", "boolean"))[
How many whitespace characters to remove from each line. By default, the number is automatically determined by finding the maximum number of whitespace all lines have in common. If #arg(gobble: false), no whitespace is removed.
]
#argument("highlighted", default:())[
Line numbers to highlight.
Note that the numbers will respect #arg[numbers-start]. To highlight the second line with #arg(numbers-start: 15), pass #arg(highlighted: (17,))
]
#argument("highlight-color", default:rgb(234, 234,189))[
Color for highlighting lines.
]
#argument("label-regex", type:"regular expression")[
A #dtype("regular expression") for matching labels in the source code. The default value will match labels with at least three characters at the end of lines, separated with a line comment (`//`). For example:
```typ
#strong[Some text] // <my-line-label>
```
If this line matches on a line, the full match will be removed from the output and the content of the first capture group will be used as the label's name (`my-line-label` in the example above).
Note that to be valid, the expression needs to have at least one capture group.
To reference a line, #cmd[lineref] should be used.
]
#argument("highlight-labels", default:false)[
If set to #value(true), lines matching #arg[label-regex] will be highlighted.
]
#argument("showrange", default:none, type:(none,"array"))[
If set to an array with exactly two #dtype("integer")s, the code-lines will be sliced to show only the lines within that range.
For example, #arg(showrange: (5, 10)) will only show the lines 5 to 10.
If settings this and #arg(numbers-start: auto), the line numbers will start at the number indicated by the first number in #arg[showrange]. Otherwise, the numbering will start as specified with #arg[numbers-start].
]
#argument("showlines", default:false)[
If set to #value(true), no blank lines will be stripped from the start and end of the code. Otherwise, those lines will be removed from the output.
Line numbering will not be adjusted to the removed lines (other than with #arg[showrange]).
]
]
#command("sourcefile", arg[code], arg(filename: none), arg(lang: auto), sarg[args])[
Takes a text string #arg[code] loaded via the #cmd[read] function and passes it to #cmd-[sourcecode] for display. If #arg[filename] is given, the code language is guessed by the file's extension. Otherwise, #arg[lang] can be provided explicitly.
Any other #arg[args] will be passed to #cmd-[sourcecode].
#example(raw("#sourcefile(read(\"typst.toml\"), lang:\"toml\")"))[
#codelst.sourcefile(read("typst.toml"), lang:"toml")
]
#ibox[
The original intend for #cmd-[sourcefile] was, to raed the provided filename, without the need for the user to call #cmd-[read]. Due to the security measure, that packages can only read files from their own directory, the call to #cmd-[read] needs to happen outside of #cmd-[sourcefile] in the document.
For this reason, the command differs from #cmd-[sourcecode] only insofar as it accepts a #dtype("string") instead of `raw` #dtype("content").
Future releases might use the #arg[filename] for other purposes, though.
]
]
#command("lineref", arg[label], arg(supplement: "line"))[
Creates a reference to a labeled line in the source code. #arg[label] is the label to reference.
#example(raw("#sourcecode[```java
class HelloWorld {
public static void main( String[] args ) { // <main-method>
System.out.println(\"Hello World!\");
}
}
```]
See #lineref(<main-method>) for a main method in Java."))
How to set labels for lines, refer to the documentation of #arg[label-regex] at #refcmd("sourcecode").
]
#command("code-frame", ..args(fill: luma(250),
stroke: 1pt + luma(200),
inset: (x: 5pt, y: 10pt),
radius: 4pt,
[code]))[
Applies the CODELST default styles to the document. Source code will be wrapped in #cmd[code-frame] and numbers styled with #cmd[numbers-style].
#example(raw("#show <codelst>: code-frame.with(
fill: gray,
stroke: 2pt + lime,
radius: 8pt
)
#sourcecode[```
some code
```]"))
]
#command("numbers-style", arg[no])[
Applies the default CODELST style for line numbers. Can be used in a #var-[show] rule or as a value to #arg[numbers-style].
#example[```typ
#for i in range(3,6) [
- #numbers-style([#i])
]
```]
]
#command("codelst-styles", barg[body])[
Applies the CODELST default styles to the document. Source code will be wrapped in #cmd[code-frame] and numbers styled with #cmd[numbers-style].
#sourcecode[```typ
#show: codelst-styles
```]
]
= Limiations and alternatvies
== How it works
CODELST renders the code lines in a #cmd-[table] and not as a block. This might lead to problems in certain PDF viewers, when selecting the code for copy&paste, since some viewers select tables row-by-row and not columns first.
Furthermore, since the code is split into individual lines and each line is rendered as its own #cmd-[raw] block, sometimes the syntax highlighting will not work correctly. This hopefully will be fixed in future releases.
== Alternatives
There are some alternatives to CODELST that fill similar purposes, but have more or other functionality. If CODELST does not suit your needs, one of those might do the trick.
/ #gitlink("platformer/typst-algorithms"): _Typst module for writing algorithms. Use the algo function for writing pseudocode and the code function for writing code blocks with line numbers._
/ #gitlink("hugo-s29/typst-algo"): _This package helps you typeset [pseudo] algorithms in Typst._
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/visualize/gradient-transform.typ | typst | Apache License 2.0 | // Test whether gradients work well when they are contained within a transform.
---
#let grad = gradient.linear(red, blue, green, purple, relative: "parent");
#let my-rect = rect(width: 50pt, height: 50pt, fill: grad)
#set page(
height: 200pt,
width: 200pt,
)
#place(top + right, scale(x: 200%, y: 130%, my-rect))
#place(bottom + center, rotate(45deg, my-rect))
#place(horizon + center, scale(x: 200%, y: 130%, rotate(45deg, my-rect)))
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/raw_07.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// First line is not dedented and leading space is still possible.
``` A
B
C
```
|
https://github.com/bpkleer/typst-academicons | https://raw.githubusercontent.com/bpkleer/typst-academicons/main/lib-gen.typ | typst | MIT License |
#import "lib-impl.typ": ai-icon
// Generated icon list of Academicons 1.9.4
#let ai-icon-map = (
"academia": "\u{e9af}",
"academia-square": "\u{e93d}",
"acclaim": "\u{e92e}",
"acclaim-square": "\u{e93a}",
"acm": "\u{e93c}",
"acm-square": "\u{e95d}",
"acmdl": "\u{e96a}",
"acmdl-square": "\u{e9d3}",
"ads": "\u{e9cb}",
"ads-square": "\u{e94a}",
"africarxiv": "\u{e91b}",
"africarxiv-square": "\u{e90b}",
"archive": "\u{e955}",
"archive-square": "\u{e956}",
"arxiv": "\u{e974}",
"arxiv-square": "\u{e9a6}",
"biorxiv": "\u{e9a2}",
"biorxiv-square": "\u{e98b}",
"ceur": "\u{e96d}",
"ceur-square": "\u{e92f}",
"ciencia-vitae": "\u{e912}",
"ciencia-vitae-square": "\u{e913}",
"clarivate": "\u{e924}",
"clarivate-square": "\u{e925}",
"closed-access": "\u{e942}",
"closed-access-square": "\u{e943}",
"conversation": "\u{e94c}",
"conversation-square": "\u{e915}",
"coursera": "\u{e95f}",
"coursera-square": "\u{e97f}",
"crossref": "\u{e918}",
"crossref-square": "\u{e919}",
"cv": "\u{e9a5}",
"cv-square": "\u{e90a}",
"datacite": "\u{e91c}",
"datacite-square": "\u{e91d}",
"dataverse": "\u{e9f7}",
"dataverse-square": "\u{e9e4}",
"dblp": "\u{e94f}",
"dblp-square": "\u{e93f}",
"depsy": "\u{e97a}",
"depsy-square": "\u{e94b}",
"doi": "\u{e97e}",
"doi-square": "\u{e98f}",
"dryad": "\u{e97c}",
"dryad-square": "\u{e98c}",
"elsevier": "\u{e961}",
"elsevier-square": "\u{e910}",
"figshare": "\u{e981}",
"figshare-square": "\u{e9e7}",
"google-scholar": "\u{e9d4}",
"google-scholar-square": "\u{e9f9}",
"hal": "\u{e92c}",
"hal-square": "\u{e92d}",
"hypothesis": "\u{e95a}",
"hypothesis-square": "\u{e95b}",
"ideas-repec": "\u{e9ed}",
"ideas-repec-square": "\u{e9f8}",
"ieee": "\u{e929}",
"ieee-square": "\u{e9b9}",
"impactstory": "\u{e9cf}",
"impactstory-square": "\u{e9aa}",
"inaturalist": "\u{e900}",
"inaturalist-square": "\u{e901}",
"inpn": "\u{e902}",
"inpn-square": "\u{e903}",
"inspire": "\u{e9e9}",
"inspire-square": "\u{e9fe}",
"isidore": "\u{e936}",
"isidore-square": "\u{e954}",
"isni": "\u{e957}",
"isni-square": "\u{e958}",
"jstor": "\u{e938}",
"jstor-square": "\u{e944}",
"lattes": "\u{e9b3}",
"lattes-square": "\u{e99c}",
"mathoverflow": "\u{e9f6}",
"mathoverflow-square": "\u{e97b}",
"mendeley": "\u{e9f0}",
"mendeley-square": "\u{e9f3}",
"moodle": "\u{e907}",
"moodle-square": "\u{e908}",
"mtmt": "\u{e950}",
"mtmt-square": "\u{e951}",
"nakala": "\u{e940}",
"nakala-square": "\u{e941}",
"obp": "\u{e92a}",
"obp-square": "\u{e92b}",
"open-access": "\u{e939}",
"open-access-square": "\u{e9f4}",
"open-data": "\u{e966}",
"open-data-square": "\u{e967}",
"open-materials": "\u{e968}",
"open-materials-square": "\u{e969}",
"openedition": "\u{e946}",
"openedition-square": "\u{e947}",
"orcid": "\u{e9d9}",
"orcid-square": "\u{e9c3}",
"osf": "\u{e9ef}",
"osf-square": "\u{e931}",
"overleaf": "\u{e914}",
"overleaf-square": "\u{e98d}",
"philpapers": "\u{e98a}",
"philpapers-square": "\u{e96f}",
"piazza": "\u{e99a}",
"piazza-square": "\u{e90c}",
"preregistered": "\u{e906}",
"preregistered-square": "\u{e96b}",
"protocols": "\u{e952}",
"protocols-square": "\u{e953}",
"psyarxiv": "\u{e90e}",
"psyarxiv-square": "\u{e90f}",
"publons": "\u{e937}",
"publons-square": "\u{e94e}",
"pubmed": "\u{e99f}",
"pubmed-square": "\u{e97d}",
"pubpeer": "\u{e922}",
"pubpeer-square": "\u{e923}",
"researcherid": "\u{e91a}",
"researcherid-square": "\u{e95c}",
"researchgate": "\u{e95e}",
"researchgate-square": "\u{e99e}",
"ror": "\u{e948}",
"ror-square": "\u{e949}",
"sci-hub": "\u{e959}",
"sci-hub-square": "\u{e905}",
"scirate": "\u{e98e}",
"scirate-square": "\u{e99d}",
"scopus": "\u{e91e}",
"scopus-square": "\u{e91f}",
"semantic-scholar": "\u{e96e}",
"semantic-scholar-square": "\u{e96c}",
"springer": "\u{e928}",
"springer-square": "\u{e99b}",
"ssrn": "\u{e916}",
"ssrn-square": "\u{e917}",
"stackoverflow": "\u{e920}",
"stackoverflow-square": "\u{e921}",
"viaf": "\u{e933}",
"viaf-square": "\u{e934}",
"wiley": "\u{e926}",
"wiley-square": "\u{e927}",
"zenodo": "\u{e911}",
"zotero": "\u{e962}",
"zotero-square": "\u{e932}"
)
#let ai-academia = ai-icon.with("\u{e9af}")
#let ai-academia-square = ai-icon.with("\u{e93d}")
#let ai-acclaim = ai-icon.with("\u{e92e}")
#let ai-acclaim-square = ai-icon.with("\u{e93a}")
#let ai-acm = ai-icon.with("\u{e93c}")
#let ai-acm-square = ai-icon.with("\u{e95d}")
#let ai-acmdl = ai-icon.with("\u{e96a}")
#let ai-acmdl-square = ai-icon.with("\u{e9d3}")
#let ai-ads = ai-icon.with("\u{e9cb}")
#let ai-ads-square = ai-icon.with("\u{e94a}")
#let ai-africarxiv = ai-icon.with("\u{e91b}")
#let ai-africarxiv-square = ai-icon.with("\u{e90b}")
#let ai-archive = ai-icon.with("\u{e955}")
#let ai-archive-square = ai-icon.with("\u{e956}")
#let ai-arxiv = ai-icon.with("\u{e974}")
#let ai-arxiv-square = ai-icon.with("\u{e9a6}")
#let ai-biorxiv = ai-icon.with("\u{e9a2}")
#let ai-biorxiv-square = ai-icon.with("\u{e98b}")
#let ai-ceur = ai-icon.with("\u{e96d}")
#let ai-ceur-square = ai-icon.with("\u{e92f}")
#let ai-ciencia-vitae = ai-icon.with("\u{e912}")
#let ai-ciencia-vitae-square = ai-icon.with("\u{e913}")
#let ai-clarivate = ai-icon.with("\u{e924}")
#let ai-clarivate-square = ai-icon.with("\u{e925}")
#let ai-closed-access = ai-icon.with("\u{e942}")
#let ai-closed-access-square = ai-icon.with("\u{e943}")
#let ai-conversation = ai-icon.with("\u{e94c}")
#let ai-conversation-square = ai-icon.with("\u{e915}")
#let ai-coursera = ai-icon.with("\u{e95f}")
#let ai-coursera-square = ai-icon.with("\u{e97f}")
#let ai-crossref = ai-icon.with("\u{e918}")
#let ai-crossref-square = ai-icon.with("\u{e919}")
#let ai-cv = ai-icon.with("\u{e9a5}")
#let ai-cv-square = ai-icon.with("\u{e90a}")
#let ai-datacite = ai-icon.with("\u{e91c}")
#let ai-datacite-square = ai-icon.with("\u{e91d}")
#let ai-dataverse = ai-icon.with("\u{e9f7}")
#let ai-dataverse-square = ai-icon.with("\u{e9e4}")
#let ai-dblp = ai-icon.with("\u{e94f}")
#let ai-dblp-square = ai-icon.with("\u{e93f}")
#let ai-depsy = ai-icon.with("\u{e97a}")
#let ai-depsy-square = ai-icon.with("\u{e94b}")
#let ai-doi = ai-icon.with("\u{e97e}")
#let ai-doi-square = ai-icon.with("\u{e98f}")
#let ai-dryad = ai-icon.with("\u{e97c}")
#let ai-dryad-square = ai-icon.with("\u{e98c}")
#let ai-elsevier = ai-icon.with("\u{e961}")
#let ai-elsevier-square = ai-icon.with("\u{e910}")
#let ai-figshare = ai-icon.with("\u{e981}")
#let ai-figshare-square = ai-icon.with("\u{e9e7}")
#let ai-google-scholar = ai-icon.with("\u{e9d4}")
#let ai-google-scholar-square = ai-icon.with("\u{e9f9}")
#let ai-hal = ai-icon.with("\u{e92c}")
#let ai-hal-square = ai-icon.with("\u{e92d}")
#let ai-hypothesis = ai-icon.with("\u{e95a}")
#let ai-hypothesis-square = ai-icon.with("\u{e95b}")
#let ai-ideas-repec = ai-icon.with("\u{e9ed}")
#let ai-ideas-repec-square = ai-icon.with("\u{e9f8}")
#let ai-ieee = ai-icon.with("\u{e929}")
#let ai-ieee-square = ai-icon.with("\u{e9b9}")
#let ai-impactstory = ai-icon.with("\u{e9cf}")
#let ai-impactstory-square = ai-icon.with("\u{e9aa}")
#let ai-inaturalist = ai-icon.with("\u{e900}")
#let ai-inaturalist-square = ai-icon.with("\u{e901}")
#let ai-inpn = ai-icon.with("\u{e902}")
#let ai-inpn-square = ai-icon.with("\u{e903}")
#let ai-inspire = ai-icon.with("\u{e9e9}")
#let ai-inspire-square = ai-icon.with("\u{e9fe}")
#let ai-isidore = ai-icon.with("\u{e936}")
#let ai-isidore-square = ai-icon.with("\u{e954}")
#let ai-isni = ai-icon.with("\u{e957}")
#let ai-isni-square = ai-icon.with("\u{e958}")
#let ai-jstor = ai-icon.with("\u{e938}")
#let ai-jstor-square = ai-icon.with("\u{e944}")
#let ai-lattes = ai-icon.with("\u{e9b3}")
#let ai-lattes-square = ai-icon.with("\u{e99c}")
#let ai-mathoverflow = ai-icon.with("\u{e9f6}")
#let ai-mathoverflow-square = ai-icon.with("\u{e97b}")
#let ai-mendeley = ai-icon.with("\u{e9f0}")
#let ai-mendeley-square = ai-icon.with("\u{e9f3}")
#let ai-moodle = ai-icon.with("\u{e907}")
#let ai-moodle-square = ai-icon.with("\u{e908}")
#let ai-mtmt = ai-icon.with("\u{e950}")
#let ai-mtmt-square = ai-icon.with("\u{e951}")
#let ai-nakala = ai-icon.with("\u{e940}")
#let ai-nakala-square = ai-icon.with("\u{e941}")
#let ai-obp = ai-icon.with("\u{e92a}")
#let ai-obp-square = ai-icon.with("\u{e92b}")
#let ai-open-access = ai-icon.with("\u{e939}")
#let ai-open-access-square = ai-icon.with("\u{e9f4}")
#let ai-open-data = ai-icon.with("\u{e966}")
#let ai-open-data-square = ai-icon.with("\u{e967}")
#let ai-open-materials = ai-icon.with("\u{e968}")
#let ai-open-materials-square = ai-icon.with("\u{e969}")
#let ai-openedition = ai-icon.with("\u{e946}")
#let ai-openedition-square = ai-icon.with("\u{e947}")
#let ai-orcid = ai-icon.with("\u{e9d9}")
#let ai-orcid-square = ai-icon.with("\u{e9c3}")
#let ai-osf = ai-icon.with("\u{e9ef}")
#let ai-osf-square = ai-icon.with("\u{e931}")
#let ai-overleaf = ai-icon.with("\u{e914}")
#let ai-overleaf-square = ai-icon.with("\u{e98d}")
#let ai-philpapers = ai-icon.with("\u{e98a}")
#let ai-philpapers-square = ai-icon.with("\u{e96f}")
#let ai-piazza = ai-icon.with("\u{e99a}")
#let ai-piazza-square = ai-icon.with("\u{e90c}")
#let ai-preregistered = ai-icon.with("\u{e906}")
#let ai-preregistered-square = ai-icon.with("\u{e96b}")
#let ai-protocols = ai-icon.with("\u{e952}")
#let ai-protocols-square = ai-icon.with("\u{e953}")
#let ai-psyarxiv = ai-icon.with("\u{e90e}")
#let ai-psyarxiv-square = ai-icon.with("\u{e90f}")
#let ai-publons = ai-icon.with("\u{e937}")
#let ai-publons-square = ai-icon.with("\u{e94e}")
#let ai-pubmed = ai-icon.with("\u{e99f}")
#let ai-pubmed-square = ai-icon.with("\u{e97d}")
#let ai-pubpeer = ai-icon.with("\u{e922}")
#let ai-pubpeer-square = ai-icon.with("\u{e923}")
#let ai-researcherid = ai-icon.with("\u{e91a}")
#let ai-researcherid-square = ai-icon.with("\u{e95c}")
#let ai-researchgate = ai-icon.with("\u{e95e}")
#let ai-researchgate-square = ai-icon.with("\u{e99e}")
#let ai-ror = ai-icon.with("\u{e948}")
#let ai-ror-square = ai-icon.with("\u{e949}")
#let ai-sci-hub = ai-icon.with("\u{e959}")
#let ai-sci-hub-square = ai-icon.with("\u{e905}")
#let ai-scirate = ai-icon.with("\u{e98e}")
#let ai-scirate-square = ai-icon.with("\u{e99d}")
#let ai-scopus = ai-icon.with("\u{e91e}")
#let ai-scopus-square = ai-icon.with("\u{e91f}")
#let ai-semantic-scholar = ai-icon.with("\u{e96e}")
#let ai-semantic-scholar-square = ai-icon.with("\u{e96c}")
#let ai-springer = ai-icon.with("\u{e928}")
#let ai-springer-square = ai-icon.with("\u{e99b}")
#let ai-ssrn = ai-icon.with("\u{e916}")
#let ai-ssrn-square = ai-icon.with("\u{e917}")
#let ai-stackoverflow = ai-icon.with("\u{e920}")
#let ai-stackoverflow-square = ai-icon.with("\u{e921}")
#let ai-viaf = ai-icon.with("\u{e933}")
#let ai-viaf-square = ai-icon.with("\u{e934}")
#let ai-wiley = ai-icon.with("\u{e926}")
#let ai-wiley-square = ai-icon.with("\u{e927}")
#let ai-zenodo = ai-icon.with("\u{e911}")
#let ai-zotero = ai-icon.with("\u{e962}")
#let ai-zotero-square = ai-icon.with("\u{e932}")
|
https://github.com/jamesrswift/pixel-pipeline | https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/tests/layers/drawing/shapes/polygon/test.typ | typst | The Unlicense | #import "/tests/preamble.typ": pixel
#let plotter = pixel.pipeline.factory(
layers: (
pixel.layer.debug(),
pixel.layer.drawing.layer(validation: true),
),
)
#import pixel.layer: drawing
#let my-polygon(pos, ..args) = drawing.shapes.polygon(
position: pixel.primitives.position(pos),
fill: blue.lighten(80%),
stroke: blue,
(
(0,1),
(1,1),
(1,0),
(0,0),
),
..args
)
Hello
#plotter({
my-polygon((0,0))
my-polygon((1,1), stroke: red)
})
World |
https://github.com/Weetile/rhul-report-typst | https://raw.githubusercontent.com/Weetile/rhul-report-typst/main/README.md | markdown | MIT License | # rhul-template-typst
Unofficial report template for reports at Royal Holloway, University of London.
Created by <NAME> and heavily modified from [light-report-uia](https://typst.app/universe/package/light-report-uia/).
## Usage
In the root directory, run the following command:
```bash
typst c --root . ./template/main.typ
```
Alternatively, use the following Docker command:
```bash
docker run --rm -v "$(pwd):/workspace" -w /workspace ghcr.io/typst/typst:latest c --root . ./template/main.typ
```

|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2F800.typ | typst | Apache License 2.0 | #let data = (
("CJK COMPATIBILITY IDEOGRAPH-2F800", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F801", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F802", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F803", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F804", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F805", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F806", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F807", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F808", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F809", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F80F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F810", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F811", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F812", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F813", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F814", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F815", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F816", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F817", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F818", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F819", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F81F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F820", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F821", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F822", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F823", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F824", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F825", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F826", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F827", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F828", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F829", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F82F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F830", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F831", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F832", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F833", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F834", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F835", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F836", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F837", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F838", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F839", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F83F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F840", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F841", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F842", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F843", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F844", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F845", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F846", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F847", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F848", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F849", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F84F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F850", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F851", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F852", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F853", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F854", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F855", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F856", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F857", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F858", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F859", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F85F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F860", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F861", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F862", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F863", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F864", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F865", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F866", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F867", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F868", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F869", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F86F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F870", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F871", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F872", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F873", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F874", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F875", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F876", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F877", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F878", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F879", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F87F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F880", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F881", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F882", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F883", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F884", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F885", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F886", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F887", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F888", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F889", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F88F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F890", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F891", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F892", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F893", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F894", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F895", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F896", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F897", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F898", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F899", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F89F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8A9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8AF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8B9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8BF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8C9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8CF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8D9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8DF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8E9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8EA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8EB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8EC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8ED", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8EE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8EF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8F9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F8FF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F900", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F901", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F902", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F903", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F904", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F905", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F906", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F907", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F908", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F909", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F90F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F910", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F911", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F912", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F913", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F914", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F915", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F916", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F917", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F918", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F919", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F91F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F920", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F921", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F922", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F923", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F924", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F925", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F926", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F927", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F928", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F929", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F92F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F930", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F931", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F932", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F933", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F934", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F935", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F936", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F937", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F938", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F939", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F93F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F940", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F941", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F942", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F943", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F944", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F945", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F946", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F947", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F948", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F949", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F94F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F950", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F951", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F952", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F953", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F954", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F955", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F956", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F957", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F958", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F959", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F95F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F960", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F961", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F962", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F963", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F964", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F965", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F966", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F967", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F968", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F969", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F96F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F970", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F971", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F972", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F973", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F974", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F975", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F976", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F977", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F978", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F979", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F97F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F980", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F981", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F982", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F983", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F984", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F985", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F986", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F987", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F988", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F989", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F98F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F990", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F991", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F992", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F993", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F994", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F995", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F996", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F997", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F998", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F999", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F99F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9A9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9AF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9B9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9BF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9C9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9CF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9D9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9DF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9E9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9EA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9EB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9EC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9ED", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9EE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9EF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F0", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F1", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F2", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F3", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F4", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F5", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F6", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F7", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F8", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9F9", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FA", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FB", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FC", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FD", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FE", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2F9FF", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA00", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA01", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA02", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA03", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA04", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA05", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA06", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA07", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA08", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA09", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0D", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0E", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA0F", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA10", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA11", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA12", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA13", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA14", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA15", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA16", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA17", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA18", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA19", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA1A", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA1B", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA1C", "Lo", 0),
("CJK COMPATIBILITY IDEOGRAPH-2FA1D", "Lo", 0),
)
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-invalid-12.typ | typst | Other | // Error: 15-23 cannot add integer and string
#{ let x = 1; x += "2" }
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/place-nested_03.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
#box(fill: aqua)[
#place(top + left, dx: 50%, dy: 50%)[Hi]
#v(30pt)
#line(length: 50pt)
]
|
https://github.com/Many5900/aau-typst | https://raw.githubusercontent.com/Many5900/aau-typst/main/chapters/components.typ | typst | #import "../custom.typ": *
= Components
#box(title: "Title for Text Box with Footer")[
The main content of the text box goes here!
][Footer text goes here]
#box(title: "Title for Text Box")[
The main content of the text box goes here!
][]
#code(lang: "Rust")[Code Block Title][
```rust
fn main() {
println!("Hello, world!");
}
```
]
#code(lang: "Rust")[][
```rust
fn main() {
println!("Hello, world!");
}
```
]
#note(title: "Note Title")[Inside a Carnot cycle, the efficiency $eta$ is defined to be:
$ eta = W/Q_H = frac(Q_H + Q_C, Q_H) = 1 - T_C/T_H $] |
|
https://github.com/Wuvist/lcpc | https://raw.githubusercontent.com/Wuvist/lcpc/main/lcpc.typ | typst | #import "paper_template.typ": paper
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx
#import "@preview/wordometer:0.1.1": word-count, total-words
#show: word-count.with(exclude: (heading.where(level: 1), raw.where(block: true)))
#show: doc => paper(
title: [Living Cost Pressure Curve in Singapore and beyond],
authors: (
(
name: "<NAME>",
affiliation: "",
email: "",
note: "Singapore Management University, <EMAIL>",
),
),
date: "April 2024",
abstract: [This paper introduces the Living Cost Pressure Curve (LCPC) as a novel economic indicator aimed at providing a comprehensive measure of living cost pressures across various societal segments. By establishing the LCPC and applying it to an in-depth analysis of Singapore, the study underscores the indicator's versatility and effectiveness in capturing economic nuances that traditional measures like the Consumer Price Index (CPI) often miss. Utilizing data from Singapore's Household Expenditure Surveys and segmenting the LCPC by dwelling type, this research reveals intricate dynamics of living cost pressures among different groups within the economy. An estimated LCPC for foreign workers in Singapore, categorized by type of work pass, offers valuable insights for individuals contemplating relocation. A comparative analysis with Hong Kong further demonstrates the LCPC's adaptability in reflecting the distinct socio-economic characteristics of various regions, highlighting significant disparities in living cost pressures faced by households in Singapore and Hong Kong. This disparity is primarily attributed to rental expenditures, pinpointing them as a crucial factor behind the economic challenges encountered by Hong Kong residents, in contrast to the potential for significant savings among Singaporean households. These findings advocate for the LCPC's capacity to provide a more holistic and accurate understanding of economic pressures arising from living costs, thereby furnishing local residents, foreign workers, and policymakers with a clearer perspective of the economic landscape.],
keywords: [
Household Analysis, Household Finance, Demographic Economics, Economic indicator, Social indicator,],
acknowledgments: "This paper is a work in progress.",
doc,
)
#set par(
leading: 1.2em,
first-line-indent: 2em,
justify: true,
)
= Introduction
Singapore is an advanced economy sometimes famous for its high GDP per capita and high living cost. These fames are usually news headlines which may be biased. Existing economic indicators may help public to have a glimpse of Singapore's economic from certain aspects, but seems none is directly reflecting living cost pressure among a society, and the reference values are limited. People need to digest multiple economic indicators in order to have a better understanding of living cost pressure of a society. Furthermore, existing economic indicators have different issue when used for understanding living cost. This paper propose a new economic indicator LCPC - Living Cost Pressure Curve, aiming to have easy reference about living cost in societies to broader audience. This paper also analyze living cost pressure in both Singapore and Hong Kong by utilizing LCPC.
When living cost is concerned, Consumer Price Index - CPI is a commonly used indicator. According to Singapore Statistic Department - SingStat @sg_cpi, the annual CPI using 2019 as base year increases from 74 in 2000 to 109 in 2022, but it doesn't imply that Singaporean's living cost pressure has increased by 47%. Singaporeans's income level also has increased during the same period. If income level increase at a faster rate than CPI, the actual economic pressure from living cost could be even lower.
GDP per capita measured in PPP includes income factors, but it could be distorted. For example, an economy like Singapore which has significant portion of GDP contributed by international trade, its GDP may not fully reflects the income level of local people.
Another commonly cited indicator is Worldwide Cost of Living - WCOL survey@eiu by Economist Intelligence Unit - EIU. In this yearly survey, it consistently ranked Singapore as the city with highest live cost in the world and attracts media attentions.
#quote[The survey has been designed to enable human resources and finance managers to calculate cost-of-living allowances and build compensation packages for expatriates and business travelers]@eiu But when WCOL survey report is covered by media, public may have the misconception that its data is aiming to reflect the living cost of local people.
Singapore government responded to WCOL survey in Dec 2023@sg_response, pointing out two reasons for #quote[it may not reflect the cost of living for Singaporeans]:
- The WCOL survey's consumption basket does not reflect what Singaporeans usually consume
- The rankings are sensitive to currency fluctuations
Beside these two reason, WCOL also has same issue as CPI: It doesn't contain information about income level.
In general, if an economic indicator is represented as an scalar like the three mentioned above, it won't be able to reflect diversification within a society. Scalar as an one dimensional number is not sufficient for describing situation across different segments of an economy. When concerning living cost pressure, it's a measurement tends varies among different classes within a society. Different representation of economic indicator is needed.
In order to create more holistic view of living cost of a economy, the proposed indicator is a curve: Living Cost Pressure Curve - LCPC.
Living Cost Pressure - LCP is defined by:
$ L C P = (sum "Expenditure")/(sum "Income") $
Indicators like CPI and EIU's WCOL are essentially a weighted sum of living cost. In order to capture living cost pressure faced by consumer, it not enough to just consider living cost metrics. Living cost must be used to against values like income to represent pressure faced. LCP is just the ratio of nominal sum of a household total expenditure over its all source income over a period. Both expenditure and income are denoted in local currency.
LCP provide quick understanding about affordability of a household expenditure. If LCP equals to 1, it implies the household is struggling to meet its expenditure needs. If LCP is above one, it implies the household is running on deficit. The household may need to spend its saving or work hard to increase income. If LCP below one, it means the household face less living cost pressure and could have extra saving.
#colbreak()
= LCPC for Singapore
A quick glance of LCPC for Singapore segmented by income quintile and by type of dwelling for three different period: 2007/08, 2012/13 and 2017/18 are:
#figure(
image("data/LCPC_income.png", width: 80%),
caption:"SG LCPC by income"
) <sg_lcpc_by_income>
#figure(
image("data/LCPC_dwelling.png", width: 80%),
caption: "SG LCPC by type of dwelling"
) <sg_lcpc_by_dwelling>
The expenditure and income mentioned above are referring to the average household monthly expenditure of all form and average monthly income from all source.
There are tow main benefit of such approach.
1. No weighted conversion is needed, just using nominal dollar values and their sum could be easily calculated. If we want to evaluate impacts of certain price change, like fresh food price shock. We will need to look into composition of the "Overall expenditure". By taking simple sum, we just need to calculated the nominal dollar changes. No weighted conversion is needed, and it reflects the actual situation faced by household: Individual household income/expenditure accounting also use nominal values without any conversion.
2. Denoted In local currency, robust to currency fluctuations. Thus, avoid the issue of WCOL survey pointed out by Singapore government.
== Data from Household Expenditure Survey
The expenditure and income data used for constructing above LCPC are from Household Expenditure Survey - HES@hes conducted by the SingStat. HES is conducted every 5 years since 2007/08. Currently 3 survey's data are available: 2007/08, 2012/13 and 2017/18. #footnote[The latest survey data for year 2023/24 should be released in mid 2024. This paper will update with the new data once available.]
Each HES surveyed about 13,000 dwelling units in Singapore, and reported both household's income and expenditure data.
Household expenditure and income data segmented by income quintile:
#figure(
tablex(
columns: 7,
align: center + horizon,
auto-vlines: false,
[*Year*], [*Data Type*], [*1st-20th*], [*21st-40th*], [*41st-60th*], [*61st-80th*], [*81st-100th*],
rowspanx(3)[2007/08], [Expenditure], [1,787], [2,950], [3,602], [4,569], [6,138],
[Income], [1,466], [3,934], [6,175], [9,439], [19,511],
[LCP], [1.22], [0.75], [0.58], [0.48], [0.31],
rowspanx(3)[2012/13], [Expenditure], [2,215], [3,531], [4,705], [5,596], [7,575],
[Income], [1,949], [5,238], [8,355], [12,246], [24,547],
[LCP], [1.14], [0.67], [0.56], [0.46], [0.31],
rowspanx(3)[2017/18], [Expenditure], [2,570], [3,753], [4,812], [5,826], [7,573],
[Income], [2,235], [5,981], [9,678], [14,407], [26,587],
[LCP], [1.15], [0.63], [0.50], [0.40], [0.28],
),
kind: table,
caption: "SG Household income & expenditure by income quintile"
) <sg_household_by_income>
Household expenditure and income data segmented by type of dwelling:
#figure(
tablex(
columns: 8,
align: center + horizon,
auto-vlines: false,
rowspanx(2)[*Year*], rowspanx(2)[*Data Type*], colspanx(4)[*HDB*], rowspanx(2)[*Condo*], rowspanx(2)[*Landed*],
(), [*1-2 Room*], [*3-Room*], [*4-Room*], [*5-Room&EC*],(),
rowspanx(3)[*2007/08*], [Expenditure], [957], [2,121], [3,093], [4,423], [6,587], [8,222],
[Income], [1,373], [3,946], [5,737], [9,028], [17,176], [21,198],
[LCP], [0.70], [0.54], [0.54], [0.49], [0.38], [0.38],
rowspanx(3)[*2012/13*], [Expenditure], [1,287], [2,478], [3,918], [5,283], [8,000], [10,409],
[Income], [1,855], [5,083], [8,043], [11,006], [20,534], [26,055],
[LCP], [0.69], [0.49], [0.49], [0.48], [0.39], [0.40],
rowspanx(3)[*2017/18*], [Expenditure], [1,545], [2,709], [3,933], [5,504], [7,963], [10,500],
[Income], [2,521], [5,868], [8,827], [12,244], [21,830], [28,937],
[LCP], [0.51], [0.42], [0.44], [0.43], [0.37], [0.36],
),
kind: table,
caption: "SG Household income & expenditure by type of dwelling"
) <sg_household_by_dwelling>
These data provides insights about household living cost status in Singapore.
LPC focus on household's monthly all source expenditure and income, aiming to reflect a household's cash flow status, which reflects pressure of living cost. Thus expenditures like imputed rental of owner-occupied accommodation should not be included when calculating expenditure.
Income include from all source that effects household's cash flow, for example salary, investment, rental income and regular government transfers like Workfare Income Supplement @wis.
== Analysis of SG LCPC
LCPC shows how live cost pressure are distributed among a society. LCPC could be segmented using different ways.
=== Segmented by Income Quintile
The most natural way will be segmented with income level. But using income quintile may have unexpected issue.
Quick finding from SG LCPC by income quintile in @sg_lcpc_by_income and @sg_household_by_income:
- LCP decreases as income level increases
- LCPC shift downward from 2007/08 to 2017/18
- All group faces lesser pressure
- 21th-40th group's LCP drop most significantly
- 81th-100th group's LCP didn't shift much
- 1st-20th group's LCP increase from 2012/13 to 2017/18, indicating this group by face large pressure.
However, the data of 1st-20th group deserve more careful examination:
- LCP is higher than 1, meaning expenditure exceed income, i.e. household is running on deficit.
This status does not necessarily implies that "Singapore's Poor struggles with household deficit". Within this group, 30%+ of household sole non-working household members of age 65+. i.e. retired elderly could be living saving, thus expenditure exceeds income#footnote[Retired elderly has no fixed salary, but could still have income from investment and rental.]. HES report indicates that #quote[It is notable, for example, that some resident households in the lowest 20% owned a car (13.6 per cent), employed a maid (13.9 per cent), lived in private property (7.1 per cent) or were headed by persons aged 65 years and over (36.7 per cent) in 2017/18.], indicating group with low monthly income may not be poorest group.
So, using income quintile for LCPC would be misleading.
=== Segmented by Type of Dwelling
Segmentation by type of dwelling on the other hand as shown in @sg_lcpc_by_dwelling and @sg_household_by_dwelling may better represent wealthiness of a household and its LCP. There is strong corelation between amount of government transfer received and type of dwelling as shown in Key Household Income Trends, 2023 report@income_trend by SingStat and the group of received most government transfer is the one dwell in HDB#footnote[HDB stands for House Development Board, and it's often referred to the public house developed by Singapore government - House Development Board.] 1 & 2 Room flat#footnote[Key Household Income Trends, 2023 Chart 6: Average Annual Government Transfers Per Household Member shows that Government Transfers tends to decrease as type of dwelling improve]. Thus, if we are concerned about status of low class in Singapore, it's better to look at the group stay in HDB 1-2 Room flat, instead of the group having the lowest income.
Type of dwelling in Singapore are typically segmented into:
#figure(
tablex(
columns: 8,
align: center + horizon,
auto-vlines: false,
rowspanx(2)[],colspanx(4)[*HDB*], rowspanx(2)[*Condo#footnote[Condominiums & Other Apartments]*], rowspanx(2)[*Landed#footnote[Landed Properties]*],rowspanx(2)[*All*],
(), [*1-2 Room*], [*3-Room*], [*4-Room*], [*5-Room&EC#footnote[Executive Condominiums which sold by HDB, provide better housing but government sponsored.]*],(),
[Percentage], [7.0%], [17.0%], [31.3%], [22.4%], [17.2%], [4.8%], [100%],
),
kind: table,
caption: "Resident Households by Type of Dwelling 2023"
) <households>
Uniquely in the world, about 77.8%@dwelling_types of Singaporean household stay in HDB. The remaining household stay in private properties like Condo(17.2% of household) and landed properties(4.8% of household).
It's worth noting that when segmenting by type of dwelling, the proportion of each segment may not be the same. "HDB 4 Room" represents about 31.3% of household, much greater then the bottom 7.0% stays in HDB 1-2 Room.
LCPC doesn't requires size of each segment to be equal, it's more important to make each segments representative. i.e. audience is easier to understand which people belongs to which segments thus create better reference value.
When segmenting by income level, despite the segments are evenly distributed, audience may find it hard to project themselves into corresponding group. One may think they belongs to "middle-income", when while they are actually among the top 20% earners. Or the opposites may also happen.
Segmenting by dwelling type on the other hand, provides a clear cut of who should belong to each segment. The SG LCPC by type of dwelling in @sg_household_by_dwelling has been striped off household with sole member of age 65+ and segmented by household#footnote[It's possible to form another LCPC focusing this group alone, as HES has corresponding data. I will analyze in future study.].
#figure(
image("data/LCPC_change.png", width: 90%),
caption: "Change of LCP by type of dwelling from 2007/08 to 2017/18"
) <sg_lcpc_change>
Quick findings from this LCPC:
- All LCP below 1: no household face deficit.
- LCP of all groups drop from 2007/08 to 2017/18, the lower type of dwelling tends to have higher drop in LCP as shown in @sg_lcpc_change.
- LCPC thus become much more "flat" in 2017/18 than in 2012/13, implies social equality has improved.
- HDB 1-2 Room group has the most improvement from 2012/13 to 2017/18, as a result of larger increment in income than expenditure. This could be a result of large transfer payment by the government.
- LCPC of 2017/18 is in a slight "W" shape, which the "middle class" - group staying in HDB 4-Room and 5-Room&EC have larger LCP than the neighboring groups HDB 3-Room and Condo. This may reflects the so-called "Squeezed Middle Class".
=== GST increment
There are many factors would affect LCPC, especially change in government policy. Singapore Government increased GST from 7% to 9% in 2023 and 2024, with 1% increment each year, and it applies to all expenditure of all segments. Assuming Singaporean doesn't change consumption with new GST, i.e. inelastic to price change of 1%; this policy will shift whole LCPC upwards, but the shape remains.
Singapore government does provide "Assurance Package" to help low income families@ap_support cushion the impact of GST increment, thus this policy could potentially further flatten LCPC.
When HER 2022/23 report is available, I will re-visit with the new data to evaluate the impact of GST increment in Singapore.
= Estimation of other LCPC
== Mortgage Repayment
HES's expenditure doesn't include Mortgage Repayment. The housing category expenditure in HES report only includes:
- Housing(Rentals) And Utilities
- Furnishings, Household Equipment And Routine Household Maintenance
I initially tried to include mortgage repayment into household expenditure and make another LCPC. According to HES 2022/23 Information Pamphlet, HES did collect home mortgage repayment data, but these data are never revealed in report. It's not only hard to find statistic for Singaporean's mortgage repayment, but also extreme hard to make reasonable estimation of mortgage repayment.
Mortgage is determined largely at the moment of purchase, and it varies a lot from one household to another. It's hard to estimate which age group of household purchase their first house, nor to mention segmented it by income quintiles or type of dwelling.
Mortgage rate may changes,. But about 80% of Singapore household stays in HDB, and the interest rate of HDB's loans is pegged to +0.1% of interest rate of CPF ordinary account@hdb_interest, which has been 2.5% since July 1999@cpf_interest. Market interest rate may change, but it will be capped to 2.6% - the HDB rates. Condo & landed properties owners may need to take loans from commercial banks, and the rate would have much higher fluctuations. But that only impacts the top 20% high income household. Furthermore, MAS has MRS limit: 30%@tdsr.
If we do a extreme estimation of that all household takes the maximum housing loans, it just discounts LCP of all segment to 70%, and has no impact on the shape of the LCPC.
From an accounting perspective, property is considered as an asset of a household, the purchase of a house is actually just turning cash assets to fixed asset, and may not incur any expenditures. It's sometimes even be considered as an investment. It's only the interest payment of mortgage could be considered as actual expenditure.
Mortgage impact of LCPC would be future research topic, but in this paper, I decide to exclude mortgage repayment when constructing LCPC.
== Rental - LCPC for foreign workers in Singapore
Rental on housing is an area worth deeper analysis. Home ownership rate is almost 90% in Singapore@sg_home_ownership, thus rental may not be a significant factor for Singaporean household's expenditure. But Singapore is a society consisting about 30%, or 1.77M non-residents@sg_population. Furthermore, Singapore forbids foreigner making purchase of HDB and most landed properties, the additional buyer-side stamp duty - ABSD for foreign buyers also has been increasing#footnote[https://www.iras.gov.sg/taxes/stamp-duty/for-property/buying-or-acquiring-property/additional-buyer's-stamp-duty-(absd)]. Most foreign workers in Singapore will need to rental places to stay, and rental is a major factor for their LCP.
It's possible to construct an estimated LCPC for foreign workers in Singapore segmented by the type of work pass for 2023:
#figure(
image("data/LCPC_foreign.png", width: 80%),
caption: "ESTIMATED SG LCPC for foreigners by type of work pass"
) <sg_lcpc_by_pass>
Quick findings:
- Work Permit - WP group has LCP very close to 1, implying they are very closed to face deficit or cash flow issues. The minimum WP salary required by MOM may not be sufficient for them to support their life in Singapore. Their monthly expenditure are already closed to the minimum by having expenditures similar to the bottom 7% local, i.e. the group stay in HDB 1-2 Room and they only assumed to share HDB room with another worker. There is not much room to cut expenditure given the ever increasing CPI in Singapore. Thus, the way for WP group to fight with high LCP may work overtime and get additional income.
- The group estimated to have both lowest LCP(0.56) and highest LCP(1.05) are Employment Pass(EP) holders, depending on the type of housing they rent. Monthly rental is the most significant factor affecting their LCP. Middle class professional considering relocating to Singapore may find living cost unbearable if they want to stay in condo and maintain corresponding life style. But, they would find comfort if they choose to rent HDB and have moderate life style just like the majority of Singaporeans.
- High income professional like Personalized Employment Pass(PEP)/Overseas Networks & Expertise Pass(ONE Pass) holders faces similar LCP below 0.7. They are the target audience of WCOL by EIU. Despite Singapore may have the highest cost of living in the world, the high income of expatriate may make them still find it affordable.
=== Estimation of data
As an estimation, I assume WP, S-Pass(SP) and EP holders are individual bearing only they own expenditure, whereas PEP bear expenditure of a family of 3, and ONE Pass holder bear expenditure of a family of 4. The rentals are estimated from average rental price of HDB 4-Room flat and 3-bedroom condo. I further assume:
- WP holders co-rent one HDB bedroom.
- SP/EP holders rent one bedroom.
- PEP and ONE-Pass holders rent one whole flat.
Monthly expenditure excluding rental are estimated from household expenditure data from HES and CPI. As for income estimation, I use minimum salaries required by Ministry of Manpower for each type of pass. Detailed code for estimations is available on LCPC's github repo#footnote[https://github.com/Wuvist/lcpc].
#figure(
tablex(
columns: 7,
align: center + horizon,
auto-vlines: false,
rowspanx(2)[], rowspanx(2)[*WP*], rowspanx(2)[*SP*], colspanx(2)[*EP*], rowspanx(2)[*PEP*], rowspanx(2)[*ONE Pass*],
[*Rent HDB*], [*Rent Condo*],
[Estimated Expenditure], [1,010], [1,667], [1,667], [3,454], [10,362], [13,816],
[Estimated Rental#h(28pt)], [562], [1,126], [1,126], [2,328], [4,656], [6,983],
[Estimated Income#h(24pt)], [1,600], [3,150], [5,000], [5,500#footnote[minimum salary requirement for EP in Financial Sector]], [22,500], [30,000],
[LCP], [0.98], [0.89], [0.56], [1.05], [0.67], [0.69],
),
kind: table,
caption: "ESTIMATED SG foreign worker's income & expenditure by type of work pass"
) <sg_worker_by_pass>
I have published an article@wechat in Chinese describing above estimation of foreign workers in Singapore's expenditure. Up to the moment of writing, this article has received over 3K views and comments leave by viewers confirmed my estimations to be very accurate comparing to their actual expenditure. The viewers indicated themselves from either the EP Rent HDB or EP Rent Condo group.
I used the minimum income for each type of work pass instead of using mean income because I believe it could serve better reference for foreigners considering working in Singapore. The LCP estimated using minimum income will be the best largest, so that potential workers could prepare themselves for the largest living cost pressure they need face if relocate to Singapore.
= LCPC for other economies
The proposed indicator LCPC should be flexible and applicable to economies beyond Singapore. When constructing LCPC for other economies, we must look into the specified characteristics of the economy.
For example, when segmenting by income level, could be applied to other economies without modification, providing household expenditures & income data by income level are available.
As mentioned earlier, segmenting by income level has its pro and cons. And in Singapore's case, segmenting by type of dwelling would provide better insight. When constructing LCPC for other economies, we may need to digest the characteristics of the local societies, and pick representing segmentation. It could be by income level, or by race/ethnic groups etc.
As LCPC for different economies may used different segmentation approach. Comparison of LCPC may not be meaningful. But, LCP as a scalar may be used for comparison among economies.
The shape and movement of LCPC in different period may also be used from cross comparison.
== Comparison with Hong Kong
Hong Kong is an economy once very similar to Singapore. Census and Statistics Department - C&SD in Hong Kong also conducts Household Expenditure Survey once every 5 years. That allows me to construct a similar LCPC for Hong Kong:
#figure(
image("data/LCPC_hk.png", width: 80%),
caption: "ESTIMATED HK LCPC by type of housing"
) <hk_lcpc>
#figure(
image("data/LCPC_hk_without_rent.png", width: 80%),
caption: "ESTIMATED HK LCPC exclude rent by type of housing"
) <hk_lcpc_without_rent>
C&SD separate type of housing into Public Housing, Subsidised Housing and Private Housing.
Hong Hong's Home Owner Rate is about 51.50% @hk_home_ownership, thus rental payment would be a significant factor when constructing LCPC.
In the latest LCPC for year 2019/20, all 3 groups face similar LCP about 0.64 in 2019/20 when rental are excluded; but when rental is included into expenditure as they should, LCP of the two non-public housing group jump significantly, they are very closed to 1. Implying a much higher living cost pressure if residents in Hong Kong are not able to stay in public housing.
If I'm allowed to do cross comparison of LCP between Singapore and Hong Kong, the LCP of Subsidised Housing group(0.97) is actually higher than SP group in SG LCPC for foreign workers(0.89). This may imply that there is incentive for Hong Kong resident to migrate to work in Singapore, if they could obtained a S-Pass or above.
Similar to Singapore, the LCPC of Hong Kong tends to shift downward from 2009/10 to 2019/20. But, it's import to note that it's only the "rich" and the "poor"'s LCPC decrease significantly in last decade. The middle class - group staying in Subsidised Housing's LCP is almost the same in 2009/10 and 2019/20, indicating their living cost pressure didn't get any better. It's even worse that this group's LCP increased to 1.04 in 2014/15. The "Squeezed Middle Class" effect seems a lot more obvious in Hong Kong.
Unlike Singapore, LCPC of Hong Kong is upward sloping, meaning households in Hong Kong face higher live cost pressure as they get richer and stay in better type of housing. If we exclude rental from expenditure, then LCPC of Hong Kong become similar to Singapore, i.e. downward sloping. Thus, we could safely conclude that rental expenditure is a critical factor impacting living cost prepare of households in Hong Kong.
The fundamental difference here between Hong Kong and Singapore is house ownership rate. Hong Kong's house ownership rate(51.50%) is much lower than Singapore(about 90%). Household in Hong Kong needs to pay rental which is a actual expenditure, whereas household in Singapore may just need to pay for mortgage, which is a form of asset conversion or even investment. This may further implies there will be big difference in the two economies's saving/investment rate, which may have large impact on their GDP growth rate. According to IMF#footnote[International Monetary Fund: https://www.imf.org/external/datamapper/NGDPDPC@WEO/SGP/HKG], Singapore and Hong Kong have very similar GDP per capita at least since 1980s, and it persisted until 2003. In 2023, Hong Kong's GDP per capita is only 58.2% of Singapore. Further growth accounting study of the two economies may confirm or reject this speculation.
=== Data for Hong Kong
Expenditure data for Hong Kong are obtained from Household Expenditure Survey: @hk_expenditure.
However, report of Household Expenditure Survey only includes household's average expenditure data but not income. Thus the income data is obtained from @hk_income. Unfortunately, this income data only reports median income level, but not average#footnote[Whereas Household Expenditure Survey only reports average expenditure, but not median.]. Thus the LCP for Hong Kong are calculated using the ratio between average expenditure over median income. If we assume that average income is higher than median, then these LCP would be lower if using average income, i.e. the whole LCPC may shift downward.
#figure(
tablex(
columns: 5,
align: center + horizon,
auto-vlines: false,
[*Year*], [], [*Public Housing*], [*Subsidised Housing*], [*Private Housing*],
rowspanx(5)[2009\ / \ 2010], [Average Rent], [1,116], [5,969], [9,573],
[Average Expenditure], [10,569], [19,288], [28,715],
[Median Income], [10,550], [19,750], [24,250],
[LCP], [1.00], [0.98], [1.18],
[LCP exclude Rent], [0.90], [0.67], [0.80],
rowspanx(5)[2014\ / \ 2015], [Average Rent], [1,576], [8,982], [13,582],
[Average Expenditure], [13,275], [26,075], [36,728],
[Median Income], [14,050], [25,000], [31,550],
[LCP], [0.94], [1.04], [1.16],
[LCP exclude Rent], [0.83], [0.68], [0.73],
rowspanx(5)[2019\ / \ 2000], [Average Rent], [1,701], [10,100], [15,218],
[Average Expenditure], [15,018], [27,631], [37,895],
[Median Income], [18,250], [28,400], [38,900],
[LCP], [0.82], [0.97], [0.97],
[LCP exclude Rent], [0.72], [0.61], [0.58],
),
kind: table,
caption: "Hong Kong Household expenditure & income by Type of housing"
) <hk_households>
Expenditure#footnote[Included rent] & income data in @hk_households are measured in HKD, no currency conversion are need, as LCP is a ratio which won't be affected by change of currency.
= Conclusion
The main purpose of LCPC is to propose a easy-to-use indicator for living cost pressure measurements. Essentially, LCPC has only two simple idea:
- Take ratio of expenditure and ratio to represent: Living Cost Pressure
- Perform meaningful segmentation to show how pressure is distributed among a economy
As shown in this paper, LCPC would have reference value to varies audiences. Local resident may use LCPC to compare how their living cost pressure other groups or compare with past. Foreign workers may use LCPC to have better understanding of working life in the new place. Researchers can use LCPC to compare of living cost pressure between economies and find out how live cost pressure of different group response to government policy.
When comparing LCPC of Hong Kong and Singapore, the living cost pressure among different classes and their trends between the two economies are significant. LCPC reveals economic incentive for workers' consideration to relocate and perhaps even major factor driving difference in long term GDP growth.
LCPC's idea is simple but its applications could be very versatile and powerful.
Bottom line, I hope SG's LCPC would serve as a response if WCOL by EIU hits news headline again in future.
All data and source code used for this paper are available at: https://github.com/Wuvist/lcpc
#bibliography("lcpc.bib", style:"harvard-cite-them-right")
#set text(gray)
#set align(right)
#total-words words in total, excluding Section Title / Code / Bibliography.
|
|
https://github.com/DannySeidel/typst-dhbw-template | https://raw.githubusercontent.com/DannySeidel/typst-dhbw-template/main/examples/example.typ | typst | MIT License | #import "@preview/supercharged-dhbw:3.3.1": *
#let acronyms = (
"VIP": "Very important person",
)
#show: supercharged-dhbw.with(
title: "Exploration of Typst for the Composition of a University Thesis",
authors: (
(name: "<NAME>", student-id: "7654321", course: "TIS21", course-of-studies: "IT-Security", company: (
(name: "YXZ GmbH", post-code: "70435", city: "Stuttgart")
)),
(name: "<NAME>", student-id: "1234567", course: "TIM21", course-of-studies: "Mobile Computer Science", company: (
(name: "ABC S.L.", post-code: "08005", city: "Barcelona", country: "Spain")
)),
),
acronyms: acronyms, // displays the acronyms defined in the acronyms dictionary
at-university: false, // if true the company name on the title page and the confidentiality statement are hidden
confidentiality-marker: (display: true),
bibliography: bibliography("example-sources.yml"),
date: datetime.today(),
language: "en", // en, de
supervisor: (company: "<NAME>"),
university: "Cooperative State University Baden-Württemberg",
university-location: "Ravensburg Campus Friedrichshafen",
university-short: "DHBW",
// for more options check the package documentation (https://typst.app/universe/package/supercharged-dhbw)
)
= Section A
A #acr("VIP") once said this:
#lorem(250) @examplesource |
https://github.com/OthoDeng/Typst-notes | https://raw.githubusercontent.com/OthoDeng/Typst-notes/main/GIS/doc/notes.typ | typst | #import "@preview/dvdtyp:1.0.0": *
#show: dvdtyp.with(
title: "Remote Sensing",
subtitle: [Observing the Earth's changing climate],
author: "<NAME>",
date: "15/07 ~ 26/07",
abstract: "This is the note taken in class, written in " + link("https://tpyst.app")[Typst] + [. If you woud like to try out typology, it is strongly recommended to have a look at ] +link("https://github.com/typst-doc-cn/tutorial/")[Typst-doc-cn]+ [.],
)
#outline()
#v(6cm)
= Earth Energy Budget
Earth Energy Budget is a calculated Figure of the flow of energy, in radiation.
== Radiation
#problem[
Why global warming?
]
Global warming has nothing to do with green house gases.
#example("addition")[Suppose you have a blanket in a room. One blamket is enougth
]
#definition("Shortwave Radiation")[
Shortwave radiation. Most radiation emmited by sun is short-wave.
]
#definition("Longwave Radiation")[
Longwave radiation. wave that reflescted from the ground.
]
= Passive Remote Sensing
#theorem("Wein's Law")[
$ lambda _max = b / T $
Where b is constant, T is the temperature.
]
#theorem("Plank's Law")[
$ B_nu (nu,T) = (2 h nu ^3) /c^2 1/(exp((h nu)/(k_beta T)) -1) $
]
#theorem("Bolzmann")[
For an ideal absorber/emitter or black body, the Stefan–Boltzmann law states that the total energy radiated per unit surface area per unit time is directly proportional to the fourth power of the black body's temperature, T:
$ M ^o = sigma T^4$
]
Note the absorption of water vapor in all part of the spectrum and the absorption of $C O_2$.
= How do satellite radiometers work?
== NISTAR
Single NISTAR Eletrical Substitution Radiometer Channel.
Only measure the infra part.
#definition[
$ "IR" = "TOTAL" - "VIS" $
]
== AVHRR
The Advanced Very High Resolution Radiometer.
AVHRR Imaging:
$
cases("Visible",
"Near IR",
"IR Channel"
)$
AVHRR Special Bands
== Radiometric Scanning
#definition("Swath")[
Swath. The width of a satellite's orbit path.
]
== Visible Remote Sensing - Ocean
Chlorophy Concentration
= Satellite & History
#theorem("Kelpler's Third Theory")[
$ r^3\/T^3 = "constant" $
]
#theorem("Newton's Univesal Gravity")[
$ F = G (m_1 m_2)/r^2 $
]
== Satellite Orbits around the Earth
1. Geostationary / Geosynchronous Orbit
2. Polar Orbit
= Hottest Year on Record
== How to measure the temperature?
#definition("Thermometer")[
Begins in 1980.
]
#problem[
Sparse Spatial Coverage over Oceans. No records with Thermometer Record. Before 2000.
]
*Solutions:* Ships!
There is Global Ship Track Array
= Suggested Research Topic
#problem[Application of Remote Sensing in Climate Change Monitoring. ]
Students can study how to use satellite remote sensing data to monitor changes in the Earth's environment that are caused by #highlight("anthropogenic climate change"). This monitoring can include changes in the Earth's surface temperature or the extend of the Earth's glaciers and sea ice coverage, using #highlight("advanced satellite retrieval") methods.
#problem[The rise and fall of greenhouse gases since the last ice age. ]
Climate changes across the past 24,000 years provide key insights into Earth system responses to external forcing. Global climate change has become a global problem as a result of accelerated human activity and industrialization. Since the Industrial Revolution, the rate of global warming has increased considerably compared to the rate of paleoclimatic warming. Comparing the #highlight("rate of warming") since the Industrial Revolution with the rate of paleoclimatic warming is of great significance for understanding the impact of human activities on global climate change and provides a scientific basis for formulating measures to address climate change.
#problem[Paleo-perspectives on Arctic warming. ]
Ice is more reflective and less absorbent of sunlight than land or the surface of an ocean. When ice melts, it typically reveals darker areas of land or sea, and this results in increased sunlight absorption and associated warming. #highlight("Polar amplification") is much stronger in the Arctic than in Antarctica. What effects is Arctic amplification having, both in the region and for the world? And How we explain Arctic warming in Paleo-perspectives?
== Important Note
#definition[
二氧化碳、甲烷浓度寿命。
]
#definition("Global Warming Potential")[
GWP。一化學物質的全球變暖潛勢定義為從開始釋放一公斤該物質起,一段時間內輻射效應的對時間積分,相對於同條件下釋放一公斤參考氣體(二氧化碳)對應時間積分的比值:
$ "GWP"(x) = (integral^"TH" _0 a_x dot \[x(t) \] dif t )/(integral^"TH" _0 a_r dot \[r(t) \] dif t ) $
]
== Dataset
- Temperature(surface): GISSTEMP, Copernicus
- Precipitation: GPCP
- Cloulds: ISCCP-H, MODIS
- Radiation: CERES(ASR, LW, Total)
#definition("GISSTEMP-v4")[
The GISS Surface Temperature Analysis version 4 (GISTEMP v4) is an estimate of global surface temperature change.
]
Combined Land-Surface Air and Sea-Surface Water Temperature Anomalies (Land-Ocean Temperature Index, L-OTI):
- *Global-mean monthly*, seasonal, and annual means, 1880-present, updated through most recent month
- *Northern Hemisphere-mean monthly*, seasonal, and annual means, 1880-present, updated through most recent month
- *Southern Hemisphere-mean monthly*, seasonal, and annual means, 1880-present, updated through most recent month
- *Zonal annual means*, 1880-present, updated through most recent complete year
#definition("ISSCCP-h")[
The Cloud Properties - International Satellite Cloud Climatology Project (ISCCP) H-Series Climate Data Record (CDR) focuses on the distribution and variation of cloud radiative properties to improve understanding and modeling of the way clouds affect climate. This dataset provides an improved understanding of the radiation budget, as well as specific insight on the relationship between clouds and the radiation balance. These data can be used to support many other cloud studies, including efforts to understand the long-term global hydrologic cycle. The dataset period of record includes data from 1983 to 2018.
]
#definition("CERES")[
http://ceres.larc.nasa.gov
]
== Data Analysis
#definition("Mean")[
$ macron(X) = sum^n _(i=1) x_i $
]
#definition("Variance")[
$ sigma^2 = (sum \(x_i - mu\)^2)/n $
]
= Revisit the scattering spectrum of the Eart
== Calculating Mean Temperature
#theorem("Calculating Mean Temp")[
$ macron(T) = sum ^365 _(i=1) (cos("Latitude") * T_i) /360 $
$ macron(P) = (integral.double _Omega "perp" dot dif x dot dif y)/(integral.double _Omega dif x dot dif y) $
]
== The Urban Heat Island effect.
#example("Urban Heat Island Adjustment")[
At night, the cities can be labelled as Use the darker weather station at night.
]
== Revisit the scattering spectrum of the Earth
#problem[ There is clouds, we can't measure the surface temperature.
]
Microwave radiation whenever there is clouds.
Requires a large area. The sea surface temperature. But you can not use it in the continent.
== Hyperspectual Raidiometer
Retrive radiation in hundreds of Channels.
== Conclusion
#rect("Thermometer:")
- Reliable surface measurements
- Long temperature record
- Poor Coverage over oceans
- Urban Heat effect
#rect("Satellite:")
- Global coverage
- short temperature record
- Cloud effect
== Looking at the trends
#definition("Linear Regression. ")[
For every grid of great point. we take average of the year, do a linear Regression, calculate the slope of the linear regression. $dif/(dif t) T$.
]
= Tasks
#problem("Week 1")[
计算逐年/逐月平均的云/辐射/降水数据随时间变化。
]
1. 查找文献(研究背景、前人的研究基础、Knowledge Gap、研究意义)
2. 确认选题(具体变量、区域、研究时间段、可能的影响机制)
3. Coding
4. Paper Writing
Extention: #highlight("聚类、EOF、神经网络")
= Write a Research Paper
#example("Outline")[
0. Abstract
1. Introduction
2. Data and Methods
3. Results
4. Conclusions
5. References
]
== Abstract
The last thing you write, written finally. 100~150 words, no citing, avoid "I", No copying the conclusion.
=== Plain Language Summary (Optional)
== Introduction
The previous paper in similar field published in the past.
```
In this Study, we ...
^^ ^^^^ ^^^^^
```
The most important part, what we are doing, why it's important.
== Data and Methods
=== Data
Generally describe & explain the mechanism and give a citation.
=== Methods
Modeling citing, (domain, last access : DD-MM-YYYY)
== Results
- Graphs
The most significant figure shall put first.
== Conclusions (or Discussions)
```
Further modeling studies are needed to fully understand ...
^^^^^^
```
=== Data Availability Statement
== References
Do follow the citation standard.
|
|
https://github.com/teshu0/CLIT-report-typst | https://raw.githubusercontent.com/teshu0/CLIT-report-typst/main/template/utils.typ | typst | Creative Commons Zero v1.0 Universal | #let font_gothic = ("Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP")
#let font_serif = ("YuMincho", "Yu Mincho", "Noto Serif CJK JP")
// タイトルの表示
#let title(font_size: 18pt, content) = {
set align(center)
set text(size: font_size, font: font_serif, weight: "medium")
content
}
// 著者の表示
#let author(font_size: 12pt, content) = {
set align(center)
set text(size: font_size, font: font_serif)
content
}
#let date(font_size: 12pt, content: none) = {
set align(center)
set text(size: font_size, font: font_serif)
if content == none {
content = datetime.today(offset: +9)
}
content.display(
"[year]/[month]/[day]"
)
} |
https://github.com/isaacholt100/isaacholt100.github.io | https://raw.githubusercontent.com/isaacholt100/isaacholt100.github.io/master/maths-notes/3-durham%3A-year-3/number-theory/number-theory.typ | typst | #import "../../template.typ": *
#show: doc => template(doc, hidden: ("proof",), slides: false)
// FIND: - \*(\w+)\*: ([\s\S]*?)(?=\n-|\n\n)\n
// REPLACE: #$1[\n $2\n]\n
#let ideal(..gens) = $angle.l #gens.pos().join(",") angle.r$
#let pm = $plus.minus$
#let Cl = $op("Cl")$
== Prerequisites
#definition[
$I subset R$ is *prime ideal* if $forall a, b in R, a b in I ==> a in I or b in I$.
]
#definition[
Ideal $I$ is *maximal* if $I != R$ and there is no ideal $J subset R$ such that $I subset J$.
]
#example[
- $p in ZZ$ is prime iff $ideal(p) = p ZZ$ is prime ideal.
- $ideal(0)$ is prime ideal iff $R$ is integral domain.
]
#lemma[
If $I$ is maximal ideal, then it is prime.
]
#proposition[
For commutative ring $R$, ideal $I$:
- $I subset R$ is prime ideal iff $R \/ I$ is an integral domain.
- $I$ is maximal iff $R \/ I$ is field.
]
#proposition[
Let $R$ be PID and $a in R$ irreducible. Then $ideal(a) = ideal(a)_R$ is maximal.
]<ideals-generated-by-irreducible-elements-in-PIDs-are-maximal>
#theorem[
Let $F$ be field, $f(x) in F[x]$ irreducible. Then $F[x] \/ ideal(f(x))$ is a field and a vector space over $F$ with basis $B = \{1, overline(x), ..., overline(x)^(n - 1)\}$ where $n = deg(f)$. That is, every element in $F[x] \/ ideal(f(x))$ can be uniquely written as linear combination $ overline(a_0 + a_1 x + hdots + a_(n - 1) x^(n - 1)), quad a_i in F $
]
= Divisibility in rings
== Every ED is a PID
#definition[
Let $R$ integral domain. $phi: R - {0} -> NN_0$ is *Euclidean function (norm)* on $R$ if:
- $forall x, y in R - {0}, phi(x) <= phi(x y)$.
- $forall x in R, y in R - {0}, exists q, r in R: x = q y + r$ with either $r = 0$ or $phi(r) < phi(y)$.
$R$ is *Euclidean domain (ED)* if Euclidean function is defined on it.
]
#example[
- $ZZ$ is ED with $phi(n) = |n|$.
- $F[x]$ is ED for field $F$ with $phi(f) = deg(f)$.
]
#lemma[
$ZZ\[-sqrt(2)\]$ is ED with Euclidean function $ phi\(a + b sqrt(-2)\) = N\(a + b sqrt(-2)\) := a^2 + 2b^2 $
]
#proposition[
Every ED is a PID.
]
== Every PID is a UFD
#definition[
Integral domain $R$ is *unique factorisation domain (UFD)* if every non-zero non-unit in $R$ can be written uniquely (up to order of factors and multiplication by units) as product of irreducible elements in $R$.
]
#example[
Let $R = {f(x) in QQ[x]: f(0) in ZZ}$. Its units are $pm 1$. Any factorisation of $x in R$ must be of the form $f(x) g(x)$ where $deg f = 1, deg g = 0$, so $x = (a x + b)c$, $a in QQ$, $b, c in ZZ$. We have $b c = 0$ and $a c = 1$ hence $x = x / c dot.op c$. So $x$ is not irreducible if $c != pm 1$. Also, any factorisation of $x / c$ in $R$ is of the form $x / c = x / (c d) dot.op d$, $d in ZZ$, $d != 0$. Again, neither factor is a unit when $d != pm 1$. So $x = x / c dot.op c = x / (c d) dot.op d dot.op c = hdots$ can never be decomposed into irreducibles (the first factor is never irreducible).
]
#lemma[
Let $R$ be PID. Then every irreducible element is prime in $R$.
]<irreducible-elements-in-PIDs-are-prime>
#theorem[
Every PID is a UFD.
]
#example[
$ZZ\[sqrt(-2)\]$ is ED so by the above theorem it is a UFD. Let $x, y in ZZ$ such that $y^2 + 2 = x^3$.
- $y$ must be odd, since if $y = 2a, a in ZZ$ then $x = 2b, b in ZZ$ but then $2a^2 + 1 = 4b^3$.
- $y pm sqrt(-2)$ are relatively prime: if $a + b sqrt(-2)$ divides both, then it divides their difference $2 sqrt(-2)$, so norm $a^2 + 2b^2 | N(2 sqrt(-2)) = 8$. Only possible case is $a = pm 1, b = 0$ so $a + b sqrt(-2)$ is unit. Other cases $a = 0, b = pm 1$, $a = pm 2, b = 0$ and $a = 0, b = pm 2$ are impossible since $y$ not even.
- If $a + b sqrt(-2)$ is unit, $exists x, y in ZZ: (a + b sqrt(-2)) (x + y sqrt(-2)) = 1$. If $b != 0$ then $(-a^2 - 2b^2)y = 1 ==> b = 0$: contradiction. If $b = 0$, $a = pm 1$. So only units in $ZZ\[sqrt(-2)\]$ are $plus.minus 1$.
]
= Finite field extensions
#definition[
Let $F$, $L$ fields. If $F subset.eq L$ and $F$ and $L$ share the same operations then $F$ is a *subfield* of $L$ and $L$ is *field extension* of $F$ (denoted $L \/ F$). $L$ is vector space over $F$:
- $0 in L$ (zero vector).
- $u, v in L ==> u + v in L$ (additivity).
- $a in F, u in L ==> a u in L$ (scalar multiplication).
]
#definition[
Let $L \/ F$ field extension. *Degree* of $L$ over $F$ is dimension of $L$ as vector space over $F$: $ [L: F] := dim_F (L) $ If $[L: F]$ finite, $L \/ F$ is *finite field extension*.
]
#example[
$QQ\(sqrt(-2)\) = \{a + b sqrt(-2): a, b in QQ\}$ is isomorphic as a vector space to $QQ^2$ so is $2$-dimensional vector space over $QQ$. Isomorphism is $a + b sqrt(-2) <--> (a, b)$. Standard basis $\{e_1, e_2\}$ in $QQ^2$ corresponds to the basis $\{1, sqrt(-2)\}$ in $QQ\(sqrt(-2)\)$. $\[QQ\(sqrt(-2)\): QQ\] = 2$.
]
#example[
$[CC: RR] = 2$ (a basis is ${1, i}$). $[RR: QQ]$ is not finite, due to the existence of transcendental numbers (if $alpha$ transcendental, then $\{1, alpha, alpha^2, ...\}$ is linearly independent).
]
#definition[
Let $L \/ F$ field extension. $alpha in L$ is *algebraic* over $F$ if $ exists 0 != f(x) in F[x]: f(alpha) = 0 $ If all elements in $L$ are algebraic, then $L \/ F$ is *algebraic field extension*.
]
#example[
$i in CC$ is algebraic over $RR$ since $i$ is root of $x^2 + 1$. $CC \/ RR$ is algebraic since $z = a + b i$ is root of $(x - z)(x - overline(z)) = x^2 - 2a x + a^2 + b^2$.
]
#proposition[
If $L \/ F$ is finite field extension then it is algebraic.
]
#definition[
Let $L \/ F$ field extension, $alpha in L$ algebraic over $F$. *Minimal polynomial* $p_alpha (x) = p_(alpha, F) (x)$ of $alpha$ over $F$ is the monic polynomial $f$ of smallest degree such that $f(alpha) = 0$. *Degree* of $alpha$ over $F$ is $deg(p_alpha)$.
]
#proposition[
$p_alpha (x)$ is unique and irreducible. Also, if $f(x) in F[x]$ is monic, irreducible and $f(alpha) = 0$, then $f = p_alpha$.
]
#example[
- $p_(i, RR)(x) = p_(i, QQ)(x) = x^2 + 1$, $p_(i, QQ(i))(x) = x - i$.
- Let $alpha = root(7, 5)$. $f(x) = x^7 - 5$ is minimal polynomial of $alpha$ over $QQ$ by above proposition, as it is irreducible by Eisenstein's criterion with $p = 5$.
- Let $alpha = e^(2pi i\/p)$, $p$ prime. $alpha$ is algebraic as root of $x^p - 1$ which isn't irreducible as $x^p - 1 = (x - 1) Phi(x)$ where $Phi(x) = (x^(p - 1) + hdots + 1)$. $Phi(alpha) = 0$ since $alpha != 1$, $Phi(x)$ is monic and $Phi(x + 1) = ((x + 1)^p - 1)\/x$ irreducible by Eisenstein's criterion with $p = p$, hence $Phi(x)$ irreducible. So $p_alpha (x) = Phi(x)$.
]
== Fields generated by elements
#definition[
Let $L\/F$ field extension, $alpha in L$. The *field generated by $alpha$ over $F$* is the smallest subfield of $L$ containing $F$ and $alpha$: $ F(alpha) := sect.big_(K "field", \ F subset.eq K subset.eq L, \ alpha in K) K $ Generally, $F(alpha_1, ..., alpha_n)$ is smallest field extension of $F$ containing $alpha_1, ..., alpha_n$.
]
- We have $F(alpha_1, ..., alpha_n) = F(alpha_1) hdots (alpha_n)$ (show $F(alpha, beta) subset.eq F(alpha)(beta)$ and $F(alpha)(beta) subset.eq F(alpha, beta)$ by minimality and use induction).
#definition[
$F[alpha] = \{sum_(i = 0)^n a_i alpha^i: a_i in F, n in NN\} = {f(alpha): f(x) in F[x]}$.
]
#lemma[
Let $L\/F$ field extension, $alpha in L$ algebraic over $F$. Then $F[alpha]$ is field, hence $F(alpha) = F[alpha]$.
]
#lemma[
Let $alpha$ algebraic over $F$. Then $[F(alpha): F] = deg(p_alpha)$.
]
#definition[
Let $K\/F$ and $L\/K$ field extensions, then $F subset.eq K subset.eq L$ is *tower of fields*.\
]
#theorem(name: "Tower theorem")[
Let $F subset.eq K subset.eq L$ tower of fields. Then $ [L: F] = [L: K] dot.op [K: F] $
]
#example[
Let $L = QQ\(sqrt(2), sqrt(3)\)$. Show $[L: QQ] = 4$.
- Let $K = QQ\(sqrt(2)\)$. Let $sqrt(3) = a + b sqrt(2)$, $a, b in QQ$ so $3 = a^2 + 2b^2 + 2a b sqrt(2)$. So $0 in {a, b}$, otherwise $sqrt(2) in QQ$. But if $a = 0$, then $sqrt(6) = 2b in QQ$, if $b = 0$ then $sqrt(3) = a in QQ$: contradiction. So $x^2 - 3$ has no roots in $K$ so is irreducible over $K$ so $p_(sqrt(3), K)(x) = x^2 - 3$.
- So $[L: K] = 2$ so by the tower theorem, $[L: QQ] = [L: K] dot.op [K: QQ] = 4$.
]
== Norm and trace
- Let $L\/F$ finite field extension, $n = [L: F]$. For any $alpha in L$, there is $F$-linear map $ hat(alpha): L --> L, quad x |-> alpha x $
- With basis $\{alpha_1, ..., alpha_n\}$ of $L$ over $F$, let $T_alpha = T_(alpha, L\/F) in M_n (F)$ be the corresponding matrix of the linear map $alpha$ with respect to the basis $\{alpha_i\}$: $ hat(alpha)(alpha_1) & = alpha alpha_1 = a_(1, 1) alpha_1 + hdots + a_(1, n) alpha_n, \ & thick dots.v \ hat(alpha)(alpha_n) & = alpha alpha_n = a_(n, 1) alpha_1 + hdots + alpha_(n, n) alpha_n $ with $a_(i, j) in F$, $T_alpha = (a_(i, j))$, so $alpha$ is eigenvalue of $T_alpha$: $ alpha vec(alpha_1, dots.v, alpha_n) = T_alpha vec(alpha_1, dots.v, alpha_n) $
#definition[
*Norm* of $alpha$ is $ N_(L\/F)(alpha) := det(T_alpha) $
]
#definition[
*Trace* of $alpha$ is $ tr_(L\/F)(alpha) := tr(T_alpha) $
]
#remark[
Norm and trace are independent of choice of basis so are well-defined (uniquely determined by $alpha$).
]
#example[
Let $L = QQ(sqrt(m))$, $m in ZZ$ non-square, let $alpha = a + b sqrt(m) in L$. Fix basis $\{1, sqrt(m)\}$. Now $ hat(alpha)(1) & = alpha dot.op 1 = a + b sqrt(m), \ hat(alpha)(sqrt(m)) & = alpha sqrt(m) = b m + a sqrt(m), \ T_alpha & = mat(a, b; b m, a) $ So $N_(L\/F)(alpha) = a^2 - b^2 m$, $tr_(L\/F)(alpha) = 2a$.
]
#lemma[
The map $L -> M_n (F)$ given by $alpha |-> T_alpha$ is injective ring homomorphism. So if $f(x) in F[x]$, $ T_(f(alpha)) = f(T_alpha) $ ($f(T_alpha)$ is a polynomial in $T_alpha$, not $f$ applied to each entry).
]
#proposition[
Let $L\/F$ finite field extension. $forall alpha, beta in L$,
- $N_(L\/F)(alpha) = 0 <==> alpha = 0$.
- $N_(L\/F)(alpha beta) = N_(L\/F)(alpha) N_(L\/F)(beta)$.
- $forall a in F, N_(L\/F)(a) = a^([L: F])$ and $tr_(L\/F)(a) = [L: F] a$.
- $forall a, b in F, tr_(L\/F)(a alpha + b beta) = a tr_(L\/F)(alpha) + b tr_(L\/F)(beta)$ (so $tr_(L\/F)$ is $F$-linear map).
]
== Characteristic polynomials
- Let $A in M_n (F)$, then characteristic polynomial is $chi_A (x) = det(x I - A) in F[x]$ and is monic, $deg(chi_A) = n$. If $chi_A (x) = x^n + sum_(i = 0)^(n - 1) c_i x^i$ then $det(A) = (-1)^n det(0 - A) = (-1)^n chi_A (0) = (-1)^n c_0$ and $tr(A) = -c_(n - 1)$, since if $alpha_1, ..., alpha_n$ are eigenvalues of $A$ (in some field extension of $F$), then $tr(A) = alpha_1 + hdots + alpha_n$, $chi_A (x) = (x - alpha_1) hdots (x - alpha_n) = x^n - (alpha_1 + hdots alpha_n) x^(n - 1) + hdots$.
- For finite extension $L\/F$, $n = [L: F]$, $alpha in L$, *characteristic polynomial* $chi_alpha (x) = chi_(alpha, L\/F)(x)$ is characteristic polynomial of $T_alpha$. So $N_(L\/F)(alpha) = (-1)^n c_0$, $tr_(L\/F)(alpha) = -c_(n - 1)$. By the Cayley-Hamilton theorem, $chi_alpha (T_alpha) = 0$ so $T_(chi_alpha (alpha)) = chi_alpha (T_alpha) = 0$, where $chi_alpha (x) = x^n + c_(n - 1) x^(n - 1) + hdots + c_0$. Since $alpha -> T_alpha$ is injective, $chi_alpha (alpha) = 0$.
#lemma[
Let $L\/F$ finite extension, $alpha in L$ with $L = F(alpha)$. Then $chi_alpha (x) = p_alpha (x)$.
]
#proposition[
Let $F subset.eq F(alpha) subset.eq L$, let $m = [L: F(alpha)]$. Then $chi_alpha (x) = p_alpha (x)^m$.
]
#corollary[
Let $L\/F$, $alpha in L$, $m = [L: F(alpha)]$, $p_alpha (x) = x^d + a_(d - 1) x^(d - 1) + hdots + a_0$, $a_i in F$. Then $ N_(L\/F)(alpha) = (-1)^(m d) a_0^m, quad tr_(L\/F)(alpha) = -m a_(d - 1) $
]
= Algebraic number fields and algebraic integers
== Algebraic numbers
#definition[
$alpha in CC$ is *algebraic number* if algebraic over $QQ$.
]
#definition[
$K$ is *(algebraic) number field* if $QQ subset.eq K subset.eq CC$ and $[K: QQ] < oo$.
]
- Every element of an algebraic number field is an algebraic number.
#example[
Let $theta = sqrt(2) + sqrt(3)$, then $QQ(theta) subset.eq QQ\(sqrt(2), sqrt(3)\)$ but also $theta^3 = 11 sqrt(2) + 9 sqrt(3)$ so $ sqrt(2) = (theta^3 - 9 theta)/2, quad sqrt(3) = (-theta^3 + 11 theta)/2 $ so $QQ\(sqrt(2), sqrt(3)\) subset.eq QQ(theta)$ hence $QQ\(sqrt(2), sqrt(3)\) = QQ(theta)$.
]
#theorem(name: "Simple extension theorem")[
Every number field $K$ has form $K = QQ(theta)$ for some $theta in K$.
]
- Set of all algebraic numbers (union of all number fields) is denoted $overline(QQ)$ and is a field, since if $alpha != 0$ algebraic over $QQ$, $[QQ(alpha): QQ] = deg(p_alpha) < oo$ so $QQ(alpha)\/QQ$ algebraic, so $-alpha, alpha^(-1) in QQ(alpha)$ algebraic, so $alpha^(-1), -alpha in overline(QQ)$, and if $alpha, beta in overline(QQ)$ then $QQ(alpha, beta) = QQ(alpha)(beta)$ is finite extension of $QQ$ by tower theorem so $alpha + beta$, $alpha beta in QQ(alpha, beta)$ so are algebraic.
- $\[overline(QQ): QQ\] = oo$ since if $\[overline(QQ): QQ\] = d in NN$ then every algebraic number would have degree $<= d$, but $root(d + 1, 2)$ has degree $d + 1$ since it is a root of $x^(d + 1) - 2$ which is irreducible by Eisenstein's criterion with $p = 2$.
#definition[
Let $alpha in overline(QQ)$. *Conjugates* of $alpha$ are roots of $p_alpha (x)$ in $CC$.
]
#example[
- Conjugate of $a + b i in QQ(i)$ is $a - b i$.
- Conjugate of $a + b sqrt(2) in QQ\(sqrt(2)\)$ is $a - b sqrt(2)$.
- Conjugates of $theta$ do not always lie in $QQ(theta)$, e.g. for $theta = root(3, 2)$, $p_theta (x) = x^3 - 2$ has two non-real roots not in $QQ(theta) subset RR$.
]
#notation[
When base field is $QQ$, $N_K$ and $tr_K$ denote $N_(K\/QQ)$ and $tr_(K\/QQ)$.
]
#lemma[
Let $K\/QQ$ number field, $alpha in K$, $alpha_1, ..., alpha_n$ conjugates of $alpha$. Then $ N_K (alpha) = (alpha_1 thin hdots thin alpha_n)^([K: QQ(alpha)]), quad tr_K (alpha) = (alpha_1 + hdots + alpha_n) [K: QQ(alpha)] $
]
== Algebraic integers
#definition[
$alpha in overline(QQ)$ is *algebraic integer* if it is root of a monic polynomial in $ZZ[x]$. The set of algebraic integers is denoted $overline(ZZ)$. If $K\/QQ$ is number field, set of algebraic integers in $K$ is denoted $cal(O)_K$, $alpha in cal(O)_K$ is called *integer in $K$*.
]
#example[
$i, (1 + sqrt(3))\/2 in overline(ZZ)$ since they are roots of $x^2 + 1$ and $x^2 - x + 1$ respectively.
]
#theorem[
Let $alpha in overline(QQ)$. The following are equivalent:
- $alpha in overline(ZZ)$.
- $p_alpha (x) in ZZ[x]$.
- $ZZ[alpha] = \{sum_(i = 0)^(d - 1) a_i alpha^i: a_i in ZZ\}$ where $d = deg(p_alpha)$.
- There exists non-trivial finitely generated abelian additive subgroup $G subset CC$ such that $ alpha G subset.eq G "i.e." forall g in G, alpha g in G $ ($alpha g$ is complex multiplication).
]
#remark[
- For third statement, generally we have $ZZ[alpha] = {f(alpha): f(x) in ZZ[x]}$ and in this case, $ZZ[alpha] = {f(alpha): f(x) in ZZ[x], deg(f) < d}$.
- Fourth statement means that $ G = {a_1 gamma_1 + hdots + a_r gamma_r: a_i in ZZ} = gamma_1 ZZ + hdots + gamma_r ZZ = ideal(gamma_1, ..., gamma_r)_ZZ $ $G$ is typically $ZZ[alpha]$. E.g. if $alpha = sqrt(2)$, $ZZ\[sqrt(2)\]$ is generated by $1, sqrt(2)$ and $sqrt(2) dot.op ZZ\[sqrt(2)\] subset.eq ZZ\[sqrt(2)\]$.
]
#proposition[
$overline(ZZ)$ is a ring. Also, for every number field $K$, $cal(O)_K$ is a ring.
]
#lemma[
Let $alpha in overline(ZZ)$. For every number field $K$ with $alpha in K$, $ N_K (alpha) in ZZ, quad tr_K (alpha) in ZZ $
]
#lemma[
Let $K$ number field. Then $ K = {alpha / m: alpha in cal(O)_K, m in ZZ, m != 0} $
]
#lemma[
Let $alpha in overline(ZZ)$, $K$ number field, $alpha in K$. Then $ alpha in cal(O)_K^times <==> N_K (alpha) = plus.minus 1 $
]
== Quadratic fields and their integers
#definition[
$d in ZZ$ is *squarefree* if $d in.not {0, 1}$ and there is no prime $p$ such that $p^2 | d$.
]
#definition[
$K = QQ\(sqrt(d)\)$ is a *quadratic field* if $d$ is squarefree. If $d > 0$ then it is *real quadratic*. If $d < 0$ it is *imaginary quadratic*.
]
#proposition[
Let $K\/QQ$ have degree $2$. Then $K = QQ\(sqrt(d)\)$ for some squarefree $d in ZZ$.
]
#lemma[
Let $K = QQ\(sqrt(d)\)$, $d equiv 1 thick (mod 4)$. Then $ ZZ\[ (1 + sqrt(d))/2 \] = {(r + s sqrt(d))/2: r, s in ZZ, r equiv s thick (mod 2)} $
]
#theorem[
Let $K = QQ\(sqrt(d)\)$ quadratic field, then $ cal(O)_K = cases(ZZ\[sqrt(d)\] & "if" d equiv.not 1 thick (mod 4), ZZ\[ (1 + sqrt(d))/2\] & "if" d equiv 1 thick (mod 4)) $
]
= Units in quadratic rings
#notation[
In this section, let $K = QQ\(sqrt(d)\)$ be quadratic number field, $d in ZZ - {0}$, $|d|$ is not a square. Let $cal(O)_d = cal(O)_K$. Let $overline(a + b sqrt(d)) = a - b sqrt(d)$. The map $x -> overline(x)$ is a $QQ$-automorphism from $K$ to $K$.
]
#definition[
$S$ is *quadratic number ring of $K$* if $S = cal(O)_d$ or $S = ZZ\[sqrt(d)\]$.
]
- We have $ alpha in S^times ==> exists x in S: alpha x = 1 ==> N_K (alpha) N_K (x) = 1 ==> N_K (alpha) = plus.minus 1 $ and for $alpha in S - ZZ$, since $[QQ(alpha): QQ] = 2$ and so $[K: QQ(alpha)] = 1$ by the Tower Theorem, $ N_K (alpha) = plus.minus 1 ==> alpha overline(alpha) = plus.minus 1 ==> alpha in S^times $ So $alpha in S^times <==> N_K (alpha) = plus.minus 1$.
#theorem[
To determine the group of units for imaginary quadratic fields:
- \
- For $d < -1$, $ZZ\[sqrt(d)\]^times = {plus.minus 1}$.
- $cal(O)_(-1)^times = ZZ[i]^times = {plus.minus 1, plus.minus i}$.
- \
- For $d equiv 1 thick (mod 4)$ and $d < -3$, $ZZ\[ (1 + sqrt(d))/2\]^times = {plus.minus 1}$.
- $ZZ\[ (1 + sqrt(-3))/2\]^times = {plus.minus 1, plus.minus omega, plus.minus omega^2}$ where $omega = (1 + sqrt(-3))/2 = e^(pi i\/3)$.
]
#theorem(name: "Main theorem")[
Let $d > 1$, $d$ non-square, $S$ be quadratic number ring of $K = QQ\(sqrt(d)\)$ (i.e. $S = cal(O)_d$ or $S = ZZ\[sqrt(d)\]$). Then
- $S$ has a smallest unit $u > 1$ (smaller than all units except $1$).
- $S^times = {plus.minus u^r: r in ZZ} = ideal(-1, u)$.
]<main-theorem-for-units>
#definition[
The smallest unit $u > 1$ above is the *fundamental unit* of $S$ (or of $K$, in the case $S = cal(O)_d$).
]
== Proof of the main theorem
#remark[
If $alpha = a + b sqrt(d)$ is unit in $ZZ\[sqrt(d)\]$, $a, b > 0$, then $N_K (alpha) = alpha overline(alpha) = plus.minus 1$, so $ |overline(alpha)| = |a - b sqrt(d)| = (|N_K (alpha)|)/(|alpha|) = 1/(|alpha|) < 1/(b sqrt(d)) < 1/b $ Define $ A = {alpha = a + b sqrt(d): a, b in NN_0, |overline(alpha)| < 1/b} $
]
#lemma[
$|A| = oo$.
]
#lemma[
If $alpha in A$, then $|N_K (alpha)| < 1 + 2 sqrt(d)$.
]
#lemma[
$exists alpha = a + b sqrt(d), alpha' = a' + b' sqrt(d) in A: alpha > alpha'$, $|N_K (alpha)| = |N_K (alpha')| =: n$ and $ alpha equiv alpha' thick (mod n), quad b equiv b' thick (mod n) $
]
#lemma[
There exists a unit $u$ in $ZZ\[sqrt(d)\]$ such that $u > 1$.
]
#lemma[
Let $0 != alpha = a + b sqrt(d) in QQ\(sqrt(d)\)$. Then $alpha > sqrt(|N_K (alpha)|)$ iff $a, b > 0$.
]
== Computing fundamental units
#theorem[
Let $d > 1$ non-square.
- If $S = ZZ\[sqrt(d)\]$ and $a + b sqrt(d) in S^times$, $a, b > 0$ such that $b$ is minimal, then $a + b sqrt(d)$ is the fundamental unit in $S$.
- If $S = ZZ\[ (1 + sqrt(d))/2 \]$ (so $d equiv 1 thick (mod 4)$), then
- $(1 + sqrt(5))/2$ is the fundamental unit in $cal(O)_5$.
- If $d > 5$ and $(s + t sqrt(d))/2 in cal(O)_d^times$ with $s, t > 0$ such that $t$ is minimal, then $(s + t sqrt(d))/2$ is the fundamental unit in $cal(O)_d$.
]
#remark[
Both $u = (1 + sqrt(5))/2$ and $u^2 = (3 + sqrt(5))/2$ have $t$ minimal (equal to $1$), which is why a separate case is needed for $d = 5$.
]
#example[
- $1 + sqrt(2)$ is fundamental unit in $ZZ\[sqrt(2)\] = cal(O)_2$, since $N_K (1 + sqrt(2)) = -1$ so is a unit, and here $b = 1$, so is minimal (as $b > 0$).
- $2 + sqrt(5)$ is the fundamental unit in $ZZ\[sqrt(5)\]$ (since $b = 1$ is minimal) but is not the fundamental unit in $cal(O)_5$.
]
#example[
Find fundamental unit in $cal(O)_7$. $7 equiv.not 1 thick (mod 4)$ so $cal(O)_7 = ZZ\[sqrt(7)\]$. $a + b sqrt(7)$ is a unit iff $a^2 - 7b^2 = plus.minus 1$. Also, by the above theorem, it is the fundamental unit if $a, b > 0$ and $b$ is minimal. We use trial and error: for each $b = 1, 2, ..., $ check whether $7b^2 plus.minus 1$ is a square #align(center)[#table(
columns: (auto, auto, auto, auto),
inset: 6pt,
align: center,
[$b$], [$7b^2 - 1$], [$7b^2 + 1$], [$a^2$],
$1$, $6$, $8$, $-$,
$2$, $27$, $29$, $-$,
$3$, $62$, $64$, $64 = 8^2$,
)] So the unit with minimal $b$ such that $a, b > 0$ is $8 + 3 sqrt(7)$, so is the fundamental unit.
]
== Pell's equation and norm equations
#definition[
*Pell's equation* is $x^2 - d y^2 = 1$ for nonsquare $d$, where solutions are $x, y in ZZ$. Since LHS is norm of $x + y sqrt(d)$, solutions are given by $x + y sqrt(d) in ZZ\[sqrt(d)\]$ with norm $1$.
]
#example[
Consider $x^2 - 2y^2 = plus.minus 1$. Fundamental unit in $ZZ\[sqrt(2)\]$ is $u = 1 + sqrt(2)$, with norm $-1$. So if $x + y sqrt(2) in ZZ\[sqrt(2)\]$ is such that $N_(ZZ\(sqrt(2)\))(x + y sqrt(2)) = 1$, then $x + y sqrt(2)$ is an even power of $u$. Thus elements of norm $plus.minus 1$ are $ plus.minus u^(2n) thick ("RHS" = 1), quad plus.minus u^(2n + 1) thick ("RHS" = -1) $ To extract solutions $x, y$, note that if $x + y sqrt(2) = plus.minus u^r$, then $x - y sqrt(2) = plus.minus overline(u)^r$, hence $ x = plus.minus (u^r + overline(u)^r)/2, quad y = plus.minus (u^r - overline(u)^r)/(2 sqrt(2)) $ Solutions when RHS $= 1$ are given by even $r$, solutions when RHS $= -1$ are given by odd $r$.
]
#example[
Consider $x^2 - 75 y^2 = 1$. $75 = 3 dot.op 5^2$ is not square-free, so rewrite as $ x^2 - 3z^2 = 1 $ where $z = 5y$. Fundamental unit in $ZZ\[sqrt(3)\]$ is $u = 2 + sqrt(3)$ of norm $1$ so solutions are $ x = plus.minus (u^n + overline(u)^n)/2, quad z = plus.minus (u^n - overline(u)^n)/(2 sqrt(3)), quad n in ZZ $ To get solution for $(x, y)$, we need $5 | z$ (which doesn't always hold). Note that $ u^2 = 7 + 4 sqrt(3) in.not ZZ\[sqrt(75)\] = ZZ\[5 sqrt(3)\], quad u^3 = 26 + 3 sqrt(75) in ZZ\[sqrt(75)\] $ Thus when $n = 2$, $(x, z)$ is not solution, but is when $n = 3$, and hence when $n = 3k$ for $k in ZZ$: $ x = plus.minus (u^(3k) + overline(u)^(3k))/2, quad y = plus.minus (u^(3k) - overline(u)^(3k))/(5 dot.op 2 sqrt(3)), quad k in ZZ $ $u^(3k + 1)$ and $u^(3k + 2)$ never give solutions, since if $u^(3k + 1) in ZZ\[sqrt(75)\]$, then $u in ZZ\[sqrt(75)\]$ (since $u^(-3k) in ZZ\[sqrt(75)\]$). Similarly, if $u^(3k + 2) in ZZ\[sqrt(75)\]$, then $u^2 in ZZ\[sqrt(75)\]$: contradiction. Note $ZZ\[sqrt(75)\] subset ZZ\[sqrt(3)\]$ and any unit in $ZZ\[sqrt(75)\]$ is unit in $ZZ\[sqrt(3)\]$, so is $plus.minus u^r$ for some $r in ZZ$. So by taking powers of $u$, eventually we find the fundamental unit in $ZZ\[sqrt(75)\]$ (as it will be smallest unit $> 1$ assuming we increment powers from $1$).
]
#let jack = false
#show: a => if jack { smallcaps(a) } else { a }
= Discriminants and integral bases
== Discriminant of an $n$-tuple
#definition[
Let $K$ number field of degree $n$. *Discriminant* of $gamma = (gamma_1, ..., gamma_n) in K^n$ is $ Delta_K (gamma) := det(Q(gamma)) $ where $Q(gamma) = \(tr_K \(gamma_i gamma_j\)\)_(1 <= i, j <= n) in M_n (QQ)$.
]
#example[
Let $K = QQ\(sqrt(d)\)$, $d != 1$ squarefree. $
gamma & = \(1, sqrt(d)\) ==> Q(gamma) = mat(2, 0; 0, 2d) ==> Delta_K (gamma) = 4d \
gamma & = \(1, (1 + sqrt(d))/2) ==> Q(gamma) = mat(2, 1; 1, (1 + d)/2) ==> Delta_K (gamma) = d
$
]
#proposition[
- $Delta_K (gamma) in QQ$ and if every $gamma_i in cal(O)_K$, then $Delta_K (gamma) in ZZ$.
- Let $M in M_n (QQ)$, then $Delta_K (M gamma) = det(M)^2 Delta_K (gamma)$.
- $Delta_K (gamma)$ is invariant under permutations of $gamma_1, ..., gamma_n$.
]
#lemma[
Let $theta_1, ..., theta_n in CC$, let $ D = mat(1, theta_1, ..., theta_1^(n - 1); dots.v, dots.v, dots.down, dots.v; 1, theta_n, ..., theta_n^(n - 1)) $ then $ det(D) = (-1)^binom(n, 2) product_(1 <= r < s <= n) (theta_r - theta_s) $
]
#theorem[
Let $K = QQ(theta)$ be number field. Let $theta_1, ..., theta_n$ be roots of $p_theta (x)$, let $gamma = (1, ..., theta^(n - 1))$. Then $
Delta_K (gamma) = product_(1 <= i < j <= n) \(theta_i - theta_j\)^2 = (-1)^binom(n, 2) product_(i = 1)^n p'_theta (theta_i) = (-1)^binom(n, 2) N_K (p'_theta (theta))
$
]
#example[
- Let $K = QQ\(sqrt(d)\)$, $d$ square-free, $theta = (1 + sqrt(d))/2$, then $ Delta_K ((1, theta)) = ((1 + sqrt(d))/2 - (1 - sqrt(d))/2)^2 = d $
- Let $theta = sqrt(d)$, so $p_theta (x) = x^2 - d$, $p'_theta (x) = 2x$, so $ Delta_K (1, theta) = (-1)^binom(2, 2) N_K (2 theta) = -4 N_k (theta) = 4d $
- Let $theta = root(3, d)$, so $p_theta (x) = x^3 - d$, $p'_theta (x) = 3x^2$ so $ Delta_K (1, theta, theta^2) = (-1)^binom(3, 2) N_K (3 theta^2) = -27 d^2 $
- Let $theta$ be root of $p_theta (x) = x^3 - x + 2$, so $p'_theta (x) = 3x^2 - 1$. $ Delta_K (1, theta, theta^2) = (-1)^binom(3, 2) N_K (3 theta^2 - 1) $ Now $theta^3 = theta - 2$ so $ N_K (3 theta^2 - 1) = (N_K (2) N_K (theta - 3))/(N_K (theta)) = 8/2 N_K (3 - theta) = 4(3 - theta_1)(3 - theta_2)(3 - theta_3) = 4 p_theta (3) = 104 $ so $Delta_K (1, theta, theta^2) = -104$. Note: in general, this method doesn't work, and generally we have to compute matrix $T_theta$ and $det(f(T_theta))$. *As a generalisation*, $ N_(QQ(theta)) (a - b theta) = b^n p_theta (a\/b) $
]
#lemma[
- Roots $theta_1, ..., theta_n$ of $p_theta (x)$ are distinct.
- $forall f(x) in QQ[x], tr_K (f(theta)) = sum_(i = 1)^n f(theta_i)$.
- $forall f(x) in QQ[x], N_K (f(theta)) = product_(i = 1)^n f(theta_i)$.
]
#proposition[
Let $K = QQ(theta)$ number field. Then $Delta_K (gamma) != 0$ iff $gamma$ is $QQ$-basis of $K$.
]
== Full lattices and integral bases
#definition[
Let $A$ subgroup of $QQ$-vector space $V$. $A$ is *full lattice* in $V$ if there are $gamma_1, ..., gamma_n in V$ such that
- ${gamma_1, ..., gamma_n}$ is basis for $V$.
- $A = {a_1 gamma_i + dots.h.c + a_n gamma_n: a_i in ZZ}$ (i.e. $gamma_1, ..., gamma_n$ generate $A$ as a group). Note $a_1, ..., a_n$ are uniquely determined for each $a in A$.
${gamma_1, ..., gamma_n}$ is *generating basis* for $A$.
]
#example[
Let $K = QQ(theta)$, $theta in cal(O)_K$, $[K: QQ] = n$, then $ZZ[theta]$ has generating basis ${1, ..., theta^(n - 1)}$ and is full lattice in $K$.
]
#example[
$ZZ$, $ZZ\[sqrt(2)\/2\]$ are not full lattices in $QQ\(sqrt(2)\)$.
]
#proposition[
Let $K$ number field. Every non-zero ideal $I subset.eq cal(O)_K$ is full lattice in $K$.
]
#definition[
Generating basis for $cal(O)_K$ is *integral basis* for $K$.
]
#example[
Let $K = QQ\(sqrt(d)\)$, then an integral basis for $K$ is $\{1, sqrt(d)\}$ if $d equiv.not 1 mod 4$, $\{1, \(1 + sqrt(d)\)\/2\}$ if $d equiv 1 mod 4$.
]
#theorem[
If $V$ is $QQ$-vector space, $dim(V) = n$, and $B subset A subset V$, $A$ and $B$ full lattices, ${beta_1, ..., beta_n}$ is generating basis for $B$, ${alpha_1, ..., alpha_n}$ is generating basis for $A$, where $beta = M alpha$, $M in M_n (ZZ)$, then
- $|A\/B| = |det(M)|$ (in particular, $A\/B$ is finite)
- If $V = K$ is number field, these satisfy *index-discriminant formula*: $Delta_K (B) = |A\/B|^2 Delta_K (A)$.
(Note $M$ exists since $alpha$ is generating basis for $A$ so spans $B$ over $ZZ$).
]
#lemma[
If $A subset K$ is full lattice and ${gamma_1, ..., gamma_n}$, ${delta_1, ..., delta_n}$ are generating bases for $A$, then $Delta_K (gamma_1, ..., gamma_n) = Delta_K (delta_1, ..., delta_n)$. We define discriminant of $A$ to be $Delta_K (A) = Delta_K (gamma_1, ..., gamma_n)$ for any generating basis ${gamma_1, ..., gamma_n}$.
]
#definition[
*Disciminant* of number field $K$ is $ Delta_K = Delta_K (cal(O)_K) = Delta_K (gamma_1, ..., gamma_n) $ for any integral basis ${gamma_1, ..., gamma_n}$.
]
== When is $R = ZZ[theta]$?
#proposition[
If $S subset.eq cal(O)_K$ is full lattice in $K = QQ(theta)$, ${gamma_1, ..., gamma_n}$ is generating basis for $S$, and $p$ prime, $p | |cal(O)_K\/S|$, then
- $p^2 | Delta_K (S)$
- There exists $alpha = m_1 gamma_1 + dots.h.c + m_n gamma_n in S$, $m_i in ZZ$, such that $alpha\/p in cal(O)_K - S$ and $ cases(0 <= |m_i| < p\/2 & "if" p "is odd", m_i in {0, 1} & "if" p = 2) $
]
#example[
If $K = QQ\(sqrt(d)\)$, $ Delta_K = cases(4d & "if" d equiv.not 1 mod 4, d & "if" d equiv 1 mod 4) $
]
#example[
Let $theta$ be root of $x^3 + 4x + 1$, $K = QQ\(theta\)$. We have $ZZ[theta] subset.eq cal(O)_K$ and $Delta_K (ZZ[theta]) = Delta_K (1, theta, theta^2) = 281 = |cal(O)_K \/ ZZ[theta]|^2 Delta_K (cal(O)_K)$. As 281 is squarefree, $|cal(O)_K \/ ZZ[theta]| = 1$ so $cal(O)_K = ZZ[theta]$.
]
#example[
Let $K = QQ(theta)$, $theta = root(3, 5)$. let $R = cal(O)_K$, $S = ZZ[theta]$. $Delta_K (S) = -3^3 dot.op 5^2$. If $p$ prime and $p | |R\/S|$, then $p in {3, 5}$ and there is $alpha = a + b theta + c theta^2$ such that $alpha\/p in R - S$, $|a|, |b|, |c| < p\/2$. Note $alpha != 0$, as otherwise $alpha in S$.
- If $5 | |R\/S|$, then $|a|, |b|, |c| in {0, 1, 2}$. Then $tr_(K\/QQ)(alpha\/5) = 3a\/5 in ZZ$ so $5 | a$ so $a = 0$. $theta alpha \/ 5 = c + (b theta^2)\/5 in cal(O)_K$ so $(b theta^2)\/5 in cal(O)_K$ so $ N_K ((b theta^2)\/5) = (N_K (b) N_K (theta)^2)/(N_K (5)) = b^3 / 5 in ZZ $ so $5 | b$, so $b = 0$. Finally, $ N_K (alpha/5) = N_K ((c theta^2)/5) = (c^3 (-5)^2)/5^3 = c^3/5 in ZZ ==> c = 0 $ Contradiction.
- If $3 | |R\/S|$, then $|a|, |b|, |c| in {0, 1}$ and can assume $a >= 0$ (by possibly multiplying by $-1$). Then $ N_K ((a + b theta + c theta^2) / 3) in ZZ ==> a^3 + 5b^3 + 25c^3 - 15a b c equiv 0 (mod 3^3) $ If $a = 0$, then $5b^3 + 25c^3 equiv 2b + c equiv 0 (mod 3)$ (as $b, c in {0, 1, -1}$), so if $b = 0$, then $c equiv 0 (mod 3) ==> c = 0$: contradiction. So $b = 1$ (by possibly multiplying by $-1$) hence $c = 1$. But then $ N_K (alpha\/3) = N_K ((theta + theta^2)/3) = (N_K (theta) N_K (1 + theta))/3^3 = (5 dot.op 6)/27 in.not ZZ $ Contradiction. If $a = 1$, then $ 1 + 5b^3 + 25c^3 equiv 1 + 2b + c equiv 0 (mod 3) $ which also leads to a contradiction.
- So $5 divides.not |R\/S|$, $3 divides.not |R\/S|$, so $|R\/S| = 1$, so $ZZ[theta] = cal(O)_K$.
]
= Unique factorisation of ideals
#definition[
*Product* of ideals $I, J subset.eq R$ is $ I J := {sum_(i = 1)^k x_i y_i: k in NN, x_i in I, y_i in J} $ If $I = ideal(a_1, ..., a_m)$, $J = (b_1, ..., b_n)$ then $ I J = ideal(a_i b_j | i in [m], j in [n]) $
]
#definition[
$I$ *divides* $J$, $I | J$, if there is ideal $K$ such that that $I K = J$.
]
#note[
_to divide is to contain_: $I | J ==> J subset.eq I$.
]
#example[
Let $R = ZZ\[sqrt(-6)\]$, $I = ideal(5, 1 + 3 sqrt(-6))$, $J = ideal(5, 1 - 3 sqrt(-6))$, then $ I J = ideal(25, 5\(1 + 3 sqrt(-6)\), 5\(1 - 3 sqrt(-6)\), 55) subset.eq ideal(5) $ But also $5 = 55 - 2 dot.op 25 in I$, $ideal(5) subset.eq I J$, so $I J = ideal(5)$.
]
#lemma[
Let $I, J$ ideals, $P$ prime ideal. Then $ I J subset.eq P <==> (I subset.eq P or J subset.eq P) $
]
#example[
$ideal(5, 1 + 3 sqrt(-6)) subset ZZ\[sqrt(-6)\]$ is prime: define $phi: ZZ\[sqrt(-6)\] -> FF_5$, $phi\(a + b sqrt(-6)\) = a - 2b$. $phi$ is surjective homomorphism. Also, $5, 1 + 3 sqrt(-6) in ker(phi)$, and $ a + b sqrt(-6) in ker(phi) & ==> b equiv 3a mod 5 \ & ==> \(a + b sqrt(-6)\) - a\(1 + 3 sqrt(-6)\) = (b - 3a) sqrt(-6) in ideal(5) $ so $ker(phi) = \(5, 1 + 3 sqrt(-6)\)$. So by first isomorphism theorem, $R\/ideal(5, 1 + sqrt(-6)) tilde.equiv FF_5$ which is field, so $ideal(5, 3 + sqrt(-6))$ is maximal, so prime.
]
#definition[
Let $K$ number field, $R = cal(O)_K$. *Fractional ideal* of $R$ is subset of $K$ of the form $ lambda I = {lambda x: x in I} $ where $ideal(0) != I subset.eq R$ and $lambda in K^times$. If $I = R$, $lambda I$ is *principal fractional ideal*. Set of fractional ideals in $R$ is denoted $cal(I)(R)$, set of principal fractional ideals is denoted $cal(P)(R)$. Multiplication of fractional ideals is defined similarly to that of ideals.
]
#example[
- $n/m ZZ$ is fractional ideal in $QQ$ for all $m, n in ZZ - {0}$.
- Every non-zero ideal is fractional ideal (take $lambda = 1$).
- If $lambda I$ is fractional ideal, then $lambda^(-1) lambda I = I$ is ideal.
]
#definition[
A fractional ideal $A$ is *invertible* if there is fractional ideal $B$ such that $A B = cal(O)_K$. $B$ is the *inverse* of $A$. The invertible fractional ideals form a group.
]
#example[
In $ZZ\[sqrt(-6)\] = cal(O)_K$, $ideal(5, 1 + 3 sqrt(-6)) ideal(5, 1 - 3 sqrt(-6)) = ideal(5)$ so $ ideal(5, 1 + 3 sqrt(-6)) dot.op 1/5 ideal(5, 1 - 3 sqrt(-6)) = cal(O)_K $ so inverse of $ideal(5, 1 + 3 sqrt(-6))$ is $1/5 ideal(5, 1 - 3 sqrt(-6))$.
]
== The norm of an ideal
#definition[
Let $ideal(0) != I$ ideal of $cal(O)_K$. *Norm* of $I$ is $ N(I) := |cal(O)_K\/I| $ We have $N(I) in NN$, $N(R) = 1$, and $I subset.neq J ==> N(I) > N(J)$ (in fact, $N(I) = N(J) |J\/I|$).
]
#proposition[
Every non-zero prime ideal in $cal(O)_K$ is maximal.
]
#lemma[
Every nonzero ideal in $cal(O)_K$ contains product of one or more non-zero prime ideals.
]
#proof[
Consider $I$ for which statement does not hold, with $N(I)$ minimal, then there are $b, b' in.not I$ but $b b' in I$.
]
== Ideals are invertible
#theorem[
Every non-zero prime ideal in $cal(O)_K$ is invertible.
]
#proof[
- Define $A = {x in K: x P subset.eq cal(O)_K}$, show $A$ is fractional ideal and $R subset.eq A$
- Show $A != cal(O)_K$:
- Choose $0 != alpha in P$, choose prime ideals such that $P_1 dots.h.c P_t subset.eq (alpha)$ and $t$ is minimal.
- Choose $beta in P_2 dots.h.c P_t$ and $beta in.not (alpha)$, show that $beta/alpha in A - R$.
- Show that $P != A P$, using Theorem 4.6.
- Use fact that $P$ is maximal to conclude $A P = R$.
]
#lemma[
If $lambda I$ is fractional ideal and $lambda I subset.eq cal(O)_K$, then $lambda I$ is ideal in $cal(O)_K$.
]
#lemma[
Let $J subset.eq I$ ideals in $cal(O)_K$ with $I$ invertible. Then
- $I^(-1) J$ is ideal in $cal(O)_K$ and so $I | J$.
- $J subset.eq I^(-1) J$ with equality iff $I = R$.
]
#theorem[
Let $I subset.neq cal(O)_K$ be non-zero ideal. Then $I$ is unique (up to reordering) product of prime ideals.
]
#definition[
A ring where every proper non-zero ideal can be uniquely factorised into prime ideals is a *Dedekind domain*. So rings of integers are Dedekind domains.
]
#example[
In $ZZ\[sqrt(-6)\]$, $\(1 + 3 sqrt(-6)\) \(1 - 3 sqrt(-6)\) = 55 = 5 dot.op 11$. $P_5 = ideal(5, 1 + 3 sqrt(-6))$ and $overline(P_5) = ideal(5, 1 - 3 sqrt(-6))$ are prime, as are $P_11 = ideal(11, 1 + 3 sqrt(-6))$ and $overline(P_11) = ideal(11, 1 - sqrt(-6))$. $P_5 overline(P_5) = ideal(5)$, $P_11 overline(P_11) = ideal(11)$, $P_5 P_11 = ideal(1 + 3 sqrt(-6))$, $overline(P_5) thick overline(P_11) = ideal(1 - 3 sqrt(-6))$ so $ \(P_5 P_11\) \(overline(P_5) thick overline(P_11)\) = \(P_5 overline(P_5)\) \(P_11 overline(P_11)\) $
]
#corollary[
Let $R = cal(O)_K$.
- Every fractional ideal (and hence every nonzero ideal) in $R$ is invertible.
- $cal(I)(R)$ is abelian group under multiplication, with identity element $R$.
]
#corollary(name: "to divide is to contain and to contain is to divide")[
$I | J <==> J subset.eq I$.
]
#theorem[
If $cal(O)_K$ is UFD, then it is also PID.
]
== Arithmetic with ideals
#definition[
Let $I, J$ be non-zero ideals of $R$, $ I & = P_1^(a_1) dots.c P_r^(a_r), \ J & = P_1^(b_1) dots.c P_r^(b_r) $ with $P_1, ..., P_r$ distinct prime ideals of $R$ and $a_i, b_i >= 0$. *gcd* and *lcm* of $I$ and $J$ are $ gcd(I, J) & := P_1^(min{a_1, b_1}) dots.c P_r^(min{a_r, b_r}), \ "lcm"(I, J) & := P_1^(max{a_1, b_1}) dots.c P_r^(max{a_r, b_r}) $
]
#definition[
$I$ and $J$ are *coprime* if $gcd(I, J) = ideal(1) = R$.
]
#proposition[
- For $m, n in ZZ$, $gcd\(ideal(m)_ZZ, ideal(n)_ZZ\) = ideal(gcd(m, n))_ZZ$ and $"lcm"\(ideal(m)_ZZ, ideal(n)_ZZ\) = ideal("lcm"(m, n))_ZZ$.
- $gcd(I, J)$ divides $I$ and $J$, and if any $K$ divides $I$ and $J$, then $K | gcd(I, J)$.
- $I, J | "lcm"(I, J)$ and for any ideal $K$, if $I, J | K$ then $"lcm"(I, J) | K$.
]
#proposition[
- In any ring, the smallest ideal containing ideals $I$ and $J$ is $I + J$. So if $I = ideal(a_1, ..., a_n)$ and $J = (b_1, ..., b_m)$ then smallest ideal containing $I$ and $J$ is $ideal(a_1, ..., a_n, b_1, ..., b_m)$.
- In any ring, the largest ideal contained in both $I$ and $J$ is $I sect J$.
]
#proposition[
If $I$ and $J$ are non-zero ideals in $cal(O)_K$ then $ gcd(I, J) = I + J, quad "lcm"(I, J) = I sect J $
]
#theorem(name: "Chinese remainder theorem for ideals")[
Let $I_1, ..., I_k$ be pairwise coprime ideals of $cal(O)_K$, then there is an isomorphism $ R \/ (I_1 dots.c I_k) & -> R\/I_1 times dots.c times R\/I_k, \ x + (I_1 dots.c I_k) & |-> (x + I_1, ..., x + I_k) $
]
= Splitting of primes and the Kummer-Dedekind theorem
== Properties of the ideal norm
#lemma[
For every non-zero ideal $I$ of $cal(O)_K$, $N(I) in I$, hence $I sect ZZ != ideal(0)$.
]<ideal-contains-its-norm>
#notation[
For $0 != alpha in cal(O)_K$, define $N(alpha) := N\(ideal(alpha)_(cal(O)_K)\)$.
]
#lemma[
$forall 0 != alpha in cal(O)_K$, $N(alpha) = |N_K (alpha)|$.
]
#lemma[
Ideal norm is multiplicative: for any non-zero ideals $I$, $J$ in $cal(O)_K$, $ N(I J) = N(I) N(J) $
]
#proof[
- Clear when $I$ or $J$ is $cal(O)_K$ so assume both are proper.
- Sufficient to show for when $J$ is prime (why?)
- Use that $N(I P) = |R\/ (I P)| = |R\/I| dot.op |I\/(I P)|$.
- Show that $|I\/(I P)| = |R\/P|$:
- Show $I\/(I P)$ is one-dimensional vector space over $R\/P$:
- Show $I != I P$ and choose $x in I - (I P)$.
- Show $(x, I P) = I$ using unique factorisation.
]
== The Kummer-Dedekind theorem
#definition[
If $p in ZZ$ prime, and $ideal(p)_(O_K) = P_1^(e_1) dots.h.c P_r^(e_r)$ then $P_1, ..., P_r$ are the prime ideals *lying above* $p$. Equivalently, $P$ *lies above* $p$ if $P sect ZZ = ideal(p)_ZZ$.
]
#remark[
If $P subset cal(O)_K$ nonzero prime ideal, then $N(P) in P sect ZZ$ so $P sect ZZ != ideal(0)$. But $P sect ZZ$ is prime ideal of $ZZ$ so $P sect ZZ = ideal(p)_ZZ$ for some prime $p in ZZ$. Hence $p in P$, $ideal(p)_(cal(O)_K) subset.eq P$ so $P | ideal(p)_(cal(O)_K)$. Hence every $P$ lies over some prime $p$.
]
#lemma[
Prime ideal $P$ of $cal(O)_K$ lies above $p$ iff $N(P) = p^r$ for some $1 <= r <= n = [K: QQ]$.
]
#proof[
For "if" direction, use that $N(I) in I$.
]
#theorem(name: "<NAME>")[
Let $p$ prime. Suppose $cal(O)_K = ZZ[theta]$ for some $theta in cal(O)_K$ with minimal polynomial $p_theta$. Let $overline(f)(x)$ be reduction of $f(x) in ZZ[x]$ $mod p$, so $overline(f)(x) in FF_p [x]$. Let $ overline(p_theta)(x) = overline(f_1)(x)^(e_1) dots.h.c overline(f_r)(x)^(e_r) $ be factorisation of $overline(p_theta)$ where $overline(f_i)$ are distinct, monic, irreducible. For each $i$, let $f_i (x) in ZZ[x]$ be monic polynomial whose reduction $mod p$ is $overline(f_i)(x)$. Let $P_i = (p, f_i (theta))_(cal(O)_K)$. Then $P_i$ are distinct prime ideals, $N(P_i) = p^(deg(f_i))$ and $ ideal(p)_(cal(O)_K) = P_1^(e_1) dots.h.c P_r^(e_r) $
]
#proof[
- Let $phi: ZZ[x] -> cal(O)_K \/ P_i$ be composition of evaluation map $ZZ[x] -> cal(O)_K$, $g(x) |-> g(theta)$, and canonical map $cal(O)_K -> cal(O)_K \/ P_i$. Show that $ ZZ[x] \/ ideal(p_theta (x), p, f_i (x)) tilde.equiv cal(O)_K\/P_i $
- Deduce another isomorphism given by reduction mod $p$ map $g(x) + ideal(p_theta (x), p, f_i (x)) |-> overline(g)(x) + ideal(overline(p_theta)(x), overline(f_i)(x))$.
- To show $P_i$ prime, deduce that $cal(O)_K\/P_i tilde.equiv FF_p [x] \/ ideal(overline(f_i)(x))$.
- Deduce that $N(P_i) = p^(deg(f_i))$.
- Use that $P_1^(e_1) dots.h.c P_r^(e_r) subset.eq ideal(p, f_1 (theta)^(e_1) dots.h.c f_r (theta)^(e_r))$ and $f_1 (theta)^(e_1) dots.h.c f_r (theta)^(e_r) equiv p_theta (theta) mod p$ and $N(P_1^(e_1) dots.h.c P_r^(e_r)) = N(p)$ to show $P_1^(e_1) dots.h.c P_r^(e_r) = ideal(p)_(cal(O)_K)$.
]
#theorem(name: "Strong Kummer-Dedekind")[
Let $K = QQ(theta)$, $theta in R = cal(O)_K$, $p divides.not |R\/ZZ[theta]|$ then $ideal(p)_R$ can be factorised by considering $overline(p_theta)(x) in FF_p [x]$ as in usual Kummer-Dedekind when $|R\/ZZ[theta]| = 1$.
]
#example[
Let $K = QQ\(sqrt(6)\)$, so $cal(O)_K = ZZ\[sqrt(6)\]$. $p_theta (x) = x^2 - 6$ factorises modulo small primes as: $
overline(x^2 - 6) & = x^2 quad & "in" FF_2 [x] \
overline(x^2 - 6) & = x^2 quad & "in" FF_3 [x] \
overline(x^2 - 6) & = x^2 - 1 = (x - 1)(x + 1) quad & "in" FF_5 [x] \
overline(x^2 - 6) & "irreducible" quad & "in" FF_7 [x] \
overline(x^2 - 6) & "irreducible" quad & "in" FF_11 [x]
$ Since $6$ is not square $mod 7$ or $11$. By Kummer-Dedekind, $
ideal(2)_(cal(O)_K) & = ideal(2, sqrt(6))^2, quad ideal(3)_(cal(O)_K) = ideal(3, sqrt(6))^2, \
ideal(5)_(cal(O)_K) & = ideal(5, sqrt(6) + 1) ideal(5, sqrt(6) - 1), \
ideal(7)_(cal(O)_K) & = ideal(7, sqrt(6)^2 - 6) = ideal(7, 0) = ideal(7), \
ideal(11)_(cal(O)_K) & = ideal(11, sqrt(6)^2 - 6) = ideal(11, 0) = ideal(11)
$
]
#definition[
When $K$ is quadratic, Kummer-Dedekind implies there are 3 mutually exclusive possibilities for prime $p in ZZ$:
- If $ideal(p)_(cal(O)_K)$ is prime ideal, $p$ is *inert*.
- If $ideal(p)_(cal(O)_K) = P^2$ for prime ideal $P$, then $p$ *ramifies* (or *is ramified*) (otherwise, it is *unramified*).
- If $ideal(p)_(cal(O)_K) = P_1 P_2$ for distinct prime ideals $P_1, P_2$, then $p$ *splits* (or *is split*).
]
#remark[
If $K\/QQ$ is quadratic, $K = QQ\(sqrt(d)\)$, then Kummer-Dedekind always applies since $R = ZZ\[theta\]$ for some $theta in K$.
]
#notation[
Let $K$ quadratic extension. If $I subset.eq cal(O)_K$ ideal, let $overline(I) = {overline(x): x in I}$ where $overline(a + b sqrt(d)) = a - b sqrt(d)$. We have $I$ prime iff $overline(I)$ prime and $N\(overline(I)\) = N(I)$.
]
#lemma[
Let $K$ quadratic number field, $p in ZZ$ prime, $P$ non-zero prime ideal in $cal(O)_K$ lying above $p$. Then $overline(P)$ is prime ideal lying above $p$ and:
- If $p$ inert, then $P = overline(P)$ and $N(P) = p^2$.
- If $p$ ramifies, then $P = overline(P)$ and $N(P) = p$.
- If $p$ splits, then $ideal(p)_(cal(O)_K) = P overline(P)$, $P != overline(P)$ and $N(P) = N\(overline(P)\) = p$.
In all cases, $P overline(P) = ideal(N(P))_(cal(O)_K)$.
]<quadratic-field-kd-cases>
#example[
Let $theta^3 + 3 theta - 1 = 0$, $K = QQ(theta)$. We have $cal(O)_K = ZZ[theta]$. To factorise $ideal(5)_(cal(O)_K)$ and $ideal(11)_(cal(O)_K)$: $-1$ and $2$ are roots of $x^3 + 3x - 1 mod 5$, so we get $x^3 + 3x - 1 equiv (x + 1)(x + 2)^2 mod 5$. So by Kummer-Dedekind, $ ideal(5)_(cal(O)_K) = ideal(5, theta + 1) ideal(5, theta + 2)^2 $ Only root in $overline(p_theta)$ in $FF_11$ is $-4$, so $overline(p_theta)(x) = (x + 4)(x^2 - 4x + 8) mod 11$ and $x^2 - 4x + 8 = (x - 2)^2 + 4$ is irreducible as $-4$ is not square $mod 11$. So by Kummer-Dedekind, $ ideal(11)_(cal(O)_K) = ideal(11, theta + 4) ideal(11, theta^2 - 4 theta + 8) $ To factorise $ideal(2 theta - 3)_(cal(O)_K)$: $ N_K (2 theta - 3) = -N_K (2) N_K (3/2 - theta) = -8 dot.op p_theta (3/2) = -8(27/8 + 9/2 - 1) = -55 $ So $ideal(2 theta - 3) = P_5 P_11$ where $N(P_5) = 5$, $N(P_11) = 11$, $P_5, P_11$ prime. So $P_5 | ideal(5)$, so $P_5 = ideal(5, theta + 1)$ or $ideal(5, theta + 2)$. Now $2 theta - 3 = 2(theta + 1) - 5 in ideal(5, theta + 1)$, so $ideal(5, theta + 1) | ideal(2 theta - 3)$, hence $P_5 = ideal(5, theta + 1)$. Now $P_11 | ideal(11)$ so $P_11 = ideal(11, theta + 4)$ or $ideal(11, theta^2 - 4theta + 8)$. But by Kummer-Dedekind, the latter has norm $11^2$ which is a contradiction (since $11^2 divides.not N(ideal(2 theta - 3)) = 55$). So $P_11 = ideal(11, theta + 4)$.
]
= The ideal class group
#notation[
Let $R = cal(O)_K$ for number field $K$.
]
#definition[
*(Ideal) class group* of $R$ (or of $K$) is $"Cl"(R) := cal(I)(R)\/cal(P)(R)$. For fractional ideal $I in cal(I)(R)$, let $[I] = I dot.op cal(P)(R) = {ideal(lambda)_R I: lambda in K^times} = {lambda I: lambda in K^times}$ denote *class* of $I$ in $"Cl"(R)$.
]
#proposition[
- $[I] = e$ iff $I in cal(P)(R)$ iff $I$ is principal.
- $[I] = [J]$ iff $I = ideal(lambda)_R J$ for some $lambda in K^times$ iff $alpha I = beta J$ for some $alpha, beta in R - {0}$.
- $[I] dot.op [J] = I J dot.op cal(P)(R) = [I J]$.
- $[I]^(-1) = [I^(-1)]$.
]
#proposition[
$Cl(R)$ is the trivial group ($Cl(R) = e$) iff $R$ is a UFD iff $R$ is a PID.
]
#proof[
- To show PID $==>$ UFD, enough to show every prime ideal is principal.
- Use that prime ideal $P$ lies over some prime $p in ZZ$.
- Use that in $R$, $p = pi_1 dots.h.c pi_r$ is factorisation into irreducibles.
]
#remark[
If $ideal(alpha)_R = P Q$ then $e = [ideal(alpha)_R] = [P Q] = [P] [Q]$ so $[P] = [Q]^(-1)$.
]
#proposition[
If $K$ is quadratic number field, $I$, $J$ ideals, then $\[overline(I)\] = [I]^(-1)$ and $I overline(J)$ is principal iff $[I] = [J]$.
]
#proof[
Use @quadratic-field-kd-cases for first part.
]
#example[
- Let $K = QQ\(sqrt(-29)\)$ so $cal(O)_K = ZZ\[sqrt(-29)\] = R$. $p_(sqrt(-29))(x) = x^2 + 29$ so by Kummer-Dedekind and @quadratic-field-kd-cases, $
ideal(2)_R & = P_2^2, quad P_2 = ideal(2, 1 + sqrt(-29))_R, quad N(P_2) = 2, \
ideal(3)_R & = P_3 overline(P_3), quad P_3 = ideal(3, 1 - sqrt(-29))_R, quad N(P_3) = 3, \
ideal(5)_R & = P_5 overline(P_5), quad P_5 = ideal(5, 1 - sqrt(-29))_R, quad N(P_5) = 5
$
- If $P_2$ were principal, then $P_2 = ideal(a + b sqrt(-29))$ but $N(P_2) = 2 = a^2 + 29b^2$: contradiction. So $[P_2] != e$ but $[P_2]^2 = e$ as $P_2^2 = ideal(2)_R$ is principal.
- Similarly, $P_5$ is not principal, but also $P_5^2$ is not principal, as if it was, then $P_5^2 = ideal(a + b sqrt(-29))$ so $25 = a^2 + 29b^2 ==> a = plus.minus 5$, but then $P_5^2 = ideal(5) = P_5 overline(P_5)$, but $P_5 != overline(P_5)$.
- But $N\(3 + 2 sqrt(-29)\) = 5^3$, so $ideal(3 + 2 sqrt(-29))_R | (5^3)_R$ by @ideal-contains-its-norm, so $ideal(3 + 2 sqrt(-29)) = P_5^a overline(P_5)^(3 - a)$; but $5 divides.not 3 + 2 sqrt(-29)$, so we can't have $P_5 overline(P_5) | ideal(3 + 2 sqrt(-29))$. So $ideal(3 + 2 sqrt(-29)) = P_5^3$ or $overline(P_5)^3$, and $3 + 2 sqrt(-29) in P_5$ so $ideal(3 + 2 sqrt(-29)) = P_5^3$, hence $[P_5]^3 = e$, so $[P_5]$ has order $3$.
- Again, $[P_3] != e$. As $N\(1 + sqrt(-29)\) = 30$, $ideal(1 + sqrt(-29)) | ideal(30) = ideal(2) ideal(3) ideal(5)$, so we see $ideal(1 + sqrt(-29)) = P_2 overline(P_3)overline(P_5)$, hence $e = [P_2] [P_3]^(-1) [P_5]^(-1)$ and so $[P_3] = [P_2] [P_5]^(-1)$. Since product of two elements of coprime orders $m, n$ in abelian group has order $m n$, we have $ "ord"([P_3]) = "ord"([P_2] \[overline(P_5)\]) = 2 dot.op 3 = 6 $ Also, $[P_3]^2 = \[overline(P_5)\]^2 = [P_5]$ so $[P_3]^3 = [P_2]$ and $[P_3]^4 = [P_5]^(-1)$. Hence $Cl(R)$ contains a cyclic subgroup of order $6$ generated by $[P_3]$.
]
== Finiteness of the class group
#lemma[
Let $C > 0$, then there are finitely many ideals of $R$ of norm $<= C$.
]
#proof[
Show if $N(I) = m$, then $I divides ideal(m)_R$, consider prime factorisation of $ideal(m)_R$.
]
#lemma[
For any number field $K$, there is $C_K in NN$ such that for any nonzero ideal $J subset.eq R$, $ exists 0 != s in J: N(s) <= C_K dot.op N(J) $
]
#proof[
- Let ${x_1, ..., x_n}$ be integral basis, define $f(c_1, ..., c_n) = N_K (c_1 x_1 + dots.h.c + c_n x_n)$ which is homogenous polynomial in $c_1, ..., c_n$ of degree $n$.
- Let $C_K = max\{|f(c_1, ..., c_n)|: |c_1|, ..., |c_n| <= 1\}$, then $|f(c_1, ..., c_n)| <= max(|c_1|, ..., |c_n|)^n C_K$.
- Let $c_i$ run through $0, ..., floor(N(I)^(1\/n))$, then there are $ (1 + floor(N(I)^(1\/n)))^n > N(I) = |R\/I| $ possibilities for $c_1, ..., c_n$.
- By pigeonhole principle, there are $c_1, ..., c_n$ and $c'_1, ..., c'_n$ such that $ c_1 x_1 + dots.h.c + c_n x_n + I = c'_1 x_1 + dots.h.c + c'_n x_n + I $
- Set $s = (c_1 - c'_1) x_1 + dots.h.c + (c_n - c'_n) x_n in I$, then $N(s) <= C_K N(I)$.
]
#corollary[
Let $underline(c) in Cl(R)$, then there is ideal $I subset.eq R$ with $[I] = underline(c)$ and $N(I) <= C_K$.
]
#proof[
Let $J subset.eq R$ such that $[J] = underline(c)^(-1)$, then there is $s in J$ with $N(s) <= C_K N_J$, so $ideal(s) = I J$ for some $I subset.eq R$, then use multiplicativity of norm.
]
#theorem[
Let $K$ number field, $R = cal(O)_K$, then $Cl(R)$ is finite.
]
#definition[
*Class number* of $K$ is $h_K := abs(Cl(R))$.
]
== The Minkowski bound
#theorem(name: "Minkowski bound")[
If $K = QQ(theta)$ and $p_theta$ has $s$ real roots, $2t$ complex roots, $n := s + 2t$, then for every $underline(c) in Cl(R)$, we can find a (non-fractional) ideal $I$ with $[I] = underline(c)$ and $ N(I) <= B_K := (4/pi)^t (n!)/(n^n) sqrt(abs(Delta_K)) $ i.e. we can take $C_K = B_K$.
]
#example[
Let $K = QQ\(sqrt(-29)\)$, so $R = ZZ\[sqrt(-29)\]$, then every ideal class has representative of norm $<= (4\/pi) sqrt(29) < 7$ so of norm $1, 2, ..., 6$, so is product of $P_2$, $P_3$, $overline(P_3)$, $P_5$, $overline(P_5)$, so $Cl(R) = ideal([P_3])$ is cyclic of order $6$.
]
#example[
Let $K = QQ\(sqrt(-19)\)$, so $R = cal(O)_K = ZZ\[ (1 + sqrt(-19))/2\]$, $Delta_K = -19$, then $ B_K = (4/pi) (2!)/(2^2) sqrt(19) = (2 sqrt(19))/pi < 3 $ So every element in $Cl(cal(O)_K)$ is represented by an ideal of norm $1$ or $2$. Let $N(I) = 2$, then $I$ is prime and $I | ideal(2)_R$. But minimal polynomial of $(1 + sqrt(-19))/2$ is $x^2 - x + 5$ and $x^2 - x + 4 = x^2 + x + 1 quad "irreducible in" FF_2 [x]$ so $2$ is inert in $R$, hence $I = ideal(2)_R$ and $N(ideal(2)_R) = 4$: contradiction. So $Cl(cal(O)_K) = {e}$, i.e. $cal(O)_K$ is PID, and in particular a UFD. Note that it is not an ED though.
]
#example[
Let $K = QQ\(sqrt(-14)\)$, so $R = cal(O)_K = ZZ\[sqrt(-14)\]$. $Delta_K = 4 dot.op -14 = -56$, so $ B_K = (4/pi)^1 (2!)/2^2 sqrt(56) = (4 sqrt(14))/pi < 5 $ In general, $Cl(cal(O)_K)$ is generated by classes of prime ideals of norm $<= B_K$. By Kummer-Dedekind, $(2)_R = (2, sqrt(-14))^2 = P_2^2$ and $(3)_R = \(3, sqrt(-14) - 1\)\(3, sqrt(-14) + 1\)$. Hence if $N(I) = 4$, then $I | (2)_R^2 = P_2^4$ so $I = P_2^2 = (2)_R$. So as a set, $ Cl(R) = {e, [P_2], [P_3], [overline(P_3)] = [P_3]^(-1), [P_2^2] = e} $ The norm of a principal ideal is $N(ideal(a + b sqrt(-14))) = a^2 + 14b^2 != 2, 3, 6$ hence $P_2$, $P_3$, $overline(P_3)$, $P_2 P_3$, $P_2 overline(P_3)$ are not principal. We have $[P_2] [overline(P_3)] != e ==> [P_2] != [P_3]$, similarly $[P_2] != [overline(P_3)]$. We have $[P_3] != [overline(P_3)]$, since otherwise $[P_3]^2 = e$, so $P_3^2$ is principal and so $P_3^2 = ideal(3)$ but then $P_3 = overline(P_3)$. Thus $e, [P_2], [P_3], [overline(P_3)]$ are distinct, so $|Cl(R)| = 4$, so $Cl(R) tilde.equiv ZZ\/2 times ZZ\/2$ or $ZZ\/4$. But $[P_3]^2 != e$ so $[P_3]$ has order $4$, hence $Cl(R) tilde.equiv ZZ\/4$ is generated by $[P_3]$. Note $[overline(P_3)]^2$ and $[P_2]$ have order $2$, so $[overline(P_3)]^2 = [P_2]$, so $[P_2 P_3^2] = e$, hence $P_2 P_3^2$ is principal and there exists element in $cal(O)_K$ of norm $2 dot.op 3^2 = 18$.
]
#example[
Let $K = QQ\(sqrt(79)\)$. Prove that $Cl(R) tilde.equiv ZZ\/3$.
- $79 equiv.not 1 (mod 4)$ so $Delta_K = 4 dot.op 79$ so by the Minkowski bound, any element in $Cl(R)$ contains an ideal of norm at most $ B_K = (4/pi)^0 (2!)/2^2 sqrt(|Delta_K|) = sqrt(79) in (8, 9) $ Hence $Cl(R)$ is generated by the ideal classes of prime ideals dividing $2$, $3$, $5$ and $7$. By Kummer-Dedekind,
#figure(table(
columns: (auto, auto, auto, auto),
inset: 8pt,
$p$, $x^2 - 79 in FF_p [x]$, $ideal(p)_R$, $"norm of prime ideals above" p$,
$2$, $x^2 - 1 = (x + 1)^2$, $P_2^2$, $2$,
$3$, $x^2 - 1 = (x + 1)(x - 1)$, $P_3 overline(P_3)$, $3$,
$5$, $x^2 - 4 = (x + 2)(x - 2)$, $P_5 overline(P_5)$, $5$,
$7$, $x^2 - 9 = (x + 3)(x - 3)$, $P_7 overline(P_7)$, $7$
))
Thus $Cl(R)$, as a set, is $ Cl(R) = & {e, [P_2], [P_3], [P_5], [P_7], [P_2]^2 = e, [P_2]^3 = [P_2], [P_2 P_3]} \ union & {[overline(P_3)], [overline(P_5)], [overline(P_7)], [P_2 overline(P_3)]} $ (since the ideals representing these classes have norm $<= 8$). Computing norms of some principal ideals $ideal(a + sqrt(79))$, letting $a$ increase up to $sqrt(79) approx 9$ to find mimimal value and other small values of the norm:
#figure(table(
columns: (auto, auto),
$a$, $N(ideal(a + sqrt(79))_R) = |a^2 - 79|$,
$0$, $79$,
$1$, $2 dot.op 3 dot.op 13$,
$2$, $3 dot.op 5^2$,
$3$, $2 dot.op 5 dot.op 7$,
$4$, $3^2 dot.op 7$,
$5$, $2 dot.op 3^3$,
$6$, $43$,
$7$, $2 dot.op 3 dot.op 5$,
$8$, $3 dot.op 5$,
$9$, $2$,
$10$, $3 dot.op 7$
))
- So $N\(ideal(9 + sqrt(79))\) = 2 ==> ideal(7 + sqrt(79)) = P_2$ so $[P_2] = e$.
- $N\(ideal(8 + sqrt(79))\) = 3 dot.op 5$ so $[P_3] [P_5] = e$ ($<=> [overline(P_3)] [overline(P_5)] = e$) or $[P_3] [overline(P_5)] = e$ ($<=> [overline(P_3)] [P_5] = e$). In both cases, $ {[P_5], [overline(P_5)]} = {[P_3], [overline(P_3)]} $
- Similarly, since $N(ideal(10 + sqrt(79))) = 3 dot.op 7$, we have $ {[P_7], [overline(P_7)]} = {[P_3], [overline(P_3)]} $
- Thus $Cl(R)$ is generated by $[P_3]$ and as a set, $Cl(R) = \{e, [P_3], [P_3]^(-1)\}$.
- Since $N\(ideal(5 + sqrt(79))\) = 2 dot.op 27$, we have $ ideal(5 + sqrt(79)) = P_2 P_3^a overline(P_3)^(3 - a) quad "for some" a in {0, 1, 2, 3} $
- If $a in {1, 2}$, then $P_3 overline(P_3) = ideal(3)_R | ideal(5 + sqrt(79))$: contradiction, since $3 divides.not 5 + sqrt(79)$. So WLOG assume $a = 3$ (if $a = 0$, swap $P_3$ and $overline(P_3)$. So $ideal(5 + sqrt(79)) = P_2 P_3^3$, hence $e = [P_3]^3$, so $[P_3]$ has order $1$ or $3$.
- Assume that $P_3 = ideal(alpha)_R$, then $ P_2 P_3^3 = ideal(9 + sqrt(79)) ideal(alpha^3) = ideal(5 + sqrt(79)) $ and so $ alpha^3 = (5 + sqrt(79))/(9 + sqrt(79)) u = (-17 + 2 sqrt(79)) u quad "for some" u in R^times $
- For any $a in R^times$, $ideal(plus.minus a alpha)_R = ideal(alpha)_R$ and $(plus.minus a alpha)^3 = \(-17 + 2 sqrt(79)\) u (plus.minus a)^3$. So without changing $P_3$, we can rescale $alpha$ by a unit and so rescale $u$ by a unit cube.
- The fundamental unit of $R$ (by trial and error) is $v = 80 + 9 sqrt(79)$. By @main-theorem-for-units, $ R^times \/ ideal(plus.minus v^3) tilde.equiv ZZ\/3 $ (consider the map $R^times -> ZZ\/3$, $plus.minus v^r = r mod 3$ and use FIT). Thus, up to multiplication by unit cubes, there are only three possible units $1, v, v^2$ (can take $v^(-1)$ instead of $v^2$). So we can choose $alpha$ such that $u$ is $1$, $v$ or $v^(-1)$.
- So $alpha^3$ is one of $ -17 + 2 sqrt(79), quad \(-17 + 2 sqrt(79)\)v = 62 + 7 sqrt(79), quad \(-17 + 2 sqrt(79)\) v^(-1) = -2782 + 313 sqrt(79) $
- Let $alpha = a + b sqrt(79)$, $a, b in ZZ$, then $alpha^3 = a(a^2 + 3 dot 79b^2) + b(3a^2 + 79b^2) sqrt(79)$. We have $3 = N(P_3) = |N(alpha)| = |a^2 - 79b^2|$ so $a, b != 0$ so coefficient in $sqrt(79)$ in $alpha^3$ satisfies $|b(3a^2 + 79b^2)| >= 3 + 79 = 82$, hence $alpha^3 = -2782 + 313 sqrt(79)$. So $b(3a^2 + 79b^2) = 313$ which is prime, hence $b = 1$ and so $a^2 = 78$: contradiction.
- So $P_3$ is not principal so has order $3$, so $Cl(R) tilde.equiv ZZ\/3$.
]
= Diophantine applications
== Mordell equations
#definition[
A *Mordell equation* is of the form $x^2 + d = y^3$, $d in ZZ$, with solutions $x, y in ZZ$ sought.
]
#example[
Find all solutions to the Mordell equation $y^3 = x^2 + 5$.
- Let $K = QQ\(sqrt(-5)\)$, then $R = cal(O)_K = ZZ\[sqrt(-5)\]$. By the Minkowski bound, every element in $Cl(R)$ has representative ideal of norm at most $ (4/pi) sqrt(5) < 3 $ so as a set, $Cl(R) = {e, [P_2]}$ where $P_2 = ideal(2, 1 + sqrt(-5))$ by Kummer-Dedekind.
- $P_2$ is not principal as $a^2 + 5b^2 = 2$ has no solutions, hence $Cl(R) tilde.equiv ZZ\/2$.
- Let $ideal(alpha) = ideal(x + sqrt(-5))$, so $ideal(overline(alpha)) = ideal(x - sqrt(-5))$. If a prime ideal $P$ divides $ideal(alpha)$ and $ideal(overline(alpha))$, then $P | ideal(alpha - overline(alpha)) = ideal(2 sqrt(-5)) = ideal(2)_R ideal(sqrt(-5))_R = P_2^2 P_5$. $2$ and $5$ ramify, so $P_2 = overline(P_2)$ and $overline(P_5) = P_5$.
- Hence $ ideal(alpha) & = P_2^a P_5^b Q_1^(r_1) dots.c Q_n^(r_n), \ ideal(overline(alpha))_R & = P_2^a P_5^b overline(Q_1)^(r_1) dots.c overline(Q_n)^(r_n) $ where $a, b, r_i >= 0$, all $Q_i, overline(Q_i)$ are distinct and different from $P_2$, $P_5$.
- Then $ ideal(y)^3 = ideal(y^3) = ideal(alpha overline(alpha)) = ideal(alpha) ideal(overline(alpha)) = P_2^(2a) P_5^(2b) (Q_1 overline(Q_1))^(r_1) dots.c (Q_n overline(Q_n))^(r_n) $ By uniqueness of prime ideal factorisation, all exponents in RHS are divisible by $3$, so let $I = P_2^(a\/3) P_5^(b\/3) Q_1^(r_1\/3) dots.c Q_n^(r_n\/3)$, so that $I^3 = ideal(alpha)_R$.
- Since $h_K = 2$, the square of any fractional ideal of $R$ is principal, so $(I^(-1))^2$ is principal, hence $I = I^3 (I^(-1))^2 = alpha (I^(-1))^2$ is principal, so let $I = ideal(beta)_R$, for $beta = s + t sqrt(-5) in R$.
- Now $ideal(beta^3) = I^3 = ideal(alpha)$ so $beta^3 = u alpha$ for some $u in R^times$. But only units in $R$ are $plus.minus 1$. Since $I = ideal(-beta)$, can assume that $beta^3 = alpha$. Then $ s^3 + 3s t^2 (-5) + (3s^2 t + t^3(-5))sqrt(-5) = x + sqrt(-5) $
- So $s^3 - 15s t^2 = x$, $3s^2 t - 5t^3 = 1$. Hence $t = plus.minus 1$, and both possibilities yield no integer solutions to the second equation, so $x^2 + 5 = y^3$ has no integer solutions.
]
#example[
Let $K = QQ\(sqrt(-31)\)$, it can be shown with Minkowski bound that $h_K = 3$ so $Cl(R) = ideal([P_2]) tilde.equiv ZZ\/3$ where $P_2 = ideal(2, (1 + sqrt(-31))\/2)$. Show that $ x^2 + 31 = y^3 $ has no solutions $x, y in ZZ$.
- Assume $x, y$ is a solution. $31 divides.not x$, as otherwise $31^2 | (y^3 - x^2) = 31$ (since $31$ is prime): contradiction.
- $x$ is odd and $y$ is even:
- If $x$ even, $y$ is odd and $y^3 equiv 31 equiv -1 mod 4$ so $y equiv -1 mod 4$. Now $x^2 + 4 = y^3 - 27 = (y - 3)(y^2 + 3y + 9)$.
- $y^2 + 3y + 9 equiv -1 mod 4$. Hence $y^2 + 3y + 9$ is divisible by prime $p equiv 3 mod 4$ (since product two numbers of form $4n + 1$ is also of this form). So $x^2 + 4 equiv 0 mod p$. Hence $(x\/2)^2 equiv -1 mod p$ so $(x\/2)^(p - 1) equiv (-1)^((p - 1)/2) equiv -1$ as $p equiv 3 mod 4$ which contradicts Fermat's little theorem. Hence $x$ is odd so $y$ is even.
- Now $\(x + sqrt(-31)\)\(x - sqrt(-31)\) = y^3$. $x$ is odd, so $alpha := (x + sqrt(-31))\/2 in R$. Let $y = 2z$, $z in ZZ$, then $alpha overline(alpha) = 2z^3$ and $ideal(alpha) ideal(overline(alpha)) = ideal(2) ideal(z)^3$.
- If $P | ideal(alpha), ideal(overline(alpha))$, then $alpha, overline(alpha) in P$, so $sqrt(-31) = alpha - overline(alpha) in P$, hence $P = ideal(sqrt(-31))$ (this is prime since norm is $31$, a prime).
- But then $x = alpha + overline(alpha) in P sect ZZ = ideal(31)_ZZ$, but $31 divides.not x$, so we have a contradiction. So $ideal(alpha)$, $ideal(overline(alpha))$ are coprime ideals.
- WLOG, $ideal(alpha) = P_2^a Q_1^(r_1) dots.c Q_n^(r_n)$ and $ideal(overline(alpha)) = overline(P_2)^a overline(Q_1)^(r_1) dots.c overline(Q_n)^(r_n)$ with $P_2$, $overline(P_2)$, all $Q_i, overline(Q_i)$ distinct.
- Then $ideal(alpha) ideal(overline(alpha)) = ideal(2)^a (Q_1 overline(Q_1))^(r_1) dots.c (Q_n overline(Q_n))^(r_n) = ideal(2) ideal(z)^3$.
- Hence $a equiv 1 mod 3$ and for all $i$, $3 | r_i$. So $ideal(alpha) = P_2 I^3$ for some ideal $I$.
- Now $[ideal(alpha)] = e$ and $[I^3] = [I]^3 = e$ as $h_K = 3$. Hence $[P_2] = e$ so $P_2$ is principal.
- So $P_2 = ideal(\(u + v sqrt(-31)\)\/2)$, $u, v in ZZ$, $u equiv v mod 2$.
- Then $2 = N(P_2) = (u^2 + 31v^2)\/4$ hence $8 = u^2 + 31v^2$: contradiction.
]
== Generalised Pell equations
#definition[
A *generalised Pell equation* is of the form $ x^2 - d y^2 = n, quad n in ZZ, d in NN "square-free" $ i.e. determine whether $n$ is a norm from $ZZ\[sqrt(d)\]$.
]
#definition[
Let $K = QQ\(sqrt(14)\)$. Solve $x^2 - 14y^2 = plus.minus 5$. We can assume $R = ZZ\[sqrt(14)\]$ is PID and so a UFD (can be proven using Minkowski bound by showing $h_K = 1$).
- By trial and error, fundamental unit is $u = 15 + 4 sqrt(14)$ and $N(u) = 15^2 - 14 dot 16 = 1$.
- We have $N\(3 - sqrt(14)\) = -5$ so $ideal(5) = ideal(3 + sqrt(14)) ideal(3 - sqrt(14))$ by Kummer-Dedekind.
- Now $ideal(x + y sqrt(14)) ideal(x - y sqrt(14)) = ideal(3 + sqrt(14)) ideal(3 - sqrt(14))$. The ideals on the LHS are conjugate, and ideals on RHS are prime so $ideal(x + y sqrt(14)) = ideal(3 plus.minus sqrt(14))$.
- Hence $x + y sqrt(14) = plus.minus \(15 + 4 sqrt(14)\)^n \(3 plus.minus sqrt(14)\)$ for some $n in ZZ$ and $x - y sqrt(14) = plus.minus \(15 - 4 sqrt(14)\)^n \(3 minus.plus sqrt(14)\)$ which gives all solutions $x, y in ZZ$.
- *Note*: $N\(x + y sqrt(14)\) = x^2 - 14y^2 = N(u)^n N\(3 plus.minus sqrt(14)\) = 1^n dot -5 = -5$ so all solutions must have $-5$ on RHS.
]
#example[
Solve $x^2 - 79y^2 = plus.minus 15$ for $x, y in ZZ$.
- Let $K = QQ\(sqrt(79)\)$, so $R = cal(O)_K = ZZ\[sqrt(79)\]$. We have that $Cl(R) tilde.equiv ZZ\/3$, generated by $[P_3]$.
- $x^2 - 79 equiv (x + 1)(x - 1) mod 3$ so $ideal(3)_R = P_3 overline(P_3) = ideal(3, 1 + sqrt(79)) ideal(3, 1 - sqrt(79))$ by Kummer-Dedekind.
- $x^2 - 79 equiv (x + 2)(x - 2) mod 5$ so $ideal(5)_R = P_5 overline(P_5) = ideal(2 + sqrt(79)) ideal(2 - sqrt(79))$ by Kummer-Dedekind.
- We have $ideal(x + y sqrt(79)) ideal(x - sqrt(79)) = ideal(15)_R = P_3 overline(P_3) P_5 overline(P_5)$. Since $overline(ideal(x + y sqrt(79))) = ideal(x - y sqrt(79))$, we have $x plus.minus y sqrt(79) = P_3 P_5$ or $P_3 overline(P_5)$.
- Note $8^2 - 79 = -15$, thus $ideal(8 + sqrt(79)) = overline(P_3) overline(P_5)$ as $8 + sqrt(79) = 9 - \(1 - sqrt(79)\) = 10 - \(2 - sqrt(79)\)$. Hence $[overline(P_3)] [overline(P_5)] = e$ so $[P_5] = [P_3]^(-1) != [P_3]$.
- So $P_3 P_5$ is principal and $P_3 overline(P_5)$ isn't. Hence $ideal(x plus.minus y sqrt(79)) = P_3 P_5 = ideal(8 - sqrt(79))$.
- Therefore, $x plus.minus y sqrt(79) = plus.minus u^n \(8 - sqrt(79)\)$ where $u = 80 + 9 sqrt(79)$ is fundamental unit in $R$, $n in ZZ$ and this gives all solutions to $x, y in ZZ$.
- Since $N(u) = 1$, $x^2 - 79y^2 = N("LHS") = N\(8 - sqrt(79)\) = -15$ so the only solutions are for $-15$, there are none for $15$.
] |
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/022.%20hp.html.typ | typst | hp.html
Hackers and Painters
May 2003(This essay is derived from a guest lecture at Harvard, which incorporated
an earlier talk at Northeastern.)When I finished grad school in computer science I went
to art school to study painting. A lot of people seemed surprised
that someone interested in computers would also be interested in painting.
They seemed to think that
hacking and painting were very different kinds of work-- that
hacking was cold, precise, and methodical, and that
painting was the frenzied expression of some primal urge.Both of these images are wrong. Hacking and painting have a
lot in common. In fact, of all the different types of people I've
known, hackers and painters are among the most alike.What hackers and painters have in common is that they're
both makers. Along with composers, architects, and writers,
what hackers and painters are trying to do is make good things.
They're not doing research per se, though if in the course of
trying to make good things they discover some new technique,
so much the better.I've never liked the term "computer science." The main
reason I don't like it is that there's no such thing.
Computer science is a
grab bag of tenuously related areas thrown together
by an accident of history, like Yugoslavia.
At one end you have people who are really mathematicians,
but call what they're doing computer science so they can get DARPA grants.
In the middle you have people working on
something like the natural history of computers-- studying the
behavior of algorithms for routing data through
networks, for example. And then at the other extreme you
have the hackers, who are trying to
write interesting software, and for whom computers are just a
medium of expression, as concrete is for architects or
paint for painters. It's as if
mathematicians, physicists, and architects all had to be in
the same department.Sometimes what the hackers do is called "software engineering,"
but this term is just as misleading.
Good software designers are no more engineers than architects are.
The border between architecture and engineering is not sharply
defined, but it's there.
It falls between what and how: architects decide what to do,
and engineers figure out how to do it.What and how should not be kept too separate. You're
asking for trouble if you try to decide what to do without
understanding how to do it.
But hacking can certainly be more than just deciding how to
implement some spec. At its best, it's creating the spec-- though
it turns out the best way to do that is to implement it.Perhaps one day
"computer science" will, like Yugoslavia, get broken up into its
component parts. That might be a good thing. Especially if it
meant independence for my native land, hacking.Bundling all these different types of work together in one
department may be convenient administratively, but it's confusing
intellectually. That's the other reason I don't like the name
"computer science." Arguably the people in the middle are doing
something like an experimental science. But the people at either
end, the hackers and the mathematicians, are not actually doing science.The mathematicians don't seem bothered by this. They happily
set to work proving theorems like the other mathematicians
over in the math department, and probably soon stop noticing
that the building they work in says ``computer science'' on the
outside. But for the hackers this label is a problem.
If what they're doing is called science, it makes them feel they
ought to be acting scientific.
So instead of doing what they really want to do, which is
to design beautiful software, hackers in universities and
research labs feel they ought to be writing research papers.In the best case, the papers are just a formality. Hackers write
cool software, and then write a paper about it, and the paper
becomes a proxy for the achievement represented by the software.
But often this mismatch causes problems. It's easy to
drift away from building beautiful things toward building ugly
things that make more suitable subjects for research papers.Unfortunately, beautiful things don't always make the
best subjects for papers.
Number one, research must be original-- and
as anyone who has written a PhD dissertation knows, the way to
be sure that you're exploring virgin territory is to to stake
out a piece of ground that no one wants. Number two, research must be
substantial-- and awkward systems yield meatier papers,
because you can write about the obstacles you have to overcome
in order to get things done. Nothing yields meaty problems like
starting with the wrong assumptions. Most of AI is an example
of this rule; if you assume that knowledge can be represented
as a list of predicate logic expressions whose arguments represent
abstract concepts, you'll have a lot of
papers to write about how to make this work. As <NAME>
used to say, "Lucy, you got a lot of explaining to do."The way to create something beautiful is often to make subtle
tweaks to something that already exists, or to combine existing
ideas in a slightly new way. This kind of work is hard to
convey in a research paper.So why do universities and research labs continue to judge
hackers by publications?
For the same reason that "scholastic aptitude"
gets measured by simple-minded standardized tests, or
the productivity of programmers gets measured in lines of code.
These tests
are easy to apply, and there is nothing so tempting as an easy test
that kind of works.Measuring what hackers are actually trying to do, designing
beautiful software, would be much more difficult. You need
a good sense of design to judge
good design. And
there is no correlation, except possibly
a negative
one, between people's ability to recognize good
design and their confidence that they can.The only external test is time. Over time, beautiful
things tend to thrive, and ugly
things tend to get discarded. Unfortunately, the amounts of time
involved can be longer than human lifetimes. <NAME>
said it took a hundred years for a writer's reputation to
converge. You have to wait for the writer's
influential friends to die, and then for all their followers
to die.I think hackers just have to resign themselves to having a large random
component in their reputations. In this they are no different
from other makers. In fact, they're lucky by comparison.
The influence of fashion is not nearly so great in hacking as it
is in painting.There are worse things than having people misunderstand your
work. A worse danger is that you
will yourself misunderstand your work. Related fields are
where you go looking for ideas. If you find yourself in the computer science
department, there is a natural temptation to believe, for example,
that hacking is the applied version of what theoretical computer
science is the theory of. All
the time I was in graduate school I had an uncomfortable feeling
in the back of my mind that I ought to know more theory,
and that it was very remiss of me to have forgotten all that
stuff within three weeks of the final exam.Now I realize I was
mistaken. Hackers need to understand the theory of computation
about as much as painters need to understand paint chemistry.
You need to know how to calculate time and
space complexity and about
Turing completeness. You might also want to remember at
least the concept of a state machine, in case you have to write
a parser or a regular expression library. Painters in fact
have to remember a good deal more about paint chemistry than
that.I've found that the best sources of ideas
are not the other fields that have the word "computer" in
their names, but the other fields inhabited by makers.
Painting has been a much richer source of ideas than the
theory of computation.For example, I was taught in college
that one ought to figure out a program
completely on paper
before even going near a computer. I found that I did not
program this way. I found that I liked to program
sitting in front of a computer, not a piece of paper. Worse
still, instead of patiently writing out a complete program
and assuring myself it was correct, I tended to just spew
out code that was hopelessly broken, and gradually beat it into
shape. Debugging, I was taught, was a kind of final pass where
you caught typos and oversights. The way I worked, it
seemed like programming consisted of debugging.For a long time I felt bad about this, just as I once
felt bad that I didn't hold my pencil the way they taught me
to in elementary school.
If I had only looked over at
the other makers, the painters or the architects, I would
have realized that there was a name for what I was doing:
sketching. As far as I can tell, the
way they taught me to program in college was all wrong.
You should figure out programs as you're writing them,
just as writers and painters and architects do.Realizing this has real implications for software design.
It means that a programming language should, above all, be
malleable. A programming language is for
thinking of
programs, not for expressing programs you've already thought
of. It should be a pencil, not a pen. Static typing would
be a fine idea if people actually did write programs the way
they taught me to in college. But that's not how any of the
hackers I know write programs. We need a language that lets us
scribble and smudge and smear, not a language where you have
to sit with a teacup of types balanced on your knee and make
polite conversation with a strict old aunt of a compiler.While we're on the subject of static typing, identifying with
the makers will save us from another problem that afflicts
the sciences: math envy. Everyone in the sciences
secretly believes that mathematicians are smarter than they are.
I think mathematicians also believe this. At any rate,
the result is that scientists tend to make their
work look as mathematical as possible. In a field like
physics this probably doesn't do much harm, but the further you
get from the natural sciences, the more of a problem it
becomes.A page of formulas just looks so impressive.
(Tip: for extra impressiveness, use Greek variables.) And
so there is a great temptation to work on problems you
can treat formally, rather than problems that are, say,
important.If hackers identified with other makers, like writers and
painters, they wouldn't feel tempted to do
this. Writers and painters don't suffer from math envy.
They feel as if they're doing something completely unrelated.
So are hackers, I think.If universities and research labs keep hackers from doing
the kind of work they want to do,
perhaps the place for them is in companies.
Unfortunately, most companies won't let hackers do what they
want either. Universities and research labs force hackers
to be scientists, and companies force them to be engineers.I only discovered this myself quite recently. When Yahoo bought
Viaweb, they asked me what I wanted to do. I had never
liked the business side very much, and said that I just wanted to
hack. When I got to Yahoo, I found that what hacking meant
to them was implementing software, not designing it. Programmers
were seen as technicians who translated the visions (if
that is the word) of product managers into code.This seems to be the
default plan in big companies. They do it because
it decreases the standard deviation of the outcome.
Only a small percentage of hackers can actually design software,
and it's hard for the
people running a company to pick these out. So instead of
entrusting the future of the software to
one brilliant hacker, most companies set things up so that it is
designed by committee, and the hackers merely
implement the design.If you want to make money at some point, remember this,
because this is one of the reasons startups win. Big companies want
to decrease the standard deviation of design outcomes because they
want to avoid disasters. But when you damp oscillations, you
lose the high points as well as the low. This is not a problem for
big companies, because they don't win by making great
products. Big companies win by sucking less than other big companies.So if you can figure out a way to get in a
design war with a company big enough that its software is
designed by product managers, they'll never be able to keep up
with you. These opportunities are not easy to find, though.
It's hard to engage a big company in a design war,
just as it's hard to engage an opponent inside a castle in hand
to hand combat. It would be pretty easy to write a better
word processor than Microsoft Word, for example, but Microsoft,
within the castle of their operating system monopoly,
probably wouldn't even notice if you did.The place to fight design wars is in new markets, where no one
has yet managed to establish any fortifications. That's where
you can win big by taking the bold approach to design, and
having the same people both design and implement the product.
Microsoft themselves did this at the start. So did Apple.
And Hewlett-Packard. I suspect almost every successful startup
has.So one way to build great software is to start your own
startup. There are two problems with this, though. One is
that in a startup you have to do so much besides write software.
At Viaweb I considered myself lucky if I
got to hack a quarter of the time. And the things I had to
do the other three quarters of the time ranged from tedious
to terrifying. I have a benchmark for this, because I
once had to leave a board meeting to have
some cavities filled. I remember sitting back in the
dentist's chair, waiting for the drill, and feeling like
I was on vacation.The other problem with startups is that there is not much
overlap between the kind of software that makes money and the
kind that's interesting to write. Programming languages
are interesting to write, and Microsoft's first product was
one, in fact, but no one will pay for programming languages
now. If you want to make money, you tend to be forced to work
on problems that are too nasty for anyone to solve for free.All makers face this problem. Prices are
determined by supply and demand, and there is just not as much
demand for things that are fun to work on as there is for
things that solve the mundane problems of individual customers.
Acting in off-Broadway plays just doesn't pay as well as
wearing a gorilla suit in someone's booth at a
trade show. Writing novels doesn't pay as well as writing
ad copy for garbage disposals.
And hacking programming languages doesn't pay as well
as figuring out how to connect some company's
legacy database to their Web server.I think the answer to this problem, in the case of software,
is a concept known to nearly all makers: the day job.
This phrase began with musicians, who
perform at night. More generally, it means that you have one
kind of work you do for money, and another for love.Nearly all makers have day jobs early in their careers.
Painters and writers notoriously do. If you're lucky
you can get a day job that's closely
related to your real work. Musicians often
seem to work in record stores. A hacker working on some
programming language or operating system might likewise be able to
get a day job using it. [1]When I say that the answer is for hackers to have day jobs,
and work on beautiful software on the side, I'm not proposing
this as a new idea. This is what open-source hacking is all
about. What I'm saying is that open-source is probably the right
model, because it has been independently confirmed by all the
other makers.It seems surprising to me that any employer would be reluctant
to let hackers work on open-source projects.
At Viaweb, we would have been reluctant to hire anyone
who didn't. When we interviewed
programmers, the main
thing we cared about was what kind of software they
wrote in their spare time.
You can't do anything really well unless
you love it, and if you love to hack you'll inevitably
be working on projects of your own. [2]Because hackers are makers rather than scientists,
the right place to look for metaphors is not in the
sciences, but among other kinds of makers. What else can painting
teach us about hacking?One thing we can learn, or at least confirm, from the
example of painting is how to learn to hack. You learn to
paint mostly by doing it.
Ditto for hacking. Most hackers don't learn to hack by
taking college courses in programming. They learn to hack
by writing programs of their own at age thirteen. Even in
college classes, you learn to hack mostly by hacking. [3]Because painters leave a trail of work behind them, you
can watch them learn by doing. If you look at the work
of a painter in chronological order, you'll find that each
painting builds on things that have been learned in previous
ones. When there's something in
a painting that works very well, you can usually find version
1 of it in a smaller form in some earlier painting.I think most makers work this way. Writers and architects seem
to as well. Maybe it would be good for hackers
to act more like painters, and regularly start over from scratch,
instead of continuing to work for years on one project, and
trying to incorporate all their later ideas as revisions.The fact that hackers learn to hack by doing it is another
sign of how different hacking is from the sciences. Scientists
don't learn science by doing it, but by doing labs and problem sets.
Scientists start out doing work that's perfect, in the sense
that they're just trying to reproduce work someone else has
already done for them.
Eventually, they get
to the point where they can do original work.
Whereas hackers, from the start, are doing original work; it's
just very bad. So hackers start original, and get good, and
scientists start good, and get original.
The other way makers learn is from examples.
For a painter, a museum is a reference library of techniques.
For hundreds of years it has been part of the traditional
education of painters to copy the works of the great masters,
because copying forces you to look closely
at the way a painting is made.Writers do this too.
<NAME> learned to write by summarizing the points
in the essays of Addison and Steele and then trying to
reproduce them. <NAME> did the same thing
with detective stories.Hackers, likewise, can learn to program by looking at
good programs-- not just at what they do, but the source
code too. One of the less publicized benefits
of the open-source movement is that it has made it easier
to learn to program. When I learned to program, we had to rely
mostly on examples in books. The one big chunk of
code available then was Unix, but even this was not
open source. Most of the people who read the source
read it in illicit photocopies of <NAME>' book, which
though written in 1977 was not allowed to be published
until 1996.Another example we can take from painting is the way that
paintings are created by gradual refinement. Paintings usually
begin with a sketch.
Gradually the details get filled in.
But it is not merely a process of filling in. Sometimes
the original plans turn out to be mistaken.
Countless paintings,
when you look at them in xrays, turn out to have limbs that
have been moved or facial features that have been readjusted.Here's a case where we can learn from painting. I think hacking
should work this way too. It's unrealistic
to expect that the specifications for a program will be
perfect. You're
better off if you admit this up front, and write programs in
a way that allows specifications to change on the fly.(The structure of large companies makes this hard for them
to do, so here is another place where startups have an advantage.)Everyone by now presumably knows about the danger of premature
optimization. I think we should be just as worried about
premature design-- deciding too early what
a program should do.The right tools can help us avoid
this danger.
A good programming language should, like oil paint, make it
easy to change your mind. Dynamic typing is a win here because
you don't have to
commit to specific data representations up front.
But the key to flexibility, I think, is to make the language
very abstract.
The easiest program to change is one that's very short.
This sounds like a paradox, but a great painting
has to be better than it has to be.
For example, when Leonardo
painted the portrait of <NAME>
in the National Gallery, he put a juniper bush behind her head.
In it he carefully
painted each individual leaf. Many painters might have thought,
this is just something to put in the background to frame
her head. No one will look that closely at it.Not Leonardo. How hard he worked on part of a painting didn't
depend at all on how closely he expected anyone to look at it.
He was like <NAME>. Relentless.Relentlessness wins because, in the aggregate, unseen details
become visible.
When people walk by the portrait of <NAME>,
their attention is often immediately arrested by it,
even before they look at the label and notice that it says
<NAME>. All those unseen details combine to produce
something that's just stunning, like a thousand barely audible
voices all singing in tune.Great software, likewise, requires a fanatical devotion to
beauty. If you look inside good software, you find that
parts no one is ever supposed to see are beautiful too.
I'm not claiming I write great software, but I
know that when it comes to code I behave in a way that would
make me eligible for prescription drugs if I approached everyday
life the same way.
It drives me crazy to see code that's badly indented,
or that uses ugly variable names.If a hacker were a mere implementor, turning a spec into code, then
he could just work his way through it from one end to the other like
someone digging a ditch. But if the hacker is a creator, we have
to take inspiration into account.In hacking, like painting,
work comes in cycles. Sometimes you get excited about some
new project and you want to work sixteen hours a day on it.
Other times nothing seems interesting.To do good work you have to take these cycles into
account, because they're affected by how you react to them.
When you're driving a
car with a manual transmission on a hill, you have to back off
the clutch sometimes to avoid stalling. Backing
off can likewise prevent ambition from stalling.
In both painting and hacking there are some
tasks that are terrifyingly ambitious, and others that are
comfortingly routine. It's a good idea to save some easy
tasks for moments when you would otherwise stall.In hacking, this can literally mean saving up bugs.
I like debugging: it's the
one time that hacking is as straightforward as
people think it is. You have a
totally constrained problem, and all you have to do is solve
it. Your program is supposed to do x. Instead it does y.
Where does it go wrong? You know you're going to win
in the end. It's as relaxing as painting a wall.The example of painting can teach us not only how to manage our
own work, but how to work together. A lot of the
great art of the past is the work of multiple hands, though
there may only be one name on the wall next to it in the
museum. Leonardo was an apprentice in the workshop of
Verrocchio and painted one of the angels in his Baptism of
Christ. This sort of thing was the rule, not the exception.
Michelangelo was considered especially dedicated for insisting
on painting all the figures on the ceiling of the Sistine
Chapel himself.As far as I know, when painters worked together on a painting,
they never worked on the same parts. It was common
for the master to paint the principal figures and for assistants
to paint the others and the background. But you never had
one guy painting over the work of another.I think this is the right model for collaboration in software
too. Don't push it too far. When a piece of code is
being hacked by three or four different people, no one of whom
really owns it, it will end up being like a common-room. It will
tend to feel bleak and abandoned, and accumulate cruft.
The right
way to collaborate, I think, is to divide projects into sharply
defined modules, each with a definite owner, and with interfaces
between them that are as carefully designed and, if possible,
as articulated as programming languages.Like painting, most software is intended for
a human audience. And so hackers, like painters, must have
empathy to do really great work. You have to be able to see
things from the user's point of view.When I was a kid I was always being told to look at things from
someone else's point of view. What this always meant in
practice was to do what someone else wanted, instead of what
I wanted. This of course gave empathy a bad name, and I made a
point of not cultivating it.Boy, was I wrong. It turns out that looking at things from
other people's point of view is practically the secret of
success. It doesn't necessarily mean being self-sacrificing.
Far from it. Understanding how someone else sees things
doesn't imply that you'll act in his interest; in some
situations-- in war, for example-- you want to do exactly
the opposite. [4]Most makers make things for a human audience.
And to engage an audience you have to understand what they need.
Nearly all the greatest paintings are paintings of people,
for example, because people are what people are interested in.Empathy is probably the single most important difference
between a good hacker and a great one. Some hackers
are quite smart, but when it comes to empathy are
practically solipsists. It's hard for such
people to design great software [5], because they can't
see things from the user's point of view.One way to tell how good people are at empathy is to watch
them explain a technical question to someone without a technical
background. We probably all know people who, though otherwise smart,
are just comically bad at this. If someone asks them at
a dinner party what a programming language is, they'll
say something like ``Oh, a high-level language is what
the compiler uses as input to generate object code.''
High-level language? Compiler? Object code? Someone who
doesn't know what a programming language is obviously doesn't
know what these things are, either.Part of what software has to do is explain itself. So to
write good software you have to understand how little users
understand.
They're going to walk up to the software with no preparation, and
it had better do what they guess it will, because they're
not going to read the manual. The best system I've ever seen
in this respect was the original Macintosh, in 1985.
It did what software almost never does: it just worked. [6]Source code, too, should explain itself. If I could get people to
remember just one quote about programming, it would be the
one at the beginning of Structure and Interpretation of Computer
Programs.
Programs should be written for people to read, and
only incidentally for machines to execute.
You need to have
empathy not just for your users, but for your readers. It's in
your interest, because you'll be one of them.
Many a hacker has written a program only to
find on returning to it six months later that he has no idea
how it works. I know several people who've sworn off Perl after
such experiences. [7]Lack of empathy is associated with intelligence, to the point
that there is even something of a fashion for it in some places.
But I don't think there's any correlation.
You can do well in math and
the natural sciences without having to learn empathy, and people in these
fields tend to be smart, so the two qualities have come to be
associated. But there are plenty of dumb people who are bad at
empathy too. Just listen to the people who call in with questions on
talk shows. They ask whatever it is they're asking in
such a roundabout way
that the hosts often have to rephrase the question for them.So, if hacking works like painting and writing, is it as cool?
After all, you only get one life.
You might as well spend it working on something great.Unfortunately, the question is hard to answer. There is always
a big time lag in prestige. It's like light from a distant star.
Painting has prestige now because of great work people did five hundred
years ago. At the time, no one thought
these paintings were as important as we do today. It would have
seemed very odd to people at the time that <NAME>,
the Duke of Urbino, would one day be known mostly as the guy
with the strange nose in a painting
by <NAME>.So while I admit that hacking doesn't seem as cool as painting now,
we should remember that painting itself didn't seem as cool in
its glory days as it does now.What we can say with some confidence is that these are the glory
days of hacking. In most fields the great work is done early on.
The paintings made between 1430 and 1500 are still unsurpassed.
Shakespeare appeared just as professional theater was being born,
and pushed the medium
so far that every playwright since has had to live in his shadow.
<NAME> did the same thing with engraving, and <NAME>
with the novel.Over and over we see the same pattern. A new medium appears, and
people are so excited about it that they explore most of its
possibilities in the first couple generations. Hacking seems
to be in this phase now.Painting was not, in Leonardo's time, as cool as his work
helped make it.
How cool hacking turns out to be will depend on what we can
do with this new medium.
Notes[1] The greatest damage that photography has done
to painting may be the fact that it killed the best day job.
Most of the great painters in history supported
themselves by painting portraits. [2] I've been told that Microsoft discourages
employees from contributing to open-source projects, even in
their spare time.
But so many of the best hackers work on open-source
projects now that the main effect of this policy may be
to ensure that they won't be able to hire any first-rate
programmers.[3] What you learn about programming in college is much like
what you learn about books or clothes or dating: what bad taste you
had in high school.[4] Here's an example of applied empathy.
At Viaweb, if we couldn't decide between two alternatives, we'd
ask, what would our competitors hate most? At one point a
competitor added a feature to their software that was basically
useless, but since it was one of few they had that we didn't, they
made much of it in the trade press.
We could have tried to explain that the feature was useless,
but we decided it would annoy our competitor more if we
just implemented it ourselves, so we hacked together our own
version that afternoon.[5] Except text editors and compilers. Hackers don't need empathy to
design these, because they are themselves typical users.[6] Well, almost. They overshot the available RAM somewhat,
causing much inconvenient disk swapping, but this could be fixed
within a few months by buying an additional disk drive.[7] The way to make programs easy to read is not to
stuff them with comments. I would take Abelson and Sussman's
quote a step further. Programming languages should be designed
to express algorithms, and only incidentally to tell computers
how to execute them. A good programming language
ought to be better for explaining software than English.
You should only
need comments when there is some kind of kludge you need to warn
readers about, just as on a road there are only
arrows on parts with unexpectedly sharp curves.
Thanks to <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this, and to <NAME>
and <NAME> for inviting me to speak.Japanese TranslationSpanish TranslationGerman TranslationPortuguese TranslationCzech TranslationWhy Good Design Comes from Bad DesignKnuth: Computer Programming as an Art
You'll find this essay and 14 others in
Hackers & Painters.
|
|
https://github.com/jkharv/typst-templates | https://raw.githubusercontent.com/jkharv/typst-templates/master/article.typ | typst | #let script-size = 8pt
#let footnote-size = 8.5pt
#let small-size = 9pt
#let normal-size = 10pt
#let large-size = 13pt
#let body-font = "EB Garamond"
#let header-font = "Montserrat"
#let num_cols = 2
#let article(
title: [Paper title],
authors: (),
abstract: none,
paper-size: "us-letter",
bibliography-file: none,
body,
) = {
set page(
paper: paper-size,
margin: {
(
top: 2.5cm,
left: 2cm,
right: 2cm,
bottom: 2.5cm
)
})
let names = authors.map(author => author.name)
let author-string = if authors.len() == 2 {
names.join(" & ")
} else {
names.join(", ", last: ", & ")
}
set document(title: title, author: names)
set text(size: normal-size, font: body-font)
// Configure headings.
set heading(numbering: "1.")
show heading: it => {
// Create the heading numbering.
let number = if it.numbering != none {
counter(heading).display(it.numbering)
h(0.5em, weak: true)
}
// Level 1 heading
set text(size: normal-size, weight: 400, font: header-font)
if it.level == 1 {
set align(center)
v(1em, weak:true)
smallcaps(text(weight: "bold", number + it.body))
v(1em, weak:true)
// Other level headings
} else {
text(weight: "medium",number + it.body)
}
}
// Configure lists and links.
set list(indent: 8pt, body-indent: 5pt)
set enum(indent: 8pt, body-indent: 5pt)
// Configure equations.
show math.equation: set block(below: 8pt, above: 9pt)
show math.equation: set text(weight: 400)
// Configure citation and bibliography styles.
set bibliography(style: "oikos.csl", title: [References])
show figure: it => {
// Space, then figure
v(2em, weak: true)
it.body
// Display the figure's caption.
if it.has("caption") {
set text(size: footnote-size)
smallcaps(it.supplement)
if it.numbering != none {
[ ]
it.counter.display(it.numbering)
}
[. ]
it.caption.body
}
v(2em, weak: true)
}
let title ={
// Display the title
align(horizon + center,
par(leading: 0.75em,
upper(
text(size: 15pt, weight: 600, font: header-font, title)
)))
}
let abstract = {
if abstract != none {
align(center, smallcaps("Abstract."))
par(justify: true, abstract)
}
}
let author ={
align(center,
smallcaps((text(font: header-font,
size: footnote-size,
author-string))))
}
// Display title and Abstract horizontally
grid(columns: (1fr, 2.5fr),
column-gutter: 0.25cm,
title,
abstract
)
author
line(start: (5%, 0%), end: (95%, 0%))
v(1cm, weak: true)
show: rest => columns(num_cols, rest)
// Display the article's contents.
par(first-line-indent: 2em, justify: true, body)
// Display the bibliography, if any is given.
if bibliography-file != none {
bibliography(bibliography-file)
}
for author in authors {
author.at("name")
linebreak()
let keys = ("department", "organization", "location")
let dept-str = keys
.filter(key => key in author)
.map(key => author.at(key))
.join(", ")
smallcaps(dept-str)
linebreak()
if "email" in author [
#link("mailto:" + author.email) \
]
if "url" in author [
_URL:_ #link(author.url)
]
v(12pt, weak: true)
}
} |
|
https://github.com/mrcinv/nummat-typst | https://raw.githubusercontent.com/mrcinv/nummat-typst/master/10_nelinearne_geometrija.typ | typst | = Nelinearne enačbe v geometriji
== Naloga
- Implementirajte Newtonovo metodo za sisteme nelinearnih enačb.
- Napišite funkcije, ki poišče presečišča geometrijskih objektov:
- samopresečišče #link("https://sl.wikipedia.org/wiki/Lissajousova_krivulja")[Lissajousove krivulje]
$ (x(t), y(t)) = (a sin(n t), b cos(m t)) $
za parametre $a = b = 1$ in $n=3$ in $m=2$.
- poltraka $bold(x)(t) = bold(x_0) + t bold(e)$ in #link("https://en.wikipedia.org/wiki/Implicit_surface")[implicitne ploskve] podane z enačbo
$F(x, y, z) = 0$.
- Poiščite minimalno razdaljo med dvema parametrično podanima krivuljama:
$
(x_1(t), y_1(t)) = &(2 cos(t) + 1/3, sin(t) + 1/4) \
(x_2(s), y_2(s)) = &(1/3 cos(s) - 1/2 sin(s), 1/3 cos(s) + 1/2 sin(t)).
$
- Zapišite razdaljo med točko na prvi krivulji in točko na drugi krivulji kot funkcijo
$d(t, s)$ parametrov $t$ in $s$.
- Minimum funkcije $d(t, s)$ oziroma $d^2(t, s)$ poiščite z #link("https://en.wikipedia.org/wiki/Gradient_descent")[gradientnim spustom].
- Minimum funkcije $d^2(t, s)$ poiščite z Newtonovo metodo kot rešitev vektorske enačbe $ nabla d^2(t, s) = 0. $
- Grafično predstavi zaporedja približkov za gradientno metodo in Newtonovo metodo.
- Primerjaj konvergenčna območja za gradientno in Newtonovo metodo (glej @konvergencna-obmocja). |
|
https://github.com/daniel-eder/typst-template-jku | https://raw.githubusercontent.com/daniel-eder/typst-template-jku/main/src/template/styles/default.typ | typst | // SPDX-FileCopyrightText: 2023 <NAME>
//
// SPDX-License-Identifier: Apache-2.0
#let default(it) = {
set page(
paper: "a4",
margin: (left: 30mm, right: 30mm, top: 40mm, bottom: 40mm),
header-ascent: 1cm, // The amount the header is raised into the top margin.
footer-descent: 0.75cm, //The amount the footer is lowered into the bottom margin.
number-align: center,
)
set text(
size: 12pt,
font: "linux libertine", //linux libertine is the default typst fonts
lang: "en"
)
set heading(numbering: "1.1") //set heading numbering
set par(justify: true) //make paragraph justified
//header font sizes
//for level 1 also add spacing
show heading.where(level: 1): it => [
//we want a new page for each chapter
#pagebreak(weak: true)
#set text(size: 24pt)
#v(3.5cm)
#par(first-line-indent: 0pt)[#it]
#v(1.5cm)
]
show heading.where(level: 2): set text(size: 18pt)
show heading.where(level: 3): set text(size: 14pt)
it
} |
|
https://github.com/Otto-AA/definitely-not-tuw-thesis | https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/src/styles/toc.typ | typst | MIT No Attribution | #import "utils/state.typ": is-back-matter
#let toc-styles = rest => {
set outline(depth: 2, indent: auto)
show outline.entry.where(level: 1): it => {
context if is-back-matter.get() {
// List of Figures/...
text(it, size: 1.1em)
} else {
// Actual ToC
v(0.4em)
strong(text(it, size: 1.4em))
}
}
show outline.entry.where(level: 2): it => {
text(it, size: 1.1em)
}
rest
}
|
https://github.com/knuesel/typst-minideck | https://raw.githubusercontent.com/knuesel/typst-minideck/main/themes/themes.typ | typst | MIT License | #import "simple.typ": simple
|
https://github.com/rabotaem-incorporated/algebra-conspect-1course | https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/01-number-theory/11-euler-fn.typ | typst | Other | #import "../../utils/core.typ": *
== Функция Эйлера
#pr[
Пусть $m in NN, space a in ZZ$, тогда $[a]_m in (factor(ZZ, m ZZ))^* <==> a bot m$
]
#proof[
$[a]_m in (factor(ZZ, m ZZ))^* <==> exists [b]_m: space [a]_m dot.c [b]_m = [1]_m <==>$
$exists b in ZZ: space a b equiv_(m) 1 <==>$
$exists b, c in ZZ: space a b = 1 + m c <==>$
$exists b, c in ZZ: space a b - m c = 1 <==> gcd(a, m) = 1 <==> a bot m$
]
#follow[
$factor(ZZ, m ZZ)$ --- поле $<==> m$ --- простое число.
]
#proof[
$m = 1: space (factor(ZZ, 1 ZZ)) = {overline(0)}$
$m$ --- простое: $space.quad gcd(a, m) = 1, space.quad forall a in {1, 2, ..., m-1} ==>$
$(factor(ZZ, m ZZ))^* = {overline(1), overline(2), ..., overline(m-1)}$
$m$ --- составное: $space.quad m = a b, space 2 <= a < m$
$gcd(a, m) eq.not 1 ==> overline(a) in.not (factor(ZZ, m ZZ))^*$
]
#def[
$\F_(n)$ --- поле из $n$ элементов. Называется _конечным полем_ или _полем Галуа_.
]
#pr[
$\F_(n)$ --- поле из $n$ элементов $<==> n = p^r, space p in PP, space r in ZZ_(+)$.
$p$ --- характеристика $\F_(n)$.
]
#proof[
Без доказательства.
]
#def[
Пусть $m in NN: space phi(n) = |(factor(ZZ, m ZZ))^*|$
Функция $phi times NN -> NN$ --- _функция Эйлера_.
]
#pr[
Пусть $p in PP, space r in NN$.
Тогда $phi(p^r) = p^r - p^(r-1)$.
]
#proof[
$phi(p^r) = |{a divides 0 <= a < p^r, space (a, p^r) = 1}| = $
$p^r - |{a divides 0 <= a < p^r, space (a, p) eq.not 1}| = $
$p^r - |{a divides 0 <= a < p^r, space p divides a}| = p^r - p^(r-1)$
]
#pr[
Мультипликативность функции Эйлера.
Пусть $m, n in NN, space m bot n$.
Тогда $phi(m n) = phi(m) dot.c phi(n)$.
]
#proof[
Построим отображение $lambda: (factor(ZZ, m n ZZ))^* -> (factor(ZZ, m ZZ))^* times (factor(ZZ, n ZZ))^*$:
$[a]_(m n) = A in (factor(ZZ, m n ZZ))^* |-> ([a]_m, [a]_n)$
$[a]_(m n) in (factor(ZZ, m n ZZ))^* ==> a bot m n ==>
cases(
a bot m,
a bot n
) ==>
cases(
[a]_m in (factor(ZZ, m ZZ))^*,
[a]_n in (factor(ZZ, n ZZ))^*
)$
Проверка корректности:
$[a]_(m n) = [a']_(m n) ==> a equiv_(m n) a' ==>
cases(
a equiv_(m) a',
a equiv_(n) a'
) ==>
cases(
[a]_m = [a']_m,
[a]_n = [a']_n
) ==>
([a]_m, [a]_n) = ([a']_m, [a']_n)$
Проверим что $lambda$ --- биекция:
Инъективность:
$lambda([a]_(m n)) = lambda([b]_(m n)) ==>
cases(
[a]_m = [b]_m,
[a]_n = [b]_n
)
limits(==>)^(m bot n) a equiv_(m n) b ==> [a]_(m n) = [b]_(m n)$
Сюръективность:
Рассмотрим $([b]_m, [c]_n) in (factor(ZZ, m ZZ))^* times (factor(ZZ, n ZZ))^*$.
$m bot n limits(==>)^("КТО") exists a:
cases(
a equiv_(m) b,
a equiv_(n) c
)$
$cases(
b bot m ==> a bot m,
c bot n ==> a bot n
) ==> a bot m n ==> [a]_(m n) in (factor(ZZ, m n ZZ))^*$
$lambda([a]_(m n)) = ([a]_m, [a]_n) = ([b]_m, [c]_n) ==> lambda$ --- биекция.
$lambda$ --- биекция $==> |(factor(ZZ, m n ZZ))^*| = |(factor(ZZ, m ZZ))^* times (factor(ZZ, n ZZ))^*| ==> phi(m n) = phi(m) dot.c phi(n)$
]
#follow[
Пусть $m_1, ..., m_k$ --- попарно взаимно простые числа.
Тогда $phi(limits(product)_(i=1)^k m_i) = limits(product)_(i=1)^k phi(m_i)$.
]
#proof[
Индукция по $k$.
"База": $k = 1 ==> phi(m_1) = phi(m_1)$
"Переход": $n-1 -> n$
$(m_n, m_1) = ... = (m_n, m_(n-1)) = 1 ==> (m_1, ..., m_n) = 1 ==>$
$phi(m_1 ... m_n) = phi(m_1 ... m_(n-1)) phi(m_n) = phi(m_1) ... phi(m_(n-1)) phi(m_n)$
]
#follow[
Пусть $n = p_1^(r_1), ..., p_s^(r_s)$ --- разложение числа $n$ на простые множители.
$==> phi(n) = limits(product)_(i=1)^s (p_i^(r_i) - p_i^(r_i-1))$
]
#proof[
По следствию: $phi(n) = phi(limits(product)_(i=1)^s p_i^(r_i)) = limits(product)_(i=1)^s phi(p_i^(r_i)) = limits(product)_(i=1)^s (p_i^(r_i) - p_i^(r_i-1))$
]
#lemma[
Пусть $R$ --- ассоциативное кольцо с единицей.
+ $a, b in R^* ==> a b in R^*$
+ $a in R^*, space x,y in R ==> cases(
a x = a y ==> x = y,
x a = y a ==> x = y
)$
]
#proof[
+ $a'$ --- обратный к $a$ элемент, $b'$ --- обратный к $b$ элемент.
$(a b)(b' a') = a (b b') a' = a a' = 1$
$(b' a) (a b) = b' (a a') b = b b' = 1$
+ $a'$ --- обратный к $a$ элемент.
$a x = a y ==> a' a x = a' a y ==> x = y$
$x a = y a ==> x a a' = y a a' ==> x = y$
]
#th(name: "<NAME>")[
Пусть $m in NN, space a in ZZ, space a bot m ==> a^(phi(m)) equiv_(m) 1$.
]
#proof[
$(factor(ZZ, m ZZ))^* = {A_1, A_2, ..., A_(phi(m))}$
$[a]_m, A_j in (factor(ZZ, m ZZ))^* limits(==>)^("1 из леммы") [a]_m A_j in (factor(ZZ, m ZZ))^*$, тогда
$[a]_m A_1, ..., [a]_m A_(phi(m))$ --- различные элементы, иначе $[a]_m A_j = [a]_m A_k limits(==>)^("2 из леммы") A_j = A_k$
${[a]_m A_1, ..., [a]_m A_(phi(m))} = (factor(ZZ, m ZZ))^* ==>$
$[a]_m A_1 dot.c ... dot.c [a]_m A_(phi(m)) = A_1 A_2 ... A_(phi(m)) ==>$
$[a]_m^(phi(m)) A_1 A_2 ... A_(phi(m)) = [1]_m A_1 A_2 ... A_(phi(m)) limits(==>)^("2 из леммы")$
$[a]_m^(phi(m)) = [1]_m ==> [a^(phi(m))]_m = [1]_m ==> a^(phi(m)) equiv_(m) 1$
]
#th(name: "<NAME>")[
Пусть $p in PP, space a in ZZ ==> a^p equiv_(p) a$
]
#proof[
$(a, p) = 1 ==> a^(p-1) equiv_(p) 1 ==> a^(p-1) dot.c a equiv_(p) 1 dot.c a ==> a^p equiv_(p) a$
$(a, p) eq.not 1 ==> a equiv_(p) 0 ==> cases(
a^p equiv_(p) 0,
a equiv_(p) 0
) ==> a^p equiv_(p) a$
]
#th(name: "<NAME>")[
$p in PP ==> (p-1)! equiv_(p) -1$
]
#proof[
В $(factor(ZZ, p ZZ))^* : overline((p-1)!) = overline(1) dot.c overline(2) dot.c ... dot.c overline(p-1) = limits(product)_(A in (factor(ZZ, p ZZ))^*) A = $
$( limits(product)_(A^2 = overline(1)) A ) dot.c ( limits(product)_(A^2 eq.not overline(1)) A ) = ( limits(product)_(A^2 = overline(1)) A ) dot.c ( A_1 dot.c A_1' dot.c ... ) = ( limits(product)_(A^2 = overline(1)) A ) dot.c overline(1) = limits(product)_(A^2 = overline(1)) A$
Рассмотрим каждый элемент:
$A^2 = overline(1) <==> A^2 - overline(1)^2 = overline(0) <==> (A - overline(1))(A + overline(1)) = overline(0) limits(<==>)^((factor(ZZ, p ZZ)) "--- ОЦ") A - overline(1) = overline(0) " или " A + overline(1) = overline(0)$
Тогда, если:
$ cases(
p = 2\, space &"то" space limits(product)_(A^2 = overline(1)) A = overline(1) = overline(-1),
p eq.not 2\, space &"то" space limits(product)_(A^2 = overline(1)) A = overline(1) dot.c overline(-1) = overline(-1)
) $
]
|
https://github.com/antran22/typst-cv-builder | https://raw.githubusercontent.com/antran22/typst-cv-builder/main/lib/util.typ | typst | MIT License | #let pull_entries(data, only: ()) = {
if only == "hidden" {
return ()
}
if type(only) != array or only.len() == 0 {
return data
}
let mapping = (:)
for entry in data {
if "id" in entry {
mapping.insert(entry.id, entry)
}
}
let result = ()
for id in only {
if id in mapping {
let entry = mapping.at(id)
if "inherit" in entry and entry.inherit in mapping {
entry = mapping.at(entry.inherit) + entry
}
result.push(entry)
}
}
return result
}
#let stick_together(a, b, threshold: 3em) = {
block(a + v(threshold), breakable: false)
v(-1 * threshold)
b
}
#let equal_columns(column_count: 1) = {
return range(column_count).map(_ => 1fr)
} |
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/code/import-items.typ | typst | Apache License 2.0 | #import "test.typ": aaa, bbb as cccccccccc, ddd as eeeeeeeeeee, fff as g, hhh as iiii, jjj as k, lll as m, nnn as o, ppp as q, rrr as s, ttt as u, vvv as w, xxx as y, zzz as aa, bbb as cc, ddd as ee, fff as gg, hhh as ii, jjj as kk, lll as mm, nnn as oo, ppp as qq, rrr as ss, ttt as uu, vvv as ww, xxx as yy, zzz as aaa, bbb as ccc, ddd as eee, fff as ggg, hhh as iii, jjj as k
#import "test.typ": a.b.c.d, eee
|
https://github.com/Quaternijkon/notebook | https://raw.githubusercontent.com/Quaternijkon/notebook/main/content/数据结构与算法/.chapter-数据结构/堆/数组中的第K个最大元素.typ | typst | #import "../../../../lib.typ":*
=== #Title(
title: [数组中的第K个最大元素],
reflink: "https://leetcode.cn/problems/kth-largest-element-in-an-array/description/",
level: 2,
)<数组中的第K个最大元素>
#note(
title: [
数组中的第K个最大元素
],
description: [
给定整数数组 nums 和整数 k,请返回数组中第 k 个最大的元素。
请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。
],
examples: ([
输入: [3,2,1,5,6,4], k = 2
输出: 5
],[
输入: [3,2,3,1,2,4,5,5,6], k = 4
输出: 4
]
),
tips: [
1 <= k <= nums.length <= $10^5$
$-10^4$ <= nums[i] <= $10^4$
],
solutions: (
( name:[基于快速排序的选择方法],
text:[
我们可以用快速排序来解决这个问题,先对原数组排序,再返回倒数第 k 个位置,这样平均时间复杂度是 O(nlogn),但其实我们可以做的更快。
首先我们来回顾一下快速排序,这是一个典型的分治算法。我们对数组 `a[l⋯r]` 做快速排序的过程是(参考《算法导论》):
- 分解: 将数组 `a[l⋯r]` 「划分」成两个子数组 `a[l⋯q−1]`、`a[q+1⋯r]`,使得 `a[l⋯q−1]` 中的每个元素小于等于 `a[q]`,且 `a[q]` 小于等于 `a[q+1⋯r]` 中的每个元素。其中,计算下标 q 也是「划分」过程的一部分。
- 解决: 通过递归调用快速排序,对子数组 `a[l⋯q−1]` 和 `a[q+1⋯r]` 进行排序。
- 合并: 因为子数组都是原址排序的,所以不需要进行合并操作,`a[l⋯r]` 已经有序。
- 上文中提到的 「划分」 过程是:从子数组 `a[l⋯r]` 中选择任意一个元素 x 作为主元,调整子数组的元素使得左边的元素都小于等于它,右边的元素都大于等于它, x 的最终位置就是 q。
由此可以发现每次经过「划分」操作后,我们一定可以确定一个元素的最终位置,即 x 的最终位置为 q,并且保证 `a[l⋯q−1]` 中的每个元素小于等于 `a[q]`,且 `a[q]` 小于等于 `a[q+1⋯r]` 中的每个元素。所以只要某次划分的 q 为倒数第 k 个下标的时候,我们就已经找到了答案。 我们只关心这一点,至于 `a[l⋯q−1]` 和 `a[q+1⋯r]` 是否是有序的,我们不关心。
因此我们可以改进快速排序算法来解决这个问题:在分解的过程当中,我们会对子数组进行划分,如果划分得到的 q 正好就是我们需要的下标,就直接返回 `a[q]`;否则,如果 q 比目标下标小,就递归右子区间,否则递归左子区间。这样就可以把原来递归两个区间变成只递归一个区间,提高了时间效率。
],code:[
```cpp
class Solution {
public:
int quickselect(vector<int> &nums, int l, int r, int k) {
if (l == r)
return nums[k];
int partition = nums[l], i = l - 1, j = r + 1;
while (i < j) {
do i++; while (nums[i] < partition);
do j--; while (nums[j] > partition);
if (i < j)
swap(nums[i], nums[j]);
}
if (k <= j)return quickselect(nums, l, j, k);
else return quickselect(nums, j + 1, r, k);
}
int findKthLargest(vector<int> &nums, int k) {
int n = nums.size();
return quickselect(nums, 0, n - 1, n - k);
}
};
```
]), ( name:[基于堆排序的选择方法],
text:[
我们也可以使用堆排序来解决这个问题——建立一个大根堆,做 k−1 次删除操作后堆顶元素就是我们要找的答案。
],code:[
```cpp
class Solution {
public:
void maxHeapify(vector<int>& a, int i, int heapSize) {
int l = i * 2 + 1, r = i * 2 + 2, largest = i;
if (l < heapSize && a[l] > a[largest]) {
largest = l;
}
if (r < heapSize && a[r] > a[largest]) {
largest = r;
}
if (largest != i) {
swap(a[i], a[largest]);
maxHeapify(a, largest, heapSize);
}
}
void buildMaxHeap(vector<int>& a, int heapSize) {
for (int i = heapSize / 2; i >= 0; --i) {
maxHeapify(a, i, heapSize);
}
}
int findKthLargest(vector<int>& nums, int k) {
int heapSize = nums.size();
buildMaxHeap(nums, heapSize);
for (int i = nums.size() - 1; i >= nums.size() - k + 1; --i) {
swap(nums[0], nums[i]);
--heapSize;
maxHeapify(nums, 0, heapSize);
}
return nums[0];
}
};
```
])
),
gain:none,
) |
|
https://github.com/miestrode/sourcerer | https://raw.githubusercontent.com/miestrode/sourcerer/main/README.md | markdown | MIT License | # Sourcerer
Sourcerer is a Typst package for displaying stylized source code blocks, with some extra features. Main features include:
- Rendering source code with numbering
- Rendering only a range of lines from the source code, keeping the original highlighting of the code (For example, block comments are still rendered well, even if cut)
- Adding in-code line labels which are easily referenceable (via `reference`)
- Considerable customization options for the display of the code block
- Consistent and pretty cutoff between pages
- Displaying the language used for a code block in a readable manner, in-code-block
# Usage
First, import the package via:
```typ
#import "@preview/sourcerer:0.2.1": code
```
Then, display custom code blocks via the `code` function, like so:
````typ
#code(
lang: "Typst",
```typ
Woah, that's pretty #smallcaps(cool)!
That's neat too.
```
)
````
This results in:
<p align="center">
<img src="assets/sourcerer.png" width="750"/>
</p>
To view all of the options of the `code` function, consult the [documentation](DOCS.md).
|
https://github.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game | https://raw.githubusercontent.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game/main/further-statistics-1.typ | typst | #import "template.typ": *
#import "shortcut.typ": *
#let title = "FS1 Topic Questions"
#let author = "<NAME>"
#let course_id = "Further Mathematics"
#let instructor = "<NAME>"
#let school_name = "David Game College"
#let written_time = "Spring 2024"
#show: assignment_class.with(title, author, course_id, instructor, school_name, written_time)
#set enum(numbering: "a)")
#set heading(numbering: "1.1.")
#outline(indent: auto)
#pagebreak(weak: false)
#problem_counter.update(0)
#preface
#topic[Discrete Probability Distributions]
- Calculation of the mean and variance of discrete probability distributions.
- Extension of expected value function to include $E(g(X))$
#prob(
[Edexcel IAL June 2018, S1, Q4],
[
A discrete random variable X has probability function
$ P(X = x) = cases(
k(2 - x) x = 0\, 1,
k(3 - x) x = 2\, 3,
k(x + 1) x = 4,
0 "otherwise",
) $
where $k$ is a constant.
(a) Show that $k = 1 / 9$
#marks(2)
Find the exact value of
(b) $P( 1 <= X < 4 )$
#marks(1)
(c) $E(X)$
#marks(2)
(d) $E(X^2)$
#marks(2)
(e) $"Var"(3X+1)$
#marks(3)
]
)
#prob(
[Edexcel IAL S1, Specimen 2018, Q3],
[
The discrete random variable $X$ has probability distribution
$ P(X = x) = 1 / 5 #h(2cm) x = 1,2,3,4,5 $
(a) Write down the name given to this distribution
#marks(1)
Find
(b) $P(X = 4)$
#marks(1)
(c) $P(X <= 3)$
#marks(1)
(d) $P(3X - 3 > X + 4)$
#marks(2)
(e) $E(X)$
#marks(1)
(f) $E(X^2)$
#marks(2)
(g) Hence find $"Var"(X)$
#marks(2)
Given that $E(a X - 3) = 11.4$
(h) Find $"Var"(a X - 3)$
#marks(4)
]
)
#prob(
[OCR (A) AS Further Stat Y532/01, Nov 2021, Q1],
[
The discrete random variable $A$ has the following probability distribution.
#table(
columns: (80pt, 60pt, 60pt, 60pt, 60pt, 60pt),
[$a$], [1], [2], [5], [10], [20],
[$P(A = a)$], [0.3], [0.1], [0.1], [0.2], [0.3],
)
(a) Find the value of $E(A)$.
#marks(2)
(b) Determine the value of $"Var"(A)$.
#marks(3)
(c) The variable A represents the value in pence of a coin chosen at random from a pile. Mia picks one coin at random from the pile. She then adds, from a different source, another coin of the same value as the one that she has chosen, and one 50p coin.
- (i) Find the mean value of the three coins
#marks(2)
- (ii) Find the variance of the value of the three coins.
#marks(1)
]
)
#prob(
[OCR (MEI) AS Further Stat a Y412, Specimen, Q4],
[
The discrete random variable $X$ has probability distribution defined by
$ P (X = r) = k (2r - 1) "for" r = 1,2,3,4,5,6, "where" k "is a constant" $
(i) Complete the table below giving the probabilities in terms of $k$.
#table(
columns: (80pt, 60pt, 60pt, 60pt, 60pt, 60pt, 60pt),
[$r$], [1], [2], [3], [4], [5], [6],
[$P(X = r)$], [], [], [], [], [], [],
)
#marks(1)
(ii) Show that the value of $k$ is $1 / 36$.
#marks(2)
(iii) Draw a diagram to illustrate the distribution.
#marks(2)
(iv) *In this question you must show detailed reasoning.* Find:
- $E(X)$
- $"Var"(X)$
#marks(5)
A game consists of a player throwing two fair dice. The score is the maximum of the two values showing on the dice.
(v) Show that the probability of a score of 3 is $5/36$.
#marks(2)
(vi) Show that the probability distribution for the score in the game is the same as the probability distribution of the random variable $X$.
#marks(3)
(vii) The game is played three times. Then find:
- the mean of the total of the three scores.
- the variance of the total of the three scores.
#marks(3)
]
)
#topic[Poisson & Binomial Distributions]
- The Poisson distribution and its additive properties
- The mean and variance of the Binomial Distribution and the Poisson distribution
- The use of the Poisson distribution as an approximation to the binomial distribution.
#topic[Geometric and Negative Binomial Distributions]
#a2_all
- Geometric and negative binomial distributions.
- Mean and variance of a geometric distribution with parameter $p$
- Mean and variance of negative binomial distribution with $P(X = x) = mat(x-1; r-1) p^r (1 - p)^(x - r)$
#topic[Hypothesis Testing]
- Extend ideas of hypothesis tests to test for the mean of a Poisson distribution
- #a2 Extend hypothesis testing to test for the parameter p of a geometric distribution.
#prob(
[Edexcel IAL S2, June 2021, Q2],
[
Luis makes and sells rugs. He knows that faults occur randomly in his rugs at a rate of 3 every 4m#sqm.
(a) Find the probability of there being exactly 5 faults in one of his rugs that is 4#sqm in size.
#marks(2)
(b) Find the probability that there are more than 5 faults in one of his rugs that is 6#sqm in size.
#marks(2)
Luis makes a rug that is 4#sqm in size and finds it has exactly 5 faults in it.
(c) Write down the probability that the next rug that Luis makes, which is 4#sqm in size, will have exactly 5 faults. Give a reason for your answer.
#marks(2)
A small rug has dimensions 80 cm by 150 cm. Faults still occur randomly at a rate of 3 every 4#sqm.
Luis makes a profit of £80 on each small rug he sells that contains no faults but a profit of £60 on any small rug he sells that contains faults.
Luis sells $n$ small rugs and expects to make a profit of at least £4000.
(d) Calculate the minimum value of $n$
#marks(4)
Luis wishes to increase the productivity of his business and employs Rhiannon. Faults also occur randomly in Rhiannon's rugs and independently to faults made by Luis. Luis randomly selects 10 small rugs made by Rhiannon and finds 13 faults.
(e) Test, at the 5% level of significance, whether or not there is evidence to support the suggestion that the rate at which faults occur is higher for Rhiannon than for Luis. State your hypotheses clearly.
#marks(5)
]
)
#topic[Central Limit Theorem]
#a2_all
- Applications of the central Limit Theorem to other distributions.
#topic[Chi-Squared Tests]
- Goodness of fit tests and Contingency Tables
- The null and alternative hypotheses.
- The use $sum_(i=1)^(n) ((O_i - E_i)^2)/(E_i)$ as an approximate $chi^2$ statistic.
- Degrees of freedom
#include "fs1/chi-square.typ"
#topic[Probability Generating Functions]
#a2_all
- Definitions, derivations and applications.
- Use of the probability generating function for the negative binomial, geometric, binomial and Poisson distributions.
- Use to find the mean and variance.
- Probability generating function of the sum of independent random variables.
#include "fs1/pgf.typ"
#topic[Quality of Tests]
#a2_all
- Type I and Type II errors.
- Size and Power of Test.
- The power function. |
|
https://github.com/Slyde-R/not-jku-thesis-template | https://raw.githubusercontent.com/Slyde-R/not-jku-thesis-template/main/template/glossary.typ | typst | MIT No Attribution | // this is an example. Check https://typst.app/universe/package/glossarium
#let glossary = (
// minimal term
(key: "jku", short: "Johannes Kepler University"),
// a term with a long form
(key: "goat", short: "GOAT", long: "greatest of all time"),
// no long form here
(key: "kdecom", short: "KDE Community", desc:"An international team developing and distributing Open Source software."),
// a full term with description containing markup
(
key: "oidc",
short: "OIDC",
long: "OpenID Connect",
desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit
#link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].]),
) |
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas6/3_Streda.typ | typst | #let V = (
"HV": (
("","Tridnévno voskrésl jesí","Raspénšusja tí dolhoterpilíve Hóspodi, pokolebál jesí zémľu vsjú, vírnych že utverdív serdcá. Ťímže ťá vospivájem, i ľubóviju poklaňájemsja nepostižímij síľi tvojéj."),
("","","V lanítu zaušén býl jesí Spáse, i opleván, jadovítaho zaušíl jesí vrahá zlóbu, otjémľa padénije, jéže podját Adám, ukráden býv viďínija rádi."),
("","","Sólnce pomračísja, i zemľá vsjá trjasášesja, i kámenije raspadésja, jáko víďiša ťá, Spáse, na drévi povíšena neprávedno, i ostavľájušča choťínija."),
("","Tridnévno voskrésl jesí","Predstojášči u krestá inohdá vo vrémja raspjátija Ďíva, s ďívstvennikom učenikóm, i pláčušči vopijáše: uvý mňí, káko stráždeši Christé, vsích sýj bezstrástije?"),
("","","Začátije tvojé bezsímennoje, i roždestvó prečístoje pomyšľájušči, udivľájusja ziló: káko síce jáko zloďíj, bláhovolíl jesí umréti Spáse? prečístaja vzyváše."),
("","","Raspinájusja úbo na drévi, i prihvoždájusja jáko čelovík, i vo hróbi polahájusja jáko mértv, Máti čístaja Ďívo: jáko Bóh že, vo slávi páki voskrésnú tridnéven."),
("Krestobohoródičen","","Ľúdi bezzakónňijšyja, bez právdy prihvoždájuščja ťá na drévi, Ďíva, i čístaja Máti tvojá zrjášči, jákože Simeón prorečé, utróboju Spáse, ujazvľášesja."),
),
"S": (
("","","Krest tvój Hóspodi, žízň i zastuplénije ľúdem tvojím jésť, i náň naďíjuščesja, tebé raspénšahosja plótiju, Bóha nášeho pojém, pomíluj nás."),
("","","Krest tvój Hóspodi, ráj otvérze ródu čelovíčeskomu, i ot istľínija izbávľšesja, tebé raspénšahosja plótiju Bóha nášeho pojém, pomíluj nás."),
("Múčeničen","","Stradávšiji tebé rádi Christé, mnóhija múki preterpíša, i soveršénnyja vosprijáša vincý na nebesích: da móľatsja o dušách nášich."),
("Krestobohoródičen","","Na drévi živót náš zrjášči vseneporóčnaja Bohoródice vísjašč, máterski rydájušči vopijáše: Sýne mój, i Bóže mój, spasí ľubóviju pojúščyja ťá."),
),
)
#let P = (
"1": (
("","","Jáko po súchu pišešéstvovav Izráiľ, po bézdňi stopámi, honíteľa faraóna víďa potopľájema, Bóhu pobídnuju písň poím, vopijáše."),
("","","Vsjáko mojehó rydáju žitijá skvérnaho, i mnóžestva bezmírnych mí zól: čtó že ispovím tí čístaja? Nedoumíju i užasájusja: no pomozí mi Vladýčice."),
("","","Otkúdu načnú hlahólati lukávaja i ľútaja mojá padénija, strástnyj áz? Uvý mňí, čtó búdu próčeje? No Vladýčice, préžde koncá uščédri mjá."),
("","","Smértnyj úbo čás, i sudíšče strášnoje vsehdá pomyšľáju prečístaja, obýčajem že vsezlým preľščájusja ľúťi: no pomozí mi."),
("","","Blahích tlíteľ smotrjája mjá nýňi náha božéstvennych dobroďítelej, i daléče otstúpľša i otčuždéna ot Bóha, pohlotíti mjá ustremľájetsja: Vladýčice, predvarí."),
),
"3": (
("","","Ňísť svját, jákože tý Hóspodi Bóže mój, voznesýj róh vírnych tvojích bláže, i utverdívyj nás na kámeni ispovídanija tvojehó."),
("","","Dúšu okaľách skvérno ot bezmírnych zól mojích strástnyj áz, Bohoródice Vladýčice: i kámo próčeje pojdú, otčájanijem vés oderžím?"),
("","","I jéže po óbrazu sebé okaľách blúdnaho, uvý mňí čístaja, vysokomúdrennoju vóleju: po podóbiju bo i ďílom, i slóvom, i pómyslom soďíjach bezmístnaja."),
("","","Ňísť ín v čelovícich, íže nepodóbnaja soďíjav, ni rodísja v míri, jákože áz, blahája, pomračén umóm: nébo kreščénije božéstvennoje oskverních."),
("","","Na konéc dostihóch zlých, presvjatája Ďívo, tý pomozí mi vskóri: Nébo i zemľá vopijút hórci, ot bezmístnych ďijánij nepodóbnych."),
),
"4": (
("","","Christós mojá síla, Bóh i Hospóď, čestnája cérkov Bohoľípno pojét vzyvájušči, ot smýsla čísta o Hóspoďi prázdnujušči."),
("","","Ánheľstiji čínove, i vójinstva nebésnych síl tvojehó Sýna užasájutsja deržávy, čístaja: nýňi že áz otčájavsja, bezstrášijem oderžím jésm."),
("","","Udivísja vsjá zemľá i užasésja, zrjášči ľútaja, i zlája tvorjášču mí, i bezmístnaja: i tvojehó Sýna mnóhomu milosérdiju čudítsja."),
("","","Cérkov oskverních zľí ťilésnuju, i cérkov Hospódňu, v ňúže čelovícy trepéščušče vchóďat: áz že blúdnyj bez studá vchoždú, uvý mňí!"),
("","","Ne javí Vladýčice, ne javí stránna mjá ustránšasja króva Sýna tvojehó, vsjáko nedostójnaho: no omýj mené ot skvérny prehrišénij mojích."),
),
"5": (
("","","Bóžijim svítom tvojím bláže, útreňujuščich tí dúšy ľubóviju ozarí moľúsja, ťá víďiti Slóve Bóžij, ístinnaho Bóha, ot mráka hrichóvnaho vzyvájušča."),
("","","Božéstvennym sijánijem tvojím blahája, iscilí dušévnyja mojá strásti, jáže mí tlíteľ vséja, i izbávi mjá sehó pľinénija hórkaho: smijétsja bo zrjá mené bez zastuplénija."),
("","","Adám prestupí úbo zápoviď jedínu Sýna tvojehó Ďívo, i vo izhnánije vpadé: káko že rydáju prehrišénij mojích bézdnu, áz prestúpnyj, i otstúpnik jehó?"),
("","","Ubíjca úbo jávľsja drévle, i bratoubíjca Káin, Bohom prokľát býsť: čtó že sotvorjú áz vsedérzyj, dúšu úbo ubív nýňi, i ne styždúsja?"),
("","","Isávu porevnovách ľútomu, črevoobjadénijem, i sýtostiju vés. Dúšu oskverních pijánstvom, i laskosérdstvom žitijé mojé, i któ mené ne pláčet strástnaho? uvý mňí!"),
),
"6": (
("","","Žitéjskoje móre vozdvizájemoje zrjá napástej búreju, k tíchomu pristánišču tvojemú priték, vopijú ti: vozvedí ot tlí živót mój, mnohomílostive."),
("","","Žitijé mojé blúdno, dušá mojá skvernáva, i živót vés okajánen, ťílo že mojé vsé vo zlých ľúťi okaľách. Ťímže potščísja Ďívo, pomoščí mi."),
("","","Konéc predstá, i ne terpľú blahája, sóvisť obličájet mjá: predstoját vo mí ďijánija lukávaja, i žitijá blúdnoje: i sudíšča užasájusja Sýna tvojehó, čístaja."),
("","","Plóti mojejá razžžénije, riká óhnennaja strášna i neuhasíma ždét voístinnu, i čérv neusypájaj: no uhasí mi sijá molítvami tvojími, prečístaja."),
("","","Nýňi trépetom oderžím jésm blahája, i užasájusja lukávaho lovlénija. Préžde bo koncá chóščet mjá tlíteľ ubíti, deržjá mja jáko pľinéna vsehó, i náha dobroďítelej."),
),
"S": (
("","","Upovánije i sťiná, i pristánišče ľúdem tvojím Ďívo, iz nejáže rodísja bezstrástno Spás vsjáčeskich, i spasé upovájuščyja na ťá, jákože pláčasja tvojehó Sýna pri kresťí, tohó i nýňi molí izbáviti ot tlí vsjá pojúščyja ťá."),
),
"7": (
("","","Rosodáteľnu úbo péšč soďíla ánhel, prepodóbnym otrokóm, chaldéi že opaľájuščeje veľínije Bóžije, mučíteľa uviščá vopíti: blahoslovén jesí Bóže otéc nášich."),
("","","Sédm sedmíceju plámeň razžžé mi strasťmí lukávyj, i ľuboďijáňmi sérdce mojé vsehdá umerščvľájet: ťímže tókami mojích sléz uhasí jehó, Máti Bóžija, i spasí mja."),
("","","Okaľájema tínoju prehrišénij mojích, ne otríni mené, Vladýčice blahája: íbo zrjá mja vo otčájaniji súšča, smijétsja prelukávyj vráh: no samá tvojéju deržávnoju rukóju vozstávi."),
("","","Strášnoje úbo sudíšče, strástnaja dušé mojá i nečúvstvennaja, i mučénije že nekončájemoje i hróznoje: no obáče nýňi pripadí k Máteri Sudijí tvojehó i Bóha, ne otčájsja samá"),
("","","Omračíchsja strástnyj mnóžestvom bezmírnych zól, i oskverních dúšu i ťílo že i úm: ťímže prečístaja, svítom tvojích sijánij, k bezstrástiju sládosti skóro vvedí mja."),
),
"8": (
("","","Iz plámene prepodóbnym rósu istočíl jesí, i právednaho žértvu vodóju popalíl jesí: vsjá bo tvoríši Christé, tókmo jéže choťíti. Ťá prevoznósim vo vsjá víki."),
("","","Jáže ot Tróicy jedínaho Bóha róždšaja, i na rukú nosívšaja, Ďívo Máti, uhasí strastéj ohnepáľnuju péšč, i sléznymi tóki omýj dúšu mojú."),
("","","Prichóda smértnaho užasájusja prečístaja, i sudá ónaho vés nýňi ubojáchsja, ďíja že zlája, nikákože styždúsja: uščédri mjá préžde koncá molítvami tvojími, Ďívo."),
("","","Stenánija nemólčnaja Vladýčice, dáruj mí, i sléz túči dážď, da otmýju mojá prehrišénija mnóhaja, i neiscíľnyja jázvy: jáko da ulučú žízň víčnuju."),
("","","Zól mojích mnóžestvo tebí ispovídach, Vladýčice, jáko nijedín v míri ín prohňíva táko Bóha, Sýna i Hóspoda tvojehó: sehó mi na mílosť vskóri preminí Ďívo."),
),
"9": (
("","","Bóha čelovíkom ne vozmóžno víďiti, na nehóže ne smíjut číni ánheľstiji vziráti: tobóju že, vsečístaja, javísja čelovíkom Slóvo voploščénno, jehóže veličájušče, s nebésnymi vóji, ťá ublažájem."),
("","","Sé prichoždú tí, prečístaja, so stráchom mnóhim i ľubóviju, kríposť vídyj mnóhija molítvy tvojejá ráb tvój: mnóho bo móžet voístinnu Vladýčice, moľbá máterňa k Sýnu: milosérdijem bo prekloňájetsja."),
("","","Líki prijimí archánhel že, i mnóžestvo výšnich vójinstv ziždíteľa mojehó: apóstol že i prorók sobóry, i múčeniki, i prepodóbnyja, i svjáščennomúčeniki: i molítvu sotvorí čístaja, za nás k Bóhu."),
("","","I nýňi i tohdá tvojú pómošč da obrjášču čístaja, v čás, vóňže izýdet dúch mój, vskóri izymájušči, izbávi mjá bisóvskaho mučítelstva, preneporóčnaja, i ne ostávi mené blahája, prédanu býti ím."),
("","","Sudijí ščédraho čáju, i čelovikoľubívaho tvojehó Sýna, čístaja ne prézri mené: no tohó mi sotvorí blahopremínna, postáviti mené odesnúju tohdá vseneporóčnaja, prečístomu sudíšču jehó, na ťá bo upovách."),
),
)
#let U = (
"S1": (
("","","Krest tvój Hóspodi, osvjatísja: ťím bo byvájut iscilénija nemoščstvújuščym hrichmí: sehó rádi tebí pripádajem, pomíluj nás."),
("","","Tókmo vodruzísja drévo, Christé, krestá tvojehó, osnovánija pokolebášasja smérti Hóspodi: jehóže bo požré ľubóviju ád, otpustí trepéščja, pokazál jesí nám spasénije tvojé svjatýj: i slavoslóvim ťá, Sýne Bóžij, pomíluj nás."),
("Krestobohoródičen","","Nadéžde i zastuplénije i pristánišče ľudéj tvojích Ďívo, iz tebé bo rodísja voístinnu míru spasénije. Jákože plákasja u krestá tvojehó Sýna i Bóha, i spasáješi upovájuščich na ťá: tohó nýňi umolí, izbáviti ot tlí vsích vospivájuščich ťá."),
),
"S2": (
("","","Dnés proróčeskoje ispólnisja slóvo: sé bo poklaňájemsja na mísťi, iďíže stojásťi nózi tvojí, Hóspodi: i dréva spasénija vkusívše, ot hrichóvnych strastéj svobódu ulučíchom, molítvami Bohoródicy, jedíne čelovikoľúbče."),
("","","Hóspodi, osudíša ťá Judéji na smérť, žízň vsích: íže čermnóje móre žezlóm prošédšiji, ko krestú ťa prihvozdíša: i ot kámene méd ssávšiji, žélč tebí prinesóša. No vóleju preterpíl jesí, da nás svobodíši ot rabóty vrážija: Christé Bóže náš, sláva tebí."),
("","","Stradáľčeskaja soprotivlénija na sudíšči, mučíteľskija rány na múčenicich, i stojáchu lícy bezplótnych, póčesti deržášče pobídy, udivíša mučíteli i carí, premúdriji, nizložíša prestúpnika ispovídanijem Christóvym: ukripívyj ích Hóspodi, sláva tebí."),
("Krestobohoródičen","","Predstojášči u krestá neiskusobráčnaja Máti, íže iz tebé róždšemusja bez símene, vopijáše: orúžije sérdce mojé prójde, o Sýne, ne terpjášči vísima na drévi ťá zríti, jehóže trepéščut vsjáčeskaja, jáko sozdáteľa i Bóha: dolhoterpilíve Hóspodi, sláva tebí."),
),
"S3": (
("","Vsjú otložívše","Na kresťí ťa vóleju nás rádi prihvoždéna Christé, tvár víďivši, kolebášesja stráchom, sólnce vés pomračí svít, kámenije raspadésja, i cérkvi božéstvennaja zavísa razdrásja, na obličénije ľútych i bezzakónnych jevréj."),
("","","Drévo prinesé tľínije vo Jedémi rodonačáľniku: krestnoje že drévo žízň procvité na lóbňim mísťi: íbo poprána býsť zlóba vrážija: pomílovan že býsť prihvoždénijem Christóvym, i obríte ráj, vopijá Adám: o drévo blahoslovénnoje!"),
("Krestobohoródičen","","Tebé róždšaja Christé, prisnoďíva otrokovíca, na kresťí zrjášči ťá nás rádi vozneséna, ujazvľáše svojé pečáli orúžijem sérdce i dúšu, i plákaše rydájušči máterski: tojá molítvami pomíluj nás."),
),
"K": (
"P1": (
"1": (
("","","Jáko po súchu pišešéstvovav Izráiľ, po bézdňi stopámi, honíteľa faraóna víďa potopľájema, Bóhu pobídnuju písň poím, vopijáše."),
("","","Tý dláni prostér na kresťí, objál jesí Vladýko, otrinovénnyja čelovíki, i k tvojemú privél jesí Otcú: jáko Sýn vozľúblen i jedinosúščen."),
("","","Jákože áhnec vozdvížen býl jesí na krest Slóve, tvojehó ovčáte iščjá zablúždšaho: i obrít sočetál jesí tó k nezablúždšym, Iisúse: sláva deržávi tvojéj."),
("Múčeničen","","Žízni výšnija želájušče, blahoslávniji strástotérpcy múčenicy, umertvíšasja na zemlí, preterpívše mučénija mnóhaja i razlíčnyja napásti, dostoblážénniji."),
("Múčeničen","","Na sudíščach neprávednych za Christá vsích právednaho predstávše stradáľcy, súd vsják neprávednyj vás opravdájušč, o Bózi preterpíli jesté."),
("Bohoródičen","","Da bezstrástije vsím, íže iz Adáma, ischodátajstvuješi Vladýko, strásť terpíši na kresťí: i zrjášči ťá zemľá trjasášesja, rydájušči Máterski vopijáše, Vladýčice."),
),
"2": (
("","","Jáko po súchu pišešéstvovav Izráiľ, po bézdňi stopámi, honíteľa faraóna víďa potopľájema, Bóhu pobídnuju písň poím, vopijáše."),
("","","Tebé vsesvjatája Ďívo nébo prostrýj Hospóď, i zémľu osnovávyj, iz tebé prošéd s plótiju, nébo zemnóje nám pokazál jésť."),
("","","Jáže Bóha začénšaja, nás rádi bývšaho čelovíka, tohó molí čístaja, v déň súdnyj nás uščédriti mnóho sohrišívšyja jemú."),
("","","Svitľíjšimi lučámi vozsijávšeje sólnce ot svjatáho tvojehó čréva, vsjú zémľu ozarjájet Vladýčice, ťímže prosvíščšesja, ťá Bóžiju Máter čtím."),
("","","Omračénija duší mojejá bezmístnych pomyšlénij mhlú razruší, navedéňmi Bohoródice Vladýčice, svítom svjatých zápovidej voplóščšahosja iz tebé."),
),
),
"P3": (
"1": (
("","","Ňísť svját, jákože tý Hóspodi Bóže mój, voznesýj róh vírnych tvojích bláže, i utverdívyj nás na kámeni ispovídanija tvojehó."),
("","","krest vodružášesja na zemlí, i nizpadáše lésť, i tvár kolebášesja, i serdcá koléblemaja vrážijimi napásťmi, utverždénije víroju prijimáchu."),
("","","Bisívšesja neprávedniji ľúdije, tebé právednaho jedínaho osudíša na smérť, opravdájušča zemnýja, i ot neprávednyja rukí ľstívaho sích izimájušča."),
("Múčeničen","","Podvizáše vsjú svojú zlóbu ľstívyj, so svjatými borjásja: no pobiždášesja, zrjá nepokóršichsja ťích, i božéstvennyja svítlosti óbščnikov."),
("Múčeničen","","Ťilésnaja krasotá zíľnymi izmiňášesja ránami, no oblistaváše páče svítlosť dušévnaja strastotérpec Christóvych, ďíjstvom svjatáho Dúcha."),
("Bohoródičen","","Krásna dobrótoju ťá Sýne, páče vsích čelovík, vnehdá raždáti mí razumích: i káko raspinájem nýňi, dobróty ne ímaši Christé, Ďívo hlahólaše slezjášči."),
),
"2": (
("","","Ňísť svját, jákože tý Hóspodi Bóže mój, voznesýj róh vírnych tvojích bláže, i utverdívyj nás na kámeni ispovídanija tvojehó."),
("","","Rukóju deržášči Christá soderžáščaho vsjá, ot rukí lukávaho dijávola, i vsjákaho vreždénija izbávi nás Bohorodíteľnice čístaja, pojúščich ťá."),
("","","Bisóvskaho smuščénija izbávi nás Ďívo, i čelovík neprávednych, i vsjákich iskušénij, i nedúh tletvórnych tvojími molítvami, Vladýčice vseneporóčnaja."),
("","","Sé tebé vsí ródove blážát otrokovíce, bezľítnoje Slóvo v plóti pod ľíty róždši prejestéstvenno, i dvojú páki prebývši."),
("","","Jáže čelovikoľúbca Bóha róždšaja Ďívo, nepotrébnaho mjá tvojehó rabá, v čás strášnaho prišéstvija jehó, izbávi vsjákaho osuždénija."),
),
),
"P4": (
"1": (
("","","Christós mojá síla, Bóh i Hospóď, čestnája cérkov Bohoľípno pojét vzyvájušči, ot smýsla čísta, o Hóspoďi prázdnujušči."),
("","","Raspjáta na drévi ťá sólnce nezachodímoje Christé, zrjá sólnce pomračášesja stráchom, i témnyja prélesti otpuščéna byváše vsjá tvár, vospivájuščaja ťá."),
("","","Vjazáchu rúci tvojí, Spáse, ľúdije zakonoprestúpniji, i svjázanniji nerišímych úz vsí otpuščájemi byváchu: i svjázan byváše vráh, i lésť razrušášesja."),
("Múčeničen","","Tečénijem krovéj potopíste múčenicy faraóna honíteľa, umovrédno bezmírno chváľaščasja: i k zemlí blahój veseľáščesja preidóste."),
("Múčeničen","","Krilámi Dúcha preleťívše síti vrážija stradáľcy, rádujuščesja vostekóste, iďíže pérvaja bláhosť, i žízň, i svít nevečérnij."),
("Bohoródičen","","Orúžijem ujazvílasja jesí strastéj Vladýčice. iz tebé voplotívšahosja, jehdá tohó víďila jesí raspinájema, i kopijém v prečístaja rébra nás rádi probodájema."),
),
"2": (
("","","Christós mojá síla, Bóh i Hospóď, čestnája cérkov Bohoľípno pojét vzyvájušči, ot smýsla čísta, o Hóspoďi prázdnujušči."),
("","","Chrám Bóžij vospojím svjatúju Ďívu, svítlo vsí blažášče, obožívšesja jejá rádi, i ľútych izbávľšesja."),
("","","Jáko dvér vedúščuju k božéstvennomu vchódu, jáko ráj božéstvennyj, jáko mýslenno místo svjaščénija, jáko dobrótu Jákovľu, Ďívu ublažájem."),
("","","Pristánišče blahoutíšnoje ťá pokazá Christós, Vladýčice vseneporóčnaja, víroju i ľubóviju ot mýsli čísty prizyvájuščym tebé Bohoródicu ístinnuju."),
("","","Maríje prečístaja, čisťíjšeje bylá jesí prijátelišče prostránnoje božéstvennaho vselénija, dušévnuju mojú skvérnu i kál potrebí."),
),
),
"P5": (
"1": (
("","","Bóžijim svítom tvojím bláže, útreňujuščich tí dúšy ľubóviju ozarí moľúsja, ťá víďiti Slóve Bóžij, ístinnaho Bóha, ot mráka hrichóvnaho vzyvájušča."),
("","","Oblačájaj nébo óblaki Christé, na kresťí náh prihvozdílsja jesí vóleju, nahotú zlóby mojejá prioďivájaj, i v rízy netľínija oblék prosviščája Vladýko."),
("","","Na kresťí ráspjat býsť ístinnyj vinohrád Christós, jáko voístinnu sýj sládosť dušám nášym, mstó iskápaja, prélesti vsjákoje pijánstvo boríteľa potrebľája."),
("Múčeničen","","Ispeščrénniji svjaščénnymi jázvami Christóvy stradáľcy, i vincý ukrašájemiji, plótiju postradávšemu Bóhu predstojášče, nášich prehrišénij razrišénije prósjat."),
("Múčeničen","","Vzirájušče strastotérpcy k támošňij slávi, i žízni, i ístinnomu veséliju, vsjáko trevolnénije ľútych podjáste, strástiju vladýčneju ukripľájemi."),
("Bohoródičen","","Vo črévo vmistívšaja ťá Christé, jedínaho nevmistímaho vsími, boľíznej kromí porodích: nýňi že boľíznuju, raspinájemu tí Christé, prečístaja Ďíva pláčušči hlahólaše."),
),
"2": (
("","","Bóžijim svítom tvojím bláže, útreňujuščich tí dúšy ľubóviju ozarí moľúsja, ťá víďiti Slóve Bóžij, ístinnaho Bóha, ot mráka hrichóvnaho vzyvájušča."),
("","","Íže slóvom vsjá sozdávyj, i múdrym prómyslom Hospóď okormľája jedín, jákože chóščet, blahoutróbijem sozdavájetsja iz tebé prečístaja, i plóť neskazánno byvájet."),
("","","Sé Ďívo, proróčeski začát vo utróbi nad vsími Bóha Vladýku i Hóspoda, i neizrečénno tohó čístaja rodilá jesí, i po roždeství Ďívo netľínna prebývši."),
("","","Maríje, Vladýčice vsích, izbávi mjá jáko mílostiva, strášnaho pľinénija, moľúsja: i hrichá mojehó rukopisánije razderí, kopijém voplóščšahosja iz tebé."),
("","","Hrichá mojehó plenícu, tvojím chodátajstvom i predstáteľstvom Ďívo, rastórhni: otčájannym bo tý jesí nadéžda, víroju pritekájuščym k božéstvennomu pokróvu tvojemú."),
),
),
"P6": (
"1": (
("","","Žitéjskoje móre, vozdvizájemoje zrjá napástej búreju, k tíchomu pristánišču tvojemú priték vopijú ti: vozvedí ot tlí živót mój mnohomílostive."),
("","","Vinčálsja jesí dolhoterpilíve, térnijem, posikája strastéj térnije: kopijém v rébra probodén býv, umertvíl jesí zmíja mnohokóznennaho, nás mértvy soďílavšaho."),
("","","Na krest vozdvížen býl jesí, nizlahája vrážiju sílu Vladýko: rabóty že hórkija mené svoboždája, priját zaušénije: poklaňájusja tvojemú, ščédre, dolhoterpíniju."),
("Múčeničen","","Krestóm ohraždájemi stradáľcy, prélesti sťíny lukávyja razverhóša, i k výšnemu hrádu preselíšasja, pobídnymi vincý ukrášeni. Ťímže ublažájemi súť."),
("Múčeničen","","Na vysotú preslávno mučénija sámi sebé vozvédše svjatíji, lukávaja voznošénija vrážija na zémľu nizverhóste, i vincý svýše prijáste."),
("Bohoródičen","","Ótčeje sijánije, káko vozdvížesja na krést, prosviščája vsjáčeskaja, i nizlahája ťmý načáľnika? Prečístaja Vladýčica Máterski pláčušči viščáše."),
),
"2": (
("","","Žitéjskoje móre, vozdvizájemoje zrjá napástej búreju, k tíchomu pristánišču tvojemú priték vopijú ti: vozvedí ot tlí živót mój mnohomílostive."),
("","","Ne opalívši utróbu tvojú, óhň sýj Iisús, iz tebé plótiju prošéd: tohó čístaja, molí, ohňá i vsjákija múki izbávitisja víroju vospivájuščym ťá."),
("","","Svjatých ánhel ťá blahoľípije vospiváju vseneporóčnaja, i moľú: neľípotnaja potrebí ot mené bisóvskaja mečtánija, v tišiňí sobľudájušči sérdce mojé."),
("","","Plótnym voobražénijem sojedinívsja, íže ot Otcá jedinoródnyj, vo utróbi tvojéj jedín ot dvojú, bez símene prójde, i sobľudé nevreždénno čestnóje Ďívstvo tvojé vseneporóčnaja."),
("","","Mnóžestvo očísti mojích hrichóv, mnóžestvom mílosti tvojejá, i spasí mja rabá tvojehó blahája, k tebí pribihájuščaho, i moľáščasja vírno mílosti tvojéj."),
),
),
"P7": (
"1": (
("","","Rosodáteľnu úbo péšč soďíla ánhel, prepodóbnym otrokóm, chaldéji že opaľájuščeje veľínije Bóžije, mučíteľa uviščá vopíti: blahoslovén jesí Bóže otéc nášich."),
("","","Jadovítuju zaušíl jesí zmíja zlóbu, zaušén býv, povíšen na dréve jedíne síľne, vsích prosvitíl jesí vopíti: blahoslovén jesí Bóže otéc nášich."),
("","","Ot dréva vkúš Adám pérvyj čelovík, obríte smérť: vtorýj že na ném Christós, umertvívsja, bezsmértnuju žízň dárujet, umertvív vrahá mnohokóznennaho."),
("Múčeničen","","Terpjášče strásť múčenicy, mučénijem Hóspodevi vozvedóstesja, i na kámeni stáste tvérďim víry, vsjáku lukávuju nizlahájušče zlóbu vrážiju božéstvennym manovénijem."),
("Múčeničen","","Prosvitívšesja stradáňmi, stradáľcy oblistájete sólnca svitľíjše, i ťmý vlásti vsjá razrušíste, pojúšče Christóvi: blahoslovén Bóh otéc nášich."),
("Bohoródičen","","Íže sýj neizmínen Božestvóm, izminíl jesí povíšen na kresťí tvár vsjú, Ďíva hlahólaše Sýnu: i zrjášči sijá plákaše, divjáščisja mnóhomu tvojemú dolhoterpíniju."),
),
"2": (
("","","Rosodáteľnu úbo péšč soďíla ánhel, prepodóbnym otrokóm, chaldéji že opaľájuščeje veľínije Bóžije, mučíteľa uviščá vopíti: blahoslovén jesí Bóže otéc nášich."),
("","","Siďáj v ňídrich rodíteľa neopísannyj, nýňi sidít opísan prečístaja, v ňídrich tvojích tvojím obložén zrákom, za jéže spastí Adáma nóv Adám býv."),
("","","Moľášči ne prestáj čelovikoľúbca Bóha nášeho, vseneporóčnaja, jáko da priímem vsekonéčnoje proščénije zlých. I ulučím jáže na nebesích uhotóvannaja blahája ľúbjaščym jehó."),
("","","Blahoslovím ťá, preneporóčnaja, róždšuju blahoslovénnaho Hóspoda, blahoslovéňmi vinčájuščaho božéstvennymi jestestvó čelovíčeskoje, i nóvo tvorjášča tó obetšávšeje préžde."),
("","","Spasénija tvojehó pristániščem obohatívšesja čístaja, ot búri spasájemsja: i nadéždu jáže na ťá jáko kríposť duší soderžášče, zovém: blahoslovénnaja jáže Bóha plótiju róždši."),
),
),
"P8": (
"1": (
("","","Iz plámene prepodóbnym rósu istočíl jesí i právednaho žértvu vodóju popalíl jesí: vsjá bo tvoríši Christé, tókmo jéže choťíti. Ťá prevoznósim vo vsjá víki."),
("","","Prehórdaho zmíja tý smiríl jesí výšnij Bóže, smirénijem sérdca voznosím na drévo, i Adáma strasťmí smirénnaho voznésl jesí, ščédre."),
("","","Drévňuju hóresť pretvorjájaj na drévo voznesén býl jesí, žélč vkušája, vsích sládoste i žízň jedinoipostásnaja sýj Vladýko, i svít i spasénije."),
("Múčeničen","","Ne prekloníste koľín istukánnym vsechváľniji, no požérti býste jáko áhncy neporóčniji: i lukávaho kríposť prekloníste, pisnoslóvjašče Christá vo víki."),
("Múčeničen","","Ch<NAME>cha živáho javístesja múčenicy, chrámy ídoľskija nizložíste, i k chrámu nebésnomu vzjáti býste, pisnoslóvjašče Christá vo víki."),
("Bohoródičen","","Jákov ťá predvíďi Ďívo, ľístvicu, k nebésňij vysoťí nás vozvoďáščuju, vo hlubinú zlých popólzšichsja: ťímže čístuju ťá blahoslovím vo víki."),
),
"2": (
("","","Iz plámene prepodóbnym rósu istočíl jesí i právednaho žértvu vodóju popalíl jesí: vsjá bo tvoríši Christé, tókmo jéže choťíti. Ťá prevoznósim vo vsjá víki."),
("","","Voístinnu Bohoródicu ispovídujem ťá: so ánhelom, jéže rádujsja, vírno vopijém tí: jedína bo súščym na zemlí rádosť rodilá jesí, obrádovannaja čístaja, i blahoslovénnaja."),
("","","Bohoviščánnaja civníca tvojehó práotca, kovčéh ťá presvját predvoobražáše, nosjášču Bóha vo plóti vseneporóčnaja: jehóže prevoznósim Hóspoda vo víki."),
("","","Neiskusobráčnaja otrokovíce Bohorádovannaja, i pristánišče súščym v búri christijánom, i upovánije, izbávi ot napástej, i strastéj i ozloblénija, i ot víčnaho ohňá rabý tvojá."),
("","","Jehdá priídeši vo slávi sudíti vsjáčeskim, desným mjá ovcám pričtí Vladýko hríšnaho, Mátere tvojejá moľbámi: da ťá slávľu vo vsjá víki."),
),
),
"P9": (
"1": (
("","","Bóha čelovíkom ne vozmóžno víďiti, na nehóže ne smíjut číni ánheľstiji vziráti: tobóju že vsečístaja, javísja čelovíkom Slóvo voploščénno, jehóže veličájušče, s nebésnymi vóji, ťá ublážájem."),
("","","Vremenóm i ľítom sýj Hospóď, posreďí zemlí v polúdne na drévo voznéslsja jesí, raspinájem jedíne dolhoterpilíve, i posreďí rajá preterpívšaho popolznovénije, plód tletvórnyj ispravľája."),
("","","Krest vodružášesja, i mučíteľ v duší smértnuju jázvu prijimáše, i svjázanniji ot tlí otrišájemi byváchu: rázum že vo vsjá čelovíki vsaždášesja, vráh upražňášesja, i rádosti vsjá ispolňáchusja."),
("Múčeničen","","Zemľá sovokupísja, Hospódni múčenicy, s nebesý otnéľiže Christós požrésja, raspinájem: i váše mnóžestvo privlečé, mnóžestvo zíľnych múk preterpívšyja, i mnóžestvu božéstvennych slúh sooblistávšyja."),
("Múčeničen","","Svítom neveščéstvennym oblistájemi, položénijem bózi býste Hospódni múčenicy, v pervoródnych selénijich vodvorjájemi, i víčnyja slávy ispolňájemi: ťímže po dólhu vírniji vás počitájem."),
("Bohoródičen","","Strášno roždestvó preterpích Vladýko, vnehdá stránno tebé rodích dolhoterpilíve, jehóže tvár raspinájema na drévi vóleju, zrjášči ustrašísja, drévle neporóčnaja plákaše vopijúšči Máterski, júže veličájem."),
),
"2": (
("","","Bóha čelovíkom ne vozmóžno víďiti, na nehóže ne smíjut číni ánheľstiji vziráti: tobóju že vsečístaja, javísja čelovíkom Slóvo voploščénno, jehóže veličájušče, s nebésnymi vóji, ťá ublážájem."),
("","","Sýn Slóvo Bóžije beznačáľnoje voplóščsja, Sýn Ďívyja byvájet: blahovolénijem že Otcá i Dúcha božéstvennaho ďíjstvom, vés obnoví istľívšij mój zrák jáko vsesílen."),
("","","Dušé vozníkni, i bódrstvuj k molítvam, i ko vsím blahím: priležánijem ľínosť sónnuju otvérži, bódruju imúšči chraníteľnicu vsehdá, čístuju Máter Bóžiju, júže veličájem."),
("","","Upovánije i pokróv, i rádovanije, tý vírnym jesí Bohoródice vseneporóčnaja. Sehó rádi moľúsja tvojím ščedrótam: prosvití dúšu mojú, júže omračí ťmá mnóhich hrichóv, i lukávych pomyšlénij."),
("","","Svjatája Ďívo Bohorádovannaja, dvéri svíta otvérzi mí, nóšč hrichá da mjá ne pokrýjet: isprávi žízň mojú, k pristánišču blahoutíšnomu božéstvennych poveľínij iz tebé vočelovíčivšahosja."),
),
),
),
"CH": (
("","","O kresťí upovánije imíju Christé, i o ném chvaľásja vopijú: čelovikoľúbče Hóspodi, hordýňu nizloží, ne ispovídajuščich tebé Bóha i čelovíka."),
("","","Íže krestóm ohraždájemi, vrahú protivľájemsja, ne bojáščesja kóznej jehó i lájanija: jáko bo hórdyj uprazdnísja, i poprán býsť síloju na drévi prihvoždénnaho Christá."),
("","","Pámjať múčenik, rádosť bojáščymsja Hóspoda: postradávše bo Christá rádi vincý ot nehó prijáša: i nýňi so derznovénijem móľatsja o dušách nášich."),
("Krestobohoródičen","Vsjú otložívše","Áhnca svojehó, áhnica neskvérnaja drévle i neporóčnaja Vladýčica, na drévi krestňim jáko uzrí Máterski vosklicáše, i divjáščisja vopijáše: čádo sladčájšeje, čtó zrínije sijé nóvoje i preslávnoje? Káko sónm bezblahodátnyj sudíšču Pilátovu predadé ťa, i osuždájet na smérť životá vsjáčeskich? No vospiváju tvojé neizrečénnoje Slóve, snizchoždénije."),
),
)
#let L = (
"B": (
("","","Pomjaní mja Bóže spáse mój, jehdá priídeši vo cárstviji tvojém: i spasí mja jáko jedín čelovikoľúbec."),
("","","Vóleju voznéslsja jesí na drévi, vo hlubinú zól popólzšichsja prizvál jesí jedíne mnohomílostive."),
("","","Zemľá potrjasésja, i sólnce uhasé, víďašče ťá na drévi Sólnca právednaho, vóleju stráždušča."),
("Múčeničen","","Strástém Spásovym strastotérpcy priobščájuščesja, i božéstvennyja svítlosti sopričaščájetesja, pričástijem obožájemi."),
("","","Voznesí mja iz hlubiný hrichóvnyja Christé mój, íže ot Tróicy jedínyj vóleju preterpívyj raspjátije."),
("","","Predstojášči u krestá Ďívo Máti, i zrjášči Sýna vóleju stráždušča, tohó veličáše."),
),
)
|
|
https://github.com/SillyFreak/typst-prequery | https://raw.githubusercontent.com/SillyFreak/typst-prequery/main/src/lib.typ | typst | MIT License | /// A boolean state indicating whether the document should display fallback content for elements
/// requiring results from preprocessing. For example, when using prequery images, compiling the
/// document before download the files during preprocessing will fail. If all prequeries used in the
/// document work even before preprocessing, it is not necessary to turn fallback mode on.
///
/// When editing the document and adding images (or other preprocessed content), it is convenient to
/// temporarily add a line at the top to switch fallback mode on:
///
/// ```typ
/// #fallback.update(true)
/// ```
///
/// When querying the document for preprocessing, this can be activated using `--input`:
///
/// ```sh
/// typst query --input prequery-fallback=true ...
/// ```
///
/// -> state
#let fallback = state("prequery-fallback", {
import "utils.typ": boolean-input
boolean-input("prequery-fallback")
})
#let _fallback = fallback
/// This is the fundamental function for building prequeries. It adds metadata for preprocessing to
/// the document and conditionally shows some fallback content when @@fallback mode is enabled.
///
/// The body may be given as a function, so that errors from the body don't let compilation fail
/// when in fallback mode.
///
/// - meta (any): the metadata value to provide for preprocessing
/// - lbl (label): the label to give the created metadata
/// - body (content, function): the body to display; if a function is given, that function will not
/// be called in fallback mode
/// - fallback (content): the fallback content to display when in fallback mode
/// -> content
#let prequery(meta, lbl, body, fallback: none) = {
[#metadata(meta) #lbl]
context {
if not _fallback.get() {
if type(body) != function {
body
} else {
body()
}
} else {
if type(body) != function and fallback == none {
// in fallback mode, a body that is simple content will still be shown
// if no fallback content was given
body
} else {
// if the body is a function, or fallback content is given, that is shown
// if the fallback content is none, then nothing is shown
fallback
}
}
}
}
#let _builtin_image = image
/// A prequery for images. Apart from the `url` parameter, the image file name is also mandatory; it
/// is part of `args` for technical reasons. Outside fallback mode, rendering this fails when the
/// referenced image is missing; images need to be downloaded in a preprocessing step.
///
/// This function provides a dictionary with `url` and `path` as metadata under the label
/// `<web-resource>`. This metadata can be queried like this:
///
/// ```sh
/// typst query --input prequery-fallback=true --field value ... '<web-resource>'
/// ```
///
/// *Fallback:* renders the Unicode character "Frame with Picture" (U+1F5BC).
///
/// - url (string): the URL of the image to be shown
/// - ..args (arguments): arguments to be forwarded to built-in `image`
/// -> content
#let image(url, ..args) = prequery(
(url: url, path: args.pos().at(0)),
<web-resource>,
// this is a bit "magic": Typst doesn't have path hygiene yet
// (https://github.com/typst/typst/issues/971) - HOWEVER, it seems that the `arguments` type
// remebers where it comes from. So the first positional parameter in `args` is the path
// _relative to where this function was called_, which is the path we actually want!
_builtin_image.with(..args),
fallback: [\u{1F5BC}],
)
|
https://github.com/RanolP/typlog | https://raw.githubusercontent.com/RanolP/typlog/main/series/make-a-pl/01-tree-sitter.typ | typst | #import "../../_utils/_prelude.typ": *
#post(1, "Tree Sitter")[
]
|
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiQualifica/content.typ | typst | MIT License | #import "functions.typ": glossary, team
#let fornitura=csv("Mfornitura.csv")
#show link: underline
/*************************************/
/* INSERIRE SOTTO IL CONTENUTO */
/*************************************/
= Introduzione
Il _Piano di Qualifica_ è un documento che delinea le strategie e le attività mirate a garantire la qualità del prodotto e propone di guidare il team attraverso un percorso di miglioramento continuo, principio a cui anch'esso è soggetto.
Il documento viene regolarmente aggiornato in modo tale da guidare gli sforzi di qualità sulla base delle mutevoli esigenze del progetto, garantendo così che il processo e il prodotto crescano e si evolvano con il tempo.
Il documento costituisce un impegno concreto per assicurare la qualità in modo costante nel corso del progetto.
== Scopo
Questo documento ha lo scopo di garantire la qualità del processo e del prodotto attraverso diversi passaggi fondamentali.
La definizione di metriche quantitative e la loro periodica misurazione permettono al team di valutare l'efficacia e l'efficienza del progetto di sviluppo e di intraprendere decisioni che ne permettano la costante ottimizzazione.
Si propone inoltre di guidare il team attraverso tutte le fasi di testing: dalla pianificazione dei test fino alla valutazione dei risultati ottenuti.
== Glossario
Al fine di evitare possibili ambiguità relative al linguaggio utilizzato nei documenti, viene
fornito il _Glossario_, nel quale sono presenti tutte le definizioni di termini aventi un significato specifico che vuole essere disambiguato. Tali termini, sono scritti in _corsivo_ e marcati con una #sub("G") a pedice.
Un'attività che comprende l'inserimento di un termine di glossario può considerarsi conclusa solo nel momento in cui il termine viene scritto e spiegato nel _Glossario_.
== Riferimenti
=== Normativi
- _Norme di Progetto v1.0_;
- Documento e presentazione di capitolato d'appalto C6 - InnovaCity:
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Progetto/C6.pdf _
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Progetto/C6p.pdf _
- Regolamento di progetto:
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/PD2.pdf _
=== Informativi
- Slide dell'insegnamento di Ingegneria del Software:
- Qualità del software:
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/T7.pdf _
- Qualità di processo:
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/T8.pdf _
- Verifica e Validazione:
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/T9.pdf _
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/T10.pdf _
- _ https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/T11.pdf _
#pagebreak()
= Qualità di processo
La qualità di processo si fonda sull'assunto che, al fine di ottenere un prodotto che soddisfi determinati standard di qualità, è necessario che i processi che lo sottendono siano sottoposti a controlli periodici con lo scopo ultimo di ottimizzarli.
Il concetto di qualità di processo viene dunque applicato all'intero spettro di attività, pratiche e metodi utilizzati lungo l'intero ciclo di vita del software.
In sintesi, la qualità di processo mira a rendere la qualità una parte integrante del prodotto, garantendo che sia costruita nel processo stesso e non sia solo un obiettivo secondario.
Di seguito vengono presentate le metriche che il team si impegna a soddisfare nel contesto della qualità di processo.
Come presentato nel documento _Norme di Progetto v1.0_, la sigla MPC sta ad indicare le metriche di processo.
== Processi primari
=== Fornitura
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
..fornitura.flatten()
),
caption: [Tabella metriche per il processo di fornitura.]
)
=== Sviluppo
==== Codifica
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPC-ATC], [Attributi per Classe], [≤ 6], [≤ 4],
[MPC-PM], [Parametri per Metodo], [≤ 5], [≤ 4],
[MPC-LCM], [Linee di Codice per Metodo], [≤ 25], [≤ 20]
),
caption: [Tabella metriche per l'attività di codifica.])
#pagebreak();
== Processi di supporto
==== Documentazione
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPC-IG], [Indice Gulpease], [≥ 60], [100],
[MPC-CO], [Correttezza Ortografica], [0], [0]
),
caption: [Tabella metriche per il processo di documentazione.]
)
==== Gestione della qualità
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPC-MNS], [Metriche Non Soddisfatte], [≤3], [0],
),
caption: [Tabella metriche per il processo di gestione della qualità.]
)
#pagebreak()
= Qualità di prodotto
La qualità di prodotto è volta alla valutazione del software realizzato: l'attenzione è rivolta ad attributi quali usabilità, funzionalità, affidabilità, manutenibilità, ma più in generale alle prestazioni del prodotto.
L'obiettivo è, dunque, assicurare che il software non solo implementi le funzionalità volute dal cliente e funzioni correttamente, ma che lo faccia seguendo le indicazioni di precisi standard di qualità.
Di seguito vengono presentate le metriche che il team si impegna a soddisfare nel contesto della qualità di prodotto.
Come presentato nel documento _Norme di Progetto v1.0_ la sigla MPD sta ad indicare le metriche di prodotto.
== Funzionalità
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPD-ROS], [Requisiti Obbligatori Soddisfatti], [100%], [100%],
[MPD-RDS], [Requisiti Desiderabili Soddisfatti], [≥ 0%], [≥ 75%],
[MPD-ROPS], [Requisiti Opzionali Soddisfatti], [≥ 0%], [≥ 50%],
),
caption: [Tabella metriche per la funzionalità del prodotto.])
== Manutenibilità
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPD-FIN], [Structure Fan In], [da determinare], [da determinare],
[MPD-FOUT], [Structure Fan Out], [da determinare], [da determinare],
[MPD-CCM], [Complessità Ciclomatica per Metodo], [≤ 5], [≤ 3],
),
caption: [Tabella metriche per la manutenibilità del prodotto.
])
== Usabilità
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPD-FU], [Facilità di Utilizzo], [≤ 7 click], [≤ 5 click],
[MPD-TA], [Tempo di Apprendimento], [≤ 10 minuti], [≤ 5 minuti]
),
caption: [Tabella metriche per l'usabilità del prodotto.])
== Affidabilità
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPD-PTCP], [Passed Test Cases Percentage], [≥ 80%], [100%],
[MPD-CC], [Code Coverage], [≥80%], [100%],
[MPD-BC], [Branch Coverage], [≥60%], [100%],
[MPD-SC], [Statement Coverage], [≥60%], [100%],
),
caption: [Tabella metriche per l'affidabilità del prodotto.])
#pagebreak()
== Efficienza
#figure(
table(
columns:(auto,auto,auto,auto),
align: (x, y) => (center, center, center,center).at(x),
fill:(_,row) => if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Metrica*],[*Descrizione*],[*Valore accettazione*],[*Valore ideale*],
[MPD-CPUU],[Maximum CPU usage],[da determinare],[da determinare],
[MPD-RAMU],[Maximum RAM usage],[da determinare],[da determinare],
[MPD-TDE],[Tempo Di Elaborazione],[da determinare], [da determinare],
),
caption: [Tabella metriche per l'efficienza del prodotto.])
#pagebreak()
= Strategie di testing
In questa sezione viene esposto il piano di testing che verrà utilizzato per garantire la correttezza finale del prodotto.
Come enunciato nel documento _Norme di Progetto v1.0_, il piano segue il #glossary("modello a V"), il quale associa ad ogni fase di sviluppo una corrispondente tipologia di testing. Tali tipologie sono le seguenti:
- *Test di unità*: si verifica il corretto funzionamento delle unità componenti il #glossary[sistema]. Un'unità rappresenta un elemento indivisibile e indipendente del #glossary[sistema]\;
- *Test di integrazione*: si verifica il corretto funzionamento di più unità che cooperano per svolgere uno specifico compito (tali unità devono certamente aver superato i loro test di unità precedentemente);
- *Test di #glossary[sistema]*: si verifica il corretto funzionamento del #glossary[sistema] nella sua interezza. I requisiti funzionali obbligatori, di vincolo, di qualità e di prestazione, precedentemente concordati con il Committente mediante stipulazione del contratto, devono essere soddisfatti per intero;
- *Test di accettazione*: si verifica il soddisfacimento del Committente rispetto al prodotto software. Il loro superamento permette di procedere con il rilascio del prodotto.
== Test di accettazione
In questa sezione vengono descritti i test di accettazione del prodotto software, eseguiti sia dal gruppo #team che dalla Proponente sotto la supervisione del gruppo.
Si vuole, con tali test, andare a validare il prodotto prima del suo rilascio.
#let test_di_accettazione = (
([
Verificare che l'#glossary("amministratore pubblico") senza autenticazione possa:
1. Usufruire dell'applicazione senza doversi autenticare.
],"N/I",[
UC1\
UC2\
UC3\
UC4\
UC5\
UC6\
UC7\
UC8
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Aprire il menu di selezione delle #glossary("dashboard")\;
2. Selezionare la #glossary("dashboard") generale dei sensori;
3. Visualizzare la relativa #glossary("dashboard")\;
4. Visualizzare un #glossary("pannello") con una mappa indicante la posizione di tutti i sensori come icone su di essa;
5. Visualizzare un #glossary("pannello") con una tabella che mostra i dati relativi a quei sensori, in particolare, percentuale di batteria, se la batteria è autonoma o meno e data di ultima manutenzione;
6. Visualizzare un messaggio di avvertenza di dati mancanti, nei vari #glossary("pannelli"), nel caso il sistema non riesca a reperire i dati.
],"N/I",[
UC0\
UC1\
UC1.1\
UC1.2
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Aprire il menu di selezione delle #glossary("dashboard")\;
2. Selezionare la #glossary("dashboard") per visualizzare i dati ambientali;
3. Visualizzare la relativa #glossary("dashboard")\;
4. Visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("serie storica") che mostri i risultati delle rilevazioni delle temperatura, espresse in gradi Celsius (°C), effettuate dai singoli sensori e aggregati tramite media aritmetica per intervalli di 5 minuti;
5. Visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("serie storica") che mostri i risultati delle rilevazioni dell'umidità, espresse in percentuale, effettuate dai singoli sensori e aggregati tramite media aritmetica per intervalli di 5 minuti;
6. Visualizzare un #glossary("pannello") con una mappa mostrante la direzione del vento, rilevata da ciascun #glossary("sensore"), tramite delle frecce con origine la posizione del #glossary("sensore")\;
7. Visualizzare un #glossary("pannello") con una tabella che mostri l'ultima rilevazione della velocità del vento, espressa in chilometri orari (km/h), effettuata da ciascun #glossary("sensore")\;
8. Visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("serie storica") che mostri i risultati delle rilevazioni delle quantità di precipitazioni, espresse in millimetri orari (mm/h), effettuate dai singoli sensori e aggregati tramite media aritmetica per intervalli di 5 minuti;
9. Visualizzare un #glossary("pannello") contenente un indice numerico relativo alle precipitazioni, espresse in millimetri orari (mm/h), indicante la media dell'intensità delle precipitazioni tra tutti i dati raccolti dai sensori, degli ultimi 5 minuti;
10. Visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("serie storica") che mostri i risultati delle rilevazioni della concentrazione di inquinanti dell'aria (#glossary("PM10")), espressi in $#sym.mu g\/m^3$,effettuate dai singoli sensori e aggregati tramite media aritmetica per intervalli di 5 minuti;
11. Visualizzare un #glossary("pannello") contenente la media della concentrazione di inquinanti dell'aria (#glossary("PM10")), espressa in $#sym.mu g\/m^3$, che consideri le rilevazioni di tutti i sensori attivi negli ultimi 5 minuti, e presentata in formato numerico;
12. Visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("serie storica") che mostri i risultati delle rilevazioni della percentuale di riempimento dei bacini idrici, effettuate dai singoli sensori e aggregate tramite media aritmetica per intervalli di 5 minuti;
13. Visualizzare un #glossary("pannello") contenente la media della temperatura, espressa in gradi Celsius (°C), considerando tutti i sensori attivi negli ultimi 5 minuti, e presentata in formato numerico;
14. Visualizzare un #glossary("pannello") contenente il massimo coefficiente di inquinamento dell'aria (#glossary("PM10")) registrato tra tutti i sensori negli ultimi 5 minuti, espresso in $#sym.mu g\/m^3$, presentato in formato numerico;
15. Visualizzare un messaggio di avvertenza di dati mancanti, nei vari #glossary("pannelli"), nel caso di assenza di dati da mostrare.
],"N/I",[
UC0\
UC2\
UC2.1\
UC2.2\
UC2.3\
UC2.4\
UC2.5\
UC2.6\
UC2.7\
UC2.8\
UC2.9\
UC2.10\
UC2.11\
UC2.12\
UC9
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Aprire il menu di selezione delle #glossary("dashboard")\;
2. Selezionare la #glossary("dashboard") per visualizzare i dati urbanistici;
3. Visualizzare la relativa #glossary("dashboard")\;
4. Visualizzare un #glossary("pannello") con una mappa che indichi, mediante indicatori numerici, collocati presso le coordinate di ciascun #glossary("sensore"), la quantità di posti liberi nel parcheggio corrispondente;
5. Visualizzare un #glossary("pannello") contenente una mappa che indichi, mediante indicatori booleani collocati presso le coordinate di ciascun #glossary("sensore"), la disponibilità della colonna corrispondente;
6. Visualizzare un #glossary("pannello") che esprima, tramite una tabella indicizzata tramite il nome del #glossary("sensore"), l'erogazione energetica, espressa in watt per ora;
7. Visualizzare un #glossary("pannello") contenente una mappa che indichi, tramite gli stati "LOW", "MEDIUM", "HIGH" e "BLOCKED", lo stato di congestione delle strade;
8. Visualizzare un #glossary("pannello") contenente una mappa che indichi, mediante degli indicatori numerici, la posizione in tempo reale delle biciclette elettriche, tali indicatori devono inoltre indicare la percentuale di batteria del mezzo;
9. Visualizzare un #glossary("pannello") contenente una mappa indicante lo stato di riempimento delle zone ecologiche, espresse in valori percentuali, posizionate nelle coordinate delle zone;
10. Visualizzare un messaggio di avvertenza di dati mancanti, nei vari #glossary("pannelli"), nel caso di assenza di dati da mostrare.
],"N/I",[
UC0\
UC3\
UC3.1\
UC3.2\
UC3.3\
UC3.3.1\
UC3.3.2\
UC3.4\
UC3.5\
UC3.6\
UC9
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Aprire il menu di selezione delle #glossary("dashboard")\;
2. Selezionare la #glossary("dashboard") per visualizzare i #glossary("dati anomali") e il superamento soglie;
3. Visualizzare la relativa #glossary("dashboard")\;
4. Visualizzare un #glossary("pannello") contenente una tabella, la quale mostra tutte le anomalie rilevate, mostrando il valore dell'anomalia, il #glossary("sensore") che l'ha rilevata e il relativo #glossary("timestamp")\;
5. Visualizzare un #glossary("pannello") contenente una tabella, la quale mostra tutti i dati superanti le soglie impostate nel sistema, mostrando il valore superante la soglia, il #glossary("sensore") che ha rilevato tale valore e il relativo #glossary("timestamp")\;
6. Visualizzare un messaggio di avvertenza di dati mancanti, nei #glossary("pannelli"), nel caso di assenza di dati da mostrare.
],"N/I",[
UC0\
UC4\
UC4.1\
UC4.2\
UC9
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Ricevere un'allerta che notifichi il superamento dei 40° Celsius (°C);
2. Ricevere un'allerta che notifichi il superamento dei 50 millimetri di pioggia all'ora (50 mm/h);
3. Ricevere un'allerta relativa all'inquinamento dell'aria (#glossary("PM10")) che notifica il superamento di 80#[#sym.mu]g su metro cubo ($ 80#sym.mu g\/m^3$);
4. Ricevere un'allerta che notifichi il superamento del 70% della capienza di un bacino;
5. Ricevere un'allerta che notifichi il superamento dell'80% della capienza di una zona ecologica.
],"N/I",[
UC5\
UC5.1\
UC5.2\
UC5.3\
UC5.4\
UC5.5\
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Scegliere una #glossary("dashboard") da visualizzare;
2. Applicare dei filtri, per visualizzare solo i dati provenienti dal sottoinsieme di sensori selezionato, nel caso di #glossary("pannelli") di tipo #glossary("serie storica")\;
3. Applicare dei filtri, per visualizzare solo i dati provenienti dai sensori delle tipologie selezionate, nel caso di #glossary("pannelli") contenenti tabelle, le quali comprendono più tipologie di sensori al loro interno;
4. Applicare dei filtri, per selezionare solo particolari sensori, mediante il nome, nel caso di #glossary("pannelli") contenenti tabelle;
5. Applicare dei filtri, per selezionare solo i dati relativi ad un definito intervallo di tempo, all'interno di un'intera #glossary("dashboard")\;
6. Visualizzare gli effetti dei filtri applicati ai #glossary("pannelli") sorgente, anche sui #glossary("pannelli") collegati, come #glossary("side effect").
],"N/I",[
UC0\
UC6\
UC6.1\
UC6.2\
UC6.3\
UC6.4\
UC6.5
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Scegliere una tabella da ordinare;
2. Ordinare le righe di tale tabella secondo uno dei suoi campi.
],"N/I",[
UC7
]),
([
Verificare che l'#glossary("amministratore pubblico"), una volta entrato nell'applicazione, possa:
1. Scegliere una #glossary("dashboard") di cui modificare il layout;
2. Modificare il layout dei #glossary("pannelli") in termini di posizione di tali #glossary("pannelli") e della loro dimensione.
],"N/I",[
UC8
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della temperatura, espressa in gradi Celsius (°C), con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U10\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione dell'umidità, espressa in percentuale, con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U11\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della direzione e della velocità del vento, espresse rispettivamente in gradi (con gli 0° a Nord e i 180° a Sud) e in chilometri orari (km/h), con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U12\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della quantità di precipitazioni, espressa in millimetri all'ora (mm/h), con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U13\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione dell'inquinamento dell'aria (#glossary("PM10")), espresso in $#sym.mu g\/m^3$, con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U14\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione del livello di riempimento del bacino idrico presso cui è installato, espressa in percentuale, con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U15\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della quantità di parcheggi nel parcheggio in cui è installato, espressa numericamente, con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U16\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della quantità di energia erogata, espressa in chilowatt all'ora (kWh), con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U17\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione della percentuale di batteria della bicicletta a cui è associato e le relative coordinate geografiche, con annesso il #glossary("timestamp") di rilevazione, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U18\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione del livello di riempimento della zona ecologica presso cui è installato, espressa in percentuale, con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U19\
U21
]),
([
Verificare che un #glossary("sensore"), una volta connesso al sistema, possa:
1. Inserire il risultato della rilevazione dello stato della congestione stradale nella strada presso cui è installato, espressa nei seguenti stati (ordinati per ordine di congestione crescente) "LOW", "MEDIUM", "HIGH", "BLOCKED", con annesso il #glossary("timestamp") di rilevazione, le proprie coordinate geografiche, la propria percentuale di batteria (costantemente a 100% nel caso di sensori senza batteria autonoma), la data di ultima manutenzione effettuata su di esso e la propria frequenza di inserimento dati, espressa in secondi.
],"N/I",[
U20\
U21
]),
).enumerate(start:1).map(test => ("TA"+ str(test.at(0)),test.at(1).at(0),test.at(1).at(1),test.at(1).at(2)));
#show figure: set block(breakable: true)
#figure(
table(
columns: (2fr,7fr,1fr),
align: (center,left,center),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Codice test*],[*Descrizione*],[*Stato*],
..test_di_accettazione.map(item => (item.at(0),item.at(1),item.at(2))).flatten().map(item => [#item])
),caption: "Test di accettazione.")
=== Tracciamento dei test di accettazione
#show figure: set block(breakable: true)
#figure(
table(
columns: (80pt,80pt),
align: (center,center),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Codice test*],[*Codice caso d'uso*],
..test_di_accettazione.map(item => (item.at(0),item.at(3))).flatten().map(item => [#item])
),caption: "Tracciamento dei test di accettazione.")
== Test di sistema
#let test_di_sistema = (
([
Verificare che l'#glossary("amministratore pubblico") possa accedere all'applicazione senza dover effettuare l'autenticazione.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un menù di selezione delle #glossary[dashboard], che permetta di selezionare una #glossary("dashboard") Sensori, Ambientale, Urbanistica e Dati anomali & superamento soglie.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare una #glossary("dashboard") dedicata a fornire una panoramica generale dei sensori.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare le posizioni dei sensori come icone su una mappa, appartenente alla #glossary("dashboard") generale relativa ai sensori.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare, in forma tabellare, l'elenco dei sensori con la relativa percentuale di batteria, un valore booleano che indica se il #glossary("sensore") abbia batteria autonoma o meno e la data di ultima manutenzione effettuata su tale #glossary("sensore"), all'interno della #glossary("dashboard") generale relativa ai sensori.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa monitorare i dati provenienti dai sensori relativi ai dati ambientali in una #glossary("dashboard") apposita.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("time series") rappresentante la media aritmetica della temperatura, espressa in gradi Celsius (°C), per ciascun #glossary("sensore"), che aggreghi i dati per intervalli di 5 minuti, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("time series") rappresentante la media aritmetica dell'umidità, espressa in percentuale, per ciascun #glossary("sensore"), che aggreghi i dati per intervalli di 5 minuti, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che evidenzi la direzione del vento, mediante frecce aventi origine nelle coordinate del #glossary("sensore"), nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una tabella la quale riporta l'ultima velocità del vento, espressa in chilometri all'ora (km/h), per ciascun #glossary("sensore"), nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("time series") rappresentante la media aritmetica dell'intensità delle precipitazioni, espresse in millimetri all'ora (mm/h), per ciascun #glossary("sensore"), che aggreghi i dati per intervalli di 5 minuti, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un indice numerico, che esprime l'intensità media delle precipitazioni, espressa in millimetri all'ora (mm/h), degli ultimi 5 minuti, facendo la media dei dati raccolti tra tutti i sensori, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("time series") rappresentante la media aritmetica del livello di polveri sottili nell'aria (#glossary("PM10")), espressa in $#sym.mu g\/m^3$, per ciascun #glossary("sensore"), aggregando i dati per intervalli di 5 minuti, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un indice numerico, che esprime l'inquinamento dell'aria medio (#glossary("PM10")), espresso in $#sym.mu g\/m^3$, degli ultimi 5 minuti, facendo la media dei dati raccolti tra tutti i sensori, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un grafico in formato #glossary("time series") rappresentante la percentuale di riempimento dei bacini idrici, per ciascun #glossary("sensore"), aggregando i dati per intervalli di 5 minuti, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un indice numerico, che esprime la temperatura media, espressa in gradi Celsius (°C), degli ultimi 5 minuti, facendo la media dei dati raccolti tra tutti i sensori, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente un indice numerico, che esprime l'inquinamento dell'aria massimo (#glossary("PM10")), espresso in $#sym.mu g\/m^3$, degli ultimi 5 minuti, tra i dati registrati da tutti i sensori, nella #glossary("dashboard") relativa ai dati ambientali.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa monitorare i dati provenienti dai sensori relativi ai dati urbanistici in una #glossary("dashboard") apposita.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che evidenzi il numero di posti liberi nei vari parcheggi, mediante indicatori numerici posti nelle coordinate del #glossary("sensore"), nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che evidenzi la posizione delle colonne di ricarica per auto, mediante indicatori booleani posti nelle coordinate dei sensori che ne indicano la disponibilità di queste, nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una tabella che riporti l'erogazione delle colonne di ricarica, espressa in Watt all'ora, nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che evidenzi lo stato di congestione delle strade, mediante gli stati "LOW", "MEDIUM", "HIGH", "BLOCKED", presso le coordinate dei sensori che hanno effettuato la rilevazione, nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che mostri, in tempo reale, la posizione delle biciclette elettriche, mediante degli indicatori numerici, indicanti la percentuale della batteria, nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una mappa che mostri la percentuale di riempimento delle zone ecologiche, mediante degli indicatori percentuali, posizionati nelle coordinate della zona, nella #glossary("dashboard") relativa ai dati urbanistici.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare una #glossary("dashboard") dedicata a monitorare i #glossary("dati anomali") e i dati superanti delle soglie.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una tabella che mostri i #glossary("dati anomali"), il #glossary("sensore") che li ha rilevati e il #glossary("timestamp") del rilevamento, nella #glossary("dashboard") relativa ai #glossary("dati anomali") e il superamento delle soglie.
],"N/I","RPF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare un #glossary("pannello") contenente una tabella che mostri i dati relativi a temperatura, precipitazioni, inquinamento dell'aria (#glossary("PM10")), bacini idrici e zone ecologiche, i cui valori superano una soglia fissata, il #glossary("sensore") che li ha rilevati e il #glossary("timestamp") del rilevamento, nella #glossary("dashboard") relativa ai #glossary("dati anomali") e superanti le soglie.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare delle notifiche riguardo a rilevazioni di tipo temperatura, superanti una soglia di 40° Celsius (°C).
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare delle notifiche riguardo rilevazioni di tipo precipitazioni, superanti una soglia di 50 millimetri all'ora (50 mm/h).
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare delle notifiche riguardo rilevazioni dell' inquinamento dell'aria (#glossary("PM10")), superanti una soglia di 80 microgrammi su metro cubo ($80#sym.mu g\/m^3$).
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare delle notifiche riguardo rilevazioni del livello di riempimento dei bacini idrici, superanti una soglia corrispondente al 70% della capienza del bacino idrico corrispondente.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa visualizzare delle notifiche riguardo rilevazioni del livello di riempimento delle zone ecologiche, superanti una soglia corrispondente all'80% della capienza della zona corrispondente.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa filtrare i dati, visualizzati all'interno di un grafico di tipo #glossary("time series"), in base ad un sottoinsieme di sensori da lui selezionato.
],"N/I","ROF"),
([
Verificare che che l'#glossary("amministratore pubblico") possa filtrare i dati, visualizzati all'interno di una tabella, in base alla tipologia di #glossary("sensore").
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa filtrare i dati, visualizzati all'interno di una tabella, in base ad un sotto-insieme di sensori, selezionando i nomi dei sensori di interesse.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico") possa filtrare i dati in base ad un intervallo temporale. Di conseguenza la #glossary("dashboard") interessata deve, nella sua totalità, mostrare solamente i dati aventi un #glossary("timestamp") in tale intervallo.
],"N/I","ROF"),
([
Verificare che i filtri, applicati dall' #glossary("amministratore pubblico") nei #glossary("pannelli") sorgente vengano applicati anche sui #glossary("pannelli") collegati.
],"N/I","ROF"),
([
Verificare che l'#glossary("amministratore pubblico"), nei #glossary("pannelli") tabellari, possa ordinare i dati sulla base dei valori delle proprie colonne, sia in ordine crescente che decrescente.
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico") possa, nel contesto della singola #glossary("dashboard"), modificare il layout, agendo su dimensione e posizione dei #glossary("pannelli").
],"N/I","RDF"),
([
Verificare che l'#glossary("amministratore pubblico"), riceva un messaggio di errore qualora, il sistema di visualizzazione non riesca a reperire i dati necessari per un determinato #glossary("pannello").
],"N/I","ROF"),
/*da qui iniziano i requisiti relativi ai sensori*/
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni della temperatura, espresse in gradi Celsius (°C), effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni all'umidità, espresse in percentuale, effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni della velocità e della direzione del vento, espresse rispettivamente in chilometri all'ora (km/h) e in gradi (con gli 0° a Nord e i 180° a Sud), effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni della quantità di precipitazioni, espresse in millimetri orari (mm/h), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni dell'inquinamento (#glossary("PM10")), espresse in microgrammi al metro cubo ($#sym.mu g\/m^3$), effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni del livello di riempimento del bacino idrico presso cui è installato, espresse in percentuale, effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni del quantitativo di posti liberi nel parcheggio controllato, effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni dell'erogazione della colonna di ricarica controllata, espresse in chilowatt all'ora (kWh), effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni delle coordinate geografiche e della percentuale di batteria della bicicletta elettrica controllata, effettuate dal #glossary("sensore"), con annesso il #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni del livello di riempimento della zona ecologica presso cui è installato, espresse in percentuale, effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della rilevazione.
],"N/I","ROF"),
([
Verificare che un #glossary("sensore") possa inserire nel sistema le rilevazioni del livello di congestione stradale, espresse in stati (in ordine crescente di congestione: "LOW", "MEDIUM", "HIGH", "BLOCKED"), effettuate dal #glossary("sensore"), con annesso coordinate e #glossary("timestamp") della misurazione.
],"N/I","ROF"),
([
Verificare che ogni #glossary("sensore") invii oltre ai dati della misurazione effettuata, la propria percentuale di batteria, la data di ultima manutenzione effettuata su di esso, e la propria frequenza di inserimento dati espressa in secondi.
],"N/I","ROF")
).enumerate(start:1).map(test => ("TS"+ str(test.at(0)),test.at(1).at(0),test.at(1).at(1),test.at(1).at(2))).enumerate(start:1).map(test => (test.at(1).at(0),test.at(1).at(1),test.at(1).at(2),test.at(1).at(3) + str(test.at(0))));
#show figure: set block(breakable: true)
#figure(
table(
columns: (2fr,7fr,1fr),
align: (center,left,center),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Codice test*],[*Descrizione*],[*Stato*],
..test_di_sistema.map(item => (item.at(0),item.at(1),item.at(2))).flatten().map(item => [#item])
),caption: "Test di sistema.")
=== Tracciamento dei test di sistema
#show figure: set block(breakable: true)
#figure(
table(
columns: (80pt,80pt),
align: (center,center),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Codice test*],[*Codice Requisito*],
..test_di_sistema.map(item => (item.at(0),item.at(3))).flatten().map(item => [#item])
),caption: "Tracciamento dei test di sistema.")
#pagebreak()
== Liste di controllo
Le liste di controllo sono uno strumento che il Verificatore può utilizzare al fine di individuare errori ricorrenti nella #glossary[documentazione] o nel codice. Tali liste prevedono anche una descrizione del problema al fine di poter fornire una spiegazione della richiesta di cambiamenti durante la fase di revisione.
Le liste di controllo possono essere aggiornate durante tutto il corso del progetto dal Verificatore, man mano che vengono notati errori ricorrenti.
=== Struttura dei documenti
#figure(
table(
columns: (1fr, 2fr),
inset: 10pt,
align: (center, left),
[*Aspetto*],[*Spiegazione*],
[Vuoti documentativi],[Non devono essere presenti sezioni senza contenuto.],
[Didascalia assente],[Tutte le tabelle e le immagini devono avere una didascalia descrittiva.],
[Ripetizione di elementi ricorrenti],[Ogni elemento che viene usato più di una volta, soprattutto se si sa a priori che verrà usato più volte, deve essere creato da una funzione #glossary("Typst").],
[Ordine non alfabetico],[I nomi dei componenti devono essere riportati in ordine alfabetico, in qualsiasi documento dove compaiono come elenco non numerato.],
[Aggiornamento fantasma],[Ad ogni insieme di modifiche ai documenti che devono essere aggiunte assieme, deve corrispondere una riga nella tabella del changelog, con un univoco numero di versione.],
[Titolo principale],[Tutti i titoli principali devono iniziare la pagina nella quale vengono inseriti.],
),
caption: [Lista di controllo per la struttura dei documenti.]
)
#pagebreak()
=== Errori ortografici, di lingua italiana e di forma
#figure(
table(
columns: (1fr, 2fr),
inset: 10pt,
align: (center, left),
[*Aspetto*],[*Spiegazione*],
[Errori di sintassi],[Gli errori di sintassi (battitura o distrazione) devono essere rimossi.],
[Errori di coniugazione],[Gli errori di coniugazione devono essere rimossi.],
[Forma verbale],[Il presente indicativo è da preferire.],
[Forma non concisa],[Le espressioni troppo verbose, ove possibile, devono essere ridotte a forme più concise.],
[Non formalità],[Le espressioni non formali devono essere sostituite con le corrispondenti espressioni formali.],
[Richiamo errato al documento],[Ogni richiamo ai documenti, in una loro particolare versione, deve seguire la seguente forma: _NomeDocumento vVersioneMajor.VersioneMinor_ (e.g. _Piano di Progetto v1.0_).],
[Termini impropriamente in maiuscolo],[I termini di glossario non godono della proprietà di avere la prima lettera maiuscola, rispetto alle parole tradizionali. Seguono le stesse regole delle parole non di glossario in quanto alla forma (ovviamente non riguardo allo stile).],
[Acronimi non in maiuscolo],[Gli acronimi devono essere completamente in maiuscolo (e.g. #glossary[ITS] - acronimo per Issue Tracking System).],
),
caption: [Lista di controllo per gli errori ortografici, di lingua italiana e di forma.]
)
#pagebreak()
=== Non conformità con le _Norme di Progetto_
#figure(
table(
columns: (1fr, 2fr),
inset: 10pt,
align: (center, left),
[*Aspetto*],[*Spiegazione*],
[Formato date errato],[Il formato delle date deve essere *dd-mm-aaaa* all'interno dei documenti, oppure *aa-mm-dd* all'interno dei nomi dei documenti.],
[Punteggiatura scorretta negli elenchi],[Ogni elemento di un elenco, numerato o non, deve terminare con un "*;*", ad eccezione dell'ultima riga, la quale deve terminare con "*.*".],
["*:*" in grassetto negli elenchi],[Gli elenchi nella forma "*termine*: testo", non devono includere il ":" nel grassetto.],
[Maiuscole nei titoli],[La prima lettera di ogni titolo deve essere maiuscola. Il resto del titolo dovrebbe essere in minuscolo (tolte particolari eccezioni, come ad esempio nomi di documenti o lettere che compaiono all'interno di acronimi).],
[Maiuscole negli elenchi],[Le prime lettere di ogni elenco devono essere maiuscole.],
[Ruoli in minuscolo],[Tutti i ruoli del progetto devono avere la prima lettera in maiuscolo.],
[Termine non presente nel glossario],[Ogni termine segnato con la formattazione da glossario deve essere effettivamente presente nel glossario con la relativa descrizione.],
),
caption: [Lista di controllo per le non conformità con le _Norme di Progetto_.]
)
#pagebreak()
=== _Analisi dei Requisiti_
#figure(
table(
columns: (1fr, 2fr),
inset: 10pt,
align: (center, left),
[*Aspetto*],[*Spiegazione*],
[Tracciamento caso d'uso - requisito],[Per ciascun caso d'uso deve corrispondere almeno un requisito.],
[Struttura errata dei requisiti],[I requisiti devono essere scritti nella forma: "\<soggetto\> deve/devono \<verbo all'infinito\>"],
[Numerazione errata dei casi d'uso],[La numerazione dei casi d'uso deve seguire la crescita dei numeri interi naturali. Se si tratta di un sotto-caso d'uso, il sotto-caso deve ereditare, come prefisso del proprio codice, il codice del caso d'uso a cui appartiene, e ne aggiunge una cifra. Fare riferimento alle _Norme di Progetto v1.0_ per una descrizione più approfondita.],
[#glossary[UML] dei casi d'uso],[Le estensioni e le inclusioni di un caso d'uso vanno nello stesso diagramma #glossary[UML] del caso d'uso stesso.],
),
caption: [Lista di controllo per l’_Analisi dei Requisiti_.]
)
#pagebreak()
= Cruscotto delle metriche
== Qualità di processo - fornitura
=== Estimated At Completion
#figure(
image("./assets/valutazione-metriche/EAC.png", width: 85%),
caption: [
Valutazione Estimated At Completion.
],
)
*#glossary[RTB]* L'EAC rappresenta una revisione del valore stimato per la realizzazione del progetto, ossia il BAC (Budget At Completion) rivisto allo stato corrente del progetto; il fattore che incide maggiormente sull'andamento dell'EAC è il rapporto tra EV (Estimated Value) e AC (Actual Cost), per cui tanto più queste metriche sono vicine l'una all'altra, tanto più l'EAC risulterà vicino al BAC pianificato inizialmente.
Concluso il secondo #glossary[sprint], il team ha rilevato che il valore associato all'EAC non rientrava all'interno della soglia accettabile: ci si è dunque attivati al fine di rimodulare la quantità di lavoro netta associata al concetto di ora produttiva.
Dal grafico si può rilevare che la curva delineata dal valore dell'EAC, pur essendo rimasta sempre al di sopra del valore di accettazione, ha, già a partire dal secondo #glossary[sprint] e dunque a seguito dell'azione correttiva intrapresa, mostrato un trend decrescente; il team si aspettava che nel corso degli #glossary[sprint] successivi l'andamento avrebbe continuato la sua discesa fino a che i valori fossero rientrati nella fascia accettabile.
Nelle ultime rilevazioni effettuate, la metrica ha comunque continuato la sua discesa, senza però raggiungere la soglia accettabile: la misurazione della metrica è stata di certo inflazionata dalle attività previste per gli ultimi #glossary[sprint].
Il team si è occupato infatti di ultimare tutta la #glossary[documentazione] necessaria alla revisione #glossary("RTB") e ciò ha fatto impennare i costi, causa il costo orario più elevato dei ruoli attivi (specie dell'Amministratore).
Questo risultato, nonostante la correlazione causale individuata, suggerisce ugualmente che qualcosa nel progetto non è stato gestito al meglio: la forte attenzione posta sulla #glossary[documentazione] nell'ultimo #glossary[sprint] è una manifestazione del tentativo del team di rincorrere gli obiettivi di una pianificazione poco rigorosa. Ne deriva che il team, in vista della seconda revisione, dovrà impegnarsi a migliorare il processo relativo alla gestione di progetto, in modo da poter essere sempre sicuri che gli obiettivi fissati siano effettivamente raggiunti nei termini dettati dalla pianificazione.
#pagebreak()
=== Budget Variance e Schedule Variance
#figure(
image("./assets/valutazione-metriche/BV_SV.png", width: 85%),
caption: [
Valutazione Budget Variance e Schedule Variance.
],
)
*#glossary[RTB]* La metrica BV indica se alla data corrente si è speso di più o di meno rispetto a quanto inizialmente previsto nel budget; la metrica SV indica se si è in linea, in anticipo o in ritardo rispetto alla schedulazione delle attività di progetto pianificate.
Nonostante inizialmente le due metriche si stessero allontanando rapidamente dal valore di accettazione, a partire dal secondo #glossary[sprint] queste sembrano stabilizzarsi, segno che le azioni correttive adottate all'epoca hanno prodotto gli effetti desiderati quasi immediatamente.
Il cambiamento più significativo si è verificato durante il quinto #glossary[sprint], in occasione del quale è stata osservata un'inversione di tendenza: entrambe le metriche hanno iniziato a riavvicinarsi al valore desiderato.
Il team si aspetta che il #glossary[way of working] consolidato nel corso del progetto permetta di recuperare quanto perso nel corso dei primi #glossary[sprint].
Durante il settimo e l'ottavo #glossary[sprint] le due metriche hanno mantenuto il gradiente che ci si aspettava.
=== Actual Cost e Estimate To Complete
#figure(
image("./assets/valutazione-metriche/AC_ETC.png", width: 85%),
caption: [
Valutazione Actual Cost e Estimate To Complete.
],
)
*#glossary[RTB]* L'AC rappresenta il costo effettivo sostenuto fino a un dato momento, mentre l'ETC rappresenta la stima del costo aggiuntivo necessario per completare il progetto; di conseguenza, ci si aspetta che l'AC cresca e che l'ETC diminuisca in modo sostanzialmente lineare, segno che il progetto sta mantenendo un ritmo regolare di avanzamento.
Il grafico mostra che effettivamente il team ha mantenuto un ritmo di avanzamento pressoché costante durante tutto il periodo che precede la revisione #glossary[RTB], il che è apprezzabile: nonostante la sessione d'esame il team ha continuato a occuparsi con impegno delle attività di progetto, per quanto possibile.
Tuttavia, si può evincere anche che il progetto risulta essere leggermente in ritardo rispetto alle tempistiche inizialmente previste.
Considerando che gli otto #glossary[sprint] effettuati corrispondono ad un periodo temporale di 10 settimane, esattamente la metà del periodo di tempo previsto per il completamento dell'intero progetto, ci si aspettava che le due metriche delineate nel grafico si fossero già incrociate giunti a questo punto.
=== Earned Value e Planned Value
#figure(
image("./assets/valutazione-metriche/EV_PV.png", width: 85%),
caption: [
Valutazione Earned Value e Planned Value.
],
)
*#glossary[RTB]* L'EV rappresenta il valore prodotto dal progetto ossia il valore dei #glossary[deliverable] rilasciati fino al momento della misurazione in seguito alle attività svolte; il PV rappresenta invece il valore del lavoro pianificato fino a un dato momento. Nonostante sia ancora prematuro confrontare le due metriche con l'EAC, si può notare che il PV si mantiene al di sotto dell'EV, seppur di poco, segno che i preventivi fatti finora sono stati leggermente ottimistici rispetto alla spesa effettiva. Si può notare come le due metriche a partire dal sesto #glossary[sprint] tendano ad avvicinarsi: ciò denota che il team sta iniziando effettivamente a produrre dei preventivi di periodo che rispecchiano maggiormente la realtà effettiva, anche per come viene fotografata nei consuntivi di periodo.
// == Qualità di Processo - Codifica TODO: non ha senso in questa fase del progetto
#pagebreak()
== Qualità di processo - documentazione
=== Indice Gulpease
#figure(
image("./assets/valutazione-metriche/IG.png", width: 85%),
caption: [
Valutazione Indice Gulpease.
],
)
*#glossary[RTB]* Al termine del secondo #glossary[sprint], tutti i documenti in corso di preparazione in vista della revisione #glossary("RTB") possiedono un IG al di sopra del limite accettabile inferiore di 60; in particolare, l'_Analisi dei Requisiti_ ha raggiunto il valore ideale.
Si rileva che nel corso dell'ultimo #glossary[sprint] tutti i documenti hanno subito un abbassamento del loro indice di leggibilità, perciò nel corso del periodo che precede la seconda revisione #glossary[PB] il team dovrà impegnarsi ad utilizzare una scrittura più semplice.
=== Correttezza Ortografica
#figure(
image("./assets/valutazione-metriche/CO.png", width: 85%),
caption: [
Valutazione Correttezza Ortografica.
],
)
*#glossary[RTB]* A seguito dei primi due #glossary[sprint] sono stati rilevati parecchi errori ortografici, per far fronte ai quali si è scelto di adottare uno strumento di controllo dell'ortografia sia in fase di stesura che in fase di revisione della #glossary[documentazione]. Tuttavia, nonostante l'uso di questo strumento, si è notato che il processo di #glossary[documentazione] continua ad essere afflitto da errori ortografici. Questo indica che il problema non è tanto la mancanza di strumenti adeguati, quanto più un approccio disattento da parte del team durante la redazione dei documenti, e nel processo di verifica che ne consegue.
Fare in modo che non vi siano errori nei documenti prima della revisione #glossary("RTB") rimane comunque un obiettivo di qualità che il team vuole raggiungere.
Per ovviare al problema il team ha deciso di introdurre una checklist incentrata sugli errori ortografici, in modo tale che i responsabili del processo di verifica possano avvalersene nel correggere eventuali errori. Questa checklist è pensata non solo come uno strumento pratico, ma principalmente come un promemoria costante per il Verificatore.
Tale strumento ha mostrato immediatamente i suoi effetti benefici: gli errori nel corso dell'ottavo #glossary[sprint] sono calati a zero.
== Qualità di processo - gestione della qualità
=== Metriche Non Soddisfatte
#figure(
image("./assets/valutazione-metriche/MNS.png", width: 85%),
caption: [
Valutazione Metriche Non Soddisfatte.
],
)
Le Metriche Non Soddisfatte corrispondono alle metriche MPC-CO, MPC-CPI, MPC-EAC. In concomitanza con l'ottavo #glossary("sprint"), la misurazione di MPC-CO è rientrata all'interno del valore di accettazione. Per quanto riguarda MPC-CPI e MPC-EAC, essendo estremamente legate tra loro, si rimanda alle considerazioni relative a MPC-EAC.
// == Qualità di prodotto
#pagebreak()
== Considerazioni finali in vista della revisione #glossary[RTB]
Il team ha tentato fin da subito di adottare un #glossary[way of working] che consentisse di rispettare gli obiettivi e le scadenze impostate all'inizio dello svolgimento del progetto, ma ci si è presto resi conto che quest'ultimo sarebbe dovuto essere gradualmente ampliato e raffinato con il passare del tempo; infatti, nonostante il #glossary[way of working] sia progressivamente migliorato con l'avanzare del progetto, alcune aree necessitano di essere meglio definite o migliorate affinché la qualità di processo si rifletta positivamente sulla qualità di prodotto. Volendo ripercorrere brevemente la progressione del modo di lavorare del team, si possono riportare alcune considerazioni sulle difficoltà incontrate inizialmente e su come si sia tentato di superarle.
In generale, il team non ha avuto difficoltà nel fissare incontri interni settimanali per discutere dell'avanzamento del progetto a cui tutti i componenti partecipassero attivamente; tuttavia, per una buona parte del periodo antecedente la prima revisione #glossary[RTB] (sostanzialmente fino allo #glossary[sprint] 5 incluso), gli incontri hanno avuto una durata eccessiva, ossia oltre le 1,5 ore. Dunque, il team ha cominciato a stilare un #glossary[ordine del giorno] nel corso dello #glossary[sprint] in modo da poter strutturare meglio gli incontri e limitarne la durata. Nonostante questa lista abbia un contenuto piuttosto variabile, si può migliorare la sua applicazione prestabilendo quanto tempo si dovrebbe dedicare a ciascun punto di discussione nel corso dell'incontro, cosa che il team ha intenzione di fare dopo la prima revisione per renderli più efficienti. Si nota che gli incontri si protraggono ancora per più di quanto previsto, il che in parte è dovuto al fatto che si investe del tempo per assistere gli Amministratori nella creazione delle issue e assegnazione dei relativi campi. Tuttavia il fenomeno va riducendosi, segno che il team sta imparando a svolgere queste attività in modo più efficiente.
Si è menzionato il processo di creazione e assegnazione delle issue: fortunatamente tale processo è stato messo a punto e applicato in modo consistente fin dal principio, ma si può migliorare la sua applicazione per agevolare ulteriormente la creazione del preventivo che precede ogni #glossary[sprint] e la pianificazione a breve termine. In particolare, come spiegato nelle _Norme di Progetto v1.0_, ad ogni issue viene assegnata una dimensione (in base alle ore produttive che si stima siano necessarie per il suo completamento) e una priorità, pensate per aiutare il team a dimensionare gli #glossary[sprint] e a gestire la catena di dipendenze tra le varie issue in modo corretto; tuttavia, il fatto di conoscere (e aggiornare in corso d'opera se necessario) la dimensione di tutte le issue previste per un determinato #glossary[sprint] e, di conseguenza, la dimensione dello #glossary[sprint] stesso non è stato preso in considerazione nella creazione del preventivo rilevante. Non c'è dubbio sul fatto che creare un preventivo "informato" da questo genere di stima sia più efficace che crearne uno inserendo ore non vincolate in alcun modo, solo in base alle esigenze del momento. Allo stesso modo il team si era prefissato di esplicitare sempre le date di inizio e fine di ogni singola issue, in modo da agevolare la pianificazione; anche in questo caso l'idea iniziale non è stata applicata in modo soddisfacente, perciò è risultato difficile eseguire una pianificazione dettagliata di ogni #glossary[sprint], che consistesse anche di un diagramma di Gantt. In futuro, dunque, il team ha intenzione di sfruttare queste procedure in modo concreto per migliorare le attività di creazione di pianificazione e preventivo di ogni #glossary[sprint].
Sarebbe utile dunque monitorare la dimensione di ogni #glossary[sprint] come viene descritta sopra tramite una metrica apposita da inserire tra quelle di gestione dei processi; idealmente si avrebbe anche una metrica che misura il tasso di completamento delle attività per ogni #glossary[sprint], così da potersi regolare nella pianificazione di quelli futuri. Quest'ultima non è stata utilizzata perché nel momento in cui il team ha cominciato ad utilizzare le metriche scelte in modo appropriato, si è reso conto di non possedere una traccia delle issue aperte e chiuse al termine di ogni #glossary[sprint]\; attualmente, nel momento in cui si hanno delle issue ancora aperte alla fine dello #glossary[sprint] corrente, queste vengono "trasportate" allo #glossary[sprint] successivo assegnandole alla #glossary[milestone] appena creata. In futuro, sarebbe bene fare uno "screenshot" dello stato della Kanban board al termine dello #glossary[sprint] in modo da poter calcolare questa metrica aggiuntiva prima di riadattarla allo #glossary[sprint] in procinto di iniziare.
L'applicazione di una routine più rigorosa per quanto riguarda l'aggiornamento del _Piano di Progetto_ e del _Piano di Qualifica_ con i dati rilevanti è di importanza vitale, soprattutto dopo la revisione #glossary[RTB] quando ci saranno documenti aggiuntivi che richiederanno attenzione; pianificazione, preventivo, consuntivo e metriche dovranno essere aggiornati in modo metodico e rigoroso in modo da essere sfruttati come strumenti utili ed evitare problemi come l'impiego di più ore produttive in un determinato ruolo (Amministratore, ad esempio) di quante non ce ne siano effettivamente a disposizione (anche questo da considerare nella creazione dei preventivi appunto, assieme alla dimensione dello #glossary[sprint]).
In quanto alla rendicontazione delle ore produttive effettivamente utilizzate dai membri del team nel corso di ciascuno #glossary[sprint], lo #glossary[spreadsheet] "Time & Resource Manager" su Google Drive si è rivelato estremamente utile (se aggiornato tempestivamente da tutti i membri senza ritardo); tuttavia, l'utilizzo delle ore produttive preventivate ed effettive riportate nel _Piano di Progetto v1.0_ per calcolare la percentuale di lavoro preventivato e svolto nell'ottica di PV ed EV è ancora un punto di discussione all'interno del team; infatti, come descritto dal grafico, L'EAC è ancora al di sopra del limite di accettazione superiore nonostante l'andamento decrescente. Questo è in un certo senso in linea con l'utilizzo che il team ha fatto del BAC, utilizzando più ore da Amministratore (tra le più costose, tra l'altro) del previsto, ma è anche un prodotto del modo in cui il team ha scelto di calcolare la percentuale di lavoro menzionata sopra; non essendoci altre alternative valide per eseguire il calcolo, con ogni probabilità il team continuerà ad adottare l'approccio delineato, utilizzando però le ore in modo più consapevole rispetto a quanto già speso per fare in modo che l'EAC continui ad avere un andamento decrescente.
La comunicazione all'interno del team è stata stabile fin dall'inizio del progetto e non ha subito grosse variazioni se non durante il periodo coincidente con la sessione di esami invernale e poco oltre (lo stesso vale per la comunicazione esterna con la Proponente); tuttavia, il team dovrebbe imparare a gestire meglio (e quindi stabilire una procedura per) le situazioni in cui uno o più documenti necessitano di una revisione o di modifiche critiche da effettuare con urgenza (senza dover necessariamente attendere il termine dello #glossary[sprint] corrente) tramite discussioni dedicate su Discord o meeting di emergenza. Tali misure sono state predisposte recentemente visto l'andamento del progetto nel corso della sessione, ma non sempre utilizzate quando necessario.
Complessivamente, il #glossary[way of working] del team è migliorato notevolmente dall'inizio del progetto, in particolare grazie a tutti gli strumenti, le procedure e le automazioni descritte nelle _Norme di Progetto v 1.0_ e alle misure di prevenzione dei rischi descritte nel _Piano di Progetto v1.0_, ma ciò non significa che sia privo di imperfezioni e che non possa essere migliorato ulteriormente in seguito alla revisione #glossary[RTB]. |
https://github.com/An-314/Notes-of-Probability_and_Stochastic_Processes | https://raw.githubusercontent.com/An-314/Notes-of-Probability_and_Stochastic_Processes/main/main.typ | typst | #import "@local/mytemplate:1.0.0": *
#show: project.with(
title: "概率论与随机过程",
template: "book",
authors: (
"Anzreww",
),
time: "甲辰春夏于清华园",
contents: true,
content_depth: 3,
)
#pagebreak(weak: true)
#include "chap1.typ"
#pagebreak(weak: true)
#include "chap2.typ"
|
|
https://github.com/xubaiw/typst-rote | https://raw.githubusercontent.com/xubaiw/typst-rote/main/example.typ | typst | #import "./rote.typ": cloze, mnemonic
#set heading(numbering: "1.")
#set outline(indent: 0.5em)
#outline()
#show: it => {
[= Original]
it
[= Cloze]
cloze(it)
[= Mnemonic]
mnemonic(it)
}
== Verus critical thinking
/ Foundational: Rote learning is widely used in the mastery of foundational knowledge. Examples of school topics where rote learning is frequently used include phonics in reading, the periodic table in chemistry, multiplication tables in mathematics, anatomy in medicine, cases or statutes in law, basic formulae in any science, etc. By definition, rote learning #underline[eschews comprehension], so by itself it is an ineffective tool in mastering any complex subject at an advanced level. For instance, one illustration of rote learning can be observed in preparing quickly for exams, a technique which may be colloquially referred to as "#underline[cramming]".
/ Disparaged: Rote learning is sometimes disparaged with the derogative terms parrot fashion, regurgitation, cramming, or mugging because one who engages in rote learning may give the wrong impression of having understood what they have written or said. It is strongly discouraged by many new curriculum standards. For example, science and mathematics standards in the United States specifically emphasize the importance of deep understanding over the mere recall of facts, which is seen to be less important. The National Council of Teachers of Mathematics stated:
|
|
https://github.com/r0uv3n/hrftypst | https://raw.githubusercontent.com/r0uv3n/hrftypst/main/0.0.1/hrftypst.typ | typst | #import "@preview/t4t:0.3.2": def
#import "@preview/ctheorems:1.0.0": *
// #import "@preview/physica:0.8.0": *
#show: thmrules
#let hbar = (sym.wj, move(dy: -0.08em, strike(offset: -0.55em, extent: -0.05em, sym.planck)), sym.wj).join()
#let containing = sym.in.rev
#let maps = [#h(0%):]
#let logicspace = h(0.5em)
#let holds = [#h(0%):]
#let suchthat = holds
#let inverse(body)=[$#body^(-1)$]
#let impliedBy = sym.arrow.l.double.long
#let implies = sym.arrow.r.double.long
#let iff = sym.arrow.l.r.double.long
#let given = math.class("relation",sym.bar.v)
#let setminus = $backslash$
#let sim = $tilde.op$
// braket stuff
#let braket(bra,ket,apply:false,size:auto) = $lr(angle.l bra mid(bar.v) #if (apply!=false) [$apply mid(bar.v)$] else [] ket angle.r,size:size)$
#let ket(content,size:auto) = $lr(bar.v content angle.r,size:size)$
#let bra(content,size:auto) = $lr(angle.l content bar.v,size:size)$
#let expectedvalue(content,size:auto) = $lr(angle.l content angle.r,size:size)$
// explanations
#let underarrow(toBeExplained, explanation,width:1000pt) = $limits(toBeExplained)_(limits(#box(box(explanation,width:width),width:0pt))^(arrow.t))$
// pairings
#let poissonBracket(arg1, arg2,size:auto) = $lr({arg1,arg2},size:size)$
#let scalarproduct(arg1, arg2,size:auto) = $lr(angle.l arg1, arg2 angle.r,size:size)$
#let mod(a, b) = calc.rem(calc.rem(a, b) + b, b)
#let quotient(Group,subGroup) = $Group\/subGroup$
#let reals = $bb(R)$
#let complexes = $bb(C)$
#let rationals = $bb(Q)$
#let integers = $bb(Z)$
#let symplecticGroup = $op("Sp")$
#let generalGroup = $op("GL")$
#let orthogonalGroup = $op("O")$
#let specialOrthogonalGroup = $op("SO")$
#let unitaryGroup = $op("U")$
#let specialUnitaryGroup = $op("SU")$
#let specialGroup = $op("SL")$
#let automorphisms = $op("Aut")$
#let homomorphisms = $op("Hom")$
#let bijections = $op("Bij")$
#let laplacian = $Delta$
#let to_be_shown(lang:"en", body) = {box(inset: 5pt,stroke: (dash:"solid",paint:black))[#if(lang=="en") [To be shown: ] else [Zu zeigen: ]#body]}
// #let theorem = thmbox("theorem", "Theorem")
// #let claim = thmbox("claim", "Claim")
// #let proof = thmplain(
// "proof",
// "Proof",
// bodyfmt: body => [#body #h(1fr) $square$]
// ).with(numbering: none)
// #let definition = thmbox("definition", "Definition")
#let hrfassignment(
university: "Georg-August-Universität Göttingen",
short_university: "Uni Göttingen",
authors: "<NAME>",
title: "",
semester: "WiSe 23/24",
date: none, // today if none, otherwise pass date object
due_date: none, // if none, use next week_day
due_weekday: 5, // friday by default
due_hour: 18, // always used
lang: "en",
numbering_string: ("1.","a.","1."),
teacher,
course,
short_course,
group,
sheet_number,
body,
) = {
// internationalization
let problem_term(lang: "en") = if (lang=="en") {("Problem","Part","","")} else {("Aufgabe","Teilaufgabe","","")}
// U+2116 is the numero glyph №
let exercise_sheet_term(lang: "en") = if (lang=="en") [Exercises: Sheet \u{2116}] else [Aufgabenblatt]
let exercise_group_term(lang: "en") = if (lang=="en") [Exercise group] else [Übungsgruppe]
let date_format = "[month repr:long] [day padding:none], [year]"
let time_format = "[hour padding:zero repr:24]:[minute padding:zero]"
let date = def.if-none(
datetime.today(), // default
date, // passed-in argument
)
let due_date = def.if-none(
date+duration(days:mod(due_weekday -date.weekday(),7)), // default
due_date, // passed-in argument
)
let due_time = datetime(
hour: due_hour,
minute: 0,
second: 0,
)
let sheet = (
name: title,
show_name: (teacher != "")
)
set text(lang: lang)
// set to_be_shown(lang: lang)
let title = [#exercise_sheet_term(lang: lang) #sheet_number#if(title!="") [: #title] else []]
set document(
author: authors,
title: short_course+" - Exercise Sheet "+str(sheet_number)+" Solutions - "+authors,
)
set page(
header: locate(loc => {
set text(weight: "bold")
if (loc.page()==1) [
#course #h(1fr) Written on #date.display(date_format) \
#exercise_group_term(lang:lang) #group #h(1fr) #if(lang=="en") [Due on ] else [Abgabe bis ] #due_date.display(date_format), #due_time.display(time_format)
] else [
#course #h(1fr) #authors \
#exercise_sheet_term(lang: lang) #sheet_number #h(1fr) #date.display(date_format)
]
}),
numbering: "1/1",
)
// Title row.
align(center)[
#block(text(weight: 700, 1.75em, title))
#authors
]
let exercise_numbering(..numbers)= {
let values = numbers.pos()
let n = values.len()
[#problem_term(lang:lang).at(n - 1) #numbering(numbering_string.slice(0,n).join(),..values)]
}
set heading(numbering:exercise_numbering)
body
}
#let hrfpresentation(
university: "Georg-August-Universität Göttingen",
short_university: "Uni Göttingen",
authors: "<NAME>",
semester: "WiSe 23/24",
lang: "en",
title,
talkNumber,
date,
course,
// teacher,
// short_course,
body,
) = {
import "@preview/polylux:0.3.1": *
import themes.metropolis: *
show: metropolis-theme
set text(lang: lang, size: 20pt)
// set text(font: "Fira Sans", weight: "light", size: 20pt)
// show math.equation: set text(font: "Fira Math")
let subtitle = "Seminar - " + course + " - Talk " + str(talkNumber)
title-slide(
title: title,
subtitle: subtitle,
author: authors,
date: date,
extra: image("Uni Goettingen - Logo 4c RGB - 600dpi.png", width: 50%),
)
slide(title: "Outline")[
#metropolis-outline
]
body
}
#let hrfhandout(
university: "Georg-August-Universität Göttingen",
short_university: "Uni Göttingen",
authors: "<NAME>",
semester: "WiSe 23/24",
lang: "en",
title,
talkNumber,
date,
course,
// teacher,
// short_course,
body,
) = {
let subtitle = "Seminar - " + course + " - Talk " + str(talkNumber)
} |
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/plugin-oob.typ | typst | Apache License 2.0 | // Test Out Of Bound read/write in WebAssembly plugins communication.
// Ref: false
---
#let p = plugin("/files/plugin-oob.wasm")
// Error: 2-14 plugin tried to read out of bounds: pointer 0x40000000 is out of bounds for read of length 1
#p.read_oob()
---
#let p = plugin("/files/plugin-oob.wasm")
// Error: 2-27 plugin tried to write out of bounds: pointer 0x40000000 is out of bounds for write of length 3
#p.write_oob(bytes("xyz"))
|
https://github.com/Dherse/typst-slides | https://raw.githubusercontent.com/Dherse/typst-slides/main/main.typ | typst | #import "@preview/polylux:0.3.1": *
#import "@preview/codly:0.1.0": *
#import "ugent-theme.typ": *
#import "./common/typstguy.typ": typstguy
// Get the current date, you can also replace it with your
// presentation's date:
// #let date = datetime(year: 2023, month: 06, day: 29)
#let date = datetime.today()
// Configure the slides:
#show: ugent-theme.with(
// The authors of the presentation
authors: "<NAME>",
// The short version of your name (e.g. for the footer)
short-authors: "<NAME>",
// The role you have in the University
role: [ Student ],
// The title of the presentation
title: [ Typst: a modern LaTeX replacement ],
// The subtitle of the presentation
subtitle: [
Workshop for 2nd year MSc. in Photonics Student
],
// The short title of the presentation (e.g. for the footer)
short-title: [ Typst: a modern LaTeX replacement ],
// The date of the presentation
date: date,
// The email address you want to display on the slides (or `none`)
email: "<EMAIL>",
// The mobile number you want to display on the slides (or `none`)
mobile: none,
// The department you are part of
dept: "Photonics Engineering",
// The research group you are part of
research-group: none,
// The link to your LinkedIn profile
linkedin: "https://www.linkedin.com/in/s%C3%A9bastien-d-herbais-de-thun-069913206/",
// Set this to true to generate a handout version of the slides.
handout: true,
// Whether to display a small progress bar at the bottom of the slides.
progress-bar: true,
)
#let latex-logo = [
#set text(font: "New Computer Modern")
L#box[#move(dx: 0em, dy: -0.20em)[
#box[
#pad(left: -0.3em)[
#text(size: 0.7em)[A]
]
]
]]#box[
#pad(left: -0.15em)[T]
]#box[#move(dx: 0em, dy: 0.24em)[
#box[
#pad(left: -0.2em)[E]
]
]]#box[
#pad(left: -0.15em)[X]
]
]
// This can be removed if you don't include code:
#let code-icon(icon) = text(
font: "tabler-icons",
fallback: false,
weight: "regular",
size: 16pt,
icon,
)
// Configure codly
#show: codly-init.with()
#codly(
languages: (
latex: (name: latex-logo, icon: none, color: red),
typ: (name: [ Typst ], icon: typstguy, color: rgb("#239DAD")),
),
width-numbers: 1em
)
// UGent logo
#corporate-logo()
// Global title slide
#title-slide()
// Print a nice outline of the presentation
#outline-slide()
// Start of the first section
#section-slide("Introduction")
// We create a simple slide.
#slide(title: [Why?])[
#line-by-line[
- LaTeX is *old*
- LaTeX is *hard*
- LaTeX is *ugly*
```latex
\title{My first LaTeX document}
\author{<NAME>\thanks{Funded by the Overleaf team.}}
\date{August 2022}
\begin{document}
\maketitle
```
- LaTeX is *slow*
]
][
#line-by-line(start: 5)[
- Typst is *modern*
- Typst is *easy*
- Typst is *beautiful*
```typ
// Easy as pie
#set document(
title: "My first Typst document",
author: "<NAME>",
)
```
- Typst is *fast*
]
]
#slide(title: [ Is LaTeX really that old? ])[
#line-by-line[
- TeX was created in 1978 by *<NAME>*
- Dude is absolutely bad-ass
- Wrote "The Art of Computer Programming"
- Created *METAFONT* & *Computer Modern*
- Line-breaking algorithm
- Document format: *DVI*
- Created *WEB*
- LaTeX was created in 1983 by *<NAME>*
- Set of macros of TeX
- Easier to use
- Closer logical structure #sym.arrow.l.r visual structure
]
]
#slide(title: [ Is it really that hard? ])[
#line-by-line[
- LaTeX is known for it's cryptic errors \ ```
! Undefined control sequence.
\enit@setresumekeys ...it@toks }\ifnum \enit@type
=\z@ #3\def \enit@noexcs {...
```
- People just Google for info
- The documentation is often hard to search
]
]
#slide(title: [ LaTeX is ugly? ])[
#quote(attribution: link("https://www.reddit.com/user/atloomis/")[u/atloomis], block: true, quotes: true)[
Because it [LaTeX] is so hacky and messy. [...]
]
- Have you ever wondered what goes on in your `documentclass`?
```latex
\def\@citex[#1]#2{%
\let\@citea\@empty
\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{], [}%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
```
]
#section-slide([ It's #strike[hammer] Typst time!])
#slide(title: [ What sets Typst apart? ])[
- A *real* programming language
```typ
#let fib(n) = {
if n <= 1 {
1
} else {
fib(n - 1) + fib(n - 2)
}
}
```
][
#only(2)[
- With *powerful* markup syntax
```typ
==== My paragraph
Hello, world!
*This text is in bold*.
_And this one is emphasized_.
#strike[This one is
struck through].
```
]
]
#slide(title: [ What sets Typst apart? ])[
#line-by-line[
- A simple *free* web-app for *everything*
- Collaborative editing
- Instant preview
- Cloud storage
- Or running on your PC using a *single* binary
- macOS, Linux, or Windows
- No dependencies
- Easy to install
- Easy to update
- *Incredible* documentation
- *Packages* at your fingertips
]
]
#section-slide([ Let's get started! ])
#slide(title: [ The basics ])[
#line-by-line[
- A Typst document is a *markup* with *code*
- The markup is the default mode or when surrounded in `[` and `]`.
- The `#` character is used to switch to code mode.
```typ
This is markup
#this-is-code()
#[ This is also markup ]
```
]
]
#slide(title: [ The basics (cont.) ])[
#line-by-line[
- Heading levels are defined with `=` characters ```typ
= Heading 1
== Heading 2
=== Heading 3
```
- Lists are defined with `-` characters ```typ
- Item 1
- Item 2
- Item 2.1
```
]
]
#slide(title: [ The basics (cont.) ])[
#line-by-line[
- Numbered lists are defined with `+` characters ```typ
+ Item 1
+ Item 2
+ Item 2.1
```
- Strong emphasis is done with `*` and `_` characters ```typ
*This is strong*
_This is emphasized_
```
]
]
#slide(title: [ The basics (cont.) ])[
#line-by-line[
- You can create labels using the `<label>` syntax: ```typ
= Chapter 1 <my-label>
```
- And you can reference them using the `@` syntax: ```typ
@my-label // This creates a clickable link
```
- It works the same for bibliographies! ```typ
@my-bib-entry // This creates a clickable link
```
]
]
#slide(title: [ The basics (cont.) ])[
#line-by-line[
- You can insert comments using `//` and `/* */` ```typ
// This is a comment
/* This is a block comment */
```
- You can insert code using the `#` character ```typ
#let x = 1
#let y = 2
#let z = x + y
```
]
]
#slide(title: [ The basics (cont.) ])[
#line-by-line[
- You can insert a block of code using the `#` character ```typ
#{
let x = 1
let y = 2
}
```
- You can declare functions and variables using the `let` keyword ```typ
#let add(a, b) = a + b
#let c = add(5, 6)
```
]
]
#slide(title: [ Bibliographies ])[
#line-by-line[
- Please use *Zotero* for managing your bibliographies
- You can export your bibliography to a `.bib` file
- Or you can use *Hayagriva*'s `.yaml` files
- You can then import them in your Typst document ```typ
#bibliography("my-bibliography.bib", style: "ieee")
```
- You can then cite them using the `@` syntax ```typ
@my-bib-entry // Will display like [1] and be clickable.
```
- Everything will be formatted automatically!
]
]
#slide(title: [ Images and figures ])[
#line-by-line[
- You can insert images using the `#image` function ```typ
#image("my-image.png")
```
- And wrap them in a figure using the `#figure` function ```typ
#figure(caption: "My caption")[
#image("my-image.png")
] <my-image>
```
- It automatically detects the type of figure (image, table, etc.)
- You can reference it by giving it a label and referecing it using the `@` syntax.
]
]
#slide(title: [ Equations ])[
- Two types: inline and display
#line-by-line[
- Inline equations are surrounded by `$` characters: $x^2 + y^2 = z^2$ ```typ
$x^2 + y^2 = z^2$
```
- Display equations are surrounded by `$` characters with a space: $ x^2 + y^2 = z^2 $ ```typ
$ x^2 + y^2 = z^2 $
```
- You can also give them a label and reference them.
- Syntax is similar to LaTeX but with a few differences.
]
]
#slide(title: [ Outlines & queries ])[
#line-by-line[
- Outlines are built from a query
- Queries allow you to ask questions of your document ```typ
#locate(loc => {
query(heading.where(level: 1), loc)
})
```
- And are made easy to use ```typ
#outline(target: figure.where(kind: image))
```
]
]
#slide(title: [ Packages ])[
#line-by-line[
- Packages are a way to extend Typst
- They are written in Typst itself
- They are easy to import ```typ
#import "@preview/polylux:0.3.1": *
```
- And easy to use ```typ
#show: codly-init.with()
#codly()
```
- Downloaded on demand
]
]
#slide(title: [ `show` rules, and `set` commands ])[
#line-by-line[
- `show` rules are used to change how an object is displayed ```typ
#show link: it => text(color: blue, it)
#link("https://www.google.com/") will be blue.
```
- `set` commands are used to change the state of a function ```typ
#set text(font: "New Computer Modern")
This text will be in New Computer Modern.
```
- Rules are applied in order of appearance
- Rules are scoped to the current block
]
]
#slide(title: [ Nifty packages ])[
- `@preview/polylux` for making slides (like this one)
- `@preview/codly` for beautiful code blocks
- `@preview/cetz` for creating diagrams
- `@preview/tablex` for creating beautiful tables
- `@preview/glossarium` for creating glossaries
- `@preview/lemmify` and `@preview/ctheorems` for creating theorems
- `@preview/jogs` to run JS code
- `@preview/pyrunner` to run Python code from Typst
- So many more
]
#section-slide([ Did you say demo? ])
#section-slide([ About your thesis ])
#slide(title: [ Use these tools ])[
- Zotero for managing your bibliography
- Typst for writing your thesis
- #link("https://draw.io") for creating diagrams
- The Typst Discord server: #link("https://discord.gg/2uDybryKPe")
]
#slide(title: [ Thanks for coming! ])[
- #link("https://typst.app")
- #link("https://discord.gg/2uDybryKPe")
- #link("https://github.com/typst/typst")
- #link("https://github.com/Dherse/masterproef")
- #link("https://github.com/Dherse/ugent-templates")
- Questions?
]
// Final end slide
#end-slide() |
|
https://github.com/Sckathach/adversarial-gnn-based-ids | https://raw.githubusercontent.com/Sckathach/adversarial-gnn-based-ids/main/presentation/main.typ | typst | #import "@preview/polylux:0.3.1": *
#import themes.simple: *
#set text(font: "Inria Sans")
#show: simple-theme.with(
footer: [SSR Presentation 2024, <NAME> & <NAME>]
)
#show figure: X => [
#set align(center)
#X
]
#title-slide[
= Graph Neural Network based Intrusion Detection and its Robustness against Adversarial Attacks
#v(1em)
<NAME> #footnote[Students - Télécom SudParis] <fn> #h(1em)
<NAME> @fn
<NAME> #footnote[Supervisor - Télécom SudParis]
June 17, 2024
]
#slide[
= Intrusion Detection System
#figure(image("assets/ids.png"))
]
#slide[
= Graph Neural Network
#figure(image("assets/node2vec.png", width: 60%))
]
#slide[
#figure(image("assets/gcn.png"))
]
#slide[
= GNN-based IDS
#figure(image("assets/ids_graph.png", width: 60%))
]
#slide[
#v(2em)
#figure(image("assets/ids_system.png", width: 70%))
]
#slide[
#v(2em)
#figure(image("assets/meta_path.jpg", width: 100%))
]
#slide[
#figure(image("assets/hypervision.png"))
]
#slide[
#figure(image("assets/hypervision_examples.png"))
]
#slide[
= GNN adversarial attacks
#figure(image("assets/adding_fake_edges.png", width: 60%))
]
#centered-slide[
= Conclusion
] |
|
https://github.com/chendaohan/bevy_tutorials_typ | https://raw.githubusercontent.com/chendaohan/bevy_tutorials_typ/main/25_change_detection/change_detection.typ | typst | #set page(fill: rgb(35, 35, 38, 255), height: auto, paper: "a3")
#set text(fill: color.hsv(0deg, 0%, 90%, 100%), size: 22pt, font: "Microsoft YaHei")
#set raw(theme: "themes/Material-Theme.tmTheme")
= 1. 变化检测
Bevy 允许你轻松检测数据何时发生变化。你可以利用这一点来响应变化执行操作。
主要用例之一是优化——避免不必要的工作,仅在相关数据发生变化时才执行。另一个用例是在更改时触发特殊操作,如配置或将数据发送到某处。
= 2. 组件
== 2.1过滤
你可以创建一个查询,只包含特定组件被修改的实体。
使用查询过滤器:
- #[
Added\<T>:检测新组件实例
- 如果组件被添加到现有实体
- 如果带有组件的新实体被生成
]
- #[
Changed\<T>:检测已更改的组件实例
- 当组件被修改时触发
- 如果组件是新添加的(如 Added),也会触发
]
```rs
fn added_info(components: Query<&MyComponent, Added<MyComponent>>) {
for component in &components {
info!("Added MyComponent: {}", component.0);
}
}
fn changed_info(components: Query<&MyComponent, Changed<MyComponent>>) {
for component in &components {
info!("Changed MyComponent: {}", component.0);
}
}
```
== 2.2 检查
如果你想像往常一样访问所有实体,而不管它们是否被修改,并且想知道这些组件的修改情况,你可以使用特殊的 Ref\<T> 查询参数代替 & 进行不可变访问。
对于可变访问,变更检测方法始终可用(因为 Bevy 查询实际上返回一个特殊的 Mut\<T> 类型,每当你在查询中使用 &mut 时)。
```rs
fn print_info(components: Query<Ref<MyComponent>>) {
for component in &components {
info!("print info: {}", component.0);
if component.is_added() {
info!("print info added: {}", component.0);
}
if component.is_changed() {
info!("print info changed: {}", component.0);
}
}
}
```
= 3. 资源
对于资源,变更检测通过 Res\<T>/ResMut\<T> 系统参数上的方法提供。
```rs
fn print_resource_info(resource: Res<MyResource>) {
info!("print resource info: {}", resource.0);
if resource.is_added() {
info!("print resource info added: {}", resource.0);
}
if resource.is_changed() {
info!("print resource info changed: {}", resource.0);
}
}
```
= 4. 检测到什么?
变更检测由 DerefMut 触发。仅通过可变查询访问组件,或通过 ResMut 访问资源,而不实际执行 &mut 访问,不会触发它。这使得变更检测非常准确。
注意:如果你调用一个接受 &mut T(可变借用)的 Rust 函数,即使该函数实际上没有进行任何修改,也会触发变更检测。
此外,当你修改组件时,Bevy 不会检查新值是否与旧值实际不同。它总是会触发变更检测。如果你想避免这种情况,只需自己检查。
变更检测在每个系统的粒度上工作,并且是可靠的。系统只会检测到它之前未见过的更改(更改发生在上次运行之后)。
= 5. 可能的陷阱
注意帧延迟/1帧滞后。如果 Bevy 在更改系统之前运行检测系统,检测系统将在下次运行时看到更改,通常是在下一帧更新时。
如果你需要确保更改立即/在同一帧内处理,可以使用显式系统排序。 |
|
https://github.com/BeitianMa/typst-lecture-notes | https://raw.githubusercontent.com/BeitianMa/typst-lecture-notes/main/example.typ | typst | #import "template.typ": *
#let title = "Real and Complex Analysis"
#let author = "<NAME>"
#let professor = "<NAME>"
#let creater = "<NAME>"
#let time = "Spring 2023"
#let abstract = lorem(60)
#show: note_page.with(title, author, professor, creater, time, abstract)
= Abstract Integration
#lorem(80)
#definition[#lorem(60)]
#lorem(60)
== Set-theoretic notations and terminology
#lorem(40)
#notefig("images//plot1.svg", width: 40%)
#lorem(60)
#definition[#lorem(60)]
#lorem(60)
$ cal(A) := { x in RR | x "is natural" } $
#lorem(10)
#theorem[#lorem(50)]
#lorem(30)
#corollary[
#lorem(20)
$ sum_(k=0)^n k
&= 1 + ... + n \
&= (n(n+1)) / 2 $
#lorem(20)
]
#lorem(40)
#theorem[#lorem(30)]
== The concept of measurability
#definition[#lorem(10)]
#lorem(80)
#corollary[#lorem(30)]
#lorem(50)
#lemma[#lorem(40)]
#lorem(40)
= Positive Borel Measures
#lemma[
#lorem(70)
$ vec(a, b, c) dot vec(1, 2, 3)
= a + 2b + 3c $
]
#lorem(40)
== Vector spaces
This is an example where you can easily reference and jump to a block of a definition, theorem, or picture under this template. From #refto("Lemma 1.2.1"), we can get
#corollary[#lorem(40)]
which is consistent with the pattern in #refto("Figure 1.1.1").
#notefig("images//plot2.svg", width: 40%) |
|
https://github.com/ralphmb/My-Dissertation | https://raw.githubusercontent.com/ralphmb/My-Dissertation/main/other/errata.typ | typst | Creative Commons Zero v1.0 Universal | // BRADLEY TERRY MODEL - TIES ALLOWED NO HOME ADV.
// Cut because allowing ties requires a home advantage correction.
//With the extra parameter estimated being $nu$. We will try to fit a model to the first //specification.
//This model is a bit more complicated to fit than the previous model.
//`BTm` doesn't provide any support for tied results, but a search turned up the `VGAM` package, //which contains `brat` and related functions.
//We first create two matrices, `win_mat` and `ties`.
//In the former we set the $i,j^("th")$ element equal to the number of wins $i$ has had over $j$, and //in the latter to the number of times each team has tied the other.
//We can then fit the model using:
//```R
//ties_fit <- vglm(Brat(win_mat, ties) ~ 1,
// bratt(refgp = 1, i0 = 0.1),
// trace = TRUE,
// crit = "coef")
//```
//This gives the following strength parameter estimates for each team:
//#table(
// columns:2,
//[AFC Bournemouth], [1.000],
//[Arsenal], [6.840],
//[<NAME>], [2.487],
//[Brentford], [2.221],
//[Brighton & HA], [2.549],
//[Chelsea], [1.116],
//[Crystal Palace], [1.123],
//[Everton], [0.744],
//[Fulham], [1.774],
//[Leeds United], [0.586],
//[Leicester City], [0.776],
//[Liverpool], [3.173],
//[Manchester City], [8.733],
//[Manchester United], [4.550],
//[Newcastle United], [3.714],
//[Nottingham Forest], [0.853],
//[Southampton], [0.446],
//[Tottenham Hotspur], [2.451],
//[West Ham United], [1.029],
//[Wolverhampton Wanderers], [1.059]
//)
//And an $alpha_0$ tie parameter of $0.511$. These parameters aren't directly comparable to those //from the tie-less model, but the higher and lower scores do correlate between them.
//We can estimate the probabilities of win, tie, and draw between two teams as follows. Taking //Bournemouth, Manchester United as examples:
//$
//Pr("Bourn. win") &= (1)/(1 + 4.55 + 0.511) = 0.165 \
//Pr("Tie") &= (0.511)/(1 + 4.55 + 0.511) = 0.084\
//Pr("Man U. win") &= (4.55)/(1 + 4.55 + 0.511) = 0.751 \
//$
```R
glm(data = valid_matches,
family = "binomial",
formula = result_bin ~ away_distance_km + opponent_points2021 + points2021)
```
Where `result_bin` is the binary win vs. not-win version of the match results, and `valid_matches` is a subset of the data set, excluded promoted teams. R gives the following summary for this model. For formatting and conciseness, any R output in this document will have less-relevant data removed and unnecessarily precise estimates rounded to an appropriate number of dec imal places.
```R
Estimate
(Intercept) -0.9252544
away_distance_km 0.0005193
opponent_points2021 -0.0174105
points2021 0.0310194
```
For an example of interpreting these coefficients: each extra point attained by the home team last season leads to an expected $exp(0.0310194)$ times greater log-odds of winning a given match. R performs significance tests against the null hypotheses of each of these coefficients being 0. The p-values for each variable respectively are 0.203, 0.647, 0.034, 0.0002. The first two of these are quite a bit higher than the usual benchmark for significance of 0.05, hence we cannot conclude they are significantly different from zero. We will therefore drop both variables. \
Since it had the higher p-value we first dropped away team distance and tested the new model, however the intercept term was still insignificantly different from zero. This leaves us with quite a simple model, with only two parameters estimated. The new model fit by R using `formula = result_bin ~ 0 + points + opponent_points` has the following summary:
#figure(
table(
columns:5,
[Variable], [Coeff.], [S.E], [z], [p],
[opponent_points2021], [-0.024], [0.006], [-4.090], [0.000],
[points2021], [0.024], [0.006], [4.043], [0.000],
)
)
Which is very symmetric. Point estimates for the coefficients, -0.02446 and 0.02393, do differ by about 2% (in magnitude), but this difference is about one tenth of standard error for each. The similarity suggests rephrasing this model in terms of point-difference, as we practically have one degree of freedom anyway. In light of this and thinking back to the overall home-team win rate of 49.2% in the previous section, the insignificance of the intercept term makes some sense. Two fairly evenly matched teams with $Delta"points" approx 0$ will be predicted log-odds of 0, corresponding to a home win rate of 50%, so the average lies in this neighbourhood too.\
Treating this as a one variable model, in @diffrate we plot the predicted probabilities for a given point-difference. The point difference for Leeds United and Manchester City is the largest at $plus.minus 55$, where the model predicts a 23% and 77% win chance for each team playing the other at home. \
#figure(
image("../assets/logis_diff_winrate.png", fit: "contain"),
caption: [Expected home win rate by point difference]
) <diffrate>
Using a cutoff of 0.5 for classifying wins vs losses, we can make a table of predicted results vs actual for every non-red-carded match in the season.
#table(
columns:4,
[],table.cell([Actual], colspan: 3, align:center),
table.cell(rotate([Pred], -90deg), rowspan:3, align: horizon, inset: (x:2pt, y:5pt)),
[], [Win], [Not],
[Win], [74], [53],
[Not], [48], [75]
)
This gives it a true positive rate of 58%, so better than random chance. The obvious caveat with predicting outcomes like this is that the logistic model is redundant here. Simply predicting a home win if the point-difference is positive would yield the same results. As well as this, the model fails to particularly accurately model match outcome even when predicting based on the data from which it was trained. \
In the interest of making more interesting and useful models, we will expand the scope of this section, and explore a related technique.
// ________________________________________________________________________________________________________________________
// Shit models, parametric survival
// ________________________________________________________________________________________________________________________
In the above univariate analyses, we saw that home/away classification, grouping of team by last-season points, and distance travelled (for away sides) were shown significant predictors. Additionally, the grouping of the opponent had limited evidence suggesting its usefulness. As we want to include data for home sides, we will for now ignore distance-travelled. We will first fit an exponential distribution based survival model to the unambiguously useful variables, as well as a Weibull model. We will then discuss the suitability of each. If either appears useful, we can investigate using the opponent's grouping, and including distance-travelled again. \
The almost-linearity of the cumulative hazard curve in @cumhaz could suggest an exponential distribution is a good fit. //Delete this line?
We can fit parametric models in R using `survreg(formula, dist = "[...]")`. Our formula will be of the form
```R
surv ~ home_or_away + team_grouping
```
where `surv` is a `survival` object encoding data for times and censoring, and the right hand side gives the covariates. Our two models will have `exponential` and `weibull` as values for `dist`.
Basic information about the models fit can be seen in the table. The exponential fit given by R has an intercept term of 4.529, and coefficients -0.299, 0.277 for factor variables `home_or_away` and `team_grouping` respectively. For the Weibull model the scale parameter was estimated at 0.888, and the coefficients at 4.501, -0.278, -0.260 respectively. All variables in both models are significant to $p<0.01$
// @@@@@@ Rewrite this bit? @@@@@@
Given both models can be written as
$ ln(mu_i)= beta_0 + beta_1"home_or_away" + beta_2"team_grouping" $
We can make a table of values for $mu$ based on each set of coefficients.
#figure(
table(
columns:3,
text(size:10pt,[Exp. | Wei. ]), text(size:9pt,[Home]), text(size:9pt,[Away]),
text(size:9pt,[Higher]), [52.1|52.6], [68.8|68.23],
text(size:9pt,[Lower]), [70.3|69.5], [92.7|90.1]
),
caption: [Values of $mu$ for each model]
) <twomodels>
@twomodels shows that the results are quite similar between models.
#highlight([Does this make sense? It feels a bit unclear to me])
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
We can see the similarity between the models quite clearly when comparing @survpredexp and @survpredwei.
#figure(
image("../assets/surv_pred_exp.png", fit: "contain"),
caption: [KM survival curves and the fitted exp. survival curves]
) <survpredexp>
The above plot shows in solid colours the Kaplan Meier estimates of survival function for each of the four treatment groups, and in dotted colours the exponential regression fit for each.
#figure(
image("../assets/surv_pred_wei.png", fit: "contain"),
caption: [KM survival curves and their Weibull fits]
) <survpredwei>
Both models seem to fit quite well, with the Weibull appearing to track the KM curves more closely near the earlier minutes of the game. The models have log-likelihoods of -2686.9 and -2682.5 for exponential and Weibull respectively, giving a LRT statistic of $lambda = 8.8$, exceeding $chi^(2)_(0.01) = 6.635 space ("df" = 1)$, hence we can favour the Weibull model as fitting the data significantly better. Note that since the models are nested (exponential models constrain $gamma = 1$) the likelihood ratio test is appropriate. A comparison of the AIC values for each also supports this, giving the exponential model 5379.8 and the Weibull 5372.9.
// Old full Models - parametric survival
#table(
columns: 4,
text(size:8pt,[Variable]), text(size:8pt,[exp(est)]), text(size:8pt,[2.5%]), text(size:8pt,[97.5%]),
text(size:8pt,[Home (vs away)]), text(size:8pt,[1.182]), text(size:8pt,[0.909]), text(size:8pt,[1.537]),
text(size:8pt,[High group (vs low)]), text(size:8pt,[1.319]), text(size:8pt,[1.107]), text(size:8pt,[1.572]),
text(size:8pt,[Opponent high group (vs low)]), text(size:8pt,[0.831]), text(size:8pt,[0.695]), text(size:8pt,[0.995]),
text(size:8pt,[Distance]), text(size:8pt,[0.999]), text(size:8pt,[0.998]), text(size:8pt,[1.000]),
)
#table(
columns: 4,
text(size:8pt,text(size:8pt,[Variable])), text(size:8pt,[exp(est)]), text(size:8pt,[2.5%]), text(size:8pt,[97.5%]),
text(size:8pt,[Home (vs away)]), text(size:8pt,[1.195]), text(size:8pt,[0.881]), text(size:8pt,[1.620]),
text(size:8pt,[Points '21]), text(size:8pt,[1.010]), text(size:8pt,[1.004]), text(size:8pt,[1.016]),
text(size:8pt,[Opponent points '21]), text(size:8pt,[0.992]), text(size:8pt,[0.986]), text(size:8pt,[0.998]),
text(size:8pt,[Distance]), text(size:8pt,[0.999]), text(size:8pt,[0.998]), text(size:8pt,[1.000]),
)
//#figure(
// image("../assets/unused/factor_mod_one.png", fit: "contain"),
//)
//#figure(
// image("../assets/unused/ctns_mod_one.png", fit: "contain"),
//)
/*#highlight([I can write these as tables instead of using screenshots, if that makes a difference. The reason for the screenshots was so I could fit more content here without changing the text size.])*/
// Rest of the deleted weibull stuff.
/*As can be seen from the coefficients in each model, playing at home and being higher ranked both correspond to shorter first goal times, and playing a higher ranked team, having to travel farther lead to longer times. We can see however that the confidence intervals are quite wide for both team side and distance travelled in each model, as both include 1. Corresponding p-values can be found for each of these variables, 21.6% and 25.3% for `home_or_away` and 14.8% and 19.8% for `actual_distance` in each respective model. This is likely due to the correlation between these variables. To remedy this we can remove the variable with highest p-value, in both cases the home/away factor.\*/
After removing this factor variable we get models with the following coefficients.
//TODO : Remake this table, with home and away as the variable chosen
#table(
columns: 4,
[Variable], [exp(est)], [L95%], [U95%],
[home_or_awayHome], [1.394], [1.135], [1.713],
[points2021], [1.010], [1.004], [1.016],
[opponent_points2021], [0.992], [0.986], [0.999],
)
With shape = 1.14 and scale = 0.00572
#table(
columns: 4,
text(size:8pt,[Variable]), text(size:8pt,[exp(est)]), text(size:8pt,[2.5%]), text(size:8pt,[97.5%]),
text(size:8pt,[High group (vs low)]), text(size:8pt,[1.314]), text(size:8pt,[1.102]), text(size:8pt,[1.566]),
text(size:8pt,[High grouped opponent (vs low)]), text(size:8pt,[0.826]), text(size:8pt,[0.691]), text(size:8pt,[0.988]),
text(size:8pt,[Distance]), text(size:8pt,[0.999]), text(size:8pt,[0.998]), text(size:8pt,[0.999]),
)
With scale parameter 0.008979 and shape parameter 1.128343
#table(
columns: 4,
text(size:8pt,[Variable]), text(size:8pt,[exp(est)]), text(size:8pt,[2.5%]), text(size:8pt,[97.5%]),
text(size:8pt,[Points '21]), text(size:8pt,[1.010]), text(size:8pt,[1.004]), text(size:8pt,[1.016]),
text(size:8pt,[Opponent points '21]), text(size:8pt,[0.992]), text(size:8pt,[0.985]), text(size:8pt,[0.998]),
text(size:8pt,[Distance]), text(size:8pt,[0.999]), text(size:8pt,[0.998]), text(size:8pt,[0.999]),
)
With scale parameter 0.007999 and shape parameter 1.142912
As the 95% interval bounds show, all covariates are significant so we need not remove any further variables. Inconveniently, due to the lack of points-values for the teams promoted from a lower league, the continuous model is derived from much less data than the factor model, with 500 observations instead of 706. This means we can't compare AIC or likelihood values for each model to assess goodness-of-fit. The values estimated in each model are similar, with the Weibull shape parameter $gamma = 1.13, 1.14$ for the factor and continuous models respectively.
Given that the inclusion of promoted teams into the 'lower' grouping is to some degree a guess on where they would most likely be grouped, we will proceed with the model based on continuous point-values. \
The value of the shape parameter, $gamma = 1.14$, indicates a growing hazard throughout the game. This is perhaps a bit surprising, given the concave look of a few of the CH curves shown earlier.
/*The intercept term gives something like a baseline survival time /* CHECK THIS */ - $exp(4.22) = 68.36$.*/
This doesn't exactly correspond to the average, just the value when all covariates are 0. We can use this, and the rest of the fitted coefficients to calculate expected survival times given some values for each coefficient.
Take a game between Arsenal (H) and Everton (A). These teams achieved 69 and 39 points last season respectively, and their stadia are 286km apart.
The TTFG expected for Everton in this match would be predicted as 109 minutes, and for Arsenal 47 mins, which makes sense, given they're the stronger team and playing at home.
#highlight([Thought about adding residual plots here, but maybe they aren't needed.])
// Residual Plots? - Housh says unnecessary
|
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/rahmenplaene/zitieren.typ | typst | Other | #import "/src/template.typ": ix
== Zitierweise
Die Zitierweise der Rahmenpläne in Mecklenburg-Vorpommern ist die Folgende und muss so verwendet werden:
#table(columns: 2,
stroke: none,
column-gutter: 1em,
row-gutter: 0.5em,
strong[Stufe], strong[Zitierweise],
[1-4], [
@MBWKMV_RPGS
],
[5 u. 6], [
@MBWKMV1996_RP56
],
[7-10], [
@MBWKMV2002_RP710
],
[11 u. 12], [
@MBWKMV2019_RP1112
],
) |
https://github.com/AntoineCorbel/typst | https://raw.githubusercontent.com/AntoineCorbel/typst/main/README.md | markdown | # typst
Typst templates for my personal use.
File **main.typ** is the one containing all the text.
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/visualize/image.typ | typst | Apache License 2.0 | // Test the `image` function.
---
// Test loading different image formats.
// Load an RGBA PNG image.
#image("/files/rhino.png")
// Load an RGB JPEG image.
#set page(height: 60pt)
#image("../../files/tiger.jpg")
---
// Test configuring the size and fitting behaviour of images.
// Set width and height explicitly.
#box(image("/files/rhino.png", width: 30pt))
#box(image("/files/rhino.png", height: 30pt))
// Set width and height explicitly and force stretching.
#image("/files/monkey.svg", width: 100%, height: 20pt, fit: "stretch")
// Make sure the bounding-box of the image is correct.
#align(bottom + right, image("/files/tiger.jpg", width: 40pt, alt: "A tiger"))
---
// Test all three fit modes.
#set page(height: 50pt, margin: 0pt)
#grid(
columns: (1fr, 1fr, 1fr),
rows: 100%,
gutter: 3pt,
image("/files/tiger.jpg", width: 100%, height: 100%, fit: "contain"),
image("/files/tiger.jpg", width: 100%, height: 100%, fit: "cover"),
image("/files/monkey.svg", width: 100%, height: 100%, fit: "stretch"),
)
---
// Does not fit to remaining height of page.
#set page(height: 60pt)
Stuff
#image("/files/rhino.png")
---
// Test baseline.
A #box(image("/files/tiger.jpg", height: 1cm, width: 80%)) B
---
// Test advanced SVG features.
#image("/files/pattern.svg")
---
// Error: 8-29 file not found (searched at typ/visualize/path/does/not/exist)
#image("path/does/not/exist")
---
// Error: 2-22 unknown image format
#image("./image.typ")
---
// Error: 2-25 failed to parse SVG (found closing tag 'g' instead of 'style' in line 4)
#image("/files/bad.svg")
---
// Test parsing from svg data
#image.decode(`<svg xmlns="http://www.w3.org/2000/svg" height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg")
---
// Error: 2-168 failed to parse SVG (missing root node)
#image.decode(`<svg height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg")
---
// Test format auto detect
#image.decode(read("/files/tiger.jpg", encoding: none), width: 80%)
---
// Test format manual
#image.decode(read("/files/tiger.jpg", encoding: none), format: "jpg", width: 80%)
---
// Error: 2-83 failed to decode image (Format error decoding Png: Invalid PNG signature.)
#image.decode(read("/files/tiger.jpg", encoding: none), format: "png", width: 80%)
|
https://github.com/goshakowska/Typstdiff | https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/ordered_list/ordered_list_deleted_result.typ | typst | + The climate
- Precipitation
- Temperature
+ degree
- hot
- cold
- #strike[warm]
+ #strike[sun]
+ #strike[The];#strike[ ];#strike[geology]
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/shape-square_05.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
//
// // Size wins over width and height.
// // Error: 09-20 unexpected argument: width
// #square(width: 10cm, height: 20cm, size: 1cm, fill: rgb("eb5278")) |
https://github.com/maxhves/maxhves-cv | https://raw.githubusercontent.com/maxhves/maxhves-cv/main/resume.typ | typst | #import "templates/resume.template.typ": *
//region Personal details
#show: resume.with(
email: "<EMAIL>",
phoneNumber: "+47 901 11 845",
author: "<NAME>",
website: "www.hvesserlewis.com",
github: "maxhves",
linkedin: "maxhves"
)
//endregion
//region Employment
= Employment
#employment(
title: "Full Stack Developer",
companyName: "Hvesser-Lewis Consulting",
startDate: "Jan 2024",
endDate: "Present",
location: "Bangkok, Thailand",
description: [
In this role, I provide technical expertise to clients on a freelance and consulting basis, working on a variety of full-stack and mobile applications. I develop end-to-end solutions tailored to the unique needs of diverse clients and businesses.
In addition to technical development, I manage all projects from start to finish, ensuring that deadlines are met while delivering high-quality work. I consistently provide accurate updates throughout each project’s lifecycle, maintaining clear communication and accountability.
],
)
#employment(
title: "Senior Software Engineer",
companyName: "Vipps MobilePay",
startDate: "Jun 2021",
endDate: "Dec 2023",
location: "Oslo, Norway & Vancouver, Canada",
description: [
- Led a financial service project, developing a credit product for Android users and managing the entire tech stack.
- Transitioned the core payment flow UI from XML to Jetpack Compose, modernizing and boosting performance.
- Improved the payments flow architecture by creating standardized helper classes.
- Maintained a rigorous release schedule, handling the end-to-end release process, monitoring crash reports, and addressing issues.
]
)
#employment(
title: "Senior Android Developer",
companyName: "FINN.no",
startDate: "Jun 2019",
endDate: "May 2021",
location: "Oslo, Norway",
description: [
- Developed an open-source image gallery library, integrated into the production app and available on my Github.
- Led a project to add a notification system to the app. Created a new feature module for networking, push notifications, local persistence, business logic, and UI.
- Designed and implemented key app components, modernizing the app's appearance and increasing user engagement and ratings.
]
)
#employment(
title: "Lead Android Developer",
companyName: "DTT",
startDate: "Aug 2017",
endDate: "May 2019",
location: "Amsterdam, the Netherlands",
description: [
- Guided and mentored a team of developers, overseeing the development of high-quality, cost-effective Android applications from inception to delivery.
- Architected Android applications for clients.
- Created precise project quotes and reports based on app requirements and design, meeting project duration and cost demands.
]
)
#employment(
title: "Software Engineer",
companyName: "DTT",
startDate: "Aug 2016",
endDate: "Jul 2017",
location: "Amsterdam, the Netherlands",
description: [
- Developed native Android apps for various clients as a consultant.
- Developed new features for existing applications and conducted assessments of code quality in established codebases.
- Showcased my expertise in Android development with the use of networking, database storage and persistence, push notifications, interface design, background services, concurrency management, and connectivity.
]
)
//endregion
//region Education
= Education
#education(
location: "Plymouth, England",
institution: "University of Plymouth",
startDate: "Sep 2014",
endDate: "May 2017",
degree: [
- BSc (Hons) Computer Science
]
)
#education(
location: "Stoke-on-Trent, England",
institution: "Staffordshire University",
startDate: "Sep 2011",
endDate: "May 2014",
degree: [
- BSc (Hons) Psychology
]
)
//endregion
//region Projects
= Projects
#project(
name: "Temperature check",
url: [
https://www.temperature-check.com
],
description: [
- Created a full stack web application using NextJS with Typescript.
- Utilized TailwindCSS and TailwindUI to create an intuitive user interface.
- Developed a platform to interpret temperature readings across multiple conditional variables.
]
)
#project(
name: "<NAME>",
url: [
https://www.crimeconnoisseur.com
],
description: [
- Created a full stack web application using NextJS, and Supabase with Typescript and SQL.
- Utilized TailwindCSS and TailwindUI to create an intuitive user interface.
- Utilized TanStack Query for state management.
- Developed a podcast client and platform, users can discover, listen to and review podcast episodes.
]
)
#project(
name: "Swap",
url: [
https://github.com/maxhves/swapx-android\
https://github.com/maxhves/swap-ios
],
description: [
- Created a native Android and native iOS mobile application with Kotlin and Swift.
- Utilized networking to sync with the latest exchange rate data via an API, subsequently storing the rates locally for quick, and offline conversions.
- Utilized Compose and SwiftUI for rapid user interface development.
- Deployed and released to the App Store and Play Store.
- Developed a currency exchange application, useful for understanding the exchange rate between two user-selected currencies.
]
)
//endegion
//region Technical skills
= Technical skills
#technicalSkill(
domain: "Mobile Developement",
skills: [
- Languages: Kotlin, Java, Swift, Objective-C.
- Libraries: Compose, Room, Coroutines, Retrofit, Hilt, Glide, Material.
- Database: SQLite, Supabase, Firebase.
]
)
#technicalSkill(
domain: "Web Development",
skills: [
- Languages: JavaScript, Typescript.
- Frameworks: NextJS, TailwindCSS.
- Libraries: ReactJS, TanStack Query.
- Database: Supabase, Firebase, Postgres.
]
)
#technicalSkill(
domain: "Interface Design",
skills: [
- Languages: LaTeX, Typst.
- Tools: Figma, Adobe Photoshop, Sketch.
]
)
//endregion |
|
https://github.com/mcanouil/quarto-highlight-text | https://raw.githubusercontent.com/mcanouil/quarto-highlight-text/main/README.md | markdown | MIT License | # Highlight-text Extension For Quarto
This is a Quarto extension that allows to highlight text in a document for various format: HTML, LaTeX, Typst, and Docx.
## Installing
```bash
quarto add mcanouil/quarto-highlight-text
```
This will install the extension under the `_extensions` subdirectory.
If you're using version control, you will want to check in this directory.
## Using
To use the extension, add the following to your document's front matter:
```yaml
filters:
- highlight-text
```
Then you can use the span syntax markup to highlight text in your document, *e.g.*:
```markdown
[Red]{colour="#b22222" bg-colour="#abc123"} # UK
[Blue]{color="#0000FF" bg-color="#ABC123"} # US
```
## Examples
Here is the source code for a minimal example: [`example.qmd`](example.qmd).
Outputs of `example.qmd`:
- [HTML](https://m.canouil.dev/quarto-highlight-text/)
- [Typst/PDF](https://m.canouil.dev/quarto-highlight-text/highlight-typst.pdf)
- [LaTeX/PDF](https://m.canouil.dev/quarto-highlight-text/highlight-latex.pdf)
- [Word/Docx](https://m.canouil.dev/quarto-highlight-text/highlight-openxml.docx) (**only supports plain text, *i.e.*, no URLs**)
- [Reveal.js](https://m.canouil.dev/quarto-highlight-text/highlight-revealjs.html)
- [Beamer/PDF](https://m.canouil.dev/quarto-highlight-text/highlight-beamer.pdf)
- [PowerPoint/Pptx](https://m.canouil.dev/quarto-highlight-text/highlight-pptx.pptx) (**only supports plain text, *i.e.*, no URLs**)
|
https://github.com/kajiLabTeam/ipsj-national-convention-typst-template | https://raw.githubusercontent.com/kajiLabTeam/ipsj-national-convention-typst-template/main/template/head.typ | typst | #import "functinos.typ": spacer
#let mixed(jfont, jweight: "regular", jsize: 1em, efont, eweight: "bold", esize: 1.05em, body) = {
show regex("[\p{Latin}0-9]"): set text(font: efont, weight: eweight, size: esize)
show regex("[\p{scx:Han}\p{scx:Hira}\p{scx:Kana}]"): set text(font: jfont, weight: jweight, size: jsize)
body
}
#let header_title(
fonts: (
sans-ja: "Noto Sans JP",
serif-ja: "Noto Serif JP",
),
title: (),
names: (),
affiliations: (),
footnotes: (:)
) = {
set align(center)
mixed(
fonts.sans-ja,
fonts.serif-ja,
grid(
rows: title.len(),
row-gutter: 8pt,
..title.map(title => {
text(
16pt,
weight: 500,
[#title \ ],
)
}),
),
)
spacer()
grid(
gutter: 1em,
columns: calc.min(names.len(), 5),
..names.map(author => {
let footnote = footnotes.at(str(author.group));
[#author.ja#super(str(footnote.index))]
}),
)
grid(
gutter: 1em,
columns: calc.min(affiliations.len(), 5),
..affiliations.map(author => {
let footnote = footnotes.at(str(author.group));
[#author.ja#super(str(footnote.index))]
}),
)
spacer()
}
|
|
https://github.com/loqusion/typix | https://raw.githubusercontent.com/loqusion/typix/main/checks/simple-with-fonts/main.typ | typst | MIT License | #set text (font: "Roboto")
#lorem(100)
|
https://github.com/typst-doc-cn/tutorial | https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/src/basic/scripting-literal-and-variable.typ | typst | Apache License 2.0 | #import "mod.typ": *
#show: book.page.with(title: "常量与变量")
本章前两节适用于没有编程经验的同学。以前接触过编程的同学可以快速浏览并跳至第三节。
Typst很快,并非因为它的#term("parser")和#term("interpreter")具有惊世的执行性能,而是语言特性本身适合缓存优化。
// 经简单测试,与LaTeX作对比,单线程LaTeX宏引擎的*计算效率*甚至要优于Typst解释器。然而,这种计算的速度优势在Typst的良好架构下立即消弭了。由于较好的缓存策略,光是在Text Shaping方面,Typst单次编译就已然快于LaTeX。架构上,Typst是较优的;随着时间积累,Typst还可以积累和打磨更多程序优化。由于缓存优势,Typst不仅单次编译很快,增量编译的速度更是达到了惊人的毫秒级,甚至微秒级。
自本节起,本教程将进入第二阶段,希望不仅让你了解如何使用脚本,还一并讲解Typst的执行原理。当然,我们不会陷入Typst的细节。所有在教程中出现的原理都是为了更好地了解语言本身。
// 什么是自省
// 程序不会自己自省,这是给你看的
== 代码表示的自省函数 <grammar-repr>
在开始学习之前,先学习几个与排版无关但非常实用的函数。
#typst-func("repr")是一个#term("introspection function"),可以帮你获得任意值的代码表示,很适合用来在调试代码的时候输出内容。
#code(```typ
#[ 一段文本 ]
#repr([ 一段文本 ])
```)
#pro-tip[
#term("introspection function")是指那些为你获取解释器内部状态的函数。它们往往接受一些语言对象,而返回存储在解释器内部的相关信息。在这里,#typst-func("repr")接受任意值,而返回对应的代码表示。
]
== 类型的自省函数 <grammar-type>
与#typst-func("repr")类似,一个特殊的函数#typst-func("type")可以获得任意值的#term("type")。所谓#term("type"),就是这个值归属的分类。例如:
- `1`是整数数字,类型就对应于整数类型(integer)。
#code(```typ
#type(1)
```)
- `一段内容`是文本内容,类型就对应于内容类型(content)。
#code(```typ
#type([一段内容])
```)
一个值只会属于一种类型,因此类型是可以比较的:
#code(```typ
#(str == str) \
#(type("X") == type("Y")) \
#(type("X") == str) \
#([一段内容] == str)
```)
类型的类型是类型(它自身):
#code(```typ
#(type(str)) \
#(type(type(str))) \
#(type(type(str)) == type) \
```)
== 求值函数 <grammar-eval>
`eval`函数接受一个字符串,把字符串当作代码执行并求出结果:
#code(```typ
#eval("1"), #type(eval("1")) \
#eval("[一段内容]"), #type(eval("[一段内容]"))
```)
从```typc eval("[一段内容]")```的中括号被解释为「内容块」可以得知,`eval`默认以#term("code mode")解释你的代码。
你可以使用`mode`参数修改`eval`的「解释模式」。`code`对应为#term("code mode"),`markup`对应为#term("markup mode"):<grammar-eval-markup-mode>
#code(```typ
代码模式eval:#eval("[一段内容]", mode: "code") \
标记模式eval:#eval("[一段内容]", mode: "markup")
```)
== 基本字面量
本小节我们将具体介绍所有基本字面量,这是脚本的“一加一”。其实在上一节,我们已经见过了一部分字面量,但皆凭直觉使用:```typc 1```不就是数字吗,那么在Typst中,它就是数字。(PS:与之相对,TeX根本没有数字和字符串的概念。)
如果你学过Python等语言,那么这将对你来说不是问题。在Typst中,常用的字面量并不多,它们是:
+ #term("none literal", postfix: "。")
+ #term("boolean literal", postfix: "。")
+ #term("integer literal", postfix: "。")
+ #term("floating-point literal", postfix: "。")
+ #term("string literal", postfix: "。")
=== 空字面量 <grammar-none-literal>
空字面量是纯粹抽象的概念,这意味着你在现实中很难找到对应的实体。就像是数学中的零与负数,空字面量自然产生于运算过程中。
#code(```typ
#repr((0, 1).find((_) => false)),
#repr(if false [啊?])
```)
上例第一行,当在「数组」中查找一个不存在的元素时,“没有”就是```typc none```。
上例第二行,当条件不满足,且没有`false`分支时,“没有内容”就是```typc none```。
// #pro-tip[
// 空字面量自然产生于运算过程中。除上所述,以下是其他会产生```typc none```的自然场景:
// - 当变量未初始化时。
// #code(```typ
// #let x; #type(x)
// ```)
// - 当`for`语句、`while`语句、函数没有产生任何值时,函数返回值为```typc none```。
// #code(```typ
// #let f() = {}; #type(f())
// ```)
// - 当函数显式`return`且未写明返回值时,函数返回值为```typc none```。
// #code(```typ
// #let f() = return; #type(f())
// ```)
// ]
`none`值不会对输出文档有任何影响:
#code(```typ
#none
```)
`none`的类型是`none`类型。`none`值不等于`none`类型,因为一个是值而另一个是类型:
#code(```typ
#type(none), #(type(none) == none), #type(type(none))
```)
=== 布尔字面量
一个布尔字面量表示逻辑的确否。它要么为`false`(真)<grammar-true-literal>要么为`true`(假)<grammar-false-literal>。
#code(```typ
假设 #false 那么一切为 #true。
```)
一般来说,我们不直接使用布尔值。当代码做逻辑判断的时候,会自然产生布尔值。
#code(```typ
$1 < 2$的结果为:#(1 < 2)
```)
=== 整数字面量 <grammar-integer-literal>
一个整数字面量代表一个整数。相信你一定知道整数的含义。Typst中的整数默认为十进制:
#code(```typ
三个值 #(-1)、#0 和 #1 偷偷混入了我们内容之中。
```)
#pro-tip[
有的时候Typst不支持在#mark("#")后直接跟一个值。这个时候无论值有多么复杂,都可以将值用一对圆括号包裹起来,从而允许Typst轻松解析该值。例如,Typst无法处理#mark("#")后直接跟随一个#mark("hyphen")的情况:
#code(```typ
#(-1), #(0), #(1)
```)
]
有些数字使用其他进制表示更为方便。你可以分别使用`0x`、`0o`和`0b`前缀加上进制内容表示十六进制数、八进制数和二进制数:<grammar-n-adecimal-literal>
#code(```typ
十六进制数:#(0xdeadbeef)、#(-0xdeadbeef) \
八进制数:#(0o755)、#(-0o644) \
二进制数:#(0b1001)、#(-0b1001)
```)
上例中,当数字被输出到文档时,Typst将数字都转换成了十进制表示。
整数的有效取值范围是$[-2^63,2^63)$,其中$2^63=9223372036854775808$。
=== 浮点数字面量 <grammar-float-literal>
浮点数与整数非常类似。最常见的浮点数由至少一个整数部分或小数部分组成:
#code(```typ
三个值 #(0.001)、#(.1) 和 #(2.) 偷偷混入了我们内容之中。
```)
有些数字使用#term("exponential notation")更为方便。你可以使用标准的#term("exponential notation")创建浮点数:<grammar-exp-repr-float>
#code(```typ
#(1e2)、#(1.926e3)、#(-1e-3)
```)
Typst还为你内置了一些特殊的数值,它们都是浮点数:
#code(```typ
$pi$=#calc.pi \
$tau$=#calc.tau \
$inf$=#calc.inf \
// NaN=#calc.nan \
```)
=== 字符串字面量 <grammar-string-literal>
Typst中所有字符串都是`utf-8`编码的,因此使用时不存在编码转换问题。字符串由一对「英文双引号」定界:
#code(```typ
#"Hello world!!"
```)
有些字符无法置于双引号之内,例如双引号本身。与「标记模式」中的转义序列语法类似,这时候你需要嵌入字符的转义序列:
#code(```typ
#"Hello \"world\"!!"
```)
字符串中的转义序列与「标记模式」中的转义序列语法相同,但有效转义的字符集不同。字符串中如下转义序列是有效的:
#{
set align(center)
table(
columns: 7,
[代码], [`\\`], [`\"`], [`\n`], [`\r`], [`\t`], [`\u{2665}`],
[效果], "\\", "\"", [(换行)], [(回车)], [(制表)], "\u{2665}",
)
}
你同样可以使用`\u{unicode}`格式直接嵌入Unicode字符。
#code(```typ
#"香辣牛肉粉好吃\u{2665}"
```)
除了使用简单字面量构造,可以使用以下方法从代码块获得字符串:
#code(```typ
#repr(`包含换行符和双引号的
"内容"`.text)
```)
== 类型转换
类型本身也是函数,例如`int`类型可以接受字符串,转换成整数。
#code(```typ
#int("11"), #int("-23")
```)
从转换的角度,`eval`可以将代码字符串转换成值。例如,你可以转换16进制数字:
#code(```typ
#eval("0x3f")
```)
== 计算标准库
由于该库即将废弃(本文将介绍新的计算API),如有希望使用的朋友,请参见#link("https://typst.app/docs/reference/foundations/calc")[Typst Reference - Calculation]。
== 浮点数陷阱
浮点数陷阱是指由于浮点转换或浮点精度问题导致的一系列逻辑问题。
// todo: 把基本字面量的运算和表达式挪过来
+ 类型比较陷阱。在运行期切记同时考虑到`float`和`int`两种类型:
#code(```typ
#type(2), #type(2.), #(type(2.) == int)
```)
可见```typc 2.```与```typc 2```类型并不相同。```typc 2.```在数学上是整数,但以浮点数存储。
+ 大数类型陷阱。当数字过大时,其会被隐式转换为浮点数存储:
#code(```typ
#type(9000000000000000000000000000000)
```)
+ 整数运算陷阱。整数相除时会被转换为浮点数:
#code(```typ
#(10 / 4), #type(10 / 4) \
#(12 / 4), #type(12 / 4) \
```)
+ 浮点误差陷阱。哪怕你的运算在数学上理论是可逆的,由于浮点数精度有限,也会误判结果:
#code(```typ
#(1000000 / 9e21 * 9e21), #((1000000 / 9e21 * 9e21) == 1000000)
```)
这提示我们,正确的浮点比较需要考虑误差。例如以上两数在允许`1e-6`误差前提下是相等的:
#code(```typ
#(calc.abs((1000000 / 9e21 * 9e21) - 1000000) < 1e-6)
```)
+ 整数转换陷阱。为了转换类型,可以使用`int`,但有可能产生精度损失(就近取整):
#code(```typ
#int(10 / 4),
#int(12 / 4)
```)
或有可能产生「截断」。
#code(```typ
#int(9000000000000000000000000000000)
```)
这些都是编程语言中的共通问题。凡是令数字保持有效精度,都会产生如上问题。
== 变量声明 <grammar-var-decl>
变量是存储“字面量”的一个个容器。它相当于为一个个字面量取名,以方便在脚本中使用。
如下语法,「变量声明」表示使得`x`的内容与`"Hello world!!"`相等。我们对语法一一翻译:
#code(```typ
#let x = "Hello world!!"
// ^^^^ ^ ^ ^^^^^^^^^^^^^^^^
// 令 变量名 为 初始值表达式
```)
#pro-tip[
同时我们看见输出的文档为空,这是因为「变量声明」本身的值是`none`。
]
「变量声明」一共分为3个有效部分。
+ `let`关键字:告诉Typst接下来即将开启一段「声明」。在英语中let是"令"的意思。
+ #term("variable identifier")、#mark("="):标识符是变量的“名称”。「变量声明」后续的位置都可以通过标识符引用该变量。
+ #term("initialization expression"):#mark("=")告诉Typst变量初始等于一个表达式的值。该表达式在编译领域有一个专业术语,称为#term("initialization expression")。这里,#term("initialization expression")可以为任意表达式,请参阅
建议标识符简短且具有描述性。尽管标识符中可以包含中文等unicode字符,但仍建议标识符中仅含英文与#mark("hyphen")。
// #link(<scripting-expression>)[表达式小节]。
// 「变量声明」可以没有初始值表达式:
// #code(```typ
// #let x
// #repr(x)
// ```)
// 事实上,它等价于将`x`初始化为`none`。
// #code(```typ
// #let x = none
// #repr(x)
// ```)
// 尽管Typst允许你不写初始值表达式,本书还是建议你让所有的「变量声明」都具有初始值表达式。因为初始值表达式还告诉阅读你代码的人这个变量可能具有什么样的类型。
「变量声明」后续的位置都可以继续使用该变量,取决于「作用域」。
// + 标识符以Unicode字母、Unicode数字和#mark("_")开头。以下是示例的合法变量名:
// ```typ
// // 以英文字母开头,是Unicode字母
// #let a; #let z; #let A; #let Z;
// // 以汉字开头,是Unicode字母
// #let 这;
// // 以下划线开头
// #let _;
// ```
// + 标识符后接有限个Unicode字母、Unicode数字、#mark("hyphen")和#mark("_")。以下是示例的合法变量名:
// ```typ
// // 纯英文变量名,带连字号
// #let alpha-test; #let alpha--test;
// // 纯中文变量名
// #let 这个变量; #let 这个_变量; #let 这个-变量;
// // 连字号、下划线在多种位置
// #let alpha-; // 连字号不能在变量名开头位置
// #let _alpha; #let alpha_;
// ```
// + 特殊规则:标识符仅为#mark("_")时,不允许在后续位置继续使用。
// #code(```typ
// #let _ = 1;
// // 不能编译:#_
// ```)
// 该标识符被称为#term("placeholder")。
// + 特殊规则:标识符不允许为`let`、`set`、`show`等关键字。
// #code(```typ
// // 不能编译:
// // #let let = 1;
// ```)
#pro-tip[
关于作用域,你可以参考#(refs.content-scope-style)[《内容、作用域与样式》]。
]
变量可以重复输出到文档中:
#code(```typ
#let x = "阿吧"
#x#x,#x#x
```)
任意时刻都可以将任意类型的值赋给一个变量。上一节所提到的「内容块」也可以赋值给一个变量。
#code(```typ
#let y = [一段文本]; #y \
#(y = 1) /* 重新赋值为一个整数 */ #y \
```)
任意时刻都可以重复定义相同变量名的变量,但是之前被定义的变量将无法再被使用:
#code(```typ
#let y = [一段文本]; #y \
#let y = 1; /* 重新声明为一个整数 */ #y \
```)
=== 函数声明 <grammar-func-decl>
「函数声明」也由`let`关键字开始。如果你仔细对比,可以发现它们在语法上是一致的。
如下语法,「函数声明」表示使得`f(x, y)`的内容与右侧表达式的值相等。我们对语法一一翻译:
```typ
#let f(x, y) = [两个值#(x)和#(y)偷偷混入了我们内容之中。]
// ^^^^ ^^^^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 令 函数名(参数列表) 为 一段内容
```
「函数声明」一共分为4个部分,相较于「变量声明」,多了一个参数列表。
参数列表中参数的个数可以有零个,一个,至任意多个,由逗号分隔。每个参数都是一个单独的#term("parameter identifier")。
```typ
// 零个参数,一个参数,两个参数,..
#f(), #f(x), #f(x, y)
```
#term("parameter identifier")的规则与功能与#term("variable identifier")相似。为参数取名是为其能在函数体中使用。
视角挪到等号右侧。#term("function body expression")的规则与功能与#term("initialization expression")相似。#term("function body expression")可以任意使用参数列表中的“变量”,并组合出一个表达式。组合出的表达式的值就是函数调用的结果。
结合例子理解函数的作用。将对应参数应用于函数可以取得对应的结果:
#code(```typ
#let f(x, y) = [两个值#(x)和#(y)偷偷混入了我们内容之中。]
#let x = "Hello world!!"
#let y = [一段文本]
#f(repr(x), y)
```)
其中```typ #f(repr(x), y)```的执行过程是这样的:
```typ
#f(repr(x), y) // 转变为
#f([\"Hello world!!\"], [一段文本])
```
注意,此时我们进入右侧表达式。
```typ
#[两个值#(x)和#(y)偷偷混入了我们内容之中。] // 转变为
#[两个值#([\"Hello world!!\"])和#([一段文本])偷偷混入了我们内容之中。]
```
最后整理式子得到,也即是我们看到的输出:
```typ
两个值\"Hello world!!\"和一段文本偷偷混入了我们内容之中。
```
// 请体会我们在介绍「变量声明」时的特殊措辞,并与「函数声明」的语法描述相对应。
// - 以下「变量声明」表示使得`x`的内容与`"Hello world!!"`相等。
// ```typ
// #let x = "Hello world!!"
// ```
// - 以下「函数声明」表示使得`f(x, y)`的内容与经过计算后的`[两个值#(x)和#(y)偷偷混入了我们内容之中。]`相等。
// ```typ
// #let f(x, y) = [两个值#(x)和#(y)偷偷混入了我们内容之中。]
// ```
== 函数闭包 <grammar-closure>
「闭包」是一类特殊的函数,又称为匿名函数。一个简单的闭包如下:
#code(```typ
#let f = (x, y) => [#(x)和#(y)。]
#f("狗", "你")
```)
我们可以看到其以箭头为体,两侧为参数列表和函数体。不像「函数声明」,它不需要取名。
闭包以其匿名特征,很适合用作参数传入其他函数,即作为「回调」函数。我们将会在下一章经常使用「回调」函数。例如,Typst提供一个`locate`函数,其接受一个函数类型的参数:
#code(```typ
#let f(loc) = [当前页码为#loc.page()。]
#locate(f)
```)
但是,等价地,此时「函数声明」不如「闭包声明」优美:
#code(```typ
#locate(loc => [当前页码为#loc.page()。])
```)
// #let x = 1;
// #let f() = x
// #f()
// #(x = 2)
// #f()
== 成员 <grammar-member-exp>
Typst提供了一系列「成员」和「方法」访问字面量、变量与函数中存储的“信息”。
其实在上一节(甚至是第二节),你就已经见过了「成员」语法。你可以通过「点号」,即```typc `OvO`.text ```,获得代码块的“text”(文本内容):
#code(```typ
这是一个代码块:#repr(`OvO`)
这是一段文本:#repr(`OvO`.text)
```)
每个类型有哪些「成员」是由Typst决定的。你需要逐渐积累经验以知晓这些「成员」的分布,才能更快地通过访问成员快速编写出收集和处理信息的脚本。(todo: 建议阅读)
当然,为防你不知道,大家不都是死记硬背的:有软件手段帮助你使用这些「成员」。许多编辑器都支持LSP(Language Server Protocol,语言服务),例如VSCode安装Tinymist LSP。当你对某个对象后接一个点号时,编辑器会自动为你做代码补全。
#figure(image("./IDE-autocomplete.png", width: 120pt), caption: [作者使用编辑器作代码补全的精彩瞬间。])
从图中可以看出来,该代码片段对象上有七个「成员」。特别是“text”成员赫然立于其中,就是它了。除了「成员」列表,编辑器还会告诉你每个「成员」的作用,以及如何使用。这时候只需要选择一个「成员」作为补全结果即可。
== 方法 <grammar-method-exp>
「方法」是一种特殊的「成员」。准确来说,如果一个「成员」是一个对象的函数,那么它就被称为该对象的「方法」。
来看以下代码,它们输出了相同的内容,事实上,它们是*同一*「函数调用」的不同写法:
#code(```typ
#let x = "Hello World"
#let str-split = str.split
#str-split(x, " ") \
#str.split(x, " ") \
#x.split(" ")
```)
第三行脚本含义对照如下。之前已经学过,这正是「函数调用」的语法:
```typ
#( str-split( x, " " ))
// 调用 字符串拆分函数,参数为 变量x和空格
```
与第三行脚本相比,第四行脚本仍然是在做「函数调用」,只不过在语法上更为紧凑。
第五行脚本则更加简明,此即「方法调用」。约定`str.split(x, y)`可以简写为`x.split(y)`,如果:
+ 对象`x`是`str`类型,且方法`split`是`str`类型的「成员」。
+ 对象`x`用作`str.split`调用的第一个参数。
「方法调用」即一种特殊的「函数调用」规则(语法糖),在各编程语言中广泛存在。其大大简化了脚本。但你也可以选择不用,毕竟「函数调用」一样可以完成所有任务。
#pro-tip[
这里有一个问题:为什么Typst要引入「方法」的概念呢?主要有以下几点考量。
其一,为了引入「方法调用」的语法,这种语法相对要更为方便和易读。对比以下两行,它们都完成了获取`"Hello World"`字符串的第二个单词的第一个字母的功能:
#code(
```typ
#"Hello World".split(" ").at(1).split("").at(1)
#array.at(str.split(array.at(str.split("Hello World", " "), 1), ""), 1)
```,
al: top,
)
可以明显看见,第二行语句的参数已经散落在括号的里里外外,很难理解到底做了什么事情。
其二,相比「函数调用」,「方法调用」更有利于现代IDE补全脚本。IDE会自动联想你接下来可能需要与“字符串”相关的函数,你便可以通过`.split`很快定位到“字符串拆分”这个函数。
其三,方便用户管理相似功能的函数。你很快就可以联想到,不仅仅是字符串可以拆分,似乎内容也可以拆分。不仅如此,将来可能还有各种各样的拆分。如果需要为他们都取不同的名字,那可就太头疼了。相比`str.split`就简单多了。要知道,程序员最讨厌给变量和函数想命名这种东西了。
]
// == 复合字面量
// ,它们是:
// + #term("array literal", postfix: "。")
// + #term("dictionary literal", postfix: "。")
== 数组字面量 <grammar-array-literal>
脚本模式中有两个核心复合字面量。
「数组」是按照顺序存储的一些「值」,你可以在「数组」中存放*任意内容*而不拘泥于类型。你可以使用圆括号与一个逗号分隔的列表创建一个*数组字面量*:
#code(```typ
#(1, "OvO", [一段内容])
```)
== 字典字面量 <grammar-dict-literal>
所谓「字典」即是「键值对」的集合,其每一项是由冒号分隔的「键值对」。如下例所示,冒号左侧,“neco-mimi”等「标识符」或「字符串」是字典的「键;而冒号右侧分别是对应的「值」。
#code(```typ
#(neko-mimi: 2, "utterance": "喵喵喵")
```)
== 数组和字典的成员访问
为了访问数组,你可以使用`at`方法。“at”在中文里是“在”的意思,它表示对「数组」使用「索引」操作。在数组中,第0个值就是其第一个值,第 $N$ 个值就是其第 $N + 1$ 个值,以此类推。如下所示:
#code(```typ
#let x = (1, "OvO", [一段内容])
#x.at(0), #x.at(1), #x.at(2)
```)
至于「索引」从零开始的原因,这只是约定俗成。等你习惯了,你也会变成计数从零开始的好程序员。
为了访问字典,你可以使用`at`方法。但由于「键」都是字符串,你需要使用字符串作为字典的「索引」。
#code(```typ
#let cat = (attribute: [kawaii\~])
#cat.at("attribute")
```)
为了方便,Typst允许你直接通过成员方法访问字典对应「键」的值: <grammar-dict-member-exp>
#code(```typ
#let cat = ("attribute": [kawaii\~])
#cat.attribute
```)
== 数组和字典的「存在谓词」
与数组相关的另一个重要语法是`in`,`x in (...)`,表示判断`x`是否*存在于*某个数组中:<grammar-array-in>
#code(```typ
#([一段内容] in (1, "OvO", [一段内容])) \
#([另一段内容] in (1, "OvO", [一段内容]))
```)
字典也可以使用此语法,表示判断`x`是否是字典的一个「键」。特别地,你还可以前置一个`not`判断`x`是否*不在*某个数组或字典中:<grammar-dict-in>
#code(```typ
#let cat = (neko-mimi: 2)
#("neko-kiki" not in cat)
```)
注意:`x in (...)`与`"x" in (...)`是不同的。例如`neko-mimi in cat`将检查`neko-mimi`变量的内容是否是字典变量`cat`的一个「键」,而`"neko-mimi"`检查对应字符串是否在其中。
== 数组和字典的「解构赋值」
除了使用字面量「构造」元素,Typst还支持「构造」的反向操作:「解构赋值」。顾名思义,你可以在左侧用相似的语法从数组<grammar-destruct-array>或字典中获取值并赋值到*对应*的变量上。<grammar-destruct-dict>
#code(```typ
#let (attr: a) = (attr: [kawaii\~])
#a
```)
「解构赋值」必须一一对应,但你也可以使用「占位符」(`_`)或「延展符」(`..`)以作*部分*解构:<grammar-destruct-array-eliminate>
#code(```typ
#let (first, ..) = (1, 2, 3)
#let (.., second-last, _) = (7, 8, 9, 10)
#first, #second-last
```)
数组的「解构赋值」有一个妙用,那就是重映射内容。<grammar-array-remapping>
#code(```typ
#let (a, b, c) = (1, 2, 3)
#let (b, c, a) = (a, b, c); #a, #b, #c
```)
特别地,如果两个变量相互重映射,这种操作被称为「交换」:<grammar-array-swap>
#code(```typ
#let (a, b) = (1, 2)
#((a, b) = (b, a)); #a, #b
```)
// field access
// - dictionary
// - symbol
// - module
// - content
== 数组和字典的典型构造
特别讲解一些关于数组与字典相关的典型构造:
#code(```typ
#() \ // 是空的数组
#(:) \ // 是空的字典
#(1) \ // 被括号包裹的整数1
#(()) \ // 被括号包裹的空数组
#((())) \ // 被括号包裹的被括号包裹的空数组
#(1,) \ // 是含有一个元素的数组
```)
`()`是空的数组<grammar-empty-array>,不含任何值。
如果你想构建空的字典,需要中置一个冒号,`(:)`是空的字典<grammar-empty-dict>,不含任何键值对。
如果括号内含了一个值,例如`(1)`,那么它仅仅是被括号包裹的整数1,仍然是整数1本身。
类似的,`(())`是被括号包裹的空数组<grammar-paren-empty-array>,`((()))`是被括号包裹的被括号包裹的空数组。
为了构建含有一个元素的数组,需要在列表末尾额外放置一个逗号以示区分,例如`(1,)`。<grammar-single-member-array>
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Trailing_commas
这种逗号被称为尾后逗号。
// todo: 改进
构造数组字面量时,允许尾随一个多余的逗号而不造成影响。
#code(```typ
#let x = (1, "OvO", [一段内容] , ); #x
// 这里有一个多余的逗号^^^
```)
构造字典字面量时,允许尾随一个多余的逗号。
#code(```typ
#let cat = (attribute: [kawaii\~], ); #cat
// 这里有一个尾随的小逗号^^
```)
== 高级参数语法
学会了「数组」和「字典」,我们可以学习更加高级的参数语法。这些高级语法让参数声明更灵活。
=== 具名参数声明 <grammar-named-param>
以上两种函数都允许包含「具名参数」,其看起来就像字典的一项,冒号右侧则是参数的*默认值*:
#code(```typ
#let g(name: "?") = [你是#name]
#g(/* 不传就是问号 */); #g(name: "OwO。")
```)
=== 变长参数 <grammar-variadic-param>
「函数声明」和「闭包声明」都允许包含「变长参数」。
#code(```typ
#let g(..args) = [很多个值,#args.pos().join([、]),偷偷混入了我们内容之中。]
#g([一个俩个], [仨个四个], [五六七八个])
```)
```typc args.pos()```的类型是`Argument`。
+ 使用`args.pos()`得到按顺序传入的参数
+ 使用`args.at(name)`访问名称为`name`的具名参数。
=== 参数解构 <grammar-destructing-param>
todo参数解构。
== 总结
// Typst如何保证一个简单函数甚至是一个闭包是“纯函数”?
// 答:1. 禁止修改外部变量,则捕获的变量的值是“纯的”或不可变的;2. 折叠的对象是纯的,且「折叠」操作是纯的。
// Typst的多文件特性从何而来?
// 答:1. import函数产生一个模块对象,而模块其实是文件顶层的scope。2. include函数即执行该文件,获得该文件对应的内容块。
// 基于以上两个特性,Typst为什么快?
// + Typst支持增量解析文件。
// + Typst所有由*用户声明*的函数都是纯的,在其上的调用都是纯的。例如Typst天生支持快速计算递归实现的fibnacci函数:
// #code(```typ
// #let fib(n) = if n <= 1 { n } else { fib(n - 1) + fib(n - 2) }
// #fib(42)
// ```)
// + Typst使用`include`导入其他文件的顶层「内容块」。当其他文件内容未改变时,内容块一定不变,而所有使用到对应内容块的函数的结果也一定不会因此改变。
// 这意味着,如果你发现了Typst中与一般语言的不同之处,可以思考以上种种优势对用户脚本的增强或限制。
基于《字面量、变量和函数》掌握的知识你应该可以:
+ 查看#(refs.ref-type-builtin)[《参考:内置类型》],以掌握内置类型的使用方法。
+ 查看#(refs.ref-visualization)[《参考:图形与几何元素》],以掌握图形和几何元素的使用方法。
+ 查看#(refs.ref-wasm-plugin)[《参考:WASM插件》],以掌握在Typst中使用Rust、JavaScript、Python等语言编写插件库。
+ 阅读#(refs.ref-grammar)[《参考:语法示例检索表》],以检查自己的语法掌握程度。
+ 查看#(refs.ref-typebase)[《参考:基本类型》],以掌握基本类型的使用方法。
+ 查看#(refs.ref-color)[《参考:颜色、色彩渐变与模式》],以掌握色彩的高级管理方法。
+ 查看#(refs.ref-data-process)[《参考:数据读写与数据处理》],以助你从外部读取数据或将文档数据输出到文件。
+ 查看#(refs.ref-bibliography)[《参考:导入和使用参考文献》],以助你导入和使用参考文献。
+ 阅读基本参考部分中的所有内容。
== 习题
#let q1 = ````typ
#let a0 = 2
#let a1 = a0 * a0
#let a2 = a1 * a1
#let a3 = a2 * a2
#let a4 = a3 * a3
#let a5 = a4 * a4
#a5
````
#exercise[
使用本节所讲述的语法,计算$2^32$的值:#rect(width: 100%, eval(q1.text, mode: "markup"))
][
#q1
]
#let q1 = ````typ
#let a = [一]
#let b = [渔]
#let c = [江]
#let f(x, y) = a + x + a + y
#let g(x, y, z, u, v) = [#f(x, y + a + z),#f(u, v)。]
#g([帆], [浆], [#(b)舟], [个#(b)翁], [钓钩]) \
#g([俯], [仰], [场笑], [#(c)明月], [#(c)秋])
````
#exercise[
输出下面的诗句,但你的代码中至多只能出现17个汉字:#rect(width: 100%, eval(q1.text, mode: "markup"))
][
#q1
]
#let q1 = ````typ
#let calc-fib() = {
let res = range(2).map(float)
for i in range(2, 201) {
res.push(res.at(i - 1) + res.at(i - 2))
}
res
}
#let fib(n) = calc-fib().at(n)
#fib(75)
````
#exercise[
已知斐波那契数列的递推式为$F_n = F_(n-1) + F_(n-2)$,且$F_0 = 0, F_1 = 1$。使用本节所讲述的语法,计算$F_75$的值:#rect(width: 100%, eval(q1.text, mode: "markup"))
][
#q1
]
#let q1 = ````typ
#set align(center)
#let matrix-fmt(..args) = table(
columns: args.pos().at(0).len(),
..args.pos().flatten().flatten().map(str)
)
#matrix-fmt(
(1, 2, 3),
(4, 5, 6),
(7, 8, 9),
)
````
#exercise[
编写函数,使用`table`(表格)元素打印任意$N times M$矩阵,例如:
```typ
#matrix-fmt(
(1, 2, 3),
(4, 5, 6),
(7, 8, 9),
)
```
#rect(width: 100%, eval(q1.text, mode: "markup"))
][
#q1
]
|
https://github.com/pascal-huber/typst-letter-template | https://raw.githubusercontent.com/pascal-huber/typst-letter-template/master/lttr.typ | typst | MIT License | // NOTE: lttr-data contains all the data to render the letter
#let lttr-data = state("letter", none)
// NOTE: lttr-max-dy keeps track of the largest offset dy (from the top margin)
// of absolutely positioned content (sender and receiver fields) such that we
// know how much vertical offset we need to add at the beginning of the letter
// content. Note that length does not include the value of
// `settings.content-spacing`.
#let lttr-max-dy = state("lttr-max-dy", 0cm)
#let lttr-update-max-dy(dy) = {
locate(loc => {
lttr-max-dy.update(x => calc.max(x, dy))
})
}
#let lttr-fmt(it) = {
if type(it) == array {
let ctr = 0
for line in it {
lttr-fmt(line)
if ctr != it.len() {
linebreak()
}
ctr += 1
}
} else {
[#it]
}
}
#let lttr-defaults = (
_page: (
margin: (
top: 3cm,
bottom: 3cm,
left: 25mm,
right: 20mm,
),
),
_text: (
size: 11pt,
),
settings: (
content-spacing: 10mm,
justify-content: true,
),
sender: (
content: none,
fmt: (it) => {
lttr-fmt(it.content)
},
),
return-to: (
content: none,
fmt: (it) => {
text(size: 0.8em)[#underline({
lttr-fmt(it.content)
})]
},
),
remark-zone: (
content: none,
fmt: (it) => {
set align(it.align)
text(size: 0.8em)[
#lttr-fmt(it.content)
]
},
),
receiver: (
content: none,
fmt: (it) => {
lttr-fmt(it.content)
},
spacing: 0.65em / 2, // NOTE: half the default spacing between lines
),
date-place: (
date: none,
place: none,
),
horizontal-table: (
content: none,
fmt: (header, content) => {
set par(leading: 0.4em)
text(size: 0.8em)[
#lttr-fmt(header)
#linebreak()
]
lttr-fmt(content)
},
spacing: 10mm,
),
title: (
content: none,
spacing: 2mm,
),
opening: (
content: none,
spacing: 2mm,
),
closing: (
content: none,
spacing: 5mm,
),
signature: (
content: none,
spacing: 5mm,
)
)
#let lttr-format-defaults = (
"DIN-5008-A": (
_page: (
paper: "a4",
),
_text: (
lang: "DE"
),
settings: (
content-spacing: 8.46mm,
),
horizontal-table: (
spacing: 8.46mm,
),
sender: (
position: (left: 125mm, top: 32mm),
width: 75mm,
),
return-to: (
position: (left: 20mm + 5mm, top: 27mm),
dimensions: (height: 5mm, width: 85mm - 5mm),
),
remark-zone: (
position: (left: 20mm + 5mm, top: 27mm + 5mm),
dimensions: (height: 12.7mm, width: 85mm - 5mm),
align: top,
),
receiver: (
position: (left: 20mm + 5mm, top: 27mm + 17.7mm),
dimensions: (height: 27.3mm, width: 85mm - 5mm),
align: top,
),
indicator-lines: (
show-puncher-mark: true,
fold-marks: (87mm, 87mm+105mm),
),
date-place: (
align: right,
)
),
"DIN-5008-B": (
_page: (
paper: "a4",
),
_text: (
lang: "DE"
),
settings: (
content-spacing: 8.46mm,
),
horizontal-table: (
spacing: 8.46mm,
),
sender: (
position: (left: 125mm, top: 50mm),
width: 75mm,
),
return-to: (
// NOTE: this position overlapps with remark-zone. DIN-5008-B does
// not have a dedicated return-to field. If both return-to and
// remark-zone have a non-none content, then the remark-zone field
// has to be recuced by return-to.dimensions.height
position: (left: 20mm + 5mm, top: 45mm),
dimensions: (height: 5mm, width: 85mm - 5mm),
),
remark-zone: (
position: (left: 20mm + 5mm, top: 45mm),
dimensions: (height: 12.7mm + 5mm, width: 85mm - 5mm),
align: bottom,
),
receiver: (
position: (left: 20mm + 5mm, top: 45mm + 17.7mm),
dimensions: (height: 27.3mm, width: 85mm - 5mm),
align: top,
),
indicator-lines: (
show-puncher-mark: true,
fold-marks: (105mm, 105mm + 105mm),
),
date-place: (
align: right,
)
),
"C5-WINDOW-LEFT": (
_page: (
paper: "a4",
),
_text: (
lang: "CH",
),
settings: (
content-spacing: 10mm,
),
horizontal-table: (
spacing: 10mm,
),
sender: (
// NOTE: position.top is the margin.top
// NOTE: position.left and width are like DIN5008
position: (left: 125mm, top: 30mm),
width: 75mm,
),
return-to: (
position: none,
),
remark-zone: (
position: none,
),
receiver: (
// NOTE: I added a 5mm "padding" on the left here
position: (left: 20mm + 5mm, top: 52mm),
// NOTE: height = Window_height - (C5_height - Paper_height)
// = 45mm - (162mm - 297mm/2)
// = 31.5mm
// NOTE: width = Window_width - (C5_width - Paper_width)
// = 100mm - (229mm - 210mm)
// = 81mm
dimensions: (height: 31.5mm, width: 81mm),
align: horizon,
),
indicator-lines: (
fold-marks: (),
show-puncher-mark: true,
),
date-place: (
align: left,
)
),
"C5-WINDOW-RIGHT": (
_page: (
paper: "a4",
),
_text: (
lang: "CH",
),
settings: (
content-spacing: 10mm,
),
horizontal-table: (
spacing: 10mm,
),
sender: (
position: none,
width: 75mm,
),
return-to: (
position: none,
),
remark-zone: (
position: none,
),
receiver: (
position: (left: 120mm, top: 52mm),
dimensions: (height: 31.5mm, width: 80mm),
align: horizon,
),
indicator-lines: (
fold-marks: (),
show-puncher-mark: true,
),
date-place: (
align: left,
)
),
)
#let lttr-indicator-lines(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.indicator-lines != none {
if state.indicator-lines.show-puncher-mark {
place(
dy: 50% - 0.5 * state._page.margin.top + 0.5 * state._page.margin.bottom,
dx: 0cm - state._page.margin.left + 9mm,
line(
length: 0.4cm,
stroke: 0.5pt + rgb("#777777")
)
)
}
if type(state.indicator-lines.fold-marks) == array {
for mark in state.indicator-lines.fold-marks {
place(
dy: mark - state._page.margin.top,
dx: 0cm - state._page.margin.left + 9mm,
line(
length: 0.2cm,
stroke: 0.5pt + rgb("#777777")
)
)
}
}
}
})
body
}
#let lttr-horizontal-table(
body
) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.horizontal-table.content != none {
let content = ()
let ctr = 0
for entry in state.horizontal-table.content {
ctr += 1
content.push({
state.horizontal-table.at("fmt")(
entry.first(),
entry.last(),
)
})
}
if ctr > 0 {
let column-width = 100% / ctr
let columns = ()
while ctr > 0 {
columns.push(column-width)
ctr -= 1
}
let tbl = table(
columns: columns,
inset: 0pt,
stroke: if state.debug {red} else {none},
align: (left, top),
..content
)
let table-rect = rect(
outset: 0pt,
inset: 0pt,
stroke: none,
tbl
)
let dy = lttr-max-dy.at(loc) + state.horizontal-table.spacing
place(
dy: dy,
{
table-rect
layout(size => style(styles => {
let (height,) = measure(
block(width: size.width, table-rect),
styles
)
lttr-update-max-dy(height + dy)
}))
}
)
}
}
})
body
}
#let lttr-closing(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.closing.content != none {
v(state.closing.spacing)
state.closing.content
}
if state.signature.content != none {
v(state.signature.spacing)
state.signature.content
}
})
body
}
#let lttr-opening(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.opening != none {
v(state.opening.spacing)
state.opening.content
}
})
body
}
#let lttr-date-place(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.date-place != none {
set align(state.date-place.align)
state.date-place.place
if state.date-place.place != none and state.date-place.date != none {
text(", ")
}
state.date-place.date
}
})
body
}
#let lttr-title(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.title != none {
v(state.title.spacing)
text(
weight: "bold",
size: 1.0em,
state.title.content
)
}
})
body
}
#let lttr-sender(body) = {
locate(loc => {
let state = lttr-data.at(loc);
let sender-rect = rect(
width: state.sender.width,
inset: 0pt,
outset: 0pt,
stroke: if state.debug {blue} else {none},
{
state.sender.at("fmt")(state.sender)
}
)
let sender-position = if state.sender.position != none {
state.sender.position
} else {
(left: state._page.margin.left, top: state._page.margin.top)
}
let dy = sender-position.top - state._page.margin.top
let dx = sender-position.left - state._page.margin.left
place(
dy: dy,
dx: dx,
sender-rect
)
// TODO: add layout here
style(styles => {
lttr-update-max-dy(measure(sender-rect, styles).height + dy)
})
})
body
}
#let lttr-receiver-return-to(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.return-to.position != none {
let dy = state.return-to.position.top - state._page.margin.top
let dx = state.return-to.position.left - state._page.margin.left
place(
dy: dy,
dx: dx,
rect(
width: state.return-to.dimensions.width,
height: 5mm,
stroke: if state.debug {red} else {none},
inset: (left: 0mm, right: 0mm),
outset: 0cm,
{
state.return-to.at("fmt")(state.return-to)
}
)
)
}
})
body
}
#let lttr-receiver-remark-zone(body) = {
locate(loc => {
let state = lttr-data.at(loc);
if state.remark-zone.position != none {
let dy = state.remark-zone.position.top - state._page.margin.top
let dx = state.remark-zone.position.left - state._page.margin.left
place(
dy: dy,
dx: dx,
rect(
width: state.remark-zone.dimensions.width,
height: state.remark-zone.dimensions.height,
stroke: if state.debug {green} else {none},
inset: (left: 0mm, right: 0mm),
outset: 0pt,
{
state.remark-zone.at("fmt")(state.remark-zone)
}
)
)
}
})
body
}
#let lttr-receiver-address(body) = {
locate(loc => {
let state = lttr-data.at(loc);
let receiver-rect = rect(
width: state.receiver.dimensions.width,
height: state.receiver.dimensions.height,
stroke: if state.debug {purple} else {none},
inset: (left: 0mm, right: 0mm, top: 0mm),
outset: 0pt,
{
v(state.receiver.spacing)
set align(state.receiver.align)
state.receiver.at("fmt")(state.receiver)
},
)
let dy = state.receiver.position.top - state._page.margin.top
let dx = state.receiver.position.left - state._page.margin.left
place(
dy: dy,
dx: dx,
receiver-rect,
)
// TODO: add layout here
style(styles => {
let rect-height = measure(receiver-rect, styles).height
lttr-update-max-dy(rect-height + dy)
})
})
body
}
#let lttr-receiver(body) = {
show: lttr-receiver-return-to
show: lttr-receiver-remark-zone
show: lttr-receiver-address
body
}
#let lttr-content-offset(body) = {
locate(loc => {
let state = lttr-data.at(loc);
v(lttr-max-dy.at(loc) + state.settings.content-spacing)
set par(justify: state.settings.justify-content)
body
})
}
#let lttr-preamble(body) = {
show: lttr-sender
show: lttr-receiver
show: lttr-horizontal-table
show: lttr-indicator-lines
show: lttr-content-offset
show: lttr-date-place
show: lttr-title
show: lttr-opening
body
}
#let lttr-init(
_page: (:),
_text: (:),
debug: false,
format: "DIN-5008-A",
settings: (:),
indicator-lines: (:),
sender: (:),
return-to: (:),
remark-zone: (:),
receiver: (:),
horizontal-table: (:),
title: (:),
date-place: (:),
opening: (:),
closing: (:),
signature: (:),
body,
) = {
let format-defaults = lttr-format-defaults.at(format)
// Takes an array of dictionaries and merges them where later dictionaries
// overwrite the values of the ones before
let lttr-deep-dict-merge(dictionaries) = {
if dictionaries.len() == 0 {
return (:)
} else if dictionaries.len() == 1 {
return dictionaries.first()
}
// helper function to deeply merge d1 and d2 (d2 overwrites d1)
let deep-merge(d1, d2) = {
let keys = (..d1.keys(), ..d2.keys())
for k in keys {
if d1.keys().contains(k) and d2.keys().contains(k) {
let d1-val = d1.at(k)
let d2-val = d2.at(k)
if type(d1-val) == dictionary and type(d2-val) == dictionary {
// both d1 and d2 contain key k both d1.at(k) and
// d2.at(k) are dictionaries, merge them
d2.insert(k, deep-merge(d1-val, d2-val))
}
} else if d1.keys().contains(k) {
// key only exists in d1, add it to d2
d2.insert(k, d1.at(k))
}
}
return d2
}
let result = none
for dict in dictionaries {
if result == none {
result = dict
} else {
result = deep-merge(result, dict)
}
}
return result
}
let merge-arg-dicts = (item-name, item) => {
if item == none {
none
} else {
lttr-deep-dict-merge((
lttr-defaults.at(item-name, default: (:)),
format-defaults.at(item-name, default: (:)),
if type(item) != dictionary {
(content: item)
} else {
item
}
))
}
}
let data = (
_page: merge-arg-dicts("_page", _page),
_text: merge-arg-dicts("_text", _text),
closing: merge-arg-dicts("closing", closing),
date-place: merge-arg-dicts("date-place", date-place),
debug: debug,
format: format,
horizontal-table: merge-arg-dicts("horizontal-table", horizontal-table),
indicator-lines: merge-arg-dicts("indicator-lines", indicator-lines),
opening: merge-arg-dicts("opening", opening),
receiver: merge-arg-dicts("receiver", receiver),
remark-zone: merge-arg-dicts("remark-zone", remark-zone),
return-to: merge-arg-dicts("return-to", return-to),
sender: merge-arg-dicts("sender", sender),
settings: merge-arg-dicts("settings", sender),
signature: merge-arg-dicts("signature", signature),
title: merge-arg-dicts("title", title),
)
// NOTE: This is a special case for DIN-5008-B as described in the format
// defaults
if data.format == "DIN-5008-B" {
if data.return-to.content != none and data.remark-zone.content != none {
// we have both return-to and remark-zone, reduce the size of
// remark-zone and shift it down
data.remark-zone.dimensions.height = data.remark-zone.dimensions.height - data.return-to.dimensions.height
data.remark-zone.position.top = data.remark-zone.position.top + data.return-to.dimensions.height
} else if data.return-to.content != none {
// there is no remark-zone, shift the return-to down
data.return-to.position.top = data.receiver.position.top - data.return-to.dimensions.height
}
}
// FIXME: find a better way to (not) set document attributes
set page(..data._page)
set text(..data._text)
lttr-data.update(x => data)
body
}
#let lttr-state() = {
locate(loc => {
lttr-data.at(loc);
})
}
|
https://github.com/mvuorre/quarto-apaish | https://raw.githubusercontent.com/mvuorre/quarto-apaish/main/_extensions/apaish/typst-show.typ | typst | Creative Commons Zero v1.0 Universal | #show: document => $documentmode$(
$if(title)$
title: "$title$",
$endif$
$if(running-head)$
running-head: "$running-head$",
$endif$
$if(by-author)$
authors: (
$for(by-author)$(
name: "$it.name.literal$",
affiliations: "$for(it.affiliations)$$if(it.id)$$it.id$$endif$$sep$,$endfor$",
email: [$it.email$]
),
$endfor$
),
$endif$
$if(affiliations)$
affiliations: (
$for(affiliations)$(
id: "$it.id$",
name: "$it.name$"
),
$endfor$
),
$endif$
$if(authornote)$
authornote: [$authornote$],
$endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(keywords)$
keywords: [$keywords$],
$endif$
$if(paper)$
paper: "$paper$",
$endif$
$if(margin)$
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
$endif$
$if(font)$
font: ("$font$",),
$endif$
$if(fontsize)$
fontsize: $fontsize$,
$endif$
$if(leading)$
leading: $leading$,
spacing: $leading$,
$endif$
$if(spacing)$
spacing: $spacing$,
leading: $leading$
$endif$
$if(cols)$
cols: $cols$,
$endif$
document,
)
|
https://github.com/Tran-Thu-Le/typst-collection | https://raw.githubusercontent.com/Tran-Thu-Le/typst-collection/main/variation-table/variation-table.typ | typst | #import "@preview/cetz:0.2.2": canvas, plot
#import "@preview/cetz:0.2.2"
// define pat before importing Cetz to utilize line() of Typst before using line() of Cetz
#let pat = pattern(size: (5pt, 5pt))[
#place(line(start: (0%, 100%), end: (100%, 0%)))
]
// Now, we can import Cetz
#import cetz.draw: circle, rect, line, content, anchor, group
#let _get-node(length: 1, cell-length: (1fr, 2fr, 2fr, 2fr)) = {
let n = cell-length.len()
let total = cell-length.sum()
let cell-fraction = cell-length.map(it => it/total)
let current-sum = 0
let nodes = (current-sum, )
for i in range(n) {
current-sum += cell-fraction.at(i)
nodes.push(current-sum*length - cell-fraction.at(i)*length/2)
nodes.push(current-sum*length)
}
return nodes
}
#let grid(i, j) = "grid."+str(i)+str(j)
#let node(point, body: "", anchor: "center", padding: 0.1em, content-radius: 0.3, name: "", hiden-stroke: none) = {
content(point, box(inset: 0.1em)[#body], anchor: anchor, name: "cir", padding: padding)
circle("cir", radius: content-radius, name: name, stroke: hiden-stroke)
}
#let vvline(grid-node1, grid-node2, anchor: "center", separation: 1%) = {
let (i1, j1) = grid-node1
let (i2, j2) = grid-node2
if i1>0 and i2>0 {
let p1 = (grid(i1, j1), separation/2, grid(i1 -1, j1))
let p2 = (grid(i2, j2), separation/2, grid(i2 -1, j2))
line(p1, p2)
let p1 = (grid(i1, j1), - separation/2, grid(i1 -1, j1))
let p2 = (grid(i2, j2), - separation/2, grid(i2 -1, j2))
line(p1, p2)
} else {
content((0, 0), "error")
}
}
#let anchor-grid(
table-width: 6,
table-height: 3,
cell-width: (0.6fr, 2fr, 2fr, 2fr),
cell-height: (2fr, 1fr, 1fr),
content-radius: 0.13,
hiden-stroke: none,
show-axis-tick: true,
stroke-style: black,
) = {
import cetz.draw: circle, rect, line, content, anchor, group
let x-pos = _get-node(length: table-width, cell-length: cell-width)
let y-pos = _get-node(length: table-height, cell-length: cell-height)
let n=x-pos.len() // {0, ...., 2 *num-cols}
let m=y-pos.len() // {0, ...., 2 *num-rows}
// ------- create anchors of grid
group(name: "grid", {
for i in range(n) {
for j in range(m) {
anchor(str(i)+str(j), (x-pos.at(i), y-pos.at(j)))
// show axis tick
let axis-tick-color = white
if show-axis-tick {
axis-tick-color = gray
}
if i==0 and j==0 {
content((x-pos.at(i), y-pos.at(j)), text(fill: axis-tick-color, size: 10pt, $0$), anchor: "north-east", padding: 0.05)
} else if i==0 {
content((x-pos.at(i), y-pos.at(j)), text(fill: axis-tick-color, size: 10pt, $#j$), anchor: "east", padding: 0.05)
} else if j==0 {
content((x-pos.at(i), y-pos.at(j)), text(fill: axis-tick-color, size: 10pt, $#i$), anchor: "north", padding: 0.05)
}
}
}
})
// ------- draw lines
line("grid.20", "grid.2"+str(m -1))
for k in range(m) {
if calc.even(k) {
line(grid(0, k), grid(n -1, k), stroke: stroke-style)
}
}
for h in range(n) {
if h in (0, 2, n - 1) {
line(grid(h, 0), grid(h, m -1), stroke: stroke-style)
} else if calc.even(h) {
// line(grid(h, 0), grid(h, m -1), stroke: hiden-stroke)
}
}
}
// ------- EXAMPLE
#canvas({
import cetz.draw: circle, rect, line, content, anchor, group
anchor-grid(
table-width: 16,
table-height: 4,
cell-width: (0.6fr, 2fr, 2fr, 2fr),
cell-height: (3fr, 1fr, 1fr),
show-axis-tick: true,
stroke-style: black,
)
node(grid(1, 5), body: $x$)
node(grid(2, 5), body: $-oo$, anchor: "west")
node(grid(4, 5), body: $-1$, anchor: "center")
node(grid(6, 5), body: $1$, anchor: "center")
node(grid(8, 5), body: $+oo$, anchor: "east")
node(grid(1, 3), body: $y'$)
node(grid(5, 3), body: $+$, anchor: "center")
node(grid(6, 3), body: $0$, anchor: "center")
node(grid(7, 3), body: $-$, anchor: "center")
node(grid(1, 1), body: $y$, anchor: "center")
node((grid(6, 0), 100%, grid(6,2)), body: $10$, name: "r2", anchor: "north-east", padding: 0.1)
node(grid(4, 0), body: $-oo$, name: "r1", anchor: "south-west")
node((grid(6, 0), 50%, grid(6,2)), body: $2$, name: "r3", anchor: "west", padding: 0.1)
node(grid(8, 0), body: $-oo$, name: "r4", anchor: "south-east")
rect(grid(2, 0), grid(4, 2), fill: pat, stroke: none)
rect(grid(2, 2), grid(4, 4), fill: pat, stroke: none)
vvline((6, 0), (6, 2), separation: 5%)
line("r1", "r2", mark: (end: ">"))
line("r3", "r4", mark: (end: ">"))
})
|
|
https://github.com/vncsb/desec-typst-template | https://raw.githubusercontent.com/vncsb/desec-typst-template/main/table-headers.typ | typst | #import "settings.typ": *
#let default-alignment = center + horizon
#let h-header(table-content) = {
set table(
align: default-alignment,
fill: (x, y) => if y == 0 {
highlight-fill-color
},
)
show table.cell: it => {
if it.y == 0 {
set text(white)
strong(it)
} else {
it
}
}
table-content
}
#let v-header(table-content) = {
set table(
align: default-alignment,
fill: (x, y) => if x == 0 {
highlight-fill-color
},
)
show table.cell: it => {
if it.x == 0 {
set text(white)
strong(it)
} else {
it
}
}
table-content
}
|
|
https://github.com/Myriad-Dreamin/tinymist | https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/docs/tinymist/type-system.typ | typst | Apache License 2.0 | #import "mod.typ": *
#show: book-page.with(title: "Tinymist Type System")
The underlying techniques are not easy to understand, but there are some links:
- bidirectional type checking: https://jaked.org/blog/2021-09-15-Reconstructing-TypeScript-part-1
- type system borrowed here: https://github.com/hkust-taco/mlscript
Some tricks are taken for help reducing the complexity of code:
First, the array literals are identified as tuple type, that each cell of the array has type individually.
#let sig = $sans("sig")$
#let ags = $sans("args")$
Second, the $sig$ and the $sans("argument")$ type are reused frequently.
- the $sans("tup")$ type is notated as $(tau_1,..,tau_n)$, and the $sans("arr")$ type is a special tuple type $sans("arr") ::= sans("arr")(tau)$.
- the $sans("rec")$ type is imported from #link("https://github.com/hkust-taco/mlscript")[mlscript], notated as ${a_1=tau_1,..,a_n=tau_n}$.
- the $sig$ type consists of:
- a positional argument list, in $sans("tup")$ type.
- a named argument list, in $sans("rec")$ type.
- an optional rest argument, in $sans("arr")$ type.
- an *optional* body, in any type.
notated as $sig := sig(sans("tup")(tau_1,..,tau_n),sans("rec")(a_1=tau_(n+1),..,a_m=tau_(n+m)),..sans("arr")(tau_(n+m+1))) arrow psi$
- the $sans("argument")$ is a $sans("signature")$ without rest and body.
$ags := ags(sig(..))$
With aboving constructors, we soonly get typst's type checker.
- it checks array or dictionary literals by converting them with a corresponding $sig$ and $ags$.
- it performs the getting element operation by calls a corresponding $sig$.
- the closure is converted into a typed lambda, in $sig$ type.
- the pattern destructing are converted to array and dictionary constrains.
|
https://github.com/tingerrr/chiral-thesis-fhe | https://raw.githubusercontent.com/tingerrr/chiral-thesis-fhe/main/src/core.typ | typst | #import "core/authors.typ"
#import "core/kinds.typ"
#import "core/component.typ"
#import "core/styles.typ"
#import "/src/utils.typ" as _utils
// TODO: lift this into a styling context kind of dictionary.
#let _fonts = (
// TODO: ncm seems to have issues with some symbols like list markers
// serif: "New Computer Modern",
serif: "Linux Libertine",
// TODO: provide ncms, this is currently not included
// #let sans = "New Computer Modern Sans"
sans: "Latin Modern Sans",
// TODO: provide and use mono font, if another one is expected
mono: "DejaVu Sans Mono",
)
#let _front-matter-anchor = <__ctf:marker:front-matter>
// TODO: arg validation
// TODO: provide good defaults
#let doc(
// kind: kinds.report(),
kind: (:),
draft: true,
abstracts: none,
bibliography: none,
outlines: (),
outlines-position: end,
outlines-force-empty: false,
glossary: none,
appendices: none,
acknowledgement: none,
affidavit: auto,
) = body => {
let meta = kind
let body = {
show: styles.content(_fonts: _fonts)
body
}
let outlines-pages = if outlines != none and outlines != () {
// TODO: the example document shows these all on their own page, but without rule revoking removing the heading pagebreak is extremely tedious
outlines.map(outline => {
component.make-outline(
force-empty: outlines-force-empty,
..outline,
)
}).join(pagebreak(weak: true))
}
show: styles.global(draft: draft, _fonts: _fonts)
show: styles.outline(_fonts: _fonts)
// TODO: propose this as the default gls supplement behavior or simply fork glossarium if there are more problems
// show: _utils._pkg.glossarium.make-glossary
show ref: it => {
let is-figure = it.element != none and it.element.func() == figure
if is-figure and it.element.kind == _utils._pkg.glossarium.__glossarium_figure {
let extra = if it.supplement == [s] {
(suffix: it.supplement)
} else if it.supplement not in (none, auto, []) {
(display: it.supplement)
}
_utils._pkg.glossarium.gls(str(it.target), ..extra)
} else {
it
}
}
component.make-title-page(..meta, _fonts: _fonts)
if abstracts != none {
abstracts.map(abstract => {
component.make-abstract(..abstract, _fonts: _fonts)
}).join(pagebreak(weak: true))
}
set page(
header: {
set text(8pt, font: _fonts.sans)
[Fachhochschule Erfurt]
h(1fr)
meta.field
v(-0.5em)
line(length: 100%, stroke: 0.5pt)
counter(footnote).update(0)
},
footer: context {
set align(if calc.even(here().page()) { left } else { right })
if page.numbering != none {
counter(page).display(page.numbering)
}
},
)
// TODO: make configurable
show: styles.table()
show: styles.raw(
theme: "/assets/themes/gruvbox-light.tmTheme",
_fonts: _fonts,
)
show: styles.math()
show: styles.figure(kinds: outlines.map(l => l.target), _fonts: _fonts)
show: styles.bibliography()
// NOTE: this must currently stay below the figure syles to ensure the fully realized level 1 headings start with their weak pagebreak.
show: styles.heading(_fonts: _fonts)
// start with roman numbering after the prelude
set page(numbering: "I")
counter(page).update(1)
component.make-table-of-contents(_fonts: _fonts)
if outlines-position == start {
outlines-pages
}
// an anchor to retreive the page number we left off with for later
_utils.marker(_front-matter-anchor)
// use arabic numbering
set page(numbering: "1")
counter(page).update(1)
body
// revert back to roman numbring, continuing where we left off
set page(numbering: "I")
context counter(page).update(counter(page).at(_front-matter-anchor).first() + 1)
// TODO: is there any need for specific handling like with the other struture elements? the if is currently redundant
if bibliography != none {
bibliography
}
if outlines-position == end {
outlines-pages
}
if glossary != none {
component.make-glossary(entries: glossary, _fonts: _fonts)
}
if appendices != none {
counter(heading).update(0)
_utils.state.appendix.update(true)
appendices.map(appendix => {
component.make-appendix(body: appendix)
}).join(pagebreak(weak: true))
_utils.state.appendix.update(false)
}
if kinds.is-thesis(meta.kind) and acknowledgement != none {
component.make-acknowledgement(body: acknowledgement)
}
if kinds.is-thesis(meta.kind) and affidavit != none {
component.make-affidavit(
title: meta.title,
author: meta.author,
date: meta.date,
body: affidavit,
kind: meta.kind,
)
}
}
|
|
https://github.com/dashuai009/dashuai009.github.io | https://raw.githubusercontent.com/dashuai009/dashuai009.github.io/main/src/content/blog/013.typ | typst | #let date = datetime(
year: 2023,
month: 5,
day: 14,
)
#metadata((
"title": "使用python爬取并分析疫情数据",
"author": "dashuai009",
description: "这是一种将C++更加现代的代码组织方式。 模块是一组源代码文件,独立于导入它们的翻译单元进行编译。",
pubDate: "'Jul 08 2022'",
subtitle: [python,疫情数据分析],
))<frontmatter>
#import "../__template/style.typ": conf
#show: conf
#outline()
= 数据获取
<数据获取>
选取#link("https://en.wikipedia.org/w/index.php?title=Template:COVID-19_pandemic_data")[wikipedia];上的疫情数据,总数据页如下
#figure(
image("013/data0.png"),
caption: [
总数据页
],
)
每个国家的数据都可以从表格中解析出来,例如United
States的详细数据的地址为
#link("https://en.wikipedia.org/wiki/COVID-19_pandemic_in_the_United_States")[Unitedd States];。
具体数据可以从下图中的表格解析:
#figure(
image("013/data1.png"),
caption: [
United States数据页
],
)
仔细分析之后我们可以写以下爬虫代码:
```python
import scrapy
from ..items import FordataItem
class mySpider(scrapy.spiders.Spider):
name = "forData"
def start_requests(self):
beginUrl= "https://en.wikipedia.org/w/index.php?title=Template:COVID-19_pandemic_data"
myHeader = {
'Content-Type': 'application/json',
'User-Agent':'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0'
}
#先爬出数据首页,找到有哪些国家
yield scrapy.Request(url=beginUrl,callback=self.parseCountryUrl,headers=myHeader)
```
```python
def parseCountryUrl(self,response):
cnt=0
for each in response.xpath('/html/body/div[3]/div[3]/div[5]/div[1]/div[4]/div[2]/table/tbody/tr'):
countryName=each.xpath('th[2]/a/text()').get()
countryUrl=each.xpath('th[2]/a/@href').extract()
if(countryName!=None and len(countryUrl)>0):
cnt=cnt+1
print(countryName,countryUrl)
countryDataUrl= "https://en.wikipedia.org"+countryUrl[0]
myHeader = {
'Content-Type': 'application/json',
'User-Agent':'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0'
}
yield scrapy.Request(url=countryDataUrl,headers=myHeader,callback=lambda response,name=countryName:self.parseCountryCase(response,name))
#再分别爬取每个国家的数据
print(cnt)
def parseCountryCase(self,response,name):
ct=0
for tr in response.css('tr.mw-collapsible'):
item=FordataItem()
item['country']=name
item['date']=tr.xpath('td[1]/text()').get()
item['cases']=tr.xpath('td[3]/span[1]/text()').get()
item['deaths']=tr.xpath('td[4]/span[1]/text()').get()
#解析出每个国家的名字、日期、病例、死亡数
if('2020' in item['date']):
ct=ct+1
yield(item)
if(ct==0):
print("没有单日数据的的国家:",name)
```
数据前几行如下:
#figure(
image("013/data2.png", width: 90%),
caption: [
疫情数据
],
)
另外,这个网页上并没有人口总数的数据可以从#link("https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population");上继续爬取。
#figure(
image("013/data3.png", width: 90%),
caption: [
国家人口对应表的数据来源
],
)
可以写出如下爬虫
```python
import scrapy
from ..items import ForpopulationItem
class mySpider(scrapy.spiders.Spider):
name = "forPopulation"
def start_requests(self):
beginUrl= "https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population"
myHeader = {
'Content-Type': 'application/json',
'User-Agent':'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0'
}
#网页请求
yield scrapy.Request(url=beginUrl,callback=self.parsePopulation,headers=myHeader)
def parsePopulation(self,response):
for tr in response.xpath('/html/body/div[3]/div[3]/div[5]/div[1]/table/tbody/tr'):
#数据解析
item=ForpopulationItem()
item['country']=tr.xpath('td[1]/a/text()').get()
item['population']=tr.xpath('td[2]/text()').get()
if(item['country'] and item['population']):
item['population'].replace(',','')
print(item)
yield item
```
爬取结果如下
#figure(
image("013/data4.png", width: 90%),
caption: [
国家人口对应表
],
)
= 数据分析和展示
<数据分析和展示>
== 数据读入和清洗
<数据读入和清洗>
从前面爬取的数据文件`myData.csv`和`population.csv`中读取数据。
对于疫情数据,将空值填充为0,只保留日起在`2020-11-30`到`2020-12-15`之间的数据。
将病例数`cases`和`deaths`格式转换为`int64`。 根据`country`和`date`
进行去重。
```python
import pandas
import numpy
import matplotlib
import matplotlib.pyplot as plt
from brokenaxes import brokenaxes
import seaborn
org=pandas.read_csv('myData.csv')
org=org.fillna('0')
org['cases']=org['cases'].str.replace('\D+','').astype(int)
org['deaths']=org['deaths'].str.replace('\D+','').astype(int)
org=org[org['date']<'2020-12-16']
org=org[org['date']>'2020-11-29']
org.drop_duplicates(subset = ['country','date'],keep='first',inplace=True)
myData=org
population=pandas.read_csv('population.csv')
population['population']=population['population'].str.replace('\D+','').astype(int)
print("收集到的",len(myData['country'].value_counts(dropna=False)),"个国家的数据")
```
收集到的 135 个国家的数据
```python
## 15天中,全球新冠疫情的总体变化趋势
####################################
#a) 15 天中,全球新冠疫情的总体变化趋势#
####################################
print("\n\n====15 天中,全球新冠疫情的总体变化趋势======")
#这十六天内的全球累计病例
totalCase=[0]*16
#这16天内的全球死亡累计病例
totalDeaths=[0]*16
#December表示日期,用字符串存储,方便图例生成
December=['']*16
#根据国家进行分组,全球数量=个国家数量之和,计算累计病例和死亡病例
casesSumByDay=myData.pivot_table(index='date',values=['cases'],aggfunc=sum)
deathsSumByDay=myData.pivot_table(index='date',values=['deaths'],aggfunc=sum)
December[0]='2020-11-30'
totalCase[0]=casesSumByDay.loc['2020-11-30']['cases']
totalDeaths[0]=deathsSumByDay.loc['2020-11-30']['deaths']
for i in range(1,16):
December[i]='2020-12-'+('0' if i<10 else '')+str(i)
totalCase[i]=casesSumByDay.loc[December[i]]['cases']
totalDeaths[i]=deathsSumByDay.loc[December[i]]['deaths']
print("11-30到12-15感染病例:",totalCase)
print("11-30到12-15死亡病例:",totalDeaths)
# matplotlib绘图显示中文
plt.rcParams["font.family"]="SimHei"
#画图部分
mycolors = ['tab:red', 'tab:blue']
fig, ax = plt.subplots(1,1,figsize=(16, 9), dpi= 300)
x = December
y = numpy.vstack([totalDeaths,totalCase])
labs=['累积死亡数','累积感染病例']
ax = plt.gca()
ax.stackplot(x, y, labels=labs, colors=mycolors, alpha=0.8)
plt.title("15 天中,全球新冠疫情的总体变化趋势")
ax.legend(fontsize=10, ncol=4)
plt.xticks(rotation=30,fontsize=10) # 这里是调节横坐标的倾斜度
plt.gca().spines["top"].set_alpha(0)
plt.gca().spines["bottom"].set_alpha(.3)
plt.gca().spines["right"].set_alpha(0)
plt.gca().spines["left"].set_alpha(.3)
plt.savefig('a.png')
```
```text
====15 天中,全球新冠疫情的总体变化趋势======
11-30到12-15感染病例: [58806605, 59867806, 59924956, 60557860, 61163129, 59527002, 60033395, 62585050, 62008006, 63602677, 65008985, 65672468, 63968990, 64505434, 67261669, 68293227]
11-30到12-15死亡病例: [1471087, 1492594, 1494629, 1506452, 1517510, 1475608, 1482627, 1541590, 1516612, 1564328, 1576069, 1588076, 1541701, 1549901, 1611817, 1633944]
```
#figure(
image("013/a.png", width: 100%),
caption: [
15 天中,全球新冠疫情的总体变化趋势
],
)
== 累计确诊数排名前 20 的国家名称及其数量
<累计确诊数排名前-20-的国家名称及其数量>
```python
####################################################
#b) 累计确诊数排名前 20 的国家名称及其数量; #
####################################################
print("\n\n=======累计确诊数排名前 20 的国家名称及其数量=========")
#总的累计数量只需要看最后一天的数量
casesMaxByCountry=myData.pivot_table(index='country',values=['cases'],aggfunc=max)
casesMaxByCountry=casesMaxByCountry.sort_values('cases', ascending=False)
print(casesMaxByCountry.head(20))
```
输出结果:
```text
=======累计确诊数排名前 20 的国家名称及其数量=========
cases
country
United States 16022297
India 9906165
Brazil 6970034
Russia 2707945
France 2391447
Turkey 1898447
United Kingdom 1888116
Italy 1870576
Spain 1762212
Argentina 1510186
Colombia 1444646
Germany 1351510
Mexico 1267202
Poland 1147446
Iran 1123474
Peru 987675
Ukraine 919704
South Africa 873679
Indonesia 629429
Netherlands 628577
```
== 15 天中,每日新增确诊数累计排名前 10 个国家的每日新增确诊数据的曲线图
<天中每日新增确诊数累计排名前-10-个国家的每日新增确诊数据的曲线图>
```python
##########################################################################
#c)15 天中,每日新增确诊数累计排名前 10 个国家的每日新增确诊数据的曲线图; #
##########################################################################
mycolors=['tab:blue','tab:orange','tab:green','tab:red','tab:purple','tab:brown','tab:pink','tab:gray','tab:olive','tab:cyan']
plt.clf()
#每个国家的12-1之前的累计数量
casesMinByCountry=myData.pivot_table(index='country',values=['cases'],aggfunc=min)
#每个国家12-1到12-15的新增数量
decCaseMaxByCountry=(casesMaxByCountry-casesMinByCountry).sort_values('cases', ascending=False)
cnt=0
countryCName=[]
figC=[0]*10
for index,row in decCaseMaxByCountry.iterrows():
cnt=cnt+1
countryCName.append(index)
yi=myData[myData['country']==index]['cases'].tolist()
for j in range(15,0,-1):#得到每日变化数据
yi[j]=yi[j]-yi[j-1]
figC[cnt-1],=plt.plot(December[1:],yi[1:],color=mycolors[cnt-1],linewidth=2.0,linestyle='-.')
if(cnt>=10):#只保留前十个国家
break
plt.title("每日新增确诊排名前 10 的国家的数据曲线图")
plt.legend(handles=figC,labels=countryCName)
plt.savefig('c.png')
```
#figure(
image("013/c.png", width: 100%),
caption: [
每日新增确诊排名前 10 的国家的数据曲线图
],
)
== 累计确诊人数占国家总人口比例最高的 10 个国家
<累计确诊人数占国家总人口比例最高的-10-个国家>
```python
################################################
#d) 累计确诊人数占国家总人口比例最高的 10 个国家 #
################################################
print("\n\n=====累计确诊人数占国家总人口比例最高的 10 个国家======")
#这会用到populaton.csv的数据
#累计确诊比例
casesRatio=[]
for index,row in casesMaxByCountry.iterrows():
tmp=population[population['country']==index]['population']
if(len(tmp)>0):#这里需要注意没有人口数据的国家
casesRatio.append({'casesRatio':row['cases']/tmp.iloc[0],'name':index})
#升序排序取最后10个
casesRatio.sort(key=lambda x:x['casesRatio'])
for i in casesRatio[-1:-10:-1]:
print(i)
```
结果如下:
```text
=====累计确诊人数占国家总人口比例最高的 10 个国家======
{'casesRatio': 0.09561146718594844, 'name': 'Andorra'}
{'casesRatio': 0.06748037079864816, 'name': 'Luxembourg'}
{'casesRatio': 0.05548972112860494, 'name': 'Czech Republic'}
{'casesRatio': 0.05271911310260917, 'name': 'Belgium'}
{'casesRatio': 0.05243676244828293, 'name': 'Georgia'}
{'casesRatio': 0.05198869490976536, 'name': 'Qatar'}
{'casesRatio': 0.04872524937150579, 'name': 'Moldova'}
{'casesRatio': 0.04842282774074547, 'name': 'United States'}
{'casesRatio': 0.046797668330376366, 'name': 'Slovenia'}
```
== 死亡率(累计死亡人数/累计确诊人数)最低的 10 个国家
<死亡率累计死亡人数累计确诊人数最低的-10-个国家>
```python
#########################################################
#e) 死亡率(累计死亡人数/累计确诊人数)最低的 10 个国家; #
#########################################################
print("\n\n====死亡率(累计死亡人数/累计确诊人数)最低的 10 个国家=======")
#每个国家死亡人数
deathsMaxByCountry=myData.pivot_table(index='country',values=['deaths'],aggfunc=max)
#每个国家的死亡率
deathsRatio=deathsMaxByCountry.rename(columns={'deaths':'deathsRatio'})
deathsRatio=deathsRatio/casesMaxByCountry.rename(columns={'cases':'deathsRatio'})
print((deathsRatio.sort_values('deathsRatio')).head(10))
```
结果如下:
```text
====死亡率(累计死亡人数/累计确诊人数)最低的 10 个国家=======
deathsRatio
country
Seychelles 0.000000
Guyana 0.000000
Saint Lucia 0.000000
Faroe Islands 0.000000
Saint Kitts and Nevis 0.000000
Falkland Islands 0.000000
Brunei 0.000000
Dominica 0.000000
Saint Vincent and The Grenadines 0.000000
Singapore 0.000497
```
== 用饼图展示各个国家的累计确诊人数的比例
<用饼图展示各个国家的累计确诊人数的比例>
```python
########################################
#f) 用饼图展示各个国家的累计确诊人数的比例#
########################################
print("\n\n=====各个国家的累计确诊人数的比例=======")
#把占比最大的几个国家列出来,直到这些国家占比超过75%,其他国家表示为other
cnt=0
figData=[]
for index,row in casesMaxByCountry.iterrows():
cnt=cnt+row['cases']
if cnt/totalCase[15]>0.75:
break
figData.append((index,row['cases']))
figData.append(('others',(totalCase[15]-cnt)))
#输出一下具体数据
print(figData)
#画图部分
plt.clf()
fig, ax = plt.subplots(figsize=(10, 5), ncols=2,dpi=300)
ax1, ax2 = ax.ravel()
patches, texts = ax1.pie(dict(figData).values(),
shadow=True,startangle=90,
labels=[ str(country)+','+str('%.2lf'%(tot*100/totalCase[15]))+'%' for country, tot in figData])
ax1.set_title('各个国家的累计确诊人数的比例')
ax2.axis('off')
ax2.legend(patches, [i for i,j in figData], loc='center left')
plt.tight_layout()
plt.savefig('f.png')
```
#figure(
image("013/f.png", width: 100%),
caption: [
各个国家的累计确诊人数的比例
],
)
```text
=====各个国家的累计确诊人数的比例=======
[('United States', 16022297), ('India', 9906165), ('Brazil', 6970034), ('Russia', 2707945), ('France', 2391447), ('Turkey', 1898447), ('United Kingdom', 1888116), ('Italy', 1870576), ('Spain', 1762212), ('Argentina', 1510186), ('Colombia', 1444646), ('Germany', 1351510), ('Mexico', 1267202), ('others', 16154998)]
```
== 展示全球各个国家累计确诊人数的箱型图,有平均值
<展示全球各个国家累计确诊人数的箱型图有平均值>
```python
################################################
#g) 展示全球各个国家累计确诊人数的箱型图,要有平均值#
################################################
print("\n\n=====全球各个国家累计确诊人数的箱型图=====")
plt.clf()
fig, ax = plt.subplots(figsize=(5, 10),dpi=300)
#图中的黄点是平均数据值
seaborn.stripplot(y='cases',data={'cases':[totalCase[15]/135]}, color="orange", size=2.5)
seaborn.boxplot(data=casesMaxByCountry,linewidth=0.3,fliersize=1)
plt.title("全球各个国家累计确诊人数的箱型图")
plt.savefig('g.png')
```
#figure(
image("013/g.png", width: 70%),
caption: [
全球各个国家累计确诊人数的箱型图
],
)
== 另外一些数据
<另外一些数据>
```python
15日新增确诊占累积确诊病例最小的20个国家
########################################
# 15日新增确诊占累积确诊病例最小的20个国家#
########################################
minRatio=(decCaseMaxByCountry/casesMaxByCountry).sort_values('cases')
print(minRatio.head(20))
```
```
cases
country
Comoros 0.000000
Singapore 0.002108
Australia 0.005099
Malawi 0.008553
Isle of Man 0.010724
Suriname 0.012823
Brunei 0.013158
Guernsey 0.013746
Sierra Leone 0.015912
Qatar 0.017265
Ivory Coast 0.017774
New Zealand 0.019084
Bolivia 0.020363
Nepal 0.022645
Benin 0.024272
Peru 0.024370
São Tomé and Príncipe 0.024752
Maldives 0.026706
Kuwait 0.027776
Iceland 0.029580
```
= 全世界应对新冠疫情最好的10个国家
<全世界应对新冠疫情最好的10个国家>
注意:爬取的数据没有包含中国的数据。
显而易见的,感染人数过多(大于一百万)的国家应对疫情肯定不是最好的。
感染人数较少(小于100)也不需要考虑,这可能疫情并没有爆发,只是几个境外输入病例。
我们只考虑疫情严重的几个国家。这之后按照人口递减排序,取前10个。
```python
#####################
#最好的10个国家 #
#####################
print("\n\n======应对疫情最好的10个国家========")
good=[]
for index,rows in casesMaxByCountry.iterrows():
tmp=population[population['country']==index]['population']
if((100<rows['cases']<1000000) and len(tmp)>0):
good.append({'population':tmp.iloc[0],'name':index})
good.sort(key=lambda x:-x['population'])
for i in range(10):
print(good[i]['name'])
```
```
======应对疫情最好的10个国家========
Indonesia
Pakistan
Nigeria
Japan
Philippines
Ethiopia
Egypt
Vietnam
South Africa
Myanmar
```
= 预测分析
<预测分析>
== 预测方法
<预测方法>
采用线性回归的方法进行预测。
新冠疫情存在一定的趋势,但目前数据比较少(只有10天),可以假设不存在季节性。
这样,可以采用`线性回归`的方法进行预测。
== 预测程序
<预测程序>
```python
###################################
# 预测分析 #
###################################
from sklearn import linear_model
regr = linear_model.LinearRegression()
# 拟合
regr.fit(numpy.array([i for i in range(10)]).reshape(-1, 1), totalCase[1:11])
# 得到直线的斜率、截距
a, b = regr.coef_, regr.intercept_
# 给出待预测日期
predictDate = numpy.array([i for i in range(10,16)]).reshape(-1,1)
#输出一下预测值
print(regr.predict(predictDate))
#画图部分
plt.clf()
fig, ax = plt.subplots(figsize=(16, 10),dpi=300)
plt.scatter(December, totalCase, color='blue')
plt.plot(December[1:], regr.predict(numpy.array([i for i in range(15)]).reshape(-1,1)), color='red', linewidth=4)
plt.savefig('i.png')
```
```text
======预测分析========
[64229138.06666667 64738456.51515152 65247774.96363637 65757093.41212121
66266411.86060607 66775730.30909091]
```
== 结果以及分析
<结果以及分析>
#figure(
image("013/i.png"),
caption: [
预测分析
],
)
最后五天的数据拟合程度较好。
对于短期的数据,线性回归应该是较好的一种预测方法。
然而,再实际问题中,还需要考虑各种影响因素。
比如,各个国家政策的调整,病毒的变异等等。
= 代码网址
<代码网址>
#link("https://paste.ubuntu.com/p/KkGVZwhg7N/")[code]
|
|
https://github.com/ClazyChen/Table-Tennis-Rankings | https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history_CN/2015/MS-10.typ | typst |
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (1 - 32)",
table(
columns: 4,
[排名], [运动员], [国家/地区], [积分],
[1], [马龙], [CHN], [3593],
[2], [许昕], [CHN], [3367],
[3], [樊振东], [CHN], [3294],
[4], [张继科], [CHN], [3258],
[5], [方博], [CHN], [3180],
[6], [水谷隼], [JPN], [3173],
[7], [#text(gray, "王皓")], [CHN], [3147],
[8], [闫安], [CHN], [3124],
[9], [迪米特里 奥恰洛夫], [GER], [3087],
[10], [庄智渊], [TPE], [3011],
[11], [黄镇廷], [HKG], [2996],
[12], [吉村真晴], [JPN], [2996],
[13], [朱世赫], [KOR], [2992],
[14], [马克斯 弗雷塔斯], [POR], [2986],
[15], [弗拉基米尔 萨姆索诺夫], [BLR], [2975],
[16], [蒂姆 波尔], [GER], [2975],
[17], [唐鹏], [HKG], [2964],
[18], [高宁], [SGP], [2939],
[19], [于子洋], [CHN], [2932],
[20], [周雨], [CHN], [2922],
[21], [郑荣植], [KOR], [2905],
[22], [陈卫星], [AUT], [2899],
[23], [丹羽孝希], [JPN], [2899],
[24], [梁靖崑], [CHN], [2888],
[25], [大岛祐哉], [JPN], [2884],
[26], [帕特里克 弗朗西斯卡], [GER], [2870],
[27], [KOU Lei], [UKR], [2854],
[28], [徐晨皓], [CHN], [2844],
[29], [安德烈 加奇尼], [CRO], [2842],
[30], [李尚洙], [KOR], [2839],
[31], [帕纳吉奥迪斯 吉奥尼斯], [GRE], [2838],
[32], [GERELL Par], [SWE], [2837],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (33 - 64)",
table(
columns: 4,
[排名], [运动员], [国家/地区], [积分],
[33], [帕特里克 鲍姆], [GER], [2834],
[34], [森园政崇], [JPN], [2831],
[35], [MATTENET Adrien], [FRA], [2830],
[36], [卢文 菲鲁斯], [GER], [2827],
[37], [西蒙 高兹], [FRA], [2826],
[38], [吉田海伟], [JPN], [2825],
[39], [塩野真人], [JPN], [2819],
[40], [利亚姆 皮切福德], [ENG], [2813],
[41], [斯特凡 菲格尔], [AUT], [2809],
[42], [<NAME>], [ENG], [2803],
[43], [松平健太], [JPN], [2803],
[44], [李廷佑], [KOR], [2800],
[45], [KIM Donghyun], [KOR], [2787],
[46], [奥马尔 阿萨尔], [EGY], [2786],
[47], [江天一], [HKG], [2780],
[48], [张禹珍], [KOR], [2777],
[49], [<NAME>], [AUT], [2777],
[50], [尚坤], [CHN], [2774],
[51], [LI Hu], [SGP], [2772],
[52], [CHEN Feng], [SGP], [2772],
[53], [MONTEIRO Joao], [POR], [2771],
[54], [LI Ping], [QAT], [2767],
[55], [#text(gray, "LIU Yi")], [CHN], [2763],
[56], [村松雄斗], [JPN], [2763],
[57], [SHIBAEV Alexander], [RUS], [2754],
[58], [GERALDO Joao], [POR], [2754],
[59], [蒂亚戈 阿波罗尼亚], [POR], [2745],
[60], [罗伯特 加尔多斯], [AUT], [2744],
[61], [雨果 卡尔德拉诺], [BRA], [2743],
[62], [沙拉特 卡马尔 阿昌塔], [IND], [2742],
[63], [汪洋], [SVK], [2739],
[64], [周恺], [CHN], [2733],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (65 - 96)",
table(
columns: 4,
[排名], [运动员], [国家/地区], [积分],
[65], [林高远], [CHN], [2722],
[66], [周启豪], [CHN], [2722],
[67], [丁祥恩], [KOR], [2722],
[68], [夸德里 阿鲁纳], [NGR], [2717],
[69], [HE Zhiwen], [ESP], [2717],
[70], [MACHI Asuka], [JPN], [2717],
[71], [VLASOV Grigory], [RUS], [2716],
[72], [王臻], [CAN], [2716],
[73], [HO Kwan Kit], [HKG], [2716],
[74], [GORAK Daniel], [POL], [2716],
[75], [巴斯蒂安 斯蒂格], [GER], [2712],
[76], [克里斯坦 卡尔松], [SWE], [2709],
[77], [朴申赫], [PRK], [2709],
[78], [OUAICHE Stephane], [ALG], [2709],
[79], [HACHARD Antoine], [FRA], [2708],
[80], [TSUBOI Gustavo], [BRA], [2701],
[81], [博扬 托基奇], [SLO], [2698],
[82], [尼马 阿拉米安], [IRI], [2698],
[83], [金珉锡], [KOR], [2697],
[84], [KARAKASEVIC Aleksandar], [SRB], [2691],
[85], [PROKOPCOV Dmitrij], [CZE], [2690],
[86], [陈建安], [TPE], [2689],
[87], [吉田雅己], [JPN], [2683],
[88], [上田仁], [JPN], [2682],
[89], [SZOCS Hunor], [ROU], [2680],
[90], [吴尚垠], [KOR], [2679],
[91], [PERSSON Jon], [SWE], [2676],
[92], [马蒂亚斯 法尔克], [SWE], [2674],
[93], [HIELSCHER Lars], [GER], [2667],
[94], [#text(gray, "KIM Hyok Bong")], [PRK], [2664],
[95], [ELOI Damien], [FRA], [2663],
[96], [乔纳森 格罗斯], [DEN], [2660],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (97 - 128)",
table(
columns: 4,
[排名], [运动员], [国家/地区], [积分],
[97], [斯蒂芬 门格尔], [GER], [2659],
[98], [艾曼纽 莱贝松], [FRA], [2658],
[99], [KANG Dongsoo], [KOR], [2657],
[100], [MATSUDAIRA Kenji], [JPN], [2654],
[101], [#text(gray, "约尔根 佩尔森")], [SWE], [2652],
[102], [BOBOCICA Mihai], [ITA], [2651],
[103], [#text(gray, "KIM Nam Chol")], [PRK], [2646],
[104], [WU Zhikang], [SGP], [2646],
[105], [#text(gray, "张一博")], [JPN], [2645],
[106], [PATTANTYUS Adam], [HUN], [2642],
[107], [赵胜敏], [KOR], [2639],
[108], [CIOTI Constantin], [ROU], [2639],
[109], [ZHAI Yujia], [DEN], [2638],
[110], [及川瑞基], [JPN], [2638],
[111], [维尔纳 施拉格], [AUT], [2637],
[112], [KIM Minhyeok], [KOR], [2632],
[113], [薛飞], [CHN], [2631],
[114], [SEO Hyundeok], [KOR], [2630],
[115], [SAKAI Asuka], [JPN], [2629],
[116], [安东 卡尔伯格], [SWE], [2627],
[117], [ROBINOT Alexandre], [FRA], [2625],
[118], [特里斯坦 弗洛雷], [FRA], [2623],
[119], [TAN Ruiwu], [CRO], [2622],
[120], [LIVENTSOV Alexey], [RUS], [2620],
[121], [<NAME>], [RUS], [2619],
[122], [米凯尔 梅兹], [DEN], [2618],
[123], [CHOE Il], [PRK], [2618],
[124], [<NAME>yi], [POL], [2617],
[125], [#text(gray, "OYA Hidetoshi")], [JPN], [2616],
[126], [雅克布 迪亚斯], [POL], [2616],
[127], [CHO Eonrae], [KOR], [2613],
[128], [TAKAKIWA Taku], [JPN], [2611],
)
) |
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/grid-5_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test that trailing linebreak doesn't overflow the region.
#set page(height: 2cm)
#grid[
Hello \
Hello \
Hello \
World
]
|
https://github.com/polazarus/typst-svg-emoji | https://raw.githubusercontent.com/polazarus/typst-svg-emoji/main/example.typ | typst | MIT License | //#import "@local/svg-emoji:0.1.0": setup-emoji, noto, github
#import "./lib.typ": setup-emoji, noto, github
#show: set text(20pt)
#show: setup-emoji.with(font: noto)
= Typst with working emoji! 🎉🎊
== Alignment tests
M😢X🚢M
== Complex emojis
👱♀️ `U+1F471 U+200D U+2640 U+FE0F`
⚛️ `U+269B U+FE0F`
== Github naming
```typst #github.at("+1")``` #github.at("+1")
```typst #github.wink``` #github.wink
== Builtin emoji
```typst #emoji.camel``` #emoji.camel
```typst #emoji.rocket``` #emoji.rocket |
https://github.com/francescoo22/masters-thesis | https://raw.githubusercontent.com/francescoo22/masters-thesis/main/vars/rules/statements.typ | typst | #import "../../config/proof-tree.typ": *
#import "../../config/utils.typ": *
// ****************** Statements typing rules ******************
#let Decl = prooftree(
axiom($x in.not Delta$),
rule(label: "Decl", $mid(var x), x : top$),
)
#let Assign-Null = prooftree(
axiom($Delta(p) = alpha beta$),
axiom($Delta[p |-> unique] = Delta'$),
rule(n:2, label: "Assign-Null", $mid(p = null)'$),
)
// TODO: in the case where the lhs is borrowed, should we require std?
#let Assign-Unique = {
let a0 = $p' subset.sq.eq.not p$
let a1 = $Delta(p) = alpha beta$
let a2 = $Delta(p') = unique$
let a3 = $Delta tr sp(p') = p'.overline(f_0) : alpha_0 beta_0, ..., p'.overline(f_n) : alpha_n beta_n$
let a4 = $Delta[p' |-> top] = Delta_1$
let a5 = $Delta_1[p |-> unique] = Delta'$
prooftree(
stacked-axiom(
(a0, a1, a2, a4),
(a3, a5)
),
rule(label: "Assign-Unique", $mid(p = p')', p.overline(f_0) : alpha_0 beta_0, ..., p.overline(f_n) : alpha_n beta_n$),
)
}
#let Assign-Shared = {
let a0 = $p' subset.sq.eq.not p$
let a1 = $Delta(p) = alpha$
let a2 = $Delta(p') = shared$
let a3 = $Delta tr sp(p') = p'.overline(f_0) : alpha_0 beta_0, ..., p'.overline(f_n) : alpha_n beta_n$
let a4 = $Delta[p |-> shared] = Delta'$
prooftree(
stacked-axiom(
(a0, a1, a2),
(a3, a4),
),
rule(label: "Assign-Shared", $mid(p = p')', p.overline(f_0) : alpha_0 beta_0, ..., p.overline(f_n) : alpha_n beta_n$),
)
}
#let Assign-Borrowed-Field = {
let a0 = $p'.f subset.sq.eq.not p$
let a1 = $Delta(p) = alpha beta$
let a2 = $Delta(p'.f) = alpha' borrowed$
let a3 = $alpha' != top$
let a4 = $(beta = borrowed) => (alpha' = unique)$
let a5 = $Delta[p'.f |-> top] = Delta_1$
let a6 = $Delta tr sp(p'.f) = p'.f.overline(f_0) : alpha_0 beta_0, ..., p'.f.overline(f_n) : alpha_n beta_n$
let a7 = $Delta_1[p |-> alpha'] = Delta'$
prooftree(
stacked-axiom(
(a0, a1, a2), (a3, a4, a5), (a6, a7)
),
rule(
label: $"Assign-"borrowed"-Field"$,
$mid(p = p'.f)', p.overline(f_0) : alpha_0 beta_0, ..., p.overline(f_n) : alpha_n beta_n$
)
)
}
#let Begin = prooftree(
axiom($mtype(m) = alpha_0 beta_0, ..., alpha_n beta_n -> alpha$),
axiom($args(m) = x_0, ..., x_n$),
rule(n:2, label: "Begin", $dot tr begin_m tl x_0 : alpha_0 beta_0, ..., x_n : alpha_n beta_n$),
)
#let Seq-New = prooftree(
axiom($Delta tr s_1 tl Delta_1$),
axiom($Delta_1 tr s_2 tl Delta'$),
rule(n:2, label: "Seq", $mid(s_1 \; s_2)'$)
)
#let If = {
let a1 = $Delta(p_1) != top$
let a2 = $Delta(p_2) != top$
let a3 = $Delta tr s_1 tl Delta_1$
let a4 = $Delta tr s_2 tl Delta_2$
let a5 = $unify(Delta, Delta_1, Delta_2) = Delta'$
prooftree(
stacked-axiom((a1, a2), (a3, a4, a5)),
rule(label: "If", $mid(fi p_1 == p_2 then s_1 els s_2)'$),
)
}
#let Assign-Call = {
let a1 = $Delta(p) = alpha' beta'$
let a2 = $Delta tr m(overline(p)) tl Delta_1$
let a3 = $mtype(m) = alpha_0 beta_0, ..., alpha_n beta_n -> alpha$
let a4 = $(beta' = borrowed) => (alpha = unique)$
let a5 = $Delta_1[p |-> alpha] = Delta'$
prooftree(
stacked-axiom((a1, a2), (a3,), (a4, a5)),
rule(label: "Assign-Call", $mid(p = m(overline(p)))'$)
)
}
#let Call = {
let a0 = $forall 0 <= i <= n : Delta(p_i) = alpha_i beta_i$
let a1 = $mtype(m) = alpha_0^m, beta_0^m, ..., alpha_n^m beta_n^m -> alpha_r$
let a2 = $forall 0 <= i <= n : Delta tr std(p_i, alpha_i^m beta_i^m)$
let a3 = $forall 0 <= i, j <= n : (i != j and p_i = p_j) => alpha_i^m = shared$
let a4 = $forall 0 <= i, j <= n : p_i subset.sq p_j => (Delta(p_j) = shared or alpha_i^m = alpha_j^m = shared)$
// Note: If we have more permissions than std, by passing to borrowed we should be able to keep those permissions. Anyway this is probably going to be false in the future so it's ok to keep it as it is
let a5 = $Delta minus.circle (p_0, ..., p_n) = Delta'$
let a6 = $forall 0 <= i <= n : alpha_i beta_i ~> alpha_i^m beta_i^m ~> alpha'_i beta'_i$
let a7 = $norm(p_0 : alpha'_0 beta'_0, ..., p_n : alpha'_n beta'_n) = p'_0 : alpha''_0 beta''_0, ..., p'_m : alpha''_m beta''_m$
prooftree(
stacked-axiom(
(a0,), (a1,), (a2,), (a3,), (a4,), (a5, a6), (a7,)
),
rule(label: "Call", $mid(m(p_0, ..., p_n))', p'_0 : alpha''_0 beta''_0, ..., p'_m : alpha''_m beta''_m$)
)
}
#let Return-p = {
let a1 = $mtype(m) = alpha_0^m, beta_0^m, ..., alpha_n^m beta_n^m -> alpha_r$
let a2 = $Delta(p) = alpha beta$
let a3 = $alpha beta rel alpha_r$
let a4 = $Delta tr std(p, alpha_r)$
let a5 = $forall 0 <= i, j <= n : (alpha_i beta_i != unique) => Delta tr std(p_i, alpha_i beta_i)$
prooftree(
stacked-axiom(
(a1, a2, a3),
(a4, a5)
),
rule(label: "Return-p", $Delta tr ret_m space p tl dot$),
)
}
#let U-Fun = prooftree(
axiom($mid(s)'$),
axiom($unify(Delta, Delta, Delta') = Delta_1$),
rule(n:2, label: "", $u_s (Delta) = Delta_1$)
) |
|
https://github.com/AnsgarLichter/cv-typst | https://raw.githubusercontent.com/AnsgarLichter/cv-typst/main/modules/skills.typ | typst | #import "../settings/styles.typ": *
#let renderSkills(skills: ()) = {
for skill in skills {
box(
rect(
stroke: skillsStyle.stroke,
radius: skillsStyle.radius,
skill
)
)
h(skillsStyle.margins.betweenSkillTags)
}
} |
|
https://github.com/Area-53-Robotics/53B-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53B-Notebook-Over-Under-2023-2024/master/README.md | markdown | Creative Commons Attribution Share Alike 4.0 International | # 53B-Over-Under-Notebook
53B's Over Under Notebook
### Experimenting with Typst:
https://typst.app/
### Compile With:
`$ typst compile notebook.typ`
### Thank you Felix for Assistance
|
https://github.com/not-matthias/typst-jku | https://raw.githubusercontent.com/not-matthias/typst-jku/main/main.typ | typst | /*
Based of the work of <NAME>, Mai 2023
Continued by <NAME>, October 2024
*/
#import "jku.typ": *
#import "utils.typ": show_endnotes, note
#show: coverpage.with( //What is what, see jku.typ
title: "<Your Title>",
submitters: ("<Your name>",),
department: "<JKU Department>",
supervisors: ("<Supervisor name>",), //When no Co-Supervisor is present, you MUST keep the comma or Typst will not interpret this as an array
date: "<date>",
typeOfWork: -1,
state: 0,
version: "<Nr>",
degree: "<Degree>",
study: "<Study>"
)
#show "OTMEvolver": text(font: font.sans, hyphenate: false)[OTM#super([Evolver])]
#let zusammenfassung = include "content/preface/zusammenfassung.typ"
#let abstract = include "content/preface/abstract.typ"
#show: preface.with(
zusammenfassung: zusammenfassung,
abstract: abstract,
)
#show: mainContent.with(
//page-margin: (x: 4cm, y: 5cm),
)
#show link: set text(fill: blue, hyphenate: true)
#show cite: it => text(fill: blue, style: "normal", it)
#show ref: it => text(weight: "medium", style: "italic", it)
#heading(supplement: "Chapter")[Content] <chap-content-label>
#include "content/01-introduction.typ"
#pagebreak()
#show bibliography: set text(size: 8pt)
#show link: it => box(clip: true, it)
#bibliography("bibliograhpy.bib")
#show_endnotes()
#counter(heading.where(level: 1)).update(it => 0) // workaround for header
#counter(heading).update(0)
#pagebreak(weak: true)
#set heading(numbering: "A.1.")
#set page(flipped: false) //To go in landscape mode, set to true if needed for attachments
#heading("Attachments") <attachments>
#include "content/attachment-a.typ"
|
|
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/grundpositionen/grundfragen.typ | typst | Other | #import "/src/template.typ": *
== Grundfragen Philosophiedidaktik
#orange-list-with-body(parred: false)[*#ix("Legitimationsfrage"):*][
(Wie) ist der Philosophieunterricht zu rechtfertigen? Warum sollte man philosophieren dürfen oder sogar müssen?
#ix("Martens", "<NAME>") antwortet auf die Frage wie folgt: Der Philosophieunterricht vermittelt Kompetenzen, die SuS zu autonomen und mündigen Personen machen. Damit soll er den SuS helfen, Teil des modernen wissenschaftlich-technischen Diskurses zu werden. Philosophieunterricht ermöglicht es erst, statt autoritären Vorgaben nachzugehen, selbst zu denken.#en[Vgl. @Martens2003_MethodenPU[S. 34 ff]]
][*#ix("Wesensfrage"):*][
Was macht Philosophie und Philosophieunterricht aus?
Es stellen sich daraus ebenfalls Fragen wie: Welche Kompetenzen sollen erlangt werden? Dürfen Kompetenzen unterrichtet werden? Versteht man die Philosophie als #ix("esoterisch", "Selbstverständnis, esoterisch"), so könnte man zu dem Schluss kommen, dass die Philosophie in der Schule nicht stattfinden kann und somit dieser nur als eine mögliche Vorbereitung für universitäre Einrichtungen gesehen werden kann. Dementsprechend ist das Ziel des Philosophieunterrichts diesem Ziel anzugleichen.
][*#ix("Inhaltsfrage"):*][
Was soll unterrichtet werden? Was macht der Philosophieunterricht zu seinem Gegenstand? Wie kann man diesen Gegenstand rechtfertigen?
Unter diese Frage fällt unter anderem die #ix("Lassahn-Deppe-Kontroverse"): Wie viel Einfluss dürfen die SuS auf den Inhalt des Philosophieunterrichts haben? Wie viel der traditionellen philosophischen Positionen soll unterrichtet werden? Auch dieser Punkt ist eng an die #ix("Wesensfrage") und das #ix("Selbstverständnis der Philosophie") gekoppelt. Ein #ix("pädagogisch-politisches Selbstverständnis", "Selbstverständnis, pädagogisch-politisch") wählt eventuell andere Schwerpunkte aus anderen Gründen wählen als mit dem #ix("esoterischem Selbstverständnis", "Selbstverständnis, esoterisch").
][*#ix("Methodenfrage"):*][
Mit welchen Methoden soll der Philosophieunterricht stattfinden?
Siehe hierzu auch die #ix("Rehfus-Martens-Kontroverse", "<NAME>", "<NAME>."), #ix("Lassahn-Deppe-Kontroverse", "<NAME>", "<NAME>") und die #ix("Tiedemann-Gefert-Kontroverse"). Darunter fallen Fragen wie: Sind Methoden, die von symbolisch-präsentativer Natur sind, gerechtfertigt? Darf Philosophie nur diskursiv stattfinden? Welche Rolle hat der Dialog oder das Gedankenexperiment?
] |
https://github.com/xdoardo/co-thesis | https://raw.githubusercontent.com/xdoardo/co-thesis/master/thesis/chapters/recursive/index.typ | typst | = Recursive datatypes and proofs<chapter-recursive>
All throughout this work we make use of the mathematical technique called
_coinduction_. It is far from easy to come up with an intuitive and contained
explaination for this technique, as coinduction is a pervasive topic in
computer science and mathematics and can be explained with different flavours
and intuitions: in category theory as coalgebras, in automata theory and formal
languages as a tool to compare infinite languages and automata execution, in
real analysis as greatest fixed points, in computer science as infinite
datatypes and corecursion and much more.
We examine this last possibility, as our use of coinduction is "limited" to
coinductive datatypes and proofs by corecursion. We begin introducing induction
both as a mathematical tool and in computer science, in particular in Agda. We
then move to coinduction and its mathematical intepretation; we conclude this
chapter with an explaination of how recursive definitions are handled in proof
assistants such as Agda.
#include "co-induction.typ"
#include "agda.typ"
|
|
https://github.com/diogro/memorial | https://raw.githubusercontent.com/diogro/memorial/master/IB-USP-2024/certificados.typ | typst | #set page(
header:[
#set text(9pt, font: "Skolar PE TEST", weight: "regular")
Anexos
#h(1fr) <NAME>
]
)
#align(left + top, text(20pt, font: "Droid Sans")[
*Anexo - Documentos comprobatorios*
])
#pagebreak()
#figure(
image("../bolsas/princeton.svg",width: 6in),
caption: [Comprovante de bolsa de Pós-Doutorado.],
supplement: [Documento],
) <fig-princeton>
#figure(
image("../bolsas/outorga_postdoc.svg",width: 6in),
caption: [Termo de outorga da bolsa de Pós-Doutorado.],
supplement: [Documento],
) <fig-outorga_postdoc>
#figure(
image("../documentos/diploma_doc.svg",width: 6in),
caption: [Diploma de Doutorado.],
supplement: [Documento],
) <fig-diploma_doc>
#figure(
image("../bolsas/outorga_doc.svg",width: 6in),
caption: [Termo de outorga da bolsa de Doutorado.],
supplement: [Documento],
) <fig-outorga_doc>
#figure(
image("../certificados/report_bath.svg",width: 6in),
caption: [Certificado de Estágio no Exterior.],
supplement: [Documento],
) <fig-bath_letter>
#figure(
image("../bolsas/outorga_BEPE.svg",width: 6in),
caption: [Termo de outorga da bolsa de estagio no exterior.],
supplement: [Documento],
) <fig-outorga_BEPE>
#figure(
image("../documentos/diploma_mest.svg",width: 6in),
caption: [Diploma de Mestrado.],
supplement: [Documento],
) <fig-diploma_mest>
#figure(
image("../bolsas/outorga_mest.svg",width: 6in),
caption: [Termo de outorga da bolsa de Mestrado.],
supplement: [Documento],
) <fig-outorga_mest>
#figure(
image("../documentos/diploma_bio.svg",width: 6in),
caption: [Diploma de Curso de Ciências Biológicas.],
supplement: [Documento],
) <fig-diploma_bio>
#figure(
image("../documentos/diploma_ccm_a4.svg",width: 6in),
caption: [Diploma de Curso de Ciências Moleculares.],
supplement: [Documento],
) <fig-diploma_ccm>
// #figure(
// image("../bolsas/outorga_TT4.svg",width: 6in),
// caption: [Termo de outorga da bolsa de treinamento técnico nível 4.],
// supplement: [Documento],
// ) <fig-outorga_TT4>
// #figure(
// image("../bolsas/outorga_TT3.svg",width: 6in),
// caption: [Termo de outorga da bolsa de treinamento técnico nível 3.],
// supplement: [Documento],
// ) <fig-outorga_TT3>
#figure(
image("../artigos/SBM.png",width: 6in),
caption: [Artigo _pre-print_: #cite(<Melo2023-ij>, form: "full").],
supplement: [Documento],
) <fig-SBM>
#figure(
image("../artigos/eQTL.png",width: 6in),
caption: [Artigo _pre-print_: #cite(<Pallares2023-eh>, form: "full").],
supplement: [Documento],
) <fig-eQTL>
#figure(
image("../artigos/Focal.png",width: 6in),
caption: [Artigo _pre-print_: #cite(<Wolf2023-bb>, form: "full").],
supplement: [Documento],
) <fig-FocalSNP>
#figure(
image("../artigos/expvar.svg",width: 6in),
caption: [Artigo: #cite(<Wolf2023-zw>, form: "full").],
supplement: [Documento],
) <fig-exp_var>
#figure(
image("../artigos/Ontogeny.svg",width: 6in),
caption: [Artigo: #cite(<Hubbe2022-xb>, form: "full").],
supplement: [Documento],
) <fig-ontogenia>
#figure(
image("../artigos/Cats.svg",width: 6in),
caption: [Artigo: #cite(<Fukimoto2020-oy>, form: "full").],
supplement: [Documento],
) <fig-cats>
#figure(
image("../artigos/Genomic_Perspective.svg",width: 6in),
caption: [Artigo: #cite(<Melo2019-le>, form: "full").],
supplement: [Documento],
) <fig-qtls>
#figure(
image("../artigos/Integration.svg",width: 6in),
caption: [Artigo: #cite(<Machado2019-af>, form: "full").],
supplement: [Documento],
) <fig-Integration>
#figure(
image("../artigos/ratones.svg",width: 6in),
caption: [Artigo: #cite(<Penna2017-if>, form: "full").],
supplement: [Documento],
) <fig-ratones>
#figure(
image("../artigos/Insights_from_Systems_Biology.svg",width: 6in),
caption: [Artigo: #cite(<Imenez_Silva2017-ic>, form: "full").],
supplement: [Documento],
) <fig-sysbio>
#figure(
image("../artigos/Modularity_Genes.svg",width: 6in),
caption: [Artigo: #cite(<Melo2016-yw>, form: "full").],
supplement: [Documento],
) <fig-Modularity_Genes>
#figure(
image("../artigos/Costly.svg",width: 6in),
caption: [Artigo: #cite(<Costa2016-mv>, form: "full").],
supplement: [Documento],
) <fig-Costly>
#figure(
image("../artigos/Xenarthra.svg",width: 6in),
caption: [Artigo: #cite(<Hubbe2016-za>, form: "full").],
supplement: [Documento],
) <fig-Xenarthra>
#figure(
image("../artigos/evolqg.svg",width: 6in),
caption: [Artigo: #cite(<Melo2015-kf>, form: "full").],
supplement: [Documento],
) <fig-evolqg>
#figure(
image("../artigos/Fitness_Trade-offs.svg",width: 6in),
caption: [Artigo: #cite(<Wolf2015-es>, form: "full").],
supplement: [Documento],
) <fig-dicty>
#figure(
image("../artigos/DirectionalSelection.svg",width: 6in),
caption: [Artigo: #cite(<Melo2015-bk>, form: "full").],
supplement: [Documento],
) <fig-DirectionalSelection>
#figure(
image("../artigos/Noise.svg",width: 6in),
caption: [Artigo: #cite(<Marroig2012-jd>, form: "full").],
supplement: [Documento],
) <fig-Noise>
#figure(
image("../artigos/SRD.svg",width: 6in),
caption: [Artigo: #cite(<Marroig2011-mg>, form: "full").],
supplement: [Documento],
) <fig-SRD>
#figure(
image("../artigos/OQYAAE.svg",width: 6in),
caption: [Capitulo de Livro: #cite(<Melo2019-wz>, form: "full").],
supplement: [Documento],
) <fig-cap_oqya>
#figure(
image("../artigos/Modularity_and_Integration.svg",width: 6in),
caption: [Capitulo de Livro: #cite(<Assis2016-wr>, form: "full").],
supplement: [Documento],
) <fig-cap_mod>
#figure(
image("../certificados/SMBE2023.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-smbe2023>
#figure(
image("../certificados/GRC2023.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-GRC2023>
#figure(
image("../certificados/EvolutionMontpellier.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-evol2018>
#figure(
image("../certificados/EED2016.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-evodevo>
#figure(
image("../certificados/certificate-evolution2015-lightningTalk.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-evol2015L>
#figure(
image("../certificados/certificate-evolution2015-poster.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-evol2015P>
#figure(
image("../certificados/Scan-140107-0009.svg",width: 6in),
caption: [Certificado de apresentação em Congresso.],
supplement: [Documento],
) <fig-sims>
#figure(
image("../certificados/EEB330.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-EEB330>
#figure(
image("../certificados/serrapilheira1.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-serrapilheira1>
#figure(
image("../certificados/serrapilheira2.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-serrapilheira2>
#figure(
image("../certificados/escrita_cientifica.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-escrita>
#figure(
image("../certificados/Certificado_Diogo_Melo_BE.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-BE>
#figure(
image("../certificados/modularidade.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-modularidade>
#figure(
image("../certificados/Chamada_workshop_2017.svg",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-mcmc>
#figure(
image("../certificados/c15.png",width: 6in),
caption: [Certificado de curso ministrado.],
supplement: [Documento],
) <fig-io>
#figure(
image("../certificados/teaching_princeton.svg",width: 6in),
caption: [Certificado de monitoria e de curso ministrado.],
supplement: [Documento],
) <fig-genomics>
#figure(
image("../certificados/bioevol.svg",width: 6in),
caption: [Certificado de monitoria.],
supplement: [Documento],
) <fig-bioevol>
#figure(
image("../certificados/certificados_R.svg",width: 6in),
caption: [Certificado de monitoria.],
supplement: [Documento],
) <fig-R>
#figure(
image("../certificados/SSSMB.svg",width: 6in),
caption: [Certificado de monitoria em curso de extensão.],
supplement: [Documento],
) <fig-SSSMB>
#figure(
image("../certificados/curso_de_campo.svg",width: 6in),
caption: [Certificado de monitoria em disciplina de pós-graduação.],
supplement: [Documento],
) <fig-campo>
#figure(
image("../certificados//Scan-140107-0011.svg",width: 6in),
caption: [Certificado de monitoria PAE em disciplina de graduação.],
supplement: [Documento],
) <fig-pae>
#show bibliography: none
#bibliography("memorial.bib",
style: "apa",
title: "Referências")
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.