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/027%20-%20Conspiracy%3A%20Take%20the%20Crown/006_Leovold's%20Dossiers.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Leovold's Dossiers", set_name: "Conspiracy: Take the Crown", story_date: datetime(day: 24, month: 08, year: 2016), author: "<NAME>", doc ) #emph[In these uncertain times in Paliano, information is as valuable as any treasure, and no one knows that better than Ambassador Leovold of Trest. He will exchange what he has collected with the right people, for the right price.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) = Marchesa's Ascent Party planning takes time. Why, the last time we held an event at the embassy, I spent a week doing nothing but negotiating with interior designers and patissiers to ensure that our decorative emblems were correct and complementary shades of blue. The queen claims that Brago left a will naming her his heir, which is laughable enough (I don't mean to disparage the spectrally advanced, but #emph[estate planning] rarely enters into their concerns), but let's talk about the true proof of her deception—on the #emph[very day] that she announces her ascension, the throne room is immediately decorated in Black Rose tapestries, the guards all have Black Rose emblems on their shields, there are Black Rose flags flying over the capital. The citizens are openly wondering how she managed to convince the Custodi to legitimize her crowning, but I just want to know how she managed to commission this much embroidery from every seamstress and tailor in the city without anyone noticing. #figure(image("006_Leovold's Dossiers/01.jpg", width: 100%), caption: [Art by Titus Lunter], supplement: none, numbering: none) Now to the matter of Brago's death. (Second death? Additional death? I didn't know we needed a term for this, but apparently we do.) My access to the new queen's court has been limited, but the best picture I can piece together from rumor and innuendo is as follows: an assassin infiltrated the palace, by some accounts walking through stone walls, in order to reach Brago's chambers. Exactly how you kill (permanently kill? Extra kill? I'm going to task a writer to come up with a term for this, or it will drive me mad) a ghost remains unknown, but visitors to court say that the new queen's crown seems to glow with the same spectral energy that used to be associated with the visage of Brago himself. #figure(image("006_Leovold's Dossiers/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) More information will be forthcoming once my associate can re-establish lines of communication with this new monarch. Forgive the cliché, but we must reach out carefully, as this rose is defined not by her petals but by her thorns. Leovold #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) = Selvala of Alberon A delightful young woman whose taste in hats is beyond compare, Selvala has twice been brought into conflict with the city she tries so very earnestly to love. She drafted the Charter alongside Brago (back when he was several notches more alive than today) and guided it through ratification. Her thanks came in the form of betrayal and imprisonment. She retreated to the hinterlands, only to be drawn into the city's affairs once more as the nobles of Paliano took to using exotic beasts as replacements for Muzzio's artificial servants. I spoke to Selvala at a riverside cafe and extended our hand in friendship—did you know that she still has cousins in Trest with whom she corresponds regularly? (A summary of those correspondences has been made available through the State Security Act, and are available for review.) We spoke at length of her current predicament—the newly minted queen will not entertain Selvala's presence in court, and she has little interest in allying with Captain Adriana, due to the latter's indifference to issues that she holds dear. #figure(image("006_Leovold's Dossiers/03.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) I suggested that perhaps Paliano had been ruled by humans and their ghosts for too long, and that it might be time for someone capable who truly cared about harmonious rule to assume a caretaker role. She replied with a look that I know well: ambition, not for its own sake, but to right a greater wrong...with just a touch of anger to fan the flames. Before we parted, I made it clear that her cousins back in Trest would be extremely interested in supporting her in any of her future endeavors, whatever they might be. Leovold #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) = Captain <NAME> (Ret.) I spend a great deal of time observing the young people of Paliano; their behaviors are as endearing to me as they are baffling. Among the colleges of the elites and the markets and guilds of the lower classes, the mating rituals of human youth are on open display. Oh, such delightful dramas unfold! Perhaps the most common tragedy, and the one most often put onto the stage, is the tale of unrequited love. Alas, poor Adriana. Her love for the city is firm and unyielding, yet when Brago's end came, the city showed that it has, in fact, no love for her. She has only narrowly survived the queen's ascension, and, bold as she is, I believe she can continue to rely on unannounced visits from the queen's emissaries until one of them proves successful in persuading her to join her king. Before that end comes, however, she seems to have her heart set on causing as much unrest in the name of righteousness as possible. I reached out to her via messenger, but the messenger returned with a broken nose and a completely ruined shirt. The nose will heal, but alas, I believe there is nothing to be done for the shirt. #figure(image("006_Leovold's Dossiers/04.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) It remains to be seen precisely what sort of stage production this will be. Will our noble heroine win over the object of her affections and usher in a new age of peace, equality, and prosperity? Or will her hopeless egalitarian utopia prove as ephemeral as the king she once served? Were I a betting elf (and I assure you, I am not), I would wager on the latter. Regardless, we have a front-row seat to this dramatic production, and further missives will be available at the intermission. Leovold #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #strong[Her Majesty Queen Marchesa, the Black Rose, first of her name, head of the council, guarantor of lawful governance, sole sovereign of the High City, true heir to the throne of Paliano and all the rights and privileges thereof] #strong[Aliases: The Black Rose, Marchesa d'Amati] There are two types of hunting beasts, in my experience. The first exists for the thrill of the chase and exults in service. You'll see these creatures chasing carriages or loping after horses, and hear their joyous roar in the air. The beast is no threat to the carriage or the horse. The creature simply loves to run. Then there are others. You wouldn't be able to tell them apart during the hunt, as they are both filled with pride and fulfillment as they chase their prey. The difference is one of purpose. The second kind tracks and kills because it was meant to do so; any playfulness or happy expression is coincidence or show. The beast hunts because it was created for this purpose. Today, perhaps, it kills what its master bids, but in the absence of all else, #emph[it would still kill] . Marchesa is a creature of the second kind. I do not blame my predecessor for missing the signs. The carefully cultivated persona, the genteel "mother of assassins" role that she played for years, all of it seemed to be pointing toward a specific ambition: to exert control and influence from the shadows. In retrospect, the entire persona was a distraction. The throne was always her target. Always. In the streets, some call her usurper. I've heard scoffing references to her "power grab" in the void left by Brago, but her intent is not just to seize power. She intends to rule. #figure(image("006_Leovold's Dossiers/05.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Within hours of taking the throne, there have been proclamations and policies, clearly drafted weeks and months before. All are aimed to consolidate her power, gain the nervous acceptance of the populace, and legitimize her rule—if her edicts are obeyed, then how can she not be queen? The next weeks and months will be crucial. The entire coup could unravel given the right nudge, but at the same time, a nudge from other parties could help consolidate her power. I have made an official outreach on Trest's behalf. You will be updated posthaste with Her Majesty's reply. Leovold #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) = Grenzo, Warden of the Royal Dungeons I love goblins. I know what you're thinking, but it's true! A goblin, by his nature, helps us understand ourselves. A goblin is everything we are not: aggressive, savage, uncouth, and loud. When a goblin truly embraces his nature, and becomes the pinnacle of what he is capable of, I cannot help but find him endearing. This would be the case with Grenzo, if I were not somewhat concerned that he and his rabble will murder me in the night alongside everyone I hold dear. #figure(image("006_Leovold's Dossiers/06.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Grenzo was content to be part of the machinery of Paliano; he had maneuvered himself into a position by which he could control vast swaths of the underworld. By serving as warden for Brago's prisons and commanding the unwavering loyalty of a network of bondsmen, bounty hunters, and criminal gangs, he was a powerful force in the city who never needed to dirty his hands. (This is a figure of speech only; his hands were, I assume, filthy all of the time.) In the absence of Brago's patronage (and it is entirely unclear what the inciting event was that led the former king to tolerate and encourage Grenzo's operations), Grenzo has adopted a different tactic, one that simultaneously surprises me more and less than the ones he has employed before—open rebellion. He incites mobs to violence, not directed at the new queen per se, but at the idea of the city itself. He has twice now taken advantage of large gatherings assembled by Captain Adriana, infiltrating them, turning a peaceful demonstration into a violent mob. His goals are now completely opaque to me—he is certainly not establishing himself in a position of power, unless you consider attempting to bring about the downfall of #emph[all ] positions of power a means to that end. #figure(image("006_Leovold's Dossiers/07.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Is this anarchy an actual political philosophy? I would like to give Grenzo the benefit of the doubt on this, as I have become fond of him over the years. Perhaps he actually mourns the loss of his king, and expresses it through rage? Doubtful, but I can't rule it out. Perhaps this chaos is at the new queen's behest? It seems out of character with her favorite sort of games. Or perhaps he is simply reverting to his baser instincts. Smashing and burning for the sheer glory of the sounds of broken glass, the dancing lights of the flames. Regardless, I have instructed my diplomatic staff to stay clear of any large gatherings, as the streets are more volatile than I have ever seen. Leovold #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #emph[Note] : #emph[Last week, one of my diplomatic attachés interrupted a dead drop from one of the new queen's agents—imagine my surprise and delight when I discovered that the contents were nothing other than a dossier on yours truly! I take every word contained herein as a sincere compliment.] = Ambassador Leovold of Trest To Her Majesty Queen Marchesa, the Black Rose, first of her name, head of the council, guarantor of lawful governance, sole sovereign of the High City, true heir to the throne of Paliano and all the rights and privileges thereof Per your instruction, I have gathered the following information regarding the recently appointed ambassador from the city-state of Trest. He has been making his presence known in the city by hosting elaborate parties, banquets, and other displays with the express intent of "cultural exchange." #figure(image("006_Leovold's Dossiers/08.jpg", width: 100%), caption: [Art by <NAME>yon], supplement: none, numbering: none) The Trestians seem to struggle with our cultural norms, and opt for a display of wealth and supposed refinement, but attendees to these events describe them as gaudy and gauche. As the elves of Trest tend toward the primitive and backward, this is no surprise. Leovold himself seems content to play the part of obsequious host and court jester, with his grand gestures and bold proclamations of friendship. It seems clear that he is trying to ingratiate himself with the nobility and commonfolk alike, with some success—the Trestian delegation is generally welcome in polite society as well as among the lower classes. The embassy does retain a small armed contingent of guards; given the size of the embassy staff, this is unsurprising, and while the guards seem well-trained, they are certainly not on any sort of aggressive footing, seemingly happy to wonder at the sights and sounds of the greatest city in Fiora. #figure(image("006_Leovold's Dossiers/09.jpg", width: 100%), caption: [Art by <NAME>umbo], supplement: none, numbering: none) Now, there have been some rumors of members of the Trestian delegation being associated with minor diplomatic incidents—suspicion of being involved in espionage and the like. There are two potential explanations for these reports. Either Leovold and his attaches are engaged in highly sophisticated spying efforts against the state, or members of his delegation are simply prone to nosing around and occasional petty theft. I think the latter to be the much more likely explanation, but I admit, I cannot entirely rule out the former. I will continue to monitor the Ambassador's movements, but given our current situation, I do not recommend devoting too many resources to doing so. We have much more pressing matters at hand. <NAME>, Thorn of the Queen #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) = The Curtain Rises What a time to be alive in Paliano! The pieces are all in place, the lights are lit, and the game is about to begin. All eyes are on the queen, of course, as she gears up to confront the renegade Captain Adriana. The city guard has been largely thrown over in favor of troops loyal only to Marchesa, but these are elevated spies and assassins, not a group trained in keeping order—most of them look as if they would be more comfortable holding a short blade in a dark alley, rather than sitting high atop a horse, covered in mail. The former guards? Some were imprisoned, but the prisons are a sieve! Grenzo has no desire to help the queen keep order, and he has largely abdicated his post. Adriana has managed to stage some rather daring rescues to bring her former guards to her side—there was a particular prison break that involved a domesticated hydra, a wagon full of meat pies, and a trio of infiltrators dressed quite unconvincingly as washerwomen, but I digress. Captain Adriana claims to fight for the city, as if it were some sort of personified ideal. A delightfully poetic concept, but her tactics are more in the physical realm. Demonstrations too large to be peaceably put down. Coordinated strikes against some of the queen's former holdings. And speeches. Let's just say that the dear woman does not shy away from the sound of her own voice. But while all eyes are on this main event, the hinterlands are abuzz with activity as well. Some, including the illustrious and storied Selvala, are looking to take advantage of the unrest to strike against the indolence and excess of the nobility, who are being so brazenly courted by the new queen. Others wonder what has happened to the remnants of the now-disbanded Academy. Most of its former masters remain in the city, retreating to private workshops (some of which more closely resemble small fortresses) whose lights are lit every night, shadows cast against the walls, until dawn's light dispels them. In all, we sit atop a hill of kindling, as children run with torches in the streets. Contingencies are in place to take action in any of several directions, or we can simply keep our heads down and court favor with the victors. I await further instructions with a capable and steady hand. Yours, <NAME>
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/multiline_07.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test single trailing line break. $ "abc" &= c \ $ One trailing line break.
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/README.md
markdown
# printed_materials Typst-based documentation and other printed materials for Protohaven. This monorepo holds all of the sources and supporting material to produce printed, paginated documentation for Protohaven. ## Repositories ### admin-code_of_conduct/ This repo is mainly used as an inclusion for the member guide; we may want this content to live elsewhere. ### admin-member_guide/ Member guide edit (WIP) ### class-handouts/ Printable class materials for Protohaven students. ### class-instructor_notes/ This is highly likely going to be elsewhere (does not necessarily need to be a paginated document) ### common-graphics/ Common graphics used across all document sets: branding imagery, etc. ### common-policy/ Inclusions used across the entire document set. ### environments/ Configuration files for the document set, ### events-handouts/ Printables: flyers, etc. ### events-setup_notes/ Might be valuable as printed documentation (physical artifacts are useful in the field)? This may want to live elsewhere. ### extra_resources/ Anything else that's valuable for the authors of this document set, and we want to keep track of it. ### reference/ Reference materials used across the entire document set: data tables and other structured data.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-AA80.typ
typst
Apache License 2.0
#let data = ( ("TAI VIET LETTER LOW KO", "Lo", 0), ("TAI VIET LETTER HIGH KO", "Lo", 0), ("TAI VIET LETTER LOW KHO", "Lo", 0), ("TAI VIET LETTER HIGH KHO", "Lo", 0), ("TAI VIET LETTER LOW KHHO", "Lo", 0), ("TAI VIET LETTER HIGH KHHO", "Lo", 0), ("TAI VIET LETTER LOW GO", "Lo", 0), ("TAI VIET LETTER HIGH GO", "Lo", 0), ("TAI VIET LETTER LOW NGO", "Lo", 0), ("TAI VIET LETTER HIGH NGO", "Lo", 0), ("TAI VIET LETTER LOW CO", "Lo", 0), ("TAI VIET LETTER HIGH CO", "Lo", 0), ("TAI VIET LETTER LOW CHO", "Lo", 0), ("TAI VIET LETTER HIGH CHO", "Lo", 0), ("TAI VIET LETTER LOW SO", "Lo", 0), ("TAI VIET LETTER HIGH SO", "Lo", 0), ("TAI VIET LETTER LOW NYO", "Lo", 0), ("TAI VIET LETTER HIGH NYO", "Lo", 0), ("TAI VIET LETTER LOW DO", "Lo", 0), ("TAI VIET LETTER HIGH DO", "Lo", 0), ("TAI VIET LETTER LOW TO", "Lo", 0), ("TAI VIET LETTER HIGH TO", "Lo", 0), ("TAI VIET LETTER LOW THO", "Lo", 0), ("TAI VIET LETTER HIGH THO", "Lo", 0), ("TAI VIET LETTER LOW NO", "Lo", 0), ("TAI VIET LETTER HIGH NO", "Lo", 0), ("TAI VIET LETTER LOW BO", "Lo", 0), ("TAI VIET LETTER HIGH BO", "Lo", 0), ("TAI VIET LETTER LOW PO", "Lo", 0), ("TAI VIET LETTER HIGH PO", "Lo", 0), ("TAI VIET LETTER LOW PHO", "Lo", 0), ("TAI VIET LETTER HIGH PHO", "Lo", 0), ("TAI VIET LETTER LOW FO", "Lo", 0), ("TAI VIET LETTER HIGH FO", "Lo", 0), ("TAI VIET LETTER LOW MO", "Lo", 0), ("TAI VIET LETTER HIGH MO", "Lo", 0), ("TAI VIET LETTER LOW YO", "Lo", 0), ("TAI VIET LETTER HIGH YO", "Lo", 0), ("TAI VIET LETTER LOW RO", "Lo", 0), ("TAI VIET LETTER HIGH RO", "Lo", 0), ("TAI VIET LETTER LOW LO", "Lo", 0), ("TAI VIET LETTER HIGH LO", "Lo", 0), ("TAI VIET LETTER LOW VO", "Lo", 0), ("TAI VIET LETTER HIGH VO", "Lo", 0), ("TAI VIET LETTER LOW HO", "Lo", 0), ("TAI VIET LETTER HIGH HO", "Lo", 0), ("TAI VIET LETTER LOW O", "Lo", 0), ("TAI VIET LETTER HIGH O", "Lo", 0), ("TAI VIET MAI KANG", "Mn", 230), ("TAI VIET VOWEL AA", "Lo", 0), ("TAI VIET VOWEL I", "Mn", 230), ("TAI VIET VOWEL UE", "Mn", 230), ("TAI VIET VOWEL U", "Mn", 220), ("TAI VIET VOWEL E", "Lo", 0), ("TAI VIET VOWEL O", "Lo", 0), ("TAI VIET MAI KHIT", "Mn", 230), ("TAI VIET VOWEL IA", "Mn", 230), ("TAI VIET VOWEL UEA", "Lo", 0), ("TAI VIET VOWEL UA", "Lo", 0), ("TAI VIET VOWEL AUE", "Lo", 0), ("TAI VIET VOWEL AY", "Lo", 0), ("TAI VIET VOWEL AN", "Lo", 0), ("TAI VIET VOWEL AM", "Mn", 230), ("TAI VIET TONE MAI EK", "Mn", 230), ("TAI VIET TONE MAI NUENG", "Lo", 0), ("TAI VIET TONE MAI THO", "Mn", 230), ("TAI VIET TONE MAI SONG", "Lo", 0), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ("TAI VIET SYMBOL KON", "Lo", 0), ("TAI VIET SYMBOL NUENG", "Lo", 0), ("TAI VIET SYMBOL SAM", "Lm", 0), ("TAI VIET SYMBOL HO HOI", "Po", 0), ("TAI VIET SYMBOL KOI KOI", "Po", 0), )
https://github.com/indicatelovelace/typstTemplates
https://raw.githubusercontent.com/indicatelovelace/typstTemplates/main/README.md
markdown
MIT License
# typstTemplates Awesome Typst Templates. ## DHBW Use at your own risk. This template is unoffical. For the DHBW Ravensburg Template, look in themes and copy the whole folder. Then follow the instructions listed [here][https://github.com/typst/packages/?tab=readme-ov-file#local-packages].
https://github.com/benjamineeckh/kul-typst-template
https://raw.githubusercontent.com/benjamineeckh/kul-typst-template/main/src/core/component/preface.typ
typst
MIT License
#let insert-preface(preface, authors, lang:"en") = { // preface if preface != none { heading( level: 1, numbering: none, outlined: true, if lang == "en" { "Preface" } else { "Voorwoord" } ) block[#sym.zws#label("start-of-preamble")] v(-1em) preface align(right)[_ #authors.map(v=>v.name).join("\n") _] pagebreak(weak: true) }else{ let t = if lang == "nl"{ "PLAATSHOUDER VOOR VOORWOORD" }else{ "PLACEHOLDER FOR PREFACE" } text(purple, size:3em)[#t] set text(red) lorem(200) pagebreak(weak: true) } }
https://github.com/Ngan-Ngoc-Dang-Nguyen/thesis
https://raw.githubusercontent.com/Ngan-Ngoc-Dang-Nguyen/thesis/main/docs/reverse.typ
typst
#include "../tools/multi-section-ref.typ" #import "../tools/macros.typ": eqref #include "../tools/multi-section-ref.typ" #import "../tools/macros.typ": eqref #import "../typst-orange.typ": theorem, proof, lemma, proposition, corollary, example #import "@preview/cetz:0.1.2": canvas, plot #import "@preview/cetz:0.1.2" #include "../tools/multi-section-ref.typ" #import "../tools/macros.typ": eqref #import "../typst-orange.typ": theorem, proof, lemma, proposition, corollary, example #include "../tools/multi-section-ref.typ" #import "../tools/macros.typ": eqref #import "../typst-orange.typ": theorem, proof == BÀI TOÁN REVERSE 1-MEDIAN TRÊN CÂY Trong phạm vi luận văn này, chúng ta sẽ tập trung vào bài toán reverse cơ bản, một chủ đề được nghiên cứu rộng rãi và có nhiều ứng dụng thực tiễn mạnh mẽ. Tuy nhiên, để phù hợp với mục tiêu của luận văn, chúng ta chỉ trình bày mô hình đơn giản nhất của bài toán. Một ví dụ thực tế của bài toán reverse có thể thấy trong lĩnh vực quy hoạch đô thị. Giả sử nhà nước đã xác định một vị trí quan trọng, chẳng hạn như một trường học, để phục vụ cho cộng đồng dân cư. Tuy nhiên, do các yếu tố khách quan như sự gia tăng lưu lượng giao thông, việc di chuyển từ các khu dân cư khác đến vị trí này trở nên khó khăn hơn. Mục tiêu của nhà nước là điều chỉnh quy hoạch (chẳng hạn như cải thiện đường giao thông hoặc thậm chí tái phân bố dân cư) nhằm tối ưu hóa việc di chuyển từ các khu dân cư đến vị trí quan trọng này. Đây là một ví dụ cơ bản cho bài toán reverse 1-median trên cây. === Định nghĩa và giải thuật Cho đồ thị cây $T = (V, E)$ gồm $n$ đỉnh, mỗi đỉnh $i, i = 1,...,n$ được gán một trọng số không âm $w_i$ và mỗi cạnh có một độ dài không âm. Xét một đỉnh $v' in V$ bất kỳ. Gọi $delta_i$ là lượng điều chỉnh trọng số của đỉnh $i$, với điều kiện $delta_i <= u_i$, trong đó $u_i$ là giới hạn điều chỉnh của đỉnh $i$. Chi phí để điều chỉnh trọng số của đỉnh $i$ một lượng $delta_i$ được ký hiệu là $c_i(delta_i)$. Mục tiêu của bài toán reverse 1-median trên cây là tìm cách điều chỉnh trọng số của các đỉnh sao cho hàm $f(v')$ đạt giá trị nhỏ nhất. Đồng thời, quá trình điều chỉnh phải tuân theo các ràng buộc về ngân sách tổng chi phí và giới hạn điều chỉnh tại mỗi đỉnh. Ta có thể viết lại bài toán như sau: $ min_(v in V) sum_(i=1)^n (w_i - delta_i) d(v_i,v') \ "s.t." sum_(i=1)^n c_i delta_i <= B \ 0 <= delta_i <= u_i \ $ <eq:41> Để giải bài toán #eqref(<eq:41>), ta có thể chuyển về giải bài toán sau: $ max sum_(i=1)^n delta_i d(v_i,v') \ "s.t." sum_(i=1)^n c_i delta_i <= B \ 0 <= delta_i <= u_i \ $ <eq:42> Rõ ràng, mô hình bài toán #eqref(<eq:42>) tương ứng với bài toán xếp ba lô liên tục. Do đó ta có thể giải quyết bài toán này trong thời gian $O(n)$. #theorem[ Bài toán reverse 1-median trên cây có thể được giải trong thời gian $O(n)$.] *Ví dụ* Cho cây $T(V,E)$ có trọng số như hình bên dưới. Chọn điểm $v_2$ và điều chỉnh trọng số đỉnh trên cây $T$ trong ngân sách $B= 5$ để $f(v_2)$ nhỏ nhất. Đồng thời vẫn thỏa mãn các ràng buộc sau: $c_1=1, c_2 = 2, c_3 = 4, c_4 =3, c_5=1, c_6 = 3 $ $ 0 <= delta_1 <= 2, 0 <= delta_2 <= 1, 0 <= delta_3 <= 2, 0 <= delta_4 <= 2, 0 <= delta_5 <= 1, 0 <= delta_6 <= 3. $ #align(center)[#canvas(length: 7%, { import cetz.draw: * let y = 2 let x = 4 let y-space = 1 let h=1.4 circle((0*h,3), radius: 0.05,fill:black, name: "v2") content("v2.left", $v_2 (5)$, anchor: "left", padding: 0.2) circle((-3,0), radius: 0.05,fill:black, name: "v1") content("v1.left", $v_1 (6)$, anchor: "left", padding: 0.2) circle((-3,6), radius: 0.05,fill:black, name: "v3") content("v3.left", $v_3 (7)$, anchor: "left", padding: 0.2) circle((4,3), radius: 0.05,fill:black, name: "v4") content("v4.left", $v_4 (4)$, anchor: "left", padding: 0.2) circle((7,6), radius: 0.05,fill:black, name: "v5") content("v5.left", $v_5 (3)$, anchor: "left", padding: 0.2) circle((7,0), radius: 0.05,fill:black, name: "v6") content("v6.left", $v_6 (3)$, anchor: "left", padding: 0.2) line("v1","v2", name: "v1v2") content("v1v2.left", $2$) line("v3","v2", name: "v2v3") content("v2v3.left", $2$) line("v4","v2", name: "v4v2") content("v4v2.left", $3$) line("v4","v5", name: "v4v5") content("v4v5.left", $2$) line("v4","v6", name: "v4v6") content("v4v6.left", $4$) } )] Dựa vào dữ kiện ban đầu, ta có thể tính được $f(v_2)$ lúc này nhận giá trị bằng 74. Bây giờ ta sẽ tiến hành cải thiện giá trị này. Tức là ta cần giải bài toán sau: $ max sum_(i=1)^6 delta_i d(v_i,v_2) \ "s.t." sum_(i=1)^6 c_i delta_i <= 3 \ 0 <= delta_1 <= 2 \ 0 <= delta_2 <= 1 \ 0 <= delta_3 <= 2 \ 0 <= delta_4 <= 2 \ 0 <= delta_5 <= 1 \ 0 <= delta_6 <= 3 \ $ Sau khi giải bài toán xếp ba lô liên tục, ta thu được: $ delta_5 = 1, delta_6 = 3, delta_1 = 2, delta_2 = delta_3= delta_4 = 0. $ Ta được đồ thị cây $T$ với trọng số các đỉnh sau khi được cải thiện như sau: #align(center)[#canvas(length: 7%, { import cetz.draw: * let y = 2 let x = 4 let y-space = 1 let h=1.4 circle((0*h,3), radius: 0.05,fill:black, name: "v2") content("v2.left", $v_2 (5)$, anchor: "left", padding: 0.2) circle((-3,0), radius: 0.05,fill:black, name: "v1") content("v1.left", $v_1 (4)$, anchor: "left", padding: 0.2) circle((-3,6), radius: 0.05,fill:black, name: "v3") content("v3.left", $v_3 (7)$, anchor: "left", padding: 0.2) circle((4,3), radius: 0.05,fill:black, name: "v4") content("v4.left", $v_4 (4)$, anchor: "left", padding: 0.2) circle((7,6), radius: 0.05,fill:black, name: "v5") content("v5.left", $v_5 (2)$, anchor: "left", padding: 0.2) circle((7,0), radius: 0.05,fill:black, name: "v6") content("v6.left", $v_6 (0)$, anchor: "left", padding: 0.2) line("v1","v2", name: "v1v2") content("v1v2.left", $2$) line("v3","v2", name: "v2v3") content("v2v3.left", $2$) line("v4","v2", name: "v4v2") content("v4v2.left", $3$) line("v4","v5", name: "v4v5") content("v4v5.left", $2$) line("v4","v6", name: "v4v6") content("v4v6.left", $4$) } )] Khi đó, $f(v_2) = 44.$
https://github.com/MALossov/YunMo_Doc
https://raw.githubusercontent.com/MALossov/YunMo_Doc/main/contents/6Appendix.typ
typst
Apache License 2.0
= 附录 == 边缘检测算法推理 ==== SOBEL算法 在边缘检测算法当中,我们使用的是较为经典的SOBEL算法: + 先求x,y方向的梯度$d x$,$d y$ + 然后求出近似梯度 $ G = d x^2 + d y^2 (1+ pi times alpha sum ^123 _12 /2 $<SOBEL> 然后开根号,也可以为了分别计算近似为 $ G = ∣ d x ∣ + ∣ d y ∣ $ + 最后根据G的值,来判断该点是不是边缘点,是的话,就将该点的像素复制为255,否则为0,,当然0或255可以自己随意指定,也可以是其他两个易于区分的像素值。 ==== 中值滤波算法 同时,为了保证SOBEL算法的实现,我们进行了中值滤波的引入: 中值滤波方法是,对待处理的当前像素,选择一个模板,该模板为其邻近的若干个像素组成,对模板的像素由小到大进行排序,再用模板的中值来替代原像素的值的方法。 当我们使用3x3窗口后获取邻域中的9个像素,就需要对9个像素值进行排序,为了提高排序效率,排序算法思想如下图所示: #figure( image("../images/Mid_Filter.png",width: 7.2cm), caption: "中值滤波思想" )<中值滤波> #par(leading: 2pt)[ + 对窗内的每行像素按降序排序,得到最大值、中间值和最小值; + 把三行的最小值相比较,取其中的最大值; + 把三行的最大值相比较,取其中的最小值; + 把三行的中间值相比较,再取一次中间值; + 把前面得到的三个值再做一次排序,获得的中值即该窗口的中值。] == 重要代码 + 在这里,我们仅仅展示`top`模块当中的代码,以保证报告中能对我们的作品有一个较为全面且容易理解的系统构建展示: #set text(font:("Noto Sans CJK SC","JetBrains Mono NL"),) ```v module top ( input clk, input rst_n, // inout cmos_scl, //cmos i2c clock // inout cmos_sda, //cmos i2c data input cmos_vsync, //cmos vsync input cmos_href, //cmos hsync refrence,data valid input cmos_pclk, //cmos pxiel clock output cmos_xclk, //cmos externl clock input [7:0] cmos_db, //cmos data output cmos_rst_n, //cmos reset output cmos_pwdn, //cmos power down output [1:0] state_led, output [14-1:0] ddr_addr, //ROW_WIDTH=14 output [ 3-1:0] ddr_bank, //BANK_WIDTH=3 output ddr_cs, output ddr_ras, output ddr_cas, output ddr_we, output ddr_ck, output ddr_ck_n, output ddr_cke, output ddr_odt, output ddr_reset_n, output [ 2-1:0] ddr_dm, //DM_WIDTH=2 inout [16-1:0] ddr_dq, //DQ_WIDTH=16 inout [ 2-1:0] ddr_dqs, //DQS_WIDTH=2 inout [ 2-1:0] ddr_dqs_n, //DQS_WIDTH=2 //RMII 接口信号 input wire rmii_clk, input wire rmii_rxdv, input wire [ 1:0] rmii_rxdata, output wire rmii_txen, output wire [ 1:0] rmii_txdata, output wire rmii_rst, inout wire mdc_sdl, //SDL inout wire mdio_sda, //SDA input wire keyshift ); //memory interface wire memory_clk; wire dma_clk; wire DDR_pll_lock; wire cmd_ready; wire [ 2:0] cmd; wire cmd_en; wire [ 5:0] app_burst_number; wire [ ADDR_WIDTH-1:0] addr; wire wr_data_rdy; wire wr_data_en; // wire wr_data_end; // wire [ DATA_WIDTH-1:0] wr_data; wire [DATA_WIDTH/8-1:0] wr_data_mask; wire rd_data_valid; wire rd_data_end; //unused wire [ DATA_WIDTH-1:0] rd_data; wire init_calib_complete; //According to IP parameters to choose `define WR_VIDEO_WIDTH_16 `define DEF_WR_VIDEO_WIDTH 16 `define RD_VIDEO_WIDTH_16 `define DEF_RD_VIDEO_WIDTH 16 `define USE_THREE_FRAME_BUFFER 1 `define DEF_ADDR_WIDTH 28 `define DEF_SRAM_DATA_WIDTH 128 // //========================================================= //SRAM parameters parameter ADDR_WIDTH = `DEF_ADDR_WIDTH; //存储单元是byte,总容量=2^27*16bit = 2Gbit,增加1位rank地址,{rank[0],bank[2:0],row[13:0],cloumn[9:0]} parameter DATA_WIDTH = `DEF_SRAM_DATA_WIDTH; //与生成DDR3IP有关,此ddr3 2Gbit, x16, 时钟比例1:4 ,则固定128bit parameter WR_VIDEO_WIDTH = `DEF_WR_VIDEO_WIDTH; parameter RD_VIDEO_WIDTH = `DEF_RD_VIDEO_WIDTH; wire video_clk; //video pixel clock wire off0_syn_de; wire [RD_VIDEO_WIDTH-1:0] off0_syn_data; wire [ 15:0] cmos_16bit_data; wire cmos_16bit_clk; wire [ 15:0] write_data; wire [ 9:0] lut_index; wire [ 31:0] lut_data; assign cmos_xclk = cmos_clk; assign cmos_pwdn = 1'b0; assign cmos_rst_n = 1'b1; assign write_data = {cmos_16bit_data[4:0], cmos_16bit_data[10:5], cmos_16bit_data[15:11]}; //状态指示灯 // assign state_led[3] = assign state_led[1] = rst_n; //复位指示灯 assign state_led[0] = init_calib_complete; //DDR3初始化指示灯 // wire cmos_clk; wire out_de; wire cmos_sdl; wire cmos_sda; wire mdc; wire mdio; assign mdc_sdl = cmos_sdl; assign mdio_sda = cmos_sda; //generate the CMOS sensor clock and the SDRAM controller clock cmos_pll cmos_pll_m0 ( .clkin (clk), .clkout(cmos_clk) ); mem_pll mem_pll_m0 ( .clkin (clk), .clkout(memory_clk), .lock (DDR_pll_lock) ); //I2C master controller i2c_config i2c_config_m0 ( .rst (~rst_n), .clk (clk), .clk_div_cnt (16'd500), .i2c_addr_2byte(1'b1), .lut_index (lut_index), .lut_dev_addr (lut_data[31:24]), .lut_reg_addr (lut_data[23:8]), .lut_reg_data (lut_data[7:0]), .error (), .done (), .i2c_scl (cmos_sdl), .i2c_sda (cmos_sda) ); //configure look-up table lut_ov5640_rgb565_640_480 lut_ov5640_rgb565 ( .lut_index(lut_index), .lut_data (lut_data) ); //CMOS sensor 8bit data is converted to 16bit data cmos_8_16bit cmos_8_16bit_m0 ( .rst (~rst_n), .pclk (cmos_pclk), .pdata_i(cmos_db), .de_i (cmos_href), .pdata_o(cmos_16bit_data), .hblank (cmos_16bit_wr), .de_o (cmos_16bit_clk) ); wire post_frame_de; wire post_frame_vsync; wire [15 : 0] post_rgb; wire post_frame_de1; wire post_frame_vsync1; wire [15 : 0] post_rgb1; wire post_frame_de2; wire post_frame_vsync2; wire [15 : 0] post_rgb2; //图像处理模块 vip u_vip ( //module clock .clk (cmos_pclk), // 时钟信号 .rst_n (rst_n), // 复位信号(低有效) //图像处理前的数据接口 .pre_frame_vsync(cmos_vsync), .pre_frame_hsync(cmos_href), .pre_frame_de (cmos_16bit_wr), .pre_rgb (write_data), //图像处理后的数据接口 .post_frame_vsync(post_frame_vsync), // 场同步信号 .post_frame_hsync(), // 行同步信号 .post_frame_de (post_frame_de), // 数据输入使能 .post_rgb (post_rgb), .post_frame_vsync1(post_frame_vsync1), // 场同步信号 .post_frame_hsync1(), // 行同步信号 .post_frame_de1 (post_frame_de1), // 数据输入使能 .post_rgb1 (post_rgb1), .post_frame_vsync2(post_frame_vsync2), // 场同步信号 .post_frame_hsync2(), // 行同步信号 .post_frame_de2 (post_frame_de2), // 数据输入使能 .post_rgb2 (post_rgb2) ); wire de_out; wire vs_out; wire [15:0] data_out; module_shift u_module_shift ( .clk (cmos_16bit_clk), .clk2 (cmos_pclk), .rstn (rst_n), .keyshift(keyshift), .de_1 (cmos_16bit_wr), .vs_1 (cmos_vsync), .data_1 (write_data), .de_2 (post_frame_de), .vs_2 (post_frame_vsync), .data_2 (post_rgb), .de_3 (post_frame_de1), .vs_3 (post_frame_vsync1), .data_3 (post_rgb1), .de_4 (post_frame_de2), .vs_4 (post_frame_vsync2), .data_4 (post_rgb2), .de_out (de_out), .vs_out (vs_out), .data_out(data_out) ); Video_Frame_Buffer_Top Video_Frame_Buffer_Top_inst ( .I_rst_n (init_calib_complete), //rst_n ), .I_dma_clk(dma_clk), //sram_clk ), `ifdef USE_THREE_FRAME_BUFFER .I_wr_halt(1'd1), //1:halt, 0:no halt .I_rd_halt(1'd1), //1:halt, 0:no halt `endif // video gary data input .I_vin0_clk (cmos_16bit_clk), .I_vin0_vs_n (~vs_out), //只接收负极性 .I_vin0_de (de_out), .I_vin0_data (data_out), .O_vin0_fifo_full(), // video data output .I_vout0_clk (rmii_clk), .I_vout0_vs_n (~out_vs), //只接收负极性 .I_vout0_de (out_de), .O_vout0_den (off0_syn_de), .O_vout0_data (off0_syn_data), .O_vout0_fifo_empty(), // ddr write request .I_cmd_ready (cmd_ready), .O_cmd (cmd), //0:write; 1:read .O_cmd_en (cmd_en), .O_app_burst_number (app_burst_number), .O_addr (addr), //[ADDR_WIDTH-1:0] .I_wr_data_rdy (wr_data_rdy), .O_wr_data_en (wr_data_en), // .O_wr_data_end (wr_data_end), // .O_wr_data (wr_data), //[DATA_WIDTH-1:0] .O_wr_data_mask (wr_data_mask), .I_rd_data_valid (rd_data_valid), .I_rd_data_end (rd_data_end), //unused .I_rd_data (rd_data), //[DATA_WIDTH-1:0] .I_init_calib_complete(init_calib_complete) ); DDR3MI DDR3_Memory_Interface_Top_inst ( .clk (rmii_clk), .memory_clk (memory_clk), .pll_lock (DDR_pll_lock), .rst_n (rst_n), //rst_n .app_burst_number (app_burst_number), .cmd_ready (cmd_ready), .cmd (cmd), .cmd_en (cmd_en), .addr (addr), .wr_data_rdy (wr_data_rdy), .wr_data (wr_data), .wr_data_en (wr_data_en), .wr_data_end (wr_data_end), .wr_data_mask (wr_data_mask), .rd_data (rd_data), .rd_data_valid (rd_data_valid), .rd_data_end (rd_data_end), .sr_req (1'b0), .ref_req (1'b0), .sr_ack (), .ref_ack (), .init_calib_complete(init_calib_complete), .clk_out (dma_clk), .burst (1'b1), // mem interface .ddr_rst (), .O_ddr_addr (ddr_addr), .O_ddr_ba (ddr_bank), .O_ddr_cs_n (ddr_cs), .O_ddr_ras_n (ddr_ras), .O_ddr_cas_n (ddr_cas), .O_ddr_we_n (ddr_we), .O_ddr_clk (ddr_ck), .O_ddr_clk_n (ddr_ck_n), .O_ddr_cke (ddr_cke), .O_ddr_odt (ddr_odt), .O_ddr_reset_n(ddr_reset_n), .O_ddr_dqm (ddr_dm), .IO_ddr_dq (ddr_dq), .IO_ddr_dqs (ddr_dqs), .IO_ddr_dqs_n (ddr_dqs_n) ); udp_top udp_top ( .sys_rst_n(rst_n), .sys_clk (clk), .rmii_clk(rmii_clk), .rmii_rxdv(), .rmii_rxdata(), .rmii_txen(rmii_txen), .rmii_txdata(rmii_txdata), .rmii_rst(rmii_rst), .mdc(mdc), .mdio(mdio), .WrClk_i(rmii_clk), .WrEn(off0_syn_de), .Data_i(off0_syn_data), .de(out_de), .outvs(out_vs) ); endmodule ``` + 具体模块代码详见压缩文档,且基本功能易于实现、故不具体展示。 + 代码生成的RTL图像见 @RTL_VIEW: #figure( image("../images/RTL_View.png",width: 18cm), caption: "RTL图像" )<RTL_VIEW> == 工程资源使用报告 - 时钟资源:#image("../images/Clock_Summary.png") - 消耗的FPGA片上资源:#image("../images/Resource_Usage.png")
https://github.com/freundTech/typst-forge
https://raw.githubusercontent.com/freundTech/typst-forge/main/matryoshka/test.typ
typst
#import "@typst-forge/matryoshka:0.1.0": compile
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/ordered_list/ordered_list_updated_result.typ
typst
+ The #strike[climate];#underline[CLIMATE] - #strike[Precipitation];#underline[Precipitation2] - Temperature + degree - #strike[hot];#underline[cold] - #underline[really];#underline[ ];#strike[cold];#underline[hot] - warm + #strike[sun];#underline[rain] + The #strike[geology];#underline[GEOLOGY]
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/problems/p0014.typ
typst
#import "../helpers.typ": * #import "../solutions/s0014.typ": * = Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string `""`. #let longest-common-prefix(strs) = { // Solve the problem here } #testcases( longest-common-prefix, longest-common-prefix-ref, ( (strs: ("flower", "flow", "flight")), (strs: ("dog", "racecar", "car")), ) )
https://github.com/EpicEricEE/typst-plugins
https://raw.githubusercontent.com/EpicEricEE/typst-plugins/master/droplet/assets/example-transform.typ
typst
#import "../src/lib.typ": dropcap #set text(size: 14pt) #set page( width: 8cm, height: auto, margin: 1em, background: pad(0.5pt, box( width: 100%, height: 100%, radius: 4pt, fill: white, stroke: white.darken(10%), )), ) #dropcap( height: 2, justify: true, gap: 6pt, transform: letter => style(styles => { let height = measure(letter, styles).height grid(columns: 2, gutter: 6pt, align(center + horizon, text(blue, letter)), // Use "place" to ignore the line's height when // the font size is calculated later on. place(horizon, line( angle: 90deg, length: height + 6pt, stroke: blue.lighten(40%) + 1pt )), ) }), lorem(21) )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fletcher/0.4.3/src/deps.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.1"
https://github.com/ice-kylin/typst-cv-miku
https://raw.githubusercontent.com/ice-kylin/typst-cv-miku/main/README.md
markdown
Do What The F*ck You Want To Public License
# typst-cv-miku This is a simple, elegant, academic style CV template for [typst](https://typst.app/). Support for English and Chinese (and more). You can see the online demo [here](https://typst.app/project/rbxGsQC-tEkDq0mnNIuxkv). ## Showcases ![cv_1](./assets/cv_1.webp) ![cv_2](./assets/cv_2.webp) ## Usage 1. Read [typst](https://typst.app/docs/) documentation. 2. Install fonts needed by this template: - [kpfonts](https://ctan.org/pkg/kpfonts) - [Source Han Sans](https://github.com/adobe-fonts/source-han-sans) - [Source Han Serif](https://source.typekit.com/source-han-serif/cn/) 3. Modify `.typ` files to fit your needs. You may need to learn some basic typst syntax. ## By the way Typst currently has some [bugs](https://github.com/typst/typst/issues/144) in the emoji output, so for the time being SVG images are being used instead, which you can find at [twemoji utils](https://twemoji.godi.se/). Small icon from Material Icons (Community). ## License Licensed under [WTFPL](http://www.wtfpl.net/).
https://github.com/DashieTM/ost-5semester
https://raw.githubusercontent.com/DashieTM/ost-5semester/main/compiler/weeks/week9.typ
typst
#import "../../utils.typ": * #section("OO in VM") #subsection("Heap") #align( center, [#image("../../Screenshots/2023_11_13_08_43_17.png", width: 100%)], ) #align( center, [#image("../../Screenshots/2023_11_13_08_43_29.png", width: 100%)], ) E.g. the issue with reference object is both the liftetime -> aka when do we delete the object without breaking the code, while also making sure there is no memory leak or unused memory. At the same time, there is also the issue with allocation and de-allocation in terms of using memory in a sensible way -> if you don't you might run into situations where you technically have enough ram for objects, but you can't use it since the allocation is all over the place(small free spaces between allocations). #subsection("Unmanaged") #align( center, [#image("../../Screenshots/2023_11_13_08_53_02.png", width: 70%)], ) #text( teal, )[Note, as a result of independence of the unmanaged stack, one can't use dotnet references inside of unmanaged.] #subsection("Object block in Heap") #columns(2, [ #align( center, [#image("../../Screenshots/2023_11_13_10_35_28.png", width: 100%)], ) #colbreak() #align( center, [#image("../../Screenshots/2023_11_13_10_35_40.png", width: 100%)], ) ]) #subsection("Heap Class in Smallj Compiler") ```cs class Heap { // allocates a type with a specific descriptor Pointer AllocateObject(ClassDescriptor type); // read a field from the class -> class.color object ReadField(Pointer ptr, int index); // write to a field fro mthe class -> class.color = rgb(255,255,255); void WriteField(Pointer ptr, int index, object value); } ``` Allocation: ```cs // new obj var type = CheckClassDescriptor(instruction.Operand); var instance = NewObject(type); Push(instance); // null obj Push(null); ``` Get and Set: ```cs // get var field = CheckFieldDescriptor(instruction.Operand); var instance = CheckPointer(Pop()); var value = heap.ReadField(instance, field.Index); Push(value); // set var field = CheckFieldDescriptor(instruction.Operand); var value = Pop(); var instance = CheckPointer(Pop()); heap.WriteField(instance, field.Index, value); ``` #subsection("Arrays") #align( center, [#image("../../Screenshots/2023_11_13_10_39_55.png", width: 100%)], ) Code:```cs // helper class class Heap { Pointer AllocateArray(ArrayDescriptor type, int length); int GetArrayLength(Pointer array); object ReadElement(Pointer array, int index); void WriteElement(Pointer array, int index, object value); } // allocation var type = CheckArrayDescriptor(instruction.Operand); var length = CheckInt(Pop()); var array = heap.AllocateArray(type, length); Push(array); ``` #subsection("Easy Heap without GC") ```cs Pointer Allocate(int size, TypeDescriptor type) { int blockSize = size + 16; if (freePointer + blockSize > limit) { // LOL throw new VMException("Out of Memory"); } long address = freePointer; freePointer += blockSize; heap.Write(address, blockSize); SetTypeDescriptor(type, address); // at offset 8 return new Pointer(address + 16); } Pointer AllocateObject(ClassDescriptor type) { // we can't read less than 8 bytes -> hence padding of 8 int size = type.AllFields.Length * 8; return Allocate(size, type); } Pointer AllocateArray(ArrayDescriptor type, int length) { // we can't read less than 8 bytes -> hence padding of 8 int size = length * 8; return Allocate(size, type); } ```
https://github.com/505000677/2060-hw5
https://raw.githubusercontent.com/505000677/2060-hw5/main/ebook.typ
typst
#import "@preview/book:0.2.4": * #import "/templates/ebook.typ" #show: ebook.project.with(title: "typst-book", spec: "book.typ") // set a resolver for inclusion #ebook.resolve-inclusion(it => include it)
https://github.com/wcshds/manual-of-chinese-phonology
https://raw.githubusercontent.com/wcshds/manual-of-chinese-phonology/main/preface.typ
typst
#set page( width: 595.35pt, height: 800pt, margin: (x: 57pt, y: 57pt), ) #set text( font: ("Source Serif 4", "Simsun", "TH-Tshyn-P0", "TH-Tshyn-P1", "TH-Tshyn-P2"), lang: "zh", region: "cn", size: 10.7pt, ) #show regex("[“”。:,、《》()「」]+"): it => { set text(font: "Simsun") it } #show par: set block(spacing: 0.9em); #set par(justify: true, first-line-indent: 2em, leading: 0.9em); #show text.where(weight: "bold").or(strong): it => { show regex("\p{script=Han}+"): set text(stroke: 0.5pt) it } #show heading.where(level: 1): it => { set text(size: 20pt) set align(center) show par: set block(spacing: 0em, inset: 0em, outset: 0em, below: 3em) v(2.5em) it.body.text.clusters().join(" ") } #show heading.where(level: 2): set heading(numbering: "1"); #show heading.where(level: 2): it => { let num = counter(heading).get().at(1) let counts = "壹贰叁肆伍陆柒捌玖拾".clusters() let num-display = if num >= 1 and num <= 10 { counts.at(num - 1) } else { panic("Invalid heading number.") } v(0.2em) h(-0.4em) num-display + "、 " + it.body v(0.2em) } #show heading.where(level: 3): set heading(numbering: "1"); #show heading.where(level: 3): it => { let num = counter(heading).get().at(2) let counts = "一二三四五六七八九十".clusters() let num-display = if num >= 1 and num <= 10 { counts.at(num - 1) } else { panic("Invalid heading number.") } v(0em) num-display + "、 " + it.body v(0em) } #show heading.where(level: 4): set heading(numbering: "1"); #show heading.where(level: 4): it => { let num = counter(heading).get().at(3) v(0em) str(num) + ". " + it.body v(0em) } #show figure.where(kind: table): it => { set figure.caption(position: top) show figure.caption: c => { text(weight: "bold")[ #v(0.8em)#c.supplement #c.counter.display(c.numbering)~~~~#c.body#v(0.5em) ] } it } #import "tools/prelude.typ": xs; // 正文開始 = 前言 上古音研究一直是漢語音韻學的前沿。從高本漢的《漢文典》以後,出版了好幾部漢語上古音的字典、手冊,其中鄭張尚芳的《上古音系》後附古音字表,能夠比較全面地反映20世紀70年代以來漢語歷史音韻學的發展。這個字表以諧聲分類,對於瞭解上古音是一個很好的安排。19世紀,在達爾文進化論影響下出現了歷史比較語言學,20世紀又出現了演化語言學。 本手冊的創新是從歷史比較法轉向演化語言學,其根本內容就是自然音變和音變鏈。 手冊的編制歷經10年,分兩期推進。 第一期,用上古字建立上古音表。 我們根據上古文獻做成上古字形庫,這項工作主要由顧國林和上海師範大學的研究生葛佳琦、胡平、郭承禹、孟曉紅、吳蕾完成。同時還建立了古音數據庫,這來自兩個基礎材料,一個是蔡夢麒在2014年提供給我的《廣韻校釋》電子材料,另一個是鄭張尚芳撰寫《上古音系》時跟我合作的古音數據庫。2015年,王奕樺在此基礎上擴充成上古音表,這就是本手冊的雛形。 第二期,在嚴格的諧聲分析基礎上做成本手冊。 2020年開始,22位專家、學者先後參加了兩個微信群:“漢語古音手冊”討論群(2020)和“諧聲分析”討論群(2021)。這本手冊包括大量的原始材料,許多青年專家對它們進行了整理,主要工作是聲符整理,這是諧聲系統的基礎;除此之外,還有上古用字和中古切語的整理。其中包括:上古通用字的確定,文字、音韻材料的校對,音韻地位的核實,語音數據的統計,聲符的確定,通假字的比較,等等,這使得本手冊的基礎更爲堅實。 青年專家有李豪、應金琦、肖禕科、張振通、喬宇軒、葛佳琦、潘牧天、畢謙琦、趙庸、王豔紅;電腦專家有顧國林、陳鵬、王奕樺;學者有葉玉英、張富海、鄔可晶、邊田鋼、董建交、王弘治、來國龍、施瑞峰、蔡夢麒。 2013年,我申請到國家社科基金重大項目“基於語音對應關係的漢語和少數民族語言演化語素的研究”,把本手冊列爲這個項目的一部分。在漢藏語歷史比較的基礎上,漢語上古音的研究纔有了更堅實的基礎。子課題的負責人有鄭張尚芳、黃樹先、王雙成、韋樹關、李雲兵。鄭張尚芳2018年去世,他爲漢語歷史音韻學和漢藏曆史比較語言學作出了不可磨滅的貢獻。當古音手冊即將出版的時候,我們深深地表示哀悼。手冊有許多地方是來自於他半個多世紀的諸多努力,同時也超出了他的《上古音系》原來的範圍和水平。本手冊即將出版,可能還存在許多差錯和不足之處。這一方面是對大量數據進行處理時帶來的;另一方面則是本人學術水平的原因。特別是在寫作過程中,我已經看到音韻學有可能發展的高度,演化語言學的新理論,出土文獻和親屬語的新材料,所以,我們很希望再過兩年能刊出手冊的新版本來彌補此版的不足。 == 基本材料 上古音構擬的依據是諧聲材料、諧聲規則和諧聲類型。漢語幾千年的語音和文字演變,雖然會有不確定性,但是總體上有據可依,有理可循。爲此,我們將上古文獻做成資料庫,每個字加上中古音和聲符,以聲符爲單位得到上古的諧聲系列,從而得到諧聲規則和諧聲類型。 === 古文獻材料 本手冊的研究對象主要是漢語的上古讀音,所以只收錄傳世文獻中的上古用字。如“茶”是後起字,本手冊就沒有收錄,只是把它作爲“荼”的後起字放在檢索中備查。爲了得到上古用字表,我們參考了大量的先秦兩漢文獻,包括十三經、《史記》、《漢書》等89種著作,相關文獻材料取自香港中文大學創建的漢達文庫。 本手冊收錄上古用字18887個,包括主要的異讀用字,這也是第一份比較可靠的上古傳世文獻用字表。 漢字所代表的語素是音義的結合體,只有通過上古的語音特徵來確定上古用字。語音史的分期雖然還有不少爭論,但是主流的意見認爲,上古漢語有以下的語音特徵:一是魚部字的讀音爲#xs(``` a ```),二是存在輔音叢,三是聲調還屬於非區別性特徵。這三個特徵從先秦到兩漢一直存在,到魏晉就消失了。所以,我們認定上古漢語就是東漢以前所使用的文獻語言。一個人到20歲通常進入語言的穩定期。東漢結束是公元220年,這個時候年屆20歲的作家所使用的就是上古漢語。語言史用某個時間進行切分只是一種統計的方便,本手冊把公元200年左右出生的作家定爲東漢作家,把商周至東漢的文獻定爲本書的收字範圍。但是,漢代的一些通用字在漢達文庫中漏收,如否定詞“無”。許多學者認爲漢代纔有專字“𫡟”,但是西漢武威漢簡《儀禮》、東漢熹平石經都收有否定詞“無”。 漢語的通用字在歷史上有幾個大變化。文字改革以後的用字,我們叫作現代字,隸變以前的文字叫古文字。這兩者之間的古籍通用字也經過了不少變化,本手冊基本上沿用《漢語大詞典》的繁體字作古籍通用字,個別地方根據上古的用字做了調整。 音韻學的研究對象是語素,而不是文字,所以本手冊確定了通用字以後,就不再收錄異體字,只在腳註中註明《廣韻》的異體字以備檢索。 === 中古音系 上古音研究應該首先從中古的音系開始,《切韻》系統的基本材料就是反切。通過反切行爲和反切規則能切分成的基本單位是聲、韻、調。 漢語最早形成的共同語即洛陽王室的語言,叫作“雅言”。這種共同語和中古時代的洛陽方言一脈相承。晉室從洛陽南遷,形成金陵的書音系統,是《切韻》的音系基礎。漢語幾千年來,從殷商的雅言到中古的洛陽金陵書音系統,再到中原官話,雖然有方言的變動,但共同語卻都有相同的音系基礎和語音規則。陸法言的《切韻》一方面記錄了上萬字的讀音材料,另一方面將其分析爲嚴密的音韻系統,這爲梳理現代方言的語音變化,構擬上古漢語的語音和形態提供了可能。可以說,沒有《切韻》,就不可能有現在的漢語語音史,《切韻》的出現實在是漢語語音史的幸運。 《切韻》原本已經失落,後來有過許多修訂和擴充的本子,其中最常見的就是《廣韻》。許多音韻學家用不同的本子和其他語言材料對《廣韻》做了細緻的校對,包含了《切韻》的精華,所以本手冊所用的《切韻》實際上就是《廣韻》的材料。我們基本採用《廣韻》反切,並按照前人與我們自己的校勘作了改動。不見於《廣韻》的用字,酌取《集韻》《說文》《玉篇》等中古《切韻》系韻書。《切韻》原本有193韻,王仁昫《刊謬補缺切韻》(即《王三》)增加爲195韻。因爲《王三》爲最早的《切韻》完本,而且《王三》的韻目更有系統性,故本手冊採用《王三》的音韻框架。《集韻》等《切韻》系韻書,與《切韻》的音韻框架並不完全一致,我們通過梳理它們的讀音音注與《切韻》的對應關係,還原作《切韻》的音韻地位。 晉室南渡以後金陵有兩個語言社團,一個是洛陽士族形成的書音系統,一個是金陵庶族形成的口語系統。二等韻在這兩個語言社團中的讀音相似又不完全一樣,經常出現異讀。如“頑”有刪、山兩個讀音,從“元”得聲的諧聲系列中,二等只能出現在刪韻,不可能出現在山韻。《切韻》佳與麻、佳與皆、山與刪、庚與耕、銜與鹹、轄與黠、陌與麥、狎與洽都有相混現象,實際上就是金陵兩個語言社團的不同讀音。本手冊的這些異讀通過諧聲系統進行改動。 有些四等的合口介音在《切韻》時代失落,如四等“絃𣒃”,原來應該有合口介音,因爲四等帶前元音,合口介音舌位靠後,容易失落變成開口字。本手冊根據諧聲在上古音中補上合口介音,但是中古的開合口則沿用文獻的原貌。 有些二等的合口介音#xs(``` _w ```)在中古二等介音#xs(``` _M_t ```)的影響下變成介音#xs(``` _M_t ```),之後變成開口字:#xs(``` _C_o_w_M_t ```) -> #xs(``` _C_o_M_t_M_t ```) -> #xs(``` _C_o_M_t_-_t ```)。如二等“街”原來應該有合口介音,到中古變成開口字:#xs(``` *k_w_r_te_- ```)>#xs(``` k_M_t_M_te_- ```)>中古#xs(``` k_M_tE ```)。 《切韻》不是古今南北方音的大雜燴,陸法言的記音以金陵洛下書音系統爲嚴格依據,所以《切韻》是實際語言的記錄。但是,《切韻》除了嚴格遵照書音系統以外,還摻雜了古代經師、文獻的反切和記音。如“臡”字,《切韻》有“人兮反”“奴低反”兩讀,都讀齊韻。齊韻屬於四等韻,四等韻是不與日母配合的。陸法言從《字林》或徐邈的字典上看到,“臡”字的日母讀音與他自己的金陵音系不合,於是他把這些反切抄到《切韻》中作爲參考讀音。他沒有寫明出處,因而造成混亂。本手冊通過中古音跟諧聲系統的比較,消除了這些混亂。 == 上古音系 === 上古的音節結構 #context { import "@preview/cetz:0.2.2": canvas, draw, tree set align(center) set text(size: 9.5pt) let data = ( [A], ([B], [C], [D]), ([E], [F]), ) let syllable-structure = canvas( length: 1cm, { import draw: * tree.tree( ( [音節], ([[聲母]], [[冠音]], ([聲幹], [主輔音], [[後輔音]])), ([韻母], ([韻部], [主元音], [[韻尾]]), [[後韻尾]]), ), grow: 1.2, spread: 2, draw-edge: (from, to, ..) => { let (a, b) = (from + ".center", to + ".center") line((a, .4, b), (b, .5, a)) }, ) }, ) v(0.4em) syllable-structure h(0em) v(-1em) } 上古有兩個後韻尾(postcode):#xs(``` _-_o? ```)、#xs(``` _-_os ```),前者到中古形成上聲調,後者形成去聲調。後韻尾屬於後綴,不屬於詞根。爲了便於詞根處理,上古韻母系統中只用韻部作基本單位,結合中古的聲調反推後韻尾,再補全上古的韻母。 一個音節可能包括一個詞根與前後綴,這是從構詞平面所作的分析。但是目前好像沒有與構詞對應的音系名稱。如“蓋”有兩讀:“古太切”的#xs(``` _*_gka_-bs ```)和“古盍切”的#xs(``` _*_gka_-b ```),詞根是#xs(``` _*_gka_-b ```)。我們把音節中所包含的詞根叫作音節根,同時把詞根的音節叫作根音節。如音節#xs(``` ka_-bs ```)中的詞根部分#xs(``` ka_-b ```)叫作音節根:#xs(``` ka_-b ```)是音節,同時是詞根,叫作根音節。 === 上古聲母輔音 上古聲母分單聲母與輔音叢兩類。下面是單聲母,都是簡單輔音,用大寫字母代表聲類: #figure( table( columns: (1fr,) * 11, align: center + horizon, inset: (y: 0.8em), [聲類], [P], [T], [K], [Q], [L], [R], [S], [M], [N], [NG], table.cell(rowspan: 3)[聲母], xs(``` p ```), xs(``` t ```), xs(``` k ```), xs(``` q ```), xs(``` l ```), xs(``` r ```), xs(``` s ```), xs(``` m ```), xs(``` n ```), xs(``` N ```), xs(``` p_h ```), xs(``` t_h ```), xs(``` k_h ```), xs(``` q_h ```), xs(``` l_0 ```), xs(``` r_0 ```), xs(``` s_h ```), xs(``` m_0 ```), xs(``` n_0 ```), xs(``` N_0 ```), xs(``` b ```), xs(``` d ```), [], xs(``` G\ ```), xs(``` l_0_h ```), [], xs(``` z ```), xs(``` m_0_h ```), xs(``` n_0_h ```), xs(``` N_0_h ```), ), caption: "上古音單聲母", ) <上古音單聲母表> @上古音單聲母表 的單聲母是從上古漢語資料庫歸納出來的,其中#xs(``` r_0_h ```)空缺,在實際的語言中也許有可能出現。除了單輔音的聲類以外,還有兩個單輔音組成的輔音叢。以下主要討論CL系列,其中L包括#xs(``` r ```)和#xs(``` l ```),它們變成單輔音以後有不同的音變。 ==== 帶冠輔音 東南亞許多語言中有一種包含次要音節(minor syllable)的音節類型,長度一般只有主要音節的一半,所以馬提索夫(Matisoff 1973)把次要音節和主要音節組成的詞叫作“一個半音節的詞”(sesquisyllabic word)。大部分次要音節可以是輔音,也可以是沒有音位價值的元音,音系功能實際上等同於一個輔音。許多人把它們叫作前置輔音,也有學者稱作前冠音。比起鼻音前置輔音、噝音前置輔音、塞音前置輔音來,鼻冠音、噝冠音、塞冠音更容易上口,把它們叫作冠音更好。上古音音節中的冠音往往是帶有無音位價值的弱元音,代號記作Pre。 冠音是弱化音,用一個小圓點記音,上古以後都已經失落,#xs(``` _C_o._L_o ```)->#xs(``` _L_o_-_o ```)。如“藍”上古#xs(``` g.ra_-m ```)>#xs(``` ra_-m ```)>中古#xs(``` lAm ```),可比較泰文中的藉詞#xs(``` gra:m_A_o_2_o ```)藍靛。有些以母字也有類似的帶輔音的來源:#xs(``` _C_o.l ```)->#xs(``` l_-_o ```),如“羑”#xs(``` k_w.lM? ```)>#xs(``` lu? ```)。 ==== 複輔音 複輔音的#xs(``` _C_o ```)與#xs(``` _L_o ```)有兩次成阻,兩次除阻。#xs(``` _C_o ```)除阻以後#xs(``` _L_o ```)再成阻,實際上就是由兩個單輔音組成。複輔音變成單輔音的時候,有以下的音變規則#xs(``` _C_o_L_o ```)->#xs(``` _T_o ```),其中的#xs(``` _T_o ```)來自於#xs(``` _C_o ```)的發音方法和#xs(``` _L_o ```)的發音部位。如藏頭“肘”#xs(``` kru ```)到拉薩話中變成了#xs(``` ts`u ```)<#xs(``` _*_gt`u ```),#xs(``` t` ```)的發音部位與#xs(``` kru ```)中#xs(``` r ```)的捲舌部位相同,#xs(``` t` ```)的發音方法與#xs(``` kru ```)中的塞音#xs(``` k ```)相同。漢語的“塘”#xs(``` dAN ```)<#xs(``` gla_-N ```),#xs(``` d ```)的發音部位與#xs(``` l ```)的舌齒音相同,#xs(``` d ```)的發音方法與塞音#xs(``` g ```)相同。曲瑤語和侗臺語中的“池塘”借自漢語,可比較長坪勉語#xs(``` gla:N ```)、全州勉語#xs(``` glaN ```)、板考布依語#xs(``` gAN ```)、隆安壯語#xs(``` hlaN ```)、扶綏壯語#xs(``` laN ```),這些材料正可以印證漢語“塘”的複輔音聲母的音變規則。複輔音是輔音叢中的一類,東亞語言中的這一類有特殊的音變類型。 ==== 複雜輔音 雅洪托夫的有些輔音叢並不採用複輔音的音變規則。例如,他把二等字“家”擬作複輔音#xs(``` _*_gkra ```),按照上面複輔音的變化規則應該是#xs(``` kra ```)>#xs(``` t`a ```)>#xs(``` ts`a ```),但它在中古以後卻是變爲#xs(``` kia ```)>#xs(``` ts\ia ```)。所以,雅洪托夫的這種輔音叢應該是複雜輔音,它變成單輔音的音變規則是:#xs(``` k ```)是主要調音,讀音保留不變,#xs(``` r ```)是次要調音,變成介音或者失落,如“家”#xs(``` k_r_ta_- ```)>#xs(``` k_M_ta_- ```)>#xs(``` kia_- ```)>#xs(``` ts\ia ```)。爲了與複輔音區分,複雜輔音的第二個成分用上標記音,如家#xs(``` _*_gk_r_ta_- ```)。 賴福吉(2015)提到複雜調音這個術語的時候,認爲是塞音(主要調音)+近音(次要調音)的組合。次要調音成分記作上標形式,如脣化音#xs(``` k_wa ```),齶化音#xs(``` k_ja ```)。二等聲母就是#xs(``` r ```)化音#xs(``` k_r_ta ```),它與其他的複雜輔音一樣,主要調音成分#xs(``` k ```)保持不變。 上古漢語的一些字與塞音或近音都發生關係,到中古的時候塞音保留不變,這就是來自上古的複雜輔音聲母,如“告”#xs(``` _*_gk_lu_-s ```)>#xs(``` ku ```)>#xs(``` k_@_tu ```)>中古#xs(``` kAu ```),可比較泰文#xs(``` kluh ```)<#xs(``` klaawh ```)(說、說話)。“鴻”#xs(``` _*_gg_lo_-N ```)>#xs(``` go_-N ```)>中古#xs(``` h\uN ```),可比較藏文#xs(``` kruN ```)(雁)。“刻”#xs(``` _*_gk_lM_- ```)>#xs(``` kM_- ```)>中古#xs(``` k_h@k ```),可比較景頗語#xs(``` krok ```)、佤語#xs(``` lok ```)(雕刻)。 上古漢語的複雜輔音分爲三套#xs(``` _C_o_j_-_o ```)、#xs(``` _C_o_l_-_o ```)、#xs(``` _C_o_r_t_-_o ```)。#xs(``` _C_o ```)是主要調音。#xs(``` _C_o_l_-_o ```)、#xs(``` _C_o_r_t_-_o ```)中的#xs(``` _C_o_-_o ```)只限於鈍音,如舉#xs(``` _*_gk_la? ```)>中古#xs(``` ka? ```)>中古#xs(``` ki7 ```),鏗#xs(``` _*_gk_h_r_ti_-N ```)>中古#xs(``` k_h_M_tEN ```)。其中的#xs(``` _C_o_j_-_o ```)變爲章組。複輔音#xs(``` _C_ol_-_o ```)、#xs(``` _C_or_-_o ```)加上次要調音#xs(``` _j ```)以後也變成章組,複輔音先變成塞音,如#xs(``` kl_j_-_o ```)>#xs(``` t_j_-_o ```),之後再與次要調音合成#xs(``` t_j_-_o ```)>#xs(``` ts\_-_o ```),如振#xs(``` _*_gkl_jMn ```)>#xs(``` t_jMn ```)>中古#xs(``` ts\in ```)。
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Papa_Lausanne.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Papa Lausanne", authors: ( "<NAME>", ), date: "10 Août, 2024", ) #set heading(numbering: "1.1.") == Papa <papa> - Portable - #link("https://www.ebay.fr/itm/326220332203?itmmeta=01J4CS0P963DJ1G6WBQAMH5CY0&hash=item4bf43f3cab:g:dKMAAOSwAkNmCoXT&itmprp=enc%3AAQAJAAAAwFQjGzEwKlhH%2Fhu91VTGcB7jxw8lz85avpi%2FIkvmaxFvgNTK%2F%2BmAw2owg4PpjyGIFutfX%2BH%2Fq5RkaP%2Bkk1pDQ8kcdRQ0533MHHDtx41HSFhxgmcuAP56UjVFf3yyEek6foVGseyZyvtIWRzoOy624FNpesMQlT%2BlfuJOsZMYJP9AeG6Ce4aWr2%2Bxz8uboj6r3nsjq5glUxzU7v44rILlqPX%2BRT0UI4Am4HgeA814Sn1QBz%2FIaKAh0GBilIe1YsEHqA%3D%3D%7Ctkp%3ABk9SR-TkgpmjZA")[1] - #link("https://www.ebay.fr/itm/135164657456?itmmeta=01J4CS0P94W2FFB31DX5QSF9BW&hash=item1f7870ff30:g:ct8AAOSwVu1mkRAu&itmprp=enc%3AAQAJAAAAwBsnoJoKtIai9VC%2B1iKZdZnFr37RDo9306zuidd6PjGL5mDEyT2ujPN0aKmLUQHZJzeys20QykLQ2PX9DdraYbJ9JtfJcOe3jp7MXzr792wnTJs8rLi%2FXIhlsoRoKZxd4WoGbnYiKVRW96r8OSnFTbFxusMhCSz9NNzzh%2BMBlFXHnSmxZxQM9H9eznUzFwc27LxXm2xG2I3AYmaroSE8RXdDswURhmHMA6K%2FlRZXL%2BUlh1cXO%2BouFDVgYidAkrtWwg%3D%3D%7Ctkp%3ABk9SR9zkgpmjZA")[2] - #link("https://www.leboncoin.fr/ad/ordinateurs/2796992403")[3] - #link("https://www.amazon.fr/Lenovo-ThinkPad-Ordinateur-portable-reconditionn%C3%A9/dp/B0CN9QRP11/ref=sr_1_3_sspa?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=2MMLRPIHXF52X&dib=<KEY>_vCz2Xdyfo48_bcPEGM00NUPenub0OdKdn1R5MPNPwzoRR44UndDyMpq7tfO72bqgaqN4VSAaErvQcczAxW8cE_6E1wy2IDMEm_lcX10Wip5RlYpFBccMyw.yrVydolGA0yLOzNBIePClJtYJqMbiR5WEk8HIptFwHU&dib_tag=se&keywords=lenovo+thinkpad+t14&qid=1722266444&sprefix=lenovo+thinkpad+t14%2Caps%2C94&sr=8-3-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1")[4] - Vélo - #link("https://www.leboncoin.fr/ad/velos/2726428557")[lien] - #link("https://www.leboncoin.fr/ad/velos/2799942565")[lien]
https://github.com/lxl66566/my-college-files
https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/算法导论/排序.typ
typst
The Unlicense
#import "../template.typ": * #import "@preview/tablex:0.0.7": tablex, colspanx, rowspanx #import "@preview/tablem:0.1.0": tablem #show: project.with( title: "5", authors: ( "absolutex", ) ) = 排序 == 课本2.3-1 使用图2-4作为模型,说明归并排序在数组A=\<3,41,52,26,38,57,9,49\>上的操作。 (不好画图) #tablex( columns: 8, align: center + horizon, colspanx(8)[3 9 26 38 41 49 52 57], (), (), (), (), (), (), (), colspanx(4)[3 26 41 52], (), (), (), colspanx(4)[9 38 49 57], (), (), (), colspanx(2)[3 41], (), colspanx(2)[26 52], (), colspanx(2)[38 57], (), colspanx(2)[9 49], (), [3], [41], [52], [26], [38], [57], [9], [49], ) == 课本7.1-1 参照图7-1的方法,说明PARTITION在数组A=\<13,19,9,5,12,8,7,4,21,2,6,11>上的操作过程。 加粗的与斜体的表示参照图7-1的阴影区域。红色的是x。 斜体的为浅阴影($<=x$),粗的为深阴影($>x$) #tablex( columns: 12, align: center + horizon, auto-vlines: false, map-cells: cell => { if get_text(cell.content) == "11" { cell.content = { set text(red.lighten(30%)) strong(cell.content) } } cell }, [*13*],[*19*],[9],[5],[12],[8],[7],[4],[21],[2],[6],[11], [_9_],[*13*],[*19*],[5],[12],[8],[7],[4],[21],[2],[6],[11], [_9_],[_5_],[*13*],[*19*],[12],[8],[7],[4],[21],[2],[6],[11], [_9_],[_5_],[*13*],[*19*],[*12*],[8],[7],[4],[21],[2],[6],[11], [_9_],[_5_],[_8_],[*13*],[*19*],[*12*],[7],[4],[21],[2],[6],[11], [_9_],[_5_],[_8_],[_7_],[*13*],[*19*],[*12*],[4],[21],[2],[6],[11], [_9_],[_5_],[_8_],[_7_],[_4_],[*13*],[*19*],[*12*],[21],[2],[6],[11], [_9_],[_5_],[_8_],[_7_],[_4_],[*13*],[*19*],[*12*],[*21*],[2],[6],[11], [_9_],[_5_],[_8_],[_7_],[_4_],[_2_],[*13*],[*19*],[*12*],[*21*],[6],[11], [_9_],[_5_],[_8_],[_7_],[_4_],[_2_],[_6_],[*13*],[*19*],[*12*],[*21*],[11], [_9_],[_5_],[_8_],[_7_],[_4_],[_2_],[_6_],[11],[*13*],[*19*],[*12*],[*21*], ) == 课本8.2-1 参照图8-2的方法,说明COUNTING-SORT在数组A=\<6, 0, 2, 0, 1, 3, 4, 6, 1, 3, 2>上的操作过程。 原先: #tablem[ |*a*|6|0|2|0|1|3|4|6|1|3|2| ] #tablem[ |*c*|0|0|0|0|0|0|0| ] 计数并累加: #tablem[ |*a*|6|0|2|0|1|3|4|6|1|3|2| ] #tablem[ |*c*|2|4|6|8|9|9|11| ] 填入: 1. #tablem[ |*b*|x|x|x|x|x|2|x|x|x|x|x| ]#tablem[ |*c*|2|4|5|8|9|9|11| ] 2. #tablem[ |*b*|x|x|x|x|x|2|x|x|3|x|x| ]#tablem[ |*c*|2|4|5|7|9|9|11| ] 3. #tablem[ |*b*|x|x|x|1|x|2|x|x|3|x|x| ]#tablem[ |*c*|2|3|5|7|9|9|11| ] ... 最后: #tablem[ |*b*|0|0|1|1|2|2|3|3|4|6|6| ] == 课本8.3-1 参照图8-3的方法,说明RADIX-SORT在下列英文单词上的操作过程:COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX. 第一次: #tablex( columns: 3, align: center + horizon, map-cells: cell => { if cell.x == 2 { cell.content = { set text(red.lighten(30%)) strong(cell.content) } } cell }, [S],[E],[A], [T],[E],[A], [M],[O],[B], [T],[A],[B], [D],[O],[G], [R],[U],[G], [D],[I],[G], [B],[I],[G], [B],[A],[R], [E],[A],[R], [T],[A],[R], [C],[O],[W], [R],[O],[W], [N],[O],[W], [B],[O],[X], [F],[O],[X], ) 第二次: #tablex( columns: 3, align: center + horizon, map-cells: cell => { if cell.x == 1 { cell.content = { set text(red.lighten(30%)) strong(cell.content) } } cell }, [T],[A],[B], [B],[A],[R], [E],[A],[R], [T],[A],[R], [S],[E],[A], [T],[E],[A], [D],[I],[G], [B],[I],[G], [M],[O],[B], [D],[O],[G], [C],[O],[W], [R],[O],[W], [N],[O],[W], [B],[O],[X], [F],[O],[X], [R],[U],[G], ) 第三次: #tablex( columns: 3, align: center + horizon, map-cells: cell => { if cell.x == 0 { cell.content = { set text(red.lighten(30%)) strong(cell.content) } } cell }, [B],[A],[R], [B],[I],[G], [B],[O],[X], [C],[O],[W], [D],[I],[G], [D],[O],[G], [E],[A],[R], [F],[O],[X], [M],[O],[B], [N],[O],[W], [R],[O],[W], [R],[U],[G], [S],[E],[A], [T],[A],[B], [T],[A],[R], [T],[E],[A], ) == 课本8.4-1 参照图8-4的方法,说明BUCKET-SORT在数组A=\<0.79,0.13,0.16,0.64,0.39,0.20,0.89,0.53,0.71,0.42>上的操作过程。 10 个桶,每个桶范围为 0.1 ``` [ [] [ 0.13, 0.16 ] [ 0.2 ] [ 0.39 ] [ 0.42 ] [ 0.53 ] [ 0.64 ] [ 0.71, 0.79 ] [ 0.89 ] [] ] ``` == 假设对于n个不同的元素$x_1,x_2...x_n$有正加权值$w_1,w_2...w_n$,有$sum(w_i)=1$,我们定义加权中位数$x_k$为满足以下条件的元素: $sum_(x_i<x_k) w_i<1/2$ 且 $sum_(x_i>x_k) w_i>=1/2$ === (a) 证明,当$w_i=1/n$时,$x_1,x_2...x_n$的中位数是加权中位数。 中位数的左边和右边的数字个数 $<= floor(n/2)$。因此每一边的数字的权和 $<= 1/2$ === (b)设计一种基于排序的算法求解加权中位数,要求其最差算法复杂度小于$O(n lg n)$。证明设计算法的时间复杂度 首先对元素按照其值进行排序,然后计算加权前缀和,直到找到第一个加权前缀和大于等于 1/2 的元素。这个元素就是加权中位数。 该算法的时间复杂度分为排序和计算加权前缀和两个部分。排序的时间复杂度为$O (n log n)$,而计算加权前缀和的时间复杂度为$O (n)$。因此,总体时间复杂度为 $O (n log n)$ === (c) 考虑一维快递中心选址问题。我们给出n个不同点$p_1,p_2...p_n$(即n个数值),分别拥有权重$w_1,w_2...w_n$,我们需要找到一个点p(p可以是任意一个点,不一定是n个给定点中的一个),要求最小化$sum_(i=1)^n w_i d(p,p_i)$,这里d是距离,定义为$p-p_i$。证明, 序列的加权中位数即是所求的p点。(提示:p这里是连续变量,其导数为0时,有极值) $ f(p)=sum_(i=1)^n w_i |p-p_i| $ $ f'(p)=sum_(i=1)^n w_i "sgn"(p-p_i) = sum_(x_i<p) w_i - sum_(x_i>p) w_i $ 当 p 为加权中位数时,$sum_(x_i<p) w_i$ 与 $sum_(x_i>p) w_i$ 最接近,得 $f'(p)$ 最小,即为 $f(p)$ 的极值。 === (d) 进一步的,我们考虑二维的快递中心选址问题,此时$p_i=(x_i,y_i)$,采用曼哈顿距离$d(p,p_i)=|x-x_i|+|y-y_i|$。给出一种算法复杂度为$O(n lg n)$的算法来解决该问题,写出相应的伪代码。 #include_code("算法导论/code/sort-3.py") == (不做要求)课本第2章思考题:2-1。这道思考题实际上就是Timsort的介绍。请大家思考这个问题,完成习题部分,以及给出伪代码(或是程序)。 == (leetcode题目)leetcode 题库 88、21、23、147、148、41、75、34、74。 https://github.com/lxl66566/OJ/tree/main/leetcode_cn
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/03-unicode/norm-decomp.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note, cross-ref #import "/template/util.typ" #import "/lib/glossary.typ": tr #show: web-page-template // ## Normalization and decomposition == #tr[normalization]和#tr[decompose] <heading:normalization-decomposition> // The Unicode Standard has a number of stated design goals: to be *universal*, in the sense that every character in every script likely to be used on computer has an encoding; to be *efficient*, such that algorithms used by computers to input and output Unicode characters do not require too much state or overhead; and to be *unambiguous*, in that every Unicode codepoint represents the same character. Unicode标准明面上有如下几个设计目标:通用,也即尽量#tr[encoding]所有可能在计算机中用到的#tr[scripts]中的所有#tr[character];高效,处理Unicode数据的输入输出的相关算法不能引入过多的额外状态和计算开销;明确且无歧义,Unicode#tr[codepoint]和#tr[character]互相一一对应。 // But it also has an unstated design goal, which is the unstated design goal of pretty much every well-behaved piece of software engineering: *backward compatibility*. Unicode wants to maintain compatibility with all previous encoding standards, so that old documents can be reliably converted to and from Unicode without ambiguity. To a first approximation, this means every character that was ever assigned a codepoint in some encoding should be assigned a unique codepoint in Unicode. 除此之外,还有一个没有直接表述出,但和绝大多数软件工程项目一样必须考虑的目标:*向后兼容*。Unicode希望尽量对先前的#tr[encoding]标准保持兼容,这样老旧的文档才能被可靠地在原始#tr[encoding]和Unicode间来回转换。这几乎就是说,只要先前的某个#tr[encoding]标准中有某个#tr[character],Unicode就必须为它赋予一个专属的#tr[codepoint]。 // This contrasts somewhat with the goal of unambiguity, as there can be multiple different ways to form a character. For instance, consider the character n̈ (Latin small letter n with diaeresis). It occurs in Jacaltec, Malagasy, Cape Verdean Creole, and most notably, *This Is Spın̈al Tap*. Despite this obvious prominence, it is not considered noteworthy enough to be encoded in Unicode as a distinct character, and so has to be encoded using *combining characters*. 这在某种程度上和之前说的无歧义目标是相违背的。因为同一个#tr[character]在不同的古老标准中可能有不同的构建方式。比如#tr[character]n̈(带有分音符的小写拉丁字母N),它在雅卡尔泰克语、马达加斯加语、卡布佛得鲁语和著名的电影《This Is Spın̈al Tap》中都有使用。尽管如此常见,但Unicode不认为它重要到要用一个单独的#tr[character]来#tr[encoding]。最终我们用一种叫做*可#tr[combine]#tr[character]*的方式#tr[encoding]它。 // A combining character is a mark that attaches to a base character; in other words, a diacritic. To encode n̈, we take LATIN SMALL LETTER N (U+006E) and follow it with COMBINING DIAERESIS (U+0308). The layout system is responsible for arranging for those two characters to be displayed as one. 可#tr[combine]#tr[character]是附加到基本#tr[character]上的符号,也称为#tr[diacritic]。为了#tr[encoding]n̈,首先需要#tr[character]`U+006E LATIN SMALL LETTER N`(拉丁文小写字母N),然后在其后加上`U+0308 COMBINING DIAERESIS`(#tr[combine]用分音符)。#tr[layout]系统会负责将这两个#tr[character]编排显示为一个整体\u{006E}\u{0308}。 #note[ // > This obviously walks all over the "efficiency" design goal - applications which process text character-by-character must now be aware that something which visually looks like one character on the page, and semantically refers to one character in text, is actually made up of *two* characters in a string, purely as an artifact of Unicode's encoding rules. Poorly-written software can end up separating the two characters and processing them independently, instead of treating them as one indivisible entity. 这显然违背了关于高效的设计目标。文本处理应用必须能够理解,有些在页面上看上去是一个#tr[character],在文本概念中也是一个#tr[character]的东西,到了编程领域的字符串概念中却是*两个*#tr[character]。而这纯粹只是Unicode#tr[encoding]规则的产物。质量一般的软件可能会把这两个#tr[character]分开并单独处理,而不是将其视为不可分割的整体。 ] // Now consider the character ṅ (Latin small letter n with dot above). Just one dot different, but a different story entirely; this is used in the transliteration of Sanskrit, and as such was included in pre-Unicode encodings such as CS/CSX (Wujastyk, D., 1990, *Standardization of Sanskrit for Electronic Data Transfer and Screen Representation*, 8th World Sanskrit Conference, Vienna), where it was assigned codepoint 239. Many electronic versions of Sanskrit texts were prepared using the character, and so when it came to encoding it in Unicode, the backward compatibility goal meant that it needed to be encoded as a separate character, U+1E45. 现在来看另一个#tr[character]ṅ(上面带点的拉丁文小写字母N),它和n̈看起来只有“一点”区别,但后续的命运却迥然不同。这个字母用于梵文的拉丁转写,曾经被CS/CSX#tr[encoding]#footnote[1990年,第八届世界梵语大会于维也纳举行。在会议的一次关于梵文在电子数据传输中的标准化问题的小组讨论会上,#cite(form: "prose", <Wujastyk.StandardizationSanskrit.1990>)提出了此编码。]收录于#tr[codepoint]239上,许多使用梵文的电子文本都会使用这一#tr[character]。因此为了向后兼容性,Unicode需要将它视为一个单独的#tr[character]。最终它被放置在#tr[codepoint]`U+1E45`上。 // But of course, it could equally be represented in just the same way as n̈: you can form a ṅ by following a LATIN SMALL LETTER N (U+006E) with a COMBINING DOT ABOVE (U+0307). Two possible ways to encode ṅ, but only one possible way to encode n̈. So much for "unambiguous": the two strings "U+006E U+0307" and "U+1E45" represent the same character, but are not equal. 但是它也理所当然地可以用#tr[encoding]n̈的那种方式来表示:`U+006E LATIN SMALL LETTER N`(拉丁文小写字母N)和`U+0307 COMBINING DOT ABOVE`(#tr[combine]用上点)这两个字符#tr[combine]起来也是\u{006E}\u{0307}。现在,我们有两种不同的#tr[encoding]可以表示ṅ,但只有一种方式表示n̈。另外,`U+006E U+0307`和`U+1E45`这两个字符串表示同一个#tr[character],但它们明显不相等。看起来歧义问题好像越来越严重了。 // But wait - and you're going to hear this a lot when it comes to Unicode - it gets worse! The sign for an Ohm, the unit of electrical resistance, is Ω (U+2126 OHM SIGN). Now while a fundamental principle of Unicode is that *characters encode semantics, not visual representation*, this is clearly in some sense "the same as" Ω. (U+03A9 GREEK CAPITAL LETTER OMEGA) They are semantically different but they happen to look the same; and yet, let's face it, from a user perspective it would be exceptionally frustrating if you searched in a string for a Ω but you didn't find it because the string contained a Ω instead. 别急,还有更糟的。还记得我们说过,Unicode是“按照语义,而不是外形”收录#tr[character]的。举例来说,用于表示电阻单位的 Ω(`U+2126 OHM SIGN`,欧姆标记)和Ω(`U+03A9 GREEK CAPITAL LETTER OMEGA`,希腊文大写字母Omega)就因语义不同而被分别收录。但是,让我们面对现实吧。如果在一串文本中搜索Ω,却因为在其中的是Ω而无法搜索出来,站在普通用户的角度看这也太迷惑和荒谬了。 // The way that Unicode deals with both of these problem is to define one of the encodings to be *canonical*. The Standard also defines two operations: *Canonical Decomposition* and *Canonical Composition*. Replacing each character in a string with its canonical form is called *normalization*. Unicode处理上述问题的方式是定义一个#tr[canonical]#tr[encoding]。标准中还定义了两个操作:*#tr[canonical]#tr[decompose]*和*#tr[canonical]#tr[compose]*。将字符串中的所有#tr[character]转化为其对应的#tr[canonical]形式的过程称为*#tr[normalization]*。 #note[ // > There's also a "compatibility decomposition", for characters which are very similar but not precisely equivalent: ℍ (U+210D DOUBLE-STRUCK CAPITAL H) can be simplified to a Latin capital letter H. But the compatibility normalizations are rarely used, so we won't go into them here. 另外还有一种操作叫兼容#tr[decompose],对于一些非常相似,但其实有细微差别的#tr[character]进行兼容处理。比如 ℍ(`U+210D DOUBLE-STRUCK CAPITAL H`,双线大写H),在兼容#tr[decompose]操作下会简化为拉丁大写字母H。但因为这种方式其实很少用到,我们在此不进行过多介绍。 ] // The simplest way of doing normalization is called Normalization Form D, or NFD. This just applies canonical decomposition, which means that every character which can be broken up into separate components gets broken up. As usual, the Unicode Database has all the information about how to decompose characters. 进行#tr[normalization]的最简单的方法是NFD(Normalization Form D,#tr[normalization]形式D),只需要执行一遍#tr[canonical]#tr[decompose]即可。在NFD完成后,每个#tr[character]都被分解为其组成部分。和之前一样,Unicode数据库也包含了关于如何#tr[decompose]#tr[character]的信息。 // Let's take up our example again of GREEK CAPITAL LETTER IOTA WITH DIALYTIKA AND TONOS, which is not encoded directly in Unicode. Suppose we decide to encode it as U+0399 GREEK CAPITAL LETTER IOTA followed by U+0344 COMBINING GREEK DIALYTIKA TONOS, which seems like a sensible way to do it. When we apply canonical decomposition, we find that the Unicode database specifies a decomposition U+0344 - it tells us that the combining mark breaks up into two characters: U+0308 COMBINING DIAERESIS and U+0301 COMBINING ACUTE ACCENT. 以前文提到过的“带Dialytika和Tonos的希腊文大写字母Iota”为例,它没有被Unicode直接#tr[encoding]。假设现在我们决定用`U+0399 GREEK CAPITAL LETTER IOTA`(希腊文大写字母Iota)和`U+0344 COMBINING GREEK DIALYTIKA TONOS`(#tr[combine]用希腊文Dialytika Tonos)这个非常合理的组合来表示它。当进行#tr[canonical]#tr[decompose]时,我们发现Unicode数据库为`U+0344`指定了#tr[decompose]形式,这个#tr[combine]符需要被#tr[decompose]为两个#tr[character]:`U+0308 COMBINING DIAERESIS`(#tr[combine]用分音符)和`U+0301 COMBINING ACUTE ACCENT`(#tr[combine]用锐音符)。 #let codepoint-table = (s, title: none) => { let cps = s.codepoints() block( breakable: false, width: 100%, align( center, table( columns: cps.len() + 1, align: center, if title == none { [] } else { title }, ..cps, [], ..cps.map(str.to-unicode).map(it => raw(util.to-string-zero-padding(it, 4, base: 16))), ), ), ) } #codepoint-table("\u{0399}\u{0344}", title: [输入字符串]) #codepoint-table("\u{0399}\u{0308}\u{0301}", title: [NFD]) // NFD is good enough for most uses; if you are comparing two strings and they have been normalized to NFD, then checking if the strings are equal will tell you if you have the same characters. However, the Unicode Standard defines another step: if you apply canonical composition to get characters back into their preferred form, you get Normalization Form C. NFC is the recommended way of storing and exchanging text. When we apply canonical composition to our string, the iota and the diaresis combine to form U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA, and the combining acute accent is left on its own: NFD对于绝大多数应用场景来说都是个不错的选择。比如希望比较两个字符串是否相等,只需要先进行NFD,然后逐个字符比较即可。Unicode还定义了另一种处理方法:在NFD的基础上再进行一个步骤,为已#tr[decompose]的#tr[character]进行#tr[canonical]#tr[compose],将它们重组成首选形式,这样就得到了NFC(Normalization Form C,#tr[normalization]形式C)。NFC是用于储存和交换文本的推荐方式。当进行#tr[canonical]#tr[compose]时,字母Iota和分音符会#tr[combine]成`U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA`(带 Dialytika 的希腊文大写字母 Iota),剩下的组合用锐音符就原样保留: #codepoint-table("\u{0399}\u{0344}", title: [输入字符串]) #codepoint-table("\u{0399}\u{0308}\u{0301}", title: [NFD]) #codepoint-table("\u{03aa}\u{0301}", title: [NFC]) // Note that this is an entirely different string to our input, even though it represents the same text! But the process of normalization provides an unambiguous representation of the text, a way of creating a "correct" string that can be used in comparisons, searches and so on. 虽然这个文本和我们最初的输入已经大不相同了,但它们表达的含义还是一样的。通过某种特定的#tr[normalization]后,用来表达一段文本的字符串就被唯一的确定了。这一方法可以用于字符串比较和搜索等多种场景。 #note[ // > The OpenType feature `ccmp`, which we'll investigate in chapter 6, allows font designers to do their own normalization, and to arrange the input glyph sequence into ways which make sense for the font. 我们在#cross-ref(<chapter:substitution-positioning>, web-path: "/chapters/06-features-2/features-2.typ", web-content: [后文])中会介绍的OpenType特性`ccmp`允许字体设计师按照他们希望的方式进行#tr[normalization],可以将输入的#tr[glyph]序列重新整理成在字体内部更易处理的形式。 // To give two examples: first, in Syriac, there's a combining character SYRIAC PTHAHA DOTTED (U+0732), which consists of a dot above and a dot below. When positioning this mark relative to a base glyph, it's often easier to position each dot independently. So, the `ccmp` feature can split U+0732 into a dot above and a dot below, and you can then use OpenType rules to position each dot in the appropriate place for a base glyph. 这里简单举两个例子。一是在叙利亚语中有一个#tr[combine]#tr[character]`U+0732 SYRIAC PTHAHA DOTTED`(叙利亚文带点的 Pthaha),它由一上一下两个点组合而成。当需要以某个基本#tr[character]为参考来确定这个符号的所在位置时,对这两个点分别进行处理通常是更加简单的。此时就可以用`ccmp`特性将`U+0732`分成上下两个点,然后再使用OpenType规则为基本#tr[glyph]分别定义这两个点的合适位置。 // Second, the character í (U+00ED LATIN SMALL LETTER I WITH ACUTE) is used in Czech, Dakota, Irish and other languages. Unless you've actually provided an i-acute glyph in your font, you'll get handed the decomposed string LATIN SMALL LETTER I, COMBINING ACUTE ACCENT. LATIN SMALL LETTER I has a dot on the top, and you don't want to put a combining acute accent on *that*. `ccmp` will let you swap out the "i" for a dotless "ı" before you add your accent to it. 第二个例子是#tr[character]í(`U+00ED LATIN SMALL LETTER I WITH ACUTE`,带锐音符的拉丁文小写字母I)。这个字母在捷克语、达科他语、爱尔兰语等语言中都会用到。一般而言,只要字体里没有单独为它绘制#tr[glyph]的话,都会将它#tr[decompose]为字母i和锐音符两个部分来处理。但是i上面有一个小点,我们不能直接将锐音符放在点的上面。这时`ccmp`特性允许我们在添加锐音符之前将字母i替换成没有点的ı。 ]
https://github.com/ShapeLayer/ucpc-solutions__typst
https://raw.githubusercontent.com/ShapeLayer/ucpc-solutions__typst/main/lib/utils/make-hero.typ
typst
Other
#import "/lib/colors.typ": color #let __ucpc_build_hero_subtitle( authors: (), datetime: none, ) = [ #text(size: 2em)[ #if type(authors) == array [ #authors.map(each => each).join(", ") ] else if type(authors) == str [ #authors ] ] \ #if datetime != none [#datetime] ] #let make-hero( title: none, subtitle: none, fgcolor: white, bgcolor: color.bluegray.at(2), height: 65%, authors: (), datetime: none, ) = { if (title == none) { panic("`title` field is required") } // Upper rect( width: 100%, height: height, fill: bgcolor, outset: 0%, inset: (left: 5em, y: 3em), )[ #align(horizon)[ #text(fill: fgcolor)[ = #text( size: 40pt, weight: "bold", )[#title] \ #text(size: 22pt, weight: "medium")[#subtitle] ] ] ] align(center + horizon)[ #text(fill: bgcolor)[ #__ucpc_build_hero_subtitle(authors: authors, datetime: datetime) ] ] }
https://github.com/pku-typst/ichigo
https://raw.githubusercontent.com/pku-typst/ichigo/main/README.md
markdown
MIT License
# ichigo - 苺 Homework Template - 作业模板 ## Usage - 使用方法 ```typ #import "@preview/ichigo:0.1.0": config, prob #show: config.with( course-name: "Typst 使用小练习", serial-str: "第 1 次作业", author-info: [ sjfhsjfh from PKU-Typst ], author-names: "sjfhsjfh", ) #prob[ Calculate the 25th number in the Fibonacci sequence using Typst ][ #let f(n) = { if n <= 2 { return 1 } return f(n - 1) + f(n - 2) } #f(25) ] ``` ## Documentation - 文档 [Click to download - 点击下载](https://github.com/PKU-Typst/ichigo/releases/download/v0.1.0/documentation.pdf) ## TODO - 待办 - [ ] Equation Numbering - [ ] Theme list - [ ] Support custom(local) theme
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fletcher/0.4.3/src/coords.typ
typst
Apache License 2.0
#import "utils.typ": * /// Convert from elastic to absolute coordinates, $(u, v) |-> (x, y)$. /// /// _Elastic_ coordinates are specific to the diagram and adapt to row/column /// sizes; _absolute_ coordinates are the final, physical lengths which are /// passed to `cetz`. /// /// - grid (dictionary): Representation of the grid layout, including: /// - `origin` /// - `centers` /// - `spacing` /// - `flip` /// - uv (array): Elastic coordinate, `(float, float)`. #let uv-to-xy(grid, uv) = { let (i, j) = vector.sub(uv, grid.origin) let (n-x, n-y) = grid.centers.map(array.len) if grid.flip.xy { (n-x, n-y) = (n-y, n-x) } if grid.flip.x { i = (n-x - 1) - i } if grid.flip.y { j = (n-y - 1) - j } if grid.flip.xy { (i, j) = (j, i) } (i, j).zip(grid.centers, grid.spacing) .map(((t, c, s)) => interp(c, t, spacing: s)) } /// Convert from absolute to elastic coordinates, $(x, y) |-> (u, v)$. /// /// Inverse of `uv-to-xy()`. #let xy-to-uv(grid, xy) = { let (i, j) = xy.zip(grid.centers, grid.spacing) .map(((x, c, s)) => interp-inv(c, x, spacing: s)) let (n-x, n-y) = grid.centers.map(array.len) if grid.flip.xy { (n-x, n-y) = (n-y, n-x) } if grid.flip.xy { (i, j) = (j, i) } if grid.flip.x { i = (n-x - 1) - i } if grid.flip.y { j = (n-y - 1) - j } vector.add((i, j), grid.origin) } /// Jacobian of the coordinate map `uv-to-xy()`. /// /// Used to convert a "nudge" in $u v$ coordinates to a "nudge" in $x y$ /// coordinates. This is needed because $u v$ coordinates are non-linear /// (they're elastic). Uses a balanced finite differences approximation. /// /// - grid (dictionary): Representation of the grid layout. /// - uv (array): The point `(float, float)` in the $u v$-manifold where the /// shift tangent vector is rooted. /// - duv (array): The shift tangent vector `(float, float)` in $u v$ coordinates. #let duv-to-dxy(grid, uv, duv) = { let duv = vector.scale(duv, 0.5) vector.sub( uv-to-xy(grid, vector.add(uv, duv)), uv-to-xy(grid, vector.sub(uv, duv)), ) } /// Jacobian of the coordinate map `xy-to-uv()`. #let dxy-to-duv(grid, xy, dxy) = { let dxy = vector.scale(dxy, 0.5) vector.sub( xy-to-uv(grid, vector.add(xy, dxy)), xy-to-uv(grid, vector.sub(xy, dxy)), ) } /// Return a vector in $x y$ coordinates with a given angle $θ$ in $x y$-space /// but with a length specified in either $x y$-space or $u v$-space. #let vector-polar-with-xy-or-uv-length(grid, xy, target-length, θ) = { if type(target-length) == length { vector-polar(target-length, θ) } else { let unit = vector-polar(1pt, θ) let det = vector.len(dxy-to-duv(grid, xy, unit)) vector.scale(unit, target-length/det) } } /// Convert labels into the coordinates of a node with that label, leaving /// anything else unchanged. #let resolve-label-coordinate(nodes, coord) = { if type(coord) == label { let node = nodes.find(node => node.name == coord) assert(node != none, message: "Couldn't find label " + repr(coord)) node.pos } else { coord } } /// Given a sequence of coordinates of the form `(x, y)` or `(rel: (Δx, Δy))`, /// return a sequence in the form `(x, y)` where relative coordinates are /// applied relative to the previous coordinate in the sequence. /// /// The first coordinate must be of the form `(x, y)`. #let resolve-relative-coordinates(coords) = { let resolved = coords for i in range(1, coords.len()) { let prev = resolved.at(i - 1) if type(coords.at(i)) == dictionary and "rel" in coords.at(i) { resolved.at(i) = vector.add(coords.at(i).rel, prev) } } resolved }
https://github.com/michidk/cv
https://raw.githubusercontent.com/michidk/cv/main/src/resume-onepage.typ
typst
#import "template/mod.typ": * #show: template.with( data: json("../data/resume.json"), displayTagline: false, displaySummary: false, displayInterests: false, displayVolunteering: false, importanceFilter: 3, // filter everything that is less important than 3 maxHighlights: 2, // show only the first 2 highlights hideDescriptions: true, fontSizeAdjustment: 3pt, margins: (top: 0.4cm, bottom: 0.4cm, left: 0.4cm, right: 0.4cm), debug: false )
https://github.com/JarKz/math_analysis_with_typst
https://raw.githubusercontent.com/JarKz/math_analysis_with_typst/main/groups/fourth.typ
typst
MIT License
= Четвертая группа вопросов 1. *Понятие числового ряда, его суммы, сходимости и расходимости. Свойства сходящихся рядов.* 2. *Критерий Коши сходимости ряда. Необходимый признак сходимости ряда. Его недостаточность.* 3. *Критерий схгодимости положительных рядов. Признаки сравнения.* 4. *Признаки Коши и Даламбера для положительных рядов.* 5. *Интегральный критерий сходимости ряда.* 6. *Понятие абсолютно сходящегося ряда. Признаки абсолютной сходимости.* 7. *Теорема о перестановках членов абсолютно сходящегося ряда.* 8. *Теорема об умножении рядов.* 9. *Условная сходимость ряда. Признак условной сходимости. Примеры условно сходящихся рядов.* 10. *Знакопеременные и знакочередующиеся ряды. Признак Лейбница.* 11. *Преобразование Абеля. Признак Дирихле и признак Абеля сходимости числовых рядов.* 12. *Теорема Римана об условно сходящихся рядах.* 13. *Понятие поточечной сходимости функциональных последовальностей и рядов. Область сходимости.* 14. *Основные проблемы теории функциональных последовальностей и рядов. Примеры, где порядок предельных переходов существенен.* 15. *Понятие равномерной сходимости. Критерий равномерной сходимости.* 16. *Мажорантный признак Вейерштрасса равномерной сходимости функционального ряда.* 17. *Признаки Дирихле и Абеля равномерной сходимости рядов.* 18. *Теорема о непрерывности предела функциональной последовательнсоти (суммы ряда).* 19. *Теорема об интегрируемости предела функциональной последовательности (суммы ряда).* 20. *Теорема о дифференцируемости предела функциональной последовательности (суммы ряда).* 21. *Степенные ряды. Радиус сходимости. Интервал сходимости.* 22. *Теорема о равномерной сходимости стеменного ряда. Теорема о непрерывности суммы степенного ряда.* 23. *Теоремы о дифференцируемости суммы степенного ряда.* 24. *Степенной ряд как ряд Тейлора свой суммы. Разложение функций $1/(1 + x)$, $ln(1+x)$, $(1 + x)^mu$ в степенные ряды в корестности точки $x = 0$.* 25. *Разложение функции $e^z$, $cos(z)$, $sin(z)$ в степенные ряды. Формула Эйлера.* 26. *Понятие ортогональной и ортонормированной систем функций, ортогональность триготометрических систем.* 27. *Понятие ортогонального ряда. Теорема о равномерной сходимости ортогонального ряда. Понятие ряда Фурье.* 28. *Минимизирующее свойство частичных сумм ряда Фурье.* 29. *Неравенство Бесселя. Стремление к нулю коэффициентов ряда Фурье. Равенство Парсеваля и сходимость в среднем.* 30. *<NAME>. И<NAME>. Принцип локализации.* 31. *Достаточные признаки поточечной сходимости тригонометрического ряда Фурье.* 32. *Теорема о равномерной сходимости тригонометрического ряда Фурье.* 33. *Ядро Фейера и его свойства. Суммы Фейера.* 34. *Теорема Фейера. Теорема Стоуна – Вейерштрасса.* 35. *Полнота и замкнутость тригонометрической системы.*
https://github.com/drupol/master-thesis
https://raw.githubusercontent.com/drupol/master-thesis/main/resources/typst/scientific-method-w-r13y.typ
typst
Other
#import "../../src/thesis/imports/preamble.typ": * #render( read("../../resources/graphviz/scientific-method-with-reproducibility.dot"), width: 100%, labels: ( step0: [#text(font: "Virgil 3 YOFF", size: .95em)[Observation]], step1: [#text(font: "Virgil 3 YOFF", size: .95em)[Question]], step2: [#text(font: "Virgil 3 YOFF", size: .95em)[Hypothesis]], step3: [#text(font: "Virgil 3 YOFF", size: .95em)[Prediction]], step4: [#text(font: "Virgil 3 YOFF", size: .95em)[Testing]], step5: [#text(font: "Virgil 3 YOFF", size: .95em)[Analysis]], step6: [#text(font: "Virgil 3 YOFF", size: .95em)[Repeat]], ), )
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/Reading/index.typ
typst
#import "/src/components/TypstTemplate/lib.typ": * #show: project.with( title: "paper_reading", lang: "zh", ) - Acceleration via Fractal Learning Rate Schedules - Deep Patch Visual Odometry - Error bounds for approximations with deep ReLU networks - 跟李沐学 AI 之论文精读 + CLIP: #link("https://www.bilibili.com/video/BV1SL4y1s7LQ")[CLIP 论文逐段精读【论文精读】] + MAE: #link("https://www.bilibili.com/video/BV1sq4y1q77t/")[MAE 论文逐段精读【论文精读】] + Attention is All You Need: #link("https://www.bilibili.com/video/BV1pu411o7BE/")[Transformer 论文逐段精读【论文精读】] + ViT: #link("https://www.bilibili.com/video/BV15P4y137jb/")[ViT 论文逐段精读【论文精读】]
https://github.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024
https://raw.githubusercontent.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024/master/chap11/shape.typ
typst
#import "@preview/cetz:0.2.2" #cetz.canvas(length: 2cm,{ import cetz.draw: * // 外框 set-style(mark: (end: "straight")) line((1, 0), (0, 0), stroke: blue) // 底部 line((3, 0), (2, 0), stroke: blue) // 底部 line((0, 1), (0, 2), stroke: blue) line((0, 0), (0, 1), stroke: blue) line((1, 1), (1, 0), stroke: blue) line((2, 0), (2, 1), stroke: blue) line((3, 1), (3, 0), stroke: blue) line((3, 2), (3, 1), stroke: blue) line((2, 1), (1, 1), stroke: blue) line((0, 2), (1, 2), stroke: blue) line((1, 2), (2, 2), stroke: blue) line((2, 2), (3, 2), stroke: blue) set-style(mark: none) let v-(x, y) = line((x, y - .05), (x, y + .05)) let h-(x, y) = line((x - .05, y), (x + .05, y)) let dot(x, y, ..arguments) = circle((x, y), radius: .05, ..arguments) h-(0, 1) h-(3, 1) v-(1, 2) v-(2, 2) dot(0, 2, fill: red, stroke: red) content((0, 2.2), "起点") content((.5, 2.15), $0$) content((1.5, 2.15), $0$) content((2.5, 2.15), $0$) content((3.15, 1.5), $3$) content((3.15, .6), $3$) content((2.5, .15), $2$) content((2.15, .6), $1$) content((1.5, 1.15), $2$) content((1.15, .6), $3$) content((.5, .15), $2$) content((.15, .6), $1$) content((.15, 1.5), $1$) let colored(x) = text(fill: purple, $#x$) content((1, 2.2), colored($0$)) content((2, 2.2), colored($0$)) content((3, 2.2), colored($3$)) content((3.15, 1), colored($0$)) content((3.15, 0), colored($3$)) content((2-.15, 0), colored($3$)) content((2.15, 1.1), colored($1$)) content((1-.15, 1.1), colored($1$)) content((1.15, 0), colored($3$)) content((-.2, 0), colored($3$)) content((-.2, 1), colored($0$)) content((-.2, 2), colored($3$)) })
https://github.com/HEIGVD-Experience/docs
https://raw.githubusercontent.com/HEIGVD-Experience/docs/main/S4/ISI/docs/4-Defense/defense.typ
typst
#import "/_settings/typst/template-note.typ": conf #show: doc => conf( title: [ Défense ], lesson: "ISI", chapter: "4 - Defense", definition: "Cette note parle de la sécurité informatique, abordant le protocole TLS pour sécuriser les communications web, l'utilisation de HTTPS, la sécurisation des emails avec PGP, la protection des réseaux via les pare-feu et la défense contre les attaques par le biais des équipements avec EDR", col: 1, doc, ) = SLS/TLS - SLS: Security Level Specification - TLS: Target Level of Security Leur *objectif* est d'offrir une boîte à outils pour établir des communications sécurisées. Le protocole a été développé par Netscape et avait pour objectif de sécuriser les échanges sur le web. Il est basé sur SSL (Secure Socket Layer) et a été renommé TLS (Transport Layer Security) par l'IETF. Ce protocole s'applique à la couche *application* du modèle OSI. == Propositions - négociation de la version SSL/TLS et des algorithmes utilisés - authentification des entités - authentification/intégrité des données - confidentialité des données - compression des données == Utilisation === Création nouveau protocol - HTTP (port 80) devient HTTPS (port 443) - Avantage: assure que la communication est sécurisée - Inconvénient: seuls les clients supportants TLS peuvent se connecter === Extension protocol existant - ESMTP avec STARTTLS, le client *peut* demander du TLS - Avantage: le client n'a pas besoin de supporter TLS mais peut le demander si souhaité - Inconvénient: les communications peuvent ne pas être sécurisées == HTTPS - L'utilisation de TLS est imposée (non négociable) - Le serveur doit avoir un certificat - Garantie de l'authenticité du serveur - Garantie de la confidentialité des communications - Le client peut avoir un certificat (optionnel) == SMTP, POP3, IMAP - ESMTP (envoi d'emails) - POP3 (récupération d'emails) - IMAP (gestion d'une boîte email) - Faiblesses du protocole de base : - Par défaut, les mots de passe sont envoyés en clair. - Par défaut, le contenu des emails est envoyé en clair. - *TLS* permet de protéger l'ensemble des communications : - TLS est une *extension* du protocole - TLS est *optionnelle* (configuration) = PGP PGP signifie Pretty Good Privacy. C'est un logiciel permettant de sécuriser du texte, des emails, des fichiers, des répertoires, etc.. Il utilise la *cryptographie hybride* (symétrique et asymétrique). Il garantit : - la confidentialité des données (chiffrement) - l'authentification/intégrité des données (signature) == Principe #image("/_src/img/docs/image copy 124.png") == Algorithme utilisés - Fonctions de hachage : - MD5, SHA-1,... - Chiffrement symétrique : - 3DES, IDEA, AES, ... - Algorithmes asymétriques : - RSA, DSA, ElGamal - Types de clés : - RSA et RSA - DSA et ElGamal - DSA (signature uniquement) - RSA (signature uniquement) == PGP vs X.509 Clé signée = certificat, c'est un lien entre une clé publique et une identité. X.509 ne permet qu'une *seule identité* alors que PGP permet *plusieurs identités*. X.509, l'auteur est l'autorité de certification (*une seule* signature) alors que PGP, les auteurs sont ad-hoc (*plusieurs signatures* possibles) Un certificat PGP comprend : - une/plusieurs identité(s) - une/plusieurs signature(s) par identité - photo (option) - un révocateur désigné (option) - une «Additional Decryption Key» (option) #image("/_src/img/docs/image copy 125.png") = Pare-feu Un pare-feu est un dispositif de sécurité qui a pour objectif de protéger un réseau informatique des attaques extérieures. Il est placé entre le réseau local et le réseau externe (Internet). == Contrôles d'accès - Filtrage statique (obsolète) : - inspection de chaque paquet indépendamment les uns des autres (rarement utilisé) - Pare-feu sans mémoire - Pare-feu sans état - Filtrage dynamique : - décision en fonction du rôle du paquet dans les flux de communication (client-serveur essentiellement) - Pare-feu avec mémoire - Pare-feu à état == Types de pare-feu - Pare-feu réseau - équipement réseau - filtrage des paquets entre deux réseaux - critères de base : source (IP), destination (IP), service (ports), ... - Pare-feu personnel - logiciel installé sur un ordinateur - filtrage des paquets entre l’ordinateur et le réseau - critères de base : application, source (IP), destination (IP), service (ports), ... = EDR •Un attaquant peut pénétrer dans réseau privé en s'en prenant a un équipement ("endpoint") disposant d'un accès privilégié - Réseau: VPN obligatoire (totalité du traffic sauf la connexion au VPN) - Gestion à distance via un agent - Anti-virus - Collecte centralisée des logs vers un SIEM
https://github.com/tingerrr/chiral-thesis-fhe
https://raw.githubusercontent.com/tingerrr/chiral-thesis-fhe/main/src/core/kinds.typ
typst
#import "/src/core/authors.typ" as _authors #let kinds = ( report: ( key: "report", name: "Belegarbeit", ), thesis-bachelor: ( key: "thesis-bachelor", name: "Bachelorarbeit", ), thesis-master: ( key: "thesis-master", name: "Masterarbeit" ), ) #let report( title: [Mustertitel], subtitle: none, author: "Musterstudent, Max", field: [Fachbereich], date: datetime(year: 1970, month: 01, day: 01), ) = { ( kind: kinds.report, id: none, title: title, subtitle: subtitle, author: _authors.prepare-author(author), field: field, date: date, supervisors: (), ) } #let thesis( kind: none, id: [ID], title: [Mustertitel], subtitle: none, author: "Musterstudent, Max", field: [Fachbereich], date: datetime(year: 1970, month: 01, day: 01), supervisors: ( "Prof. Dr. <NAME>", "Prof. Dr. <NAME>", ), ) = { ( kind: kind, id: id, title: title, subtitle: subtitle, author: _authors.prepare-author(author), field: field, date: date, supervisors: supervisors.map(_authors.prepare-author), ) } // TODO: error handling #let is-thesis(kind) = kind.key.starts-with("thesis-") #let assert-kind-valid(kind) = { assert.eq(type(kind), dictionary) // ... }
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas2/4_Stvrtok.typ
typst
#let V = ( "HV": ( ("", "Jehdá ot dréva", "Vsjú napojíste zémľu, jákože ríki razďíľšesja duchóvnyja iz Jedéma, júže i poorávše vsíjaste spasíteľnoje propovídanije, i klás blahoplóden požáste múdriji, dúšy spasénnych, sích v mýslennych sokróviščach sokryvájušče učenicý Hospódni, jáko mnohocínnoje bohátstvo."), ("", "", "Ot ťmý strastéj i slastéj mnohostrástnoje mojé sérdce svobodíte, svitíľnicy súšče vostóka mýslennaho, i prosvitítelije presvítliji sólnca, vsím vozviščájušče razóršaho lésť nóšči zlovírija: jehóže umolíte i náša prosvitíti smýsly, jáko samovídcy sehó."), ("", "", "Nóvyja voístinnu blahodáti vý skrižáli Bohonačertánnyja, tajínnicy i svítcy oduševlénniji javístesja, slóvo spasíteľnoje nosjášče napísannoje Dúchom, Ótčim pérstom: ťímže proidóste vsjá koncý, víru pravoslávnuju, i k nebésnym stezjú vedúščuju, vsím čelovíkom jávi pokazújušče."), ("", "Jehdá ot dréva", "V Mírich požív čúvstvenňi, míro voístinnu javílsja jesí: mírom pomázan býv úmnym, svjáte Nikólaje svjatíteľu Christóv, oblahoucháješi bezsmértnuju voňú blahouchánija, víroju pritekájuščym pod króv tvój, razrišája sích ot napástej i bíd i skorbéj ótče, ko Hóspodu tvojími molítvami."), ("", "", "Mnóžestvom iskušénij soderžím, i trevolnénijem žitéjskim obchodím, volnámi že potopľájem obstojánij, i pečáľmi oblahájem, na ťá nadéždu mojú vsjú vozlaháju ótče Nikólaje, vsích ľútych podážď mí razrišénije molítvami tvojími, blažénne, jéže ko Vladýci i Bóhu nášemu."), ("", "", "Mrákom i potemňínijem pomyšlénij i bisóvskimi lesťmí obnosíma, i plotskími strasťmí oburevájema, i zakónom pobiždájema hrichóvnym, postíhnuv mjá ozarí svítom blahodáti: svít bo jesí v míri, božéstvennoju prosviščájem zaréju, dostoblažénne Nikólaje."), ("Bohoródičen", "", "Slóvo, jéže Otcú, i svjatómu Dúchu ravnočéstnoje sýj jáko velíkoje sólnce, iz Ďívy Bohootrokovícy vozsijávšeje na zemlí v posľídňaja, poslá vás jáko zarí, slávniji apóstoli, svítom víry prosviščájuščich vsjá čelovíki, vo mráci prélesti, i ťích k néj učéňmi božéstvennymi privoďáščich."), ), "S": ( ("", "", "Vozvelíčil jesí Spáse, vo vselénňij verchóvnych apóstol imená: navykóša bo nebésnym, i neizrečénna dáša zemným iscilénija: i síni ích jedíny nedúhi uvračeváchu, íže ot rýbarej čudotvorjášče, i íže ot Judéj bohoslóvjašče blahodáti učénija: íchže rádi Milosérde, dážď nám véliju mílosť."), ("", "", "Íže ot neprávednych ďijánij vsehdá borími, i k tebí pribihájušče voístinnu súščemu Bóhu, hlás tvojích učeník prinósim tí, hlahóľušče: spasí ny nastávniče, pohibájem. Pokaží i nýňi vrahóm nášym, mólimsja jáko pokryváješi ľúdi, i spasáješi ot bíd, molítvami apóstol, prezirája hrichí, za mnóhuju blahostýňu, Hóspodi sláva tebí."), ("", "", "Vélija sláva júže sťažáste svjatíji víroju: ne tókmo bo vo stradánijich vrahá pobidíli jesté, no i po smérti dúchi prohoňájete, nedúžnyja isciľájete, dúš i ťilés vráčeve, molítesja ko Hóspodu, pomílovatisja dušám nášym."), ("Bohoródičen", "", "Jáko plodovíta máslina, Ďíva izrastí tebé plodá živótnaho, plodonosíti míru véliju i bohátuju mílosť."), ), ) #let P = ( "1": ( ("", "", "Hrjadíte ľúdije, pojím písň Christú Bóhu, razďíľšemu móre, i nastávľšemu ľúdi, jáže izvedé iz rabóty jehípetskija, jáko proslávisja."), ("", "", "Íže blahočéstno ťá čístaja, súščuju Bohoródicu ispovídajuščaho dušéju i ustý, ot ľútych bíd, i nedúh i prehrišénij nýňi spasí prečístaja."), ("", "", "Vsjú v tebí blahodátej bézdnu ležášču uvíďichom: ťímže pribihájušče Bohoródice usérdno k pokróvu tvojemú božéstvennomu, spasájemsja."), ("", "", "O nás ťá pojúščich prečístaja, molí voploščénnaho ot prečístych tvojích i čestných krovéj, izbávitisja ot prehrišénij, i boľíznej hórkich."), ("", "", "Ťá pochvalú vírniji vsí sťažáchom, pribížišče i utverždénije i rádovanije, i dušám spasénije, nadéždu že i sťínu, Bohoblahodátnaja."), ), "3": ( ("", "", "Utverdí nás v tebí Hóspodi, drévom umerščvéj hrích, i strách tvój vsadí v serdcá nás pojúščich ťá."), ("", "", "Molítvami tvojími čístaja, Bóha jehóže rodilá jesí, podážď blahopremínna tvojím rabóm, pritekájuščym k pokróvu tvojemú, i vírno kláňajuščymsja tvojemú roždestvú."), ("", "", "Hlahóly mojejá molítvy uslýši Ďívo, iz hlubiný mojehó sérdca, jáže prinošú ti prepítaja, i ot strastéj i napástej spasí mja."), ("", "", "Vsjú mojú žízň okormí Ďívo, upovánije mojé i predstáteľnice, iskušénij i naítija izbavľájušči, i núžnych Bohonevísto."), ("", "", "Premúdrosť Bóžiju ipostásnuju na rukú jáko nosívši Bohomáti, ot nevíďinija i zabluždénija izbávitisja nám, molísja."), ), "4": ( ("", "", "Uslýšach Hóspodi, slávnoje tvojé smotrénije, i proslávich čelovikoľúbče nepostižímuju tvojú sílu."), ("", "", "Jázvam moím dušévnym, i plotskím skvérnam, jáže Bóha róždšaja Vladýčice, razrišénije podážď."), ("", "", "Oskvernénnaho mjá strasťmí, i pomyšléniji, i žitijá trevolnéniji, upovánijem Ďívo, i víroju utverdí."), ("", "", "Ot naítija izbávi mjá Máti Bóžija, i búri, i bíd tvojími molítvami, jedína prepítaja."), ("", "", "Oburevájema volnámi žitéjskimi, ischití Ďívo, k tvojemú pristánišču nastavľájušči mjá."), ), "5": ( ("", "", "Svíta podáteľu, i vikóv tvórče Hóspodi, vo svíťi tvojích poveľínij nastávi nás: rázvi bo tebé inóho Bóha ne znájem."), ("", "", "Orúžije nepobidímoje imúšče, na razlíčnaja iskušénija vrážija, vsjákaho ozloblénija izbavľájemsja jávi, íže ťá Bohoródicu čístuju víduščiji."), ("", "", "Zakóna ispolnénije, výššaja Cheruvím, rodilá jesí Bóžija Slóva voploščénna, Sýna jedinoródna: jehóže o rabích tvojích umolí."), ("", "", "Vsjáčeskich tvorcá na rukú tvojéju čístaja nosjášči, sehó nám tvojími molítvami blahopremínna daváj, nýňi vsím sérdcem k tebí pribihájuščym."), ("", "", "Ot uťisnénija i boľízni dúši, moľbú prinošú ti okajánnyj: ščedrót jedína róždšaja vinóvnoje Slóvo, uščédriv spasí mja."), ), "6": ( ("", "", "V bézdňi hrichóvňij vaľájasja, neizsľídnuju milosérdija tvojehó prizyváju bézdnu: ot tlí Bóže mjá vozvedí."), ("", "", "Spasénija pristánišče vídyj ťá, plávaja mnohopečáľnaho žitijá móre, prizyváju Vladýčice: okormíteľnica duší mojéj búdi."), ("", "", "Obnažíchsja odéždy cilomúdrija mojehó, ozlóblen býv, no Máti prisnoďívo Bóha róždšaja, rádosti odéždu podážď mí."), ("", "", "Čístaho žitijá otpadóch, k ľínosti žív strástnyj: no vozvedí blahoslovénnaja Vladýčice, poveľínijem Sýna tvojehó sočtávši."), ("", "", "Mílosti tvojejá Bohoródice spodóbi mjá, premílostivaho Slóva poróždšaja, svojéju króviju ot tlí čelovíki izbávľšaho."), ), "S": ( ("", "Božéstvennaho býchom", "Božéstvennaho mjá vchóda čístaja spodóbi, molítvami tvojími prisnoďívo, i sojúzy ľútych strastéj rastórhši, plámene búduščaho mjá svobodí."), ), "7": ( ("", "", "Óbrazu zlatómu na póli Deíri služímu, trijé tvojí ótrocy nebrehóša bezbóžnaho veľínija: posreďí že ohňá vvérženi, orošájemi pojáchu: blahoslovén jesí Bóže otéc nášich."), ("", "", "Na kresťí prihóžďsja, íže iz tebé voplotívyjsja Bohorodíteľnice, Adámovo razdrá rukopisánije: jehóže nýňi Ďívo molí, vsjákija zlóby izbávitisja víroju zovúščym: blahoslovénnaja, jáže Bóha plótiju róždšaja."), ("", "", "Nadéžda blahája, zastúpnica že vírnych jesí Vladýčice: i nýňi mólimsja tebí, darováti mílosti pučínu vsím na ťá naďíjuščymsja, i zovúščym tí: blahoslovénnaja, jáže Bóha plótiju róždšaja."), ("", "", "Ťmóju ľútoju žitijá obját býv, soskorbjáščaho i sboľíznujuščaho ne obritóch: tvojéju Ďívo svítlostiju razriší ťmú prehrišénij, i ozarí píti tebí blahoslovénnaja, jáže Bóha plótiju róždšaja."), ("", "", "V krásnuju odéždu spasíteľnych zápovidej kreščénijem oďíjavsja, očerních ľínostiju okajánnyj, nýňi že k tebí pritekáju Ďívo, vo odéždu prosjá spasénija tobóju páki obleščísja."), ), "8": ( ("", "", "V péšč óhnennuju ko otrokóm jevréjskim snizšédšaho, i plámeň v rósu prelóžšaho Bóha, pójte ďilá jáko Hóspoda, i prevoznosíte vo vsjá víki."), ("", "", "Iznemohájet mój nýňi úm, vo hlubinú vpád bezčéstija, jáko otvsjúdu razlíčnymi obját jésm zlými: no tý Ďívo iscilí, bezstrástija svítom oďíjavši."), ("", "", "Stólp kríposti tvérd, i stepéň, i chraníteľnicu, i zastúpnicu sťažávše ťá víroju, spasájemsja nýňi, pojúšče roždestvó tvojé prečístaja, i prevoznosjášče jehó vo vsjá víki."), ("", "", "Bezsmértija zarjú, i istóčnik vímy ťá Bohoródice, jáko róždšuju Slóvo bezsmértnaho Otcá, vsjá ot smérti izbavľájuščeje, prevoznosjáščyja jehó vo vsjá víki."), ("", "", "Strují iscilénij nám vsehdá vírnym čístaja istočáješi, jehóže nezavístnuju blahodáť vzémľušče, vospivájem roždestvó tvojé čístaja, i prevoznósim vo vsjá víki."), ), "9": ( ("", "", "Ot Bóha Bóha Slóva neizrečénnoju múdrostiju, prišédšaho obnovíti Adáma, jádiju v tľínije pádšaho ľúťi, ot svjatýja Ďívy neizrečénno voplotívšahosja nás rádi, vírniji jedinomúdrenno písňmi veličájem."), ("", "", "Bohoblažénnaja otrokovíce, nadéždu mojú vsjú usérdno vozložích na ťá: spasí mja Máti ístinnaho životá, i píšči prisnosúščnyja nasýtitisja, molí čístaja, víroju ťá i ľubóviju písňmi veličájuščemu."), ("", "", "Jávľšisja Ďívo dvér božéstvennaho svíta, duší mojejá mhlú svítom tvojím neveščéstvennym i blistániji ozarí, i ot víčnaho ohňá izbávitisja mí spodóbi čístaja, chodátajstvy tvojími: jáko da neprestánno veličáju ťá."), ("", "", "Boľáščyja zrjášči dušéju i ťílom, i vvérženyja v strásti ľútyja, blahoutróbijem tvojím Vladýčice iscilívši razriší, íže nýňi stužájemyja pečáľmi: da víroju i ľubóviju ťá písňmi veličájut."), ("", "", "Vo črévo tvojé vselísja, jehóže iz čréva prevéčnyj Otéc rodí Sýna, soveršén býsť čelovík, i istóčnik blahodátej ťá Bohomáti pokazá nám, vírno kláňajuščymsja neskazánnomu tvojemú roždéstvú."), ), ) #let U = ( "S1": ( ("", "", "Íže umudrívyj lovcý páče rítorov, i poslávyj jákože propovídniki po vséj zemlí, neizhlahólannym čelovikoľúbijem tvojím Christé Bóže: ťích rádi utverdí cérkov tvojú, i vírnym nizposlí blahoslovénije tvojé, jedíne vo svjatých počivájaj."), ("", "", "Premúdrosti Bóžija súšče učenicý i samovídcy, premúdrych i rítorov jáko nemúdruju múdrosť ochudíša, prostotóju própovidi jazýki umudrívše božéstvenniji apóstoli, pravoslávno vospiváti soďíteľa jedínaho i Hóspoda."), ("Bohoródičen", "", "Tebé veličájem Bohoródice, vopijúšče: rádujsja nezachodímaho svíta óblače: tohó bo nosíla jesí v ňídrich tvojích, slávy Hóspoda."), ), "S2": ( ("", "", "Ulovívše lovcý jazýki mréžeju Dúcha, i naučíša koncý zemnýja tebí kláňatisja so Otcém, i Dúchom Christé Bóže: ťích rádi utverdí cérkov tvojú, i vírnym nizposlí blahoslovénije tvojé, íže jedíne mílostive i čelovikoľúbče."), ("", "", "Ulovívše lovcý jazýki mréžeju Dúcha, i naučíša koncý zemnýja tebí kláňatisja so Otcém, i Dúchom Christé Bóže: ťích rádi utverdí cérkov tvojú, i vírnym nizposlí blahoslovénije tvojé, íže jedíne mílostive i čelovikoľúbče."), ("Múčeničen", "", "Strastonóscy Hospódni, blažénna zemľá napívšajasja króve vášeja, i svjáti chrámi prijémšiji ťilesá váša: na sudíšči bo vrahá obličíste, i Christá so derznovénijem propovídaste. Tohó jáko bláha molíte spastísja, mólimsja, dušám nášym."), ("Bohoródičen", "", "Božéstvennaho jestestvá óbščnicy býchom, tobóju Bohoródice prisnoďívo: Bóha bo nám voploščénna rodilá jesí. Ťímže ťá po dólhu vsí blahočéstno veličájem."), ), "S3": ( ("", "<NAME>", "Íže svitíla svítlaja, svjatýja tvojá učenikí Slóve v mír posláv, i prosvitíl jesí podsólnečnuju, ťmý nerazúmija izbavľája vsích čelovík. Ťích molítvami prísno umolén byvája, júže vo ťmí dúšu mojú prosvití čelovikoľúbče, i spasí mja."), ("", "", "Lučámi čudés Nikólaje, prosviščáješi podsólnečnuju vsjú, i razrišáješi mrák skorbéj, i bíd othoňáješi našéstvije, predstátel sýj tepľíjšij."), ("Bohoródičen", "", "Neiskusobráčnaja prečístaja, svjatája Bohoródice beznevístnaja, Sýna tvojehó, jehóže páče jestestvá plótiju rodilá jesí, so apóstoly prísno molí sohrišénij proščénije, i žitijá ispravlénije, i strastéj preminénije darováti vsím pojúščym ťá."), ), "K": ( "P1": ( "1": ( ("", "", "Vo hlubiňí postlá inohdá, faraonítskoje vsevójinstvo preoružénnaja síla, voplóščšejesja že Slóvo vsezlóbnyj hrích potrebílo jésť, preproslávlennyj Hospóď, slávno bo proslávisja."), ("", "", "Svíta božéstvennaho mólnija víroju bývše, svitovídniji Spásovy apóstoli, vsehó mja prosvitíte omračájema slastéj čérnostiju, i v ľínosti vsé mojé žitijé prošédša."), ("", "", "Svíta božéstvennaho mólnija víroju bývše, svitovídniji Spásovy apóstoli, vsehó mja prosvitíte omračájema slastéj čérnostiju, i v ľínosti vsé mojé žitijé prošédša."), ("", "", "Učenicý i drúzi Christóvy, drúha mjá bývša vrahú, zlých rádi prisvojénija, ot sehó mja izbavľájte spodvížušče mojú dúšu k ľubví, vozľubívšaho ród čelovíč blahostýni rádi."), ("", "", "Smirénnaja dušé mojá, préžde smérti potščísja pokájatisja, i sebé umerščvlénnuju pláči: da jáko Lázarja četverodnévnaho voskresívyj jáko milosérd, i tebé voskresít apóstol moľbámi."), ("Bohoródičen", "", "Blaháho róždši Bóha, prečístaja, vsích blahotvorjáščaho, tľínijem soderžímych, tohó molí preneporóčnaja, so proróki, i múčeniki, i apóstoly, vsích izbáviti ot napástej."), ), "2": ( ("", "", "Hrjadíte ľúdije, pojím písň Christú Bóhu, razďíľšemu móre, i nastávľšemu ľúdi, jáže izvedé iz rabóty jehípetskija, jáko proslávisja."), ("", "", "Vsehdá božéstvennomu prestólu blahodáti predstojá Nikólaje, blahodáť i mílosť darováti molísja, tebé prizyvájuščym víroju rabóm tvojím."), ("", "", "Na zemlí velíka predstáteľa ťá pokazá Bóh bídstvujuščym: ťímže mí predstáni v noščí i vo dní, sochraňája mjá ot soblázn borcá."), ("", "", "Jákože dnevnúju zvizdú uvíďiv ťá, tvojími svitozárnymi lučámi ťmý da izbávľusja iskušénij, i bíd i vsjákaho hrichá, ótče Nikólaje."), ("Bohoródičen", "", "Ťilésnych boľíznej izbávi mjá, i duší mojejá iscilí nedovídomyja strúpy, i ohňá víčnaho ischití mja, jedína Bohoblahodátnaja."), ), ), "P3": ( "1": ( ("", "", "Procvilá jésť pustýňa, jáko krín Hóspodi, jazýčeskaja neploďáščaja cérkov, prišéstvijem tvojím, v néjže utverdísja mojé sérdce."), ("", "", "Učíteľa sťažávše svjatíji premúdrosť Ótčuju dúchom, jéllinskuju obuíste premúdrosť, bohovídcy dostočúdniji."), ("", "", "Neplódije duší mojejá razrišíte vsechváľniji, i blahočádije ďijánij, v dobroďítelech prinosíti sotvoríte, jáko Slóva samovídcy dostoblažénniji."), ("", "", "Ľúťi mjá ujadéna nýňi jadovítym uhryzénijem vrážijim, iscilí moľbámi apóstol tvojích, blahoďíteľu vsích mnohomílostive."), ("Bohoródičen", "", "Bóha preblaháho umolí prečístaja, so apóstoly vsími, ot vsjákaho vréda, i obstojánija, i bíd izbávitisja čtúščym ťá."), ), "2": ( ("", "", "Utverdí nás v tebí Hóspodi, drévom umerščvéj hrích, i strách tvój vsadí v serdcá nás pojúščich ťá."), ("", "", "Iscilénij istóčnik sýj svjáte, strásti uvračúj duší mojejá, i žízň mojú sobľudí, nevrédna mjá sochraňája rabá tvojehó."), ("", "", "Umá mojehó pobiždénije ispravľája, ot vréda vídimych i nevídimych borjúščich mjá spasáj, jáko predstáteľ mój velíkij Nikólaje."), ("", "", "Íže jedín blahíj ťá bláha zastúpnika čelovíkom dadé blažénne, sehó rádi moľú ťá: ot vsjákich mjá zól svobodí."), ("Bohoródičen", "", "Kríposť mojá i rádosť i vesélije, i sťiná tvérdaja i predstáteľnice, tý jesí vseneporóčnaja, iskušénij i bíd izbavľájušči mjá."), ), ), "P4": ( "1": ( ("", "", "Prišél jesí ot Ďívy, ne chodátaj ni ánhel, no sám Hóspodi voplóščsja, i spásl jesí vsehó mja čelovíka. Ťím zovú ti: sláva síľi tvojéj Hóspodi."), ("", "", "Álčušča mjá vsehdá, i hládom istájema, spasénija sňíďmi nasýti jedíne čelovikoľúbče, božéstvennymi moľbámi apóstol, vo vsém míri propovídavšich ťá."), ("", "", "Álčušča mjá vsehdá, i hládom istájema, spasénija sňíďmi nasýti jedíne čelovikoľúbče, božéstvennymi moľbámi apóstol, vo vsém míri propovídavšich ťá."), ("", "", "Na móre mirskóje navél jesí vsích, jáko kóni čelovikoľúbče, slávnyja apóstoly tvojá, tohó vozmuščájuščyja slányja nevérstvija hórkija vódy."), ("", "", "Sólnca Christá súščym vo ťmí vozvistívše, vo ťmí mja ležášča hrichóvňij prosvitíte apóstoli prechváľniji, vozbraňájušče lukávym pomyslóm sérdca mojehó."), ("Bohoródičen", "", "Vsepítaja, jáže Bóha prepítaho róždšaja, o pojúščich ťá so apóstoly molí, jáko da izbávimsja ot hrichóv, i bíd i ozloblénija."), ), "2": ( ("", "", "Pojú ťa, slúchom bo Hóspodi uslýšach, i užasóchsja: do mené bo ídeši, mené iščjá zablúždšaho. Ťím mnóhoje tvojé snizchoždénije, jéže na mjá, proslavľáju mnohomílostive."), ("", "", "Ukrasív prestól dobroďíteľmi Nikólaje, ukrašénije javílsja jesí svjatítelem čestnóje. Ťímže ťá moľú: neľipótu duší mojejá ukrasí, i ot mirskích soblázn spasí mja."), ("", "", "Stezjú támo vedúščuju uhládi mí preblažénne: ot žitéjskich vóln oblehčí mja, i ko pristánišču žízni vozvedí Nikólaje, ot tebé predstáteľa velíkaho obohatívšasja."), ("", "", "Hlahól božéstvennych poslúšateľu, uslýšav mojá hlahóly, izbávi mjá ot bisóvskich soblázn, i bezzakónnych mužéj, i vsjákich obstojánij nachoďáščich, velíkij Nikólaje."), ("Bohoródičen", "", "Svjatája Bohoródice Vladýčice, v noščí mja i vo dní osvjatí, i sochraní, i nastávi ko spaséniju mnóhimi hrichí pádajušča, i prilóhmi bisóvskimi nizríjema."), ), ), "P5": ( "1": ( ("", "", "Chodátaj Bóhu i čelovíkom býl jesí Christé Bóže: tobóju bo Vladýko k svitonačáľniku Otcú tvojemú, ot nóšči nevíďinija privedénije ímamy."), ("", "", "Velíkij pástyr posreďí volkóv poslá jáko óvcy, božéstvennyja učenikí svojá, ťích pretvorjájuščja Bóžijeju síloju kreščénija, i dobrótoju slovés."), ("", "", "Velíkij pástyr posreďí volkóv poslá jáko óvcy, božéstvennyja učenikí svojá, ťích pretvorjájuščja Bóžijeju síloju kreščénija, i dobrótoju slovés."), ("", "", "Božéstvennym svítom, jáže vo ťmí prélesti prosvitíste apóstoli serdcá. Ťímže moľú vý, otemňínaho mjá slasťmí mráčnymi, prosvitíte Bohoblažénniji."), ("", "", "Okajánnaja dušé, préžde koncá potščísja i pokájsja, Hóspodevi zovúšči: sohriších tí Vladýko, prostí apóstol rádi, i spasí mja jáko milosérd."), ("Bohoródičen", "", "Svítom tvojím ozarí vo ťmí ležášča mjá, svíta žilíšče, i so apóstoly molísja preneporóčnaja, ot vsjákija núždy izbáviti mjá tvojími molítvami."), ), "2": ( ("", "", "Svíta podáteľu, i vikóv tvórče Hóspodi, vo svíťi tvojích poveľínij nastávi nás: rázvi bo tebé inóho Bóha ne znájem."), ("", "", "Zakóna Bóžija ispólniteľu, molí blaháho Bóha, zakóny božéstvennyja mí sobľudáti, i bezzakónnujuščich vráh izmí mja, i bisóvskaho vréda, vseblažénne Nikólaje."), ("", "", "Jákože drévle predstáv svjáte, izbavľája júnoši trí: síce i mené ot vsjákaho hrichá izbávi tvojími k Bóhu molítvami, Bohomúdre Nikólaje."), ("", "", "Svjaščennoďílateľu Christóv, hríšnikom isporúčniče, velíkij čudotvórče, blahodávca molí Bóha, da ne posramít mené v čás súdnyj."), ("Bohoródičen", "", "Hospodorodíteľnice čístaja, obladájema mjá mnóhimi strasťmí, jáko blahá predstávši izbávi ot sích: jáko da ťá vospiváju dušéju i sérdcem i jazýkom, spasájem."), ), ), "P6": ( "1": ( ("", "", "V bézdňi hrichóvňij vaľájasja, neizsľídnuju milosérdija tvojehó prizyváju bézdnu: ot tlí Bóže mjá vozvedí."), ("", "", "Íže vódu živótnuju nosjášče, tájemuju dúšu mojú znójem hrichóvnym moľúsja, učenicý Spásovy napójte."), ("", "", "Nebesá mýslennaja bývše, Bohozárniji apóstoli, slávu Bóžiju ispovídaste neizrečénnuju, júže ulučíti nám vsím molítesja."), ("", "", "V pučíňi ľúťi volnújuščijsja, k tebí Christé, íže vsích okormíteľu prichoždú, rádi apóstol tvojích, ko spasíteľnomu pristánišču uprávi mjá."), ("", "", "So vsími výšnimi sílami, so proróki, i apóstoly, i múčeniki, o nás molí Sýna tvojehó Bohonevísto."), ("Bohoródičen", "", "V bézdňi hrichóvňij vaľájasja, neizsľídnuju milosérdija tvojehó prizyváju bézdnu: ot tlí Bóže mjá vozvedí."), ), "2": ( ("", "", "Íže Mírjanom býv pervoprestóľnik Nikólaje, i oblahouchál jesí vírnych sostavlénija blahími tvojími ďijániji: ot zlosmrádna prehrišénija izbávi mjá."), ("", "", "Svitľíjše sólnca sťažáv ótče sérdce, vsehó mja prosvití, iskušénij i skorbéj othoňája ťmú Nikólaje."), ("", "", "Ot vsjákija izbávi mjá ťisnotý, prostránstvo jáko imíja mílosti Nikólaje, ťísnym šéstvovati mjá ukripí putém ko Hóspodu."), ("", "", "Na vsjáko vrémja tebé prizyváju prečístaja, da obrjášču ťá pomóščnicu, izimájuščuju mjá ot vsjákaho ozloblénija i strášnych múk."), ("Bohoródičen", "", "Bohoprotívnoje veľínije bezzakónnujuščaho mučíteľa vysók plámeň voznesló jésť: Christós že prostré Bohočestívym otrokóm rósu duchóvnuju, sýj blahoslovén i preproslávlen."), ), ), "P7": ( "1": ( ("", "", "Ohném božéstvennaho Dúcha predvozžžéni bývše apóstoli, prélesti úhlije uhasíste, Bóžije že račénije vo umích vsích vírnych vospalíste: ťímže velehlásno vás čtím."), ("", "", "Ohném božéstvennaho Dúcha predvozžžéni bývše apóstoli, prélesti úhlije uhasíste, Bóžije že račénije vo umích vsích vírnych vospalíste: ťímže velehlásno vás čtím."), ("", "", "Mír voznenavíďiste, i jáže v míri, Christá vozľubíste, v míri plótiju čelovíkom primisívšasja: jehóže molíte božéstvenniji apóstoli, jáže v žitijí mja vsích ľútych svobodíti."), ("", "", "Sudijé právedne serdcevídče, íže jedín sokrovénnaja vídyj mojá sohrišénija, v čás sudá ne osudí mené, nižé otsléši mjá vo óhň, molítvami apóstol tvojích."), ("", "", "Ohném Božestvá ne opalílasja jesí, neizrečénno róždši Ďívo, bráku neiskúsna bývši. Ťímže so apóstoly molísja čístaja, víčnaho mjá plámene svobodíti, tebé slávjaščaho."), ("Bohoródičen", "", "Óbrazu zlatómu na póli Deíri služímu, trijé tvojí ótrocy nebrehóša bezbóžnaho veľínija: posreďí že ohňá vvérženi, orošájemi pojáchu: blahoslovén jesí Bóže otéc nášich."), ), "2": ( ("", "", "Ohňú iskušénij na vsják déň primišájusja, ótče Nikólaje, posreďí sítej mimochoždú, jákože ptíca, pod tvój ščédryj pokróv pritekáju: nevrédna mjá sochraní, blaháho moľá Bóha i Hóspoda."), ("", "", "Hlahóly mojá uslýšav spíšno, ótče Nikólaje, potščísja prijití mi na pómošč, oburevájemu skorbmí i núždami žitéjskimi. i bisóvskimi ozlobléniji: jáko da spasájem pojú predstáteľstvo tvojé."), ("", "", "Íže drévle jávľsja vo sňí carjú, nepovínnyja imúščyja umréti izbavľája, napástej mjá izbávi nachoďáščich vsehdá, i nedúh ťilésnych, i dušévnych boľíznej, ótče Nikólaje."), ("", "", "Tebé jedínu prečístaja imíju pomóščnicu, tebé napisúju mňí vsích žitijá chraníteľnicu, ne prézri mené rabá tvojehó, jedína predstáteľnice míra, no spasí mja pojúšča: blahoslovén Bóh otéc nášich."), ("Bohoródičen", "", "Péšč inohdá óhnennaja vo Vavilóňi ďíjstva razďiľáše, Bóžijim veľínijem chaldéji opaľájuščaja, vírnyja že orošájuščaja, pojúščyja: blahoslovíte vsjá ďilá Hospódňa Hóspoda."), ), ), "P8": ( "1": ( ("", "", "Ťilovídno na vás našéd vo óhnennom víďi presvjatýj Dúch, soďíla jáko svitíla, popaľájušča úbo bezbóžije, prosviščájušča že vsjá blahočéstvujuščyja, božéstvenniji Slóva apóstoli."), ("", "", "Ťilovídno na vás našéd vo óhnennom víďi presvjatýj Dúch, soďíla jáko svitíla, popaľájušča úbo bezbóžije, prosviščájušča že vsjá blahočéstvujuščyja, božéstvenniji Slóva apóstoli."), ("", "", "Strasťmí ľúťi oburevájemoje neisprávlennoje sérdce mojé iscilí ščédre, moľúsja: dúšu mojú prosvití, i úm mój naprávi preklónšijsja v zlóbu, učenikóv tvojích moľbámi."), ("", "", "Vozdochní dušé mojá, i proslezísja priľížno, i sebé préžde koncá vospláči, préžde dáže ne postíhnet tebé pláč neuťíšimyj, i vozopíj Hóspodevi: spasí mja mílostive, molítvami apóstol tvojích."), ("", "", "Péšč inohdá neopáľšaja ďitéj, tvojé roždestvó proobražáše Ďívo vseneporóčnaja. Sehó rádi moľú ťa: so apóstoly molísja, so vsími proróki, ohňá hejénny izbáviti mjá."), ("Bohoródičen", "", "V péšč óhnennuju ko otrokóm jevréjskim snizšédšaho, i plámeň v rósu prelóžšaho Bóha, pójte ďilá jáko Hóspoda, i prevoznosíte vo vsjá víki."), ), "2": ( ("", "", "Vjazáti i rišáti priím vlásť ot Bóha, ótče Bohomúdre Nikólaje, zól mojích soúzy razriší tvojími molítvami: i božéstvenňij mjá privjaží ľubví vočelovíčitisja voschoťívšaho Vladýki."), ("", "", "Posiščénijem tvojím božéstvennym vo dní i v noščí posiščáj mjá, uhlaždája stezjú smirénňij mojéj duší, i sochraňáj mjá svjáte Nikólaje, neujázvlena ot nachoďáščich lukávaho soblázn."), ("", "", "Rúku mí podážď k Bóžijej pómošči Nikólaje, i sochraní ot ľútaho vrážija čájanija, íže júnoši inohdá smérti hórkija izbávil jesí: da počitáju ťá jáko blaháho predstáteľa."), ("", "", "Jehdá sjádeši Bóže, na prestóľi strášňim sudíti míru, ne vnídi v súd s rabóm tvojím: no části spodóbi spásájemych, molítvami Nikolája."), ("Bohoródičen", "", "Páče jestestvá tvojím roždestvóm Bohorodíteľnice vozvelíčila jesí nás umálennych velíkimi neisčétnymi zlými. Ťímže mólimsja tí prečístaja: vozvelíči v nás bohátyja tvojá mílosti."), ), ), "P9": ( "1": ( ("", "", "Beznačáľna rodíteľa Sýn, Bóh i Hospóď, voplóščsja ot Ďívy nám javísja, omračénnaja prosvetíti, sobráti rastočénnaja: ťím vsepítuju Bohoródicu veličájem."), ("", "", "Apóstoli slávniji, apóstoli blažénniji, učenicý Spásovy, propovídnicy vsemúdriji, ot vsjákaho mjá izbávite vréda, vsjákaho hňíva, vsjákaho hrichá, vsjákaho obstojánija, i razlíčnych napástej."), ("", "", "Apóstoli slávniji, apóstoli blažénniji, učenicý Spásovy, propovídnicy vsemúdriji, ot vsjákaho mjá izbávite vréda, vsjákaho hňíva, vsjákaho hrichá, vsjákaho obstojánija, i razlíčnych napástej."), ("", "", "Mené osuždénnaho, mené neisprávlennaho, tvojá poveľínija nebréhšaho, i bisóvskim preľščénijem umovrédno posľídovavša, vozvratí Hóspodi, molítvami apóstol tvojích."), ("", "", "Dúšu neisprávlenu prinošú, i sóvisť pohrebénuju s veščmí prehrišénij, i oskvernénnoje sérdce, i pómysl okaľán, vopijú ti čelovikoľúbče: apóstol rádi uščédri mjá mílostiju tvojéju."), ("Bohoródičen", "", "Apóstoli prečístaja, tvojehó Sýna propovídaša vo vsém míri, Bóha i čelovíka. Ťímže s ními molísja, vo strášnom dní sudá izbávitisja múk, víroju tebé veličájuščym."), ), "2": ( ("", "", "Ot Bóha Bóha Slóva, neizrečénnoju múdrostiju, prišédšaho obnovíti Adáma, jádiju v tľínije pádšaho ľúťi, ot svjatýja Ďívy neizrečénno voplotívšahosja nás rádi, vírniji jedinomúdrenno písňmi veličájem."), ("", "", "Svjaščénstva právilo, i krótosti óbraz, vím ťá Nikólaje múdre: na mjá vozstajúščuju búrju po vsjá dní strastéj i bíd, ukrotí molítvami tvojími, i sobľudí mja nevreždénna svjaščénňijšij ótče."), ("", "", "Jáko svjaščénňijšij sosúd prijáten božéstvennaho míra, mílostivno izlijávšahosja na zémľu, vsích nás oblahoucháj serdcá, Mírjanom býv múdre pervosvjatíteľ, iskušénija zlovónije othoňá molítvami tvojími."), ("", "", "Tý mojú uťíši ótče dúšu, nevídimo mnóžestvom ozlóblennuju ľúťi: tý bezmírnaja mí ukrotí iskušénija, jáže ľstívyj podvížet mí vo dní i v noščí, jáko blahíj mój predstáteľ javľájasja Nikólaje."), ("", "", "Strášnyj Vladýčnij déň pri dvérech približájetsja, čtó sotvoríši o dušé, hrichóv mnóžestvo imúšči? Potščísja úbo préžde koncá, i vozopíj Hóspodu priľížno: molítvami Nikoláa svjatíteľa tvojehó spasí mja."), ("Bohoródičen", "", "Poščadí mja Hóspodi, poščadí, jehdá chóščeši sudíti i ne osudí mené vo óhň, nižé járostiju tvojéju obličí mené: mólit ťá Ďíva róždšaja ťá Christé, i apóstol mnóžestvo, i slávnyj Nikoláj."), ), ), ), "ST": ( ("", "", "Vozvelíčil jesí Spáse, vo vselénňij verchóvnych apóstol imená, navykóša nebésnym, neizrečénna dáša zemným iscilénija, i síni ích jedíny nedúhi uvračeváchu: íbo ot rýbarej čudotvorjášče, i íže o Judéj Bohoslóvjašče blahodáti učénija, íchže rádi blahoutróbne, dážď nám véliju mílosť."), ("", "", "Íže ot neprávednych ďijánij vsehdá borími, i k tebí pribihájušče voístinnu súščemu Bóhu, hlás tvojích učeník prinósim tí, hlahóľušče: spasí ny nastávniče, pohibájem. Pokaží i nýňi vrahóm nášim, mólimsja, jáko pokryváješi ľúdi, i spasáješi ot bíd, molítvami apóstol prezirája hrichí, za mnóhuju blahostýňu, Hóspodi sláva tebí."), ("", "", "Svjatých tvojích mnóžestvo, mólit ťá Christé: pomíluj i spasí nás jáko čelovikoľúbec."), ("Bohoródičen", "", "Vsé upovánije mojé na ťá vozlaháju, Máti Bóžija, sochraní mja pod króvom tvojím."), ) ) #let L = ( "B": ( ("", "", "Hlás tí prinósim razbójnič, i mólimsja: pomjaní nás Spáse, vo cárstviji tvojém."), ("", "", "Mirskíja koncý prošédše apóstoli, ot ťmý prélesti i zločéstija čelovíki izbávili jesté premúdriji."), ("", "", "Mréžeju blahodáti iz hlubiný sújetstva, vsích čelovík, učenicý Spásovy múdri vozvelí jesté."), ("", "", "Íže tečénije skončávšyja, i víru sobľúdšyja, strastotérpcy Hospódni, sohlásno vírniji vospoím."), ("", "", "Ravnoďíteľna Rodíteľu Sýna, so Dúchom propovídavše, vospojím Tróicu nesozdánnuju."), ("", "", "Apóstolov pochvalá, stradáľcev udobrénije, tý jesí prečístaja Ďívo, i míra spasénije."), ) )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/string-06.typ
typst
Other
// Error: 2-15 no default value was specified and string index out of bounds (index: 5, len: 5) #"Hello".at(5)
https://github.com/typst-jp/typst-jp.github.io
https://raw.githubusercontent.com/typst-jp/typst-jp.github.io/main/tests/suite/layout/place.typ
typst
Apache License 2.0
// Test the `place` function. --- place-basic --- #set page("a8") #place(bottom + center)[© Typst] = Placement #place(right, image("/assets/images/tiger.jpg", width: 1.8cm)) Hi there. This is \ a placed element. \ Unfortunately, \ the line breaks still had to be inserted manually. #stack( rect(fill: eastern, height: 10pt, width: 100%), place(right, dy: 1.5pt)[ABC], rect(fill: conifer, height: 10pt, width: 80%), rect(fill: forest, height: 10pt, width: 100%), 10pt, block[ #place(center, dx: -7pt, dy: -5pt)[Hello] #place(center, dx: 7pt, dy: 5pt)[Hello] Hello #h(1fr) Hello ] ) --- place-block-spacing --- // Test how the placed element interacts with paragraph spacing around it. #set page("a8", height: 60pt) First #place(bottom + right)[Placed] Second --- place-background --- #set page(paper: "a10", flipped: true) #set text(fill: white) #place( dx: -10pt, dy: -10pt, image( "/assets/images/tiger.jpg", fit: "cover", width: 100% + 20pt, height: 100% + 20pt, ) ) #align(bottom + right)[ _Welcome to_ #underline[*Tigerland*] ] --- place-float --- #set page(height: 140pt) #set place(clearance: 5pt) #lorem(6) #place(auto, float: true, rect[A]) #place(auto, float: true, rect[B]) #place(auto, float: true, rect[C]) #place(auto, float: true, rect[D]) --- place-float-missing --- // Error: 2-20 automatic positioning is only available for floating placement // Hint: 2-20 you can enable floating placement with `place(float: true, ..)` #place(auto)[Hello] --- place-float-center-horizon --- // Error: 2-45 floating placement must be `auto`, `top`, or `bottom` #place(center + horizon, float: true)[Hello] --- place-float-horizon --- // Error: 2-36 floating placement must be `auto`, `top`, or `bottom` #place(horizon, float: true)[Hello] --- place-float-default --- // Error: 2-27 floating placement must be `auto`, `top`, or `bottom` #place(float: true)[Hello] --- place-float-right --- // Error: 2-34 floating placement must be `auto`, `top`, or `bottom` #place(right, float: true)[Hello] --- place-float-columns --- // LARGE #set page(height: 200pt, width: 300pt) #show: columns.with(2) = Introduction #figure( placement: bottom, caption: [A glacier], image("/assets/images/glacier.jpg", width: 50%), ) #lorem(45) #figure( placement: top, caption: [A rectangle], rect[Hello!], ) #lorem(20) --- place-float-figure --- // LARGE #set page(height: 250pt, width: 150pt) = Introduction #lorem(10) #footnote[Lots of Latin] #figure( placement: bottom, caption: [A glacier #footnote[Lots of Ice]], image("/assets/images/glacier.jpg", width: 80%), ) #lorem(40) #figure( placement: top, caption: [An important], image("/assets/images/diagram.svg", width: 80%), ) --- place-bottom-in-box --- #box( fill: aqua, width: 30pt, height: 30pt, place(bottom, place(line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 3pt)) ) ) --- place-horizon-in-boxes --- #box( fill: aqua, width: 30pt, height: 30pt, { box(fill: yellow, { [Hello] place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 2pt)) }) place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: green + 3pt)) } ) --- place-bottom-right-in-box --- #box(fill: aqua)[ #place(bottom + right)[Hi] Hello World \ How are \ you? ] --- place-top-left-in-box --- #box(fill: aqua)[ #place(top + left, dx: 50%, dy: 50%)[Hi] #v(30pt) #line(length: 50pt) ] --- issue-place-base --- // Test that placement is relative to container and not itself. #set page(height: 80pt, margin: 0pt) #place(right, dx: -70%, dy: 20%, [First]) #place(left, dx: 20%, dy: 60%, [Second]) #place(center + horizon, dx: 25%, dy: 25%, [Third]) --- issue-1368-place-pagebreak --- // Test placing on an already full page. // It shouldn't result in a page break. #set page(height: 40pt) #block(height: 100%) #place(bottom + right)[Hello world] --- issue-2199-place-spacing-bottom --- // Test that placed elements don't add extra block spacing. #show figure: set block(spacing: 4em) Paragraph before float. #figure(rect(), placement: bottom) Paragraph after float. --- issue-2199-place-spacing-default --- #show place: set block(spacing: 4em) Paragraph before place. #place(rect()) Paragraph after place. --- issue-2595-float-overlap --- #set page(height: 80pt) Start. #place(auto, float: true, [ #block(height: 100%, width: 100%, fill: aqua) ]) #place(auto, float: true, [ #block(height: 100%, width: 100%, fill: red) ]) #lorem(20) --- issue-2715-float-order --- #set page(height: 180pt) #set figure(placement: auto) #figure( rect(height: 60pt), caption: [Rectangle I], ) #figure( rect(height: 50pt), caption: [Rectangle II], ) #figure( circle(), caption: [Circle], ) #lorem(20)
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/solutions/s0013.typ
typst
#import "../helpers.typ": * #let roman-to-integer-ref(s) = { let s = s.clusters() let n = s.len() let d = ("I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000) let ans = 0 for i in range(n) { if i < n - 1 and d.at(s.at(i)) < d.at(s.at(i + 1)) { ans -= d.at(s.at(i)) } else { ans += d.at(s.at(i)) } } ans }
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/cover.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#align(center)[ #set text( font: "Times New Roman", 35pt ) == Engineering Notebook Team 53B #line(length: 75%, stroke: 2pt) #image("/assets/over_under_field.png", width: 75%) #line(length: 75%, stroke: 2pt) == Over Under 2023 - 2024 #pagebreak() ]
https://github.com/PgBiel/iterino
https://raw.githubusercontent.com/PgBiel/iterino/main/test.typ
typst
Apache License 2.0
#import "src/lib.typ" as iter #let i = iter.from-array((1, 2, 3)) #let i = iter.map(i, fn: x => x + 1) #assert.eq(iter.to-array(i), (2, 3, 4)) #let i = iter.chain( iter.range(10), iter.map.with(fn: x => x + 1), iter.filter.with(pred: n => n != 3), iter.inspect.with(fn: v => if v == 3 { panic("don't") }), iter.to-array ) #assert.eq(i, (1, 2, 4, 5, 6, 7, 8, 9, 10, 11))
https://github.com/Icxolu/typst-qr
https://raw.githubusercontent.com/Icxolu/typst-qr/main/example.typ
typst
MIT License
#set page(width: auto, height: auto) #let typst_qr = plugin("target/wasm32-unknown-unknown/release/typst_qr.wasm") #let qr(data, dark_color: black, light_color: white, has_quiet_zone: true, width: auto) = image.decode( str(typst_qr.qr( cbor.encode(( data, dark_color.hex(), light_color.hex(), has_quiet_zone, )) )), format: "svg", width: width ) #figure( qr("This QR code was generated dynamically by a typst plugin!", width: 200pt), caption: [ A qr code generated by a typst wasm plugin!! ], ) #figure( qr( "This QR code was generated dynamically by a typst plugin!", dark_color: green, light_color: blue, has_quiet_zone: false, width: 200pt ), caption: [ A qr code with custom colors! ], )
https://github.com/Dicarbene/note-typst
https://raw.githubusercontent.com/Dicarbene/note-typst/master/templates/SimplePaper/main.typ
typst
MIT License
#import "simplepaper.typ": * #show: project.with( title: "SimplePaper 中文模板使用说明", authors: ( "张三", ), ) = 模版简介 SimplePaper 是 Typst 的模版,用于生成简单的论文。 = 使用说明 模版默认使用的字体包括 "FZShuSong-Z01", "FZXiaoBiaoSong-B05", "FZHei-B01", "FZKai-Z03", "FZFangSong-Z02", "DejaVu Sans Mono for Powerline",我们推荐你在方正官网安装这些字体。 如果你的系统没有安装这些字体,你需要在模版中修改字体。 = 使用示例 <example> == 特殊标记 <bug1> 你可以 Typst 的语法对文本进行特殊标记,我们为如下标记设定了样式: + *突出* + _强调_ + 引用 @example + `raw text` === 注意事项 由于 Typst 的语法, 如果你使用 `*本文*` 来标记突出,那么你需要在 `*` 前面加上一个空格,但这会导致你 *突出的文本* 前后附带一个空格,如果你#strong("不想要这个空格"),你可以使用 `#strong("本文")` 来代替。 在列表中使用 raw text 可能会导致不正确的显示,如 @bug1 中的列表。 raw text 中的中文字体可能较小,这是因为 Typst 无法为不同的中英文字体设置不同的字号,所以我们将中英文的字体设置为了相同的字号,这对于英文来说是合适的,但对于中文来说可能不合适。如`raw text: English 中文`。 == 图片 我们为图片标题默认设置了 "FZKai-Z03" 字体,效果如@img 如果你想要使用其他字体,你可以自行修改模版。 #figure(image("sample.svg"), caption: [ 示例图片 ], )<img> == 表格 #figure( table( columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr), inset: 10pt, align: horizon, [], [周一], [周二],[周三],[周四],[周五], "早上", "编译原理", "操作系统", "计算机网络", "操作系统", "计算机网络", "下午", "数据挖掘", "计算机网络", "操作系统", "计算机网络", "分布式系统" ), caption: "示例表格" )
https://github.com/mem-courses/discrete-mathmatics
https://raw.githubusercontent.com/mem-courses/discrete-mathmatics/main/homework/week4.typ
typst
MIT License
#import "../template.typ": * #import "../functions.typ": * #show: project.with( course: "Discrete Mathmatics", course_fullname: "Discrete Mathematics and Application", course_code: "211B0010", title: "Homework #4: Functions & Sets & Algorithms", authors: (( name: "<NAME>", email: "<EMAIL>", id: "A10" ),), semester: "Spring-Summer 2024", date: "March 12, 2024", ) #let circ = math.circle.stroked.small + math.space = 2.3 Functions #hw("22(c)")[ Determine whether this function is a bijection from $RR$ to $RR$. $ f (x) = (x + 1)/(x + 2) $ ][ It is not a bijection from $RR$ to $RR$. When $x$ is $-2$, the value of $f(x)$ is undefined. It means that the domain of $f(x)$ is $(-oo, -2) union (-2, +oo)$, so it must not be a bijection from $RR$ to $RR$. ] #hw("36")[ If $f$ and $f circ g$ are one-to-one, does it follow that $g$ is one-to-one? Justify your answer. ][ Let's prove by contradiction. Suppose that $g$ is not a one-to-one function, which means there exists $x$ and $y$ in the domain of $g$ such that $g(x)=g(y)$ and $x!=y$. Thus, $f(g(x)) = f(g(y))$ holds. But $x!=y$, it conflicts with the assumption that $f circ g$ is one-to-one. Therefore, $g(x)$ is one-to-one. ] #hw("42(a)")[ Let $f$ be a function from the set $A$ to the set $B$. Let $S$ and $T$ be subsets of $A$. Show that (a) $f (S union T) = f(S) union f(T)$. ][ (1) Prove that $f(S union T) subset.eq f(S) union f(T)$ by contradiction: Suppose that $f(S union T) subset.eq.not f(S) union f(T)$, which means there exists $x$ in $S union T$ but $not(f(x) in f(S) or f(x) in f(T))$. That is to say, there exists $x in S or x in T$ but $f(x) in.not f(S) and f(x) in.not f(T)$. It conflicts with the definition of functions. Therefore, $f(S union T) subset.eq f(S) union f(T)$ is proved. (2) Prove that $f(S) union f(T) subset.eq f(S union T)$ by direct proof: For all $y in f(S)$, there exists $x in S$ with $f(x) = y$. This also holds for $y in f(T)$. So for all $y in f(S) union f(T)$, whether $x in S$ or $x in T$ holds, which means $x in S union T$. Therefore, $y in f(S union T)$ must hold. Therefore $f(S) union f(T) subset.eq f(S union T)$. Overall, $f(S union T) = f(S) union f(T)$ holds. ] #hw("74")[ Suppose that $f$ is a function from $A$ to $B$, where $A$ and $B$ are finite sets with $abs(A) = abs(B)$. Show that $f$ is one-to-one if and only if it is onto. ][ Let $n$ be the size of sets $A$ and $B$. (1) Prove that "if $f$ is onto, then $f$ is one-to-one" by contradiction: Suppose $f$ is onto but is not one-to-one, which means that there exists $x,y in A$ with $f(x) = f(y) and x != y$. Then since $f$ is a onto function, for any other element $y$ in $B$, there must exist at least one element (let's call it $x$) in $A$ such that $f(x) = y$. Thus, the size of $A$ is at least $|B|+1$, which conflicts with the assumption $abs(A) = abs(B)$. So "if $f$ is onto, then $f$ is one-to-one" is proved. (2) Prove that "if $f$ is one-to-one, then $f$ is onto" by direct proof. By the definition of one-to-one functions, for any $y$ in $B$, there is at most one element $x$ in $A$ such that $f(x) = y$. Since $abs(A) = abs(B)$, we could only map exactly one element in $A$ to the elements in $B$. Therefore, all elements in $B$ is mapped, which means f is a onto function. Overall, "$f$ is one-to-one if and only if it's onto" is proved above. ] #hw("76(c,d)")[ Prove or disprove each of these statements about the floor and ceiling functions. (c) $ceil(ceil(x"/"2)"/"2) = ceil(x"/"4)$ for all real number $x$. (d) $floor(sqrt(ceil(x))) = floor(sqrt(x))$ for all positive real numbers $x$. ][ (c) It's true. Proof: Let $c$ be the value of $display(ceil(x))$. For any real number $x$, it's obvious that $display(ceil(x/2) = ceil(c/2))$ and $display(ceil(x/4) = ceil(c/4))$ holds. Thus we can have a discuss in cases: (c.1) $c equiv 0 space (mod 4)$: $display(ceil(c/4) = c/4)$, $display(ceil(ceil(c/2)/2) = ceil(c/4) = c/4)$. (c.2) $c equiv 1 space (mod 4)$: $display(ceil(c/4) = (c-1)/4)$, $display(ceil(ceil(c/2)/2) = ceil(((c-1)/2)/2) = ceil((c-1)/4) = (c-1)/4)$. (c.3) $c equiv 2 space (mod 4)$: $display(ceil(c/4) = (c-2)/4)$, $display(ceil(ceil(c/2)/2) = ceil((c/2)/2) = ceil(c/4) = (c-2)/4)$. (c.4) $c equiv 3 space (mod 4)$: $display(ceil(c/4) = (c-3)/4)$, $display(ceil(ceil(c/2)/2) = ceil(((c-1)/2)/2) = ceil((c-1)/4) = (c-3)/4)$. Overall, $display(ceil(ceil(c/2)/2) = ceil(c/4))$ holds for all real number $c$. (d) It's false. We can find a counter example easily: suppose that $x=8.1$, then $floor(sqrt(x))=2$ but $floor(sqrt(ceil(x))) = 3$. ] = 2.5 Cardinality of Sets #hw("4(c,d)")[ Determine whether each of these sets is countable or uncountable. For those that are countably infinite, exhibit a one-to-one correspondence between the set of positive integers and that set. (c) the real numbers with decimal representations consisting of all 1s. (d) the real numbers with decimal representations of all 1s or 9s. ][ (c) Let the set $A$ contain all real numbers with decimal representations consisting of all 1s, and the set $S$ be ${(p,q) | p,q in RR}$. (c.1) Prove that $abs(A) <= abs(S)$: For any $x$ in $A$, let $p$ be the number of 1s before the decimal point, and let $q$ be the number of 1s after the decimal point. Then, we can map $x$ with the paired positive integer $(p,q)$ in the set $S$. (c.2) Prove that $abs(S) <= abs(A)$: For any pair of positive integers $(p,q)$, we can map it to an decimal number $x in A$ such that $x = 10^(p)+10^(p-1)+dots.c+10+1+10^(-1)+10^(-2)+dots.c+10^(-q)$. Therefore, $abs(A)=abs(S)$. We will prove that $abs(S) = abs(ZZ_+ times ZZ_+) = aleph_0$ soon in _Exercise 28_, so that $A$ is *countable*. // (c.1) Prove that $abs(A) <= abs(QQ_+)$: For any $x$ in $A$, let $p$ be the number of 1s before the decimal point, and let $q$ be the number of 1s after the decimal point. Here we can map $x$ with the paired positive integer $(p,q)$. // (c.1) Prove that $abs(A) <= abs(QQ_+)$: For all real numbers in $A$, are all rational numbers, or $A subset.eq QQ_+$. So that $abs(A) <= abs(QQ_+)$. // (c.2) Prove that $abs(QQ_+) <= |S|$: For any positive rational number $x$ in $QQ_+$, it can be represented as $p"/"q$ where $p$ and $q$ are positive integers with $gcd(p,q) = 1$. // (c.3) Prove that $abs(S) <= abs(A)$: For any pair of positive integers $(p,q)$, we can map it to an decimal number $x in A$ such that $x = 10^(p)+10^(p-1)+dots.c+10+1+10^(-1)+10^(-2)+dots.c+10^(-q)$. // Overall, $|A| = |QQ_+| = |S|$ holds, which means $A$ is countable. (d) Let the set $B$ contain all real numbers with decimal representations consisting of all 1s or 9s. Here we will prove that $B$ is uncountable. Obviously, $B subset.eq A$, so that $abs(B) <= abs(A)$. And we can prove that $abs(B) != abs(A) = abs(ZZ_+)$ by contradiction: Suppose that $abs(B) = abs(ZZ_+)$, which means that $B={b_1,b_2, dots.c}$. Suppose their decimal representations are $ b_1 &= d_1 . bold(b_11) b_12 b_13 dots.c\ b_2 &= d_2 . b_21 bold(b_22) b_23 dots.c\ b_3 &= d_3 . b_31 b_32 bold(b_33) dots.c\ $ #h(indent)Here $d_i$ represents the integer part of $b_i$, and $b_(i,j)$ represents the $j$-th integer after the decimal point of $b_i$. $b_(i,j)$ is whether 1 or 9, and specially $b_(i,j) = 0$ when $j$-th integer after the decimal point not exists. Then, let $x=1.x_1 x_2 x_3 dots.c$ where $x_i = 1$ when $b_(i,i)=9$ and $x_i=9$ when $b_(i,i) = 1$ or $0$. So that, if we compare $x$ with elements in $B$, there exists at least one digit such that $x_i != b_(i,i)$, which means $x$ is not in the set $B$, and that's a contradiction. Therefore, $B$ is *uncountable*. ] #hw("28")[ Show that the set $ZZ_+ times ZZ_+$ is countable. ][ We can list a table and put all the pairs of positive integers $(p,q)$ to the $p$-th row and $q$-th column. Then we can count all these elements one by one along diagonal lines from the bottom left to the top right. More formally, we can represent $S$ as ${r_1, r_2, r_3, dots.c}$. Here $r_n = display((n-(m(m-1))/2, (m(m+1))/2+1-n))$ where $m$ is the only positive integer such that $display((m(m-1))/2 < n<= (m(m+1))/2)$. Overall, we can map the set $ZZ_+ times ZZ_+$ to the set $ZZ_+$ one-to-one and onto, which means that $ZZ_+ times ZZ_+$ is countable. ] #hw("36")[ Show that there is a one-to-one correspondence from the set of subsets of the positive integers to the set of real numbers between $0$ and $1$. Use this result and _Exercises 34 and 35_ to conclude that $aleph_0 < abs(cal("P")(ZZ_+)) = abs(RR)$. _Hint_: Look at the first part of the hint for _Exercise 35_. ][ For any set in the power set of positive integers, it can be represent as a infinite 0-1 string which we usually call it "bitset". We simply write down "0." before this 0-1 string, so that it can be regarded as a binary decimal number between $0$ and $1$. That is to say, we have conclude a one-to-one correspondence from $cal("P")(ZZ_+)$ to ${x | 0<x<1}$. Then applying the conclusion from _Exercise 34 and 35_, we can conclude that $abs(aleph_0) < abs(cal("P")(ZZ_+)) = abs(RR)$. ] #hw("38")[ Show that the set of functions from the positive integers to the set ${0,1,2,3,4,5,6,7,8,9}$ is uncountable. _Hint_: First set up a one-to-one correspondence between the set of real numbers between $0$ and $1$ and a subset of these functions. Do this by associating to the real number $0.d_1d_2 dots.c d_n dots.c$ the function $f$ with $f(n) = d_n$. ][ Let's prove it by contradiction: Suppose that such set $F$ is countable, which means that we can list all elements in $F$ as $F={f_1,f_2,f_3,dots.c}$. Here we can constract a function $g$ such that for any positive integer $n$, $g(n) = 0$ when $f_n (n) != 0$, and $g(n) = 1$ when $f_n (n) = 0$. So, compare $g$ with all functions in $F$, we can find at least one $x$ in the domain with $f(x) != g(x)$, which means $g$ is not in the set $F$. But it conflicts with the definition of $F$. Therefore, $F$ is not countable. ] = 3.1 Algorithms #hw("2")[ Determine which characteristics of an algorithm described in the text (after Algorithm 1) the following procedures have and which they lack. #table( columns: (2em, 1fr), align: left + top, stroke: 0pt, [(a)], box(width: 50%)[ #set par(first-line-indent: 0em) *procedure* _double_(_n_: positive integer) *while* _n_ > 0 #h(2em) _n_ := 2#[]_n_ ], [(b)], box(width: 50%)[ #set par(first-line-indent: 0em) *procedure* _divide_(_n_: positive integer) *while* _n_ ≥ 0 #h(2em) _m_ := 1#[/]_n_ #h(2em) _n_ := _n_ − 1 ], [(c)], box(width: 50%)[ #set par(first-line-indent: 0em) *procedure* _sum_(_n_: positive integer) _sum_ := 0 *while* _i_ < 10 #h(2em) _sum_ := _sum_ + _i_ ], [(d)], box(width: 50%)[ #set par(first-line-indent: 0em) *procedure* _choose_(_a_, _b_: integers) _x_ := either _a_ or _b_ ], ) ][ (a) This algorithm lacks finiteness, the algorithm will never terminate. (b) This algorithm lacks effectiveness, the value of $1"/"n$ when $n=0$ is undefined. (c) This algorithm lacks generality, this function only works when $n=10$. (d) This algorithm lacks definiteness, it's unclear whether the returned value would be $a$ or $b$. ] #hw("4")[ Describe an algorithm that takes as input a list of $n$ integers and produces as output the largest difference obtained by subtracting an integer in the list from the one following it. ][ *procedure* _largest_difference_(_a_: the list, _n_: the size of the list) $i:=1$ $max_diff := -oo$ *while* $i<n$ #h(2em) *if* $a[i+1]-a[i] > max_diff$ #h(4em) $max_diff := a[i+1] - a[i]$ *return* $max_diff$ ] // = 3.2 // #hw("8(c)")[][] // #hw("26(a)")[][] // #hw("54")[][] // #hw("56")[][] // = 3.3 // #hw("7")[][] // #hw("10")[][]
https://github.com/pluttan/os
https://raw.githubusercontent.com/pluttan/os/main/lab4/lab4.typ
typst
#import "@docs/bmstu:1.0.0":* #import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx, cellx #show: student_work.with( caf_name: "Компьютерные системы и сети", faculty_name: "Информатика и системы управления", work_type: "лабораторной работе", work_num: 4, study_field: "09.03.01 Информатика и вычислительная техника", discipline_name: "Операционные системы", theme: "Процессы", author: (group: "ИУ6-52Б", nwa: "<NAME>"), adviser: (nwa: "<NAME>"), city: "Москва", table_of_contents: true, ) = Введение == Цель работы Получение теоретических и практических сведений об управлении процессами, потоками и оперативной памятью в UNIX-подобных системах и в Linux в частности. == Задание - Открыть в текстовом браузере некую страницу и перевести его в фоновый режим - Запустить ещё два экземпляра текстового браузера в фоновом режиме - Найти процесс, максимально нагружающий процессор - Вывести список процессов текущего пользователя - «Убить» первый процесс браузера в котором открыта 1 страница - Вывести список всех процессов всех пользователей - Просмотреть список процессов постранично - Отобрать из вывода команды ps строку, соответствующую процессу «dbus-daemon», определить, где лежит её выполняемый файл и с какими параметрами он запущен - Записать в файл с именем, содержащим текущее время, строку «\-\-\-\-\-\-\-» и список процессов - Выполнить команду в фоновом режиме с отсрочкой запуска на 1 минуту. Продемонстрировать, что команда выполнилась именно через минуту. - Отобрать из одного из сформированных файлов строки, относящиеся к одному из процессов. - Вывести результаты работы произвольной команды в один файл, а сообщения об ошибках в другой. Продемонстрировать правильность работы. - Выполнить произвольную команду с ограничением использования процессорного времени 300 секунд и выводом результатов и сообщений об ошибках в один файл. - Настроить cron на выполнение команды ежедневно в заданное время. Продемонстрировать правильность работы. = Выполнение == Открыть в текстовом браузере некую страницу и перевести его в фоновый режим Откроем в браузере `w3m` страницу `google.com` #img(image("img/51.png", width:70%), [`ya.ru`]) Используя сочетания клавиш `Ctrl+z` переведем страницу в фоновый режим. #img(image("img/52.png", width:70%), [Страница переведена в фоновый режим и отображается в списке процессов]) == Запустить ещё два экземпляра текстового браузера Откроем страницу `ya.ru` и переведем ее в фоновый режим. #img(image("img/1.png", width:70%), [`ya.ru`]) #img(image("img/3.png", width:70%), [Страница переведена в фоновый режим и отображается в списке процессов]) Откроем страницу `cppreference.com` и переведем ее в фоновый режим. #img(image("img/6.png", width:70%), [`cppreference.com`]) #img(image("img/8.png", width:70%), [Страница переведена в фоновый режим и отображается в списке процессов]) == Найти процесс, максимально нагружающий процессор Для того, чтобы найти такой процесс выполним комманду ```sh top```: #img(image("img/10.png", width:70%), [```sh top```]) Получается, что самым нагружающим процессом является `Xorg`. == Вывести список процессов текущего пользователя Удобнее комманды `top` есть комманда `ps`, если ее использовать с аргументом `a`, то получится вывести список процессов текущего пользователя. #img(image("img/11.png", width:70%), [```sh ps a```]) #img(image("img/12.png", width:70%), [```sh ps a```]) == «Убить» первый процесс браузера в котором открыта 1 страница Так как страница переведена в фоновый режим, то закрыть ее обычной коммандой `kill` передав аргументом `PID = 3228`, но можно добавить флаг `-9`, который означет принудительное завершение. #img(image("img/15.png", width:70%), [```sh kill -9 3228```]) Хоть и не сразу, но процесс завершился. == Вывести список всех процессов всех пользователей Для того, чтобы вывести список всех процессов всех пользователей используем ту же комманду ```sh ps``` с 3 аргументами: `axu`. #img(image("img/19.png", width:70%), [```sh ps axu```]) == Просмотреть список процессов постранично Воспользуемся коммандой `more` чтобы вывести тот же список, но постранично: ```sh ps axu|more``` #img(image("img/22.png", width:70%), [```sh ps axu|more```]) == Отобрать из вывода команды `ps` строку, соответствующую процессу `dbus-daemon`, определить, где лежит её выполняемый файл и с какими параметрами он запущен Для того чтобы отобрать необходимую строку используем комманду `grep` совместно с коммандой `ps`: #img(image("img/26.png", width:70%), [```sh ps axu|grep 'dbus-daemon'```]) == Записать в файл с именем, содержащим текущее время, строку «\-\-\-\-\-\-\-» и список процессов Напишем несколько комманд, которые должны повторяться друг за другом в случае удачного/любого исхода предыдущей комманды. Вот вся комманда: ```sh d="$(date)"; touch "$d"&&echo "dir:"&&ls -la|grep "$d" ;echo '-------'>>"$d"&&echo $(ps) >>"$d"&&echo "file:"&&cat "$d"``` Разберем по порядку: - ```sh d="$(date)"``` берем текущее время в переменную ```sh $d``` - ```sh touch "$d"``` создаем файл с названием в виде текущего времени - ```sh echo "dir:"``` пишем о том, что следующим сведением в консоль поступит полная директория файла - ```sh ls -la|grep "$d" ``` ищем файл в текущей директории и выводим о нем информацию - ```sh echo '-------' >> "$d"``` записываем в файл «\-\-\-\-\-\-\-» - ```sh echo $(ps) >> "$d"``` Записываем в файл список текущих процессов - ```sh echo "file:"``` Пишем что далее будет выведена информация записанная в файле - ```sh cat "$d"``` читаем файл #img(image("img/27.png", width:70%), [```sh d="$(date)"; touch "$d"&& echo "dir:"&& ls -la|grep "$d" ; echo '-------'>>"$d"&& echo $(ps) >>"$d"&& echo "file:"&& cat "$d" ```]) == Выполнить команду в фоновом режиме с отсрочкой запуска на 1 минуту. Продемонстрировать, что команда выполнилась именно через минуту. ```sh (sleep 60; ls -la > output.txt) & for i in {1..62}; do echo "Текущее время: $(date '+%Y-%m-%d %H:%M:%S')"; [ -f output.txt ] && cat output.txt || echo "Файл output.txt не найден"; sleep 1; done ``` Напишем еще одну составную комманду: - Отложим выполнение комманды ```sh ls -la > output.txt```, которая выводит информацию о текущей директории в файл `output.txt` на 1 минуту: ```sh (sleep 60; ls -la > output.txt)``` - Организуем цикл, который в течении 62 секунд будет выводить текущее время и найден ли файл (пока мы не записали ничего файла не будет). ```sh for i in {1..62}; do echo "Текущее время: $(date '+%Y-%m-%d %H:%M:%S')"; [ -f output.txt ] && cat output.txt || echo "Файл output.txt не найден"; sleep 1; done ``` #img(image("img/30.png", width:70%), [Начало выполнения комманды: минута еще не прошла]) #img(image("img/31.png", width:70%), [Комманда выполнилась, файл найден и выведен в терминал]) == Отобрать из одного из сформированных файлов строки, относящиеся к одному из процессов. Чтобы отобрать строки, относящиеся к одному процессу напишем комманду ```sh grep``` и передадим в качечтве аргумента название процесса и название файла: #img(image("img/33.png", width:70%), [```sh grep w3m 'Fri Sep 13 11:05:14 MSK 2024'```]) == Вывести результаты работы произвольной команды в один файл, а сообщения об ошибках в другой. Продемонстрировать правильность работы. Для выполенния данной операции воспользуемся следующей коммандой: ```sh ls /usr /неправильный_путь > output.txt 2> error.txt``` Эта комманда выведет все, что есть в каталоге `/usr` в один файл и ошибку об отсутствии каталога `/неправильный_путь` в другой. Дополнительно к комманде припишем чтение этих 2 файлов через отступ. #img(image("img/34.png", width:70%), [```sh ls /usr /неправильный_путь > output.txt 2> error.txt; cat output.txt && echo -e "\n\n" && cat error.txt ```]) == Выполнить произвольную команду с ограничением использования процессорного времени 300 секунд и выводом результатов и сообщений об ошибках в один файл. Комманда ```sh find``` может занять достаточно много времени, поэтому ограничим ее выполение до 300с. Вывод напривим в файл `output.txt`, после чего прочитаем последние 10 строк из него: ```sh timeout 300s find / > output.txt 2>&1; tail output.txt``` #img(image("img/50.png", width:70%), [```sh timeout 300s find / > output.txt 2>&1; tail output.txt```]) == Настроить cron на выполнение команды ежедневно в заданное время. Продемонстрировать правильность работы. Для начала откроем конфиг-файл ```sh cron```: #img(image("img/35.png", width:70%), [```sh crontab -e```]) Пропишем сюда следующую строку: ```crontab 42 11 * * * /usr/bin/env echo "Hello World" » /output.txt``` - `42 11` Означает, что комманда выполнится в 11:42. - `* * *` Означают, что комманда будет выполняться каждый день - `/usr/bin/env` Путь к среде - ```sh echo "Hello World" » /output.txt``` Комманда #img(image("img/45.png", width:70%), [```sh crontab -e```]) Проверим все ли правильно записалось: #img(image("img/46.png", width:70%), [```sh crontab -l```]) Проверим запущен ли демон ```sh cron```: #img(image("img/47.png", width:70%), [```sh ps axu|grep cron```]) За минуту до назначенного времени запустим комманду, которая каждую секунду в течении 62 секунд проверяет наличие файла `output.txt` и его содержимое: ```sh for i in {1..62}; do echo "Текущее время: $(date '+%Y-%m-%d %H:%M:%S')"; [ -f output.txt ] && cat output.txt || echo "Файл output.txt не найден"; sleep 1; done ``` #img(image("img/48.png", width:70%), [Комманда]) #img(image("img/49.png", width:70%), [Комманда]) В 11:42 файл появился и в него записалось Hello.
https://github.com/The-Notebookinator/notebookinator
https://raw.githubusercontent.com/The-Notebookinator/notebookinator/main/lib.typ
typst
The Unlicense
#import "./internals.typ": * #import "./entries.typ": * #import "./utils.typ" #import "./themes/themes.typ" #import "./glossary.typ" /// The base notebook template. This function is meant to be applied to your entire document as a show rule. /// /// *Example Usage:* /// /// ```typ /// #import themes.default: default-theme /// /// #show: notebook.with( /// theme: default-theme /// ) /// ``` /// - team-name (string): The name of your team. /// - season (string): The name of the current season. /// - year (string): The years in which the notebook is being written. /// - theme (theme): The theme that will be applied to all of the entries. If no theme is specified, it will fall back on the default theme. /// - cover (content): The title page of the notebook. /// - body (content): The content of the notebook. This will be ignored. Use the create-entry functions instead. /// -> content #let notebook( team-name: "", season: "", year: "", cover: none, theme: (:), body, ) = { let rules = theme.rules show: doc => rules(doc) let cover-content = if cover == none { let ctx = ( team-name: team-name, season: season, year: year, ) (theme.cover)(ctx: ctx) } else { cover } page( margin: 0pt, cover-content, ) // Filler page page[] print-entries(theme: theme) body // FIXME: this should be ignored, but the document doesn't properly render without it. }
https://github.com/N3M0-dev/Notes
https://raw.githubusercontent.com/N3M0-dev/Notes/main/CS/Algorithm/Intro_to_Algor/Ch_3/ch3.typ
typst
#import "@local/note_template:0.0.1": * #set par(justify: true) #set heading(numbering: "1.1") #set page(numbering: "1", number-align: center) #frontmatter( title: "Chapter 3: Data Sturctures", date: "2023 Oct 31", authors: ("Nemo",) ) #outline(indent: auto) #pagebreak() = Elementary Data Sturctures == Stacks and Queues Stacks and queues are dynamic sets in which the element removed form the set by the "Delete" operation prespecified. Stacks follow the _last-in, first-out_ or _LIFO_ policy and the queues follow the _first-in, first-out_ policy. === Stacks The INSERT operation on a stack is often called PUSH, and the DELETE is called POP (allusions to physical stacks). *Skipped...* === Queues The INSERT operation is called ENQUEUE and the DELETE is called DEQUEUE. The queue has a _head_ and a _tali_. *Skipped...* === Lots of Skipping ... = Hash Tables
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10F30.typ
typst
Apache License 2.0
#let data = ( ("SOGDIAN LETTER ALEPH", "Lo", 0), ("SOGDIAN LETTER BETH", "Lo", 0), ("SOGDIAN LETTER GIMEL", "Lo", 0), ("SOGDIAN LETTER HE", "Lo", 0), ("SOGDIAN LETTER WAW", "Lo", 0), ("SOGDIAN LETTER ZAYIN", "Lo", 0), ("SOGDIAN LETTER HETH", "Lo", 0), ("SOGDIAN LETTER YODH", "Lo", 0), ("SOGDIAN LETTER KAPH", "Lo", 0), ("SOGDIAN LETTER LAMEDH", "Lo", 0), ("SOGDIAN LETTER MEM", "Lo", 0), ("SOGDIAN LETTER NUN", "Lo", 0), ("SOGDIAN LETTER SAMEKH", "Lo", 0), ("SOGDIAN LETTER AYIN", "Lo", 0), ("SOGDIAN LETTER PE", "Lo", 0), ("SOGDIAN LETTER SADHE", "Lo", 0), ("SOGDIAN LETTER RESH-AYIN", "Lo", 0), ("SOGDIAN LETTER SHIN", "Lo", 0), ("SOGDIAN LETTER TAW", "Lo", 0), ("SOGDIAN LETTER FETH", "Lo", 0), ("SOGDIAN LETTER LESH", "Lo", 0), ("SOGDIAN INDEPENDENT SHIN", "Lo", 0), ("SOGDIAN COMBINING DOT BELOW", "Mn", 220), ("SOGDIAN COMBINING TWO DOTS BELOW", "Mn", 220), ("SOGDIAN COMBINING DOT ABOVE", "Mn", 230), ("SOGDIAN COMBINING TWO DOTS ABOVE", "Mn", 230), ("SOGDIAN COMBINING CURVE ABOVE", "Mn", 230), ("SOGDIAN COMBINING CURVE BELOW", "Mn", 220), ("SOGDIAN COMBINING HOOK ABOVE", "Mn", 230), ("SOGDIAN COMBINING HOOK BELOW", "Mn", 220), ("SOGDIAN COMBINING LONG HOOK BELOW", "Mn", 220), ("SOGDIAN COMBINING RESH BELOW", "Mn", 220), ("SOGDIAN COMBINING STROKE BELOW", "Mn", 220), ("SOGDIAN NUMBER ONE", "No", 0), ("SOGDIAN NUMBER TEN", "No", 0), ("SOGDIAN NUMBER TWENTY", "No", 0), ("SOGDIAN NUMBER ONE HUNDRED", "No", 0), ("SOGDIAN PUNCTUATION TWO VERTICAL BARS", "Po", 0), ("SOGDIAN PUNCTUATION TWO VERTICAL BARS WITH DOTS", "Po", 0), ("SOGDIAN PUNCTUATION CIRCLE WITH DOT", "Po", 0), ("SOGDIAN PUNCTUATION TWO CIRCLES WITH DOTS", "Po", 0), ("SOGDIAN PUNCTUATION HALF CIRCLE WITH DOT", "Po", 0), )
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/prob/seminars/2024-09-30.typ
typst
= Формула Пуанкаре Пять человек подбросили шляпы в воздух и каждый поймал одну случайную. Всего $5! = 120$ перестановок Никто не получил свою шляпу: $ 120 - 5 dot (5 - 1)! + 10 dot (5 - 2)! - 10 dot (5 - 3)! + 5 dot 1 - 1 = 44 $ Общая формула: $ n(A_1 + A_2 + ... + A_n) = sum_(s = 1)^n (-1)^(s - 1) C^s_n (n - s)! = n! sum_(s = 1)^n (-1)^s/s! $ $A_i$ --- $i$ человек получили свои шляпы $ P(A) = sum_(s = 0)^n (-1)^s/s! $ = Задачи == Задача Отрезок длина 5 на две части: 2 и 3. Десять точек бросают случайным образом. Найти вероятность того, что на отрезок длины 2 попадетне менее 9 точек A - случайная точка попадет на отрезок длины 2. p = P(A) = 0.4 $ P_10(>=9) = P_10(9) + P_10(10) = ...$ == Задача #footnote[Спасибо Агилю за конспектирование этой и следующей задач.] Есть 3 шара. Шары бывают или черными, или белыми. Было проведено 4 опыта. Найти апостериорные вероятности всех цветовых составов урн Результат: бчбб A - выпало бчбб $ H_1 = H_"ччч" $ $ H_2 = H_"ччб" $ $ H_3 = H_"чбб" $ $ H_4 = H_"ббб" $ $ P(H_i) = 0.25 $ $ P(A | H_1) = 0 $ $ P(A | H_2) = (1/3)^3 dot (2/3) = 2/81 $ $ P(A | H_3) = (1/3) dot (2/3)^3 = 8/81 $ $ P(A | H_4) = 0 $ $ P(A) = sum(i = 0)^4 P(H_i) dot P(A|H_i) $ $ P(H_2 | A) = P(A | H_2) dot P(H_2)/P(A) $ $ P(H_3 | A) = P(A | H_3) dot P(H_3)/P(A) $ == Задача В группе учится 30 студентов. На каждом из 14 семинаров проводится рубежный контроль случайным образом выбирает 6 студентов, чьи работы проверяются. Найти вероятность того, что работы первого студента: + Ни разу не попадут на проверку + Попадут на проверку не менее 2 раз + Найти среднее количество проверенных работ $A$ --- работа первого студента попадет на проверку. $ P(A) = 6/30 = 0.2 $ + $P_0 (14) = C^0_14 dot p^0 dot q^14 = 1 dot 1 dot (0.8)^14 =0.04398$ + $P_14 (>=2) = 1 - P_14 (0) - P_14 (1) = 0.802$ + $M(x)= n p = 14 dot 1/5 = 2.8$ == Задача $ p = 0.8 $ Цель поражена, если не менее трех попаданий. $A$ --- цель поражена $ P_n (>= 3) = P_4 (3) + P_4 (4) = ... $ == Задача Два контролера проверяют деталь. $H_i$ --- деталь попадет к $i$-ому контролеру $A$ --- деталь одобрена #figure( caption: [Условие], table( columns: 3, table.header($i$, $P(H_i)$, $P(A | H_i)$), $1$, $0.4$, $0.95$, $2$, $0.6$, $0.98$, ) ) \*Формула Баеса\* == Задача Фирма участвует в проектах. Вероятность победы в проектах соответственно: $0.9$, $0.4$, $0.8$, $0.2$ Вероятность, что фирма выиграет хотя бы в двух проектах? $ 1 - 0.1 dot 0.6 dot 0.2 dot 0.8 - "*по два*" + ... $
https://github.com/Myriad-Dreamin/shiroa
https://raw.githubusercontent.com/Myriad-Dreamin/shiroa/main/packages/shiroa-tests/test-summary.typ
typst
Apache License 2.0
#import "../shiroa/summary-internal.typ": * #import "../shiroa/lib.typ": * #let test(inp) = { let s = _convert-summary(metadata((kind: "book", summary: inp))) _numbering-sections(s.summary) } #let res = () #let t = test[ = Test ] #res.push(t) #let t = test[ = Test - #chapter("chapter1.typ")["Chapter 1"] ] #res.push(t) #let t = test[ = Test - #chapter("chapterN.typ", section: "3")["Chapter 3"] - #chapter("chapterN.typ")["Chapter 3.1"] ] #res.push(t) #let t = test[ = Test - #chapter("chapterN.typ", section: "3")["Chapter 3"] - #chapter("chapterN.typ")["Chapter 4"] ] #res.push(t) #let t = test[ = Test - #chapter("chapterN.typ")["Chapter 3"] - #chapter("chapterN.typ", section: "3.1")["Chapter 3.1"] - #chapter("chapterN.typ")["Chapter 3.2"] ] #res.push(t) #let t = test[ = Test - #chapter("chapterN.typ", section: "3")["Chapter 3"] - #chapter("chapterN.typ")["Chapter 4"] ] #res.push(t) #res.push(t) #res
https://github.com/gongke6642/tuling
https://raw.githubusercontent.com/gongke6642/tuling/main/Math/roots.typ
typst
#set text( size:10pt, ) #set page( paper:"a5", margin:(x:1.8cm,y:1.5cm), ) #set par( justify: true, leading: 0.52em, ) = 根 平方根或其他次方根。 = 例 #image("39.png") = 函数组 = 根 一般根 #image("40.png") = 指数 要开几次方,即根式的底数。 默认:none = 底数 进行方根运算的表达式,即根式的底数。 = 平方根 平方根 #image("41.png") = 表达式 要开平方根的表达式。
https://github.com/gabrielluizep/typst-ifsc
https://raw.githubusercontent.com/gabrielluizep/typst-ifsc/main/template/assignment.typ
typst
Creative Commons Zero v1.0 Universal
#let lista(title: "Título", course: "Programação I", doc) = { set text(font: "Latin Modern Roman", size: 1.1em, lang: "pt") set par(justify: true) show link: underline show heading.where(level: 1): it => [ #set align(center) #v(3em, weak: true) #it.body #v(2em, weak: true) ] show heading.where(level: 2): it => [ #v(3em, weak: true) #it.body #v(2em, weak: true) ] show heading: set text(font: "Latin Modern Sans") set enum(spacing: 2em) grid( columns: (auto, 1fr), gutter: 1em, image("../assets/ifsc-logo.png", height: 3.5em), [ #set text(font: "Latin Modern Sans") Instituto Federal de Santa Catarina\ Campus São José\ Área de Telecomunicações ], ) heading(level: 1, course + " - " + title) doc }
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20interna/Verbali/23-12-17/23-12-17.typ
typst
#import "/template.typ": * #show: project.with( date: "17/12/23", subTitle: "Meeting di retrospettiva e pianificazione", docType: "verbale", authors: ( "<NAME>", ), timeStart: "15:00", timeEnd: "16:00", ); = Ordine del giorno - Analisi Keep doings e Improvements; - To do e divisione ruoli. == Analisi Keep doings e Improvements === Keep doings - Ugualmente allo scorso sprint il gruppo ha raggiunto un soddisfacente grado di familiarità con le tecnologie e le ripartizioni dei lavori; - Avendo deciso, in seguito ai problemi riscontrati nello scorso sprint, di porre ai lavori scadenze infrasettimanali, le task sono state completate con maggiore costanza, evitando sovraccarichi durante il fine settimana. === Improvements - A causa di imprevisti tecnici, si sono verificati casi di insufficiente comunicazione tra i membri del gruppo creando il cosiddetto "effetto sottomarino" e producendo rallentamenti dei lavori; - Lo stato di avanzamento del documento Norme di Progetto sta procedendo più lentamente rispetto al livello atteso. === Soluzioni accordate relativamente agli improvements - Impegnarsi, in caso di imprevisti, a comunicare tempestivamente agli altri membri del gruppo gli eventuali ritardi previsti nei lavori; - Nella pianificazione del prossimo sprint verranno assegnati più membri del gruppo alla stesura del documento Norme di Progetto. == To do e divisione ruoli - I Progettisti e il Responsabile lavoreranno alla stesura del documento Norme di Progetto aggiungendo almeno cinque nuovi capitoli; - Il membro del gruppo tra quelli assegnati a lavorare sulle Norme di Progetto che farà un solo capitolo, si dovrà impegnare a studiare le tecnologie relative all'interfaccia utente (Angular, React, Next.js) per capire quale è più adatta al nostro progetto; - Due membri lavoreranno ai PoC: il Programmatore si impegnerà nell'integrazione dei PoC minori in un singolo PoC principale, mentre il membro del gruppo assegnato al ruolo di Verificatore proseguirà, come Programmatore, con lo sviluppo del lato frontend dell'applicativo; - L'Analista continuerà a redigere il documento di Analisi dei Requisiti migliorando quanto fatto e completando la tabella dei requisiti; - L'Amministratore dovrà: - redigere i verbali; - modificare il documento Piano di Progetto aggiungendo il preventivo del settimo sprint, il consuntivo del quinto sprint e sistemando eventuali errori presenti nel documento; - Migliorare le GitHub Action risolvendo gli errori legati al versionamento dei file e all'aggiornamento del changelog.
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/os/lectures/2024-10-07.typ
typst
#import "/utils/math.typ": * == Очереди сообщений Примитивы обмена информацией + `send(address, message)`: отправить сообщение `message` в очередь `address` Блокируется при попытке записи в полный буфер + `receive(address, message)`: получить сообщение `message` из очереди `address` Блокируется при чтении из пустого буфера. Получение сообщений в порядке FIFO Работают атомарно Обеспечивают взаимоисключение при работе с буфером === Задача Producer--Consumer #grid( columns: 2, row-gutter: 5pt, [Producer:], [Consumer:], // Producer ``` while (1) { produce_item(); send(address, item); } ```, // Consumer ``` while (1) { receive(address, item); consume_item(); } ``` ) == Эквивалентность механизмов Все механизмы синхронизации эквиваленты: имея один механизм можно написать все другие === Мониторы Хора через семафоры Дейкстры ```c Semaphore mut_ex = 1; // Для организации взаимоисключения // При входе в монитор void mon_enter(void) { P(mut_ex); } // Для выхода по return (в конце метода) void mon_exit(void) { V(mut_ex); } // Для каждой условной переменной Semaphore c_i = 0; shared int f_i = 0; // Для операции wait на условной переменной i void wait(i) { f_i += 1; V(mut_ex); P(c_i); f_i -= 1; } // Для операции signal void signal_exit(i) { if (f_i) { V(c_i); } else { V(mut_ex); } } ``` === Очереди сообщений через Семафоры Дейкстры ```c // Для очереди сообщений A Semaphore Amut_ex = 1; Semaphore Afull = 0; Semaphore Aempty = N; // N - системный размер буфера ``` #grid( columns: (1fr, 1fr), align: center, row-gutter: 15pt, ```c void send (A, msg) { P(Aempty); P(Amut_ex); put_item(A, msg); V(Amut_ex); V(Afull); } ```, ```c void receive(A, msg) { P(Afull); P(Amut_ex); get_item(A, msg); V(Amut_ex); V(Aempty); } ``` ) === Семафоры Дейкстры через Мониторы Хора ```c Monitor sem { unsigned int count; Condition c; void P(void) { if (count == 0) { c.wait; } count -= 1; } void V(void) { count += 1; c.signal; } { count = N; } } ``` === Семафоры Дейкстры через Очереди сообщений ```c void Sem_init(int N) { int i; создать очередь сообщений m; for (int i = 0; i < N; ++i) { send(M, msg); } } void Sem_P() { receive(M, msg); } void Sem_V() { send(M, msg); } ``` == Пример решения задачи В лесу стоит пустая бочка меда. Прилетают пчелы и кладут по капле. Только одна пчела может класть каплю меда. Медведь ест полную бочку меда. Пчела, положившая последнюю каплю, кусает медведя, чтобы позвать его есть мед. === Через семафоры Нужно понять, где процессы могут уходить в ожидание: - Пчела, когда другая пчела в бочке - Пчела, когда бочка полная - Медведь, когда бочка пуста ```c Semaphore bee = 1; Semaphore bear = 0; shared int Count = 0; ``` #grid( columns: (1fr, 1fr), align: center, row-gutter: 15pt, [Пчела:], [Медведь:], ```c while (1) { P(bee); Count++; if (Count == N) { V(bear); } else { V(bee); } // улетает за медом } ```, ```c while (1) { P(bear); Count = 0; V(bee); // идет бродить } ``` ) === Через очереди сообщений ```c shared int Count = 0; MessageQueue bee, bear; ``` #grid( columns: (1fr, 1fr), align: center, row-gutter: 15pt, [Пчела:], [Медведь:], ```c while (1) { receive(bee, m); Count++; if (Count == N) { send(bear, m); } else{ send(bee, m); } // улетаем за медом } ```, ```c send(bee, m); while (1) { receive(bear, m); Count = 0; send(bee, m); // идет бродить } ``` ) === Через мониторы ```c Monitor bb { Condition cbee, cbear; int Count; void bee() { if (Count == N) { cbee.wait; } Count++; if (Count == N) { cbear.signal; } else { cbee.signal; } } void bear() { if (Count != N) { cbear.wait; Count = 0; cbee.signal } } { Count = 0; } } ``` #grid( columns: (1fr, 1fr), align: center, row-gutter: 15pt, [Пчела:], [Медведь:], ```c while (1) { bb.bee(); // летим за медом } ```, ```c while (1) { bb.bear(); // идет бродить } ``` ) = Планирование процессов Нужно распределить ограничить ресурсы между многими потребителями. Для этого нужно: + Поставить цель планирования (*критерий*) + Придумать *алгоритм*, который опирается на некоторые *параметры* системы == Уровни планирования - *Долгосрочное планирование* (например, планирование заданий) Обычно на процессоре пытаются поддерживать фиксированное число работающих заданий. Это число называется *степенью мультипрограммирования*. Тогда новое задание появляется только, когда завершается другое. Решение о запуске задач принимается редко и надолго. - *Среднесрочное планирование* (например, swapping) Не завершившийся процесс временно выкачивают из оперативной памяти в постоянную. Потом когда-то возвращают. - *Краткосрочное планирование* (например, планирование запуска процессов) Решение принимается часто, каждый квант времени (каждые ~100мс). == Цели планирования - *Справедливость*: все процессам давать примерно одинаковое число времени - *Эффективность*: ЦП загружен на 100% (на практике обычно не достигается) Иногда на процессоре запускают IDLE процесс (работающий вхолостую) - *Сокращение* [среднего] *полного времени выполнения* (turnaround time) - *Сокращение времени ожидания* (waiting time): часть времени от turnaround time, когда мы не исполняемся - *Сокращение времени отклика* (response time): время от момента нажатия до появления реакции - Существуют некоторые другие цели Цели друг другу противоречат == Желаемые свойства алгоритмов - *Предсказуемость*: можно заранее оценить время работы программы; программа всегда должна работать примерно одно и то же время - *Минимизация накладных расходов* (overhead) - *Равномерность загруженности* вычислительной системы - *Масштабируемость*: небольшое увеличение нагрузки не должно приводить к резкому ухудшению характеристик == Параметры планирования - *Статические* (со временем не меняются): используются алгоритмами долгосрочного планирования - Статические параметры вычислительной системы (например, объем ОЗУ) - Статические параметры процесса: известны ещё до запуска (например, кем запущен, степень важность, требуемые ресурсы) - *Динамические* (меняются со времением): используются алгоритмами всех уровней планирования - Динамические параметры вычислительной системы (например, объем свободной ОЗУ в данный момент) - Статические параметры процесса (например, уже использованное процессорное время) #def[ #defitem[CPU Burst] --- куски программы, которые могут непрерывно выполняться на процессоре (без работы с *IO Burst*). ] == Когда нужно делать краткосрочное планирование? - Вынужденное принятие решений - "исполнение" $->$ "закончил исполнение" - "исполнение" $->$ "ожидание" - Невынужденное принятие решений - "исполнение" $->$ "готовность" - "ожидание" $->$ "готовность" Типы планирования: - *Невытесняющее*: принимаем только вынужденные решения - *Вытесняющее*: принимаем только и вынужденные, и невынужденные решения == Конкретные алгоритмы === FCFS (First Come -- First Served) (невытесняющий) Все готовые процессы выстраиваются в очередь FIFO. Когда освобождается место, мы берем процесс из головы очереди, новые добавляем в конце. *Преимущество*: Очень простой *Недостаток*: результирующие характеристики очень зависят от порядка появления процессов
https://github.com/Arrata-TTRPG/Arrata-TTRPG
https://raw.githubusercontent.com/Arrata-TTRPG/Arrata-TTRPG/main/src/sections/dice.typ
typst
Other
#import "../typst-boxes.typ": * = Dice == Why Dice? Dice are tools that are used to generate random numbers, which are in turn used to determine the outcome of certain scenarios. By adjusting things like how we count the value of each die, how many dice are rolled, and what special rules apply to them, we turn completely random, arbitrary values into probabilities that reflect the upper and lower bounds of a particular thing. == Dice Notation When using and discussing quantities of dice, often the term Dice Notation may be used. This refers to a system that helps define two things about the dice being rolled: - How many dice are to be rolled, represented as $Y$. - How many sides the dice being rolled have; represented as $X$. This is composed with a D in between, which stands for dice, in the form $Y D X$, although I prefer and will use a lowercase d for the rest of this book. Individual dice are often written without the $Y$ value as $d X$. #slantedColorbox( title: "Dice Notation Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: 100-sided dice are often a composition of $1 d 10 + (1 d 10 times 10)$._ #table( columns: (auto, auto), inset: 10pt, align: horizon, [1 6-sided die:], [$1 d 6$ or $d 6$], [3 dice with 20 sides each:], [$3 d 20$], [14 dice with 6 sides each:], [$14 d 6$], [100 dice with 100 sides each:], [$100 d 100$] ) ] == Rolled Dice When a roll is made, the result in this book will be recorded in parentheses () and each die's result will be separated by commas. These values are chosen at random for this book, and will be written as $(1, 2, 3, ...)$. #slantedColorbox( title: "Dice Rolling Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Ellipses $(r_0,...,r_n)$ are used to represent a range of data._ I rolled a six-sided die and got a $4$: $ 1 d 6 = (4) $ I rolled 3 twenty-sided dice and got 5, 15, and 20: $ 3 d 20 = (5, 14, 20) $ I rolled 100 one-hundred-sided dice and got 99, 65, ..., 23, and 55: $ 100 d 100 = (99, 65, ..., 23, 55) $ ] == Addition and Subtraction There will be cases where a roll would be given or have lost dice to roll, in which case we represent the change to a quantity of dice as $plus.minus X D$, where $X$ is the number of dice being added or subtracted and $D$ (always capitalized) is denoting that $X$ represents a quantity of dice. Separately, if two different-sided quantities of dice are added, there is no attempt to unify them into a single roll. Instead, they are left in their separate states and written as $Y_1$d$X_1$ + $Y_2$d$X_2$. #slantedColorbox( title: "Addition and Subtraction Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Different sided dice are never joined together into single a $X d Y$._ #table( columns: (auto, auto), [I gained 3d6 for my 6d6 roll:], [6d6 + 3D = 9d6], [I lost 2d20 for my 4d20 roll:], [4d20 - 2D = 2d20], [I gained 100d6 for my 5d8 roll:], [100d6 + 5d8 = 100d6 + 5d8] ) ] == Exploding Dice There are also cases where dice can "explode". This means that when the maximum possible value of a die is rolled, the value of that die is kept, and you can add +1D to the roll, rolling one more die. This can theoretically repeat infinitely, although the probability of that is essentially impossible. To denote a roll as exploding, add an exclamation point, $!$, to the front. Here are a few examples, not that they are summed to show how the value of the exploded dice affected the outcome: #slantedColorbox( title: "Exploding Dice Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Rolled dice that have a modifier applied to them are bolded (*6*)_. #table( columns: (auto, auto), align: horizon, [$!X_1 d Y_1$], [$= $ !_Result_ $+ X_2 d Y_2$ ... $=$ _Final Result_], [!3d6], [$=$ (*6* + 2 + 5) $=$ (*6* + 2 + 5) + !1d6 = 13 + (4) $=$ 17], [!2d20], [$=$ (*20* + *20*) $=$ 40 + !2d20 = 40 + (10 + 15) $=$ 65], [!6d2], [$=$ (1 + *2* + 1 + 1 + *2* + *2*) $=$ 9 + !3d2 $=$ ...], ) ] == Evil Dice In opposition to exploding dice, Arrata will deal with *Evil dice*. Evil dice are denoted by adding an upside-down exclamation point, $¡$. Instead of giving the roll an additional die to roll and add to the sum, Evil dice give an extra D1 that subtracts from the roll. #slantedColorbox( title: "Exploding Dice Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Evil dice and Exploding dice can happen simultaneously!_ #table( columns: (auto, auto), [$¡X_1 d Y_1$], [$= $ ¡_Result_ $- X_2 d Y_2$ ... $=$ _Final Result_], [$¡2 d 20$], [$= (bold(1) + 5) = 6 - ¡1 d 20 = 6 - (10) = -4$], [$¡6 d 6$], [$= (4 + 5 + 3 + bold(1) + 2 + 6) = 19 - ¡1 d 6 = 19 - (6) = 13$], [$¡3 d 10$], [$= (bold(1) + bold(1) + bold(1)) = 3 - ¡3 d 10 = 3 - (bold(1) + 2 + bold(1)) = ...$], ) ] == Dice Pools Arrata functions on *Dice Pools*. This is a way of rolling dice that focuses not on the sum of the values of the dice rolled, but by comparing each value to a constant, $C$. === Conditionals For Dice Pools, conditionals are used along with a given constant $C$ to achieve a specific effect. For Arrata, this conditional is the $>$ comparison operator. This is used to count the number of dice rolled that are larger than $C$. #slantedColorbox( title: "Dice Conditionals Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: This condition is $>$, *not* $>=$, so $(3) > 3$ evaluates to $0$, not $1$._ #table(columns: (auto, auto), [_Dice Pool $> C$_], [_$=$ Result $> C =$ Counted Sum_], [$4 d 20>10$], [$= (bold(12), bold(13), 4, 1)>10 = 2$], [$5 d 4>1$], [$= (1, bold(4), bold(2), 1, bold(3))>1 = 3$], [$2 d 10>9$], [$= (4, 7)>9 = 0$] ) ] This counted sum can be used for several schemas, and the value of $C$ can be used to adjust the probabilities of certain outcomes. The larger $C$ is, the lower the counted sum is and vice versa. == The d6 Arrata uses the d6 as its only die to roll. It's a convenient die as they're extremely stackable, provide a decent window of probabilities, and are often very cheap and numerous, which is excellent for Arrata because Dice Pool-based rolls can sometimes call for dozens of dice to be rolled at once. Because we know all rolls in Arrata use the d6, whenever a Quantity of dice is discussed, dice notation will not be used. Instead, the roll will be composed into a *Stat*. #pagebreak()
https://github.com/typst/templates
https://raw.githubusercontent.com/typst/templates/main/cereal-words/template/main.typ
typst
MIT No Attribution
#import "@preview/cereal-words:0.1.0": game #show: game // Type the words here
https://github.com/a-dixon/typst-template-ieee
https://raw.githubusercontent.com/a-dixon/typst-template-ieee/main/README.md
markdown
# Typst template for two-column IEEE-like papers at the Cooperative State University Baden-Würrtemberg This file aims to give a short overview of how IEEE-like papers can be created using this repo. For an introduction to the markup-based typesetting system *Typst*, please refer to the official [documentation](https://typst.app/docs/). ## Template The paper is defined according to the `template.typ` file. For many use cases this file will not need changing. ## Thesis Your thesis starts with the `thesis.typ` file. A document is created here based off `template.typ`. ## Content Your content may be separated into separate files per chapter, which can be placed in the `/chapters` folders. These files must then be included into the `thesis.typ` file using the following command: ```Typst #include "./chapters/introduction.typ" ``` ## Literature Place your literature into `literature.bib` in BibTex style. ## Acronyms Place your acronyms into `acronyms.yaml` in the following style: ```YAML YAML: YAML Ain't Markup Language ``` ## Static file Place static files like images into the `/statics` folder and include them in your thesis according to the documentation. ## Compilation Compile your thesis using the Typst CLI. To compile your thesis once, use the following command: ```SHELL typst compile thesis.typ ``` To compile your thesis upon change, use the following command: ```SHELL typst watch thesis.typ ``` That should be all :)
https://github.com/Dav1com/minerva-report-fcfm
https://raw.githubusercontent.com/Dav1com/minerva-report-fcfm/master/lib/util.typ
typst
MIT No Attribution
#import "../meta.typ": * /// Arreglo con los meses en español. /// -> array #let meses = ("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre") /// Arreglo con los días de la semana en español. /// -> array #let dias = ("Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo") /// Aplica el formato "[day] de [month repr: long] del [year]" en español /// /// - fecha (datetime): fecha a dar formato. /// -> string #let formato-fecha(fecha) = { return str(fecha.day()) + " de " + meses.at(fecha.month()-1) + " de " + str(fecha.year()) } /// Esta función permite obtener ayuda sobre cualquier función /// del template. Para saber qué funciones y variables define /// el template simplemente deja que el autocompletado te guíe, /// luego puedes llamar esta función para obtener más ayuda. /// /// - nombre (string): Puede ser el nombre de una función o /// variable, entonces la función entrega /// ayuda general sobre esta. Si se entrega /// algo de la forma `"help(nombre)"` entonces /// entrega ayuda específica sobre el argumento /// `nombre`. /// -> content #let help(nombre) = { import "../meta.typ": * return help-leaf("util")(nombre) }
https://github.com/xkevio/parcio-typst
https://raw.githubusercontent.com/xkevio/parcio-typst/main/parcio-thesis/chapters/introduction/intro.typ
typst
MIT License
#import "../../template/template.typ": subfigure, section = Introduction<intro> _In this chapter, #lorem(50)_ == Motivation // Subfigures. #subfigure( caption: "Caption", columns: 2, label: <fig:main>, figure(caption: "Left")[ #image(alt: "Blue OVGU logo", width: 75%, "../../template/ovgu.jpg") ], <fig:main-a>, figure(caption: "Right")[ #image(alt: "Blue OVGU logo", width: 75%, "../../template/ovgu.jpg") ], <fig:main-b> ) You can refer to the subfigures (Figures @fig:main-a[] and @fig:main-b[]) or the figure (@fig:main). \ \ #section[Summary] #lorem(80)
https://github.com/bpkleer/typst-modern-acad-cv
https://raw.githubusercontent.com/bpkleer/typst-modern-acad-cv/main/README.md
markdown
MIT License
# modern-acad-cv This template for an academic CV serves the peculiarities of academic CVs. If you are not an academic, this template is not useful. Most of the times in academics, applicants need to show everything they have done. This makes it a bit cumbersome doing it by single entries. In addition, academics might apply to institutions around the globe, making it necessary to send translated CVs or at least translations of some parts (i.e., title of papers in different languages). This template serves these special needs in introducting automated sections based on indicated `yaml`-files. Furthermore, it has a simplified multilingual support by setting different headers, title etc. for different languages (by the user in the `yaml`-fields). With this template, it might be more handy to keep your CV easier on track, especially when you need in different languages, since managing a `yaml`-file is easier than checking typesetting files against each other. This template is influenced by LaTeX's [moderncv](https://github.com/moderncv/moderncv) and its typst translation [moderner-cv](https://github.com/DeveloperPaul123/modern-cv). ## Fonts In this template, the use of FontAwesome icons via the [fontawesome typst package](https://typst.app/universe/package/fontawesome) is possible, as well as the icons from Academicons [use-academicons typst package](https://typst.app/universe/package/use-academicons). To use these icons properly, you need to install each fonts on your system. You can download [fontawesome here](https://fontawesome.com/download) and [academicons here](https://jpswalsh.github.io/academicons/). Both typst packages will be load by the template itself. Furthermore, I included my favorite font [Fira Sans](https://fonts.google.com/specimen/Fira+Sans). You can download it here [here](https://fonts.google.com/specimen/Fira+Sans), or just change the font argument in `modern-acad-cv()`. ## Usage The main function to load the construct of the academic CV is `modern-acad-cv()`. After importing the template, you can call it right away. If you don't have [Fira Sans](https://fonts.google.com/specimen/Fira+Sans) installed, choose a different font. Examples are given below. ```typst #import "@preview/modern-acad-cv:0.1.0": * #show: modern-acad-cv.with( metadata, multilingual, lang: "en", font: ("Fira Sans", "Andale Mono", "Roboto"), show-date: true, body ) // ... ``` In the remainder, I show basic settings and how to use the automated functions with the corresponding `yaml`-file. ### Setting up the main file and the access to the `yaml`-files A first step in your document is to invoke the template. Second, since this template works with `yaml`-files in the background you need to specify paths to each `yaml`-file you want to use throughout the document. The template comes along with the `metadata.yaml`. In the beginning of this yaml-file you set colors. Feel free to change it to your preferred color scheme. ```yaml colors: main_color: "#579D90" lightgray_color: "#d5d5d5" gray_color: "#737373" ... ``` At the beginning of your document, you just set then set the metadata-object: ```typst #import "@preview/modern-acad-cv:0.1.0": * #let metadata = yaml("metadata.yaml") ``` Initially, the `metadata.yaml` is located on the same level as the `example.typ`. All other `yaml`-files are saved in the folder `dbs`. Since `typ`-documents search for paths from the root of the document in that the function is called, you have to give the databases for the entry along the `metadata.yaml` within each function call. ### socials Contact details are important. In this CV template, you have the possibility to use fontawesome icons and academicons. To use socials, you just need to specify in `metadata.yaml`, the wanted entries. As you can see below, you set a category, i.e. email or lattes and then you have to define four arguments: `username`, `prefix`, `icon`, and `set`. The `username` will be used for constructing the link and will be shown next to the logo. The `prefix` is needed to build the valid link. The `icon` is the name of the icon in the respective set, which is chosen in `set`. ```yaml personal: name: ["<NAME>"] socials: email: username: <EMAIL> prefix: "mailto:" icon: paper-plane set: fa homepage: username: momo.github.io prefix: https:// icon: globe set: fa orcid: username: 0000-0000-0000-0000 prefix: https://orcid.org icon: orcid set: ai lattes: username: "1234567891234567" prefix: http://lattes.cnpq.br/ icon: lattes set: ai ... ``` ### Language setting & headers In order to support changing headers, you need to specify the language and the different content for each header in each language in the `i18n.yaml` in the folder `dbs`. The structure of the yaml is simple: ```yaml lang: de: subtitle: Short CV education: Hochschulbildung work: Akademische Berufserfahrung (Auswahl) grants: Fördermittel, Stipendien & Preise ... en: subtitle: Short CV education: Higher education work: Academic work experience (selection) grants: Scholarships & awards ... pt: subtitle: Currículo education: Formação acadêmica work: Atuação profissional (seleção) grants: Bolsas de estudo e prémios ... ``` For each language, you want to use later, you have to define all the entries. Reminder, don't change the entry names, since the functions won't find it under different names without changing the functions. First you have to set up a variable that inherits the ISO-language code, save the database into an object (here `multilingual`) and then give the object `multilingual` and `language` to the function `create-headers`: ```typst // set the language of the document #let language = "pt" // loading multilingual database #let multilingual = yaml("dbs/i18n.yaml") // defining variables #let headerLabs = create-headers(multilingual, lang: language) ``` You create an object `headerLabs` that uses the function `create-headers()` which will define the headers as you provided in the `yaml`. Then by switching the language object, all headers (if used accordingly to the naming in the `yaml`) will change directly. Throughout the document you then reference the created `headerLabs` object. If you change language, and values are provided, these automatically change. ```typst = #headerLabs.at("work") ... = #headerLabs.at("education") ... = #headerLabs.at("grants") ``` ### Automated functions All of the following functions share common arguments: `what`, `multilingual`, and `lang`. In `what`, you always declare the database you want to use with the function. For example, to get work entries, you choose `work`, which you defined beforehand as input from `work.yaml`. In the `multilingual` argument, you just pass the `multilingual` object. In `lang` you pass your `language` object. ```typst #let multilingual = yaml("dbs/multilingual.yaml") #let work = yaml("dbs/work.yaml") #let language = "pt" // Function call with objects #cv-auto-stc(work, multilingual, lang: language) ``` ### Sorting publications and referencing your own name or correpsonding Since `typst` so far does not support multiple bibliographies or subsetting these, this function let you choose specific entries via the `entries` argument or group of entries by the `tag` argument. Furthermore, you can indicate a string in `me` that can be highlighted in every output entry (i.e., your formatted name). So far, this function leads to another function that create APA-style format, if you want to use any other citation style, you need to download the template on [github](https://github.com/bpkleer/modern-acad-cv), introduce your own styling and then add it in the `cv-refs()` function. ```typst #let multilingual = yaml("dbs/multilingual.yaml") #let refs = yaml("dbs/refs/yaml") // function call of group of peer-reviewed with tag `peer` #cv-refs(refs, multilingual, tag: "peer", me: [Mustermensch, M.], lang: language) ``` You see in the example pictures that I used this function to built five different subheaders, i.e. for peer reviewed articles (`tag: "peer"`) and chapters in edited books (`tag: "edited"`). You can define the tags how you want, however, they need to put them into `tag: <str>`. Sometimes, it is not only necessary to highlight your own name, you might also want to indicate yourself as corresponding author. This can be done through the `refs.yaml` which adhere to [Hayagriva](https://github.com/typst/hayagriva). By adding an argument `corresponding` in the yaml and setting the value to `true`, a small `C` will appear next to your name. ```yaml Mustermensch2023: type: "article" date: 2023 page-range: 55-78 title: "Populism and Social Media: A Comparative Study of Political Mobilization" tags: "peer" author: [ "<NAME>", "<NAME>" ] corresponding: true parent: title: "Journal of Political Communication" volume: 41 issue: 3 serial-number: doi: "10.1016/j.jpolcom.2023.102865" ``` For applications abroad, it might be worth to translate at least title of the publications so that other persons easily can see what the paper is about. In every `title` argument, you can therefore provide a dictionary with the language codes and the titles. Keep the original title in `main` and the translations with the corresponding language shortcut (i.e., `"en"` or `"pt"`). The function prints the main and translated title, depending on the provided translation in the `refs.yaml`. Be aware, here you find not `de` in the dictionary, instead you find `main`. The original title needs to be wrapped in `main`. ```yaml Mustermensch2023: type: "article" date: 2023 page-range: 55-78 title: main: "Populismus und soziale Medien: Eine vergleichende Studie zur politischen Mobilisierung" en: "Populism and Social Media: A Comparative Study of Political Mobilization" pt: "Populismo e redes sociais: Um Estudo Comparativo de Mobilização Política" tags: "peer" author: [ "<NAME>", "<NAME>" ] corresponding: true parent: title: "Journal of Political Communication" volume: 41 issue: 3 serial-number: doi: "10.1016/j.jpolcom.2023.102865" ``` ### cv-auto-skills() Instead of just enumerating your skills or your knowledge of specific software, you can build a skill-matrix with this function. In this skill-matrix, you can have sections, i.e. *Computer Languages*, *Programs* and *Languages*. These sections are the highest level in the corresponding `skills.yaml`: ```yaml computer: ... programs: ... languages: ... ``` You can then define in each categories specific skills, i.e. German and Portuguese in `languages`: ```yaml computer: ... programs: ... languages: german: ... portugues: ... ``` For each entry, you have to define `name`, `level` and `description`. ```yaml languages: ... pt: name: de: Portugiesisch en: Portuguese pt: Português level: 3 description: de: fortgeschritten en: advanced pt: avançado ``` As you can see, you can again define language-dependent names in `name` and descriptions in `description`. `level` is a numeric value and indicates how many of the four boxes are filled to indicate you level of proficiency. If you don't have the need for a CV of different languages, you can directly define `name` or `description`. You have to call the function with three objects `skills`, `multilingual`, and `metadata` and the corresponding `language` of the document: ```typst #let skills = yaml("dbs/skills.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let metadata = yaml("dbs/metadata.yaml") #let language = "pt" #cv-auto-skills(skills, multilingual, metadata, lang: language) ``` ### Print your info without any formatting The function `cv-auto` is the base function for printing the provided infos in the specified `yaml` file with no further formatting. The functions `cv-auto-stc` and `cv-auto-stp` do only differ in the point that `cv-auto-stc` both give the title in bold, `cv-auto-stp` puts the subtitle in parentheses and `cv-auto-stc` puts the subtitle after a comma. The structure of the corresponding `yaml` files is simple: in each entry you can have the following entries: `title`, `subtitle`, `location`, `description` and `left`. `title` is mandatory, `subtitle`, `location`, and `description` are voluntary. In all functions you need to specify `left`, which indicates period of time, or year. For `title`, `subtitle`, `location`, and `description`, you can provide a dictionary for different languages (see below). ```yaml master: title: de: Master of Arts en: Master of Arts pt: Pós-Graduação subtitle: de: Sozialwissenschaften en: Social Sciences pt: Ciências Sociais location: de: Exzellenz-Universität en: University of Excellence pt: Universidade de Excelência description: de: mit Auszeichnung en: with distinction pt: com distinção left: "2014" ``` In your main document, you then easily call the function and transfer the standard arguments `what`, `metadata`, and `lang`. ```typst // section of education #let education = yaml("dbs/education.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #cv-auto-stp(education, multilingual, lang: language) // section of work positions #let work = yaml("dbs/work.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #cv-auto-stc(work, multilingual, lang: language) // section of given talks #let talks = yaml("dbs/talks.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #cv-auto(talks, multilingual, lang: language) ``` ### Creating a list instead of single entrie Sometimes, instead of giving every entry, you want to group by year. Another example for this case could be that you want to summarize your memberships or reviewer duties. The function `cv-auto-list` uses just the standard input: ```typst #let conferences = yaml("dbs/conferences.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #cv-auto-list(conferences, multilingual, lang: language) ``` The corresponding `yaml` file is differently organized: The entry point in the file is the corresponding year. In every year, you organize your entries (i.e. conference participations). In each entry in a year, you have the `name` and `action` entry. You can provide a dictionary for the `name`. For `action`, I used `P` and `C`, for *paper/presentation* and *chair*. You can then manually define this upfront the function call for the reader, or you use the `i18n.yaml`, indicate the explanations for each language in `exp-confs` and then it automatically changes with the specific language code. ```yaml "2024": conference2: name: European Conference on Gender and Politics action: P conference1: name: ECPR General Conference action: P, C ``` The action will be added after each conference name in superscripts. ### Creating a table This case is mostly used for listing your prior teaching experience. The corresponding `teaching.yaml` for this description, is organized as followed: ```yaml "2024": course1: summer: T name: de: "Statistik+: Einstieg in R leicht gemacht" en: "Statistics+: Starting with R (de)" pt: "Estatística+: Começando com R (de)" study: de: Bachelor en: Bachelor pt: Graduação ... ``` First you indicate the year `"2024"` and then you organize all courses you gave within that year (i.e. here `course1`). Mandatory are `name` and `study`. For both you can indicate a single value or a dictionary corresponding to your chosen languages. You can provide `summer` if you want to indicate differences for terms. This is `boolean`, the specific word is then given in the `i18n.yaml` under `table-winter` resp. `table-summer`. The function then uses again just the standard arguments and plots a table with the indicated year, name, and study area. ```typst #let teaching = yaml("dbs/teaching.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #cv-table-teaching(teaching, multilingual, lang: language) ``` ### cv-auto-cats() In case you want to directly print entries from categories that belong to one `yaml`-file, you can use `cv-auto-cats`. This will print the header for each subcategory and then the belonging entries. An example is given in `training.yaml`. In this file, further training is given by categories (i.e., methods and didactics). Within the categories you have here courses and then `title`, `location`, and `left`. `location` and `title` can be dictionaries if you want to translate between different languages. ```yaml methods: course2: title: Bayesian modelling in the Social Sciences location: An expensive Spring Seminar left: "2024" ... didactics: course2: title: de: Konfliktkompetenz I + II en: Conflict competence I + II pt: Competência de conflitos I + II location: de: Universitätsallianz en: University Alliance pt: Aliança Universitária left: "2019" ``` Call the function as usal: ```typst #let training = yaml("dbs/training.yaml") #let multilingual = yaml("dbs/multilingual.yaml") #let language = "pt" #let headerLabs = create-headers(multilingual, lang: language) #cv-auto-cats(training, multilingual, headerLabs, lang: language) ``` ### Special cases: long names If you have a long name that crosses the social media side, just set the argument `split` to `true` within `metadata.yaml`: ```yaml ... personal: name: ["<NAME>"] split: true ... ``` ## Examples ![Momo Mustermensch's CV](assets/example1.png) ![Momo Mustermensch's CV](assets/example2.png) ![Momo Mustermensch's CV](assets/example3.png)
https://github.com/Isaac-Fate/booxtyp
https://raw.githubusercontent.com/Isaac-Fate/booxtyp/master/src/book.typ
typst
Apache License 2.0
#import "page-header.typ": page-header-rules #import "outline.typ": outline-rules #import "paragraph.typ": paragraph-rules #import "sectioning.typ": chapter-rules, section-rules #import "equation.typ": equation-rules #import "reference.typ": reference #import "theorems/mod.typ": theorem-rules #import "figure.typ": figure-rules #let book(body, toc-title: "Table of Contents") = { show: page-header-rules show: outline-rules // show: paragraph-rules show: figure-rules show: chapter-rules show: section-rules show: equation-rules show: reference show: theorem-rules body }
https://github.com/xsro/xsro.github.io
https://raw.githubusercontent.com/xsro/xsro.github.io/zola/typst/nlct/math/common.typ
typst
#import "@preview/ctheorems:0.1.0": * #set heading(numbering: "1.1.") #let theorem = thmbox("theorem", "Theorem", fill: rgb( "#E1F5FE"),stroke:rgb("#4FC3F7")) #let proposition = thmbox("proposition", "Proposition", fill: rgb( "#E1F5FE"),stroke:rgb("#4FC3F7")) #let corollary = thmplain( "corollary", "Corollary", base: "theorem", titlefmt: strong ) #let definition = thmbox("definition", "Definition", stroke:rgb("#4FC3F7"), inset: (x: 0.3em, top: 0.2em, bottom:0.2em)) #let example = thmplain("example", "Example", numbering:none) #let proof = thmplain( "proof", "Proof", base: "theorem", bodyfmt: body => [#body #h(1fr) $square$], ).with(numbering:none)
https://github.com/fenjalien/metro
https://raw.githubusercontent.com/fenjalien/metro/main/tests/angle/number-angle-product/test.typ
typst
Apache License 2.0
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: 1cm) #ang(2.67) #ang(2.67, number-angle-product: " ")
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/06-features-2/anchor/mark-to-mark.typ
typst
Other
#import "/template/template.typ": web-page-template #import "/template/components.typ": note #import "/template/lang.typ": arabic #import "/lib/glossary.typ": tr #show: web-page-template // ### Mark-to-mark === 符号叠放 // The third kind of mark positioning, mark-to-mark, does what its name implies - it allows marks to have other marks attached to them. 第三种符号#tr[positioning]规则是符号叠放。顾名思义,它用来在符号上附加符号。 // In Arabic, an alif can have a hamza mark attached to it, and can in turn have a damma attached to the hamza. We position this by defining a mark class for the damma as normal: 在阿拉伯文中,字母`alif`上可以添加`hamza`符号,然后这个整体上面还可以添加`damma`符号。我们按照之前的方式为`damma`定义一个符号类: ```fea markClass damma <anchor 189 -103> @dammaMark; ``` // And then we specify, in the `mkmk` (mark-to-mark) feature, how to attach the hamza to the damma: 然后,在`mkmk`(mark-to-mark)特性中,定义它如何叠放在`hamza`符号上: ```fea feature mkmk { position mark hamza <anchor 221 301> mark @dammaMark; } mkmk; ``` 看看结果:#arabic[أُ] // Once again, this is the kind of feature that is often automatically generated by defining anchors in your font editor. 再次提醒,在字体编辑器中定义锚点后,这种特性通常是让软件自动生成的。
https://github.com/rabotaem-incorporated/probability-theory-notes
https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/02-general/01-kolmogorov.typ
typst
#import "../../utils/core.typ": * == Колмогоровская модель теории вероятностей #ticket[Вероятностное пространство. Условная вероятность. Независимые события.] #def[ _Вероятностное пространство_ --- это тройка $(Omega, Ff, P)$, где - $Omega$ --- пространство _элементарных исходов_ (множество) - $Ff$ --- $sigma$-алгебра подмножеств $Omega$ (элементы --- _случайные события_) - $P$ --- _вероятностная мера_ на $Ff$ (мера вероятностная, если $P(Omega) = 1$). ] #notice[ Если $Omega$ --- не более чем счетное, то можно рассмотреть $Ff$ --- это множество всех подмножеств $Omega$. Для больших множеств далеко не все меры можно продолжать на все подмножества. ] #def[ Если $A$ --- случайное событие, вероятность которого положительна, то _условной вероятностью_ события $B$ при условии $A$ называется число $ P(B | A) := P(A sect B)/P(A). $ ] #def[ События $A$ и $B$ называются _независимыми_, если $P(A sect B) = P(A)P(B)$. ] #def[ События $A_1, A_2, ..., A_n$ называются _независимыми в совокупности_, если для любого набора различных индексов $i_1, i_2, ..., i_k$ верно $ P(A_(i_1) sect A_(i_2) sect ... sect A_(i_k)) = P(A_(i_1))P(A_(i_2))...P(A_(i_k)). $ ] #def[ Бесконечная последовательность событий $A_1, A_2, ...$ называется _независимой в совокупности_, если для любого натурального $n$ и любого набора различных индексов $i_1, i_2, ..., i_n$ верно $ P(A_(i_1) sect A_(i_2) sect ... sect A_(i_n)) = P(A_(i_1))P(A_(i_2))...P(A_(i_n)), $ или, равносильно, если любой префикс независим в совокупности. ] #(make_theorem("Утверждение", color: blue))[ Если $A_1, A_2, ...$ независимы в совокупонсти, то $ P(Sect_(k = 1)^oo A_k) = product_(k = 1)^oo P(A_k). $ ] #proof[ $P(Sect_(k = 1)^oo A_k) <-- P(Sect_(k = 1)^n A_k) = product_(k = 1)^n P(A_k) --> product_(k = 1)^oo P(A_k)$. ] #ticket[Лемма Бореля–Кантелли. Закон нуля и единицы. Пример.] #lemma(name: "Борелля-Кантелли")[ 1. Если ряд $sum_(n = 1)^oo P(A_n) < +oo$, то вероятность того, что случилось бесконечное количество из событий $A_n$, равна нулю. 2. Если события $A_1, A_2, ...$ независимы в совокупности, и ряд $sum_(n = 1)^oo P(A_n)$ расходится, то вероятность того, что случилось бесконечное количество из событий $A_n$, равна единице. ] #proof[ Пусть $B$ --- событие "случилось бесконечное количество $A_n$". Тогда $ B = Sect_(n = 1)^oo Union_(k = n)^oo A_k. $ Почему? - "$supset$": пусть $omega in Sect_(n = 1)^oo Union_(k = n)^oo A_k$. Тогда $omega in union_(k = n)^oo A_k$ для любого $n$, а значит $omega in A_k$ для бесконечного количества $k$. - "$subset$": пусть $omega in A_j$ для бесконечного числа $j$. Тогда $omega in Union_(k = n)^oo A_k$ для любого $n$, и $omega in Sect_(n = 1)^oo Union_(k = n)^oo A_k$. Теперь доказываем лемму. 1. $P(B) = P(Sect_(n = 1)^oo Union_(k = n)^oo A_k) <= P(Union^oo_(k = n) A_k) <= sum_(k = n)^oo P(A_k) --> 0$ как хвост сходящегося ряда. 2. $P(Sect_(k = n)^oo neg(A)_k) = product_(k = n)^oo P(neg(A)_k) = product_(k = n)^oo (1 - P(A_k))$, так как события $neg(A)_n$ независимы в совокупности. $ ln P(Sect_(k = n)^oo neg(A)_k) = sum_(k = n)^oo ln(1 - P(A_k)) <= -sum_(k = n)^oo P(A_k) = -oo. $ Значит $P(Sect_(k = n)^oo neg(A_k)) = 0$, и $P(neg(Sect_(k = n)^oo neg(A)_k)) = 1$, и $P(Union_(k = n)^oo A_k) --> P(B)$ по непрерывности меры сверху. ] #follow(name: "<NAME> и единицы")[ Пусть $A_1, A_2, A_3, ...$ --- независимые в совокупности события. Тогда $ P("случилось бесконечное количество" A_n) = 0 "или" 1. $ ]
https://github.com/AntonioSilva03/CurriculumVitae
https://raw.githubusercontent.com/AntonioSilva03/CurriculumVitae/main/Curriculum%20in%20English/template/resume.typ
typst
#import "@preview/modern-cv:0.4.0": * #show: resume.with( author: ( firstname: "António", lastname: "Silva", email: "<EMAIL>", phone: "(+351) 968780666", github: "AntonioSilva03", linkedin: "antónio-silva03", address: "Braga, Braga", positions: ( "Computer Engineer", ), ), date: datetime.today().display(), language: "en", colored-headers: true, ) = Education #resume-entry( title: "Escola EB 2,3 de Gualtar", location: "Braga", date: "2013 - 2018" ) #resume-entry( title: "Escola Secundária Carlos Amarante", location: "Braga", date: "2018 - 2021", description: "Science and Technology Course Final Average of 18.22 values", ) #resume-entry( title: "Universidade do Minho", location: "Braga", date: "2021 - 2024", description: "Degree in Computer Engineering", ) = Certifications #resume-entry( title: "Academic Merit (x8)", location: "Braga", date: "2013-2021", description: "Agrupamento de Escolas Carlos Amarante", ) #resume-entry( title: "Certificate in Advanced English (C1)", location: "Braga", date: "december 2020", description: "Cambridge Assessment English", ) = Projects #resume-entry( title: "Online auction platform", location: [#github-link("AntonioSilva03/Projeto-LI4")], date: "september 2023 - january 2024", description: "Universidade do Minho - Computer Labs IV", ) #resume-item[ - Platform for creating auctions containing skins from the Counter-Strike game - Platform composed of 3 layers: Database, Business Logic and User Interface - Basic authentication with email and password, with which each user can create auctions, bid on auctions and view their auction history - Admin Dashboard - Tools - Blazor, Microsoft SQL Server, HTML, CSS ] #resume-entry( title: "Curricular Units Site Generator", location: [#github-link("AntonioSilva03/Projeto-EngWeb")], date: "may 2024 - june 2024", description: "Universidade do Minho - Web Engineering", ) #resume-item[ - Platform to generate web pages that support curricular units - Three types of users (student, teacher, admin) - In this app, CU teachers can make files available and post information about the CU (evaluation, timetables, teaching team). - All of this content can be consulted by students who enter the UC. - Architecture divided into 3 layers: interface, authentication server, API and database - Authentication with JWT - Tools - Express, MongoDB, JWT, Docker ] #resume-entry( title: "3D Engine", location: [#github-link("AntonioSilva03/Projeto-CG")], date: "february 2024 - june 2024", description: "Universidade do Minho - Computer Graphics", ) #resume-item[ - In this project, a 3D engine was developed based on 3D mini-figure graphics. - It was divided into four phases and, in each phase, a set of configuration XML files was provided for testing and evaluation purposes. - It was possible to create 3D scenes, such as the creation of a cube, a plane, a sphere, a cone, a cylinder and even a solar system, with realistic planet rotation. - A system of manually geometric transformations, a camera system and a lighting system were implemented. - Tools - OpenGl, C++. ] #pagebreak() #resume-entry( title: "Task orchestration service on a computer", location: [#github-link("AntonioSilva03/Projeto-SO")], date: "march 2024 - june 2024", description: "Universidade do Minho - Operating Systems", ) #resume-item[ - The server runs infinitely, persistently waiting for client requests. - The client can request a task execution, a program pipeline or a server status. - The server can run with two scheduling policies that must be passed as an argument. - You can test the execution times of multiple policies with the same tasks - Tools - C ] #resume-entry( title: "Development of a system interface", location: [#github-link("AntonioSilva03/Projeto-IPM")], date: "march 2024 - june 2024", description: "Universidade do Minho - Person-Machine Interface", ) #resume-item[ - Interface for mechanics at a service station - Multiple states for a service - Possibility to change details - Pinia was used to implement the application state - Backend implemented with json-server - Tools - Vue ] #resume-entry( title: "Service station management systems", location: [#github-link("AntonioSilva03/Projeto-DSS")], date: "september 2023 - january 2024", description: "Universidade do Minho - Software Systems Development", ) #resume-item[ - This system helps the operation of an E.S.Ideal station. - Various diagrams to help understand the system - Provides its customers with various car booking and maintenance services. - Two types of users: manager and mechanic - Architecture implemented using a database. - Tools - Java, SQL Server and Visual Paradigm. ] #resume-entry( title: "Database of a fictitious Hospital", location: [#github-link("AntonioSilva03/Projeto-BD")], date: "february 2022 - june 2023", description: "Universidade do Minho - Database", ) #resume-item[ - Definition of a hospital's information system and human resources - Requirements Gathering and Analysis - Conceptual and logical modeling of the database - Physical implementation of the database and a database management system - Data Analysis Panel System - Tools - SQL, PowerBI, brModelo ] #resume-entry( title: "Peer-to-Peer file transfer service", location: [#github-link("AntonioSilva03/Projeto-CC")], date: "october 2023 - december 2023", description: "Universidade do Minho - Computer Communications", ) #resume-item[ - A peer-to-peer file transfer service allows clients to more efficiently transfer data from multiple nodes (seeders) by transferring different parts of packets in parallel. - There is a central entity that handles connections and controls which files each node has - It is also possible to consult the files that are being shared at that moment directly in the program, as well as delete files. - Use of TCP and UDP - Tools - Java ] #resume-entry( title: "Learning and decision models", location: [#github-link("AntonioSilva03/Projeto-ADI")], date: "march 2024 - june 2024", description: "Universidade do Minho - Smart Learning and Decision", ) #resume-item[ - This project is divided into two separate tasks. The first task consists of querying, exploring, analyzing and preparing a dataset chosen by us. The second task consists of the same basis, but this time on a dataset chosen by the teachers. - As the dataset chosen by the teachers normally demonstrated a Classification problem, the dataset we decided to choose normally demonstrated a Regression problem. - All models in detail as well as results and analysis can be found in one report. - Tools - KNIME ] #pagebreak() #resume-entry( title: "Messaging services", location: [#github-link("AntonioSilva03/SSI2324")], date: "february 2024 - june 2024", description: "Universidade do Minho - Computer Systems Security", ) #resume-item[ - Repository with all practical work carried out in the IT Systems Security course and laboratory guides. - TP1: encrypted message exchange service that uses the Diffie-Hellman protocol. x503 certificates and the Station-to-Station protocol are also used. - TP2: Concordia application. Message exchange service that works with users and groups on the Linux system. It is possible to send messages to a single user or to a group made up of several users. - Tools - Python, C ] #resume-entry( title: "Forth Compiler", location: [#github-link("AntonioSilva03/Projeto-PL")], date: "may 2024 - june 2024", description: "Universidade do Minho - Language Processing", ) #resume-item[ - Compiler for the Forth language that generates code for a virtual machine - Translator grammar based on PLY-Yacc - Lexical analyzer implemented with PLY-Lex - Tools - Python ] = Skills #resume-skill-item( "Programming languages", ( "C++", "C", "C#", "Python", "Java", "JavaScript", "Haskell", "HTML", "CSS", ), ) #resume-skill-item( "Frameworks", ( "Vue", "Blazor", "Express", ), ) #resume-skill-item( "Tools", ( "Git", "Docker", "MongoDB", "SQL Server", ), ) #resume-skill-item("Spoken Languages", ( "Portuguese", "English" )) #resume-skill-item("Soft-skills", ( "Teamwork", "Communication", "Time Management", "Troubleshooting", "Adaptability", "Bug finding" ))
https://github.com/Meisenheimer/Notes
https://raw.githubusercontent.com/Meisenheimer/Notes/main/src/Cluster.typ
typst
MIT License
#import "@local/math:1.0.0": * = Cluster == K-means #env("Definition")[ Given points $mathbf(x)_1, dots, mathbf(x)_m in RR^n$, *k-means clustering* aims to partition the points into $k lt.eq n$ sets $S = {S_1, dots, S_k}$ satisfies $ S = limits(arg min)_(S) {sum_(i=1)^k sum_(mathbf(x) in S_i) ||mathbf(x) - mathbf(mu)_i||^2}, $ where $mathbf(mu)_i$ is the mean (centroid) of points in $S_i$, i.e. denoted by $|S_i|$ the size of $S_i$, $ mathbf(mu)_i = 1/(|S_i|) sum_(mathbf(x) in S_i) mathbf(x). $ ] #env("Theorem")[ Denoted by $mathbf(x)_1, dots, mathbf(x)_m in RR^n$ the points and $S = {S_1, dots, S_k}$ sets given by K-means, $ S = limits(arg min)_(S) {sum_(i=1)^k 1/(|S_i|) sum_(mathbf(x), mathbf(y) in S_i) ||mathbf(x) - mathbf(y)||^2}. $ ] #env("Method", name: "K-means clustering")[ Denoted by $S^((t)) = {S_1^((t)), dots, S_k^((t))}$ the sets given by k-means at $t$-th step and $mathbf(mu)_i^((t))$ the mean of $S_i^((t))$, the algorithm proceeds by + *Assignment*: Assign each point to the cluster with the nearest mean, $ S_i^((t)) = {mathbf(x)_p: forall j in {1, dots, k}, ||mathbf(x)_p - mathbf(mu)_i^((t))||^2 lt.eq ||mathbf(x)_p - mathbf(mu)_j^((t))||^2}; $ + *Update*: Recalculate means (centroids) of each cluster, $ mathbf(mu)_i^((t)) = 1/(|S_i^((t))|) sum_(mathbf(x) in S_i^((t))) mathbf(x). $ ]
https://github.com/jrihon/multi-bibs
https://raw.githubusercontent.com/jrihon/multi-bibs/main/chapters/01_chapter/mod.typ
typst
MIT License
#import "../../lib/multi-bib.typ": * #import "bib_01_chapter.typ": biblio // import dictionary from the generated file = Chapter 1 #include "introduction.typ" #include "methods.typ" #include "results.typ" #include "discussion.typ" #mbibliography(biblio, "ieee")
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/enum_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // In the line. 1.2 \ This is 0. \ See 0.3. \
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-tools/drill_press_metal.typ
typst
#import "/meta-environments/env-features.typ": * = Metal Drill Press == Notes // General and specific to Protohaven === Safety Keep workpiece firmly attached to the table at all times. If the workpiece becomes loose, it may lift up and begin to spin on the drill bit, creating a very dangerous cutting hazard. === Use Drilling produces a lot of heat, and it's easy to overheat a drill bit when cutting for an extended period in a hard material. Go slowly, take frequent breaks, and use a good cutting oil to help cool the work and improve the cut. === Consumables The are shop-use drill bits available in the shop cart by the metal band saw, and there is a drill bit set available for checkout at the front desk. If you need a particular bit size, or want to be sure you have sharp drills, you should invest in your own drill bit set. == Parts of the Metal Drill Press === Full View #figure( image("./images/drill_press-metal-front_quarter-annotated.png", width: 100%), caption: "An annotated full view of the metal drill press.", ) === Belt Drive #figure( image("./images/drill_press-metal-belts-annotated.png", width: 100%), caption: "An annotated view of the belt drive system.", ) === On/Off Switch Put the switch into the *on* position to turn on the drill. Put the switch into the *off* position to turn off the drill. === Chuck The chuck holds the drill bit in the spindle. The chuck uses a set of jaws, which tighten around the shaft of the bit. Always make sure that the bit is firmly held by all three jaws. === Depth Stop The depth stop limits the amount of downward travel for the spindle. Set the depth stop to drill holes of a specific depth in a work piece. === Feed Handle The feed handle lowers the spindle towards the workpiece. === Spindle The spindle is driven by the motor to turn the chuck and the bit. === Table The table supports the workpiece. The workpiece can be clamped to the table with the clamp set, or with the drill press vise. === Table Adjust Clamp Use the table adjust clamp to reposition the table. With the table adjust clamp loose, the table can be swung from side to side or moved up and down the drill press post. Always make sure the table adjust clamp is fully tight before drilling a workpiece. === Belt Cover At the top of the drill press, the belt cover contains the belt drive system. Make sure the belt cover is closed before turning on the drill press. === Motor Tension Lock Screw There are two motor tension lock screws on either side of the drill cabinet. Loosen both screws to free the motor and enable the motor tension release lever. Make sure the motor tension lock screws are firmly tightened before running the drill press. === Motor Tension Release Lever The motor tension release lever pulls the motor into a slack position, so the drive belts can be repositioned. Always make sure the drive belts are under tension before running the drill press. === Clamp Set At the base of the drill press is a clamp set for use with the drill press table. The clamp set offers various screws and clamping bars that can secure a workpiece to the table. === Drill Press Vise At the base of the drill press is a drill press vise, which can hold a workpiece for drilling. The drill press vise must be clamped to the table using the clamp set to securely hold the workpiece. == Basic Operation === Setting Up Ready the work area: + Turn on the light. + Clear off table of tools. Set the appropriate speed: + Open the top of the drill press. + Loosen the two motor slide lock screws. + Release the motor tension release lever. + Configure the belts for the appropriate cutting speed. + Set the motor tension release lever. + Tighten the two motor slide lock screws. + Close the top of the drill press. Secure a bit in the chuck: + Close the jaws of the chuck all the way. + Open the jaws just enough to accept the bit.\ _This will help keep the bit centered in the chuck._ + Slide the bit up into the jaws of the chuck. + Tighten the chuck.\ _The metal drill press has a keyless chuck; you do not need a chuck key. Tighten the chuck by hand._ Briefly run the drill to make sure the bit is on axis.\ _The bit should not wobble when the drill is running._ If needed, set the depth stop to make sure the drill press stops cutting at a specific depth. === Workholding #safety_hazard_box([Proper workholding is critical to the safe use of the metal drill press. If the workpiece comes loose while the drill is running, the workpiece will rise up and begin to spin, becoming a very dangerous hazard for anyone nearby. Always make sure that your workpiece is securely clamped to the table of the metal drill press. #warning([DO NOT drill into the table or vise.]) Use sacrificial wood under the workpiece for through holes.) ]) There is a clamp set stored at the base of the metal drill press which can be used to secure the workpiece to the table. The clamp set can also be used to secure the table vise. === Drilling + Turn on the drill. + Pull the feed handle with a slow firm pressure to advance the bit through the workpiece.\ _Using cutting oil is recommended to control the temperature of the cut, and help the drill bite into the material._ + Reduce feed pressure near the end of the cut.\ + Turn off the drill. If you are making a deep hole in the workpiece, you may wish to complete the cut in several passes. // Called "pecking" to clear swarf and add more cutting fluid. === Cleaning Up + Unclamp the workpiece from the table. + Clear off the table of tools and clamps. + Clean the table of swarf and wipe up any cutting fluid. + Turn off the light.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/cjk-punctuation-adjustment_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set text(lang: "zh", region: "CN", font: "Noto Serif CJK SC") 《书名〈章节〉》 // the space between 〉 and 》 should be squeezed 〔茸毛〕:很细的毛 // the space between 〕 and : should be squeezed
https://github.com/maucejo/cnam_templates
https://raw.githubusercontent.com/maucejo/cnam_templates/main/src/presentation/_slides.typ
typst
MIT License
#import "@preview/touying:0.5.2": * #import "_pres-utils.typ": * #let _typst-builtin-align = align #let slide( title: auto, subtitle: none, align: horizon, config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies, ) = touying-slide-wrapper(self => { if align != auto { self.store.align = align } let align = _typst-builtin-align let header(self) = { set align(top) show: components.cell.with(inset: 1em) set text(size: 1.25em) [*#utils.display-current-heading(level: 1)* #h(1fr) #text(size: 0.8em)[*#utils.display-current-heading(level: 2)*]] } let footer(self) = { place(right, dx: -15pt, dy: -5pt)[#utils.slide-counter.display() / #utils.last-slide-number] } let self = utils.merge-dicts( self, config-page( header: header, footer: footer, ), ) let new-setting = body => { show: align.with(self.store.align) show: setting body } touying-slide(self: self, config: config, repeat: repeat, setting: new-setting, composer: composer, ..bodies) } ) #let title-slide = touying-slide-wrapper(self => { let content = { let title-logo-height = 6.5% let dy = -1.25cm if self.store.composante != "cnam" { title-logo-height= 12% dy = -1.75cm } set image(height: title-logo-height) place(top + right, dx: -1cm, dy: dy, self.store.logo) if self.info.facade == "image" { title-box(self.store.colors.primary, title: text(size: 50pt)[*#self.info.title*], subtitle: text(size: 20pt, weight: "light")[*#self.info.subtitle*], color-title: self.store.colors.text-title) place(center + bottom, dy: 0.5cm, image("../resources/assets/facade-image-theme-" + self.store.color-theme-name + ".png", width: 95%, height: 28%)) } else if self.info.facade == "photo" { title-box(image("../resources/assets/photo-cnam.png", width: 100%, height: 110%, fit: "stretch"), title: text(size: 50pt)[*#self.info.title*], subtitle: text(size: 20pt, weight: "light")[*#self.info.subtitle*], color-title: self.store.colors.text-title) } if self.info.over-title != none { place(top + left, dx: -0.5cm, dy: -1.29cm)[#over-title(self.info.over-title)] } } self = utils.merge-dicts( self, config-common(freeze-slide-counter: true), config-page( margin: (top: 2cm, left: 1.25cm, x: 0em) ) ) touying-slide(self: self, content) } ) #let new-section-slide(level: 1, numbered: true, title) = touying-slide-wrapper( self => { let content = { let title-logo-height = 6.5% let dy = -1.25cm if self.store.composante != "cnam" { title-logo-height= 12% dy = -1.75cm } title-box(self.store.colors.secondary, title: text(size: 45pt)[#title], subtitle: none, color-title: self.store.colors.section-title) if self.info.over-title != none { place(top + left, dx: -0.5cm, dy: -1.29cm)[#over-title(self.info.over-title)] } } self = utils.merge-dicts( self, config-common(freeze-slide-counter: true), config-page( margin: (top: 2cm, left: 1.25cm, x: 0em) ) ) touying-slide(self: self, content) } ) #let focus-slide(body, overtitle: false) = touying-slide-wrapper(self => { let content = { title-box(self.store.colors.secondary, title: body, subtitle: none, color-title: self.store.colors.text-focus) if overtitle { place(top + left, dx: -0.5cm, dy: -1.29cm)[#over-title(self.info.over-title)] } } self = utils.merge-dicts( self, config-common(freeze-slide-counter: true), config-page( margin: (top: 2cm, left: 1.25cm, x: 0em) ) ) touying-slide(self: self, content) } )
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/Reading/Reconstruction/DeepSDF.typ
typst
--- order: 1 --- #import "/src/components/TypstTemplate/lib.typ": * #show: project.with( title: "Reading DeepSDF", lang: "zh", ) #let SDF = math.text("SDF") #let clamp = math.text("clamp") #let Occupancy = math.text("Occupancy") #let NeRF = math.text("NeRF") = SDF(DeepSDF) - DeepSDF: Learning Continuous Signed Distance Functions for Shape Representation - 时间:2019.1 == 引言 - DeepCNN 是基于图像的支柱方法,当直接推广到第三个空间维度时,在空间和时间复杂度上的快速增长,以及表示的不匹配问题,使得 3D 数据处理或产生 3D 推理等任务的质量、灵活性和保真度不高 - 这项工作中提出了一种新的生成 3D 建模表示和方法,该方法高效、富有表现力且完全连续。该方法使用 SDF 的概念,但与将 SDF 离散为规则网格以进行评估和测量去噪的常见表面重建技术不同,我们改为学习一个生成模型来产生这样一个连续的场 - 尽管 SDF 在 CV, CG 领域被熟知,但这篇文章应该是第一个用神经网络来直接拟合的工作,主要贡献在于: + 具有连续隐式曲面的、shape-conditioned 的 3D 模型的建模方法 + 基于概率 auto-decoder 的 3D 形状的学习方法,以及 + 该方法在形状重建和补全方面的演示和应用 - 我们的模型产生了具有复杂拓扑结构的高质量连续表面,并在定量比较中取得了 SOTA。一个例子,我们的模型仅使用 7.4 MB 的内存来表示椅子这一类别,这还不到单个未压缩的 $512^3$ 3D 位图的内存占用的一半(16.8 MB)(但感觉拿未压缩的原图来比也有点耍流氓) == 相关工作 === Representations for 3D Shape Learning - 3D 物体形状的(显式)表示可以分成 $3$ 类:基于点云, mesh 和 voxel 的方法: + Point-based: 点云的表达更接近 raw data,不可否认PointNet 在提特征方面很合适(做分类分割检测的工作比较合适),但在物体形状的表达方面很受限,没有描述 topology,不适合生成完美的表面、 + Mesh-based:可以对 3D 物体建模,但是拓扑结构固定 + Voxel-based:最直接的想法就是使用 dense occupancy grid,但是由于三次的复杂度所以代价高昂,即使有八叉树或者 voxel hash 的方法依旧精度不高, - 所以体素的用法需要进一步的拓展,那就是 SDF(TSDF)了。比如 KinectFusion 作为经典工作,成功将 depth map 融合到了 3D model 中。后续工作都是在离散空间开展的,重建的话一般就是 TSDF 之后做 marching cubes,所以连续域的探索是很新颖的工作 === Representation Learning Techniques - 现代 Representation Learning 技术旨在自动学到描述数据的特征,主要有以下这些方法 + Generative Adversial Networks(GAN): 生成器和判别器对抗学习学到 deep embeddings of target data + Auto-encoders: auto-encoder + decoder,比如 VAE(对比学习那一套里面的)因为 encoder 和 decoder 之间的 bottleneck 的约束,auto-encoder 有望学到原始输入的表示 + Optimizing Latent Vectors: 或者说 decode-only,使用 self-reconstruction loss 训练 === Shape Completion - 经典的表面重建方法通过拟合 RBF 来近似隐式表面函数,或者通过将定向点云的重建问题转换为泊松问题,从而得到密集表面。这些方法仅对单个形状而不是数据集进行建模 - 最近的各种方法使用数据驱动的方法,大多采用 encoder-decoder 架构将 occupancy voxels、离散 SDF voxels、深度图、RGB 图像、点云 简化为 latent vector,然后根据学习到的先验预测完整的体积形状 - (其实都是比较 old-fashioned 的方法,真现代肯定 NeRF, 3DGS 了 == 方法 - key idea 是使用 Deep Neural Networks 直接从点样本中回归连续的 SDF。训练后的网络能够预测给定查询位置的 SDF 值,从中我们可以通过评估空间样本来提取零水平集曲面。可以直观地理解为二元分类器,决策边界是形状表面 - 最简单的想法当然就是为每个形状学习一个网络(没有包含任何 shape 的信息) $f_theta (x) approx SDF(x), ~~~ forall x in Omega$,训练时使用 L1 loss: $ cal(L)(f_theta (x),s) = |clamp(f_theta (x),s) - clamp(s,delta)| ",其中" clamp(x,delta)) := min(delta, max(-delta,x)) (delta = 0.1) $ #fig("/public/assets/Reading/Reconstruction/DeepSDF/2024-10-11-15-19-08.png", width: 60%) - 我们当然希望一个模型可以表示各种各样的形状,发现它们的共同属性并嵌入到低维潜在空间中。为此,我们引入了一个潜在向量 $z$ - codebook 的思想,$z$ 代表对某个 general 形状的描述,每一种形状都有一个对应的 code,用某个 3D location $x$ 去 query 然后得到近似的 SDF 输出 $ f_th (zi, x) approx SDF^i (x) $ #fig("/public/assets/Reading/Reconstruction/DeepSDF/2024-10-11-15-18-45.png", width: 60%) - 那么这个 $z$ 怎么来呢? - 不像 VAE 那样(类似上图左边 encoder + decoder) encoder 是针对单个 shape 的,在 VAE 得到这个 latent code 之后,test 的时候再 VAE 一次,再和 point 一起作为输入进行预测,着实有些累赘。所以考虑去掉 encoder 使用 decoder-only(另外,这个工作在 3D 学习社区首次引入 decoder-only) - 给定一个 $N$ shapes 的数据集,构建训练样本 $X_i = {(bx_j, s_j): s_j = SDF^i (bx_j)}$,每个 $i$ 对应一个 shape,每个 $j$ 对应一个点,于是给定 shape SDF samples $X_i$ 后的 shape code $zi$ 的后验概率为 $ p_th (zi|X_i) = p(zi) p(X_i|zi) / p(X_i) =^? p(zi) product_((x_j,s_j) in X_i) p_th (s_j|zi;bx_j) $ - 当前形状最好的 Latent Vector 应该是使得这个 SDF 值的判断最为正确的 Vector,所以文章的训练方法就是,先随机定义该形状的 Latent Vector(随便给个先验),通过训练反向传播得到更好的 Vector(通过后验不断优化) - 我们假定 $p(zi)$ 为特定均值方差的 multivariate-Gaussian,$p(zi) = 1/(2si sqrt(pi)) exp(- zi^2 / (si^2))$ - 对于 $Pi$ 中的公式,我们用 deep feed-forward network 来拟合 $f_th (zi,bx_j)$,然后不失一般性(?)地表示为 $ p_th (s_j|zi;bx_j) = exp(-cal(L)(f_th (zi, bx_j), s_j)) $ - 于是,在训练时我们把编码向量 $bz$ 和样本位置 $bx_j$ 堆叠在一起,如上图 b 所示,作为神经网络的输入,同时在第 $4$ 层也进行输入(说是再插入到中间一次效果更好)。神经网络梯度反传优化 $th$,同时反传到输入优化 $bz$(更确切地说,把部分输入也当成了 nn.Parameters),这相当于是在做上面那个后验概率的最大化(MAP) $ argmin_(th,{zi}_(i=1)^N) sum_(i=1)^N (sum_(j=1)^K cal(L) (f_th (zi,bx_j),s_j) + 1/si^2 norm(zi)^2) $ #fig("/public/assets/Reading/Reconstruction/DeepSDF/2024-10-11-20-13-28.png", width: 70%) - 然后在 inference 的时候,我们冻结网络 $th$,只优化 $bz$,继续做 MAP $ hat(bz) = argmin_bz sum_((bx_j,bs_j) in X) cal(L)(f_th (zi,bx_j),s_j) + 1/si^2 norm(zi)^2 $ - 我们可以发现模型在推理阶段仍然是会用到 ground truth 和损失,这是什么意思呢? - 我们知道 3D Reconstruction 是对于空间里的点进行更高精度的恢复,3D Completion 是对部分可观测点还原出整个形状,二者都可以采样出一定的 ground truth。那么在推理的时候我们可以只取一小部分点,利用这些点去进行训练,得到 Latent Vector,之后再对全部的点利用刚刚得到的 Latent Vector 进行重建。因为我们之前 decoder 是训练过的(类似于预训练),包含大量的先验知识。所以在这样的 decoder 下,反向传播训练出一个较好的 Latent Vector 是比较快的 - 这与 auto-encoder(或者说 encoder-decoder)框架相比是一个巨大优势,因为 auto-encoder 的 encoder 期望测试输入与训练数据相似(有些过于依赖训练数据的意思),也就是说泛化性没那么强;但我感觉这样的方法也有缺点,因为 encoder-decoder 架构的 Latent Vector 只需要一次 forward 就得到了,而这里 auto-decoder 的方法就要反向传播重训练,应用上稍微复杂一点。也算是一种在 LocalOverfitting 和 Generalisable Learning 之间寻求平衡吧 - (论文这里真的写得很怪且不清晰,其实我觉得把整个模型称作 hypernetwork,然后推理的时候产生真正的 network,这样描述不就清晰多了。可以参考 #link("https://zhuanlan.zhihu.com/p/102904841")[谈谈DeepSDF中AutoDecoder],写得挺深入) == 实验 - 先说一下数据的问题 - 我们需要的数据是$(x, y, z, "sdf value")$,这样的数据集目前没有,但是像 ShapeNet 这样的数据集提供了物体的 3D shape mesh,对每个物体用一个 mesh 表达。 - 把它 normalize 到单位球中(in practice fit to sphere radius of 1/1.03),解决 scale 的问题,半径比 $1$ 稍小一点参考 TSDF 理解 - 数据的预处理是个大头的工作,这里有两个难点 + 必须知道 mesh 的每个三角形的朝向才能判断点在物体内部还是外部,决定 SDF 的 sign + 必须 aggressive 一些,在物体表面附近采点,球内随便产生的点没啥用,学不出来表面。 - 作者的做法描述得很简单,在单位球上均匀假想 $100$ 个相机,每个得到一个 depth map,然后通过一些操作算出符号和距离 - 作者分了 $4$ 个章节来展示,不细看了,反正就是很厉害效果很好云云 - Representing Known 3D Shapes - Representing Test 3D Shapes (auto-encoding) - Shape Completion - Latent Space Shape Interpolation - #link("https://blog.csdn.net/qq_38677322/article/details/110957634")[一篇复现论文的博客] == 结论和评价 - 作者自评 - DeepSDF 在形状表示和完成任务中显著优于适用的 baseline,同时实现了表示复杂拓扑、封闭表面以及提供高质量形状法线的目标。DeepSDF 模型能够在不产生离散化错误的情况下表示更复杂的形状,并且所需的内存显著少于之前最先进的结果 - 然而,尽管形状的 SDF 逐点前向采样是高效的,但在推断过程中需要对潜在向量进行显式优化,所需时间显著增加。我们希望通过用更高效的 Gauss-Newton 或类似方法替代 ADAM 优化来提高性能,这些方法利用了解析导数 - DeepSDF 目前假设模型处于 canonical pose,因此野外完成需要对 SE(3) 变换空间进行显式优化,从而增加了推断时间 - 最后,要在单一嵌入中表示包括动态和纹理在内的真实可能场景空间仍然是一个重大挑战,我们将继续探索这一问题 #q[deepSDF 之后涌现了大量的工作,达摩院的 Curriculum DeepSDF 以及 Berkeley 的 Extending DeepSDF 就是典型代表,还有 Facebook 的 Deep Local Shapes以 及 ETH 的 KAPLAN,这也一定程度能理解为什么 DeepSDF 被评为 CVPR2019 最有影响力的几篇工作之一了] == 论文十问 + 论文试图解决什么问题? - 3D 形状的表示和重建问题 + 这是否是一个新的问题? - 不是新问题,但是 DeepSDF 是第一个用神经网络直接连续地拟合 SDF 的工作 + 这篇文章要验证一个什么科学假设? - 通过神经网络直接拟合 SDF,可以更好地表示 3D 形状 + 有哪些相关研究?如何归类?谁是这一课题在领域内值得关注的研究员? - 3D 形状的表示和重建问题,主要有 Point-based, Mesh-based, Voxel-based 的显式方法,学习的架构上有 GAN, encoder-decoder, decoder-only 等 + 论文中提到的解决方案之关键是什么? - 使用神经网络直接拟合 SDF,通过 decoder-only 的方法学习潜在空间,通过 inference 时再训练的方法得到最优的潜在向量 + 论文中的实验是如何设计的? - 通过 ShapeNet 数据集,对每个物体的 mesh 进行处理,得到 SDF 数据集,然后训练模型,展示效果 + 用于定量评估的数据集是什么?代码有没有开源? - ShapeNet 数据集的处理后版本(需要自己处理);代码开源在 #link("https://github.com/facebookresearch/DeepSDF")[github.com/facebookresearch/DeepSDF] + 论文中的实验及结果有没有很好地支持需要验证的科学假设? - 有的,实验效果还是不错的 + 这篇论文到底有什么贡献? - 提出了一种新的 3D 形状表示方法,用神经网络直接连续地拟合 SDF 的工作,效果不错 + 下一步呢?有什么工作可以继续深入? - 优化推理时间,解决动态和纹理的问题
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/show-bare-04.typ
typst
Other
// Error: 4-19 show is only allowed directly in code and content blocks #((show: body => 2) * body)
https://github.com/Mc-Zen/quill
https://raw.githubusercontent.com/Mc-Zen/quill/main/tests/tequila/ranges-with-two-qubit-gates/test.typ
typst
MIT License
#set page(width: auto, height: auto, margin: 0pt) #import "/src/quill.typ" #import quill: tequila as tq #quill.quantum-circuit( ..tq.build( tq.cx((0, 1), (1, 2)), tq.cx(0, (1,2)), tq.cx((1, 2), 0), ) )
https://github.com/ChristophVanDeest/FH-Kiel-Typst-Template
https://raw.githubusercontent.com/ChristophVanDeest/FH-Kiel-Typst-Template/main/lib/lib.typ
typst
MIT License
#let report( language: "en", title: "", author: "", faculty: "", department: "", include-declaration-of-independent-processing: false, body, ) = { import "template.typ": template template( is-thesis: false, is-master-thesis: false, is-bachelor-thesis: false, is-report: true, language: language, title-de: title, keywords-de: none, abstract-de: none, title-en: title, keywords-en: none, abstract-en: none, author: author, faculty: faculty, department: department, study-course: none, supervisors: (), submission-date: none, include-declaration-of-independent-processing: include-declaration-of-independent-processing, body, ) } #let bachelor-thesis( language: "en", title-de: "", keywords-de: none, abstract-de: none, title-en: none, keywords-en: none, abstract-en: none, author: "", faculty: "", department: "", study-course: "", supervisors: (), submission-date: none, include-declaration-of-independent-processing: true, body, ) = { import "template.typ": template template( is-thesis: true, is-master-thesis: false, is-bachelor-thesis: true, is-report: false, language: language, title-de: title-de, keywords-de: keywords-de, abstract-de: abstract-de, title-en: title-en, keywords-en: keywords-en, abstract-en: abstract-en, author: author, faculty: faculty, department: department, study-course: study-course, supervisors: supervisors, submission-date: submission-date, include-declaration-of-independent-processing: include-declaration-of-independent-processing, body, ) } #let master-thesis( language: "en", title-de: "", keywords-de: none, abstract-de: none, title-en: none, keywords-en: none, abstract-en: none, author: "", faculty: "", department: "", study-course: "", supervisors: (), submission-date: none, include-declaration-of-independent-processing: true, body, ) = { import "template.typ": template template( is-thesis: true, is-master-thesis: true, is-bachelor-thesis: false, is-report: false, language: language, title-de: title-de, keywords-de: keywords-de, abstract-de: abstract-de, title-en: title-en, keywords-en: keywords-en, abstract-en: abstract-en, author: author, faculty: faculty, department: department, study-course: study-course, supervisors: supervisors, submission-date: submission-date, include-declaration-of-independent-processing: include-declaration-of-independent-processing, body, ) }
https://github.com/jamesrswift/ionio-illustrate
https://raw.githubusercontent.com/jamesrswift/ionio-illustrate/main/README.md
markdown
MIT License
<a name="readme-top"></a> # The `ionio-illustrate` package <div align="center"> <a href="https://github.com/jamesxx/ionio-illustrate/blob/master/LICENSE"> <img alt="GitHub" src="https://img.shields.io/github/license/jamesxx/ionio-illustrate"> </a> <a href="https://github.com/typst/packages/tree/main/packages/preview/ionio-illustrate"> <img alt="typst package" src="https://img.shields.io/badge/typst-package-239dad"> </a> <a href="https://github.com/JamesxX/ionio-illustrate/tags"> <img alt="GitHub tag (with filter)" src="https://img.shields.io/github/v/tag/jamesxx/ionio-illustrate"> </a> </div> This package implements a Cetz chart-like object for displying mass spectrometric data in Typst documents. It allows for individually styled mass peaks, callouts, titles, and mass callipers. <br /> <p align="center"> <a href="https://github.com/jamesxx/ionio-illustrate/blob/main/manual.pdf"><strong>Explore the docs »</strong></a> <br /> <br /> <a href="https://github.com/jamesxx/ionio-illustrate/issues">Report Bug</a> · <a href="https://github.com/jamesxx/ionio-illustrate/issues">Request Feature</a> </p> </div> ## Getting Started To make use of the `ionio-illustrate` package, you'll need to add it to your project like shown below. Make sure you are importing a version that supports your end goal. ```typst #import "@preview/ionio-illustrate:0.3.0": * ``` Then, load in your mass spectrum data and pass it through to the package like so. Data should be 2D array, and by default the mass-charge ratio is in the first column, and the relative intensities are in the second column. ```typst #let data = csv("isobutelene_epoxide.csv") #let ms = mass-spectrum(massspec, args: ( size: (12,6), range: (0,100), )) #figure((ms.display)()) ``` ![](gallery/isobulelene_epoxide.typ.png) There are many ways to further enhance your spectrum, please check out the manual to find out how. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- ROADMAP --> ## Roadmap - [x] Pass style options through to the plot (tracker: #1) - [ ] Better placement of text depending on plot size - [ ] Improve default step on axes - [x] Add support for callouts that are not immediately above their assigned peak - [ ] Automatically detect when two annotations are too close, and display accordingly - [ ] Move to new Typst type system (waiting on upstream) - [x] Add in function for displaying skeletal structure of chemical - [ ] Optional second axis for absolute intensity - [x] Add additional display functions - [x] Figure out function signature for multiple data sets - [x] Overlayed and shifted - [x] Horizontal reflection - [x] How to update existing extras? See the [open issues](https://github.com/jamesxx/ionio-illustrate/issues) for a full list of proposed features (and known issues). <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING --> ## Contributing Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! 1. Fork the Project 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the Branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## License Distributed under the MIT License. See <a href="https://github.com/jamesxx/ionio-illustrate/blob/master/LICENSE">`LICENSE`</a> for more information. <p align="right">(<a href="#readme-top">back to top</a>)</p> ## Gallery ![](gallery/linalool.typ.png) ![](gallery/dual-reflection.typ.png) ![](gallery/dual-shifted.typ.png) <p align="right">(<a href="#readme-top">back to top</a>)</p>
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/数学模型/论文/pkuthss-typst/thesis.typ
typst
#import "template.typ": * #import "@local/common-note-template:0.1.0": * #import "@preview/curryst:0.3.0": rule, proof-tree #show: doc => conf( cauthor: "郭子荀", studentid: "2100012990", blindid: "2100012990", cthesisname: "数学模型课程论文", cheader: "数学模型课程论文", ctitle: "类型、范畴与程序语言模型", school: "数学科学学院", cfirstmajor: "某个一级学科", cmajor: "某个专业", emajor: "Some Major", direction: "某个研究方向", csupervisor: "李四 教授", esupervisor: "Prof. <NAME>", date: "二零二四年五月", cabstract: "上个世纪以来,计算机技术快速发展,如何设计更优秀的程序语言的讨论也随之产生,其中一个方向便是使用类型、范畴这些近现代数学中产生的抽象语言构建更具表达力的形式语言。一方面,这为程序分析的理论和实践建立了易于研究又富有表达力的模型;另一方面,尽管这些高阶语言没有在大部分主流的编程语言中得到显式的应用,但其中的许多概念也极大地影响了这些程序语言的设计和改进。同时,许多主流易用的数学形式化系统,包括 Coq, Lean 等,也是基于这样一种抽象语言设计的。本文将以尽量简单清晰的脉络梳理需要涉及的基本概念,进一步简要介绍它如何成为真实的计算机语言以及数学语言的一种抽象模型。由于时间仓促以及作者水平有限,难免有所疏漏,还请批评指正。 ", ckeywords: ("范畴论", "类型论", "程序语言", "形式化数学", "理论计算机"), eabstract: "This document introduces the features of the pkuthss-typst template.", ekeywords: ("Typst", "Template"), acknowledgements: [感谢 Typst 开发者的辛勤付出。 #lorem(300)], linespacing: 1em, outlinedepth: 3, blind: false, listofimage: false, listoftable: false, listofcode: false, alwaysstartodd: false, doc, ) #show: thm-rules #show: ans-rules #show: thm-rules1 #let stlc = [Simply Typed Lambda Calculus] #let martin-lof = [Martin-Löf Type Theory] #let Bool = `Bool` #let Void = `Void` #let boring = `()` #let lam(x, y) = $lambda #x . space #y$ = 前言 <intro> == 介绍 无论是一段程序还是一个数学证明,正确性当然是最低的要求。人工检查往往充满了不可靠性,既然计算机有着强大的计算能力,是否能让计算机来帮助我们验证程序的正确性呢?对于一段纯粹使用形式逻辑符号进行推理的“证明”,设计一个程序验证其正确性或许是可以做到的,然而要求数学家使用形式逻辑符号去书写证明无疑有些荒唐,因此人们需要一种更具有表达力,能够保证正确,还能保证可计算性的语言。 而对于计算机程序,情况还要更为糟糕一些。早已证明在 lambda 演算,或者等价的,图灵机模型中,不可能设计一个程序验证所有程序是否停机 @halting ,遑论其正确性。这意味着我们必须做出一定的取舍,保证一部分的正确性(至少是停机性)而将另一部分交给程序员。 有趣的是,*类型(Type)* 的概念成为了上述两个问题的一种统一的答案。在证明的形式化验证上,Curry-Howard 对应指出,一个命题可以看作是一个类型,而一个证明可以看作是一个程序,如此设计一个形式化验证系统就是在设计一个类型系统。而在程序分析领域,类型是一种几乎被所有主流编程语言采纳的一种进行前文所述的取舍的方式:设计一个仔细定义的类型系统,保证确定一个程序是否符合类型系统的要求(称为*类型检查*)是可计算的,同时认为不符合类型系统的程序均是不合法的。 事实上,类型最早是 Russell 为了解决著名的 Russell 悖论而提出的一种规范数学语言的设想@principia。尽管数学界最终普遍采用了公理集合论体系,但类型这种工具却最终在二十世纪以来的逻辑学、数学以及程序语言领域成为了重要的工具和语言。Church 提出的 #stlc 和 Martin-Löf 提出的 #martin-lof(也叫直觉类型论) 都是这一思想的经典实现,并且在程序语言和形式化数学中有着很大的影响。本文的第一个目标便是介绍其中的基本概念和构造方法,从而为类似 #stlc 这样简单的基本语言提供类型模型。(在 @intro-stlc 中有对 #stlc 的语言模型的简单介绍) 然而,在这些简单的形式语言中,我们讨论的函数仅限于如同数学上的函数一样,不依赖也不改变程序的*上下文(context)*或者说运行时状态。这种函数在程序语言中被称为*纯函数(pure function)*,而熟悉任何一种常见编程语言的读者都知道这在实际编程中几乎是不可能的,哪怕是最简单 C++ 程序: ```cpp std::cout << "Hello, world!" << std::endl; ```其中使用了标准库的 IO 操作,无疑对程序上下文造成了影响。在现实世界的计算机程序中,依赖并改变上下文几乎是不可避免的,否则我们完全没必要运行这个程序(在诸如 Lean 的证明系统中,我们确实没必要运行程序,但在通用编程语言中这是荒唐的),因此看起来这种简单的语言并不足以描述复杂的现实世界程序,所幸,计算机科学家 <NAME> 最早将*单子(Monad)*应用于函数式编程@moggi1989computational,提供了一种非常优美的解决方案。介绍这个巧妙的解决方法便是本文的第二个目标。 单子的概念来自于*范畴论(Category theory)*,其起初的动机产生于于现代代数和代数拓扑等学科,看似是完全的纯数学,但人们发现它和类型论有着巧妙的联系,在理论计算机和程序语言领域得到了有趣的应用。选择本题作为《数学模型》课程论文的动机也是表现即使范畴论这种高度抽象的数学分支,也能为实际的计算机程序提供一种简洁优美的模型,进而启发程序语言的设计,这是十分令人惊喜的。 本文意图基于尽量简单直观的范畴语言,介绍常用的类型论概念和操作,建立一个简单但足够实用,接近于 Haskell #footnote[一种典型的函数式编程语言,可以参考官网介绍:https://www.haskell.org/] 所采用的的类型系统。其中本质内容都是前人的工作,但具体的叙述、表达和证明经过了以力求统一简洁为目标的设计。 == 预备知识 === 范畴 <category> 本文所使用范畴论部分的概念和记号基本来自于 @代数学引论 #definition[范畴][ 一个范畴 $C$ 是以下数据: - 一组对象构成的集合 $Ob$ - 对于每一对对象 $A, B in Ob$,一个集合 $Hom (A, B)$,称为 $A$ 到 $B$ 的态射集 并且满足: - 对于每一个对象 $A in Ob$,存在一个态射 $id_A in Hom (A, A)$,称为 $A$ 的恒等态射 - 对于每一对对象 $A, B, C in Ob$,存在一个映射 $Hom (A, B) times Hom (B, C) -> Hom (A, C)$,称为态射的复合 两个态射的复合记作 $f compose g$ 或者 $f g$,并且满足: - 结合律:对于任意 $f in Hom (A, B), g in Hom (B, C), h in Hom (C, D)$,有 $(f g) h = f (g h)$ - 单位元:对于任意 $f in Hom (A, B)$,有 $f id_A = f = id_B f$ ] 为了描述态射之间的复合关系,常常使用交换图表,例如: #align(center)[#commutative-diagram( node((0, 0), $A$, 1), node((0, 1), $B$, 2), node((1, 0), $C$, 3), node((1, 1), $D$, 4), arr(1, 2, $f$), arr(1, 3, $g$), arr(2, 4, $h$), arr(3, 4, $k$),)] 代表任何两点间殊途同归,也即: $ h f = k g $ 从概念上可以看出,范畴是代数结构的一种统一描述,其中态射是代数结构之间同态的一种推广,而以下概念是单射、满射、同构的推广: #definition[单射、满射、同构][ 设 $f: A -> B$ 是范畴 $C$ 中的态射 - 如果对于任意 $g, h: X -> A$,有 $f g = f h => g = h$,则称 $f$ 是单射 - 如果对于任意 $g, h: B -> X$,有 $g f = h f => g = h$,则称 $f$ 是满射 - 如果存在$g: B -> A$ 使得 $f g = id_B, g f = id_A$,则称 $f$ 是同构 ] #definition[函子][ 设 $A, B$ 是两个范畴,称 $F: A -> B$ 是(共变)函子,如果: - $F$ 给出对象集上的映射 $F: Ob(A) -> Ob(B)$ - 对于所有 $a in Ob(A), b in Ob(B)$,$F$ 给出态射集上的映射 $F: Hom_A (a, b) -> Hom_B (F a, F b)$,并且满足: - $F id = F id$ - $F (f compose g) = (F f) compose (F g)$ 如果 $F$ 给出 $F: Hom_A (a, b) -> Hom_B (F b, F a)$ 上的类似映射,则称 $F$ 为反变函子 ] 通俗来讲,函子就是范畴之间的同态或者态射。 #definition[][ - 称函子 $F$ 是忠实的,如果对于任意的 $X, Y$ 均有映射: $ Hom (X, Y) -> Hom (F X, F Y) $ 是单射 - 称函子 $F$ 是全的,如果上面的映射总是满射 ] #definition[自然变换][ 设 $F, G: A -> B$ 是两个函子,称 $F, G$ 之间的自然变换 $eta$ 是一族态射: $ theta_X in Hom_C (F X, G X), X in Ob(A) $ 使得交换图: #align(center)[#commutative-diagram( node((0, 0), $F X$, 1), node((0, 1), $G X$, 2), node((1, 0), $F Y$, 3), node((1, 1), $G Y$, 4), arr(1, 2, $theta_X$), arr(1, 3, $F f$), arr(2, 4, $G f$), arr(3, 4, $theta_Y$),)] 对于任意 $f in Hom(X, Y)$ 都成立。 ] 自然变换是函子之间的态射,在代数中常常使用的自然或者典范往往就是指这种自然变换。 === 类型与程序语言 与严格的数学不同,计算机科学中许多概念都没有一个公认的,确切的定义,这里只是对用到的其他概念做以简单介绍和辨明,部分参考了 @tapl。 #definition[变量与元变量][ 本文所称变量是程序语言中的一个标识符,可能是自由的或者约束的。而元变量是指叙述概念或者定理时的占位符,不在真实的编程语言中出现。例如我们讨论一个经典的 lambda 函数: $ id_A = lam(x\: A, x) $ 其中 $x$ 是程序语言内部的自由变量,而 $A$ (如果上下文没有指定)是元变量或者说占位符,在实际的程序语言中应当被替换成某个具体的类型。 ] 在具有多态的类型系统,也就是一个表达式可以有多种类型的情况下,编译器在推断类型时使用的类型变量通常也称为元变量,但本文不涉及多态系统,并且假设所有表达式具有明确的(尽管书写时可能为了方便而省略)类型。 #definition[可变与不可变变量][ 对于一个程序语言中的变量,如果其值可以在程序运行时被修改,则称其为*可变变量*,否则称为*不可变变量*。 ] 大部分主流编程语言,包括 C++, Java, Python, Rust 等,都是允许可变变量的,而 Haskell 并不允许。同时,像是 #stlc 这样的简单形式语言往往不允许可变变量,从而避免了对于程序状态等复杂问题的探讨。 #definition[静态与动态][ 在程序语言中,往往将编译时或者说不需要实际运行程序就能确定的性质称为*静态(static)*,而需要运行时才能确定的性质称为*动态(dynamic)*。特别的,如果所有变量或者表达式的类型都是静态的,那么这种类型系统称为*静态类型系统*,反之称为*动态类型系统*。 ] 典型的,C++, Haskell 等语言的类型系统是静态的,而 Python, JavaScript 等语言的类型系统是动态的。静态类型系统往往允许更充分的静态分析达到更好的性能和安全性,而动态类型系统则更加灵活,但也更容易出错。显然在理论上动态类型系统远比静态类型系统更加复杂,因此本文所说类型系统都是静态类型系统。 #definition[类型检查与类型推导][ 在一个静态类型系统中,编译器或者解释器往往需要检查一个表达式是否符合某种类型,这个过程称为*类型检查*。而如果编译器或者解释器能够自动推导出一个表达式的类型,那么这个过程称为*类型推导*。 ] 当然类型推导要比类型检查复杂很多。本文假定*所有的项和表达式具有显式的类型*,不考虑类型推导的问题。 #definition[依赖类型][ 在类型系统中,如果类型的定义依赖于某个值,那么这种类型称为*依赖类型(Dependent type)* ] 既然之前提到了类型的初衷是对值分类,依赖类型看似有些不合直觉。由于依赖类型带来的复杂性,很少有通用的编程语言采取依赖类型系统。然而,基于依赖类型的 #martin-lof 是许多定理证明系统的基础。本文的篇幅不足以仔细介绍依赖类型与 #martin-lof ,可以参考 @martin1982constructive @categorical-logic 需要注明的是,通常来说一个编程语言是由若干条*类型规则、语法规则、求值规则*等等组成的,而本文难以仔细介绍或者列出这些规则,只会在需要的时候简要介绍。 = 基本的概念和构造 == 范畴中的类型 #definition[类型范畴 1][ 给定一个范畴 $C$ 并且满足以下性质: + 有: $ forall A, B in Ob(C), Hom(A, B) in Ob(C) $ 同时,$Hom(A, *): C -> C$ 按照如下定义: - 对于任意 $A: Ob(C)$,定义: $ funcDef(Hom(*, B), Ob(C), Ob(C), A, Hom(A, B)) $ - 对于任意 $f in Hom(A_1, A_2)$,定义: $ funcDef(Hom(*, B), Hom(A_1, A_2), Hom(Hom(A_2, B), Hom(A_1, B)), f, [g : Hom(A_2, B) |-> g compose f]) $ 成为反变函子,而类似的 $Hom(* , B)$ 成为共变函子。 + 范畴中有始对象 #Void 和终对象 #boring,也即对于所有的 $Y in Ob(C)$,均有 $Hom(Void, Y)$ 与 $Hom(Y, boring)$ 恰有一个元素。可以证明若范畴中存在始对象和终对象,则在同构的意义下唯一 @代数学引论 此时,也记 $A -> B := Hom(A, B)$,并称 - 每个 $C$ 中的对象是一个类型 - 每个 $C$ 中的态射是类型之间的函数 ]<type-category> 这个概念将成为本文最基本的模型。注意这里的类型暂时是非依赖类型。同时,这里并没有断言 $Ob(C)$ 中的一个类型 $A$ 是否是一个集合。一方面,可以认为 $A$ 是一个集合,其中的元素就是该类型的值,态射是值之间的(纯)函数;另一方面,如果有必要,可以认为类型只是一个单点,语言中所有的*项(term)*都由态射组成(典型的,Untyped Lambda Calculus 就可以认为构成对象只有单点,$Hom$ 集是所有 $lambda$ 表达式的语言)。 使得这个对应合理的最基本事实是,在(函数式)程序语言中最基本的类型推理法则包括: - $ #proof-tree( rule( $Gamma tack f x : B$, $Gamma tack x: A$, $Gamma tack f: A -> B$, ) ) $<t-app> 上面的式子意为:如果上下文 $Gamma$ 中有 $x$ 具有类型 $A$,$f$ 具有类型 $A -> B$,那么 $f x$ 具有类型 $B$ - $ #proof-tree( rule( $Gamma tack g compose f : A -> C$, $Gamma tack g: B -> C$, $Gamma tack f: A -> B$, ) ) $<t-abs> 上面的式子意为:如果上下文 $Gamma$ 中有 $f$ 具有类型 $A -> B$,$g$ 具有类型 $B -> C$,那么 $g compose f$ 具有类型 $A -> C$ 这两者与@category 中我们对范畴的要求不谋而合。 #remark[][ 这里我们还添加了两个额外要求: + 对于类型 $A, B$,$A -> B$ 的所有函数也是一个类型。这在函数式编程语言中非常普遍,然而,并非所有编程语言都符合这个要求,例如在 C 中就不能直接这样构造类型。不过在满足这个要求的前提下讨论问题会带来很多方便,同时这也不是过强的要求(在 C 中实现这样的类型并不困难)。 + 存在始对象和终对象,它们分别对应没有元素的类型和仅有一个元素的类型。既然假设 $A$ 没有元素,那么 $A -> B$ 的映射当然唯一;假设 $A$ 仅有一个元素,那么 $B -> A$ 的映射当然也唯一。这些类型可以成为后续操作的基础。 ] == #stlc <intro-stlc> 前一节中,我们仅给出了一个非常抽象的类型模型。前言中多次提到的 #stlc 恰好成为符合这个类型模型最典型的实现。仔细讨论 #stlc 的设计或许是有益的,然而这里由于篇幅和文章重点所限难以实现,只能列出一些基本属性,具体的可以参考 @tapl : - 利用类似 $lam(x, y)$ 的语法,我们可以定义最基本的对象,包括自然数: $ 0&: lam(s, (lam(z, z)))\ 1&: lam(s, (lam(z, s z)))\ ... $ 布尔: $ "true"&: lam(t, (lam(f, t)))\ "false"&: lam(t, (lam(f, f))) $ 以及其上的基本运算。这种语言被称为 Untyped Lambda Calculus。 - 在 Untyped Lambda Calculus 上,赋以直观的类型,包括 $NN, Bool$ 以及经典的类型规则 @t-abs 以及 @t-app,我们就得到了基础的 #stlc。 可以证明,Untyped Lambda Calculus 是图灵完备的,具有与任何其他图灵完备语言相同的计算能力。 == 规范化性 #lemma[][ #stlc 具有*规范化性*,也即,所有具有良好类型的程序都停机。 ]<normalization> #proof[ 可以参考 @tapl ] @type-category 给出了非常广泛的定义,可以根据需要选取各种各样的语言。根据 $Ob$ 和 $Hom$ 的丰富程度,我们要在许多因素之间做出取舍: - 我们甚至可以取 $C = "Ab"$ 是所有 Abel 群构成的范畴(注意到 Abel 群之间的同态有自然的的 Abel 群结构),然而这样的范畴中 $Ob$ 过于丰富了,不可能作为一个编程语言的基础。 - 在 Untyped Lambda Calculus 中,$C$ 中只有一个对象(当然不需要进行类型检查),但 $Hom$ 是丰富的,足以达到图灵完备的计算能力。 - 在 #stlc 中,$Ob$ 和 $Hom$ 都相对简单,这让我们可以进行类型检查。同时,所有合法的程序也都是停机的。 - 对于通用的程序语言,前言中的介绍表明,我们往往希望计算能力足够强大的同时,类型系统不要过于复杂,以至于无法进行类型检查,这是大多数编程语言的实际选择。 - 特殊用途的语言,例如定理证明系统,可能希望使用一个规范化的语言,也就是其中所有合法的程序都停机。特别的,用于表达类型的语言往往被希望是规范化的,保证类型检查和推导容易完成。当然,实践上往往也允许舍弃规范化性换取具有更强表达能力的类型系统,例如 Rust 就具有图灵完备的类型系统 @rust-com == 和类型与积类型 前面提到,我们希望类型系统既具备强大的表达能力,又不要过于复杂。一个最典型的解决方法是,选取有限个基本类型和若干类型构造规则,只允许按照这些规则进行构造。本节将介绍和类型、积类型两种典型的类型构造方式,它们与范畴论中常用的积和余积是相同的。 #definition[积/余积][ 设 $A, B in Ob(C)$, + 若对象 $D$ 满足: - 存在态射 $pi_A: D -> A, pi_B: D -> B$ - 以下交换图表: #align(center)[#commutative-diagram( node((0, 0), $M$, 1), node((0, 1), $B$, 2), node((1, 0), $A$, 3), node((1, 1), $D$, 4), arr(1, 2, $f$), arr(1, 3, $g$), arr(4, 2, $pi_A$), arr(4, 3, $pi_B$), arr(1, 4, $exists !f times g$) )] 对于任何 $M, f, g$ 都成立,则称 $D$ 是 $A, B$ 的积,记 $D = A times B$ + 若对象 $D$ 满足: - 存在态射:$i_A : A -> D, i_B: B -> D$ - 以下交换图表: #align(center)[#commutative-diagram( node((0, 0), $M$, 1), node((0, 1), $B$, 2), node((1, 0), $A$, 3), node((1, 1), $D$, 4), arr(2, 1, $f$), arr(3, 1, $g$), arr(2, 4, $pi_A$), arr(3, 4, $pi_B$), arr(4, 1, $exists !f times g$, label-pos: right) )] 对于任何 $M, f, g$ 都成立,则称 $D$ 是 $A, B$ 的余积,记 $D = A + B$ 以上两个交换图表被称为积/余积的泛性质,可以证明 @代数学引论 满足泛性质的积/余积是唯一的。 ]<product-coproduct> #let fst = `first` #let sec = `second` #let inl = `inl` #let inr = `inr` #definition[积类型/和类型][ 在类型范畴 $C$ 中,对于任意两个类型 $A, B$: - 若 $A, B$ 的积存在,则称之为积类型 $(A, B)$ 或者 $A times B$,此时分别将 $pi_A, pi_B$ 记作 $fst, sec$ - 若 $A, B$ 的余积存在,则称之为和类型 $A | B$ 或者 $A + B$,此时分别将 $pi_A, pi_b$ 记作 $inl, inr$ ] 简单来说,积类型就是两个类型的元素组成的二元组,而和类型就是两个类型的元素进行二选一。同时,上面的泛性质可以翻译成下面更加通俗的语言: - 在积类型中,任取符合上面定义的 $f: M -> B, g: M -> A$,可以按照下面的方式构造唯一的函数: $ funcDef(h, M, A times B, m, (f m, g m)) $ 且与 $fst, sec$ 交换\ 反之,如果我们要构造 $M -> (A, B)$ 的函数,唯一的方式便是分别构造 $M -> A$ 和 $M -> B$ 的函数,也就是指定每个分量。 - 在和类型中,任取符合上面定义的 $f: B -> M, g: A -> M$,可以按照下面的方式构造唯一的函数: $ h (inl a) &= g a\ h (inr b) &= f b $ 且与 $inl, inr$ 交换\ (这种语法也被称为*模式匹配(pattern match)*,已经在许多编程语言中得到实现)\ 反之,若要构造 $A + B -> M$ 的函数,唯一的方式便是指定 $A -> M$ 和 $B -> M$ 的函数,也就是指定每个分支。 #definition[有限积/余积][ 定义三元积: $ A times B times C := A times (B times C) $ 三元余积: $ A + B + C := A + (B + C) $ 类似的,可以递归定义任何有限积/余积,并且与结合顺序无关(证明略)。 ] 在 @type-category 中,我们给出了所讨论语言的基本要求。当然,这样的语言未必具有和类型或者积类型。要想实现这两种构造,简单来说需要添加类型规则以及相应的语法规则,求值规则。这些规则的设计和实现是编程语言设计中的重要问题,这里不再详细讨论,只假定之后讨论的语言具有这些语法和规则(典型的,具有积/和拓展的 #stlc 以及 Haskell 语言)。有趣的是,关于积类型有如下的结论: #theorem[][ 设 $C$ 是如 @type-category 定义的类型范畴,则存在类型范畴 $C'$,使得其中对象是 $C$ 中对象或者 $C$ 中对象经过若干次积、 $Hom$ 构造得到,其中态射被 $C$ 中态射确定,且它对 $Hom$、积运算封闭。这样的范畴称为 $C$ 产生的*自由笛卡尔闭范畴*。 ]<free-CCC> #proof[ 我们可以非常显式的写出目标范畴 $C'$ 的定义。其对象集 $O$ 是由以下类型构造规则递归定义的集合: - $t in Ob(C) => t in O$ - $A, B in O => A times B in O$ //- $A, B in O => A + B in O$ - $A, B in O => Hom(A, B) in O$ 同时,类似的给出态射集的递归定义: - $t_1, t_2 in Ob(c) => Hom_C' (t_1, t_2) := Hom_C (t_1, t_2)$ - $ A, B in O => Hom(A times B, M) &:= Hom(A, Hom(B, M)) in O\ Hom(N, A times B) &:= Hom(N, A) times Hom(N, B) in O $ 我们说明,以上规则是合法的且足以定义 $C'$: - 首先,需要验证两条规则是一致的,也即: $ Hom(A, Hom(B, C times D)) = Hom(A times B, C times D) = Hom (A times B, C) times Hom (A times B, D) $ 上式右端等于: $ Hom(A, Hom(B, C)) times Hom(A, Hom(B, D)) $ 左端等于: $ Hom(A, Hom(B, C) times Hom (B, D)) $ 两者确实是相等的 - 其次,验证上面两条 $Hom$ 规则是可终止的。为此,设 $A$ 是某个定义好的对象,注意到它是前面几条规则的有限次构造,可设其中使用了 $l(A)$ 次乘法规则,显然 $l(A) = 0 => l in Ob(C)$\ 我们用归纳法,假设所有 $l <= n$ 的对象以及 $l < n$ 的对象之间的态射已被定义,考虑规则: $ Hom(A times B, M) = Hom(A, Hom(B, M)) $ 上式右侧的 $l$ 较左侧减一,因此已被定义 $ Hom(N, A times B) = Hom(N, A) times Hom(N, B) $ 已经假设 $l(Hom(N, A times B)) = n$,则不难发现 $l(Hom(N, A) times Hom(N, B)) = n$ 且是对象,因此已被定义,从而 $Hom(N, A) times Hom(N, B)$ 一定也已经定义 - 我们还要说明若 $max(l(M), l(N)) = n$,则 $Hom(M, N)$ 也已经确定。先考虑 $M$: - 假设 $M = U times V$,则已经定义 - 否则,注意到 $M$ 的构造事实上是树形结构,可以找到深度最低的一个使用乘规则定义的节点,考虑其上层: - 若为 $Hom(U times V, W)$ 则按定义有自然同构: $ Hom(U times V, W) tilde.eq Hom(U, Hom(V, W)) $这使得 $M$ 同构于 $M'$ ,其中 $l(M') < l(M)$ - 若为 $Hom(W, U times V)$,则有自然同构: $ Hom(W, U) times Hom(W, V) tilde.eq Hom(W, U times V) $ 导致 $times$ 的深度进一步降低 不断进行上面的步骤,要么最终 $M = U times V$ 从而定义已经完成,要么 $l(M)$ 可以降低 当然 $N$ 也可以做类似操作,因此要么由归纳假设要么由之前的规则 $Hom(M, N)$ 一定已经定义 - 最后,$Hom$ 之间的复合映射也可以类似的显式给出,这里不再赘述 // - // $ // A, B in O => Hom(A + B, M) = Hom(A, M) times Hom(B, M)\ Hom(N, A + B) = Hom(N, A) + Hom(N, B) // $ ]<consturct-CCC> #corollary[][ 若 $C$ 对应的语言具有规范化性,则其自由笛卡尔闭范畴 $C'$ 也具有规范化性。 ]<free-CCC-normal> #proof[ 注意到 $C'$ 中的态射都是 $C$ 中态射进行有限次组合得到的,结论是显然的。 ] @free-CCC 表明,之前提到的积类型具有由证明过程给出的典范构造。换言之,它并不会实际提升语言的表达能力,其中的关键是证明过程中出现的: $ Hom(A times B, M) tilde.eq Hom(A, Hom(B, M)) $ 这被称为 *Curry化*,它的存在允许在函数式语言中使用 $Hom(A, Hom(B, M))$ 表示二元函数而不是数学中更常用的 $Hom(A times B, M)$ 与积类型的情形不同,和类型只有典范同构: $ Hom(A + B, N) tilde.eq Hom(A, N) times Hom(B, N) $ 但 $Hom(M, A + B)$ 无法简单的确定,这也表明和类型的添加确实可能提升语言的表达能力,例如下面的 Haskell 函数: ```haskell func : Bool -> A + B func True = inl a func False = inr b ``` 在 #stlc 中就是不可能的,既然其中不允许将两种不同的类型组成同一个表达式。 #definition[类型系统 2][ 后文所称的类型系统是指范畴 $C$ ,满足要求: - 满足 @type-category 条件 - 对有限积和有限余积封闭 ]<type-category2> #let Fin = `Fin` #let Maybe = `Maybe` #let Just = `Just` #let Nothing = `Nothing` #example[][ 有了积类型以及和类型,我们可以构造出许多常用的类型和类型构造子: - 记 $Fin_n = n dot () = () + () + ... + ()$ 是 $n$ 元有限类型。 - 记 `Maybe A := A + ()`,此时通常称 $Just := inl, Nothing := inr$,换言之 `Maybe A` 的对象是以下两种情况之一: - $Just a$ - `Nothing` 它的作用在于处理一些有可能出错的函数。注意到之前我们假设态射 $A -> B$ 应该恰好对于 $A$ 的对象得到 $B$ 的对象,然而实践上并不容易保证。例如,假设我们要处理函数 $ln x: ? -> RR$,将会面临以下窘境: - 认为 $ln x: RR -> RR$,这是断然不行的,既然对于 $<=0$ 的实数 $ln$ 都无法定义 - 认为 $ln x: RR^+ -> RR$,看似可行,然而稍加分析就会发现按照类似的逻辑我们需要认为: $ ln(x-a) :RR^(>= a) -> RR $ 导致我们被迫使用依赖类型,这是十分麻烦的。 因此,一个有些逃避但有效的方法是认为 $ln x : RR -> Maybe RR$,将定义域不全带来的麻烦推迟到 $ln$ 函数的类型之外解决。我们不能希望类型解决一切问题,但 `Maybe` 的使用明确的告诉了我们这里有类型不能解决的问题,这是十分有益的。 ] == 积/和的函子性<functor> @type-category2 保证我们在 $C$ 中可以做任意有限和以及有限积。在上节的讨论中我们发现,积/和不仅作用于对象,在态射上同样也有作用,这就是下面要给出的函子性: #theorem[][ 设 $C$ 是满足 @type-category2 的类型范畴,则 $forall A in Ob(C)$,以下: $ (*, A) &:= B |-> (B, A)\ (A, *) &:= B |-> (A, B)\ * + A &:= B |-> A + B\ A + * &:= B |-> B + A $ 都是 $C -> C$ 的函子。 ]<functor-product> #proof[ 就是 @product-coproduct 的简单推论 ] 函子的概念看似只是抽象废话,但它确实能在许多场景发挥作用,例如假设我们有函数: ```haskell f:: A -> B f a = ... ``` 它的功能是做某种计算。之后由于上游发生变化或者其他考虑,我们希望它能处理 `Maybe A` 的参数,也即输入 `Nothing` 时输出 `Nothing`,按照通常的 Haskell 模式匹配语法需要写成: ```haskell f' :: Maybe A -> Maybe B f (Just a) = Just (f a) f Nothing = Nothing ``` 然而,假如对函子的概念十分熟练,不难验证上面的 `f'` 恰好就是 `Maybe f`(注意到 @functor-product 表明 `Maybe` 确实是函子),这可以为我们带来方便。 更有趣的是,用函子处理不仅能带来书写上的便利,还可以为编译器提供高层的优化可能。例如假设我们有函数 `f, g` ,它们有时独立使用,有时复合使用。在 C++ 语言中类似: ```CPP B f(A a) {...} C g(B b) {...} D h(A a) {return g(f(a));} ``` 现在要全部改成 #Maybe 版本(C++ 中不使用 #Maybe 而是 `std::optional`,逻辑是类似的,为了统一我们仍写成 #Maybe): ```CPP Maybe<B> f1(Maybe<A> a) {if (a.isNothing()) return Nothing; return f(a.value());} Maybe<C> g1(Maybe<B> b) {if (b.isNothing()) return Nothing; return g(b.value());} Maybe<D> h1(Maybe<A> a) {return g1(f1(a));} ``` 看起来十分自然,然而仔细分析就会发现这里多做了一次无用的检查,既然 `f1` 对于有效值应该返回有效值。解决这一问题的方法是: - 寄希望于编译器进行分析,然而这在 `f, g` 非常复杂时是极为困难的,编译器很难确定其中的值是否会变成 `Nothing` - 手动实现 `h1`,调用原始的 `f, g` ,这意味着 `f, g` 两个函数要必须要同时向外提供带检查和不带检查两个版本,实际工作中也会有些麻烦。当然在 C++ 中确实可以通过精巧的模板和重载解决这个问题,但重载本身又会引入新的工程问题。 在函数式语言中,我们会写成: ```haskell f1 = Maybe f g1 = Maybe g h = f1 . g1 ``` (Haskell 中使用 `fmap` 语法而非直接将单子作用于函数,但是实质是一样的,为了理解方便暂且如此书写)\ 看似在 `f1 compose g1` 仍会出现两次检查,然而将表达式拆开,它恰好是 `(Maybe f) compose (Maybe g)`,由函子的定义,它一定等于 `Maybe (f compose g)`,后者只做一次检查。一般而言,使用这样的函子律进行表达式替换总是能提升程序的性能,而正确性由函子的定义保证,与 `f, g` 的实现有多么复杂无关,编译器进行这个优化远比 C++ 情形容易得多,因此已经在函数式编程领域得到应用@ghc-rewrite 事实上,这样的优化能够进行,归根到底是范畴论的抽象为编程语言提供了兼具易用性和简单性(编译器能够简单地确定一些性质进行优化)的模型,下一章单子部分也会进一步展示这一点。 = 副作用与单子 关于本章内容的深入讨论,可以参考 @moggi1989abstract == 副作用<side-effect> 前面的讨论中,我们总是认为程序中的函数就是如同数学上的函数一样是一个固定的一一对应。然而在大多数(过程式)语言中,函数更像是一个不完全封闭的代码块,以下的 C++ 代码: ```CPP int a = 0; void fun(int input) { a++; return input + a; } ``` 描述的事情是非常常见的。这里的 `++` 就是一个带有副作用的函数,它的执行让外部环境(`a` 的值)发生了改变。这种行为用纯函数式的语法并非不能模拟,考虑: ```haskell EnvWithLocalVarA T = (T, Int) aplus :: EnvWithLocalVarA T -> EnvWithLocalVarA T aplus (t, cur_a) = (t, cur_a + 1) fun :: EnvWithLocalVarA Int -> Int fun input = (fst (aplus input)) + (sec (aplus input)) ``` 这个想法,简单来说,就是将带有环境的值认为是从值构造出的新类型。这个想法在之前 #Maybe 之中也有体现。然而,上面的语法不免过于复杂,是否存在简化空间呢?以 #Maybe 为例,考虑定义这样一个函数: $ f(x) = 1/(x - 1/y) $ 并希望不合法的值都返回 #Nothing,我们把它拆成两个函数的复合: ```haskell f1 :: Double -> Double -> Maybe Double f1 x y = if y == 0 then Nothing else x - 1 / y f2 :: Double -> Maybe Double f2 x = if x == 0 then Nothing else 1 / x ``` 大致来说,`f = f2 . f1`,然而观察类型,我们没有说明如何把 `Maybe Double` 的值输入 `f2` 中,有两种想法: - 方法一:手动书写: ```haskell f :: Double -> Double -> Maybe Double f x y = case f1 x y of Nothing -> Nothing Just a -> f2 a ``` - 方法二:@functor 中提到,`Maybe` 是一个函子,而 `Maybe f` 恰好接收 `Maybe Double` 类型的参数,因此可以: ```hs f' :: Double -> Double -> Maybe (Maybe Double) f' = (Maybe f2) . f1 helpf :: Maybe (Maybe Double) -> Maybe Double helpf Nothing = Nothing helpf (Just Nothing) = Nothing helpf (Just (Just a)) = Just a ```<way-2> 尽管都十分麻烦,但仔细思考就会发现,方案二中的 `helpf` 函数似乎是有一般性的,它将嵌套的 `Maybe` 函子降低一层。这也符合我们的设想,既然我们希望 `T a` 代表 "带有副作用的 `a` 类型",那么 `T T a` 似乎是 "带有副作用的带有副作用的 `a` 类型",似乎本来就应该典范的同态到 `T a` 。@category 中提到,所谓的典范同态在范畴论中就是函子间的自然变换,此处似乎就是 `T T` 与 `T` 之间存在一个自然变换。 == 单子 #let returnF = `return` #let join = `join` #let small(body) = text(size: 9pt)[#body] #definition[单子][ 类型范畴 $C$ 上的一个单子是指: - 一个自函子 $F: C -> C$ - 一个自然变换 $returnF : id -> C$ - 一个自然变换 $join: F^2 -> F$ 满足: - #returnF 是单位元,也即对于 $forall a in Ob(C)$ 有交换图: #align(center)[#commutative-diagram( node((0, 0), $F^2 a$, 1), node((0, 1), $F a$, 2), node((1, 0), $F a$, 3), node((0, -1), $F a$, 4), arr(2, 1, $small(returnF : F a -> F^2 a)$, label-pos: right), arr(4, 1, $small(F (returnF: a -> F a))$), arr(4, 3, $id$), arr(2, 3, $id$), arr(1, 3, $join$), )] - 结合律,也即对于 $forall a in Ob(C)$ 有交换图: #align(center)[#commutative-diagram( node((0, 0), $F F F a$, 1), node((0, 1), $F F a$, 2), node((1, 0), $F F a$, 3), node((1, 1), $F a$, 4), arr(1, 2, $small(F (join : F F a -> F a))$), arr(1, 3, $small((join : F F (F a)-> F (F a)) )$, label-pos: right), arr(2, 4, $join$), arr(3, 4, $join$),)] ]<Monad-def-join> 这里,#returnF 是将无副作用的值包装起来,#join 则是如上节所述,将函子作用后的二次副作用简化。结合律则是说,对于三次甚至以上副作用,可以按照任何顺序利用 #join 进行简化。这也是符合直觉的,毕竟正如上节所述,带有两层副作用的值和带有多层副作用的值都应该典范的同态于带有一层副作用的值。 #remark[][ 需要注意的是,如果要在编程语言中实现“自然变换”,我们要实现一种多态函数,例如: ```hs joinMaybe :: Maybe(Maybe a) -> Maybe a joinMaybe Nothing = Nothing joinMaybe (Just Nothing) = Nothing joinMaybe (Just (Just x)) = Just x ``` 也就是希望这个定义对所有类型 `a` 起作用。多态的实现也是类型系统中非常重要的课题,@tapl @categorical-logic @moggi1989abstract 中都有相关讨论。这里我们暂且略过这部分讨论,假设我们已经实现了符合直觉的多态系统。 ]<maybe-join> #theorem[][ #Maybe 是单子,其中: - #returnF 定为: ```hs returnF :: a -> Maybe a returnF x = Just x ``` - #join 如 @maybe-join 中定义 ] #proof[ 仔细验证 @Monad-def-join 中所有性质: #let Justx = `Just x` - #returnF 是自然变换: #align(center)[#commutative-diagram( node((0, 0), $a: A$, 1), node((0, 1), $b: B$, 2), node((1, 0), $Just a: Maybe A$, 3), node((1, 1), $Just b: Maybe B$, 4), arr(1, 2, $f$), arr(1, 3, $returnF$), arr(2, 4, $returnF$), arr(3, 4, $Maybe f$),)] - #join 是自然变换: #align(center)[#commutative-diagram( node((0, 0), $Just^2 a: Maybe^2 A$, 1), node((0, 1), $Just^2 b: Maybe^2 B$, 2), node((1, 0), $Just a: Maybe A$, 3), node((1, 1), $Just b: Maybe B$, 4), arr(1, 2, $F^2 f$), arr(1, 3, $join$), arr(2, 4, $join$), arr(3, 4, $F f$),)] - 先讨论单位元,既然 $Maybe$ 无非 `Nothing, Just x` 两种,分别代入定义: #align(center)[#commutative-diagram( node((0, 0), $Just Nothing$, 1), node((0, 1), $Nothing$, 2), node((1, 0), $Nothing$, 3), node((0, -1), $Nothing$, 4), arr(2, 1, $small(returnF : F a -> F^2 a)$, label-pos: right), arr(4, 1, $small(F (returnF: a -> F a))$), arr(4, 3, $id$), arr(2, 3, $id$), arr(1, 3, $join$), )] #align(center)[#commutative-diagram( node((0, 0), $Just (Justx)$, 1), node((0, 1), $Justx$, 2), node((1, 0), $Justx$, 3), node((0, -1), $Justx$, 4), arr(2, 1, $small(returnF : F a -> F^2 a)$, label-pos: right), arr(4, 1, $small(F (returnF: a -> F a))$), arr(4, 3, $id$), arr(2, 3, $id$), arr(1, 3, $join$), )] - 再讨论结合性,需要考虑 $Maybe^3$ 的四种情形: $ Nothing, Just (Nothing), Just( Just (Nothing)), Just (Just (Justx)) $ 分别画出图表: #align(center)[#commutative-diagram( node((0, 0), $Nothing$, 1), node((0, 1), $Nothing$, 2), node((1, 0), $Nothing$, 3), node((1, 1), $Nothing$, 4), arr(1, 2, $small(F (join : F F a -> F a))$), arr(1, 3, $small((join : F F (F a)-> F (F a)) )$, label-pos: right), arr(2, 4, $join$), arr(3, 4, $join$),)] #align(center)[#commutative-diagram( node((0, 0), $Just (Nothing)$, 1), node((0, 1), $Just (Nothing)$, 2), node((1, 0), $Nothing$, 3), node((1, 1), $Nothing$, 4), arr(1, 2, $small(F (join : F F a -> F a))$), arr(1, 3, $small((join : F F (F a)-> F (F a)) )$, label-pos: right), arr(2, 4, $join$), arr(3, 4, $join$),)] #align(center)[#commutative-diagram( node((0, 0), $Just( Just (Nothing))$, 1), node((0, 1), $Just (Nothing)$, 2), node((1, 0), $Just (Nothing)$, 3), node((1, 1), $Nothing$, 4), arr(1, 2, $small(F (join : F F a -> F a))$), arr(1, 3, $small((join : F F (F a)-> F (F a)) )$, label-pos: right), arr(2, 4, $join$), arr(3, 4, $join$),)] #align(center)[#commutative-diagram( node((0, 0), $Just( Just (Justx))$, 1), node((0, 1), $Just (Justx)$, 2), node((1, 0), $Just (Justx)$, 3), node((1, 1), $Justx$, 4), arr(1, 2, $small(F (join : F F a -> F a))$), arr(1, 3, $small((join : F F (F a)-> F (F a)) )$, label-pos: right), arr(2, 4, $join$), arr(3, 4, $join$),)] 尽管有些繁琐,不过这些过程应当能更加充分地体现单子定义中两条规则的含义。 ] == bind 与 do-notation #let bind = `bind` 有了单子的定义,我们可以定义一个新的操作,它将一个带有副作用的函数应用到一个带有副作用的值上,这个操作被称为 `bind`,它的定义如下: #let xc = `x` #let idc = `id` #let Fc = `F` #let fc = `f` #let gc = `g` #let ac = `a` #definition[bind][ 对于单子 $F$,定义 `bind` 操作: ```hs bind :: (a -> F b) -> F a -> F b bind f x = join ((F f) x) ``` 等价的: $ bind fc = join compose (Fc fc) $ 这里 `F f : F a -> F F b, (F f) x : F F b`\ 一般的,记: ```hs x >>= f = bind f x ``` ]<bind-def> 仔细观察就会发现这就是 @side-effect 结尾的方法一的推广。 #lemma[][ #bind 函数满足: - 右单位: ```hs x >>= return = x ``` 等价的: $ bind returnF = idc $ - 左单位: ```hs return a >>= f = f a return f >>= (\x -> (\y -> return (x y))) = \y -> return (f y) ``` 等价的: $ (bind fc) compose returnF = fc $ - 结合律: ```hs (x >>= f) >>= g = x >>= (\a -> f a >>= g) ``` 等价的: $ bind ((bind gc) compose fc) = (bind gc) compose (bind fc) $ ]<bind-property> #proof[ - $ bind returnF = join compose (Fc returnF ) = idc $ 这来自 $returnF$ 的单位元性 - $ (bind fc) compose returnF = join compose (Fc fc) compose returnF $ 由 #returnF 是自然变换: #align(center)[#commutative-diagram( node((0, 0), $A$, 1), node((0, 1), $B$, 2), node((1, 0), $F A$, 3), node((1, 1), $F B$, 4), arr(1, 2, $f$), arr(1, 3, $returnF $), arr(2, 4, $returnF$), arr(3, 4, $F f$),)] 上式化简到: $ join compose returnF compose fc $ 由单位元性,上式就是 $fc$ - $ bind [ac |-> bind gc (fc ac)] &= join compose (Fc [ac |-> bind gc (fc ac)])\ &= join compose (Fc ((join compose Fc gc) compose fc))\ &= join compose (Fc (join compose Fc gc) compose (Fc fc))\ &= join compose Fc join compose Fc^2 gc compose (Fc fc) "(函子性)"\ &= join compose join compose Fc^2 gc compose (Fc fc)\ $ 这里 #join 是自然变换给出: #align(center)[#commutative-diagram( node((0, 0), $F A$, 1), node((0, 1), $F B$, 2), node((1, 0), $F^2 A$, 3), node((1, 1), $F^2 B$, 4), arr(1, 2, $F g$), arr(3, 1, $join$), arr(4, 2, $join$), arr(3, 4, $F^2 g$),)] 上式等于: $ &join compose Fc gc compose join compose (Fc fc)\ &= (join compose Fc gc) compose (join compose Fc fc)\ &= (bind gc) compose (bind fc) $ 证毕 ] #let idc = `id` #theorem[][ 假设函子 $F$ 具有: - 多态函数 `return: a -> F a`,满足: - $(returnF fc)(returnF ac) = returnF (fc ac)$,也即 $returnF$ 是自然变换 - 如 @bind-def 中定义的多态函数 #bind 函数,并且满足 @bind-property 中的性质 - 兼容性:$bind (returnF compose fc) = Fc fc $ ,则 $F$ 是一个单子,并有: $ join = bind (idc : Fc ac -> Fc ac) $ ] #proof[ 依次证明: - #join 是自然变换: #align(center)[#commutative-diagram( node((0, 0), $F^2 A$, 1), node((0, 1), $F^2 B$, 2), node((1, 0), $F A$, 3), node((1, 1), $F B$, 4), arr(1, 2, $F^2 f$), arr(1, 3, $bind idc$), arr(2, 4, $bind idc$), arr(3, 4, $F f$),)] 也即: $ Fc fc compose (bind idc) = (bind idc) compose Fc^2 fc $ 由兼容性: $ Fc fc compose (bind idc) &= (bind (returnF compose fc)) compose (bind idc) \ &= bind (bind (returnF compose fc) compose idc)\ &= bind (bind (returnF compose fc)) $ $ (bind idc) compose Fc^2 fc &= (bind idc) compose bind (returnF compose Fc fc)\ &= bind ((bind idc )compose (returnF compose Fc fc))\ &= bind ((bind idc )compose (returnF compose bind (returnF compose fc)))\ &= bind (((bind idc )compose returnF) compose bind (returnF compose fc))\ &= bind (idc compose bind (returnF compose fc))\ &= bind (bind (returnF compose fc))\ $ - 单位性1 :$join compose returnF = idc$ $ join compose returnF = (bind idc) compose returnF = idc $ - 单位性2:$join compose (F returnF) = idc$ $ join compose (F returnF) &= (bind idc) compose (bind (returnF compose returnF))\ &= bind (bind idc compose (returnF compose returnF) )\ &= bind ((bind idc compose returnF) compose returnF )\ &= bind ((idc) compose returnF )\ &= bind (returnF )\ &= idc\ $ - 结合性:$join compose Fc join = join compose join$ $ join compose Fc join &= (bind idc) compose bind (returnF compose (bind idc))\ &= bind ((bind idc) compose (returnF compose (bind idc)))\ &= bind ((bind idc compose returnF) compose (bind idc))\ &= bind (idc compose (bind idc))\ &= bind idc compose bind idc\ &= join compose join\ $ 证毕 ] #remark[][ 这种直白的定义方式可以抽象成所谓的*Kleisli 三元对*,这里不再介绍,可以参考 @moggi1989abstract ] 有了这些方便的函数,我们可以定义一种新的*语法糖*,它将一系列的 `bind` 函数调用简化为一种更加直观的形式,这就是 `do` 语法: #definition[do-notation][ 对于单子 $F$,定义 `do` 语法: ```hs do {ac <- x; fc; gc; ...} = x >>= (\ac -> fc >>= (\_ -> gc >>= (\_ -> ...))) ``` ] 这种语法可以大幅度简化 #bind 的书写,例如: ```hs f :: Int -> Maybe Int g :: Int -> Maybe Int h :: Int -> Maybe Int fgh :: Int -> Maybe Int fgh x = do a <- f x b <- g a c <- h b return c ``` == State 与 IO #let State = `State` 最后,我们终于可以用单子的概念解决前言中提出的问题。首先是 #State 单子,它的定义如下: #definition[State][ 对于一个类型 $S$,定义 $State S a$ 为一个带有状态的函数,它的输入是一个状态 $S$,输出是一个值 $a$ 以及一个新的状态 $S$。它的定义如下: ```hs State s a = State {runState :: s -> (a, s)} ``` 对于给定的状态类型 $s$,它是一个单子,其中: - #returnF 定为: ```hs returnF :: a -> State s a returnF x = State (\s -> (x, s)) ``` - #join 定为: ```hs join :: State s (State s a) -> State s a join (State f) = State (\s -> let (State g, s') = f s in g s') ``` 证明略。可以定义以下符合字面意思的函数: ```hs get :: State s s put :: s -> State s () evalState :: State s a -> s -> a ``` 具体定义及细节可以参考 @haskell-intro ] #example[][ 以下 C++ 代码: ```cpp int fun(int x) { int a = x + 1; int b = x + 2; a++; b++; return a * b; } ``` 可以使用 `State (int, int)` 翻译为: ```hs geta = fst.get getb = snd.get puta newa = do (_, b) <- get put (newa, b) putb newb = do (a, _) <- get put (a, newb) fun :: int -> int fun x = runState (do put (x + 1, x + 2) puta (geta + 1) putb (getb + 1) return (geta * getb) ) (0, 0) ``` ] 这看似颇为繁琐,但令人惊喜的是,我们在本章实质上只添加了语法糖,没有改变语言本身的性质。例如,注意到上面的代码完全可以看作是只具有积类型拓展的 #stlc 中的程序,由 @normalization 结合 @free-CCC-normal 可以知道上面的程序一定是停机的,与其等价的 C++ 程序也确实停机。尽管这是非常显然的事实,但如果我们选取更加复杂的具有规范化性的语言(例如包含某种结构化递归),我们或许能得到相当范围内的 C++ 程序是停机的。 这种转化,化归思想在程序语言相关的研究之中非常常见,而范畴论的观点提供了单子这样一种强大的转化工具。 在前言中,我们提到 IO 是带有副作用的操作,这是无法逃避的事实,而单子提供了这样一种工具:它尽可能的将带有副作用的操作统一成纯函数,仅在最后交予上层实际执行。例如,在以下程序中 : ```hs main :: IO () main = do putStrLn "Hello, world!" input <- getLine putStrLn input ``` `IO` 是语言预先提供的单子,上面的程序看似是依次执行三个函数(效果也确实如此),实则是将两个打印函数使用之前定义的 #bind, #returnF 等函数将三个函数组合在一起,分别具有类型: ```hs putStrLn :: String -> IO () getLine :: IO String ``` 范畴强大的表达能力让我们能够实现将复杂的副作用尽可能压缩、统一、组合,得到非常优美的结果,这也是这种模型的成功之处。 = 结语与展望 本篇文章从基础的类型范畴,逐渐引入基础的类型构造方式,再到最后单子的精彩应用,体现了范畴论观点与程序语言的紧密联系,并以规范化性为例展示了以范畴作为模型在实际研究之中的有效之处。当然,这种模型的威力不止于此,例如在 @functor 中所提到的特殊优化方法,同样可以进一步应用于单子律,同样的,从根本上得益于类型与范畴提供的简单清晰的抽象模型。 然而,本文所设计的模型只是非常简单而初步的模型,与实际有效应用的模型仍然相去甚远。同时,对于在形式化数学领域非常基础的依赖类型与 #martin-lof,虽然大体思想类似,但很多具体的视角需要修改(例如不再能认为类型是范畴中的对象,典型的处理是看作某个态射上的纤维)。更加深入,复杂的类型系统需要更加复杂的范畴论工具,这些都是作者未来需要学习的方向。 #pagebreak() #bibliography("ref.bib", style: "ieee" )
https://github.com/gerome-andry/typst-CV
https://raw.githubusercontent.com/gerome-andry/typst-CV/main/cv.typ
typst
#set text(size: 12pt, font: "PT Sans") #set page(paper: "a4") #let email = symbol("") #let scholar = symbol("") #let site = symbol("") #let git = symbol("") #text(30pt)[ *<NAME>* ] #grid( columns: (1fr, 1fr), align(left)[ Montefiore Institute\ University of Liège\ Allée de la Découverte, 10\ Liège, Belgium (BE) ], align(left)[ #email #text(blue, link("mailto:<EMAIL>"))\ #site #text(blue, link("https://gerome-andry.github.io/")[gerome-andry.github.io])\ #git #text(blue, link("https://github.com/gerome-andry")[github])\ #scholar #text(blue, link("https://scholar.google.com/citations?user=YZxxzigAAAAJ&hl=fr")[google-scholar]) ] ) = Summary I’m a PhD student at University of Liège working on the use of deep learning for Sciences. I mainly work with generative/probabilistic methods to address model misspecification in Simulation-based Inference. = Education #grid( columns: (1fr, 4fr), [ 2023 - present ], [ === PhD in Deep Learning for Sciences \@Uliège F.R.S.-FNRS Research Fellow\ Under the supervision of #link("https://glouppe.github.io/")[<NAME>] \ _Working title: Overcoming model misspecification with deep learning_ ] ) \ #grid( columns: (1fr, 4fr), [ 2021 - 2023 ], [ === MSc. in Electrical Engineering \@Uliège Focus : Signal processing and intelligent robotics\ Graduated magna cum laude (87%) \ _Thesis title: Data assimilation as Simulation-based Inference_ ] ) \ #grid( columns: (1fr, 4fr), [ 2018 - 2021 ], [ === BSc. in Electronics and Computer Engineering \@Uliège Graduated magna cum laude (79%) \ ] ) = Experience #grid( columns: (1fr, 4fr), [ Summer 2022 ], [ === Student intern \@Haulogy Under the supervision of #link("http://blogs.ulg.ac.be/damien-ernst/")[<NAME>] and #link("https://www.linkedin.com/in/asutera/?originalSubdomain=be")[Dr. <NAME>] \ _Subject: Time series forecasting using Machine/Deep Learning techniques_ ] ) \ #grid( columns: (1fr, 4fr), [ 2019 - 2023 ], [ === Student Instructor \@Uliège I gave (11 mandates) various working sessions in computer sciences, electrical engineering and basic engineering courses. I also worked as a tutor in the #text(blue,link("https://www.si-pass.lu.se/en/about-si-pass")[SI-PASS program]) of the faculty. ] ) = Publications - Google Scholar : #text(blue,"https://scholar.google.com/citations?user=YZxxzigAAAAJ&hl=fr") // #grid( // columns: (1fr, 1fr, 1fr), // [ // == Language // ], // [ // == Hobbies // ], // [ // == Language // ], // )
https://github.com/ruben-hude/typst-prepa
https://raw.githubusercontent.com/ruben-hude/typst-prepa/main/typst-prepa.typ
typst
Apache License 2.0
#import "@preview/ctheorems:1.0.0": * #import "@preview/big-todo:0.2.0": * #import "@preview/lovelace:0.1.0": * // Mise en page #set page(width: 16cm, height: auto, margin: 1.5cm) #set heading(numbering: "1.1.") #let last_num = (..nums) => nums.pos().last() #let theorem = thmbox("théorème", "Théorème", fill: rgb("#eeffee"), base_level: 0) #let corollary = thmbox( "corollaire", "Corrolaire", fill: rgb("#efe6ff") ) #let definition = thmbox("définition", "Défintion", stroke: rgb("#68ff68") + 1pt, base_level: 1).with(numbering: last_num) #let example = thmplain( "exemple", "Exemple", inset: 0.8em, fill: luma(245), breakable: false, ).with(numbering: last_num) #let proof = thmplain( "preuve", "Preuve", base: "theorem", bodyfmt: body => [#body #h(1fr) $square$], ).with(numbering: none) #let remark = thmplain( "remarque", "Remarque" ).with(numbering: none) #let property = thmbox( "propriété", "Propriété", stroke: blue + 1pt, base_level: 1 ).with(numbering: last_num) #let usuel = thmplain( "résultat usuel", "Résultat usuel", inset: 0.8em, stroke: black + 0.5pt, breakable: false, ).with(numbering: none) #let method = thmbox( "méthode", "Méthode", stroke: 1pt, base_level: 1 ).with(numbering: last_num) #let exercice(num, fait, exo) = { import emoji: checkmark, crossmark let mark = if fait {checkmark} else {crossmark} counter(heading).update(num -1) { set heading(numbering: nums => "Exercice "+ numbering("1", nums)) [= #mark ] } [#exo] } // Mathématiques #let fun(ED, EA, i, o) = $ inline(#ED) & --> #EA \ #i & arrow.bar.long #o $ #let Union = $op(union.big, limits: #true)$ #let ii = $upright(i)$ #let ee = $upright(e)$ #let Re = $ op("Re") $ #let Im = $ op("Im") $ #let result(r) = align(center, rect(r, stroke: rgb("#fd8a8a"), radius: 5pt)) #let sgn = $op("sgn")$ #let lna(x) = $ln abs(#x)$ #let interval(e1,e2, lo: false, ro: false) = { let l = if lo {$bracket.l$} else {$bracket.r$} let r = if ro {$bracket.r$} else {$bracket.l$} $lr(#l #e1, #e2 #r)$ } #let cosh = $op("ch")$ #let sinh = $op("sh")$ #let tanh = $op("th")$ #let arccos = $op("Arccos")$ #let arcsin = $op("Arcsin")$ #let arctan = $op("Arctan")$ #let argsh = $op("Argsh")$ #let conjug(z) = $accent(#z, -)$ #let pm =$plus.minus$ #let va(u) = $accent(#u, ->)$ // Templates #let template(title, doc) = { set text(lang: "fr") // set document(title: title) set par(justify: true) set page( header: align(right, title), numbering: "1/1" ) show: thmrules show: setup-lovelace align(center, text(title, style: "italic", 24pt)) doc } #let chapter(num, name, doc) = { let title = "Chapitre " + str(num) + " - " + str(name) show: doc => template(title, doc) set heading( numbering :(..nums) => { let lenght = nums.pos().len() if lenght != 1 { nums.pos() .slice(if lenght==2 {-1} else {-2}) .map(str) .join(".") } else {numbering("I", nums.pos().last())} } ) outline() doc } #let devoir(type, num, doc) = { let title = "Devoir " + str(type) + " " + str(num) show: doc => template(title, doc) set enum(numbering: "(1.a)") doc } #let td(num, name, doc) = { let title = "TD" + str(num) + " - " + name show: doc => template(title, doc) set enum(numbering: "(1.a)") outline() doc }
https://github.com/alliso/resume
https://raw.githubusercontent.com/alliso/resume/main/typ/cv.typ
typst
#set page( margin: 5% ) #set text(font: "JetBrains Mono") #grid( columns: (80%, 20%), rows: auto, align(center + bottom,text(18pt)[ = <NAME> #align(center,text(12pt)[== *DESARROLLADOR FULL STACK*]) ]), text(6pt)[#list(marker: [], [+34 651 353 777], [#text("<EMAIL>")], [#underline[#link("www.linkedin.com/in/allico")]], [#underline[#link("https://github.com/alliso")]], [Calle Doctor Juan Peset n9 p4 Buñol, Valencia 46360 España], )] ) Desarrollador con amplia experiencia en programación y mantenimiento de sistemas, y conocimiento profundo de lenguajes como Java, JavaScript y TypeScript. He participado en diversos proyectos de desarrollo de aplicaciones y sistemas, y he demostrado mis habilidades de colaboración y trabajo en equipo en distintos contextos profesionales. #align(center, line(length: 60%, stroke: 0.5pt + gray)) #align(center,[== #underline[Habilidades]]) #columns(5)[ #set list(marker: [‣]) - Java 11, 17 y 21 - Spring Boot #colbreak() - TypeScript - Docker #colbreak() - Cucumber - TypeScript #colbreak() - MongoDB - Kafka #colbreak() - Git - PostgreSQL ] #align(center, line(length: 60%, stroke: 0.5pt + gray)) #align(center,[== #underline[Experiencia laboral]]) === Desarrollador Full Stack en CTT Express - Remoto (Feb 2023 - Actualidad) #text(10pt)[ - Creación y diseño de soluciones de software escalables y de alta calidad mediante el uso de tecnologías como Java Spring Boot y Vue. - Implementación de metodologías innovadoras como TDD y Scrum, que agilizan el proceso de desarrollo y aseguran la calidad del software. - Diseño de microservicios y uso de tecnologías como Kafka y Grafana. ] === Desarrollador Full Stack en IRTIC - Valencia (Jun 2022 - Feb 2023) #text(10pt)[ - Creación de soluciones de software escalables y de alta calidad mediante el uso de tecnologías como Java Spring Boot y Angular. - Experiencia en la creación y optimización de contenedores Docker tanto para el Frontend como el Backend de aplicaciones, con el objetivo de simplificar y acelerar el proceso de despliegue en entornos de producción y desarrollo. ] === Desarrollador Full Stack en Dialapplet - Valencia (Ene 2020 - Jun 2022) #text(10pt)[ - Integrante del equipo de I+D de la empresa, encargado de diseñar e implementar soluciones de software innovadoras y personalizadas mediante el uso de tecnologías de vanguardia. - Implementación de contenedores Docker para automatizar y optimizar los procesos de la empresa, con el objetivo de mejorar la eficiencia y productividad del negocio. - Mantenimiento y mejora de aplicaciones ya existentes mediante la adición de nuevas funcionalidades y la solución de problemas técnicos. - Aplicación de metodologías ágiles como SCRUM para la gestión de proyectos de software, utilizando herramientas como Jira para la planificación y seguimiento de tareas. ] === Soporte IT en F1-Connecting - Valencia (Oct 2019 - Ene 2020) #text(10pt)[ - Mantenimiento de sistemas operativos Linux, incluyendo la automatización de procesos mediante el uso de lenguajes de programación como Python. ] === Desarrollador Frontend en WA works - <NAME> (Sep 2018 - Dic 2018) #text(10pt)[ - Experiencia en el desarrollo de aplicaciones Front End mediante el uso de frameworks como React y TypeScript, con el fin de brindar una experiencia de usuario ágil e intuitiva. ] #align(center, line(length: 60%, stroke: 0.5pt + gray)) #pagebreak() #align(center,[== #underline[Educación]]) #text(10pt)[ - Grado en Ingeniería Informática en Universidad Politécnica de Valencia (2015 - 2019) ]
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/visualize/gradient.typ
typst
--- gradient-linear-angled --- // Test gradients with direction. #set page(width: 90pt) #grid( gutter: 3pt, columns: 4, ..range(0, 360, step: 15).map(i => box( height: 15pt, width: 15pt, fill: gradient.linear(angle: i * 1deg, (red, 0%), (blue, 100%)), )) ) --- gradient-linear-oklab --- // The tests below test whether hue rotation works correctly. // Here we test in Oklab space for reference. #set page( width: 100pt, height: 30pt, fill: gradient.linear(red, purple, space: oklab) ) --- gradient-linear-oklch --- // Test in OkLCH space. #set page( width: 100pt, height: 30pt, fill: gradient.linear(red, purple, space: oklch) ) --- gradient-linear-hsv --- // Test in HSV space. #set page( width: 100pt, height: 30pt, fill: gradient.linear(red, purple, space: color.hsv) ) --- gradient-linear-hsl --- // Test in HSL space. #set page( width: 100pt, height: 30pt, fill: gradient.linear(red, purple, space: color.hsl) ) --- gradient-linear-relative-parent --- // The image should look as if there is a single gradient that is being used for // both the page and the rectangles. #let grad = gradient.linear(red, blue, green, purple, relative: "parent") #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-linear-relative-self --- // The image should look as if there are multiple gradients, one for each // rectangle. #let grad = gradient.linear(red, blue, green, purple, relative: "self") #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-linear-relative-parent-block --- // The image should look as if there are two nested gradients, one for the page // and one for a nested block. The rotated rectangles are not visible because // they are relative to the block. #let grad = gradient.linear(red, blue, green, purple, relative: "parent") #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 5pt, fill: grad, background: place(top + left, my-rect), ) #block( width: 40pt, height: 40pt, inset: 2.5pt, fill: grad, )[ #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) ] --- gradient-linear-repeat-and-mirror-1 --- // Test repeated gradients. #rect( height: 40pt, width: 100%, fill: gradient.linear(..color.map.inferno).repeat(2, mirror: true) ) --- gradient-linear-repeat-and-mirror-2 --- #rect( height: 40pt, width: 100%, fill: gradient.linear(..color.map.rainbow).repeat(2, mirror: true), ) --- gradient-linear-repeat-and-mirror-3 --- #rect( height: 40pt, width: 100%, fill: gradient.linear(..color.map.rainbow).repeat(5, mirror: true) ) --- gradient-linear-sharp-and-repeat --- #rect( height: 40pt, width: 100%, fill: gradient.linear(..color.map.rainbow).sharp(10).repeat(5, mirror: false) ) --- gradient-linear-sharp-repeat-and-mirror --- #rect( height: 40pt, width: 100%, fill: gradient.linear(..color.map.rainbow).sharp(10).repeat(5, mirror: true) ) --- gradient-linear-sharp --- #square( size: 100pt, fill: gradient.linear(..color.map.rainbow, space: color.hsl).sharp(10), ) #square( size: 100pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl).sharp(10), ) #square( size: 100pt, fill: gradient.conic(..color.map.rainbow, space: color.hsl).sharp(10), ) --- gradient-linear-sharp-and-smooth --- #square( size: 100pt, fill: gradient.linear(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), ) #square( size: 100pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), ) #square( size: 100pt, fill: gradient.conic(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), ) --- gradient-linear-stroke --- #align(center + top, square(size: 50pt, fill: black, stroke: 5pt + gradient.linear(red, blue))) --- gradient-fill-and-stroke --- #align( center + bottom, square( size: 50pt, fill: gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)), stroke: 10pt + gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)) ) ) --- gradient-linear-stroke-relative-parent --- // The image should look as if there is a single gradient that is being used for // both the circle stroke and the block fill. #align( center + horizon, block( width: 50pt, height: 50pt, fill: gradient.linear(red, blue).sharp(4), circle( radius: 18pt, stroke: 5pt + gradient.linear(red, blue, relative: "parent").sharp(4), ) ) ) --- gradient-linear-line --- // Test gradient on lines #set page(width: 100pt, height: 100pt) #line(length: 100%, stroke: 1pt + gradient.linear(red, blue)) #line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue)) #line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue, relative: "parent")) --- gradient-radial-hsl --- #square( size: 100pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl), ) --- gradient-radial-center --- #grid( columns: 2, square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (0%, 0%)), ), square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (0%, 100%)), ), square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (100%, 0%)), ), square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (100%, 100%)), ), ) --- gradient-radial-radius --- #square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, radius: 10%), ) #square( size: 50pt, fill: gradient.radial(..color.map.rainbow, space: color.hsl, radius: 72%), ) --- gradient-radial-focal-center-and-radius --- #circle( radius: 25pt, fill: gradient.radial(white, rgb("#8fbc8f"), focal-center: (35%, 35%), focal-radius: 5%), ) #circle( radius: 25pt, fill: gradient.radial(white, rgb("#8fbc8f"), focal-center: (75%, 35%), focal-radius: 5%), ) --- gradient-radial-relative-parent --- // The image should look as if there is a single gradient that is being used for // both the page and the rectangles. #let grad = gradient.radial(red, blue, green, purple, relative: "parent"); #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-radial-relative-self --- // The image should look as if there are multiple gradients, one for each // rectangle. #let grad = gradient.radial(red, blue, green, purple, relative: "self"); #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-radial-text --- // Test that gradient fills on text. // The solid bar gradients are used to make sure that all transforms are // correct: if you can see the text through the bar, then the gradient is // misaligned to its reference container. #set page(width: 200pt, height: auto, margin: 10pt) #set par(justify: true) #set text(fill: gradient.radial(red, blue)) #lorem(30) --- gradient-conic --- #square( size: 50pt, fill: gradient.conic(..color.map.rainbow, space: color.hsv), ) --- gradient-conic-center-shifted-1 --- #square( size: 50pt, fill: gradient.conic(..color.map.rainbow, space: color.hsv, center: (10%, 10%)), ) --- gradient-conic-center-shifted-2 --- #square( size: 50pt, fill: gradient.conic(..color.map.rainbow, space: color.hsv, center: (90%, 90%)), ) --- gradient-conic-angled --- #square( size: 50pt, fill: gradient.conic(..color.map.rainbow, space: color.hsv, angle: 90deg), ) --- gradient-conic-oklab --- // Test in Oklab space for reference. #set page( width: 100pt, height: 100pt, fill: gradient.conic(red, purple, space: oklab) ) --- gradient-conic-oklch --- // Test in OkLCH space. #set page( width: 100pt, height: 100pt, fill: gradient.conic(red, purple, space: oklch) ) --- gradient-conic-hsv --- // Test in HSV space. #set page( width: 100pt, height: 100pt, fill: gradient.conic(red, purple, space: color.hsv) ) --- gradient-conic-hsl --- // Test in HSL space. #set page( width: 100pt, height: 100pt, fill: gradient.conic(red, purple, space: color.hsl) ) --- gradient-conic-relative-parent --- // The image should look as if there is a single gradient that is being used for // both the page and the rectangles. #let grad = gradient.conic(red, blue, green, purple, relative: "parent"); #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-conic-relative-self --- // The image should look as if there are multiple gradients, one for each // rectangle. #let grad = gradient.conic(red, blue, green, purple, relative: "self"); #let my-rect = rect(width: 50%, height: 50%, fill: grad) #set page( height: 50pt, width: 50pt, margin: 2.5pt, fill: grad, background: place(top + left, my-rect), ) #place(top + right, my-rect) #place(bottom + center, rotate(45deg, my-rect)) --- gradient-conic-stroke --- #align( center + bottom, square( size: 50pt, fill: black, stroke: 10pt + gradient.conic(red, blue) ) ) --- gradient-conic-text --- #set page(width: 200pt, height: auto, margin: 10pt) #set par(justify: true) #set text(fill: gradient.conic(red, blue, angle: 45deg)) #lorem(30) --- gradient-text-bad-relative --- // Make sure they don't work when `relative: "self"`. // Hint: 17-61 make sure to set `relative: auto` on your text fill // Error: 17-61 gradients and patterns on text must be relative to the parent #set text(fill: gradient.linear(red, blue, relative: "self")) --- gradient-text-global --- // Test that gradient fills on text work for globally defined gradients. #set page(width: 200pt, height: auto, margin: 10pt, background: { rect(width: 100%, height: 30pt, fill: gradient.linear(red, blue)) }) #set par(justify: true) #set text(fill: gradient.linear(red, blue)) #lorem(30) --- gradient-text-dir --- // Sanity check that the direction works on text. #set page(width: 200pt, height: auto, margin: 10pt, background: { rect(height: 100%, width: 30pt, fill: gradient.linear(dir: btt, red, blue)) }) #set par(justify: true) #set text(fill: gradient.linear(dir: btt, red, blue)) #lorem(30) --- gradient-text-in-container --- // Test that gradient fills on text work for locally defined gradients. #set page(width: auto, height: auto, margin: 10pt) #show box: set text(fill: gradient.linear(..color.map.rainbow)) Hello, #box[World]! --- gradient-text-rotate --- // Test that gradients fills on text work with transforms. #set page(width: auto, height: auto, margin: 10pt) #show box: set text(fill: gradient.linear(..color.map.rainbow)) #rotate(45deg, box[World]) --- gradient-text-decoration --- #set text(fill: gradient.linear(red, blue)) Hello #underline[World]! \ Hello #overline[World]! \ Hello #strike[World]! \ --- gradient-transformed --- // 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: 50pt, width: 50pt, margin: 2.5pt, ) #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))) --- gradient-presets --- // Test all gradient presets. #set page(width: 100pt, height: auto, margin: 0pt) #set text(fill: white, size: 18pt) #set text(top-edge: "bounds", bottom-edge: "bounds") #let presets = ( ("turbo", color.map.turbo), ("cividis", color.map.cividis), ("rainbow", color.map.rainbow), ("spectral", color.map.spectral), ("viridis", color.map.viridis), ("inferno", color.map.inferno), ("magma", color.map.magma), ("plasma", color.map.plasma), ("rocket", color.map.rocket), ("mako", color.map.mako), ("vlag", color.map.vlag), ("icefire", color.map.icefire), ("flare", color.map.flare), ("crest", color.map.crest), ) #stack( spacing: 3pt, ..presets.map(((name, preset)) => block( width: 100%, height: 20pt, fill: gradient.linear(..preset), align(center + horizon, smallcaps(name)), )) ) // Test that gradients are applied correctly on equations. --- gradient-math-cancel --- // Test on cancel #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ a dot cancel(5) = cancel(25) 5 x + cancel(5) 1 $ --- gradient-math-frac --- // Test on frac #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ nabla dot bold(E) = frac(rho, epsilon_0) $ --- gradient-math-root --- // Test on root #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $ --- gradient-math-mat --- // Test on matrix #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ A = mat( 1, 2, 3; 4, 5, 6; 7, 8, 9 ) $ --- gradient-math-underover --- // Test on underover #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ underline(X^2) $ $ overline("hello, world!") $ --- gradient-math-dir --- // Test a different direction #show math.equation: set text(fill: gradient.linear(..color.map.rainbow, dir: ttb)) #show math.equation: box $ A = mat( 1, 2, 3; 4, 5, 6; 7, 8, 9 ) $ $ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $ --- gradient-math-misc --- // Test miscellaneous #show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) #show math.equation: box $ hat(x) = bar x bar = vec(x, y, z) = tilde(x) = dot(x) $ $ x prime = vec(1, 2, delim: "[") $ $ sum_(i in NN) 1 + i $ $ attach( Pi, t: alpha, b: beta, tl: 1, tr: 2+3, bl: 4+5, br: 6, ) $ --- gradient-math-radial --- // Test radial gradient #show math.equation: set text(fill: gradient.radial(..color.map.rainbow, center: (30%, 30%))) #show math.equation: box $ A = mat( 1, 2, 3; 4, 5, 6; 7, 8, 9 ) $ --- gradient-math-conic --- // Test conic gradient #show math.equation: set text(fill: gradient.conic(red, blue, angle: 45deg)) #show math.equation: box $ A = mat( 1, 2, 3; 4, 5, 6; 7, 8, 9 ) $ --- gradient-kind --- // Test gradient functions. #test(gradient.linear(red, green, blue).kind(), gradient.linear) --- gradient-stops --- #test(gradient.linear(red, green, blue).stops(), ((red, 0%), (green, 50%), (blue, 100%))) --- gradient-sample --- #test(gradient.linear(red, green, blue, space: rgb).sample(0%), red) #test(gradient.linear(red, green, blue, space: rgb).sample(25%), rgb("#97873b")) #test(gradient.linear(red, green, blue, space: rgb).sample(50%), green) #test(gradient.linear(red, green, blue, space: rgb).sample(75%), rgb("#17a08c")) #test(gradient.linear(red, green, blue, space: rgb).sample(100%), blue) --- gradient-space --- #test(gradient.linear(red, green, space: rgb).space(), rgb) #test(gradient.linear(red, green, space: oklab).space(), oklab) #test(gradient.linear(red, green, space: oklch).space(), oklch) #test(gradient.linear(red, green, space: cmyk).space(), cmyk) #test(gradient.linear(red, green, space: luma).space(), luma) #test(gradient.linear(red, green, space: color.linear-rgb).space(), color.linear-rgb) #test(gradient.linear(red, green, space: color.hsl).space(), color.hsl) #test(gradient.linear(red, green, space: color.hsv).space(), color.hsv) --- gradient-relative --- #test(gradient.linear(red, green, relative: "self").relative(), "self") #test(gradient.linear(red, green, relative: "parent").relative(), "parent") #test(gradient.linear(red, green).relative(), auto) --- gradient-angle --- #test(gradient.linear(red, green).angle(), 0deg) #test(gradient.linear(red, green, dir: ltr).angle(), 0deg) #test(gradient.linear(red, green, dir: rtl).angle(), 180deg) #test(gradient.linear(red, green, dir: ttb).angle(), 90deg) #test(gradient.linear(red, green, dir: btt).angle(), 270deg) --- gradient-repeat --- #test( gradient.linear(red, green, blue).repeat(2).stops(), ((red, 0%), (green, 25%), (blue, 50%), (red, 50%), (green, 75%), (blue, 100%)) ) #test( gradient.linear(red, green, blue).repeat(2, mirror: true).stops(), ((red, 0%), (green, 25%), (blue, 50%), (green, 75%), (red, 100%)) ) --- issue-2902-gradient-oklch-panic --- // Minimal reproduction of #2902 #set page(width: 15cm, height: auto, margin: 1em) #set block(width: 100%, height: 1cm, above: 2pt) // Oklch #block(fill: gradient.linear(red, purple, space: oklch)) #block(fill: gradient.linear(..color.map.rainbow, space: oklch)) #block(fill: gradient.linear(..color.map.plasma, space: oklch)) --- issue-2902-gradient-oklab-panic --- #set page(width: 15cm, height: auto, margin: 1em) #set block(width: 100%, height: 1cm, above: 2pt) // Oklab #block(fill: gradient.linear(red, purple, space: oklab)) #block(fill: gradient.linear(..color.map.rainbow, space: oklab)) #block(fill: gradient.linear(..color.map.plasma, space: oklab)) --- issue-gradient-cmyk-encode --- // Test that CMYK works on gradients #set page(margin: 0pt, width: 100pt, height: auto) #let violet = cmyk(75%, 80%, 0%, 0%) #let blue = cmyk(75%, 30%, 0%, 0%) #rect( width: 100%, height: 10pt, fill: gradient.linear(violet, blue) ) #rect( width: 100%, height: 10pt, fill: gradient.linear(rgb(violet), rgb(blue)) ) // In PDF format, this gradient can look different from the others. // This is because PDF readers do weird things with CMYK. #rect( width: 100%, height: 10pt, fill: gradient.linear(violet, blue, space: cmyk) )
https://github.com/suspenss/Undergraduate-mathematics
https://raw.githubusercontent.com/suspenss/Undergraduate-mathematics/main/mathmatics-analysis/mainproblem.typ
typst
#import "./../setup/templates.typ": * #import "./../setup/theorem.typ": * #show: thmrules #show: project.with( title: "Mathmatics Analysis", authors: ("epoche",), language: "ch", outl: [ #outline(indent: true, title: "目录", depth: 2) ], ) #show math.ast: math.thin #let obey = math.tilde #let vb = $bold(beta)$ #let va = $bold(alpha)$ #let ve = $bold(e)$ #let tem = theorem #let def = definition #let prf = proof #let emp = example #let ant = annotation #let pos = proposition #let lem = lemma #let prt = properties #let exr = exercise = 自然数 == 加法 #exr[ 证明自然数加法的结合律。 ] #prf[ 对 $b$ 进行数学归纳法,当 $b = 0$ 时,等式为 $(a + 0) + c = a + (0 + c)$,由加法定义及加法的交换律可得 $a + c = a + c$,即 $b = 0$ 时得证。现归纳性地假设 $(a + b) + c = a + (b + c)$,待证 $(a + "succ" b) + c = a + ("succ" b + c)$,根据交换律及加法定义可以将其化简为 $"succ" (a + b) + c = a + "succ" (b + c)$,进一步化简为 $"succ" (a + b + c) = "succ" (a + b + c)$,等式两边相等。 ] #exr[ 证明引理 2.2.10 。 ] #prf[ 对 $a$ 进行归纳法,当 $a = 1$ 时,$"succ" b = 1$,式子可以写成 $b + 1 = 0 + 1$,由消去律可以得到 $b = 0,b in NN$,现归纳性地假设 $forall thin a in ZZ^+, exists thin b in NN,"succ" b = a$,需证明 $"succ" b = "succ" a$,此时 $b = a,b in NN$。 ] #exr[ 证明命题 1.1 自然数的序的基本性质。 ] #exr[ 证明命题 2.2.13 证明中标注了(为什么?)的三个命题。 ] #exr[ 证明命题 2.2.14 。 ]
https://github.com/benjft/CV
https://raw.githubusercontent.com/benjft/CV/master/benedict_thompson_cv.typ
typst
#set page(paper: "a4", margin: (top:1.5cm, bottom:1.5cm)) #text(size: 20pt, align(center)[= <NAME>]) #sym.bullet #link("tel:+447964629416")[`07964-629-416`] #h(1fr) #sym.bullet #link("mailto:<EMAIL>")[`<EMAIL>`] #h(1fr) #sym.bullet #link("https://github.com/benjft")[`github.com/benjft`] #h(1fr) #sym.bullet #link("https://linkedin.com/in/benjft")[`linkedin.com/in/benjft`] #include "bio.typ" #include "experience.typ" #include "education.typ" #include "other.typ" #pagebreak(weak: true) #include "projects.typ"
https://github.com/kaewik/din5008-typst
https://raw.githubusercontent.com/kaewik/din5008-typst/master/din5008-letter.typ
typst
MIT License
#let iconGrid(icon, content) = box( height: 8pt, grid( columns: (auto, auto), column-gutter: 1em, icon, content )) #let githubLink(content) = iconGrid( image( width: 10pt, "github-mark.png" ), content ) #let email(content) = iconGrid( emoji.mail, content ) #let phone(content) = iconGrid( emoji.phone.receiver, content ) #let build(letter, config) = { page( paper: "a4", margin: ( top: 45mm, bottom: 1.69cm, left: 2.5cm, right: letter.rightMargin ), [ #grid( columns: (10cm, auto), [ #text(8pt)[ \ \ \ \ #underline[#letter.senderName, #letter.senderStreet #letter.senderHouseNo, #letter.senderZipCode #letter.senderCity] ]\ #letter.receiverName \ #letter.receiverStreet #letter.receiverHouseNo \ #letter.receiverZipCode #letter.receiverCity \ #letter.receiverMail ], [ #move( dx: 0mm, dy: 5mm, [ #letter.senderName \ #letter.senderStreet #letter.senderHouseNo \ #letter.senderZipCode #letter.senderCity \ #phone(letter.senderPhoneNo)\ #email(letter.senderMail)\ #if letter.senderGithub != none { githubLink(letter.senderGithub) linebreak() } #v(8.46mm) ] ) ] ) #align( right, letter.dateLine ) #text( weight: "bold", letter.subject )\ \ \ #letter.opening,\ \ #par( justify: true, letter.body ) \ #letter.greeting #if not config.disableGreetingLine { linebreak() linebreak() linebreak() linebreak() [ #letter.senderName ] } ] ) } #let makeLetter( rightMargin: 2cm, dateLine: datetime.today().display("[day].[month].[year]"), senderName: "<NAME>", senderStreet: "No-Given-Street", senderHouseNo: "00", senderZipCode: "12345", senderCity: "Somwheretown", senderPhoneNo: "0123 456789", senderMail: "<EMAIL>", senderGithub: none, receiverName: "<NAME>", receiverStreet: "No-Receiver-Street", receiverHouseNo: "11", receiverZipCode: "54321", receiverCity: "Receiver-Lake-City", receiverMail: "<EMAIL>", subject: "Application to a not defined job", opening: "Dear ladies and gentlemen", body: "Lorem ipsum", greeting: "Best regards,", config: ( disableGreetingLine: false ) ) = { let letter = (:) letter.insert("rightMargin", rightMargin) letter.insert("dateLine", dateLine) letter.insert("senderName", senderName) letter.insert("senderStreet", senderStreet) letter.insert("senderHouseNo", senderHouseNo) letter.insert("senderZipCode", senderZipCode) letter.insert("senderCity", senderCity) letter.insert("senderPhoneNo", senderPhoneNo) letter.insert("senderMail", senderMail) letter.insert("senderGithub", senderGithub) letter.insert("receiverName", receiverName) letter.insert("receiverStreet", receiverStreet) letter.insert("receiverHouseNo", receiverHouseNo) letter.insert("receiverZipCode", receiverZipCode) letter.insert("receiverCity", receiverCity) letter.insert("receiverMail", receiverMail) letter.insert("subject", subject) letter.insert("opening", opening) letter.insert("body", body) letter.insert("greeting", greeting) build(letter, config) }
https://github.com/pluttan/electron
https://raw.githubusercontent.com/pluttan/electron/main/lab1/lab1.typ
typst
#import "@docs/bmstu:1.0.0":* #import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx, cellx #show: student_work.with( caf_name: "Компьютерные системы и сети", faculty_name: "Информатика и системы управления", work_type: "лабораторной работе", work_num: "1", discipline_name: "Электроника", theme: "Диоды в источниках питания (Вариант 13)", author: (group: "ИУ6-42Б", nwa: "<NAME>"), adviser: (nwa: "<NAME>"), city: "Москва", table_of_contents: true, ) = Задание == Цель работы Исследование характеристик и параметров выпрямительных схем и стабилизаторов напряжения. == Задание 1. Исследовать работу однополупериодной и двухполупериодной схем выпрямителя для случаев: - активной нагрузки; - емкостной нагрузки;\ #h(-45pt)зарисовать форму выходного напряжения, а также форму тока,\ #h(-45pt) протекающего через диод. 2. Определить с помощью осциллографа угол отсечки q и коэффициент пульсаций кп для одно- и двухполупериодной схем. 3. Исследовать сглаживающее действие фильтра LC при одно- и двухполупериодном выпрямлении. Определить коэффициенты сглаживания. 4. Отснять нагрузочные характеристики выпрямителя и определить его выходное сопротивление. 5. Подключить к выпрямителю параметрический стабилизатор, снять нагрузочную характеристику стабилизатора и определить по ней его выходное сопротивление, определить коэффициент стабилизации (схема выпрямителя мостовая, фильтр LC отключен). == Параметры схемы #align(center)[ #tablex( columns: 11, inset: 7pt, align: center+horizon, [$U_"вх"$],[$f_"вх"$],colspanx(2)[Выпрям. диод],colspanx(2)[Стабилитрон],[$C_1$],[$L_1$],[$C_2$],[$R_2$],[$R_н$], [В],[Гц],[Материал],[$r_б$, Ом],[$U_"ст"$, В],[$r_б$, Ом],[мкФ],[Гн],[мкФ],[Ом],[Ом], [10],[50],[Ge],[1,2],[6],[1,5],[80],[0,5],[80],[400],[1000], ) ] = Однополупериодный выпрямитель без фильтра #img(image("1.png", width:90%), [Схема однополупериодного выпрямителя без фильтра]) #img(image("2.png", width:90%), [Форма напряжений однополупериодной схемы без фильтра]) #img(image("3.1.png", width:90%), [Анализ Фурье однополупериодной схемы без фильтра]) #img(image("3.2.png", width:90%), [Анализ Фурье однополупериодной схемы без фильтра]) #img(image("4.png", width:90%), [Форма тока однополупериодной схемы без фильтра]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Амплитуда входного напряжения], [$ U_"вх max" = 14.14 В $], [Среднее значение выходного напряжения], [$ U_0 = U_"вх max"/ pi =4.5 В $], [Среднее значение выходного напряжения по анализу Фурье], [$ U_0 = 4.3 В $], [Амплитуда первой гармоники переменной составляющей на выходе], [$ U_"m1" = 6.81 В $], [Коэффициент пульсаций], [$ К_п = U_"m1"/U_0 = 1.51 $], [Коэффициент пульсаций по анализу Фурье], [$ К_п = 1.58 $], [Среднее значение выпрямленного тока], [$ J_"ср" = U_0/R_н = 0.00225 А $], [Амплитудное значение тока через диод], [$ J_max = U_"вх max"/R_н = 0.01414 А $] )] = Однополупериодный выпрямитель с фильтром #img(image("5.png", width:90%), [Схема однополупериодного выпрямителя с фильтром]) #img(image("6.png", width:90%), [Форма напряжений и угол отсечки однополупериодной схемы с фильтром]) #img(image("7.1.png", width:80%), [Анализ Фурье однополупериодной схемы с фильтром ]) #img(image("7.2.png", width:80%), [Анализ Фурье однополупериодной схемы с фильтром ]) #img(image("8.png", width:80%), [Форма обратных напряжений однополупериодной схемы с фильтром]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Угол отсечки], [$ theta = (omega (t_2-t_1))/2 = 0.3 "рад" $], [Среднее значение выходного напряжения], [$ U_0 = U_"вх max" cos θ = 13.5 В $], [Среднее значение выходного напряжения по анализу Фурье], [$ U_0 = 12.3 В $], [Амплитуда первой гармоники переменной составляющей на выходе], [$ U_"m1" = 0.96 В $], [Коэффициент пульсаций], [$ К_п= U_"m1"/U_0 = 0.071 $], [Коэффициент пульсаций по анализу Фурье], [$ К_п = 0.078 $], [Амплитудное значение тока через диод], [$ J = 0.01414 А $], [Обратное значение напряжения на диоде], [$ U_"обр" = 26.26 В $] )] = Мостовая схема выпрямителя без фильтра #img(image("10.png", width:90%), [Схема мостового выпрямителя без фильтров]) #img(image("11.png", width:90%), [Форма напряжений мостовой схемы без фильтра]) #img(image("12.1.png", width:90%), [Анализ Фурье мостовой схемы без фильтра]) #img(image("12.2.png", width:90%), [Анализ Фурье мостовой схемы без фильтра]) #img(image("13.png", width:90%), [Форма обратных напряжений мостовой схемы без фильтра]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Среднее значение выходного напряжения], [$ U_0 = (2 U_"вх max") / pi = 9 В $], [Среднее значение выходного напряжения по анализу Фурье], [$ U_0 = 4.09 В $], [Амплитуда первой гармоники переменной составляющей на выходе], [$ U_"m1" = 7.07 В $], [Коэффициент пульсаций], [$ К_п = U_"m1"/U_0 = 0.78 $], [Коэффициент пульсаций по анализу Фурье], [$ К_п = 1.7$], [Амплитудное значение тока], [$ J = 0.009 А $] )] = Мостовая схема выпрямителя с конденсатором #img(image("14.png", width:90%), [Схема мостового выпрямителя с фильтром]) #img(image("15.png", width:90%), [Форма напряжений и угол отсечки мостовой схемы с фильтром]) #img(image("16.png", width:90%), [Анализ Фурье мостовой схемы с фильтром]) #img(image("17.png", width:90%), [Форма обратных напряжений мостовой схемы с фильтром]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Угол отсечки], [$ theta = (omega (t_2-t_1))/2 = 0.3 "рад" $], [Среднее значение выходного напряжения], [$ U_0 = U_"вх max" cos θ = 13.5 В $], [Среднее значение выходного напряжения по анализу Фурье], [$ U_0 = 12.5 В $], [Амплитуда первой гармоники переменной составляющей на выходе], [$ U_"m1" = 12.5 В $], [Коэффициент пульсаций], [$ К_п = U_"m1"/U_0 = 0.92 $], [Коэффициент пульсаций по анализу Фурье], [$ К_п = 1 $], [Амплитудное значение тока через диод], [$ J = 0.0135 А $], [Обратное значение напряжения на диоде], [$ U_"обр" = 13.65 В $] )] = Исследование сглаживающего действия фильтра LC для однополупериодной схемы #img(image("19.png", width:90%), [Однополупериодная схема с П-образным фильтром]) #img(image("20.png", width:90%), [Форма напряжений однополупериодной схемы с LC-фильтром]) #img(image("21.png", width:90%), [Анализ Фурье для коэффициента пульсаций на входе LC-фильтра однополупериодной схемы]) #img(image("22.png", width:90%), [Анализ Фурье для коэффициента пульсаций на выходе LC-фильтра однополупериодной схемы]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Коэффициент пульсации на входе по анализу Фурье], [$ К_"пульс вх" = 0.119 $], [Коэффициент пульсации на выходе по анализу Фурье], [$ К_"пульс вых" = 0.039 $], [Коэффициент сглаживания], [$ К_"сгл" = К_"пульс вх"/К_"пульс вых" = 3.05 $] )] = Исследование сглаживающего действия фильтра для мостовой схемы #img(image("23.png", width:90%), [Мостовая схема с П-образным фильтром]) #img(image("24.png", width:90%), [Форма напряжений мостовой схемы с LC-фильтром]) #img(image("25.png", width:90%), [Анализ Фурье для коэффициента пульсаций на входе LC-фильтра мостовой схемы]) #img(image("26.png", width:90%), [Анализ Фурье для коэффициента пульсаций на выходе LC-фильтра мостовой схемы]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Коэффициент пульсации на входе по анализу Фурье], [$ К_"пульс вх" = 0.24 $], [Коэффициент пульсации на выходе по анализу Фурье], [$ К_"пульс вых" = 0.25 $], [Коэффициент сглаживания], [$ К_"сгл" = К_"пульс вх"/К_"пульс вых" = 0.96 $] )] = Нагрузочная характеристика однополупериодного выпрямителя с П-образным фильтром #img(image("27.png", width:90%), [Однополупериодная схема с П-образным фильтром для снятия нагрузочной характеристики]) #align(center)[ #tablex( columns: 12, inset: 7pt, align: center+horizon, [I, А], [0,01], [0,025], [0,05], [0,075], [0,1], [0,125], [0,15], [0,17], [0,2 ], [0,225], [0,25], [U, В], [12,4], [10,5], [8,9], [6,9], [5,5], [4,2], [3,1], [1,8], [0,98], [0,3], [0,01] )] #img(image("28.png", width:90%), [График зависимости нагрузочной характеристики от тока]) Выходное дифференциальное сопротивление выпрямителя $ R_"вых" = (∆ U)/(∆ J) $ $ R_"вых1" = 420 "Ом" $ $ R_"вых2" = 1.3 "Ом" $ = Нагрузочная характеристика мостового выпрямителя с П-образным фильтром #img(image("29.png", width:90%), [Мостовая схема с П-образным фильтром для снятия нагрузочной характеристики]) #align(center)[ #tablex( columns: 12, inset: 6pt, align: center+horizon, [I, А], [0,01], [0,050], [0,100], [0,150], [0,200], [0,250], [0,300], [0,350], [0,400], [0,450], [0,500], [U, В], [13,96], [11,03], [9,61], [8,66], [8,00], [7,58], [7,33], [7,13], [7,02], [6,89], [6,74] ) #tablex( columns: 11, inset: 6pt, align: center+horizon, [I, А], [0,550], [0,600], [0,650], [0,700], [0,750], [0,800], [0,850], [0,900], [0,950], [1,000], [U, В], [6,61], [6,56], [6,37], [6,24], [6,18], [6,07], [5,87], [5,76], [5,63], [5,51] ) ] #img(image("30.png", width:90%), [График зависимости нагрузочной характеристики от тока]) Выходное дифференциальное сопротивление выпрямителя $ R_"вых" = (∆ U)/(∆ J) $ $ R_"вых1" = 1396 "Ом" $ $ R_"вых2" = 5.51 "Ом" $ = Мостовая схема с фильтром и стабилизатором напряжения #img(image("31.png", width:90%), [Мостовая схема с фильтром и стабилизатором напряжения]) #img(image("32.png", width:90%), [Форма напряжений мостовой схемы со стабилизатором]) $ U_"вых ном" = 11,6 В $ $ U_"вх ном " = 13,03 В $ = Снятие нагрузочной характеристики стабилизатора и определение коэффициента стабилизации #img(image("33.png", width:90%), [Мостовая схема со стабилизатором для снятия нагрузочной характеристики]) #align(center)[ #tablex( columns: 12, inset: 4pt, align: center+horizon, [I, мА], [4], [6], [8], [10], [12], [14], [16], [18], [20], [22], [24], [U, В], [5,99], [5,986], [5,982], [5,976], [5,968], [5,951], [5,753], [5,151], [4,271], [3,387], [2,504] )] #img(image("34.png", width:90%), [График зависимости нагрузочной характеристики от тока]) #align(center)[ #tablex( columns: 2, inset: 7pt, align: left+horizon, [Выходное сопротивление стабилитрона],[$ R = (∆ U)/(∆ J) = 1,4 "Ом" = r_"дин" $], [Коэффициент стабилизации ], [$ К_"ст" = (R_"бал"/r_"дин"+1) U_"вых ном" / U_"вх ном" = 255 $] )] = Вывод В результате выполнения лабораторной работы были выявлены основные характеристики и параметры выпрямительных систем и стабилизаторов напряжения.
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/para/para_updated_result.typ
typst
In this report, we will explore the various factors that influence #emph[fluid dynamics] in #strike[glaciers];#underline[changed] ha they contribute to the formation and behaviour of these #strike[natural];#underline[changed] structures. All manuscripts are to be #strike[submitted];#underline[changed] electronically to the ScholarOne Abstracts site created for each conference. The manuscript upload will be enabled several weeks after acceptance notices have been sent. Presenting authors of accepted papers will receive an email with instructions when manuscript submission opens. It is important that presenting authors keep their email addresses up-to-date so they do not miss this notice. It is the responsibility of the #strike[author];#underline[changed] to obtain any required government or company reviews for their papers in advance of publication. Start early to determine if the reviews are required; this process can take several weeks.
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Chapters/5-Review.typ
typst
#import "../abbreviations.typ": * #import "../Template/customFunctions.typ": * = Review <review> In diesem Kapitel wird das erstellte System überprüft. Es soll herausgefunden werden, ob das neue System einsetzbar ist. Hierzu wird ein Interview geführt und die in @anforderungsanalyse aufgestellten Anforderungen überprüft. == Interview mit Modulverantwortlicher Person Im Laufe der Implementierungsphase wurde ein Prototyp einer modulverantwortlichen Person vorgestellt, um einschätzen zu können, ob das entstehende System eine Erleichterung des bisherigen Arbeitsprozesses darstellen könnte. Aus dem Interview ergaben sich kleinere Anpassungen an den Anforderungen, jedoch konnten keine groben Fehler am Gesamtsystem festgestellt werden. Ergebnis des Interviews war, dass die Anwendung benutzbar wirkt und den Arbeitsprozess vermutlich verbessern wird. == Abweichungen zum Prototypen Um sicherzustellen, dass keine wichtigen Details aus den Entwürfen übersehen wurden, wurde das neue System in diesem Abschnitt mit den Entwürfen aus @UI verglichen. Das in @drawer gezeigte Menü enthält in der tatsächlichen Implementierung andere Einträge. Es gibt beispielsweise in der aktuellen Version des Systems noch keine Möglichkeit, einen neuen Studiengang oder eine neue Abteilung anzulegen. Dies muss aktuell noch per Datenbankzugriff erledigt werden. Da das System im ersten Schritt jedoch nur von der Abteilung Informatik genutzt werden soll, ist dies zunächst in Ordnung. Eine Implementierung entsprechender Funktionen sollte zudem nicht aufwändig sein, da es bereits ähnliche Implementierungen für das Erstellen von Modulen und Teilmodulen gibt. Des Weiteren entfällt die geplante Benutzerverwaltung (@createUser), da in Zukunft eventuell direkt das LDAP der Hochschule verwendet werden könnte. Stattdessen gibt es im Drawer jetzt die Möglichkeit, PDF-Kompilierungsanträge und Teilmodule zu verwalten. Die Filter in @moduleoverview wurden direkt in die Tabellenüberschrift integriert (@filterResult). Außerdem wurden weitere Spalten eingeführt, um #link(<UseCaseInfoModule>)[Use Case 2] abbilden zu können. #imageFigure(<filterResult>, "../Images/filter.png", "Filtermöglichkeit") Die in @translateDropdown und @translatePopup zu sehenden Steuerelemente zum Hinzufügen von Übersetzungen wurden zugunsten einer besseren Usability ersetzt (siehe @createEditModules) Alle nicht genannten Abbildungen aus @UI ähneln den tatsächlichen Implementierungen. Bei dem Vergleich sind keine unerklärten Abweichungen gefunden worden. Alle vorgenommenen Änderungen verbessern entweder das System oder sind nicht für die Erfüllung der wesentlichen Use Cases erforderlich, sodass davon ausgegangen wird, dass alle wichtigen Anforderungen an das Design erfüllt wurden. == Vergleich der PDFs<pdfComparision> Da die Generierung eines Modulhandbuchkataloges im PDF-Format ein zentraler Bestandteil dieser Arbeit war, sollte das Ergebnis genauer geprüft werden. Hierzu wurden aktuelle Modulhandbücher von der Website der Hochschule mit den neu generierten Handbüchern aus dem System verglichen. Bei der ersten Überprüfung (siehe @pdfA und @pdfB @ilovepdf.comILovePDFOnlinePDF) sind dabei noch einige Aufgaben aufgefallen, die im Anschluss behoben wurden. So fehlten beispielsweise bei den Semesterwochenstunden ein Komma und das Suffix "SWS". Bei den längeren Texten (z. B. "Inhalt") fällt außerdem auf, dass die neuen Texte im Blocksatz dargestellt sind, während die ursprünglichen Texte lediglich linksbündig ausgerichtet sind. #imageFigure(<pdfA>, "PdfCompareA.png", "Ursprüngliches PDF") #imageFigure(<pdfB>, "PdfCompareB.png", "Neues PDF") Nachdem die kleineren Anpassungen vorgenommen und mit einer erneuten Überprüfung verifiziert wurden, ähnelt das neue PDF nun dem ursprünglichen PDF. Die Nutzung des neuen PDFs sollte dementsprechend möglich sein. #pagebreak() == Überprüfung, ob Anforderungen erfüllt sind Im Folgenden wird überprüft, welche Anforderungen erfüllt sind und welche Anforderungen in Zukunft noch umgesetzt werden müssen. Dies hilft für die spätere Einschätzung, ob das System bereits eingeführt werden könnte, oder ob es noch kritische offene Aufgaben gibt. Die Anforderungen enthalten gegebenenfalls einen Verweis auf Abbildungen oder Passagen im vorangegangenen Text, um die aufgestellten Behauptungen zu beweisen. #table( columns: 3, table.header( [*Anf.*], [*Umsetzung*], [*Bewertung*], ), table.cell(colspan: 3, align: center, [#link(<UseCaseInfoDegree>)[#emph("Use Case 1")]]), [@StaticLink], [Durch die Nutzung von Routen kann ein Studiengang mithilfe eines Links aufgerufen werden.], [Erfüllt #linebreak() @appRoutes], [@PDF], [In der Übersicht aller Studiengänge der Abteilung kann ein PDF für jeden Studiengang aufgerufen werden. ], [Erfüllt #linebreak() @degreeProgramOverview], table.cell(colspan: 3, align: center, [#emph("Use Case 2")]), [@SHOWMODULES], [Es können alle Module eines Studienganges angezeigt werden.], [Erfüllt #linebreak() @moduleOverviewResult], [@FILTER], [In allen Spalten steht eine Filterfunktion bereit.], [Erfüllt #linebreak() @filterResult], [@SEARCH], [Die Suchfunktion wurde erfolgreich implementiert.], [Erfüllt #linebreak() @implementSearch], [@SHOWMODULEDETAIL], [Es gibt für jedes Modul eine Detailansicht mit allen verfügbaren Informationen.], [Erfüllt #linebreak() @moduleDetailResult], table.cell(colspan: 3, align: center, [#emph("Use Case 3")]), [@LOGIN], [Im seitlichen Menü gibt es einen Login-Button.], [Erfüllt], [@LOGOUT], [Im seitlichen Menü gibt es einen Logout-Button.], [Erfüllt], [@RESETPW], [Wurde nicht umgesetzt, da Accounts in der Einführungsphase erst direkt in der Datenbank verwaltet werden. Eventuell erfolgt später eine Anbindung an die SSO-Accounts der Hochschule. <nichtUmgesetzt>], [Nicht erfüllt], [@RESETMYPW], [Wurde nicht umgesetzt (siehe #link(<nichtUmgesetzt>)[Umsetzung F9])], [Nicht erfüllt], [@EDIT], [Personen die für ein Modul verantwortlich sind, sowie die studiengangsverantwortliche Person können Module bearbeiten.], [Erfüllt #linebreak() @editModule], [@CHECKMOD], [Es wurden verschiedene Plausibilitätschecks eingebaut. Fehlerhafte Felder werden rot markiert. Der User erhält weitere Informationen über einen Tooltip.], [Erfüllt #linebreak() @plausib], table.cell(colspan: 3, align: center, [#emph("Use Case 4")]), [@MODULE], [Module können bearbeitet werden.], [Erfüllt #linebreak() @editModule], [@DUPLICATE], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], [@COURSE], [Studiengänge können verwaltet werden], [Erfüllt #linebreak() @menu], [@DUPLICATECourse], [Studiengänge können dupliziert werden. Dabei werden darin enthaltene Module und Teilmodule ebenfalls dupliziert. Ansprechpartner werden nicht dupliziert, sondern auf die bestehenden Einträge verwiesen.], [Erfüllt #linebreak() @menu], [@hideCourse], [Studiengänge können im Menü in der Abteilungsübersicht ausgeblendet werden.], [Erfüllt #linebreak() @menu], [@showHiddenCourses], [Wenn ein User angemeldet ist, werden ausgeblendete Studiengänge angezeigt. Die für nicht angemeldete User ausgeblendeten Studiengänge erhalten eine Markierung, die darauf hinweist. ], [Erfüllt #linebreak() @hiddenCourse], [@CRUSER], [Wurde nicht umgesetzt (siehe #link(<nichtUmgesetzt>)[Umsetzung F9])], [Nicht erfüllt], [@CreateSubmodules], [Teilmodule können verwaltet werden. ], [Erfüllt], [@CreateRequirements], [Vorraussetzungen haben keine eigenständige Verwaltungsmaske, sondern sind ein Teil der Modulbearbeitungsmaske und können dort bearbeitet werden. ], [Erfüllt], table.cell(colspan: 3, align: center, [#emph("Use Case 5")]), [@SHOWCHANGES], [Die Änderungen an einem Modul werden automatisch protokolliert. Dabei ist der Benutzer angegeben, sowie alle modifizierten Felder.], [Erfüllt #linebreak() @changelog #linebreak() #link(<implementChangelog>)[Unterabschnitt 4.1.2]], [@REVERT], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], [@SHOWCHANGESmisc], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], [@REVERTmisc], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], table.cell(colspan: 3, align: center, [#emph("Use Case 6")]), [@COMPARE], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], ) #imageFigure(<hiddenCourse>, "../Images/HiddenCourse.png", "Ausgeblendeter Studiengang") #imageFigure(<changelog>, "../Images/Changelog.png", "Änderungshistorie") #pagebreak() #table( columns: 3, table.header( [*Anf.*], [*Umsetzung*], [*Bewertung*], ), table.cell(colspan: 3, align: center, [#emph("Änderbarkeit")]), [@MODULAR], [Frontend und Backend nutzen wiederverwendbare Services (z. B. UserService zum Abrufen der Daten aller User). Außerdem gibt es im Frontend wiederverwendbare Komponenten (z. B. ResponsibleAvatarComponent)], [Erfüllt], [@TESTABLE], [Durch Erfüllung der Anforderungen @MODULAR, @Verantwortlichkeit, @Kopplung, @Komplex und @DepedencyInjection sollte der vorliegende Code gut testbar sein, sodass die Anforderungen @TEST und @TESTUI umgesetzt werden können.], [Erfüllt], [@Verantwortlichkeit], [Bei der Entwicklung wurde darauf geachtet, dass es für die verschiedenen Arten von Daten jeweils eigene Services gibt. Es gibt nicht eine große Klasse "DatabaseAccess", sondern einen ModuleService, einen SubModuleService, einen RequirementService und so weiter.], [Erfüllt], [@Kopplung], [Aus der Trennung von Frontend und Backend ergibt sich eine lose Kopplung, da das Frontend keine Abhängigkeit zur Datenbank hat, weil nur über die REST-Schnittstellte kommuniziert wird. Außerdem kommen die meisten Komponenten im Quellcode mit einer geringen Anzahl an Abhängigkeiten aus. Als Beispiel ist hier das ModuleGridComponent zu nennen, welches als zentrales Element der Anwendung die Module in einer Tabelle auf der Oberfläche anzeigt. Diese Komponente hat Abhängigkeiten zum ModuleService (um alle Module abzurufen), zum Router, der Activated Route und dem CourseService (um den ausgewählten Studiengang aus der URL auslesen und dessen Namen anzeigen zu können), zum AuthService (um zu ermitteln, ob der User eingeloggt ist) und zum LanguageService (um die Website in der gewünschten Sprache zu zeigen). Diese Anzahl an Abhängigkeiten ist gerechtfertigt, weil die Komponente eine zentrale Rolle in der Anwendung spielt und daher mit verschiedenen Bereichen der Anwendung interagieren muss.], [Erfüllt], [@Komplex], [Mithilfe eines externen Tools (Qodana @QodanaStaticCode) wurde die zyklomatische Komplexität der einzelnen Methoden betrachtet. Hierbei wurden keine Methoden mit einer höheren Komplexität als 10 gefunden.], [Erfüllt], [@DepedencyInjection], [In Frontend und Backend werden Abhängigkeiten mithilfe von Dependency Injection eingesetzt.], [Erfüllt #linebreak() @createEndpoints #linebreak() @uebersetzbarkeit], [@TEST], [Bisher nicht umgesetzt, aber durch @TESTABLE vorbereitet.], [Vorbereitet], [@TESTUI], [Bisher nicht umgesetzt, aber durch @TESTABLE vorbereitet.], [Vorbereitet], table.cell(colspan: 3, align: center, [#emph("Benutzbarkeit")]), [@PATH], [Der aktuelle Pfad wird in der Anwendung angezeigt. Durch Anklicken eines Elementes kann zurückgesprungen werden (beispielsweise von der Detailansicht eines Moduls zurück zur Auflistung aller Module)], [Erfüllt #linebreak() @moduleDetailResult], [@ASK], [Das Löschen von Datensätzen muss vom User bestätigt werden. Hierzu erscheint ein Popup mit den Buttons "Ja" und "Nein".], [Erfüllt #linebreak() @deleteQuery], [@SOFTDELETE], [Diese Anforderung wurde nicht umgesetzt. Das Löschen eines Datensatzes könnte in Zukunft angepasst werden, sodass nur eine Eigenschaft "deleted" auf True gesetzt wird. Beim Laden von Daten werden nur Datensätze geladen, die "deleted=false" sind. Die Oberfläche könnte angepasst werden, sodass angemeldete User auch gelöschte Elemente ansehen können.], [Konzept liegt vor], [@QUICK], [Das Generieren eines PDFs dauert recht lange. Hier wird ein Statusindikator eingesetzt, der dem User anzeigt, in welchem Status sich der Kompilierungsauftrag befindet. Abgesehen davon gibt es keine Stellen in der Anwendung, die eine erhöhte Ladezeit haben. Ein Ladebalken wurde daher nicht eingebaut, das Ziel einer guten Benutzbarkeit aber trotzdem erreicht.], [Erfüllt #linebreak() @createPdfStep2], [@ERROR], [Mögliche Fehler werden abgefangen und mithilfe einer verständlichen Fehlermeldung an den User übermittelt.], [Erfüllt #linebreak() @errorMsg], [@ERRORSOLVE],[Bisher nicht umgesetzt, aber durch @ERROR vorbereitet.],[Vorbereitet], [@RESPONSIVE],[Die Übersicht der Studiengänge, aller Module und die Moduldetails wurden für mobile Endgeräte optimiert.],[Teilweise erfüllt #linebreak() @design], [@KEYBOARD],[Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], [@SELFEXPLAIN],[Ohne eine Studie oder ähnliches ist es schwer zu beweisen, dass das System selbsterklärend ist. In der Implementierung wurde darauf geachtet, möglichst selbsterklärende Beschriftungen, Icons und Steuerelemente zu verwenden. In den Bearbeitungsmasken gibt es eine Live-Vorschau, sodass ersichtlich ist, welches Eingabefeld was verändert. Außerdem wurden an verschiedenen Stellen Tooltips, Dialoge und Einblendungen verwendet, um möglicherweise unklare Details genauer zu erklären.],[Vermutlich erfüllt #linebreak() @editModule], table.cell(colspan: 3, align: center, [#emph("Effizienz")]), [@STARTFRONTEND],[Alle Seiten im Frontend laden innerhalb einer Sekunde. Die geladenen Datenmengen werden reduziert, indem beim Laden der Modulübersicht zum Beispiel nicht direkt alle Informationen eines Moduls geladen werden. Diese werden erst geladen, sobald die Detailansicht geöffnet wird.],[Erfüllt #linebreak() @endpoints], [@STARTBACKEND],[Während der Implementierung des Systems konnte kein Zustand ermittelt werden, zu dem das Backend nach einem Fehler nicht innerhalb einer Minute neu startet.],[Erfüllt], [@DEPLOY],[Das Frontend wird mithilfe einer GitHub-Action bei jedem Push auf den Testserver deployt. Das Backend wird mithilfe eines Deploy-Skripts und einem Cronjob automatisch deployt. Diese Methodik ist auch für den Livebetrieb möglich.],[Vorbereitet], [@CLICKS],[Es wurde versucht, die Arbeitsabläufe möglichst einfach zu gestalten. Ohne größeren Aufwand ist es nicht nachprüfbar, ob diese Anforderung vollständig erledigt ist.],[Vermutlich erfüllt], table.cell(colspan: 3, align: center, [#emph("Funktionalität")]), [@TRANSLATE],[Die Anwendung und die PDFs die generiert werden stehen in Englisch und Deutsch bereit.],[Erfüllt #linebreak() @uebersetzbarkeit], [@TRANSLATEMULTIPLE],[Der Code ist so vorbereitet, dass ohne großen Aufwand weitere Sprachen hinzugefügt werden können. Aktuell liegen die Modulhandbücher nur in Englisch und Deutsch vor, weshalb die neue Anwendung auch nur in Deutsch und Englisch entwickelt wurde.],[Vorbereitet], [@lookup],[In den Bearbeitungsmasken werden Eingabefelder verwendet, welche den User bei der Eingabe unterstützen. Wenn beispielsweise eine Zahl erwartet wird, können keine Buchstaben eingegeben werden. Außerdem werden, wenn möglich, Dropdowns statt Textfeldern genutzt.],[Erfüllt #linebreak() @editModule], [@similarPdf], [Das neue PDF ähnelt dem bisherigen PDF.], [Erfüllt #linebreak() @pdfComparision], [@security], [Nur autorisierte Benutzer können datenverändernde Endpunkte verwenden.], [Erfüllt], table.cell(colspan: 3, align: center, [#emph("Übertragbarkeit")]), [@DOKBACK], [Es gibt eine Dokumentation, welche unter anderem erklärt, wie das System einzurichten ist.], [Erfüllt #linebreak() @createDocumentation], [@containerAnf], [Das neue System kann mithilfe von Podman-Containern deployt werden.], [Erfüllt #linebreak() @podman], [@austauschbarkeit], [Durch die Verwendung von Prisma ist der Zugriff auf die Datenbank abstrahiert, daher kann die tatsächliche Datenbank ohne größeren Aufwand ausgetauscht werden. Der LaTeX-Kompilierungs-Server wird über einen einzelnen REST-Endpunkt angesprochen und ist dadurch nur sehr lose gekoppelt. Das Frontend arbeitet hingegen mit mehreren REST-Endpunkten des Backends und ist daher zwar austauschbar, jedoch wäre das verglichen mit den zuvor genannten Komponenten aufwändig.], [Erfüllt], table.cell(colspan: 3, align: center, [#emph("Zuverlässigkeit")]), [@ERRORSTABLE], [Fehler die während des Testens aufgefallen sind, haben die Systeme nicht zum Absturz gebracht.], [Vermutlich erfüllt], [@reife], [Beim Erledigen der Use Cases sind keine Fehler aufgefallen.], [Erfüllt], [@robustheit], [Wurde aus zeitlichen Gründen nicht priorisiert.], [Nicht erfüllt], table.cell(colspan: 3, align: center, [#emph("Technische Anforderungen")]), [@FRONT], [Das Frontend ist eine neue Anwendung.], [Erfüllt], [@FRONT_TECH], [Das Frontend nutzt Angular.], [Erfüllt], [@BACK], [Das bestehende Backend wurde erweitert.], [Erfüllt], [@BACK_TECH], [Das Backend nutzt (weiterhin) NestJS und Prisma.], [Erfüllt], [@DB], [Die bestehende Datenbank wurde erweitert.], [Erfüllt], ) #imageFigure(<deleteQuery>, "../Images/DeleteQuery.png", "Rückfrage beim Löschen") #imageFigure(<errorMsg>, "../Images/errormsg.png", "Fehlermeldung vom error.service.ts") #pagebreak() == Zwischenfazit Nachdem die aufgestellten Anforderungen überprüft wurden, kann nun eine Aussage zum neuen System getroffen werden. Von den 64 Anforderungen wurden 15 Anforderungen nicht erfüllt. Unter den nicht erfüllten Anforderungen befinden sich keine Anforderungen mit dem Schlüsselwort "<PASSWORD>". Es wurden also alle Anforderungen, die für das System zwingend erforderlich sind, erfüllt. Aus diesem Grund ist davon auszugehen, dass das System für die in @usecases erstellten Use Cases nutzbar ist (mit Ausnahme des nur teilweise erfüllten #link(<UCRevertChanges>)[Use Case 5] und des ausgelassen #link(<UseCaseTable>)[Use Case 6]). #pagebreak() #hide("grr")
https://github.com/drupol/master-thesis
https://raw.githubusercontent.com/drupol/master-thesis/main/src/thesis/theme/infos.typ
typst
Other
#import "./colors.typ": * #let info-settings = ( info: ( prefix: none, icon: "circle-info", fill_color: umons-turquoise.lighten(90%), stroke_color: umons-turquoise, ), cite: ( prefix: none, icon: "quote-left", fill_color: rgb("#ffffff"), stroke_color: black, ), definition: ( prefix: [#underline(smallcaps[*Definition*])], icon: "highlighter-solid", fill_color: umons-faculty-sciences.lighten(90%), stroke_color: umons-faculty-sciences, ), question: ( prefix: none, icon: "circle-question", fill_color: umons-yellow.lighten(90%), stroke_color: umons-yellow, ), important: ( prefix: none, icon: "circle-exclamation", fill_color: rgb("#228B22").lighten(90%), stroke_color: rgb("#228B22").darken(20%), ), conclusion: ( prefix: none, icon: "lightbulb-solid", fill_color: umons-red.lighten(90%), stroke_color: umons-red, ), good: ( prefix: none, icon: "circle-check", fill_color: umons-grey.lighten(90%), stroke_color: umons-grey.darken(20%), ), note: ( prefix: [ *Note:* ], icon: "note-sticky", fill_color: umons-grey.lighten(90%), stroke_color: umons-grey.darken(20%), ), ); #let info-stroke(kind: "good") = info-settings.at(kind).stroke_color #let info-image(kind: "info", ..args) = { let settings = info-settings.at(kind) image("solid/" + settings.icon + ".svg", ..args, alt: settings.icon) } #let info-box( body, settings: (:), kind: "info", radius: 5pt, footer: none, icon: true, ref: none, ) = { set par( leading: 0.55em, justify: true, ) let settings = info-settings.at(kind) + settings let extra = if footer == none { none } else { v(.5em) h(1fr) text(size: .75em)[#footer] } set align(left) box( width: 0.8fr, fill: settings.fill_color, stroke: .5pt + settings.stroke_color, radius: radius, inset: 0pt, )[ #let body = if kind == "cite" { quote(attribution: extra, quotes: false)[#emph(body)] } else { body } #let contents = if icon { ( image( "../../../resources/images/" + settings.icon + ".svg", width: 32pt, ), ( { settings.prefix body extra } ), ) } else { ( { settings.prefix body extra } ) } #figure( kind: "info-box", supplement: [Info box], { set align(left) table( columns: if icon { (38pt, 1fr) } else { 1 }, inset: 10pt, stroke: none, column-gutter: 10pt, ..contents, ) }, ) #{ if ref != none { label(ref) } else { none } } ] }
https://github.com/ldq3/summary_of_OS_camp
https://raw.githubusercontent.com/ldq3/summary_of_OS_camp/master/src/main.typ
typst
#import "/global.typ": * #show link: underline #show: init #show strong: alert #show: slides #touying-outline() #include "content.typ"
https://github.com/RiccardoTonioloDev/Bachelor-Thesis
https://raw.githubusercontent.com/RiccardoTonioloDev/Bachelor-Thesis/main/Riccardo_Toniolo_BSc_thesis.typ
typst
Other
#import "./config/variables.typ": * #import "./config/thesis-config.typ": * #import "@preview/glossarium:0.4.1": make-glossary #import "@preview/codly:1.0.0": * #show: codly-init.with() #set text(hyphenate: false) #show: make-glossary #show: config.with( myAuthor: myName, myTitle: myTitle, myNumbering: "1.", myLang: myLang ) #include "structure.typ"
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/references/cross_module_alias.typ
typst
Apache License 2.0
// path: base.typ #let x = 1; ----- #import "base.typ": x as /* ident after */ ff #ff
https://github.com/dmtr-m/typst-assignments-template
https://raw.githubusercontent.com/dmtr-m/typst-assignments-template/main/README.md
markdown
# typst-assignments-template
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-A830.typ
typst
Apache License 2.0
#let data = ( ("NORTH INDIC FRACTION ONE QUARTER", "No", 0), ("NORTH INDIC FRACTION ONE HALF", "No", 0), ("NORTH INDIC FRACTION THREE QUARTERS", "No", 0), ("NORTH INDIC FRACTION ONE SIXTEENTH", "No", 0), ("NORTH INDIC FRACTION ONE EIGHTH", "No", 0), ("NORTH INDIC FRACTION THREE SIXTEENTHS", "No", 0), ("NORTH INDIC QUARTER MARK", "So", 0), ("NORTH INDIC PLACEHOLDER MARK", "So", 0), ("NORTH INDIC RUPEE MARK", "Sc", 0), ("NORTH INDIC QUANTITY MARK", "So", 0), )
https://github.com/3akev/autofletcher
https://raw.githubusercontent.com/3akev/autofletcher/main/README.md
markdown
MIT License
# autofletcher This small module provides functions to (sort of) abstract away manual placement of coordinates. See the [manual](https://raw.githubusercontent.com/3akev/autofletcher/main/manual.pdf) for usage examples. ## Credits [fletcher](https://github.com/Jollywatt/typst-fletcher)
https://github.com/mattyoung101/uqthesis_eecs_hons
https://raw.githubusercontent.com/mattyoung101/uqthesis_eecs_hons/master/pages/chapters/conclusion.typ
typst
ISC License
= Conclusion #lorem(300)
https://github.com/exusiaiwei/quarto-ilm
https://raw.githubusercontent.com/exusiaiwei/quarto-ilm/main/README.md
markdown
MIT License
<div align="center"> <h1>🎓 Quarto ILM Template</h1> <p> <b>English</b> | <a href="README.zh-CN.md">简体中文</a> </p> <!-- Badges --> <p> <img src="https://img.shields.io/badge/quarto-template-blue" alt="quarto template"> <img src="https://img.shields.io/github/stars/exusiaiwei/quarto-ilm" alt="stars"> <img src="https://img.shields.io/github/forks/exusiaiwei/quarto-ilm" alt="forks"> <img src="https://img.shields.io/github/license/exusiaiwei/quarto-ilm" alt="license"> <img src="https://img.shields.io/github/last-commit/exusiaiwei/quarto-ilm" alt="last-commit"> </p> </div> ## 📚 Table of Contents - [📚 Table of Contents](#-table-of-contents) - [🌟 About](#-about) - [✨ Features](#-features) - [📥 Installation](#-installation) - [🚀 Usage](#-usage) - [🔧 Customization](#-customization) - [🤝 Contributing](#-contributing) - [📄 License](#-license) ## 🌟 About Quarto ILM is a versatile, clean, and minimal template for non-fiction writing, adapted from the [Typst 'ilm' template](https://github.com/talal/ilm). 'Ilm' (Urdu: عِلْم), pronounced as /ə.ləm/, is the Urdu term for knowledge. This Quarto template is ideal for class notes, reports, and books. ## ✨ Features - Clean and minimal design - Title page - Table of contents - Indices for different types of figures (images, tables, code blocks) - Dynamic running footer with chapter title (top-level heading) - Support for Iosevka font (fallback to Fira Mono) ## 📥 Installation To use this template, run the following command in your terminal: ```bash quarto use template exusiaiwei/quarto-ilm ``` This will create a new directory with all the files needed to get you started. ## 🚀 Usage After installation, you can customize the template by modifying the YAML metadata in your Quarto document. Currently, the following metadata options are supported: ```yaml title: "ILM Typst Template Example" author: "<NAME>" date: "YYYY-MM-DD" abstract: "This document demonstrates the features of the ILM Typst template for Quarto." bibliography: refs.bib biblio-style: apa format: ilm-typst: default ``` ## 🔧 Customization You can further customize the template by modifying the `_extensions/ilm-typst` files. Feel free to adjust the styling and layout to suit your needs. ## 🤝 Contributing Contributions are welcome! Please feel free to submit a Pull Request or open an Issue if you have any suggestions or encounter any problems. ## 📄 License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. <div align="center"> <p> <a href="#-quarto-ilm-template">Back to Top</a> </p> </div>
https://github.com/m20027/typst-jp-conf-template
https://raw.githubusercontent.com/m20027/typst-jp-conf-template/main/main.typ
typst
MIT No Attribution
// MIT No Attribution // Copyright 2024 <NAME> #import "libs/rsj-conf/lib.typ": rsj-conf #show: rsj-conf.with( title: [Typst を使った国内学会論文の書き方 \ - 国内学会予稿集に似せたフォーマットの作成 - ], authors: [◯ 著者姓1 著者名1,著者姓2 著者名2(○○○大学),著者姓3 著者名3 (□□□株式会社)], abstract: [#lorem(80)], bibliography: bibliography("refs.yml", full: false) ) // #import "libs/rengo/lib.typ": rengo // #show: rengo.with( // title: [Typst を使った国内学会論文の書き方 \ - 国内学会予稿集に似せたフォーマットの作成 - ], // authors: [◯ 著者姓1 著者名1,著者姓2 著者名2(○○○大学),著者姓3 著者名3 (□□□株式会社)], // etitle: [How to Write a Conference Paper in Japanese], // eauthors: [\*A. First, B. Second (○○○ Univ.), and C. Third (□□□ Corp.)], // abstract: [#lorem(80)], // keywords: ([Typst], [conference paper writing], [manuscript format]), // bibliography: bibliography("refs.yml", full: false) // ) // #import "libs/mscs/lib.typ": mscs // #show: mscs.with( // title: [Typst を使った国内学会論文の書き方 \ - 国内学会予稿集に似せたフォーマットの作成 - ], // authors: [◯ 著者姓1 著者名1,著者姓2 著者名2(○○○大学),著者姓3 著者名3 (□□□株式会社)], // etitle: [How to Write a Conference Paper in Japanese], // eauthors: [\*A. First, B. Second (○○○ University), and C. Third (□□□ Corporation)], // abstract: [#lorem(80)], // keywords: ([Typst], [conference paper writing], [manuscript format]), // bibliography: bibliography("refs.yml", full: false) // ) // ソースコードブロックを表示するためのパッケージ #import "@preview/sourcerer:0.2.1": code // URL リンクにアンダーラインを入れる #show link: underline = はじめに #text("これは非公式のサンプルです.", fill: rgb(red), weight: "bold") 適宜投稿先の規定をご確認ください. 発表論文原稿を PDF でご執筆いただき,学会のホームページにアップロードしてください. このファイルはこのテンプレートの使い方を示しており,同時に発表論文の見本でもあります. 執筆の時は以下の説明をよく読み,執筆要項に従ったフォーマットでご提出ください. アップロードした PDF がそのまま公開されます. というような説明が書かれるであろうテンプレートを作ってみました. 本稿では,このテンプレートファイルの使い方および Typst による執筆作業の概要について解説します. この原稿のソースコードは #link("https://github.com/kimushun1101/typst-jp-conf-template") で公開しております. = テンプレートファイルの使い方 テンプレートファイルは以下の手順で使うことができます. == Typst のインストール - Windows の場合\ Windows PowerShell から以下のコマンドでインストールできる. #code( ```sh winget install --id Typst.Typst ``` ) - Mac の場合\ Homebrew を使ってインストールできる. #code( ```sh # Homebrew のインストール /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Typst のインストール brew install typst ``` ) - Rust からインストール\ たとえば Ubuntu の場合は,Rust の cargo を使ってインストールする方法が簡単と思われます. #code( ```sh # Rust のインストール curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Typst のインストール cargo install --git https://github.com/typst/typst --locked typst-cli ``` ) == サンプルのビルド + GitHub に慣れていればテンプレートリポジトリを使用して,新しいリポジトリを作成してクローン.不慣れであれば zip ダウンロードして解凍してください. + シェルで対象のディレクトリに移り #code( ```sh typst compile main.typ ``` ) とコマンドすれば main.pdf をビルドできます. == Visual Studio Code による執筆 コマンドライン入力に忌避感のある方は(またそうでない方も) Visual Studio Code (VS Code) の使用をオススメします. VS Code の拡張機能である Typst LSP と Typst Preview をインストールすれば,保存と同時に PDF ファイルが作成され,編集中においても現在の出力結果を常に確認することができます. = 原稿の体裁 == レイアウトとフォント 用紙サイズは A4,縦250 mm,横170 mm の枠内に収まるようにしてください. 余白は,上 20 mm,下27 mm,左20 mm,右20 mm とします. タイトル,著者,アブストラクトはシングルコラム,本文はダブルコラムです. アブストラクトは左右に 0.7 cm 余白を取っています. フォントの設定は @tab:fonts の通りです. ここで,ゴシック体とは "MS PGothic", "Hiragino Kaku Gothic Pro", "IPAexGothic", "Noto Sans CJK JP" のいずれか,明朝体とは ""MS PMincho", "Hiragino Mincho Pro", "IPAexMincho", "Noto Serif CJK JP" のいずれかで見つかるものが採用されます. これらのフォントがお使いのコンピュータになければインストールするか,代わりに使いたいフォントがあればソースコードの方に追加してください. 以下のコマンドで使用可能なフォント一覧を確認できます. #code( ```sh typst fonts ``` ) #figure( placement: top, caption: [フォントの設定], table( columns: 3, stroke: none, table.header( [項目], [サイズ (pt)], [フォント], ), table.hline(), [#text(18pt, "タイトル", font: ("MS PGothic", "Hiragino Kaku Gothic Pro", "IPAexGothic", "Noto Sans CJK JP"))], [18], [ゴシック体], [#text(12pt, "著者名", font: ("MS PGothic", "Hiragino Kaku Gothic Pro", "IPAexGothic", "Noto Sans CJK JP"))], [12], [ゴシック体], [#text(12pt, "章タイトル", font: ("MS PMincho", "Hiragino Mincho Pro", "IPAexMincho", "Noto Serif CJK JP"))], [12], [ゴシック体], [節,小節,本文], [10], [明朝体], [#text(9pt, "参考文献")], [9], [明朝体], ) ) <tab:fonts> 今回使用しているテンプレートは "rsj-conf/lib.typ" に記載されています. このテンプレートのソースコードは charge-ieee と abiding-ifacconf というテンプレートを参考にして,第41回日本ロボット学会学術講演会のフォーマットに近づけて作成しました. テンプレートの検索は Typst Universe (#link("https://typst.app/universe")) ででき,そこで掲載されているテンプレートのソースコードは #link("https://github.com/typst/packages/tree/main/packages/preview") で見ることができます. == 数式・図・表 数式番号は @eq:system のように数式の右側に, 図のタイトルは "@fig:quadratic タイトル名"のように図の下部に,表のタイトルは "@tab:fonts タイトル名" のように図の上部につきます. 投稿先に応じてキャプションの言語は日本語や英語で指定されるかと思いますので,指示に従ってください. == 特殊な章 謝辞と参考文献は他の章とは異なり,章番号が自動でつかないように設定しています. また,参考文献は "参 考 文 献" とスペースで区切り,中央揃えにしています. = 編集の仕方 == 論文情報の編集 main.typ の文頭にある以下のコードを解説します. #code( ```typ #import "libs/rsj-conf/lib.typ": rsj-conf #show: rsj-conf.with( title: [Typst を使った国内学会論文の書き方 \ - 国内学会予稿集に似せたフォーマットの作成 - ], authors: [◯ 著者姓1 著者名1,著者姓2 著者名2(○○○大学),著者姓3 著者名3 (□□□株式会社)], abstract: [#lorem(80)], bibliography: bibliography("refs.yml", full: false) ) ``` ) 1 行目はこの原稿の体裁を設定するためのソースコードを import しています. これは "libs" ディレクトリ以下にあります. 2 行目は,ソースコードやコマンドなどを綺麗に表示するための "code" 関数を呼び出すために import しています. こちらは "libs" ディレクトリにはありません. Typst Universe から自動でインストールされたものを使っております. その他,Typst Universe で使いたい packages があるとここで同様に import しておくとよいでしょう. // 今回 rsj-conf という論文体裁手元のファイルを使用しておりますが,テンプレートファイルも登録することができます. // 将来的には Typst Universe に登録しようと思います. 4 行目では,1行目で読み込んだ関数を使用して,原稿体裁を作成しています. 5 行目ではタイトルを,6行目では著者一覧を,7 行目ではアブストラクトを記載します. 各内容の中で改行をしたい場合には,`\` で改行してください. `lorem` 関数は英文のダミーテキストを作成してくれる関数です. 8 行目の参考文献については本章の最後の節で説明します. また,異なるテンプレートも用意してみました. コメントアウトで切り替えてみてください. #code( ```typ #import "libs/rengo/lib.typ": rengo #show: rengo.with( title: [Typst を使った国内学会論文の書き方 \ - 国内学会予稿集に似せたフォーマットの作成 - ], authors: [◯ 著者姓1 著者名1,著者姓2 著者名2(○○○大学),著者姓3 著者名3 (□□□株式会社)], etitle: [How to write a conference paper in Japanese], eauthors: [\*A. First, B. Second (○○○ Univ.), and C. Third (□□□ Corp.)], abstract: [#lorem(80)], keywords: ([Typst], [conference paper writing], [manuscript format]), bibliography: bibliography("refs.yml", full: false) ) ``` ) このフォーマットですと,`etitle`, `eauthors`, `keywords` が追加されており,それぞれ英語タイトル,英語著者名,キーワードを意味しています. `keywords` は`()` のリスト形式で指定されていることに注意してください. 逆にいうと,投稿先によって変更しなければ行けない部分はここだけです. == 基本的な文法 章は `=`,節は `==`,小節は `===` で始めます. 改段落は LaTeX と同じく改行を 2 つ以上挟みます. 数字つき箇条書きは `+` で,数字なしの箇条書きは `-` を文頭につけて書くことができます. テキストの装飾は text 関数で行えます. LaTeX に慣れている方は,Typst 公式ページの #link("https://typst.app/docs/guides/guide-for-latex-users/") を読むと雰囲気がつかめると思います. == 数式 数式番号をつけるような中央揃えの数式は,最初の`$` の後ろと閉じの`$` の前にスペースを挟み #code( ```typ $ dot(x) &= A x + B u \ y &= C x $ <eq:system> ``` ) のように書き,文中に書く数式は,`$` の前後にスペースを挟まず #code( ```typ $x in RR^n$ ``` ) というように書きます. ここで `<eq:system>` は引用するときのラベルになります. 出力例はつぎの通りです. 以下のシステムを考える. $ dot(x) &= A x + B u \ y &= C x $ <eq:system> ここで $x in RR^n$ は状態,$u in RR^m$ は入力,$y in RR^l$ は出力,$A in RR^(n times n)$,$B in RR^(n times m)$.および $C in RR^(l times n)$ は定数行列である. このシステムに対して,目標値 $r(t)$ に対する偏差を $e = r - y$ とした以下の PI 制御器を使用する. $ u = K_P e + K_I integral_0^t e d t $ <eq:PI-controller> ただし,$K_P$ と $K_I$ はそれぞれ比例ゲイン,積分ゲインとする. == 図と表 本稿を執筆時のバージョン Typst 0.11.0 では,PNG, JPEG, GIF, SVG の形式のイメージデータを挿入することができます. 例としては以下の通りです. #code( ```typ #figure( placement: bottom, image("figs/quadratic.svg", width: 90%), caption: [$x^2$ のグラフ], ) <fig:quadratic> #figure( placement: bottom, image("figs/sqrt-and-sin.png", width: 90%), caption: [$sqrt(x)$ と $sin x$ のグラフ], ) <fig:sqrt-sin> ``` ) ここで placement は,紙面の上 (top) に寄せるか下 (bottom) に寄せるかを決められます.言及している文章に近い方に調整してください. #figure( placement: bottom, image("figs/quadratic.svg", width: 90%), caption: [$x^2$ のグラフ], ) <fig:quadratic> #figure( placement: bottom, image("figs/sqrt-and-sin.png", width: 90%), caption: [$sqrt(x)$ と $sin x$ のグラフ], ) <fig:sqrt-sin> @tab:fonts は以下で記述されております. #code( ```typ #figure( placement: top, caption: [フォントの設定], table( columns: 3, stroke: none, table.header( [項目], [サイズ (pt)], [フォント], ), table.hline(), [タイトル], [18], [#text(18pt, "ゴシック体", font: ("MS PMincho", "Noto Sans CJK JP", "IPAexGothic"))], [著者名], [12], [#text(12pt, "ゴシック体", font: ("MS PMincho", "Noto Sans CJK JP", "IPAexGothic"))], [章], [12], [#text(12pt, "ゴシック体", font: ("MS PMincho", "Noto Sans CJK JP", "IPAexGothic"))], [本文], [10], [明朝体], ) ) <tab:fonts> ``` ) table の columns の数に応じて,文字列の配列が自動的に整列されます. `stroke: none` は枠線を消しています.`table.hline()` を挟むとその位置に横線を引けます. == 参考文献 参考文献は `refs.yml` に記載してください. Hayagriva という YAML 形式のフォーマットに従っています. 編集するだけであれば特に解説する必要はないと思います. 詳細が気になる方は #link("https://github.com/typst/hayagriva") をご参照ください. 参考文献の体裁は `libs/rsj-conf/bib.csl` で制御しています. これは Citation Style Language という XML 形式で記述されております. CSL ファイルは著者が編集する必要はありませんが,詳細が気になる方は #link("https://citationstyles.org/") をご参照ください. 日本語論文として重要な点は,CSL ファイルでは Hayagriva で記述された `language` の属性を見て,著者表示を"カンマ区切りのみ"にするか"カンマ区切り+最終著者の前にand" にするかを決定している点です. したがって,英語文献だけでしたら YAML ファイルの代わりに bib ファイルも使用することができます. 文献内で引用された順番にフォーマットを整えて自動で参考文献の章が作られます. 引用の方法については後述します. 完成原稿では推奨されませんが,引用されていない論文も記載したい場合には full: true にすれば,すべての文献が出力されます. == 引用 引用は "\@label" と記述することで,数式であれば @eq:system,図であれば @fig:quadratic,表であれば @tab:fonts,参考文献であれば @kimura2015asymptotic のように表示されます. 参考文献は連続して引用すると @kimura2017state @kimura2021control @kimura2020facility @khalil2002control @sugie1999feedback @shimz2022visually と繋げられて表示されます. 文法上では特に規則はありませんが,個人的にはラベルの命名規則として,図の場合には "fig:" から,表の場合には"tab:" から始めるようにラベル名を設定しており,参考文献のラベルは "著者名発行年タイトルの最初の単語"で名付けております. = おわりに 筆者の理解や表現が誤っている箇所もあるかと思います. #link("https://github.com/kimushun1101/typst-jp-conf-template")[GitHub] を通して,Issues や Pull Reqests を歓迎しております. 日本語での投稿で構いません. 誤字脱字や文法,表現など細かい修正でも大変ありがたいです. 筆者は,Typst が普及するためには学会のフォーマットで配布されることが不可欠だと感じています. 異なる学会のフォーマットも随時 `libs` ディレクトリに追加していこうと思っております. これらのファイルがTypst が普及の一助となれば幸いです. = 謝辞 謝辞には章番号が振られないように設定しております. 「この研究は☆☆☆の助成を受けて行われました.」や「〇〇〇大学との共同研究です.」 みたいな文章が書かれることを想定しています. 最後までお読みいただき誠にありがとうございました.
https://github.com/JJ-IsShort/typst-math-paper
https://raw.githubusercontent.com/JJ-IsShort/typst-math-paper/main/site/template.typ
typst
// The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project(title: "", authors: (), body) = { // Set the document's basic properties. set document(author: authors, title: title) // set page(numbering: "1", number-align: center) set page(width: 595.28pt, height: auto, margin: (top: 2.5cm, bottom: 2.5cm, left: 2.5cm, right: 2.5cm)) set text(font: "Linux Libertine", size: 15pt, lang: "en") set par(justify: true, leading: 1em) body }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/page-00.typ
typst
Other
// Just empty page. // Should result in auto-sized page, just like nothing. #page[]
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/typst_packages/mtgstory/0.2.0/mtgstory.typ
typst
#let conf( title, set_name: "Unknown set", story_date: datetime(day: 05, month: 08, year: 1993), author: "Unknown author", doc ) = { let header = [ #grid( columns: (1fr, 1fr), gutter: 2em, [*#title\ by #author*], align(right)[*#set_name*], ) #line(length: 100%) ] let footer = [ #align(center)[#counter(page).display("1")] #{ set align(center) set text(fill: gray) [All stories at #link("github.com/polarkac/MTG-Stories")] } ] set document(title: title, author: author, date: story_date) set par(justify: true) set page(paper: "a4", header: header, header-ascent: 15%, footer: footer, margin: (top: 3.0cm)) [ #{ set text(size: 2.5em) set align(center) heading(level: 2, title) author } #{ set text(size: 1.5em) set align(center) [From set #emph[#set_name]\ #story_date.display("[day]. [month]. [year]")] } #set heading(outlined: false) #doc ] }
https://github.com/Besthope-Official/backend
https://raw.githubusercontent.com/Besthope-Official/backend/master/camp/qa/qa.typ
typst
#import "@preview/cuti:0.2.1": show-cn-fakebold #show: show-cn-fakebold #let title = [2024奇点后端部面试] #set text(font: ("Source Han Serif SC")) #set page( header: align(right + horizon, title), background: image("backend_logo_opacity_0.4.png", fit: "cover", width: 30%), numbering: "1", number-align: right, ) #align(center, text(20pt)[ *#title* ]) #show link: underline = 前情提要 在正式加入部门之前,这一次,我们希望通过一组面试题来了解大家的实际情况:它不是考核性的,面试题并不关注大家的知识储备,毕竟大家都是新生,它更像是一份文档、一个教程——我们希望通过这份材料来了解大家的*自学能力和思维能力*,同时也让大家能对后端开发的工作有大致了解。 我们同时也提供了一份免试题,供那些具有*丰富 Web 开发*经验的同学参考。如果你选择免试任务,我们不妨先来花些时间聊聊。 最后,祝你好运,享受头脑风暴吧! = 面试题 设计类似微信红包的后端接口架构。 == 逻辑实现 我们把红包系统拆成四步:发红包、包红包、抢红包、拆红包。 发红包只需要指定红包金额和人数。 红包金额的分配算法是一个简单的*取随机数*。一种实现是,下限是一分钱,上限是红包剩余总额平分后的两倍。 抢和拆红包是分开的。经常出现的一种情况,抢了红包——红包被分完了。 == 性能调优 某些游戏公司的服务器经常被人诟病“土豆服务器”,崩溃、卡帧、延迟——另外的一些场景,例如,大麦网抢票、12306抢车票,这些系统在流量访问上的显著特征是什么?你觉得抢红包系统会出现哪些问题? 针对大流量的场景,后端常用的优化方式有: === 缓存 *数据库*在后端的任务是*持久化数据*,将一条条数据存放在服务器的*硬盘*上。 但硬盘读写是一个耗时的任务,你看到的服务器卡死,很有可能是因为对应数据库处理不过来而导致的读写锁冲突、死锁,甚至“雪崩”——相比之下,*内存*的读写速度要至少快 100 倍,而这是由*硬件特质*和特殊的*缓存 Cache*机制保证的。 前端会保存静态资源(图片,样式……)作为浏览器缓存;而对于那些实时的数据,在后端的实际应用场景中,通常将缓存数据库(例如 *Redis*)作为中间层: - 对于*读*操作:先尝试从缓存中读取数据,如果没有(*缓存未命中*),再从数据库中读取。 - 对于*写*操作:先将数据写入缓存,然后*异步*地批量写入数据库。 === 异步 异步的思想很简单:将耗时的操作(例如网络请求、数据库查询)放到后台*线程*中执行,而不阻塞主线程。 实现异步的重要机制之一是*消息队列*。用食堂取餐来类比,它允许顾客(消息*生产者*)在点单后不必等待,可以去做其他事情(比如找座位、聊天等),同时允许后厨(消息*消费者*)按照消息队列的顺序处理订单、*发布*取餐通知,而顾客只需*订阅*,关注自己有没有叫到号。 #figure(grid( rows: 2, gutter: 2mm, image("no-mq.png", width: 75%), image("with-mq.png", width: 75%) ), caption: "异步优化接口性能的例子:用户注册" ) === 负载均衡 通过*集群(分布式系统)*水平拓展服务器来分摊接口流量。通俗来说就是增加服务器的数量。 通常来说会有一个负载均衡服务器(例如Nginx)来处理请求:它会根据各个服务器的负载情况,或按照某些规则(例如根据数据索引来选择不同数据库,*SET化架构*),将请求分发到不同的服务器上。 === 其它方式 思考下还有什么办法能够进行性能优化。 == 设计单元测试 至此,你的系统设计完成了。随之而来的是一个我们更希望关注的问题: 你的程序怎样才算是正确的?换言之,你要怎么测试你的代码是否正确、bug-free? 确保你的讨论是充分的。思考一下,你还需要考虑哪些潜在的 corner cases(特例)?怎么设计针对大流量的压力测试? = \*免试题 SWUFE-OJ 是奇点工作室开发部正在开发的在线 OJ 系统,未来可能会作为本校使用的 OJ 系统。它使用 Python Django 作为后端框架,Vue 3 作为前端框架进行开发。它目前的版本在 GitHub 上开源。 获取项目,利用 Git 工具克隆到本地 ``` git clone https://github.com/SingularityLab-SWUFE/SWUFE-OJ-Backend.git ``` 在以下任务中任选其一完成,并在新的分支发起 Pull Request 提交。 == 项目部署 为该项目添加 dockerfile,使得项目可以部署到 Docker 容器中。 你需要了解 Docker 的基本概念,以及如何编写 Dockerfile。集成的服务除了本 Python 后端以外,还需要包含: MySQL、Redis,以及一个外部的测评系统(目前采用的是 QDUOJ 使用的 `JudgeServer`)。 == 模块开发 为该项目添加社区系统模块,使得用户可以发帖、回帖、点赞、评论等。 - 你需要提交一份接口文档,描述该模块的功能、各个接口的路由、请求参数、返回结果等。 - 你的代码需要编写功能单元测试,覆盖模块里的路由函数,并通过测试。 - 你的代码应当符合项目的整体编码风格。 = 附录 面试题#link("https://www.zybuluo.com/yulin718/note/93148?spm=a2c6h.12873639.article-detail.27.42947521iiarNM")[参考答案]:微信从财付通拉取金额数据,生成个数/红包类型/金额,放到redis集群里,app端将红包ID的请求放入请求队列中,如果发现超过红包的个数,直接返回。根据红包的逻辑处理成功得到令牌请求,则由财付通进行一致性调用,通过像比特币一样,两边保存交易记录,交易后交给第三方服务审计,如果交易过程中出现不一致就强制回归。
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/1.typ
typst
#import "../conf.typ": * = Теорема Больцано-Вейерштрасса и критерий Коши сходимости числовой последовательности == Теорема Больцано-Вейерштрасса #definition[ Пусть имеется правило, которое каждому натуральному числу $n$ ставит в соответствие некоторое $x_n$ из множества $G$. Тогда *последовательностью* называется множество всевозможных упорядоченных пар $(n, x_n), n in NN$. ] #definition[ Последовательность $seq(x)$ называется *ограниченной сверху (снизу)*, если #eq[ $exists M (m): x_n <= M$ ($x_n >= M$) $forall n in NN$. ] ] #definition[ Последовательность $seq(x)$ называется *ограниченной*, если она ограничена и сверху, и снизу. ] #definition[ Последовательность называется *строго возрастающей (убывающей)*, если #eq[ $forall n in NN : x_n < x_(n + 1)$ ($x_n > x_(n + 1)$). ] ] #definition[ Последовательность $seq(idx: k, y)$ называется *подпоследовательностью* последовательности $seq(x)$, если #eq[ $forall k in NN : exists n = n_k : y_k = x_n_k$, ] где последовательность $seq(idx: k, n)$ - строго возрастающая. Эта последовательность обозначается $seq(idx: k, x_n)$. ] #definition[ Последовательность отрезков ${[a_n, b_n]}_(n = 1)^oo$ называется *последовательностью вложенных отрезков*, если #eq[ $forall n in NN : [a_n, b_n] supset [a_(n + 1), b_(n + 1)]$. ] ] #theorem( "Принцип Кантора вложенных отрезков", )[ Всякая последовательность вложенных отрезков ${[a_n, b_n]}_(n = 1)^oo$ имеет непустое пересечение, то есть #eq[ $sect.big_(n = 1)^oo [a_n, b_n] != emptyset$ ] ] #definition[ Число $x_0$ называется *пределом последовательности* $seq(x)$, если #eq[ $forall epsilon > 0 : exists N_epsilon in NN : forall n >= N_epsilon : |x_n - x_0| < epsilon$. ] ] #theorem("Больцано-Вейерштрасса")[ Из каждой ограниченной последовательности можно выделить сходящуюся подпоследовательность. ] #proof[ Пусть $seq(x)$ -- рассматриваемая ограниченная последовательность, то есть #eq[ $exists a_1, b_1 in RR: forall n in NN : space a_1 <= x_n <= b_1$ ] Заметим, что один из отрезков $[a_1, (a_1 + b_1) / 2], [(a_1 + b_1) / 2, b_1]$ содержит бесконечно много элементов последовательности. Пусть $[a_2, b_2]$ -- тот из отрезков, который содержит бесконечно много элементов. Продолжая данный трюк счётное количество раз, получим последовательность вложенных отрезков ${[a_n, b_n]}_(n = 1)^oo$. Также заметим, что данные отрезки стягиваются: #eq[ $0 < b_n - a_n = (b_1 - a_1) / 2^n$ ] Тогда по принципу Кантора: #eq[ $sect.big_(n = 1)^oo [a_n, b_n] = {c}$ ] Осталось построить подпоследовательность, будем брать $x_n_k in [a_k, b_k]$, причём так, чтобы $n_k > n_(k - 1)$. Очевидно, $n_1 = 1$. Существование предела также очевидно: #eq[ $0 <= abs(c - x_n_k) <= b_k - a_k = (b_1 - a_1) / 2^k ->_(k -> oo) 0$ ] ] == <NAME> #definition[ Последовательность $seq(x)$ называется *фундаментальной*, если #eq[ $forall epsilon > 0 : exists N in NN : forall n > N : forall p in NN : space abs(x_(n + p) - x_n) < epsilon$ ] ] #theorem("Критерий Коши сходимости числовой последовательности")[ Числовая последовательность сходится $<=>$ она фундаментальна. ] #proof[ $=>$ По определению предела: #eq[ $exists l in RR : forall epsilon > 0 : exists N in NN : forall n > N : space abs(x_n - l) < epsilon / 2$ ] Тогда по неравенству треугольника в условиях предела: #eq[ $abs(x_(n + p) - x_n) = abs(x_(n + p) - l + l - x_n) <= abs(x_(n + p) - l) + abs(x_n - l) < epsilon$ ] $arrow.l.double$ Вначале докажем, что из фундаментальности следует ограниченность: #eq[ $epsilon := 1 : exists N in NN : forall n > N : forall p in NN : space abs(x_(n + p) - x_n) < 1$ ] Тогда заметим, что #eq[ $forall n in NN : min(x_1, ..., x_N, x_(N + 1) + 1) <= x_n <= max(x_1, ..., x_N, x_(N + 1) + 1)$ ] Тогда из ограниченной последовательности $seq(x)$ по теореме Больцано-Вейерштрасса достанем сходящуюся подпоследовательность: #eq[ $exists seq(idx: k, x_n) : exists l : forall epsilon > 0 : exists K(epsilon) in NN : forall k > K(epsilon) : space abs(x_n_k - l) < epsilon / 2$ ] Также по определению фундаментальности: #eq[ $forall epsilon > 0 : exists N(epsilon) in NN : forall n > N(epsilon) : forall p in NN : space abs(x_(n + p) - x_n) < epsilon$ ] Объединим эти два условия и получим требуемое: #eq[ $forall epsilon > 0 : exists N_0 = max(N(epsilon), n_(K(epsilon) + 1)) : forall n &> N_0 : \ abs(x_n - l) = abs(x_n - x_n_(K(epsilon) + 1) + x_n_(K(epsilon) + 1) - l) &<= abs(x_n - x_n_(K(epsilon) + 1)) + abs(x_n_(K(epsilon) + 1) - l) < epsilon$ ] ]
https://github.com/rem3-1415926/Typst_Thesis_Template
https://raw.githubusercontent.com/rem3-1415926/Typst_Thesis_Template/main/appendix/app1.typ
typst
MIT License
= Appendix One <app:one> == sub a #lorem(30) == sub b #lorem(30) === subsub b-a #lorem(30)
https://github.com/pedrofp4444/BD
https://raw.githubusercontent.com/pedrofp4444/BD/main/report/content/[2] Levantamento e Análise de Requisitos/validacao.typ
typst
#let validacao = { [ == Análise e Validação Geral dos Requisitos Como foi previamente referido, nesta última fase, o levantamento e organização dos requisitos sofreu um processo rigoroso e crucial de validação da sua consistência e integridade. Deste modo, atendeu-se aos resultados do Inquérito Estatístico de Opinião e à reunião final de validação para se entender as alterações necessárias relativamente aos requisitos que mais discordâncias despertaram. Durante a reunião final, cuja ata se encontra em anexo (anexo 4), todos os requisitos anteriormente levantados foram rigorosamente avaliados e aprovados pelos membros da equipa “Quatro em Linha”, representantes e detetives da _Lusium_. Os representantes da _Lusium_ referiram a alteração de algumas das características de um funcionário, sendo esta a substituição dos números de identificação, nomeadamente, o número de identificação fiscal (NIF), o número de identificação bancária (NIB) e o número de segurança social (NSS) para apenas o número de identificação fiscal (NIF), dado o âmbito do projeto, o que foi aprovado. <NAME> sugeriu a alteração da informação do minério previsto para minério mínimo previsto. <NAME>, representante da _Lusium_, respondeu que seria uma alteração possível, apenas teriam de comunicar essa alteração aos técnicos que iriam avaliar os terrenos. Por último, <NAME>, detetive da B.E.L.O, pediu o acréscimo de um terceiro estado para o suspeito, sendo este “em investigação”, o que também foi unanimemente aprovado. Assim sendo, a equipa “Quatro em Linha” tem agora a devida certeza que os requisitos se encontram em conformidade com as expectativas dos representantes da _Lusium_ e dos detetives da B.E.L.O, conseguindo assegurar que a implementação futura do sistema de gestão de base de dados poderá ser corretamente efetuada sem quaisquer ambiguidades e defeitos. Após esta validação e correção, é então seguro passar para uma fase posterior onde será desenvolvido o modelo concetual, fundamentado pelos requisitos definidos. ] }