repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/gianzamboni/cancionero
https://raw.githubusercontent.com/gianzamboni/cancionero/main/wip/el-tango-de-la-muerte.typ
typst
#import "../theme/project.typ": *; #cancion("El tango de la muerte","<NAME>")[ ¡Qué se haga ya la oscuridad! Deténgase la sucesión En una ausencia tan brutal Que es uno mismo el que no está Y no sentir ningún dolor Es lo que duele más Llegó el olvido, vencedor Y ya el saqueo comenzó En la memoria sin guardián Libros de viento robará Y de tu verso más cantor Nadie se acordará Yo juego con la carta más segura No importan los vaivenes de la suerte Aquí donde me ve, yo soy la Muerte El precio de la última aventura Yo soy mucho más fuerte que la vida Yo soy la última rima del poema Mi voz en todo acorde suena Y con cualquier camino yo hago esquina #colbreak() No hay que pensar ni preguntar Yo soy mi propia explicación Soy el sentido y el motor De la poesía y el amor La nada espera, vamos ya Su tiempo terminó ]
https://github.com/kdog3682/mathematical
https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/mathtools/create-fractions-from-ratios.typ
typst
#import "@local/typkit:0.1.0": * #let create-fractions-from-ratios(..sink) = { let args = sinks.pos() assert-is-color-value-object-array(args) let values = args.map((x) => x.value) let d = values.sum() let callback(o) = { return colored(frac(o.value, d), o.fill) } let fractions = args.map(callback) let ratio-items = map(values, colored, o.fill).intersperse(marks.math.colon) fletcher-canvas({ for (i, ratio-item) in ratio-items.enumerate() { node(0, 0, ratio) } for ratio-item in ratio-items { node() } }) }
https://github.com/GES233/interview-trancript-template
https://raw.githubusercontent.com/GES233/interview-trancript-template/main/exmaple_transcript.typ
typst
#import "interview_template.typ": interview, record, follow #let A(content) = record("卧龙", content) #let B(content) = record("凤雏", content) #let C(content) = record("摄像头", content) #show: doc => interview( title: [意大利面与42号混凝土], interviewee: [延边刺客], interview_time: datetime(year: 2024, month: 10, day: 8), interview_method: [线上收集(参见「存档名」)], archive_name: link("https://www.bilibili.com/video/BV1o8411x7aE/"), transcript: [GES233], meta_extra: ("时长": text(font: "Consolas", weight: 400, [00:01:44])), doc ) // 00:09 #B[拿着你的烟哇,哥?] // 00:10 #C[你先回答几个问题。] #B[你说。] #C[你多长时间没洗澡了?] #B[比基尼好看不好看。] // 00:25 #C[回答正确。] #C[张家口有没有外星人?] #B[抽烟有害健康。] #C[回答正确。] // 00:40 #A[他这种答案要是也能拿烟的话,那那我不拍了。] #follow[我不拍了,你们俩拍吧。] #follow[啊?我不敢苟同他的观点啊。] #C[那你说。] #A[ 我个人认为这个意大利面就应该拌 42 号混凝土, 因为这个螺丝钉的长度它很容易会直接影响到挖掘机的扭矩,你知道吧? ] #follow[ 你往里砸的时候,一瞬间,它就会产生大量的高能蛋白,俗称 UFO 。 ] #follow[ 会严重影响到经济的发展。 ] #follow[ 甚至对这个太平洋以及充电器都会造成一定的核. 核污染,你知道吧?啊? ] #follow[ 再者说根据这个勾股定理,你可以很容易的推断出, 人工饲养的东条英鸡,它是可以捕获野生的三角函数的。 ] #follow[ 所以说这个这个这个这个... 你不. 不管这个秦始皇的切面是否具有放射性, 特朗普的 n 次方是否含有沉淀物。 都不影响这个这个沃尔玛跟这个维尔康在南极会合。 ] #follow[啊?] #record("", "——私人笑声——")
https://github.com/howardlau1999/sysu-thesis-typst
https://raw.githubusercontent.com/howardlau1999/sysu-thesis-typst/master/functions/codeblock.typ
typst
MIT License
#let codeblock(raw, caption: none, outline: false) = { figure( if outline { rect(width: 100%)[ #set align(left) #raw ] } else { set align(left) raw }, caption: caption, kind: "code", supplement: "代码" ) }
https://github.com/quiode/CurriculumVitae
https://raw.githubusercontent.com/quiode/CurriculumVitae/main/CV.typ
typst
MIT License
// My actual CV #import "resume.typ": resume // resume template // general settings #set text(lang: "de") #set document(title: "Lebenslauf von <NAME>", author: "<NAME>") // resume import #show: doc => resume( doc, "<NAME>", headlines: ( ("10.03.2004, Bülach",), (link("mailto:<EMAIL>"),), (link("tel:+41787466828", "+41 78 746 68 28"),), ("Hofackerstrasse 3, 8722 Kaltbrunn",), ), avatar: "avatar.jpeg", experiences: ( (title: "Ausbildung", events: (( title: "ETH Zürich", location: none, date: (start: "2023", end: "jetzt"), description: [Bachelor Informatik], remark: "BP: 5.5", ), ( title: "Kantonsschule Wattwil", location: none, date: (start: "2018", end: "2022"), description: [ Schwerpunkt Physik und Anwendungen der Mathematik \ CodeCamp, Amnesty International ], remark: none, ))), ( title: "Berufserfahrung", events: ( ( title: "Praktikant in der Entwicklung", location: "c-alm AG", date: (start: "Dezember 2023", end: "August 2024"), description: [ Frontend mit Angular und Bootstrap, Backend mit Spring Boot und Apache POI \ Deployen von neuen Projekten mit Docker ], remark: none, ), ( title: "Praktikant Informatik", location: "Markant AG", date: (start: "Oktober 2019", end: none), description: [Einrichten von Arbeitsplätzen, IT-Support], remark: none, ), ), ), (title: "Weitere Erfahrungen", events: (( title: "Informatikschule 61 Frauenfeld", location: none, date: (start: "Juli 2022", end: "November 2022"), description: [Rekrutenschule Telematiksoldat], remark: none, ),)), ), custom: ((title: "Fähigkeiten", body: [ #grid(columns: (1fr, 1fr), [ === Sprachen Deutsch - Muttersprache \ Englisch - Fortgeschritten \ Französisch - Grundkenntnisse ], [ === Programmiersprachen und Frameworks Angular, Bootstrap, Springboot, Apache POI, Docker, Linux ]) ]),), )
https://github.com/fenjalien/metro
https://raw.githubusercontent.com/fenjalien/metro/main/tests/num/rounding/round-mode/test.typ
typst
Apache License 2.0
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: 1cm) = None #num(1.23456) #num(14.23) = Places #metro-setup(round-mode: "places", round-precision: 3) #num(1.23456) #num(14.23) = Figures #metro-setup(round-mode: "figures", round-precision: 3) #num(1.23456) #num(14.23)
https://github.com/maxgraw/bachelor
https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/5-implementation/external.typ
typst
In der Konzeption der Anwendung wurde bereits die Integration in das Shop-System von <NAME> berücksichtigt. Es wurde festgelegt, dass die Integration über eine interne Schnittstelle erfolgen soll. Hierbei wurde die Anwendung um das Menü "Einkaufen" erweitert. In der handleSelect-Funktion musste, wie bereits zuvor definiert, nur eine weitere Abfrage hinzugefügt werden, welche die handleShop-Funktion bei einem Tippen auf das Menü "Einkaufen" aufruft. Wie in @figure-handleShop dargestellt, beendet die Funktion die aktuelle XR-Session und leitet den Nutzer auf die Shop-Seite weiter. Hierbei wird ein dynamischer Link erstellt, der die ausgewählten Elemente in den Warenkorb legt. Die Schnittstelle basiert auf der URL-Ebene des Shopsystems. Um die korrekten Möbelstücke in den Warenkorb zu legen, werden die zuvor definierten Metadaten verwendet. #let code = ```js export const handleShop = async (config) => { // End the current XR session await config.renderer.xr.getSession().end(); // Create a new URL const url = new URL("", "https://woocommerce.maxpaszke.de"); url.searchParams.set("add-to-cart", "232"); // Add the selected items to the cart for (const item of config.options) { const quantity = config.selection.children.filter( (child) => child.userData.id === item.userData.id, ).length; if (quantity === 0) continue; url.searchParams.set(`quantity[${item.userData.id}]`, quantity); } // Redirect the user to the shop page window.location.href = url.href; }; ``` #figure( code, caption: [Auszug aus der Funktion "handleShop" vom @appendix-handleShop] ) <figure-handleShop> Um die Evaluation der Anwendung innerhalb der Arbeit von <NAME> zu ermöglichen und die Bewertung dieser Arbeit nicht zu beeinträchtigen, wurde, wie bereits zuvor beschrieben, eine eigene Web Component Klasse "ShopARElement" erstellt. Diese Klasse wurde in die zuvor beschriebene SvelteKit-Anwendung importiert und unter dem Pfad #link("https://ar.maxgraw.com/shop") veröffentlicht.
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Maths_Exercices_09_11_2023.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: "Maths Exercices 09 11 2023", authors: ( "<NAME>", ), date: "31 Octobre, 2023", ) #set heading(numbering: "1.1.") == Exercice 48 <exercice-48> + Soit $u_n eq 5 n^2 minus 2 lr((minus 1))^n$. On sait que $minus 1 lt.eq lr((minus 1))^n lt.eq 1$ pour tout $n$. Cela signifie que $minus 2 lr((minus 1))^n gt.eq minus 2$ pour tout $n$. Par conséquent, $5 n^2 minus 2 lr((minus 1))^n gt.eq 5 n^2 minus 2$ pour tout $n$. On sait également que $lim_(n arrow.r plus oo) lr((5 n^2 minus 2)) eq plus oo$. En appliquant le théorème de comparaison, on obtient que $lim_(n arrow.r plus oo) lr((5 n^2 minus 2 lr((minus 1))^n)) eq plus oo$. + Soit $u_n eq n^2 minus 2 n plus lr((minus 1))^(n plus 1)$. On sait que $minus 1 lt.eq lr((minus 1))^n lt.eq 1$ pour tout $n$. Cela signifie que pour n\=n+1$minus 1 lt.eq lr((minus 1))^(n plus 1) lt.eq 1$ par conséquent $n^2 minus 2 n minus 1 lt.eq lr((minus 1))^(n plus 1) lt.eq n^2 minus 2 n plus 1$ pour tout $n$ On sait que $lim_(n arrow.r plus oo) lr((n^2 minus 2 n minus 1)) eq lim_(n arrow.r plus oo) lr((n^2 lr((1 minus 2 / n minus 1 / n^2)))) eq plus oo$ car $lim_(n arrow.r plus oo) 1 / n^k eq 0$ pour $k in bb(N)^ast.basic$. En appliquant le théorème de comparaison, on obtient que $lim_(n arrow.r plus oo) lr((n^2 minus 2 n plus lr((minus 1))^(n plus 1))) eq plus oo$ + Soit $lr((minus 1))^n times sqrt(n) / n$. On sait que $minus 1 lt.eq lr((minus 1))^n lt.eq 1$ pour tout $n in bb(N)$. Donc $minus sqrt(n) / n lt.eq lr((minus 1))^n times sqrt(n) / n lt.eq sqrt(n) / n$. On sait également que $lim_(n arrow.r plus oo) minus sqrt(n) / n eq minus n^(1 slash 2) / n eq minus 1 / sqrt(n) eq 0$ et de manière analogue $lim_(n arrow.r plus oo) sqrt(n) / n eq 0$ En appliquant le théorème dit des gendarmes, on obtient que $lim_(n arrow.r plus oo) lr((minus 1))^n times sqrt(n) / n eq 0$
https://github.com/jhqiu21/Notes
https://raw.githubusercontent.com/jhqiu21/Notes/main/EC1101E%20Introduction%20to%20Economics%20Analysis/Typst/lecture%201.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: "Summary of Lecture 1", authors: ( "JINHANG",), date: "August 21, 2023", ) // We generated the example code below so you can see how // your document will look. Go ahead and replace it with // your own content! = Definition + *Scarce:* - Deficient in quantity compared with the demand. - Insufficient to satisfy needs or wants. + *Economics:* the study of choice under scarcity. + *Explicit cost:* monetary sacrifice. + *Implicit cost:* non-monetary sacrifice + *Microeconomics:* The study of how households and firms make decisions and how they interact in markets + *Macroeconomics:* The study of economy-wide phenomena, e.g., inflation, unemployment, and economic growth = Five Core Principles #lorem + Scarcity Implies Trade-Off - unlimited wants - limited resources - more of one good thing $equiv$ less of another + Bargaining Strength Comes Through Scarcity + Compare Costs and Benefits: An action should be taken if, and only if, the benefit is at least as great as the cost. + People Respond to Changes in Costs and Benefit - benefit $arrow.t$ likehood $arrow.t$ - cost $arrow.t$ likehood $arrow.b$ + Focus on Your Comparative Advantage = Economics + Positive Economics - speaking like a scientist - attempt to describe the world as it is - addresses the relatively narrow “What is?” question - can be answered with the tools of economics - NO interjecting any value judgment (whether the particular outcome is desirable or harmful) + Normative Economics - speaking like a policy advisor - attempt to prescribe how the world should be - addresses the much broader “What should be?” question - answers require value judgements - based on an underlying positive analysis - involves our view on ethics, religion, and political philosophy + Economists Disagree - Positive disagreements: differences in scientific judgments - Normative disagreements: differences in values = Production Possibilities Frontier + *Definition:* a graph that shows all combinations of two goods that can be produced given the available resources and technology + *Character: * - Moving along a PPF involves shifting resources from the production of one good to the production of the other good. - The slope of the PPF indicates the opportunity cost of good x in terms of good y - Economic growth shifts the PPF outward - If the opportunity cost of a good is constant, the PPF is a straight line. - PPF is concave - the opportunity cost of a good rises as the economy produces more of the good - different resources are suited for different uses, i.e., different resources have different opportunity costs of producing one good in terms of the other good. = Gains from Trade + Interdependence + Specialization and Exchange + Production Possibilities in Vietnam + Consumption With and Without Trade: Compare consumption without trade to consumption with trade. - see how much of each good is produced and traded by each country - use the table to calculate consumption with trade - produced - imported - exported - compare consumption without trade to consumption with trade + Absolute advantage: the ability to produce a good using fewer inputs than another producer. - If each country has an absolute advantage in one good and specializes in that good, then both countries can gain from trade. - measures the cost of a good in terms of the inputs required to produce it + Comparative advantage: the ability to produce a good at a lower opportunity cost than another producer. - Absolute advantage is NOT necessary for comparative advantage! - Gains from trade arise from comparative advantage - When each country specializes in the good in which it has a comparative advantage $arrow$ total production in all countries $arrow.t$ $arrow$ world’s economic pie $arrow.t$ $arrow$ all countries can gain from trade. - individuals specializing in different goods or services and trading with one another
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/syntaxes/textmate/tests/unit/bugs/hover.typ
typst
Apache License 2.0
#let code(it, args: any, res: none, scope: (:));
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Maths_Exercices_25_03_2024.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: "Maths Exercices", authors: ( "<NAME>", ), date: "25 Mars, 2024", ) #set heading(numbering: "1.1.") == Exercice 61 p 263 === 1. $F$ représente la primitive de la fontion $t->(2-t)ln (t)$ qui s'annule en $x=1$ === 2. On a donc $F$ dérivable sur $[1;2]$ et qui a pour dérivée la fonction $F(x)'=(2-x)ln (x)$ $(2-x)ln (x) gt.eq 0$ $forall x in [1;2], 2-x gt.eq 0$ et $forall x in [1;2], ln(x) gt.eq 0$ Donc $F'$ est positive ou nulle sur $[1;2]$ et ainsi $F$ est croissante sur $[1;2]$ === 3. On a $F(1)=0$ et $F$ croissante sur $[1;2]$ par conséquent $forall x in [1;2], F(x) gt.eq F(1) gt.eq 0$
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/par-justify-01.typ
typst
Other
// Test that lines with hard breaks aren't justified. #set par(justify: true) A B C \ D
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/grotesk-cv/0.1.6/template/cv.typ
typst
Apache License 2.0
#import "@preview/grotesk-cv:0.1.6": cv #let metadata = toml("info.toml") #let import-sections( sections, ) = { for section in sections { include { "content/" + section + ".typ" } } } #let left-pane = ( "profile", "experience", "education", ) #let right-pane = ( "skills", "languages", "other_experience", "references", ) #show: cv.with( metadata, use-photo: true, left-pane: import-sections(left-pane), right-pane: import-sections(right-pane), left-pane-proportion: 71%, )
https://github.com/avonmoll/bamdone-rebuttal
https://raw.githubusercontent.com/avonmoll/bamdone-rebuttal/main/lib.typ
typst
MIT No Attribution
// heavily inspired by <NAME>, https://zenkelab.org/resources/latex-rebuttal-response-to-reviewers-template/ #let rc = counter("reviewer") #let pc = counter("point") #let reviewer() = { rc.step() pc.update(0) line(length: 100%) [= Reviewer #context rc.display()] } #let configure( point-color: blue.darken(30%), response-color: black, new-color: green.darken(30%), ) = { let point(color: point-color, body) = figure( { pc.step() let pc_ = context pc.get().at(0) let rc_ = context rc.get().at(0) set text(color) set align(left) [*Point #rc_.#pc_* --- #body] }, kind: "point-outer", supplement: [Point], ) let response(color: response-color, body) = text(color)[*Response* --- #body] let new(color: new-color, body) = text(color, body) ( point: point, response: response, new: new, ) } #let rebuttal( // The document's title. title: [Response Letter], // Content containing list of authors authors: [], date: datetime.today().display(), // The article's paper size. Also affects the margins. paper-size: "us-letter", // The paper's content. body, ) = { set page( numbering: "1", number-align: center, paper: "us-letter", ) set text(11pt) set par(justify: true) // Quotation Formatting set quote(block: true) show quote: set pad(left: 2em) show quote: set block( fill: black.transparentize(90%), width: 100%, inset: 5pt, radius: 1pt, ) show figure.where(kind: "point"): set block(breakable: true) show figure.where(kind: "point"): it => align(left,block(it)) // inspired by i-figured show figure.where(kind: "point-outer"): it => { let rc_ = rc.at(it.location()).at(0) let pc_ = pc.at(it.location()).at(0) + 1 let figure = figure( it.body, kind: "point", supplement: it.supplement, numbering: nums => numbering("1.1", rc_, pc_), ) if it.has("label") { let new-label = label("pt-" + str(it.label)) [#figure #new-label] } else [ #figure ] } align(center)[ = #title #authors\ #date ] body }
https://github.com/EricWay1024/Homological-Algebra-Notes
https://raw.githubusercontent.com/EricWay1024/Homological-Algebra-Notes/master/libs/color.typ
typst
#import "@preview/ctheorems:1.1.2": * #let theorem = thmbox( "theorem", "Theorem", fill: rgb("#e8e8f8"), breakable: true, separator: [#h(0em).#h(0.2em)], ) #let lemma = thmbox( "theorem", "Lemma", fill: rgb("#e8e8f8"), breakable: true, separator: [#h(0em).#h(0.2em)], ) #let proposition = thmbox( "theorem", "Proposition", fill: rgb("#e8e8f8"), breakable: true, separator: [#h(0em).#h(0.2em)], ) #let definition = thmbox( "theorem", "Definition", fill: rgb("#e8f8e8"), breakable: true, separator: [#h(0em).#h(0.2em)], ) #let example = thmbox( "theorem", "Example", stroke: rgb("#ffaaaa") + 1pt, breakable: true, separator: [#h(0em).#h(0.2em)], ) #let remark = thmplain( "theorem", "Remark", // stroke: rgb("#aaaaff") + 1pt, breakable: true, separator: [#h(0em).#h(0.2em)], ) #let notation = thmplain( "theorem", "Notation", // stroke: rgb("#aaaaff") + 1pt, breakable: true, separator: [#h(0em).#h(0.2em)], ) #let note = thmplain( "theorem", "Note", // stroke: rgb("#aaffaa") + 1pt, breakable: true, separator: [#h(0em).#h(0.2em)], ) #let corollary = thmbox( "theorem", "Corollary", fill: rgb("#e8e8f8"), breakable: true, separator: [#h(0em).#h(0.2em)], )
https://github.com/JJ-IsShort/typst-math-paper
https://raw.githubusercontent.com/JJ-IsShort/typst-math-paper/main/site/equations.typ
typst
#import "template.typ": * #import "@preview/physica:0.9.3": * #show: project.with( title: "An Overview of Constraint Based Physics Solving", authors: ("<NAME>",) ) #heading("Introduction", bookmarked: true, depth: 1, outlined: true) In this paper, I will try and explain how constraint based physics solvers work as well as trying to derive a few constraints and showcase their implementations. I decided on this as my topic because I have always like physics simulations but whenever I've tried to write my own I've had serious numerical stability issues and even when the simulations stayed stable for a bit they looked wrong. I recently found out why. I haven't found many resources on how to program a proper physics simulation, and even less easy to understand resources. I am hoping that putting together this paper and these simulations will both act as a resource for others and will help me understand these concepts better for future simulations I may want to write. #pagebreak() #heading("Background", bookmarked: true, depth: 1, outlined: true) Physics solvers can be found everywhere, from Disney movies to our video games and from scientific research to computer simulations designed for no reason other than to look pretty (and get views on YouTube). In many of these applications, the quality of the physics simulation is extremely important. Disney wouldn't want to set their computers simulating the hair of characters for the day or two needed to get the quality they want and then find that the hair just jumped around weirdly or had numerical stability issues. Even in some games, the quality of the physics is important. For instance in the Poly Bridge series of games, the bridges that the player must build break if they experience too much force. There is a type of physics solver that often gets implemented that simply will not do for most of these applications. #pagebreak() #heading("Solver Types", bookmarked: true, depth: 1, outlined: true) Impulse based physics solvers simply modify a velocity of acceleration parameter in a multitude of ways depending on the simulations requirements (gravity, collisions, etc) and then, as a final step, use an integrator like Verlet Integration or any of the RK4 Integrators (or if they don't care about quality, Euler Integration). These kinds of physics solvers often are of lower quality. For instance, the developers of the Poly Bridge game series wouldn't have gotten accurate force data if they used an Impulse Solver. With Impulse Solvers, multiple sources of force can conflict and result in odd behavior. #linebreak() Constraint Based Solvers first apply all the forces applied on an object, just like Impulse Solvers, except that when applying constraints like collision or distance constraints, in other words the rules which the simulation absolutely must not and can not break, it does those in a separate step. In this step, it takes information from each constraint present in the simulation and gathers them together. Then it uses the force applied by force generators and the constraint information to find the force that needs to be applied to keep those constraints valid as much as possible. By doing these steps separately and by using the unconstrained force to calculate a second corrective force, the constraints can be enforced in a much more rigorous way. You don't get issues like the forces of gravity in a stack of objects being so strong that they overcome the collision forces in the lower objects and push them into each other. #pagebreak() #heading("Simulations", bookmarked: true, depth: 1, outlined: true) This paper is being put together by Typst as an alternative to LaTeX for formating and Raylib-rs compiled to WebAssembly for the interactivity and is being stitched together on a website using javascript. This allows me to create these sections with all sorts of content as well as sections that contain a (possibly interactive) simulation to show the equations in practice. For each of these simulations I will use Verlet Integration. The details of how it works aren't really needed for this paper. Its main advantages are how easy it is to implement, how incredibly numerically stable it is (especially when compared to Euler Integration which is what I was using before), how it doesn't lose energy with time, and how it is able to easily and as a property of the method itself conserve momentum without having to explicitly write it into other parts of the physics implementation. This will remove the need to write restitution factors into our simulation, simplifying it greatly. The previous simulation showcases a basic Impulse Solver. The gravity is being applied the same way it would be in most Constraint Solvers, but inter-object collision is missing entirely, and the two constraints that are built in (try clicking and dragging on it) are prone to the issues inherent in Impulse Solvers, such as several sources of movement fighting against each other and the constraints that your simulations aren't supposed to break get broken often. In this paper, those three constraints will be implemented, and more if there is time, in a much more rigorous way than implemented in the above simulation. #pagebreak() #heading("Derivation", bookmarked: true, depth: 1, outlined: true) In this section I will go quickly over how we find the equation that gives us our corrective/constraint force $F_c$. First we should define a constraint. The idea behind a constraint is that it is a function that always evaluates too 0. In other words: #align(center)[ $C = 0$ (Position constraint)\ $dot.basic(C) = 0$ (Velocity constraint)\ $dot.double(C) = 0$ (Acceleration constraint) ] This is the kind of notation you should get used to seeing. Typically a variable without and dot notation is referring to position, while one and two dots ($dot.basic(C)$ and $dot.double(C)$) refer to velocity and acceleration. So the goal is to find a vector which will bring the constraint back to 0. Let us first think about what the force $F_c$ is. It is a direction times a magnitude: $F_c = lambda N$. We can compute $N$, and this is how. $N = J^TT$ where $J$ is the Jacobian of the constraint. Let's break this down. The Jacobian just means that this matrix shows how much a change in the input simulation state values will change the value of the constraint. In other words: #let C = "C" #align(center)[ $#partialderivative(C, "q") = jmat(C; "q"_x, "q"_y, "q"_z)$ ] Where $q$ is a list of the x, y and z positions of a particle. To help visualize this, let's imagine a 1D world with two particles. They have a constraint that tries to make them overlap. This means that $C(x_1,x_2) = x_1-x_2=0$ where $x_1$ and $x_2$ are the positions in 1D of the particles. If we find the Jacobian, we would get $vecrow(1,-1)$. This is a simplified example of finding the Jacobian. #linebreak() The next step is to explain a new variable, $W$ or the effective mass. $W = M^(-1)$ where $M$ is the mass matrix. And now to explain the mass matrix, which will change our understanding of the $q$ vector. It is a lot better to compute the force needed to correct all the objects all at once. As such, the entire state of the whole simulation gets used instead of the single particle that it has seemed like we are using. $M$ isn't just the mass of one particle, it's:\ #align(center)[ $M = mat( m_"1x", , , , ; , m_"1y", , , ; , , m_"1z", , ; , , , dots.down, ; , , , , m_"nx"; , , , , , m_"ny"; , , , , , , m_"nz"; )$ ] Here, each element is the inertia of a particle in one axis and the values are grouped with the other inertia values from the same object. This example is 3 dimensional. With this approach of representing the whole state, $q$ becomes: #align(center)[ $q = vecrow(x_"1x",x_"1y",x_"1z",x_"2x",x_"2y",x_"2z",...,x_"nx",x_"ny",x_"nz")$ ] Where $n$ is the index of the particle. I'm going to leave the concept of the global state of the simulation behind for a bit since it was only needed to explain why mass is a matrix. Just understand that when I talk about the positions of the particles $q$, even if I show them as only 2 or 3 values depending on how many dimensions I use for the calculation, they are actually all the positions of all the particles. // Add sources for this whole section to the slides and lecture notes. Notes are about the world vector thing. Slides are the individual equations #linebreak() Anyways, now we have $F_c=J^TT lambda$. We have the direction to apply the forces and with what intensity relative to others, however, we still need the magnitude multiplier. This is where I have to point out another caveat. This approach is how we can solve constraints in a computer. Technically, there is a different approach // Add sources to point to the slides. To show the other approach. that gives an exact solution, but it is not the best approach for simulating for various reasons like not being as resistant to errors that would crop up in the imperfect world of the simulation. With that in mind, how should we best approximate the $F_c$ and really the $lambda$ in the world of computers? We can use $[J W J^TT]lambda =-dot.basic(J) dot.basic(q)-[J W]Q$ where $Q$ is similar to $q$ except that it is a force in each axis that was applied to each object this physics step before the correction force is applied. Since everything except $lambda$ is defined, the equation can be thought of as $A lambda=B$ or in other words, a linear system of equations. This is possible to solve in code using the conjugate gradient method. Implementing this method from the pseudocode and Julia code provided on the Wikipedia page //Add sources here to the wiki was the hardest part of this whole project, though the main difficulty came from trying to use a pre written implementation instead of writing my own. Once I got to it it took me maybe a few hours. This means that if I needed to, armed with the knowledge of the path to take, I could probably get a full physics engine written in less than a week, and maybe you could too. There is still the $-dot.basic(J) dot.basic(q)$ term which is a bit scary, but luckily what the $dot.basic(J)$ means is $pdv(J,q,t)$ which will, in most cases, be 0. If we have time, we might look at an instance where it isn't 0, but it is also an edge case. This means that we get $[J W J^TT]lambda =-[J W]Q$. This, again, should be fairly easy to implement in code through matrix math libraries and the conjugate gradient solver. #linebreak() There is another element to this, where any errors need to be corrected for. This can be done easily with Baumgarte Stabilization// Add sources to the video but it is not involving Calculus IV topics so we will brush over this. #pagebreak() #heading("Examples", bookmarked: true, depth: 1, outlined: true) Now lets look at some constraints. We will re formulate the constraints that were there before, namely, the border and the cursor interaction constraints. First, lets look at what a conditional constraint even looks like, as the previous way to look at the constraints didn't allow them to only activate when a collision is happening. The solution is that we only apply the constraint if we detect a collision and otherwise ignore it. Lets only look at one axis. In this simulation, the floor is in the positive Y direction. To detect the collisions, we first make sure that the mouse isn't being pressed, as that is an element of the constraint, then we check if the position of an object is more or equal to the maximum extent of the screen in the Y axis. Now that we have a collision check, lets define $C$. #align(center)[ $C = 640 - a_y$ ] Where $a_y$ is the object's position on the Y axis. This then means that we need to find the Jacobian of this, and since it is an $RR => RR$ function, the Jacobian is actually just the derivative. #align(center)[ $dv(C,a_y) = -1$ ] This means that when our objects are colliding with the floor, value of the derivative in the Y axis is $-1$. In practice, the Jacobian is multiplied by $0.5$ because that gives the constraint bounciness. #linebreak() For the circular constraint, once again, we need to figure out when the constraint needs to be applied. It is only needed when the distance between the mouse position and the object is more than the following distance, which we can call $l$. We sill use a slightly different approach to finding the Jacobian here. This way is more generalized. We will find $dv(C, t)$ and use $dv(C,t) = J v$ where $v$ is a list of all the positions of the objects involved in this constraint. // Add sources to the other paper If we then define $C$ as #align(center)[ $C = 1/2(abs(p_"b" - p_"a")^2 - l^2)$ ] where $p_a$ and $p_b$ are the positions of the objects. The $1/2$ and squares just make the derivation easier. Continuing on, we can set $p_"ab" = p_b - p_a$ which lets us simplify this into #align(center)[ $C = 1/2(abs(p_"ab")^2 - l^2)$ ] This is fairly easy to handle and to derive: #align(center)[ $dot.basic(C) = dv(,t) 1/2 abs(p_"ab")^2\ = p_"ab" dv(,t) p_"ab"\ = (p_"b" - p_"a") dot.c (dv(,t)p_b - dv(,t)p_a)$ ] And we can get $dv(,t)p_i$ from the first derivative of position, or velocity of the objects: #align(center)[ $dot.basic(C) = (p_"b" - p_"a") dot.c (v_b - v_a)$ ] Then we need to factor out $v$ to get $J$: #align(center)[ $dot.basic(C) = (p_"b" - p_"a") dot.c v_b - (p_"b" - p_"a") dot.c v_a$ ] Meaning that if we take $v$ to be $vec(v_a,v_b)$ we get a Jacobian of $vec(-(p_b - p_a),(p_b - p_a)) ^ TT$. This is our constraint Jacobian for both objects in both dimensions. We can just ignore whichever side is connected to the mouse and only move one end of the constraint and we have a mouse following constraint. #pagebreak() #heading("Conclusion", bookmarked: true, depth: 1, outlined: true) The way that this was implemented is simply the most Calculus IV reliant method I could find, since every constraint needs to only be defined by its Jacobian, but it isn't flawless. For one, Baumgarte Stabilization is quite difficult to get correct using this position constraint based solver. Baumgarte Stabilization allows the simulation to not just avoid breaking a constraint, but also restore a constraint if it gets broken, whether it be because of something that can't be controlled by physics (like user input) knocking things around in the simulation, or just round-off errors because of how computers do math. There are better solutions out there, which rely less heavily on Calculus IV and if you do find this interesting, I recommend looking through my sources and doing research on your own. I will most likely be exploring the topic more as well. Have fun! #pagebreak() #heading("Bibliography", bookmarked: true, depth: 1, outlined: true) #bibliography("My Library 2.bib", full: true, style: "modern-language-association-8", title: none)
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/smartquotes_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 25-35 expected 2 quotes, found 4 quotes // #set smartquote(quotes: ("'",) * 4)
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/par-indent_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set par(hanging-indent: 1em) Welcome \ here. Does this work well?
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/edu/seminars/2024-09-11.typ
typst
= Введение Препод: <NAME> Email: `<EMAIL>` Нет четкой параллели между лекциями и семинарами Семинары о разработке занятий $ "Итог" = 0.5 dot "Задание" + 0.3 dot "Текущие" + 0.2 dot "Посещаемость" $ + Посещаемость + пунктуальность + Выполнение текущих заданий (их мало) - Работа с книгой - Работа с фильмами + Выполнение итогового задания Работа на семинарах поможет в итоговой работе Итоговый проект либо в парах, либо в одиночку Используем MTS Link и Miro = Современное образование Мегатренды: + Демографические диспропорции + Высокий темп урбанизации + Изменения в экономике и глобальный дисбаланс ресурсов + Конвергенции новый технологий: нано, био, ... + Пересмотр этический норм + Изменение модели взаимодействия государства и гражданина + Изменение структуры и роли семьи Контекст образования напрямую связан с требованиями к сотруднику Концепция BANI мира = Универсальные компетенции и грамотность Компетентность --- интегрированный набор знаний, навыков и деятельностных установок - Знания --- это факты, цифры, идеи, теории - Навыки --- это способности совершать конкретные действия - Деятельностное установки --- принципы, опираясь на которые человек реагирует на идеи, людей, ситуации Компетентность --- это мастерство в решении определенных задач Универсальные компетентности - Компетентность мышления - Компетентность взаимодействия с собой - Компетентность взаимодействия с другими людьми - Компетенция (более узкое) --- для конкретной работы, задачи - Компетентность (более широкое) --- способность применять свои навыки для разных ситуаций Проблема переноса: есть знания, но не знают, как приложить *4k*: - Критическое мышление - Креативноcть - Коммуникация - Кооперация = Принципы современного образования - Понимание, вместо запоминания - Развитие самостоятельности - Способы, вместо решения - Высокий уровень адаптивности - Акцент на навыке коммуникации == Активное и пассивное обучение - Пассивное --- основное делает учитель - Активное --- основное делает ученик Обычно подходы используются совместно == Новые роли учителя и ученика Учитель больше не носитель знаний, наставник Ученик --- активный участник процессор
https://github.com/DieracDelta/presentations
https://raw.githubusercontent.com/DieracDelta/presentations/master/polylux/tests/subslides.typ
typst
#import "../polylux.typ": * #set page(paper: "presentation-16-9") #set text(size: 50pt) #polylux-slide[ == `alternatives-fn` #alternatives-fn(start: 1, end: 8, subslide => [#subslide]) #uncover(3)[only on 3] #uncover("10,11-")[from 10 on] ] #polylux-slide[ == `pause` a #pause a #pause a ] #polylux-slide[ Can you see me? ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/linguify/0.4.1/lib/lib.typ
typst
Apache License 2.0
#import "linguify.typ" as lflib #import "linguify.typ": set-database, reset-database, linguify, #import "fluent.typ": load_ftl_data #import "utils.typ" #import "utils.typ": if-auto-then
https://github.com/benjamineeckh/kul-typst-template
https://raw.githubusercontent.com/benjamineeckh/kul-typst-template/main/src/core/component/outline.typ
typst
MIT License
#let insert-outline(non-odd-page-headers, lang: "en") = { // Table of contents // Outline customization let outline-color = red.darken(10%) // let outline-color = black show outline.entry: it => { link(it.element.location(), text(outline-color)[#it.body]) [ ] box(width: 1fr, it.fill) [ ] box( width: measure[9999].width, align(right, it.page), ) } show outline.entry.where(level: 1): it => { v(12pt, weak: true) let body = if it.element.numbering != none { numbering(it.element.numbering, ..counter(it.element.func()).at(it.element.location())) [ ] it.element.body } else { it.body } link(it.element.location(), strong(text(outline-color)[#body])) h(1fr) it.page } show outline: set heading(numbering:none, outlined: false) let title = if lang == "nl"{ "Inhoudsopgave" }else{ "Contents" } outline(title: title, depth: 2, indent: true, fill:repeat(" . ")) pagebreak(weak: true) }
https://github.com/alberto-lazari/computer-science
https://raw.githubusercontent.com/alberto-lazari/computer-science/main/advanced-topics-cs/quantum-algorithms/chapters/amplitude-amplification.typ
typst
#import "/common.typ": * = Amplitude amplification Amplitude amplification is a technique used to distinguish a good state $ket(psi_G)$ from a bad state $ket(psi_B)$ by flipping the sign of $ket(psi_G)$, in order to find a state that has a large overlap with $ket(psi_G)$. == Grover's black-box search algorithm A special case of amplitude amplification is Grover's black-box search algorithm. Let $f : {0, 1}^n -> {0, 1}$ be an unknown function, that takes as input an $n$-qubits binary string and outputs 1 for a unique string $lstr$, 0 otherwise. $ f(arrow(x)) = cases( 1 quad "if" arrow(x) = lstr, 0 quad "otherwise" ) $ The good state $ket(psi_G)$ searched by the algorithm is the one in which $f(arrow(x))$ returns 1. It does it by repeatedly brute forcing every possible string and amplifying the good state at every step, until the probability of obtaining $lstr$ from a measurement is almost 1. === Complexity The optimal number of iterations $k$ is around $pi / 4 sqrt(2^n) ==> O(2^(n / 2))$. Compared to a classic algorithm with complexity $O(2^n)$, the quantum version provides a quadratic speedup.
https://github.com/Servostar/dhbw-abb-typst-template
https://raw.githubusercontent.com/Servostar/dhbw-abb-typst-template/main/template/main.typ
typst
MIT License
#import "../src/lib.typ": * #import "abstract.typ": abstract, summary #show: dhbw-template.with(( lang: "de", region: "de", draft: false, author: ( name: "<NAME>", semester: 4, program: "Informationtechnology", course: "TINF19IT1", faculty: "Technik", university: "DHBW Mannheim", company: "ABB AG", supervisor: "<NAME>", matriculation-number: 123456789, ), thesis: ( title: "Unofficial ABB/DHBW Typst template", subtitle: "for reports and thesises", submission-date: "23rd march 2020", timeframe: "1st january 2020 - 20th march 2020", kind: "T2000", summary: summary, abstract: abstract, preface: include "preface.typ", keywords: ("IT", "other stuff"), bibliography: bibliography("refs.bib"), glossary: yaml("glossary.yml"), appendices: include "appendix.typ", ), )) #import "@preview/wrap-it:0.1.0": wrap-content = Lorem Ipsum #text(fill: ABB-RED, "Hello ABB branding") #lorem(25) @oidc @potato #lorem(100) @Anhang-A == Lorem Ipsum 2 #lorem(200) @einstein = Lorem Ipsum 3 <sec:hello> #lorem(15) t `Hello, World!` #lorem(50) $ angle.l a, b angle.r &= arrow(a) dot arrow(b) \ &= a_1 b_1 + a_2 b_2 + ... a_n b_n \ &= sum_(i=1)^n a_i b_i. \ integral_2^4(3x + 4x^2) $ #lorem(140) #wrap-content( figure(image("assets/digitaldog.jpg", width: 200pt), caption: [ Some image caption ]), lorem(200), ) #url("https://github.com", "text") @sec:hello #lorem(50) #figure( table( columns: 3, table.header[Date][Exercise Type][Calories Burned], [2023-03-15], [Swimming], [400], [2023-03-17], [Weightlifting], [250], [2023-03-18], [Yoga], [200], [2023-03-15], [Swimming], [400], [2023-03-17], [Weightlifting], [250], [2023-03-18], [Yoga], [200], [2023-03-15], [Swimming], [400], [2023-03-17], [Weightlifting], [250], [2023-03-18], [Yoga], [200], ), caption: [ Some table ], ) #pagebreak() #lorem(100) #inline-color("#ff0000", "red") @HTTP #figure( ```rust use std::env; use std::fs::OpenOptions; use std::io::Write; fn main() { println!("Hello, World!!!"); } ```, caption: [Some code], ) #lorem(100) #pagebreak() = Conclusion #lorem(320)
https://github.com/fatihcatalkaya/java-typst
https://raw.githubusercontent.com/fatihcatalkaya/java-typst/master/README.md
markdown
Apache License 2.0
# Java Typst This library allows to render [Typst](https://typst.app/) templates using native Java functions. The intention, which lead to the development of this library was, to use Typst as a templating engine for PDF file generation. This library heavily relies on previous work from [<NAME>'s typst-as-a-library](https://github.com/tfachmann/typst-as-library). I have modified it, such that it uses the embedded fonts from the [typst-assets](https://crates.io/crates/typst-assets) crate. The package can be easily used by including the following snipped in your pom.xml ```xml <dependency> <groupId>io.github.fatihcatalkaya</groupId> <artifactId>java-typst</artifactId> <version>1.0.0</version> </dependency> ```
https://github.com/cu1ch3n/caidan
https://raw.githubusercontent.com/cu1ch3n/caidan/main/lib.typ
typst
MIT License
#import "nord.typ": * #let en_text(size, body, fill: nord3, style: "italic") = text( font: "Ysabeau Infant", size: size, style: style, fill: fill, weight: "light", )[#body] #let zh_text(size, body, fill: nord0) = text( font: "LXGW Wenkai", size: size, fill: fill, weight: "light", )[#body] #let cuisine(name_zh, name_en) = align(center)[ #v(.5em) #zh_text(16pt)[#name_zh] \ #en_text(10pt)[#name_en] #v(.3em) ] #let item(name_zh, name_en) = box[ #zh_text(14pt)[#name_zh #h(1fr)] \ #v(-.7em)#h(.14em)#en_text(10pt)[#name_en]#v(.3em) ] #let caidan( title: none, cover_image: none, update_date: none, page_height: 595.28pt, page_width: 841.89pt, num_columns: 3, body, ) = { let frame_font_size = 40pt let frame_format = c => text( c, font: "WebOMints GD", size: frame_font_size, fill: nord3, ) let frame = ( chars: ([E], [F], [G], [H]), dx: 1em, dy: 2em, ) let dx = (1, -1, 1, -1) let dy = (1, 1, -1, -1) let border_x = (left, right, left, right) let border_y = (top, top, bottom, bottom) let column_width = page_width / num_columns let frame_vert_line = line( length: page_height - 2 * (frame.dy + frame_font_size), angle: 90deg, stroke: 1pt + nord3, ) let frame_vert_line_dy = frame.dy + frame_font_size + .5em let frame_horiz_line = line( length: column_width - 2 * (frame.dx + frame_font_size) - .6em, stroke: 1pt + nord3, ) let frame_horiz_line_dx = frame.dx + frame_font_size + .3em let separator_vert_line = line( length: page_height, angle: 90deg, stroke: (paint: nord0, thickness: .5pt, dash: "dashed"), ) set page( fill: nord6, height: page_height, width: page_width, margin: (x: frame.dx + 2em, y: frame.dy + 4em), background: [ // separator lines #for i in range(num_columns - 1) { place( top + left, dx: (i + 1) * column_width, separator_vert_line, ) } // frame #for i in range(num_columns) { let offset_xl = i * column_width let offset_xr = (num_columns - i - 1) * column_width // frame characters for j in range(4) { place( border_x.at(j) + border_y.at(j), dx: dx.at(j) * (offset_xl + frame.dx), dy: dy.at(j) * frame.dy, frame_format(frame.chars.at(j)), ) } // left frame line place( top + left, dx: offset_xl + frame.dx + 7pt, dy: frame_vert_line_dy, frame_vert_line, ) // right frame line place( top + right, dx: -(offset_xr + 2 * frame.dx) + 4pt, dy: frame_vert_line_dy, frame_vert_line, ) // top frame line place( top + left, dx: offset_xl + frame_horiz_line_dx, dy: frame.dy + 4pt, frame_horiz_line, ) // bottom frame line place( bottom + left, dx: offset_xl + frame_horiz_line_dx, dy: -frame.dy + 4pt, frame_horiz_line, ) // page numbering place( bottom + left, dx: offset_xl + 0.5 * column_width, dy: -frame.dy - 1em, context { let num = (counter(page).get().at(0) - 1) * 3 + i if num != 0 { en_text(10pt, style: "normal")[#numbering("I", num)] } }, ) } ], ) let title_page = context { set align(center) let title_content = { title if cover_image != none { v(3em) let img_width = measure(cover_image).width let max_img_width = column_width - 2 * frame.dx - 6em if img_width.pt() > max_img_width.abs.pt() { set image(width: column_width - 2 * frame.dx - 6em) cover_image } else { cover_image } } if update_date != none { v(5em) zh_text(10pt)[ 更新于:#update_date.display("[year]年[month padding:none]月[day padding:none]日") ] linebreak() en_text(8pt)[ Updated on #update_date.display("[month repr:long] [day], [year]")] } } let text_dy = ( page_height - measure(title_content).height ) / 2 - frame.dy - 2em if title != none or cover_image != none or update_date != none { v(text_dy) title_content } } set list(marker: [#v(.7em)#en_text(16pt, fill: nord3)[☐]]) columns( num_columns, gutter: frame.dx * 2 + 4em, )[#title_page #colbreak(weak: true) #body] }
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/012.%20taste.html.typ
typst
#set page( paper: "a5", margin: (x: 1.8cm, y: 1.5cm), ) #set text( font: "Liberation Serif", size: 10pt, hyphenate: false ) #set par(justify: true) #set quote(block: true) #v(10pt) = Taste for Makers #v(10pt) _February 2002_ #quote(attribution: [<NAME>, The Copernican Revolution])["...Copernicus' aesthetic objections to [equants] provided one essential motive for his rejection of the Ptolemaic system...."] #quote(attribution: [<NAME>, Skunk Works])["All of us had been trained by <NAME> and believed fanatically in his insistence that an airplane that looked beautiful would fly the same way."] #quote(attribution: [<NAME>, A Mathematician's Apology])["Beauty is the first test: there is no permanent place in this world for ugly mathematics."] I was talking recently to a friend who teaches at MIT. His field is hot now and every year he is inundated by applications from would-be graduate students. _"A lot of them seem smart,"_ he said. _"What I can't tell is whether they have any kind of taste."_ Taste. You don't hear that word much now. And yet we still need the underlying concept, whatever we call it. What my friend meant was that he wanted students who were not just good technicians, but who could use their technical knowledge to design beautiful things. Mathematicians call good work "beautiful," and so, either now or in the past, have scientists, engineers, musicians, architects, designers, writers, and painters. Is it just a coincidence that they used the same word, or is there some overlap in what they meant? If there is an overlap, can we use one field's discoveries about beauty to help us in another? For those of us who design things, these are not just theoretical questions. If there is such a thing as beauty, we need to be able to recognize it. We need good taste to make good things. Instead of treating beauty as an airy abstraction, to be either blathered about or avoided depending on how one feels about airy abstractions, let's try considering it as a practical question: _how do you make good stuff?_ If you mention taste nowadays, a lot of people will tell you that "taste is subjective." They believe this because it really feels that way to them. When they like something, they have no idea why. It could be because it's beautiful, or because their mother had one, or because they saw a movie star with one in a magazine, or because they know it's expensive. Their thoughts are a tangle of unexamined impulses. Most of us are encouraged, as children, to leave this tangle unexamined. If you make fun of your little brother for coloring people green in his coloring book, your mother is likely to tell you something like "you like to do it your way and he likes to do it his way." Your mother at this point is not trying to teach you important truths about aesthetics. She's trying to get the two of you to stop bickering. Like many of the half-truths adults tell us, this one contradicts other things they tell us. After dinning into you that taste is merely a matter of personal preference, they take you to the museum and tell you that you should pay attention because Leonardo is a great artist. What goes through the kid's head at this point? What does he think "great artist" means? After having been told for years that everyone just likes to do things their own way, he is unlikely to head straight for the conclusion that a great artist is someone whose work is better than the others'. A far more likely theory, in his Ptolemaic model of the universe, is that a great artist is something that's good for you, like broccoli, because someone said so in a book. Saying that taste is just personal preference is a good way to prevent disputes. The trouble is, it's not true. You feel this when you start to design things. Whatever job people do, they naturally want to do better. Football players like to win games. CEOs like to increase earnings. It's a matter of pride, and a real pleasure, to get better at your job. But if your job is to design things, and there is no such thing as beauty, then there is no way to get better at your job. If taste is just personal preference, then everyone's is already perfect: you like whatever you like, and that's it. As in any job, as you continue to design things, you'll get better at it. Your tastes will change. And, like anyone who gets better at their job, you'll know you're getting better. If so, your old tastes were not merely different, but worse. Poof goes the axiom that taste can't be wrong. Relativism is fashionable at the moment, and that may hamper you from thinking about taste, even as yours grows. But if you come out of the closet and admit, at least to yourself, that there is such a thing as good and bad design, then you can start to study good design in detail. How has your taste changed? When you made mistakes, what caused you to make them? What have other people learned about design? Once you start to examine the question, it's surprising how much different fields' ideas of beauty have in common. The same principles of good design crop up again and again. == Good design is simple. You hear this from math to painting. In math it means that a shorter proof tends to be a better one. Where axioms are concerned, especially, less is more. It means much the same thing in programming. For architects and designers it means that beauty should depend on a few carefully chosen structural elements rather than a profusion of superficial ornament. (Ornament is not in itself bad, only when it's camouflage on insipid form.) Similarly, in painting, a still life of a few carefully observed and solidly modelled objects will tend to be more interesting than a stretch of flashy but mindlessly repetitive painting of, say, a lace collar. In writing it means: say what you mean and say it briefly. It seems strange to have to emphasize simplicity. You'd think simple would be the default. Ornate is more work. But something seems to come over people when they try to be creative. Beginning writers adopt a pompous tone that doesn't sound anything like the way they speak. Designers trying to be artistic resort to swooshes and curlicues. Painters discover that they're expressionists. It's all evasion. Underneath the long words or the "expressive" brush strokes, there is not much going on, and that's frightening. When you're forced to be simple, you're forced to face the real problem. When you can't deliver ornament, you have to deliver substance. == Good design is timeless. In math, every proof is timeless unless it contains a mistake. So what does Hardy mean when he says there is no permanent place for ugly mathematics? He means the same thing <NAME> did: if something is ugly, it can't be the best solution. There must be a better one, and eventually someone will discover it. Aiming at timelessness is a way to make yourself find the best answer: if you can imagine someone surpassing you, you should do it yourself. Some of the greatest masters did this so well that they left little room for those who came after. Every engraver since Durer has had to live in his shadow. Aiming at timelessness is also a way to evade the grip of fashion. Fashions almost by definition change with time, so if you can make something that will still look good far into the future, then its appeal must derive more from merit and less from fashion. Strangely enough, if you want to make something that will appeal to future generations, one way to do it is to try to appeal to past generations. It's hard to guess what the future will be like, but we can be sure it will be like the past in caring nothing for present fashions. So if you can make something that appeals to people today and would also have appealed to people in 1500, there is a good chance it will appeal to people in 2500. == Good design solves the right problem. The typical stove has four burners arranged in a square, and a dial to control each. How do you arrange the dials? The simplest answer is to put them in a row. But this is a simple answer to the wrong question. The dials are for humans to use, and if you put them in a row, the unlucky human will have to stop and think each time about which dial matches which burner. Better to arrange the dials in a square like the burners. A lot of bad design is industrious, but misguided. In the mid twentieth century there was a vogue for setting text in sans-serif fonts. These fonts are closer to the pure, underlying letterforms. But in text that's not the problem you're trying to solve. For legibility it's more important that letters be easy to tell apart. It may look Victorian, but a Times Roman lowercase g is easy to tell from a lowercase y. Problems can be improved as well as solutions. In software, an intractable problem can usually be replaced by an equivalent one that's easy to solve. Physics progressed faster as the problem became predicting observable behavior, instead of reconciling it with scripture. == Good design is suggestive. <NAME>'s novels contain almost no description; instead of telling you how everything looks, she tells her story so well that you envision the scene for yourself. Likewise, a painting that suggests is usually more engaging than one that tells. Everyone makes up their own story about the Mona Lisa. In architecture and design, this principle means that a building or object should let you use it how you want: a good building, for example, will serve as a backdrop for whatever life people want to lead in it, instead of making them live as if they were executing a program written by the architect. In software, it means you should give users a few basic elements that they can combine as they wish, like Lego. In math it means a proof that becomes the basis for a lot of new work is preferable to a proof that was difficult, but doesn't lead to future discoveries; in the sciences generally, citation is considered a rough indicator of merit. == Good design is often slightly funny. This one may not always be true. But Durer's engravings and Saarinen's womb chair and the Pantheon and the original Porsche 911 all seem to me slightly funny. Godel's incompleteness theorem seems like a practical joke. I think it's because humor is related to strength. To have a sense of humor is to be strong: to keep one's sense of humor is to shrug off misfortunes, and to lose one's sense of humor is to be wounded by them. And so the mark -- or at least the prerogative -- of strength is not to take oneself too seriously. The confident will often, like swallows, seem to be making fun of the whole process slightly, as Hitchcock does in his films or Bruegel in his paintings -- or Shakespeare, for that matter. Good design may not have to be funny, but it's hard to imagine something that could be called humorless also being good design. == Good design is hard. If you look at the people who've done great work, one thing they all seem to have in common is that they worked very hard. If you're not working hard, you're probably wasting your time. Hard problems call for great efforts. In math, difficult proofs require ingenious solutions, and those tend to be interesting. Ditto in engineering. When you have to climb a mountain you toss everything unnecessary out of your pack. And so an architect who has to build on a difficult site, or a small budget, will find that he is forced to produce an elegant design. Fashions and flourishes get knocked aside by the difficult business of solving the problem at all. Not every kind of hard is good. There is good pain and bad pain. You want the kind of pain you get from going running, not the kind you get from stepping on a nail. A difficult problem could be good for a designer, but a fickle client or unreliable materials would not be. In art, the highest place has traditionally been given to paintings of people. There is something to this tradition, and not just because pictures of faces get to press buttons in our brains that other pictures don't. We are so good at looking at faces that we force anyone who draws them to work hard to satisfy us. If you draw a tree and you change the angle of a branch five degrees, no one will know. When you change the angle of someone's eye five degrees, people notice. When Bauhaus designers adopted Sullivan's "form follows function," what they meant was, form should follow function. And if function is hard enough, form is forced to follow it, because there is no effort to spare for error. Wild animals are beautiful because they have hard lives. == Good design looks easy. Like great athletes, great designers make it look easy. Mostly this is an illusion. The easy, conversational tone of good writing comes only on the eighth rewrite. In science and engineering, some of the greatest discoveries seem so simple that you say to yourself, I could have thought of that. The discoverer is entitled to reply, why didn't you? Some Leonardo heads are just a few lines. You look at them and you think, all you have to do is get eight or ten lines in the right place and you've made this beautiful portrait. Well, yes, but you have to get them in exactly the right place. The slightest error will make the whole thing collapse. Line drawings are in fact the most difficult visual medium, because they demand near perfection. In math terms, they are a closed-form solution; lesser artists literally solve the same problems by successive approximation. One of the reasons kids give up drawing at ten or so is that they decide to start drawing like grownups, and one of the first things they try is a line drawing of a face. Smack! In most fields the appearance of ease seems to come with practice. Perhaps what practice does is train your unconscious mind to handle tasks that used to require conscious thought. In some cases you literally train your body. An expert pianist can play notes faster than the brain can send signals to his hand. Likewise an artist, after a while, can make visual perception flow in through his eye and out through his hand as automatically as someone tapping his foot to a beat. When people talk about being in "the zone," I think what they mean is that the spinal cord has the situation under control. Your spinal cord is less hesitant, and it frees conscious thought for the hard problems. == Good design uses symmetry. I think symmetry may just be one way to achieve simplicity, but it's important enough to be mentioned on its own. Nature uses it a lot, which is a good sign. There are two kinds of symmetry, repetition and recursion. Recursion means repetition in subelements, like the pattern of veins in a leaf. Symmetry is unfashionable in some fields now, in reaction to excesses in the past. Architects started consciously making buildings asymmetric in Victorian times and by the 1920s asymmetry was an explicit premise of modernist architecture. Even these buildings only tended to be asymmetric about major axes, though; there were hundreds of minor symmetries. In writing you find symmetry at every level, from the phrases in a sentence to the plot of a novel. You find the same in music and art. Mosaics (and some Cezannes) get extra visual punch by making the whole picture out of the same atoms. Compositional symmetry yields some of the most memorable paintings, especially when two halves react to one another, as in the _Creation of Adam_ or _American Gothic_. In math and engineering, recursion, especially, is a big win. Inductive proofs are wonderfully short. In software, a problem that can be solved by recursion is nearly always best solved that way. The Eiffel Tower looks striking partly because it is a recursive solution, a tower on a tower. The danger of symmetry, and repetition especially, is that it can be used as a substitute for thought. == Good design resembles nature. It's not so much that resembling nature is intrinsically good as that nature has had a long time to work on the problem. It's a good sign when your answer resembles nature's. It's not cheating to copy. Few would deny that a story should be like life. Working from life is a valuable tool in painting too, though its role has often been misunderstood. The aim is not simply to make a record. The point of painting from life is that it gives your mind something to chew on: when your eyes are looking at something, your hand will do more interesting work. Imitating nature also works in engineering. Boats have long had spines and ribs like an animal's ribcage. In some cases we may have to wait for better technology: early aircraft designers were mistaken to design aircraft that looked like birds, because they didn't have materials or power sources light enough (the Wrights' engine weighed 152 lbs. and generated only 12 hp.) or control systems sophisticated enough for machines that flew like birds, but I could imagine little unmanned reconnaissance planes flying like birds in fifty years. Now that we have enough computer power, we can imitate nature's method as well as its results. Genetic algorithms may let us create things too complex to design in the ordinary sense. == Good design is redesign. It's rare to get things right the first time. Experts expect to throw away some early work. They plan for plans to change. It takes confidence to throw work away. You have to be able to think, _there's more where that came from_. When people first start drawing, for example, they're often reluctant to redo parts that aren't right; they feel they've been lucky to get that far, and if they try to redo something, it will turn out worse. Instead they convince themselves that the drawing is not that bad, really -- in fact, maybe they meant it to look that way. Dangerous territory, that; if anything you should cultivate dissatisfaction. In Leonardo's drawings there are often five or six attempts to get a line right. The distinctive back of the Porsche 911 only appeared in the redesign of an awkward prototype. In Wright's early plans for the Guggenheim, the right half was a ziggurat; he inverted it to get the present shape. Mistakes are natural. Instead of treating them as disasters, make them easy to acknowledge and easy to fix. Leonardo more or less invented the sketch, as a way to make drawing bear a greater weight of exploration. Open-source software has fewer bugs because it admits the possibility of bugs. It helps to have a medium that makes change easy. When oil paint replaced tempera in the fifteenth century, it helped painters to deal with difficult subjects like the human figure because, unlike tempera, oil can be blended and overpainted. == Good design can copy. Attitudes to copying often make a round trip. A novice imitates without knowing it; next he tries consciously to be original; finally, he decides it's more important to be right than original. Unknowing imitation is almost a recipe for bad design. If you don't know where your ideas are coming from, you're probably imitating an imitator. Raphael so pervaded mid-nineteenth century taste that almost anyone who tried to draw was imitating him, often at several removes. It was this, more than Raphael's own work, that bothered the Pre-Raphaelites. The ambitious are not content to imitate. The second phase in the growth of taste is a conscious attempt at originality. I think the greatest masters go on to achieve a kind of selflessness. They just want to get the right answer, and if part of the right answer has already been discovered by someone else, that's no reason not to use it. They're confident enough to take from anyone without feeling that their own vision will be lost in the process. == Good design is often strange. Some of the very best work has an uncanny quality: Euler's Formula, Bruegel's Hunters in the Snow, the SR-71, Lisp. They're not just beautiful, but strangely beautiful. I'm not sure why. It may just be my own stupidity. A can-opener must seem miraculous to a dog. Maybe if I were smart enough it would seem the most natural thing in the world that $e^(i dot pi) = -1$. It is after all necessarily true. Most of the qualities I've mentioned are things that can be cultivated, but I don't think it works to cultivate strangeness. The best you can do is not squash it if it starts to appear. Einstein didn't try to make relativity strange. He tried to make it true, and the truth turned out to be strange. At an art school where I once studied, the students wanted most of all to develop a personal style. But if you just try to make good things, you'll inevitably do it in a distinctive way, just as each person walks in a distinctive way. Michelangelo was not trying to paint like Michelangelo. He was just trying to paint well; he couldn't help painting like Michelangelo. The only style worth having is the one you can't help. And this is especially true for strangeness. There is no shortcut to it. The Northwest Passage that the Mannerists, the Romantics, and two generations of American high school students have searched for does not seem to exist. The only way to get there is to go through good and come out the other side. == Good design happens in chunks. The inhabitants of fifteenth century Florence included Brunelleschi, Ghiberti, Donatello, Masaccio, <NAME>, <NAME>, Verrocchio, Botticelli, Leonardo, and Michelangelo. Milan at the time was as big as Florence. How many fifteenth century Milanese artists can you name? Something was happening in Florence in the fifteenth century. And it can't have been heredity, because it isn't happening now. You have to assume that whatever inborn ability Leonardo and Michelangelo had, there were people born in Milan with just as much. What happened to the Milanese Leonardo? There are roughly a thousand times as many people alive in the US right now as lived in Florence during the fifteenth century. A thousand Leonardos and a thousand Michelangelos walk among us. If DNA ruled, we should be greeted daily by artistic marvels. We aren't, and the reason is that to make Leonardo you need more than his innate ability. You also need Florence in 1450. Nothing is more powerful than a community of talented people working on related problems. Genes count for little by comparison: being a genetic Leonardo was not enough to compensate for having been born near Milan instead of Florence. Today we move around more, but great work still comes disproportionately from a few hotspots: the Bauhaus, the Manhattan Project, the New Yorker, Lockheed's Skunk Works, Xerox Parc. At any given time there are a few hot topics and a few groups doing great work on them, and it's nearly impossible to do good work yourself if you're too far removed from one of these centers. You can push or pull these trends to some extent, but you can't break away from them. (Maybe you can, but the Milanese Leonardo couldn't.) == Good design is often daring. At every period of history, people have believed things that were just ridiculous, and believed them so strongly that you risked ostracism or even violence by saying otherwise. If our own time were any different, that would be remarkable. As far as I can tell it isn't. This problem afflicts not just every era, but in some degree every field. Much Renaissance art was in its time considered shockingly secular: according to Vasari, Botticelli repented and gave up painting, and <NAME> and <NAME> actually burned some of their work. Einstein's theory of relativity offended many contemporary physicists, and was not fully accepted for decades -- in France, not until the 1950s. Today's experimental error is tomorrow's new theory. If you want to discover great new things, then instead of turning a blind eye to the places where conventional wisdom and truth don't quite meet, you should pay particular attention to them. ----------------------- As a practical matter, I think it's easier to see ugliness than to imagine beauty. Most of the people who've made beautiful things seem to have done it by fixing something that they thought ugly. Great work usually seems to happen because someone sees something and thinks, _I could do better than that_. Giotto saw traditional Byzantine madonnas painted according to a formula that had satisfied everyone for centuries, and to him they looked wooden and unnatural. Copernicus was so troubled by a hack that all his contemporaries could tolerate that he felt there must be a better solution. Intolerance for ugliness is not in itself enough. You have to understand a field well before you develop a good nose for what needs fixing. You have to do your homework. But as you become expert in a field, you'll start to hear little voices saying, _What a hack! There must be a better way_. Don't ignore those voices. Cultivate them. The recipe for great work is: very exacting taste, plus the ability to gratify it.
https://github.com/chengluyu/typst-template
https://raw.githubusercontent.com/chengluyu/typst-template/main/shorthands.typ
typst
#let kw = ( "let": $bold(sans("let"))$, "in": $bold(sans("in"))$, "if": $bold(sans("if"))$, "then": $bold(sans("then"))$, "and": $bold(sans("and"))$, "is": $bold(sans("is"))$, "else": $bold(sans("else"))$, "fun": $bold(sans("fun"))$, "data": $bold(sans("data"))$, "case": $bold(sans("case"))$, "of": $bold(sans("of"))$, "match": $bold(sans("match"))$, "or": $bold(sans("or"))$ ) #let what = $class("normal", ?)$ #let neg = $class("unary", -)$ #let def = $class("relation", ::=)$ #let rule(name) = text(font: "Linux Libertine")[#smallcaps(name)] #let subst(term, from, to) = $[from |-> to] space.thin term$ #let concat = $class("binary", +#h(-0.25em)+)$ #let hole = math.square.tiny #let typed = math.op(":") #let turn = move(dx: -0.25em, dy: -0.2em, rotate(-55deg, scale(80%)[⤾]))
https://github.com/knuesel/typst-minideck
https://raw.githubusercontent.com/knuesel/typst-minideck/main/example.typ
typst
MIT License
#import "@preview/minideck:0.2.1" #let (template, slide, title-slide, pause, uncover, only) = minideck.config() #show: template #title-slide[ = Slides with `minideck` == Some examples <NAME> #datetime.today().display() ] #slide[ = Subslides with `pause` #grid(columns: (1fr, 1fr))[ First part #show: pause Second part ][ #show: pause Enums need explicit numbering 1. One 2. Two #show: pause 3. Three ] ] #slide[ = Subslides with `uncover` and `only` #uncover(1, from:3)[Content visible on subslides 1 and 3+ (space reserved on 2).] #only(2,3)[Content included on subslides 2 and 3 (no space reserved on 1).] Content always visible. ] #slide[ = Dynamic equations $ f(x) &= x^2 + 2x + 1 \ #uncover(2, $&= (x + 1)^2$) $ ] #import "@preview/pinit:0.1.4": * #slide[ = Works well with `pinit` Pythagorean theorem: $ #pin(1)a^2#pin(2) + #pin(3)b^2#pin(4) = #pin(5)c^2#pin(6) $ #show: pause $a^2$ and $b^2$ : squares of triangle legs #only(2, { pinit-highlight(1,2) pinit-highlight(3,4) }) #show: pause $c^2$ : square of hypotenuse #pinit-highlight(5,6, fill: green.transparentize(80%)) #pinit-point-from(6)[larger than $a^2$ and $b^2$] ] #import "@preview/cetz:0.2.2" as cetz: * #let (slide, only, cetz-uncover, cetz-only) = minideck.config(cetz: cetz) #slide[ = With CeTZ figures CeTZ figures require - cetz-specific `uncover` and `only` from `minideck.config` - a `context` outside the `canvas` call Above canvas #context canvas({ import draw: * cetz-only(3, rect((0,-2), (14,4), stroke: 3pt)) cetz-uncover(from: 2, rect((0,-2), (16,2), stroke: blue+3pt)) content((8,0), box(stroke: red+3pt, inset: 1em)[ A typst box #only(2)[on 2nd subslide] ]) }) Below canvas ] #import "@preview/fletcher:0.5.0" as fletcher: diagram, node, edge #let (slide, fletcher-uncover) = minideck.config(fletcher: fletcher) #slide(steps: 2)[ = With fletcher diagrams fletcher diagrams require - fletcher-specific `uncover` and `only` from `minideck.config` - a `context` outside the `diagram` call - an explicit number of steps passed to the `slide` function #set align(center) Above diagram #context diagram( node-stroke: 1pt, node((0,0), [Start], corner-radius: 2pt, extrude: (0, 3)), edge("-|>"), node((1,0), align(center)[A]), fletcher-uncover(from: 2, edge("d,r,u,l", "-|>", [x], label-pos: 0.1)) ) Below diagram ] #let (template, slide) = minideck.config( theme: minideck.themes.simple.with(variant: "dark"), ) #show: template #slide[ = Slide with dark theme Some text ]
https://github.com/BreakingLead/note
https://raw.githubusercontent.com/BreakingLead/note/main/Math/uncategorized/变分法.typ
typst
#import "../template-mathnote.typ": * #show: template = 变分法
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/link_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test that the period is trimmed. #show link: underline https://a.b.?q=%10#. \ Wahttp://link \ Nohttps:\//link \ Nohttp\://comment
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/typstonomicon/extract_plain_text.md
markdown
MIT License
# Extracting plain text ```typ // original author: ntjess #let stringify-by-func(it) = { let func = it.func() return if func in (parbreak, pagebreak, linebreak) { "\n" } else if func == smartquote { if it.double { "\"" } else { "'" } // " } else if it.fields() == (:) { // a fieldless element is either specially represented (and caught earlier) or doesn't have text "" } else { panic("Not sure how to handle type `" + repr(func) + "`") } } #let plain-text(it) = { return if type(it) == str { it } else if it == [ ] { " " } else if it.has("children") { it.children.map(plain-text).join() } else if it.has("body") { plain-text(it.body) } else if it.has("text") { if type(it.text) == "string" { it.text } else { plain-text(it.text) } } else { // remove this to ignore all other non-text elements stringify-by-func(it) } } #plain-text(`raw inline text`) #plain-text(highlight[Highlighted text]) #plain-text[List - With - Some - Elements + And + Enumerated + Too ] #plain-text(underline[Underlined]) #plain-text($sin(x + y)$) #for el in ( circle, rect, ellipse, block, box, par, raw.with(block: true), raw.with(block: false), heading, ) { plain-text(el(repr(el))) linebreak() } // Some empty elements #plain-text(circle()) #plain-text(line()) #for spacer in (linebreak, pagebreak, parbreak) { plain-text(spacer()) } ```
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/VerbaliInterni/VerbaleInterno_240308/meta.typ
typst
MIT License
#let data_incontro = "08-03-2024" #let inizio_incontro = "10:00" #let fine_incontro = "11:30" #let luogo_incontro = "Discord"
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Allemand_08_01_2023_p61.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: "Allemand 08 01 2023 p61", authors: ( "<NAME>", ), date: "30 Octobre, 2023", ) #set heading(numbering: "1.1.") == Ex 4 <ex-4> #block[ #set enum(numbering: "a.", start: 1) + ein Foto teilen + eine SMS schicken + sich ein Video anschauen + eine App benutzen + Seine Daten schützen + das Privatleben respektieren + ein Posting kommentieren ] == Ex 5 <ex-5> ich schicke ein Foto -\> ich poste ein Bild ich empfehle dir -\> ich rat dir ich kommentiere -\> ich habe etwas zu sagen ich bin ab und zu offline -\> manchmall schalte ich mein Handy aus ich habe seinen Namen gegoogelt -\> ich habe im Internet über ihn recherchiert ich benutze ein Passwort -\> ich schütze meine Daten == Ex 6 <ex-6> Mein Bruder benutzt immer sein Smartphone. Er muss immer eine Nachricht schicken, ein Foto teilen oder ein Posting kommentieren. Er liest nur E-Books und hat ein Profil in jedem sozialen Netzwerk. Aber er schützt seine Daten nich richtig und hat heute einen Virus bekommen, er muss also heute offline bleiben. Das nervt ihn so sehr!
https://github.com/devraza/warehouse
https://raw.githubusercontent.com/devraza/warehouse/main/blog/nfc-misconceptions.typ
typst
MIT License
#import "template.typ": conf #show: doc => conf( title: [ Misconceptions about NFC ], doc, ) #align(left, text(10pt)[*I made a mistake while writing this blog post - somehow forgetting that security isn’t unambiguous. You can actually skim NFC chips from a certain distance \(having a limited distance is still an important factor though!), and though I think some of what I said below still applies you’re better off ignoring it all.* There are, of course, a whole range of problems with skimming NFC chips from a distance so my point - don’t be so worried - would still stand. Either way, I recommend you take this with a grain of salt. ]) = Introduction NFC \(short for Near-Field Communication) is the set of communication protocols which allow for #emph[near-field communication] between two electronic devices. One of the most prominent uses of this technology are contactless transactions - this includes services like Google and Apple Pay as well as all of your contactless-enabled cards. It’s been a while since my last blog past, but this one will be brief too - I’m writing here for the sake of clearing up some misconceptions people have about NFC. = The Misconceptions == Inspiration While talking with a friend on a WhatsApp group chat a few days ago about a program I found on my jailbroken iOS device - link("https://github.com/Aemulo")[Aemulo] - I was informed of 'subway skimmers'; devices that could #emph[supposedly] read data from contactless-enabled devices \(via NFC) and would be able to emulate them. The idea behind the above example was that someone with malicious intent could place such a device in a public location and take their contactless devices for their malicious purposes. When I heard of this, my first thought was: #link("https://devraza.duckdns.org/blog/hoaxes-overview/")[hoax];, and I think that it was rightfully so. == What exactly is wrong with this? Several things. I’m no expert in cybersecurity - everyone’s a student in some way, but I was sure that NFC was, as it’s name implies, for #strong[near-field communication];. I’m repeating myself here, but that’s kind of the point. Various reliable resources, including Wikipedia, show that NFC has a maximum range of only a few centimetres - which makes sense, no? And yet, whatever source my friend had for 'subway skimmers' gave the impression, or otherwise stated, that it would work within a radius of a few feet, which is just impossible. Upon voicing my doubts, I was then told that 'with a powerful enough antenna, it’s possible'. Hoaxes sure are convincing, aren’t they? Unfortunately, I am not able to find the source of my friend’s misinformation. See, NFC only works within a few centimetres anyways. Even if it could #emph[magically] work within a radius of a few feet, you’ve got to take in the electromagnetic interference that the clothes and wallets people have would bring to any malicious device. The point of electromagnetic interference is especially true over a #emph[huge] area of a few feet \(relatively), where you’ve got several NFC-enabled devices. == Where it’s actually an issue Of course, that isn’t to say there aren’t any issues with NFC and malicious readers - I’m just saying that the word getting around is horribly unrealistic. For example, a #emph[realistic] example of a malicious NFC reader would be one placed on the card slots in cash machines - you get: - The short range (~20 cm) - Only one device - Lots of devices to read! And so, you’ve got someone so much more realistic that poses an actual threat! = Conclusion <conclusion> The information above, which I deem accurate, is there. What I suggest be taken away from this is pretty much the same as what is was for #link("https://devraza.giize.com/blog/hoaxes-overview/")[my blog post on hoaxes] - #strong[do some fact-checking!]
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/place-nested.typ
typst
Apache License 2.0
// Test vertical alignment with nested placement. --- #box( fill: aqua, width: 30pt, height: 30pt, place(bottom, place(line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 3pt)) ) ) --- #box( fill: aqua, width: 30pt, height: 30pt, { box(fill: yellow, { [Hello] place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 2pt)) }) place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: green + 3pt)) } ) --- #box(fill: aqua)[ #place(bottom + right)[Hi] Hello World \ How are \ you? ] --- #box(fill: aqua)[ #place(top + left, dx: 50%, dy: 50%)[Hi] #v(30pt) #line(length: 50pt) ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/columns_05.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test the `colbreak` and `pagebreak` functions. #set page(height: 1cm, width: 7.05cm, columns: 2) A #colbreak() #colbreak() B #pagebreak() C #colbreak() D
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/linebreak_09.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test linebreak for East Asian languages ทีวีตรวจทานนอร์ทแฟรีเลคเชอร์โกลด์อัลบัมเชอร์รี่เย้วสโตร์กฤษณ์เคลมเยอบีร่าพ่อค้าบลูเบอร์รี่สหัสวรรษโฮปแคนูโยโย่จูนสตรอว์เบอร์รีซื่อบื้อเยนแบ็กโฮเป็นไงโดนัททอมสเตริโอแคนูวิทย์แดรี่โดนัทวิทย์แอปพริคอทเซอร์ไพรส์ไฮบริดกิฟท์อินเตอร์โซนเซอร์วิสเทียมทานโคโยตี้ม็อบเที่ยงคืนบุญคุณ
https://github.com/Scriptorgames/JIF-JUFO-Paper
https://raw.githubusercontent.com/Scriptorgames/JIF-JUFO-Paper/main/example.typ
typst
#import "template.typ": * #show: ams-article.with(title: [Jif], authors: ( (name: "<NAME>"), (name: "<NAME>"), (name: "<NAME>"), ), abstract: lorem(100), bibliography-file: "refs.bib") #sc[```java public class MyFunkyFlass { public static void main(String[] args) { System.out.println("Hello Illian") } } ```] #term(ps1: [`$`], input: [`ls -la`], output: [ `total 140 drwxr-xr-x. 1 null null 48 Nov 30 01:11 . drwx------. 1 null null 1032 Dec 3 18:30 .. -rw-r--r--. 1 null null 23093 Nov 30 00:40 s1.png -rw-r--r--. 1 null null 26076 Nov 30 01:02 s2.png -rw-r--r--. 1 null null 42784 Nov 30 01:18 s3.png -rw-r--r--. 1 null null 42735 Nov 30 01:12 s4.png` ]) #showybox( frame: ( border-color: red.darken(50%), title-color: red.lighten(60%), body-color: red.lighten(80%), ), title-style: (color: black, weight: "regular", align: center), shadow: (offset: 3pt), title: "Red-ish showybox with separated sections!", lorem(20), lorem(12), ) Call me Ishmael. Some years ago --- never mind how long precisely --- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen, and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off --- then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me. @netwok2020 There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs - commerce surrounds it with her surf. Right and left, the streets take you waterward. Its extreme down-town is the battery, where that noble mole is washed by waves, and cooled by breezes, which a few hours previous were out of sight of land. Look at the crowds of water-gazers there. Anyone caught using formulas such as $sqrt(x+y)=sqrt(x)+sqrt(y)$ or $1/(x+y) = 1/x + 1/y$ will fail. The binomial theorem is $ (x+y)^n=sum_(k=0)^n binom(n, k) x^k y^(n-k). $ A favorite sum of most mathematicians is $ sum_(n=1)^oo 1/n^2 = pi^2 / 6. $ Likewise a popular integral is $ integral_(-oo)^oo e^(-x^2) dif x = sqrt(pi) $ #theorem[ The square of any real number is non-negative. ] #proof[ Any real number $x$ satisfies $x > 0$, $x = 0$, or $x < 0$. If $x = 0$, then $x^2 = 0 >= 0$. If $x > 0$ then as a positive time a positive is positive we have $x^2 = x x > 0$. If $x < 0$ then $−x > 0$ and so by what we have just done $x^2 = (−x)^2 > 0$. So in all cases $x^2 ≥ 0$. ] = Introduction This is a new section. You can use tables like @solids. #figure(table( columns: (1fr, auto, auto), inset: 5pt, align: horizon, [], [*Area*], [*Parameters*], [*Cylinder*], $ pi h (D^2 - d^2) / 4 $, [$h$: height \ $D$: outer radius \ $d$: inner radius], [*Tetrahedron*], $ sqrt(2) / 12 a^3 $, [$a$: edge length], ), caption: "Solids") <solids> == Things that need to be done Prove theorems. = Background #lorem(40)
https://github.com/OCamlPro/ppaqse-lang
https://raw.githubusercontent.com/OCamlPro/ppaqse-lang/master/src/étude/conclusion.typ
typst
#import "defs.typ": * #import "links.typ": * = Conclusion Ce rapport fourni un aperçu des langages de programmation C, C++, #Ada, #Scade, #OCaml, #Rust et de leur écosystème du point de vue de la sûreté logicielle. Comme à chaque fois qu'on étudie plusieurs langages, il est difficile d'échapper à la question toute naturelle : _in fine_, quel est le langage le plus sûr ? La réponse sous-tend qu'on compare les langages et leur écosystème entre eux et, comme nous l'avons vu, tous ces langages ne sont pas vraiment comparables car il vont toucher des usages particuliers avec des techniques particulières. Comme un bon bricoleur choisi bien son outil en fonction de la tâche à réaliser, un bon développeur doit choisir le langage le plus adapté à son besoin. Le besoin en sureté est celui de la confiance dans le logiciel. Celle-ci repose sur deux piliers: - les vérifications statiques, que ce soit par le compilateur lui-même ou des outils tiers; - les tests. Ni l'un ni l'autre ne suffisent, seuls, à garantir la sûreté d'un logiciel : les analyses peuvent être mal implémentées ou reposer sur des hypothèses fausses et les tests peuvent ne pas couvrir toutes les combinaisons possibles pour des raisons combinatoires ou techniques. Or, nous l'avons vu, tous les langages présentés disposent d'environnements de test plus ou moins automatisés mais suffisants pour réaliser des bancs de tests complets. En revanche, #OCaml et #Rust, malgré leur très bon degré de vérification intrinsèque, manquent d'analyses complémentaires qui ne sont, pour l'heure, qu'à l'état de projets de recherche. Aussi, pour des projets très critiques, les langages #Ada et #Scade semblent être les plus adaptés car ils offrent des garanties de vérification à la fois intrinsèques et externes très fortes. Pour les projets un peu moins critiques, #OCaml et #Rust ont probablement une place à prendre en fonction des objectifs recherchés : - #Rust pour les mêmes raisons que le C/C++ mais avec des garanties supplémentaires; - #OCaml pour son efficacité productive. Lorsque plusieurs langages sont utilisables, la gestion du _coût_ intervient afin d'être compétitif. Ce coût provient : - du temps de développement; - du temps de débogue; - des licences d'outils tiers; - de la formation du personnel (pour le langage et les outils); - de la dette technique. La dette technique est un point important car elle est souvent sous-estimée et engendre un coût caché de production qui augmente, parfois de manière dramatique, avec le temps. La dette technique est évaluée par rapport à : 1. la complexité et maintenabilité de la base de code au fil du temps. Par exemple, les programmes C++ ont une tendance naturelle à devenir difficile à suivre; 2. la disponibilité des ressources : les ressources qui savent faire de l'#Ada ou du #Scade sont plus rares que celles qui savent faire du C et coûtent naturellement plus cher sur le marché du travail. Comme il n'existe pas à notre connaissance de métriques sur des développements comparables, il est difficile de donner une vue complètement objective de la comparaison entre les langages selon les critères ci-dessus. A titre informatif, nous pouvons cependant donner le résultat d'une étude informelle réalisée dans le cadre du développements de systèmes embarqués (mais lourds) a haut niveau de confiance avec du temps réel avec des garanties de sécurité#footnote[Le système d'exploitation PolyXene (https://cyber.gouv.fr/produits-certifies/polyxene-version-11) et ses variantes.]. Ces systèmes n'étaient pas soumis au normes de sûreté mais l'expérience est toutefois pertinente puisque le hasard a voulu que les langages étudiés dans ce rapport y soient utilisés (ou dans une forme équivalente). Ces développements ont été fait avec une équipe d'ingénieurs représentative de l'ingénieur moyen et le résultat est résumé dans la @bilan. Les coûts sont donnés en pire cas (avec des € croissants) : par exemple, si l'équipe d'ingénieur est déjà versée dans l'art de faire du bon C++, son coût de formation sera moindre ou nul. #figure( table( columns: (auto, auto, auto, auto, auto, auto, auto), [], [*C*], [*C++*], [*#Ada*], [*#Scade*], [*#OCaml*], [*#Rust*], [*Temps Réel dur*], [Oui], [Oui], [Oui], [Oui], [Non], [Oui], [*Temps Réel mou*], [Oui], [Oui], [Oui], [Oui], [Oui], [Oui], [*Environnement contraint*], [Oui], [Oui], [Oui], [Oui], [Pas directement], [Oui], [*Temps de développement*], [Long], [Moyen], [Moyen], [Long], [Court], [Moyen], [*Temps de débogage*], [Long], [Long], [Court], [Court], [Court], [Court], [*Licences*], [€€€], [€€€], [€€€], [€€€], [?], [?], [*Formation*], [€], [€€€], [€€€], [€€], [€], [€€€], [*Dette technique*], [€], [€€], [€], [?], [€], [€€], ), caption: [Bilan comparatif des langages] ) <bilan> Nous n'avons pas assez de recul pour évaluer la dette technique liée à #Scade ni le prix des licences sur l'éventuelle commercialisation des outils actuellement à l'état de projet de recherche pour #OCaml et #Rust. Toutefois, nous pensons que ce bilan et le rapport dans sa globalité donneront une idée générale assez fidèle à l'état actuel des langages étudiés.
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/feebf7-2023_fall_TA/lectures/lecture_4.typ
typst
#import "../utils.typ": * = Lecture 4 ```plain Time: Week 2, 9.18 Mon ``` #statement[ $ a > 1 quad => quad a^n > (n^2) / 4 (a-1)^2 $ ] #proof[ $ a^n = ((a-1)+1)^n = sum_(i=0)^(n) binom(n, i) (a-1)^i = 1 + n(a-1) +n(n-1) / 2 (a-1)^2 > n(n-1) / 2 (a-1)^2 $ 对充分大的$n$, 容易说明: $ n-1>n / 2 quad => quad n(n-1) / 2 > n^2 / 4 \ => a^n > n^2 / 4 (a-1)^2 $ ] $ a_n = n^k / a^n = (n / (a^(1 / k))^n)^k $ $ a_n / a_1 = product_(i=1)^(n-1) a_(i+1) / a_i <= product_(i=1)^(n-1) b_(i+1) / b_i = b_n / b_1 $ $ n! <1 / 2 n^(n / 2) $ #v(4cm) $ a_n = sum_(i=0)^n 1 / i \ forall epsilon>0, "take" N=1 / epsilon, => forall n>N, abs(a_(n+1) - a_n)<epsilon \ a_n -> infinity \ $ #pagebreak()
https://github.com/Shedward/dnd-charbook
https://raw.githubusercontent.com/Shedward/dnd-charbook/main/dnd/page/cover.typ
typst
#import "../core/core.typ": * // Outter padding used in cover #let coverPaddings = paddings(1.5) // Renders cover page // Parameters: // - name: Name of the character, shown in the middle of cover // - author: Name of the author, shown in top-right corner // - title: Flavor title, shown above character name // - subtitle: Flavor subtitle, shown below character name // - caption: Additional text for flavor or another info, // shown at bottom-left corner #let cover( name, author: none, title: none, subtitle: none, caption: none ) = page( framed( stroke: strokes.normal, insets: coverPaddings, fitting: expand, radius: coverPaddings )[ #framed( insets: 2.0 * coverPaddings, fitting: expand, radius: coverPaddings )[ #box(width: 100%, height: 100%)[ #if author != none [ #place(top + right)[ #author ] ] #place(bottom + left)[ #caption ] #place(center + horizon)[ #bookSubtitle[ #title ] \ #bookTitle[ "#name" ] \ #v(8mm) #bookSubtitle[ #set text(18pt) #subtitle ] \ ] ] ] ] )
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/book/src/themes/helpers.md
markdown
# Helpers for theme authors Let us have a look at some common use cases you run into as a theme author and what solutions are provided by the `helpers` and `logic` modules inside polylux. As a theme author, you have access to them due to the imports ```typ #import "../logic.typ" #import "../helpers.typ" ``` (see previous page). ## How much longer? 🥱 There are a handfull of features that let you display the progress of the presentation. The most simple one is directly displaying the current slide number. Remember that each slide might produce an arbitrary amount of subslides, i.e. PDF pages, so we cannot rely on the builtin page counter. Instead, there is the `logical-slide` counter in the `logic` module. Therefore, you can use ```typ #logic.logical-slide.display() ``` to see what the current slide number is. If you want to put that into relation to how many slides there are in total, you can also display ```typ #helpers.last-slide-number ``` which is a short-hand way of getting the final value of `logic.logical-slide`. Note that both these things are content, though, so you can only display them and not calculate with the numbers. A common calculation you might want do to is finding their ratio, i.e. current slide number divided by total number of slides. To that end, you can use the function `helpers.polylux-progress`. You can pass a function to it that turns the current ratio into some content. For example: ```typ #helpers.polylux-progress( ratio => [ You already made it through #calc.round(ratio * 100) #sym.percent of the presentation! ]) ``` Some themes utilise this to display a little progress bar, for example. ## Sections Another way of expressing where we are in a presentation is working with sections. In your theme, you can incorporate the following features from the `helpers` module: First, whenever a user wants to start a new section, you can call ```typ #helpers.register-section(the-section-name) ``` with whatever name they specify. It is up to you to decide what kind of interface you provide for the user and how/if you visualise a new section, of course. Based on that, you can then display what section the presenter is currently in by using: ```typ #helpers.current-section ``` If no section has been registered so far, this is empty content (`[]`). And finally, you might want to display some kind of overview over all the sections. This is achieved by: ```typ #helpers.polylux-outline() ``` Unfortunately, it is hard to get the Typst-builtin `#outline` to work properly with slides, partly again due to how page numbers are kind of meaningless. `polylux-outline` is a good alternative to that and will return an `enum` with all the registered sections (ever, not only so far, so you can safely use it at the beginning of a presentation). `polylux-outline` has two optional keyword arguments: - `enum-args`: pass a dictionary that is propagated to [`enum` as keyword arguments](https://typst.app/docs/reference/layout/enum#parameters), for example `enum-args: (tight: false)`, default: `(:)` - `padding`: pass [something that `pad` accepts](https://typst.app/docs/reference/layout/pad#parameters), will be used to pad the `enum`, default: `0pt`
https://github.com/fabriceHategekimana/master
https://raw.githubusercontent.com/fabriceHategekimana/master/main/report.typ
typst
#import "@preview/bubble:0.1.0": * #import "@preview/curryst:0.3.0": rule, proof-tree #import "src/module.typ": * #show: bubble.with( title: "Système de type", subtitle: "Pour les sciences des données", author: "<NAME>.", affiliation: "Université de Genève", date: datetime.today().display(), year: "2024", class: "Sciences informatiques", logo: image("src/logo.png"), ) #set par( first-line-indent: 1em, justify: true, linebreaks: "optimized" ) #pagebreak() #align(horizon)[ == Abstract Les sciences des données et les statistiques jouent un rôle de plus en plus important dans nos sociétés. Cependant, les langages de programmation actuels ne sont pas entièrement adaptés à ce nouveau paradigme de développement. L'objectif de cette recherche est de développer un système de type statique permettant de manipuler des tableaux multidimensionnels pour les sciences des données. La méthodologie consiste à créer un mini-langage capable de gérer les tableaux multidimensionnels, en utilisant des génériques et des types dépendants. Nous avons réussi à développer un modèle simple d'un langage capable de réaliser des opérations sur des scalaires, des matrices et des vecteurs, ainsi qu'un module pour les réseaux de neurones. Les résultats montrent qu'il est possible d'assurer un niveau satisfaisant de sécurité avec les types, bien que nous rencontrions des limitations en termes de représentation complète sans rendre l'algorithme de vérification de type indécidable à un certain degré. ] #pagebreak() #outline(depth: 2, indent: 8% - 2em) #include "1_Intro/Context.typ" #include "1_Intro/Problématique.typ" #include "1_Intro/Solutions.typ" #include "2_Etat_de_l_art/R.typ" #include "2_Etat_de_l_art/Lambda_calculus.typ" #include "2_Etat_de_l_art/STLC.typ" #include "2_Etat_de_l_art/Système_F.typ" #include "3_Theorie/C3PO.typ" #include "3_Theorie/Syntax.typ" #include "3_Theorie/Évaluation.typ" #include "3_Theorie/Typage.typ" #include "3_Theorie/Intro.typ" #include "3_Theorie/Types_de_données_basiques.typ" #include "3_Theorie/Broadcasting.typ" #include "5_Implémentation/Prolog.typ" #include "4_Usecase/Couches.typ" #include "4_Usecase/Réseaux_de_neurones.typ" #include "6_Conclusion/Synthèse.typ" #include "6_Conclusion/Succès.typ" #include "6_Conclusion/Défauts.typ" #include "6_Conclusion/Projet_futures.typ" #pagebreak() = Remerciements Je tiens à exprimer ma profonde gratitude à toutes les personnes qui ont contribué à la réalisation de cette thèse. Leur soutien, leurs conseils et leurs encouragements ont été inestimables tout au long de ce parcours. Tout d'abord, je remercie sincèrement Monsieur <NAME>, mon directeur de thèse, pour sa supervision éclairée. Son expertise et sa rigueur scientifique ont grandement enrichi ce travail. Je suis également reconnaissant envers Dr. <NAME> et Mr. <NAME>, les membres du laboratoire SMV qui m'ont accompagné dans ce projet. Leur expertise, leur soutien moral et leurs échanges enrichissants on su me donner un cadre stable où évoluer. Leur camaraderie a rendu cette expérience de recherche plus agréable et stimulante. Un grand merci à Mr. <NAME> et Mr. <NAME>, membres de l'université de Northeastern University, pour leur travail de recherche sur le langage R et l'élaboration d'un système de type. Leurs suggestions constructives et leurs encouragements pour ce projet de recherche. Je n'oublie pas Mr. <NAME>, ainsi que la communauté des utilisateurs de R à Genève pour leur aide précieuse à comprendre les besoin actuels des statisticiens, scientifiques des données et constructeur de librairies. Leur expertise technique et leur feedback ont été d'une grande aide à la réalisation du design du langage. À tous, je vous exprime ma profonde reconnaissance et mes remerciements les plus sincères. #bibliography("works.bib")
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/code/multiline-string.typ
typst
Apache License 2.0
#{assert(true, message: "Target qubit for multi qubit gate does not exist aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") } #{assert(true, message: "Target qubit for multi qubit gate does not exist aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa c") }
https://github.com/HiiGHoVuTi/requin
https://raw.githubusercontent.com/HiiGHoVuTi/requin/main/graph/contraintes.typ
typst
#import "../lib.typ" : * #show heading: heading_fct Dans cet exercices, on considère différents graphes avec différentes contraintes. === Graphes non orientés #question(2)[ Soit $m >=3$. Soit $G =(S,A)$ un graphe non orienté tel que pour tout $m$ personnes choisies, il existe un unique $s in S$ qui est reliées aux $m$ personnes. Quel est le dégrée max du graphe ? ] #question(3)[ Soit $G =(S,A)$ un graphe non orienté tel que pour toute paire $(s_1,s_2) in S^2$, il existe un *unique* $s' in S$ tel que $(s_1, s')$ et $(s',s_2) in E$. Montrer qu'il existe un sommet relié à tout les autres. ] #correct([ CF. https://diplome.di.ens.fr/informatique-ens/annales/2023_Info-rapport.pdf "Théorème des amis" ])
https://github.com/yongweiy/cv
https://raw.githubusercontent.com/yongweiy/cv/master/experience.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cvSection, cvEntry, setAccentColor, awesomeColors, regularColors #let metadata = toml("./metadata.toml") #let cvSection = cvSection.with(metadata: metadata, highlighted: false) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("Experience") #{ let accentColor = setAccentColor(awesomeColors, metadata) let beforeEntrySkip = eval( metadata.layout.at("before_entry_skip", default: 1pt), ) let beforeEntryDescriptionSkip = eval( metadata.layout.at("before_entry_description_skip", default: 1pt), ) let entryA1Style(str) = { text(size: 10pt, weight: "bold", str) } let entryA2Style(str) = { align( right, text(weight: "medium", fill: accentColor, style: "oblique", str), ) } let entryB1Style(str) = { text(size: 8pt, fill: accentColor, weight: "medium", smallcaps(str)) } let entryB2Style(str) = { align( right, text(size: 8pt, weight: "medium", fill: gray, style: "oblique", str), ) } let entryDescriptionStyle(str) = { text( fill: regularColors.lightgray, { v(beforeEntryDescriptionSkip) str }, ) } let entryTagStyle(str) = { align(center, text(size: 8pt, weight: "regular", str)) } let entryTagListStyle(tags) = { for tag in tags { box( inset: (x: 0.25em), outset: (y: 0.25em), fill: regularColors.subtlegray, radius: 3pt, entryTagStyle(tag), ) h(5pt) } } let makeTable(..content) = { table( columns: (0%, 1fr), inset: 0pt, stroke: none, align: horizon, column-gutter: 0pt, [], table( columns: (1fr, auto), inset: 0pt, stroke: none, row-gutter: 6pt, align: auto, ..content ), ) } v(beforeEntrySkip) makeTable( {entryA1Style([Automated Reasoning Group \@Amazon])}, {entryA2Style([Seattle, WA, USA])} ) makeTable( {entryB1Style([Applied Scientist Intern])}, {entryB2Style([Summer 2023])} ) entryDescriptionStyle(list( [Devised and implemented algorithmic optimization for policy evaluation in Identity and Access Management (1 billion calls per second).], [Profiled the policy evaluation engine, discovered mutiple unusual patterns, and turned them into optimization opportunities.], [Proved the correctness of all these optimizations in Dafny and improved the performance of the policy evaluation engine by about 10%.], )) makeTable( {entryB1Style([Applied Scientist Intern])}, {entryB2Style([Summer 2022])} ) entryDescriptionStyle(list( [Proved the correctness of IP address parsing in Dafny, which is a critical component of Identity and Access Management.], [Identified Dafny's limitation in bitvector reasoning and devised an effective workaround for it, enabling sound analysis of IP addresses.], [Implemented a Dafny-to-Java transpilation pass to generate idiomatic bitvector manipulation code.], [Adopted the Checker Framework to enable various safety checks in the generated Java code, providing future proof to developers.] )) v(beforeEntrySkip) makeTable( {entryA1Style([Purdue University])}, {entryA2Style([West Lafayette, IN, USA])} ) makeTable( {entryB1Style([Graduate Research Assistant])}, {entryB2Style([2023 - now])} ) entryDescriptionStyle(list([Under the supervision of Dr. <NAME>.])) makeTable( {entryB1Style([Graduate Research Assistant])}, {entryB2Style([2020 - 2023])} ) entryDescriptionStyle(list([Under the supervision of Dr. <NAME>.])) } // #cvEntry( // title: [Applied Scientist Intern], // society: [Automated Reasoning Group \@Amazon, Inc], // // logo: image("../src/logos/xyz_corp.png"), // date: [Summer 2023], // location: [Seattle, WA, USA], // description: list( // [Devised and implemented algorithmic optimization for policy evaluation in Identity and Access Management (1 billion calls per second).], // [Profiled the policy evaluation engine, discovered mutiple unusual patterns, and turned them into optimization opportunities.], // [Proved the correctness of all these optimizations in Dafny and improved the performance of the policy evaluation engine by about 10%.], // ), // // tags: ("Dafny", "Java", "Scala", "TypeScript"), // ) // #cvEntry( // title: [Applied Scientist Intern], // society: [Automated Reasoning Group \@Amazon, Inc], // // logo: image("../src/logos/xyz_corp.png"), // date: [Summer 2022], // location: [Seattle, WA, USA], // description: list( // [Proved the correctness of IP address parsing in Dafny, which is a critical component of Identity and Access Management.], // [Identified Dafny's limitation in bitvector reasoning and devised an effective workaround for it, enabling sound analysis of IP addresses.], // [Implemented a Dafny-to-Java transpilation pass to generate idiomatic bitvector manipulation code.], // [Adopted the Checker Framework to enable various safety checks in the generated Java code, providing future proof to developers.] // ), // // tags: ("Dafny", "F#", "Java"), // ) // #cvEntry( // title: [Graduate Research Assistant], // society: [Purdue University], // date: [2023 - now], // location: [West Lafayette, IN, USA], // description: [Under the supervision of Dr. <NAME>.], // ) // #cvEntry( // title: [Graduate Research Assistant], // society: [Purdue University], // date: [2020 - 2023], // location: [West Lafayette, IN, USA], // description: [Under the supervision of Dr. <NAME>.], // )
https://github.com/mem-courses/linear-algebra
https://raw.githubusercontent.com/mem-courses/linear-algebra/main/homework/linear-algebra-homework4.typ
typst
#import "../template.typ": * #show: project.with( title: "Linear Algebra Homework #4", authors: ( (name: "<NAME> (#95)", email: "<EMAIL>", phone: "3230104585"), ), date: "October 20, 2023", ) = P38 习题二 19 #ac #prob[证明 $bold(A)$ 为数域 $PP$ 上的 $n$ 阶方阵,证明:$r(bold(A))=n <==> |bold(A)|!=0$.] - $=>$ 反证法:若 $|bold(A)|=0$,说明通过初等行变换将 $bold(A)$ 变为约化阶梯形矩阵 $bold(A_1)$ 后,至少有一个空行.即说明 $r(bold(A_1))<n$.由于初等行变换不改变矩阵的秩.我们有 $r(bold(A))=r(bold(A_1))!=n$. - $arrow.l.double$ 若 $|bold(A)|!=0$,说明通过初等行变换将 $bold(A)$ 变为约化阶梯形矩阵 $bold(A_2)$ 后,没有空行.同理可以说明 $r(bold(A))=n$. = P38 习题二 20 #ac #prob[ 判断下列命题是否正确(给出理由): (1) 如果 $m times n$ 矩阵 $bold(A)$ 的秩为 $m$,那么 $m<=n$;\ (2) 矩阵的秩等于该矩阵的非零行的个数;\ (3) 阶梯形矩阵的秩等于该矩阵的非零行的个数;\ (4) 阶梯型矩阵的秩等于该矩阵的非零列的个数;\ ] (1) 正确;$m=r(bold(A))<=min{n,m} => m<=n$. (2) 错误;反例:令 $bold(A)=mat(1,1;1,1)$,则 $r(bold(A))=1!=2$. (3) 正确;设非零行个数为 $k$.选阶梯头所在的 $k$ 行 $k$ 列构成的子式行列式不为 $0$,故 $r(bold(A))>=k$.只有 $k$ 个非零行,故 $r(bold(A))<=k$.综上 $r(bold(A))=k$. (4) 错误;反例:$ mat(1,2,3,1;0,0,1,4;0,0,0,2;0,0,0,0) $ = P39 习题二 25 #ac #prob[ 设有三张平面两两相交,且交线相互平行,由它们的方程 $ a_(i 1)x + a_(i 2)y + a_(i 3)z = d_i\,quad i=1,2,3 $ 组成的线性方程组的系数矩阵与增广矩阵分别记为 $bold(A),overline(bold(A))$,则($quad$). *(A)* $r(bold(A))=2, r(overline(bold(A)))=3$\ *(B)* $r(bold(A))=2, r(overline(bold(A)))=2$\ *(C)* $r(bold(A))=1, r(overline(bold(A)))=3$\ *(D)* $r(bold(A))=1, r(overline(bold(A)))=1$\ ] 两两平面有交线,故 $r(bold(A)) = 2$. 三平面没有公共点,故相当于线性方程组无解,故 $r(bold(A)) != r(bold(overline(A)))$. 综上,只能选 (A). = P39 习题二 28(2) #ac #prob[ 用初等变换将矩阵化为标准形: $ mat( 1,-1,2,1,0; 2,-2,4,3,0; 4,0,7,3,2; ) $ ] $ mat( 1,-1,2,1,0; 2,-2,4,3,0; 4,0,7,3,2; ) xarrow(R_2-2R_1\ R_3-4R_1) mat( 1,-1,2,1,0; 0,0,0,1,0; 0,4,-1,-1,2; ) xarrow(R_1-R_2\ R_3+R_2) mat( 1,-1,2,0,0; 0,0,0,1,0; 0,4,-1,0,2; ) \ xarrow(1/2R_3) mat( 1,-1,2,0,0; 0,0,0,1,0; 0,2,-1/2,0,1; ) xarrow(C_(24)\ C_(35)) mat( 1,0,0,-1,2; 0,1,0,0,0; 0,0,1,2,-1/2; ) xarrow(C_4+C_1\ C_4-2C_3\ C_5-2C_1\ C_5+1/2C_3) mat( 1,0,0,0,0; 0,1,0,0,0; 0,0,1,0,0; ) $ = P39 习题二 29 #pc #prob[ 判断下面命题是否正确(给出理由): (1) 任意一个矩阵都可以通过初等行变换化为阶梯形矩阵;\ (2) 任意一个给定的矩阵都可以通过不同的初等行变换化为不同的阶梯形矩阵;\ (3) 任意一个矩阵都可以通过初等行变换化为它的相抵标准形;\ (4) 任意一个矩阵都可以通过初等变换化为它的相抵标准形;\ (5) 任意一个给定的矩阵都可以通过不同的初等变换化为不同的相抵标准形;\ (6) 某些矩阵可以通过不同的初等变换化为不同的相抵标准形;\ (7) 如果两个矩阵相抵,那么它们的相抵标准形相同;\ (8) 如果两个矩阵的秩相等,那么它们的相抵标准形相同. ] (1) 正确;可以通过 Gauss 消元完成. (2) 错误;如单位矩阵就不可.#wa (3) 错误;如 $mat(1,0,0;0,0,0;0,0,1)$ 就不可能在不进行初等列变换的情况下化为相抵标准形. (4) 正确. (5) 错误;一个矩阵的相抵标准形唯一. (6) 错误. (7) 正确. (8) 正确.#wa #warn[有可能两矩阵的形状不同.(即 $m$ 和 $n$ 不同)] #warn[助教:若考虑 $OOO$ 矩阵,则 (1)(2) 均为 $bold(X)$,但一般不考虑其相抵标准型.] = P41 补充题二 6 #ac #prob[ 试证明 $n$ 次多项式 $f(x) = a_n x^n + a_(n-1) x^(n-1) + dots.c + a_1 x + a_0$(其中 $a_n!=0$)最多只有 $n$ 个互异的根. ] 若已知 $f(x)$ 的 $m$ 个互异根 $x_1,x_2,dots,x_m$,要求系数向量 $arrow(a) = (a_0,a_1,dots,a_n)$ 存在. - 考虑 $m<=n$ 时,方程个数 $m$ 小于未知数个数 $n+1$,故系数向量一定有解. - 考虑 $m=n+1$ 时,线性方程组形如: $ cases( a_0 + a_1 x_1 + a_2 x_1^2 + dots.c + a_n x_1^n &= 0, a_0 + a_1 x_2 + a_2 x_2^2 + dots.c + a_n x_2^n &= 0, &dots.c, a_0 + a_1 x_(n+1) + a_2 x_(n+1)^2 + dots.c + a_n x_(n+1)^n &= 0, ) $ 根据 Cramer 法则,求其系数矩阵(实际上为 Vandermonde 矩阵)的行列式: #set math.mat(delim: "|") $ |bold(D)| = mat( 1,x_1,x_1^2,dots.c,x_1^n; 1,x_2,x_2^2,dots.c,x_2^n; dots.v,dots.v,dots.v,,dots.v; 1,x_(n+1),x_(n+1)^2,dots.c,x_(n+1)^n; ) = product_(1<=i<j<=n+1) (x_j - x_i) != 0 $ 故系数向量 $arrow(a)$ 应当由唯一解,且: $ a_n = |bold(D_n)| / |bold(D)| = mat( 1,x_1,x_1^2,dots.c,x_1^(n-1),0; 1,x_2,x_2^2,dots.c,x_2^(n-1),0; dots.v,dots.v,dots.v,,dots.v,dots.v; 1,x_(n+1),x_(n+1)^2,dots.c,x_(n+1)^(n-1),0; ) / |bold(D)| = 0 $ 与题设中的 $a_n!=0$ 矛盾,故此时解得的系数向量 $arrow(a)$ 不合法. - 考虑 $m>n+1$ 时,考虑满足其中任取 $n$ 个根的情况,根据上面的方法可得系数向量无解. 故 $n$ 次多项式 $f(x)$ 最多有 $n$ 个互异的根. = (自选)P41 补充题二 3(7) #prob[ 试计算行列式的值: #set math.mat(delim: "|") $ mat( a_0,a_1,dots.c,a_n; a_1,a_2,dots.c,a_0; dots.v,dots.v,,dots.v; a_n,a_0,dots.c,a_(n-1); ) (n+1 "阶循环矩阵的行列式") $ ] = (自选)P41 补充题二 3(8) #prob[ 试计算行列式的值: #set math.mat(delim: "|") $ mat( 1,1,dots.c,1; cos a_1, cos a_2, dots.c, cos a_n; dots.v,dots.v,,dots.v; cos (n-1) a_1, cos(n-1) a_2,dots.c, cos(n-1) a_n; ) $ 其中 $a_1,a_2,dots,a_n in CC$. ]
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/problems/p0005.typ
typst
#import "../helpers.typ": * #import "../solutions/s0005.typ": * = Longest Palindromic Substring Given a string `s`, return the *longest palindromic substring* in `s`. #let longest-palindromic-substring(s) = { // Solve the problem here } #testcases( longest-palindromic-substring, longest-palindromic-substring-ref, ( (s: "babad"), (s: "cbbd"), (s: "abcdefgfedcbb"), (s: "accc"), (s: "a"), (s: "aa"), (s: "asasfsafdaasfsaasa") ) )
https://github.com/VisualFP/docs
https://raw.githubusercontent.com/VisualFP/docs/main/SA/acronyms.typ
typst
// Inspired by https://github.com/Ciolv/typst-template-bachelor-thesis/blob/main/acronyms.typ #let acronyms = ( AST: "Abstract Syntax Tree", API: "Application Programming Interface", FP: "Functional Programming", SA: "Studienarbeit", LSP: "Language Server Protocol", GHC: "Glasgow Haskell Compiler", PoC: "Proof of Concept", GTK: "GIMP ToolKit", OST: "Eastern Switzerland University of Applied Sciences", FFI: "Foreign Functional Interface", FRP: "Functional Reactive Programming", HTML: "HyperText Markup Language", CSS: "Cascading Style Sheets", DOM: "Document Object Model", JS: "JavaScript", OS: "Operating System", UI: "User Interface", UC: "Use Case", NFR: "Non-Functional Requirement" ) #let acronym-descriptions = ( AST: [Tree representation of a program's structure], GTK: [Toolkit for creating graphical user interfaces], FFI: [Interface between two different programming languages], FRP: [A concept that defines types and functions for interactive applications written in a functional language @frp_elliott_hudak], HTML: [Language to define the content structure of, e.g., web sites], CSS: [Language to style the content of, e.g., web sites], DOM: [Tree representation of, e.g., a HTML document], ) #let usedAcronyms = state("usedDic", (:)) #let ac(ac) = { if (not acronyms.keys().contains(ac)) { return rect( fill: red, inset: 8pt, radius: 4pt, [*Error*: Acronym *#ac* not found!], ) } usedAcronyms.display(usedDic => { let label = label("list_of_acronyms") if (usedDic.keys().contains(ac)) { return link(label, ac) } return link(label)[#ac (#acronyms.at(ac))] }); usedAcronyms.update(usedDic => { usedDic.insert(ac, true) return usedDic }) } #let sa_list_of_acronyms() = { locate(loc => if (usedAcronyms.final(loc).len() > 0) { heading(level: 1, "Glossary & List of Acronyms") v(1em) terms( tight: false, separator: [: #h(0.6em)], ..usedAcronyms .final(loc) .pairs() .map(key => key.at(0)) .sorted() .map(key => { let meaning = acronyms.at(key) let description = if (acronym-descriptions.keys().contains(key)) [ \- #acronym-descriptions.at(key)] else [] terms.item(key, meaning + description) }) ) }) }
https://github.com/MRoiban/infofonda-learn
https://raw.githubusercontent.com/MRoiban/infofonda-learn/master/main.typ
typst
#import "@preview/equate:0.2.0": equate #import "@preview/showybox:2.0.1": showybox #import "@preview/lovelace:0.3.0": * #import "@preview/ilm:1.1.2": * #show: ilm.with( title: [Informatique Fondamentale], author: "<NAME>", date: datetime(year: 2024, month: 07, day: 22), abstract: [], preface: [], figure-index: (enabled: true), table-index: (enabled: true), listing-index: (enabled: true) ) #let showbox(title, body) = box()[ #showybox( shadow: ( offset:3.5pt ), title: title, [#body] ) ] #let pseudocodeblock(title, code) = box[#text( font: "FiraCode Nerd Font Mono", ligatures: true )[ #showybox( shadow: ( offset: 3.5pt ), title: title, [#code] ) ]] #let CQFD = box[$space square.filled$] #let cardinal(variable) = box[$bar variable bar$] = Théorie de la complexité #showbox("Problème de décision", [ Un problème de décision est un langage $P subset.eq sum^*$ ]) #showbox("Algorithme de décision",[ Un algorithme qui pour un problème de décision $P$, on a un programme $A$ qui prend comme argument $u in sum^*$ tel que: $ A(u) = cases( 1 #[si $u in$ P] \ 0 #[sinon] ) $ ]) #showbox("La classe "+$cal(P)$, [ La classe $cal(P)$ est la classe des problèmes qui peuvent être décidé en temps polynomial. Tout langage $P in sum^*$ qui a comme un algorithme de décision qui va prendre un temps polynomial pour trouver une solution est alors en $P in cal(P)$: $ A(u) &= O(n^k) \ A(u) &= cases( 1 #[si $u in P$] \ 0 #[sinon] ) $ ]) #showbox("Algorithme de vérification", [ Un algorithme de vérification est un programme $A(u,v)$ qui va prendre comme argument une solution candidate $u in sum^* $ et va vérifier que cette solution est correcte en utilisant un certificat $v$ tel que: $ A(u,v) = cases( 1 #[si $u$ sachant $v in P$ ] \ 0 #[sinon] ) $ ]) #showbox("La classe "+$cal(N)cal(P)$, [ Un problème $P$ est dit dans $cal(N)cal(P)$ s'il existe un algorithme de vérification $A$ en temps polynomial qui prends un mot $u in sum^*$ et une constante $k$, tel que pour tout $u$ les affirmations suivantes sont vraies: 1. $u in P$ 2. la longeur du certificat $v$ est polynomiale: $ bar v bar = O(#cardinal("u") ^k) $ ])
https://github.com/katamyra/Notes
https://raw.githubusercontent.com/katamyra/Notes/main/Personal%20Notes/HandsOnMl/CompiledNotes.typ
typst
#import "../../template.typ": * #show: template.with( title:[ Hands On Machine Learning Notes ], description: [ Notes based on the Book "Hands-On Machine Learning with Scikit-Learn & TensorFlow" by <NAME> ], authors: ( ( name: "<NAME>", link: "https:github.com/katamyra" ), ), ) #set text( fill: rgb("#04055c") ) #include "Modules/MachineLearningLandScape.typ" #include "Modules/Classification.typ"
https://github.com/simon-epfl/notes-ba3-simon
https://raw.githubusercontent.com/simon-epfl/notes-ba3-simon/main/analyseiii/posts/notes.typ
typst
== Reminder: Euclidean spaces - We work in n-dimensional space $x = (x_1, x_2, ..., x_n) $. - 2D: $v = (x_1, x_2) = (x, y)$ - 3D: $v = (x_1, x_2, x_3) = (x, y, z)$ Calculer un produit vectoriel : $ det mat( "", "+", "-", "+"; "+", "axe1", "axe2", "axe3"; "-", "vect1x", "vect1y", "vect1z"; "+", "vect2x", "vect2y", "vect2z"; ) $ === Scalar product If we have $x = (x_1, ..., x_n) $ and $y = (y_1, ..., y_n) $, then: $ x dot y = angle.l x,y angle.r = x_1y_1 + ... + x_n\y_n $ === Cross product (3D) $x = (x_1, x_2, x_3)$ $y = (y_1, y_2, y_3)$ $ x times y = (x_2y_3 - x_3y_2, x_3y_1 - x_1y_3, x_1y_2-x_2y_1) $ === Scalar Field A scalar field $ F : RR arrow.r RR, x arrow.r F(x) $ assigns a scalar value to every point. Examples: temperature, chemical concentration, pressure, probability distribution. Given a scalar field $ F^n arrow.r RR$, the level set of the value $ c in RR$ is: $ { x in RR^n : f(x) = c } $ === Vector Field A vector field assigns a vector to each point in space: $ F : RR^n arrow.r RR^n, x arrow.r (F_1(x), ..., F_n (x)) $ Examples: - $F : RR^2 arrow.r RR^2, (x_1, x_2) arrow.r (-x_2, x_1)$ - $F : RR^2 arrow.r RR^2, (x_1, x_2) arrow.r (2x_1, x_2 + x_3, x_1x_2x_3)$ How to visualize vector fields? Put one arrow for each point in space. - constant vector field - rotational vector field - source vector field #pagebreak() === Gradient, Hessian, Laplacian If $ F : RR^n arrow.r RR$ is a scalar field, then the gradient is the vector field $ nabla F = (partial x_1 f, partial x_2 f, ..., partial x_n f) $ $ nabla = mat( partial x_1; partial x_2; ...; partial x_n; ) $ $ "grad" f = nabla f = mat( partial x_1 f; partial x_2 f; ...; partial x_n f; ) $ Example: $ f(x_1, x_2) = x_1^3 + x_1x_2^5 $ $ gradient f(x_1, x_2) = (3x_1^2 + x_2^5, x_1 dot 5x_2^4) $ - Geometrically, $ gradient f$ points in the direction of the steepest increae of $f$ - The directional derivative of $f$ in direction $v in RR^n$ is: $ D_v f = gradient f dot v = partial x_1 f dot v + ... + partial x_n f dot v_n $ The value $ D_v f$ tells us how $f$ changes as we move in direction $v$. - Along any level set line, the gradient is orthogonal. Example: $f(x_1, x_2) = x_1^2 + x_2^2$ $gradient f(x_1, x_2) = (2x_1, 2x_2)$ Level set of $c = 1$. If $ F : RR^n arrow.r RR$ is a scalar field, then the Hessian of $f$ is a matrix field: $ gradient^2 f = mat( partial_1 partial_1 f, partial_1partial_2 f, ..., partial_1partial_n f; ..., ..., ..., ...; partial_n partial_1 f, ..., ..., partial_n partial_n f ) $ - The Hessian is symmetric if all 2nd directives are continuous - Physical/geometric interpretation contains information on the curvature of the scalar field If $ F : RR^n arrow.r RR$ is a scalar field, then the Laplacian of $f$ is the scalar field: $ laplace f = sum_(i = 1)^n partial_i partial_i f = partial_i partial_i f + partial_2 partial_2 f + ... + partial_n partial_n f $ - Sum of the diagonal entries of the Hessian - Physically relevant in modeling diffusion Poisson problem : $ - laplace u = f$ ($u$ is an unknown scalar field, while $f$ is known, it's a differential equation). Example: $ f(x, y, z) = x y^3e^z $ $ gradient f(x) = (y^3e^z, 3x\y^2e^z, x\y^3e^z) $ $ partial x partial x f = 0 $ $ partial x partial y f = 3y^2e^z $ $ partial x partial z f = y^3e^z $ $ partial y partial y f = 6x\ye^z $ $ partial y partial z f = 3x\y^2e^z $ $ partial z partial z f = x\y^3e^z $ $ nabla^2 f = mat( 0, 3y^2e^z, y^3e^z; 3y^2e^z, 6x\ye^z, 3x\y^2e^z; y^3e^z, 3x\y^2e^z, x\y^3e^z; ) $ $ laplace f = 0 + 6x\ye^z + x\y^3e^z = e^z\x\y(6 + y^2) $ Example: $ F(x) = ||x|| = sqrt(sum_(i = 1)^n x_i^2), x in RR^n $ First partial derivatives: $ partial_i F(x) = partial_i (sum_(i = 1)^n x_i^2)^(1/2) = 1/2 (sum_(i = 1)^n x_i^2)^(-1/2) dot 2x_i = 1/(||x||) x_i = x_i/(||x||) $ Notice the singularity at $x = 0$. It looks like the gradient is not defined but in fact it can be removed by continuous extension of the first derivatives. Second partial derivatives (case disjunction): $ partial_i partial_i f(x) = partial_i (x_i/(||x||)) = partial_i (x_i dot ||x||^(-1)) = 1/(||x||) + x_i dot (-1/(||x||^2)(partial_i ||x||)) $ $ = 1/(||x||) + x_i dot -1/(||x||^2) dot x_i/(||x||) = 1/(||x||) - x^2 dot 1/(||x||^3) $ $ partial_j partial_i f(x) = partial_j (x_i/(||x||)) = 0 + x_i dot -1/(||x||^2)(partial_j ||x||) = x_i dot -1/(||x||^2) (x_j)/(||x||) = (-x_i x_j)/(||x||^3) $ All partial derivatives of order 2, we can build the Hessiam matrix. We want the Laplacian too: $ laplace f(x) = sum_(i = 1)^n partial_i partial_i f(x) = sum_(i = i)^n 1/(||x||) - (x_i^2)/(||x||^3) = n/(||x||) - (sum_(i = 1)^n x_i^2)/(||x||^3) $ $ = n/(||x||) - (||x||^2)/(||x||^3) = (n-1)/(||x||) $ == Divergence Given a vector field $ F : RR^n arrow.r RR^n, x arrow.r (F_1(x), ..., F_n(x))$ The divergence is the vector field: $ "div" F = sum_(i = 1)^n partial_i F_i = partial_1 F_1 + partial_2 F_2 + ... + partial_n F_n $ - formally, $"div" F = nabla dot F $ - the Laplacian is the divergence of the gradient: $laplace F = "div" gradient F$ Example: $ "div" (x_1^2x_2, x_2^3, e^(x_3)) = 2x_1x_2 + 3x_2^2 + e^(x_3) $ == Rotation or curl of vector fields If $ F: RR^3 arrow.r RR^3$ is a 3D vector field, $F=(F_1, F_2, F_3)$, then the curl/rotation is a 3D vector field: $ "curl" F = "rot" F = mat( - partial_3 F_2 + partial_2 F_3; - partial_1 F_3 + partial_3 F_1; - partial_2 F_1 + partial_1 F_2; ) $ Formally, $ "curl" F = nabla times F$. Only works in 3D. There is a rotation in 2D: If $F : RR^2 arrow.r RR^2$ is a 2D vector fireld, then the rotation/curl of $F$ is a scalar field. $ "curl" F = "rot" F = - partial_2 F_1 + partial_1 F_2 $ Motivation: we formally extend the vector field with a third coordinate $F_3 = 0$. $ tilde(F) = mat( F_1; F_2; 0 ) => "curl" F = mat( - partial_3 F_2 + partial_2 F_3; - partial_1 F_3 + partial_3 F_1; - partial_2 F_1 + partial_1 F_2; ) = mat( 0; 0; - partial_2 F_1 + partial_1 F_2; ) $ Examples: the divergence measures the presence of sinks and sources ("puits et sources"), while rotation measures the presence of a spin. == Curve $ integral_a^b f(x) d x = "integrate f over interval " [a,b] $ Now we generalize this: $ integral_gamma f d l = "integrate f over curve " gamma $ #image("curvey.png", width: 50%) A curve is a function $ gamma: [a, b] arrow RR^n, t arrow gamma(t) $ We may also think as $gamma(t)$ as a position in time. The image of $gamma(t)$ is written $Gamma(t)$. Some examples: $gamma(t): [0, T] arrow RR^3$ can be the 3D position of a drone flying. $gamma(t): [0, 1] arrow RR^2$ can be the position at $t$% of a car travel on a map. $gamma(t): [0, 2 pi] arrow RR^2, t arrow (cos(t), sin(t))$ is the parametrization of the unit circle (as $t$ progresses, we travel the unit circle). Two functions can represent the same curve! $gamma_1(t): [0, 1] arrow RR^2, t arrow (t, t^2)$ \ $gamma_2(t): [0, 1] arrow RR^2, t arrow (sqrt(t), t)$ #image("graphx^2.png", width: 50%) === Notions and definitions We call a curve $gamma(t): [a, b] arrow RR^n, t arrow (gamma_1(t), gamma_2(t), ..., gamma_n(t))$ - *simple*: if it does not self-intersect (formally, $gamma: [a, b] arrow RR^n$ is injective) - *closed*: if $gamma(a) = gamma(b)$ - *differentiable* if $gamma_1(t), ..., gamma_n(t)$ are differentiable - *regular* if the curve is differentiable and the vector $forall t (dot(gamma_1(t)), ..., dot(gamma_n(t))) eq.not arrow(0)$ (the derivatives are never 0 all together). It means that curve never comes to a full stop, they always keep moving. === Tangential vectors and speed The tangent vector of a curve $gamma(t)$ is: $dot(gamma(t)) = (dot(gamma_1(t)), ..., dot(gamma_2(t)))$ and the speed is: $|dot(gamma(t))| = sqrt((dot(gamma_1(t))^2, ..., dot(gamma_2(t))^2))$ #image("velocity.png", width: 50%) Similar to the definition of the derivative: $ dot(gamma(t)) = lim_(h arrow 0) (gamma(t + h) - gamma(t))/(h) $ #image("tplush.png", width: 30%) Example: $gamma: [0, 2 pi] arrow RR^2, t arrow (cos(t), sin(t)) $ \ $dot(gamma(t)) = (-sin(t), cos(t)) $ #image("unitcircder.png", width: 50%) #pagebreak() == Curve Integrals #image("newintegrals.png") Let $gamma: [a, b] arrow RR^n$ be a curve Let $f: RR^n arrow R$ be a scalar field The integral of $f$ over $Gamma$ is: $ integral_Gamma f d l := integral_a^b (f compose gamma)(t) |dot(gamma(t))| d t $ $ = integral_a^b (f compose gamma)(t) sqrt((dot(gamma_1(t))^2 + ... + dot(gamma_n)(t)^2)) d t $ The curve integral only depends on the curve $Gamma$, not $gamma$ (which is what we want, we need the curve, not the parametrization, see eg. where we had 2 functions for one curve). - where $gamma$ is slow, $dot(gamma)$ is small - where $gamma$ is fast, $dot(gamma)$ is large En fait si la fonction va très lentement, on va "utiliser" une grande partie de notre portion de a vers b pour la tracer, mais on réduit dcp le facteur. If $gamma : [a, b] arrow RR^n$ is a simple regular curve, then $integral_Gamma F d l$ only depends on $Gamma$. And it should! After all, $gamma$ is just a parametrization and $Gamma$ is the "physical" object. == Curve integrals of vector fields Given a curve $ gamma: [a,b] arrow RR^n$ and a vector field $ F: RR^n arrow RR^n$ we define: $ integral_(Gamma) arrow(F) d l := integral_a^b arrow(F)(gamma(t)) dot dot(y)(t) d t $ $ = integral_a^b F_1(gamma(t)) dot dot(y_1)(t) + ... + F_n (gamma(t)) dot dot(y_n)(t) d t $ Example: Suppose $arrow(F) = nabla f$ is the gradient of scalar field $ integral_Gamma arrow(F) d l = integral_(Gamma) nabla f d l = integral_a^b nabla f(gamma(t)) dot dot(gamma)(t) d t $ We observe $ (f compose y)' = nabla f(gamma(t)) dot dot(gamma)(t) " (see Analysis II)" $ $ = integral_a^b (f compose gamma)'(t) d t = f(gamma(b)) - f(gamma(a)) $ One more perspective of curve integrals fo vector fields. Suppose $ F : RR^n arrow RR^n$ and a curve $ gamma: [a, b] arrow RR^n$. $ integral F d l = integral_a^b F(gamma(t) dot dot(gamma(t))) = integral_a^b F(gamma(t)) dot dot(gamma(t))/(||dot(gamma(t))||) ||dot(gamma(t))|| d t $ At any time $t$, the vector $tau(t) = dot(gamma(t))/(||dot(gamma(t))||)$ is the unit tangent vector at time $t$. $ integral_Gamma F d l = integral_a^b F(gamma(t)) dot tau(t) dot ||dot(gamma(t))|| d t = integral_gamma F dot tau d l $ We can break our integral into pieces of simple and regular differentiable curves. $ integral_Gamma f d l = integral_a^b f dot y |dot(gamma)| d t = integral_b^c f dot y dot |dot(gamma)| d t + integral_c^d f dot gamma dot |dot(gamma)| d t $ == Conservative vector fields and their potentials Let $ F : Omega arrow RR^n$ be a vector field, $ Gamma subset RR^n$ open. Does there exist a potential $f$ of $F$ over $Omega$, i.e. $f in C'(Omega, RR)$ such that $nabla f = F$? *Theorem*: Let $Omega subset RR^n$ be open and $arrow(F) in C'(Omega, RR^n), F = (F_1, F_2, ..., F_n)$. If $arrow(F)$ has a potential then $partial_i F_j = partial_j F_i, 1 <= i,j <= n$. *Proof*: if $F$ admits a potential $f in C'(Omega, RR)$, then already $f in C^2(Omega, RR)$. Given $1 <= i,j <= n$, we see: $ partial_i F_j = partial_i partial_j f = partial_j partial_i f = partial_j F_i $ using Schwarz. *Remark*: This is a necessary condition but not a sufficient one. We use that $"Hess"(f)$ is symmetric. We call $F in C'(Omega, RR^n)$ conservative if $partial_j F_i = partial_i F_j, i <= i,j <= n$. Let $Omega in RR^n$. We call this set: - *convex* if $forall (x, y) in Omega$ the line segment from $x$ to $y$ is within $Omega$. - *star-shaped* if $exists z in Omega forall x in Omega$ the line segment from $z$ to $x$ is within $Omega$. Formally: $ [x,y] := { t x + (1 - t)y : t in [0, 1] } $ line segment from $x$ to $y$. Image of the curve $gamma : [0, 1] arrow RR^n, t arrow t x + (1 - t)y $ $ Omega$ convex $:arrow.double.l.r forall (x, y) in Omega : [x, y] in Omega$ \ $ Omega$ star-shaped $:arrow.double.l.r exists z forall x in Omega : [z, x] in Omega$ Theorem: let $Omega subset RR^n$ be open and star-shaped with respect to $z in Omega$. If $F in C'(Omega, RR^n)$ is conservative, then $arrow(F)$ has a potential $f in C^2(Omega, RR)$. $ f(x) := integral_0^1 F(z + t(x - z)) dot (x - z) d t $ $ = integral_y F d l " where " y: [0, 1] arrow RR^n : t arrow z + t(x - z) $ It depends on the choice of $z$! Convex and star-shaped domains are important but simple. What if the domain has holes? $ Omega = { x in RR^3 | ||x|| > 1 }, Omega = RR^2 \\ {(0, 0)} $ Example: Can we find a potentiel for $ F(x, y) = (x/(sqrt(x^2 + y^2)), y/sqrt(x^2 + y^2)) $ Smooth vector field over $Omega = RR^2 \\ {(0, 0)}$ we check that it is curl-free and that $ integral_y F d l = 0 $ for some simple closed regular curve around $(0, 0)$. - check whether $partial_x F_y = partial_y F_x$ - consider closed simple regular curve $gamma : [0, 2pi] arrow RR^2, t arrow (cos(t), sin(t)), integral_gamma F d l = 0$ There exists a potential! How to find it? Suppose $f in C'(Omega, RR)$ with $nabla f = F$. For any closed simple regular curve $gamma integral_gamma F d l = f(gamma(b)) - f(gamma(a))$. We construct a potential. Here we use a piecewise regular curves. - We pick $f(1,0) = C$. - For any $x > 0$, let $gamma_X : [0, 1] arrow RR^2, t arrow (1 + t(x - 1), 0)$. Obviously the straight line from $(1, 0)$ to $(x, 0)$. $f(x, 0) - f(1, 0) = integral_gamma_X F d l = ... = x - 1$ then $f(x, 0) = x + f(1, 0) - 1$ - Next, suppose $(x, y) = (r cos (theta), r sin (theta))$ for $r > 0$, and $0 <= theta < 2pi$. Let $delta_(x, y) $
https://github.com/xdoardo/co-thesis
https://raw.githubusercontent.com/xdoardo/co-thesis/master/thesis/appendices/proofs.typ
typst
#import "/includes.typ": * //typstfmt::off = Proofs<appendix-proofs> == The delay monad #refproof(label: <proof-weak-bisimilarity-equivalence>, thmref: <thm-weak-bisimilarity-equivalence>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Codata/Sized/Delay/WeakBisimilarity/Relation/Binary/Equivalence.agda#L16")[ ```hs reflexive : Reflexive R -> ∀ {i} -> Reflexive (WeakBisim R i) reflexive refl^R {i} {now x} = now refl^R reflexive refl^R {i} {later x} = later λ where .force -> reflexive (refl^R) symmetric : Sym P Q -> ∀ {i} -> Sym (WeakBisim P i) (WeakBisim Q i) symmetric sym^PQ (now x) = now (sym^PQ x) symmetric sym^PQ (later x) = later λ where .force -> symmetric (sym^PQ) (force x) symmetric sym^PQ {i} (laterₗ x ) = laterᵣ (symmetric sym^PQ x) symmetric sym^PQ (laterᵣ x) = laterₗ (symmetric sym^PQ x) --- ... transitive-now : ∀ {i} {x y z} (t : Trans P Q R) (p : WeakBisim P ∞ (now x) y) (q : WeakBisim Q ∞ y z) -> WeakBisim R i (now x) z transitive-now t (now p) (now q) = now (t p q) transitive-now t (now p) (laterᵣ q) = laterᵣ (transitive-now t (now p) q) transitive-now t (laterᵣ p) (later x) = laterᵣ (transitive-now t p (force x)) transitive-now t (laterᵣ p) (laterᵣ q) = laterᵣ (transitive-now t p (laterˡ⁻¹ q)) transitive-now t (laterᵣ p) (laterₗ q) = transitive-now t p q mutual transitive-later : ∀ {i} {x y z} (t : Trans P Q R) (p : WeakBisim P ∞ (later x) y) (q : WeakBisim Q ∞ y z) -> WeakBisim R i (later x) z transitive-later t p (later q) = later λ { .force → transitive t (later⁻¹ p) (force q) } transitive-later t p (laterᵣ q) = later λ { .force → transitive t (laterˡ⁻¹ p) q } transitive-later t p (laterₗ q) = transitive-later t (laterʳ⁻¹ p) q transitive-later t (laterₗ p) (now q) = laterₗ (transitive t p (now q)) transitive : ∀ {i} (t : Trans P Q R) -> Trans (WeakBisim P ∞) (WeakBisim Q ∞) (WeakBisim R i) transitive t {now x} p q = transitive-now t p q transitive t {later x} p q = transitive-later t p q ``` ]] #refproof(label: <proof-delay-monad>, thmref: <thm-delay-monad>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Codata/Sized/Delay/Examples.agda#L19")[ ```hs left-identity : ∀ {i} (x : A) (f : A -> Delay B i) -> (now x) >>= f ≡ f x left-identity {i} x f = _≡_.refl right-identity : ∀ {i} (x : Delay A ∞) -> i ⊢ x >>= now ≈ x right-identity (now x) = now _≡_.refl right-identity {i} (later x) = later (λ where .force -> right-identity (force x)) associativity : ∀ {i} {x : Delay A ∞} {f : A -> Delay B ∞} {g : B -> Delay C ∞} -> i ⊢ (x >>= f) >>= g ≈ x >>= λ y -> (f y >>= g) associativity {i} {now x} {f} {g} with (f x) ... | now x₁ = Codata.Sized.Delay.Bisimilarity.refl ... | later x₁ = Codata.Sized.Delay.Bisimilarity.refl associativity {i} {later x} {f} {g} = later (λ where .force -> associativity {x = force x}) ``` ]] == The Imp programming language #refproof(label: <proof-tilde-transitive>, thmref: <thm-imp-store-tilde-transitive>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Syntax/Ident.agda#L87")[ ``` ∻-trans : ∀ {s₁ s₂ s₃ : Store} (h₁ : s₁ ∻ s₂) (h₂ : s₂ ∻ s₃) -> s₁ ∻ s₃ ∻-trans h₁ h₂ id∈σ = h₂ (h₁ id∈σ) ``` ] ] #block(breakable: false)[ #refproof(label: <proof-ceval-store-tilde>, thmref: <lemma-ceval-store-tilde>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Semantics/BigStep/Functional/Properties.agda#L91")[ ```hs ceval⇓=>⊑ᵘ : ∀ (c : Command) (s s' : Store) (h⇓ : (ceval c s) ⇓ s') -> s ⊑ᵘ s' ceval⇓=>⊑ᵘ skip s .s (nowj refl) x = x ceval⇓=>⊑ᵘ (assign id a) s s' h⇓ {id₁} x with (aeval a s) ... | just v with h⇓ ... | nowj refl with (id == id₁) in eq-id ... | true rewrite eq-id = v , refl ... | false rewrite eq-id = x ceval⇓=>⊑ᵘ (ifelse b cᵗ cᶠ) s s' h⇓ x with (beval b s) in eq-b ... | just true rewrite eq-b = ceval⇓=>⊑ᵘ cᵗ s s' h⇓ x ... | just false rewrite eq-b = ceval⇓=>⊑ᵘ cᶠ s s' h⇓ x ceval⇓=>⊑ᵘ (seq c₁ c₂) s s' h⇓ {id} with (bindxf⇓=>x⇓ {x = ceval c₁ s} {f = ceval c₂} h⇓) ... | sⁱ , c₁⇓sⁱ with (bindxf⇓-x⇓=>f⇓ {x = ceval c₁ s} {f = ceval c₂} h⇓ c₁⇓sⁱ) ... | c₂⇓s' = ⊑ᵘ-trans (ceval⇓=>⊑ᵘ c₁ s sⁱ c₁⇓sⁱ {id}) (ceval⇓=>⊑ᵘ c₂ sⁱ s' c₂⇓s' {id}) {id} ceval⇓=>⊑ᵘ (while b c) s s' h⇓ {id} x with (beval b s) in eq-b ... | just false with h⇓ ... | nowj refl = x ceval⇓=>⊑ᵘ (while b c) s s' h⇓ {id} x | just true rewrite eq-b = while-⊑ᵘ c b s s' (λ s₁ s₂ h -> ceval⇓=>⊑ᵘ c s₁ s₂ h) h⇓ {id} x ``` ]] ] #block(breakable: false)[ #refproof(label: <proof-cf-equiv>, thmref:<thm-cf-equiv>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Data/CharacteristicFunction.agda#L49")[ ```hs cf-ext : ∀ {s₁ s₂ : CharacteristicFunction} -> (a-ex : ∀ x -> s₁ x ≡ s₂ x) -> s₁ ≡ s₂ cf-ext a-ex = ext a Agda.Primitive.lzero a-ex ``` ]] ] #block(breakable: false)[ #refproof(label: <proof-ceval-sc-subeq>, thmref: <lemma-ceval-sc-subeq>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Semantics/BigStep/Functional/Properties.agda#L134")[ ```hs ceval⇓=>sc⊆s' : ∀ (c : Command) (s s' : Store) (h⇓ : (ceval c s) ⇓ s') -> (dom s ∪ (cvars c)) ⊆ (dom s') ceval⇓=>sc⊆s' skip s .s (now refl) x x-in-s₁ rewrite (cvars-skip) rewrite (∨-identityʳ (dom s x)) = x-in-s₁ ceval⇓=>sc⊆s' (assign id a) s s' h⇓ x x-in-s₁ with (aeval a s) ... | nothing with h⇓ ... | now () ceval⇓=>sc⊆s' (assign id a) s s' h⇓ x x-in-s₁ | just v with h⇓ ... | now refl with (id == x) in eq-id ... | true = refl ... | false rewrite eq-id rewrite (∨-identityʳ (dom s x)) with s x in eq-sx ... | just x₁ rewrite eq-sx = refl ceval⇓=>sc⊆s' (ifelse b cᵗ cᶠ) s s' h⇓ x x-in-s₁ with (beval b s) in eq-b ... | nothing with h⇓ ... | now () ceval⇓=>sc⊆s' (ifelse b cᵗ cᶠ) s s' h⇓ x x-in-s₁ | just false rewrite eq-b = ceval⇓=>sc⊆s' cᶠ s s' h⇓ x (h {dom s x} {cvars cᵗ x} {cvars cᶠ x} x-in-s₁) ceval⇓=>sc⊆s' (ifelse b cᵗ cᶠ) s s' h⇓ x x-in-s₁ | just true rewrite eq-b = ceval⇓=>sc⊆s' cᵗ s s' h⇓ x (h {dom s x} {cvars cᵗ x} {cvars cᶠ x} x-in-s₁) ceval⇓=>sc⊆s' (seq c₁ c₂) s s' h⇓ x x-in-s₁ with (bindxf⇓=>x⇓ {x = ceval c₁ s} {f = ceval c₂} h⇓) ... | sⁱ , c₁⇓sⁱ with (bindxf⇓-x⇓=>f⇓ {x = ceval c₁ s} {f = ceval c₂} h⇓ c₁⇓sⁱ) ... | c₂⇓s' with (ceval⇓=>sc⊆s' c₁ s sⁱ c₁⇓sⁱ x) ... | n with (ceval⇓=>sc⊆s' c₂ sⁱ s' c₂⇓s' x) ... | n' with (dom s x) | (cvars c₁ x) | (cvars c₂ x) ... | false | false | true rewrite (∨-zeroʳ (dom sⁱ x)) = n' refl ... | false | true | false rewrite (∨-zeroˡ (false)) rewrite (∨-identityʳ (dom sⁱ x)) = n' (n refl) ... | false | true | true rewrite (∨-zeroˡ (false)) rewrite (∨-zeroʳ (dom sⁱ x)) = n' refl ... | true | n2 | n3 rewrite (∨-zeroˡ (true)) rewrite (n refl) rewrite (∨-identityʳ (dom sⁱ x)) = n' refl ceval⇓=>sc⊆s' (while b c) s s' h⇓ x x-in-s₁ rewrite (cvars-while {b} {c}) rewrite (∨-identityʳ (dom s x)) = ceval⇓=>⊆ (while b c) s s' h⇓ x x-in-s₁ ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-adia-safe>, thmref: <thm-adia-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/DefiniteInitialization.agda#L48")[ ```hs adia-safe : ∀ (a : AExp) (s : Store) -> (dia : avars a ⊆ dom s) -> (∃ λ v -> aeval a s ≡ just v) adia-safe (const n) s dia = n , refl adia-safe (var id) s dia with (avars (var id) id) in eq-avars-id ... | false rewrite (==-refl {id}) with eq-avars-id ... | () adia-safe (var id) s dia | true = in-dom-has-value {s} {id} (dia id eq-avars-id) adia-safe (plus a₁ a₂) s dia with (adia-safe a₁ s (⊆-trans (⊏ᵃ=>⊆ a₁ (plus a₁ a₂) (plus-l a₁ a₂)) dia)) ... | v₁ , eq-aev-a₁ with (adia-safe a₂ s (⊆-trans (⊏ᵃ=>⊆ a₂ (plus a₁ a₂) (plus-r a₁ a₂)) dia)) ... | v₂ , eq-aev-a₂ rewrite eq-aev-a₁ rewrite eq-aev-a₂ = v₁ + v₂ , refl ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-bdia-safe>, thmref: <thm-bdia-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/DefiniteInitialization.agda#L60")[ ```hs bdia-safe : ∀ (b : BExp) (s : Store) -> (dia : bvars b ⊆ dom s) -> (∃ λ v -> beval b s ≡ just v) bdia-safe (const b) s dia = b , refl bdia-safe (le a₁ a₂) s dia with (adia-safe a₁ s (⊆-trans (⊏ᵇᵃ=>⊆ a₁ (le a₁ a₂) (le-l a₁ a₂)) dia)) | (adia-safe a₂ s (⊆-trans (⊏ᵇᵃ=>⊆ a₂ (le a₁ a₂) (le-r a₁ a₂)) dia)) ... | v₁ , eq-a₁ | v₂ , eq-a₂ rewrite eq-a₁ rewrite eq-a₂ = (v₁ ≤ᵇ v₂) , refl bdia-safe (BExp.not b) s dia with (bdia-safe b s (⊆-trans (⊏ᵇᵇ=>⊆ b (BExp.not b) (_⊏ᵇ_.not b)) dia)) ... | v , eq-b rewrite eq-b = (Data.Bool.not v) , refl bdia-safe (and b₁ b₂) s dia with (bdia-safe b₁ s (⊆-trans (⊏ᵇᵇ=>⊆ b₁ (and b₁ b₂) (and-l b₁ b₂)) dia)) | (bdia-safe b₂ s (⊆-trans (⊏ᵇᵇ=>⊆ b₂ (and b₁ b₂) (and-r b₁ b₂)) dia)) ... | v₁ , eq-b₁ | v₂ , eq-b₂ rewrite eq-b₁ rewrite eq-b₂ = (v₁ ∧ v₂) , refl ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-dia-safe>, thmref: <thm-dia-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/DefiniteInitialization.agda#L117")[ ```hs dia-safe : ∀ (c : Command) (s : Store) (v v' : VarsSet) (dia : Dia v c v') (v⊆s : v ⊆ dom s) -> (h-err : (ceval c s) ↯) -> ⊥ dia-safe skip s v v' dia v⊆s (now ()) dia-safe (assign id a) s v .(id ↦ v) (assign .a .v .id a⊆v) v⊆s h-err with (adia-safe a s (⊆-trans a⊆v v⊆s)) ... | a' , eq-aeval with h-err ... | now () dia-safe (ifelse b cᵗ cᶠ) s v .(vᵗ ∩ vᶠ) (if .b .v vᵗ vᶠ .cᵗ .cᶠ b⊆v diaᶠ diaᵗ) v⊆s h-err with (bdia-safe b s λ x x-in-s₁ → v⊆s x (b⊆v x x-in-s₁)) ... | false , eq-beval rewrite eq-beval rewrite eq-beval = dia-safe cᶠ s v vᶠ diaᶠ v⊆s h-err dia-safe (ifelse b cᵗ cᶠ) s v .(vᵗ ∩ vᶠ) (if .b .v vᵗ vᶠ .cᵗ .cᶠ b⊆v diaᶠ diaᵗ) v⊆s h-err | true , eq-beval rewrite eq-beval rewrite eq-beval = dia-safe cᵗ s v vᵗ diaᵗ v⊆s h-err dia-safe (seq c₁ c₂) s v₁ v₃ dia v⊆s h-err with dia ... | seq .v₁ v₂ .v₃ .c₁ .c₂ dia-c₁ dia-c₂ with (ceval c₁ s) in eq-ceval-c₁ ... | now nothing = dia-safe c₁ s v₁ v₂ dia-c₁ v⊆s (≡=>≋ eq-ceval-c₁) ... | now (just s') rewrite eq-ceval-c₁ = dia-safe c₂ s' v₂ v₃ dia-c₂ (dia-ceval=>⊆ dia-c₁ v⊆s (≡=>≋ eq-ceval-c₁)) h-err dia-safe (seq c₁ c₂) s v₁ v₃ dia v⊆s h-err | seq .v₁ v₂ .v₃ .c₁ .c₂ dia-c₁ dia-c₂ | later x with (dia-safe c₁ s v₁ v₂ dia-c₁ v⊆s) ... | c₁↯⊥ rewrite eq-ceval-c₁ = dia-safe-seq-later c₁↯⊥ dia-c₂ h h-err dia-safe (while b c) s v v' dia v⊆s h-err with dia ... | while .b .v v₁ .c b⊆s dia-c with (bdia-safe b s (λ x x-in-s₁ → v⊆s x (b⊆s x x-in-s₁))) ... | false , eq-beval rewrite eq-beval with h-err ... | now () dia-safe (while b c) s v v' dia v⊆s h-err | while .b .v v₁ .c b⊆s dia-c | true , eq-beval with (ceval c s) in eq-ceval-c ... | now nothing = dia-safe c s v v₁ dia-c v⊆s (≡=>≋ eq-ceval-c) dia-safe (while b c) s v v' dia v⊆s h-err | while .b .v v₁ .c b⊆s dia-c | true , eq-beval | now (just s') rewrite eq-beval rewrite eq-ceval-c with h-err ... | laterₗ w↯ = dia-safe (while b c) s' v v dia (⊆-trans v⊆s (ceval⇓=>⊆ c s s' (≡=>≋ eq-ceval-c))) w↯ dia-safe (while b c) s v v' dia v⊆s h-err | while .b .v v₁ .c b⊆s dia-c | true , eq-beval | later x with (dia-safe c s v v₁ dia-c v⊆s) ... | c↯⊥ rewrite eq-beval rewrite eq-ceval-c = dia-safe-while-later c↯⊥ dia h h-err ``` ] ] ] #block(breakable: false)[ #proof(label:<proof-dia-sound-while-later>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/DefiniteInitialization.agda#L165")[ ```hs dia-sound-while-later : ∀ {x : Thunk (Delay (Maybe Store)) ∞} {b c} {v} (l↯⊥ : (later x)↯ -> ⊥) (dia : Dia v (while b c) v) (l⇓s=>⊆ : ∀ {s : Store} -> ((later x) ⇓ s) -> v ⊆ dom s) (w↯ : (bind (later x) (λ s -> later (ceval-while c b s))) ↯) -> ⊥ dia-sound-while-later {x} {b} {c} {v} l↯⊥ dia l⇓s=>⊆ w↯ with (force x) in eq-force-x ... | now nothing = l↯⊥ (laterₗ (≡=>≋ eq-force-x)) dia-sound-while-later {x} {b} {c} {v} l↯⊥ dia l⇓s=>⊆ w↯ | now (just s') with w↯ ... | laterₗ w↯' rewrite eq-force-x with w↯' ... | laterₗ w↯'' = dia-sound (while b c) s' v v dia (l⇓s=>⊆ (laterₗ (≡=>≋ eq-force-x))) w↯'' dia-sound-while-later {x} {b} {c} {v} l↯⊥ dia l⇓s=>⊆ w↯ | later x₁ with w↯ ... | laterₗ w↯' rewrite eq-force-x with w↯' ... | laterₗ w↯'' = dia-sound-while-force {x₁} fx↯=>⊥ dia fx⇓=>⊆ w↯'' where lx↯=>⊥ : (hl : (later x₁) ↯) -> ⊥ lx↯=>⊥ hl rewrite (sym eq-force-x) = l↯⊥ (laterₗ hl) fx↯=>⊥ : (h : (force x₁) ↯) -> ⊥ fx↯=>⊥ h = lx↯=>⊥ (laterₗ {xs = x₁} h) lx⇓=>⊆ : ∀ {s : Store} → (lx₁⇓s : later x₁ ⇓ s) → v ⊆ dom s lx⇓=>⊆ lx₁⇓s rewrite (sym eq-force-x) = l⇓s=>⊆ (laterₗ lx₁⇓s) fx⇓=>⊆ : ∀ {s : Store} → (fx₁⇓s : force x₁ ⇓ s) → v ⊆ dom s fx⇓=>⊆ fx₁⇓s = lx⇓=>⊆ (laterₗ {xs = x₁} fx₁⇓s) ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-apfold-safe>, thmref: <thm-apfold-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/PureFolding/Arith.agda#L31")[ ```hs -- Pure constant folding preserves semantics. apfold-safe : ∀ a s -> (aeval a s ≡ aeval (apfold a) s) apfold-safe (const n) _ = refl apfold-safe (var id) _ = refl apfold-safe (plus a₁ a₂) s rewrite (apfold-safe a₁ s) rewrite (apfold-safe a₂ s) with (apfold a₁) in eq-a₁ | (apfold a₂) in eq-a₂ ... | const n | const n₁ = refl ... | const n | var id = refl ... | const n | plus v₂ v₃ = refl ... | var id | v₂ = refl ... | plus v₁ v₃ | v₂ = refl ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-bpfold-safe>, thmref: <thm-bpfold-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/PureFolding/Bool.agda#L38")[ ```hs bpfold-safe : ∀ b s -> (beval b s ≡ beval (bpfold b) s) bpfold-safe (const b) s = refl bpfold-safe (le a₁ a₂) s rewrite (apfold-safe a₁ s) rewrite (apfold-safe a₂ s) with (apfold a₁) | (apfold a₂) ... | const n | const n₁ = refl ... | const n | var id = refl ... | const n | plus v₂ v₃ = refl ... | var id | v₂ = refl ... | plus v₁ v₃ | v₂ = refl bpfold-safe (not b) s rewrite (bpfold-safe b s) with (bpfold b) ... | const b₁ = refl ... | le a₁ a₂ = refl ... | not v = refl ... | and v v₁ = refl bpfold-safe (and b₁ b₂) s rewrite (bpfold-safe b₁ s) rewrite (bpfold-safe b₂ s) with (bpfold b₁) | (bpfold b₂) ... | const b | const b₃ = refl ... | const b | le a₁ a₂ = refl ... | const b | not v₂ = refl ... | const b | and v₂ v₃ = refl ... | le a₁ a₂ | v₂ = refl ... | not v₁ | v₂ = refl ... | and v₁ v₃ | v₂ = refl ``` ] ] ] #block(breakable: false)[ #refproof(label: <proof-cpfold-safe>, thmref: <thm-cpfold-safe>)[ #mycode("https://github.com/ecmma/co-thesis/blob/master/agda/lujon/Imp/Analysis/PureFolding/Command.agda#L50")[ ```hs cpfold-safe : ∀ (c : Command) (s : Store) -> ∞ ⊢ (ceval c s) ≋ (ceval (cpfold c) s) cpfold-safe skip s rewrite (cpfold-skip) = now refl cpfold-safe (assign id a) s = ≡=>≋ (cpfold-assign a id s) cpfold-safe (ifelse b cᵗ cᶠ) s = cpfold-if b cᵗ cᶠ s cpfold-safe (seq c₁ c₂) s = cpfold-seq c₁ c₂ s cpfold-safe (while b c) s = cpfold-while b c s cpfold-assign : ∀ (a : AExp) (id : Ident) (s : Store) -> (ceval (assign id a) s) ≡ (ceval (cpfold (assign id a)) s) cpfold-assign a id s with (apfold-sound a s) ... | asound with (aeval a s) in eq-av ... | nothing rewrite eq-av rewrite (eqsym asound) with (apfold a) in eq-ap ... | var id₁ rewrite eq-ap rewrite eq-av rewrite eq-av = eqrefl ... | plus n n₁ rewrite eq-ap rewrite eq-av rewrite eq-av = eqrefl cpfold-assign a id s | asound | just x rewrite eq-av rewrite (eqsym asound) with (apfold a) in eq-ap ... | var id₁ rewrite eq-ap rewrite eq-av rewrite eq-av = eqrefl cpfold-assign a id s | asound | just x | plus n n₁ rewrite eq-ap rewrite eq-av rewrite eq-av = eqrefl cpfold-assign a id s | asound | just x | const n rewrite eq-ap rewrite eq-av rewrite eq-av with asound ... | eqrefl = eqrefl cpfold-if : ∀ (b : BExp) (cᵗ cᶠ : Command) (s : Store) -> ∞ ⊢ (ceval (ifelse b cᵗ cᶠ) s) ≋ (ceval (cpfold (ifelse b cᵗ cᶠ)) s) cpfold-if b cᵗ cᶠ s with (bpfold-sound b s) ... | bsound with (beval b s) in eq-b ... | nothing rewrite eq-b rewrite (eqsym bsound) with (bpfold b) in eq-bp ... | le a₁ a₂ rewrite eq-bp rewrite eq-b rewrite eq-b = now eqrefl ... | not n rewrite eq-bp rewrite eq-b rewrite eq-b = now eqrefl ... | and n n₁ rewrite eq-bp rewrite eq-b rewrite eq-b = now eqrefl -- cont ``` ] ] ] //typstfmt::on
https://github.com/sxdl/MCM-Typst-template
https://raw.githubusercontent.com/sxdl/MCM-Typst-template/main/lib.typ
typst
Apache License 2.0
#let text-font = ("Times New Roman", "<NAME>") #let mcm( title: "A Typst Template for MCM/ICM", problem-chosen: "ABCDEF", team-control-number: "1111111", year: "2025", summary: [], keywords: [], magic-leading: 0.65em, body, ) = { set document(title: team-control-number) set text( font: text-font, size: 12pt, lang: "en" ) //----------------------------summary-------------------------// [ #set page( paper: "us-letter", margin: (top: 1.02cm, bottom: 0cm, left: 2.54cm, right: 2.54cm) ) #set par( justify: true, first-line-indent: 2em ) #grid( columns: (5.63cm,) * 3, rows: (14pt,) * 3, align: center + horizon, [*Problem Chosen*], [*#year*], [*Team Control Number*], grid.cell(rowspan: 2, text(size: 20pt)[#problem-chosen]), [*MCM/ICM*], grid.cell(rowspan: 2, text(size: 20pt)[#team-control-number]), [*Summary Sheet*] ) #line(length: 100%, stroke: (thickness: 1.1pt, dash: "solid")) #align(center)[#text()[*#title*]] #align(center)[#text()[*Summary*]] #par(leading: magic-leading)[#summary] *Keywords:* #keywords #counter(page).update(0) // #pagebreak() ] //-----------------------------------------------------------// set page( paper: "us-letter", margin: (top: 2.54cm, bottom: 2.54cm, left: 2.54cm, right: 2.54cm), header: [ Team \# #team-control-number #h(1fr) Page #counter(page).display( "1 of 1", both: true, ) #v(-0.8em) #line(length: 100%, stroke: (thickness: 0.6pt, dash: "solid")) ] ) //--------------------------outline---------------------------// show outline.entry.where( level: 1 ): it => { v(12pt, weak: true) strong(it) } show heading.where(outlined: false): set align(center) outline( indent: auto, ) pagebreak() //--------------------------heading---------------------------// let empty-par = par[#box()] let fake-par = context empty-par + v(-measure(empty-par + empty-par).height) set heading( numbering: "1.1 " ) show heading: it => [#it #v(4pt)] show heading.where(level: 1): it => [#it #v(4pt)] show heading: it => it + fake-par //-------------------------paragraph--------------------------// set par( justify: true, first-line-indent: 2em ) //-------------------------list-----------------------------// set list(indent: 1em) set enum(indent: 1em) show enum: it => it + fake-par //--------------------------figure----------------------------// set figure(gap: 1em) show figure: it => it + fake-par //---------------------------image----------------------------// set image(width: 70%) //---------------------------table----------------------------// show figure.where( kind: table ): set figure.caption(position: top) show table.cell.where(y: 0): strong show table.cell.where(y: 0): set par(justify: false) //---------------------------math-----------------------------// set math.equation(numbering: "(1)") show math.equation.where(block: true): it => it + fake-par //-------------------------reference--------------------------// set bibliography(title: "References") //---------------------------code-----------------------------// show raw.where(block: false): it => box( fill: luma(240), inset: (x: 2pt), outset: (y: 3pt), radius: 1pt )[#text(size: 10pt)[#it]] show raw.where(block: true): it => block( width: 100%, fill: luma(240), inset: 10pt, radius: 3pt, stroke: 0pt, breakable: true )[#it] + fake-par //------------------------------------------------------------// body } //---------------------------enum-----------------------------// #let enum-default = { set enum(numbering: "1.") } #let enum-paren(content) = { set enum(numbering: "1)") content enum-default } //---------------------------image----------------------------// #let img-single(path: str, width: 70%, caption: none, placement: none) = { figure( image(path, width: width), caption: caption, placement: placement ) } #let img-grid(cols: 2, rows: 1, imgs: array, subcaps: (), caption: none, placement: none) = { assert(cols * rows == imgs.len()) let col-width = () let row-height = () let i = cols while i > 0 { col-width.push(90%/cols) i -= 1 } let i = rows while i > 0 { row-height.push(auto) i -= 1 } // subcap completion let i = imgs.len() - subcaps.len() while i > 0 { subcaps.push(none) i -= 1 } // cells let cells = () let i = 0 while i < rows { let j = 0 while j < cols { cells.push( grid.cell(image(imgs.at(i * cols + j), width: 70%), align: bottom) ) j += 1 } let k = 0 while k < cols { cells.push( grid.cell(subcaps.at(i * cols + k), align: top) ) k += 1 } i += 1 } rows += 1 figure( grid( columns: col-width, rows: row-height, column-gutter: 0.5em, row-gutter: 0.5em, align: bottom, ..cells, ), caption: caption, placement: placement ) } //---------------------------table----------------------------// #let threee-line-table(columns: array, align: auto, headers: array, bodies: array, caption: content) = { figure( table( columns: columns, align: align, stroke: (_, y) => ( top: if y == 0 {1pt} else if y == 1 {0.6pt} else {0pt}, bottom: 1pt, ), ..headers, ..bodies, ), caption: caption ) } //---------------------------tools----------------------------// #let no-indent = context h(-par.first-line-indent) #let math-no-number(content) = { set math.equation(numbering: none) content } #let place-here(it) = { set figure(placement: auto) it }
https://github.com/SeniorMars/tree-sitter-typst
https://raw.githubusercontent.com/SeniorMars/tree-sitter-typst/main/examples/compute/calc.typ
typst
MIT License
// Test math functions. // Ref: false --- // Test conversion to numbers. #test(int(false), 0) #test(int(true), 1) #test(int(10), 10) #test(int("150"), 150) #test(int(10 / 3), 3) #test(float(10), 10.0) #test(float("31.4e-1"), 3.14) #test(type(float(10)), "float") --- #test(calc.round(calc.e, digits: 2), 2.72) #test(calc.round(calc.pi, digits: 2), 3.14) --- // Error: 6-10 expected boolean, integer, float, or string, found length #int(10pt) --- // Error: 8-13 expected boolean, integer, float, or string, found function #float(float) --- // Error: 6-12 not a valid integer #int("nope") --- // Error: 8-15 not a valid float #float("1.2.3") --- // Test the `abs` function. #test(calc.abs(-3), 3) #test(calc.abs(3), 3) #test(calc.abs(-0.0), 0.0) #test(calc.abs(0.0), -0.0) #test(calc.abs(-3.14), 3.14) #test(calc.abs(50%), 50%) #test(calc.abs(-25%), 25%) --- // Error: 11-22 expected integer, float, length, angle, ratio, or fraction, found string #calc.abs("no number") --- // Test the `even` and `odd` functions. #test(calc.even(2), true) #test(calc.odd(2), false) #test(calc.odd(-1), true) #test(calc.even(-11), false) --- // Test the `mod` function. #test(calc.mod(1, 1), 0) #test(calc.mod(5, 3), 2) #test(calc.mod(5, -3), 2) #test(calc.mod(22.5, 10), 2.5) #test(calc.mod(9, 4.5), 0) --- // Error: 14-15 divisor must not be zero #calc.mod(5, 0) --- // Error: 16-19 divisor must not be zero #calc.mod(3.0, 0.0) --- // Test the `min` and `max` functions. #test(calc.min(2, -4), -4) #test(calc.min(3.5, 1e2, -0.1, 3), -0.1) #test(calc.max(-3, 11), 11) #test(calc.min("hi"), "hi") --- // Error: 10-12 expected at least one value #calc.min() --- // Error: 14-18 cannot compare integer and string #calc.min(1, "hi") --- // Test the `range` function. #test(range(4), (0, 1, 2, 3)) #test(range(1, 4), (1, 2, 3)) #test(range(-4, 2), (-4, -3, -2, -1, 0, 1)) #test(range(10, 5), ()) #test(range(10, step: 3), (0, 3, 6, 9)) #test(range(1, 4, step: 1), (1, 2, 3)) #test(range(1, 8, step: 2), (1, 3, 5, 7)) #test(range(5, 2, step: -1), (5, 4, 3)) #test(range(10, 0, step: -3), (10, 7, 4, 1)) --- // Error: 7-9 missing argument: end #range() --- // Error: 11-14 expected integer, found float #range(1, 2.0) --- // Error: 17-22 expected integer, found string #range(4, step: "one") --- // Error: 18-19 number must be positive #range(10, step: 0)
https://github.com/RodolpheThienard/typst-template
https://raw.githubusercontent.com/RodolpheThienard/typst-template/main/beamer/example/example.typ
typst
MIT License
#import "../beamer.typ" : beamer #show: beamer.with( title: "Title page", author: "author", date: [#datetime.today().display(" [Month repr:numerical], [day] [year]")], end: "End Slide", ) = Title part == 1 slide #figure(image("../../.picture/logo.png", height: 50%)) == 2 slide
https://github.com/Complex2-Liu/macmo
https://raw.githubusercontent.com/Complex2-Liu/macmo/main/contests/2023/content/problem-07.typ
typst
#import "../lib/math.typ": problem, proof, note, ans #problem[ 求最大的实数 $k$ 使得对于任意的正数 $a$ 和 $b$, 均有 $(a + b)(a b + 1)(b + 1) >= k a b^2$, 并给出证明. ] #proof[ 取 $a = 1, b = 2$ 便知 $k <= 27 / 4$. 然后我们这样来凑: $ a + b = a + b / 2 + b / 2 &>= 3 dot 4^(-1/3) dot a^(1/3)b^(2/3) \ a b + 1 = (a b) / 2 + (a b) / 2 + 1 &>= 3 dot 4^(-1/3) dot a^(2/3)b^(2/3) \ b + 1 = b / 2 + b / 2 + 1 &>= 3 dot 4^(-1/3) dot b^(2/3) $ 三式相乘便知 $(a + b)(a b + 1)(b + 1) >= 27/4 a b^2$. ] /* vim: set ft=typst: */
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10080.typ
typst
Apache License 2.0
#let data = ( ("LINEAR B IDEOGRAM B100 MAN", "Lo", 0), ("LINEAR B IDEOGRAM B102 WOMAN", "Lo", 0), ("LINEAR B IDEOGRAM B104 DEER", "Lo", 0), ("LINEAR B IDEOGRAM B105 EQUID", "Lo", 0), ("LINEAR B IDEOGRAM B105F MARE", "Lo", 0), ("LINEAR B IDEOGRAM B105M STALLION", "Lo", 0), ("LINEAR B IDEOGRAM B106F EWE", "Lo", 0), ("LINEAR B IDEOGRAM B106M RAM", "Lo", 0), ("LINEAR B IDEOGRAM B107F SHE-GOAT", "Lo", 0), ("LINEAR B IDEOGRAM B107M HE-GOAT", "Lo", 0), ("LINEAR B IDEOGRAM B108F SOW", "Lo", 0), ("LINEAR B IDEOGRAM B108M BOAR", "Lo", 0), ("LINEAR B IDEOGRAM B109F COW", "Lo", 0), ("LINEAR B IDEOGRAM B109M BULL", "Lo", 0), ("LINEAR B IDEOGRAM B120 WHEAT", "Lo", 0), ("LINEAR B IDEOGRAM B121 BARLEY", "Lo", 0), ("LINEAR B IDEOGRAM B122 OLIVE", "Lo", 0), ("LINEAR B IDEOGRAM B123 SPICE", "Lo", 0), ("LINEAR B IDEOGRAM B125 CYPERUS", "Lo", 0), ("LINEAR B MONOGRAM B127 KAPO", "Lo", 0), ("LINEAR B MONOGRAM B128 KANAKO", "Lo", 0), ("LINEAR B IDEOGRAM B130 OIL", "Lo", 0), ("LINEAR B IDEOGRAM B131 WINE", "Lo", 0), ("LINEAR B IDEOGRAM B132", "Lo", 0), ("LINEAR B MONOGRAM B133 AREPA", "Lo", 0), ("LINEAR B MONOGRAM B135 MERI", "Lo", 0), ("LINEAR B IDEOGRAM B140 BRONZE", "Lo", 0), ("LINEAR B IDEOGRAM B141 GOLD", "Lo", 0), ("LINEAR B IDEOGRAM B142", "Lo", 0), ("LINEAR B IDEOGRAM B145 WOOL", "Lo", 0), ("LINEAR B IDEOGRAM B146", "Lo", 0), ("LINEAR B IDEOGRAM B150", "Lo", 0), ("LINEAR B IDEOGRAM B151 HORN", "Lo", 0), ("LINEAR B IDEOGRAM B152", "Lo", 0), ("LINEAR B IDEOGRAM B153", "Lo", 0), ("LINEAR B IDEOGRAM B154", "Lo", 0), ("LINEAR B MONOGRAM B156 TURO2", "Lo", 0), ("LINEAR B IDEOGRAM B157", "Lo", 0), ("LINEAR B IDEOGRAM B158", "Lo", 0), ("LINEAR B IDEOGRAM B159 CLOTH", "Lo", 0), ("LINEAR B IDEOGRAM B160", "Lo", 0), ("LINEAR B IDEOGRAM B161", "Lo", 0), ("LINEAR B IDEOGRAM B162 GARMENT", "Lo", 0), ("LINEAR B IDEOGRAM B163 ARMOUR", "Lo", 0), ("LINEAR B IDEOGRAM B164", "Lo", 0), ("LINEAR B IDEOGRAM B165", "Lo", 0), ("LINEAR B IDEOGRAM B166", "Lo", 0), ("LINEAR B IDEOGRAM B167", "Lo", 0), ("LINEAR B IDEOGRAM B168", "Lo", 0), ("LINEAR B IDEOGRAM B169", "Lo", 0), ("LINEAR B IDEOGRAM B170", "Lo", 0), ("LINEAR B IDEOGRAM B171", "Lo", 0), ("LINEAR B IDEOGRAM B172", "Lo", 0), ("LINEAR B IDEOGRAM B173 MONTH", "Lo", 0), ("LINEAR B IDEOGRAM B174", "Lo", 0), ("LINEAR B IDEOGRAM B176 TREE", "Lo", 0), ("LINEAR B IDEOGRAM B177", "Lo", 0), ("LINEAR B IDEOGRAM B178", "Lo", 0), ("LINEAR B IDEOGRAM B179", "Lo", 0), ("LINEAR B IDEOGRAM B180", "Lo", 0), ("LINEAR B IDEOGRAM B181", "Lo", 0), ("LINEAR B IDEOGRAM B182", "Lo", 0), ("LINEAR B IDEOGRAM B183", "Lo", 0), ("LINEAR B IDEOGRAM B184", "Lo", 0), ("LINEAR B IDEOGRAM B185", "Lo", 0), ("LINEAR B IDEOGRAM B189", "Lo", 0), ("LINEAR B IDEOGRAM B190", "Lo", 0), ("LINEAR B IDEOGRAM B191 HELMET", "Lo", 0), ("LINEAR B IDEOGRAM B220 FOOTSTOOL", "Lo", 0), ("LINEAR B IDEOGRAM B225 BATHTUB", "Lo", 0), ("LINEAR B IDEOGRAM B230 SPEAR", "Lo", 0), ("LINEAR B IDEOGRAM B231 ARROW", "Lo", 0), ("LINEAR B IDEOGRAM B232", "Lo", 0), ("LINEAR B IDEOGRAM B233 SWORD", "Lo", 0), ("LINEAR B IDEOGRAM B234", "Lo", 0), ("LINEAR B IDEOGRAM B236", "Lo", 0), ("LINEAR B IDEOGRAM B240 WHEELED CHARIOT", "Lo", 0), ("LINEAR B IDEOGRAM B241 CHARIOT", "Lo", 0), ("LINEAR B IDEOGRAM B242 CHARIOT FRAME", "Lo", 0), ("LINEAR B IDEOGRAM B243 WHEEL", "Lo", 0), ("LINEAR B IDEOGRAM B245", "Lo", 0), ("LINEAR B IDEOGRAM B246", "Lo", 0), ("LINEAR B MONOGRAM B247 DIPTE", "Lo", 0), ("LINEAR B IDEOGRAM B248", "Lo", 0), ("LINEAR B IDEOGRAM B249", "Lo", 0), ("LINEAR B IDEOGRAM B251", "Lo", 0), ("LINEAR B IDEOGRAM B252", "Lo", 0), ("LINEAR B IDEOGRAM B253", "Lo", 0), ("LINEAR B IDEOGRAM B254 DART", "Lo", 0), ("LINEAR B IDEOGRAM B255", "Lo", 0), ("LINEAR B IDEOGRAM B256", "Lo", 0), ("LINEAR B IDEOGRAM B257", "Lo", 0), ("LINEAR B IDEOGRAM B258", "Lo", 0), ("LINEAR B IDEOGRAM B259", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B155", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B200", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B201", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B202", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B203", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B204", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B205", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B206", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B207", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B208", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B209", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B210", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B211", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B212", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B213", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B214", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B215", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B216", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B217", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B218", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B219", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B221", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B222", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B226", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B227", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B228", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B229", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B250", "Lo", 0), ("LINEAR B IDEOGRAM VESSEL B305", "Lo", 0), )
https://github.com/PgBiel/typst-oxifmt
https://raw.githubusercontent.com/PgBiel/typst-oxifmt/main/README.md
markdown
Apache License 2.0
# typst-oxifmt (v0.2.1) A Typst library that brings convenient string formatting and interpolation through the `strfmt` function. Its syntax is taken directly from Rust's `format!` syntax, so feel free to read its page for more information (https://doc.rust-lang.org/std/fmt/); however, this README should have enough information and examples for all expected uses of the library. Only a few things aren't supported from the Rust syntax, such as the `p` (pointer) format type, or the `.*` precision specifier. A few extras (beyond the Rust-like syntax) will be added over time, though (feel free to drop suggestions at the repository: https://github.com/PgBiel/typst-oxifmt). The first "extra" so far is the `fmt-decimal-separator: "string"` parameter, which lets you customize the decimal separator for decimal numbers (floats) inserted into strings. E.g. `strfmt("Result: {}", 5.8, fmt-decimal-separator: ",")` will return the string `"Result: 5,8"` (comma instead of dot). See more below. **Compatible with:** [Typst](https://github.com/typst/typst) v0.4.0+ ## Table of Contents - [Usage](#usage) - [Formatting options](#formatting-options) - [Examples](#examples) - [Grammar](#grammar) - [Issues and Contributing](#issues-and-contributing) - [Testing](#testing) - [Changelog](#changelog) - [License](#license) ## Usage You can use this library through Typst's package manager (for Typst v0.6.0+): ```typ #import "@preview/oxifmt:0.2.1": strfmt ``` For older Typst versions, download the `oxifmt.typ` file either from Releases or directly from the repository. Then, move it to your project's folder, and write at the top of your Typst file(s): ```typ #import "oxifmt.typ": strfmt ``` Doing the above will give you access to the main function provided by this library (`strfmt`), which accepts a format string, followed by zero or more replacements to insert in that string (according to `{...}` formats inserted in that string), an optional `fmt-decimal-separator` parameter, and returns the formatted string, as described below. Its syntax is almost identical to Rust's `format!` (as specified here: https://doc.rust-lang.org/std/fmt/). You can escape formats by duplicating braces (`{{` and `}}` become `{` and `}`). Here's an example (see more examples in the file `tests/strfmt-tests.typ`): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("I'm {}. I have {num} cars. I'm {0}. {} is {{cool}}.", "John", "Carl", num: 10) #assert.eq(s, "I'm John. I have 10 cars. I'm John. Carl is {cool}.") ``` Note that `{}` extracts positional arguments after the string sequentially (the first `{}` extracts the first one, the second `{}` extracts the second one, and so on), while `{0}`, `{1}`, etc. will always extract the first, the second etc. positional arguments after the string. Additionally, `{bananas}` will extract the named argument "bananas". ### Formatting options You can use `{:spec}` to customize your output. See the Rust docs linked above for more info, but a summary is below. (You may also want to check out the examples at [Examples](#examples).) - Adding a `?` at the end of `spec` (that is, writing e.g. `{0:?}`) will call `repr()` to stringify your argument, instead of `str()`. Note that this only has an effect if your argument is a string, an integer, a float or a `label()` / `<label>` - for all other types (such as booleans or elements), `repr()` is always called (as `str()` is unsupported for those). - For strings, `?` (and thus `repr()`) has the effect of printing them with double quotes. For floats, this ensures a `.0` appears after it, even if it doesn't have decimal digits. For integers, this doesn't change anything. Finally, for labels, the `<label>` (with `?`) is printed as `<label>` instead of `label`. - **TIP:** Prefer to always use `?` when you're inserting something that isn't a string, number or label, in order to ensure consistent results even if the library eventually changes the non-`?` representation. - After the `:`, add e.g. `_<8` to align the string to the left, padding it with as many `_`s as necessary for it to be at least `8` characters long (for example). Replace `<` by `>` for right alignment, or `^` for center alignment. (If the `_` is omitted, it defaults to ' ' (aligns with spaces).) - If you prefer to specify the minimum width (the `8` there) as a separate argument to `strfmt` instead, you can specify `argument$` in place of the width, which will extract it from the integer at `argument`. For example, `_^3$` will center align the output with `_`s, where the minimum width desired is specified by the fourth positional argument (index `3`), as an integer. This means that a call such as `strfmt("{:_^3$}", 1, 2, 3, 4)` would produce `"__1__"`, as `3$` would evaluate to `4` (the value at the fourth positional argument/index `3`). Similarly, `named$` would take the width from the argument with name `named`, if it is an integer (otherwise, error). - **For numbers:** - Specify `+` after the `:` to ensure zero or positive numbers are prefixed with `+` before them (instead of having no sign). `-` is also accepted but ignored (negative numbers always specify their sign anyways). - Use something like `:09` to add zeroes to the left of the number until it has at least 9 digits / characters. - The `9` here is also a width, so the same comment from before applies (you can add `$` to take it from an argument to the `strfmt` function). - Use `:.5` to ensure your float is represented with 5 decimal digits of precision (zeroes are added to the right if needed; otherwise, it is rounded, **not truncated**). - Note that floating point inaccuracies can be sometimes observed here, which is an unfortunate current limitation. - Similarly to `width`, the precision can also be specified via an argument with the `$` syntax: `.5$` will take the precision from the integer at argument number 5 (the sixth one), while `.test$` will take it from the argument named `test`. - **Integers only:** Add `x` (lowercase hex) or `X` (uppercase) at the end of the `spec` to convert the number to hexadecimal. Also, `b` will convert it to binary, while `o` will convert to octal. - Specify a hashtag, e.g. `#x` or `#b`, to prepend the corresponding base prefix to the base-converted number, e.g. `0xABC` instead of `ABC`. - Add `e` or `E` at the end of the `spec` to ensure the number is represented in scientific notation (with `e` or `E` as the exponent separator, respectively). - For decimal numbers (floats), you can specify `fmt-decimal-separator: ","` to `strfmt` to have the decimal separator be a comma instead of a dot, for example. - To have this be the default, you can alias `strfmt`, such as using `#let strfmt = strfmt.with(fmt-decimal-separator: ",")`. - Number spec arguments (such as `.5`) are ignored when the argument is not a number, but e.g. a string, even if it looks like a number (such as `"5"`). - Note that all spec arguments above **have to be specified in order** - if you mix up the order, it won't work properly! - Check the grammar below for the proper order, but, in summary: fill (character) with align (`<`, `>` or `^`) -> sign (`+` or `-`) -> `#` -> `0` (for 0 left-padding of numbers) -> width (e.g. `8` from `08` or `9` from `-<9`) -> `.precision` -> spec type (`?`, `x`, `X`, `b`, `o`, `e`, `E`)). Some examples: ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s1 = strfmt("{0:?}, {test:+012e}, {1:-<#8x}", "hi", -74, test: 569.4) #assert.eq(s1, "\"hi\", +00005.694e2, -0x4a---") #let s2 = strfmt("{:_>+11.5}", 59.4) #assert.eq(s2, "__+59.40000") #let s3 = strfmt("Dict: {:!<10?}", (a: 5)) #assert.eq(s3, "Dict: (a: 5)!!!!") ``` ### Examples - **Inserting labels, text and numbers into strings:** ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("First: {}, Second: {}, Fourth: {3}, Banana: {banana} (brackets: {{escaped}})", 1, 2.1, 3, label("four"), banana: "Banana!!") #assert.eq(s, "First: 1, Second: 2.1, Fourth: four, Banana: Banana!! (brackets: {escaped})") ``` - **Forcing `repr()` with `{:?}`** (which adds quotes around strings, and other things - basically represents a Typst value): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("The value is: {:?} | Also the label is {:?}", "something", label("label")) #assert.eq(s, "The value is: \"something\" | Also the label is <label>") ``` - **Inserting other types than numbers and strings** (for now, they will always use `repr()`, even without `{...:?}`, although that is more explicit): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Values: {:?}, {1:?}, {stuff:?}", (test: 500), ("a", 5.1), stuff: [a]) #assert.eq(s, "Values: (test: 500), (\"a\", 5.1), [a]") ``` - **Padding to a certain width with characters:** Use `{:x<8}`, where `x` is the **character to pad with** (e.g. space or `_`, but can be anything), `<` is the **alignment of the original text** relative to the padding (can be `<` for left aligned (padding goes to the right), `>` for right aligned (padded to its left) and `^` for center aligned (padded at both left and right)), and `8` is the **desired total width** (padding will add enough characters to reach this width; if the replacement string already has this width, no padding will be added): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Left5 {:-<5}, Right6 {:=>6}, Center10 {centered: ^10?}, Left3 {tleft:_<3}", "xx", 539, tleft: "okay", centered: [a]) #assert.eq(s, "Left5 xx---, Right6 ===539, Center10 [a] , Left3 okay") // note how 'okay' didn't suffer any padding at all (it already had at least the desired total width). ``` - **Padding numbers with zeroes to the left:** It's a similar functionality to the above, however you write `{:08}` for 8 characters (for instance) - note that any characters in the number's representation matter for width (including sign, dot and decimal part): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Left-padded7 numbers: {:07} {:07} {:07} {3:07}", 123, -344, 44224059, 45.32) #assert.eq(s, "Left-padded7 numbers: 0000123 -000344 44224059 0045.32") ``` - **Defining padding-to width using parameters, not literals:** If you want the desired replacement width (the `8` in `{:08}` or `{: ^8}`) to be passed via parameter (instead of being hardcoded into the format string), you can specify `parameter$` in place of the width, e.g. `{:02$}` to take it from the third positional parameter, or `{:a>banana$}` to take it from the parameter named `banana` - note that the chosen parameter **must be an integer** (desired total width): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Padding depending on parameter: {0:02$} and {0:a>banana$}", 432, 0, 5, banana: 9) #assert.eq(s, "Padding depending on parameter: 00432 aaaaaa432") // widths 5 and 9 ``` - **Displaying `+` on positive numbers:** Just add a `+` at the "beginning", i.e., before the `#0` (if either is there), or after the custom fill and align (if it's there and not `0` - see [Grammar](#grammar) for the exact positioning), like so: ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Some numbers: {:+} {:+08}; With fill and align: {:_<+8}; Negative (no-op): {neg:+}", 123, 456, 4444, neg: -435) #assert.eq(s, "Some numbers: +123 +0000456; With fill and align: +4444___; Negative (no-op): -435") ``` - **Converting numbers to bases 2, 8 and 16:** Use one of the following specifier types (i.e., characters which always go at the very end of the format): `b` (binary), `o` (octal), `x` (lowercase hexadecimal) or `X` (uppercase hexadecimal). You can also add a `#` between `+` and `0` (see the exact position at the [Grammar](#grammar)) to display a **base prefix** before the number (i.e. `0b` for binary, `0o` for octal and `0x` for hexadecimal): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("Bases (10, 2, 8, 16(l), 16(U):) {0} {0:b} {0:o} {0:x} {0:X} | W/ prefixes and modifiers: {0:#b} {0:+#09o} {0:_>+#9X}", 124) #assert.eq(s, "Bases (10, 2, 8, 16(l), 16(U):) 124 1111100 174 7c 7C | W/ prefixes and modifiers: 0b1111100 +0o000174 ____+0x7C") ``` - **Picking float precision (right-extending with zeroes):** Add, at the end of the format (just before the spec type (such as `?`), if there's any), either `.precision` (hardcoded, e.g. `.8` for 8 decimal digits) or `.parameter$` (taking the precision value from the specified parameter, like with `width`): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("{0:.8} {0:.2$} {0:.potato$}", 1.234, 0, 2, potato: 5) #assert.eq(s, "1.23400000 1.23 1.23400") ``` - **Scientific notation:** Use `e` (lowercase) or `E` (uppercase) as specifier types (can be combined with precision): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("{0:e} {0:E} {0:+.9e} | {1:e} | {2:.4E}", 124.2312, 50, -0.02) #assert.eq(s, "1.242312e2 1.242312E2 +1.242312000e2 | 5e1 | -2.0000E-2") ``` - **Customizing the decimal separator on floats:** Just specify `fmt-decimal-separator: ","` (comma as an example): ```typ #import "@preview/oxifmt:0.2.1": strfmt #let s = strfmt("{0} {0:.6} {0:.5e}", 1.432, fmt-decimal-separator: ",") #assert.eq(s, "1,432 1,432000 1,43200e0") ``` ### Grammar Here's the grammar specification for valid format `spec`s (in `{name:spec}`), which is basically Rust's format: ``` format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type fill := character align := '<' | '^' | '>' sign := '+' | '-' width := count precision := count | '*' type := '' | '?' | 'x?' | 'X?' | identifier count := parameter | integer parameter := argument '$' ``` Note, however, that precision of type `.*` is not supported yet and will raise an error. ## Issues and Contributing Please report any issues or send any contributions (through pull requests) to the repository at https://github.com/PgBiel/typst-oxifmt ## Testing If you wish to contribute, you may clone the repository and test this package with the following commands (from the project root folder): ```sh git clone https://github.com/PgBiel/typst-oxifmt cd typst-oxifmt/tests typst c strfmt-tests.typ --root .. ``` The tests succeeded if you received no error messages from the last command (please ensure you're using a supported Typst version). ## Changelog ### v0.2.1 - Fixed formatting of UTF-8 strings. Before, strings with multi-byte UTF-8 codepoints would cause formatting inconsistencies or even crashes. ([Issue #6](https://github.com/PgBiel/typst-oxifmt/issues/6)) - Fixed an inconsistency in negative number formatting. Now, it will always print a regular hyphen (e.g. '-2'), which is consistent with Rust's behavior; before, it would occasionally print a minus sign instead (as observed in a comment to [Issue #4](https://github.com/PgBiel/typst-oxifmt/issues/4)). - Added compatibility with Typst 0.8.0's new type system. ### v0.2.0 - The package's name is now `oxifmt`! - `oxifmt:0.2.0` is now available through Typst's Package Manager! You can now write `#import "@preview/oxifmt:0.2.0": strfmt` to use the library. - Greatly improved the README, adding a section for common examples. - Fixed negative numbers being formatted with two minus signs. - Fixed custom precision of floats not working when they are exact integers. ### v0.1.0 - Initial release, added `strfmt`. ## License Licensed under MIT or Apache-2.0, at your option.
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Chapters/6-Fazit.typ
typst
#import "../abbreviations.typ": * #import "../Template/customFunctions.typ": * = Fazit<fazit> Das in @introduction aufgestellte Ziel, eine Webanwendung zu erstellen, welche die Bearbeitung und Veröffentlichung von Modulhandbüchern erleichtert, wurde durch eine klare Struktur angegangen. Nachdem in @anforderungsanalyse die Zielgruppen und Anforderungen ermittelt wurden, konnte in @entwurf das System geplant werden. In @implementierung wurden die Anforderungen umgesetzt, was in @review bestätigt wurde. Das Ergebnis dieser Bachelorarbeit ist ein verbesserter Prozess zur Bearbeitung des Modulkataloges. Die hierzu aufgestellten Anforderungen wurden größtenteils erfüllt. Unter den nicht erfüllten Anforderungen befinden sich keine Anforderungen, die die produktive Nutzung der Anwendung verhindern. Zwar wäre es gut, wenn die ausstehenden Arbeiten in Zukunft umgesetzt werden, jedoch kann mit dem bestehenden System bereits der aktuell bestehende Arbeitsablauf ersetzt werden. Das System ermöglicht das Anzeigen von Modulkatalogen als PDF und das Anzeigen von Moduldetails in einer modernen Oberfläche. Außerdem können die Informationen der Module im System bearbeitet werden, wobei das System mithilfe von Dropdowns und Plausibilitätschecks unterstützt. Das resultierende PDF wird automatisch generiert und den Interessierten zur Verfügung gestellt. Außerdem sind wesentliche Informationen zur Einrichtung und Weiterentwicklung des Systems in einer Dokumentation erfasst. Durch die modernen Oberflächen sollte es Studierenden und studieninteressierten Personen leicht fallen, an die gewünschten Informationen zu bestimmten Modulen oder einem Studiengang zu gelangen. Für die dozierenden Personen an der #hsh sollte die Aktualisierung der Modultexte dank der intuitiven Eingabefelder sowie der unterstützenden Plausibilitätsprüfung angenehmer sein. Die Generierung eines PDFs läuft jetzt weitestgehend automatisch, sodass der Studiengangsdekan für diese Aufgabe nun weniger Zeit benötigen sollte. Alles in allem wurde durch die Erfüllung der wesentlichen Anforderungen und durch die Bereitstellung des neuen Systems das aufgestellte Ziel erreicht. Es gibt eine Webanwendung, die die Verwaltung und Erstellung von Modulhandbüchern ermöglicht. #pagebreak() #hide("grr") = Ausblick<ausblick> Obwohl das neue System bereits funktionsfähig ist, gibt es dennoch Potenzial für weitere Optimierungen. Sowohl die erstellte Dokumentation als auch der Quellcode könnten in bestimmten Bereichen weiter verbessert werden. Einzelne Abschnitte im Code könnten noch redundanten Code enthalten und die Dokumentation enthält nicht alle in dieser Arbeit genannten Einzelheiten des Systems. Sollten bei der Weiterentwicklung verbesserungswürdige Stellen in Dokumentation oder Quellcode auffallen, können diese dokumentiert und verbessert werden. Die aktuelle Struktur des Systems sollte Erweiterungen und Anpassungen ermöglichen. Der nächste Schritt könnte die Einführung des neuen Systems für die Abteilung Informatik sein. Hierzu könnte das System auf Hochschulservern eingerichtet werden. Im Anschluss müssten die Modulverantwortlichen zunächst einmal das generierte PDF, beziehungsweise die im System hinterlegten Daten, auf Vollständigkeit prüfen. Ein Link zu verschiedenen Seiten des Systems könnte dann auf der Website der Hochschule erstellt werden. Es wäre beispielsweise denkbar, auf der Unterseite der Abteilung Informatik auf die Studiengangübersicht des neuen Systems (@menu) zu verlinken. Für die nähere Zukunft ist es außerdem denkbar, dass abgesehen von den bereits erfassten nicht erfüllten Anforderungen weitere Funktionen geplant werden. So könnte die moderne Anzeige von einzelnen Modulen um verschiedene Informationen erweitert werden. Es könnte beispielsweise eine Anbindung an den Stundenplan geben, sodass auf der Modulseite auch angezeigt wird, zu welchen Zeiten und an welchem Ort die Lehrveranstaltungen stattfinden. Auch wäre die Anbindung weiterer Abteilungen und Fakultäten denkbar. Dies ist durch die Datenstruktur bereits vorbereitet, jedoch könnte es erforderlich sein, die PDF-Dokumente optisch anders darzustellen. Auch wäre eine Anbindung an das #hone denkbar, wie bereits in @verwandteArbeiten beschrieben. Zusätzlich zu den Modulhandbüchern und des Anhangs der Prüfungsordnung könnte ebenso die in @definition genannte Abbildung des Curriculums (@mdiCurr) generiert und im neuen System angezeigt werden. In der Bearbeitungsansicht könnte statt der derzeitigen HTML-Vorschau das tatsächliche PDF angezeigt werden. Dies wurde durch die Umstellung auf TypeScript bereits vorbereitet und könnte eine sinnvolle Änderung sein, um zum einen eine genauere Vorschau zu ermöglichen und zum anderen die Code-Qualität zu verbessern, indem Abhängigkeiten verringert werden. Das neu entworfene System könnte zudem Vorlage für weitere Entwicklungen sein. Die genutzten Technologien, sowie die entworfene Struktur könnte für eine Vielzahl von Projekten interessant sein. #pagebreak() #hide("grr")
https://github.com/benjft/CV
https://raw.githubusercontent.com/benjft/CV/master/bio.typ
typst
#align(center)[_ A full stack software developer working with Asp.Net Core, MSSQL Server, and React, with additional DevOps experience. Experienced working on projects of varying scales, from lightweight tools to complex systems. In my current role I work on adding new functionality to existing products, as well as aiding in the development of new products, implementing CI/CD processes, and improving performance and security. _]
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/visualize/gradient-stroke.typ
typst
Apache License 2.0
// Test gradients on strokes. --- #align(center + top, square(size: 50pt, fill: black, stroke: 5pt + gradient.linear(red, blue))) --- #align( center + bottom, square( size: 50pt, fill: gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)), stroke: 10pt + gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)) ) ) --- #align( center + bottom, square( size: 50pt, fill: black, stroke: 10pt + gradient.conic(red, blue) ) ) --- // Test gradient on lines #set page(width: 100pt, height: 100pt) #line(length: 100%, stroke: 1pt + gradient.linear(red, blue)) #line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue)) #line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue, relative: "parent"))
https://github.com/glambrechts/slydst
https://raw.githubusercontent.com/glambrechts/slydst/main/example.typ
typst
MIT License
#import "slydst.typ": * #set page(fill: white) #show: slides.with( title: "Slydst: Slides in Typst", authors: "<NAME>", ) #show raw: set block(fill: silver.lighten(65%), width: 100%, inset: 1em) == Outline #outline() = Usage == Setup To start, just use the following preamble. ```typst #import "@preview/slydst:0.1.1": * #show: slides.with( title: "Insert your title here", // Required subtitle: none, date: none, authors: (), layout: "medium", ratio: 4/3, title-color: none, ) Insert your content here. ``` == Content - *Level-one headings* corresponds to new sections. - *Level-two headings* corresponds to new slides. - Blank space can be filled with *vertical spaces* like `#v(1fr)`. ```typst == Outline #outline() = First section == First slide #figure(image("figure.png", width: 60%), caption: "Caption") #v(1fr) #lorem(20) ``` ...and longer slides are automatically numbered. === Subsubtitles Note that level-three headings do not break pages. = Components == Definitions, theorems and others #definition(title: "An interesting definition")[ #lorem(10) ] #theorem(title: "An interesting theorem")[ Let $p(x, y)$ a probability distribution, we have, $ p(x, y) = p(x) p(y | x) $ ] #lemma(title: "An interesting lemma")[ #lorem(20) ] #corollary(title: "An interesting corollary")[ #lorem(30) ] = Summary == Summary - Slydst provides simple static slides. - Slides are named according to the headings. - Some more components are available.
https://github.com/GYPpro/Java-coures-report
https://raw.githubusercontent.com/GYPpro/Java-coures-report/main/Report/7.typ
typst
#set text(font:("Times New Roman","Source Han Serif SC")) #show raw.where(block: false): box.with( fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, ) // Display block code in a larger block // with more padding. #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt, ) #set math.equation(numbering: "(1)") #set text( font:("Times New Roman","Source Han Serif SC"), style:"normal", weight: "regular", size: 13pt, ) #set page( paper:"a4", number-align: right, margin: (x:2.54cm,y:4cm), header: [ #set text( size: 25pt, font: "KaiTi", ) #align( bottom + center, [ #strong[暨南大学本科实验报告专用纸(附页)] ] ) #line(start: (0pt,-5pt),end:(453pt,-5pt)) ] ) #show raw: set text( font: ("consolas", "Source Han Serif SC") ) = 实现一个线段树泛型模板 \ #text("*") 实验项目类型:设计性\ #text("*")此表由学生按顺序填写\ #text( font:"KaiTi", size: 15pt )[ 课程名称#underline[#text(" 面向对象程序设计 ")]成绩评定#underline[#text(" ")]\ 实验项目名称#underline[#text(" 实现一个线段树泛型模板 ")]\ 指导老师#underline[#text(" 干晓聪 ")]\ 实验项目编号#underline[#text(" 1 ")]实验项目类型#underline[#text(" 设计性 ")]实验地点#underline[#text(" 数学系机房 ")]\ 学生姓名#underline[#text(" 郭彦培 ")]学号#underline[#text(" 2022101149 ")]\ 学院#underline[#text(" 信息科学技术学院 ")]系#underline[#text(" 数学系 ")]专业#underline[#text(" 信息管理与信息系统 ")]\ 实验时间#underline[#text(" 2023年11月1日上午 ")]#text("~")#underline[#text(" 2023年11月1日中午 ")]\ ] #set heading( numbering: "一、" ) #set par( first-line-indent: 1.8em) = 实验目的 \ #h(1.8em)熟悉泛型类、泛型方法的使用与泛型思想在编码中的应用。利用C++语言实现泛型。 = 实验环境 \ #h(1.8em)计算机:PC X64 操作系统:Windows 编程语言:C++ IDE:Visual Studio Code 在线测试平台:leetcode = 程序原理 \ #h(1.8em) 线段树是一种较为复杂的数据结构,旨在快速解决区间数据批量修改与特征统计。 本类实现了一个可以批量地对数据进行线性空间内加和运算的线段树,统计内容为区间内的最大值,对于每个操作: + 修改单点:时间复杂度为$O(log n)$ + 修改区间:均匀修改与查询后最坏时间复杂度为每点渐进$O(log (n m))$,n为内容总数,m为修改区间长度 + 查询区间:$O(log n)$ = 程序代码 文件`sis6\segTree.`实现了一个`segTree`类 ```cpp #include <vector> #include <map> #include <string> #include <string.h> #include <math.h> #include <set> #include <algorithm> #include <iostream> #include <queue> template <class TYPE_NAME> class lazyTree { /* * TYPE_NAME需要支持:+ += != 和自定义的合并运算符 * 实现了懒惰标记,仅支持区间批量增加 * 区间批量减需要TYPE_NAME支持-,且有-a = 0 - a * 额外处理了一个单点修改为对应值的函数,非原生实现,其复杂度为 4logn * 不提供在线 * 不提供持久化 */ private: std::vector<TYPE_NAME> d; std::vector<TYPE_NAME> a; std::vector<TYPE_NAME> b; int n; const TYPE_NAME INI = 0; // 不会影响合并运算的初始值,如max取INF,min取0,mti取1 void subbuild(int s, int t, int p) { if (s == t) { d[p] = a[s]; return; } int m = s + ((t - s) >> 1); // (s+t)/2 subbuild(s, m, p * 2); subbuild(m + 1, t, p * 2 + 1); d[p] = d[p * 2] + d[p * 2 + 1]; // 合并运算符 ↑ } TYPE_NAME subGetSum(int l, int r, int s, int t, int p) { if (l <= s && t <= r) return d[p]; int m = s + ((t - s) >> 1); if (b[p] != 0) { d[p * 2] += b[p] * (m - s + 1); // 合并运算符的高阶运算 此处运算为应用懒惰标记 d[p * 2 + 1] += b[p] * (t - m); // 合并运算符的高阶运算 此处运算为应用懒惰标记 b[p * 2] += b[p]; // 下传标记,无需修改 b[p * 2 + 1] += b[p]; // 下传标记,无需修改 b[p] = 0; } TYPE_NAME ansl = INI; TYPE_NAME ansr = INI; if (l <= m) ansl = subGetSum(l, r, s, m, p * 2); if (r > m) ansr = subGetSum(l, r, m + 1, t, p * 2 + 1); return ansl + ansr; // 合并运算符↑ } void subUpdate(int l, int r, TYPE_NAME c, int s, int t, int p) { if (l <= s && t <= r) { d[p] += (t - s + 1) * c; // 合并运算符的高阶运算 此处运算为修改整匹配区间值 b[p] += c; // 记录懒惰标记,无需修改 return; } int m = s + ((t - s) >> 1); if (b[p] != 0 && s != t) { d[p * 2] += b[p] * (m - s + 1); // 合并运算符的高阶运算 此处运算为应用懒惰标记 d[p * 2 + 1] += b[p] * (t - m); // 合并运算符的高阶运算 此处运算为应用懒惰标记 b[p * 2] += b[p]; // 下传标记,无需修改 b[p * 2 + 1] += b[p]; // 下传标记,无需修改 b[p] = 0; } if (l <= m) subUpdate(l, r, c, s, m, p * 2); if (r > m) subUpdate(l, r, c, m + 1, t, p * 2 + 1); d[p] = d[p * 2] + d[p * 2 + 1]; // 合并运算符 ↑ } public: lazyTree(TYPE_NAME _n) { n = _n; d.resize(4 * n + 5); a.resize(4 * n + 5); b.resize(4 * n + 5); } void build(std::vector<TYPE_NAME> _a) { a = _a; subbuild(1, n, 1); } TYPE_NAME getsum(int l, int r) { return subGetSum(l, r, 1, n, 1); } void update(int l, int r, TYPE_NAME c) // 修改区间 { subUpdate(l, r, c, 1, n, 1); } void update(int idx, TYPE_NAME tar) { // 修改单点,未测试 TYPE_NAME tmp = getsum(idx, idx); tar -= tmp; subUpdate(idx, idx, tar, 1, n, 1); } }; ``` = 出现的问题、原因与解决方法 \ #h(1.8em) 我经常参与算法竞赛,非常熟悉C++与线段树,因此编码过程非常顺利。 = 测试数据与运行结果 \ 测试数据实例化泛型为int_32 输入数据规则:第一行包含两个整数$m,n$,表示这列数字的个数和操作总数 第二行包含$n$个用空格分隔的数,其中第$i$个数字表示数列第$i$项的初始值 接下来$m$行每行包含3-4个整数,表示一个操作。具体如下: #box[ + `1 x y k`:将区间`[x,y]`内每个数加上$k$ + `2 x y`:输出区间`[x,y]`内每个数的和 ] 样例运行结果如下: #figure( table( align: left + horizon, columns: 3, [*输入*],[*输出*],[*解释*], [`5 5 1 5 4 2 3`],[],[初始化数据], [`2 2 4`],[`11`],[求出`[2,4]`内元素和], [`1 2 3 2`],[],[将`[2,3]`内所有元素+2], [`2 3 4`],[`8`],[求出`[3,4]`内元素和], [`1 1 5 1`],[],[将`[1,5]`内所有元素+1], [`2 1 4`],[`20`],[求出`[1,4]`内元素和] ) ) 注:测试平台`leetcode`的特性为直接向函数传参,因此不需要实现输入输出。
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/break-continue-04.typ
typst
Other
// Test break outside of loop. #let f() = { // Error: 3-8 cannot break outside of loop break } #for i in range(1) { f() }
https://github.com/The-Notebookinator/notebookinator
https://raw.githubusercontent.com/The-Notebookinator/notebookinator/main/utils/theme.typ
typst
The Unlicense
/* This file contains all of the constructors for core theme related constructors. All of the constructors also perform checks to ensure that all of the types are correct. */ #let check-type(ctx, field, expected-type) = { let given-type = type( ctx.at(field), ) assert.eq( given-type, expected-type, message: "Expected " + field + " to be of type " + str(expected-type) + ", but got: " + given-type, ) } #let check-multiple-types(ctx, fields, expected-type) = { for field in fields { check-type( ctx, field, expected-type, ) } } /// A constructor for theme variables /// /// - rules (function): A function constructed by `make-rules` /// - cover (function): A function constructed by `make-cover` /// - frontmatter-entry (function): A function constructed by `make-frontmatter-entry` /// - body-entry (function): A function constructed by `make-body-entry` /// - appendix-entry (function): A function constructed by `make-appendix-entry` /// -> dictionary #let make-theme( rules: none, cover: none, frontmatter-entry: none, body-entry: none, appendix-entry: none, ) = { for input in ( rules, cover, frontmatter-entry, body-entry, appendix-entry, ) { assert.eq( type(input), function, ) } return ( rules: rules, cover: cover, frontmatter-entry: frontmatter-entry, body-entry: body-entry, appendix-entry: appendix-entry, ) } /// A constructor for a rules function. The resulting function will take the whole document as input, and can modify it in any arbitrary way. /// /// - callback (function): A function that returns the content of the document, and takes a `doc` parameter as input. /// -> function #let make-rules(callback) = { assert.eq( type( callback([test]), ), content, message: "The callback function does not return content. Make sure that you've properly returned the document.", ) return doc => { callback(doc) } } /// A constructor for a cover function. The resulting function will be displayed inside of a page with no margins, as the cover of the notebook. /// /// - callback (function): A function that returns a cover, and takes a named `ctx` argument. /// -> function #let make-cover(callback) = { return (ctx: (:)) => { check-multiple-types( ctx, ( "team-name", "season", "year", ), str, ) callback(ctx) } } /// A constructor for frontmatter entry function. The resulting function should return the content of an entry as output. /// /// - callback (function): A function that returns an entry, and takes a named `ctx` argument, and a `body` positional argument. /// -> function #let make-frontmatter-entry(callback) = { assert.eq(type(callback), function) return (ctx: (:), body) => { check-type(ctx, "title", str) callback(ctx, body) } } /// A constructor for a body entry function. The resulting function should return the content of an entry as output. /// /// - callback (function): A function that returns an entry, and takes a named `ctx` argument, and a `body` positional argument. /// -> function #let make-body-entry(callback) = { assert.eq(type(callback), function) return (ctx: (:), body) => { let valid-entry-types = ( "identify", "brainstorm", "decide", "build", "program", "test", "management", "notebook", ) let valid-types-printable = valid-entry-types.fold( "", (base, value) => { base + " '" + value + "'" }, ) check-multiple-types( ctx, ( "title", "type", "author", "witness", ), str, ) check-type(ctx, "date", datetime) check-type(ctx, "participants", array) if not valid-entry-types.contains(ctx.type) { panic("Entry type '" + str(ctx.type) + "' is not valid. Valid types include:" + valid-types-printable) } callback(ctx, body) } } // All of the check logic is exactly the same, so we can just use the frontmatter-entry here /// A constructor for an appendix entry function. The resulting function should return the content of an entry as output. /// /// - callback (function): A function that returns an entry, and takes a named `ctx` argument, and a `body` positional argument. /// -> function #let make-appendix-entry = make-frontmatter-entry
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cheda-seu-thesis/0.2.1/README.md
markdown
Apache License 2.0
# 东南大学论文模板 使用 Typst 复刻东南大学「本科毕业设计(论文)报告」模板和「研究生学位论文」模板。 请在 [`init-files`](./init-files/) 目录内查看 Demo PDF。 > [!IMPORTANT] > > 此模板是民间模板,学校可能不会认可本模板。 > > 此模板内可能仍然存在诸多格式问题。 > > 如需使用此模板,请自行承担风险。 - [东南大学论文模板](#东南大学论文模板) - [使用方法](#使用方法) - [本地使用](#本地使用) - [Web App](#web-app) - [模板内容](#模板内容) - [研究生学位论文模板](#研究生学位论文模板) - [本科毕业设计(论文)报告模板](#本科毕业设计论文报告模板) - [目前存在的问题](#目前存在的问题) - [参考文献](#参考文献) - [开发与协议](#开发与协议) - [二次开发](#二次开发) ## 使用方法 本模板需要使用 Typst 0.11.0 编译。 此模板已上传 Typst Universe ,可以使用 `typst init` 功能初始化,也可以使用 Web App 编辑。Typst Universe 上的模板可能不是最新版本。如果需要使用最新版本的模板,从本 repo 中获取。 ### 本地使用 请先安装位于 `fonts` 目录内的全部字体。然后,您可以使用以下两种方式使用本模板: - 下载/clone 本 repo 的全部文件,编辑 `init-files` 目录内的示例文件。 - 使用 `typst init @preview/cheda-seu-thesis:0.2.0` 来获取此模板与初始化文件。 随后,您可以通过编辑示例文件来生成想要的论文。两种论文格式的说明都在对应的示例文档内。 如您使用 VSCode 作为编辑器,可以尝试使用 [Tinymist](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) 与 [Typst Preview](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview) 插件。如有本地包云同步需求,可以使用 [Typst Sync](https://marketplace.visualstudio.com/items?itemName=OrangeX4.vscode-typst-sync) 插件。更多编辑技巧,可查阅 <https://github.com/nju-lug/modern-nju-thesis#vs-code-%E6%9C%AC%E5%9C%B0%E7%BC%96%E8%BE%91%E6%8E%A8%E8%8D%90> 。 ### Web App > [!NOTE] > > 由于字体原因,不建议使用 Web App 编辑此模板。 请打开 <https://typst.app/universe/package/cheda-seu-thesis> 并点击 `Create project in app` ,或在 Web App 中选择 `Start from a template`,再选择 `cheda-seu-thesis`。 然后,请将 <https://github.com/csimide/SEU-Typst-Template/tree/master/fonts> 内的 **所有** 字体上传到 Typst Web App 内该项目的根目录。注意,之后每次打开此项目,浏览器都会花费很长时间从 Typst Web App 的服务器下载这一批字体,体验较差。 最后,请按照自动打开的文件的提示操作。 ## 模板内容 ### 研究生学位论文模板 此 Typst 模板按照[《东南大学研究生学位论文格式规定》](https://seugs.seu.edu.cn/_upload/article/files/5d/c2/abe9785f44c8b3ea4823f14bfb92/cd829a73-1b86-400d-9bce-2c4b4fdb85b7.pdf)制作,制作时参考了 [SEUThesis 模板](https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/seuthesis/seuthesis.pdf)。 当前支持进度: - 文档构件 - [x] 封面 - [x] 中英文扉页 - [x] 中英文摘要 - [x] 目录 - [x] 术语表 - [x] 正文 - [x] 致谢 - [x] 参考文献 - [x] 附录 - [ ] 索引 - [ ] 作者简介 - [ ] 后记 - [ ] 封底 - 功能 - [ ] 盲审 - [x] 页码编号:正文前使用罗马数字,正文及正文后使用阿拉伯数字 - [x] 正文、附录图表编号格式:详见研院要求 - [x] 数学公式放置位置:离页面左侧两个汉字距离 - [x] 数学公式编号:公式块右下 - [x] 插入空白页:新章节总在奇数页上 - [x] 页眉:奇数页显示章节号和章节标题,偶数页显示固定内容 - [x] 参考文献:支持双语显示 ### 本科毕业设计(论文)报告模板 此 Typst 模板基于东南大学本科毕业设计(论文)报告模板(2024 年 1 月)仿制,原模板可以在教务处网站上下载([2019 年 9 月版](https://jwc.seu.edu.cn/2021/1108/c21686a389963/page.htm) , [2024 年 1 月版](https://jwc.seu.edu.cn/2024/0117/c21686a479303/page.htm))。 当前支持进度: - 文档构件 - [x] 封面 - [x] 中英文摘要 - [x] 目录 - [x] 正文 - [x] 参考文献 - [x] 附录 - [x] 致谢 - [ ] 封底 - 功能 - [ ] 盲审 - [x] 页码编号:正文前使用罗马数字,正文及正文后使用阿拉伯数字 - [x] 正文、附录图表编号格式:详见本科毕设要求 - [x] 数学公式放置位置:离页面左侧两个汉字距离 - [x] 数学公式编号:公式块右侧中心 - [x] 页眉:显示固定内容 - [x] 参考文献:支持双语显示 - [ ] 表格显示“续表” > [!NOTE] > > 可以看看隔壁 <https://github.com/TideDra/seu-thesis-typst/> 项目,也正在使用 Typst 实现毕业设计(论文)报告模板,还提供了毕设翻译模板。该项目的实现细节与本模板并不相同,您可以根据自己的喜好选择。 ## 目前存在的问题 - 中文首段有时会自动缩进,有时不会。如果没有自动缩进,需要使用 `#h(2em)` 手动缩进两个字符。 - 参考文献格式不完全符合要求。请见下方参考文献小节。 - 行距、边距等有待继续调整。 ### 参考文献 参考文献格式不完全符合要求。Typst 自带的 GB/T 7714-2015 numeric 格式与学校要求格式相比,有以下问题: 1. 学校要求在作者数量较多时,英文使用 `et al.` 中文使用 `等` 来省略。但是,Typst 目前仅可以显示为单一语言。 **A:** 该问题系 Typst 的 CSL 解析器不支持 CSL-M 导致的。 <details> <summary> 详细原因 </summary> - 使用 CSL 实现这一 feature 需要用到 [CSL-M](https://citeproc-js.readthedocs.io/en/latest/csl-m/index.html#cs-layout-extension) 扩展的多 `layout` 功能,而 Typst 尚不支持 CSL-M 扩展功能。详见 https://github.com/typst/typst/issues/2793 与 https://github.com/typst/citationberg/issues/5 。 - Typst 目前会忽视 BibTeX/CSL 中的 `language` 字段。参见 https://github.com/typst/hayagriva/pull/126 。 因为上述原因,目前很难使用 Typst 原生方法实现根据语言自动选用 `et al.` 与 `等`。 </details> OrangeX4 和我写了一个基于查找替换的 `bilingual-bibliography` 功能,试图在 Typst 支持 CSL-M 前实现中文西文使用不同的关键词。 本模板的 Demo 文档内已使用 `bilingual-bibliography` 引用,请查看 Demo 文档以了解用法。注意,该功能仍在测试,很可能有 Bug,详见 https://github.com/csimide/SEU-Typst-Template/issues/1 。 > 请在 https://github.com/nju-lug/modern-nju-thesis/issues/3 查看更多有关双语参考文献实现的讨论。 > > 本模板曾经尝试使用 https://github.com/csimide/cslper 作为双语参考文献的实现方法。 2. 学校给出的范例中,除了纯电子资源,即使引用文献来自线上渠道,也均不加 `OL`、访问日期、DOI 与 链接。但是,Typst 内置的 GB/T 7714-2015 numeric 格式会为所有 bib 内定义了链接/DOI 的文献添加 `OL` 标记和链接/DOI 。 **A:** 该问题系学校的标准与 GB/T 7714-2015 不完全一致导致的。 请使用 `style: "./seu-thesis/gb-t-7714-2015-numeric-seu.csl"` ,会自动依据文献类型选择是否显示 `OL` 标记和链接/DOI。 > 该 csl 修改自 <https://github.com/redleafnew/Chinese-STD-GB-T-7714-related-csl/blob/main/003gb-t-7714-2015-numeric-bilingual-no-url-doi.csl> > > 原文件基于 CC-BY-SA 3.0 协议共享。 3. 作者大小写(或者其他细节)与学校范例不一致。 **A:** 学校用的是 GB/T 7714-2015 的方言,曾经有学长把它叫做 GB/T 7714-SEU ,目前没找到完美匹配学校要求的 CSL(不同学院的要求也不太一样),后续会写一个符合要求的 CSL 文件。 4. 正文中连续引用,上标合并错误(例如,引用 1 2 3 4 应当显示为 [1-4] ,但是显示为 [1,4] )。 临时方案是把 csl 文件里 `after-collapse-delimiter=","` 改成 `after-collapse-delimiter="-"`。 详细原因请见 https://github.com/typst/hayagriva/issues/154 。 ## 开发与协议 如果您在使用过程中遇到任何问题,请提交 issue。本项目欢迎您的 PR。如果有其他模板需求也可以在 issue 中提出。 除下述特殊说明的文件外,此项目使用 MIT License 。 - `init-files/demo_image/` 路径下的文件来自东南大学教务处本科毕设模板。 - `seu-thesis/assets/` 路径下的文件是由东南大学教务处模板经二次加工得到,或从东南大学视觉设计中取得。 - `fonts` 路径下的文件是此模板用到的字体。 - `东南大学本科毕业设计(论文)参考模板 (2024年1月修订).docx` 是教务处提供的毕设论文模板。 ### 二次开发 本模板欢迎二次开发。在二次开发前,建议了解本模板的主要特性与关联的文件: - 有较为麻烦的图表、公式编号(图表编号格式不相同,甚至附录与正文中图表编号格式也不相同;图的名称在图下方,表的名称在表上方;公式不是居中对齐,公式编号位置不是右侧上下居中)。 - `seu-thesis/utils/figure-and-ref.typ` 定义了显示图表格式、图表文内引用格式和公式引用格式的函数。 - 上述文件依赖于 `part-state` (定义在 `seu-thesis/utils/states.typ` 内)用于判断所处的位置。 - 部分计数器置零的工作是在 `heading` 中完成的,即 `seu-thesis/utils/show-heading.typ` - 如有条件或没有如此麻烦的需求,建议使用 `i-figure` 包。 - (仅研究生学位论文)奇数页偶数页页眉不同,且有页眉中显示章节名称的需求。 - 该功能位于 `seu-thesis/parts/main-body-degree-fn.typ` ,并且强依赖在 `heading` (`seu-thesis/utils/show-heading.typ`)中完成的工作。 - 该功能以来 `seu-thesis/utils/states.typ` 内定义的多个 `state`。 - 支持双语显示参考文献(自动使用 `et al.` 和 `等`) - 该功能来自 `bilingual-bibliography`,关联的文件是 `seu-thesis/utils/bilingual-bibliography.typ`。 - 有关 `bilingual-bibliography` 的更多信息,请查看 https://github.com/nju-lug/modern-nju-thesis/issues/3 > [!NOTE] > > 本模板内造的轮子比较多,而且我的代码质量一般,请酌情取用。
https://github.com/Dav1com/minerva-report-fcfm
https://raw.githubusercontent.com/Dav1com/minerva-report-fcfm/master/template/preamble.typ
typst
MIT No Attribution
// Este archivo es parte de la estructura de ejemplo para usar el template. // La idea es definir aquí tus comandos propios para fácilitar el proyecto. // Por ejemplo puedes importar el package lemmify y definir tus propios teoremas. // Es necesario importar este archivo en cada .typ que crees.
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/meta/link-03.typ
typst
Other
// Check that unbalanced brackets are not included in links. #[https://example.com/] \ https://example.com/)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/033_Rivals%20of%20Ixalan.typ
typst
#import "@local/mtgset:0.1.0": conf #show: doc => conf("Rivals of Ixalan", doc) #include "./033 - Rivals of Ixalan/001_The Flood.typ" #include "./033 - Rivals of Ixalan/002_Glimpse the Far Side of the Sun.typ" #include "./033 - Rivals of Ixalan/003_The Arbiter of Law Left Chaos in His Wake.typ" #include "./033 - Rivals of Ixalan/004_Sabotage.typ" #include "./033 - Rivals of Ixalan/005_Wool Over the Eyes.typ" #include "./033 - Rivals of Ixalan/006_Who Tells the Stories.typ"
https://github.com/pluttan/typst-bmstu
https://raw.githubusercontent.com/pluttan/typst-bmstu/main/bmstu/g7.32-2017/blocks.typ
typst
MIT License
// Составляет содержание работы. #let mk_table_of_contents() = { { set align(center) set text(16pt, weight: "bold") [Содержание] } set align(left) outline( title: [], indent: auto, ) } #let lst = counter("listing") #let imag = counter("image") #let tabl = counter("table") #let code(data, lang, lable) = { align(center)[ #raw(data, lang:lang) #lst.step() ] align(center)[ Листинг #lst.display() #sym.bar.h _ #lable _ ] } #let img(data, lable, f:(i)=>{i.display()}) = { align(center)[ #data #imag.step() ] align(center)[ Рисунок #f(imag) #sym.bar.h _ #lable _ ] } #let imgc() = { align(center)[ #imag.step() #imag.display() ] }
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/touying/themes/metropolis.typ
typst
// This theme is inspired by https://github.com/matze/mtheme // The origin code was written by https://github.com/Enivex // Consider using: // #set text(font: "Fira Sans", weight: "light", size: 20pt) // #show math.equation: set text(font: "Fira Math") // #set strong(delta: 100) // #set par(justify: true) #import "../utils/utils.typ" #import "../utils/states.typ" #import "../utils/components.typ" #let _saved-align = align #let slide( self: none, title: auto, footer: auto, align: horizon, ..args, ) = { self.page-args = self.page-args + ( fill: self.colors.neutral-lightest, ) if title != auto { self.m-title = title } if footer != auto { self.m-footer = footer } (self.methods.touying-slide)( ..args.named(), self: self, setting: body => { show: _saved-align.with(align) set text(fill: self.colors.primary-dark) show: args.named().at("setting", default: body => body) body }, ..args.pos(), ) } #let title-slide( self: none, extra: none, ..args, ) = { self = utils.empty-page(self) let info = self.info + args.named() let content = { set text(fill: self.colors.primary-dark) set align(horizon) block(width: 100%, inset: 2em, { text(size: 1.3em, text(weight: "medium", info.title)) if info.subtitle != none { linebreak() text(size: 0.9em, info.subtitle) } line(length: 100%, stroke: .05em + self.colors.secondary-light) set text(size: .8em) if info.author != none { block(spacing: 1em, info.author) } if info.date != none { block(spacing: 1em, if type(info.date) == datetime { info.date.display(self.datetime-format) } else { info.date }) } set text(size: .8em) if info.institution != none { block(spacing: 1em, info.institution) } if extra != none { block(spacing: 1em, extra) } }) } (self.methods.touying-slide)(self: self, repeat: none, content) } #let new-section-slide(self: none, short-title: auto, title) = { self = utils.empty-page(self) let content = { set align(horizon) show: pad.with(20%) set text(size: 1.5em) title block(height: 2pt, width: 100%, spacing: 0pt, utils.call-or-display(self, self.m-progress-bar)) } (self.methods.touying-slide)(self: self, repeat: none, section: (title: title, short-title: short-title), content) } #let focus-slide(self: none, body) = { self = utils.empty-page(self) self.page-args = self.page-args + ( fill: self.colors.primary-dark, margin: 2em, ) set text(fill: self.colors.neutral-lightest, size: 1.5em) (self.methods.touying-slide)(self: self, repeat: none, align(horizon + center, body)) } #let slides(self: none, title-slide: true, outline-slide: true, outline-title: [Table of contents], slide-level: 1, ..args) = { if title-slide { (self.methods.title-slide)(self: self) } if outline-slide { (self.methods.slide)(self: self, title: outline-title, (self.methods.touying-outline)()) } (self.methods.touying-slides)(self: self, slide-level: slide-level, ..args) } #let register( aspect-ratio: "16-9", header: states.current-section-title, footer: [], footer-right: states.slide-counter.display() + " / " + states.last-slide-number, footer-progress: true, self, ) = { // color theme self = (self.methods.colors)( self: self, neutral-lightest: rgb("#fafafa"), primary-dark: rgb("#23373b"), secondary-light: rgb("#eb811b"), secondary-lighter: rgb("#d6c6b7"), ) // save the variables for later use self.m-progress-bar = self => states.touying-progress(ratio => { grid( columns: (ratio * 100%, 1fr), components.cell(fill: self.colors.secondary-light), components.cell(fill: self.colors.secondary-lighter) ) }) self.m-footer-progress = footer-progress self.m-title = header self.m-footer = footer self.m-footer-right = footer-right // set page let header(self) = { set align(top) if self.m-title != none { show: components.cell.with(fill: self.colors.primary-dark, inset: 1em) set align(horizon) set text(fill: self.colors.neutral-lightest, size: 1.2em) utils.fit-to-width(grow: false, 100%, text(weight: "medium", utils.call-or-display(self, self.m-title))) } else { [] } } let footer(self) = { set align(bottom) set text(size: 0.8em) pad(.5em, { text(fill: self.colors.primary-dark.lighten(40%), utils.call-or-display(self, self.m-footer)) h(1fr) text(fill: self.colors.primary-dark, utils.call-or-display(self, self.m-footer-right)) }) if self.m-footer-progress { place(bottom, block(height: 2pt, width: 100%, spacing: 0pt, utils.call-or-display(self, self.m-progress-bar))) } } self.page-args = self.page-args + ( paper: "presentation-" + aspect-ratio, header: header, footer: footer, margin: (top: 3em, bottom: 1.5em, x: 0em), ) self.padding = (x: 2em, y: 0em) // register methods self.methods.slide = slide self.methods.title-slide = title-slide self.methods.new-section-slide = new-section-slide self.methods.touying-new-section-slide = new-section-slide self.methods.focus-slide = focus-slide self.methods.slides = slides self.methods.touying-outline = (self: none, enum-args: (:), ..args) => { states.touying-outline(enum-args: (tight: false,) + enum-args, ..args) } self.methods.alert = (self: none, it) => text(fill: self.colors.secondary-light, it) self }
https://github.com/Aadamandersson/typst-analyzer
https://raw.githubusercontent.com/Aadamandersson/typst-analyzer/main/components/syntax/test_data/parser/ok/let_binding_fn_pat.typ
typst
Apache License 2.0
#let add(x, y) = x + y #let two() = 1 + 1
https://github.com/j10ccc/algorithm-analysis-homework-template-typst
https://raw.githubusercontent.com/j10ccc/algorithm-analysis-homework-template-typst/main/layout/headers/title.typ
typst
#let title( body, homework_id: [0], deadline: [2023.9.11 : 6PM] ) = [ #align(center, [ = *习题 #homework_id* #v(16pt) ]) *提交截止时间 #deadline*。 #body ]
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-policy/code_of_conduct.typ
typst
#set enum(full: true, numbering: (..n) => { let format = if n.pos().len() > 1 {"a."} else {"1."} numbering(format, n.pos().last()) }) _These rules and policies are subject to change. Changes will become effective immediately upon a successful vote of adoption by the Board of Directors._ = Core Values Protohaven supports a maker space that values: *Inclusion:* We strive to create an environment where all feel welcome and are treated with dignity and respect. *Empowerment:* We share our knowledge, resources, tools, and space to build the capacity of others. *Collaboration:* We are a shared learning community that offers various levels of engagement to honor the creative aspirations of everyone. *Agility:* We shift our focus and resources based on the needs of our members and the community. *Sustainability:* We intentionally plan for the financial future of our organization and the environmental future of our planet. = Community Guidelines We ask that our members: + *Be Respectful:* Our students, members, instructors, Shop Techs, and partners bring with them a rich variety of experiences, perspectives, and aspirations. What brings us together is a shared interest in the process of making things. To create a welcoming, supportive environment, we ask each individual to treat one another with care and openness to diversity of race, gender, orientation, age, identity, and ability. + *Take Responsibility:* Protohaven is built around shared resources — space, tools, knowledge, and the community itself. To preserve these communal assets, each individual is asked to take responsibility for their own actions and to be mindful of how they impact those around them. We are each accountable for ourselves, and don’t expect others to bear the costs of our actions. + *Help Out:* Protohaven is a public charity and is made possible only by people giving more than they take. In this spirit, we ask each individual to find opportunities to help each other, the organization, and our broader community. We also ask each individual to recognize that assistance is not always sought, to seek consent before providing aid, and to provide opportunity for others’ work and discovery. = Shop == Shop Safety + Report all injuries and incidents: + Immediately report all accidents, injuries, or incidents to the nearest Protohaven Shop Tech or Instructor. + Immediately discontinue use of the tool(s) or equipment if it becomes unsafe, damaged, or is not working properly. Notify the nearest Protohaven Shop Tech. + Safe conduct: + Use the space and equipment safely and leave the space and equipment in clean and working condition. + Work and behave in a way that protects your own safety and the safety of others. + Children under the age of 18 must be accompanied and supervised by an adult at all times. + Ask for help when you are uncertain how to use equipment. + Prepare: + Safety is your top priority when using the makerspace. If you are not sure what to do, ask. + Be aware of locations of emergency exits, first aid, fire, and safety equipment. + Never use a tool unless you have been trained to use it safely and have received the appropriate clearance(s). + Use a step stool to reach extension cords or tools which are out of reach. Do not climb on tables or chairs to reach for something. + Do not work when tired, in a hurry, or under the influence of drugs, alcohol, or other judgment-altering substances. + Do not cause a distraction, fool around, or startle anyone while either one of you is using a tool or equipment. + Use protective gear and dress right. + Do not wear loose-fitting clothing around moving or rotating machinery. + Remove ties, jewelry, lanyards, etc., especially around moving or rotating machinery. + Tie back long hair. + Wear suitable gloves when handling hot objects or sharp-edged items. Do not wear gloves around spinning equipment. + Wear goggles where deemed necessary. + Wear appropriate ear protection when using or around loud equipment. + Obey special machine guidelines when available. + Use tools correctly: + Use tools how they are designed to be used. + Never use a broken tool. Report any broken tools or machinery to a Protohaven Shop Tech immediately. + Do not remove tools from Protohaven premises. + Never walk away from a tool that is still on or spinning down. + Never tamper with a tool’s safety features. Operate machinery according to recommended procedures and with safety guards in place, as applicable. + Do not modify Protohaven tools or equipment unless you have received approval from Protohaven staff or leadership to do so. + Clean up: + Clean up after yourself; leave the area clean and tidy. + Clean and return all tools to where you got them. + Shut off and unplug machines when cleaning. + Never use a rag near moving machinery. + Use a brush, hook, or a special tool to remove chips, shavings, etc., from the work area. Never use your hands. + Keep fingers clear of the point of operation of machines by using special tools or devices, such as push sticks, hooks, pliers, etc. + Keep the floor around machinery clean, dry, and free from trip hazards. + Clean up spills immediately and put a chair or cone over them if they are wet enough to cause someone to slip. == Non-Discrimination Protohaven does not promote or discriminate against any person, population group, or organization with regard to categories protected by applicable United States law. These include, but are not limited to race, color, religion, sex, gender identity and expression, physical appearance, language, education background, national origin, age, disability, and veteran status. == Anti-Harassment Harassment is prohibited and will not be tolerated. Any person who feels they have been the victim of harassment should ask the harasser to cease the behavior if they feel safe doing so. Members or guests asked to stop any harassing behavior are expected to comply immediately. Harassment includes the following, without limitation: + Offensive comments related to race, religion, gender, gender identity and expression, sexual orientation, disability, or physical appearance + Gratuitous sexual or obscene images or behavior + Unwelcome physical contact or sexual attention without consent or after a request to stop + Threats or incitement of violence towards any individual, including encouraging a person to engage in self-harm + Deliberate intimidation by words, gestures, body language, or menacing behavior + Stalking + Harassing photography or recording, including logging online activity for harassment purposes + Continued one-on-one contact or communication after requests to cease + Deliberate \"outing\" of a sensitive aspect of a person’s identity without their consent + Deliberate misgendering. This includes deadnaming or persistently using a pronoun that does not correctly reflect a person\'s gender identity = Formal Complaints The formal complaint process exists for members to request a discussion be held by the Board of Directors regarding specific actions of another member. Members are expected to discuss their complaints in a calm and polite manner. Mediation is available to resolve issues without the need of a formal complaint. + Formal complaints against another member must be submitted, in writing, to the Board of Directors or to any member of the Board of Directors. The complaint must have two parts outlined at minimum, a \"Complaint\" part and a \"Recommended Solution\" part. + The Board of Directors will consider the complaint at the next, appropriate meeting. Identifying information will be scrubbed from meeting minutes, and documentation of the complaint will be appropriately logged in Neon. + The board reserves the right to address the conduct as they deem most appropriate and violators will be notified in writing. = Code of Conduct Violations Any member or guest who violates any part of the Protohaven Code of Conduct will be asked to stop or leave. Violations will be logged in the member’s Neon profile by a Protohaven Shop Tech, Staff, or Board of Director Member. Based on the frequency or severity of the violation(s), Protohaven Board of Directors reserve the right to suspend or terminate the violator’s membership. Notice of suspension or termination will be made in writing. Unsafe use of tools or equipment may also result in removal of clearances, requiring remedial training via classes or private instruction at the violator’s expense. Members may appeal a suspension or termination of membership in writing to the Board of Directors within 30 calendar days of receipt of notification. Membership will remain in suspension or termination until the appeal is closed.
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/typstfmt/124-block-comment.typ
typst
Apache License 2.0
#let test(..args) = ( // do something ) #test( a: "test test test test test", b: "test test test test test", )[ /* test */ test test test test test test test test test test test test test test test test test test test test test test test test ][ /* test */ test test test test test test test test test test test test test test test test test test test test test test test test ][ /* test */ test test test test test test test test test test test test test test test test test test test test test test test test ]
https://github.com/alejandrgaspar/pub-analyzer
https://raw.githubusercontent.com/alejandrgaspar/pub-analyzer/main/docs/api/internal/render.md
markdown
MIT License
# Render Pub Analyzer provides the option to generate reports in PDF format, that summarizes all the available information. This process utilizes [typst](https://typst.app/){target=_blank}, the new markup-based typesetting system for the sciences. Let's see how to render a scientific production report for an author. ```python import asyncio from pub_analyzer.internal.render import render_report from pub_analyzer.models.report import AuthorReport report = AuthorReport(**kwargs) # (1)! pdf_bytes = asyncio.run(render_report(report=report, file_path='demo.typ')) with open('demo.pdf', mode="wb") as file: file.write(pdf_bytes) ``` 1. Use real information instead of `**kwargs` placeholder. !!! Warning Currently, I have not discovered an efficient approach to generate a complete PDF summary for institutions, covering the huge volume of data in the reports. I am open to new ideas and suggestions about it. ::: pub_analyzer.internal.render options: show_source: false
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/036%20-%20Guilds%20of%20Ravnica/007_The%20Gathering%20Storm%3A%20Chapter%201.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Gathering Storm: Chapter 1", set_name: "Guilds of Ravnica", story_date: datetime(day: 05, month: 06, year: 2019), author: "<NAME>", doc ) It was autumn in Ravnica, and so it rained, day after day. The sky was gray from horizon to horizon, the sun only a vague hint of a brighter glow behind the clouds. Rain marched down the boulevards in sheets like a conquering army, infiltrated the tiny, crooked alleyways, rattled the stained-glass windows in the places of worship, and pattered off the trees in the gardens. In the squares, fountains overflowed, and the drains bubbled and vomited up debris. In the underground kingdom of the Golgari, far below the city streets, drips became trickles became torrents, as all the water slowly drained down, through layer after layer of ancient architecture, back to the long-buried oceans. Any hint of sunshine was long gone for the day when <NAME> turned the corner of Frost Lane into the neighborhood known as Seven Swords. A few of the more upscale shops were lit by steady magical glows, but here most made do with cheaper oil lamps, which sputtered unhealthily in the damp. The few other passersby who shared the street moved quickly, heads down, huddled under umbrellas or clutching sodden coats. Ral didn’t hurry, nor did he keep his head down. He walked with steady purpose, his long, dark coat flapping around his ankles. The rain caused him no hardship at all; it started to bend away from him about five feet above his head, splashing into a neat circle all around him that was wide enough not to dampen his boots. #emph[After all,] he thought, with grim satisfaction, #emph[what’s the point in being a "rain mage" if you have to get wet?] While he scanned the doorways and storefronts, he kept half his attention on the people around him. Tonight could be a trap—in fact, it was almost #emph[certainly] a trap—but while he thought he knew what #emph[kind] of trap, one could never be certain. Not when you were dealing with Bolas. Fortunately—both for his peace of mind and for their own good health—no one seemed interested. Seven Swords was not a rowdy neighborhood, nor a particularly rich one. The origin of its name, like so much of Ravnica, was lost in the mists of time, but these days it was just a small block of streets lined with large stone townhouses that had seen better days. Originally built for the rich, back when the area had been fashionable, they were now subdivided into tiny apartments, so a family might sleep, eat, and work all in what had once been some aristocrat’s ballroom or pantry. A few businesses operated at ground level, mostly taverns, eateries, and pawn shops, the latter identifiable by their iron-barred windows. Where Frost Lane met Green Street there was a small square, with a derelict fountain brought back to a semblance of life by the endless rain. It was lined by larger buildings, most of them in equally bad repair. Cast-iron benches were slowly dissolving into puddles of rust, leaving wide orange stains on the cobblestones. Ral turned, picking out the old signs, and finally found what he was looking for. On the corner, a worm-eaten wooden signboard covered in peeling white paint marked the entrance to The Silver Curtain. The doors below it had been boarded up long ago, and subsequently broken open. They hung half-open, revealing only gloom within. #emph[Well.] Ral stared into the darkness, as though force of will could make it give up its secrets. #emph[I suppose there’s only one thing to do.] He felt a touch of nerves, a faint tightness in his throat, but he banished it at once. Instead he summoned his anger, the slow, hot rage that had powered him all these years. #emph[How dare he come to me ] now#emph[?] Ral’s hands tightened into fists. Distant thunder rumbled, and Ral could feel the lightning overhead flashing from cloud to cloud, as though the arcs were drawn across his skin. He stalked forward, pushing the doors wide, and stepped into darkness. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) At the same moment, across the Tenth District, a young woman was breaking into Nivix. Most people would have said this was, if not actually impossible, then at least suicidal. Nivix, rising like a spike above the lesser spires of the Ravnican skyline, was the headquarters of the Izzet League. The lower stories were packed with workshops, barracks, and laboratories, guarded by madmen with flamethrowers and tireless, watchful constructs. Above that were the quarters of the most senior members of the Izzet, home to some of the most dangerous mages and inventors in Ravnica. And above #emph[that] was the Aerie, home to Niv-Mizzet himself. The Firemind, ancient dragon, parun of the guild and schemer beyond compare. The intruder was headed for the very top. Most people would have said she was not in her right mind, and if she’d been able to she would have agreed with them. There was something else in there with her, another mind, a slithering, scaled thing that looked out through her eyes and had snuffed out her will as easily as blowing out a candle. She was currently attached to a kite, a broad wood-and-canvas thing painted a dark gray, to be lost against the evening sky. Tame air elementals had borne her up, well above even the tip of Nivix’s spire, but she’d dismissed them before making her approach. Niv-Mizzet and his minions had wrapped the Aerie in wards, and anything so crude as magical flight would be detected instantly. Indeed, <NAME>, who had ultimate responsibility for the innermost protections of the Firemind, had done an exemplary job. Deep inside Nivix, there was a control room, manned night and day by loyal Izzet watchmen. Any attempt to teleport, phase, or otherwise pass magically through the walls or windows would set alarm bells ringing. Any brute physical efforts, needless to say, would do the same. Ral himself checked the wards every evening, and made regular inspections to ensure they were properly maintained. Tonight, however, <NAME> was elsewhere. His responsibilities in this area passed to Watch Captain <NAME>, an innocuous vedalken who had risen through the ranks of the Izzet’s guards on the strength of his willingness to obey orders and display absolutely no imagination. Like Ral, he would do his duty with careful thoroughness. Unlike Ral, he was a fan of the comic opera. And last night, at a performance of #emph[Spirogne Goes Hunting] , he’d had a chance encounter with a #emph[delightful] young woman, and— —Well, Neero didn’t remember much of the night after that. But the young woman, who was the same young woman strapped to the kite, was a Dimir thoughtstealer, so her dates often worked out that way. And now, if all had gone well— In her magically enhanced vision, Nivix’s wards glowed in every color of the rainbow, a vicious spectrum of traps and alarms. At the very top of the tower, where a vast window of curved glass looked over the city, they blazed particularly brightly. Until, just at the appointed hour, they all went dark. Neero Jax would have some questions to answer in the morning. The intruder angled her kite, descending toward the tower. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) It was no longer evident what kind of theater The Silver Curtain had been, since it had clearly been playing only to audiences of rats for years now. Ral stepped carefully through the anteroom, where scraps of old posters still clung to the decaying plaster walls, and edged past the ticket-taker’s stall. Another pair of double doors led into the theater itself, a wide semicircular room with rows of rotting wooden seats on either side of a central aisle. At the far end was the stage, the proscenium arch half-collapsed, the eponymous silver curtain in shredded tatters behind it. Ral was more interested in the man who sat at the edge of the stage. He was in middle age, with a lined, weathered face and long hair bound into ragged dreadlocks. Under his loose robe, much of his chest was replaced with smooth, flexible metal, and his right arm was a twisted cage of metal struts, ending in fingers like talons. He looked up as Ral entered, with a brief smile entirely devoid of humor. "Tezzeret," Ral said. He’d suspected as much, from the message he’d gotten. "Still running the old lizard’s errands, I see?" "<NAME>." Tezzeret yawned with affected indifference. "Still killing time on this second-rate world." The old rage shifted in Ral’s chest. His hands tightened, but he kept his tone casual. "I thought I made it clear last time that we had nothing left to say to each other." "You may have nothing left to say," Tezzeret said. "But for reasons that escape me, #emph[he] has decided to make you an offer. A #emph[final] offer." "Your #emph[master] told me that once already," Ral said. Tezzeret’s lip twitched, and Ral knew he’d scored. The prideful Planeswalker hated to be reminded of his subservience. "You should tell him his threats are less impressive when he doesn’t follow through." "As I said, I don’t understand why he extends his mercy, only that it rarely lasts." Tezzeret pushed himself down from the stage. "You owe him a debt, Zarek. You can pay it, and reap the benefits of service." He cocked his head, and crimson energy rippled down his metal arm. "Or you can continue your obstinacy, and burn with all the rest." "Tempting." Ral smiled thinly. "But I already have one arrogant dragon to deal with. I’d rather not swap him for another." "As I expected." Tezzeret shrugged. "In which case—" His slow, deliberate pace vanished. Tezzeret slashed his metal arm, launching a spray of white-hot metal in Ral’s direction. Ral was equally quick to react. Power flowed down his arm, into the mizzium nodes in his bracer. A crackling shield of electrical energy sprang to life, sending the projectiles spinning away in all directions before curving back to rejoin their originator. Tezzeret had already hopped back up onto the stage. Beside him, something was rising out of the dust: a long-limbed, spider-like construct with a single glowing eye on a flexible stalk. Two more of the things shook themselves free of debris in the corner of the theater, and Ral could hear at least one more behind him, blocking the exit. "A nice trick," he said, then looked up at the ceiling. "But how long can a storm mage last away from the storm?" Tezzeret grinned again. "I suppose we’ll find out." He ducked out of sight into the theater’s backstage as the constructs charged. Ral spun, and the machine closing from behind crashed against his shield in a spray of sparks. He lashed out with his other hand, and a short burst of lightning crackled across the thing, sending it stumbling drunkenly backward to crash into a wall. Before he could finish it, the rest of them were on him, and Ral had to duck to one side as a clicking, hissing construct lashed out with scythe-like forelimbs. He gave ground, putting his back to the wall, and spread his arms. It was, indeed, a problem for a mage of the storm to be cut off from the sky. The amount of power Ral could store in his body was limited, and the process was exhausting. #emph[But that’s the thing about the Izzet. We solve problems.] #emph[] #emph[] Fortunately, he’d come expecting a trap. On his back, a bulge beneath his trench coat, was the Mizzium-Ion Electrostatic Accumulator, Mark IV, the very latest from the Laboratory of Storms and Electricity. It was fully charged, mizzium rings spinning rapidly in their crystal chambers. Long conduits linked it to the bracers on his forearms, where output nodes helped shape and channel the power. The original long-ago inventor had intended her device to produce harmless entertainment for children’s parties. After the third fried clown, Ral had taken over the project for his own purposes. Electricity cracked down his right arm, forming into a crescent-shaped arc of white-hot plasma. When the construct closed, Ral sidestepped and unleashed plasma with a thunderclap. Hardened steel parting like wet plaster, and the construct died with a screech of grinding gears. One of its fellows climbed over its corpse, blades swinging down, and Ral ducked and chopped its legs out from under it with another blast, leaving it to flounder helplessly. The construct from the anteroom had joined its remaining fellow by now, and they squared up and came at him together, shoulder to mechanical shoulder. Ral let his shield vanish in a spray of sparks and raised both hands. Every hair on his body stood on end as the accumulator’s energy flooded through him, crackling briefly over his fingertips before blasting out in a double bolt of lightning. Thunder shook The Silver Curtain, dislodging more plaster from the walls. The two constructs twitched like dying insects in the massive discharge, then sagged as soon as Ral lowered his arms, their delicate internals melted into so much slag. He cast an irritated glance over his shoulder at the stage, but there was no sign of Tezzeret. #emph[If he wanted me dead, this was a pretty poor attempt.] Ral’s frown deepened. Tezzeret might be arrogant, but he wasn’t stupid. #emph[Which means he doesn’t want me dead. And Bolas must have known I’d turn him down. So why call me here?] #emph[] #emph[] #emph[A diversion.] Which meant he was in exactly the wrong place. Flames were starting to lick at the walls of the old theater, rising from the super-heated metal corpses of the constructs. Ral was already running, out through the anteroom and into the rain, his coat flapping behind him. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The intruder hit the side of Nivix, letting go of her kite, which whipped away in the wind before tumbling to crash somewhere in the city below. That left the young woman without an escape route, but the #emph[thing] in her mind didn’t care about that. A mind mage herself, she recognized the work of a master in the controlling presence. Somewhere deep inside she was screaming, but her body calmly climbed the pebbled stone of the outside of the tower until she reached the great window, a huge multi-paned circle like an insect’s eye. She opened a belt pouch, clinging nonchalantly to the tower with one hand, and came up with a small metal device with a suction cup at one end. She’d acquired it from a black-market Izzet artificer—some irony there. When it was stuck fast against one pane of the window, she touched the end. The little thing gave a high-pitched whine that set her teeth on edge, and then the glass of the window sagged and melted, still cold but flowing as easily as water. It ran down the leading and out of the way, and the intruder slipped easily into Niv-Mizzet’s inner sanctum. A half-dozen alarms ought to have been blaring at that point, but instead there was silence. The Aerie was a single massive room, sized for the convenience of an ancient dragon. A variety of telescopes and other optical instruments stood at the window, pointed variously at the sky or out across the city. Books were everywhere, piled in drifts or stacked on shelves until they were in danger of collapse. Presumably the prodigious intellect of the Firemind could make some sense of the confusion. There was surprisingly little of the machinery for which the Izzet were famous, no smelting vats or bins of spare parts, no steam-belching contraptions. Niv-Mizzet was beyond such things, experimenting in the realm of pure thought and magic. But even ancient dragons needed to sleep from time to time, and the parun of the Izzet was currently curled up in one corner of his stone-walled laboratory like a cat, the tip of his serpentine tail twitching lazily beneath his nose. The sound of his slow breath was as loud as a blacksmith’s bellows. Even with the outer wards breached, Niv-Mizzet was far from helpless. The floor of his sanctum was layered in arcane traps, visible to the intruder’s enhanced sight as lines of blue-white energy crisscrossing the floor, flanked by twisting columns of runes. An ordinary thief or assassin might have found these an impenetrable barrier, but the presence in the intruder’s mind knew that no defense was truly impregnable. It calculated for a moment, then moved its host forward, stepping confidently through the barriers. The intruder stepped, waited a heartbeat, turned, sidestepped, sprinted forward, paused again. Magic pulsed and shimmered through the web of wards, searching for heat, for movement, for the spark of life. The young woman held her breath for so long her vision went gray at the edges as she shuffled backward in front of a bookcase, then spent a moment recovering before turning an easy cartwheel and walking on her hands through a section of densely interleaved runes. #emph[Not bad] , the presence thought. #emph[But not good enough.] #emph[] #emph[] Before long, its host stood at the side of the sleeping dragon, reaching a cautious black-gloved hand to lay on one of Niv-Mizzet’s long, dark horns. The presence called on the young woman’s power, her subtle magic reaching out toward the Firemind. Even here, at the center of his power, Niv-Mizzet was paranoid. Ever since <NAME> had touched his thoughts, prior to becoming the Living Guildpact, Niv-Mizzet had taken to warding his mind more carefully. Even with the guidance of the intrusive presence, no mind mage could extract any secrets from the dragon now, not without his noticing. #emph[But ] adding#emph[ a secret . . . oh, yes.] #emph[] #emph[] The intruder touched her temple, and when she pulled her finger away a blue glowing thought strand dangled from it, fragile as a spider’s thread. She lowered her hand, letting the strand brush along the dragon’s scaly skin. It fell from her finger and sank into Niv-Mizzet’s head, merging with his thoughts. #emph[Just a very small addition, when all’s said and done.] #emph[] #emph[] Task accomplished, the intruder turned away. The innermost ring of magical traps was just in front of her, and the presence in her mind identified the one it wanted, and forced her to step forward. #emph[No!] The Dimir mindmage struggled to fight back. #emph[You’ve done what you wanted. At least let me ] try#emph[ to get out of here!] #emph[] #emph[] #emph[Sorry, my dear.] The presence took firmer hold of her mind. #emph[Your part isn’t done yet.] #emph[] #emph[] The presence unsheathed mental claws, and the young woman, in the depths of her own mind, screamed again. It flayed her memories, twisting, shifting, and destroying. Sculpting what it wanted. When it was satisfied, it nudged her forward another step. Her foot came down squarely in the middle of a stasis trap, and blue-white energy snapped into a taut sphere all around her, freezing her in place as firmly as if she’d been encased in ice. At the same time, magic pulsed a warning, both to Niv-Mizzet and the unfortunate guards down in the control room. Behind the intruder, the dragon opened one slitted eye. #emph[Perfect] , the presence thought. It slipped away, leaving its host behind, trapped like a fly in a spider’s web.#linebreak    #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) That something had happened was obvious the moment Ral returned to Nivix, out of breath from his sprint across the district and wet through. He’d been too busy dodging traffic, once he’d returned to the busier neighborhoods, to keep up his rain-repelling spell. Even this late at night, the Tenth District bustled, the roads thick with carriages and pack animals while pedestrians spilled out of the taverns and theaters. Around Nivix, though, Izzet guards were out in force, cordoning off the tower’s grounds. A squad of viashino scorchbringers prowled past, dragon-like humanoids in gleaming armor, pilot lights glowing on their low-slung flamethrowers. Ral avoided the main doors, heading for a more secure side entrance. Two uniformed guards there recognized him and cleared the way, and he stalked past them, rain dripping from his coat onto the scarred concrete floor. The Nivix was a maze, but one he’d worked in for decades, and it didn’t take long to get to the control room on the second floor. There were more guards here, and through the open doors he could see a pair of chemisters with a horde of attendants tearing apart the spells and machinery. Before he could go inside and take charge, a goblin woman in the uniform of a guard captain stepped in his path. "<NAME>," she said. "Ah . . . so glad you’ve returned. There’s been an incident." "What kind of incident?" Ral growled. "We’re . . . not sure, sir. Something happened up in the Aerie. The guildmaster has . . . not been forthcoming. <NAME> has ordered the tower locked down as a precaution, and we’re checking all the defenses." #emph[Maree] . Of course that jumped-up little goblin would take charge. #emph[I’ll deal with her later.] "I want a report on everything you find," Ral said. "In the meantime—" "In the meantime, sir," the captain interrupted, "the guildmaster has requested your presence. At once." "Ah." Ral paused for a moment, straightening his coat. "Send the reports to my office, then. I’ll be in the Aerie." The captain nodded and rushed off, clearly glad to be out of his presence. Ral turned away from the arguing chemisters and walked toward the elevator, a little more slowly. While he was grateful not to have to climb the stairs to Niv-Mizzet’s roost, it was hard not to escape a nervous thrill when he stepped into Nivix’s elevator. It had been designed by <NAME> to hurl high-speed rocks at passing clouds, and only repurposed for transporting people up and down when the goblin inventor couldn’t get it to go quickly enough. Today, though, Ral was lost in thought, and paid little heed to the jerk as the rockapult\/vertical lift started upward. #emph[An incident in the ] Aerie#emph[? Did someone try to attack the guildmaster himself?] That seemed more than a little mad, but assassins had targeted Niv-Mizzet before. A worm of fear turned in Ral’s gut. He’d been away, which might bring suspicion in his direction; he’d served Niv-Mizzet loyally for decades, but the dragon was notoriously fickle when it came to his underlings. For a fleeting moment, he wished he’d stopped to charge his accumulator. #emph[Not that it would matter.] #emph[] #emph[] The elevator reached the top floor with a quiet #emph[ding] . Ral stepped out, glancing quickly around the Aerie. Nothing seemed immediately amiss. One pane of glass was missing from the great window, but there was none of the destruction he’d expect if Niv-Mizzet had fought off an attacker. #emph[So not assassination. What, then] #emph[] #emph[] The dragon himself was hunched over in the far corner, fussing with something Ral couldn’t see. As always, Ral was amazed at how lightly and gracefully Niv-Mizzet moved, considering his size. His long, blue-fringed wings were tucked against his back, and the spined membranes around his head flexed, a sure sign that he was agitated. When he turned to Ral, long neck curving to face the Planeswalker, his huge paws made hardly a sound on the stone, like he was some enormous cat. "Ral." The dragon spoke in a soft whisper, but his words simultaneously echoed in Ral’s mind in a deep, stentorian bass. He took another step forward, enormous eyes hooded. "Kind of you to join us." "Apologies, Guildmaster." Ral made a half-bow, the accumulator shifting on his back. His long, white-streaked hair, not standing on end for once, flopped against his cheek. "I was called away on urgent business." "What sort of urgent business?" the dragon snapped. Ral blinked in surprise. He’d expected Niv-Mizzet to be focused on whatever had happened here; the dragon was nothing if not self-centered. His mind raced. "I was investigating a potential threat." "Ral." Niv-Mizzet took another step closer, and Ral felt the hot wind of his breath. "The time for lies has passed." #emph[Damn.] Ral had done a great deal of fast talking, over the years, to keep his secrets from the guildmaster. The existence of Planeswalkers, for a start, and the fact Ral was one, not to mention the true purpose of Project Lightning Bug— "Let me help you." For some reason, there was an edge of amusement in the dragon’s voice. "You were meeting with an agent of <NAME>." "I—" Ral froze. #emph[He knows.] #emph[How much does he know?] "Guildmaster . . ." "Ah, Ral. You really are very clever." Niv-Mizzet’s enormous head swung close, jaws parted. "For a human. Tell me, do you know how long I have been guildmaster of the Izzet?" "Since the beginning," Ral managed. "You are the parun. Ten thousand years, at least." "Ten thousand years," the dragon agreed. "Can you even imagine that span of time? Ten thousand years watching this city and its people. Ten thousand years to contemplate the nature of the universe. And yet you presume me unaware of your little secrets." Niv-Mizzet’s mental voice rose to a roar. "#emph[Do you think they call me the Firemind for nothing] ?" Ral took an involuntary step backward, bowing automatically. "No, Guildmaster. Of course not." He hesitated, then cautiously looked up. "How long have you known?" "That you are a Planeswalker? Since you first came here. The signs are not difficult to read, once you know the truth." "Then why pretend ignorance?" Niv-Mizzet gave a dry chuckle. "In ten thousand years, I have found no tactic more effective than knowing more than you let on. I had no reason to interrupt your little game. Until now." He ruffled his wings. "Who did you meet?" "Tezzeret," Ral said, deciding quickly that honesty was now the only way out. "He tried to convince me to serve Bolas, and then to kill me when I refused." He paused, then added, "I believe his intention may have been to make certain I was away from the tower." "Plans that serve more than one purpose are Bolas’s hallmark." Niv-Mizzet raised a foreclaw, and a blue-white sphere of energy floated up from behind him. Inside was a young woman dressed all in black, frozen in place, her eyes wide with terror. "While you were away, we had a guest. One of Lazav’s creatures." "Lazav." Ral grimaced. "The Dimir are working with Bolas?" "So it would seem. I have examined her mind." The dragon turned to stare at the spy, then made her float away with another lazy wave. "She was sent to extract certain information from me. Bolas knows my plan, at least in outline." "Tezzeret implied that Bolas is coming here, to Ravnica." Ral’s head was still spinning with the idea that Niv-Mizzet #emph[knew] all of this. "It could be a lie, of course." "He is coming. What do you think the Interlocus has been in preparation for?" Ral’s breath caught. The Interlocus was Niv-Mizzet’s mysterious personal project, which had consumed so much of the dragon’s time and attention—to say nothing of guild resources—for months. He’d delegated more and more of the guild’s day-to-day functioning to Ral. It had always rankled that, however much Niv-Mizzet seemed to trust him, he’d never explained the purpose of his plan. "Bolas is coming," the dragon repeated. "I have heard reports of the havoc he has wreaked on other planes, and I will not allow it happen here. He will come to Ravnica, and I will kill him. "<NAME> is . . ." Ral hesitated again. "Very powerful, Guildmaster." "Your confidence is touching," Niv-Mizzet said dryly. "Rest assured, I will be prepared for him. But there is a problem which requires your attention." "A problem?" "The Guildpact." Niv-Mizzet settled back on his haunches with a yawn. "To defeat Bolas, I must become stronger. Much stronger. And the Guildpact will not allow it. It was created to prevent one guild from becoming much more powerful than the others, after all. To preserve the balance." The dragon sounded irritated. "To deal with this kind of threat is exactly why Azor created the position of the Living Guildpact." "Beleren?" Ral said. "But he—" "Is gone. And no one knows when or if he will return. Without him we are trapped." Niv-Mizzet’s voice was a snarl. "Azor never anticipated a #emph[Planeswalker] taking the position. It would have been better if it had remained in our control." Ral swallowed nervously. He’d been involved in that debacle, substituting himself for Niv-Mizzet’s carefully designed artificial challenger for the Implicit Maze. He hadn’t thought the dragon cared about that, but at this point he no longer wanted to assume anything. "There is a final failsafe," Niv-Mizzet went on. "The Guildpact can be altered." "Altered? Is that possible?" "With the agreement of all ten guild leaders." Another humorless chuckle. "You can see why it has never been done." It was certainly hard to imagine getting all ten of Ravnica’s feuding guilds to agree on #emph[anything] , much less changing the basic laws underlying their competition. "So what do you need me to do?" "Get them to agree, of course." "That’s . . ." Ral shook his head. "I don’t think that’s possible, Guildmaster." "It is the task I have assigned you," Niv-Mizzet snapped. "You will perform it to the best of your ability, or I will find someone who can." His tone softened. "When the Interlocus is complete, I will no longer be master of the Izzet. I will be apart from the guilds, above them. Our guild will require a new guildmaster, for the first time in ten thousand years." The dragon’s eyes narrowed. "Consider this a graduation exam, of sorts." "I . . ." Ral straightened up. #emph[Get a hold of yourself. ] Niv-Mizzet had shaken him, no doubt exactly as the dragon had intended. But what he offered  . . . #emph[It’s what I’ve wanted since the beginning.] A position commensurate with his talents. #emph[Guildmaster of the Izzet.] He felt a universe of possibilities opening in front of him. #emph[And all I have to do is convince ten mortal enemies to grant one ancient dragon enough power to stop another.] #emph[] #emph[] He cleared his throat. "Understood, Guildmaster. I will begin immediately." "Excellent." Niv-Mizzet sounded genuinely pleased. "I have some connections that will be of assistance. You’ll receive their reports." "Thank you," Ral said. "What of the Dimir? If they’re already working for Bolas –" "Leave the Dimir to me. If Lazav has thrown in his lot with Bolas, then we will simply need to replace him. No doubt one of his lieutenants will be unhappy with his guildmaster’s choice of loyalty." "As you say." Ral bowed again. "With your permission, I’ll go and get started." "One more thing." Ral straightened up as a thick roll of draft paper floated over to him from one of the dragon’s work tables. He picked it out of the air and unrolled it, frowning. The sheets were blueprints, fabulously complex, but still somehow familiar. "What is this?" he said. "A backup plan," Niv-Mizzet said. "A crossplanar beacon, based on the design of your Project Lightning Bug." Recalling the lengths to which he’d gone to keep that project’s true significance from the guildmaster, Ral winced. There was a hint of amusement in the dragon’s voice. "When activated, it will make Ravnica shine in the sight of Planeswalkers throughout the Multiverse. How many will come, I cannot say, but it may be that they will gather in sufficient power to defeat Bolas, in the event my own efforts are insufficient." "Calling a horde of Planeswalkers whose intentions we don’t know to Ravnica seems . . . extreme." "Indeed," Niv-Mizzet said. "But better to have the option and not need it than the other way around. See that it is constructed according to my specifications." "Of course, Guildmaster. I’ll put our best chemisters on it." "You may go." Niv-Mizzet settled down, pillowing his head on his paws. "I look forward to hearing reports of your progress."#linebreak    #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) In the elevators, Ral took a few moments to calm his breathing. #emph[Get the guilds to agree to change the Guildpact.] It still seemed impossible, but half of Ral’s life had been spent doing the impossible. #emph[You find the first step, and then you keep going.] He grinned, and ran his fingers through his hair, a crackle of electricity restoring it to normal frizzy state. He could already see what the first step had to be. When he emerged from the elevator, he sent messengers racing in the direction of the Azorius Senate, bearing notes under the official Izzet League guild seal. #emph[After all, how do you get started arranging an impossible meeting?] He grinned to himself. #emph[You start with the people who love meetings.]
https://github.com/piepert/philodidaktik-hro-phf-ifp
https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/grundpositionen/debatten_und_kontroversen.typ
typst
Other
#import "/src/template.typ": * == #ix("Debatten", "Debatte") und #ix("Kontroversen", "Kontroverse") #orange-list-with-body[*#ix("Lassahn-Deppe-Kontroverse", "Lassahn-Deppe-Kontroverse", "<NAME>", "<NAME>"):* #text(fill: black)[Sollten die Probleme und Fragen von SuS zu den Problemen der Philosophie werden oder umgekehrt?]][ #ix("<NAME>", "<NAME>") ist der Meinung, dass die aktuellen gesellschaftlichen und politischen Fragestellungen der SuS kanonischen Philosophietexten vorzuziehen ist.#en[Vgl. @Lassahn1972_Aktualitaet[S. 16]] #ix("<NAME>", "<NAME>") kritisiert diese Auffassung: seiner Meinung nach ist eine reine Konzentration auf aktuelle Fragestellungen insofern schwierig, als dass man sie erst durch die traditionellen Primärtexte komplett verstehen könne.#en[Vgl. @Lassahn1972_PUBegruendung[S. 49]] ][*#ix("Rehfus-Martens-Kontroverse", "Rehfus-Martens-Kontroverse", "<NAME>", "<NAME>."):* #text(fill: black)[Welche Ziele hat Philosophieunterricht und wie sieht ein guter Philosophieunterricht aus?]][ #ix("<NAME>", "<NAME>") ist Vertreter der #ix("Konstitutionsthese") der Philosophiedidaktik und der Meinung, dass diese notwendig dem Menschen innewohnt, unabhängig von Ort (Schule, Universität, ...) und Alter (Kind, Jugendlich, Erwachsen). Er spricht von der Philosophie als "#ix("Kulturtechnik")". Seine bevorzugte Vorgehensweise ist die des #ix(["induktiven Entdeckens"], "Induktion") in Form einer #ix("dialogisch-pragmatischen Methode", "Methode, dialogisch-pragmatisch"), bei der die SuS Probleme selbständig lösen, ohne ein großes Fundament aus traditionellen philosophischen Theorien. Im Mittelpunkt steht der philosophische Dialog und die thematischen Interessen der SuS, wonach der Philosophieunterricht ausgerichtet werden soll. #ix("<NAME>", "<NAME>.") ist im Gegensatz dazu der Meinung, dass die Philosophie ungeeignet zur Vorbereitung auf das alltägliche Leben ist und es eine #ix("elitäre Handlung", "Handlung, elitär", "Elite") ist, die in der Universität stattfindet. Die Rolle des Philosophieunterrichts ist, die SuS auf diese Tätigkeit vorzubereiten. Dazu gilt es, philosophische Traditionen zu verstehen und sie anwenden zu können; dies entspricht eienr #ix("deduktiven Analyse", "Deduktion") der Probleme. Der Vorschlag von Martens, die Probleme der SuS in den Mittelpunkt des Unterrichts zu stellen, ist damit nicht kompatibel. Auch den Dialog als Primärmethode der Philosophie lehnt er ab, stattdessen spricht Rehfus von einer #ix("monologisch-analytischen", "Methode, monologisch-analytisch") Auseinandersetzung der SuS mit den Themen. #set par(justify: false) #table(columns: (auto, 0.5fr, 0.5fr), stroke: none, [], strong[#ix("Rehfus", "<NAME>.")]+en[Vgl. @Rehfus1986_BildungstheoretischerPU], strong[#ix("Martens", "<NAME>")]+en[E. Martens: Philosophieren als Kulturtechnik. In: ders.: Methodik des Ethik- und Philosophieunterrichts. Hannover 2003. S. 30 ff.], align(right)[Philosophie], [ - ist nicht didaktisch sondern argumentativ in sich selbst - ist ungeeignet zur Vorbereitung auf das Leben ], [ - ist didaktisch #ix("konstituiert", "Konstitutionsthese") - ist notwendig zur humanen Lebensgestaltung (Philosophie als #ix("Kulturtechnik")) ], align(right)[Denken], [ - ist der Hauptbestand in der Philosophie und im Unterricht - ist Ich- und theoriebezogen ], [ - ist eine Praxis über die Praxis und des Hauptziels des Unterrichts ], align(right)[Schule], [ - hat propädeutische Bedeutung zur Vorbereitung auf die wesentliche Stätte der Philosophie: die Universität/Akademie ], [ - ist als Ort des Philosophierens geeignet; das Philosophieren ist als Kulturtechnik kann an mannigfaltigen Orten praktiziert werden ], align(right)[Dialog], [ - ist nicht philosophie-spezifisch und dem Denken untergeordnet ], [ - ist philosophie-spezifisch und wichtig für philosophische Prozesse. ], align(right)[Philosophie-\ unterricht], [ - sollte bildungstheoretisch#en["bildungstheoretisch" meint in diesem Konetext, dass der Philosophieunterricht nicht praktisch, mit einem Fokus auf die Handlung, sondern theoretisch, mit einem Fokus auf das reflexive Denken, stattfinden soll.#en-note("note-bildungstheoretisch")]#en-content("note-bildungstheoretisch")[Vgl. @Rehfus1986_BildungstheoretischerPU[S. 101 ff]]/identitätstheoretisch#en[#box(place(hide["]))"identitätstheoretisch" meint in diesem Zusammenhang die Philosophie als Reflexionsmöglichkeit als Ausgang aus eigener Identitätsnot.#en-note("note-identitätstheoretisch")]#en-content("note-identitätstheoretisch")[Vgl. @Rehfus1986_BildungstheoretischerPU[S. 106 ff]] ausgerichtet sein - sollte die Probleme der Philosophie zu den Problemen der SuS machen - sollte Lernzieltheorie ablehnen ], [ - sollte dialogisch/pragmatisch ausderichtet sein - sollte die Probleme der SuS zum Zentrum des Philosophieunterrichts machen ]) ][*#ix("Tiedemann-Gefert-Kontroverse", "Tiedemann-Gefert-Kontroverse", "<NAME>", "<NAME>")* #text(fill: black)[Sind #ix("präsentativ-symbolische", "Form, präsentativ-symbolisch") und/oder #ix("diskursive", "Form, diskursiv") Formen adäquate und genuin philosophische Medien/Methoden des Philosophierens?]][ Mit #ix("präsentativ-symbolischen Formen", "Form, präsentativ-symbolisch") ist die von #ix("<NAME>", "Langer, Susanne K.") weiterentwickelte Theorie von #ix("Ernst Cassierers", "Cassirer, Ernst") #ix("symbolischen Formen", "Form, symbolisch"). Die grundlegende Errungenschaft ist, dass Philosophieren nach #ix("Cassirer", "<NAME>") und #ix("Langer", "Langer, Susanne K.") nicht mehr nur an Sprache gebunden ist (textuell durch z.B. Essays und verbal z.B. durch Dialoge), sondern Menschen Medien ebenfalls Bedeutung zuweisen können, die nicht sprachlich ausgedrückt werden kann. Der Unterschied zwischen diesen #ix("diskursiven", "Form, diskursiv") und #ix("präsentativen", "Form, präsentativ-symbolisch") Formen ist Teil der #ix("Tiedemann-Gefert-Kontroverse"). #ix("Gefert", "<NAME>") behauptet, dass #ix("präsentativ-symbolische Formen", "Form, präsentativ-symbolisch") Teil des Philosophierens sein können. Die Idee ist, dass die Frage "Was bedeutet das?" für die Philosophie grundlegend ist. #ix("Tiedemann", "<NAME>") hält dem entgegen, dass Menschen eventuell in #ix("präsentativ-symbolischen Formen", "Form, präsentativ-symbolisch") denken können, aber diese nicht für die Philosophie geeignet sind.#en[Vgl. @Runtenberg2016_EPhiD[S. 42]] ][*#ix("Philosophieren mit Kindern", "Philosophieren mit Kindern", "PmK", "PwC") -- möglich oder unmöglich?*#en[Vgl. @Nordhofen1994_PmK[S. 35-46]]][ Kinder können nicht philosophieren, denn ... + *#ix("Seriösitätsargument"):* ... ihnen fehlt ein umfassendes Wissen um am philosophischen Diskurs teilzunehmen. Ein breites Wissen über traditionelle philosophische Positionen bietet die Möglichkeit, Sachverhalte besser in den Kontext philosophischer Debatten einordnen, Argumente zu analysieren und Positionen verstehen und ausdrücken zu können. Kindern fehlt dieses grundlegende philosophische Wissen, daher könnte behauptet werden, dass sie nicht am philosophischen Diskurs teilnehmen können, ohne die Philosophie so weit herunterbrechen zu müssen, dass sie "unseriös" wird.#en[Vergleiche mit dem #ix("esoterischen Selbstverständnis", "Selbstverständnis, esoterisch") der Philosophie.] Eine Grenze, wann die "Seriöstität" eintritt, welche und wie viele Werke man dazu gelesen haben muss, wird nicht gegeben. So ist fraglich, ob Oberstufenschüler, Studenten oder gar Dozenten philosophieren können, da sie gar nicht den philosophischen Diskurs in Gänze überblicken können. + *#ix("entwicklungspsychologisches Argument", "entwicklungspsychologisches Argument", "Argument, entwicklungspsychologisch"):* ... ihnen fehlen die entwicklungspsychologischen Fähigkeiten. #ix("<NAME>", "<NAME>") war Pionier der #ix("Entwicklungspsychologie") und unterteilte die menschliche Entwicklung in grobe Phasen ein. Diese Phasen können experimentell teilweise bestätigt werden. Eine Erkenntnis ist, dass abstraktes Denken durchschnittlich erst ab etwa dem 11. Lebensjahr #ix("abstrakt", "Denken, abstrakt") und #ix("hypothetisch-deduktiv", "Denken, hypothetisch-deduktiv") -- was als "wissenschaftlich" charakterisiert wird -- denken können.#en[Vgl. @SeitzSteinBerner2019_Entwicklung[S. 241]] Sind die Kinder nicht in diesem Stadium, kann man argumentieren, dass sie nicht philosophieren können. Hier kann man jedoch entgegenhalten, dass auch vor dieser Phase philosophische Ansätze im Denken von Kindern erkennbar sind und gefördert werden müssen. Nur weil diese nicht, ähnlich wie im #ix("Seriösitätsargument"), nicht in der Art des universitäten Niveaus stattfinden, spricht dies der Tätigkeit noch nicht den philosophischen Aspekt ab. + *#ix("Sprachargument"):* ... ihnen fehlt der Wortschatz der philosophischen Fachsprache, um ihre Ideen ausdrücken zu können. Philosophie ist schwer ohne Fachsprache zu denken, genau dies greift die Debatte auf. Kindern fehlt die akademisch-sprachliche Grundlage zum Philosophieren, sie sind sprachlich eingeschränkt und können ihre Gedanken aufgrund lexikalischer und grammatischer Mängel nur eingeschränkt ausdrücken. Lehnt man die Möglichkeit über #ix("präsentativ-symbolische Formen", "Form, präsentativ-symbolisch") zu philosophieren, schränkt man die Möglichkeit des Philosophierens mit Kindern stark ein. Versteht man unter Philosophie die Suche nach der Wahrheit, so ist im Gegensatz zu diskursiv-verbalen Formen fraglich, inwiefern #ix("präsentativ-symbolische Formen", "Form, präsentativ-symbolisch") einen Wahrheitsanspruch darstellen können. Es könnte behauptet werden, dass etwa ein Bild nicht "wahr" oder "falsch" sein kann. ] #task[Lassahn-Deppe-Kontroverse][ Erläutern und begründen Sie, ob Sie sich dem Philosophiedidaktiker Lassahn oder Deppe hinsichtlich der Debatte um die Aktualität von Unterrichtsinhalten der Philosophie anschließen würden. ][ In der #ix("Debatte um die Aktualität von Unterrichtsinhalten") geht es um die Aktualität von Unterrichtsinhalten. #ix("<NAME>", "<NAME>") vertritt die Meinung, dass nur ein starker Bezug auf aktuelle Themen im Unterricht angewandt werden dürfe, jedoch keine kanonischen Texte. #ix("Wolfgang Deppe", "Deppe, Wolfgang") hält dem entgegen, dass diese Position zu radikal sei und eine versteifte Position auf nur-kanonisch oder nur-aktuell nicht zielführend ist. Ich schließe mich #ix("Wolfgang Deppe", "Deppe, Wolfgang") an und bin der Meinung, dass aktuelle Themen anlässe für das Philosophieren mit Kindern sein könnten, anders herum können jedoch auch kanonische Texte auf aktuelle Themen bezogen werden. Aktuelle Themen bieten einen Bezug auf die Lebenswirklichkeit der SuS und sind daher sinnvoll zum Wecken intrinischer Motivation oder als Transferprozesse, jedoch sind kanonische Texte daher nicht auszuschließen. ] #task(key: "langer-diskursiv-präsentativ")[Diskursive vs. präsentative Formen][ Erklären Sie den Unterschied zwischen diskursiven und präsentativen Formen des Philosophierens. ][ Nach Susanne Langer können als Weiterentwicklung von Ernst Cassierers "Philosophie der Symbolischen Formen" diskursive von präsentative Symbole unterschieden werden. Diskursive Symbole sind diejenigen sprachlichen Ausdrücke, deren Bedeutung meist konventionell klar festgelegt ist. Sie stellen ihre Sachverhalte linear dar. Nacheinander wird ein diskursives Zeichen nach dem nächsten Verarbeitet: Das Subjekt kommt über das Zeichen zum durch das Zeichen ausgedrückten Objekt. So stehen die Zeichenketten "der Mond" oder "Luna" stellvertretend für den Mond und sind diskursive Symbole. Präsentative Symbole dagegen können sich, z.B. eben im Falle von Bildern, simultan darstellen, d.h. alles auf einmal. Ein Bild ist im Gegensatz zu einem Text -- sofern es nicht verdeckt ist -- immer im Ganzen zu sehen. Auch das Bild erzeugt eine Vorstellung im Kopf der Betrachtenden und hat somit eine Bedeutung. Daher können neben diskursiven Symbole, auch präsentative Symbole Bedeutungen haben. Im Gegensatz zu Präsentative lässt sich laut Langer diese Bedeutung nicht auf die Bestandteile des Bildes reduzieren. "der Mond" hat auch ohne den Satz "Der Mond ist aufgegangen." eine Bedeutung, ein Schatten jedoch ohne das Bild laut Langer nicht. Damit lassen sich auch keine Einzelbestandteile und kein "Vokabular" für präsentative Symbole anfertigen. Philosophieren in diskursiver Form ist also dasjenige, welches sich den diskursiven Symbolen bereichert -- Texten, Sprache im Allgemeinen. Sie ist linear, relativ sicher deutbar und lässt sich in kleinere bedeutungsvolle Bestandteile zerlegen. Philosophieren in symbolischer Form dagegen macht sich andere Wege zum Sammeln und Vermitteln von Eindrücken zunutze, etwa Philosophieren mittels Bildern und Filmen. Die Symbole können nicht-linear und nicht-reduzierbar sein, sie sind vieldeutig und damit sind präsentative Formen des Philosophierens grundlegend anders als diskursive Formen des Philosophierens. ] #task[Philosophieren mit Kindern][ Erklären und widerlegen Sie die drei Gegenargumente zum Philosophieren mit Kindern nach Susanne Nordhofen!#en[@Nordhofen1994_PmK[S. 35-46]] ][ Das Sprachargument unterstellt Kindern, ohne einen Grundschatz an philosophischen Fachtermini ihre Gedanken nicht ausdrücken zu können. Dies mag stimmen, jedoch ist der präsentativ-symbolische Ansatz der Philosophie eine Möglichkeit, wie man ohne Sprache, sondern über Bilder und Symbole philosophieren kann. Das entwicklungspsychologische Argument bezieht sich auf das Entwicklungsmodell von Piaget, das postuliert, Kinder können erst ab dem 11. Lebensjahr wissenschaftlich und philosophisch denken können. Das Niveau des Philosophierens mit Kindern muss jedoch nicht auf universitärem Niveau stattfinden, sondern kann auf grundlegend philosophische Interessen und Gedankengänge der Kinder beschränkt werden. Es geht um eine gezielte Förderung und Ausbildung, nicht um konkretes wissenschaftliches Arbeiten. Und das ist möglich. Da Kinder den philosophischen Fachdiskurs nicht überblicken können, ist der Philosophieunterricht mit Kindern nicht seriös, so das Seriöstitätsargument. Da aber auch gelehrte Philosophieprofessoren nicht alle philosophischen Fachtexte gelesen haben, ist fraglich, wo die Grenze der "Seriösität" zu ziehen ist. Philosophieren als Tätigkeit ist auch ohne ein Grundwissen traditioneller philosophischer Meinungen möglich. ]
https://github.com/lebinyu/typst-thesis-template
https://raw.githubusercontent.com/lebinyu/typst-thesis-template/main/template/global_style.typ
typst
Apache License 2.0
// DO WORK!!! #let styleheading(title,doc) = { show heading.where(level: 1): [ #block( inset: (top: 20pt, bottom: 10pt), block( block( stroke: (left: 12pt + blue), inset: (left: 24pt, top: 12pt, bottom: 6pt), outset: (left: -6pt), )[ #text(size: 28pt, fill: blue, title) ]) ) ] heading(level: 1, outlined: false, title) doc } #let styleheading_head(title,doc) = { show heading.where(level: 1): [ #block( inset: (top: 20pt, bottom: 10pt), block( block( stroke: (left: 12pt + blue), inset: (left: 24pt, top: 12pt, bottom: 6pt), outset: (left: -6pt), )[ #text(size: 28pt, fill: blue, title) ]) ) ] heading(level: 1, outlined: true, title) doc } #let styleheading1(title) = { show heading.where(level: 1): [ #block( inset: (top: 20pt, bottom: 10pt), block( block( stroke: (left: 12pt + blue), inset: (left: 24pt, top: 12pt, bottom: 6pt), outset: (left: -6pt), )[ #text(size: 28pt, fill: blue, title) ]) ) ] heading(level: 1, outlined: false, title) } #let styleheading_chapter(title,chaptnumber) = { show heading.where(level: 1): it => { block( inset: (top: 20pt, bottom: 10pt), block( block( stroke: (left: 12pt + blue), inset: (left: 24pt, top: 12pt, bottom: 6pt), outset: (left: -6pt), )[ #set text(font: "Technika", size: 18pt) #set par(leading: 0.5em) #counter(heading).update(chaptnumber) Chapter #text(size: 28pt, counter(heading).display()) \ #text(size: 28pt, fill: blue, it.body) ]) ) } heading(level: 1, title) }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/044%20-%20Innistrad%3A%20Crimson%20Vow/005_Episode%203%3A%20Forever%20Hold%20Your%20Peace.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 3: Forever Hold Your Peace", set_name: "Innistrad: Crimson Vow", story_date: datetime(day: 10, month: 11, year: 2021), author: "<NAME>", doc ) Stained-glass windows aren't made overnight. To make them, you must first decide what you are making—and how to make it. That alone can take the better part of months, particularly if the glazier and an artist are working together. Broad shapes and silhouettes are taken into consideration, but so too are the smaller shards tucked here and there to dazzle the eye. How many feathers upon the wings of an angel? How many scales upon the head of the serpent? How many fangs, gleaming in the treacherous light? The larger picture, the details—you must have all of them laid out before you. You must understand what you are going to make before you've even begun. Then you must begin it. Here, there are also long hours, long weeks, long months. Each feather, each scale, each fang must come from a new piece of glass colored specifically for the purpose. You'll use a blazing-hot iron to cut the pieces apart, hoping as you go that no piece cracks before its time. One by one, piece by piece, you and your underlings whiling your lives away. Even when you have all your pieces cut—perfectly rounded, sheared to size shard by shard—you are not yet done. Stained glass is too weak to stand alone. You must join the parts, which then cohere into a whole. Break the beautiful work you've made into panels: feathers, scales, fangs, all in their own spaces. Mount these onto iron, and at last, you've created your work. If you are lucky, it will last a few centuries before someone flings an angel through it. Sorin's seen many stained-glass windows in his time. He's commissioned a few himself. The process always fascinated him. Like architecture, its frequent companion, it's the work of centuries—something only he and others like him are positioned to appreciate. It is not the first time he has seen the window before him, but in this hanging-raindrop moment, he has the time to appreciate it. At its apex is <NAME>, smiling with glee, two tipped goblets of blood acting as the frame for the rest of the window. How long had it taken to complete this monument to Oliva's ego? How many arduous hours were spent shaping every curve of her lips, every jewel, every eyelash? Where the other families take opportunities like this to highlight their scions, Olivia seizes the lion's share of attention for herself. Oh, there are others sprinkled here and there—feather, scale, and tooth—but she reigns supreme throughout. From her presence at the top to her portrait in the center~to her standing now at the base of the window, arm in arm with <NAME>. #figure(image("005_Episode 3: Forever Hold Your Peace/01.jpg", width: 100%), caption: [Edgar, <NAME> | Art by: <NAME>], supplement: none, numbering: none) They made an achingly regal picture—she with her train of sorrowful spirits, he in his wedding finery. He realizes, looking at them, that these are details. His gathered relatives, looking on him with indifference; the wedding guests, as thirsty for drama as they are for blood; his plundered grandfather. One thing has led to the other, one panel into the next: vampires run rampant, he creates the angel, the angel perishes, he is humiliated, Olivia fills the void of power he's left behind. As she sips from a chalice of blood, as she points to him with a smirk on her lip, her eyes seem to say that it could have been anything. Any sign of weakness would have been enough. Any disaster befalling Innistrad would have opened enough space for her. The woman sought power the way plants sought light. The larger picture of Olivia's life has always marched toward this. "Welcome, welcome! Oh, it's such a delight to have so many guests. I simply couldn't have a wedding with the groom's side empty. It'd be such a faux pas#emph[.] " The way his grandfather dotingly pats her hand makes him want to scream. <NAME> hardly had words for his first wife when they were alive. That he would show such kindness to this woman~ A chorus of polite laughter from his extended family. They do not look at him, but he feels their derision all the same, like daggers at his throat. "Now, I'm sure you're all honored to be here, and #emph[dying ] to get to the main event. But I hope you'll forgive me; I have a little something else planned first. A little amuse-bouche, if you will, and a present for my dear Edgar. Thralls!" She snaps her fingers. At first, he thinks nothing is happening. A small flicker of hope shines somewhere within him that her thralls have finally turned against her. But she extinguishes this, too, as easily as breathing. Catching his eye, she points upward. The chandelier? A work of art no less impressive than the stained glass, but what was so special about it? From the look on her face, whatever she had in store was~ There is something else lashed to the ceiling of the grand hall. #emph[Something ] sinks lower, draped in rich red curtains. The shape reminds him of a birdcage, and he wonders if she's made someone stitch her an abomination as a gift. Given her predilection for torturing the faithful, she might have torn the wings from an angel and attached them to a choir singer. #emph[Behold, a songbird.] But as the birdcage descends, a familiar scent comes to him—angel blood. With it comes a memory: his grandfather, <NAME>, a gathered crowd of his family and their closest confidants. A fear that gripped him by the spine; the weight of expectations like stocks across his shoulders. His grandfather looking on him with pride. A cup in his hands, filled with blood. #emph[Drink and be eternal.] He didn't want to drink. The wretched smell of the stuff stained his palate with copper. And there was the angel, too, chained upside down like~ Like a bird. That day—years ago, centuries—she was still writhing. Her eyes met Sorin's not long after his grandfather's, her plea just as impassioned: #emph[Do not drink. Save me.] Time has washed away much of his memory, but her whimpering, the smell of her blood, the look on her face as his grandfather forced him to drink—these things stand like mountains against the ceaseless tides. He knows what he is going to see before the curtains drop to the floor. He does not avert his eyes. There is no cage save Sigarda's own wings, bloodied and battered, pressed so tight against her that she cannot move. Red ribbons serve to bind her instead, a mockery of her considerable strength. She does not hang upside down—but she is no more comfortable than her predecessor had been. However powerful the magic, it is difficult to stamp out an angel's spirit; he had learned this firsthand. Sigarda's struggling still. And when she looks to him from within her feathered prison it is with the same pleading look he remembered. A new face does not dull its blade. His chest aches, his tongue sticks to the roof of his mouth. #emph[Drink and be eternal] , his grandfather had said. But was this what they'd been striving for all these years? To repeat history? Another thought follows: Olivia can't have brought Sigarda here solely to serve as a gift. #figure(image("005_Episode 3: Forever Hold Your Peace/02.jpg", width: 100%), caption: [Sigarda's Imprisonment | Art by: <NAME>], supplement: none, numbering: none) The blood dripping from the angel's wounds calls to him. He knows it calls to them, too; he knows his grandfather is also a talented blood mage. Sorin's sorting through the possibilities faster than he can consciously follow, his instincts a sieve for his waking mind. If a ritual like this one was enough to convert his immediate family to vampirism, then this one~ Well, it was simple, wasn't it? If you controlled a man's blood, you controlled him. If you controlled an angel's blood, you controlled her. Granted, you'd have to be an elder vampire to handle that much power, but~if you drank that blood, made it a part of you, then you might well control angels, too. Assuming you lived. The #emph[idea ] is a simple one; to put it into practice less so. Sigarda being one of the oldest angels did much to help. But they'd need something else, something to bind the blood to its drinkers, something just as old and powerful. Ideally crafted of Moonsilver—he's never found a finer vessel for magical energy. Even Eldrazi weren't immune. Something like the Moonsilver Key Arlinn and the others were looking for. The Moonsilver Key Olivia now held in her hands, looking for all the Plane like an offering bowl. The Sungold lock was much the same; together, the two formed a sphere. Sorin watches in horror as his grandfather joins his hands to hers. Together, they hold the key to domination. <NAME> with control over all the angels in Innistrad. Eternal night hardly mattered in comparison. Innistrad could endure much—but it could not endure this. Anger and fear seize him. He fights against his restraints, but the chains only dig in deeper against his flesh. A fell procession of vampires dressed as Avacynian priests approaches. One—his high hat marking him as a Lunarch—takes his place behind the couple. Must everything here be an insult to him? Again, the eyes of the crowd are upon him, again they point to him, again they watch to see what he will do. #emph[Drink and be eternal] , his grandfather said to him. As if he had any choice in the matter. As if he had wanted to be eternal. "If you continue to decline our invitations, Sorin, we're going to stop sending them," wrote one of his aunts. As if her soirees were the most important thing in the Multiverse. "Has it ever occurred to you that you're no fun at all?" This from an uncle years ago—an uncle he sees now flanked by two women while he bleeds a slender young thrall. He laps at the blood like a cat lapping at milk. This is what he thinks of as fun. There is an #emph[angel ] hanging from the ceiling, and that man can only think of passing pleasures. Torments upon torments. Olivia hands the false priest a piece of vellum. He has the temerity to read it in a reedy, mocking voice. "Beloved guests, you have come here today to participate in the most sacred ritual on Innistrad. It is said that herons mate for life. For those such as we, eternal and unchanging, such a promise reaches beyond mortal understanding. The Lady of our most illustrious house, <NAME>, has pledged her heart to <NAME>, and he, his undying affections to her. I understand <NAME> has brought his grandfather here to be married?" "I've done #emph[no ] such thing!" Sorin protests, struggling again. The guards yank him backward. Worse—the crowd laughs. "Don't mind the boy," says Edgar. "You know how he is at parties." "No sense for hospitality," echoes Olivia. The priest smirks. "Very well. Now. The two of you can speak your vows to one another, if you've prepared them." He doesn't ask who will go first. Olivia speaks the very moment his tongue rests. "Edgar. <NAME>. We met so many centuries ago I've long forgotten the occasion—but I remember the moment I realized we should be together like it was yesterday. Sorin left your coffin unguarded, and I thought to myself, what a #emph[fool ] to leave a man like that unattended. You're in my care now, and together, we'll rule Innistrad. I promise I'll always consider your opinions for at least a moment before rejecting them, Edgar. I promise to overlook your sartorial missteps. And I promise to grant you the honor of being my husband." "Thank you, Most Illustrious Lady Voldaren. Those vows brought tears to my eyes," says the priest, who has likely not cried in centuries. "<NAME>, your vows?" Sorin snarls. The guards restraining him advance in lockstep. Momentum alone carries him closer to the altar. As one, they fling him upon the steps. He lands like a Thraben beggar upon the marble. There are only two chains now: one pulling his shoulders backward out of their sockets and binding together his arms, another coiled about his throat. He forces himself to his feet. The chain threatens to crush his windpipe. No matter. He'd endure that. He'll endure anything if it means he can tear <NAME>'s head from her body. To see her smiling down on him like this~ Thousands of years ago, <NAME> made the most important decision of Sorin's life for him. Tonight, Sorin repays the favor. Woodcutter, blacksmith, werewolf, vampire, angel—blood is blood. He calls to the darkness in the bowl, and it answers him. A blade of red-black slices through the chains as easily as any sword. Momentum sends the bowl tumbling out of their joined hands. Blood stains his shirt, his skin, his hands—but he stands unyielding before them. "I object." "Sorin," says Olivia, baring her fangs, "you're ruining my #emph[special day] ." #figure(image("005_Episode 3: Forever Hold Your Peace/03.jpg", width: 100%), caption: [Arterial Alchemy | Art by: <NAME>], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "So, I just have a question," says Chandra. Arlinn smirks. Standing outside the gates, they've had little in the way of things to do. A new set of guards replaced the old, but they're no more talkative. "What's on your mind?" "It's a vampire wedding, right?" "Right," says Kaya, sensing danger. "A vampire wedding." "Do you think there's cake in there?" Adeline half groans, half laughs. Kaya pinches the bridge of her nose. Teferi's shoulders rise and fall with his quiet chuckles. Arlinn thinks for a moment. "There has to be, right? For the thralls?" "I can't imagine they feed their servants, no," Kaya says. "Teferi, have you ever been to one of these before?" "Not a vampire wedding, no, but~" "Something similar?" Adeline asks. "Something similar," Teferi says. He rubs at his chin, then shrugs with a smile. "But, that's the thing about weddings. No matter the traditions, some things stay the same. They're all about bringing people together." "Even with vampires?" asks Chandra. Teferi nods. "Even vampires." Maybe it wouldn't be so bad when they got in. Until then, they'd have to keep freezing their toes off. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) His preternatural senses alert him to the incoming thrust a split second before it would have taken his head. A golden spear comes into view from behind him. What a dirty trick, to catch him like this. But perhaps a gift in disguise—he is going to need a weapon, after all. He snaps the spearhead off its shaft, then pulls. Before the spearman can recover his balance, Sorin wheels around, driving the sharpened blade into the recess of the man's armpit. Bone grinds against metal. It doesn't stop the spearman—but Sorin's magic does. A single held glance is enough to freeze him in place. And turn him into a shield. Guards rarely work alone. This one is no exception. A swordsman is next to try his luck, his weapon heavier than anything a human could manage. A wicked, animal grunt heralds the crunch of impact against his captive's armor. Sorin raises a brow. What #emph[was ] that thing? More cudgel than blade. If Sorin had a say in the matter he'd pick something with better balance. But he doesn't have any say in the matter—they took his sword from him when they chained him. This will have to do. He hurls the bleeding captive toward the swordsman. In an unnatural instant, he's behind the swordsman; another sees him snapping the man's neck. Sorin tears the sword away. Yes, the weight is all wrong, and no wonder—it's thick as his hand and encrusted with gold. Disgusting. Truly disgusting. Which means it's the perfect weapon to kill Olivia. Three more fall in quick succession, crushed beneath the weight of the new weapon. He doesn't pay them much attention. His captors don't matter anymore—only the woman in charge. Five more guards are closing in. He has time for one cut. It isn't going to be a beautiful one, not with this behemoth. Still, nothing else matters—not what might happen after this, not the Moonsilver Key, not the eternal night, and not the abject horror on his grandfather's face. This is far more personal. Olivia knows it, too; the instant they lock eyes, she grips the Moonsilver Key tighter than ever, as if the power locked within it might save her. Sorin raises the sword. Muscle and weight carry it on its dread arc downward, closer and closer to Olivia's flying form. No matter. He's stepping into the swing enough to make up the distance. He's going to end this here and now— At least, he'd like to. A flash of light throws him off. The starburst tip of the blade grazes Olivia's chiffon gown and gloves. Grasping for the now-falling key, Olivia is furious. Even more so when it lands out of her grasp. "Attacking a bride on her wedding day! I knew you were gauche, but this! We'll need to construct a whole new #emph[word ] for how gauche this is," she sneers down at him. His grandfather's hand lands on his shoulder. "Sorin, this is more important than you could ever imagine. We need this. The key—my word, what is #emph[that] ?" He doesn't have to look away to see it: right below Olivia's feet, the Moonsilver Key glows with an unnatural light. There, at the altar: a geist of some sort bursting from the key. No—not a geist; something else. He's seen things like this on other Planes—this is someone's spirit, separated from their body. A witch, by the shape of her headdress. "Who invited #emph[you?] #emph[" ] Olivia snaps. The spirit turns toward her. Brows knit over spectral eyes. "You did." #figure(image("005_Episode 3: Forever Hold Your Peace/04.jpg", width: 100%), caption: [Katilda, <NAME> | Art by: <NAME>ñón], supplement: none, numbering: none) Ghostly flowers entwine about the witch's arm. They grow, blossom, and die all in an instant. The spirit studies this with some interest. A simple gesture, and vines join the flowers. In only a few seconds, she's grown herself a staff—one whose many branches glow with purpose. She looks toward the angel hanging in the center of the room like a Harvesttide decoration. Disgust and horror mingle on her face. Understanding replaces it, and her burning eyes alight on <NAME>. "You would stoop so low as this?" Edgar's grip tightens on Sorin's shoulder, but his words only drive a further wedge between them. "Olivia, you must stop her!" Sorin shoves his grandfather aside. He tells himself that it isn't really Edgar talking, as if that will make it hurt less somehow. Still, one thing is clear: if Olivia has to stop the spirit, then he has to stop Olivia. With all the speed he can muster, he dashes between her and the key, meeting her head-on charge with a wild slash. Even the bite of the blade on her outstretched arms isn't enough to stop her—she keeps coming. He keeps fighting back. Sorin throws his weight toward her, a crude shove, anything to buy the spirit the time it needs. A bolt of soft, verdant light over his shoulder tells him he's successful. Olivia's claws rake his cheek, then dig in, holding his face in a bizarre parody of a loving stepmother. The fire burning in her eyes is going to be hard to extinguish. Whatever that spirit's up to, it better be good. But he hears something then, a sound that fills him with hope even as it dredges up horrible memories of his mortal life. The holy flutter of an angel's wings. He doesn't know what's coming, not exactly. But he has an idea. That bolt from earlier must have cleansed the bindings keeping Sigarda in place. Sorin smiles right back in Olivia's face. It's worth the pain of her nails digging in deeper. "I think your little party's over," he says. And he watches, delighted, as her eyes leave his to regard something behind him. Sorin throws her away, turning to face the rising angel. Making an angel is much like making stained glass: you have to know what she will be before you can begin. Sorin did not make Sigarda—but he knew her. And in the days before he made Avacyn—the days when he realized this was the solution he'd spent so much time seeking—he studied her. Where Bruna was thoughtful and reserved to a fault, Sigarda never let the perfect become the enemy of the good. She acted when she knew who was on the side of good and who was on the side of evil. Yet she had none of Gisela's bluster, none of her fire-and-brimstone approach to the sinners. The iron framework keeping Sigarda together was an unabashed love of humankind. He had wanted the same for Avacyn. Or at least a simulacrum of that love, if he could not recreate it himself. Oh, there were differences. Sigarda felt too deeply, for instance, often offering mercy where ruthlessness might have better served the people of Innistrad. She was too emotional, he thought. That got in the way of her executing her duties. But looking at her now, framed by the Voldaren's stained glass window, Sorin realizes it's better that he #emph[didn] #emph['t ] make Sigarda. He never would have imbued her with this much righteous wrath. Blood streaks her wings, the air around her shimmering with golden energy. Every cut he dealt her in their fight weeps anew. But there are more, too, and he wonders just how it was that Olivia captured her. Whatever happened, they're about to be repaid tenfold. She looks down upon the congregated masses with pure, unbridled disdain. Even the oldest of the vampires quiets at the sight of her—a new symbol for something they once feared. Sigarda spreads her wings. A shock of white energy forms around her. "All of you are guilty," speaks the angel. Sorin takes a breath. It isn't enough to prepare him for what comes next. She's bright as the dawn, bright as alabaster, bright as hope—too bright to behold. Holy light blazes against his eyes. The stained glass behind her took years to bring to fruition. So, too, the panels that line the walls. How many months, how many years, how many lives went into the chandelier over their heads? It is impossible to know. Even he cannot fathom the collected years of labor represented by Olivia's twisted collection. All of it—every year, every month, every hour—shatters in an instant. The light dazzles him, but he can see the cracks as they form, veins of fire against the glass. He can't bring himself to look away even as the light sears him. There is something beautiful in all this: the larger shards, each a mirror, reflecting the eternal between them; the smaller shards, deadly snow; droplets of blood, a blasphemous rain upon the congregation. And then the force hits them. Chaos erupts like a spear through the Voldaren manor. An explosion of energy throws him off his feet. Before he knows what's happening, he's flung into a fountain of blood—and he is one of the lucky ones. Sangromancy allows him to make a shield from the falling blood to protect him from the incoming shards. Not everyone else has the skill. All around him, there are partygoers like pincushions. Sorin stands among them. In that moment, he notices two things: first, that Olivia and his grandfather are, unfortunately, mostly unharmed; second, the glass is not the only thing that's shattered. #figure(image("005_Episode 3: Forever Hold Your Peace/05.jpg", width: 100%), caption: [Sanctify | Art by: Kasia 'Kafis' Zielinska], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Chandra has a thousand questions. Adeline has five hundred answers, about two hundred guesses, and figures the others can make up the rest. Outside of <NAME>, she perches her head on her hand and watches Chandra talk. No matter how awful the circumstances, no matter how vile the place only a stone's throw away, the light in Chandra's eyes is beautiful. And it's because she's looking so closely that Adeline sees it: a new light, bright gold, one that gilds Chandra's cheeks. It looks almost~angelic. "Wait. Wait, what's that?" Adeline looks over toward the manor. The light's coming from inside the building. The invitation wards are crumbling. Chandra grins. "Looks like the party's getting started."
https://github.com/sa-concept-refactoring/doc
https://raw.githubusercontent.com/sa-concept-refactoring/doc/main/chapters/abbreviateFunctionTemplate.typ
typst
#import "@preview/tablex:0.0.4": tablex, colspanx, rowspanx, cellx, hlinex #let refactoring_name = "Abbreviate Function Template" = Refactoring — #refactoring_name <abbreviate_function_template> For this refactoring, another subset of the first idea (@idea_requirement_transformation) is implemented. It replaces explicit function template declarations with abbreviated declarations using `auto` parameters. This tweak helps reduce the number of lines and makes the code more readable. @second_refactoring_capabilities shows examples of what this refactoring is able to do. A detailed analysis, including call-site implications, can be found in @abbreviate_function_template_analysis. Implementation details are discussed in @abbreviate_function_template_implemenation and limitations are explored in @abbreviate_function_template_limitations. Finally, the usage of the refactoring is shown in @abbreviate_function_template_usage. #figure( table( columns: (1fr, 1fr), align: horizon, [*Before*], [*After*], [ ```cpp template <typename T> auto f(T param) ``` ], [ ```cpp auto f(auto param) ``` ], [ ```cpp template <typename ...T> auto f(T ...p) ``` ], [ ```cpp auto f(auto ...p) ``` ], [ ```cpp template <std::integral T> auto f(T param) ``` ], [ ```cpp auto f(std::integral auto param) ``` ], [ ```cpp template <std::integral T> auto f(T const ** p) ``` ], [ ```cpp auto f(std::integral auto const ** p) ``` ], ), caption: [Capabilities of the "#refactoring_name" refactoring], ) <second_refactoring_capabilities> #pagebreak() == Analysis <abbreviate_function_template_analysis> The analysis looks at the captured elements (@second_refactoring_captured_elements), call site implications (@call_site_implications), and the impact of the refactoring on the abstract syntax tree (@second_refactoring_ast). === Preconditions The refactoring should be as defensive as possible and only apply when it is clear that it will apply correctly. In @abbreviate-function-template-preconditions checks are explained which are made during the preparation phase to ensure the refactoring feature can be applied. #figure( table( columns: (1fr, 1.5fr), align: start, [*Check*], [*Reasoning*], [ A template definition needs to be in place. ], [ If the template definition is not present the logic of this refactoring can not be applied. ], [ The template type parameter is not used multiple times, e.g. #[ #set text(size: 0.9em) #v(-4mm) ```cpp template<typename T> void f(T p1, T p2) {} ``` ] ], [ If the type parameter is used in the body it cannot be replaced with an `auto` param. ], [ The order of template parameters is the same as their occurrence as function parameters, e.g. #[ #set text(size: 0.9em) #v(-4mm) ```cpp template<typename T, typename U> void f(T p1, U p2) {} ``` ] ], [ The function signature would change otherwise. ], [ The parameter type is not used within a container \ (e.g. `map`, `set`, `list`, `array`) ], [ The `auto` keyword cannot be used in this context. ], [ No `requires` clause should be present. ], [ As the refactoring is removing the type parameter the `requires` clause would not be valid anymore. ] ), caption: [ Checks made during the preparation phase of the \"#refactoring_name\" refactoring ], ) <abbreviate-function-template-preconditions> #pagebreak() === Captured Elements <second_refactoring_captured_elements> @second_refactoring_captured_elements_figure shows the captured elements and their purpose. A reference to them is stored as a member of the tweak object during the preparation phase and used during the application phase. #figure( tablex( columns: 2, auto-vlines: false, ```cpp template <std::integral T> ^^^^^^^^^^^^^^^^^^^^^^^^^^ auto f(T param) -> void {} ```, [ *Template Declaration* \ Will be removed. ], ```cpp template <std::integral T> ^^^^^^^^^^^^^ auto f(T param) -> void {} ```, [ *Template Parameter Restriction* \ Will be used in the parameter type replacement. ], ```cpp template <std::integral T> auto f(T param) -> void {} ^ ```, [ *Parameter Type* \ Will be replaced with template parameter \ restriction and ```cpp auto```. ], ), caption: [Elements captured for the "#refactoring_name" refactoring], ) <second_refactoring_captured_elements_figure> === Call Site Implications <call_site_implications> The refactoring must not change the signature of the target method. In regard to this specific refactoring, the order of type parameters must stay the same. This is only the case if the `auto` parameters are in the same order as their original template parameters. For example the two methods in @call_site_differences result in two different signatures. When calling these methods with ```cpp foo<int, float>(1.0, 2)``` only the version on the left would compile, as the types of the arguments would be `float` for `param1` and `int` for `param2`. The second version would be the opposite, `int` for `param1` and `float` for `param2`, which then breaks the call as the parameter types do not match. #figure( kind: image, grid( columns: (auto, auto), gutter: 1em, align(start)[ ```cpp template<typename T, typename U> auto foo(U param1, T param2) ``` ], align(start + horizon)[ ```cpp auto foo(auto param1, auto param2) ``` ] ), caption: [Example to illustrate call site differences of auto parameters], ) <call_site_differences> // COR Andere Einschränkungen? #pagebreak() === Abstract Syntax Tree <second_refactoring_ast> As can be seen in @second_refactoring_ast_figure, the AST transformation of this refactoring is very minimal. The only change is that the explicit type parameter name is replaced with a generated one. It is interesting to see how abstract the AST really is in this case. It does not reflect the source code as closely as in the AST of the previous refactoring (@first_refactoring_ast_analysis). The `template` is not represented as a separate node, instead its information is stored in the `TemplateTypeParam` node. Therefore, the AST structure does not change, only the information within the node is. #figure( tablex( columns: (5pt, 160pt, 30pt, 240pt), align: center + horizon, auto-vlines: false, auto-hlines: false, [], [ *Before* ], [], [ *After* ], hlinex(), [], ```cpp template<std::integral T> auto f(T param) -> void {} ```, [], ```cpp auto f(std::integral auto param) -> void {} ```, hlinex(), colspanx(4)[#image("../images/ast_second_refactoring.png")], ), caption: [Example AST tranformation of "#refactoring_name" refactoring], ) <second_refactoring_ast_figure> #pagebreak() == Implementation <abbreviate_function_template_implemenation> The most challenging part of this refactoring was figuring out where template parameters are being used, as the refactoring only applies if there is exactly one usage of the parameter and that usage is as a function parameter type. Initially, it was tried to perform a symbol lookup in the index clangd holds, but this led to no results. This is very likely due to the target being a template parameter, which has no proper symbol ID in the context of the template declaration, as it is not a concrete instance of a type. Afterward, the way the "find references" LSP feature is implemented in clangd was analyzed. It uses a helper class called `XRefs` which implements a `findReferences` function that can deal with template functions. Unfortunately, the result of this method call cannot be traced back to the AST. In the end, the `findReferences` call is only used to find the number of references to a given template parameter. This number is an important point of reference to see if the refactoring applies. - #[ If there is *only one reference*, it would mean that the template parameter is declared but never used. In this case, the refactoring cannot apply, since the template parameter would cease to exist, resulting in a different function signature. ] - #[ If there are *exactly two references*, it means that one of those is the definition and there is at least one usage of it. Figuring out if the usage is a function parameter is done in a later step. ] - #[ If there are *more than two references*, it means that there are either two function parameters with the same type or there is at least one usage outside of function parameters (for example the body of the function). In both cases the refactoring cannot apply, since replacing both usages with `auto` would result in two template parameters where there used to be just one, thus changing the function signature. ] As a next step, the function parameters are iterated over to verify that each template parameter type occurs as a function parameter and that the order is the same. In addition, the type qualifiers are extracted, which consist of reference kind, constness, pointer type, and array specifiers. Function parameters are not supported for now, since their qualifiers are structured quite differently. The application phase is rather simple in comparison. In a first step, the template declaration is removed, and in a second step, the types of the function parameters are updated. The information needed for this has been collected during the preparation phase. #[ #set heading(numbering: none) === Testing A lot of manual tests were performed using a test project. Debug inspections were performed often to verify assumptions. Unit tests were also written as described in @testing, which consist of a total of 14 tests, 4 of them availability tests, 4 unavailability tests and 6 application tests. This is a similar extent to which existing refactorings are tested. === Pull Request The implementation has been submitted upstream as a pull request @pull_request_of_second_refactoring and as of #datetime.today().display("[month repr:long] [year]") is awaiting review. ] == Limitations <abbreviate_function_template_limitations> There are limits to this refactoring. Some of them are given by the language or compiler and some are intentional, because otherwise the scope of the refactoring would have increased drastically. === Templated Function Parameters If a function parameter is a templated parameter like ```cpp std::vector<T>``` the refactoring cannot apply. // TODO: Ask Corbat if he knows why. I could not find the source of the error message. The reason for this is that `auto` cannot be used as a template argument. #figure( ```cpp template <typename T> void foo(std::vector<T> param) ```, caption: "Templated function parameter", ) === Template Arguments Used Multiple Times This is an inherit limitation of the refactoring. If for example the same template parameter is used for multiple function parameters, it means that all of them will have the same type when instantiated. Would they be replaced with `auto`, each of them would result in a different type. This limitation also applies if the template argument is used anywhere else. This includes the return type and the body of the function. Replacing one template parameter with multiple `auto` keywords likely breaks the behavior of the function. #figure( ```cpp template<std::integral T> auto foo(T param, T anotherParam) -> void {} ```, caption: "Template argument used for multiple function parameters", ) === Requires Clauses Functions with `requires` clauses are not supported. As a workaround the previously implemented refactoring (@inline_concept_requirement) can be used first. #figure( ```cpp template <typename T> void f(T) requires foo<T> {} ```, caption: "Function template with requires clause", ) #pagebreak() == Usage <abbreviate_function_template_usage> The refactoring is available as a code action for language server clients. To use it the cursor can be placed anywhere within the function. === VS Code To use the feature the user needs to hover over any part of the function, then right click to show the code options. To see the possible refactorings the option "Refactor..." needs to be clicked and then the newly implemented refactoring "Abbreviate Function Template" will appear within the listed options. How this can look like is shown in @abbreviate_function_template_usage_in_vs_code. #figure( image("../images/abbreviate_function_template_usage_in_vs_code.png", width: 50%), caption: [Screenshot showing the option to abbreviate a function template in VS Code], ) <abbreviate_function_template_usage_in_vs_code> === Neovim @abbreviate_function_template_usage_in_vim shows how the refactoring looks like before accepting it in Neovim. The cursor can be placed anywhere within the function before triggering the listing of code actions. #figure( image("../images/abbreviate_function_template_usage_in_neovim.png", width: 80%), caption: [Screenshot showing the option to abbreviate a function template in Neovim], ) <abbreviate_function_template_usage_in_vim>
https://github.com/Astro36/Astro36
https://raw.githubusercontent.com/Astro36/Astro36/main/Resume_Park_KR.typ
typst
#let black100 = black #let black90 = white.darken(90%) #let black80 = white.darken(80%) #let black70 = white.darken(70%) #let accent_darken = rgb("#662549") #let accent_lighten = rgb("#AE445A") #let accent_underline = rgb("#FFF8E3") #set document(title: "박승재", author: "박승재") #set page(numbering: "1", number-align: center) #set text(font: "NanumSquare", fallback: false, size: 11pt, fill: black100) #set par(leading: 0.8em, justify: true) #show heading.where(level: 1): it => text(size: 24pt, it.body) #show heading.where(level: 2): it => block( above: 1.8em, below: 1.2em, text(size: 16pt, fill: accent_darken, smallcaps(it.body)), ) #let label(body) = text(weight: "bold", size: 0.8em, fill: accent_lighten)[[#body]] #let note(body) = text(size: 0.8em)[(#body)] #let accent(body) = underline(stroke: 6pt + accent_underline, offset: -2pt, evade: false, background: true)[#body] #let pill(body) = box( baseline: -1pt, stroke: 0.5pt + black, radius: 1pt, inset: (x: 2pt), outset: (y: 2pt), )[#text(size: 8pt, body)] #let tile(title, date, body) = block(spacing: 1em)[ #grid( columns: (105pt, 1fr), text(size: 0.9em, fill: black80)[#date], [#title \ #text(fill: black90)[#body]], ) ] = 박승재 #block(above: 1.5em)[ #text(size: 12pt, fill: black90)[ 컴퓨터는 마법으로 돌아가지 않는다. 원리에 집중하자. ] ] #block[ #text(size: 10pt, fill: black80)[ 만 23세 \ <EMAIL> \ https://github.com/Astro36 \ ] ] #place( top + right, image("assets/profile.jpg", width: 3cm), ) == 학력 #tile( [#link("https://www.yonsei.ac.kr/")[*연세대학교 석사*] 재학], "2024.09 ~", [ 일반대학원 #link("https://ai.yonsei.ac.kr/")[#accent[인공지능학과]] 석사과정 ], ) #tile( [#link("https://www.inha.ac.kr/")[*인하대학교 학사*] 졸업], "2019.03 ~ 2024.08", [ #link("https://ice.inha.ac.kr/")[#accent[정보통신공학]] 전공, #link("https://gfiba.inha.ac.kr/")[#accent[글로벌금융학]] 부전공 \ 학점 4.41/4.5, #accent[석차 2/189] ], ) #tile( [#link("https://www.inha.ac.kr/")[*백석고등학교*] 졸업], "2016.03 ~ 2019.02", [], ) == 교육이력 #tile( [#link("https://www.swmaestro.org/")[*SW마에스트로 제11기 연수과정 수료*], 창의도전형 SW인재육성 정부지원 사업], "2020.05 ~ 2020.12", [ 자연어 빅데이터를 이용한 한글 교정 및 점진적 성능 향상이 가능한 #accent[불법 스팸·매크로 탐지 솔루션] 개발(Python, C++) \ 창업, 프로그래밍, AI 멘토링 교육 이수 \ #link("https://www.msit.go.kr/")[과학기술정보통신부], #link("https://www.iitp.kr/")[정보통신기획평가원] 주관 / #link("https://www.fkii.org/")[한국정보산업연합회] 운영 ], ) #tile( [*제4회 국가슈퍼컴퓨팅 청소년캠프 수료*, 고등학생 슈퍼컴퓨팅 인재발굴 사업], "2018.07", [ 베어울프 타입 슈퍼컴퓨터 강의, MPI 병렬 프로그래밍 실습, AI, 드론 활용 교육 \ #link("https://www.kisti.re.kr/")[한국과학기술정보연구원], #link("https://www.unist.ac.kr/")[UNIST] 주관 ], ) == 수상 및 사회경험 #tile( [#link("https://kbig.kr/portal/kbig/keybiz/creatorcamp/info.page")[*2023 데이터 크리에이터 캠프*], #accent[우수상]], "2023.09 ~ 2023.12", [ 빅데이터 멘토링 해커톤: 딥러닝 #accent[음식 이미지 분류] 챌린지 \ #link("https://kbig.kr/")[K-ICT 빅데이터센터] 주최 / #link("https://www.msit.go.kr/")[과학기술정보통신부], #link("https://www.nia.or.kr/")[한국지능정보사회진흥원] 주관 ], ) #tile( [*풀스택 프리랜서 개발자*], "2019.09 ~ 2020.01", [ INSIGHT: 인공지능 멘탈 헬스케어 솔루션 스타트업, #label[1천만 원 프로젝트] \ #accent[안드로이드 앱] 및 인공지능 모델 #accent[API 서버] 개발 ], ) #tile( [*KAIST Creative Team Coding Challenge*, #accent[우수상]], "2018.03", [ 중·고등학생 소프트웨어 프로젝트 공모전 \ #link("https://www.kaist.ac.kr/")[KAIST], #link("https://kr.ncsoft.com/")[NCSOFT] 주최 / #link("https://gifted.kaist.ac.kr/")[KAIST 과학영재교육연구원] 주관], ) == 자격증 #block(spacing: 1em)[ #grid( columns: (105pt, 1fr), [#link("https://www.pqi.or.kr/inf/qul/infQulBasDetail.do?qulId=433")[리눅스마스터 2급]], text(fill: black90)[#link("https://www.ihd.or.kr/")[한국정보통신진흥협회], 2023.12], ) ] #block(spacing: 1em)[ #grid( columns: (105pt, 1fr), [#link("https://www.pqi.or.kr/inf/qul/infQulBasDetail.do?qulId=430")[디지털정보활용능력]], text(fill: black90)[ 스프레드시트 고급, #link("https://www.ihd.or.kr/")[한국정보통신진흥협회], 2012.12 \ 워드프로세서 중급, #link("https://www.ihd.or.kr/")[한국정보통신진흥협회], 2012.04 \ 프리젠테이션 고급, #link("https://www.ihd.or.kr/")[한국정보통신진흥협회], 2011.09 \ ], ) ] == 동아리 #tile( [#link("https://inhabluechip.com/")[*블루칩 뮤추얼펀드*], 인하대학교 주식투자 동아리], "2023.03 ~ 2024.06", [ #accent[리서치 팀장] 및 펀드 매니저#note[2024.01 \~ 2024.06], #label[#link("https://fund.inhabluechip.com/")[펀드 운용규모 최고금액]: 4천만 원] \ #link("https://www.youtube.com/@bluechipmutualfund7790")[기업분석 세미나#note[YouTube]] 발표, #link("https://inhabluechip.com/forum/view/259643")[기업분석 보고서] 작성 및 #link("https://www.incheonilbo.com/news/articleList.html?sc_sub_section_code=S2N28")[인천일보] 기고 ], ) #tile( [#link("https://int-i.github.io/")[*인트아이*], #link("https://ice.inha.ac.kr/ice/2247/subview.do")[인하대학교 정보통신공학과] 프로그래밍 소모임], "2019.03 ~ 2024.08", [#accent[소모임 회장]#note[2023.07 \~ 2024.03], 프로그래밍 스터디 모임 및 블로그 운영, \ #label[블로그 조회수: 총 24만 회, 월 9천 회]], ) #tile( [#link("https://www.inhabas.com/")[*IBAS*], 인하대학교 빅데이터 학술동아리], "2022.09 ~ 2023.06", [빅데이터 및 인공지능 논문 리뷰 스터디], ) #tile( [*#link("https://ice.inha.ac.kr/ice/2247/subview.do")[인하대학교 정보통신공학과] #link("https://ice.inha.ac.kr/ice/2246/subview.do")[학생회]*], "2019.03 ~ 2023.06", [] ) #tile( [#link("https://prography.org/")[*Prography 4기 \~ 5기*], 연합 IT프로젝트 동아리], "2019.03 ~ 2020.02", [ #accent[프론트엔드・백엔드 개발자] 트랙, 심리상담사 매칭 플랫폼 및 힐링 음악 앱 개발 \ 안드로이드 앱 및 API 서버 담당(풀스택) / 서버와 PG사 결제 API 연동 업무 수행 ], ) #tile( [#link("https://cafe.naver.com/websinha")[*WEBS*], #link("http://startup.inha.ac.kr/")[인하대학교 창업지원단] 소속 창업동아리], "2019.03 ~ 2019.12", [], ) == 보유기술 #block(spacing: 1em)[ #grid( columns: (105pt, 1fr), [프로그래밍 언어], text(fill: black90)[C++, Java, Kotlin, JavaScript, TypeScript, Python, Rust, Dart], ) ] #block(spacing: 1em)[ #grid( columns: (105pt, 1fr), [플랫폼 & 프레임워크], text(fill: black90)[ Arduino, Spring, Android, Node.js, Flutter \ AI: TensorFlow, PyTorch \ DevOps: Docker ], ) ] #block(spacing: 1em)[ #grid( columns: (105pt, 1fr), [데이터베이스], text(fill: black90)[MySQL, PostgreSQL, MongoDB], ) ] == 프로젝트 #tile( [#link("https://fund.inhabluechip.com/")[*BCMF NAV*], 동아리 프로젝트 #pill[Tailwind CSS] #pill[GitHub Actions]], "2024.01", [ 교내 주식투자 동아리에서 운영하는 블루칩 뮤추얼펀드의 주당순자산가치(NAV)와 총운용자산(AUM)를 매일 계산해서 보여주는 서비스(반응형 디자인) #stack( dir: ltr, spacing: 1em, image("assets/bcmf_nav_0.png", height: 7.5cm), image("assets/bcmf_nav_1.png", height: 7.5cm), ) ] ) #tile( [#link("https://play.google.com/store/apps/details?id=me.astro36.mystock")[*Stock Earnings Calendar*], 토이 프로젝트 #pill[Flutter]], "2023.06 ~ 2023.07", [ 관심기업의 주가와 실적 발표일을 보여주는 달력, Google Play에 업로드 #stack( dir: ltr, spacing: 1em, image("assets/mystock_0.png", width: 33%), image("assets/mystock_1.png", width: 33%), image("assets/mystock_2.png", width: 33%), ) ] ) #tile( [#link("https://github.com/Astro36/ICE3015-project")[*Self-Balancing Robot*], 교과목 프로젝트 #pill[C++]], "2023.05 ~ 2023.06", [ PID 제어기를 이용한 2륜 자가균형 로봇, ATmega4809와 MPU6050 센서 사용, 외부 라이브러리 없이 데이터시트를 참고해 구현, _임베디드시스템설계: 최종 프로젝트_ #stack( dir: ltr, spacing: 1em, pad(top: 1em)[#image("assets/ice3015.png", width: 33%)], image("assets/ice3015_circuit.png", width: 66%), ) ] ) #tile( [#link("https://github.com/Astro36/ICE3016-miniproject")[*3D Product Catalog*], 교과목 프로젝트 #pill[C++]], "2022.12", [ 3D 제품 반응형 카탈로그, OpenGL과 Blender(모델링) 이용, _컴퓨터그래픽스설계: 미니 프로젝트_ #stack( dir: ltr, spacing: 1em, image("assets/ice3016_0.png", width: 50%), image("assets/ice3016_1.png", width: 50%), ) #stack( dir: ltr, spacing: 1em, image("assets/ice3016_2.png", width: 50%), image("assets/ice3016_3.png", width: 50%), ) ] ) #tile( [#link("https://github.com/ICE-LIFE/ICE-LIFE-Backend")[*ICE Market*], 학생회 프로젝트 #pill[React] #pill[Spring] #pill[MySQL]], "2022.07 ~ 2022.08", [ 정보통신공학과 온라인 중고장터 서비스, 학생회 공약 실행 \ #accent[팀 프로젝트] - 역할: Docker와 NGINX 세팅, Spring 웹 소켓을 이용한 1대1 채팅 API 구현 #image("assets/icemarket.png", width: 100%) ] ) #tile( [#link("https://github.com/Astro36/qp")[*Quick Pool*], 오픈소스 #pill[Rust]], "2021.11 ~ 2021.12", [ 고성능 비동기 Generic Pool, 자원할당 Queue에 Lock-free 자료구조 적용, \ #label[다운로드: 2.1천 회] #stack( dir: ltr, spacing: 1em, image("assets/qp_0.png", width: 50%), image("assets/qp_1.png", width: 50%), ) ] ) #tile( [*Spree*, 창업 #pill[Django] #pill[TensorFlow] #pill[C++]], "2020.07 ~ 2020.12", [ 자연어 빅데이터를 이용한 한글 교정 및 점진적 성능 향상이 가능한 불법 스팸・매크로 탐지 솔루션, _IITP-2020-SW마에스트로과정_, \ #accent[팀 프로젝트] - 역할: CNN 기반 스팸 메시지 분류 모델 설계, 학습된 모델을 C++ 라이브러리 형태로 포팅해 배포 ] ) #tile( [#link("https://github.com/Astro36/kotka")[*└ Kotka*], 오픈소스 #pill[Python]], "2020.07 ~ 2020.08", [ #box(inset: (left: 1em))[ 데이터 Augmentation을 위한 한글 난독화 도구, _IITP-2020-SW마에스트로과정_ ] #stack( dir: ltr, spacing: 1em, image("assets/spree_2.png", width: 50%), image("assets/spree_1.png", width: 50%), ) #stack( dir: ltr, spacing: 1em, image("assets/spree_0.png", width: 50%), image("assets/spree_3.png", width: 50%), ) ] ) #tile( [*Shim*, 창업 #pill[Android] #pill[Express.js] #pill[MySQL]], "2019.09 ~ 2020.02", [ 심리상담사 매칭 플랫폼 및 힐링 음악 앱, Prography 4\~5기 \ #accent[팀 프로젝트] - 역할: 안드로이드 앱 및 API 서버 개발, 서버와 PG사 결제 API 연동 업무 수행 #image("assets/shim.png", height: 11cm) ] ) #tile( [*Care U*, 해커톤 #pill[Flutter] #pill[TensorFlow]], "2020.01", [ 컴퓨터 비전 기술을 활용한 공유킥보드 사고 예방 솔루션, _2020 슈퍼 챌린지 해커톤_ \ #accent[팀 프로젝트] - 역할: TensorFlow Lite 모델을 실행하는 Flutter 앱 개발 #stack( dir: ltr, spacing: 1em, image("assets/careu_0.png", height: 5.5cm), image("assets/careu_2.png", height: 5.5cm), ) #stack( dir: ltr, spacing: 1em, image("assets/careu_1.png", height: 5.5cm), image("assets/careu_3.png", height: 5.5cm), ) ] ) #tile( [*Hyeyum*, 교과목 프로젝트 #pill[Express.js] #pill[Python]], "2019.11 ~ 2019.12", [ Google 음성 인식 API를 이용한 언어 습관 교정 로봇, _창의적 정보통신공학설계: 최종 프로젝트_ #image("assets/hyeyum.png", height: 8cm) ] ) #tile( [#link("https://github.com/int-i/brainha-demo-server")[*BraInha*], 해커톤 #pill[Android] #pill[Express.js] #pill[MySQL]], "2019.11", [ 교내 전공 공부 Q&A 플랫폼 앱, _2019 인하 SW 해커톤_ \ #accent[팀 프로젝트] - 역할: Docker와 NGINX 세팅, API 서버 개발 #stack( dir: ltr, spacing: 1em, image("assets/brainha_0.png", width: 33%), image("assets/brainha_1.png", width: 33%), image("assets/brainha_2.png", width: 33%), ) ] ) #tile( [#link("https://github.com/watchdocs")[*WATCH_DOCS*], 해커톤 #pill[Vue.js] #pill[Express.js] #pill[MongoDB]], "2019.08", [ WaykiChain Smart Contract를 이용한 비즈니스 문서 관리 서비스, _Huobi Korea X WaykiChain Hackathon_ \ #accent[팀 프로젝트] - 역할: Vue.js를 이용한 서비스 웹 페이지 개발 #image("assets/watchdocs.png", width: 100%) ] ) #tile( [#link("https://github.com/Astro36/kodict")[*Kodict*], 오픈소스 #pill[Rust]], "2018.11 ~ 2019.02", [효율적 탐색을 위한 한국어 국어사전 자료구조 구현 및 국어사전 크롤러 제공, \ #label[다운로드: 2.6천 회]] ) #pagebreak() #tile( [#link("https://github.com/Astro36/kokoa")[*KokoaNLP*], 공모전 #pill[Node.js]], "2018.04 ~ 2018.07", [ 비지도 학습 기반의 한국어 자연어 처리 도구, _2018 한국정보올림피아드 공모부문_ #image("assets/kokoanlp.png", width: 100%) ] ) #tile( [#link("https://github.com/Astro36/touch-music")[*Touch Music*], 공모전 #pill[Electron] #pill[Python]], "2018.03", [ 마인드맵 형식의 음악 검색 서비스, _2018 KAIST Creative Team Coding Challenge_, #label[우수상] \ #accent[팀 프로젝트] - 역할: Melon 노래 가사 크롤링, Word2Vec을 이용한 노래 스타일 분석 알고리즘 개발, Electron 앱 개발 #image("assets/touchmusic.png", width: 100%) ] ) #align(right)[ #text(size: 9pt, fill: black70)[ _(최종 수정: #datetime.today().display("[year].[month]"), #link("https://typst.app/")[Typst]로 작성됨)_ ] ]
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/build-drivetrain-fixes.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Build: Drivetrain Fixes", type: "build", date: datetime(year: 2023, month: 8, day: 5), author: "<NAME>", witness: "Violet Ridge", ) After testing our drivetrain and discovering several issues with it, we began to fix them. #grid( columns: (1fr, 2fr), gutter: 20pt, [ The first issue we fixed was structural. We noticed that the spacers used as boxing for the C-channel were not snug, and were able to spin freely. This meant that they weren't taking load, and were effectively useless. We fixed this by finding the correct spacer configuration, which was added up to 0.875". We then replaced the existing spacers with white nylon ones. ], image("../assets/drivetrain/boxing.jpg"), ) #grid( columns: (2fr, 1fr), gutter: 20pt, image("../assets/drivetrain/new-bracing.jpg"), [ The second issue was also structural. The ends of the C-Channel on our drivetrain were only held together by a 1.5" standoff and a 0.375" nylon spacer. We decided to double this in order to increase the squareness of the drive.], ) #grid( columns: (1fr, 2fr), gutter: 20pt, [ The third issue had to do with the motor inserts coming out while driving. Our old configuration involved just a single motor insert, but the space between the motor cartridge and the C-channel is too large, and therefore allows the insert to come out, disengaging the motor from the axle. We solved this problem by adding an extra 1/16" spacer between the insert and the C-channel, and that solved the issue. ], image("../assets/drivetrain/motor-spacing-fix.svg"), ) #grid( columns: (1fr, 2fr), gutter: 20pt, [ We then addressed the issue of how difficult it was to control the drivetrain. We decided to substitute the omni wheels in the middle of the drivetrain with traction wheels in order to stop us from drifting. ], image("../assets/drivetrain/build-log/traction-wheel.jpg"), ) #grid( columns: (1fr, 2fr), gutter: 20pt, [ The next issue had to do with the friction on the drivetrain. During testing we noticed that both sides of the drivetrain were drawing much more than the recommended 1W of power. We combed over the drivetrain looking for places where friction could be an issue and made the following changes: - Reduced spacing on some axles - Straightened motor mounts - Corrected axle length The most egregious issue we found was a piece of C-channel that a motor was mounted to. It's holes had been worn away, and were no longer square. This caused the motor that was mounted to it to not be straight. ], image("../assets/drivetrain/build-log/holes.png"), ) // TODO: // - discuss power draw fixes // - discuss friction fixes // - traction wheels
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cuti/0.1.0/README.md
markdown
Apache License 2.0
# Cuti Cuti is a package that simulates fake bold weight for fonts by utilizing the `stroke` attribute of `text`. This package is typically used on fonts that do not have a `bold` weight, such as "SimSun". ## Usage Please refer to the [English Demo & Doc](./demo-and-doc/demo-and-doc.pdf) located in the `demo-and-doc` directory for details. 本 Package 提供中文文档: [中文 Demo 与文档](./demo-and-doc/demo-and-doc-cn.pdf)。 ### Getting Started Quickly (For Chinese User) Please add the following content at the beginning of the document: ```typst #import "@preview/cuti:0.1.0": show-cn-fakebold #show text: show-cn-fakebold #show strong: show-cn-fakebold ``` Then, the bolding for SimHei, SimSun, and KaiTi fonts should work correctly. ### `fakebold` ```typst Fakebold: #fakebold[#lorem(5)] \ Bold: #text(weight: "bold", lorem(5)) \ Bold + Fakebold: #fakebold[#text(weight: "bold", lorem(5))] \ ``` ```typst Bold + Fakebold: #fakebold(base-weight: "bold")[#lorem(5)] \ #set text(weight: "bold") Bold + Fakebold: #fakebold[#lorem(5)] ``` ### `regex-fakebold` ```typst + RegExp `[a-k]`: #regex-fakebold(reg-exp: "[a-o]")[#lorem(5)] + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] \ #set text(weight: "bold") + RegExp `\p{script=Han}`: #regex-fakebold(reg-exp: "\p{script=Han}")[衬衫的价格是9磅15便士。] ``` ### `show-fakebold` ```typst #show text: show-fakebold Regular: #lorem(10) \ #text(weight: "bold")[Bold: #lorem(10)] ``` ```typst #show strong: it => show-fakebold(reg-exp: "\p{script=Han}", it) Regular: 我正在使用 Typst 排版。 \ Strong: *我正在使用 Typst 排版。* ``` ## License MIT License This package refers to the following content: - [TeX and Chinese Character Processing: Fake Bold and Fake Italic](https://zhuanlan.zhihu.com/p/19686102) - Typst issue [#394](https://github.com/typst/typst/issues/394) Thanks to Enter-tainer for the assistance.
https://github.com/jamesrswift/pixel-pipeline
https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/pipeline/stages/validation.typ
typst
The Unlicense
#let validation( ) = { }
https://github.com/ymgyt/techbook
https://raw.githubusercontent.com/ymgyt/techbook/master/cloud/aws/cdk/recipe/iam.md
markdown
# CDK IAM Recipe ## Policy from json ```typescript import { PolicyDocument } from "aws-cdk-lib/aws-iam"; import * as lbcPolicy from "./lbc-v2.6.1-iam-policy.json"; export const awsLbcPolicyDocument = PolicyDocument.fromJson(lbcPolicy); ``` * jsonをimportしてそのままdocumentを作れる `tsconfig.json`の`resolveJsonModule: true`が必要 ```json { "compilerOptions": { "resolveJsonModule": true }, } ``` ## IRSA Role EKS IRSA用のRole定義 ```typescript import { FederatedPrincipal, Policy, Role } from "aws-cdk-lib/aws-iam"; import { Construct } from "constructs"; import { awsLbcPolicyDocument } from "../policy/lbc/aws-load-balancer-controller-policy"; export interface LbcIamRoleProps { federatedAwsAccountId: string; federatedOidcProviderId: string; serviceAccountNamespace?: string; serviceAccountName?: string; } // IAM Role for aws loadbalancer controller export class LbcIamRole extends Construct { constructor(scope: Construct, id: string, props: LbcIamRoleProps) { super(scope, id); const { federatedAwsAccountId: accountId, federatedOidcProviderId: oidcProviderId, serviceAccountNamespace, serviceAccountName, } = props; const federated = `arn:aws:iam::${accountId}:oidc-provider/${oidcProviderId}`; const namespace = serviceAccountNamespace ?? "kube-system"; const serviceAccount = serviceAccountName ?? "aws-loadbalancer-controller"; const condition = { StringEquals: { [`${oidcProviderId}:aud`]: "sts.amazonaws.com", [`${oidcProviderId}:sub`]: `system:serviceaccount:${namespace}:${serviceAccount}`, }, }; const principal = new FederatedPrincipal( federated, condition, "sts:AssumeRoleWithWebIdentity", ); const role = new Role(this, "Role", { assumedBy: principal, description: "IAM Role for aws loadbalancer controller service account", }); const policy = new Policy(this, "Policy", { document: awsLbcPolicyDocument, }); role.attachInlinePolicy(policy); } } ```
https://github.com/Arrata-TTRPG/Arrata-TTRPG
https://raw.githubusercontent.com/Arrata-TTRPG/Arrata-TTRPG/main/src/sections/stats.typ
typst
Other
#import "../typst-boxes.typ": * = Stats Now that we've established the basic rules of dice, we can translate those into the mechanics, different parts of Characters, and the components that make them up. A stat is a composition of two elements: - *Quality*: The $C$ constant used for a conditional roll. - *Quantity*: The number of $d 6$s to roll. Stats are values that represent the capability of a single part of something or someone. They represent, in a statistical sense, the upper and lower bounds of what that part can do. == Quantity Quantity has already been defined; it is the number of dice rolled, specifically in $d 6$s. It specifies the $Y$ component of $Y d X$ or the value of the dice pool. In a more character-focused sense, Quantity represents the capacity to do what a particular stat does. It defines the upper bound for the stat's capability. Quantity is an *uncapped* value, meaning that Quantity values can be arbitrarily large, from 1 to whatever lies just below infinity. Luckily, you won't need to purchase $infinity - 1$ $d 6$s, as Arrata will almost always deal with Quantity values from 1 to 10. In rare cases, Quantities might be in excess of 20, but those are extremely rare and represent supernatural forces beyond conventional limits. == Quality Quality is the $C$ constant used for a conditional roll for the dice pool. In Arrata, Quantity comes in 3 levels: - #strong[B]asic: $C$ = 3. - #strong[A]dept: $C$ = 2. - #strong[S]uperb: $C$ = 1. When referring to the Quality of a stat, we use the capital first letter of the name of the Quality, as highlighted above. Here are a few examples of dice notation conditionals and their corresponding Quality: - $10 d 6>3$ is $B$ Quality. - $4 d 6>2$ is $A$ Quality. - $ 5d 6>1$ is $S$ Quality. Quality is special in terms of characters' stats as it represents not how much a person could do with a stat, but how easily they reach that maximum. Most stats will be of Basic Quality, being Adept or Superb means that stat is beyond conventional ability; usually representing some sort of prodigal ability or technologically advanced method. == Composition Stats in Arrata are not written in dice notation. Instead, they are composed in the format $Q Y$ where $Q$ is the letter of the Quality and $Y$ is the value of the Quantity. Additionally, there may be modifiers, which are typically appended to the front of the stat when it's being rolled. Stats that are simply being stored, say on a character sheet, should never have modifiers. Here are three example stats: #slantedColorbox( title: "Stats Outline", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Modifiers are used later, but are important to keep in mind._ $ overbracket("B", "Quality") #h(-1cm) underbracket(6, "Quantity") quad quad underbracket(100, "Quantity") #h(-0.3cm) overbracket("A", "Quality") quad underbracket("¿?!¡", "Modifiers") #h(-0.35cm) overbracket("S", "Quality") #h(-0.2cm) underbracket("40,000", "Quantity") $ ] Now that stats are defined, we can discuss what they're used for. == Checks A critical part of roleplaying is meeting something that is challenging for the character to overcome. When this happens; when an action is contested, a \textbf{Check} is called for. Dice are rolled and compared to a {\em difficulty level} to determine the outcome. Checks are the core of the vast majority of TTRPGs, and Arrata is no different in this regard. Knowing when a check occurs and what to do are critical pieces of information for GMs and players alike. Not only do they drive the story, but checks are also used to challenge aspects of characters, which allows them to discover, learn, and change. This seemingly secondary role is where you will often find the most drama, and how you choose to pursue challenges and how you guide your character's changes are what this is all about. === Success and Failure Because Arrata uses dice pools and comparisons, every die rolled is defined as either a \emph{Success} or \emph{Failure}. Quality defines the threshold for what a success is; if a die is rolled and is greater than its Quality constant, then the die rolled is counted as a success. This is done for each die you roll and the number of successes is summed up. Any die whose value is less than or equal to the Quality (value rolled $<=$ Quality) is called a failure. The sum of the failures of a roll is not usually used for anything, and the need for that operation will be stated ahead of time, so when you make a typical roll, unless specified, don't worry about summing your Failures up, just the Successes. #slantedColorbox( title: "Dice Conditionals Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Successes get probabilistically more occurrent with higher Quality._ #table(columns: (auto, auto), [Rolling $B 2$:], [$(4,2) > 3 = 1$ _Success_, $1$ _Failure_], [Rolling $A 5$:], [$(2, 6, 1, 3, 5) > 2 = 3$ _Successes_, $2$ _Failures_], [Rolling $S 4$:], [$(6, 2, 5, 4) > 1 = 4$ _Successes_, $0$ _Failures_], ) ] === Obstacle In Arrata we refer to the _difficulty level_ as *Obstacle*. When making a check, this value will be provided by the GM, by a specific subsystem, or it may not be provided at all (in which case, consider the Obstacle to be 0). Obstacle defines the lower bound of the number of successes needed to _pass_ the check. If you roll successes below this value, you will _fail_ the check. If an Obstacle value is higher than your stat's Quantity, you may attempt the check, but it may be better to seek alternative strategies. For nomenclature's sake, Obstacle is shortened to Ob $X$, where Ob stands for Obstacle and $X$ represents the value of the Obstacle for the check. For an entire check, it is written in the form _Stat_ vs _Ob_ $X$. #slantedColorbox( title: "Obstacle Examples", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note:_ vs _is a $>=$ operator, so $3$_ vs _$3$ is a Success._ #align(center)[ Rolling $B 2$ vs _Ob_ 1: $B 2 = (2, 2)>3 = 0$ Successes 0 Successes vs _Ob_ 1: _Failure..._ Rolling $A 4$ vs _Ob_ 2: $A 4 = (5, 6, 3, 5)>2 = 3$ Successes 3 Successes vs _Ob_ 2: *Success!* Rolling $S 6$ vs _Ob_ 4: $S 6 = (1, 5, 1, 2, 3, 4)>1 = 4$ _Successes_ 4 Successes vs _Ob_ 4: *Success*! ] ] === Intent When a check is called for, _Intent_ must be defined for all parties involved. It's the GM's job to sum up these Intents and put forward _outcomes_. For the GM, they should define at least two outcome: Success and Failure. If there is ambiguity, === Extra Successes When you roll past the Obstacle of a check, it might be that your GM allows for additional boons depending on your intent in the task. If you're trying to attack someone, you might deal them additional wounds, if you're haggling for a better price, you may very well rob them of a golden ring for a measly button. The magnitude of this boon shall be determined by the GM, although moderation is advised; going too far may result in more negative outcomes than expected (see: The Monkey's Paw). #slantedColorbox( title: "A Chef's Roll", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _A cook is making a large volume of stew with their $B 5$ cooking skill. The GM declares that with their ingredients, the Obstacle of the check will be Ob 2. The cook rolls and gets all 5 successes! The GM says that because the cook not only met but surpassed the Obstacle, the resultant stew is incredibly delicious, and the patrons consuming it are mesmerized._ _Note: There are no extra consequences to having successes under the Obstacle of the check._ ] == Advantage Events may occur such that a side in a check has manipulated the circumstances in their favor. We refer to this favor as _Advantage_, and multiple instances of favorable conditions induce higher levels of Advantage. For example: exploiting the environment, having a relevant Quirk, playing into your Argos, having the high ground in a fight, and getting Help from another character would all induce a level of advantage, _each_. If someone truly possessed all of those conditions, we would say they _have 5 levels of advantage_. When advantage is had, the rolling side with advantage turns their roll into an open-ended roll. In addition, if multiple sources provide a level of advantage higher than 1, or the roll was already open-ended, then the extra levels of advantage turn into $+1D$ each. With open-ended rolls, remember that any maxes of the die (6) will add $+1D$ to the roll. These 6s that have been rolled and are giving $+1D$ are also counted as successes. #slantedColorbox( title: "Advantage Example", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Open-ended rolls are denoted with a $!$ modifier._ #align(center)[ Rolling $B$3 vs _Ob_ 4 with 3 levels of advantage: $!B 3 + 2 = !(6, 4, 6, 2, 4)>3 = 4$ Successes $+ !B 2$ $4$ Successes $+ !(4, 2)>3$ $4$ Successes vs _Ob_ 4: *Success!* ] ] == Disadvantage There are also situations where the inverse may be true; the terrain is unfavorable, your Quirks are opposed to the action, it opposes your Argos, having the low ground in combat, and enemies harrying you would all induce a level of disadvantage each. Disadvantage imposes Evil dice to the roll, and is also obtained in levels. Past the first level of disadvantage, or if the roll already has Evil dice, the check will have +1 Ob imposed per level of extra disadvantage. Evil dice subtract -1 Success from rolls that result in a minimum value for a d6 (1). #slantedColorbox( title: "Disadvantage Example", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Note: Rolls with Evil Dice are denoted with a ¡ modifier._ #align(center)[ Rolling $S 5$ vs _Ob_ 3 with 2 levels of disadvantage: $¡ S 5 = (4, 1, 5, 2, 6)>1 = (3 - 1)$ Successes 2 Successes vs _Ob_ 4:_ Failure..._ ] ] == Help, All at Once There comes a time when two or more characters will be working towards the same goal at the same time. It could be that someone is attempting to help others, which is called Help, or that they're doing a sensitive task in parallel, which is called All at Once. Choose a character to act as the leader of the roll - this person should be the one who is relying the most on the other characters; the weakest link, the loudest sneak, the dumbest think. Have the non-leading characters roll first, summing the successes and failures. Subtract the failures from the successes, and give that level of advantage to the leader of the roll. If the number is negative, give that level of disadvantage instead. Also, note down a check for all characters rolling here. Here is an example of Help: #slantedColorbox( title: "Agnar's Help", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Agnar woke up at the bottom of a pit with a large boulder on top of him! He's uninjured, but at an awkward angle; luckily, his comrade Steven has arrived to help! Since Agnar is in the disadvantaged position and is the one in need of help, he'll be making this supporting roll with his A5 Power stat, and Steven will be leading the roll with his weaker B4 Power stat. The GM puts that, to free Agnar, the Ob will be 3. Failing to meet that Ob will result in the boulder crushing Agnar's foot, injuring him!_ _Agnar rolls first: 3 successes - 2 failures, a net of +1! That means Steven gets to roll with a level of advantage! Steven rolls: !(6, 1, 5, 2), 2 successes but he gets to roll an extra B1 because of the help from Agnar: (4), making 3 successes! They both roll the boulder off Agnar, an act that seems to have won Steven some free liquor tonight!_ ] And one of All at Once: #slantedColorbox( title: "All at Once", width: auto, radius: 0pt, color: black, )[ #set text(size: 8pt) _Steven hears the scraping of boots up ahead. Unfortunately, both Agnar and himself lost their weapons in the fall and will need to deploy stealth if they hope to avoid getting gutted. Unfortunately, this calls for a Stealth check, one that falls under All at Once, and Agnar has the tact and Stealthiness of a pregnant horse (B2). Steven sighs, and prepares his A6 Stealth roll. The GM declares that this Stealth check will be an Ob 4._ _He gets 5 successes - 1 failure! A net +4 advantage for Agnar! That means Agnar rolls a !B5: (6, 6, 3, 4, 1). 3 Successes so far, but he gets 2 more from the open-endedness of the roll: (4, 1). That makes 4 successes! Through some miracle, Steven manages to compensate for Agnar's bumbling mess of a stealth attempt, and they sneak past whatever's prowling these halls in one- well, two pieces._ ] #pagebreak()
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/docs/proposals/2-retrieve-text-from-document.md
markdown
Apache License 2.0
### Retrieve Text from Document The text item can be retrieved from the document, which can replace the role of `page.getTextContent()`. From declaration of pdf.js, we can see that `page.getTextContent()` returns a `TextContent` object, which contains an array of `TextItem` objects. The `TextItem` object contains the text string, the position of the text, and the font size. ```typescript /** * Page text content. */ export type TextContent = { /** * - Array of * {@link TextItem } and {@link TextMarkedContent } objects. TextMarkedContent * items are included when includeMarkedContent is true. */ items: Array<TextItem | TextMarkedContent>; /** * - {@link TextStyle } objects, * indexed by font name. */ styles: { [x: string]: TextStyle; }; }; /** * Page text content part. */ export type TextItem = { /** * - Text content. */ str: string; /** * - Text direction: 'ttb', 'ltr' or 'rtl'. */ dir: string; /** * - Transformation matrix. */ transform: Array<any>; /** * - Width in device space. */ width: number; /** * - Height in device space. */ height: number; /** * - Font name used by PDF.js for converted font. */ fontName: string; /** * - Indicating if the text content is followed by a * line-break. */ hasEOL: boolean; }; /** * Page text marked content part. */ export type TextMarkedContent = { /** * - Either 'beginMarkedContent', * 'beginMarkedContentProps', or 'endMarkedContent'. */ type: string; /** * - The marked content identifier. Only used for type * 'beginMarkedContentProps'. */ id: string; }; /** * Text style. */ export type TextStyle = { /** * - Font ascent. */ ascent: number; /** * - Font descent. */ descent: number; /** * - Whether or not the text is in vertical mode. */ vertical: boolean; /** * - The possible font family. */ fontFamily: string; }; ``` These information can be easily mapped from `typst::doc::TextItem`:
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/typstonomicon/multiple-show.md
markdown
MIT License
## Multiple show rules Sometimes there is a need to apply several rules that look very similar. Or generate them from code. One of the ways to deal with this, the most cursed one, is this: ```typ #let rules = (math.sum, math.product, math.root) #let apply-rules(rules, it) = { if rules.len() == 0 { return it } show rules.pop(): math.display apply-rules(rules, it) } $product/sum root(3, x)/2$ #show: apply-rules.with(rules) $product/sum root(3, x)/2$ ``` The recursion problem may be avoided with the power of `fold`, with basically the same idea: ```typ // author: Eric #let kind_supp = (code: "Listing", algo: "Algorithme") #show: it => kind_supp.pairs().fold(it, (acc, (kind, supp)) => { show figure.where(kind: kind): set figure(supplement: supp) acc }) ``` Note that just in case of symbols (if you don't need element functions), one can use regular expressions. That is a more robust way: ```typ #show regex("[" + math.product + math.sum + "]"): math.display $product/sum root(3, x)/2$ ```
https://github.com/emanuel-kopp/Labelyst.jl
https://raw.githubusercontent.com/emanuel-kopp/Labelyst.jl/main/README.md
markdown
MIT License
# Labelyst [![Build Status](https://github.com/emanuel-kopp/Labelyst.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/emanuel-kopp/Labelyst.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Stable](https://img.shields.io/badge/docs-dev-blue.svg)](https://emanuel-kopp.github.io/Labelyst.jl/dev/) ## Create labels containing QR-codes and human-readable codes for your experiments! The package exports one function only, `labelyst()`, which takes a `Julia` DataFrame and some additional parameters as inputs and translates it into a [Typst](https://typst.app/) file which is then, if desired, compiled into a PDF. To work with `Labelyst.jl` you need Typst installed on your computer, learn about installation [here](https://github.com/typst/typst). ## Basic usage The package is registered at the General registry and can be installed with `add Labelyst`. The input `DataFrame` needs to have one column named `ID` and one column named `label`. The `ID` column will be used to make the QR-code, it is advisable not to use too long IDs (e.g. for 500 samples, just use _s001-s500_ or something similar). The column `label` will be used for the human-readable part of the label: here one can add information about treatments, blocks or similar. Depending on the input parameters provided, one of the defined methods of `labelyst()` will be called to flexibly produce labels for different situations (i.e. pot labels, adhesive labels, ...) # Examples ## Create labels to print on adhesive paper ```julia # Create example data testdf = DataFrame( ID=["p001", "p002", "p003", "p004", "p005", "p006", "p007", "p008", "p009", "p010", "p011", "p012", "p013", "p014", "p015", "p016"], label=["label-1", "label-2", "label-3", "label-4", "label-5", "label-6", "label-7", "label-8", "label-9", "label-10", "label-11", "label-12", "label-13", "label-14", "label-15", "label-16"]) ``` ```julia # Create labels (in this example: 16 labels arranged as 8 rows and 2 columns on a DIN A4 paper) labelyst(testdf,"example_1", "a4", [8, 2]; font_size = "20pt") ``` <img src="docs/assets/example_1.jpg" width="600"> ## Create labels for pot experiments ```julia # Here: one page of size 90mm x 17mm (i.e. a typical size for a pot label) per label labelyst(testdf,"example_2", ["90mm", "17mm"]; font_size = "10pt") ``` <img src="docs/assets/example_2.jpg" width="400"> ## Multi-line labels Long label texts will print on multiple lines, and line-breaks can be forced with a double backslash (`\\`). ```julia testdf = DataFrame( ID=["p001", "p002"], label=["Treatment: red \\ Block: 2 \\ Contact: <NAME>", "Treatment: blue \\ Block: 1 \\ Contact: <NAME>"]) ``` ```julia # Create labels labelyst(testdf,"example_3", "a4", [8, 2]) ``` <img src="docs/assets/example_3.jpg" width="600">
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/tidy/0.1.0/src/styles/minimal.typ
typst
Apache License 2.0
// Color to highlight function names in #let fn-color = rgb("#1f2a63") #let get-type-color(type) = rgb("#eff0f3") #let show-outline(module-doc) = { let prefix = module-doc.label-prefix let items = () for fn in module-doc.functions { items.push(link(label(prefix + fn.name + "()"), fn.name + "()")) } list(..items) } // Create beautiful, colored type box #let show-type(type) = { h(2pt) box(outset: 2pt, fill: get-type-color(type), radius: 2pt, raw(type)) h(2pt) } #let show-parameter-list(fn, display-type-function) = { block(fill: rgb("#d8dbed"), width: 100%, inset: (x: 0.5em, y: 0.7em), { set text(font: "Cascadia Mono", size: 0.85em, weight: 340) text(fn.name, fill: fn-color) "(" let inline-args = fn.args.len() < 5 if not inline-args { "\n " } let items = () for (arg-name, info) in fn.args { let types if "types" in info { types = ": " + info.types.map(x => display-type-function(x)).join(" ") } items.push(box(arg-name + types)) } items.join( if inline-args {", "} else { ",\n "}) if not inline-args { "\n" } + ")" if fn.return-types != none { " -> " fn.return-types.map(x => display-type-function(x)).join(" ") } }) } // Create a parameter description block, containing name, type, description and optionally the default value. #let show-parameter-block( name, types, content, style-args, show-default: false, default: none, ) = block( inset: 0pt, width: 100%, breakable: style-args.break-param-descriptions, [ #[ #set text(fill: fn-color) #raw(name) ] (#h(-.2em) #types.map(x => (style-args.style.show-type)(x)).join([ #text("or",size:.6em) ]) #if show-default [\= #raw(lang: "typc", default) ] #h(-.2em)) -- #content ] ) #let show-function( fn, style-args, ) = { set par(justify: false, hanging-indent: 1em, first-line-indent: 0em) block(breakable: style-args.break-param-descriptions, [ #(style-args.style.show-parameter-list)(fn, style-args.style.show-type) #label(style-args.label-prefix + fn.name + "()") ]) pad(x: 0em, fn.description) [*Parameters:*] for (name, info) in fn.args { let types = info.at("types", default: ()) let description = info.at("description", default: "") if description == [] and style-args.omit-empty-param-descriptions { continue } (style-args.style.show-parameter-block)( name, types, description, style-args, show-default: "default" in info, default: info.at("default", default: none), ) } }
https://github.com/Rhinemann/mage-hack
https://raw.githubusercontent.com/Rhinemann/mage-hack/main/src/chapters/Quintessence.typ
typst
#import "../templates/interior_template.typ": * #show: chapter.with(chapter_name: "Quintessence") = Quintessence #show: columns.with(2, gutter: 1em) Quintessence is the raw material of reality. Technocrats refer to it as Primal Energy. It is what flows through the patterns of reality and what makes magic possible. The primal force, quintessence can not truly be divided, measured or contained. The patterns of all supernaturals, mortals, inanimate objects, and the whole of the Tellurian is woven from Quintessence. The term literally translates to "Fifth Essence". Quintessence is the same thing as Chi, Sekhem, and Gnosis. Glamour is a form of quintessence, just as diamonds are a form of carbon. Vitae is theorized by mages to be fused with Quintessence, thus explaining its supernatural properties. #block(breakable: false)[ == Quintessence Pool Every mage has a Quintessence pool. Your Quintessence pool is the free flowing Quintessence that your Avatar can accumulate and safely use, it acts as a Recourse, which means you can expend any amount of dice to roll separately, adding to the result. You can get a maximum of 10 dice in your Quintessence pool through Character Advancement. ] When casting a spell, you may set aside any number of Quintessence dice before rolling. After the dice pool for the spell was rolled, the player must roll the Quintessence dice set aside and add the highest result die to the total. After that the dice set aside are considered spent and must be recovered later. Quintessence dice may have tags attached to them, corresponding to the type of resonance of Quintessence.
https://github.com/Nerixyz/icu-typ
https://raw.githubusercontent.com/Nerixyz/icu-typ/main/experimental.typ
typst
MIT License
#import "impl.typ": fmt-timezone, fmt-zoned-datetime
https://github.com/VisualFP/docs
https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/poc/architecture.typ
typst
#import "../../../acronyms.typ": * = Architecture <poc-architecture> This chapter describes the architecture chosen for the #ac("PoC") application. == Client/Server Cut As described in @option-ui-decision, the #ac("PoC") uses Electron.js and Threepenny-GUI for its implementation. Using the client-server cut classification by <NAME> @Renzel1997ClientServerAF, the technology choice results in the application having a "remote user interface" as shown in @container-diagram. #figure( image("../../static/container_diagram.svg", width: 50%), caption: "C4 Container Diagram for VisualFP PoC" )<container-diagram> The Threepenny #ac("UI") starts a local web server from which it serves static files to the #ac("UI"). The Electron.js app doesn't contain any logic and acts as a browser. Theoretically, Threepenny could also host a regular web application, eliminating the need for an Electron app. However, Threepenny controls the browser via web sockets, so a performant server and a good network connection are required. It is recommended to avoid this, as a high latency connection would be noticeable through slow #ac("UI") updates. @threepenny_gui == Backend Components <NAME> suggests to use the C4 model to visualize the architecture of an application through diagrams on 4 levels @c4-model. The container diagram has been used to showcase the client/server cut in @container-diagram, the component diagram of the backend is shown in @component-diagram. #figure( image("../../static/component_diagram.svg", width: 90%), caption: "C4 Component Diagram for VisualFP's Threepenny UI" )<component-diagram> Splitting the backend into these three components isolates the #ac("UI") from the business logic, making either of them easily replaceable. The translation component is described in more detail in @translation-layer, the #ac("UI") component in @ui and the inference engine in @type-inference.
https://github.com/AlyamanMas/cv-and-related
https://raw.githubusercontent.com/AlyamanMas/cv-and-related/master/activites.typ
typst
#import "template.typ": * #import "@preview/codelst:2.0.1": sourcecode, sourcefile #import "@preview/tablex:0.0.6": * #show: project.with( title: "Summary of Activities", authors: ( (name: "<NAME>", email: "<EMAIL>" ), ), ) = Internships == Internship at Intelligile #text(weight: "regular")[\/ Core Engineering Team Member] #text(rgb("#444"))[Summer 2022] In this internship, I joined the Core Engineering Team and worked together on creating a cross-platform 3D engine that maps to different APIs on each platform (we worked with DirectX on Windows, Metal on macOS, and Vulkan for Linux). I learned many cooperation skills as this was a long practical internship, and I picked many technical skills from working on a very low- level project and having long discussions with my amazing mentor. = Volunteering == SWIM LEBANON #text(weight: "regular")[\/ Volunteering Member] #text(rgb("#444"))[Spring 2022] This was an event/opportunity organized by SWIM LEBANON where many of us gathered around the beach in Tripoli, Lebanon, and started cleaning it. By the end, we filled around 100 big trash cans, and the beach around Beirut Arab University and the surrounding area became much cleaner. == Alnajah Charitable Organization #text(weight: "regular")[\/ Volunteering Member] #text(rgb("#444"))[2022] This was a charitable organization that I was a part of in Lebanon. I participated in two events: 1. A visit to a refugee camp where we also donated clothes and food 2. An orphanage visit where we spent the day with the orphans and brought them gifts == HelpClub #text(weight: "regular")[\/ Volunteering Member] #text(rgb("#444"))[Fall 2022-Ongoing] HelpClub is a charity club in AUC. I have been a part of this club since I joined this University, and participated in packing events in addition to orphan visits. = Student Organizations == Open Source Community (OSC) #text(weight: "regular")[\/ President] #text(rgb("#444"))[Spring 2024-Ongoing] I am currently serving as the president of the Open Source Community club at AUC (OSC for short). I have always been an active member of this club, but being a president has significantly shifted my leadership skills and gave me an overview of what goes into organizing a complicated entity overall, from event organization, to contacts/PR, financials, marketing...
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/deco-02.typ
typst
Other
// Test stroke folding. #set underline(stroke: 2pt, offset: 2pt) #underline(text(red, [DANGER!]))
https://github.com/chamik/gympl-skripta
https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-dila/13-tezka-hodina.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/helper.typ": dilo, poezie #dilo("Těžká hodina", "hodina", "<NAME>", "", "1. p. 20. st; proletářská literatura", "Čechy", "1922", "lyricko-epické", "sbírka básní") #columns(2, gutter: 1em)[ *Téma*\ proměna autora z chlapce na muže *Motivy*\ obětování jedince pro potřeby společnosti, poukazování na bídu a důsledky války, práce, boje, činy *Časoprostor*\ doba i místo autora *Postavy* \ v každé básni jiné, typicky pro proletářskou poezii jsou to chudí lidé na okraji společnosti *Kompozice* sbírka 22 převážně sociálních básní, 3 jsou balady. *Jazykové prostředky*\ metafory, personifikace, rým sdružený a střídavý, vulgarismy, poetismy *Obsah*\ _Těžká hodina_ -- přerod z chlapce na muže _Balada o nenarozeném dítěti_ -- neschopnost uživit dítě _Slepí muzikanti_ -- jedinec se obětovává ve prospěch společnosti _Čepobití_ -- motiv válka _Tvář za sklem_ -- proletařská poezie _Kázání na hoře_ -- vybízí k spravedlnosti a lepším podmínkám pro všechny _Oči_ -- přirovnání k bráně do srdce _Jaro_ -- přirovnání přírodního jara k obrození lidské společnosti _Balada o snu_ -- proletářská poezie, kontrast dvou světů _Sloky_ -- pesimismus má být potlačen nadějí lepšího zítřka _Pohřeb_ -- smrt Wolkerovy babičky Anežky Skládalové _Muž_ -- smrt Wolkrova dědečka Jiřího Skládala _Fotografie_ -- sobeckost vyšších vrstev, proletářství _Dům v noci_ -- motiv lásky a chudoby nižších vrstev _Mirogoj_ -- válka, hřbitov, smrt … _Nevěrná_ -- nedodržená věrnost ženy muži _Odjezd_ -- pobyt Wolkera v Jugoslávii _Milenci_ -- láska a práce _Balada o očích topičových_ -- kolektivismus _Moře_ -- pobyt Wolkera u Jadranu na ostrově Krk *Literárně historický kontext*\ Toto dílo je mnohem epičtější než jeho ostatní díla. Potřeboval v něm zachytit změnu a sám řekl že "lyrika je stav a epika je čin". ] #pagebreak() #show: poezie *Ukázka -- Těžká hodina* Přišel jsem na svět,\ abych si postavil život\ dle obrazu srdce svého.\ Chlapecké srdce je písnička na začátku,\ plán pro zámek, který bys lidem jak milé dal k svátku,\ ale mužovo srdce jsou ruce a mozoly,\ které se krví svou do cihel probolí,\ aby tu stála alespoň skutečná hospoda u silnice,\ pro ušlé poutníky a pro poutnice.\ Dnes je má těžká hodina.\ Chlapecké srdce mi zemřelo a sám v rakvi je vynáším,\ a zemřelým trpě, trpím i tím,\ které mi v prsou se roditi počíná.\ Dnes je má těžká hodina;\ jedno srdce jsem pohřbil a druhé ještě nemám,\ sesláblý úzkostí, sesláblý samotou\ marně se bráním studeným stěnám\ pokoje svého\ uštěpačného.\ Milenčin dopise, lampo, kniho kamarádova,\ věci zrozené z lásky, světla a víry,\ dnes při mně stůjte a třikrát mi věrnější buďte,\ když zůstal jsem na světě sirý,\ a modlete se,\ aby mi narostlo srdce statečné a nesmlouvavé,\ a věřte dnes za mě, ţe tomu tak bude,\ a věřte dnes za mě, ţe postavím\ dle obrazu jeho\ život člověka spravedlivého.\ Já mužné srdce ještě nemám,\ sám v těžké své hodině;\ a proto nevěřím. #pagebreak()
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/layout/multiline_detect.md
markdown
MIT License
# Multiline detection Detects if figure caption (may be any other element) _has more than one line_. If the caption is multiline, it makes it left-aligned. <div class="warning"> Breaks on manual linebreaks. </div> `````typ #show figure.caption: it => { layout(size => context [ #let text-size = measure( ..size, it.supplement + it.separator + it.body, ) #let my-align #if text-size.width < size.width { my-align = center } else { my-align = left } #align(my-align, it) ]) } #figure(caption: lorem(6))[ ```rust pub fn main() { println!("Hello, world!"); } ``` ] #figure(caption: lorem(20))[ ```rust pub fn main() { println!("Hello, world!"); } ``` ] `````