repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/Toniolo-Marco/git-for-dummies | https://raw.githubusercontent.com/Toniolo-Marco/git-for-dummies/main/README.md | markdown | # Git for dummies
Una piccola guida su come organizzare e gestire il repository per il corso di Advanced Programming, su come usare git, Github e le GitHub Actions.
Il file pdf è disponibile nella sezione Releases a destra.
# Typst per VS Code (Linux)
La guida è scritta in [Typst](https://typst.app/docs/),
Per compilare automaticamente il file `main.typ`, con i file dei capitoli aggiornati, è presente una task che controlla i file `.typ` modificati e ricompila solo il main. Questa task viene eseguita all'apertura della cartella del progetto. È necessario avere installato `cargo` e `watchexec-cli`; rispettivamente con:
curl https://sh.rustup.rs -sSf | sh
cargo install watchexec-cli
Per avere una preview del file `main.typ` è utile utilizzare l'estensione [Tinymist](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) di VS Code.
Un'altra estensione consigliata per visualizzare i PDF all'interno di VS Code è [VS Code PDF](https://marketplace.visualstudio.com/items?itemName=tomoki1207.pdf).
|
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas7/4_Stvrtok.typ | typst | #let V = (
"HV": (
("","Ne ktomú vozbraňájemi","Bohorazúmija slávniji apóstoli rálom vozďílavše zémľu vsjú, vírnych mnóžestvo vozrastíste."),
("","","Strastéj mojích razrušíte zímu, i tišinú mi vozsijájte, čístaho prolítija, blažénniji apóstoli."),
("","","Jáko učenicý Slóva, ot nesmýslstva privedóste k rázumu Bóžiju jazýkov sobóry."),
("","","Jákože préžde izbávil jesí ótče, vojevódy umréti imúščyja, molítvami tvojími Nikólaje, tákožde i nýňi nás spasí."),
("","","Íže víroju i ľubóviju vsjá prizyvájuščyja, i pojúščyja ťá vseblažénne svjatíteľu Nikólaje, izbávi pečálej."),
("","","Hláda i hubíteľstva, trúsa i skorbéj, i vsjákija núždy svobodí rabý tvojá, svjatíteľu premúdre Nikólaje."),
("Bohoródičen","","Moľbú prinesí tvojích ráb k tvojemú Sýnu vsečístaja, da spasét vsjá, jáže sozdá."),
),
"S": (
("","","Apóstoli slávniji, stolpí cérkóvniji, ístiny propovídnicy, svitíla súšče svítlaja, vý ohném duchóvnym vsjáku prélesť popalíste, čelovíčeskij ród víroju prosvitíste. Ťímže mólim vý: molíte Spása i Bóha nášeho, umiríti mír, i spastí dúšy náša."),
("","","Apóstoli Christóvy, ďílateli Spásovy, krest úbo jákože rálo na rámich nosjášče, oľaďívšuju zémľu ídoľskoju prélestiju očístivše, i víry slóvo vsíjaste: dostójno počitájemi jesté svjatíji Christóvy apóstoli."),
("Múčeničen","","Vsechváľniji múčenicy, ovčáta duchóvnaja, vsesožžénija slovésnaja. žértvy prijátny, blahouhódny Bóhovi, vás ni zemľá sokrý, no nébo priját. Vý, ánhelom sopričástnicy býste. S nímiže molíte, mólim vý, Spása i Bóha nášeho, umiríti mír, i spastí dúšy náša."),
("Bohoródičen","","Jedínu po roždeství prečístuju Ďívu vospojím, jáko máter Bóha Slóva, hlahóľušče: sláva tebí."),
),
)
#let P = (
"1": (
("","","Mánijem tvojím na zemnýj óbraz preložísja, préžde udoborazlivájemoje vodnóje jestestvó Hóspodi: ťímže nemókrenno pišešéstvovav Izráiľ, pojét tebí písň pobídnuju ."),
("","","Vodámi životóčnymi Ďívo, napój istájavšuju dúšu mojú znójem hrichóvnym, jáko da klás plodonósen vozraščú čístaja, božéstvennaho umilénija."),
("","","Odoždí mi čístaja, kápli umilénija ščedrótnymi kápľami, ímiže otmýju otrokovíce, vsjú dušévnuju skvérnu, ot nevňátija jéj pribývšuju."),
("","","Tý soďíteľa tvojehó vo utróbi prijémši, bez tlí rodilá jesí, mladénca Bóha súšča bývšaho, stránno čúdo, rabó i Máti jesí, Vladýčice beznevístnaja."),
("","","Izbáviteľa čelovíčeskomu ródu, i svobodíteľa i Spása, Christá nám rodilá jesí, Ďívo Máti prečístaja: ťímže jávi ťá znájušče, chodátaicu žízni víčnyja slávim."),
),
"3": (
("","","V načáľi nebesá vsesíľnym slóvom tvojím utverždéj Hóspodi Spáse, i vseďíteľnym i Bóžijim Dúchom vsjú sílu ích, na nedvížimim mjá kámeni ispovídanija tvojehó utverdí."),
("","","Ťilésnuju bahrjanícu ot tvojích prečístych krovéj obahrív cár vsích, i sijú nosív kromí tľínija jestestvóm, Bóh že i čelovík, ot tebé prójde Ďívo, imíja cárstvo neizmínno."),
("","","Jáko sokróvišče blahích, i neizrečénnych Ďívo, dánnoje vsím ot Bóha, podajéši nám nezavístnoje blahodáti, čudésnyja dáry, v napástech i bidách i v némoščech, moľáščymsja tí."),
("","","Ťá Danijíl čúdnyj províďa hóru čístaja, ot nejáže kámeň otsičésja Christós, sokruší bisóvskija istukány. Ťímže jáko vsích dóbrych pisnoslóvim vinú, izbávleni roždestvóm tvojím."),
("","","Bohohlásnyj ťá ňikohda províďi svítok, v némže Slóvo napisásja čístaja, pérstom Ótčim. Ťímže molísja v knízi napisáti mjá žízni, lukávoje pisánije hrichóv mojích rasterzávši."),
),
"4": (
("","","Ótča ňídra ne ostávľ, i sošéd na zémľu Christé Bóže, tájnu uslýšach smotrénija tvojehó, i proslávich ťá jedíne čelovikoľúbče."),
("","","Molítvu k róždšemusja iz tebé Bohoródice, sotvorí, jáko da obrjáščem pómošč vo vrémja obstojánija, íže strásti tohó slávjaščiji."),
("","","Míro iz tebé presvjatája čístaja, izlijávšejesja, soďíteľ jestestvá, blahovónija ispólni vsjáčeskaja božéstvennymi razumíňmi, i smrádnuju lésť prohná."),
("","","Jáko mýslennuju ľístvicu čístaja, postavléj ťá súščym na zemlí Christ<NAME>, tobóju k nebésnym božéstvennym ďijánijem vírnyja vozvódit, jáko milosérd."),
("","","Oťahčén vrémenem mnóhim hrichóvnym, blahája, zovú ti: očiščénije mí javísja, Bóha róždšaja, míra vzémľuščaho prehrišénija."),
),
"5": (
("","","Hóspodi Bóže mój, ot nóšči útrenevav tebí moľúsja: podážď mí ostavlénije prehrišénij mojích, i k svítu tvojích poveľínij putí mojá naprávi, moľúsja."),
("","","Máti čelovikoľúbca i Bóha, prepítaja Bohoródice, víroju ťá i ľubóviju písňmi voschvaľájuščemu prísno, očiščénije tvojími moľbámi prehrišénij mojích nizposlí mňí."),
("","","Prečístaja Bohoródice, prijátelišče súšči neizmínnaho svíta, i chrám božéstvennyja zarí, mojú dúšu omračénnuju, svítom tvojím prosvití, moľúsja."),
("","","Hóspodi Bóže mój, íže býti čelovík izvólivyj, moľúsja tí: blahovolí spastí mjá blúdnaho, rádi čísto róždšija ťá Ďívy, i čístyja otrokovícy."),
("","","Vladýčice Bohomáti, mojích prehrišénij podážď proščénije, jáže žízň ipostásnuju mírovi róždšaja preneporóčnaja."),
),
"6": (
("","","Plávajuščaho v molví žitéjskich popečénij, s korablém potopľájema hrichí, i dušetľínnomu zvírju primetájema, jáko Jóna Christé, vopijú tí: iz smertonósnyja hlubiný vozvedí mja."),
("","","Ot tlí smérti, i jéže ot Adáma hrichá, tvojím izbávichomsja Bohoródice, bezsímennym roždestvóm: Bóh bo vkúpi i čelovík jedínyj, tójže i Sýn sýj, izbavlénije sohrišénij vírnym dáruja."),
("","","Mojích prehrišénij Vladýčice, razderí rukopisánije, v knízi mjá spasénnych napisávši, božéstvennymi molítvami tvojími: jáko da vo chvaléniji ťá pojú, svjaťíjšuju cheruvím súščuju."),
("","","Otrinovénnyja drévle, právednym tvojím sudóm Christé, ot tvojehó licá, prizvál jesí plotskím prišéstvijem, jáko milosérd. I nýňi bláže, sohríššyja ný prijimí, i ot zól preminí."),
("","","Očiščénije róždšuju, i hríšnikov blahodáteľa Ďívo prečístaja, moľú ťá: viný bezmírnych prehrišénij mojích razriší Máterneju tvojéju molítvoju: ímaši bo jáko Máti k Sýnu, jéže moščí."),
),
"S": (
("","","Pod króv tvój vsí zemnoródniji pribihájem, izbávi víčnujuščaho ohňá dúšy náša, blahája."),
),
"7": (
("","","Péšč ótrocy ohnepáľnu drévle rosotočášču pokazáša, jedínaho Bóha vospivájušče, i hlahóľušče: prevoznosímyj otcév Bóh i preproslávlen."),
("","","Oťahčénnyj úm mój snóm, vseneporóčnaja, ko blahím ďílanijem vozdvíhni: jáko da ublažáju ťá Čestňíjšuju vsjákija tvári."),
("","","Júniji trijé ótrocy posreďí péšči tvojé proobražáchu roždestvó: ne opalísja úbo, óhň róždši čístaja. Ťímže véščnyja mí strásti sérdca popalí."),
("","","V ženách ťá krásnu i dobrú prekrásnyj Hospóď urazumív, iz tebé voplotísja. Tohó úbo molí presvjatája otrokovíce, spastí mja."),
("","","Božéstvennaja rosá iz tebé prošédši, istájavšyja znójem hrichóvnym, orošájet preneporóčnaja. Ťímže ťá moľú, istájavšuju dúšu mojú orosí."),
),
"8": (
("","","Neopálnaja ohňú v Sináji pričáščšajasja kupiná Bóha javí, medlenojazýčnomu i huhnívomu Moiséovi, i ótroki révnosť Bóžija trí nepreborímyja vo ohní pivcý pokazá, vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("","","Neopáľna ohném v Sináji besídovavši kupiná, tvojé pokazúja stránno roždestvó bohovídcu Moiséju. Ťímže udívľsja stránnomu roždestvú tvojemú čístaja, rádujasja vopijáše: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo víki."),
("","","Umerščvlényj mój úm hrichóm, jáže živót róždšaja čístaja Ďívo, oživotvorí, i spasí k Bóhu preminéniji tvojími máternimi, prísno mjá pojúšča: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo víki."),
("","","Imíju ťá čístaja, v noščí i vo dní chraníteľnicu neotstúpnu, ot mýslennych i vídimych vráh, nikákože navíta zlá i lukáva užasájusja, pojá Christú: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo vsjá víki."),
("","","Ot svojehó čelovikoľúbija, Sýn tvój Bohoródice, jáko bláh prekloňájem, ťá podadé pómošč na vrahí, i ciľbú strastéj víroju zovúščym: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo vsjá víki."),
),
"9": (
("","","Netľínija iskušénijem róždšaja, i vsechitrecú Slóvu plóť vzaimodávšaja, Máti neiskusomúžnaja Ďívo Bohoródice: prijátelišče nesterpímaho, seló nevmistímaho ziždíteľa tvojehó, ťá veličájem."),
("","","Neokrádomoje bohátstvo ďívstva tvojehó, Máti plótiju javílasja jesí vsederžíteľa, nevísto neiskusomúžnaja Ďívo Bohoródice, vospitávši, jáko mladénca, pitájuščaho jáko ziždíteľa vés mír, i osvjaščájušča."),
("","","Čelovikoľúbňijšeje Slóvo róždši Ďívo, hrichí míra vzémľuščeje, sehó molí, nám nizposláti hrichóv razrišénije, víroju nesumňínnoju po dólhu ťá blažáščym."),
("","","Hrichoľubív sýj, trepéšču i bojúsja, da ne vnezápu konéc žitijá dostíhnet mjá čístaja Vladýčice, vsích obídimych predstáteľnice, i óbrazy mjá pokajánija ukripíti nýňi umoléna búdi."),
("","","Da ne vo óhň pósleši mjá, uhotóvannyj mňí, mólit ťá Ďíva, róždšaja ťá, i božéstvennyj bezplótnyj lík, apóstoli, prorócy, múčenicy i svjáščennonačáľnicy, i dúsi právednych, vseščédryj i mnohomílostive."),
),
)
#let U = (
"S1": (
("","","Ďílateli selú tvojemú javíl jesí apóstoly tvojá Slóve, posikájuščyja ídoly: ťímže ťá Vladýku vo jazýcich propovídavše, blahočéstno vozvelíčiša."),
("","","Zemnýja na zemlí slávy ne vozľubíste slávniji, Bóha nebésnaho čelovíkom propovídavše, tomú vsích privedóste."),
("Bohoródičen","","Ášče i Máter ťá tvár pozná, no Ďívu ťá ziždíteľ pokazál jésť: rodilá bo jesí plótiju Christá Bóha, spasájuščaho dúšy náša."),
),
"S2": (
("","","Jáko nášeho spasénija okormíteli premúdryja apóstoli Christá Bóha, píňmi i písňmi po dólhu počtím: tíji bo prélesti nečéstije othnávše, mír spasóša, jáko samovídcy Slóva, i sluhí, i drúzi, i brátija bývše."),
("","","Prorócy propovídaša, apóstoli naučíša, múčenicy ispovídaša, i mý vírovachom: jáko tý jesí Christós Sýn Bóžij, izbávitel míra."),
("Múčeničen","","Múčenicy tvojí Hóspodi, vrahá pobidíša, i prélesť ídoľskuju posramíša, vooružívšesja krestá tvojehó síloju: ťímže i so ánhely vospivájušče ťá, vopijút pobídnuju písň, slavoslóvjašče ťá Christé. Ťích molítvami podážď dušám nášym očiščénije i véliju mílosť."),
("Bohoródičen","","Rádujsja, iz nejáže neprelóžno Slóvo plóť býsť, i vselísja v ný: rádujsja čístaja, apóstolov i múčenikov rádovanije, i nás vírnych spasénije: rádujsja Máti Christá Bóha."),
),
"S3": (
("","Plód čréva","Učenicý Hospódni vsechváľniji, íže podsólnečnuju vsjú jáko svitíla ozarívše, vo ťmí strastéj mjá i prehrišénij súšča, prosvitítisja mí, molíte."),
("","","Svitíla vý súšče míru, Hospódni apóstoli, oblistavájete prísno slóvo vírnym, othoňájušče zíľňi prélesti mhlú. Ťímže i prosviščájete jazýki kreščénijem, jáko propovídnicy Tróicy súšče, prísno počitájemiji."),
("Bohoródičen","","Jáže míru rádoste Ďívo tvojehó Sýna neprestánno so apóstoly molí, proščénije darováti nášich prehrišénij, i žitijá ispravlénije."),
),
"K": (
"P1": (
"1": (
("","","Mánijem tvojím na zemnýj óbraz preložísja, préžde udoborazlivájemoje vodnóje jestestvó Hóspodi: ťímže nemókrenno pišešéstvovav Izráiľ, pojét tebé písň pobídnuju ."),
("","","Mánijem k božéstvennomu bohovídni bývše, bóhi sokrušíste bezbóžnych, i k božéstvenňij vsích vozdvihóste ľubví, vírovavšich Bóhu vsečestníji."),
("","","Mánijem k božéstvennomu bohovídni bývše, bóhi sokrušíste bezbóžnych, i k božéstvenňij vsích vozdvihóste ľubví, vírovavšich Bóhu vsečestníji."),
("","","Sóľ jákože bývše vsejá zemlí, Bohohlahóliviji Hospódni apóstoli, sohnítije vsé ustávite sérdca mojehó, i obujávšeje ľúťi iscilíte."),
("","","Vsích sudijá právedňijšij, jehdá chóščet vo vtoróje prišéstvije s vámi sísti božéstvenniji apóstoli, tohdá vsjákaho osuždénija nás izbávite."),
("Bohoródičen","","Prečístaja Bohoródice, so bezplótnymi ánhely, i proróki, i múčeniki i apóstoly molí: jáko da ostavlénije prehrišénij prijímem Ďívo, i bohátuju mílosť."),
),
"2": (
("","","Pospíšestvovavšemu Bóhu vo Jehípťi Moiséovi, izvestí Izráiľa, tomú jedínomu poím, jáko proslávisja."),
("","","Proslávleno na zemlí prešéd žitijé, tebé slávjaščyja Nikólaje, pričástniki támo súščyja slávy sotvorí."),
("","","V pučíňi ľútych plávajušče, žitéjskich iskušénij volnámi vseblažénne, okružájemi jesmý: ot níchže nás spasí."),
("","","Rúku mí nýňi podáteľnuju pómošči podážď, ótče Nikólaje, ot vráh vídimych i nevídimych izbávi mjá."),
("Bohoródičen","","Íže neveščéstvennyja sluhí sotvorív, iz tebé Bohoródice, rodísja za mílosť neizrečénnuju, čelovíki vídim býsť."),
),
),
"P3": (
"1": (
("","","V načáľi nebesá vsesílnym slóvom tvojím utverždéj Hóspodi Spáse, i vseďíteľnym i Bóžijim Dúchom, vsjú sílu ích: na nedvížimim mjá kámeni ispovídanija tvojehó utverdí."),
("","","Jáko nebesá slávu Bóžiju, jákože rečé prorók, povídujete božéstvenniji učenicý, ujasňájušče jehó božéstvennoje voploščénije, i stradánija jávi múdriji: ímiže strastéj i smérti vsích, i tlí izbávite."),
("","","Stríly Christá síľnaho izoščrény javístesja, ot stríl mjá lukávaho, múdriji učenicý Hospódni izbávite: i ujazvlénoje ľúťi hrichóvnym orúžijem mojé sérdce iscilíte."),
("","","Preľščénnaho mjá ľúťi i odéždy obnažéna božéstvennyja, božéstvennymi odéždami Christóvy učenicý, prosvitíti potščítesja: íže vrážija kovárstva obnažívše vsjá, i tohó v stúd oblekóste."),
("","","Síly nebésnyja sostavléj slóvom, íže prorókom blahodáť podávyj, i učenikóm, i vsím múčenikom: ťích molítvami Bóže, i prečístyja Mátere tvojejá, spasí vsích, i uščédri jáko milosérd."),
("Bohoródičen","","Nebesá utverdívyj slóvom, i zemnóje osnovánije ukripívyj na vodách mnóhich, utverdí mój úm v vóľu tvojú čelovikoľúbče."),
),
"2": (
("","","O vselénňij prinosjá molénija, ot vsjákija núždy i skorbéj bezčíslennych spasí nás, svjáte Nikólaje."),
("","","Svjázannych neizbížno iz temnícy jákože izbávil jesí: soúzy rasterzáv zól mojích, molítvami tvojími, primirí Bóhu, svjáte Nikólaje."),
("","","V noščí i vo dní zastúpnika ťá naricájem, náša molítvy prinesí Hóspodevi, sochraňája nás prísno, svjáte Nikólaje."),
("","","Kleščí jáže božéstvennyj úhľ prijémši v božéstvenňij utróbi. Tvojéj, nikákože opalívšisja, popalí prečístaja, náša prehrišénija."),
("Bohoródičen","","Ótča ňídra ne ostávľ, i sošéd na zémľu Christé Bóže, tájnu uslýšach smotrénija tvojehó, i proslávich ťá jedíne čelovikoľúbče."),
),
),
"P4": (
"1": (
("","","Íže Otcú soprestóľnyj Sýn, na zemlí voplóščsja jáko čelovík, izbrá vás učenikí, jehó Božestvó propovídati vsím jazýkom."),
("","","Íže Otcú soprestóľnyj Sýn, na zemlí voplóščsja jáko čelovík, izbrá vás učenikí, jehó Božestvó propovídati vsím jazýkom."),
("","","K sozidátelem vsích strastéj vpádsja umovrédno okajánnyj áz, sérdcem ujazvíchsja. Ťímže moľúsja, iscilíte mjá vráčeve boľáščich apóstoli."),
("","","Ot strastéj izbávite nás, i ot bíd ľútych, i skorbéj apóstoli slávniji, i ot vsjákija napásti, i vseboľíznennyja múki."),
("","","Jáže Bóhu Máti izbránnyja, so apóstoly svjaščénnymi, i múčeniki, i proróki molísja, bíd i skorbéj i prehrišénij izbávitisja nám."),
("Bohoródičen","","Pokrýla jésť nebesá Christé Bóže smotrénijem tvojím, dobroďítel neizrečénnyja múdrosti tvojejá čelovikoľúbče."),
),
"2": (
("","","Premúdrostiju tvojéju očernív Árijev úm jéresiju pomračénnyj, i ot tohó preľščájemyja, Nikólaje prosvitíl jesí."),
("","","Uvračúj mojá mnóhija strúpy Bohoprijátnymi tvojími molítvami, Bohoblažénne ótče Nikólaje, i sérdce mojé prosvití."),
("","","Umertvív strástnyja vzyhránija, ot níchže mjá umerščvlénaho, molítvami tvojími vseblažénne oživív, nóva sotvorí."),
("","","Rodilá jesí plótiju bezľítnaho: jehóže molí mnohoľítnych zól nás izbáviti, pojúščich ťá vseneporóčnaja."),
("Bohoródičen","","Hóspodi Bóže mój, ot nóšči útrenevav tebí moľúsja: podážď mí ostavlénije prehrišénij mojích, i k svítu tvojích poveľínij putí mojá naprávi, moľúsja."),
),
),
"P5": (
"1": (
("","","Hóspodi Bóže mój, apóstolom tvojím mír drévle darovávyj, ťích molítvami mír dáruj vsím, i prehrišénij proščénije."),
("","","Hóspodi Bóže mój, apóstolom tvojím mír drévle darovávyj, ťích molítvami mír dáruj vsím, i prehrišénij proščénije."),
("","","Hóspodi Bóže mój, svídyj sohrišénija duší mojejá, i neisprávlennyj nráv sérdca mojehó, túne mjá uščédriv spasí, apóstol moľbámi."),
("","","Hóspodi Bóže mój, razbójnika, i bludnícu sohrišívšuju, mnóhija rádi spásl jesí bláhosti: i molítvami tvojích apóstol, i mené blúdnaho uščédri."),
("","","Hóspodi Bóže mój, roždéjsja ot Ďívy neiskusobráčnyja, tojá molítvami i apóstol tvojích očiščénije sohrišénij mí dáruj, i búduščija izbávi múki."),
("Bohoródičen","","Útreňujet dúch mój k tebí Bóže, zané svít jesí, i tvojá poveľínija býša iscilénija rabóm tvojím, čelovikoľúbče."),
),
"2": (
("","","Sovíty ótče, podvizájemyja prísno na ný, nenakázannych čelovík tvojími molítvami Nikólaje, bezďíľny sotvorí."),
("","","Soúzy zól nášich rastórhni tvojími molítvami, svjazávyj zlóbu dušetľínnaho zmíja, vsesvjatýj Nikólaje."),
("","","Rázumom prísno sohrišájušče, i mnóžestvom ľútych soderžími ótče, predstáteľa ťá Nikólaje, tépla prizyvájem."),
("","","Maríje Hospožé vsejá tvári, ot vrahá bezstúdno obladáti íščušča smirénnoje sérdce mojé, Bohorodíteľnice do koncá svobodí."),
("Bohoródičen","","Plávajuščaho v molví žitéjskich popečénij, s korablém potopľájema hrichí, i dušetľínnomu zvírju, primetájema jáko Jóna Christé, vopijú ti: iz smertonósnyja hlubiný vozvedí mja."),
),
),
"P6": (
"1": (
("","","Sámyja múdrosti božéstvenniji učenicý bývše, jéllinskuju obujíša premúdrosť, i mudrecá zlóby pohubíša: i v nevíďiniji bluďáščyja, svítom blahočéstija premúdriji prosvitíša."),
("","","Sámyja múdrosti božéstvenniji učenicý bývše, jéllinskuju obujíša premúdrosť, i mudrecá zlóby pohubíša: i v nevíďiniji bluďáščyja, svítom blahočéstija premúdriji prosvitíša."),
("","","Íže Petróvo drévle slezámi prehrišénije očístiv, tohó molítvami duší mojejá neisčétnaja sohrišénija očísti, bezmírnaho rádi tvojehó blahoutróbija i premnóhija, Christé, blahostýni."),
("","","Íže Ninevíťany drévle pokájavšyjasja uščédriv, i mené obýčnym tvojím milosérdijem pomíluj, apóstol tvojích rádi: i da ne za mnóžestvo prehrišénij izbáviteľu, mnóžestvo priložíši mučénija."),
("","","Jáže svít róždšaja, prosvití dúšu mojú omračénnuju strasťmí: i molí so apóstoly, s proróki že i múčeniki, ot vsjákaho hrichá, vsjákaho vréda, vsjákija zlóby vrážija izbáviti mjá."),
("Bohoródičen","","Jóna iz čréva ádova vopijáše: vozvedí ot tlí živót mój. Mý že tebí vopijém: vsesíľne Spáse pomíluj nás."),
),
"2": (
("","","Razoríl jesí smérti neprávednyj súd, i spásl jesí mílostiju tvojéju ótče Nikólaje, choťáščyja umréti, jáko téplyj pomóščnik prizyvájuščym ťá."),
("","","Nedúhi dúš nášich utiší: i ustá otverzájuščajasja vsúje na ľúbjaščich ťá, svjaščénňijšij pástyrju, zahradí."),
("","","Pážiť hórkuju zločéstija Árijeva potrebíl jesí Nikólaje, rastvorénijem slovés tvojích svjaščennotaínniče, pravoslávnym utverždénije tý býl jesí."),
("","","Uvračúj vseneporóčnaja, neiscíľno boľáščuju, okajánnuju dúšu mojú žitéjskimi prélesťmi, i mnóhich hrichóv obstojániji."),
("Bohoródičen","","Péšč ótrocy ohnepáľnu drévle rosotočášču pokazáša, jedínaho Bóha vospivájušče, i hlahóľušče: prevoznosímyj otcév Bóh, i preproslávlen."),
),
),
"P7": (
"1": (
("","","Péšč drévle hórkaho bezbóžija, rosóju božéstvennaho propovídanija uhasíste slávniji apóstoli, zovúšče: prevoznosímyj otcév Bóh i preproslávlen."),
("","","Péšč drévle hórkaho bezbóžija, rosóju božéstvennaho propovídanija uhasíste slávniji apóstoli, zovúšče: prevoznosímyj otcév Bóh i preproslávlen."),
("","","Ľútaho mjá Christé, hrichá, i vo áďi mučénija, i v hejénňi boľíznej ischití: i spasí mja, moľúsja, moľbámi Slóve, apóstol tvojích."),
("","","Slóva mréžeju iz hlubiný nevíďinija čelovíki ulovívše, i potopľájema mjá bezmírnymi prehrišéniji, i oburevájema, učenicý Christóvy spasíte."),
("","","So ánhely, s múčeniki i apóstoly, vseneporóčnaja, tvojehó Sýna molí i Hóspoda, spastísja rabóm tvojím ot napástej vsjáčeskich i skorbéj."),
("Bohoródičen","","Péšč horjáščuju orosíl jesí Spáse, ótroki spásl jesí pojúščyja i hlahóľuščyja: blahoslovén jesí vo víki Hóspodi Bóže otéc nášich."),
),
"2": (
("","","Krasotá cerkóvnaja býv, múdre Nikólaje, vsjákija mjá nekrasotý strastéj bezčéstnych izbávi, blahodáteľa vsehó míra moľá, svjatíteľu, prísno."),
("","","Túčami molítv tvojích, Nikólaje múdre, vsích nás napój serdcá: jáko da prinesém plodý dostójny pokajánija, svjatíteľu Nikólaje."),
("","","Prosvití tvojími molítvami náša pomyšlénija, víroju útreňujuščich, i Bóha slávjaščich, razorívyj moľbámi tvojími artemídy kápišča."),
("","","Vsják jazýk víroju slávit ťá, čístaja, slávu súščuju i pochvalú róda nášeho, i nastávnicu zablúždšich, Bohoródice preblažénnaja."),
("Bohoródičen","","Neopáľnaja ohňú v Sináji pričáščšajasja kupiná Bóha javí, medlenojazýčnomu i huhnívomu Moiséovi, i ótroki révnosť Bóžija trí nepreborímyja vo ohní pivcý pokazá: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
),
),
"P8": (
"1": (
("","","Úhlije ohném razúmnym razžéhšesja, jákože tróstije vsjú ídoľskuju lésť popalíša, Christóvy učenicý, i prosvitíša vírnych dúši, vzyvájuščyja: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("","","Úhlije ohném razúmnym razžéhšesja, jákože tróstije vsjú ídoľskuju lésť popalíša, Christóvy učenicý, i prosvitíša vírnych dúši, vzyvájuščyja: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("","","Omračénnuju dúšu mojú hrichóm, i omračénnoje strasťmí bezčéstija nýňi prosvitíte sérdce mojé, svítu prisnosúščnomu pričástnicy Christóvy apóstoli, jáko da neprestánno zovú: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("","","Ujázvlennuju dúšu mojú jadovítymi hórdaho uhryzéňmi, íže jázvy plótiju prijémyj, iscilí molítvami svjáščénnych tvojích učenikóv, i spasí pojúščyja: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("","","Neopáľno róždši óhň, sochranílasja jesí Ďíva prečístaja: ťímže molí, jehóže rodilá jesí, so bezplótnymi líki i apóstoly, spastísja víroju pojúščym: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte vo vsjá víki."),
("Bohoródičen","","V peščí ótroki podražájušče, duchóvnuju rósu prijémšiji: víroju zovém: blahoslovíte ďilá Hospódňa Hóspoda."),
),
"2": (
("","","V Mírich mirouchánnoje ťílo tvojé, vsesvjáte Nikólaje, ležáščeje, míro pritekájuščym istočájet, i ustavľájet nedúhi čelovíkom."),
("","","Míru ťá zastúpnika pokazá, míra tvoréc i Hospóď: ťímže prizyvájuščym ťá v núždach nýňi Nikólaje, obritáješisja izbáviteľ hotóvijšij."),
("","","Ňísť, íže prizvávyj ťá v skórbech, i skóro ne obrjáščet uťišénija. Ťímže tebí mólimsja: vsjá boľízni náša, Nikólaje, oblehčí."),
("","","Pojét vsják jazýk i slávit ťá, Ďívo Bohonevísto, Bóha bo prepítaho rodilá jesí: jehóže molí neprestánno, spastísja dušám nášym."),
("Bohoródičen","","Netľínija iskušénijem róždšaja, i vsechitrecú Slóvu plóť vzaimodávšaja, Máti neiskusomúžnaja Ďívo Bohoródice: prijátelišče nesterpímaho, seló nevmistímaho ziždíteľa tvojehó, ťá veličájem."),
),
),
"P9": (
"1": (
("","","Sýny svíta i dné vás javíl jésť, Bóha Otcá Slóvo: sehó vozľubívše božéstvenniji apóstoli svitíla vselénnyja, bisóv potrebítelije, nastávnicy zablúždšich, cérkve tvérdaja osnovánija javístesja."),
("","","Sýny svíta i dné vás javíl jésť, Bóha Otcá Slóvo: sehó vozľubívše božéstvenniji apóstoli svitíla vselénnyja, bisóv potrebítelije, nastávnicy zablúždšich, cérkve tvérdaja osnovánija javístesja."),
("","","Rála slovesé, íže na výjach lehčájšeje sehó ího nosívšiji, obnovíte nýňi oľadeňívšuju strasťmí dúšu mojú, i pokajánija símenem plodonósnu sijú soďílajte."),
("","","O zakonopoložénijich mjá božéstvennych neradívša, i bývšaho mjá bisóv žilíšče, i ďílatelišče vsjákaho hrichá uščédri mjá Slóve, molítvami slávnych apóstol tvojích, jáko čelovikoľúbec."),
("","","Zemľá božéstvennymi osvjaščájetsja moščmí blahoslávnych apóstol, božéstvennym Dúchom: pervoroždénnych že výšňaja cérkov duchámi sích svitľíjetsja bezprestánno: íchže rádi Spáse, vsích uščédri."),
("Bohoródičen","","Da mjá vo óhň ne pósleši uhotóvannyj mňí, mólit ťá Ďíva tebé róždšaja, i božéstvenniji bezplótniji lícy, apóstoli, prorócy i múčenicy, svjatítelije, i dúsi právednych, vseščédre mnohomílostive."),
),
"2": (
("","","Páče jestestvá Máter, i po jestestvú Ďívu, jedínu v ženách blahoslovénnuju, písňmi vírniji Bohoródicu veličájem."),
("","","Posľídovav nrávom svjáščénnych apóstol, i sidálišča ťích nasľídoval jesí, jáko svjatíteľ čísten, dostoslávnyj Nikólaje."),
("","","Jáko revníteľa ťá božéstvennaho, i pomóščnika po vsemú tebé prizyvájuščym tépľi, vo vsém míri blažénne, tvoréc prevelíka pokazá."),
("","","Sokrušénnym sérdcem vopijém tí ótče: uťišénije nám búdi v skórbech, pečáli razhoňája vsehdá ot dúš nášich, Nikólaje."),
("","","Smértnoje posičénije, jákože sikíra drévu predležít tí, o dušé! ne ľinísja úbo, pokajánija plodý Bóhu pokazáti usérdstvuj."),
("Bohoródičen","","Nósiši nosjáščaho vsjáčeskaja svjatými tvojími rukámi: jehóže molí čístaja, ot čuždáho zloďíjstva nevrédnym nám spastísja."),
),
),
),
"CH": (
("","","Apóstoli slávniji, stolpí cerkóvniji, ístiny propovídnicy, svitíla súšče svítlaja, vý ohném duchóvnym vsjáku prélesť popalíste, čelovíčeskij že ród prosvitíste. Ťímže mólim vý: molíte Spása i Bóha nášeho, umiríti mír, i spastí dúšy náša."),
("","","Apóstoli Christóvy, ďílateli Spásovy, krest bo jáko rálo na rámich nosjášče, oľaďívšuju zémľu ot ídoľskija lésti očístivše, i víry slóvo vsíjaste: voístinnu dostójno naricájetesja svjatíji Christóvy apóstoli."),
("Múčeničen","","Jedíno dýšušče, i na jedíno vzirájušče strastotérpcy múčenicy, jedín púť životá obrítše, jéže za Christá smérť revnújušče drúh drúha končíňi: ole čudesé! Jáko sokróvišča múki predvoschiščájušče, drúh ko drúhu hlahólachu: jáko ášče ne nýňi úmrem, úmrem že vsjáko, i bytijú dólžnaja poslúžim: sotvorím núždu ľubočéstijem, óbščeje svojé da vminím, smértiju živót kúpim. Molítvami ích, Bóže, pomíluj nás."),
("Bohoródičen","","Rodílsja jesí ot Ďívy neskazánno Christé, i prosvitíl jesí súščyja vo ťmí, vopijúščyja: Hóspodi sláva tebí."),
),
)
#let L = (
"B": (
("","","Krasén bí i dóbr v sňíď, íže mené umertvívyj plód: Christós jésť drévo živótnoje, ot nehóže jadýj ne umiráju, no vopijú s razbójnikom: pomjaní mjá Hóspodi, vo cárstviji tvojém."),
("","","Iz hlubiný zlovírija jazýk stadá privlekóste premúdriji k véri Bohokrásňij, i k mýslenňij trapézi obrók mnohocínnyj sích privedóste, slávniji apóstoli."),
("","","Omračénije ľútyja prélesti svítom propovídanija othnávše apóstoli Hospódni, serdcá blahočestívych prosvitíli jesté jávi: ťímže vás písňmi božéstvennymi ublažájem."),
("Múčeničen","","Ssicájemi na udesá mečém stradáľcy božéstvenniji, ne otsíčeni prebýste ľubvé izbáviteľa: k nemúže vostekóste: nýňi živeté v rádosti, vsí nebésnoju slávoju oblistavájemi."),
("","","Zlóbňijšij i tlíteľ róda čelovíčeskaho obderžít mjá, molítvami propovídnik tvojích, vsesíľnaja Tróice, ischití mja ot hortáni jehó: da veličáju tvojú bezmírnuju mílosť."),
("","","Soprestóľna Otcú Sýna, čístaja Ďívo, ot čístych tvojích krovéj proizvelá jesí nosjáščaho plóť mértvennuju, jáko da obezsmértit suščestvó čelovíčeskoje: ťímže po dólhu ťá vsí ublažájem."),
),
)
|
|
https://github.com/goshakowska/Typstdiff | https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/all_types_working/all_types_working_deleted.typ | typst | GNU nano 6.2 test1.typ
= Introduction
|
|
https://github.com/arthurcadore/eng-telecom-workbook | https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/PSD/homework2/homework.typ | typst | MIT License | #import "@preview/klaro-ifsc-sj:0.1.0": report
#import "@preview/codelst:2.0.1": sourcecode
#show heading: set block(below: 1.5em)
#show par: set block(spacing: 1.5em)
#set text(font: "Arial", size: 12pt)
#set text(lang: "pt")
#set page(
footer: "Engenharia de Telecomunicações - IFSC-SJ",
)
#show: doc => report(
title: "Filtros Digitais",
subtitle: "Processamento de Sinais Digitais",
authors: ("<NAME>",),
date: "05 de Maio de 2024",
doc,
)
= Questão 1:
Considere o diagrama de fluxo de sinais a seguir:
#figure(
figure(
image("./pictures/q1.png"),
numbering: none,
caption: [Sinal de entrada no domínio do tempo]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
== Item A:
Determine a função de transferência $𝐻[𝑧]$ relacionando a entrada $𝑥[𝑛]$ à saída $𝑦[𝑛]$ para o filtro FIR em treliça da figura acima.
Para determinar a função de transferência, é necessário analisar o diagrama de fluxo de sinais e identificar as relações entre as variáveis de entrada e saída.
Assim podemos retirar da figura acima as seguintes expressões:
- $x[n] + 1/4x[n -1]$
- $x[n-1] + 1/4x[n]$
- $x[n] + 1/4x[n-1] - 3/5[n-2] - 0,15[n-1]$
- $x[n-2] + 1/4x[n-1] - 3/5[n] - 0,15[n-1]$
- $y[n] = x[n] + 1/4x[n-1] - 3/5x[n-2] - 3/20x[n-1] - 2/3x[n-3] -1/6x[n-2] + 2/5x[n-1] + 1/10x[n-2] $
Desta forma, solucionando a equação acima no dominio $n$ temos que:
$
y[n] = 1x[n] + 0,5x[n-1] - 0,666x[n-2] - 0,666x[n-3]
$
Agora, podemos passar a função expressada acima para o domino Z, onde temos que:
$
Y[z] = x[Z] + 0,5Z^{-1}x[Z] - 0,666Z^{-2}x[Z] - 0,666Z^{-3}x[Z]
$
Assim, podemos isolar a função de transferência $H[z]$ através de $Y[z]/X[z]$, onde temos que:
$
Y[Z] = X[Z] . (1 + 0,5Z^{-1} - 0,666Z^{-2} - 0,666Z^{-3})
$
$
H[Z] = Y[Z]/X[Z] = 1 + 0,5Z^{-1} - 0,666Z^{-2} - 0,666Z^{-3}
$
Podemos também encontrar os coeficientes $alpha$ utiliziando o algorimito para conversão de $k$, e calcular a equação de transferência:
$
\k1= -1/4, \k2 = 3/5, \k3 = 2/3
$
Para i = 1:
$
alpha^{1}_1 = -1/4
$
Para i = 2:
$
alpha^{2}_2 = 3/5
$
Como $i=2$ entra em $i > 1$, então $(j = 1)$, temos que:
$
alpha^{2}_1 = alpha^{1}_1 - 3/5 alpha^{1}_1
$
Para $i = 3$:
$
alpha^{3}_3 = 2/3
$
Como $i=3$ entra em $i > 1$, então $(j = 1)$, temos que:
$
alpha^{3}_1 = alpha^{2}_1 - 2/3 alpha^{2}_2
$
Para $j = 2$:
$
alpha^{3}_2 = alpha^{2}_2 - 2/3 alpha^{2}_1
$
Podemos encontrar $alpha^{3}_1$ substituindo $alpha^{2}_1$ em $alpha^{3}_1 = alpha^{2}_1 - 2/3 alpha^{2}_2$:
$
alpha^{3}_1 = alpha^{2}_1 - 2/3 alpha^{2}_2
$
Considerando que $alpha^{2}_1 = alpha^{1}_1 - 3/5 alpha^{1}_1
$
$
alpha^{3}_1 = alpha^{1}_1 - 3/5 alpha^{1}_1 - 2/3 alpha^{2}_2
$
$
alpha^{3}_1 = (-1/4) + (-3/5).(-1/4) + (-2/3).(3/5) = -0,5
$
Podemos encontrar $alpha^{3}_2$ substituindo $alpha^{2}_1$ em $alpha^{3}_2 = alpha^{2}_2 - 2/3 alpha^{2}_1$:
$
alpha^{3}_2 = alpha^{2}_2 - 2/3 alpha^{2}_1
$
$
alpha^{3}_2 = alpha^{2}_2 - 2/3 (alpha^{1}_1 - 3/5 alpha^{1}_1)
$
$
alpha^{3}_2 = alpha^{2}_2 - 2/3 alpha^{1}_1 + 2/5 alpha^{1}_1
$
$
alpha^{3}_2 = (3/5) + (- 3/2) . (-1/4) + (2/5).(-1/4) = 0,666
$
Portanto, temos que:
$
alpha^{3}_1 = -0,5, alpha^{3}_2 = 0,666, alpha^{3}_3 = 0,666
$
Desta forma, a equação no tempo é dada por:
$
y[n] = 1x[n] + 0,5x[n-1] - 0,666x[n-2] - 0,666x[n-3]
$
Realizando a transformada Z, temos que:
$
Y[Z] = X[Z] . (1 + 0,5Z^{-1} - 0,666Z^{-2} - 0,666Z^{-3})
$
Rearranjando a equação, temos que:
$
H[Z] = Y[Z]/X[Z] = 1 + 0,5Z^{-1} - 0,666Z^{-2} - 0,666Z^{-3}
$
Podemos também encontrar a equação de transferência utilizando a forma recursiva, para isso temos que:
$
\k1= -1/4, \k2 = 3/5, \k3 = 2/3
$
$
A^{0}(Z) = B^{0}(Z) = 1
$
$
A^{i}(Z) = A{i-1}(Z) - \k{i}Z^{-1}B{i-1}(Z)
$
$
B^{i}(Z) = -\k{i}A^{i-1}(Z) + Z^{-1}B^{i-1}(Z)
$
Dessa forma, Para $i = 1$ temos que:
$
A^{1}(Z) = A{0}(Z) - \k_1 Z^{-1}B{0}(Z)
$
$
A^{1}(Z) = 1 - (-1/4)Z^{-1}
$
$
A^{1}(Z) = 1 + 1/4Z^{-1}
$
\
\
$
B^{1}(Z) = -\k_1A^{0}(Z) + Z^{-1}B^{0}(Z)
$
$
B^{1}(Z) = -(-1/4)Z^{-1} + Z^{-1}
$
$
B^{1}(Z) = 1/4 + Z^{-1}
$
\
\
Para $i = 2$ temos que:
$
A^{2}(Z) = A{1}(Z) - \k_2 Z^{-1}B{1}(Z)
$
$
A^{2}(Z) = 1 - (-1/4)Z^{-1} - (3/20)Z^{-1} - 3/5Z^{-2}
$
$
A^{2}(Z) = 1 + 1/10Z^{-1} - 3/5Z^{-2}
$
\
\
$
B^{2}(Z) = -\k_2A^{1}(Z) + Z^{-1}B^{1}(Z)
$
$
B^{2}(Z) = -3/5(1 + 1/4Z^{-1}) + Z^{-1}(1/4 + Z^{-1})
$
$
B^{2}(Z) = -3/5 - 3/20Z^{-1} + 1/4Z^{-1} + Z^{-2}
$
$
B^{2}(Z) = -3/5 + 1/10Z^{-1} + Z^{-2}
$
Para $i = 3$, temos que:
$
A^{3}(Z) = A{2}(Z) - \k_3 Z^{-1}B{2}(Z)
$
$
A^{3}(Z) = 1 - (-1/10)Z^{-1} - 3/5Z^{-2} - 2/3Z^{-1} (-3/5 + 1/10Z^{-1} + Z^{-2})
$
$
A^{3}(Z) = 1 + 1/10Z^{-1} - 3/5Z^{-2} + 6/15Z^{-1} - 2/30Z^{-2} - 2/3Z^{-3}
$
$
A^{3}(Z) = 1 + 1/2Z^-1 - 20/30Z^{-2} - 2/3Z^{-3}
$
Desta forma, temos que
$
A^{3}(Z) = H[Z] = 1 + 1/2Z^-1 - 2/3Z^{-2} - 2/3Z^{-3}
$
== Item B:
Desenhe o diagrama de fluxo de sinais na forma direta I.
O diagrama de fluxo de sinais na forma direta I é apresentado abaixo:
#figure(
figure(
image("./pictures/q1-2.svg",width: 60%),
numbering: none,
caption: [Diagrama de Fluxo de Sinais na Forma Direta I]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
== Item C:
=== Desenvolvimento:
Determine e trace o gráfico da resposta ao impulso unitário.
Conforme obtido no Item A, temos que:
$
H[Z] = 1 + 1/2Z^-1 - 2/3Z^{-2} - 2/3Z^{-3}
$
Portanto, aplicando um impulso unitário, temos que a resposta ao impulso é dada por:
$
H[n] = delta[n] + 1/2delta[n-1] - 2/3delta[n-2] - 2/3delta[n-3]
$
Assim, realizando um plot em octave, temos o seguinte gráfico para a resposta ao impulso:
#figure(
figure(
image("./pictures/q1-c.png"),
numbering: none,
caption: [Resposta ao Impulso Unitário]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
=== Script Utilizado:
Para o desenvolvimento desta questão, utilizei o seguite script octave:
#sourcecode[```matlab
% Definindo a resposta ao impulso H[n]
% Criando um vetor com 10 amostras
n = 0:10;
% Adicionando a resposta ao impulso e algumas amostras com zero para melhor visualização
H = [1, 1/2, -2/3, -2/3, 0, 0, 0, 0, 0, 0, 0];
% Realizando o plot com stem da resposta:
stem(n, H, 'filled');
xlabel('n');
ylabel('H[n]');
title('Resposta ao Impulso H[n]');
grid on;
```]
== Item D:
Desenhe a estrutura do filtro em treliça para o filtro só-pólos $1/𝐻[𝑧]$
\
Para desenhar a estrutura, podemos determinar o filtro só polos $1/H[z]$ utilizando:
$
F(Z) = 1/H[Z] = F(Z) = 1/((1 + 1/2Z^-1 - 2/3Z^{-2} - 2/3Z^{-3}))
$
Desta forma, a estrutura é dada pela seguinte ilustração:
#figure(
figure(
image("./pictures/q1-d.svg"),
numbering: none,
caption: [Estrutura do Filtro em Treliça Só-Polos]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
= Questão 2:
Um sistema LIT causal é definido pelo diagrama de fluxo de sinais mostrado na Figura a seguir, que representa o sistema como uma cascata de um sistema de segunda ordem com um sistema de primeira ordem.
#figure(
figure(
image("./pictures/q2.png"),
numbering: none,
caption: [Sinal de entrada no domínio do tempo]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
== Item A:
=== Desenvolvimento:
Qual é a função de transferência do sistema em cascata global?
Para encontrarmos a função de transferência do sistema em cascata global, primeiramente, os nós somadores foram identificados e o sistema foi dividido em duas partes, onde o $y_1[n]$ do primeiro sistema é o $x_2[n]$ do segundo sistema:
#figure(
figure(
image("./pictures/q2-2.png"),
numbering: none,
caption: [Nós somadores identificados]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
Desta forma, podemos obter as expressões abaixo:
$
a[n] = 0,3b[n-1] + 0,4b[n-2]
$
$
b[n] = x[n] + a[n]
$
$
\y1[n] = b[n] + 0,81b[n-2]
$
Passando as expressões para o dominio Z, tem os que:
$
A[Z] = 0,3Z^{-1}B[Z] + 0,4Z^{-2}B[Z]
$
$
B[Z] = X[Z] + A[Z]
$
$
\Y1[Z] = B[Z] + 0,81Z^{-2}B[Z]
$
Isolando $B[Z]$ nas expressões, temos que:
$
B[Z] = X[Z] + 0,3Z^{-1}B[Z] + 0,4Z^{-2}B[Z]
$
$
X[Z] = B[Z] (1 - 0,3Z^{-1} - 0,4Z^{-2})
$
$
Y[Z] = B[Z] (1 + 0,81Z^{-2})
$
Portanto, podemos calcular a função de transferência $\H1$ do primeiro sistema:
$
\H1[Z] = \Y1[Z]/X[Z] = (B[Z](1 + 0,81Z^{-2})) / (B[Z](1 - 0,3Z^{-1} - 0,4Z^{-2}))
$
$
\H1[Z] = (1 + 0,81Z^{-2}) /(1 - 0,3Z^{-1} - 0,4Z^{-2})
$
Para o segundo sistema, temos as seguintes equações:
$
c[n] = 2x[n] - 0,8y[n]
$
$
y[n] = x[n] + c[n-1]
$
Passando para o dominio Z, temos as seguintes expressões:
$
C[Z] = 2X[Z] - 0,8Y[Z]
$
$
Y[Z] = X[Z] + C[Z]Z^{-1}
$
Aplicando C[Z] em Y[Z], temos que:
$
Y[Z] = X[Z] + 2Z^{-1}X[Z] - 0,8Z^{-1} Y[Z]
$
Isolando Y[Z], temos que:
$
Y[Z] + 0,8Z^{-1}Y[Z] = X[Z] + 2Z^{-1}X[Z]
$
$
Y[Z] (1 + 0,8Z^{-1}) = X[Z] (1 + 2Z^{-1})
$
Desta forma, podemos calcular a função de transferência $\H2$ do segundo sistema:
$
\H2[Z] = Y[Z]/X[Z] = (1 + 2Z^{-1}) / (1 + 0,8Z^{-1})
$
$
\H2[Z] = (1 + 2Z^{-1}) / (1 + 0,8Z^{-1})
$
Assim, podemos calcular a função de transferência global do sistema em cascata, realizando a multiplicação de $\H1[Z]$ por $\H2[Z]$:
$
H[Z] = ((1 + 0,81Z^{-2})) /((1 - 0,3Z^{-1} - 0,4Z^{-2})) . ((1 + 2Z^{-1})) / ((1 + 0,8Z^{-1}))
$
Desta forma, a equação de transferência do sistema em cascata(calculada através do script ocateve) é dada por:
$
H[Z] = (1 + 2Z^{-1} + 0,81Z^{-2} + 1,62Z^{-3}) / (1 + 0,5Z^{-1} - 0,64Z^{-2} - 0,32Z^{-3})
$
=== Script Utilizado:
Para o desenvolvimento desta questão, utilizei o seguinte script em octave:
#sourcecode[```matlab
clear all; close all; clc;
pkg load signal
% Definindo as variáveis de entrada dadas pelo calculo de H1 e H2
y1 = roots([1 0 0.81]);
x1 = roots([1 -0.3 -0.4]);
y2 = roots([1 2]);
x2 = roots([1 0.8]);
% Calculando os polos e zeros da função de transferência:
polos_H = poly([0+0.9000i 0-0.9000i -2])
zeros_H = poly([0.8000 -0.5000 -0.8000])
```]
== Item B:
=== Desenvolvimento:
O sistema global é estável? Explique resumidamente.
Sim, o sistema é estável. Para determinar a estabilidade do sistema, é necessário analisar os polos da função de transferência.
Para isso, a função de transferência calculada no item anterior teve seus polos e zeros plotados, conforme apresentado abaixo. Note que como *todos os polos encontram-se dentro do circulo de raio unitário, o sistema é considerado estável*
#figure(
figure(
image("./pictures/q2-b.png"),
numbering: none,
caption: [Polos e Zeros da Função de Transferência]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
=== Script Utilizado:
Para o desenvolvimento desta questão, utilizei o seguinte script em octave:
#sourcecode[```matlab
clear all; close all; clc;
pkg load signal
% Definindo as variáveis de entrada dadas pelo calculo de H1 e H2
y1 = roots([1 0 0.81]);
x1 = roots([1 -0.3 -0.4]);
y2 = roots([1 2]);
x2 = roots([1 0.8]);
% Calculando os polos e zeros da função de transferência:
polos_H = poly([0+0.9000i 0-0.9000i -2])
zeros_H = poly([0.8000 -0.5000 -0.8000])
% Plotar o gráfico de polos e zeros
figure(1)
zplane([polos_H],[zeros_H]);
title('Pólos e zeros da função de transferência');
set(findall(gcf, 'type', 'line'), 'linewidth', 2);
```]
== Item C:
Desenhe o diagrama de fluxo de sinais de uma implementação na forma direta II transposta desse sistema.
A partir da função de transferência obtida no item A, podemos desenhar o diagrama de fluxo de sinais de uma implementação na forma direta II transposta do sistema.
#figure(
figure(
image("./pictures/q2-3.svg", width: 80%),
numbering: none,
caption: [Implementação na Forma Direta II Transposta]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
= Questão 3:
A figura a seguir mostra uma implementação em forma direta II de um sistema:
#figure(
figure(
image("./pictures/q3.png"),
numbering: none,
caption: [Sinal de entrada no domínio do tempo]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
== Item A:
Determine a função de transferência $𝐻[𝑧]$.
A função de transferência do sistema pode ser obtida analisando diretamente o diagrama conforme apresentado abaixo:
#figure(
figure(
image("./pictures/q3-1.png"),
numbering: none,
caption: [Coeficientes do Sistema]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
Sendo:
$
A = 0,5
$
$
B = 0,2
$
$
C = 1
$
A função de transferência do sistema é dada por:
$
H[Z] = (C + \BZ^{-1})/ (1 - \AZ{-1}) = (1 + 0,2Z^{-1})/ (1 - 0,5Z^{-1})
$
== Item B:
Determine a resposta ao impulso.
A resposta ao impulso até o primeiro nó é dada por:
$
\h1[n] = 0,5^{n-1} u[n]
$
Para o segundo nó, a resposta ao impulso é dada pela seguinte expressão (baseada na resposa ao impulso até o primeiro nó):
$
\h2[n] = (0,5^{n-1} u[n]) + (0,2(0,5)^{n-1}u[n-1])
$
== Item C:
Assumindo que o sistema seja implementado em aritmética de ponto fixo de 8 bits, e que todos os produtos sejam arredondados para 8 bits antes que uma soma qualquer tenha sido realizada. Usando o modelo linear para ruído de arredondamento, encontre a variância do ruído de arredondamento na saída do filtro. (Faça passa a passo)
Para encontrar a variância do ruido de arredondamento, considero o modelo linear do ruído de arredondamento exibido abaixo:
#figure(
figure(
image("./pictures/q3-2.png"),
numbering: none,
caption: [Modelo Linear do Ruído de Arredondamento]
),
caption: figure.caption([Elaborada pelo Autor], position: top)
)
Pela definição temos que a quantidade de bits é dada por:
$
B + 1 = 8
$
Portanto, B = 7
Desta forma, podemos calcular a variância do ruído do ponto dada por $sigma^2_e$. Tal que:
$
sigma^2_e = 2^{-2B} / 12
$
Assim, temos que:
$
sigma^2_e = 2^{-2.7} / 12 = 2^{-14} / 12 = (0,00006103515625/12) = 0,00000508626302
$
Agora, para calcular a variância do ruído de saida do sistema, temos que:
$
sigma^2_f = sigma^2_e + sigma^2_e (C^2 + B^2 + 2A.B.C)/(1-A^2)
$
$
sigma^2_f = 0,00000508626302 + 0,00000508626((1^2 + 0,2^2 + 2. 0,5 . 1 . 2 ))/(1 - 0,5^2)
$
$
sigma^2_f = 0,00000508626302 + 0,00000840928
$
$
sigma^2_f = 0,00001349554302
$ |
https://github.com/typst/webapp-issues | https://raw.githubusercontent.com/typst/webapp-issues/main/SECURITY.md | markdown | # Security Policy
Thank you for reporing vulnerabilities to us!
If you find a vulnerability in the Typst web application, please use the "Security" tab on GitHub to report it privately.
Alternatively, send an email with `[Security web app] ` in the subject line to `<EMAIL>`.
## Reporting a Vulnerability
When reporting your vulnerability, please precisely describe how to trigger it and what resources you have found to be impacted.
We will try to quickly respond after checking your report. Our response will inform you whether accept the vulnerability, or whether we decline it with respect to user impact, our threat model, etc.
If accepted, we will notify you once the issue got fixed. Please do not publicly disclose it beforehand.
|
|
https://github.com/jomaway/typst-gentle-clues | https://raw.githubusercontent.com/jomaway/typst-gentle-clues/main/lib/theme.typ | typst | MIT License | // theme file for gentle clues
// catppuccin based theme (default)
// https://catppuccin.com/palette
#let catppuccin = (
info: (
accent-color: rgb(4, 165, 229), // sky #04a5e5
icon: "info.svg"
),
notify: (
accent-color: rgb(30, 102, 245), //blue #1e66f5
icon:"bell.svg"
),
success: (
accent-color: rgb(64, 160, 43), // green #40a02b
icon:"checkbox.svg"
),
warning: (
accent-color: rgb(223, 142, 29), // yellow #df8e1d
icon:"warning.svg"
),
danger: (
accent-color: rgb(254, 100, 11), // peach #fe640b
icon:"danger.svg"
),
error: (
accent-color: rgb(210, 15, 57), // red #d20f39
icon:"crossmark.svg"
),
task: (
accent-color: rgb(136, 57, 239), // mauve #8839ef
icon:"task.svg"
),
tip: (
accent-color: rgb(23, 146, 153), // teal #179299
icon:"tip.svg"
),
abstract: (
accent-color: rgb(32, 159, 181), // saphire #209fb5
icon:"abstract.svg"
),
conclusion: (
accent-color: rgb(221, 120, 120), // flamingo #dd7878
icon:"conclusion.svg"
),
memo: (
accent-color: rgb(230, 69, 83), // maroon #e64553
icon:"excl.svg"
),
question: (
accent-color: rgb(23, 146, 153), // teal #179299
icon:"questionmark.svg"
),
quote: (
accent-color: rgb(114, 135, 253), // lavender #7287fd
icon:"quote.svg"
),
example: (
accent-color: rgb(220, 138, 120), // rosewater #dc8a78
icon:"simple-graph.svg"
),
experiment: (
accent-color: rgb(220, 138, 120), // rosewater #dc8a78
icon:"experiment.svg"
),
goal: (
accent-color: rgb(230, 69, 83), // maroon #e64553
icon:"flag.svg"
),
code: (
accent-color: rgb(114, 135, 253), // lavender #7287fd
icon:"code.svg"
),
idea: (
accent-color: rgb(223, 142, 29), // yellow #df8e1d
icon:"lightbulb.svg"
),
)
|
https://github.com/chubetho/Bachelor_Thesis | https://raw.githubusercontent.com/chubetho/Bachelor_Thesis/main/templates/toc.typ | typst | #outline(depth: 3)
#pagebreak(weak: true) |
|
https://github.com/DawnEver/csee-typst-template | https://raw.githubusercontent.com/DawnEver/csee-typst-template/main/README.md | markdown | MIT License | # CSEE [Typst](https://typst.app) Template
- [English](#what-is-mcmicm)
- [中文](#what-is-mcmicm)
Typst template for [CSEE (Chinese Society for Electrical Engineering)](https://www.csee.org.cn/).
## What is CSEE
> The Chinese Society for Electrical Engineering (CSEE) is a prominent academic organization in China that focuses on advancing electrical engineering. It has a large membership base and aims to promote scientific research, academic exchanges, and the application of electrical engineering knowledge. CSEE organizes conferences, seminars, and exhibitions, publishes high-quality journals, and maintains technical committees covering various areas of electrical engineering. The society actively engages in international collaborations to foster global advancements in the field.
>
> generated by chatgpt
CSEE only privides [word template](CSEE_Template.doc) for users.
Based on the official template and guidelines, I diy the Typst version.
## What is Typst
Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use.
- [Typst Github](https://github.com/typst/typst)
- [Typst Homepage](https://typst.app)
## Preview
See the [main.pdf](main.pdf).

## Preview
- ./img/ # default image folder
- ./appendices.typ # appendices of the thesis
- ./main.typ # main body of the thesis
- ./template.typ # template file
- ./[main.pdf](main.pdf) # default output pdf
- ./refs.bib # bibliography file
## Usage:
Run `typst compile main.typ` to obtain main.pdf
You can try it online ([Click Me](https://typst.app/project/pxdKIC-xO_H20K5NAg_9sm)) or run locally.
I strongly recommand writing with VSCode.

## Version
Typst>=0.9.0 is recommanded.
## Friend Link
- [Signals-and-Control Thesis](https://github.com/Lightyear-li/Signals-and-Control)
## TODO
- Table and figure captions of both Chinese and English.
## Contribute
Welcome to PRs.
|
https://github.com/veilkev/jvvslead | https://raw.githubusercontent.com/veilkev/jvvslead/Typst/main.typ | typst | #import "./sys/sys.typ": *
#import "./sys/packages.typ": *
#import "./sys/header.typ": *
#set page(
margin: (x: 0.75cm, y: 1cm),
background: image("./images/background.jpg", width: 110%),
header: align(right + horizon)[
#move(dx: 2pt, dy: -20pt,
image("./images/logo.png", width: 125pt, height: auto)
)
],
header-ascent: -300%,
// Footer (black line)
footer: [
// Parellelogram Graphic
#let lines = text("/", fill: black, size: 15pt, weight: "regular")
#move(dx: 0.1cm, dy: -5pt,
box(width: 1fr, repeat[#parallelogram])
)], numbering: "1",
)
/***********************************************/
/* Essentials */
/***********************************************/
#show "Caution": "WARNING"
#page-number(1)
#include("./files/1_evacuation.typ")
include("./files/1_system.typ")
#pagebreak()
#page-number(2)
#include("./files/2_resets.typ")
#pagebreak()
#page-number(3)
#include("./files/3_reprints_suspends.typ")
#pagebreak()
#page-number(4)
#include("./files/4_sales.typ")
#pagebreak()
#page-number(5)
#include("./files/5_operators.typ")
#pagebreak()
#page-number(6)
#include("./files/6_passwords.typ")
#page-number(7)
#include("./files/7_prices.typ")
#page-number(8)
#pagebreak()
#include("./files/8_detreport.typ")
#pagebreak()
#pagebreak()
#page-number(9)
#include("./files/9_statuses.typ")
#pagebreak()
#page-number(10)
#include("./files/91_bank99.typ")
#pagebreak()
#page-number(11)
#include("./files/count.typ")
#page-number(12)
#include("./files/books.typ")
|
|
https://github.com/1sSay/USPTU_conspects | https://raw.githubusercontent.com/1sSay/USPTU_conspects/main/src/philosophy/MiddleAges.typ | typst | // Global settings and templates
#set text(14pt)
#let def(term, color: black) = {
box(stroke: color, inset: 7pt, text()[ #term ])
}
// Lecture header and date
#let lecture_header = text()[Средневековье]
#let date = text()[7.09.2024]
// Header
#align(center, heading(level: 1)[Философия. \ #lecture_header ])
#align(center, text(weight: "thin")[#date])
#align(center, text(weight: "thin")[Конспект Сайфуллина Искандара БПО09-01-24])
// Content
== Средневековая теологическая философия
- *Годы:* V-XV вв.
А больше нету :( |
|
https://github.com/DashieTM/ost-5semester | https://raw.githubusercontent.com/DashieTM/ost-5semester/main/patterns/weeks/MAP.typ | typst | == Atomic Parameter Patterns
<atomic-parameter-patterns>
Moderator: <NAME>
=== Interface Representation Patterns
<interface-representation-patterns>
==== Structural Representation Patterns
<structural-representation-patterns>
There are various structural patterns for API representation design. The
following key quality attributes are especially siginificant:
+ Interoperability: Ensuring the API can seamlessly work across different
platforms and programming languages.
+ Performance: Optimizing factors such as latency, network resource consumption,
and message verbosity.
+ Developer Convenience and Experience: Balancing ease of use for both API
consumers and providers.
+ Maintainability: Facilitating the ability to evolve API clients and providers
independently without disruptions, often by aiming for loose coupling.
+ Security and Data Privacy: Ensuring the confidentiality, integrity, and
availability of data in transit and guarding against malicious tampering or
impersonation.
Note: Quality attributes can vary depending on whether the API is public or
internal.
==== Structures for API
<structures-for-api>
- Single structured
- Single atomic
- Multiple structured
- Multiple atomic
- Pagination
==== Atomic Parameter
<atomic-parameter>
Problem:
Two applications need to communicate over a network, how can these applications
guarantee consistent data when (possibly) different technologies are used?
Forces:
- Interoperability -\> Only create custom ones when needed
- Expressiveness: Specify undefined or NULL values explicitly
- Information: Specify ranges in API documentation
- Performance: API should not spam network
Solution:
Use single parameters with a singular scalar value that should be as universal
as possible (int over Integer class -\> java). These singular parameters can
have limited ranges or might possibly be nullable, however, this should be
documented in the API documentation.
Liabilities:
- Might become spammy -\> too many single parameters -\> too many single packets
- Not very expressive
- Additional work needed for strong statically typed languages -\> rust, haskell
Uses:
- Remote API with #emph[low] amount of information sent or received
==== Atomic Parameter List
<atomic-parameter-list>
Problem:
This is an extension of the Atomic Parameter pattern. How do you handle sending
multiple data units to the server?
Solution:
- To transmit two or more simple, unstructured information items, define multiple "Atomic
Parameters."
Forces:
- Performance: Instead of sending multiple API calls with a single Atomic
Parameter, combine then into a list to preserve network capacity and server-side
resources. Organize these Atomic Parameters in an ordered list.
Liabilities:
- Serialization and deserialization needed (not always natively supported)
- More work, less expressive than single atomic parameters
Uses:
- Remote API with #emph[high] amount of information sent or received
- Facebook’s Graph API
- Twitter API
=== Prüfungsfragen
<prüfungsfragen>
- Are Atomic Parameter Lists suitable for all programming languages out of the
box? \[no\]
- Single Atomic Parameter is a suitable pattern for a notification daemon with
optional image and response functionality \[no\]
== Auftrag 2
<auftrag-2>
Moderator: <NAME>
=== Structural Representation Patterns
<structural-representation-patterns>
==== Parameter Tree Pattern
<parameter-tree-pattern>
Problem: A simple message format has been defined, like Atomic parameter or
Atomic parameter list. But this simple message format does not fully satisfy the
information need of the message receiver.
Forces:
- Expressiveness and efficiency have to be balanced.
- Interoperability
- Serialization time
- Learning effort and maintainability
- security -\> checks forgotten
Solution: The solution is to organize the data in a message echange format, like
JSON or XML. A primary container called root is created, that can hold various
kinds of data structures, like tuples (which combine different types of data,
such as a ZIP code and a city name) or arrays (which group elements with the
same structure).
These structures can then be nested inside of each other.
Liabilities:
- Big tree can cause serialization issues
- Different trees might be requested -\> too many requests
- Tree structure needs to be perfectly documented -\> otherwise hell to maintain
or use
- Accept everything, but send only what you specified
- Specify upper and lower boundaries -\> arrays
- Be specific about possible null values
- careful with complex structures such as key-value mappings -\> see
networkmanager dbus
Uses:
- Notification dbus
=== Parameter Forest Pattern
<parameter-forest-pattern>
==== Forces same as above
<forces-same-as-above>
Problem: What if I want multiple trees?
Solution: Use multiple trees on the top level.
Liabilities:
- limit the number of trees
- provide tests and use suitable messaging formats such as xml or json
- be careful with spikes -\> trees that might be extremely big or small
- worse performance
- harder to maintain
- harder to protect against tampering
Notes:
- can have multiple roots -\> multiple trees
=== Pagination Pattern
<pagination-pattern>
Problem: How to provide large amounts of data that doesn’t really fit into a
single response.
Solution:
- send only parts (agreed upon fixed size or dynamic)
- The pattern has variants such as Offset-Based Pagination, Cursor-Based
Pagination (also known as Token-Based Pagination) and Time-Based Pagination
- The default page-based Pagination and its Offset-Based Pagination variant are
quite similar
Forces:
- Page size -\> how much do we send/receive?
- Variability of data (Identically structured? How often data definition changes)
- Memory available for a request (both on provider and on consumer side) and data
currentness
Liabilities:
- pattern needs to be applied consistently
- max size needs to be chosen carefully
- pagination is of limited use when all data is loaded either way
- additional pages should be included with dymanic links that are timestamped
- big datasizes lead to potential DDOS, problems with packet sizes, performance
issues especially without serialization libraries
=== Prüfungsfragen
<prüfungsfragen>
- Can Parameter Tree Pattern handle multiple trees on the top level for multiple
trees? \[No\]
- Is Pagination Pattern mainly for handling large data that doesn’t fit in a
single response? \[Yes\]
#figure(
[#image(width: 50%,"../presentations/uploads/094f3812bc6fd3c1f68add604a9145c5/list.png")], caption: [
list.png
],
)
#figure(
[#image(width: 50%,"../presentations/uploads/b276b829704c67a42ee691be7a31d65a/tree.png")], caption: [
tree.png
],
)
#figure(
[#image(width: 50%,"../presentations/uploads/22d866a2ed3c51d25127f3d812c80249/forest.png")], caption: [
forest.png
],
)
#figure(
[#image(width: 50%,
"../presentations/uploads/7a8ca424c530b3fd309a7168fa1660f8/pagination.png",
)], caption: [
pagination.png
],
)
== Auftrag 3
<auftrag-3>
Moderator: <NAME>
=== Version Identifier
<version-identifier>
Problem: How can an API provider indicate its current capabilities as well as
the existence of possibly incompatible changes to clients?
Forces: - Accuracy and exact API version - Minimizing impact on client -
Guaranteeing API changes don’t cause accidental breakage - Traceability for
versions
Solution: Introduce an explicit version number into the exchanged messages to
indicate the API version.
Examples: Version of representation format
#image(width: 50%,
"../presentations/uploads/f55758d145d702374870c5721495a8be/represenation.png",
)
Specific operation
#image(width: 50%,
"../presentations/uploads/2e2d3801a405b2dff4b85c5c7b8792b1/operation.png",
)
Whole Api #image(width: 50%,"../presentations/uploads/2735a3a0967525f807ea094e138e4de0/api.png")
JSON payload
#image(width: 50%,
"../presentations/uploads/742cae61ab201413c72205d3940e654e/payload.png",
)
benefits: - Reduces likelihood of breakage because of api changes - Makes
version tracing possible - Helps to identify proper API early
Liabilities: - Governance - Version changes don’t always introduce changes in
functionality
=== Semantic Versioning
<semantic-versioning>
Problem: How can stakeholders compare API versions to immediately detect whether
they’re compatible? How to differentiate between bug fixes and breaking changes?
Forces: - Minimal effort to detect version incompatability - Manageability of
api versions - Clarity of change impact
Solution: Introduce a hierarchical three-number versioning (e.g 1.1.1)
Example:
#image(width: 50%,
"../presentations/uploads/c834347ce17c41236f0b9aac97d2a026/versioning.png",
)
Benefits: - Clarity for clients about compatibility
Liabilities: - Increased effort to determine version identifiers
=== Two in Production
<two-in-production>
Problem: How can a provider gradually update an API without breaking existing
clients, but also without having to maintain a large number of API versions in
production?
Forces: - Ability to roll back API - Minimize changes to the client by API -
Minimize maintenance effort for clients and server - Time for clients to
implement changes
Solution: Deploy and support two versions of an API endpoint. Update and
decommission (i.e. deprecate and remove) the versions in a rolling, overlapping
fashion
Benefits: - Clients have time to implement new API - Reduces likelihood of
undetected changes further
Example: #image(width: 50%,
"../presentations/uploads/91b75328686095c4f5878b8cb567b2ee/rollout.png",
)
Liabilities: - Clients have to adapt to incompatible API changes over time -
Causes additional costs for operating multiple API versions
=== Limited Life time Guarantee
<limited-life-time-guarantee>
Problem: How can a provider let clients know for how long they can rely on the
published version of an API?
Forces: - plannable API changes - maintenance effort
Solution: As an API provider, guarantee to not break the published API for a
given, fixed timeframe.
Benefits: - No multi version support needed - Clients know about changes
- Clients have enough time to change API
Liabilities: - Limits ability to respond to urgent change requests - Forces
clients to upgrade at a defined point in time - Clients do not always update API
even with this method -\> see windows EOL
=== Prüfungsfragen
<prüfungsfragen>
- Should fixes only increment the third part of the semantic versioning?(1.1.0 -\>
1.1.1) \[yes\]
- Semantic versioning makes it easier to differentiate between bug fixes and
breaking changes in an API \[yes\]
=Auftrag 4 Moderator: Felix
=== Game Loop basics
<game-loop-basics>
The game loop has the following base functionality that it needs to implement:
```c
while(true) {
// handle user input
process_input();
// move player, move objects, enemies etc
update();
// after moving we update the UI
render();
// move time forward -> see below
}
```
#image(width: 50%,
"../presentations/uploads/241c3957b083c9533158d990bd8084f2/bevy-function.png",
)
#image(width: 50%,"../presentations/uploads/3d2ff886e4051235f3d8b38b9eb3aac3/bevy.png")
=== Fixed Time Step with No Synchronization:
<fixed-time-step-with-no-synchronization>
Run the game loop as fast as possible without synchronization. This was mostly
used in the early days of gaming.
Benefits:
- Simple implementation
Liabilities: - Game speed directly affected by hardware and complexity.
- Gameplay is faster on a fast machine Liabilities: - Game speed
directly affected by hardware and complexity. - Gameplay is faster on a fast
machine
#figure(
[#image(width: 50%,
"../presentations/uploads/afaf7dc8d9b2d75757b16d28ef170411/fixedTime.png",
)], caption: [
fixedTime
],
)
=== Fixed Time Step with Synchronization:
<fixed-time-step-with-synchronization>
Run the game at a fixed time step but add a delay or synchronization point to
prevent it from running too fast.
Benefits:
- Relatively simple with added power efficiency and doesn’t play too fast
- saves power
- good when implemented as option -\> fps slider
Liabilities: - Game can still play too slowly if updates take too long - CPU
thread scheduling is not guaranteed - bad when forced -\> NFS Rivals
#figure(
[#image(width: 50%,
"../presentations/uploads/383d7a7d5ad1a12eed9eb24ec1073422/fixedTimeS.png",
)], caption: [
fixedTimeS
],
)
=== Variable Time Step
<variable-time-step>
Adapt to playing both too slowly and too fast by adjusting the time step.
Benefits: - Adaptable to varying processing speeds.
Liabilities: - Makes gameplay non-deterministic and unstable. Can complicate
physics and networking. - aka ball moves through wall randomly cuz fun - Update
function is called every frame, with 180frames per second this is 180 times,
with 60 frames this is 60 times -\> hence the first pc will have more update
calls than the second. This will create a floating point error delta between the
two PCs.
#figure(
[#image(width: 50%,
"../presentations/uploads/776785bef3ce0cdd37b042783e57d2d0/varTime.png",
)], caption: [
varTime
],
)
Example from bevy:
```rs
transform.translation.y -= 50. * bullet.speed * timer.delta_seconds();
```
=== Fixed Update Time Step, Variable Rendering:
<fixed-update-time-step-variable-rendering>
Update with a fixed time step but drop rendering frames if necessary to catch up
to the player’s clock.
Benefits:
- Adapts to playing both too slowly and too fast, providing smoother gameplay on
high-end machines.
- Floating point error delta between different pcs eliminated.
Liabilities: - More complex implementation, requiring tuning of the update time
step for different hardware.
#image(width: 50%,
"../presentations/uploads/a4ae4893cf9406606b680fb9148f1cc1/physicswait.png",
)
#image(width: 50%,
"../presentations/uploads/4754664079677c4012e41022735b6da7/fixTimeVar.png",
)
```c
// variable rendering with:
render(lag / MS_PER_UPDATE);
// visibly move objects -> physics is not changed, player just sees something as "moved"
```
=== Prüfungsfragen
<prüfungsfragen>
- Fixed update time step solves the issue of floating point errors.\[yes\]
- Fixed time stamp with no synchronization is the preferred variant by
gamers.\[no\]
#figure(
[#image(width: 50%,
"../presentations/uploads/73ef97c1ed6b2d8a9322d3c1328ce56f/monobehaviour_flowchart.svg",
)], caption: [
monobehaviour\_flowchart.svg
],
)
== Auftrag 5
<auftrag-5>
Moderator: Fabio
=== Component
<component>
How can a single entity span multiple domains without coupling the
domains to each other?
Problem: - Creating monolithic classes that handle multiple
responsibilities is hard to change - A game character class that handles
input, sound, physics and the rendering. This becomes a large file very
quickly.
#figure([#image(width: 50%,"../presentations/uploads/e1b615ffcf3fb7ee180e78a4926db098/player.png")],
caption: [
player
]
)
#figure([#image(width: 50%,"../presentations/uploads/662bfa86dafc4fd021b6e198a6fe43f3/bad-bjorn.png")],
caption: [
bad-bjorn
]
)
Solution: - Place the different components into different classes. Input
into InputComponent and the game character has an instance of it. Entity
is reduced to a container of components
#image(width: 50%,"../presentations/uploads/c5c8ffa55e7f77517cb0dd1a99ddc4c8/component-bevy.png")
#image(width: 50%,"../presentations/uploads/0cf700577d0d4b29c1b7423b18fe09ee/good-bjorn.png")
Benefits: - Components become reuseable packages - Developers can work
on a component without needing knowledge on how other components work
Liabilities: - More complexity - More indirection
==== Additional Information
<additional-information>
===== Diamond (or why not to use inheritance)
<diamond-or-why-not-to-use-inheritance>
This refers to a class inheriting from 2 classes which in return will
inherit the same class. This leads to undefined behavior as the system
can’t determine which function to use.
#figure([#image(width: 50%,"../presentations/uploads/8986ed9ce8851a72672148ca59709beb/diamond.png")],
caption: [
diamond
]
)
===== ECS (Entities Components Systems)
<ecs-entities-components-systems>
#image(width: 50%,"../presentations/uploads/cb2d4ada762601c9a55c91d1d4bee1b6/ecs.png") This takes
the component pattern to the extreme by only storing ids of components.
This allows for fast queries of components, which in return solves the
complexity of component interaction:
#figure([#image(width: 50%,"../presentations/uploads/065052c0427ee26879e7be948c3e4da6/reset-powerup.png")],
caption: [
reset-powerup
]
)
===== Data Locality
<data-locality>
Accelerate memory access by arranging data to take advantage of CPU
caching (L1, L2, L3 cache). Components are often stored in contiguously,
which means they are spatially local. This reduces the need to fetch
data from slower levels of the memory hierarchy and improves access
speed.
===== Polymorphism
<polymorphism>
Instead of attaching a component directly, one can also use pointers in
order to provide more flexibility. This would mean you can create
versions of a specific component to attach -\> a player might want a
player-input component, which in return is a input component. With this
a different type of player can have a different input component, or the
same player on a different level etc.
```cpp
// class stuff
private:
InputComponent* input; // can be casted and hence dynamic
PhysicsComponent physics; // can't be casted -> always the same functionality
```
Benefits: - flexibility
Liabilities: - indirection - Vtable
===== Communication options
<communication-options>
- Container state / global state
- multiple writers can lead to race condition
- 1 writer / multiple readers -\> for true "state" values
- Directly
- parent to child
- child to parent needs inheritance
- simple and fast
- not flexible
- messages
- good when recipient might need to respond or handle the action
immediately
- can be combined with queue
- broadcast
- see bevy example above with "EventReader"
=== Questions
<questions>
Is inheritance preferable to composition? - No
The component pattern creates more objects which decreases the
performance, can data locality help to decrease the performance losses?
- yes
== Event Queue
<event-queue>
How to decouple the sending of an event/message from when it is
processed.
Problem: User input needs to be stored to prevent the operating system
from forgetting it between receiving input and processing it.
Solution: Store it in a queue. For example: A Combat Code can send
events, such as "enemy died," and any system can receive events from the
queue, then a tutorial system can display "Press x to loot" over a dead
enemy.
=== Interrupts vs. Events
<interrupts-vs.-events>
Interrupts are abrupt, immediately disrupting any ongoing workflows via
the operating system. In contrast, events can be queued up and are
handled when the program in question decides to do so.
=== Context
<context>
Events can facilitate the queuing of activities with specific
requirements:
#emph[Concurrency]: Events can be handled at any time, ensuring that
they do not block the main loop with activities like loading.
#emph[Prioritization]: Instances where similar events occur frequently,
such as in sound processing, require prioritization.
#emph[Memory]: Event queues provide limited storage for events. - This
aligns with concurrency, allowing events to be handled asynchronously. -
By storing events and deferring their processing, we avoid simultaneous
access from multiple sources to the audio thread, preventing blocking
behavior.
==== Central vs. Local
<central-vs.-local>
- Central is global -\> anyone can send/get events to/from it.
- Centralization can lead to problems:
- Different event types
- Size
=== Benefits
<benefits>
- Concurrency
- Time and space separation.
- Decoupling
- Overall performance improvement -\> Concurrency
=== Liabilities
<liabilities>
- Complexity
- Single-request performance may worsen.
- Fire-and-forget requests are not suitable if a response is necessary.
- Feedback loops:
- A sends an event
- B receives the event and responds with an event
- A receives the event and also responds with an event
- Repeat infinitely
- Events can get lost if not handled.
- Memory usage
#image(width: 50%,"../presentations/uploads/bf150d1caed0d14d720304a21b3bd15c/bevy1.png")
#image(width: 50%,"../presentations/uploads/f2fb1b520a084f9298850c958230ea94/bevy2.png")
#image(width: 50%,"../presentations/uploads/9160090cd611dca6e7c3ec3b787d6b2c/illustration.png")
#image(width: 50%,"../presentations/uploads/38fce3977f9ee309d85a164928fca742/events5.png")
#image(width: 50%,"../presentations/uploads/92cdb2c30b411b9751bf5662602cfca0/events6.png")
#image(width: 50%,"../presentations/uploads/e97e0987c1dac015e4212b9ccd6bff97/events7.png")
=== Ring Buffers
<ring-buffers>
Ring buffers allow continuous adding and deleting of events without
shifting elements.
#image(width: 50%,"../presentations/uploads/49a113dc502555456caa7fd38f53f5c0/illustration2.png")
#image(width: 50%,"../presentations/uploads/07e723f6971077fd03367d9d6de572f8/events8.png")
#image(width: 50%,"../presentations/uploads/2eed469bf706a7df98890755d2eaee41/events9.png")
#image(width: 50%,"../presentations/uploads/0987835aa6959a15cd9d4af8ad58b66b/events10.png")
#image(width: 50%,"../presentations/uploads/350635c551de62764fd680447312ae14/events11.png")
=== Aggregating Events
<aggregating-events>
Duplicate entries can be aggregated within the queue -\> for example,
avoid to play the same sound twice, or even worse, twice the volume.
The window for looping through the event queue is not umlimited. It
might be necessary to do this in a different function -\> update(), or
you might add a hashmap for content.
==== Concurrency
<concurrency>
Make sure to always put the function that will be run on the event into
another thread if it does something specific -\> playSound, please don’t
use the same thread there.
==== Queues
<queues>
- Single Cast
- Request
- Broadcast
- Event to all listeners
- Events often filtered by listeners
- Performance issues if too many listeners or events
- Zero listeners -\> Discard event
- Worker Queue
- Split events
- Different listeners get different events -\> more like a thread
worker queue
=== Memory
<memory>
#figure([#image(width: 50%,"../presentations/uploads/2cdb16626f7c696d9c57806d8c42107e/image.png")],
caption: [
image
]
)
==== Questions
<questions>
- Does an event queue help synchronize actions in a game? \[no\]
- Does the use of ring buffers allow for continuous adding and deleting
of events without the need for shifting elements? \[yes\]
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/place.typ | typst | Apache License 2.0 | // Test the `place` function.
---
#set page("a8")
#place(bottom + center)[© Typst]
= Placement
#place(right, image("/files/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
]
)
---
// Test how the placed element interacts with paragraph spacing around it.
#set page("a8", height: 60pt)
First
#place(bottom + right)[Placed]
Second
|
https://github.com/rabotaem-incorporated/probability-theory-notes | https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/02-general/02-random-variables.typ | typst | #import "../../utils/core.typ": *
== Случайные величины
#ticket[Случайная величина. Распределение случайной величины.\ Свойства функций распределения. Интегрирование по мере, имеющей плотность.]
#def[
$(Omega, Ff, P)$ --- вероятностное пространство, $xi: Omega --> RR$ --- _случайная величина_, если $xi$ --- измеримая функция, то есть $ lr(size: #1.5em, {omega: xi(omega) #stack($<=$, $>=$, $<$, $>$) x}) in Ff space forall x in RR. $
]
#def[
_Распределение случайной величины $xi$_ --- $P_xi$ --- мера на борелевских подмножествах $RR$, определенная как $P_xi (A) := P(xi(omega) in A)$.
]
#def[
Случайные величины $xi$ и $eta$ _одинаково распределены_, если $P_xi = P_eta$.
]
#def[
_Функция распределения случайной величины $xi$_: $F_xi (x) := P(xi <= x)$.
]
#props[
1. $F_xi: RR --> [0, 1]$.
2. Функция распределения однозначно задает распределение.
3. $F_xi$ неубывает.
4. $F_xi$ непрерывна справа, то есть $lim_(y -> x+) F_xi (y) = F_xi (x)$.
5. $lim_(x -> -oo) F_xi (x) = 0$ и $lim_(x -> oo) F_xi (x) = 1$.
6. $P (xi < x) = lim_(y -> x-) F_xi (y)$ (и предел сущесвует).
7. $F_(xi + c) (x) = F_xi (x - c)$.
8. $F_(c xi) (x) = F_xi (x / c)$ (при c > 0).
]
#proof[
1. Очевидно.
2. Надо доказать
$
F_xi = F_eta ==>^? P_xi = P_eta
$
Посмотрим на $P_xi (a, b]$ --- то есть на функцию на ячейках:
$
P_xi (a, b] = F_xi (b) - F_xi (a) = F_eta (b) - F_eta (a) = P_eta (a, b] ==> P_xi = P_eta "совпадают на ячейках" ==> P_xi = P_eta
$
по единственности продолжения.
3. Очевидно.
4. Проверим по Гейне, пусть $y_n arrow.br x$:
$
lim_(n -> oo) F_xi (y_n) = lim_(n -> oo) P_xi (-oo, y_n] =^"непр. сверху" P_xi (-oo, x] = F_xi (x).
$
5. Проверим по Гейне второе, пусть $x_n arrow.tr +oo$:
$
F_xi (x_n) = P_xi (-oo, x_n] -->_"непр. снизу" P_xi (Union_(n = 1)^oo (-oo, x_n]) = P_xi (-oo, +oo) = 1.
$
6. $ F_xi (x_n) = P_xi (-oo, x_n] -->_"непр. снизу" P_xi (Union_(n = 1)^oo (-oo, x_n]) = P_xi (-oo, x) = P(xi < x). $
7. $ F_(xi + c) (x) = P(xi + c <= x) = P(xi <= x - c) = F_xi (x - c). $
8. $ F_(c xi) (x) = P(c xi <= x) = P(xi <= x / c) = F_xi (x / c). $
]
#notice[
Любая функция со свойствами 3, 4 и 5 является функцией распределения случайной величины.
]
#proof[
$F: RR --> [0, 1]$ --- функция. Рассмотрим $nu (a, b] = F(b) - F(a)$ --- это так называемая _мера Лебега-Стилтьеса_ простроенная на функции $F$, которая как минимум на $Bb$ определится. Положим $Omega = RR$, $Ff = Bb$, $P = nu$. Доказывать, что это мера мы не будем. Аккуратно надо возиться. Помните теорему про что-то вроде "объем и непрерывность сверху это мера"? Вот надо использовать вот эти штуки.
]
#ticket[Дискретное, непрерывное и абсолютно непрерывное распределения.\ Свойства. Примеры вероятностных распределений.]
#def[
Случайная величина $xi$ _дискретна_, если множество ее значений не более чем счетно: $xi: Omega --> {y_1, y_2, y_3, ...}$
]
#def[
_Дискретное распределение_ --- распределение дискретной случайной величины, duh.
]
#notice[
Пусть $xi$ --- дискретная случайная величина.
1. $P(xi = x) = 0$ если $x != y_j$.
2. $P(xi in A) = sum_(j : y_j in A) P(xi = y_j)$, то есть дискретное распеделение полностью определяется числами $P(xi = y_j)$.
3. $F_xi (x) = sum_(j: y_j <= x) P(xi = y_j)$.
]
#def[
_Случайная величина $xi$ непрерывна_ (или _распределение случайной величины $xi$ непрерывно_), если $P(xi = x) = 0$ для любого $x$.
]
#notice[
$xi$ --- непрерывная случайная величина тогда и только тогда, когда $F_xi$ непрерывна.
]
#proof[
- "$==>$": Знаем, что $P (xi < x) = lim_(y -> x-) F_(xi) (y)$.
$
F_xi (x) = P(xi <= x) = P(xi < x) = lim_(y -> x-) F_xi (y) ==> F_xi "непрерывная слева".
$
- "$<==$": $F_xi$ непрерывна слева, значит
$
P(xi < x) = lim_(y -> x-) F_xi (y) = F_xi (x) = P(xi <= x) ==>
P(xi = x) = P(xi <= x) - P(xi < x) = 0.
$
]
#def[
$xi$ имеет _абсолютно непрерывное распределение_, если у $P_xi$ есть плотность относительно меры Лебега $lambda$, и эта плоность $p_xi$ называется _плотностью распределения_.
]
#remind[
$mu, nu$ --- меры на одной $sigma$-алгебре $Aa$. Говорят, что $p >= 0$ --- плотность $mu$ относительно $nu$, если $p$ измерима относительно $Aa$ и $mu A = integral_A p dif nu$ для любого $A in Aa$.
]
#props[
1. $ P_xi (A) = integral_A p_xi (t) dif t "и " F_xi (x) = integral_(-oo)^x p_xi (t) dif t. $
2. $ integral_RR p_xi (t) dif t = 1. $
3. $ p_xi (t) = (F_xi (t))' "при почти всех" t. $
]
#proof[
1. Тривиально.
2. Очевидно.
3. Без доказательства. Если функция дифференцируема, то нетрудно, но в общем случае это тяжело.
]
=== Примеры вероятностных распределений
Оказывается, что это настолько важно, что у нас на это будет первый в истории подпараграф.
Для полноты картины, я добавлю сюда свойства, которых к текущему моменту у нас нет (матожидание, характеристическая функция, ...). Все свойства запоминать не надо, в любом случае они выводятся не трудно.
#example(name: "Распределение Бернулли")[
- Параметризуется $p in [0, 1]$.
- $xi: Omega --> {0, 1}$.
- $ P(xi = 1) = p, space P(xi = 0) = 1 - p. $
- $E xi = p$.
- $D xi = p(1 - p)$.
- $phi_xi (t) = p e^(i t) + 1 - p$.
]
#example(name: "Биномиальное распределение")[
- Параметризуется $n in NN$ и $p in [0, 1]$.
- $xi: Omega --> {0, 1, 2, ..., n}$.
- $ P(xi = k) = C_n^k p^k (1 - p)^(n - k). $
- Обозначается $xi sim op("Binom")(n, p)$.
- Является количеством успехов в схеме Бернулли с $n$ испытаниями.
- $E xi = n p$.
- $D xi = n p (1 - p)$.
- $phi_xi (t) = (p e^(i t) + 1 - p)^n$.
]
#example(name: "Дискретное равномерное распределение")[
- Параметризуется $n in NN$.
- $xi: Omega --> {1, 2, ..., n}$.
- $ P(xi = k) = 1 / n. $
- $E xi = (n + 1)/2$.
- $D xi = (n^2 - 1)/12$.
- $phi_xi = (e^(i t) - e^(i (N + 1) t))/(N (1 - e^(i t)))$.
]
#example(name: "Распределение Пуассона")[
- Параметризуется $lambda > 0$.
- $xi: Omega --> {0, 1, 2, ...}$.
- $ P(xi = k) = e^(-lambda) lambda^k / k!. $
- Обозначаются $xi sim op("Pois")(lambda)$, или $xi sim op("Poisson")(lambda)$.
- $E xi = lambda$.
- $D xi = lambda$.
- $phi_xi = e^(lambda (e^(i t) - 1))$.
]
#example(name: "Геометрическое распределение")[
- Параметризуется $p in (0, 1)$.
- $xi: Omega --> {1, 2, ...}$.
- $ P(xi = k) = p (1 - p)^(k - 1). $
- Обозначается $xi sim op("Geom")(p)$.
- $P(xi = k)$ --- вероятность того, что в схеме Бернулли с вероятностью успеха $p$ первый успех произойдет на $k$-м испытании.
- $E xi = 1/p$.
- $D xi = (1 - p)/p^2$.
- $phi_xi = (p e^(i t))/(1 - (1 - p) e^(i t))$.
]
#example(name: "Непрерывное равномерное распределение")[
- Параметризуется $a, b in RR$, $b > a$.
- $xi: Omega --> [a, b]$.
- $ p_xi (t) = 1/(b - a) bb(1)_[a, b] (t) = cases(1/(b - a) "при" t in [a, b], 0 "иначе"). $
- Обозначается $xi sim U(a, b)$.
- $E xi = (a + b)/2$.
- $D xi = (b - a)^2/12$.
- $phi_xi = (e^(i t b) - e^(i t a))/(i t (b - a))$.
#subgraph(label: [$p_xi (t), xi sim U(-1; 1)$], domain: (-2, 2), t => if (t < 1 and t > -1) {1 / 2} else {0})
]
#example(name: "Нормальное распределение")[
- Параметризуется $a in RR$, $sigma > 0$.
- $xi: Omega --> RR$.
- $ p_xi (t) = 1/(sqrt(2pi) sigma) e^(-(t-a)^2 / (2 sigma^2)). $
- Обозначается $xi sim Nn(a, sigma^2)$.
- _Стандартное нормальное распределение_: $Nn(0, 1)$.
- $Phi(x) := 1/sqrt(2 pi) integral_oo^x e^(-t^2/2) dif t$ --- функция распределения для стандартного нормального распределения.
- $E xi = a$.
- $D xi = sigma^2$.
- $phi_xi = e^(i a t - (sigma^2 t^2)/2)$.
#subgraph(label: [$p_xi (t), xi sim Nn(0, 1)$], domain: (-4, 4), t => 1/(calc.sqrt(2 * calc.pi)) * calc.exp(-t*t / 2))
]
#notice[
Если $eta sim Nn(0, 1)$, то $sigma nu + a sim Nn(a, sigma^2)$.
]
#proof[
Знаем
$ F_eta (x) = 1/sqrt(2pi) integral_(-oo)^x e^(-t^2/2) dif t. $
Считаем,
$
F_(sigma eta + a) (x) =
P(sigma eta + a <= x) =
P(eta <= (x - a) / sigma) =
F_eta ((x - a) / sigma) newline(=)
1/sqrt(2pi) integral_(-oo)^((x - a)/sigma) e^(-t^2/2) dif t =
1/sqrt(2pi) integral_(-oo)^x e^(-(s - a)^2 / (2 sigma^2)) (dif s)/sigma =
F_(Nn(a, sigma^2)) (x).
$
Если что, мы подставили $t = (s - a)/sigma$, $dif t = (dif s)/sigma$.
]
#example(name: "Экспоненциальное распределение")[
- Параметризуется $lambda > 0$.
- $xi: Omega --> [0, +oo)$.
- $ p_xi (t) = lambda e^(-lambda t) bb(1)_[0, +oo) (t) = cases(lambda e^(-lambda t) "при" t >= 0, 0 "иначе"). $
- $F_xi (x) = 1 - e^(-lambda x)$ (при $x > 0$, иначе $0$).
- Обозначается $xi sim op("Exp")(lambda)$.
- $E xi = 1/lambda$.
- $D xi = 1/lambda^2$.
- $phi_xi = lambda/(lambda - i t)$.
#subgraph(label: [$p_xi (t), xi sim op("Exp")(1)$], domain: (-1, 7), t => if (t >= 0) { calc.exp(-t) } else { 0 })
]
|
|
https://github.com/WinstonMDP/knowledge | https://raw.githubusercontent.com/WinstonMDP/knowledge/master/matrixes.typ | typst | #import "cfg.typ": cfg
#show: cfg
= Матрицы
Матрицу обозначают $(a_(i j))$.
$A + B = (a_(i j) + b_(i j))$
$lambda A = (lambda a_(i j))$
Произведением матрицы $A = (a_(i j))$ размера $m times n$ и матрицы $B = (b_(j k))$
размера $n times p$ нзывается матрица $A B = (c_(i k))$ размера $m times p$, элементы
которой находятся по формулам $c_(i k) = sum_(j = 1)^n a_(i j) b_(j k)$.
Квадратная матрица имеет две диагонали. Главная диагональ - это диагональ из левого
верхнего в правый нижний. Побочная - другая.
Диагональная матрица - это квадратная матрица с ненулевыми элементами на главной
диагонали. Обозначают $"diag"(a_1, ..., a_n)$.
$E = "diag"(1, ..., 1)$ - единичная матрица.
Однородная (приведённая) с.л.а.у., ассоциированная с другой - это другая с.л.а.у., у
которой все свободные члены равны нулю.
Все квадратные матрицы порядка $n$ образуют ассоциативную алгебру с единицей, которую
обозначают $L_n (F)$. Она имеет делители нуля.
$E_(i j)$ - матричная единица: матрица на $i j$ которой стоит $1$, на остальных местах
$0$.
Матрица вида $lambda E$ называется скалярной.
$(a_(i j))^T = (a_(j i))$
Матрица с элементами $a_(i j) = 0$ при $i > j$ называется верхней треугольной.
|
|
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Physique_Act_16_10_2023_1.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: "Physique Act 16 10 2023 1",
authors: (
"<NAME>",
),
date: "30 Octobre, 2023",
)
#set heading(numbering: "1.1.")
=== Phase 3
<phase-3>
Durant la phase 3 les caractéristiques du vection vitesse reste
inchangées tout au long de la phase. Le vecteur vitesse est constant. Le
vecteur d’accélération est nul durant cette phase car le vecteur vitesse
est constant et que la dérivée d’une constante est 0 \
$x lr((t)) eq m x plus p$ \
\
$v lr((t)) eq frac(d x, d t) eq k$ \
\
$frac(d v, d t) eq 0$ \
=== Bilan :
<bilan>
On détermine les coordonnées cartésiennes des vecteurs vitesse et
accélération en dérivant les coordonnées de la position puis en dérivant
à nouveau pour trouver les coordonnées du vecteur d’accélération.
Le vecteur accélération est nul si la vitesse est constante soit si la
position est une fonction affine.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/vonsim/0.1.0/lib.typ | typst | Apache License 2.0 | #let init-vonsim(body) = {
set raw(syntaxes: "vonsim.sublime-syntax")
body
}
#let init-vonsim-with-theme(body) = {
set raw(syntaxes: "vonsim.sublime-syntax", theme: "vonsim.tmTheme")
body
}
#let background = rgb(41, 37, 36)
#let foreground = rgb(255, 255, 255)
|
https://github.com/lonkaars/typst-metalogo | https://raw.githubusercontent.com/lonkaars/typst-metalogo/master/demo.typ | typst | MIT License | #set page(width: 35em, height: auto)
#set text(font: "New Computer Modern")
#import "@preview/metalogo:1.0.2": TeX, LaTeX, XeLaTeX, XeTeX, LuaLaTeX
#LaTeX is a typestting program based on #TeX. Some people use #XeLaTeX
(sometimes #XeTeX), or #LuaLaTeX to typeset their documents.
People who are afraid of #LaTeX and its complex macro system may use typst
instead.
|
https://github.com/MaxAtoms/T-705-ASDS | https://raw.githubusercontent.com/MaxAtoms/T-705-ASDS/main/content/week10.typ | typst | #import "../template.typ": example, exercise
#import "../boxes.typ": colorbox, definition
#import "../tags.typ": week, barron
== Non-parametric tests
#barron("9.2")
Parametric tests are designed for a specific family of distributions.
Non-parametric tests #underline("do not") assume a specific distribution.
They are:
- less powerfull
- applicable to a wider range of situations
*Examples:*
- _Battery lives:_ Is the normal distribution assumption valid? We see that the sample size is too small to test normality
- _Outliers in the data:_ We know that the mean is sensitive to outliers which could greatly impact the test statistic
- _Data from surveys:_ Asking people to rank satisfaction on a scale (e.g. 'stronly agree', 'agree', 'neutral', 'disagree', 'strongly disagree'). We can not assign numbers to this directly. Similarly: Levels of education, Ranks, Intervals, ...
#definition[
Data that can be ordered from lowest to highest without numeric values is called #underline("ordinal data").
]
=== Sign test
The sign test is a test for one population.
It tests the hypothesis
$H_0: M=m #text("vs") H_A: M eq.not m #text("or") M < m #text("or") M > m$
for a population median.
We are testing whether exactly half of the population is below/above $m$.
=== Sign test procedure
1. Count how many observations are above $m$
$S_#text("obs") = S(X_1,dots,X_n) = \#{i: X_i > m}$
2. If $H_0$ is true then $m$ is the median $M$.
In this case each $X_i$ is equally likely to be above or below $m$.
Therefore:
$ S~text("Binomial")(n, p=1/2) $
3. If n is small, we use the binomial distribution to compute p-value.
If n is large we use normal approximation:
$ S~text("Norm")(n/2, sqrt(n)/2) $
*For the p-value:*
- right tail test: $p = P(S gt.eq S_text("obs"))$
- left tail test: $p = P(S lt.eq S_text("obs"))$
- two tail test: $p = 2 dot.op text("min")( P(S lt.eq S_text("obs")), P(S gt.eq S_text("obs")))$
#example(number: "10.9 Keystrokes")[
Figure 10.1 shows clearly that the keystrokes data is not normal.
We apply the sign-test instead.
1. $H_0: M=0.2 text("vs") H_A: M eq.not 0.2$
2. Find the test stat.
0.24, 0.22, 0.26, 0.34, 0.35, 0.32, 0.33, 0.29, 0.19, 0.36, 0.30, 0.15, 0.17, 0.28, 0.30, 0.40, 0.37, 0.27
$ S_text("obs") \#{i: X_i > m = 0.2} = 15 $
3. We have a two-tail test so the p-value is:
$
p &=2 dot.op text("min")(P(S lt.eq S_text("obs")), P(S gt.eq S_text("obs")))
&=2 dot.op text("min")(0.0038, 0.9993) = 0.0076
$
4. Reject $H_0$. We have enough evidence to support the claim of unauthorized use.
]
=== Wilcoxon signed-rank test
#barron("10.2.2")
We can use some of the unused information in the sign test.
Take magnitude into account.
#definition[
#underline("Rank") of any unit of a sample is its position whn the sample is arranged in increasing order (smallest to highest).
]
In a sample of size $n$, the smallest unit has rank 1, second smallest has rank 2,..., and the largest has rank $n$.
If two or more observations are equal, their rank is replaced by their average rank.
$R_i$ is the rank of the i-th observation.
#example[
3 7 5 6 5 4 \
1 6 3.5 5 3.5 2
3+4/2 = 3.5
$R_1 = 1$
$R_2 = 6$
$R_3 = 3.5$
$R_4 = 5$
$R_5 = 3.5$
$R_6 = 2$
]
=== Wilcoxon signed-rank test procedure
We test the hypothesis
$ H_0: M = m text("vs") H_A: M eq.not m text("or") M < m text("or") M > m $
1. Look at the distances between observations and $m$.
//$ d_i = abs([$X_i - m$]) $
$ d_i = |X_i - m| $
2. Order the distances $d_i$ and compute their rank (ranks of $d_i$).
3. Look at the ranks that correspond to $X_i > m$.
And compute the test statistic:
$ W = sum_(i:X_i > m) R_i $
4. The null distribution is
For $n gt.eq 15$:
$ N approx text("Norm")(n(n+1)/4, sqrt((n(n+1)(2n+1))/24))$
We assume that $X_i$ have a continous and symmetric distribution.
#example(number:"10.12 Supply and demand")[
7, 5.5, 9.5, 6, 3.5, 9
1. $H_0: M = 5 text("vs") H_A: M > 5 $
2.
#table(
columns: 6,
[$i$], [$X_i$], [$X_i - 5$], [$d_i$], [$R_i$], [sign(w.r.t. 5)],
[1], [7], [2], [2], [4], [+],
[2], [5.5], [0.5], [0.5], [1], [+],
[3], [9.5], [4.5], [4.5], [6], [+],
[4], [6], [1], [1], [2], [+],
[5], [3.5], [-1.5], [1.5], [3], [+],
[6], [9], [4], [4], [5], [+],
)
Finding the test statistic:
$
W_text("obs") = sum_(i: X_i > m) R_i = 4+1+6+2+5 = 18
$
3. $W_text("obs")~text("Norm")((6 dot.op 7)/4, sqrt((6 dot.op 7 dot.op 13)/24))$
$p = P(W_text("obs")) = P((18 - 21/2)/sqrt(22.75) > z) = P(1.57 > z) = 1 - 0.9418 = 0.0592$
Do not reject because $p > alpha = 0.05$
]
|
|
https://github.com/ralphmb/typst-template-stats-dissertation | https://raw.githubusercontent.com/ralphmb/typst-template-stats-dissertation/main/README.md | markdown | Apache License 2.0 | ## My Stats Dissertation
This is the template I made for my final year project in Maths and Stats.
The code used for generating headers was written by <NAME>, [and comes from this repo](https://github.com/zagoli/simple-typst-thesis).
I think I've changed it a bit but it's still almost entirely their work, used under the Apache license, thank you to them as I'd not have been able to figure the headers out myself.
The rest is mine. I've removed most of the content except one plot and one reference.
Feel free to reuse anything if you can find a use for it.
The actual thesis can be found under */writeup/*. If you install typst and compile the file *main.typ* using `typst compile main.typ` or `typst watch main.typ` for automatic compilation, you'll generate the file 'main.pdf'. The 'sections' folder contains the files for each section - literature review, bibliography etc. 'assets' is where I put all images, large code files to be read etc.
I also used Typst for the thesis presentation. This is found in presentation/pres.typ. Compiling this will get you a pdf with one slide per page. It uses a package called Polylux.
`wordcounter` is a small script I used to check the wordcount while writing. There's definitely better ways to do this but it's a good approximation. It just calls `wc -w` on each relevant source file and adds the results, giving an itemised breakdown.
`committer` is a script I used for backups. If you're using git version control you could write it in here. It backs up relevant notes from my Obsidian vault, copies code from my working R folder and places it in the writeup assets for addition into appendices, and opens Google Drive in my browser.
`tablemaker.py` is a script that can take copy-pasted R output and turn it into Typst tables. Since I had to talk about a million different regression models and their coefficients this saved me quite a lot of time. Ideally this might be written in R or Typst itself.
Thanks!
|
https://github.com/Mc-Zen/quill | https://raw.githubusercontent.com/Mc-Zen/quill/main/examples/shor-nine-qubit-code.typ | typst | MIT License | #import "../src/quill.typ": *
#let ancillas = (setwire(0), 5, lstick($|0〉$), setwire(1), targ(), 2, [\ ],
setwire(0), 5, lstick($|0〉$), setwire(1), 1, targ(), 1)
#quantum-circuit(
scale: 80%,
lstick($|ψ〉$), 1, 10pt, ctrl(3), ctrl(6), $H$, 1, 15pt,
ctrl(1), ctrl(2), 1, [\ ],
..ancillas, [\ ],
lstick($|0〉$), 1, targ(), 1, $H$, 1, ctrl(1), ctrl(2),
1, [\ ],
..ancillas, [\ ],
lstick($|0〉$), 2, targ(), $H$, 1, ctrl(1), ctrl(2),
1, [\ ],
..ancillas
) |
https://github.com/kdog3682/typkit | https://raw.githubusercontent.com/kdog3682/typkit/main/0.1.0/src/marks.typ | typst | #import "math-marks.typ" as math
#import "strokes.typ"
#let soft = (
width: 0.2,
length: 0.3,
stroke: strokes.soft,
start: ">",
end: ">",
fill: black,
)
#let double-sided-arrow-mark = (
width: 0.2,
length: 0.3,
stroke: strokes.soft,
start: ">",
end: ">",
fill: black,
)
#let arrow-mark = (
width: 3,
length: 3,
end: ">",
fill: black,
)
|
|
https://github.com/Ciolv/typst-template-t3000 | https://raw.githubusercontent.com/Ciolv/typst-template-t3000/main/main.typ | typst | MIT License | #import "template.typ": *
#show: t3000.with(
title: "Titel",
abstract: [
Abstrakt-Text in 9 Punkte Time New Roman.
],
authors: (
(name: "Autor", organization: "<NAME>", email: "E-mail-Adresse"),
),
bibliography-file: "references.yml",
)
= Überschrift 1
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
== Unterüberschift (“Überschrift2”)
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
= Überschrift 1
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
\
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
\
Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.
== Umfang der Hausarbeit
Die Hausarbeit sollte 3-7 Seiten umfassen (in der angegebenen Formatierung, siehe auch @FTK).
#v(1em)
#align(center,[== Zitate und Referenzen])
#v(0.5em)
Alle Hausarbeiten müssen den Author/Jahr-Stil verwenden, also z.B. (FKT 2019).
Für die Formatierung ist die Reference-Formatvorlage zu verwenden. Alle Referenzen müssen alphabetisch sortiert sein.
|
https://github.com/brayevalerien/Learning-Typst | https://raw.githubusercontent.com/brayevalerien/Learning-Typst/main/tutorial/01_writing_in_typst/writing.typ | typst | MIT License | This is a sample test, just to test Typst capabilities and make sure my environment is properly set up. Apparently everything is working properly! Using Typst in VSCode is super simple, I just had to download the Typst LSP extention and everything was setup automatically.
= Section title
This is a section, and there is a title just above this paragraph. It is formated as a header because I used a "=" symbol before it in the source code.
== Subsection title
To change header level, I simply use more "=" symbols. The subsection title above this paragraph has two "=" in front of it in the source code and is thus rendered as a level 2 header.
== What about paragraphs?
Creating a paragraph is easy: symply write some text.
To create another paragraph, I just have to use two line breaks, just like this!
== Comparison with LaTeX
At first glance, Typst source code seems more straight forward that LaTeX, where I would have had to use "\\section{}" and "\\subsection{}" for sections and subsections.
New paragraphs require "\\\\" in LaTeX, but not in Typst.
Note that I have to escape the backslashes ("\\") in the source code, using another backslash.
= Compiling
Compiling is very fast and happens in a matter of tenths of a second. Very good for iterating quickly! I would be interested in knowing how fast an actual article with many figures and images would perform.
With the Typst LSP extention for VSCode, compiling happens on save. It creates a pdf file next to the typ source file, with no additional junk. Pretty clean!
Without the extension, compiling a typ file can be done through a simple command, calling the Typst compiler on the source file.
= Lists
Unumbered lists are done using "-":
- this is an item
- this is another item
- ...
Numbered list simply use "+" instead of "-":
+ this is the first item
+ this is the second item
+ ...
Obviously, lists can be nested:
+ first of all, I can nest numbered lists:
+ this is sub-item 1
+ this is sub-item 2
+ and unumbered lists too:
- a sub-item
- another sub-item that has a nested, numbered, list:
+ look at me!
+ and at me too!
= Figures
Cute kitties are super cool so I need to have a way to put some in my Typst documents! Look at this cute kitty in Game of Thrones:
#figure(
image("kitty.png", width: 50%),
caption: [
A cute kitty in _Game of Thrones_
]
) <kitty>
On a side note, the @kitty has been generated by the _Flux.1_ AI model. Have you noticed that I just made a clickable reference to a figure AND that I just learned how to write _italicized_ text?
= About this document
This document has been written to learn and test the Typst language. As someone with some LaTeX experience, I'm curious to see how Typst feels and how it could be usefull to me so I just write this to try out it features.
I'm following the official Typst tutorial @tutorial.
= Math
Obviously, since I'm passionate about generative AI, I need to be able to type quite advanced math pretty easily. Let's test this out in this section!
== Inline equations
Inline equations work similarly to LaTeX, simply by using "\$" (I had to escape this symbol using a backslash).
Diffusion models usually try to sample new a data point $x_0$ following the training data distribution, using what's called a reverse diffusion process to progressively denoise a pure gaussian noise sample $x_T arrow.r.hook cal(N)(0, 1)$.
It wasn't obvious how to write the round $cal(N)$, but apparently you can symply use the "cal" function in math mode @mathfonts. I can't wait to learn how to write inline code just to be able to properly write "cal" instead of using double quotes by the way! It also demonstrates how Typst uses functions in math mode to define custom symbols. I guess I will learn how to define custom functions latter on in this tutorial?
Writing $arrow.r.hook$ is interesting. Indeed, it shows that symbols are defined as elements of classes. $arrow.r.hook$ is the "hook" element of the "arrow.r" (right arrow) class.
== Full equations
Writing inline equations is easy. But it's as easy to put them on their own line! I just need to put the equation on it's own line in the source code, separating it from the previous and next paragraphs with line breaks and placing spaces between the "\$" symbols and the equation.
The reverse diffusion process of a diffusion model is defined by it's _reverse diffusion kernel_ $q(x_t |x_(t-1))$. Since the process is markovian, $x_T, x_(T-1), ..., x_1$ are independent and we can thus get the joint probability distribution of these variables conditionally to $x_0$:
$ q(x_1, ..., x_T | x_0) = product_(t=1)^T q(x_t | x_(t-1)) $
I notice two things right of the bat:
- to group things together, we use parenthesis "()" and not curly brackets "{}"
- the size of the parenthesis in the compiled equations automatically adapt to what is inside them, no need for the "\\left( ... \\right)" synthax.
#bibliography("ref.bib") |
https://github.com/noneback/typst-template | https://raw.githubusercontent.com/noneback/typst-template/main/blog_template.typ | typst | #let doc_tmplate(
title: none,
authors: (),
keywords: (),
category:(),
abstract: [],
doc
) = {
set page(
paper: "us-letter", header: align(right+horizon, title), numbering: "1",
)
set par(
justify: true
)
set text(
font: ("Times New Roman","Songti SC"),
size: 11pt
)
show link: underline
// title
align(center , text(17pt)[
*#title*
])
// author
let ncols = calc.min(authors.len(), 3)
set align(center)
grid(
columns: (1fr,) * ncols, row-gutter: 24pt,
..authors.map(author => [
#author.name \
#author.affiliation \
#link("mailto:" + author.email)
])
)
// abstract
par(justify: false)[
*Abstract* \
#abstract
]
// keyword & category
par(justify: true)[
#align(left)[
*keywords*: #keywords \
*categories*: #category \
]
]
// heading
show heading.where(
level: 1
): it => block(width: 100%)[
#set align(center)
#set text(12pt, weight: "bold")
#it.body \
]
show heading.where(
level: 2
): it => block(width: 100%)[
#set align(left)
#set text(11pt, weight: "bold", style: "italic")
#it.body\
]
show heading.where(
level: 3
): it => block(width: 100%)[
#set align(center)
#set text(11pt, weight: "regular", style: "italic")
#smallcaps(it.body)
]
// outline
set heading(numbering: "1.1.")
outline(
indent: 1em
)
linebreak()
// list item
set enum(numbering: "1.a.i")
// content
columns(2, align(left)[#doc])
}
#let insert_image(
path, name, desc
)= {
figure(
image(path, width:90%), caption: [#desc],
)
}
/* */
|
|
https://github.com/grnin/Zusammenfassungen | https://raw.githubusercontent.com/grnin/Zusammenfassungen/main/Bsys2/09_Message_Passing.typ | typst | // Compiled with Typst 0.11.1
#import "../template_zusammenf.typ": *
#import "@preview/wrap-it:0.1.0": wrap-content
/* #show: project.with(
authors: ("<NAME>", "<NAME>"),
fach: "BSys2",
fach-long: "Betriebssysteme 2",
semester: "FS24",
tableofcontents: (enabled: true),
language: "de"
) */
= Message Passing und Shared Memory
Prozesse sind voneinander _isoliert_, müssen jedoch trotzdem miteinander _interagieren_.\
*Beispiel Chrome Browser:*
Jede Seite wird durch einen eigenen Prozess gerendert, Seiten können sich _nicht_
gegenseitig _beeinflussen_. Ein weiterer Prozess stellt _GUI_ sowie Zugriffe auf
Filesystem und Netzwerk zur Verfügung.
Dies _reduziert_ Auswirkungen von _Security-Exploits_.
== Message-Passing / Message Queueing
Message-Passing ist ein Mechanismus mit zwei Operationen:
- _Send:_ Kopiert die Nachricht _aus_ dem Prozess: ```c send (message)```
- _Receive:_ Kopiert die Nachricht _in_ den Prozess: ```c receive (message)```
Dabei können Implementierungen nach verschiedenen Kriterien unterschieden werden:
- #link(<message-size>)[_Feste_ oder _Variable_ Nachrichtengrösse]
- #link(<message-direct>)[_Direkte_] oder
#link(<message-indirect>)[_indirekte_] Kommunikation
- #link(<message-sync>)[_Synchrone_ oder _asynchrone_ Kommunikation]
- #link(<message-buffer>)[_Puffering_]
- #link(<message-prio>)[Mit oder ohne _Prioriäten_ für Nachrichten]
#pagebreak()
=== Feste oder variable Nachrichtengrösse <message-size>
Message-Passing mit _fester Nachrichtengrösse_ ist _umständlicher zu verwenden_.
Benutzer muss bei _Überschreiten_ der Nachrichtengrösse selbst _Vorsorge treffen_,
um die Nachricht in kleinere Teilnachrichten aufzutrennen. Bei _Unterschreiten_ wird
Speicher _verschwendet_.\
Message-Passing mit _variabler Nachrichtengrösse_ ist _aufwändiger zu implementieren_.
=== Direkte Kommunikation - Senden <message-direct>
Bei direkter Kommunikation werden Nachrichten von einem Prozess $P_1$ an einen Prozess
$P_2$ adressiert. $P_1$ muss den Empfänger einer Nachricht kennen.
Kommunikation _nur zwischen genau zwei Prozessen_ #hinweis[`send(P2, message)`].
=== Direkte Kommunikation - Empfangen
- _Symmetrische direkte Kommunikation:_ $P_2$ muss den Sender seiner Nachricht _kennen_
#hinweis[`receive(P1, message)`]
- _Asymmetrische direkte Kommunikation:_ $P_2$ muss den Sender seiner Nachricht _nicht_
kennen, sondern erhält die ID in einem Out-Parameter #hinweis[`id receive (id, message)`]
=== Indirekte Kommunikation <message-indirect>
Bei indirekter Kommunikation existieren spezifische OS-Objekte: _Mailboxen, Ports oder Queues_.
- Prozess $P_1$ _sendet_ Nachrichten _an eine Queue_ $Q$ #hinweis[`send(Q, message)`]
- Prozess $P_2$ _empfängt_ Nachrichten _aus einer Queue_ $Q$ #hinweis[`receive(Q, message)`]
Kommunikation erfordert, dass beide Teilnehmer die _gleiche Mailbox kennen_.
Es kann _mehr als eine_ Mailbox zwischen zwei Teilnehmern geben.
==== Mehr als zwei Teilnehmer
Bei mehr als zwei Teilnehmer müssen Regeln definiert werden, welcher Prozess die Nachricht
empfängt, wie _Beschränkung_ der Queue auf nur einen Sender und Empfänger,
Beschränkung des Aufrufs von `receive` auf nur einen Prozess, _zufällige Auswahl_ oder
Auswahl nach _Algorithmus_.
==== Lebenszyklus der Queue
- _Queue gehört einem Prozess:_ Queue lebt solange wie der Prozess
- _Queue gehört dem Betriebssystem:_ Queue existiert unabhängig von einem Prozess.
OS muss Mechanismus zum Erzeugen und Löschen der Queue zur Verfügung stellen.
=== Synchronisation <message-sync>
Message-Passing kann _blockierend (synchron)_ oder _nicht-blockierend (asynchron)_ sein,
alle Kombinationen sind möglich:
- _Blockierendes Senden:_ Sender wird solange blockiert, bis die Nachricht vom Empfänger
empfangen wurde
- _Nicht-blockierendes Senden:_ Sender sendet Nachricht und fährt sofort weiter
- _Blockierendes Empfangen:_ Empfänger wird blockiert, bis Nachricht verfügbar
- _Nicht-blockierendes Empfangen:_ Empfänger erhält Nachricht, wenn verfügbar, oder 0
==== Rendezvous
Sind Empfang und Versand _beide blockierend_, kommt es zum _Rendezvous_, sobald beide
Seiten ihren Aufruf getätigt haben #hinweis[(Sender weiss, dass Empfänger empfangen hat)].
OS kann eine _Kopieroperation sparen_ und _direkt_ vom Sende- in den Empfänger-Prozess
kopieren. _Impliziter Synchronisationsmechanismus_.
#columns(2, gutter: 0em)[
```c
// Producer
message msg;
open (Q);
while (1) {
produce_next (&msg);
send (Q, &msg); // blocked until sent
}
```
#colbreak()
```c
// Consumer
message msg;
open (Q);
while (1) {
receive (Q, &msg); // blocked until received
consume_next (&msg);
}
```
]
#pagebreak()
=== Pufferung <message-buffer>
Je nach Nachrichten-Kapazität der Queue kann man drei Arten des Pufferung unterscheiden:
- _Keine:_ Queue-Länge ist 0, keine Nachrichten können gespeichert werden,
Sender muss blockieren
- _Beschränkte:_ Maximal $n$ Nachrichten können gespeichert werden.
Sender blockiert erst, wenn Queue voll ist.
- _Unbeschränkte:_ Beliebig viele Nachrichten passen in die Queue, Sender blockiert nie
=== Prioritäten <message-prio>
In manchen Systemen können Nachrichten mit _Prioritäten_ versehen werden.
Der Empfänger holt die Nachricht mit der _höchsten Priorität zuerst_ aus der Queue.
=== POSIX Message-Passing
OS-Message-Queues mit _variabler Länge_, haben mind. 32 Prioritäten und können
_synchron und asynchron_ verwendet werden.
==== ```c mqd_t mq_open (const char *name, int flags, mode_t mode, struct mq_attr *attr);```
_Öffnet eine Message-Queue_ mit systemweitem `name` und gibt einen
_Message-Queue-Descriptor_ zurück.
- _`name`_ sollte immer mit `/` beginnen und sonst keine `/` enthalten
- _`flags`:_
`O_RDONLY` für read-only,
`O_RDWR` für lesen und schreiben,
`O_CREAT` erzeugt Queue, falls sie nicht existiert und
`O_NONBLOCK` definiert dass `send` und `receive` nicht blockieren
- _`mode`:_ Legt Zugriffsberechtigungen fest: `S_IRUSR` | `S_IWUSR`
- _`struct mq_attr`:_ Beinhaltet Flags, maximale Anzahl Nachrichten in Queue,
maximale Nachrichtengrösse und Anzahl der Nachrichten, die aktuell in der Queue sind.
Lesen/Schreiben mit `mq_getatrr`/`mq_setattr`.
==== ```c int mq_close (mqd_t queue);```
_Schliesst die Queue_ mit dem Descriptor `queue` für diesen Prozess.
Sie _bleibt_ aber noch _im System_, bis sie entfernt wird.
==== ```c int mq_unlink (const char *name);```
_Entfernt die Queue_ mit dem Namen `name` aus dem System.
_Name_ wird _sofort entfernt_ und Queue kann anschliessend _nicht mehr geöffnet_ werden.
_Queue_ selber wird _entfernt_, sobald _alle Prozesse sie geschlossen_ haben.
==== ```c int mq_send (mqd_t queue, const char *msg, size_t length, unsigned int priority);```
_Sendet die Nachricht_, die an Adresse `msg` beginnt und `length` Bytes lang ist, in die `queue`.
_Blockiert_ erst, wenn die _Queue voll_ ist #hinweis[(ausser mit `O_NONBLOCK`, returnt
dann -1)]. Gibt es auch als Variante mit _Timeout_: `mq_timedsend`.
==== ```c int mq_receive (mqd_t queue, const char *msg, size_t length, unsigned int *priority);```
_Kopiert die nächste Nachricht_ aus der Queue in den Puffer, der an Adresse `msg` beginnt
und `length` Bytes lang ist #hinweis[(sollte $>=$ max msg size der Queue sein)].
_Blockiert_, wenn die Queue _leer_ ist.
Gibt es auch als Variante mit _Timout_: `mq_timedreceive`.
`priority` ist ein Out-Parameter für die Priorität der empfangenen Nachricht.
Gibt _Grösse_ der empfangenen Nachricht zurück.
#wrap-content(
image("img/bsys_39.png"),
align: top + right,
columns: (50%, 50%),
)[
== Shared Memory
Frames des Hauptspeichers werden _zwei (oder mehr) Prozessen_ $P_1$ und $P_2$
_zugänglich_ gemacht. In $P_1$ wird Page $V_1$ auf einen Frame $F$ abgebildet.
In $P_2$ wird Page $V_2$ auf _denselben_ Frame $F$ abgebildet.
Beide Prozesse können _beliebig_ auf dieselben Daten zugreifen.
Eine Adresse in $V_1$ ergibt nur für $P_1$ Sinn, dieselbe Adresse gehört für $P_2$ zu
einer _völlig anderen_ Speicherstelle. _Keine absoluten Adressen/Pointer verwenden!_
Im Shared Memory müssen _relative Adressen_ verwendet werden.
#hinweis[(Pointer müssen relativ zur Anfangs-Adresse sein, z.B. als Offset bezogen auf Start-Adresse)]
]
=== POSIX API
Das OS benötigt ein _spezielles Objekt $bold(S)$_, das Informationen über den gemeinsamen
Speicher verwaltet. $S$ wird in POSIX wie eine Datei verwendet.\
Ausserdem benötigt das OS ein _Objekt $bold(M_i)$_, je Prozess $P_i$, der diesen Speicher
verwenden möchte, um die spezifischen Mappings zu speichern #hinweis[(Mapping Table)].
==== ```c int shm_open (const char *name, int flags, mode_t mode);```
_Öffnet ein Shared Memory_ mit system-weitem `name` und gibt FD zurück.
- _`name`_ sollte immer mit `/` beginnen und sonst keine `/` enthalten
- _`flags`:_
`O_RDONLY` für read-only,
`O_RDWR` für lesen und schreiben,
`O_CREAT` erzeugt Shared Memory, falls es nicht existiert
- _`mode`:_ Legt Zugriffsberechtigungen fest: `S_IRUSR` | `S_IWUSR`
```c
int fd = shm_open ("/mysharedmemory", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
// Erzeugt (falls nötig) und öffnet Shared Memory /mysharedmemory zum Lesen und Schreiben
```
==== ```c int ftruncate (int fd, offset_t length);```
_Setzt Grösse der "Datei"_.
Gibt 0 zurück wenn alles OK, sonst -1 und Fehlercode in `errno`.
Muss _zwingend_ nach SM-Erstellung gesetzt werden, um entsprechend viele Frames zu allozieren.
Wird für Shared Memory _mit ganzzahligen Vielfachen_ der Page-/Framegrösse verwendet.
==== ```c int close (int fd);```
_Schliesst "Datei"_. Gibt 0 zurück wenn alles OK, sonst -1 und Fehlercode in `errno`.
Shared Memory _bleibt aber im System_, auch wenn kein Prozess das Shared Memory mehr offen hält.
==== ```c int shm_unlink (const char * name);```
_Löscht_ das Shared Memory mit dem `name` aus dem System. Dies kann danach _nicht mehr
geöffnet_ werden, bleibt aber _vorhanden_, bis es kein Prozess mehr geöffnet hält.
==== ```c
void * mmap(void *hint_address, size_t length, int protection, int flags,
int file_descriptor, off_t offset)
```
Mapped das Shared Memory, das mit `fd` geöffnet wurde, in den virtuellen Adressraum des
laufenden Prozesses und gibt die (virtuelle) Addresse des ersten Bytes zurück.
```c
void * address = mmap(
0, // void *hint_address (0 because nobody cares)
size_of_shared_memory, // size_t length (same as used in ftruncate)
PROT_READ | PROT_WRITE, // never use execute
MAP_SHARED, // int flags
fd, // int file_descriptor
0 // off_t offset (start map from first byte)
);
```
==== ```c int munmap (void *address, size_t length);```
_Entfernt das Mapping_ wieder aus dem virtuellen Adressraum.
== Vergleich Message-Passing & Shared Memory
_Shared Memory_ ist oft der _schneller zu realisierende Ansatz_.
Existierende Applikationen können relativ schnell auf mehrere Prozesse mit Shared Memory
umgeschrieben werden. Oft aber _schwer wartbar_.
Das System ist _weniger stark modularisiert_ und Prozesse sind schlechter gegeneinander _geschützt_.
_Message-Passing_ erfordert _mehr Engineering-Aufwand_.
Existierende Applikationen müssen in grossen Teilen neu implementiert werden.
Bei _sauber gekapselten_ Anwendungen viel geringeres Problem.
Lassen sich leicht als _verteilte Systeme_ erweitern.
Bei einigen OS sogar schon implementiert, z.B. QNX
#pagebreak()
=== Performance
- _Einzel-Prozessor-System:_ Im Normalfall Shared-Memory wegen entfallenden Kopieroperationen
- _Mehr-Prozessor-System:_ Shared-Memory benötigt zusätzlichen Aufwand aufgrund Cache-Synchronisation
Message-Passing-Systeme liegen auf Mehr-Prozessor-Systemen häufig _gleichauf_ und werden
in Zukunft vermutlich sogar _performanter_ sein als Shared-Memory-Systeme.
== Vergleich Message-Queues & Pipes
#table(
columns: (1fr, 1fr),
table.header(
[Message-Queues],
[Pipes],
),
[
- bidirektional
- Daten sind in einzelnen Messages organisiert
- beliebiger Zugriff
- Haben immer einen Namen
],
[
- unidirektional
- übermittelt Bytestrom an Daten
- FIFO-Zugriff
- Müssen keinen Namen haben
],
)
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/attach-p3_01.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test forcing scripts and limits.
$ limits(A)_1^2 != A_1^2 $
$ scripts(sum)_1^2 != sum_1^2 $
$ limits(integral)_a^b != integral_a^b $
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/quill/0.2.1/README.md | markdown | Apache License 2.0 | <h1 align="center">
<img alt="Quill" src="docs/images/logo.svg" style="max-width: 100%; width: 300pt">
</h1>
<p align="center">
<a href="https://typst.app/docs/packages/">
<img alt="Typst Package" src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FMc-Zen%2Fquill%2Fmain%2Ftypst.toml&query=%24.package.version&prefix=v&logo=typst&label=package&color=239DAD"/>
</a>
<a href="https://github.com/Mc-Zen/quill/actions/workflows/run_tests.yml">
<img alt="Test Status" src="https://github.com/Mc-Zen/quill/actions/workflows/run_tests.yml/badge.svg"/>
</a>
<a href="https://github.com/Mc-Zen/quill/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue"/>
</a>
</p>
**Quill** is a package for creating quantum circuit diagrams in [Typst](https://typst.app/).
Repository: https://github.com/Mc-Zen/quill
_Note, that this package is in beta and may still be undergoing breaking changes. As new features like data types and scoped functions will be added to Typst, this package will be adapted to profit from the new paradigms._
_Meanwhile, we suggest importing everything from the package in a local scope to avoid polluting the global namespace (see example below)._
## Usage
Create circuit diagrams by calling the function `quantum-circuit()` with any number of positional arguments — just like the built-in Typst functions `table()` or `grid()`. A variety of different gate and instruction commands are available for adding elements and plain numbers can be used to produce any number of empty cells filled with the current wire style. A new wire is started by adding a `[\ ]` item.
```typ
#{
import "@preview/quill:0.2.1": *
quantum-circuit(
lstick($|0〉$), $H$, ctrl(1), rstick($(|00〉+|11〉)/√2$, n: 2), [\ ],
lstick($|0〉$), 1, targ(), 1
)
}
```
<h3 align="center">
<img alt="Bell Circuit" src="docs/images/bell.svg">
</h3>
Plain quantum gates — such as a Hadamard gate — can be written with the shorthand notation `$H$` instead of the more lengthy `gate($H$)`. The latter offers more options.
Refer to the [user guide](docs/guide/quill-guide.pdf) for a full documentation of this package.
## Gallery
<h3 align="center">
<img alt="Gallery" src="docs/images/gallery.svg" />
</h3>
## Examples
Some show-off examples, loosely replicating figures from [Quantum Computation and Quantum Information by <NAME> and <NAME>](https://www.cambridge.org/highereducation/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE#overview).
<h3 align="center">
<img alt="Quantum teleportation circuit" src="docs/images/teleportation.svg">
</h3>
<h3 align="center">
<img alt="Quantum circuit for phase estimation" src="docs/images/phase-estimation.svg">
</h3>
<h3 align="center">
<img alt="Quantum fourier transformation circuit" src="docs/images/qft.svg">
</h3>
## Tests
This package uses [typst-test](https://github.com/tingerrr/typst-test/) for running [tests](tests/).
## Changelog
### v0.2.1
- Improvements:
- Add `fill` parameter to `midstick()`.
- Add `bend` parameter to `permute()`.
- Add `separation` parameter to `permute()`.
- Fixes:
- With Typst 0.11.0, `scale()` now takes into account outer alignment. This broke the positioning of centered/right-aligned circuits, e.g., ones put into a `figure()`.
- Change wires to be drawn all through `ctrl()`, making it consistent to `swap()` and `targ()`.
### v0.2.0
- New features:
- Add arbitrary labels to any `gate` (also derived gates such as `meter`, `ctrl`, ...), `gategroup` or `slice` that can be anchored to any of the nine 2d alignments.
- Add optional gate inputs and outputs for multi-qubit gates (see gallery).
- Implicit gates (breaking change ⚠️): a content item automatically becomes a gate, so you can just type `$H$` instead of `gate($H$)` (of course, the `gate()` function is still important in order to use the many available options).
- Other breaking changes ⚠️:
- `slice()` has no `dx` and `dy` parameters anymore. Instead, labels are handled through `label` exactly as in `gate()`. Also the `wires` parameter is replaced with `n` for consistency with other multi-qubit gates.
- Swap order of row and column parameters in `annotate()` to make it consistent with built-in Typst functions.
- Improvements:
- Improve layout (allow row/column spacing and min lengths to be specified in em-lenghts).
- Automatic bounds computation, even for labels.
- Improve meter (allow multi-qubit gate meters and respect global (per-circuit) gate padding).d
- Fixes:
- `lstick`/`rstick` braces broke with Typst 0.7.0.
- `lstick`/`rstick` bounds.
- Documentation
- Add section on creating custom gates.
- Add section on using labels.
- Explain usage of `slice()` and `gategroup()`.
<!-- - Add Tips and tricks section -->
### v0.1.0
Initial Release |
https://github.com/rangerjo/tutor | https://raw.githubusercontent.com/rangerjo/tutor/main/example/src/ex2/ex.typ | typst | MIT License | #import "@local/tutor:0.4.0": points, lines
#let exercise(cfg) = [
#heading(level:cfg.level,
[FHIR vs HL7v2 (#points(4.5) points)])
List two differences between HL7v2 and FHIR:
+ #if cfg.sol { [ HL7v2 uses a non-standard line format, where as FHIR uses XML or JSON] } else { [ #lines(cfg,3) ] }
+ #if cfg.sol { [ FHIR specifies various resources that can be queried, where as HL7v2 has a number of fixed fields that are either filled in or not]} else { [ #lines(cfg,3) ] }
]
|
https://github.com/AU-Master-Thesis/thesis | https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/0-predoc/nomenclature.typ | typst | MIT License | #import "../../lib/mod.typ": *
= Nomenclature <nomenclature>
// #jonas[Check this out]
#par(first-line-indent: 0pt)[Some terminology and type setting used in this thesis may not be familiar to the reader, and are explained here for clarity.]
#term-table(
[*crate*], [
A crate is a compilation unit in Rust. It contains the modules, types, and functions that together makes up a logical grouping of source code. For the purpose of this thesis, it can be interchaintably substituted with the notion of a _library_ found in many other programming languages.
],
[`monospace`], [Monospace text is used for inline code snippets and direct reference to files.],
[`T`], [Any monospaced text starting with a capital letter refers to a Rust type. A type in Rust is either a struct, a tagged enum, or a union.],
[`Container<'a, T>`], [A type `Container` which is generic over a lifetime `'a` and a type `T` with no constraints. A lifetime in Rust is a unique concept that specifies how long a reference to a value must remain valid.
],
[`<file>`], [A reference to a specific source file e.g. `config.toml`],
[`<file>:<int>`], [A reference to a specific source file and line number e.g. `config.toml:5`],
[`<file>:<int>-<int>`], [A reference to a specific source file and line number range e.g. `config.toml:5-10`],
// [#source-link("https://www.youtube.com/watch?v=dQw4w9WgXcQ", "<file>")], [],
[#source-link("https://github.com/AU-Master-Thesis/gbp-rs", "<file>")], [A hyperlink reference to a specific source file or repository. Can be clicked on in a PDF viewer to access the URL.],
// [*Inline Figures* #h(0.5em) #sr], []
)
|
https://github.com/felsenhower/kbs-typst | https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/27.typ | typst | MIT License | #table(
columns: 3,
[Name], [Posten], [Gehalt],
..(json("sample.json").map(x => (
x.vorname + " " + x.name,
x.posten,
str(x.gehalt) + " €")
).flatten())
)
|
https://github.com/EtoDemerzel0427/resume.typst | https://raw.githubusercontent.com/EtoDemerzel0427/resume.typst/main/README.md | markdown | # resume.typst
A simple and elegant resume template in [Typst](https://github.com/typst/typst). This template is modified from [simplecv](https://github.com/LaurenzV/simplecv) and is inspired by [typst-chi-cv-template](https://github.com/matchy233/typst-chi-cv-template).
🚧 **This template is still WIP, and subject to changes until I finalize my own resume.**
## Example
<img width="569" alt="image" src="https://user-images.githubusercontent.com/32998901/236611314-a23f6a63-adb9-4407-8c43-35b53d904d2f.png">
|
|
https://github.com/lucifer1004/leetcode.typ | https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/problems/p0012.typ | typst | #import "../helpers.typ": *
#import "../solutions/s0012.typ": *
= Integer to Roman
Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
#align(center)[#table(
columns: (auto, auto),
align: center,
[*Symbol*], [*Value*],
[I], [1],
[V], [5],
[X], [10],
[L], [50],
[C], [100],
[D], [500],
[M], [1000],
)]
For example, `2` is written as `II` in Roman numeral, just two one's added together. `12` is written as `XII`, which is simply `X + II`. The number `27` is written as `XXVII`, which is `XX + V + II`.
Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not `IIII`. Instead, the number four is written as `IV`. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as `IX`. There are six instances where subtraction is used:
- `I` can be placed before `V` (5) and `X` (10) to make 4 and 9.
- `X` can be placed before `L` (50) and `C` (100) to make 40 and 90.
- `C` can be placed before `D` (500) and `M` (1000) to make 400 and 900.
Given an integer, convert it to a roman numeral.
#let integer-to-roman(num) = {
// Solve the problem here
}
#testcases(
integer-to-roman,
integer-to-roman-ref, (
(num: 3),
(num: 58),
(num: 1994)
)
)
|
|
https://github.com/f7ed0/typst-template | https://raw.githubusercontent.com/f7ed0/typst-template/master/lib/blocks.typ | typst | #let codeblock(content,type : "",filename: "") = {
pad(
block(
[
#if type != "" or filename != "" {
grid(columns: (1fr,1fr),
pad(
text(filename,
size: 9pt,
font: "Fira Code",
),
bottom:-6pt,
left : 5pt,
top : 5pt
),
align(right,
pad(
text(type,
size: 9pt,
fill : rgb(123,104,238,255),
font: "Fira Code"
),
bottom:-7pt,
right : 5pt,
top : 5pt,
)
)
)
pad(line(length: 100%, stroke : rgb(100,100,100,255)), bottom: -13pt)
}
#pad(align(left,content),x : 5pt, y: 5pt)
],
width: 100%,
fill : rgb(245,245,245),
stroke : rgb(100,100,100,255),
radius: 5pt
),
x : 12pt
)
}
#let levels = (
info : (
icon : "assets/info_icon.png",
background : rgb(189,203,221,150)
),
knowledge : (
icon : "assets/book_icon.png",
background : rgb(0,67,0,40)
),
warning : (
icon : "assets/error_icon.png",
background : rgb(187,39,26,50)
)
)
#let remark(content, level:levels.info) = {
pad(
block(
pad(
grid(
columns: (30pt, 1fr),
align(
horizon,
block(
image(level.icon,width: 25pt,height: 25pt ),
//fill : level.accent,
radius: 10pt,
)
),
pad(content,
left: 5pt,
y :5pt
)
),
rest : 10pt
),
fill : level.background,
radius: 10pt,
),
x : 15pt
)
}
#let coloredLink(lnk,value) = link(lnk,text(value,fill:rgb(123,104,238,255)))
#let pseudocode(content) = text(content,font: "DejaVu Math TeX Gyre", size: 10pt)
#let tableau(body, caption:"") = figure(body, kind: "tableau",supplement: "Tableau", caption: caption)
#let splitstretch() = str.from-unicode(0x200A)
#let table_figure() = context {
if query(selector(figure)).len() > 0 [
#pagebreak(weak : true)
#outline(title: "Table des Tableaux et des Figures", target: figure)
] else [
]
}
#let normalheader(authors,info,title,font_: "Stretch Pro") = context [
#let headings = query(selector(heading.where(level: 1)).after(here()))
#if headings.len() > 0 {
let content = headings.first()
if content.location().page() == here().page() {
text(content.body, size: 10pt, weight: 500)
} else {
let headings = query(selector(heading.where(level: 1)).before(here()))
if headings.len() > 0 {
let content = headings.last().body
text(content, size: 10pt, weight: 500)
}
}
} else {
let headings = query(selector(heading.where(level: 1)).before(here()))
if headings.len() > 0 {
let content = headings.last().body
text(content, size: 12pt, weight: 500)
}
}
#h(1fr)
#text(title,size : 9pt, weight: 600,font: font_)
#line(length: 100%)
] |
|
https://github.com/jomaway/typst-linguify | https://raw.githubusercontent.com/jomaway/typst-linguify/main/lib/utils.typ | typst | MIT License | // Helper function.
// if the value is auto "ret" is returned else the value self is returned
#let if-auto-then(val,ret) = {
if (val == auto){
ret
} else {
val
}
}
// basic result type implementation
#let ok(value) = ("ok": value)
#let error(msg) = ("error": msg)
#let is-ok(result) = result.at("ok", default: none) != none
#let is-error(result) = result.at("error", default: none) != none
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/007%20-%20Theros/004_Nymphs%20of%20Theros.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Nymphs of Theros",
set_name: "Theros",
story_date: datetime(day: 02, month: 10, year: 2013),
author: "<NAME>",
doc
)
Awaking into being, she experienced such sadness swelling in her core. Overcome with the grief of a life lost—no, many lives lost—and the spirits within the massive hydra forever extinguished, was the first of many feelings this youthful nymph would become familiar with. Arising from the grass beneath the spilled blood, Zoe stood and immediately fell to her knees to press her leafy forehead to one of the hydra's fallen heads. Her starlit hands caressed the front horn of the creature and she sang in a sad, low voice her first words in Theros. A blade had slain this majestic creature and it hurt Zoe, who was connected to all the souls of the forest. A servant of Nylea, Zoe wanted to protect the rest of her beloved beasts from the tragedy that had just occurred.
The sun set and a new day began before she stood again and took her first steps. Zoe followed a lynx into a grove of pale green olive trees and immediately understood that the grove was her home. Once inside, Zoe felt the presence of her creator. Thinking of the hydra's stillness and the dryness in her eyes, Zoe asked, "What is this sorrow? What is this world and why is it so cruel as to murder a living creature of greatness?"
Nylea spoke in a voice that sang like honey, "Mortals do not understand the beauty of the woods. We must protect our animals and our home from the folly and hatred of the humans."
"How can I protect the beauty, Master?"
"You were created in a spout of grief and I trust that, feeling that grief, you will be inspired to preserve the vitality of our home and do so in your own way, when the time comes. For now, dance with your sisters among the trees in the starlight from my home."
With that, the presence of Nylea disappeared and the sound of laughter filled the grove. Dryads appeared from the trees as though they'd been pressed against the trunks, drinking energy from the roots—energy that would keep the dryads dancing and singing until the sunlight appeared again.
"New sister, play with us!" A dryad grabbed Zoe's hand, her leaves so long Zoe couldn't tell where her hair stopped and the branches of the trees above started. Her arms were long and graceful, and she led Zoe to a circle of joyous dryads encircling an oak tree and celebrating the sweet earth below. Her face was exquisite with soft features and large eyes, and her grin was loving and cheerful. The grief Zoe felt melted away. She felt warm and energized. She found dancing was as natural as breathing.
#figure(image("004_Nymphs of Theros/01.jpg", width: 100%), caption: [Leafcrown Dryad | Art by <NAME>], supplement: none, numbering: none)
Zoe learned of many nymphs like herself aligned with gods other than her own. She was referred to as a Euphoran, considered the hands of Nylea and capable of traveling on purposeful quests. Euphoran nymphs, she was told, unlike their sisters, are created unintentionally as a side effect of a god's spell, and embody the ideals they were born from. Because of this, Zoe had the purpose of protecting her wood, and thus needed to better understand the dangers that existed.
Zoe's sisters looked to her for guidance in times of danger, such as when hunters pass through their grove. Not wanting to shed blood of any creature, Zoe often scared away intruders by shaking trees or singing haunting chords. She acted as somewhat of a caretaker, singing her sisters to sleep and watching over them. In the mornings, she strode with the deer, and at night, she caressed the cooing owls.
One evening, surveying the woods outside the grove, Zoe witnessed a hunter's death. She had been following him to ensure he would leave with no kill, when an arrow pierced his heart and he dropped. The death frightened Zoe, but when she noticed a hooded figure saunter up to the body, she realized another human had caused it. The thought of a being assaulting another its own sickened Zoe. #emph[How could one slaughter its own kind?] While contemplating this, the murderer knelt to retrieve her arrow from the body, but two fiery figures appeared and consumed her instantaneously. The figures were of a similar build as Zoe, with starry shadows and soft, feminine faces. But instead of leaves and branches, they were covered in a bright, burning light—resembling fire, but solid.
#figure(image("004_Nymphs of Theros/02.jpg", width: 100%), caption: [Spearpoint Oread | Art by Todd Lockwood], supplement: none, numbering: none)
Zoe approached the nymphs and they turned toward her, startled yet ready for battle. She put up a peaceful hand and said, "I do not want to cause your souls any harm. Please, why did you kill?"
One of these nymphs spoke, "Blood guilt cannot be forgiven. Three mortal souls this thief stole. No more blood will be shed. My sister was merely assisting in case we were spotted."
"So, you were protecting more mortals from this one human?"
"For blood payment. Bloodshed should only be done honorably in battle. This thief was not honorable, so she had to pay."
Zoe didn't understand how any bloodshed could be honorable. Her grief returned momentarily, but she wanted to know more about these new beings and her curiosity grew stronger. "Why do humans kill?"
"Power. They want to control others to be... leaders. As we lead our sisters. They want to do that."
"That isn't bad, though. How would killing help?"
The red nymph lowered her brow in thought and said, "Other humans want to lead, too. Humans battle to decide who can lead. In battle, weak souls die honorably. Sometimes, humans try to lead outside of battle. This human wanted currency, a way to purchase items that can help with power. She was willing to kill for currency. This is dishonorable—worth punishment."
"Where do you dwell?" Zoe tried to imagine a red nymph's home.
"Up high in mountain tops, closer to our master Purphoros."
Zoe could picture the beautiful bodies resting on rocks against the sky, their color similar to her companions' leaves in the autumn. She wondered how trees in the mountains stood.
The red nymph watched Zoe and said, "You seem to be like me; capable of thought and free will."
"That's because we are Euphoran nymphs. Created out of emotion during our god's spell, not as a mere servant."
"Yes. There are only a handful of us. We all have different goals and rarely cross paths."
The idea of others inspired Zoe, but these others with ideals so different from her own—could they harm her forest? Might they murder a cougar for eating a mouse? Would that be dishonorable? The thought of them taking "payment" from her creatures scared Zoe and a coolness ran through her that ended in a shiver. "Be gone, Oread Sisters. Leave our forest be. I fear the damage flames could do in my home."
"We can leave your woods at once, Dryad. Our business here is done."
The encounter spread wonder into Zoe's mind, of what else was on the edge of her woods, of who could cause harm to her creatures and her roots. She must know. Perhaps, she thought, other Euphorans could teach her of the dangers. And she wanted to meet them, to see beings like herself. Receiving guidance from the Euphorans who had traveled more than her could lead to fulfilling her purpose of protecting the woods more satisfactorily.
Her first journey led her to where woods end and meadow begin. The sunlight hurt Zoe's eyes and she crawled across the hot ground beneath the burning sun for half a day before finding brush to drink the energy of shade from. Zoe could feel a dampness nearby and saw green blades of grass ahead. There were little white puffs bobbing on the hills and Zoe could feel the spirits within the beasts, but had never met the kind before.
"Please don't touch my creatures," she heard a voice say. A nymph scurried to her, resembling the red ones Zoe had met, only gentler in shape and demeanor. Her head was covered in wheat stalks and her skin was as light as the sun. "I think its best you stay in your deep world and I protect my fields."
#figure(image("004_Nymphs of Theros/03.jpg", width: 100%), caption: [Observant Alseid | Art by <NAME>wood], supplement: none, numbering: none)
"What do you fear will harm your fields?" asked Zoe, standing up, eye to eye, with the white nymph.
"Warriors have massacred my flocks before, stolen their wool, taken their hide, and eaten their meat."
Sadness flooded within Zoe at the thought of beasts being shredded in that way, and she could relate.
"Humans do not care for the less-intelligent kind. They see no harm in destroying life below them, as they believe to be superior, much like Heliod is my superior."
"You are a Euphoran," noticed Zoe.
The nymph nodded with a bright grin, but shooed Zoe away like a shepherd leads a flock, almost playfully. Zoe understood that this nymph, like her, just wanted to protect her home. It seemed to Zoe that all of nature was harmed by humans.
Once back deep into the woods, Zoe drank from a stream; she wanted to see how far it stretched and fed the trees in her woods, to ensure that her beloved home would have all it would ever need in dry spells or hot times. She also felt there might be a Euphoran of the water itself, who might have insight as well—for dangers lurk in the water's depths, too.
Zoe journeyed away from the grove for a couple days before she happened upon a cliff. Her woods ended suddenly, making her heart bounce with an anxiety she'd never experienced. Ahead was a lake—a large body of her vital water. She no longer feared its depletion, but she wondered what else was inside.
It wasn't long before a splash ahead caught Zoe's eye. Was that a creature? Meandering closer, Zoe saw another being like herself, with a similar face like that of a human maiden. But instead of lush leaves, this nymph rippled like waves, as though she were carved out of the liquid Zoe's forest needed to live. The naiad at first waved with a webbed hand, but then dived into the watery hole and didn't return for quite some time.
#figure(image("004_Nymphs of Theros/04.jpg", width: 100%), caption: [Nimbus Naiad | Art by <NAME>], supplement: none, numbering: none)
Zoe, too curious to leave just then, sat near the edge of the cliff and watched the figure making circles beneath the surface. It danced underneath the waves, much like Zoe danced beneath the trees. The blue face looked up, smiled playfully, and flew out of the water up to where Zoe sat, where she hovered, her flowing arms outstretched and her starry shadows moving against the blue sky.
"Our homes touch, but we cannot play together," said the nymph. "I must keep my underwater friends safe from your beasts, you see. Please go back. Please return to your dry home."
"Wait... while I do miss my sisters, I must admit that your depths look dangerous to me. Can you teach me of the peril within?"
Wading in the air, the naiad pondered. "Krakens linger down below, and sharks, eels, and more and more. Yet something horrible floats above my waves, forever causing gore."
Zoe felt fear of the unknown, but played the riddle game with the naiad. "Does it fly? Does it soar?"
"It does not soar, it does not fly, it creates devices from your home up high. Uses those to torture my creatures below, killing, stealing, I'm sad, but it's so."
"No," whispered Zoe. "Humans."
"Yes, yes, the mortals that stand on two legs made of flesh and bone; they do not care for any but their very own." The naiad knelt down, spun, and submerged again into her cool home.
Zoe shivered slightly before going back into the safety of her trees. The new feeling of hopelessness created a tunnel into Zoe's heart. An empty tunnel that didn't hold love like she felt for the rest of the animals she had met. Humans were the one creature Zoe didn't seem to understand. Perhaps one more Euphoran could answer her. One she heard lived near herself, but one that she'd heard wanted to be left alone.
Zoe risked travel into the darkest parts of her forest. The areas where shadows seemed to crawl and trees seemed more dead than alive. Eventually, she reached a deep, dark cave. Inside, stars appeared.
"Stay away," cried a voice.
Squinting, Zoe could make out a dark figure, thin like herself and glowing of stars. This face was not playful or loving like other nymphs—just as beautiful, but sad. This face, surrounded by darkness, knew grief like Zoe had experienced on her first day of existence.
Quietly, hauntingly, the nymph spoke. "I'm waiting for a death. Do not disturb me."
As Zoe crept nearer to the sound, she saw a hunter across the stream, bow pulled, and a resting wolf in sight.
"No!" shouted Zoe. The human turned and the two of them made eye contact. Without thinking, Zoe began to sing a charming song that caught the man's attention.
"A dryad," he whispered. "A beautiful creature." He dropped his bow. "Come to me," he pled. The human made his way toward Zoe slowly, arms reaching out.
Zoe turned and ran but heard a loud splash. Making her way back to the sound, she saw the human figure sprawled out, drown in the stream. She didn't feel grief, but pride, in having saved the wolf's life.
Zoe watched as the dark nymph of before approached the motionless body. The solemn nymph swayed above the body, arms reaching and pulling rhythmically as she howled a somber tune. She encircled the body as her hands drew up what looked like white smoke. Once the mist was wrapped up in the lampad's starry hands, her enchanting dance stopped. Slowly, the nymph disappeared into the cave, from which Zoe saw neither lampad nor human soul return.
#figure(image("004_Nymphs of Theros/05.jpg", width: 100%), caption: [Cavern Lampad | Art by Volkan Baga], supplement: none, numbering: none)
After the silence from the disturbance died and the sound of birds chirping was restored, Zoe too returned to her path home. A morning later, Zoe was back in her olive grove. Her sisters greeted her with open arms and they danced with the trees while she sang a song of her journey.
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/bugs/columns-1.typ | typst | Apache License 2.0 | // The well-known columns bug.
---
#set page(height: 70pt)
Hallo
#columns(2)[
= A
Text
= B
Text
]
|
https://github.com/kadykov/typstCV | https://raw.githubusercontent.com/kadykov/typstCV/main/style.typ | typst | #import "@preview/fontawesome:0.4.0": *
#let text-color = black
#let background-color = white
#let primary-color = rgb("#4457af")
#let bodywidth = 73%
// Define a function to set up style that accepts external variables
#let setup-style(
name: "<NAME>",
email: "<EMAIL>",
post-name: "Research Engineer",
website: "www.kadykov.com",
github: "kadykov",
gitlab: "kadykov",
linkedin: "aleksandr-kadykov",
doc
) = {
// Document settings
set text(
font: "IBM Plex Serif Text",
size: 10.5pt,
lang: "en",
fill: text-color,
hyphenate: true,
)
show heading: set text(
fill: primary-color,
font: "Fira Sans",
weight: "medium",
size: 1.1em,
hyphenate: false,
)
show strong: set text(
font: "IBM Plex Serif SmBld"
)
set page(
paper: "a4",
margin: (x: 2.5cm, y: 3.5cm),
header: [
#name
#h(1fr)
#if "PHONE" in sys.inputs.keys() [
#link("tel:" + sys.inputs.PHONE.replace(regex("[^0-9+]"), ""))[
#fa-phone()
#sys.inputs.PHONE.replace("_", " ")
]
|
]
#link("mailto:" + email)[
#fa-envelope()
#email
]
#v(-0.5em)
#line(length: 100%, stroke: 0.5pt)
#v(-0.5em)
],
footer: [
#v(-0.5em)
#line(length: 100%, stroke: 0.5pt)
#v(-0.5em)
#fa-arrow-up-right-from-square()
#link("https://" + website)[#website]
#h(1fr)
#text(fill: black)[#fa-github()]
#link("https://github.com/" + github)[#github] |
#text(fill: orange)[#fa-gitlab()]
#link("https://gitlab.com/" + gitlab)[#gitlab] |
#text(fill: blue)[#fa-linkedin()]
#link("https://www.linkedin.com/in/" + linkedin)[#linkedin]
]
)
// Paragraph settings
set par(justify: false, leading: 0.8em)
doc
}
// Custom macros
#let secline() = {
v(-0.3em)
line(length: 100%, stroke: 1.5pt + primary-color)
v(-0.1em)
}
#let experience(company-title: str, company-subtitle: str, company-location: str, dates: str, description) = [
#box()[
#secline()
#block(width: 100%)[
#block(width: bodywidth)[
== #company-title
#emph()[#company-subtitle]
]
#place(top + right)[
#fa-location-dot()
#emph()[#company-location]
]
]
]
#block(width: 100%)[
#place(top + right)[
#fa-calendar()
#emph()[#dates]
]
#block(width: bodywidth)[
#description
]
]
]
#let hidden-section(title) = [
#heading()[
#v(-1.15em)
#text(fill: background-color)[#title]
#v(-0.5em)
]
]
|
|
https://github.com/liuguangxi/fractusist | https://raw.githubusercontent.com/liuguangxi/fractusist/main/src/hilbert.typ | typst | MIT License | //==============================================================================
// The Hilbert curve
//
// Public functions:
// hilbert-curve, peano-curve
//==============================================================================
#import "util.typ": gen-svg
//----------------------------------------------------------
// Public functions
//----------------------------------------------------------
// Generate 2D Hilbert curve
//
// iterations: [1, 8]
// axiom: "W"
// rule set:
// "V" -> "-WF+VFV+FW-"
// "W" -> "+VF-WFW-FV+"
// angle: 90 deg
//
// Arguments:
// n: the number of iterations
// step-size: step size (in pt), optional
// stroke-style: stroke style, can be none or color or gradient or stroke object, optional
// width: the width of the image, optional
// height: the height of the image, optional
// fit: how the image should adjust itself to a given area, "cover" / "contain" / "stretch", optional
//
// Returns:
// content: generated vector graphic
#let hilbert-curve(n, step-size: 10, stroke-style: black + 1pt, width: auto, height: auto, fit: "cover") = {
assert(type(n) == int and n >= 1 and n <= 8, message: "`n` should be in range [1, 8]")
assert(step-size > 0, message: "`step-size` should be positive")
if stroke-style != none {stroke-style = stroke(stroke-style)}
let stroke-width = if (stroke-style == none) {0} else if (stroke-style.thickness == auto) {1} else {calc.abs(stroke-style.thickness.pt())}
let axiom = "W"
let rule-set = (V: "-WF+VFV+FW-", W: "+VF-WFW-FV+")
let dx = (step-size, 0, -step-size, 0)
let dy = (0, step-size, 0, -step-size)
let dx-str = dx.map(i => repr(i))
let dy-str = dy.map(i => repr(i))
let s = axiom
for i in range(n) {s = s.replace(regex("V|W"), x => rule-set.at(x.text))}
let dir = 0
let path-d = "M0 0 "
for c in s {
if c == "-" {
dir -= 1
if dir < 0 {dir = 3}
} else if c == "+" {
dir += 1
if (dir == 4) {dir = 0}
} else if c == "F" {
path-d += "l" + dx-str.at(dir) + " " + dy-str.at(dir) + " "
}
}
let margin = calc.max(5, stroke-width)
let x-min = 0
let x-max = (calc.pow(2, n) - 1) * step-size
let y-min = 0
let y-max = x-max
x-min = calc.floor(x-min - margin)
x-max = calc.ceil(x-max + margin)
y-min = calc.floor(y-min - margin)
y-max = calc.ceil(y-max + margin)
let svg-code = gen-svg(path-d, (x-min, x-max, y-min, y-max), none, stroke-style)
return image.decode(svg-code, width: width, height: height, fit: fit)
}
// Generate 2D Peano curve (Hilbert II curve)
//
// iterations: [1, 5]
// axiom: "X"
// rule set:
// "X" -> "XFYFX+F+YFXFY-F-XFYFX"
// "Y" -> "YFXFY-F-XFYFX+F+YFXFY"
// angle: 90 deg
//
// Arguments:
// n: the number of iterations
// step-size: step size (in pt), optional
// stroke-style: stroke style, can be none or color or gradient or stroke object, optional
// width: the width of the image, optional
// height: the height of the image, optional
// fit: how the image should adjust itself to a given area, "cover" / "contain" / "stretch", optional
//
// Returns:
// content: generated vector graphic
#let peano-curve(n, step-size: 10, stroke-style: black + 1pt, width: auto, height: auto, fit: "cover") = {
assert(type(n) == int and n >= 1 and n <= 5, message: "`n` should be in range [1, 5]")
assert(step-size > 0, message: "`step-size` should be positive")
if stroke-style != none {stroke-style = stroke(stroke-style)}
let stroke-width = if (stroke-style == none) {0} else if (stroke-style.thickness == auto) {1} else {calc.abs(stroke-style.thickness.pt())}
let axiom = "X"
let rule-set = (X: "XFYFX+F+YFXFY-F-XFYFX", Y: "YFXFY-F-XFYFX+F+YFXFY")
let dx = (step-size, 0, -step-size, 0)
let dy = (0, step-size, 0, -step-size)
let dx-str = dx.map(i => repr(i))
let dy-str = dy.map(i => repr(i))
let s = axiom
for i in range(n) {s = s.replace(regex("X|Y"), x => rule-set.at(x.text))}
let dir = 0
let path-d = "M0 0 "
for c in s {
if c == "-" {
dir -= 1
if dir < 0 {dir = 3}
} else if c == "+" {
dir += 1
if (dir == 4) {dir = 0}
} else if c == "F" {
path-d += "l" + dx-str.at(dir) + " " + dy-str.at(dir) + " "
}
}
let margin = calc.max(5, stroke-width)
let x-min = 0
let x-max = (calc.pow(3, n) - 1) * step-size
let y-min = 0
let y-max = x-max
x-min = calc.floor(x-min - margin)
x-max = calc.ceil(x-max + margin)
y-min = calc.floor(y-min - margin)
y-max = calc.ceil(y-max + margin)
let svg-code = gen-svg(path-d, (x-min, x-max, y-min, y-max), none, stroke-style)
return image.decode(svg-code, width: width, height: height, fit: fit)
}
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/numty/0.0.1/README.md | markdown | Apache License 2.0 | # numty
Numeric Typst
Mathematical functions to operate vectors / arrays and numbers in typst, with simple broadcasting.
```typ
#import "numty.typ" as nt
#let a = (1,2,3)
#let b = 2
#nt.mult(a,b) => (2,4,6)
#nt.add(a,a) => (2,4,6)
#nt.add(2,a) => (3,4,5)
#nt.dot(a,a) => 11
#calc.sin((3,4)) -> fails
#nt.sin((3.4)) -> (0.14411, 0.90929)
```
Supported functions
vpow -> exponentation
vmult -> multiplication
vdiv -> division
vsum -> sumation
vnorm -> normalization of a vector
vdot -> dot product
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/bugs/grid-2.typ | typst | Apache License 2.0 | // Grid now skips a remaining region when one of the cells
// doesn't fit into it at all.
---
#set page(height: 100pt)
#grid(
columns: (2cm, auto),
rows: (auto, auto),
rect(width: 100%, fill: red),
rect(width: 100%, fill: blue),
rect(width: 100%, height: 80%, fill: green),
[hello \ darkness #parbreak() my \ old \ friend \ I],
rect(width: 100%, height: 20%, fill: blue),
polygon(fill: red, (0%, 0%), (100%, 0%), (100%, 20%))
)
---
#set page(height: 60pt)
#lorem(5)
- #lorem(5)
|
https://github.com/sicheng1806/typst-book-for-sicheng | https://raw.githubusercontent.com/sicheng1806/typst-book-for-sicheng/main/scr/钢筋混凝土结构/main.typ | typst | #import "../basic_pkg/note_CN.typ"
#show : doc => note_CN.conf(
title: "钢筋混凝土结构",
doc
)
= 绪论
== 预备知识
钢筋混凝土结构设计需要足够的材料力学和结构力学知识用于分析钢筋混凝土结构的力学性质和应力分布,因而在此之前请先掌握:
+. 材料力学中的应变曲线与结构形变-应变性质
+. 材料力学 |
|
https://github.com/isaacholt100/isaacholt100.github.io | https://raw.githubusercontent.com/isaacholt100/isaacholt100.github.io/master/maths-notes/2-durham%3A-year-2/complex-analysis/complex-analysis.typ | typst | #import "../../template.typ": template
#show: template
= The complex plane and Riemann sphere
- $CC^* = CC - {0}$
- $z_1 z_2 = 0 <==> z_1 = 0$ or $z_2 = 0$.
- $|z| = sqrt(z overline(z))$.
- $"Re"(z) = (z + overline(z)) \/ 2$, $"Im"(z) = (z - overline(z)) \/ 2i$.
- $z^(-1) = overline(z) \/ |z|^2$.
- *Principal value of $arg(z)$*: in interval $lr((-pi, pi])$, written $"Arg"(z)$.
- $arg(z_1 z_2) ident arg(z_1) + arg(z_2) quad (mod 2pi)$.
- $arg(1 \/ z) = -arg(z) quad (mod 2pi)$.
- $arg(overline(z)) = -arg(z) quad (mod 2pi)$.
- Multiplication by $z_1 = r_1 e^(i theta_1)$ represents rotation by $theta_1$ followed by dilation by factor $r_1$.
- Addition represents translation.
- Conjugation represents reflection in the real axis.
- Taking the real (imaginary) part represents projection onto the real (imaginary) axis.
- $|z_1 z_2| = |z_1| |z_2|$.
- *De Moivre's formula*: $(cos(theta) + i sin(theta))^n = cos(n theta) + i sin(n theta)$.
- *Triangle inequality*: $|z_1 + z_2| <= |z_1| + |z_2|$.
- $|z| >= 0$ and $|z| = 0 <==> z = 0$.
- $max{|"Re"(z)|, |"Im"(z)|} <= |z| <= |"Re"(z)| + |"Im"(z)|$.
- *Complex exponential function*: $ exp(z) := e^x (cos(y) + i sin(y)) $.
- $forall z in CC, e^z != 0$.
- $e^(z_1 + z_2) = e^(z_1) e^(z_2)$.
- $e^z = 1 <==> z = 2 pi i k$ for some $k in ZZ$.
- $e^(-z) = 1 \/ e^z$.
- $|e^z| = e^("Re"(z))$.
- $forall k in ZZ$, $exp(z) = exp(z + 2k pi i)$.
- $ sin(z) := 1 / (2 i) (e^(i z) - e^(-i z)), quad cos(z) := 1/2 (e^(i z) + e^(-i z)) \ sinh(z) := 1/2 (e^z - e^(-z)), quad cosh(z) := 1/2 (e^z + e^(-z)) $
- For every $w in CC^*$, $ e^z = w = |w| e^(i phi) $ has solutions $ z = log(|w|) + i(phi + 2k pi), quad k in ZZ $
- Let $theta_2 - theta_1 = 2 pi$, let $arg$ be the argument function in $lr((theta_1, theta_2])$. Then $ log(z) := log(|z|) + i arg(z) $ is a *branch of logarithm*. Jump discontinuity on *branch cut*, the ray $R_(theta_1) = R_(theta_2)$.
- *Principal branch of log*: where $arg(z) = "Arg"(z) in lr((-pi, pi])$.
- $e^(log(z)) = z$.
- Generally, $log(z w) != log(z) + log(w)$.
- Generally, $log(e^z) != z$.
- Given a branch of log, *power function* is $ z^w := exp(w log(z)) $
- $hat(CC) = C union {infinity}$.
- Unit sphere: $S^2 = {(x, y, s) in RR^3: x^2 + y^2 + s^2 = 1}$, north pole: $N = (0, 0, 1) in S^2$. *Stereographic projection*: map that takes $v in S^2 - {N}$ to $x + i y in CC$, where $(x, y)$ is where the line from $N$ through $v$ intersects the $(x, y)$-plane.
- *Stereographic projection formula*: $ P(x, y, s) = x / (1 - s) + (i y) / (1 - s) $ North pole is mapped to $infinity$.
- Inverse of stereographic projection found by intersection of line (from $z in CC$ to $N$) and $S^2$.
- *Riemann sphere*: unit sphere $S^2$ with stereographic projections from north and south pole.
= Metric spaces
- *Metric space*: set $X$ and *metric* function $d: X times X -> RR_(>= 0)$, for every $x, y, z in X$
- *positivity*: $d(x, y) >= 0$ and $d(x, y) = 0 <==> x = y$
- *symmetry*: $d(x, y) = d(y, x)$
- *triangle inequality*: $d(x, y) <= d(x, z) + d(z, y)$
- *norm* on vector space $V$:
- $||v|| >= 0$ and $||v|| = 0 <==> v = 0$
- $||lambda v|| = |lambda| dot.op ||v||$
- $||v + w|| <= ||v|| + ||w||$
- $d(v, w) = ||v - w||$ always defines a metric
- $d(v, w) = sqrt(angle.l v - w \, v - w angle.r)$
- *$l_p$ norm*: $ ||x||_p = root(p, sum_(i = 1)^n |x_i|^p) $
- *Taxicab norm*: $l_1$ norm
- *$l_oo$ norm (sup-norm)*: $||x||_oo := max_(i = 1, dots, n) |x_i|$
- *Riemannian (chordal) metric on $hat(CC)$*: $d(z, w) = ||f(z) - f(w)||_2$ where $f: hat(CC) -> S^2$ is the inverse stereographic projection.
- *Discrete metric*: $ d(x, y) := cases(
0 "if" x = y,
1 "if" x != y
) $
- *Open ball of radius $r$ centred at $x$*: $B_r(x) := {y in X: d(x, y) < r}$
- *Closed ball of radius $r$ centred at $x$*: $overline(B)_r(x) := {y in X: d(x, y) <= r}$
- *$U subset.eq X$ open* if $forall x in U, exists epsilon > 0, B_epsilon(x) subset U$
- *$U subset.eq X$ closed* if $X - U$ open
- *clopen*: open and closed, e.g. empty set and $X$
- Open balls are open
- Closed balls are closed
- Arbitrary unions of open sets are open
- Finite intersections of open sets are open
- Finite unions of closed sets are closed
- Arbitrary intersections of closed sets are closed
- *Interior of $A$*: $A^0 := {x in A: "for some open" U subset.eq A, x in U}$. It is the largest open set in $A$.
- *Closure of $A$*: complement of interior of complement: $overline(A) := {x in X: U union A != nothing "for every open set" U "with" x in U} = X - (X - A)^0$. It is the smallest closed set containing $A$.
- *Boundary of $A$*: closure without interior: $diff A := overline(A) - A^0$
- *Exterior of $A$*: complement of closure: $A^e := X - overline(A) = (X - A)^0$
- $A "is open" <==> diff A sect A = nothing <==> A = A^0$
- $A "is closed" <==> diff A subset.eq A <==> A = overline(A)$
- For simple sets in $RR^n$ or $CC^n$, closure (or interior) is obtained by replacing by replacing strict inequality with equality (or vice versa).
- Sequence ${x_n}$ *converges to* $x in X$ if $lim_(n -> oo) d(x_n, x) = 0$ or equivalently, $ forall epsilon > 0, exists N in NN, forall n > N, d(x_n, x) < epsilon $
- Limits in the complex plane follow COLT rules
- ${z_n}$ converges iff ${"Re"(z_n)}$ and ${"Im"(z_n)}$ converge.
- $lim_(n -> oo) x_n = x <==> forall "open" U "with" x in U, exists N in NN, forall n > N, x_n in U$
- $f: (X_1, d_1) -> (X_2, d_2)$ is *continuous at $x_0 in X_1$* if $ forall epsilon > 0, exists delta > 0, forall x in X_1, d_1(x, x_0) < delta ==> d_2(f(x), f(x_0)) < epsilon $
- $f$ is *continuous on $X_1$* if continuous at every $x_0 in X_1$
- Products, sums and quotients of real/complex continuous functions are continuous
- Compositions of continuous functions are continuous
- *Preimage*: $f^(-1)(U) := {x in X_1: f(x) in U}$
- *Properties of preimage*:
- $f^(-1)(A union B) = f^(-1)(A) union f^(-1)(B)$
- $f^(-1)(A sect B) = f^(-1)(A) sect f^(-1)(B)$
- $f^(-1)(A - B) = f^(-1)(A) - f^(-1)(B)$
- $f: X_1 -> X_2 "continuous" & <==> f^(-1)(U) "open in" X_1 forall "open" U subset.eq X_2 \ & <==> f^(-1)(F) "closed in" X_1 forall "closed" F subset.eq X_2$
- $f: X_1 -> X_2 "continuous at" x in X_1 <==> f^(-1)(U) "open in" X_1 forall "open" U subset.eq X_2 "containing" f(x)$
- Non-empty $K subset.eq X$ *compact* if for every sequence ${x_k}$ in $K$, there exists a convergent subsequence ${x_(n_k)}$ with limit in $K$.
- If ${x_k}$ is a convergent sequence in $X$ then every subsequence ${x_(n_k)}$ converges to the same limit.
- $F subset.eq X$ is closed iff every sequence in $F$ converging in $X$ also converges in $F$.
- Compact sets are closed
- Every closed subset of a compact set is compact
- $A subset.eq X$ *bounded* if for some $R > 0$, $x in X$, $A subset.eq B_R(x)$
- Compact sets are bounded
- *Heine-Borel for $CC$*: $K subset.eq CC$ is compact iff $K$ is closed and bounded.
- $f: X -> Y$ is continuous at $x in X$ iff $ lim_(n -> oo) f(x_n) = f(x) $ for every convergent sequence ${x_n}$ in $X$ with $x_n -> x$.
- If $K subset.eq X$ is compact and $f: X -> Y$ is continuous, then $f(K)$ is compact in $Y$. So for $Y = RR$, any continuous real-valued function attains maxima and minima on compact sets.
= Complex differentiation
- $f: U -> CC$ for open $U$ is *complex differentiable at $z_0 in U$* if $ lim_(z -> z_0) (f(z) - f(z_0)) / (z - z_0) $ exists. Limit is the *derivative of $f$ at $z_0$*: $ f'(z_0) = lim_(h -> 0) (f(z_0 + h) - f(z_0)) / h $. $h in CC$ so limit must exist from every direction.
- Complex differentiability at $z_0$ implies continuity at $z_0$.
- Sums, products and quotients of complex differentiable functions are complex differentiable.
- Compositions of complex differentiable functions are complex differentiable.
- The product, quotient and chain rules hold for complex differentiable functions.
- Most non-constant purely real/imaginary functions are not complex differentiable.
- If $f = u + i v$ is complex differentiable at $z_0$ then $u_x, u_y, v_x, v_y$ exist at $z_0$ and satisfy *Cauchy-Riemann equations*: $ u_x(z_0) = v_y(z_0), quad u_y(z_0) = -v_x(z_0) $. Also, $ f'(z_0) = u_x(z_0) + i v_x(z_0) $
- Let $f: U -> CC$, $U$ open, $f = u + i v$. If $u_x, u_y, v_x, v_y$ exist and are continuous at $z_0$ and satisfy the Cauchy-Riemann equations at $z_0$, then $f$ is complex differentiable at $z_0$.
- Let $U subset.eq C$ open, $f: U -> CC$. $f$ is *holomorphic on $U$* if $f$ is complex differentiable at every $z_0 in U$.
- $f$ is *holomorphic at $z_0 in U$* if $f$ is complex differentiable on some $B_epsilon(z_0)$.
- Affine linear maps $z -> a z + b$, $a != 0$ are holomorphic.
- *Path (curve) from $a$ to $b$*: continuous function $gamma: [0, 1] -> CC$ with $gamma(0) = a$ and $gamma(1) = b$. Path *closed* if $a = b$.
- *Smooth* path: continuously differentiable.
- $U subset.eq CC$ *path-connected* if for every $a, b in U$, there exists a path $gamma$ from $a$ to $b$ with $gamma(t) in U$ for every $t in [0, 1]$.
- *Domain (region)*: open and path-connected.
- *Chain rule*: Let $U subset.eq CC$ open, $f: U -> CC$ holomoprhic, $gamma: [0, 1] -> U$ smooth path. Then $ (f compose gamma)'(t_0) = f'(gamma(t_0)) gamma'(t_0) $
- Let $D$ domain, $f: D -> CC$ holomorphic on $D$. If $forall z in D, f'(z) = 0$, or $f$ is purely real/imaginary, or $f$ has constant real/imaginary part, or $f$ has constant modulus, then $f$ is constant on $D$.
- Let $D$ domain, $f: D -> CC$ *conformal at $z_0$* if $f$ preserves angle and orientation of any two tangent vectors at $z_0$. Equivalently, $f$ preserves angle and orientation of any two smooth paths through $z_0$. $f$ *conformal* if conformal at every $z_0 in D$.
- If $f$ holomorphic, $f'(z_0) != 0$ then $f$ conformal at $z_0$.
- $f$ transforms the tangent vector $gamma'(t_0)$ by multiplying it by $f'(gamma(t_0))$.
- If $f$ is conformal at $z_0$, then $f$ is complex differentiable at $z_0$ and $f'(z_0) != 0$.
- $f$ is conformal on domain $D$ iff $f$ is holomorphic on $D$ and $forall z in D, f'(z) != 0$.
- Conformal maps map orthogonal grids in the $(x, y)$-plane to orthogonal grids. (Grids can be made of arbitrary smooth curves, not necessarily straight lines).
- For $D$ and $D'$ domains, $f: D -> D'$ is *biholomorphic* if $f$ holomorphic, bijection and $f^(-1): D' -> D$ holomorphic. $f$ is a *biholomorphism*. $D$ and $D'$ are *biholomorphic* if such an $f$ exists and write $f: D op("~", limits: #true)_(->) D'$
- Affine linear maps $z -> a z + b$, $a != 0$, are biholomorphic from $CC$ to $CC$.
- For $D$ domain, set of all biholomorphic maps from $D$ to $D$ forms a group under composition, called *automorphism group of $D$*, $"Aut"(D)$.
= Mobius transformations
- $"GL"_2(CC) := {A in M_2(CC): det(A) != 0}$.
- Let $T = mat(a, b; c, d) in "GL"_2(CC)$, then *Mobius transformation* is $M_T(z) = infinity$ if $c z + d = 0$, else $ M_T(z) = (a z + b) / (c z + d) $ Also $ M_T(infinity) = cases(
a/c & "if" c != 0,
infinity & "if" c = 0
) $ So $M_T: hat(CC) -> hat(CC)$.
- Let $k^2 = det(T)$ then $ M_(1/k T)(z) = ((a z)/k + b/k) / ((c z)/k + d/k) = (a z + b) / (c z + d) = M_T(z) $ so any $T$ can be scaled to $T' = 1/k T$ so that $det(T') = det(1/k T) = 1/k^2 det(T) = 1$.
- *Cayley map*: $M_T(z) = (z - i) / (z + i)$ where $T = mat(1, -i; 1, i)$.
- Cayley map maps $HH -> DD$.
- Set of Mobius transformations forms group under composition:
- $M_(T_1) compose M_(T_2) = M_(T_1 T_2)$.
- $(M_T)^(-1) = M_(T^(-1))$.
- $M_T = "Id" <==> T = t mat(1, 0; 0, 1)$, $t in CC^*$.
- Let $T = mat(a, b; c, d) in "GL"_2(CC)$. If $c = 0$, $M_T$ is biholomorphic from $hat(CC)$ to $hat(CC)$. If $c != 0$, $M_T$ is biholomorphic from $CC - { -d/c }$ to $CC - { a/c }$.
- $M_T$ conformal at every $z in CC$ where $M_T(z) != infinity$.
- $M_T$ is bijection from $hat(CC)$ to $hat(CC)$.
- $z$ is *fixed point* of $M_T$ if $M_T(z) = z$.
- If $M_T$ is not identity map, then it has at most $2$ fixed points in $hat(CC)$. So if $M_T$ has $3$ fixed points in $hat(CC)$, it is identity map.
- *Cross ratio* of distinct $z_0, z_1, z_2, z_3 in CC$: $ (z_0, z_1; z_2, z_3) := ((z_0 - z_2)(z_1 - z_3)) / ((z_0 - z_3)(z_1 - z_2)) $ If some $z_i = infinity$ then same definition but remove all differences involving $z_i$, so $ (infinity, z_1; z_2, z_3) := ((z_1 - z_3)) / ((z_1 - z_2)) $
- *Three points theorem*: Let ${z_1, z_2, z_3}$, ${w_1, w_2, w_3}$ be sets of distinct ordered points in $hat(CC)$. Then exists unique Mobius transformation $f$ such that $f(z_i) = w_i$, $i = 1, 2, 3$, given by $F^(-1) compose G$, where $ F(z) = (z, w_1; w_2, w_3), quad G(z) = (z, z_1; z_2, z_3) $
- *Mobius transformations preserve cross ratio*: For Mobius transformation $f$, $ (f(z_0), f(z_1); f(z_2), f(z_3)) = (z_0, z_1; z_2, z_3) $
- *Strategy to find Mobius transformation from how it acts on three points*: since cross-ratio preserved, rearrange the equation $ (f(z), w_1; w_2, w_3) = (z, z_1; z_2, z_3) $
- *Strategy to find image of domain $D$ under $M_T$*:
- Find image of boundary: $M_T(diff D)$.
- Find image of point $z_0 in D$ in interior: $M_T(z_0)$.
- Image $D'$ is domain bounded by $M_T(diff D)$ and containing $M_T(z_0)$.
- *Circline*: circle or line.
- Mobius transformations map circlines in $hat(CC)$ to circlines in $hat(CC)$.
- *Equations of circles and lines in $CC$*: $ gamma z overline(z) - alpha overline(z) - overline(alpha) z + beta = 0 $ is equation of circle if $gamma = 1$ and $|alpha|^2 - beta > 0$, and equation of line if $gamma = 0$ and $alpha != 0$. Also, any circle or line can be described by this equation.
- Circle uniquely determined by three points, line determined by two points, so to determine how Mobius transformation maps circle, check where three points on circle are mapped.
- Circles through $N$ in $S^2$ correspond to lines in $hat(CC)$. Circles not through $N$ correspond to circles in $hat(CC)$ (via stereographic projection).
- For domain $D$, $"Mob"(D)$ is set of Mobius transformations that map $D$ to $D$.
- *H2H*: $ f in "Mob"(HH) <==> f = M_T, quad T in "SL"_2(RR) := {A in M_2(RR): det(A) = 1} $
- *D2D*: $ f in "Mob"(DD) <==> f = M_T, quad T in "SU"(1, 1) := {A = mat(alpha, beta; overline(beta), overline(alpha)): alpha, beta in CC, det(A) = 1} $
- *D2D\**:
- Every $f in "Mob"(DD)$ is of form $ f(z) = e^(i theta) (z - z_0) / (overline(z_0) z - 1) $ where $z_0 in DD$ is unique point such that $f(z_0) = 0$.
- Every $f in "Mob"(DD)$ where $f(0) = 0$ is a rotation about $0$.
- *Strategy to find biholomorphic map between two domains*: build up biholomorphic map from simpler known ones, e.g. Mobius transformations, Cayley map, translations.
= Notions of convergence in complex analysis and power series
- For $X$ and $Y$ metric spaces, ${f_n}_(n in NN): X -> Y$ *converges pointwise on $X$ to $f$* if $ forall x in X, forall epsilon > 0, exists N in NN, forall n > N, quad d_Y(f_n(x), f(x)) < epsilon $ $f(x) = lim_(n -> infinity) f_n(x)$ is *limit function*.
- ${f_n}_(n in NN)$ *converges uniformly on $X$ to $f$* if $ forall epsilon > 0, exists N in NN, forall n > N, forall x in X, quad d_Y(f_n(x), f(x)) < epsilon $
- Uniform convergence implies pointwise convergence.
- *Uniform limits of continuous functions are continuous*: let ${f_n}_(n in NN)$ be all continuous on $X$ and converge uniformly to $f$ on $X$. Then $f$ is continuous on $X$.
- *Test for uniform convergence*: let ${f_n}: X -> CC$ converge pointwise to $f$.
- If $forall x in X, |f_n(x) - f(x)| <= s_n$, ${s_n}$ is sequence with $lim_(n -> oo) s_n = 0$, then ${f_n}$ converges uniformly to $f$ on $X$.
- If for some sequence ${x_n} subset X$, $|f_n(x_n) - f(x_n)| >= c$ for some $c > 0$, then $f_n$ does not converge uniformly to $f$ on $X$.
- *Weierstrass M-test*: Let ${f_n}: X -> CC$ satisfy $ forall x in X, |f_n(x)| <= M_n, quad sum_(n = 1)^oo M_n < oo $ Then $sum_(n = 1)^oo f_n$ converges uniformly to some $f$ on $X$.
- Let ${f_n}: [a, b] -> RR$ be continuous and converge uniformly to $f$ on $[a, b]$. Then $ forall c in [a, b], quad lim_(n -> oo) integral_a^c f_n(x) dif x = integral_a^c f(x) dif x $
- ${f_n}$ *converges locally uniformly on $X$ to $f$* if $forall x in X$, exists open $U subset X$ containing $x$ such that ${f_n}$ converges uniformly to $f$ on $U$.
- Let ${f_n}$ be continuous on $X$ and converge locally uniformly to $f$ on $X$. Then $f$ is continuous on $X$.
- *Local M-test*: let ${f_n}: X -> CC$ be continuous, such that $forall y in X$, exists open $U subset X$ containing $y$ and $M_n > 0$ with $ forall x in U, |f_n(x)| <= M_n, quad sum_(n = 1)^oo M_n < oo $ Then $sum_(n = 1)^oo f_n$ converges locally uniformly to continuous function on $X$.
- *Complex power series*: $ sum_(n = 0)^oo a_n (z - c)^n, quad a_n, c in CC $
- Either:
- Series converges only for $z = c$ ($R = 0$).
- Series converges absolutely for $|z - c| < R <==> z in B_R(c)$. $R$ is *radius of convergence*, $B_R(c)$ is *disc of convergence* and diverges for $|z - c| > R$.
- Series converges absolutely for all $z$ ($R = oo$).
- Power series with radius of convergence $R$ converges absolutely on $B_r(c)$ for every $0 < r < R$. So series is locally uniformly convergent (but not uniformly convergent) on disc of convergence.
- *Term-by-term differentiation and integration preserve radius of convergence*: let $sum_(n = 0)^oo a_n (z - c)^n$ have radius of convergence $R$. Then formal derivative and antiderivative $ sum_(n = 1)^oo n a_n (z - c)^(n - 1), quad sum_(n = 0)^oo a_n / (n + 1) (z - c)^(n + 1) $ have radius of convergence $R$.
- *Power series can be differentiated term-by-term in disc of convergence*: let $sum_(n = 0)^oo a_n (z - c)^n$ have radius of convergence $R$ and converge to $f: B_R(c) -> CC$. Then $f$ is holomorphic on $B_R(c)$ and $ f'(z) = sum_(n = 1)^oo n a_n (z - c)^(n - 1) $
- Power series with $R > 0$ can be differentiated infinitely many times and $ f^((k))(z) = sum_(n = k)^oo k! binom(n, k) a_n (z - c)^(n - k) $ So $f^((k))(c) = k! a_k$.
- *Power series can be integrated term-by-term in disc of convergence*: power series with $R > 0$ has holomorphic antiderivative $F: B_R(c) -> CC$ given by $ F(z) = sum_(n = 0)^oo a_n / (n + 1) (z - c)^(n + 1) $
= Complex integration over contours
- Let $f: [a, b] -> CC$, $f = u + i v$, then $ integral_a^b f(t) dif t = integral_a^b u(t) dif t + i integral_a^b v(t) dif t $
- Let $f_1, f_2: [a, b] -> CC$, $c in CC$, then $ integral_a^b (f_1(t) + f_2(t)) dif t = integral_a^b f_1(t) dif t + integral_a^b f_2(t) dif t, quad integral_a^b c f_1(t) dif t = c integral_a^b f_1(t) dif t $
- Curve $gamma: [a, b] -> CC$ is $C^1$ if *continuously differentiable* (derivative exists and is continuous).
- *Integral of continuous $f: U -> CC$ along curve $gamma: [a, b] -> U$, $gamma in C^1$*: $ integral_gamma f(z) dif z := integral_a^b f(gamma(t)) gamma'(t) dif t $
- Let $f_1, f_2: [a, b] -> CC$, $c in CC$, then $ integral_gamma (f_1(z) + f_2(z)) dif z = integral_gamma f_1(z) dif z + integral_gamma f_2(z) dif z, quad integral_gamma c f_1(z) dif z = c integral_gamma f_1(z) dif z $
- $(-gamma): [-b, -a] -> CC$, $(-gamma)(t) := gamma(-t)$, then $ integral_(-gamma) f(z) dif z = - integral_gamma f(z) dif z $
- Let $phi: [a', b'] -> [a, b]$ be continuously differentiable, $phi(a') = a$, $phi(b') = b$, $delta: [a', b'] -> CC$, $delta = gamma compose phi$. Then $ integral_gamma f(z) dif z = integral_delta f(z) dif z $
- Let $gamma: [a, b] -> CC$, $a = a_0 < a_1 < dots.h.c < a_n = b$, $gamma_i: [a_(i - 1), a_i] -> CC$ be $C^1$, $gamma_i(t) := gamma(t)$ for $t in [a_(i - 1), a_i]$. Then $gamma$ is *piecewise $C^1$ curve*, or *contour*. $ integral_gamma f(z) dif z = sum_(i = 1)^n integral_gamma_i f(z) dif z $ is a *contour integral*.
- *Contour union*: let $gamma: [a, b] -> CC$, $delta: [c, d] -> CC$, then $ (gamma union delta): [a, b + d - c] -> CC, quad (gamma union delta)(t) := cases(
gamma(t) & "if" t in [a, b],
delta(t + c - b) & "if" t in [b, b + d - c]
) $ Then $ integral_(gamma union delta) f(z) dif z = integral_gamma f(z) dif z + integral_delta f(z) dif z $
- *Complex Fundamental Theorem of Calculus (FTC)* Let $U subset.eq CC$ open, $F: U -> CC$ holomorphic with derivative $f$, $gamma: [a, b] -> U$ contour. Then $ integral_gamma f(z) dif z = F(gamma(b)) - F(gamma(a)) $ So if $gamma$ closed, then $integral_gamma f(z) dif z = 0$. Also, if $gamma_1$ and $gamma_2$ have same endpoints, then $ integral_(gamma_1) f(z) dif z = integral_(gamma_2) f(z) dif z $
- If $F' = f$, $F$ is *antiderivative* or *primitive* of $f$.
- *Length* of contour $gamma$: $ L(gamma) := integral_a^b |gamma'(t)| dif t $
- *Estimation lemma*: Let $f: U -> CC$ continuous, $gamma: [a, b] -> U$ contour. Then $ |integral_gamma f(z) dif z| <= L(gamma) dot.op sup_gamma |f| $ where $sup_gamma |f| := sup{|f(z)|: z in gamma}$
- *Converse to FTC*: Let $D$ domain, $f: D -> CC$ continuous, $integral_gamma f(z) dif z = 0$ for every closed contour $gamma in D$. Then exists holomorphic antiderivative $F: D -> CC$ (unique up to addition of constant) such that $ F'(z) = f(z) $
- Domain $D$ *starlike* if for some $a_0 in D$, for every $a_0 != b in D$, straight line from $a_0$ to $b$ contained in $D$.
- *Cauchy's theorem for starlike domains*: let $D$ starlike domain, $f: D -> CC$ holomorphic, $gamma in D$ closed contour. Then $ integral_gamma f(z) dif z = 0 $ Same holds if $f$ holomorphic on $D - S$, $S$ finite set of points, and $f$ continuous on $D$.
- Let $U$ open, $f: U -> C$ holomorphic, $Delta in U$ be triangle. Then $ integral_(diff Delta) f(z) dif z = 0 $ Same holds if $f$ holomorphic on $U - S$, $S$ finite set of points, and $f$ continuous on $U$.
- By default, always use *anti-clockwise* parameterisation of contour.
- Let $D$ starlike domain, $f: D -> CC$ continuous, $integral_(diff Delta) f(z) dif z = 0$ for every triangle $Delta in D$. Then exists holomorphic $F: D -> CC$ such that $F' = f$.
- *Cauchy's integral formula (CIF)*: let $B = B_r(a)$, $f: B -> CC$ holomorphic. Then for every $w in B, rho$ such that $|w - a| < rho < r$, $ f(w) = 1/(2 pi i) integral_(|z - a| = rho) f(z) / (z - w) dif z $
= Features of holomorphic functions
- *Cauchy-Taylor theorem*: let $U subset.eq CC$ open, $f: U -> CC$ holomorphic, $r > 0$, $B_r(a) subset U$. Then $f$ is given by power series (*Taylor series of $f$ around $a$*) that converges on $B_r(a)$: $ f(z) = sum_(n = 0)^oo c_n (z - a)^n, quad z in B_r(a) $ where $ c_n = 1 / (2 pi i) integral_(|z - a| = rho) f(z) / ((z - a)^(n + 1)) dif z $ for any $0 < rho < r$.
- Function with Taylor series expansion on $B_r(a)$, $r > 0$, is *analytic at $a$*.
- Function *analytic* if analytic at every point in domain.
- Holomorphic $<==>$ analytic.
- *Cauchy's integral formula (CIF) for derivatives*: let $B = B_r(a)$, $f: B -> CC$ holomorphic. For every $0 < rho < r$, $ integral_(|z - a| = rho) f(z) / ((z - a)^(n + 1)) dif z = (2 pi i) / (n!) f^((n))(a) $
- So $f$ has Taylor series expansion on $B_r(a)$: $ f(z) = sum_(n = 0)^oo (f^((n))(a)) / (n!) (z - a)^n $
- Equivalent of Cauchy-Taylor doesn't hold for real analysis, e.g. $ f(x) = cases(
e^(-1/x) & "if" x > 0,
0 & "if" x <= 0
) $ has derivatives of all orders and $f^((n))(0) = 0$. But Taylor series around $x = 0$ would be $ f(x) = sum_(n = 0)^oo c_n x^n, quad x in (0 - epsilon, 0 + epsilon) $ for some $epsilon > 0$. But then $c_n = f^((n)) / (n!) = 0$ but $f$ isn't identically zero in any neighbourhood of the origin. So $f$ doesn't have a Taylor series.
- *Holomorphic functions have infinitely many derivatives*: let $U subset.eq CC$ open, $f: U -> CC$ holomorphic. Then $f$ has derivatives of all orders on $U$ which are all holomorphic.
- *Morera's theorem*: let $D$ domain, $f: D -> CC$ continuous. If for every closed contour $gamma$ in $D$, $ integral_gamma f(z) dif z = 0 $ then $f$ holomorphic.
- $f: CC -> CC$ *entire* if holomorphic on $CC$.
- $f: CC -> CC$ *bounded* if for some $M > 0$, $|f(z)| <= M$ for every $z in CC$.
- *Liouville's theorem*: every bounded entire function is constant.
- *Fundamental theorem of algebra*: every non-constant polynomial with complex coefficients has complex root.
- *Local maximum modulus principle*: let $f: B_r(a) -> CC$ holomorphic. If $ forall z in B_r(a), |f(z)| <= |f(a)| $ then $f$ constant on $B_r(a)$.
- *Maximum modulus principle*: let $D$ domain, $f: D -> CC$ holomorphic. If for some $a in D$, $ forall z in D, |f(z)| <= |f(a)| $ then $f$ constant on $D$.
- If $U subset CC$ path-connected and open, then not possible to write $U = U_1 union U_2$, where $U_1, U_2$ disjoint, open, non-empty. So domains are connected.
- $f: B_r(a) -> CC$ has *zero of order $m$ at $a$* if for some $m > 0$, exists holomorphic $h: B_r(a) -> CC$ such that $f(z) = (z - a)^m h(z)$, $h(a) != 0$.
- $f$ has zero of order $m$ at $a$ iff $ f(a) = f^((1))(a) = dots.h.c = f^((m - 1))(a) = 0 $ and $f^((m))(a) != 0$.
- *Principle of isolated zeros*: let $f: B_r(a) -> CC$ holomorphic, $f != 0$. Then for some $0 < rho <= r$, $ forall z in B_rho(a) - {a}, quad f(z) != 0 $ Holds for $f(a) = 0$, i.e. zeros of holomorphic functions are isolated.
- *Uniqueness of analytic continuation theorem*: let $D' subset D$ non-empty domains, $f: D' -> CC$ holomorphic. Then exists at most one holomorphic $g: D -> CC$ such that $ forall z in D', quad f(z) = g(z) $ If $g$ exists, it is *analytic continuation of $f$ to $D$*.
- Let $D$ domain, $f, g: D -> CC$ holomorphic, $B_r(a) subset D$. If $f(z) = g(z)$ on $B_r(a)$ then $f(z) = g(z)$ on $D$.
- Let $S subset C$, $w in S$.
- $w$ *isolated point of $S$* if for some $epsilon > 0$, $B_epsilon(w) sect S = {w}$.
- $w$ *non-isolated point of $S$* if $forall epsilon > 0$, exists $w != z in S$ such that $z in B_epsilon(w)$.
- *Identity theorem*: Let $f, g: D -> CC$ holomorphic on domain $D$. If $S := {z in D: f(z) = g(z)}$ contains non-isolated point, then $f(z) = g(z)$ on $D$.
- Let $D subset.eq CC$ domain, $u: D -> RR$ *harmonic* if has continuous second order partial derivatives and satisfies *Laplace's equation*: $ u_(x x) + u_(y y) = 0 $
- Let $f = u + i v: D -> CC$ holomorphic on domain $D$. Then $u$ and $v$ harmonic.
- *Existence of harmonic conjugates theorem*: let $D$ starlike domain, $u: D -> RR$ harmonic. Then exists harmonic $v: D -> RR$ such that $f = u + i v$ holomorphic on $D$. $v$ is *harmonic conjugate of $u$*, unique up to addition of real constant. *Note*: condition of $D$ being starlike is removed when Cauchy's theorem is proved in generality.
- Let $f: D -> CC$ holomorphic on domain $D$. Then $f$ has holomorphic antiderivative on $D$.
- *Dirichlet problem*: let $D subset.eq CC$ domain with closure $overline(D)$, boundary $diff D$, $g: diff D -> RR$ continuous. Find continuous $mu: overline(D) -> RR$ such that $mu$ harmonic on $D$ and $mu = g$ on $diff D$.
- Let $f = u + i v: D -> CC$ holomorphic on domain $D$, $mu$ harmonic on $f(D)$. Then $tilde(mu) := mu compose f$ harmonic on $D$.
- So if $mu$ harmonic on $D'$ and want to find a harmonic $tilde(mu)$ on $D$, find holomorphic $f$ mapping $D$ to $D'$ so $f(D) = D'$. Then $tilde(mu) = mu compose f$ is solution.
= General form of Cauchy's theorem and C.I.F.
- Let curve $gamma: [a, b] -> CC$, $gamma(t) = w + r(t) e^(i theta(t))$, $w in CC$, $r, theta: [a, b] -> RR$, piecewise $C^1$, $r(t) > 0$. *Winding number (index)* of $gamma$ around $w$ is $ I(gamma; w) := (theta(b) - theta(a)) / (2 pi) $
- Let contour $gamma: [a, b] -> CC$, $w in CC$, $w in.not gamma$. Then exists $r, theta: [a, b] -> RR$ piecewise $C^1$, $r(t) > 0$ such that $ gamma(t) = w + r(t) e^(i theta(t)) $. Here, $r(t) = |gamma(t) - w|$.
- Let $gamma: [a, b] -> CC$ closed contour, $w in.not gamma$. Then $ I(gamma; w) = 1/(2 pi i) integral_gamma 1/(z - w) dif z $
- Let $D$ starlike domain, $gamma$ closed contour in $D$. If $w in.not D$, then $I(gamma; w) = 0$.
- Let $U subset.eq CC$ open.
- Closed contour $gamma$ in $U$ *homologous to zero in $U$* if $I(gamma; w) = 0$ for every $w in.not U$.
- $U$ is *simply connected* if every closed contour in $U$ homologous to zero in $U$.
- *Cycle*: finite collection of closed contours in $U$, denoted as formal sum $ Gamma := gamma_1 + dots.h.c + gamma_n $ $w$ *does not lie in $Gamma$* if $w in.not gamma_i$ for all $i$. Define $ I(Gamma; w) := sum_(i = 1)^n I(gamma_i; w) $ and $ integral_Gamma f(z) dif z := sum_(i = 1)^n integral_(gamma_i) f(z) dif z $ $Gamma$ *homologous to zero in $U$* if $I(Gamma; w) = 0$ for every $w in.not U$.
- Closed curve $gamma: [a, b] -> CC$ *simple* if for any $t_1 < t_2$, $gamma(t_1) = gamma(t_2) ==> t_1 = a "and" t_2 = b$ (no self-crossing or backtracking).
- *Jordan curve theorem*: Let $gamma$ closed curve. Then $CC - gamma$ is disjoint union of two domains, exactly one of which is bounded. Bounded domain is *interior* of $gamma$, $D_gamma^"int"$. Unbounded domain is *exterior*, $D_gamma^"ext"$. $w$ lies inside $gamma$ if $w in D_gamma^"int"$ and outside $gamma$ if $w in D_gamma^"ext"$.
- Let $gamma$ simple closed contour. Then possible to put orientation on $gamma$ such that $forall w in CC - gamma$, $ I(gamma; w) = cases(
1 & "if" w in D_gamma^"int",
0 & "if" w in D_gamma^"ext",
) $ Then $gamma$ is *positively oriented* (interior always on left of curve - anticlockwise).
- Let $D$ domain, $f: D -> CC$ holomorphic, $Gamma$ cycle in $D$, homologous to zero in $D$.
- *General form of Cauchy's theorem*: $ integral_Gamma f(z) dif z = 0 $
- *General form of CIF*: $ forall w in D - Gamma, quad integral_Gamma f(z) / (z - w) dif z = 2 pi i I(Gamma; w) f(w) $
- For simple closed curve $gamma$, $f$ holomorphic on $D_gamma^"int" union gamma$ if exists domain $D$ such that $D_gamma^"int" union gamma subset D$ and $f$ holomorphic on $D$.
- Let $gamma$ simple closed, positively oriented contour and $f$ holomorphic on $D_gamma^"int" union gamma$.
- *Cauchy's theorem for simple closed contours*: $ integral_gamma f(z) dif z = 0 $
- *CIF for simple closed contours*: $ forall w in D_gamma^"int", quad integral_gamma f(z) / (z - w) dif z = 2 pi i f(w) $
= Holomorphic functions on punctured domains
- *Laurent series*: $ sum_(n = -oo)^oo c_n (z - a)^n $ *Principal part*: $sum_(n = -oo)^(-1) c_n (z - a)^n$. *Analytic part*: $sum_(n = 0)^oo c_n (z - a)^n$.
- Laurent series converges at $z$ iff principal and analytic parts converge at $z$.
- *Annulus centre $a$, internal/external radii $r$ and $R$*: $ A_(r, R)(a) := {z in CC: r < |z - a| < R} $
- If Laurent series isn't power series ($c_n != 0$ for some $n < 0$) then either:
- It never converges or
- Exists $0 <= r < R <= oo$ such that it converges on $A_(r, R)(a)$ and diverges for $|z - a| < r$ or $|z - a| > R$. $A_(r, R)(a)$ is *annulus of convergence*.
- If Laurent series has annulus of convergence $A_(r, R)(a)$ then it converges uniformly on any $A_(rho_1, rho_2)$ with $r < rho_1 < rho_2 < R$. So it converges locally uniformly on $A_(r, R)(a)$ so represents holomorphic function on $A_(r, R)(a)$.
- If Laurent series has annulus of convergence containing $A_(r, R)(a)$, then $c_n$ are unique and given by, for any $rho in (r, R)$ $ c_n = 1/(2 pi i) integral_(|z - a| = rho) f(z) / (z - a)^(n + 1) dif z $ So Laurent series in $A_(r, R)(a)$ unique.
- *Holomorphic functions on annuli have Laurent series*: let $f: A_(r, R)(a) -> CC$ holomorphic, then exist unique $c_n in CC$ such that $ forall z in A_(r, R)(a), quad f(z) = sum_(n = -oo)^oo c_n (z - a)^n $ and annulus of convergence of Laurent series contains $A_(r, R)(a)$. Series is *Laurent series of $f$ on $A$*.
- *Punctured ball*: $B_R^*(a) := B_R(a) - {a} = A_(0, R)(a)$.
- If $f$ holomorphic on $B_R^*(a)$, $f$ has *isolated singularity* at $a$.
- Types of isolated singularity:
- $f$ has *removable singularity* at $z = a$ if $c_n = 0$ for all $n <= -1$ (principal part is zero).
- $f$ has *pole of order $k$* at $z = a$ if $c_(-k) != 0$ and $c_n = 0$ for all $n < -k$.
- $f$ has *essential singularity* at $z = a$ if exist infinitely many $n < 0$ such that $c_n != 0$.
- $f: B_R^*(a) -> CC$ has removable singularity at $z = a$ iff $f$ extends to holomorphic function on $B_R(a)$ ($f$ has analytic continuation to $B_R(a)$).
- Let $f: B_R^*(a) -> CC$ holomorphic, $R > 0$. Then $f$ has removable singularity at $z = a$ iff $ lim_(z -> a) (z - a) f(z) = 0 $
- *Riemann extension theorem*: Let $f: B_R^*(a) -> CC$ holomorphic and bounded, then $f$ has removable singularity at $z = a$.
- Let $f: B_R^*(a) -> CC$ holomorphic. The following are equivalent:
- $f$ has pole of order $k$ at $z = a$.
- $f(z) = (z - a)^(-k) g(z)$, $g: B_R(a) -> CC$ holomorphic, $g(a) != 0$.
- Exists $0 < r <= R$ and $h: B_r(a) -> CC$ holomorphic with zero of order $k$ at $z = a$ such that $f(z) = 1 \/ h(z)$ for $z in B_r^*(a)$.
- Let $f: B_R^*(a) -> CC$ holomorphic. Then $f$ has pole at $z = a$ iff $ lim_(z -> a) |f(z)| = oo $
- *Casorati-Weierstrass theorem*: let $f: B_R^*(a) -> CC$ holomorphic with essential singularity at $z = a$. Then $ forall w in CC, forall 0 < r < R, forall epsilon > 0, exists z in B_r^*(a), quad f(z) in B_epsilon(w) $
- *Big Picard theorem*: let $f: B_R^*(a) -> CC$ holomorphic with essential singularity at $z = a$. Then for some $b in CC$, $ forall 0 < r < R, quad CC - {b} subset.eq f(B_r^*(a)) $
= Cauchy's residue theorem
- $f$ *meromorphic* on domain $D$ if $f$ holomorphic on $D - S$, $S subset D$ has no non-isolated points and $f$ has pole at every $s in S$.
- $f$ meromorphic on $D_gamma^"int" union gamma$ if exists domain $D$ containing $D_gamma^"in" union gamma$ and $f$ meromorphic on $D$.
- Let $f$ meromorphic on domain $D$ with pole at $a$, with Laurent series $ f(z) = sum_(n = -k)^oo c_n (z - a)^n $ *Residue of $f$ at $a$* is $ "Res"_(z = a)(f) := c_(-1) $
- *Cauchy's residue theorem*: Let $f$ meromorphic on $D_gamma^"int" union gamma$, $gamma$ positively oriented simple closed contour, $f$ has no poles on $gamma$ and finite number of poles inside $gamma$, ${a_1, ..., a_m}$. Then $ integral_gamma f(z) dif z = 2 pi i sum_(j = 1)^m "Res"_(z = a_j)(f) $
- *Simple pole*: pole of order $1$.
- *Rules for calculating residues*:
- *Linear combinations*: $"Res"_(z = a) (A f + B g) = A "Res"_(z = a)(f) + B "Res"_(z = a)(g)$.
- *Cover up rule for poles of order $1$*: if $z = a$ is pole of order $1$, $ "Res"_(z = a)(f) = lim_(z -> a) (z - a) f(z) $
- *Simple zero on denominator*: if $f(z) = g(z) \/ h(z)$, $g, h$ holomorphic at $a$, $g(a) != 0$, $z = a$ is zero of order $1$ of $h$, then $ "Res"_(z = a)(f) = g(a) / (h'(a)) $
- *Poles of higher orders*: if $f(z) = g(z) \/ (z - a)^k$, $k > 0$, $g$ holomorphic at $a$, then $ "Res"_(z = a)(f) = (g^((k - 1))(a)) / ((k - 1)!) $
- To calculate $ integral_0^(2 pi) F(sin(theta), cos(theta)) dif theta $ where $F$ is rational function, use change of variable $z = e^(i theta)$, and use $ integral_0^(2 pi) F(sin(theta), cos(theta)) dif theta = integral_(|z| = 1) F((z - z^(-1)) / (2 i), (z + z^(-1)) / 2) (dif z) / (i z) $
- To calculate $ lim_(R -> oo) integral_(-R)^R p(x) / q(x) dif x $ where $deg(q) >= deg(p) + 2$ and $q$ has no real roots, integrate $f(z) = p(z) \/ q(z)$ over $gamma_R = L_R union C_R$ where $R$ greater than maximum modulus of roots of $q$. Use e.g. Estimation Lemma or Jordan's lemma to show $lim_(R -> oo) integral_(C_R) f(z) dif z = 0$.
- $ integral_(-oo)^oo f(x) dif x = lim_(r -> oo) integral_(0)^r f(x) dif x + lim_(s -> oo) integral_(-s)^0 f(x) dif x $
- *Cauchy principal value* of $integral_(-oo)^oo f(x) dif x$: $ P.V. integral_(-oo)^oo f(x) dif x = lim_(r -> oo) integral_(-r)^r f(x) dif x $
- If $f$ even, $P.V. integral_(-oo)^oo f(x) dif x = integral_(-oo)^oo f(x) dif x$
- *Jordan's lemma*: let $f$ holomorphic on $D = {z in CC: |z| > r}$ for some $r > 0$, $z f(z)$ bounded on $D$. Then for every $alpha > 0$, $ lim_(R -> oo) integral_(C_R) f(z) e^(i alpha z) dif z = 0 $ where $C_R = R e^(i theta), theta in [0, pi]$.
- To calculate $ P.V. integral_(-oo)^oo f(x) sin(alpha x) dif x quad "or" quad P.V. integral_(-oo)^oo f(x) cos(alpha x) dif x $ where $f$ meromorphic in $CC$ with no real poles and $f$ satisfies Jordan's lemma, calculate integral $ integral_(gamma_R) f(z) e^(i alpha z) dif z $ with CRT, where $gamma_R = L_R union C_R$. Then use $ integral_(L_R) f(z) e^(i alpha z) dif z = integral_(-R)^R f(x) cos(alpha x) dif x + i integral_(-R)^R f(x) sin(alpha x) dif x $ and equate real/imaginary parts. Use Jordan's lemma to show $lim_(R -> oo) integral_(C_R) f(z) e^(i alpha z) dif z = 0$.
- *Indentation lemma*: Let $g$ meromorphic on $CC$ with simple pole at $0$, $C_epsilon(theta) = epsilon e^(i theta), theta in [0, pi]$. Then $ lim_(epsilon -> 0) integral_(C_epsilon) g(z) dif z = pi i "Res"_(z = 0)(g) $
- To calculate $ integral_(-oo)^oo f(x) dif x $ where $f$ has simple pole at $z = 0$, let $gamma_(rho, R) = L_2 union (-C_rho) union L_1 union C_R$ where $L_2$ is line from $-R$ to $-rho$, $L_1$ is line from $rho$ to $R$. Take $rho -> 0$ and $R -> oo$, use indentation lemma and Jordan's lemma. *Note*: may have to choose appropriate branch cut so that $f$ holomorphic on $D$.
- Let $f$ meromorphic with zero or pole order $k > 0$ at $a$. Then $f' \/ f$ has simple pole at $a$ and $ "Res"_(z = a)(f' \/ f) = cases(
k & "if f has zero at" z = a,
-k & "if f has pole at" z = a
) $
- *Argument principle*: let $gamma$ positively oriented simple closed contour, $f$ meromorphic on $D_gamma^"int" union gamma$, $f$ has no zeros or poles on $gamma$, $Z_f$ be number of zeros of $f$ in $D_gamma^"int"$ (counted with multiplicity), $P_f$ be number of poles of $f$ in $D_gamma^"int"$ (counted with multiplicity). Then $ 1/(2 pi i) integral_gamma (f'(z)) / f(z) dif z = Z_f - P_f = I(Gamma_f; 0), quad Gamma_f = f compose gamma $ (Counted with multiplicity means zero/pole of order $k$ counts $k$ times).
- *Rouche's theorem*: let $gamma$ simple closed contour, $f, g$ holomorphic on $D_gamma^"int" union gamma$, with $ forall z in gamma, |f(z) - g(z)| < |g(z)| $ Then $f$ and $g$ have same number of zeros (counted with multiplcity) inside $gamma$.
- *Open mapping theorem*: let $f$ holomorphic, non-constant on domain $D$. Then if $U subset D$ open, $f(U)$ is open. |
|
https://github.com/Sematre/typst-kit-thesis-template | https://raw.githubusercontent.com/Sematre/typst-kit-thesis-template/main/main.typ | typst | // ---------------------------------
// | Information about the thesis |
// ---------------------------------
#let author = "<NAME>"
#let title = "Title of the Thesis"
#let thesis_type = "Master's Thesis/Bachelor's Thesis"
#let institute = "KASTEL – Institute of Information Security and Dependability"
#let reviewers = ("Prof. A", "Prof. B")
#let advisors = ("M.Sc. C", "M.Sc. D")
#let start_time = "xx. Month 20XX"
#let end_time = "xx. Month 20XX"
// ---------------
// | Page Layout |
// ---------------
#set document(
author: author,
title: title
)
#set page(
paper: "a4",
binding: left,
margin: (
inside: 3.25cm,
outside: 2.5cm,
),
number-align: right,
numbering: "1",
)
// TODO: Not stable yet...
// #show heading.where(outlined: false): set heading(bookmarked: false)
#show heading: it => {
set text(font: "Source Sans Pro")
v(12pt * 3.5, weak: true)
it
v(12pt * 2, weak: true)
}
#show heading.where(level: 1): it => {
pagebreak(to: "odd")
v(3cm)
it
}
#set par(justify: true)
#set text(
font: "Linux Libertine",
size: 12pt,
hyphenate: false
)
// --------------
// | Title page |
// --------------
#rect(
width: 100%,
height: 100%,
radius: (
top-right: 8mm,
bottom-left: 8mm,
),
)[
#set align(center)
#set text(size: 14pt)
#grid(
columns: 1,
rows: (6cm, 1fr),
align(horizon, grid(
columns: (2fr, 1fr, 2fr),
rows: 1fr,
image("assets/logo-kit.svg", height: 1.8cm),
[],
image("assets/logo-sdq.svg", height: 1.8cm)
)),
[
#text(font: "Source Sans Pro", size: 20pt, strong(title))
#thesis_type of
#author
], [
At the KIT Department of Informatics\
#institute
#v(12pt)
#let cardinalNumberToOrdinalNumber(number) = {
if 11 <= calc.rem(number, 100) and calc.rem(number, 100) <= 13 {
str(number) + "th"
} else {
str(number) + (
"th",
"st",
"nd",
"rd",
"th"
).at(calc.min(calc.rem(number, 10), 4))
}
/*
(
"1": "First",
"2": "Second",
"3": "Third",
"4": "Fourth",
"5": "Fifth",
"6": "Sixth",
"7": "Seventh",
"8": "Eighth",
"9": "Ninth",
"10": "Tenth",
).at(str(number))
*/
}
#block(align(left, grid(
columns: (auto, auto),
gutter: 0.65em,
..reviewers.enumerate().map(item => {
let index = item.at(0) + 1
let name = item.at(1)
([#cardinalNumberToOrdinalNumber(index) examiner:], [#name])
}).flatten(),
[], [],
..advisors.enumerate().map(item => {
let index = item.at(0) + 1
let name = item.at(1)
([#cardinalNumberToOrdinalNumber(index) advisor:], [#name])
}).flatten(),
)))
#v(12pt)
#start_time – #end_time
]
)
]
// -------------------
// | Title back page |
// -------------------
#pagebreak(weak: true)
Karlsruher Institut für Technologie\
Fakultät für Informatik\
Postfach 6980\
76128 Karlsruhe
// ---------------
// | Declaration |
// ---------------
#pagebreak(to: "odd")
#v(1fr)
#rect(
width: 100%,
inset: (
top: 5pt,
rest: 0pt
),
stroke: (
top: 1pt
),
)[
/*
Gemäß Studien- und Prüfungsordnung Bachelor Informatik des KIT,
§ 14 (5) vom 10.05.2022
*/
I declare that I have developed and written the enclosed thesis completely by myself. I have not used any other than the aids that I have mentioned. I have marked all parts of the thesis that I have included from referenced literature, either in their original wording or paraphrasing their contents. I have followed the by-laws to implement scientific integrity at KIT.
]
*PLACE, DATE*
#v(1.5cm)
#grid(
row-gutter: 1.5mm,
block(width: 8cm, repeat[.]),
align(center)[
(#author)
]
)
// ----------------
// | Abstract |
// ----------------
#include "sections/01_abstract_en.typ"
#include "sections/02_abstract_de.typ"
// ------------------------
// | Table of Contents |
// ------------------------
// Headings
#[
#show outline.entry.where(level: 1): it => {
v(12pt, weak: true)
set text(font: "Source Sans Pro")
strong(it)
}
#heading(outlined: false)[Outline]
#outline(
depth: 3,
indent: auto,
title: none
)
]
// Figures
#heading(outlined: false)[List of Figures]
#outline(
target: figure.where(kind: image),
title: none,
)
// Tables
#heading(outlined: false)[List of Tables]
#outline(
target: figure.where(kind: table),
title: none,
)
// -----------------
// | Main part |
// -----------------
#set heading(numbering: "1.")
#include "sections/03_introduction.typ"
#include "sections/04_content.typ"
#include "sections/05_evaluation.typ"
#include "sections/06_conclusion.typ"
// --------------------
// | Bibliography |
// --------------------
#bibliography("thesis.bib")
// ----------------
// | Appendix |
// ----------------
#show: it => {
counter(heading).update(0)
counter("appendices").update(1)
set heading(numbering: "A.1.")
it
}
#include "sections/07_appendix.typ"
|
|
https://github.com/storopoli/Bayesian-Statistics | https://raw.githubusercontent.com/storopoli/Bayesian-Statistics/main/slides/07-ordinal_regression.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "@preview/polylux:0.3.1": *
#import themes.clean: *
#import "utils.typ": *
#import "@preview/plotst:0.2.0": plot as pplot, axis, bar_chart, scatter_plot
#new-section-slide("Ordinal Regression")
#slide(title: "Recommended References")[
- #cite(<gelman2013bayesian>, form: "prose") - Chapter 16: Generalized linear
models, Section 16.2: Models for multivariate and multinomial responses
- #cite(<mcelreath2020statistical>, form: "prose") - Chapter 12, Section 12.3:
Ordered categorical outcomes
- #cite(<gelman2020regression>, form: "prose") - Chapter 15, Section 15.5: Ordered
and unordered categorical regression
- #cite(<Burkner_Vuorre_2019>, form: "prose")
- #cite(<Semenova_2019>, form: "prose")
]
#focus-slide(background: julia-purple)[
#align(center)[#image("images/memes/categorical_data.jpg")]
]
#slide(title: [What is Ordinal Regression?])[
#v(2em)
*Ordinal regression* is a regression model for *discrete data* and, more
specific, when the *values of the dependent variables have a "natural
ordering"*.
#v(2em)
For example, opinion polls with its plausible ordered values from
agree-disagree, or a patient perception of pain score.
]
#slide(title: [Why not just use Linear Regression?])[
The main reason to not simply use linear regression with ordinal discrete
outcomes is that the categories of the dependent variable could not be
*equidistant*.
#v(2em)
This is an assumption in linear regression (and in almost all models that use "metric"
dependent variables): the distance between, for example, $2$ and $3$ is not the
same distance between $1$ and $2$.
#v(2em)
This assumption can be *violated in an ordinal regression*.
]
#slide(title: [How to deal with an Ordinal Dependent Variable?])[
#v(2em)
Surprise! Plot twist!
#v(2em)
Another *non-linear transformation*.
]
#slide(title: [Cumulative Distribution Function -- CDF])[
In the case of ordinal regression, first we need to transform the *dependent
variable into a cumulative scale*
#v(2em)
For this, we use the cumulative distribution function (CDF):
$ P(Y <= y) = sum^y_(i=y_"min") P(Y = i) $
CDF is a *monotonically increasing function* that represents the *probability of
a random variable* $Y$ *taking values less than a certain value*
$y$
]
#slide(title: [Log-cumulative-odds])[
#text(size: 18pt)[
Still, this is not enough. We need to apply the *logit function onto the CDF*:
$ op("logit")(x) = op("logistic")^(-1)(x) = ln(x / (1 -x)) $
where $ln$ is the natural log function.
The logit function is the inverse of the logistic function: it takes as input
any value between $0$ and $1$ (e.g. a probability) and outputs an unconstrained
real number which we call *logodds* #footnote[we already seen it in logistic regression.].
As the transformation is performed onto the CDF, we call the result as the CDF
logodds or *log-cumulative-odds*.
]
]
#slide(title: [$K-1$ Intercepts])[
What do we do with this *log-cumulative-odds*?
It allows us to construct *different intercepts for all possible values of the
ordinal dependent variable*. We create an *unique intercept for* $k ∈ K$.
#v(1em)
Actually is $k ∈ K-1$. Notice that the maximum value of the CDF of $Y$ will
always be $1$. Which translates to a log-cumulative-odds of $oo$, since $p = 1$:
$ ln(p / (1-p)) = ln(1 / (1-1)) = ln(0) = oo $
Hence, we need only $K-1$ *intercepts for all* $K$ *possible values that*
$Y$ *can take*.
]
#slide(title: [Violation of the Equidistant Assumption])[
#v(3em)
Since each intercept implies a different CDF value for each $k ∈ K$, we can
safely *violate the equidistant assumption* which is not valid in almost all
ordinal variables.
]
#slide(title: [Cut Points])[
Each intercept implies in a log-cumulative-odds for each $k ∈ K$; We need also
to *undo the cumulative nature of the $K - 1$ intercepts*. Firstly, we *convert
the log-cumulative-odds back to a valid probability with the logistic
function*:
$ op("logit")^(-1)(x) = op("logistic")(x) = (1 / (1 + e^(-x))) $
Then, finally, we remove the cumulative nature of the CDF by *subtracting every
one of the $k$ cut points by the
$k - 1$ cut point*:
$ P(Y = k) = P(Y <= k) - P(Y <= k - 1) $
]
#slide(title: [Example - Probability Mass Function of an Ordinal Variable])[
#align(center)[
#let data = (
(0.10, 1),
(0.15, 2),
(0.33, 3),
(0.25, 4),
(0.10, 5),
(0.07, 6),
)
#let x_axis = axis(
min: 0,
max: 6.1,
step: 1,
location: "bottom",
helper_lines: false,
title: "values",
)
#let y_axis = axis(
min: 0,
max: 0.46,
step: 0.1,
location: "left",
show_markings: true,
helper_lines: true,
value_formatter: "{:.1}",
title: "PDF",
)
#let pl = pplot(data: data, axes: (x_axis, y_axis))
#bar_chart(pl, 80%, bar_width: 70%, caption: none)
]
]
#slide(title: [Example - CDF versus log-cumulative-odds])[
#side-by-side[
#align(center)[
#let data = (
(0.10, 1),
(0.25, 2),
(0.58, 3),
(0.83, 4),
(0.93, 5),
(1.00, 6),
)
#let x_axis = axis(
min: 0,
max: 6.1,
step: 1,
location: "bottom",
helper_lines: false,
title: "values",
)
#let y_axis = axis(
min: 0,
max: 1.2,
step: 0.1,
location: "left",
show_markings: true,
helper_lines: true,
value_formatter: "{:.1}",
title: "CDF",
)
#let pl = pplot(data: data, axes: (x_axis, y_axis))
#bar_chart(pl, 80%, bar_width: 70%, caption: none)
]
][
#align(center)[
#let data = (
(1, -2.19722),
(2, -1.09861),
(3, 0.322773),
(4, 1.58563),
(5, 2.58669),
(6, 10.0),
)
#let x_axis = axis(
min: 0,
max: 6.1,
step: 1,
location: "bottom",
helper_lines: false,
title: "values",
)
#let y_axis = axis(
min: -3,
max: 3,
step: 1,
location: "left",
show_markings: true,
helper_lines: true,
value_formatter: "{:.1}",
title: "log-cumulative-odds",
)
#let pl = pplot(data: data, axes: (x_axis, y_axis))
#scatter_plot(pl, 80%, stroke: 4pt, caption: none)
]
]
]
#slide(title: [Adding Coefficients $bold(β)$])[
#v(3em)
With the equidistant assumption solved with $K - 1$ intercepts, we can add
coefficients to represent the independent variable's effects into our ordinal
regression model.
]
#slide(title: [More Log-cumulative-odds])[
We've transformed all intercepts into log-cumulative-odds so that we can add
effects as weighted sums of the independent variables to our basal rates
(intercepts).
For every $k ∈ K - 1$, we calculate:
$ φ = α_k + β_i x_i $
where $α_k$ is the log-cumulative-odds for the $k ∈ K - 1$ intercepts,
$β_i$ is the coefficient for the $i$th independent variable $x_i$.
Lastly, $φ_k$ represents the linear predictor for the $k$th intercept.
]
#slide(title: [Matrix Notation])[
This can become more elegant and computationally efficient if we use
matrix/vector notation:
$ bold(φ) = bold(α) + bold(X) \cdot bold(β) $
#v(2em)
where $bold(φ)$, $bold(α)$ e
$bold(β)$ #footnote[
note that both the coefficients and intercepts will have to be interpret as
odds, like we did in logistic regression.
]
are vectors and $bold(X)$ is the data matrix, in which every line is an
observation and every column an independent variable.
]
#slide(title: [Ordinal Regression Specification])[
#text(size: 13pt)[
$
bold(y) &tilde "Categorical"(bold(p)) \
bold(p) &= "logistic"(bold(φ)) \
bold(φ) &= bold(α) + bold(c) + bold(X) \cdot bold(β) \
c_1 &= "logit"("CDF"(y_1)) \
c_k &= "logit"("CDF"(y_k) - "CDF"(y_(k-1))) "for" 2 <= k <= K-1 \
c_K &= "logit"(1 - "CDF"(y_(K-1))) \
bold(α) &tilde "Normal"(μ_α, σ_α) \
bold(β) &tilde "Normal"(μ_(bold(β)), σ_{bold(β)})
$
]
#text(size: 12pt)[
- $bold(y)$ -- ordinal discrete dependent variable.
- $bold(p)$ -- probability vector of size $K$.
- $K$: number of possible values that $bold(y)$ can take, i.e. number of ordered
discrete values.
- $bold(φ)$: log-cumulative-odds, i.e. the cut points considering the intercepts
and the weighted sum of the independent variables.
- $c_k$: cutpoint in log-cumulative-odds for every $k ∈ K-1$.
- $α_k$: intercept in log-cumulative-odds for every $k ∈ K-1$.
- $bold(X)$: data matrix of the independent variables.
- $bold(β)$: coefficient vector with size the same as the number of columns of $bold(X)$.
]
]
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/028%20-%20Kaladesh/009_A%20Grateful%20Consulate.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"A Grateful Consulate",
set_name: "Kaladesh",
story_date: datetime(day: 19, month: 10, year: 2016),
author: "<NAME>",
doc
)
#emph[The metal-mage Tezzeret intended to make an example of Pia Nalaar by facing her in a public contest. But the Planeswalkers of the Gatewatch, drawn to Kaladesh by Tezzeret's presence here, interrupted the contest and freed Pia Nalaar from Consulate custody. But Tezzeret's schemes are never straightforward, and even the public spectacle had another purpose—as <NAME> is learning now.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
<NAME> shook his head, annoyed. All around him, a deeply flawed plan was unfolding in utter chaos.
Throughout the fairgrounds, Enforcer-Chief Ranaj's soldiers were seizing inventions in their characteristically clumsy fashion, with automatons lending an unsubtle threat to back up the enforcers' legal authority. Arguments had erupted on every side, scuffles were breaking out here and there, and inventors were loudly expressing the expected range of emotions, from outraged fury to crushing despair. And through it all was an undercurrent of panic, a press of the crowd away from the arena, where Tezzeret should have been holding his demonstration against the renegade, Pia Nalaar. But Tezzeret had been carried off to the Aether Spire on a Consulate flagship, so that was where Dovin had to make his way—through all this chaos.
#emph[If Tezzeret had just consulted me before setting the enforcers to work, ] Dovin thought, #emph[everything would be going so much more smoothly.]
"You!" he barked at a nearby enforcer whose sash identified her as an officer. "It is necessary to disperse that cluster of citizens before they opt for a more violent expression of their frustration." The officer followed his pointing hand and nodded in acknowledgement. She opened her mouth to repeat his instructions, but he wasn't finished.
"In addition, that man must exercise more caution in handling that sword, or he will sever a limb—his own or one belonging to another citizen. That cart cannot support the weight of the so-called 'mana vault' that is being loaded into it, and you must ensure that none of your enforcers are inspired to set foot inside it." He had been the one who ensured that the device, a product of the Aetherological Society, had been surrounded by a fence at the fair, for the safety of all observers. He winced as an axle broke under its weight and six strong soldiers staggered around, trying to keep it from tipping over onto any of them.
The officer ran toward that disaster, forgetting all his other warnings in her haste, and Dovin sighed. It was up to him, then, to prevent the next disaster. He hurried toward the knot of restive inventors, grabbing two enforcers by the elbow as he drew near.
"Move along your way, citizens," he said. "For your own safety." He shoved the two soldiers ahead of him, and they started guiding people away. Good. Next.
Ah, too late again! The oaf with the sword had already cut himself. Fortunately, the wound was much less serious than it could have been, and someone was already kneeling beside him, tying a tourniquet above the wound on his arm. Dovin nodded, satisfied that the care was sufficient—but still irritated that it was necessary.
Nearby, an inventor cradled an elegant thopter device in her arms as if it were a child. As an enforcer stepped toward her, Dovin saw immediately how it would all play out: the enforcer would wrest it from her arms, the inventor would shriek her anger and try to grab it back, and the Bastion automaton that lumbered up behind the enforcer would have to restrain her. Would it take that much longer to do it right? Show your badge, explain your purpose, promise to treat it with the greatest care, ensure that the inventor's name was attached to it.
But apparently that was too much to ask. Before he could make his way there, the scene played out exactly as Dovin had known it would, and the automaton had to hold the inventor at bay until she pulled away and stormed off in the other direction, clearly prepared to take action.
#figure(image("009_A Grateful Consulate/01.jpg", width: 100%), caption: [Confiscation Coup | Art by <NAME>], supplement: none, numbering: none)
It was a flawed plan, poorly executed. He had come to expect better from the Consulate he loved. But then, he had also grown accustomed to being consulted, to having the opportunity to refine such plans before they were put into place, instead of scrambling to clean up the mess left behind. The Consulate had recognized his talents, which accounted for his rise to the position of senior inspector, overseeing new designs and setting safety standards. And Tezzeret had seen his potential as well, his ability to spot flaws not just in inventions but in the intricate complexities of the Consulate bureaucracy, the Inventors' Fair, and Tezzeret's own rise to power. Yes, Dovin had seen that, too, and subtly helped the metal-mage correct a flaw or two in his schemes. And Tezzeret rewarded him for it.
#emph[What happened?] he wondered.
Had he lost Tezzeret's favor, somehow? Did Tezzeret hold the arrival of these other Planeswalkers against him? Dovin felt himself growing defensive. Contacting these Planeswalkers—this "Gatewatch"—had been the best possible course of action under the circumstances, given the information available to him at the time. Tezzeret could not blame him for that.
Well, the damage was done. The Planeswalkers were here and the enforcers were doing what Tezzeret told them to do, and it fell to <NAME>an to fix it—as indeed he struggled to fix everything he could, throughout the city, within the limits of his ability. His talents had their negative aspects, given how difficult it was for him to leave uncorrected the flaws that he saw. He could not stand by and watch his city, his Consulate, descend into chaos.
As he made his way closer to the spire, a blast like a trumpet sounded over the plaza. Just ahead, an exquisite lifecraft construct in the likeness of an elephant—the inventor had even gone to the trouble of reproducing its blaring sound—swung its head from side to side, knocking enforcers to the ground with its huge, spiraling tusks. The soldiers tried to duck out of the way or prod the lifecraft beast with their own spears, but the metal spearheads clanked uselessly against its metal plating. Dovin pursed his lips as he hurried toward the commotion.
#emph[I cannot be in all the places required,] he thought,#emph[ to ameliorate the repercussions of this inadequate decision-making.]
He grabbed the arm of an enforcer and yanked him backward just in time to avoid the elephant's lashing trunk. "Listen," he said.
"I'm a little busy!" the enforcer snapped.
"If you are busy with no plan, you might as well be idle," Dovin said. "Listen and watch."
The enforcer blinked at him, confused, and Dovin took the opportunity to explain. "Watch. When a spear is thrust toward the lifecraft animal's throat, it rears up on its hind legs. Without fail. It then kicks out with its front feet. Here, tell them."
"Go for the throat!" the enforcer yelled, and one of his fellows obeyed.
With a trumpet, the elephant reared up and lashed out with both front feet, sending the obedient enforcer sprawling on the pavement. Dovin sighed.
"Look there," he said, pointing at its belly. "The quality of the work is shoddy, typical for renegade construction. A cable near the hips is exposed whenever it rears up in that fashion. All that is required is to sever the cable, and the entire automaton will collapse."
#figure(image("009_A Grateful Consulate/02.jpg", width: 100%), caption: [Bastion Mastodon | Art by <NAME>], supplement: none, numbering: none)
The enforcer nodded and inched back into the fray, trying to get close enough to do as Dovin had instructed. Dovin crossed his arms, keeping one eye on the elephant as he scanned the crowd for the renegade lifecrafter responsible for this untidiness.
"Ah," he said, spotting an elf in the crowd.
He stepped forward and took hold of a different enforcer's shoulders. "The task of severing the cable falls to you," he said in her ears. He shifted her a little to the left, just as his most recent pupil provoked the elephant into rearing up again.
"Go now," he said, gently pushing her forward.
The elephant turned slightly at her approach, lashing out with its trunk. She dodged it—#emph[well done,] Dovin thought—and managed to catch the exposed cable on her polearm. Shifting her grip, she yanked, the blade cut the cable, the elephant fell—
And its trunk sent the elf lifecrafter sprawling to the ground.
Dovin pointed him out to the enforcers. "Take the elf into custody to answer for this disturbance." And he strode on—#emph[No more distractions!] —to the Aether Spire, to find Tezzeret.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Dovin reached the spire and saw Tezzeret striding down a hall, barking orders. He hurried to catch up with the head judge and put a hand on Tezzeret's arm.
He yanked his hand back from the feel of jagged metal under the sleeve. Of course: he had previously assumed that the glowing claw at the end of the sleeve was a distinct device, perhaps mounted to Tezzeret's arm, but now he realized it was #emph[part] of the arm—based on his brief touch, he could extrapolate the shape of it under the loose cloth. A #emph[replacement] limb? And far from elegant in its aesthetics, though it appeared highly functional. Interesting, and odd that Dovin had not noticed it before. Had Tezzeret been hiding it?
"What is it, Baan?" Tezzeret said. His posture shouted impatience, even as his face attempted to project an unshakable calm.
"What is #emph[this] ?" Dovin countered, sweeping his arm behind him, to encompass all the chaos of the Inventors' Fair being dismantled. "What possible circumstances could render these draconian measures necessary?"
Tezzeret pointed over Dovin's shoulder with his metal hand. "I take it you didn't see what happened in the arena," he said.
"Your invention contest with the renegade? An overdramatic move with endless potential for disaster, which I believe I brought to your attention as soon as you made your intention known to me."
"I was referring specifically to the gang of six Planeswalkers who #emph[interrupted] that duel and disappeared with the renegade." Tezzeret's face clearly showed his frustration now. "I don't remember you outlining that possible disaster."
Dovin counted on his fingers—there was the younger Nalaar, of course, who had been complicating the range of potential outcomes since her arrival on the plane. The telepath, the elf, the warrior, the necromancer...he held his smallest finger. Who was the sixth?
#figure(image("009_A Grateful Consulate/03.jpg", width: 100%), caption: [Dramatic Reversal | Art by <NAME>s], supplement: none, numbering: none)
"They have emboldened the renegades," Tezzeret said. "The situation is getting out of control."
"But was all this necessary? Why confiscate their inventions, and in such a clumsy and heavy-handed manner? A quick survey of the square should make it clear that these actions serve only to further provoke and, as you say, embolden those who would resist Consulate authority."
"Relax, Baan. It's not as though we're stealing their inventions. We're safeguarding them. We wouldn't want such priceless inventions damaged in a renegade attack."
"There's no need to sway my opinion on the matter, of course, but—"
"And these devices aren't thoroughly tested, as you well know. They're not safe. We can't leave that much unlicensed technology just lying around the city."
"Such a thing would be irresponsible, of course," Dovin said. "But it would have been more productive to explain that rationale. Instead of sending Ranaj's enforcers to wrest devices from the hands of their grief-stricken owners, we could have sent bureaucrats with forms to complete, complicated assurances, soothing nonsense words."
"There's no #emph[time,] " Tezzeret snarled under his breath.
#emph[Interesting,] Dovin thought. Tezzeret's whole posture changed, just for a moment—as if a fit of rage had seized him, squeezed his body, and as quickly released him.
Dovin adopted a soothing tone. "I'm sure that taking extra time to preserve to peace and public safety is entirely worthwhile. It is certainly true that some of these devices have enormous potential to damage person and property—"
"Yes, tremendous potential. Don't you see? It's far better that Consulate inquiriums take this technology and explore its potential, rather than leaving that work in the hands of who-knows-who. We can develop it, refine it, perfect it."
Dovin paused for a moment. "Yes, of course. Such development was essential to the plan for the Inventors' Fair from the beginning. The advancement of technology for the betterment of society, under careful Consulate supervision. So why—"
"And who better than you to lead that effort?"
Dovin blinked, momentarily speechless. "Me?" Of course that was the logical choice. But a moment ago, he had been thinking that he'd fallen out of Tezzeret's favor somehow. Now Tezzeret was offering him a position of tremendous importance.
"But before I can entrust you with such a momentous task, you need to clear something up. These other Planeswalkers. You brought them here?"
"Well, in a strictly technical sense, I did not, no. I invited some of them here as a safeguard against a potential fault I identified in the plans for the Inventors' Fair—specifically the renegade danger, embodied in Pia Nalaar. But the Planeswalkers refused my invitation. Only then did the young Nalaar get wind of my invitation and come here on her own. I brought only one—the elf, Nissa."
"And here is my cause for concern, Baan," Tezzeret said, putting his hand of flesh and bone on Dovin's shoulder. "I value your foresight. Your interaction with these Planeswalkers seems like an uncharacteristic mistake."
A mistake? Dovin bristled. "In fact, my decision was optimal, given the information you opted to share with me. Presented with the danger of a renegade threat, who better to confront such a danger than a group of self-professed heroes with such monumental power at their disposal? The odds that they would actually side with the renegades were infinitesimal—were it not for the existence of what appear to be personal grudges, of which I had no foreknowledge."
"And this is the result," Tezzeret said. "They challenge me in the arena. I am forced to move more quickly—so clumsily, as you rightly said. They forced my hand." He flexed his metal hand, and Dovin took an involuntary step back.
"You need to fix this, Baan. You're right that these events will stir up the renegades. So stop them. I need a secure inquirium where I can work without fear of renegade attack. You need the confiscated inventions stored and safely catalogued for your own explorations. We need the Bastion on high alert, ready to face any threat that arises. We need to remind them who is in charge here."
"You need an inquirium?" Dovin asked. "What for?"
#figure(image("009_A Grateful Consulate/04.jpg", width: 100%), caption: [Rashmi, Eternities Crafter | Art by Magali Villeneuve], supplement: none, numbering: none)
"I have my own research to pursue," Tezzeret said, continuing down the hall. Dovin hurried to catch up. "Rashmi's work for the fair had staggering implications. Larger than this little rebellion, larger even than Kaladesh. That will be my focus. The rest of the inventions are yours."
#emph[Really?] Dovin thought. He had not seen anything else at the fair capture Tezzeret's attention in this way. "Very well," he said.
"#emph[After] you clean up the rest of this mess."
"Of course." #emph[First,] he thought, #emph[the Planeswalkers.]
Tezzeret turned and strode off without another word, and Dovin beckoned to the nearest enforcer officer.
"Assemble a veteran squad of soldiers," he instructed, "with a measure of skill, if you please, and pursue the...the strangers, the renegades from the arena. Heed me: they have flaws that will ensure their failure if properly exploited." He counted them off on his fingers. "They lack a clear leader, so they can be pulled in different directions. The young Nalaar is volatile and easily provoked into reckless action. The black-haired woman is not fully trusted by some of the others, especially the soldier. They have a sad belief that they're heroes, and can be counted on to act as such. They will try to protect their weaker associates, such as <NAME>. And they expect that they will win with a minimum of cost or sacrifice. Exploit those weaknesses in every way you can. Go!"
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The moment he stepped back outside, Dovin's head swam. The plaza was even more crowded now, presumably with members of the arena audience—many of whom were inventors who were now discovering that the enforcers were laying claim to their precious inventions, or had already removed them. Dovin again shook his head at the clumsiness of it all. He didn't even need to look around the plaza to sense all the things that were going wrong—or were about to. It was a mess, as Tezzeret had said, and through no fault of his own. But Tezzeret had entrusted the task of cleaning it up to him, and nobody—in his humble but precise estimation—was better suited to the job.
He wound his way through the plaza again, this time in no hurry, gathering a handful of Bastion officers around him as he went. After all that had already been done, the most likely point of failure now was the turning of public opinion against the Consulate, and that was not a single potential point of failure but dozens, threatening the integrity of the whole delicate machine that was Ghirapur. Scattered clumps of discontented inventors registered on his attention like biting flies—a problem for the enforcers to handle, under his guidance. Gently dispersing them with pleasant reassurances was probably enough at this point, but a few strategic arrests would also be necessary. He sent officers off to each problem spot.
Other issues were better suited to individual intervention. He made his way to the scene of an emotional flare-up, a hot-headed human inventor loudly making his displeasure known to a dwarf enforcer while a pair of Bastion automatons tried to lift an elaborate device whose purpose was not immediately apparent.
"Perhaps I may be of assistance," he said, interposing himself between the inventor and the enforcer. In such situations, Dovin had found, the characteristic vedalken calm could defuse the powerful emotions displayed so prominently by other races.
"You have no #emph[right] !" the inventor yelled, bringing his reddened face entirely too close to Dovin's and jabbing a finger into his sternum.
"I can certainly understand your attachment to this marvelous device," Dovin said, running a hand over the invention's intricate metalwork. He understood its purpose now—it was designed to fabricate thopters. Clever. Of course, its many flaws also became immediately apparent, but this was not the time to enumerate them. "Truly amazing work. Your application of Dujari's principle here is ingenious." It was; he made a mental note to examine the device further once it was safely stored in a laboratory. #emph[After] the dangerous aether leak, sure to attract gremlins, was closed. "Tremendous potential."
The inventor's scowl softened, and his shoulders straightened with pride. "Thank you."
"I do assure you, sir, that your device will be treated with the utmost care while it remains in Consulate hands."
"But—"
"Of course you are familiar with the process of submitting inventions to the Consulate for safety review and careful inspection. And surely you recognize that under such extraordinary circumstances as these"—he made a vague but sweeping gesture that could be taken to mean anything from the Inventors' Fair itself to this moment of Consulate confiscation—"the process must be altered somewhat. But the result will be the same. And your work might very well be the foundation for the next breakthrough in fabrication technology. The Consulate is grateful."
#figure(image("009_A Grateful Consulate/05.jpg", width: 100%), caption: [Whirlermaker | Art by <NAME>], supplement: none, numbering: none)
Without waiting for a response from the inventor, Dovin turned to the enforcer, who had been watching the exchange with a scowl. "Now, I recommend that you secure the services of at least one more automaton to move this device with the care it deserves. If you wait, I will send them to you."
The dwarf enforcer looked as though waiting were absolutely the last thing she wanted to do, but Dovin fixed her with a stern eye to clarify that his polite phrasing should not be taken as permission to refuse.
#emph[This] was the kind of finesse that Ranaj's enforcers lacked, and Dovin very much feared that the result could be disastrous.
Similar exchanges slowed his journey from the Aether Spire all the way to the storage facility where the inventions were being taken. He calmed a half-dozen inventors, dispersed another three groups of renegades-in-the-making, and helped a containment team deal with a clutch of gremlins that had descended on the lifecraft elephant when it started leaking aether from its severed cable.
In contrast to the anxiety and tension of the city, though, a very different sort of energy filled the storage facility, and it immediately quickened Dovin's pulse. Top scientists and inventors from every Consulate inquirium in the city had been sent here with a single purpose: to undertake the monumental task of cataloging, safely storing, and investigating all of these inventions. Contained in these walls was the potential for a forward leap in technology on the same scale as the Great Aether Boom that had launched the current age of innovation, six decades ago.
And he was in charge of it all. Any doubts he had harbored about Tezzeret's good will vanished.
He could hardly wait to get started. As soon as the Planeswalkers were taken into custody and the renegades quieted. #emph[Soon.]
Increased Bastion presence. Curfews, perhaps. If necessary, a constraining of the aether supply to curtail renegade activity. And given the flaws of the Gatewatch as a group, they would be captured and confined in no time. Security and order would be restored.
And then all this would be his to explore.
#figure(image("009_A Grateful Consulate/06.jpg", width: 100%), caption: [<NAME> | Art by <NAME>], supplement: none, numbering: none)
|
|
https://github.com/chendaohan/bevy_tutorials_typ | https://raw.githubusercontent.com/chendaohan/bevy_tutorials_typ/main/24_plugins/plugins.typ | typst | #set page(fill: rgb(35, 35, 38, 255), height: auto, paper: "a3")
#set text(fill: color.hsv(0deg, 0%, 90%, 100%), size: 22pt, font: "Microsoft YaHei")
#set raw(theme: "themes/Material-Theme.tmTheme")
= 1. 插件
随着项目的增长,使其更加模块化是有益的。你可以将其拆分为“插件”。
插件只是要添加到 App 构建器中的一组内容。可以将其视为从多个地方(如不同的 Rust 文件/模块或 crate)向 App 添加内容的一种方式。
创建插件最简单的方法是编写一个接受 &mut App 的 Rust 函数:
```rs
fn function_plugin(app: &mut App) {
info!("function plugin");
app.insert_resource(FunctionPluginResource(true))
.add_systems(Startup, || info!("function plugin system"));
}
```
另一种方法是创建一个结构体并实现 Plugin Trait:
```rs
struct OnePlugin {
settings: bool,
}
impl Plugin for OnePlugin {
fn build(&self, app: &mut App) {
info!("{} One Plugin", self.settings);
}
}
```
使用结构体的好处是,如果你想使插件可配置,可以通过配置参数或泛型来扩展它。
无论哪种方式,你都可以获得 &mut App 的访问权限,因此你可以像在 main 函数中一样向其中添加任何内容。
现在,你可以从其他地方向 App 添加插件。Bevy 将调用你上面的插件实现。实际上,插件添加的所有内容将与 App 中已有的内容一起被合并到 App 中。
在你自己的项目中,插件的主要价值在于不必将所有 Rust 类型和函数声明为 pub,只为了让它们可以从 main 函数访问并添加到 App 中。插件允许你从多个不同的地方(如单独的 Rust 文件/模块)向 App 添加内容。
你可以决定插件如何融入你的游戏架构。
一些建议:
- 为不同的状态创建插件。
- 为各种子系统(如物理或输入处理)创建插件。
= 2. 插件组
插件组一次注册多个插件。Bevy 的 DefaultPlugins 和 MinimalPlugins 就是这种情况的例子。
要创建你自己的插件组,实现 PluginGroup Trait:
```rs
struct MyPluginGroup;
impl PluginGroup for MyPluginGroup {
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(OnePlugin{settings: true})
.add(TwoPlugin{settings: true})
}
}
```
将插件组添加到应用程序时,你可以禁用某些插件,同时保留其余的插件。
例如,如果你想手动设置日志记录(使用你自己的 tracing 订阅者),可以禁用 Bevy 的 LogPlugin:
```rs
App::new()
.add_plugins(
DefaultPlugins.build()
.disable::<LogPlugin>()
)
.run();
```
请注意,这只是禁用了功能,但实际上无法删除代码以避免二进制膨胀。禁用的插件仍然必须编译到程序中。
如果你想减少构建的体积,应该考虑禁用 Bevy 的默认 cargo features,或者单独依赖各种 Bevy 子 crate。
= 3. 插件配置
插件也是存储在初始化/启动期间使用的设置的方便位置。对于可以在运行时更改的设置,建议将它们放在资源中。
```rs
App::new()
.insert_resource(ClearColor(Color::BLACK))
.run()
```
使用插件组添加的插件也可以配置。Bevy 的许多 DefaultPlugins 就是这样工作的。
```rs
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
...
}))
.run()
``` |
|
https://github.com/abs0luty/qc-for-beginners | https://raw.githubusercontent.com/abs0luty/qc-for-beginners/master/book.typ | typst | #import "template.typ": *
#import "@preview/physica:0.8.1": *
#import "@preview/quill:0.2.0": *
// 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: "Quantum computing for beginners",
authors: (
"<NAME>",
)
)
#set heading(numbering: "1.1. ")
#let task_number = numbering("1.1")
#outline()
#pagebreak()
= Complex numbers
== Basics
Quantum mechanics oftenly makes use of *complex numbers*. Complex numbers are elements of a number system that extends real
numbers with a specific element denoted as $i$, called *imaginary unit*, which is a solution to $x^2=-1$ ($i = sqrt(-1)$).
Every complex number can be expressed in the form $a + b i$ where $a, b in RR$. $RR$ here is a set of all real numbers. Set of all complex numbers is denoted as $CC$. In the given example, $a$ is called the *real part* of the complex number and $b$ is called the *imaginary part*.
Complex numbers can be added and multiplied.
*Example*: Let $a = 2 + 3i$ and $b = 1 + 4i$. Find $a + b$, $a - b$ and $a times b$:
To compute the sum of two complex numbers, we just need to manually add real and imaginary parts separately: $a + b$ = $2 + 3i + 1 + 4i$ = $3 + 7i$.
Same applies to subtraction: $a - b = 2 + 3i - 1 - 4i = 1 - i$.
Multiplication is a bit different. To multiply complex numbers, we need to multiply each term of the first complex number with each term of the second one: $a times b = (2 + 3i) times (1 + 4i) = 2 + 6i + 8i + 12i^2$. From the definition of imaginary unit $i$, which is: $i = sqrt(-1)$ follows: $i^2 = -1$. So $12i^2$ can be simplified to just $-12$. So the total value of $a times b$ is $-10 + 14i$.
*Exercise 1.1.1*: Find $a/b$, given $a$ and $b$ from the previous example.
*Exercise 1.1.2*: Let $a = 4 - 3i$ and $b = 2 + 4i$. Find $a + 2b$, $3a - b$, $4a times (-2b)$ and $(10a)/(3b)$.
*Exercise 1.1.3*: Prove that addition and multiplication over complex numbers are *commutative* and *associative* operations.
*_Note_*: binary operation is considered *commutative* if changing the order of the operands doesn't change the result. *Associativity property* is a property of some binary operations, which means that rearranging the parentheses in an expression won't affect the result, example: $(2 + 3) + 4 = 2 + (3 + 4)$.
== Specific operations with complex numbers
Real numbers have a unary operation, the absolute value, given by:
$|x| = sqrt(x^2)$
There is a generalization of this operation for complex numbers, which is also often referred as *modulus*. It is defined as:
$|c| = |a + b i| = sqrt(a^2 + b^2)$
*Exercise 1.2.1*: Find the modulus of $3 + 4i$.
*Exercise 1.2.2*: Proof that $|a||b|=|a b|$, for all $a, b in CC$.
*Exercise 1.2.3*: Proof that $|a + b| <= |a| + |b|$, for all $a, b in CC$.
We've shown, that a set of complex numbers $CC$ satisfies certain properties:
- Addition and multiplication are commutative.
- Addition and multiplication are associative.
- Addition operation has identity: $0$.
- Multiplication operation has identity: $1$.
- Subtraction is defined everywhere.
- Division is defined everywhere except when the value of divisor is $0$.
- Multiplication distributes with respect to addition.
A set with operations satisfying all these properties is a *field*. $CC$ is a field of complex numbers. $RR$ is a field of real number.
= Answers
*1.1.1*: $14/17-5/17i$; *1.1.2*: $8 + 5i$; $10-13i$; $-160-80i$; $-2/3-11/3i$; *1.2.1*: $5$;
|
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/model/list.typ | typst | // Test bullet lists.
--- list-basic ---
_Shopping list_
#list[Apples][Potatoes][Juice]
--- list-nested ---
- First level.
- Second level.
There are multiple paragraphs.
- Third level.
Still the same bullet point.
- Still level 2.
- At the top.
--- list-content-block ---
- Level 1
- Level #[
2 through content block
]
--- list-top-level-indent ---
- Top-level indent
- is fine.
--- list-indent-specifics ---
- A
- B
- C
- D
--- list-tabs ---
// This works because tabs are used consistently.
- A with 1 tab
- B with 2 tabs
--- list-mixed-tabs-and-spaces ---
// This doesn't work because of mixed tabs and spaces.
- A with 2 spaces
- B with 2 tabs
--- list-syntax-edge-cases ---
// Edge cases.
-
Not in list
-Nope
--- list-marker-align-unaffected ---
// Alignment shouldn't affect marker
#set align(horizon)
- ABCDEF\ GHIJKL\ MNOPQR
--- list-marker-dash ---
// Test en-dash.
#set list(marker: [--])
- A
- B
--- list-marker-cycle ---
// Test that items are cycled.
#set list(marker: ([--], [•]))
- A
- B
- C
--- list-marker-closure ---
// Test function.
#set list(marker: n => if n == 1 [--] else [•])
- A
- B
- C
- D
- E
- F
--- list-marker-bare-hyphen ---
// Test that bare hyphen doesn't lead to cycles and crashes.
#set list(marker: [-])
- Bare hyphen is
- a bad marker
--- list-marker-array-empty ---
// Error: 19-21 array must contain at least one marker
#set list(marker: ())
--- list-attached ---
// Test basic attached list.
Attached to:
- the bottom
- of the paragraph
Next paragraph.
--- list-attached-above-spacing ---
// Test that attached list isn't affected by block spacing.
#show list: set block(above: 100pt)
Hello
- A
World
- B
--- list-non-attached-followed-by-attached ---
// Test non-attached list followed by attached list,
// separated by only word.
Hello
- A
World
- B
--- list-tight-non-attached-tight ---
// Test non-attached tight list.
#set block(spacing: 15pt)
Hello
- A
World
- B
- C
More.
--- list-wide-cannot-attach ---
// Test that wide lists cannot be ...
#set par(spacing: 15pt)
Hello
- A
- B
World
--- list-wide-really-cannot-attach ---
// ... even if forced to.
Hello
#list(tight: false)[A][B]
World
--- list-items-context ---
#context [+ A]
#context [+ B]
#context [+ C]
--- list-item-styling ---
- Hello
#text(red)[- World]
#text(green)[- What up?]
--- issue-2530-list-item-panic ---
// List item (pre-emptive)
#list.item[Hello]
--- issue-1850-list-attach-spacing ---
// List attachment should only work with paragraphs, not other blocks.
#set page(width: auto)
#let part = box.with(stroke: 1pt, inset: 3pt)
#{
part[
$ x $
- A
]
part($ x $ + list[A])
part($ x $ + list[ A ])
part[
$ x $
- A
]
part($ x $ + parbreak() + list[A])
part($ x $ + parbreak() + parbreak() + list[A])
}
|
|
https://github.com/arthurcadore/eng-telecom-workbook | https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/MTG/homework1.typ | typst | MIT License | #import "@preview/klaro-ifsc-sj:0.1.0": report
#import "@preview/codelst:2.0.1": sourcecode
#show heading: set block(below: 1.5em)
#show par: set block(spacing: 1.5em)
#set text(font: "Arial", size: 12pt)
#set page(
footer: "Engenharia de Telecomunicações - IFSC-SJ",
)
#show: doc => report(
title: "Casamento de Impedâncias por Elementos Mistos",
subtitle: "Meios de Transmisão Guiados ",
authors: ("<NAME>",),
date: "12 de Abril de 2024",
doc,
)
= Introdução
Neste relatório o objetivo é apresentar o casamento de impedâncias por elementos mistos, utilizando a carta de Smith. A carta de Smith é uma ferramenta gráfica utilizada para a análise de circuitos de RF, sendo útil para a análise de casamento de impedâncias em a necessidade de transformadas de impedância por expressões matemáticas.
= Desenvolvimento teórico
=== Linha Original:
Para o casamento por elementos mistos, é necessário a adição de uma linha de transmissão de comprimento variavél (de acordo com a impedância imaginária da carga), bem como a adição de um componente reativo (indutor ou capacitor) para o casamento da parte imaginária da impedância.
#align(center)[
#{
import "@preview/quill:0.2.1": *
quantum-circuit(
scale: 120%,
$"Zin"$, 2, $"Z0"$, 1, $"ZL"$, ctrl(1, show-dot:false), [\ ],
$"Zin"$, 5, ctrl(0, show-dot:false)
)
}
]
- *Zin* é a impedância de entrada
- *Z0* é a impedância da linha de transmissão
- *ZL* é a impedância da carga.
=== Linha Casada:
Sendo assim, o circuito final após o casamento por elementos mistos é composto por uma linha de transmissão de comprimento variável e um componente reativo, que juntos, casam a impedância da carga, desta forma, na entrada do circuito, a impedância imaginária é cancelada e a impedância real (normalizada) é igual a 1, ou seja, casada com a linha.
#align(center)[
#{
import "@preview/quill:0.2.1": *
quantum-circuit(
scale: 120%,
$"Zin"$, 2, $"Z0"$, ctrl(1),1, $"LTC"$, 1, $"ZL"$, ctrl(1, show-dot:false), [\ ],
$"Zin"$, 3, $"XLC"$, 4, ctrl(0, show-dot:false),
)
}
]
- *Zin* é a impedância de entrada
- *Z0* é a impedância da linha de transmissão
- *LTC* é a linha de transmissão para o casamento
- *ZL* é a impedância da carga.
- *XLC* é a impedância da linha XL ou XC correspondente ao casamento.
#table(
columns: (1fr, 1fr, 1fr),
align: (left, center, center),
table.header[][Impedância da linha ($ohm$)][Impedância da Carga ($ohm$)],
[Valor Real], [50], [$11 + 25$j],
[Valor Normalizado], [1], [$ 0,22 + 0,5$j],
)
== Representação na carta
#figure(
figure(
image("SmithChart.svg"),
numbering: none,
caption: [Representação (SmithChart) - Casamento por elementos mistos]
),
caption: figure.caption([Carta de Smith (Importada)], position: top)
)
= Conclusão
Desta forma, podemos concluir que os valores necessários para o casamento misto são os seguintes:
=== Linha de Transmissão adicionada:
#table(
columns: (1fr, 1fr, 1fr),
align: (left, center, center),
table.header[][Impedância vista na LTC($ohm$)][Comprimento da LTC ($lambda$)],
[Valor Normalizado], [$1 + 1,9$j], [0,11$lambda$],
[Valor Real], [$50+95$j], [0,11$lambda$],
)
=== Componente de Casamento Reativo:
Com a parte real da impedância casada, podemos calcular o valor do componente reativo a ser adicionado ao circuito para casar a parte imaginária da impedância
#table(
columns: (1fr, 1fr),
align: (left, center),
table.header[][Impedância do componente($ohm$)],
[Valor Normalizado], [1,9j],
[Impedância Real], [95j],
)
#let impedancia = "indutiva"
#let frequencia = 1e9
#let impedanciaV = 0.1
#let c
#let l
#let piNumb = 3.14159265359
Realizando o calculo de da impedância #impedancia, obtemos o seguinte valor do componente a ser adicionado a posição "XLC" do circuito de linha casada. Para realizar o calculo, podemos aplicar a equação apresentada abaixo:
\
#if impedancia == "capacitiva"{
c = 1/(2 * piNumb * frequencia * impedanciaV)
align(center)[
$"XC" = 1/(2 *pi * f * C) arrow #impedanciaV = 1/(2 * pi * frequencia * C) arrow C = 1/(2 * pi * frequencia * impedanciaV)
\
C = #c
$
]
table(
columns: (1fr, 1fr),
align: (left, center),
table.header[Valor do Capacitor ($F$)][#c]
)
}else {
l = impedanciaV / (2 * piNumb * frequencia)
align(center)[
$"XL" = 2 * pi * f * L arrow #impedanciaV = 2 * pi * f * L arrow L = #impedanciaV / (2 * pi * f)
\
L = #l
$
]
}
== Circuito resultante:
O circuito resultante ficará da seguinte forma apresentada abaixo, onde os componentes adicionados fazem o casamento da impedância da carga, desta forma, a impedância de entrada do circuito é casada com a linha de transmissão:
#align(center)[
#{
import "@preview/quill:0.2.1": *
quantum-circuit(
scale: 120%,
$"Zin"$, 2, $"50"ohm$, ctrl(1),1, $"0,11"lambda$, 1, $"11+25j"ohm$, ctrl(1, show-dot:false), [\ ],
$"Zin"$, 3, $"+95j"ohm$, 4, ctrl(0, show-dot:false),
)
}
]
= Referências
- #link("https://www.acs.psu.edu/drussell/Demos/SWR/SmithChart.pdf")[Smith Chart - Original Paper] |
https://github.com/Gekkio/gb-ctr | https://raw.githubusercontent.com/Gekkio/gb-ctr/main/chapter/cpu/intro.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "../../common.typ": *
== Introduction
The CPU core in the Game Boy SoC is a custom Sharp design that hasn't publicly been given a name by either Sharp or Nintendo. However, using old Sharp datasheets and databooks as evidence, the core has been identified to be a Sharp *SM83* CPU core, or at least something that is 100% compatible with it. SM83 is a custom CPU core used in some custom Application Specific Integrated Chips (ASICs) manufactured by Sharp in the 1980s and 1990s.
#warning[
Some sources claim Game Boy uses a "modified" Zilog Z80 or Intel 8080 CPU core. While the SM83 resembles both and has many identical instructions, it can't execute all Z80/8080 programs, and finer details such as timing of instructions often differ.
]
SM83 is an 8-bit CPU core with a 16-bit address bus. The Instruction Set Architecture (ISA) is based on both Z80 and 8080, and is close enough to Z80 that programmers familiar with Z80 assembly can quickly become productive with SM83 as well. Some Z80 programs may also work directly on SM83, assuming only opcodes supported by both are used and the program is not sensitive to timing differences.
#speculation[
Sharp most likely designed SM83 to closely resemble Z80, so it would be easy for programmers already familiar with the widely popular Z80 to write programs for it. However, SM83 is not a "modified Z80" because the internal implementation is completely different. At the time Sharp also manufactured real Z80 chips such as LH0080 under a license from Zilog, so they were familiar with Z80 internals but did not directly copy the actual implementation of the CPU core. If you compare photos of a decapped Z80 chip and a GB SoC, you will see two very different-looking CPU cores.
]
=== History
The first known mention of the SM83 CPU core is in Sharp Microcomputers Data Book (1990), where it is listed as the CPU core used in the SM8320 8-bit microcomputer chip, intended for inverter air conditioners @sharp_microcomputers_1990. The data book describes some details of the CPU core, such as a high-level overview of the supported instructions, but precise details such as full opcode tables are not included. Another CPU core called SM82 is also mentioned, but based on the details it's clearly a completely different one.
The SM83 CPU core later appeared in Sharp Microcomputer Data Book (1996), where it is listed as the CPU core in the SM8311/SM8313/SM8314/SM8315 8-bit microcomputer chips, meant for home appliances @sharp_microcomputers_1996. This data book describes the CPU core in much more detailed manner, and other than some mistakes in the descriptions, the details seem to match what is known about the GB SoC CPU core from other sources.
|
https://github.com/ericthomasca/resume-v1 | https://raw.githubusercontent.com/ericthomasca/resume-v1/main/modules/professional.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Professional Experience")
#cvEntry(
title: [Software Developer],
society: [Genoa Design International],
date: [Oct 2022 - Jan 2024],
location: [Mount Pearl, NL (Remote)],
description: list(
[Led and contributed to full-stack development, showcasing proficiency in software design, development, and deployment.],
[Utilized key technologies: React for dynamic front-end, ASP.NET for backend, and SQL Server for efficient database management.],
[Collaborated with cross-functional Agile teams to ensure effective project delivery and continuous integration.]
)
)
#cvEntry(
title: [Software Developer Intern],
society: [Genoa Design International],
date: [Jul 2022 - Aug 2022],
location: [Mount Pearl, NL (Remote)],
description: list(
[Engaged in a comprehensive software development internship, gaining hands-on experience with modern technologies.],
[Assisted in various development tasks, laying the foundation for a successful transition to a full-time Software Developer role.]
)
)
#cvEntry(
title: [Financial Services Manager],
society: [Bank of Montreal],
date: [May 2016 - June 2018],
location: [Stephenville, NL],
description: list(
[Managed a portfolio of clients, providing expert advice on banking, lending, and investment solutions.],
[Exceeded sales targets consistently for lending, investing, and everyday banking products.],
[Opened and managed customer accounts, ensuring compliance with banking regulations.],
[Advised clients on financial planning, tailoring solutions to meet their individual needs.]
)
)
#cvEntry(
title: [Front Desk Clerk],
society: [Glynmill Inn],
date: [Jun 2015 - Sep 2015],
location: [Corner Brook, NL],
description: list(
[Performed night audit tasks, ensuring accurate balancing and closing of daily accounts.],
[Managed guest check-ins, providing information about hotel services, charges, and facilities.],
[Delivered concierge services, assisting guests with information about the hotel and the surrounding area.],
[Bartended during evening hours, offering food services and ensuring a positive guest experience.]
)
)
#cvEntry(
title: [Youth Technology Intern],
society: [Corner Brook Public Library],
date: [Dec 2014 - Jun 2015],
location: [Corner Brook, NL],
description: list(
[Created presentations and interactive activities aimed at educating individuals of all ages on practical internet and computer technologies, including Windows, Android, iOS, and common web platforms.],
[Facilitated workshops to enhance digital literacy and empower patrons with essential technological skills for everyday use.],
[Provided assistance to library patrons seeking help with technology-related queries, fostering a supportive learning environment.],
[Assisted in the development of the library's digital resources, ensuring accessibility and relevance to the community's needs.]
)
) |
https://github.com/jneug/schule-typst | https://raw.githubusercontent.com/jneug/schule-typst/main/src/theme.typ | typst | MIT License | // Import defualt theme as fallback and overwrite with selected theme
#import "themes/default.typ": *
#let _theme-name = sys.inputs.at("theme", default: "default")
#import "themes/" + _theme-name + ".typ": *
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.2.0/src/lib.typ | typst | Apache License 2.0 | #let version = version((0,2,0))
#import "canvas.typ": canvas
#import "draw.typ"
// Expose utilities
#import "vector.typ"
#import "matrix.typ"
#import "styles.typ"
#import "coordinate.typ"
#import "drawable.typ"
#import "process.typ"
#import "util.typ"
#import "path-util.typ"
#import "mark.typ"
#import "mark-shapes.typ"
// Libraries
#import "lib/axes.typ"
#import "lib/plot.typ"
#import "lib/chart.typ"
#import "lib/palette.typ"
#import "lib/angle.typ"
#import "lib/tree.typ"
#import "lib/decorations.typ"
|
https://github.com/dogeystamp/typst-templates | https://raw.githubusercontent.com/dogeystamp/typst-templates/master/README.md | markdown | The Unlicense | # typst templates
Personal templates for [Typst](https://github.com/typst/typst), a neat markdown-like typsetting system.
I have the following directory structure for these:
```
docs/
├── problems
│ ├── src
│ │ └── test.cpp
│ ├── test.pdf
│ └── test.typ
└── templates
└── ...
```
## Installation
Install dependencies:
- Nimbus Sans: `gsfonts` (name on Arch Linux)
Set up `docs/` as a git repo.
mkdir docs
cd docs
git init
Add `templates/` as a submodule.
git submodule add https://github.com/dogeystamp/typst-templates templates
Set the environment variable `TYPST_ROOT` to `docs/` in `.bashrc`, `.profile` or equivalent.
Otherwise, templates won't be able to render due to security policy.
.profile
--------
export TYPST_ROOT="$HOME/docs"
Create a settings file in `docs/`:
templates/gensettings.sh settings.yml
## Example usage
Example usage (this is test.typ in the above tree:)
```typ
#import "/templates/problems.typ": template, source_code, status
#show: template.with(
title: "CCC '22 J1 - Cupcake Party",
problem_url: "https://dmoj.ca/problem/cc22j1",
stat: "incomplete",
)
= Thought process
#lorem(20)
== Important things
#lorem(50)
#source_code("test")
```
Some settings are available in `main.typ`.
## Screenshots

Note that the font size is optimized for viewing the document fit to width on half a monitor.
|
https://github.com/SillyFreak/typst-packages-old | https://raw.githubusercontent.com/SillyFreak/typst-packages-old/main/scrutinize/docs/manual.typ | typst | MIT License | #import "@preview/tidy:0.3.0"
#import "template.typ": *
#import "../src/lib.typ": grading, question, questions
#let package-meta = toml("../typst.toml").package
// #let date = none
#let date = datetime(year: 2024, month: 3, day: 16)
#show: project.with(
title: "Scrutinize",
// subtitle: "...",
authors: package-meta.authors.map(a => a.split("<").at(0).trim()),
abstract: [
_Scrutinize_ is a library for building exams, tests, etc. with Typst.
It provides utilities for common question types and supports creating grading keys and sample solutions.
],
url: package-meta.repository,
version: package-meta.version,
date: date,
)
// the scope for evaluating expressions and documentation
#let scope = (grading: grading, question: question, questions: questions)
#let transform-raw-lines(original, func) = {
let (text, ..fields) = original.fields()
text = text.split("\n")
text = func(text)
text = text.join("\n")
raw(text, ..fields)
}
#let example(code, lines: none, cheat: none) = {
// eval can't access the filesystem, so no imports.
// for displaying, we add the imports ...
let preamble = raw(
"#import \"@preview/" + package-meta.name + ":" + package-meta.version + "\"" +
": grading, question, questions\n",
lang: "typ",
block: true,
)
// ... and for running, we have the imported entries in `scope`
let code-to-display = transform-raw-lines(code, l => {
// the code to display should contain imports including a blank line
let l = preamble.text.split("\n") + l
// if there is a line selection, apply it (the preamble counts)
if lines != none {
l = l.slice(lines.at(0) - 1, lines.at(1))
}
l
})
let code-to-run = if cheat == none {
code.text
} else {
// for when just executing the code as-is doesn't work in the docs
cheat.text
}
[
#code-to-display
#tidy-output-figure(eval(code-to-run, mode: "markup", scope: scope))
]
}
#let question-example(question, lines: none) = {
let preamble = ```typ
#import questions: with-solution
#let q = [
```
let epilog = ```typ
]
#grid(
columns: (1fr, 1fr),
with-solution(false, q),
with-solution(true, q),
)
```
let cheat = transform-raw-lines(question, l => {
preamble.text.split("\n") + l + epilog.text.split("\n")
})
example(question, lines: lines, cheat: cheat)
}
= Introduction
_Scrutinize_ has three general areas of focus:
- It helps with grading information: record the points that can be reached for each question and make them available for creating grading keys.
- It provides a selection of question writing utilities, such as multiple choice or true/false questions.
- It supports the creation of sample solutions by allowing to switch between the normal and "pre-filled" exam.
Right now, providing a styled template is not part of this package's scope.
= Questions and question metadata
Let's start with a really basic example that doesn't really show any of the benefits of this library yet:
#example(```typ
// you usually want to alias this, as you'll need it often
#import question: q
#q(points: 2)[
== Question
#lorem(20)
]
```)
After importing the library's modules and aliasing an important function, we simply get the same output as if we didn't do anything. The one peculiar thing here is ```typc points: 2```: this adds some metadata to the question. Any metadata can be specified, but `points` is special insofar as it is used by the `grading` module. There are two additional pieces of metadata that are automatically available:
- `body`: the complete content that was rendered as the question
- `location`: the location where the question started and the Typst `metadata` element was inserted
The body is rendered as-is, but the location and custom fields are not used unless you explicitly do; let's look at how to do that. Let's say we want to show the points in each question's header:
#example(lines: (6, 9), ```typ
// you usually want to alias this, as you'll need it often
#import question: q
#show heading: it => {
// here, we need to access the current question's metadata
[#it.body #h(1fr) / #question.current().points]
}
#q(points: 2)[
== Question
#lorem(20)
]
```)
Here we're using the #ref-fn("question.current()") function to access the metadata of the current question. This function requires #link("https://typst.app/docs/reference/context/")[context] to know where in the document it is called, which a show rule already provides.
= Grading
The next puzzle piece is grading. There are many different possibilities to grade a test; Scrutinize tries not to be tied to specific grading strategies, but it does assume that each question gets assigned points and that the grade results from looking at some kinds of sums of these points. If your test does not fit that schema, you can simply use less of the related features.
The first step in creating a typical grading scheme is determining how many points can be achieved in total, using #ref-fn("grading.total-points()"). We also need to use #ref-fn("question.all()") to get access to the metadata distributed throughout the document:
#example(lines: (13, 27), ```typ
// you usually want to alias this, as you'll need it often
#import question: q
// let's show the available points to the right of each
// question's title and give the grader a space to put points
#show heading: it => {
// here, we need to access the current question's metadata
[#it.body #h(1fr) / #question.current().points]
}
#context [
#let qs = question.all()
#let total = grading.total-points(qs)
#let hard = grading.total-points(qs, filter: q => q.points >= 5)
Total points: #total
Points from hard questions: #hard
]
#q(points: 6)[
== Hard Question
#lorem(20)
]
#q(points: 2)[
== Question
#lorem(20)
]
```, cheat: ```typ
// you usually want to alias this, as you'll need it often
#import question: q
// let's show the available points to the right of each
// question's title and give the grader a space to put points
#show heading: it => {
// here, we need to access the current question's metadata
[#it.body #h(1fr) / #question.current().points]
}
#context [
#let qs = question.all().slice(2, 4)
#let total = grading.total-points(qs)
#let hard = grading.total-points(qs, filter: q => q.points >= 5)
Total points: #total
Points from hard questions: #hard
]
#q(points: 6)[
== Hard Question
#lorem(20)
]
#q(points: 2)[
== Question
#lorem(20)
]
```)
#pagebreak(weak: true)
Once we have the total points of the text figured out, we need to define the grading key. Let's say the grades are in a three-grade system of "bad", "okay", and "good". We could define these grades like this:
#example(lines: (13, 22), ```typ
// you usually want to alias this, as you'll need it often
#import question: q
// let's show the available points to the right of each
// question's title and give the grader a space to put points
#show heading: it => {
// here, we need to access the current question's metadata
[#it.body #h(1fr) / #question.current().points]
}
#context [
#let qs = question.all()
#let total = grading.total-points(qs)
#let grades = grading.grades(
[bad], total * 2/4, [okay], total * 3/4, [good]
)
#grades
]
#q(points: 6)[
== Hard Question
#lorem(20)
]
#q(points: 2)[
== Question
#lorem(20)
]
```, cheat: ```typ
// you usually want to alias this, as you'll need it often
#import question: q
// let's show the available points to the right of each
// question's title and give the grader a space to put points
#show heading: it => {
// here, we need to access the current question's metadata
[#it.body #h(1fr) / #question.current().points]
}
#context [
#let qs = question.all().slice(4, 6)
#let total = grading.total-points(qs)
#let grades = grading.grades(
[bad], total * 2/4, [okay], total * 3/4, [good]
)
#grades
]
#q(points: 6)[
== Hard Question
#lorem(20)
]
#q(points: 2)[
== Question
#lorem(20)
]
```)
Obviously we would not want to render this representation as-is, but #ref-fn("grading.grades()") gives us a convenient way to have all the necessary information, without assuming things like inclusive or exclusive point ranges. The `test.typ` example in the gallery has a more complete demonstration of a grading key.
#pagebreak(weak: true)
= Question templates and sample solutions
With the test structure out of the way, the next step is to actually write questions. There are endless ways of formulating questions, but some recurring formats come up regularly.
#pad(x: 5%)[
_Note:_ customizing the styles is currently very limited/not possible. I would be interested in changing this, so if you have ideas on how to achieve this, contact me and/or open a pull request. Until then, feel free to "customize using copy/paste".
]
Each question naturally has an answer, and producing sample solutions can be made very convenient if they are stored with the question right away. To facilitate this, this package provides
- #ref-fn("questions.solution"): this boolean state controls whether solutions are currently shown in the document.
- #ref-fn("questions.with-solution()"): this function sets the solution state temporarily, before switching back to the original state. The `small-example.typ` example in the gallery uses this to show an answered example question at the beginning of the document.
Additionally, the solution state can be set using the Typst CLI using `--input solution=true` (or `false`, which is already the default), or by regular state updates. Within context expressions, a question can use `questions.solution.get()` to find out whether solutions are shown. This is also used by Scrutinize's question templates.
Let's look at a free text question as a simple example:
== Free text questions
In free text questions, the student simply has some free space in which to put their answer:
#question-example(```typ
#import questions: free-text-answer
// toggle the following comment or pass `--input solution=true`
// to produce a sample solution
// #questions.solution.update(true)
Write an answer.
#free-text-answer[An answer]
Next question
```)
Left is the unanswered version, right the answered one. Note that the answer occupies the same space regardless of whether it is displayed or not, and that the height can also be overridden - see #ref-fn("questions.free-text-answer()"). The content of the answer is of course not limited to text.
== single and multiple choice questions
These question types allow making a mark next to one or multiple choices. See #ref-fn("questions.single-choice()") and #ref-fn("questions.multiple-choice()") for details.
#question-example(```typ
#import questions: single-choice, multiple-choice
Which of these is the fourth answer?
#single-choice(
range(1, 6).map(i => [Answer #i]),
// 0-based indexing
3,
)
Which of these answers are even?
#multiple-choice(
range(1, 6).map(i => ([Answer #i], calc.even(i))),
)
```)
#pagebreak(weak: true)
= Module reference
// == `scrutinize`
// #{
// let module = tidy.parse-module(
// read("src/lib.typ"),
// scope: scope,
// )
// tidy.show-module(
// module,
// sort-functions: none,
// style: tidy.styles.minimal,
// )
// }
== `scrutinize.question`
#{
let module = tidy.parse-module(
read("../src/question.typ"),
label-prefix: "question.",
scope: scope,
)
tidy.show-module(
module,
sort-functions: none,
style: tidy.styles.minimal,
)
}
== `scrutinize.grading`
#{
let module = tidy.parse-module(
read("../src/grading.typ"),
label-prefix: "grading.",
scope: scope,
)
tidy.show-module(
module,
sort-functions: none,
style: tidy.styles.minimal,
)
}
== `scrutinize.questions`
#{
let module = tidy.parse-module(
read("../src/questions.typ"),
label-prefix: "questions.",
scope: scope,
)
tidy.show-module(
module,
sort-functions: none,
style: tidy.styles.minimal,
)
}
|
https://github.com/dadn-dream-home/documents | https://raw.githubusercontent.com/dadn-dream-home/documents/main/contents/06-luoc-do-deployment/index.typ | typst | = Lược đồ deployment
Nhóm đề xuất lược đồ deployment ở @fig:deployment.
#figure(
image("deployment.drawio.svg", width: 100%),
caption: "Lược đồ deployment",
) <fig:deployment>
Lược đồ này gồm các thành phần chính:
/ Sensor: là các cảm biến, được lập trình bởi Yolo:Bit để gửi các giá trị cảm
biến đo được về cho máy chủ.
/ Actuator: là các thiết bị, tương tự như cảm biến.
/ Backend Server: là máy chủ, chịu trách nhiệm nhận dữ liệu và cung cấp API cho
ứng dụng di động. Dữ liệu được nhận từ các cảm biến, thiết bị thông qua API
MQTT, cung cấp bởi phần mềm `mosquitto`#footnote[https://mosquitto.org].
Các API được cung cấp bởi thư viện `gRPC`#footnote[https://grpc.io]. Các API này được sử dụng bởi ứng
dụng di động để hiển thị dữ liệu. \
/ Mobile Phone: là thiết bị của người dùng. Ứng dụng di động sử dụng các API để
hiển thị dữ liệu cũng như điều khiển thiết bị.
Nhóm dự kiến nếu đưa vào hoạt động, Backend Server sẽ được chạy trên một máy
tính Raspberry Pi, song không có thời gian để thử nghiệm. Ngoài ra, trong đồ
án này, để đảm bảo tính ổn định, các cảm biến và thiết bị sẽ gửi dữ liệu
thông qua một gateway khác trước khi đến được máy chủ.
|
|
https://github.com/ClazyChen/Table-Tennis-Rankings | https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2013/WS-06.typ | typst |
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (1 - 32)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[1], [LI Xiaoxia], [CHN], [3416],
[2], [LIU Shiwen], [CHN], [3328],
[3], [DING Ning], [CHN], [3280],
[4], [GUO Yan], [CHN], [3238],
[5], [GUO Yue], [CHN], [3146],
[6], [WU Yang], [CHN], [3118],
[7], [ZHU Yuling], [MAC], [3034],
[8], [FENG Yalan], [CHN], [2947],
[9], [#text(gray, "FAN Ying")], [CHN], [2942],
[10], [CHEN Meng], [CHN], [2924],
[11], [SUH Hyo Won], [KOR], [2887],
[12], [JIANG Huajun], [HKG], [2882],
[13], [FENG Tianwei], [SGP], [2873],
[14], [WEN Jia], [CHN], [2850],
[15], [ISHIKAWA Kasumi], [JPN], [2846],
[16], [RI Myong Sun], [PRK], [2835],
[17], [SHEN Yanfei], [ESP], [2827],
[18], [#text(gray, "DANG Yeseo")], [KOR], [2819],
[19], [KIM Kyungah], [KOR], [2812],
[20], [#text(gray, "WANG Yuegu")], [SGP], [2788],
[21], [YANG Ha Eun], [KOR], [2786],
[22], [PAVLOVICH Viktoria], [BLR], [2776],
[23], [#text(gray, "LI Jiawei")], [SGP], [2768],
[24], [HU Melek], [TUR], [2760],
[25], [SEOK Hajung], [KOR], [2748],
[26], [#text(gray, "CHANG Chenchen")], [CHN], [2746],
[27], [LI Xiaodan], [CHN], [2736],
[28], [LI Jiao], [NED], [2734],
[29], [LIU Jia], [AUT], [2734],
[30], [LANG Kristin], [GER], [2728],
[31], [<NAME>], [ROU], [2706],
[32], [LI Jie], [NED], [2705],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (33 - 64)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[33], [LI Qian], [POL], [2704],
[34], [MOON Hyunjung], [KOR], [2700],
[35], [NI Xia Lian], [LUX], [2689],
[36], [FUKUHARA Ai], [JPN], [2686],
[37], [WU Jiaduo], [GER], [2679],
[38], [ZHAO Yan], [CHN], [2678],
[39], [KIM Hye Song], [PRK], [2678],
[40], [#text(gray, "FUJII Hiroko")], [JPN], [2677],
[41], [<NAME>], [JPN], [2674],
[42], [<NAME>], [FRA], [2670],
[43], [<NAME>], [UKR], [2669],
[44], [<NAME>], [CHN], [2666],
[45], [TIKHOMIROVA Anna], [RUS], [2665],
[46], [<NAME>], [UKR], [2662],
[47], [<NAME>], [KOR], [2653],
[48], [<NAME>], [FRA], [2650],
[49], [<NAME>], [ROU], [2650],
[50], [#text(gray, "<NAME>")], [KOR], [2644],
[51], [TIE Yana], [HKG], [2639],
[52], [<NAME>], [HKG], [2638],
[53], [<NAME>], [SWE], [2638],
[54], [CHENG I-Ching], [TPE], [2633],
[55], [<NAME>], [JPN], [2633],
[56], [<NAME>], [KOR], [2630],
[57], [VACENOVSKA Iveta], [CZE], [2626],
[58], [YOON Sunae], [KOR], [2602],
[59], [WAKAMIYA Misako], [JPN], [2586],
[60], [CHOI Moonyoung], [KOR], [2580],
[61], [PASKAUSKIENE Ruta], [LTU], [2580],
[62], [<NAME>], [GER], [2578],
[63], [<NAME>], [GER], [2575],
[64], [SHAN Xiaona], [GER], [2574],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (65 - 96)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[65], [<NAME>], [HUN], [2574],
[66], [#text(gray, "SUN Beibei")], [SGP], [2572],
[67], [LEE Eunhee], [KOR], [2569],
[68], [POTA Georgina], [HUN], [2567],
[69], [LOVAS Petra], [HUN], [2565],
[70], [KOMWONG Nanthana], [THA], [2560],
[71], [PARTYKA Natalia], [POL], [2554],
[72], [HUANG Yi-Hua], [TPE], [2552],
[73], [KUMAHARA Luca], [BRA], [2536],
[74], [<NAME>melie], [AUT], [2534],
[75], [SONG Maeum], [KOR], [2531],
[76], [KIM Jong], [PRK], [2529],
[77], [MATSUDAIRA Shiho], [JPN], [2526],
[78], [CHEN Szu-Yu], [TPE], [2523],
[79], [#text(gray, "WU Xue")], [DOM], [2522],
[80], [LIN Ye], [SGP], [2521],
[81], [STRBIKOVA Renata], [CZE], [2517],
[82], [PARK Youngsook], [KOR], [2516],
[83], [YU Mengyu], [SGP], [2516],
[84], [ZHENG Jiaqi], [USA], [2509],
[85], [WINTER Sabine], [GER], [2504],
[86], [NONAKA Yuki], [JPN], [2504],
[87], [TAN Wenling], [ITA], [2503],
[88], [NG Wing Nam], [HKG], [2500],
[89], [RI Mi Gyong], [PRK], [2499],
[90], [FUKUOKA Haruna], [JPN], [2498],
[91], [#text(gray, "MOLNAR Cornelia")], [CRO], [2496],
[92], [LEE I-Chen], [TPE], [2492],
[93], [ZHANG Mo], [CAN], [2489],
[94], [#text(gray, "TOTH Krisztina")], [HUN], [2489],
[95], [CECHOVA Dana], [CZE], [2479],
[96], [HAPONOVA Hanna], [UKR], [2477],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (97 - 128)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[97], [#text(gray, "MISIKONYTE Lina")], [LTU], [2472],
[98], [STEFANSKA Kinga], [POL], [2470],
[99], [MAEDA Miyu], [JPN], [2469],
[100], [LI Chunli], [NZL], [2467],
[101], [MIKHAILOVA Polina], [RUS], [2464],
[102], [GU Yuting], [CHN], [2457],
[103], [RAMIREZ Sara], [ESP], [2455],
[104], [WANG Chen], [CHN], [2453],
[105], [BALAZOVA Barbora], [SVK], [2453],
[106], [KANG Misoon], [KOR], [2452],
[107], [LAY <NAME>], [AUS], [2452],
[108], [#text(gray, "RAO Jingwen")], [CHN], [2450],
[109], [ISHIGAKI Yuka], [JPN], [2448],
[110], [<NAME>], [JPN], [2443],
[111], [<NAME>], [TPE], [2443],
[112], [PAVLOVICH Veronika], [BLR], [2439],
[113], [#text(gray, "TANIOKA Ayuka")], [JPN], [2438],
[114], [FADEEVA Oxana], [RUS], [2438],
[115], [YAMANASHI Yuri], [JPN], [2436],
[116], [SOLJA Petrissa], [GER], [2433],
[117], [DOO Hoi Kem], [HKG], [2430],
[118], [<NAME>], [HUN], [2430],
[119], [CHOI Jeongmin], [KOR], [2430],
[120], [STEFANOVA Nikoleta], [ITA], [2429],
[121], [MATSUZAWA Marina], [JPN], [2424],
[122], [NOSKOVA Yana], [RUS], [2421],
[123], [#text(gray, "KIM Junghyun")], [KOR], [2420],
[124], [ODOROVA Eva], [SVK], [2417],
[125], [<NAME>], [SRB], [2415],
[126], [<NAME>iangbing], [AUT], [2396],
[127], [NGUYEN Thi Viet Linh], [VIE], [2395],
[128], [<NAME>], [MEX], [2393],
)
) |
|
https://github.com/satler-git/rrr | https://raw.githubusercontent.com/satler-git/rrr/main/example/pdfs/ja-rorem.typ | typst | MIT License | #set par(justify: true)
#set page(columns: 2)
#set text(font: "IBM Plex Sans JP")
#import "@preview/roremu:0.1.0": roremu
#roremu(1800)
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/counter_01.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Count labels.
#let label = <heya>
#let count = counter(label).display()
#let elem(it) = [#box(it) #label]
#elem[hey, there!] #count \
#elem[more here!] #count
|
https://github.com/gabrielrovesti/WIM-Project | https://raw.githubusercontent.com/gabrielrovesti/WIM-Project/main/WIM%20Project/unipd-doc.typ | typst | MIT License | // Comment-style lecture number annotation (# Lecture n)
#let lecture(number) = {
set text(gray)
[\# Lecture #number]
}
#let notes() = doc => {
set text(font: "New Computer Modern")
doc
}
#let unipd-doc(title: none, subtitle: none, author: none, date: none) = doc => {
let unipd-red = rgb(180, 27, 33)
set page(header: [
_WIM Usability Analysis_
#h(1fr)
//National Academy of Sciences
], footer: [
_<NAME>_
#h(1fr)
#counter(page).display(
"1/1",
both: true,
)
])
set list(marker: ([•], [◦], [--]))
set heading(numbering: "1.1.")
show heading.where(level: 1): it => {
set text(fill: unipd-red)
it
}
align(center, {
v(10em)
figure(image("images/unipd-logo.png", width: 40%))
v(3em)
text(size: 22pt, weight: "bold", fill: unipd-red, smallcaps(title))
v(5pt)
text(size: 18pt, weight: "bold", fill: unipd-red, subtitle)
parbreak()
set text(size: 15pt)
author
parbreak()
date
pagebreak()
})
show outline.entry.where(level: 1): it => {
v(1em, weak: true)
strong(it)
}
outline(
title: "Index",
indent: 2em,
)
pagebreak()
doc
}
|
https://github.com/Toniolo-Marco/git-for-dummies | https://raw.githubusercontent.com/Toniolo-Marco/git-for-dummies/main/slides/theory/pull-request.typ | typst | #import "@preview/touying:0.5.2": *
#import themes.university: *
#import "@preview/numbly:0.1.0": numbly
#import "@preview/fletcher:0.5.1" as fletcher: node, edge
#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)
#import "../components/gh-button.typ": gh_button
#import "../components/git-graph.typ": branch_indicator, commit_node, connect_nodes, branch
By now it should be clear the importance of the _main_ branch; if multiple developers are working on a project, someone needs to be in charge of checking the *quality of the code in production* and *resolving merge conflicts* in the main.
#grid(columns: (1fr,3fr),rows: 2,column-gutter: 7%,row-gutter: 5%,
grid.cell(
rowspan: 2,
[
This is accomplished through _pull requests_ (PR), which are requests to *merge one branch into another* (usually in the main). _Pull requests_ allow for discussion of changes made, code review, and resolution of merge conflicts before merging the branches.
]),
image("../img/pr-example.png"),
[A PR consist of: title, description, id#footnote([It increases along with the issue number]), associated commits, status, labels...]
)
---
Unfortunately, to date, GitHub's free plan does not allow you to protect the _main_ branch from direct push:
#align(center)[#image("../img/gh-rules.png", width: 90%)]
One way around this problem, within organizations, is:
- create a team
- assign _triage_ permissions to this team
- add team members
This way, only the owners of the organization will be able to approve pull requests. |
|
https://github.com/XavierZXY/typst-docs | https://raw.githubusercontent.com/XavierZXY/typst-docs/main/cv/zh.typ | typst | MIT License | // #show heading: set text(font: "Noto Serifs CJK SC", size: 13pt)
#set text(font: "Noto Serif CJK SC", size: 11pt)
#show link: underline
// Feel free to change the margin below to best fit your own CV
#set page(
margin: (x: 0.9cm, y: 1.3cm),
)
// For more customizable options, please refer to official reference: https://typst.app/docs/reference/
#set par(justify: true)
#let chiline() = {v(-3pt); line(length: 100%); v(1pt)}
// #place(right, [#image("me.jpg", height: auto, width: 13%)])
= 邹翔宇
中共党员 | 男 | 2000.11 \
长沙理工大学-计算机科学与技术学士学位 | 2023.06 \
\u{1f4e7} #link("mailto://<EMAIL>")[<EMAIL>]
\u{1f4e1}#link("https://www.github.com/xavierzxy")[github.com/XavierZXY]
\u{1f30d} #link("https://spacezxy.top/about")[www.spacezxy.top]
== 专业技能
#chiline()
- 了解Python、C++、Java、Rust编程
- 熟悉常用数据结构和算法
- 熟悉计算机网络,操作系统等相关知识
- 了解Linux环境下常用工具和命令的使用
- 了解支持向量机,决策树等基础机器学习算法
- 了解卷积神经网络,注意力机制,Transformer等
- 了解构建机器学习系统的基础知识,了解TVM
- 了解LoRA模型优化技术
- 了解CUDA基础编程
== 实习经历
#chiline()
=== 北京澎峰科技公司 #h(1fr) 2024.06 -- 2024.08
- Flash attention相关工作
- cuda, hip
=== 中科院深圳理工大学训练营活动 #h(1fr) 2024.01 -- 2024.09
- 学习Mamba等相关模型技术
- CUDA并行编程,以及传统编译器基础知识
== 项目经历
#chiline()
=== 面向RISC-V架构的AI开发框架构建与优化 #h(1fr) 2024.02 -- 2024.05
- 在RISC-V开发板上使用ncnn工具部署水域安全检测系统
- 使用openmp, rvv, yolov5-lite等方法,优化加速模型的推理速度和推理流程
=== DeepLearning Sys #h(1fr) 2023.01 -- 2023.04
- 学习CMU DL Systems课程、学习简单GPU,CUDA编程
- 构建简单的深度学习系统
- 实现自动微分
- 实现计算图
- 实现GPU矩阵运算加速
=== 第十三届大学生服务外包大赛 #h(1fr) 2022.02 -- 2022.06
- 使用深度学习模型学习多人声音频中的人声特征
- 使用C++将项目工程化部署
== 荣誉奖项
#chiline()
开放原子开源大赛-面向RISC-V架构的AI开发框架构建与优化二等奖 #h(1fr) 2024.04 \
长沙理工大学优秀毕业设计论文 #h(1fr) 2023.06 \
第十三届中国大学生服务外包大赛中南赛区三等奖 #h(1fr) 2022.06 \
长沙理工大学奖学金 #h(1fr) 多次获得 \
== 其他
#chiline()
- 语言: 英语(CET-6) |
https://github.com/typst-community/mantodea | https://raw.githubusercontent.com/typst-community/mantodea/main/tests/component/table-of-contents/test.typ | typst | MIT License | #import "/src/component/table-of-contents.typ": make-table-of-contents
#make-table-of-contents()
#pagebreak()
#set heading(numbering: "1.")
= Chapter
== Section
=== Subsection
#counter(page).update(9999)
#counter(heading).update(8)
= Chapter
#counter(heading).update((8, 22))
== Section
=== Subsection
|
https://github.com/fabriceHategekimana/master | https://raw.githubusercontent.com/fabriceHategekimana/master/main/6_Conclusion/Défauts.typ | typst | Bien sûr, notre solution s'est confrontée à des obstacles. Un typage statique est moins souple qu'un typage dynamique ce qui entraîne une perte de souplesse concernant le prototypage. Une autre limitation vient du déterminisme de notre système de type. Si nous voulons avoir l'option de l'inférence de type, il faut que le typage de nos types dépendant se limitent au nombres entiers positif et à l'arithmétique de Presburger, ce qui rends le typage de certaines fonctions (comme la fonction de linéirisation) inexprimable.
Un élément qui a été vu comme une victoire mais peut-être vu comme un echec et le fait que notre langage et son système de type ne peuvent pas exprimer de façon sécurisée le broadcasting. C'est en effet dû que celui-ci s'appuie en partie sur la transformation de type implicite (ce qui n'est pas permi pour un langage qui souhaite un minimum de sécurité pour la construction de modèles utilisable par le grand publique), mais cela reste quand même une perte d'une fonctionnalité puissante qui fait partie de la boite à outil du Scientifique des données.
|
|
https://github.com/GolemT/BA-Template | https://raw.githubusercontent.com/GolemT/BA-Template/main/lib/acronym-lib.typ | typst | #import "shared-lib.typ" : display, display-link, is-in-dict
#import "../acronyms.typ": Acronyms
#let prefix = "acronym-state-"
#let acros = state("acronyms", none)
#let init-acronyms(acronyms) = {
acros.update(acronyms)
}
#let acrs(acr, plural: false, link: true) = {
if plural {
display("acronyms", acros, acr, acr + "s", link: link)
} else {
display("acronyms", acros, acr, acr, link: link)
}
}
#let acrspl(acr, link: true) = {
acrs(acr, plural: true, link: link)
}
#let acrl(acr, plural: false, link: true) = {
acros.display(Acronyms => {
if is-in-dict("acronyms", acros, acr) {
let defs = Acronyms.at(acr)
if type(defs) == "string" {
if plural {
display("acronyms", acros, acr, defs + "s", link: link)
} else {
display("acronyms", acros, acr, defs, link: link)
}
} else if type(defs) == "array" {
if defs.len() == 0 {
panic("No definitions found for acronym " + acr + ". Make sure it is defined in the dictionary passed to #init-acronyms(dict)")
}
if plural {
if defs.len() == 1 {
display("acronyms", acros, acr, defs.at(0) + "s", link: link)
} else if defs.len() == 2 {
display("acronyms", acros, acr, defs.at(1), link: link)
} else {
panic("Definitions should be arrays of one or two strings. Definition of " + acr + " is: " + type(defs))
}
} else {
display("acronyms", acros, acr, defs.at(0), link: link)
}
} else {
panic("Definitions should be arrays of one or two strings. Definition of " + acr + " is: " + type(defs))
}
}
})
}
#let acrlpl(acr, link: true) = {
acrl(acr, plural: true, link: link)
}
#let acrf(acr, plural: false, link: true) = {
if plural {
display("acronyms", acros, acr, [#acrlpl(acr) (#acr\s)], link: link)
} else {
display("acronyms", acros, acr, [#acrl(acr) (#acr)], link: link)
}
state(prefix + acr, false).update(true)
}
#let acrfpl(acr, link: true) = {
acrf(acr, plural: true, link: link)
}
#let acr(acr, plural: false, link: true) = {
state(prefix + acr, false).display(seen => {
if seen {
if plural {
acrspl(acr, link: link)
} else {
acrs(acr, link: link)
}
} else {
if plural {
acrfpl(acr, link: link)
} else {
acrf(acr, link: link)
}
}
})
}
#let acrpl(acronym, link: true) = {
acr(acronym, plural: true, link: link)
}
#let print-acronyms(title: "acronyms", acronym-spacing) = {
heading(level: 1, outlined: false, numbering: none)[#title]
acros.display(Acronyms => {
let acronym-keys = Acronyms.keys()
let max-width = 0pt
for acr in acronym-keys {
let result = measure(acr).width
if (result > max-width) {
max-width = result
}
}
let acr-list = acronym-keys.sorted()
for acr in acr-list {
grid(
columns: (max-width + 0.5em, auto),
gutter: acronym-spacing,
[*#acr#label("acronyms-" + acr)*], [#acrl(acr, link: false)],
)
}
})
} |
|
https://github.com/iceghost/resume | https://raw.githubusercontent.com/iceghost/resume/main/5-projects/2-document-repo.typ | typst | === Document Repository
#place(right + top)[Sep 2021 - Dec 2021]
/ Links: #link("https://chungtacungtien.com")[Demo].
/ Role: Fullstack Developer.
This website is designed to share learning materials from <NAME>
with HCMUT students and focuses on custom components such as emphasis on
important information and interactive quizzes. Students can easily access
learning materials to get better academic results.
_Result_: \~500 visits every day during Oct 2021 to Dec 2021.
I learned about the bus factor and the value of internal documentation in
Software Engineering for ensuring maintainability through this project.
|
|
https://github.com/sitandr/typst-examples-book | https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/gradients.md | markdown | MIT License | # Color & Gradients
## Gradients
Gradients may be very cool for presentations or just a pretty look.
```typ
/// author: frozolotl
#set page(paper: "presentation-16-9", margin: 0pt)
#set text(fill: white, font: "Inter")
#let grad = gradient.linear(rgb("#953afa"), rgb("#c61a22"), angle: 135deg)
#place(horizon + left, image(width: 60%, "../img/landscape.png"))
#place(top, polygon(
(0%, 0%),
(70%, 0%),
(70%, 25%),
(0%, 29%),
fill: white,
))
#place(bottom, polygon(
(0%, 100%),
(100%, 100%),
(100%, 30%),
(60%, 30% + 60% * 4%),
(60%, 60%),
(0%, 64%),
fill: grad,
))
#place(top + right, block(inset: 7pt, image(height: 19%, "../img/tub.png")))
#place(bottom, block(inset: 40pt)[
#text(size: 30pt)[
Presentation Title
]
#text(size: 16pt)[#lorem(20) | #datetime.today().display()]
])
``` |
https://github.com/a-mhamdi/graduation-report | https://raw.githubusercontent.com/a-mhamdi/graduation-report/main/README.md | markdown | MIT License | # Templates of Capstone Project Report
* * *
Three kinds of templates are in this repository:
- [LaTeX](https://github.com/a-mhamdi/graduation-report/tree/main/LaTeX)
- [LyX](https://github.com/a-mhamdi/graduation-report/tree/main/LyX)
- [Typst](https://github.com/a-mhamdi/graduation-report/tree/main/Typst)
- [MS-WORD](https://github.com/a-mhamdi/graduation-report/tree/main/MS-WORD)
If you need to download only a particular folder, not the entire repository, please consider using the following URL: [https://download-directory.github.io/](https://download-directory.github.io/)
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&skip_quickstart=true&machine=standardLinux32gb&repo=364736245&devcontainer_path=.devcontainer%2Fdevcontainer.json&geo=EuropeWest)
<!-- Make sure to checkout to the desired branch when downloading your preferred template. -->
|
https://github.com/Chwiggy/thesis_bachelor | https://raw.githubusercontent.com/Chwiggy/thesis_bachelor/main/src/chapters/08_conclusion.typ | typst | #import "../preamble.typ": *
= Conclusion
As seen above, there is still a lot of work to be done. And while the general travel time indiactor seems to work as a useful tool to gain informaiton about general connectivity in specific locations, the planning indicator unfortunately still seems to need a lot of work to become a useful and non-redundant measure of transit accessibility.
As such the travel time difference indicator manages to convey information about general service patterns like the average headway of transit services, but lacks information that could have been gained by much simpler metrics too, that involve less intensive calculations. This is less true for the general mean travel time indicator that displays patterns, that are much more easy to distinguish and interpret.
These kind of calculations then can play a vital role in informing the public but also in informing decisions of policy makers and transit agencies in their decision making processes. However, to give a full picture, a much more intensive study of travel behaviour, model itineraries and effects of specific tranist arrangements is necessary. As such this project feels, like an exercise in futility: trying to boil down hugely complex systems into easy indicators. In the end it probably needs a whole set of indicators to understand the workings of a transit system and all it's varied effects on the people who are supposed to use it.
<end_of_chapter>
#locate(loc => bib_state.at(query(<end_of_chapter>, loc).first().location())) |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-1B130.typ | typst | Apache License 2.0 | #let data = (
"2": ("HIRAGANA LETTER SMALL KO", "Lo", 0),
"20": ("HIRAGANA LETTER SMALL WI", "Lo", 0),
"21": ("HIRAGANA LETTER SMALL WE", "Lo", 0),
"22": ("HIRAGANA LETTER SMALL WO", "Lo", 0),
"25": ("KATAKANA LETTER SMALL KO", "Lo", 0),
"34": ("KATAKANA LETTER SMALL WI", "Lo", 0),
"35": ("KATAKANA LETTER SMALL WE", "Lo", 0),
"36": ("KATAKANA LETTER SMALL WO", "Lo", 0),
"37": ("KATAKANA LETTER SMALL N", "Lo", 0),
)
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/features_07.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test raw features.
#text(features: ("smcp",))[Smcp] \
fi vs. #text(features: (liga: 0))[No fi]
|
https://github.com/jneug/typst-codelst | https://raw.githubusercontent.com/jneug/typst-codelst/main/docs/example.typ | typst | MIT License | #import "../src/codelst.typ": sourcecode, sourcefile, lineref, code-frame
#let codelst = text(fill: rgb(254, 48, 147), smallcaps("codelst"))
#let cmd(name) = text(fill: rgb(99, 170, 234), raw(block: false, sym.hash + name.text + sym.paren.l + sym.paren.r))
#let code-block = block.with(
stroke: 1pt,
inset: 0.65em,
radius: 4pt,
)
#let code-example = ```typ
/*
* Example taken from
* https://typst.app/docs/tutorial/formatting/
*/
#show "ArtosFlow": name => box[
#box(image(
"logo.svg",
height: 0.7em,
))
#name
]
// Long line that breaks
This report is embedded in the ArtosFlow project. ArtosFlow is a project of the Artos Institute.
/*
Very long line without linebreak
with a preceding block comment
*/
This_report_is_embedded_in_the_ArtosFlow_project._ArtosFlow_is_a_project_of_the_Artos_Institute.
// End example
```
Normal #cmd[raw] works as expected:
#code-block(code-example)
Using #cmd[sourcecode] will add line numbers and a frame.
#code-block(sourcecode(code-example))
#pagebreak()
#code-block(
sourcecode(
showrange: (15, 21),
showlines: true,
code-example,
),
)
Sourcecode can be loaded from a file and passed to #cmd[sourcefile]. Any #codelst sourcecode can be wrapped inside #cmd[figure] as expected.
#codelst line numbers can be formatted via a bunch of `numbers-` options:
#code-block[
#let filename = "typst.toml"
#let number-format(n) = text(fill: blue, emph(n))
#show figure.where(kind: raw): fig => grid(
columns: (1fr, 2fr),
gutter: .65em,
[
#set align(left)
#set par(justify: true)
To the right in @lst-sourcefile you can see the #raw(filename) file of this package with some #number-format[fancy line numbers].
],
fig,
)
#figure(
caption: filename,
sourcefile(
numbers-side: right,
numbers-style: number-format,
file: filename,
read("../" + filename),
),
)<lst-sourcefile>
]
Since packages can't #cmd[read] files from outside their own directory, you can alias #cmd[sourcefile] for a more convenient command:
```typc
let srcfile( filename, ..args ) = sourcefile(read(filename), file:filename, ..args)
```
#let srcfile(filename, ..args) = sourcefile(read(filename), file: filename, ..args)
Formatting is controlled through options. To use a default style, create an alias for your command:
```typc
let code = sourcecode.with(
numbers-style: (lno) => text(black, lno),
frame: none
)
```
#cmd[sourcecode] accepts a number of arguments to affect the output like _highlighting lines_, _restrict the line range_ or _place labels_ in specific lines to reference them later.
#code-block[
#sourcecode(
numbers-start: 9,
highlighted: (14,),
highlight-labels: true,
highlight-color: rgb(250, 190, 144),
gutter: 2em,
label-regex: regex("<([a-z-]+)>"),
frame: code => block(width: 100%, fill: rgb(254, 249, 222), inset: 5pt, code),
)[```typ
#"hello world!" \
#"\"hello\n world\"!" \
#"1 2 3".split() \ <split-example>
#"1,2;3".split(regex("[,;]")) \
#(regex("\d+") in "ten euros") \
#(regex("\d+") in "10 euros")
```]
]
To reference a line use #cmd[lineref]:
- See #lineref(<split-example>) for an example of the `split()` function.
Long code breaks to new pages. To have listings in figures break, you need to allow it via a #cmd[show] rule:
```typ
#show figure.where(kind: raw): set block(breakable: true)
```
#[
#show figure.where(kind: raw): set block(breakable: true)
#show figure.where(kind: raw): fig => [
#v(1em)
#set align(center)
#strong([#fig.supplement #fig.counter.display()]): #emph(fig.caption.body)
#fig.body
]
#figure(
srcfile("example.typ", highlighted: range(121, 136), numbers-step: 5, numbers-first: 5),
caption: "Code of this example file.",
)
]
#pagebreak()
== More examples
And last but not least, some weird examples of stuff you can do with this package (example code taken from #link("https://github.com/rust-lang/rust-by-example/blob/master/src/fn.md", raw("rust-lang/rust-by-example"))):
#sourcecode(frame: none, numbering: none)[
```rust
// Unlike C/C++, there's no restriction on the order of function definitions
fn main() {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
```
]
#sourcecode(
numbering: "I",
numbers-style: lno => align(right, [#text(eastern, emph(lno)) |]),
gutter: 1em,
tab-size: 8,
gobble: 1,
showlines: true,
)[
```rust
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
// Corner case, early return
if rhs == 0 {
return false;
}
// This is an expression, the `return` keyword is not necessary here
lhs % rhs == 0
}
```
]
#block(width: 100%)[
#sourcecode(
numbers-width: -6mm,
frame: block.with(width: 75%, fill: rgb("#b7d4cf"), inset: 5mm),
)[```rust
// Functions that "don't" return a value, actually return the unit type `()`
fn fizzbuzz(n: u32) -> () {
if is_divisible_by(n, 15) {
println!("fizzbuzz");
} else if is_divisible_by(n, 3) {
println!("fizz");
} else if is_divisible_by(n, 5) {
println!("buzz");
} else {
println!("{}", n);
}
}
```]
#place(
top + right,
block(width: 23%)[
#set par(justify: true)
#lorem(40)
],
)
]
#sourcecode(
numbering: "(1)",
numbers-side: right,
numbers-style: lno => text(1.5em, rgb(143, 254, 9), [#sym.arrow.l #lno]),
frame: code => {
set text(luma(245))
code-frame(
fill: luma(24),
stroke: 4pt + rgb(143, 254, 9),
radius: 0pt,
inset: .65em,
code,
)
},
)[```rust
// When a function returns `()`, the return type can be omitted from the
// signature
fn fizzbuzz_to(n: u32) {
for n in 1..=n {
fizzbuzz(n);
}
}
```]
|
https://github.com/Shuenhoy/modern-zju-thesis | https://raw.githubusercontent.com/Shuenhoy/modern-zju-thesis/master/documentclass/undergraduate-cs.typ | typst | MIT License | #import "../pages/undergraduate-cover.typ": undergraduate-cover
#import "../pages/undergraduate-decl.typ": undergraduate-decl
#import "../pages/template-individual.typ": template-individual
#import "../pages/outline.typ": main-outline
#import "../pages/undergraduate-task.typ": undergraduate-task
#import "../pages/undergraduate-eval.typ": undergraduate-eval
#import "../pages/undergraduate-proposal-cover.typ": undergraduate-proposal-cover
#import "../pages/undergraduate-proposal-task.typ": undergraduate-proposal-task
#import "../pages/undergraduate-proposal-eval.typ": undergraduate-proposal-eval
#import "../utils/fonts.typ": *
#import "../utils/part.typ": show-part, show-outline-with-part, part-and-headings, part, part-bib
#import "../utils/header.typ": header, footer
#import "../utils/fakebold.typ": show-cn-fakebold
#import "../utils/indent-first-par.typ": indent-first-par
#import "../utils/supplement.typ": show-set-supplement
#import "../utils/twoside.typ": show-twoside-pagebreak, twoside-numbering-footer, twoside-pagebreak
#import "../utils/structure.typ": frontmatter, mainmatter
#import "../utils/appendix.typ": appendix
#import "../dependency/i-figured.typ"
#let undergraduate-cs-set-style(doc, twoside: true) = {
// Page geometry
set page(
paper: "a4",
margin: (
x: 3.18cm,
bottom: 2.54cm + 12pt + 30pt,
top: 2.54cm + 12pt + 4mm,
),
)
show: show-twoside-pagebreak.with(twoside: twoside)
// Header and footer
set page(
header-ascent: 4mm,
footer-descent: 35pt,
header: header(
left: locate(loc => if not calc.even(loc.page()) {
"浙江大学本科生毕业论文"
}),
right: locate(loc => if calc.even(loc.page()) {
document.title
}),
),
footer: twoside-numbering-footer,
)
// Paragraph and text
set par(leading: 1.3em, first-line-indent: 2em, justify: true)
show: indent-first-par
set text(font: 字体.仿宋, size: 字号.小四, lang: "zh")
show: show-cn-fakebold
set underline(offset: 0.2em)
// Headings
show heading: i-figured.reset-counters
set heading(numbering: (..numbers) => {
let level = numbers.pos().len()
if (level == 1) {
return numbering("一、", numbers.pos().at(level - 1))
} else {
return numbering("1.1 ", ..numbers.pos().slice(1))
}
})
show heading.where(level: 1): x => {
twoside-pagebreak
v(12pt)
align(center, x)
v(6pt)
}
show heading.where(level: 2): set text(size: 字号.三号)
show heading.where(level: 3): set text(size: 字号.小三)
show heading.where(level: 4): set text(size: 字号.四号)
// Reference
show: show-set-supplement
show figure: i-figured.show-figure
show math.equation.where(block: true): i-figured.show-equation
show figure.where(kind: table): set figure.caption(position: top)
// Part
show: show-part
show: show-outline-with-part
doc
}
#let undergraduate-cs-default-info = (
title: ("毕业论文/设计题目",),
grade: "20XX",
student-id: "1234567890",
author: "张三",
author-en: "<NAME>",
department: "某学院",
major: "某专业",
field: "某方向",
supervisor: "李四",
submit-date: datetime.today(),
)
#let undergraduate-cs(info: (:), twoside: true) = {
let info = undergraduate-cs-default-info + info
(
pages: (
cover: undergraduate-cover(info: info),
decl: undergraduate-decl(),
outline: main-outline(target: part-and-headings),
task: undergraduate-task.with(info: info),
individual: template-individual,
eval: undergraduate-eval,
proposal-cover: undergraduate-proposal-cover(info: info),
proposal-task: undergraduate-proposal-task.with(info: info),
proposal-eval: undergraduate-proposal-eval,
),
style: doc => {
set document(title: info.title.join())
show bibliography: none
undergraduate-cs-set-style(doc, twoside: twoside)
},
)
}
|
https://github.com/coco33920/.files | https://raw.githubusercontent.com/coco33920/.files/mistress/typst_templates/paper/template.typ | typst | ///////////////////////////////
// This Typst template is for working paper draft.
// It is based on the general SSRN papaer.
// Copyright (c) 2023
// Author: <NAME>
// License: MIT
// Version: 0.1
// Date: 2021-07-05
// Email: <EMAIL>
///////////////////////////////
#let paper(
font: "Times New Roman",
fontsize: 11pt,
title: none,
authors: (),
date: "",
abstract: [],
keywords: [],
JEL: [],
acknowledgements: none,
bibloc: none,
bibstyle: "ieee",
bibtitle: "References",
doc,
) = {
set par(leading: 1em)
// Set and show rules from before.
set text(
font: font,
size: fontsize
)
set footnote(numbering: "*")
set footnote.entry(
separator: line(length: 100%, stroke: 0.5pt)
)
set footnote.entry(indent: 0em)
set align(left)
text(17pt, align(center,{title;footnote(acknowledgements)}))
v(15pt)
let count = authors.len()
let ncols = calc.min(count, 3)
set footnote.entry(indent: 0em)
grid(
columns: (1fr,) * ncols,
row-gutter: 24pt,
..authors.map(author => {
text(14pt,align(center,{author.name;
{
if author.note != "" {
footnote(author.note)
}
};[\ ]
author.affiliation; [\ ]
link("mailto:" + author.email)})
)
}),
)
v(5pt)
align(center,[This Version: #date])
v(25pt)
par(justify: true)[
#align(center, [*Abstract*])
#abstract
]
v(10pt)
par(justify: true)[
#set align(left)
#emph([*Keywords:*]) #keywords
]
v(5pt)
par(justify: true)[
#set align(left)
#emph([*JEL Classification:*]) #JEL
]
pagebreak()
set heading(numbering: "1.")
set math.equation(numbering: "(1)")
set footnote(numbering: "1")
set footnote.entry(
separator: line(length: 100%, stroke: 0.5pt)
)
set footnote.entry(indent: 0em)
set align(left)
columns(1, doc)
pagebreak()
bibliography(
bibloc,
style: bibstyle,
title: bibtitle,
)
}
|
|
https://github.com/CHHC-L/JI-Lab-Report-Typst | https://raw.githubusercontent.com/CHHC-L/JI-Lab-Report-Typst/master/README.md | markdown | # JI-Lab-Report-Typst
Typst template for lab report @ sjtu-umji courses
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/par-simple.typ | typst | Apache License 2.0 | // Test plain text.
---
#set page(width: 250pt, height: 120pt)
But, soft! what light through yonder window breaks? It is the east, and Juliet
is the sun. Arise, fair sun, and kill the envious moon, Who is already sick and
pale with grief, That thou her maid art far more fair than she: Be not her maid,
since she is envious; Her vestal livery is but sick and green And none but fools
do wear it; cast it off. It is my lady, O, it is my love! O, that she knew she
were! She speaks yet she says nothing: what of that? Her eye discourses; I will
answer it.
I am too bold, 'tis not to me she speaks: Two of the fairest stars in all the
heaven, Having some business, do entreat her eyes To twinkle in their spheres
till they return. What if her eyes were there, they in her head? The brightness
of her cheek would shame those stars, As daylight doth a lamp; her eyes in
heaven Would through the airy region stream so bright That birds would sing and
think it were not night. See, how she leans her cheek upon her hand! O, that I
were a glove upon that hand, That I might touch that cheek!
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/delimited-01.typ | typst | Other | // Test unmatched.
$[1,2[ = [1,2) != zeta\(x/2\) $
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/model/quote.typ | typst | // Test the quote element.
--- quote-dir-author-pos ---
// Text direction affects author positioning
And I quote: #quote(attribution: [<NAME>])[cogito, ergo sum].
#set text(lang: "ar")
#quote(attribution: [عالم])[مرحبًا]
--- quote-dir-align ---
// Text direction affects block alignment
#set quote(block: true)
#quote(attribution: [<NAME>])[cogito, ergo sum]
#set text(lang: "ar")
#quote(attribution: [عالم])[مرحبًا]
--- quote-block-spacing ---
// Spacing with other blocks
#set quote(block: true)
#set text(8pt)
#lines(3)
#quote(lines(3))
#lines(3)
--- quote-inline ---
// Inline citation
#set text(8pt)
#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.]
#show bibliography: none
#bibliography("/assets/bib/works.bib")
--- quote-cite-format-label-or-numeric ---
// Citation-format: label or numeric
#set text(8pt)
#set quote(block: true)
#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.]
#show bibliography: none
#bibliography("/assets/bib/works.bib", style: "ieee")
--- quote-cite-format-note ---
// Citation-format: note
#set text(8pt)
#set quote(block: true)
#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.]
#show bibliography: none
#bibliography("/assets/bib/works.bib", style: "chicago-notes")
--- quote-cite-format-author-date ---
// Citation-format: author-date or author
#set text(8pt)
#set quote(block: true)
#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.]
#show bibliography: none
#bibliography("/assets/bib/works.bib", style: "apa")
--- quote-nesting ---
// Test quote selection.
#set page(width: auto)
#set text(lang: "en")
=== EN
#quote[An apostroph'] \
#quote[A #quote[nested] quote] \
#quote[A #quote[very #quote[nested]] quote]
#set text(lang: "de")
=== DE
#quote[Satz mit Apostroph'] \
#quote[Satz mit #quote[Zitat]] \
#quote[A #quote[very #quote[nested]] quote]
#set smartquote(alternative: true)
=== DE Alternative
#quote[Satz mit Apostroph'] \
#quote[Satz mit #quote[Zitat]] \
#quote[A #quote[very #quote[nested]] quote]
--- quote-nesting-custom ---
// With custom quotes.
#set smartquote(quotes: (single: ("<", ">"), double: ("(", ")")))
#quote[A #quote[nested] quote]
|
|
https://github.com/maleksware/hash-segtree | https://raw.githubusercontent.com/maleksware/hash-segtree/main/README.md | markdown | # Dynamic substring comparison problem: segment tree approach
The paper is in `paper-src/paper.pdf`. The Typst template, Hayagriva bibliography and the paper source can be found alongside.
### Repository structure
Each subproblem considered in the paper has its own folder. Each folder has the Python helper scripts:
1. Test generators (pseudorandom test generation with specified parameters) - `_gen-tests.py`.
2. Mini-test generators (small tests to avoid wasting time on running slow implementations instead of just showing how slow they are on smaller tests) - `_gen-mini-tests.py`.
3. Benchmarking scripts (C++ console invoking, timing, writing to the corresponding CSV) - `_run-tests.py`.
4. Plotters (configured to produce output to be inserted in the paper source) - `_plot-data.py`.
The C++ implementations for the corresponding problem can be found in `implementations`. Note that to run the tests yourself, you will have to compile the executables for your machine from source. Please refer to the source code of `_run-tests.py` to see the folder structure the scripts expect.
The `measurements` folder contains the test results which have been obtained from the generated testset. It has been added here for reference and debugging. The actual results will be different depending on the CPU/OS. Those are the files from which all the plots in the paper have been produced. The format is as follows: `<test-size>,<qp/ln>,<time-in-milliseconds>`.
All measurements have been taken on a Windows machine with Intel Core i5 11th Gen, with the Power mode enabled and no limitations on battery usage.
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/meta/outline-entry.typ | typst | Apache License 2.0 | // Tests outline entry.
---
#set page(width: 150pt)
#set heading(numbering: "1.")
#show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it)
}
#outline(indent: auto)
#set text(8pt)
#show heading: set block(spacing: 0.65em)
= Introduction
= Background
== History
== State of the Art
= Analysis
== Setup
---
#set page(width: 150pt, numbering: "I", margin: (bottom: 20pt))
#set heading(numbering: "1.")
#show outline.entry.where(level: 1): it => [
#let loc = it.element.location()
#let num = numbering(loc.page-numbering(), ..counter(page).at(loc))
#emph(link(loc, it.body))
#text(luma(100), box(width: 1fr, repeat[#it.fill.body;·]))
#link(loc, num)
]
#counter(page).update(3)
#outline(indent: auto, fill: repeat[--])
#set text(8pt)
#show heading: set block(spacing: 0.65em)
= Top heading
== Not top heading
=== Lower heading
=== Lower too
== Also not top
#pagebreak()
#set page(numbering: "1")
= Another top heading
== Middle heading
=== Lower heading
---
// Error: 2-27 cannot outline metadata
#outline(target: metadata)
#metadata("hello")
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/place-float-auto_04.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
//
// // Error: 2-27 floating placement must be `auto`, `top`, or `bottom`
// #place(float: true)[Hello] |
https://github.com/vsheg/intermediate-ml | https://raw.githubusercontent.com/vsheg/intermediate-ml/main/02-linear/03-weighted-ls.typ | typst | #import "@preview/physica:0.9.3": *
#import "../defs.typ": *
#import "../template.typ": *
#show: template
= Weighted Least Squares (WLS)
== Intro
#note(
title: [Heteroscedasticity],
)[
can be eliminated by applying weighted LS.
For a model with non-constant variance of the error term:
$
bold(y) = X bold(beta) + bold(epsilon), quad Var[epsilon(bold(x))] = y(bold(x))^2 dot sigma^2
$
To apply WLS, the weights must have a negative square unit:
$
w(bold(x)) = 1 / y(bold(x))^2
$
This leads to the transformations:
$
bold(y)' = bold(y) / sqrt(w), quad bold(x)' = bold(x) / sqrt(w), quad bold(epsilon)' = bold(epsilon) / sqrt(w)
$
The weight matrix is:
$
W = dmat(1 / y(bold(x)_1)^2, dots.down, 1 / y(bold(x)_ell)^2)
$
and
$
bold(y)' = sqrt(W) bold(y), quad bold(x)' = sqrt(W) bold(x), quad bold(epsilon)' = sqrt(W) bold(epsilon)
$
Now, the model can be formulated as a homoscedastic least squares problem:
$
bold(y)' = X' bold(beta) + bold(epsilon)', quad Var[epsilon'(bold(x))] = sigma^2
$
]
- The *Weighted Least Squares (WLS)* method is an extension of the ordinary least squares
(OLS) technique. The model is formulated the same way as in OLS:
$
hat(y)(bold(x)) = bold(x)^Tr hat(bold(beta)) + epsilon(bold(x))
$
where $bold(x)$ is the vector of features, $bold(beta)$ is the vector of parameters, $y(bold(x))$ is
the target variable, and $epsilon(bold(x))$ is the error term.
- Each observation $bold(x)$ has associated weights $w(bold(x))$ that reflect the importance
of that particular observation.
- This method minimizes the weighted sum of squared residuals:
$
RSS = sum_(bold(x) in X^ell) w(bold(x)) dot (y(bold(x)) - hat(y)(bold(x)))^2 -> min_bold(beta).
$
- The solution to this minimization problem is given by:
$
bold(beta)^* = ub((X^Tr W X)^(-1) X^Tr W, X^+_W) bold(y),
$
where $W$ is the diagonal matrix of weights, and $X^+_W$ is the weighted pseudo-inverse.
== Formalism
=== Weight matrix
For a weighted
$
RSS = sum_(bold(x) in X^ell) w(bold(x)) dot (y(bold(x)) - hat(y)(bold(x)))^2
$
let's introduce the weight matrix:
$
W :&= diag(w(bold(x)_1), ..., w(bold(x)_ell)) \
&= dmat(w(bold(x)_1), dots.down, w(bold(x)_ell))
$
=== Matrix form
#note(
title: [Quadratic form],
)[
is a function of the form:
$
Q(x_1, ..., x_n) = sum_(i=1)^n sum_(j=1)^n a_(i,j) x_i x_j.
$
Coefficients $a_(i,j)$ can be arranged in a symmetric matrix $A$, and the quadratic form
can be written in matrix form as:
$
Q(bold(x)) = bold(x)^T A bold(x).
$
]
Thus, we can rewrite the RSS in matrix form as a quadratic form:
$
RSS = (bold(y) - X bold(beta))^Tr W (bold(y) - X bold(beta)).
$
=== Transformation to standard LS problem
The weighted LS problem can be easily reformulated as a standard LS problem by replacing
the original variables with transformed ones:
$
bold(y)' := W^(1/2) bold(y), quad X' := W^(1/2) X, quad bold(epsilon)' := W^(1/2) bold(epsilon)
$
Substituting these transformations into the original model, we get:
$
bold(y)' = X' bold(beta) + bold(epsilon)'
$
=== Analytical solution
Now, let's solve for $bold(beta)$ in the transformed model. Since $W$ and $W^{1/2}$ are
diagonal matrices, transposing them results in the same matrix:
$
bold(beta)^* = X'^+ bold(y)' = (X'^Tr X')^(-1) X'^Tr bold(y)'
$
Expanding the expressions:
$
bold(beta)^*
&= ((W^(1/2) X)^T W^(1/2) X)^(-1) (W^(1/2) X)^Tr W^(1/2) bold(y) \
&= (X^Tr W X)^(-1) X^Tr W bold(y)
$
Therefore, the solution is:
$
bold(beta)^* = ub((X^Tr W X)^(-1) X^Tr W, X^+_W) bold(y)
$ |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-invalid-09.typ | typst | Other | // Error: 3-8 cannot divide by zero
#(1 / 0)
|
https://github.com/astrale-sharp/typst-compile-mode-poc | https://raw.githubusercontent.com/astrale-sharp/typst-compile-mode-poc/master/mode.typ | typst | Other |
#let mode = 1 // 0 is eval // 1 is correction with slide
#let slide(body, color : white) = align(center + top,text( size: 20pt, rect( inset: 15pt, fill: color ,body)))
#set page(paper: "presentation-16-9")
#set heading(numbering: " 1.1) ")
#show heading.where(level : 1): it => {
let dict = it.body.children.last()
let body = it.body.children.rev().slice(1).rev().join()
let dict = eval(dict.text )
let point = dict.point
if mode == 0 {
align(center, rect(inset : 15pt)[#body: $point/point$ \ #[*_#dict.consignes _*]] )
} else {
slide( text(body, weight: "bold",size: 30pt), color: red)
}
}
#show heading.where(level : 2): it => {
let dict = it.body.children.last()
let body = it.body.children.rev().slice(1).rev().join()
let dict = eval(dict.text )
let point = dict.point
if mode == 0 {
underline(
[Question] +
counter(it.func()).display() +
text(body.children.join()))
linebreak()
if dict.keys().contains("hint") {[*_HINT :_* ] + emph(dict.hint) + linebreak()}
}
else {
pagebreak()
slide(it)
if dict.keys().contains("correction") {rect(inset: 15pt, stroke: red + 1mm)[Correction: #dict.correction] }
}
}
#show heading: it => text(it,weight: "light") // just to overwrite the formatting myself
= My Evaluation #{ (point : 20, consignes: [read the questions!]) }
== Where is the moon? #{(point : 2, hint : [think harder])}
#lorem(15)
== What is the moon? #{(point : 1, correction : [just multiply silly!])}
#lorem(15)
== What's the mass of the moon? #{(point : 1, correction : [just multiply silly!])}
#lorem(15)
|
https://github.com/Zeratoxx/typst-polylux-theme-frankenstein | https://raw.githubusercontent.com/Zeratoxx/typst-polylux-theme-frankenstein/main/theme/frankenstein.typ | typst | #import "@preview/polylux:0.3.1": *
// frankenstein theme
//
// A highly customizable theme inspired by old Beamer theme Singapore with
// the section names at the top.
//
// The theme's initialization function is at the bottom of this file.
// GLOBAL HELPERS
// Guaranteed array helper. Users often supply a single argument to something that
// should be an array.
#let _as-array(value) = {
if type(value) == array {
value
} else {
(value,)
}
}
// Recursively update a dictionary.
#let _update-dict(dict, update) = {
for ((key, value)) in update.pairs() {
if type(value) == dictionary {
dict.insert(key, _update-dict(dict.at(key, default: (:)), value))
} else {
dict.insert(key, value)
}
}
dict
}
#let frankenstein-list(content) = (
layout(size => [
#let text-size = measure([#content])
#let proper-width = text-size.width + 50pt
#if proper-width > size.width {
proper-width = size.width
}
#move(
dx: 10pt,
block(
// fill: black.transparentize(50%),
width: proper-width)[
#set enum(numbering: "a.1.")
#content
],
)])
)
// frankenstein color palette for easy styling.
#let _frankenstein-palette = (
primary-900: color.hsl(rgb("#1f4ac3")),
primary-800: color.hsl(rgb("#2c57ce")),
primary-700: color.hsl(rgb("#3963d9")),
primary-600: color.hsl(rgb("#4370ec")),
primary-500: color.hsl(rgb("#4d7cfe")),
primary-400: color.hsl(rgb("#6890fe")),
primary-300: color.hsl(rgb("#82a3fe")),
primary-200: color.hsl(rgb("#82a3fe")),
primary-100: color.hsl(rgb("#a6beff")),
primary-50: color.hsl(rgb("#eaefff")),
secondary-900: color.hsl(rgb("#0f0f25")),
secondary-800: color.hsl(rgb("#171731")),
secondary-700: color.hsl(rgb("#1e1e3d")),
secondary-600: color.hsl(rgb("#232345")),
secondary-500: color.hsl(rgb("#28284d")),
secondary-400: color.hsl(rgb("#38385b")),
secondary-300: color.hsl(rgb("#484868")),
secondary-200: color.hsl(rgb("#848499")),
secondary-100: color.hsl(rgb("#bfbfca")),
secondary-50: color.hsl(rgb("#e5e5ea")),
contrast: white,
success: color.hsl(rgb("#8bc34a")),
warning: color.hsl(rgb("#ff9800")),
danger: color.hsl(rgb("#f44336")),
error: color.hsl(rgb("#f44336")),
info: color.hsl(rgb("#4d7cfe")),
cat-0: color.hsl(rgb("#e58606")),
cat-1: color.hsl(rgb("#5d69b1")),
cat-2: color.hsl(rgb("#52bca3")),
cat-3: color.hsl(rgb("#99c945")),
cat-4: color.hsl(rgb("#cc61b0")),
cat-5: color.hsl(rgb("#24796c")),
cat-6: color.hsl(rgb("#daa51b")),
cat-7: color.hsl(rgb("#2f8ac4")),
cat-8: color.hsl(rgb("#764e9f")),
cat-9: color.hsl(rgb("#ed645a")),
cat-10: color.hsl(rgb("#a5aa99")),
transparent: color.hsl(rgb(0, 0, 0, 0)),
)
// Create a frankenstein theme author entry.
#let frankenstein-author(name, affiliation, email) = {
(name: name, affiliation: affiliation, email: email)
}
// frankenstein default options.
#let _frankenstein-defaults = (
// Presentation aspect frankenstein.
aspect-ratio: "16-9",
// Presentation title.
title: [Presentation long title],
// Presentation title.
short-title: [Presentation title],
// An abstract for your work. Can be omitted if you don't have one.
abstract: lorem(10),
// Presentation authors/presenters.
authors: (
frankenstein-author("<NAME>", "Foo Ltd.", "<EMAIL>"),
frankenstein-author("<NAME>", "Quux Co.", "<EMAIL>"),
),
graphics-path: "../images/",
light-logo-filename: none,
dark-logo-filename: none,
// Date that will be displayed on cover page.
// The value needs to be of the 'datetime' type.
// More info: https://typst.app/docs/reference/foundations/datetime/
// Example: datetime(year: 2024, month: 03, day: 17)
date: datetime.today(),
date-format: "[day].[month].[year]",
// Document keywords to set.
keywords: (),
// The version of your work.
version: "Draft",
// Default font settings.
text: (font: ("Inter", "Lato", "Noto Sans", "Open Sans"), size: 16pt),
// Default language settings.
lang: "en",
// Whether to register headings as sections and subsections.
register-headings: true,
// Whether to apply some heading styling.
style-headings: true,
// Whether to apply some heading styling.
draw-headings-separation: true,
// Whether to apply the custom link style.
style-links: true,
// Whether to apply some raw styling.
style-raw: true,
// What to show as the "hero" or background image on title slides. `auto` means
// the theme's default background (auto, content, none).
hero: auto,
// What to show in the header ("progress", "progress+location", "short-info-top", "short-info-bottom", content, none).
header: "progress+location",
// What to show in the footer ("progress", "progress+location", "short-info-top", "short-info-bottom", content, none).
footer: "short-info-bottom",
// Title background color.
title-hero-color: _frankenstein-palette.secondary-800,
// Title text style.
title-text: (
font: ("Segoe UI", "Cantarell", "Inter", "Noto Sans", "Open Sans"),
size: 20pt,
fill: _frankenstein-palette.contrast,
),
// Title text heading overrides.
title-heading-text: (size: 2.5em, weight: "bold", hyphenate: false),
// Title author text heading overrides.
title-author-text: (:),
// Title affiliation text overrides.
title-affiliation-text: (size: 0.7em, weight: "light"),
// Title abstract text overrides.
title-abstract-text: (:),
// Title date and version text override.
title-version-text: (size: 0.7em, weight: "light"),
// Title vertical spacing.
title-gutter: 9%,
// Common heading text style.
heading-text: (font: ("Inter", "Cantarell", "Noto Sans", "Open Sans"), hyphenate: false, weight: "medium",tracking: .03em),
// Heading text style overrides in order of heading depth.
heading-texts: (
(/* depth 1 */fill: _frankenstein-palette.secondary-800, size: 1.2em, tracking: .02em),
(/* depth 2 */size: 1.15em,),
(/* depth 3 */size: 1.1em, ), /* depth ... */
),
// Heading alignments in order of heading depth.
heading-alignments: (left,),
// Slide content box options.
slide-box: (width: 100%, height: 100%, clip: true),
// Content slide alignment.
slide-grid: (
rows: (auto, 1em, 3fr, auto, 5fr, 3.5em, auto),
columns: (auto, 3.5em, 1fr, auto, 1fr, 3.5em, auto),
gutter: 0pt
),
grid-children: (),
// Slide grid cell.
slide-grid-cell: (x: 3, y: 3),
// Color for external link anchors.
link-color: _frankenstein-palette.primary-500,
// Stroke color for tables and such.
stroke-color: _frankenstein-palette.secondary-100,
// Fill color for code blocks and such.
fill-color: _frankenstein-palette.secondary-50,
// location background color.
location-bar-color: _frankenstein-palette.secondary-50,
// location text options for all text.
location-text: (fill: _frankenstein-palette.secondary-200, size: .5em),
// location text overrides for past sections.
location-text-past: (:),
// location text overrides for the current section.
location-text-current: (weight: "medium", size: 1.25em),
// location text overrides for future sections.
location-text-future: (:),
// location shape for past subsections.
location-shape-past: box(
height: 3.8pt,
circle(radius: 1.7pt, fill: _frankenstein-palette.secondary-100, stroke: 0.7pt + _frankenstein-palette.secondary-100),
),
// location shape for current subsections.
location-shape-current: box(
height: 3.8pt,
circle(radius: 1.7pt, fill: _frankenstein-palette.primary-500, stroke: 0.7pt + _frankenstein-palette.primary-500),
),
// location shape for future subsections.
location-shape-future: box(height: 3.8pt, circle(radius: 1.7pt, stroke: 0.7pt + _frankenstein-palette.secondary-100)),
// Progress bar height.
progress-bar-height: 5pt,
// Progress bar background color.
progress-bar-color: _frankenstein-palette.secondary-50,
// Progress bar overlay color.
progress-overlay-color: _frankenstein-palette.secondary-100,
// Progress bar text color.
progress-text-color: _frankenstein-palette.secondary-200,
// Whether to show first author in short information bar.
show-authors-in-short-info: true,
)
// Variable to hold the options state.
#let frankenstein-options = state("frankenstein-options", _frankenstein-defaults)
// Register new options or replace existing keys.
#let frankenstein-option-register(options) = {
frankenstein-options.update(s => {
s = s + options
s
})
}
// Update options by replacing values and updating dictionaries.
#let frankenstein-option-update(options) = {
frankenstein-options.update(s => _update-dict(s, options))
}
// Draw a tiny anchor on the top right of the body text.
#let frankenstein-link-anchor(body, color: _frankenstein-defaults.link-color) = {
box[#body#h(0.05em)#box(height: 1em, text(size: .4em, fill: color)[#emoji.chain])]
// box[#body#h(0.05em)#super(box(height: 0.7em, circle(radius: 0.15em, stroke: 0.08em + color)))]
}
// TITLE SLIDE
// frankenstein custom background image.
#let _frankenstein-hero(fill: _frankenstein-defaults.title-hero-color) = {
// Build the background.
place(block(width: 100%, height: 100%, fill: fill))
// The left triangle.
place(left + top, polygon(fill: fill.lighten(20%).transparentize(50%), (0%, 100%), (25%, 80%), (0%, 70%)))
// The bottom triangle.
place(left + top, polygon(fill: fill.lighten(20%).transparentize(20%), (0%, 100%), (25%, 80%), (75%, 100%)))
// The large one on the right.
place(left + top, polygon(fill: fill.lighten(20%).transparentize(85%), (0%, 100%), (100%, 100%), (100%, 20%)))
}
#let frankenstein-image(filename, image-args: ()) = layout(size => (
context {
[
#pad(
x: 2%,
top: 2%,
bottom: 15%,
move(
dy: 10pt,
image(frankenstein-options.get().at("graphics-path", default: "") + filename, fit: "contain", ..image-args),
),
)
]
}
))
#let frankenstein-image-plain(filename, image-args: ()) = (
context {
image(frankenstein-options.get().at("graphics-path", default: "") + filename, fit: "contain", ..image-args)
}
)
// frankenstein title text content. Draws only from defaults, fully customizable.
#let _frankenstein-title-content(
title: _frankenstein-defaults.title,
authors: _frankenstein-defaults.authors,
abstract: _frankenstein-defaults.abstract,
date: _frankenstein-defaults.date,
date-format: _frankenstein-defaults.date-format,
version: _frankenstein-defaults.version,
keywords: _frankenstein-defaults.keywords,
title-text: _frankenstein-defaults.title-text,
heading-text: _frankenstein-defaults.title-heading-text,
author-text: _frankenstein-defaults.title-author-text,
affiliation-text: _frankenstein-defaults.title-affiliation-text,
abstract-text: _frankenstein-defaults.title-abstract-text,
version-text: _frankenstein-defaults.title-version-text,
gutter: _frankenstein-defaults.title-gutter,
register-section: false,
) = {
set text(..title-text)
let rows = ()
if title != none {
rows.push(text(..heading-text)[#title])
if register-section {
utils.register-section(title)
}
}
if authors != none and authors.len() > 0 {
for author in _as-array(authors) {
let name = author.at("name", default: none)
let email = author.at("email", default: none)
let affiliation = author.at("affiliation", default: none)
let content = {
let author-text = text(..author-text)[#name]
if email == none {
author-text
} else {
link("mailto:" + email)[#author-text]
}
if affiliation != none {
v(0.3em, weak: true)
text(..affiliation-text)[#affiliation]
}
}
rows.push(content)
}
}
if abstract != none {
rows.push([
#set text(..abstract-text)
#abstract
])
}
let date-line = ()
if date != none {
date-line.push(date.display(date-format))
}
if version != none {
date-line.push(version)
}
if keywords != none and keywords.len() > 0 {
let keywords = _as-array(keywords)
date-line.push(keywords.join(", "))
}
if date-line.len() > 0 {
let sep = [
#h(1.6pt)
|
#h(1.6pt)
]
rows.push([
#set text(..version-text)
#date-line.join(sep)
])
}
grid(columns: (auto), gutter: gutter, ..rows)
}
#let place-logo(logo-hint, graphics-path: auto) = (
context {
let options = frankenstein-options.get()
let actual-path = if graphics-path == auto {
options.graphics-path
} else {
graphics-path
}
if type(actual-path) == str {
let logo-filename = ""
if type(logo-hint) == str {
logo-filename = logo-hint
} else if type(logo-hint) == color {
if logo-hint == white {
logo-filename = options.light-logo-filename
} else {
logo-filename = options.dark-logo-filename
}
}
place(
right + top,
pad(
right: 2em,
top: 2em,
image(actual-path + logo-filename, fit: "contain", alt: "logo", height: 2.5em),
),
)
}
}
)
// frankenstein style title slide.
// Draws options from context that are not in the parameter list.
#let title-slide(
// Slide title.
title: none,
// Document authors/presenters.
authors: none,
// Presentation abstract or subtitle.
abstract: none,
// Presentation date. Set to none to hide.
date: none,
// Presentation version. Set to none to hide.
version: none,
// Presentation keywords. Set to none to hide.
keywords: none,
// Foreground content to show (in front of regular title page content).
foreground: none,
// Background content to show (behind regular title page content).
background: none,
// What to show as the "hero" or background image on title slides.
// auto means the theme's default background (auto, content, none).
hero: auto,
// Whether to register this slide title as a section.
register-section: false,
body: none
) = {
let content = context {
let options = frankenstein-options.get()
let title2 = title
let authors2 = authors
let abstract2 = abstract
let date2 = date
let version2 = version
let keywords2 = keywords
let hero2 = hero
if hero == auto {
hero2 = options.at("hero", default: _frankenstein-defaults.hero)
}
if hero2 == auto {
let fill = options.title-hero-color
if fill != none {
_frankenstein-hero(fill: fill)
}
} else {
place(top + left, block(width: 100%, height: 100%, hero2))
}
if title2 == none {
title2 = options.title
}
if authors2 == none {
authors2 = options.authors
}
if abstract2 == none {
abstract2 = options.abstract
}
if date2 == none {
date2 = options.date
}
if version2 == none {
version2 = options.version
}
if keywords2 == none {
keywords2 = options.keywords
}
if background != none {
background
}
place-logo(white)
align(
left + horizon,
block(
width: 100%,
inset: 15%,
_frankenstein-title-content(
title: title2,
authors: authors2,
abstract: abstract2,
date: date2,
date-format: options.date-format,
version: version2,
keywords: keywords2,
title-text: options.title-text,
heading-text: options.title-heading-text,
author-text: options.title-author-text,
affiliation-text: options.title-affiliation-text,
abstract-text: options.title-abstract-text,
version-text: options.title-version-text,
gutter: options.title-gutter,
),
),
)
if foreground != none {
foreground
}
}
logic.polylux-slide(max-repetitions: 3, content + body)
}
// CONTENT SLIDE HELPERS
// frankenstein progress bar. Draws everything from options.
#let frankenstein-progress-bar(height: auto, progress-color: auto, background-color: auto) = {
locate(loc => {
let options = frankenstein-options.at(loc)
let current = loc.page()
let total = counter(page).final().first()
let bar-height = if height == auto {
options.progress-bar-height
} else {
height
}
let bar-progress-color = if progress-color == auto {
options.progress-overlay-color
} else {
assert(
type(progress-color) == color,
message: "argument 'progress-color' needs to be a color, got type '" + type(progress-color) + "'",
)
progress-color
}
let bar-background-color = if background-color == auto {
options.progress-bar-color
} else {
assert(
type(background-color) == color,
message: "argument 'background-color' needs to be a color, got type '" + type(background-color) + "'",
)
background-color
}
block(
fill: bar-background-color,
width: 100%,
below: 0pt,
above: 0pt,
height: bar-height,
place(
left + horizon,
clearance: 0pt,
utils.polylux-progress(frankenstein => block(
fill: bar-progress-color,
width: frankenstein * 100%,
height: 100%,
)),
),
)
})
}
// frankenstein style section location info bar. Draws everything from options.
#let frankenstein-location-info(show-location: true) = {
locate(loc => {
// Get the variables at this stage or final.
let options = frankenstein-options.at(loc)
let page = loc.page()
let secs = utils.sections-state.final()
set text(..options.location-text)
// Precalculate when sections and subsections end.
let sec_ends = {
if secs.len() > 1 {
secs.slice(1).map(s => s.loc.page())
} else {
()
}
}
sec_ends.push(none)
let sec_display = {
let curr_sec = if secs.len() > 0 {
let page-first-sec = secs.at(0).loc.page()
secs
.zip(sec_ends)
.map(((sec, end)) => {
(sec: sec, end: end)
})
.find(entry => {
// Returns false if the location of the first section haven't been reached yet.
// Returns always true after reaching the location of the first section but only at specific position caused by the order of the OR arguments.
// Priority decreases from left to right.
return page >= page-first-sec and (
page == entry.sec.loc.page() or (entry.end != none and page <= entry.end) or entry.end == none
)
})
} else {
none
}
if curr_sec != none {
curr_sec.sec.body
}
}
// Combine into a block that fills the header.
block(
fill: options.location-bar-color,
width: 100%,
frankenstein-progress-bar() + if show-location {
align(
horizon,
{
pad(
x: 4em,
y: 1.4em,
grid(
columns: (1fr, 1fr, 1fr),
gutter: .4em,
align(left,
box(
text(..options.location-text-current)[
#place(
move(dx: -2em, dy: -.26em,
circle(radius: .65em, inset: 2pt, stroke: _frankenstein-palette.primary-100.darken(20%).transparentize(80%))[
#circle(stroke: _frankenstein-palette.primary-100.darken(20%).transparentize(80%), fill: _frankenstein-palette.primary-100.darken(20%).transparentize(80%))
]
)
)
#sec_display
]
)
),
// debug
// text()[#secs] + text()[#sec_ends],
none,
if type(options.graphics-path) == str and type(options.dark-logo-filename) == str {
align(right, image(options.graphics-path + options.dark-logo-filename, fit: "contain", alt: "logo", height: 4em))
} else {
none
},
),
)
},
)
},
)
})
}
// frankenstein style short information bar. Draws everything from options.
#let frankenstein-short-info(
align_y,
leftsize: 2fr,
centersize: 6fr,
rightsize: 2fr,
pad-left: 4em,
pad-right: 3em,
pad-y: 2em,
show-page-number: true,
) = {
locate(loc => {
// Get the variables at this stage or final.
let options = frankenstein-options.at(loc)
let page = loc.page()
set text(..options.location-text)
// Precalculate when sections and subsections end.
let content = {
()
}
content.push(pad(left: pad-left, text(options.date.display(options.date-format))))
let center-content = options.short-title
if center-content == [] or center-content == none {
center-content = ""
}
if options.show-authors-in-short-info and options.authors != none and options.authors.len() > 0 {
if center-content != "" or center-content != [] or center-content != none {
center-content += linebreak()
}
center-content += options.authors.at(0).name + if options.authors.at(0).affiliation != "" and options.authors.at(0).affiliation != [] and options.authors.at(0).affiliation != none {" — " + options.authors.at(0).affiliation}
}
content.push(align(center, text(center-content)))
content.push(
align(
right,
pad(
right: pad-right,
text(if show-page-number {
str(page)
} else {
[]
}),
),
),
)
// Combine into a block that fills the header.
// TODO block fill color through options
place(
align_y,
block(
fill: _frankenstein-palette.transparent,
width: 100%,
align(
horizon,
{
pad(y: pad-y, grid(columns: (leftsize, centersize, rightsize), gutter: .4em, ..content))
},
),
),
)
})
}
// frankenstein header or footer bar helper.
#let frankenstein-bar(kind) = {
if kind == "progress+location" {
frankenstein-location-info()
} else if kind == "progress" {
frankenstein-location-info(show-location: false)
} else if kind == "short-info-top" {
frankenstein-short-info(top)
} else if kind == "short-info-bottom" {
frankenstein-short-info(bottom)
} else if kind == none {
[]
} else {
kind
}
}
// frankenstein header helper.
#let _frankenstein-header() = (
context {
frankenstein-bar(frankenstein-options.get().at("header", default: none))
}
)
// frankenstein footer helper.
#let _frankenstein-footer() = (
context {
frankenstein-bar(frankenstein-options.get().at("footer", default: none))
}
)
// frankenstein content box helper. Wraps it in a box+grid combination.
#let _frankenstein-content(box-args: auto, grid-args: auto, grid-cell: auto, grid-children: auto, body) = {
context {
let options = frankenstein-options.get()
let grid-children = if grid-children == auto {
options.grid-children
} else if grid-children == none {
()
} else {
_as-array(grid-children)
}
let the-grid = if grid-args == auto {
grid.with(..options.slide-grid)
} else if grid-args == none {
none
} else {
grid.with(..grid-args)
}
let body = if the-grid == none {
body
} else {
if grid-cell == auto {
the-grid(grid.cell(..options.slide-grid-cell, body), ..grid-children)
} else if grid-cell == none {
if type(body) == array {
the-grid(..body, ..grid-children)
} else {
body
}
} else {
the-grid(grid.cell(..grid-cell, body), ..grid-children)
}
}
let body = if box-args == auto {
box(..options.slide-box, body)
} else if box-args == none {
body
} else {
box(..box-args, body)
}
body
}
}
#let _frankenstein-split-content-box(
fg,
// bg, // fill: bg breaks images in split content
width,
alignment,
body,
inset_left: none,
inset_right: none,
inset_top: none,
inset_bottom: none,
inset_x: 2em,
inset_y: 1em,
grid-children: (),
) = {
let scaler = 1
if type(width) == ratio {
scaler = width
}
if inset_top == none {
inset_top = inset_y * scaler
}
if inset_bottom == none {
inset_bottom = inset_y * scaler * 3.5
}
if inset_left == none {
inset_left = inset_x * scaler
}
if inset_right == none {
inset_right = inset_x * scaler
}
let offset_top = 3fr
let offset_bottom = 3fr
let offset_left = 1fr
let offset_right = 1fr
if alignment.x == left {
offset_right = 3fr
} else if alignment.x == right {
offset_left = 3fr
}
_frankenstein-content(
box-args: (width: width, height: 100%, clip: true, /* fill: bg */), // ???????? fill: bg breaks split content??!
grid-args: (
rows: (auto, inset_top, offset_top, auto, offset_bottom, inset_bottom, auto),
columns: (auto, inset_left, offset_left, auto, offset_right, inset_right, auto),
gutter: 0pt,
),
grid-cell: (x: 3, y: 3),
grid-children: grid-children,
align(alignment + horizon, box(align(left, text(fill: fg, body)))),
)
}
// CONTENT SLIDES
// frankenstein style slide.
#let slide(
title,
do-outline-register: true,
depth: 2,
header: auto,
footer: auto,
box-args: auto,
grid-args: auto,
grid-cell: auto,
grid-children: (),
body,
) = {
if title != none and type(title) != str {
panic("argument 'title' need to be a string, got type '" + type(title) + "' with value '" + str(title) + "'")
}
if type(do-outline-register) != bool {
panic("argument 'do-outline-register' need to be a boolean, got type '" + type(do-outline-register) + "' with value '" + str(do-outline-register) + "'")
}
context {
let title-display
if title != none {
let should-get-outlined = depth == 1 and do-outline-register
title-display = block( /* fill: black.transparentize(50%), */
pad(
top: 1em,
bottom: 3.7em,
heading(outlined: should-get-outlined)[#title] + if frankenstein-options.get().draw-headings-separation {
place(bottom, dy: 18pt, dx: 10pt, line(stroke: 1pt + _frankenstein-palette.primary-900, length: 77pt))
},
),
)
}
let should-place-logo = false
let header = if header == auto {
_frankenstein-header()
if frankenstein-options.get().header == "progress" {
should-place-logo = true
}
} else {
header
}
let footer = if footer == auto {
_frankenstein-footer()
} else {
footer
}
let inner = {
stack(dir: ttb, title-display, body)
}
let content = _frankenstein-content(
box-args: box-args,
grid-args: grid-args,
grid-cell: grid-cell,
grid-children: grid-children,
inner,
)
logic.polylux-slide(
max-repetitions: 3,
grid(columns: 1, gutter: 0pt, rows: (auto, 1fr, auto), ..(header, content, footer)),
)
if should-place-logo {
place-logo(black)
}
}
}
// TODO buggy.. fix bugginess
#let WIP-two-column-slide(
title,
do-outline-register: true,
depth: 2,
header: auto,
footer: auto,
box-args: auto,
grid-args: auto,
grid-cell: auto,
grid-children: (),
body1,
body2,
) = {
let body = grid(
rows: 1,
columns: (auto, auto, auto),
gutter: 1em,
body1, line(start: (50%, 15%), end: (50%, 30%), stroke: .5pt + _frankenstein-palette.secondary-200), body2,
)
slide(
title,
do-outline-register: do-outline-register,
depth: depth,
header: header,
footer: footer,
box-args: box-args,
grid-args: grid-args,
grid-cell: grid-cell,
grid-children: grid-children,
body,
)
}
#let new-section-slide(
section-title,
subtitle: none,
uppercase-subtitle: true,
do-outline-register: true,
header: none,
footer: auto,
body,
) = (
context {
let options = frankenstein-options.get()
if type(section-title) != str {
panic("argument 'section-title' need to be a string, got type '" + type(section-title) + "' with value '" + str(section-title) + "'")
}
if subtitle != none and type(subtitle) != str {
panic("argument 'section-subtitle' need to be a string, got type '" + type(subtitle) + "' with value '" + str(subtitle) + "'")
}
if do-outline-register {
utils.register-section(section-title)
}
let heading-display = if options.style-headings {
let depth = 0
let texts = _as-array(options.heading-texts)
let style = if depth < texts.len() {
texts.at(depth)
} else {
(:)
}
// Do not hyphenate headings.
text(
..options.heading-text,
..style,
fill: _frankenstein-palette.primary-500.darken(50%).desaturate(50%),
weight: "thin",
tracking: 1pt,
size: 45pt,
)[#section-title]
} else {
section-title
}
let content = {
set align(horizon)
set enum(spacing: 1em)
show: pad.with(20%)
block(heading-display)
v(1em)
block(height: 2pt, width: 100%, spacing: 0pt, frankenstein-progress-bar(height: 2pt))
if subtitle != none and subtitle != "" {
let proper-subtitle = subtitle
if uppercase-subtitle {
proper-subtitle = upper(subtitle)
}
text(fill: _frankenstein-palette.secondary-200, proper-subtitle)
}
if body != [] {
linebreak()
v(1.5em)
set text(fill: _frankenstein-palette.cat-1)
box(width: 100%, pad(x: 7%, body))
}
}
slide(none, header: header, footer: footer, grid-args: none, content)
}
)
// frankenstein style centered slide.
#let centered-slide(title, do-outline-register: true, depth: 2, header: auto, footer: auto, box-args: auto, body) = {
context {
if title != none and type(title) != str {
panic("argument 'title' need to be a string, got type '" + type(title) + "' with value '" + str(title) + "'")
}
if type(do-outline-register) != bool {
panic("argument 'do-outline-register' need to be a boolean, got type '" + type(do-outline-register) + "' with value '" + str(do-outline-register) + "'")
}
let lower-fraction = 5fr
if title == none {
lower-fraction = 3fr
}
slide(
title,
do-outline-register: do-outline-register,
depth: depth,
header: header,
footer: footer,
box-args: box-args,
grid-args: (
rows: (auto, 1em, 3fr, auto, lower-fraction, 1em, auto),
columns: (auto, 2em, 1fr, auto, 1fr, 2em, auto),
gutter: 0pt,
),
grid-cell: (..frankenstein-options.get().slide-grid-cell, align: horizon + center),
body,
)
}
}
// frankenstein style bare bones slide.
#let bare-slide = logic.polylux-slide
#let west-slide(
title,
depth: 2,
do-outline-register: true,
subtitle: none,
title-width: 30%,
hyphenate: true,
header: auto,
footer: auto,
body,
) = {
let content = context {
frankenstein-option-update((heading-text: (hyphenate: true)))
box(
fill: frankenstein-options.get().location-bar-color,
_frankenstein-split-content-box(
_frankenstein-palette.secondary-900,
title-width,
center,
if title != none {
heading(depth: depth, outlined: do-outline-register, title)
v(.5em)
text(fill: _frankenstein-palette.secondary-300, size: .9em, hyphenate: hyphenate, subtitle)
} else {
[]
},
),
)
frankenstein-option-update((heading-text: (hyphenate: false)))
_frankenstein-split-content-box(
_frankenstein-palette.secondary-600,
(100% - title-width),
left,
inset_right: 4em,
inset_left: 7em,
body,
)
}
slide(
none,
depth: depth,
do-outline-register: do-outline-register,
header: header,
footer: footer,
grid-args: none,
content,
)
}
#let east-slide(
title,
depth: 2,
do-outline-register: true,
subtitle: none,
title-width: 30%,
hyphenate: true,
header: auto,
footer: auto,
body,
) = {
let content = context {
_frankenstein-split-content-box(
_frankenstein-palette.secondary-900,
(100% - title-width),
right,
inset_right: 7em,
inset_left: 4em,
body,
)
frankenstein-option-update((heading-text: (hyphenate: true)))
box(
fill: frankenstein-options.get().location-bar-color,
_frankenstein-split-content-box(
_frankenstein-palette.secondary-900,
title-width,
center,
if title != none {
heading(depth: depth, outlined: do-outline-register, title)
v(.5em)
text(fill: _frankenstein-palette.secondary-300, size: .9em, hyphenate: hyphenate, subtitle)
} else {
[]
},
),
)
frankenstein-option-update((heading-text: (hyphenate: false)))
}
slide(
none,
depth: depth,
do-outline-register: do-outline-register,
header: header,
footer: footer,
grid-args: none,
content,
)
}
// TODO
#let WIP_title-slide2(title, subtitle: none, author: [], date: none) = {
let title-block(fg, bg, height, body) = block(
width: 100%,
height: height,
outset: 0em,
inset: 0em,
breakable: false,
stroke: none,
spacing: 0em,
fill: bg,
align(center + horizon, text(fill: fg, body)),
)
let content = {
title-block(_frankenstein-palette.primary-900, _frankenstein-palette.secondary-50, 60%, text(1.7em, title))
title-block(
_frankenstein-palette.secondary-50,
_frankenstein-palette.primary-900,
40%,
{
if subtitle != none {
text(size: 1.2em, subtitle)
parbreak()
}
text(
size: .9em,
{
author
if date != none {
h(1em)
sym.dot.c
h(1em)
date
}
},
)
},
)
place(center + horizon, dy: 10%, rect(width: 6em, height: .5em, radius: .25em, fill: frankenstein-accent))
}
logic.polylux-slide(content)
}
// TODO
#let WIP_split-slide(body-left, body-right) = {
let content = {
_frankenstein-split-content-box(
_frankenstein-palette.primary-900,
_frankenstein-palette.secondary-50,
50%,
right,
body-left,
)
_frankenstein-split-content-box(
_frankenstein-palette.secondary-50,
_frankenstein-palette.primary-900,
50%,
left,
body-right,
)
}
logic.polylux-slide(content)
}
// TODO
#let WIP_slide2(title, header: none, footer: none, new-section: none, body) = {
let body = pad(x: 2em, y: .5em, body)
let progress-barline = locate(loc => {
if frankenstein-progress-bar.at(loc) {
let cell = block.with(width: 100%, height: 100%, above: 0pt, below: 0pt, breakable: false)
let colors = frankenstein-colors.at(loc)
utils.polylux-progress(frankenstein => {
grid(
rows: 2pt,
columns: (frankenstein * 100%, 1fr),
cell(fill: colors.a), cell(fill: colors.b),
)
})
} else {
[]
}
})
let header-text = {
if header != none {
header
} else if title != none {
if new-section != none {
utils.register-section(new-section)
}
locate(loc => {
let colors = frankenstein-colors.at(loc)
block(
fill: colors.c,
inset: (x: .5em),
grid(
columns: (60%, 40%),
align(top + left, heading(level: 2, text(fill: colors.a, title))),
align(top + right, text(fill: colors.a.lighten(65%), utils.current-section)),
),
)
})
} else {
[]
}
}
let header = {
set align(top)
grid(rows: (auto, auto), row-gutter: 3mm, progress-barline, header-text)
}
let footer = {
set text(size: 10pt)
set align(center + bottom)
let cell(fill: none, it) = rect(
width: 100%,
height: 100%,
inset: 1mm,
outset: 0mm,
fill: fill,
stroke: none,
align(horizon, text(fill: white, it)),
)
if footer != none {
footer
} else {
locate(loc => {
let colors = frankenstein-colors.at(loc)
show: block.with(width: 100%, height: auto, fill: colors.b)
grid(
columns: (25%, 1fr, 15%, 10%),
rows: (1.5em, auto),
cell(fill: colors.a, frankenstein-short-author.display()),
cell(frankenstein-short-title.display()),
cell(frankenstein-short-date.display()),
cell(logic.logical-slide.display() + [~/~] + utils.last-slide-number),
)
})
}
}
set page(
margin: (top: 2em, bottom: 1em, x: 0em),
header: header,
footer: footer,
footer-descent: 0em,
header-ascent: .6em,
)
logic.polylux-slide(body)
}
#let frankenstein-outline(numbering: "I.") = {
if numbering == auto {
numbering = "I."
}
text(
size: 18pt,
utils.polylux-outline(enum-args: (
tight: false,
body-indent: .9em,
spacing: 1.6em,
numbering: numbering,
)),
)
}
// frankenstein style slide.
#let frankenstein-outline-slide(title, depth: 1, header: none, footer: auto, numbering: auto) = west-slide(
title,
depth: depth,
do-outline-register: false,
header: header,
footer: footer,
)[#frankenstein-outline(numbering: numbering)]
// THEME
// The frankenstein theme function that sets up all styling and show rules once.
// Any provided options update the defaults by recursively updating the
// options dictionary. I.e. setting: `options: (title-text: (fill: red))`
// Only changes the title text's fill to red and maintains other options.
// You can view all defaults in the `frankenstein-defaults` variable.
#let frankenstein-theme(
// Presentation aspect frankenstein.
aspect-ratio: "16-9",
// Whether to include the default cover page.
cover: true,
// Presentation title.
title: [Presentation title],
// An abstract for your work. Can be omitted if you don't have one.
abstract: lorem(30),
// Presentation authors/presenters.
authors: (
frankenstein-author("<NAME>", "Foo Ltd.", "<EMAIL>"),
frankenstein-author("Foo Bar", "Quux Co.", "<EMAIL>"),
),
graphics-path: "../images/",
// Filename to dark logo
dark-logo-filename: none,
// Filename to light logo
light-logo-filename: none,
// Date that will be displayed on cover page.
// The value needs to be of the 'datetime' type.
// More info: https://typst.app/docs/reference/foundations/datetime/
// Example: datetime(year: 2024, month: 03, day: 17)
date: datetime.today(),
// Document keywords to set.
keywords: (),
// The version of your work.
version: "Draft",
// frankenstein language.
lang: "en",
// pdfpc configs
pdfpc-config: none,
// frankenstein theme options.
options: (:),
// Presentation contents.
body,
) = {
let keywords = {
if keywords == none {
()
} else {
keywords
}
}
// Set document properties.
set document(title: title, author: authors.first().name, date: date, keywords: keywords)
set page(paper: "presentation-" + aspect-ratio, margin: 0em, header: none, footer: none)
if pdfpc-config != none {
pdfpc.config(..pdfpc-config)
}
// Update all options.
let options = options + (
aspect-ratio: aspect-ratio,
title: title,
abstract: abstract,
authors: authors,
date: date,
keywords: keywords,
version: version,
lang: lang,
graphics-path: graphics-path,
dark-logo-filename: dark-logo-filename,
light-logo-filename: light-logo-filename,
)
frankenstein-option-update(options)
let list-marker1(content) = pad(top: -.05em, text(size: 1.2em, fill: _frankenstein-palette.primary-700, [#content]))
let list-marker2(content) = pad(top: 0.01em, text(size: .9em, fill: _frankenstein-palette.primary-500, [#content]))
let list-marker3(content) = pad(top: .02em, text(size: .9em, fill: _frankenstein-palette.primary-400, [#content]))
let list-marker4(content) = pad(top: -.1em, text(size: 1.2em, fill: _frankenstein-palette.primary-300, [#content]))
let list-marker5(content) = pad(top: -.1em, text(size: 1.1em, fill: _frankenstein-palette.primary-200, [#content]))
// Text setup.
set par(leading: 0.7em, justify: true, linebreaks: "optimized")
show par: set block(spacing: 1.35em)
set enum(
numbering: "I.a.1.",
tight: false,
spacing: 1.8em,
body-indent: 1.25em,
indent: -10pt,
)
set list(
marker: (list-marker1[⬢], list-marker2[⬟], list-marker3[⬥], list-marker4[▸], list-marker5[--]),
tight: false,
spacing: 1.8em,
body-indent: 1.25em,
indent: -10pt,
)
// Any text
show: it => (
context {
set text(lang: frankenstein-options.get().lang, ..frankenstein-options.get().text)
it
}
)
// Heading setup.
show heading: it => (
context {
let options = frankenstein-options.get()
if options.register-headings and logic.subslide.get().first() == 1 and it.outlined {
// Register sections and subsections.
if it.depth == 1 {
utils.register-section(it.body)
}
}
if options.style-headings {
let depth = it.depth - 1
let alignments = _as-array(options.heading-alignments)
let value = if depth < alignments.len() {
alignments.at(depth)
} else if alignments.len() > 0 {
alignments.last()
} else {
none
}
set align(value)
let texts = _as-array(options.heading-texts)
let style = if depth < texts.len() {
texts.at(depth)
} else if texts.len() > 0 {
texts.last()
} else {
(:)
}
// Do not hyphenate headings.
text(..options.heading-text, ..style)[#it]
} else {
it
}
}
)
// Style links if set.
show link: it => (
context {
let options = frankenstein-options.get()
if options.style-links {
// Don't style for internal links.
if type(it.dest) == label or type(it.dest) == location {
return it
}
let color = options.at("link-color", default: _frankenstein-palette.primary-500)
frankenstein-link-anchor(it)
} else {
it
}
}
)
// Set raw font to Fira Code if available.
show raw.where(block: true): it => (
context {
let options = frankenstein-options.get()
if options.style-raw {
set text(font: "Fira Code")
block(inset: (x: .3em), fill: options.fill-color.lighten(25%), outset: (y: .5em), radius: .15em, it)
} else {
it
}
}
)
show raw.where(block: false): it => (
context {
let options = frankenstein-options.get()
if options.style-raw {
set text(font: "Fira Code")
box(fill: options.fill-color, inset: (x: .3em), outset: (y: .3em), radius: .15em, it)
} else {
it
}
}
)
// Title slide if set.
if cover {
title-slide(
title: title,
authors: authors,
abstract: abstract,
date: date,
version: version,
keywords: keywords,
// Pick the option without another context.
hero: options.at("hero", default: _frankenstein-defaults.hero),
register-section: false, // Don't register the cover.
)
}
// Presentation contents.
body
} |
|
https://github.com/csimide/SEU-Typst-Template | https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/seu-thesis/utils/set-bachelor.typ | typst | MIT License | #import "numbering-tools.typ": number-with-circle, chinese-numbering
#import "packages.typ": show-cn-fakebold, i-figured
#import "bachelor-footnote.typ": bachelor-footnote
#import "show-heading.typ": show-heading
#import "bilingual-bibliography.typ": show-bibliography
#import "fonts.typ": 字体, 字号
#let set-bachelor(bilingual-bib: true, doc) = {
set page(
paper: "a4",
margin: (
top: 2cm + 0.5cm,
bottom: 2cm + 1cm,
left: 2cm + 0.5cm,
right: 2cm,
),
)
set text(font: 字体.宋体, size: 字号.小四, weight: "regular", lang: "zh")
set par(first-line-indent: 2em, leading: 15pt, justify: true)
show par: set block(spacing: 15pt)
show: show-cn-fakebold
show: show-bibliography.with(bilingual: bilingual-bib)
show heading: show-heading.with(
heading-top-margin: (0.2cm, 0.19cm, 0cm),
heading-bottom-margin: (0.12cm, 0.1cm, 0cm),
heading-space: (0.5em, 0.3em),
heading-indent: (0cm, 0em, 0em),
heading-align: (center, left, left),
heading-text: (
(font: 字体.黑体, size: 字号.三号, weight: "bold"),
(font: 字体.黑体, size: 字号.四号, weight: "regular"),
(font: 字体.宋体, size: 字号.小四, weight: "regular")
),
always-new-page: true,
auto-h-spacing: true,
)
show heading.where(level: 1): set heading(supplement: none)
set outline(depth: 3, indent: 2em)
show figure.where(kind: table): set figure.caption(position: top)
show figure: set figure(gap: 1.1em)
show figure: set text(size: 字号.五号, font: 字体.宋体, weight: "regular")
show figure: i-figured.show-figure.with(numbering: "1-1")
show figure.where(kind: table): i-figured.show-figure.with(numbering: "1.1")
show figure.where(kind: table): it => v(1.2em) + it
show math.equation.where(block: true): i-figured.show-equation
set footnote(numbering: num => number-with-circle(num))
set footnote.entry(
separator: line(start: (2.5em, 0pt), length: 30%, stroke: 0.5pt) + v(0.5em),
gap: 1em,
)
show footnote.entry: bachelor-footnote
set heading(numbering: chinese-numbering.with(in-appendix: false))
doc
} |
https://github.com/cunhapaulo/typst_styles | https://raw.githubusercontent.com/cunhapaulo/typst_styles/main/example_paper.typ | typst | MIT License | #import "./toolbox/paper.typ": *
#show: project.with(
title: "Main Title of this Paper",
subtitle: ": "+"Optional Paper´s Subtitle",
date: "Date of publishing",
abstract: lorem(70),
keywords: [Keyword1; keyword2; keyword3.],
authors:
(
( name: "Author #1 Name",
affiliation: "Course Name\n University Name",
email: "email@organization"
),
( name: "Author #2 Name",
affiliation: "Course Name\n University Name",
email: "email@organization"
),
),
)
#set cite(style: "chicago-author-date")
#section_[Introduction]
#lorem(30) #footnote[#footciteref(<Peters2000>)]
#lorem(30)
= Modernism and Post-Modernism
#lorem(40)
#myfigure("../img/finishline.jpg",
width: 45%,
caption: [Linha de chegada] ,
source: "Free pics website."
)
#lorem(30)
== Modernism in Arts
#lorem(30)
#lorem(30)
#myfigure("../img/ufpa.png",
width: 25%,
caption: [University´s logo],
source: "Institutional website of UFPa "
)
#lorem(45) #footnote[#lorem(30)]
== Modernism in Philosophy
#lorem(25) Citation #citeonline(<Lyotard2009>)
#lorem(125)
== Pós-modernism in Philosophy
#lorem(40) @Peters2000[p.10] @Lyotard2009
Eaxample uses of citation:
1. #citeonline(<Lyotard2009>, supplement: "p. 97")
2. #citeonline(<Lyotard2009>)
3. #cite(<Peters2000>, supplement: "p. 245")
4. @Peters2000[p. 45]
// Bibliography section
#set par(first-line-indent: 0mm, hanging-indent: 8mm, leading: 0.6em) // format tweak
#bibliography("./references/refs.bib", title: "Referências", style: "./references/abnt-ufrgs.csl") |
https://github.com/qiufei/typst | https://raw.githubusercontent.com/qiufei/typst/main/tree.typ | typst | MIT License | #import "@preview/cetz:0.2.2": canvas, draw, tree
#set page(width: auto, height: auto, margin: .5cm)
#let data = (
[A], ([B], [C], [D]), ([E], [F])
)
#canvas(length: 1cm, {
import draw: *
set-style(content: (padding: .2),
fill: gray.lighten(70%),
stroke: gray.lighten(70%))
tree.tree(data, spread: 2.5, grow: 1.5, draw-node: (node, ..) => {
circle((), radius: .45, stroke: none)
content((), node.content)
}, draw-edge: (from, to, ..) => {
line((a: from, number: .6, b: to),
(a: to, number: .6, b: from), mark: (end: ">"))
}, name: "tree")
// Draw a "custom" connection between two nodes
let (a, b) = ("tree.0-0-1", "tree.0-1-0",)
line((a, .6, b), (b, .6, a), mark: (end: ">", start: ">"))
}) |
https://github.com/xdoardo/co-thesis | https://raw.githubusercontent.com/xdoardo/co-thesis/master/thesis/chapters/imp/introduction.typ | typst | #import "@local/ebnf:0.1.0": *
#import "/includes.typ": *
== Introduction <section-imp-introduction>
=== Syntax <subsection-imp-introduction-syntax>
The syntax of the Imp language can be described in a handful of EBNF rules,
as shown in @imp-syntax-rules.
#ebnf("Imp", label: <imp-syntax-rules>, rules: (
aexp: (
(rule: [$n$], comment: [integer constant]),
(rule: [id], comment: [identifiers]),
(rule: [$a_1 + a_2$], comment: [sum])
),
bexp: (
(rule: [$b$], comment: [boolean constant]),
(rule: [$a_1 < a_2$], comment: [integer inequality]),
(rule: [$not b$], comment: [boolean negation]),
(rule: [$b_1 and b_2$], comment: [logical and])
),
command: (
(rule: [skip], comment: [nop]),
(rule: [id $<-$ *aexp*], comment: [assignment]),
(rule: [$c_1 ; c_2$], comment: [sequence]),
(rule: [if *bexp* then $c_1$ else $c_2$], comment: [conditional]),
(rule: [while *bexp* do c], comment: [loop]),
),
))
The syntactic elements of this language are _commands_, _arithmetic
expressions_, _boolean expressions_ and _identifiers_. Given its simple nature,
it is easy to give an abstract representation for its concrete syntax: all of
the elements can be represented with simple datatypes enclosing all the
information embedded in the syntactic rules, as shown in @code-ident, @code-aexp,
@code-bexp and @code-command.
#tablex(columns: (50%, 50%),
auto-hlines: false,
auto-vlines: false,
mycode(label: <code-ident>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L15")[
//typstfmt::off
```hs
Ident : Set
Ident = String
```
//typstfmt::on
],
mycode(label: <code-aexp>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Core.agda#L13")[
//typstfmt::off
```hs
data AExp : Set where
const : (n : ℤ) -> AExp
var : (id : Ident) -> AExp
plus : (a₁ a₂ : AExp) -> AExp
```
//typstfmt::on
],
colspanx(2,
mycode(label: <code-bexp>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Core.agda#L18")[
//typstfmt::off
```hs
data BExp : Set where
const : (b : Bool) -> BExp
le : (a₁ a₂ : AExp) -> BExp
not : (b : BExp) -> BExp
and : (b₁ b₂ : BExp) -> BExp
```
//typstfmt::on
]))
#mycode(label: <code-command>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Core.agda#L24")[
//typstfmt::off
```hs
data Command : Set where
skip : Command
assign : (id : Ident) -> (a : AExp) -> Command
seq : (c₁ c₂ : Command) -> Command
ifelse : (b : BExp) -> (c₁ c₂ : Command) -> Command
while : (b : BExp) -> (c : Command) -> Command
```
//typstfmt::on
]
=== Stores<subsection-imp-stores>
Identifiers in Imp have an important role. Identifiers can be initialized or
uninitialized (see @imp-semantics for a more detailed reasoning about their
role) and their value, if any, can change in time. We need a way to keep track
of identifiers and their value: this tool is the `Store`. Stores are defined as
shown in @code-store, that is, as _partial maps_ with the use of the `Maybe` monad.
#mycode(label: <code-store>,
"https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L18")[
//typstfmt::off
```hs
Store : Set
Store = Ident -> Maybe ℤ
```
//typstfmt::on
]
We now proceed to show basic definitions over partial maps.
1. *in-store predicate*: let $id$ be an identifier and $sigma$ be a store. To say that
$id$ is in $sigma$ we write $ id in sigma$; in other terms, it is the same as
$exists space v in ZZ, sigma id equiv "just" v$.
2. *empty store*: we denote the empty store as $emptyset$. For this special store,
it is always $forall id, id in emptyset -> bot$ or $forall id, emptyset id equiv "nothing"$.
#mycode(label: <code-store-empty>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L21")[
//typstfmt::off
```hs
empty : Store
empty = λ _ -> nothing
```
//typstfmt::on
]
3. *adding an identifier*: let $id$ be an identifier and $v : ZZ$ be a
value. We denote the insertion of the pair $(id, v)$ in a store $sigma$ as $(id , v) arrow.r.bar sigma$.
#mycode(label: <code-store-update>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L24" )[
//typstfmt::off
```hs
update : (id₁ : Ident) -> (v : ℤ) -> (s : Store) -> Store
update id₁ v s id₂ with id₁ == id₂
... | true = (just v)
... | false = (s id₂)
```
//typstfmt::on
]
4. *joining two stores*: let $sigma_1$ and $sigma_2$ be two stores. We define the
store that contains an $id$ if $id in sigma_1$ or $id in sigma_2$ as $sigma_1 union sigma_2$.
Notice that the join operation is not commutative, as it may be that
#align(center,
$exists id, exists space v_1, exists space v_2, v_1 eq.not v_2 and sigma_1 id equiv "just" v_1 and sigma_2 id equiv "just" v_2$
)
#mycode(label: <code-store-join>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L29" )[
//typstfmt::off
```hs
join : (s₁ s₂ : Store) -> Store
join s₁ s₂ id with (s₁ id)
... | just v = just v
... | nothing = s₂ id
```
//typstfmt::on
]
5. *merging two stores*: let $sigma_1$ and $sigma_2$ be two stores. We define the
store that contains an $id$ if and only if $sigma_1 id equiv "just" v$ and $sigma_2 id equiv "just" v$ as $sigma_1 sect sigma_2$.
#mycode(label: <code-store-merge>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L34" )[
//typstfmt::off
```hs
merge : (s₁ s₂ : Store) -> Store
merge s₁ s₂ =
λ id -> (s₁ id) >>=
λ v₁ -> (s₂ id) >>=
λ v₂ -> if (⌊ v₁ ≟ v₂ ⌋) then just v₁ else nothing
--- ^ decidable boolean equality for integers
```
//typstfmt::on
]
#definition(label: <def-imp-store-tilde-inclusion>)[
Let $sigma_1$ and $sigma_2$ be two stores. We define a new relation between them as
$ forall id, paren.l space exists space z, space sigma_1 id equiv "just" z space paren.r -> paren.l space exists space z, space sigma_2 id equiv "just" z space paren.r $
and we denote it with $sigma_1 space ∻ space sigma_2$.
In Agda:
#mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L83C1-L84C82")[
// typstfmt::off
```hs
_∻_ : Store -> Store -> Set
x ∻ x₁ = ∀ {id : Ident} -> (∃ λ z -> x id ≡ just z)
-> (∃ λ z -> x₁ id ≡ just z)
```
// typstfmt::on
]]
And we prove the transitivity of this new relation:
#theorem(name: "Transitivity of ∻ ", label: <thm-imp-store-tilde-transitive>)[
#mycode(proof: <proof-tilde-transitive>, "https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L86")[
// typstfmt::off
```hs
∻-trans : ∀ {s₁ s₂ s₃ : Store} (h₁ : s₁ ∻ s₂) (h₂ : s₂ ∻ s₃) -> s₁ ∻ s₃
```
// typstfmt::on
]]
|
|
https://github.com/loqusion/typix | https://raw.githubusercontent.com/loqusion/typix/main/checks/simple-with-virtual-paths/main.typ | typst | MIT License | #lorem(100)
#image("icons/link.svg")
#image("icons/paper-plane-tilt.svg")
|
https://github.com/Amirhosein-GPR/university_notes | https://raw.githubusercontent.com/Amirhosein-GPR/university_notes/main/assets/typst/tools/tool.typ | typst | #let red_color = rgb(200, 0, 0)
#let orange_color = rgb(220, 100, 0)
#let yellow_color = rgb(120, 120, 0)
#let green_color = rgb(0, 120, 0)
#let blue_color = rgb(0, 100, 200)
#let dark_blue_color = rgb(0, 0, 200)
#let purple_color = rgb(150, 0, 150)
#let gold_color = rgb(255, 215, 0)
#let brown_color = rgb(160, 60, 0)
#let svg(path, rgb: "", width: auto, height: auto) = {
let original = read(path)
let colored = original.replace("path", "path fill=\"" + rgb + "\"")
box(width: width, height: height)[#image.decode(colored)]
}
#let section_template(title: str, content, black_and_white: false, icon_paths: (), icon_color: color, pause: bool, continuation: bool, should_fill: true) = {
let fill_color
if should_fill {
fill_color = icon_color
} else {
fill_color = rgb(0, 0, 0, 0)
}
block(below: 1em)[
#block(below: 0.5em , width: 100%)[
#let icon_list = ()
#for icon_path in icon_paths {
icon_list.push(svg(icon_path, rgb: icon_color.to-hex(), width: 0.8em, height: 0.8em))
}
#let counter = 0
#let icon_list_last_index = icon_list.len() - 1
#grid(
columns: (auto, 1fr, auto),
align: center,
gutter: 0.5em,
{
while counter < icon_list_last_index {
box(stroke: icon_color, inset: 0.5em, radius: 0.2em)[
#icon_list.at(counter)
]
h(0.5em)
counter += 1
}
box(stroke: icon_color, inset: 0.5em, radius: 0.2em, fill: fill_color.lighten(97%))[
#icon_list.at(counter)
]
},
block(stroke: icon_color, inset: 0.5em, radius: 0.2em, width: 100%, fill: fill_color.lighten(97%))[
#text(fill: icon_color, baseline: -0.2em)[
#title
]
],
{
while counter > 0 {
box(stroke: icon_color, inset: 0.5em, radius: 0.2em)[
#icon_list.at(counter)
]
h(0.5em)
counter -= 1
}
box(stroke: icon_color, inset: 0.5em, radius: 0.2em, fill: fill_color.lighten(97%))[
#icon_list.at(counter)
]
},
)
]
#block(stroke: icon_color, inset: (bottom: 0.75em, rest: 0.5em), radius: 0.2em, width: 100%, below: 1em, fill: fill_color.lighten(97%))[
#if continuation == true {
grid(
columns: (1fr),
align: center,
inset: (top: 0.3em),
place(center, dy: -0.4em)[
#svg("../../icons/circle-play.svg", rgb: icon_color.to-hex(), width: 1em, height: 1em)
],
)
block(above: 1em, below: 0.7em)[
#line(length: 100%, stroke: (paint: icon_color, dash: "densely-dashed"))
]
}
#content
#if pause == true {
block(below: 1em, above: 0.7em)[
#line(length: 100%, stroke: (paint: icon_color, dash: "densely-dashed"))
]
grid(
columns: (1fr),
align: center,
place(center, dy: -0.6em)[
#svg("../../icons/circle-pause.svg", rgb: icon_color.to-hex(), width: 1em, height: 1em)
],
)
}
]
]
}
// #let reset_section_counters() = {
// counter("tip").update(0)
// counter("definition").update(0)
// counter("question").update(0)
// counter("example").update(0)
// counter("true_answer").update(0)
// counter("wrong_answer").update(0)
// counter("comparision").update(0)
// counter("list").update(0)
// counter("simple_context").update(0)
// counter("exercise").update(0)
// counter("exercise").update(0)
// counter("reminder").update(0)
// }
// #let section(counter_enabled: true, black_and_white: false, types: (), contents: (), options: (level: 1, pause: false, continuation: false)) = {
// let headings_counter = counter("heading")
// let section_counters = ()
// let title_array = ()
// let icon_paths_array = ()
// let icon_color_array = ()
// let number_of_sections = types.len()
// if options == none {
// options = ()
// for i in range(number_of_sections) {
// options.push((level: 1, pause: false, continuation: false))
// }
// } else {
// options = options
// }
// for i in range(number_of_sections) {
// if types.at(i) == "tip" {
// let icon_paths = ()
// while options.at(i).level > 0 {
// icon_paths.push("../../icons/star.svg")
// options.at(i).level -= 1
// }
// title_array.push("نکته")
// icon_paths_array.push(icon_paths)
// icon_color_array.push(orange_color)
// section_counters.push(counter("tip"))
// } else if types.at(i) == "definition" {
// title_array.push("تعریف")
// icon_paths_array.push(("../../icons/file-lines.svg",))
// icon_color_array.push(blue_color)
// section_counters.push(counter("definition"))
// } else if types.at(i) == "question" {
// title_array.push("سؤال")
// icon_paths_array.push(("../../icons/circle-question.svg",))
// icon_color_array.push(brown_color)
// section_counters.push(counter("question"))
// } else if types.at(i) == "example" {
// title_array.push("مثال")
// icon_paths_array.push(("../../icons/circle-dot.svg",))
// icon_color_array.push(purple_color)
// section_counters.push(counter("example"))
// } else if types.at(i) == "true_answer" {
// title_array.push("پاسخ")
// icon_paths_array.push(("../../icons/circle-check.svg",))
// icon_color_array.push(green_color)
// section_counters.push(counter("true_answer"))
// } else if types.at(i) == "wrong_answer" {
// title_array.push("پاسخ")
// icon_paths_array.push(("../../icons/circle-xmark.svg",))
// icon_color_array.push(red_color)
// section_counters.push(counter("wrong_answer"))
// } else if types.at(i) == "comparision" {
// title_array.push("مقایسه")
// icon_paths_array.push(("../../icons/code-compare.svg",))
// icon_color_array.push(rgb(0, 170, 170))
// section_counters.push(counter("comparision"))
// } else if types.at(i) == "list" {
// title_array.push("فهرست")
// icon_paths_array.push(("../../icons/list.svg",))
// icon_color_array.push(yellow_color)
// section_counters.push(counter("list"))
// } else if types.at(i) == "simple_context" {
// title_array.push("متن")
// icon_paths_array.push(("../../icons/book.svg",))
// icon_color_array.push(luma(70))
// section_counters.push(counter("simple_context"))
// } else if types.at(i) == "exercise" {
// title_array.push("تمرین")
// icon_paths_array.push(("../../icons/pen-to-square.svg",))
// icon_color_array.push( rgb(255, 0, 150))
// section_counters.push(counter("exercise"))
// } else if types.at(i) == "exercise-p" {
// title_array.push("تمرین")
// icon_paths_array.push(("../../icons/pen-to-square.svg", "../../icons/plus.svg"))
// icon_color_array.push( rgb(255, 0, 150))
// section_counters.push(counter("exercise-p"))
// } else if types.at(i) == "reminder" {
// title_array.push("یادآوری")
// icon_paths_array.push(("../../icons/arrows-rotate.svg",))
// icon_color_array.push( rgb(0, 180, 100))
// section_counters.push(counter("reminder"))
// }
// }
// if counter_enabled {
// context {
// let headings_before_here_count = query(selector(heading.where(level: 1)).before(here())).len()
// if headings_before_here_count > headings_counter.get().first() {
// headings_counter.update(headings_before_here_count)
// reset_section_counters()
// }
// if number_of_sections == 1 {
// section_counters.at(0).step()
// let first_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(0).get().first()}]
// section_template(title: title_array.at(0) + " " + first_section_title, contents.at(0), black_and_white: black_and_white, icon_paths: icon_paths_array.at(0), icon_color: icon_color_array.at(0), pause: options.at(0).pause, continuation: options.at(0).continuation)
// } else if number_of_sections == 2 {
// let first_section_title
// let second_section_title
// if types.at(0) == types.at(1) {
// section_counters.at(0).step()
// first_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(0).get().first() * 2 - 1}]
// second_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(1).get().first() * 2}]
// // section_counters.at(0).step()
// } else {
// for i in range(number_of_sections) {
// section_counters.at(i).step()
// }
// first_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(0).get().first()}]
// second_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(1).get().first()}]
// }
// block(below: 1em)[
// #grid(
// columns: (1fr, 1fr),
// gutter: 1em,
// section_template(title: title_array.at(0) + " " + first_section_title, contents.at(0), black_and_white: black_and_white, icon_paths: icon_paths_array.at(0), icon_color: icon_color_array.at(0), pause: options.at(0).pause, continuation: options.at(0).continuation),
// section_template(title: title_array.at(1) + " " + second_section_title, contents.at(1), black_and_white: black_and_white, icon_paths: icon_paths_array.at(1), icon_color: icon_color_array.at(1), pause: options.at(1).pause, continuation: options.at(1).continuation)
// )
// ]
// //TODO: number_of_sections == 3
// } else if number_of_sections == 3 {
// let first_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(0).get().first() * 3 - 2}]
// let second_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(1).get().first() * 3 - 1}]
// let third_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(2).get().first() * 3}]
// block(below: 1em)[
// #grid(
// columns: (1fr, 1fr),
// gutter: 1em,
// section_template(title: title_array.at(0) + " " + first_section_title, contents.at(0), black_and_white: black_and_white, icon_paths: icon_paths_array.at(0), icon_color: icon_color_array.at(0), pause: options.at(0).pause, continuation: options.at(0).continuation),
// section_template(title: title_array.at(1) + " " + second_section_title, contents.at(1), black_and_white: black_and_white, icon_paths: icon_paths_array.at(1), icon_color: icon_color_array.at(1), pause: options.at(1).pause, continuation: options.at(1).continuation),
// section_template(title: title_array.at(2) + " " + third_section_title, contents.at(2), black_and_white: black_and_white, icon_paths: icon_paths_array.at(2), icon_color: icon_color_array.at(2), pause: options.at(2).pause, continuation: options.at(2).continuation)
// )
// ]
// //TODO: number_of_sections == 4
// } else if number_of_sections == 4 {
// let first_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(0).get().first() * 4 - 3}]
// let second_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(1).get().first() * 4 - 2}]
// let third_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(2).get().first() * 4 - 1}]
// let fourth_section_title = text(stylistic-set: 1)[#headings_before_here_count.#{context section_counters.at(3).get().first() * 4}]
// block(below: 1em)[
// #grid(
// columns: (1fr, 1fr),
// gutter: 1em,
// section_template(title: title_array.at(0) + " " + first_section_title, contents.at(0), black_and_white: black_and_white, icon_paths: icon_paths_array.at(0), icon_color: icon_color_array.at(0), pause: options.at(0).pause, continuation: options.at(0).continuation),
// section_template(title: title_array.at(1) + " " + second_section_title, contents.at(1), black_and_white: black_and_white, icon_paths: icon_paths_array.at(1), icon_color: icon_color_array.at(1), pause: options.at(1).pause, continuation: options.at(1).continuation),
// section_template(title: title_array.at(2) + " " + third_section_title, contents.at(2), black_and_white: black_and_white, icon_paths: icon_paths_array.at(2), icon_color: icon_color_array.at(2), pause: options.at(2).pause, continuation: options.at(2).continuation),
// section_template(title: title_array.at(3) + " " + fourth_section_title, contents.at(3), black_and_white: black_and_white, icon_paths: icon_paths_array.at(3), icon_color: icon_color_array.at(3), pause: options.at(3).pause, continuation: options.at(3).continuation)
// )
// ]
// }
// }
// } else {
// section_template(title: title_array.at(0), contents.at(0), black_and_white: black_and_white, icon_paths: icon_paths_array.at(0), icon_color: icon_color_array.at(0), pause: options.at(0).pause, continuation: options.at(0).continuation)
// }
// }
#let section_counter(section_type) = {
let headings_counter = counter("heading")
let section_counter = counter(section_type)
section_counter.step()
context {
let headings_before_here_count = query(selector(heading.where(level: 1)).before(here())).len()
if headings_before_here_count > headings_counter.get().first() {
headings_counter.update(headings_before_here_count)
counter("tip").update(1)
counter("definition").update(1)
counter("question").update(1)
counter("example").update(1)
counter("answer").update(1)
counter("comparison").update(1)
counter("list").update(1)
counter("simple_context").update(1)
counter("exercise").update(1)
counter("reminder").update(1)
text(stylistic-set: 1)[#context headings_before_here_count.1]
} else {
text(stylistic-set: 1)[#context headings_before_here_count.#context section_counter.get().first()]
}
}
}
#let double_section(content1, content2) = {
block(below: 1em)[
#grid(
columns: (1fr, 1fr),
gutter: 1em,
content1,
content2
)
]
}
#let tip(content, level: 1, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "نکته"
if enable_counter {
title += " " + section_counter("tip")
}
let icon_paths = ()
while level > 0 {
icon_paths.push("../../icons/star.svg")
level -= 1
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: icon_paths, icon_color: orange_color, pause: pause, continuation: continuation)
}
#let definition(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "تعریف"
if enable_counter {
title += " " + section_counter("definition")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/file-lines.svg",), icon_color: blue_color, pause: pause, continuation: continuation)
}
#let question(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "سؤال"
if enable_counter {
title += " " + section_counter("question")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/circle-question.svg",), icon_color: red_color, pause: pause, continuation: continuation)
}
#let example(content, black_and_white: false, pause: false, continuation: false, enable_counter: false, double_section: false) = {
let title = "مثال"
if enable_counter {
title += " " + section_counter("example")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/circle-dot.svg",), icon_color: purple_color, pause: pause, continuation: continuation)
}
#let true_answer(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "پاسخ"
if enable_counter {
title += " " + section_counter("answer")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/circle-check.svg",), icon_color: green_color, pause: pause, continuation: continuation)
}
#let wrong_answer(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "پاسخ"
if enable_counter {
title += " " + section_counter("answer")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/circle-xmark.svg",), icon_color: brown_color, pause: pause, continuation: continuation)
}
#let comparision(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "مقایسه"
if enable_counter {
title += " " + section_counter("comparision")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/code-compare.svg",), icon_color: rgb(0, 170, 170), pause: pause, continuation: continuation)
}
#let list(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "فهرست"
if enable_counter {
title += " " + section_counter("list")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/list.svg",), icon_color: yellow_color, pause: pause, continuation: continuation)
}
#let simple_context(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "متن"
if enable_counter {
title += " " + section_counter("simple_context")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/book.svg",), icon_color: luma(70), pause: pause, continuation: continuation)
}
#let exercise(content, black_and_white: false, extra_score: false, pause: false, continuation: false, enable_counter: false) = {
let title = "تمرین"
if enable_counter {
title += " " + section_counter("exercise")
}
let icon_paths
if extra_score {
icon_paths = ("../../icons/pen-to-square.svg", "../../icons/plus.svg")
} else {
icon_paths = ("../../icons/pen-to-square.svg",)
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: icon_paths, icon_color: rgb(255, 0, 150), pause: pause, continuation: continuation)
}
#let reminder(content, black_and_white: false, pause: false, continuation: false, enable_counter: false) = {
let title = "یادآوری"
if enable_counter {
title += " " + section_counter("reminder")
}
section_template(title: title, content, black_and_white: black_and_white, icon_paths: ("../../icons/arrows-rotate.svg",), icon_color: rgb(0, 180, 100), pause: pause, continuation: continuation)
}
#let custom_figure(content, caption: str, refrence: none, inset: 0em, kind: image) = {
let supplement
if kind == image {
supplement = "شکل"
} else if kind == table {
supplement = "جدول"
}
if kind == raw {
supplement = "کد"
set raw(lang: "js")
show figure: arg => {
show par: set block(above: 0em)
block(stroke: black, width: 100%, inset: inset, radius: (top-left: 0.2em, top-right: 0.2em), clip: true, fill: luma(230))[
#text(dir: ltr)[
#arg.body
]
]
align(center)[
#box(stroke: black, inset: 1em, width: 100%, radius: (bottom-left: 0.2em, bottom-right: 0.2em))[
#text(baseline: 0em, stylistic-set: 1)[
#arg.caption
]
]
]
}
[
#figure(content, caption: caption, supplement: supplement) #refrence
]
} else {
show figure: arg => {
show par: set block(above: 0em)
align(center)[
#block(stroke: black, width: 100%, inset: inset, radius: (top-left: 0.2em, top-right: 0.2em), clip: true)[
#text(dir: ltr)[
#arg.body
]
]
#box(stroke: black, inset: 1em, width: 100%, radius: (bottom-left: 0.2em, bottom-right: 0.2em))[
#text(baseline: 0em, stylistic-set: 1)[
#arg.caption
]
]
]
}
[
#figure(content, caption: caption, supplement: supplement) #refrence
]
}
}
#let title(content, color: blue_color, size: 1.4em, should_fill: true) = {
let fill_color
if should_fill {
fill_color = green_color
} else {
fill_color = rgb(0, 0, 0, 0)
}
block(stroke: (thickness: 0.2em, paint: color), width: 100%, inset: 1.4em, radius: 0.2em, fill: color.lighten(97%))[
#align(center)[
#text(size: size)[
*#content*
]
]
]
}
#let sources(content) = {
// pagebreak()
show block: set block(above: 0em)
block(width: 100%, stroke: black)[
#block(width: 100%, inset: 1em)[
#align(center)[
منابع
]
]
#block(width: 100%, stroke: black, inset: 1em)[
#text(dir: ltr)[
#content
]
]
]
}
#let code_section(content, lang: "js") = {
line(length: 100%)
set raw(lang: lang)
block(fill: luma(230), inset: 1em, width: 100%, radius: 0.2em)[
#text(dir: ltr)[
#content
]
]
line(length: 100%)
}
#let introduce_sections(should_fill: true) = {
title("راهنمای جزوه", color: green_color)
align(center)[
#block(fill: luma(240), inset: 1em, radius: 0.2em, width: 100%, stroke: luma(200))[
*نحوه خواندن جزوه*
]
#align(right)[
جزوه از دو نوع ستون تشکیل شده است:
+ #text(fill: red_color)[ستون اصلی]:
ابتدا ستون اصلی راست هر صفحه را #text(fill: rgb(0, 100, 0))[به طور کامل] خوانده و سپس ستون اصلی چپ آن را #text(fill: rgb(0, 100, 0))[به طور کامل] بخوانید.
+ #text(fill: blue_color)[ستون فرعی]:
درون هر ستون اصلی نیز در مواقعی ممکن است دو ستون فرعی ایجاد شود.
ستون های فرعی اما بر خلاف ستون های اصلی، از #text(fill: rgb(0, 100, 0))[راست به چپ] خوانده می شوند.
شکل زیر گویای همه چیز است:
]
#block(stroke: (paint: black, dash: "densely-dash-dotted"), radius: 0.2em, inset: 0.5em, breakable: false)[
#image("../../../images/ML/00.png")
]
]
align(center)[
#block(fill: luma(240), inset: 1em, radius: 0.2em, width: 100%, stroke: luma(200))[
*بخش های مختلف جزوه*
]
]
double_section()[
#tip(enable_counter: false)[
نکاتی که به نظر قابل توجه می آیند در این بخش قرار می گیرند.
]
#question(enable_counter: false)[
سؤال ها در این بخش قرار می گیرند.
]
#true_answer(enable_counter: false)[
پاسخ های درست در این بخش قرار می گیرند.
]
#comparision(enable_counter: false)[
مقایسه ها در این بخش قرار می گیرند.
]
#simple_context(enable_counter: false)[
متن های عادی در این بخش قرار می گیرند.
]
#exercise(enable_counter: false, extra_score: true)[
تمرین های نمره مثبت در این بخش قرار می گیرند.
]
][
#definition(enable_counter: false)[
تعریف ها در این بخش قرار می گیرند.
#v(1.6em)
]
#example(enable_counter: false)[
مثال ها در این بخش قرار می گیرند.
]
#wrong_answer(enable_counter: false)[
پاسخ های نادرست در این بخش قرار می گیرند.
]
#list(enable_counter: false)[
فهرست ها در این بخش قرار می گیرند.
]
#exercise(enable_counter: false)[
تمرین ها در این بخش قرار می گیرند.
#v(1.6em)
]
#reminder(enable_counter: false)[
يادآوری ها در این بخش قرار می گیرند.
#v(1.6em)
]
]
align(center)[
#block(fill: luma(240), inset: 1em, radius: 0.2em, width: 100%, stroke: luma(200))[
*قطع شدن بخش ها*
]
]
block()[
فرض کنید دو بخش به نام های بخش ۱ و بخش ۲ داریم:
هنگامی که بخش ۱ توسط بخش ۲ قطع می شود، در انتهای بخش ۱، علامت
#text(baseline: 0.2em)[
#svg("../../icons/circle-pause.svg", rgb: "rgb(0, 0, 0)", width: 1em, height: 1em)
]
آورده می شود و پس از آنکه بخش ۲ (و شاید تعدادی بخش دیگر) به پایان رسید، ادامه بخش ۱ که با علامت
#text(baseline: 0.2em)[
#svg("../../icons/circle-play.svg", rgb: "rgb(0, 0, 0)", width: 1em, height: 1em)
]
شروع می شود، می آید.
به طور مثال:
#double_section()[
#definition(pause: true)[
#sym.dots
]
][
#question()[
#sym.dots
#v(1.7em)
]
]
#double_section()[
#true_answer()[
#sym.dots
#v(1.7em)
]
][
#definition(continuation: true)[
#sym.dots
]
]
]
} |
|
https://github.com/mvuorre/quarto-preprint | https://raw.githubusercontent.com/mvuorre/quarto-preprint/main/README.md | markdown | Creative Commons Attribution 4.0 International | *quarto-preprint* is a [Quarto](https://quarto.org) extension for rendering Quarto source documents to PDF documents via [Typst](https://typst.app/docs). It aims to
- Just Work™️
- Typst doesn't require complicated LaTeX installations
- Be fast
- Typst creates PDF files very quickly
- Be 100% Quarto standards compliant
- Write manuscripts without worrying about formatting & metadata
- Switch to any Quarto journal format without changing anything but `format:` (and whatever is required by the destination format)
To use (see below), install the extension and set your Quarto output format to `preprint-typst`. The extension also provides a `preprint-docx` format, which renders Quarto source documents to MS Word documents with some basic layout improvements.
Example output: <https://mvuorre.github.io/quarto-preprint/index.pdf>.
## Install
Add template to an existing project:
```bash
quarto add template mvuorre/quarto-preprint
```
Start a new Quarto project that uses `quarto-preprint`:
```bash
quarto use template mvuorre/quarto-preprint
```
## Configuration
The output of Quarto documents is configured through YAML metadata either in the document's front matter (between triple dashes), or in a `_quarto.yml` file. Read more about these at Quarto's [guide](https://quarto.org/docs/authoring/front-matter.html) to writing scholarly documents, Quarto's Typst format [documentation](https://quarto.org/docs/output-formats/typst.html), and the [Typst documentation](https://typst.app/docs) pages.
`preprint-typst` aims to include all standard Quarto front matter options for scholarly writing. Please report missing features (or other bugs) on [GitHub](https://github.com/mvuorre/quarto-preprint/issues). In addition, there are a few options specific to Typst, and the `quarto-preprint` format.
## Options specific to `quarto-preprint`
```{yaml}
running-head: "*preprint* Quarto extension manual"
branding: psyarxiv
authornote: This is an example author note.
wordcount: "{{< words-body >}}"
```
`running-head` should be a text string and is used as the document's running head.
`branding` adds a specified preprint service's logo to the document. Currently only "psyarxiv" is a valid value.
`authornote` allows adding information to the footer of the first page.
`wordcount` add a word count using <https://github.com/andrewheiss/quarto-wordcount> (see above example, and link for instructions on use).
# Help & contributing
Send your bug reports and pull requests to <https://github.com/mvuorre/quarto-preprint>. If you're reporting a bug, please include a reproducible example / full details of what you're trying to do, how, and what goes wrong.
## Tips
### Collaboration
It can be useful to also output a MS Word document for collaboration. To do so, you can include `docx` as an output format as shown [here](https://quarto.org/docs/output-formats/ms-word.html). `quarto-preprint` also provides a slightly improved bare-bones MS Word output format `preprint-docx`.
[Typst](https://typst.app) also provides an online interface. That could be especially useful for collaborating on documents. You can create a .typ file by including
```yaml
format:
preprint-typst:
keep-typ: true
```
in the document's YAML. Then, copy-paste the resulting .typ file and other required materials (bibliography & image files, etc.) to the Typst online interface. See an example [here](https://typst.app/project/rk4zWONKPIF5lRxF_HU1I5).
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/计算方法B/code/hw4/上机报告.typ | typst | #import "../../../template.typ": *
#show: note.with(
title: "上机报告",
author: "YHTQ",
date: datetime.today().display(),
logo: none,
withOutlined : false,
withTitle : false,
withHeadingNumbering: false
)
#let output = read("output")
本次作业主要是利用各种古典迭代法解线性方程组,对于不同参数、数据和 SOR 方法中不同 omega 选取的测试如下:\
#block[
#output
]
由于不同方法的迭代矩阵各不相同,误差估计比较复杂,因此这里迭代终止条件简单的设置为前后两次计算的差小于其中一个向量。 $L_infinity$ norm 的 $10^(-4)$ 倍。在几组实验中,可以验证矩阵 $A$ 满足不可约对角占优条件,因此 G-S 迭代和 Jacobi 迭代总是收敛的。同时,G-S 迭代都略快于 Jacobi 迭代,而 SOR 方法在选取合适的 $omega$ 后,迭代次数最少,速度最快。然而,不合适的 $omega$ 也会导致 SOR 方法的迭代次数增加,甚至无法收敛。\ |
|
https://github.com/christopherkenny/tufte | https://raw.githubusercontent.com/christopherkenny/tufte/main/_extensions/tufte/biblio.typ | typst | Other | #let sansfont = ($for(sansfont)$"$sansfont$",$endfor$)
$if(citations)$
#heading(level:1, [References])
#show bibliography: set text(font: sansfont)
#show bibliography: set par(justify: false)
#set bibliography(title: none)
$if(csl)$
#set bibliography(style: "$csl$")
$elseif(bibliographystyle)$
#set bibliography(style: "$bibliographystyle$")
$endif$
$if(bibliography)$
#bibliography($for(bibliography)$"$bibliography$"$sep$,$endfor$)
$endif$
$endif$
|
https://github.com/Blezz-tech/math-typst | https://raw.githubusercontent.com/Blezz-tech/math-typst/main/Картинки/Демо вариант 2024/Задание 01.4.typ | typst | #import "@preview/cetz:0.1.2"
#import "/lib/my_cetz.typ": *
#set align(center)
#cetz.canvas(length: 0.5cm, {
import cetz.draw: *
import cetz.angle: angle
set-style(..defaultStyle)
let (A, B, C, D) = ((0,0), (4,4), (11,4), (7,0))
line(A, B, C, D, close: true)
content(A, $ A $, anchor: "right")
content(B, $ B $, anchor: "bottom")
content(C, $ C $, anchor: "left")
content(D, $ D $, anchor: "top")
line(A, B, name: "AB")
line(B, C, name: "BC")
// line(D, (horizontal: "AB", vertical: "AB"), name: "DH1")
// line(D, (horizontal: "BC", vertical: "BC"), name: "DH2")
// content("DH1.end", name: "H1", $ H_1 $, anchor: "bottom-right")
// content("DH2.end", $ H_2 $, anchor: "bottom", name: "H2")
// angle("H1", D, B, $$)
line(D, (horizontal: "AB", vertical: "AB"), name: "DH1")
line(D, (horizontal: "AB", vertical: ()), name: "DH1")
line(D, (horizontal: (), vertical: "AB"), name: "DH1")
})
|
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/foundations/type.typ | typst | --- type ---
#test(type(1), int)
#test(type(ltr), direction)
#test(type(10 / 3), float)
--- type-string-compatibility ---
#test(type(10), int)
#test(type(10), "integer")
#test("is " + type(10), "is integer")
#test(int in ("integer", "string"), true)
#test(int in "integers or strings", true)
#test(str in "integers or strings", true)
--- issue-3110-type-constructor ---
// Let the error message report the type name.
// Error: 2-9 type content does not have a constructor
#content()
--- issue-3110-associated-field ---
// Error: 6-12 type integer does not contain field `MAXVAL`
#int.MAXVAL
--- issue-3110-associated-function ---
// Error: 6-18 type string does not contain field `from-unïcode`
#str.from-unïcode(97)
--- issue-2747-repr-auto-none ---
#test(repr(none), "none")
#test(repr(auto), "auto")
#test(repr(type(none)), "type(none)")
#test(repr(type(auto)), "type(auto)")
|
|
https://github.com/mariunaise/HDA-Thesis | https://raw.githubusercontent.com/mariunaise/HDA-Thesis/master/graphics/quantizers/s-metric/2_2_en.typ | typst | #import "@preview/cetz:0.2.2": canvas, plot, draw, decorations, vector
#let line_style = (stroke: (paint: black, thickness: 2pt))
#let dashed = (stroke: (dash: "dashed"))
#canvas({
import draw: *
set-style(axes: (shared-zero: false))
plot.plot(size: (8,6),
x-tick-step: 0.25,
y-label: $cal(E)(2, 2, tilde(x))$,
x-label: $tilde(x)$,
y-tick-step: none,
y-ticks: ((0.125, [M1]) ,(0.25, [M2]),(0.375, [M1]) ,(0.5, [M2]),(0.625, [M1]) ,(0.75, [M2]),(0.875, [M1]) ,(1, [M2])),
axis-style: "left",
x-min: 0,
x-max: 1,
y-min: 0,
y-max: 1,{
plot.add(((0,0.125), (0.125, 0.125), (0.25,0.25), (0.375, 0.375),(0.5,0.5), (0.625, 0.625),(0.75,0.75), (0.875, 0.875),(1, 1)), line: "vh", style: line_style)
plot.add-hline(0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, style: dashed)
plot.add-vline(0.25, 0.5, 0.75, 1, style: dashed)
})
decorations.brace((-0.9,0.63), (-0.9,1.63), name: "00")
decorations.brace((-0.9,2.13), (-0.9,3.13), name: "01")
decorations.brace((-0.9,3.63), (-0.9,4.63), name: "10")
decorations.brace((-0.9,5.13), (-0.9,6.13), name: "11")
draw.content((v => vector.add(v, (-0.3, 0)), "00.west"), [00])
draw.content((v => vector.add(v, (-0.3, 0)), "01.west"), [01])
draw.content((v => vector.add(v, (-0.3, 0)), "10.west"), [10])
draw.content((v => vector.add(v, (-0.3, 0)), "11.west"), [11])
})
|
|
https://github.com/TeddyHuang-00/typpuccino | https://raw.githubusercontent.com/TeddyHuang-00/typpuccino/main/example.typ | typst | MIT License | #import "src/lib.typ": latte, frappe, macchiato, mocha
#let relative-luminance(color) = {
let rgb = rgb(color).components(alpha: false).map(c => {
c = float(c)
if c <= 0.03928 { c / 12.92 } else {
calc.pow((c + 0.055) / 1.055, 2.4)
}
})
(0.2126, 0.7152, 0.0722).zip(rgb).map(e => e.at(0) * e.at(1)).sum()
}
#let determine-text-color(color) = {
let l = relative-luminance(color)
let contrast-black = (l + 0.05) / 0.05
let contrast-white = 1 / (l + 0.05)
if contrast-black > contrast-white {
black
} else {
white
}
}
#let show-palette(name, palette) = {
box[
== #name
#grid(
columns: 7,
gutter: 1em,
..palette.color-entries.pairs().map(
e => {
let (name, color) = e
square(
fill: color,
width: 5em,
align(center + horizon, text(fill: determine-text-color(color), name)),
)
},
),
)
#v(3em)
]
}
= Usage
#grid(columns: 2, gutter: 1em, [ ```typst
#import "@preview/catypuccin:0.1.0": latte, frappe, macchiato, mocha
#square(fill: mocha.red)
``` ], [#square(fill: mocha.red)])
= Color Palettes
#show-palette("Latte", latte)
#show-palette("Frappe", frappe)
#show-palette("Macchiato", macchiato)
#show-palette("Mocha", mocha)
|
https://github.com/AnsgarLichter/cv-typst | https://raw.githubusercontent.com/AnsgarLichter/cv-typst/main/cv-en.typ | typst | #import "template.typ": *
#import "@preview/fontawesome:0.1.0": *
#show: cv
#let icons = (
phone: fa-phone(),
homepage: fa-home(fill: colors.accent),
linkedin: fa-linkedin(fill: colors.accent),
github: fa-github(fill: colors.accent),
xing: fa-xing(),
mail: fa-envelope(fill: colors.accent)
)
#header(
fullName: [<NAME>],
jobTitle: [Master Student Computer Science at SAP],
socials: (
(
icon: icons.github,
text: [AnsgarLichter],
link: "https://github.com/AnsgarLichter"
),
(
icon: icons.homepage,
text: [ansgarlichter.com],
link: "https://ansgarlichter.com"
),
(
icon: icons.mail,
text: [<EMAIL>],
link: "mailto://<EMAIL>"
),
(
icon: icons.linkedin,
text: [ansgarlichter],
link: "https://linkedin.com/in/ansgarlichter"
)
),
profilePicture: "../media/profilePhoto.jpeg"
)
#section("Professional Experience")
#entry(
title: "Practical Experiences during Master's Studies",
companyOrUniversity: "SAP SE",
date: "09/2022 - 09/2024",
location: "Walldorf, Germany",
logo: "media/sap.png",
description: list(
[In total 4 rotations in different departments],
[Consulting & development of several Fiori apps for home office risk assessment using CAP Node.js],
[Support in developing a microservice architecture using CAP Java],
[Development of OPA tests in TypeScript for Fiori Elements applications including synchronization of mock data],
)
)
#entry(
title: "SAP EWM Software Developer",
companyOrUniversity: "SEW-EURODRIVE",
date: "09/2020 - 08/2022",
location: "Graben-Neudorf, Germany",
logo: "media/sew.png",
description: list(
[Development in the SAP EWM system with ABAP OO, developed web applications for handling logistic processes with SAPUI5 and OData-Services],
[Creation of a new template for manual warehouses for all plants worldwide, including coordination with the relevant departments],
)
)
#entry(
title: "Practical Experiences during Bachelor's Studies",
companyOrUniversity: "SEW-EURODRIVE",
date: "09/2017 - 09/2020",
location: "Bruchsal / Graben-Neudorf, Germany",
logo: "media/sew.png",
description: list(
[Development tasks (web applications, transactions, scripts) in different departments with in the context of different SAP systems],
[ABAP OO, ODataV2, SAPUI5],
[Support the Going Live phase of a SAP MES Pilot Project with a 2-month assignment in Suzhou, China]
)
)
#section("Education")
#entry(
title: "Master of Science Computer Science",
companyOrUniversity: "University of Applied Sciences Karlsruhe",
date: "09/2022 - 09/2024",
location: "Karlsruhe, Germany",
logo: "media/hka.png",
description: list(
[Thesis: A Comparative Analysis of PostgreSQL and SAP HANA in the Context of the SAP Cloud Application Programming Model - Developing a Recommendation Framework],
[Minor: Software Engineering],
[GPA: 1.0 (thesis missing)]
)
)
#entry(
title: "Deutschlandstipendium",
companyOrUniversity: "University of Applied Sciences Karlsruhe",
date: "09/2023 - 09/2024",
location: "",
logo: "media/stipendium.png",
description: list(
[Public-private scholarship awarded for academic potential]
)
)
#entry(
title: "Bachelor of Science Business Information Systems",
companyOrUniversity: "Corporate State University Karlsruhe",
date: "09/2017 - 09/2020",
location: "Karlsruhe, Germany",
logo: "media/dhbw.png",
description: list(
[Thesis: Digitalization of the intralogistics – evaluation of various pick-by-solutions to improve the picking process at SEW-EURODRIVE],
[Minor: Software Engineering],
[GPA: 1.5]
)
)
#pagebreak()
#header(
fullName: [<NAME>],
jobTitle: [Master Student Computer Science at SAP],
socials: (
(
icon: icons.github,
text: [AnsgarLichter],
link: "https://github.com/AnsgarLichter"
),
(
icon: icons.homepage,
text: [ansgarlichter.com],
link: "https://ansgarlichter.com"
),
(
icon: icons.mail,
text: [<EMAIL>],
link: "mailto://<EMAIL>"
),
(
icon: icons.linkedin,
text: [ansgarlichter],
link: "https://linkedin.com/in/ansgarlichter"
)
),
profilePicture: "../media/profilePhoto.jpeg"
)
#section("Programming Expertise")
#entry(
title: "ExportKindleClippingsToNotion ",
companyOrUniversity: "Personal Project",
date: "2023 - 2024",
location: "",
logo: "media/ExportKindleClippingsToNotion.jpeg",
description: list(
[CLI-Tool to export your kindle clippings to Notion],
[Written in C\# using the official Notion API]
)
)
#entry(
title: "Corporate State University’s Mobile App",
companyOrUniversity: "University Project",
date: "2020",
location: "",
logo: "media/dhbw.png",
description: list(
[Maintenance and further Development of the following features: Live departure times of trains, lecture schedule and cafeteria menu],
[Upgrade of the used frameworks to the latest version],
[Mobile app in Ionic & Angular for Android and iOS]
)
)
#entry(
title: "Catch The Train",
companyOrUniversity: "Personal Project",
date: "2019",
location: "",
logo: "media/CatchTheTrain.jpeg",
description: list(
[Fetch the live departures times more comfortable],
[Using Flutter & the official API of the local public transport services company]
)
)
#section("Skills & Interests")
#skill(
category: "Technology",
skills: ("SAPUI5", "Fiori Elements", "CAP Node.js / Java", "JavaScript", "TypeScript", "ABAP OO", "Angular")
)
#skill(
category: "Languages",
skills: ("German (native)", "English (fluent)", "Spanish (Basics)")
)
#skill(
category: "Sports",
skills: ("Gym", "Riding the bicycle", "Swimming")
)
#skill(
category: "Interests",
skills: ("Enthusiastic about Tech", "Politics & Economics", "Motor Sports (Formula 1)")
) |
|
https://github.com/kokkonisd/typst-phd-template | https://raw.githubusercontent.com/kokkonisd/typst-phd-template/main/examples/presentation.typ | typst | The Unlicense | // Replace 0.2.3 with the version of the template you've installed.
#import "@local/phd-template:0.2.3" as template
#show: doc => template.presentation-setup(
doc,
title: "My Cool Presentation",
title-short: "Cool Presentation",
subtitle: "It's Really Interesting, I Swear",
authors: (
(
name: "<NAME>",
organization: "My Lab",
email: "<EMAIL>",
),
),
authors-short: (
"I. Me",
),
)
#template.slide(title: "Overview", size: 30pt)[
- Introduction
- Some Stuff
- Conclusion
]
#template.section-slide(title: "Introduction", subtitle: "where I introduce stuff")
#template.slide(title: "Background (1/2)")[
#lorem(100)
]
#template.slide(title: "Background (2/2)")[
#lorem(50)
]
#template.section-slide(title: "Some Stuff", subtitle: "That's Interesting")
#template.slide(title: "Primary stuff")[
- One
- Two
- Three
]
#template.slide(title: "Secondary stuff")[
- Four
- Four Point Five
- Five
]
#template.section-slide(title: "Conclusion", subtitle: "wrapping it up")
#template.slide(title: "What I Learned")[
- nothing
]
#template.section-slide(title: "Thank you for your attention :)", subtitle: "Any questions?")
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.